|
Thanks Bill. - I already solved it please see prev post
I posted the reg expr which resolves this issue, seems like RegEx.Split has special handling for "(" and ")" so need be very carefully with that (i.e. with RegEx.Match you wont have the same problem, only with "Split")
Reg expression is such powerfull language (but ... quite hard to master and you can't really expose this via UI to end user as a result of language/expression complexity...)
dev
|
|
|
|
|
devvvy wrote: you can't really expose this via UI to end user Hi,
I just want to make sure you understand that what I am asking in my response to you refers to other developers as being "end-users." And I am speaking to the issue of code maintenance in the context of projects involving complexity and teamwork (not speaking about virtuoso code written by geniuses who will support it to their graves, and perhaps beyond).
I have personally seen cases where complex RegEx's were not fully documented, and then the person who wrote them moved on, or was a temporary consultant, or whatever, and, later, bugs developed requiring modification of the RegEx, and the effort it took on the part of the then available developers to grok the original, and make effective change was a true waste of time.
Perhaps in the ideal world, to get a beginning degree in CS, you'd have to pass a core competency test in RegEx ? I think not. And new tools, like Linq, offer alternatives that are much easier to document, and, imho, maintain. And the times now with amazing desktop CPU horsepower, and relatively vast amounts of memory, allow, I think, for a choice, at times, of high-clarity, highly maintainable, over possibly obscure, but higher-performant, code.
Which is not to say that someone could not document a complex RegEx so well that it would be easy to maintain: I've just, personally, never seen that in the "real-world."
Now if my hypothesis ... that RegEx skills are diminishing among programmers in general over the last ten, twenty, years ... is off-base: well, then 'fugedda about it'
But, I have no bias against RegEx per se, and admire its almost cryptic syntax which is so powerful, just as I once admired certain LISP small functions that, via multiple recursion, did amazing things (the problem being that in order to understand how they did what they did required you to have mental abilities equal to their, often brilliant, creators).
best, Bill
"Anyone who shows me my 'blind spots' gives me the gift of sight." ... a thought from the shallows of the deeply shallow mind of ... Bill
|
|
|
|
|
Hi,
I have a datagridview with 3 columns. In column1 I have a datagridviewcombobox which consists of country. In column2 we have datagridviewcombobox which consists of states. In column I have a datagridviewlinkbutton column when I click on the this link column it will add a new row to the datagrid. This datagridview is on placed on a tabpage of a tab control with the name tab2. When I move to tab1 and come back to tab2 then the datagridviewlinkbutton column is added again i.e., the total number of columns is now 4. But i dont want this to happen i.e., it should only have 3 columns even if i move from tab1 to tab2.
Thanks,
Ajay Chauhan
|
|
|
|
|
I have a product for which I build an MSI with VS setup solution.
Every time I want to deploy my changes the the customer I have to remote desktop to 4 machines, upload my new installer, uninstall the previous version and install the new version (run the MSI).
It's a bit tedious (particularly on 4 machines).
Is there a way I could automate the process (remote login / upload / uninstall / install) ins ome way (with PowerShell for example)?
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
You don't have to remote desktop into the machines at all. You do, have to copy the installers out to the machines, then you can either run the install command lines in quiet mode with PSEXEC or open up a CMD prompt with PSEXEC and run the same command line. The usual command line for a quiet unattended install starts with
msiexec /i myinstaller.msi /q
Since you can't see any MSI user interface, you'd have to monitor the msiexec processes using the TaskList command line tool. Something like:
tasklist /FI "imagename eq msiexec.exe"
You'll usually have 3 instances running while an install is in progress. When it's done, it'll drop down to 1 instance.
|
|
|
|
|
Thanks David, all very good tip!
I'm going to look at it!
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
i have 2 datatables (each have 158740 rows or even more)
How can i get these three things :
1) items in both datatbales on ColumnA-----> in arrayList
2) items in A not B on ColumnA
3) items in B not A on ColumnA
I mean get diffrence on ColumnA
|
|
|
|
|
select distinct ColumnA from Table1 union select ColumnA from Table2
select Table1.ColumnA from Table1 where Table1.ColumnA not in (select ColumnA from Table2)
select Table2.ColumnA from Table2 where Table2.ColumnA not in (select ColumnA from Table1)
Or something like that. SQL is getting rusty due to abhorrent Oracle exposure.
Use SqlConnection, SqlCommand, SqlDataReader to get that into .NET.
Regards,
Rob Philpott.
|
|
|
|
|
Records in Table A not in Table B
Select A.ColumnA from
A left join B
on A.ColumnA=B.ColumnA
where B.ColumnA is null
Records in Table B not in Table A
Select B.ColumnA from
B left join A
on B.ColumnA=A.ColumnA
where A.ColumnA is null
Records in both table A and B
Select A.ColumnA from
A join B
on A.ColumnA=B.ColumnA
modified 28-Nov-11 14:40pm.
|
|
|
|
|
If you mean that you have two System.Data.DataTables, then may I humbly suggest a MasterFileUpdater[^]?
|
|
|
|
|
yes it is System.Data.DataTables.
Please help!
the link i didnt get any thing usefull
|
|
|
|
|
Well, that's all I've got. You'll have to fill in the details.
|
|
|
|
|
We have a website we are showing a embedded media player. With out Media player being installed this media player object will not be shown in the website page.
For enabling media player in Windows server 2008 Destop experience feature should be installed. But When we enable this feature we are getting trouble with Windows media encoder component.
1) Is there any way to enable Windows media player without enabling the Desktop Experience feature?
2) Is there any known issues with Encoder when Desktop experience is enabled. Please suggest.
Thanks in Advance.
Chandu
|
|
|
|
|
Hi everyone, I am using Graphics.DrawString function to draw text on a Panel control modeled as a sheet of paper. The function is called more than once when there is more than one record of text to be drawn.
My problem now is how to find the location where the previous call to DrawString ended so that I can set the location of the next text to the subsequent call to Graphics.DrawString.
Another problem is how to find out whether the initial sheet is full so that the rest of the text
can be drawn on another sheet that will be created after the first one is full. Thanks.
|
|
|
|
|
Graphics.DrawString isn't going to tell you that. However, there is a similar Graphics.MeasureString which, when given a maximum width, will return the rectangular hull of the text Graphics.DrawString would paint. Make sure you give DrawString the same string and font, and a rectangle with the same width and sufficient height.
Mind you, there are some anomalies, MeasureString and DrawString don't always match up to the last pixel. Google may be able to provide more details on this.
|
|
|
|
|
Thanks Luc! I have not done it yet, if MeasureString can return the Rectangle for the text, then I believe it will really help. Just about to continue.
modified 28-Nov-11 7:12am.
|
|
|
|
|
You are going to have to keep a record of how many characters have been entered and in what fonts, then you can use the Graphics.MeasureString [^] method to find whereabouts you are on the panel.
My plan would be to use the width and height of the panel to create a Rectangle , which I would use with the DrawString method (has an overload which takes a rectangle to draw in), and just keep adding the user input to the end of the string, calculating beforehand how many characters the rectangle could hold, so that I could just use the number of characters entered to tell if I need to create a new page.
Hope this makes sense.
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
Wayne Gaylard wrote: Hope this makes sense.
Hmm. Counting characters doesn't make sense when using proportional fonts (where iiiiiiiiii and wwwwwwwwww have different width).
|
|
|
|
|
I din't really mean actually counting the characters, just meant to use MeasureString with the font used to calculate the space used. My bad, I guess my English is not up to scratch today
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
Thanks Wayne! I think this is a great way to tell whether I need another page or not. But I'm wondering how I can calculate the number of characters for a page given the font. The problem is knowing the number of words that can fit onto one line since the words will not have the same width.
If the words making up a line is known, it will also be possible to know the number of lines for the page but I don't know how.
|
|
|
|
|
AS Luc mentioned, proportional fonts is always going to be your nemesis here. The only way to tell is by having the actual string to measure. If you need to know the number before the user enters anything, maybe you could get an average to work with if you use MeasureString to find the length of a string of i's and then find the length of a string of w's and get the average of the 2, but that seems a bit of a hack.
When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman
|
|
|
|
|
A question that needs to be answered, imho, is whether you are drawing every character on the page in the same font, at the same font-size, and in the same font-style.
If you are varying font, font-size, font-style per page, I think you are going to "go nuts" using MeasureString, and there are other, better ways you could approach what you are trying to do.
You should also consider possible quality-of-rendering issues that could affect readability, if you are using DrawString to render fonts less than 12 points in size.
A suggestion: WinForms: put a RichTextBox on a Form, set 'MultiLine' to 'false (make it fairly short in width); define a ContentsResized Event handler for the ContextResized Event. Put a regular TextBox on the page into which you write out the width of the .NewRectangle property exposed by the parameter 'e in the ContextResized EventHandler.
Put a button on the Form which when clicked changes the Font of the RichTextBox. Run this project, type away, and then, at some point, click on the button that changes the RichTextBox's font. Observe what happens as your typed content exceeds the width of the RichTextBox.
Kind of like this:
private void richTextBox1_ContentsResized(object sender, ContentsResizedEventArgs e)
{
textBox1.Text = e.NewRectangle.Width.ToString();
}
private void button1_Click(object sender, EventArgs e)
{
richTextBox1.Font = new System.Drawing.Font("Arial", 36F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
} And observe what happens to the reported measurement.
Now, also, consider that at any moment you can render a bit-map from the contents of any Control.
A little more information about your scenario, please.
best, Bill
"Anyone who shows me my 'blind spots' gives me the gift of sight." ... a thought from the shallows of the deeply shallow mind of ... Bill
modified 30-Nov-11 12:35pm.
|
|
|
|
|
I am trying to add around 3000 columns to a dataset table.But it fails to add after a limit.
Is there any limitation to number of columns that can be added.If yes then what?
|
|
|
|
|
If you have to hit that limit, you've got bigger issues with your application...
It's System.Int32.MaxValue , or 2,147,483,647. But since you wont be able to reach that limit without generating an OutOfMemory Exception, it's limited by available memory.
Can't find the max columns in Datatable[^]
|
|
|
|
|
kgaurav.kumbhawat wrote: add around 3000 columns to a dataset table
I got stuck with one of these requirements a few years ago, needed to export a shed load of stress data and my favourite tool exports a datatable to CSV. I had to rewrite the method to write a CSV directly. You can find the limitations in MSDN but I don't have a link.
If you are wanting a database table with 3k columns then take a serious look at your requirements there should be a better solution than 3k of columns!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|