|
They're not exactly arbitrary. This one seems to work:
(?:(?'Delimiter'(\*|/|\(|:|\?|!@|!\+|\+|@))(?'Value'.+?))(?=(\*|/|\(|:|\?|!@|!\+|\+|@|))
(Whoops, no it doesn't... Working...)
Ah, here we go:
(?:(?'Delimiter'(\*|/|\(|:|\?|!@|!\+|\+|@))(?'Value'[^\*/\(\?!@\+:]*))
modified on Monday, September 21, 2009 1:33 PM
|
|
|
|
|
yep. it works:
public override void Test(int arg) {
Regex r=new Regex(@"(?:(?'Delimiter'(\*|/|\(|:|\?|!@|!\+|\+|@))(?'Value'[^\*/\(\?!@\+:]*))");
DoIt(r, @"*A(M!@12?SIMPLE!+5+2/AB:6");
DoIt(r, @"!+5+2/AB:6*A(M!@12?SIMPLE");
}
public void DoIt(Regex r, string s) {
log("");
log("input="+s);
foreach (Match m in r.Matches(s)) {
GroupCollection g=m.Groups;
log(" Delimiter=\""+g["Delimiter"]+"\" Value=\""+g["Value"]+"\"");
}
}
Looks terrible, works fine.
Luc Pattyn
Have a look at my entry for the lean-and-mean competition; please provide comments, feedback, discussion, and don’t forget to vote for it! Thank you.
Local announcement (Antwerp region): Lange Wapper? Neen!
|
|
|
|
|
I thought about recommending a regex, but decided that it would be more time and effort to create, test and debug the regex than the equivalant code! As a plus, the code is easier to understand, document and maintain.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
While I understand the frustrations with Regex; in this case I disagree.
|
|
|
|
|
It's a bad design, but this Regex should do it: (?:(?'Delimiter'(\*|/|\(|:|\?|!@|!\+|\+|@))(?'Value'[^\*/\(\?!@\+:]*))
|
|
|
|
|
Does anybody know to work with this junk of help system Microsoft made? I search for "apples oranges cucumbers" and I get 500 results of pages that match ANY of the terms, not ALL the terms as one would normally surmise. No wonder all Microsoft's search tools get a beating from Google. This is less functionality that friggin Notepad! GRRRRRRRRRRRRRR.
^
|_______ and hey, I'm not angry at you ::- D. Maybe it's my fault and I don't know how to use it. Does ANYBODY know???
|
|
|
|
|
Hi,
I've had this WTF moment too and have often wondered why a document explorer search was a lot less precise than I intended it to be.
Q) Is the search term 'apples oranges pears' is equivalent to the term 'apples AND oranges AND pears'?
A) It depends!
Explicit use of the AND operator will give hits that contain all three keywords. The problem when AND is merely implied is that a setting in Visual Studio (Tools..Options..Help..General..Include partial matches in local search results) allows partial matches, in effect allowing 'apples OR oranges OR pears'. Unchecking the box in my VS C# Express 2005 has restored sanity to the world of boolean logic.
Alan.
|
|
|
|
|
*laugh* nice reply Alan. Thanks! It worked! ::- D. Pfew. So it was me who was stupid and didn't investigate well enough the options. Thanks again for showing the way and getting me rid of one of my greatest frustrations EVER.
|
|
|
|
|
I have an executable that is crashing in Release mode for a customer.
I have been reading and have figured out from articles like this:
Do we have to include .pdb files in the final build?
That I need to generate a pdb file for my release and archive it (How to do this: Build, Configuration, Release. Then Project, Properties, Build Tab, Bottom Right in VS2005 find grey button "Advanced...". Press it then set Debug Info drop down list to "pdb-only").
Then when the customer has a crash he needs to email me the .dmp file generated by Windows How to read the small memory dump files that Windows creates for debugging
Now I have to put the two together in Visual Studio and can see where it crashed etc. The problem is I can't find any info on how to actually to do that!
I have to say there are few articles on this subject and it's a mess.
Many Thanks...
modified on Monday, September 21, 2009 4:48 AM
|
|
|
|
|
Hi,
You actually want a Dr Watson crash dump file from your customer. The pdb file allows the data in that dump to be cross referenced to the source code.
Rather than have me possibly mislead you by talking about something I don't fully understand, can I refer you to the Stack Overflow forum where a similar question was raised yesterday. The links to articles by John Robbins of Wintellect look to be very useful.
link[^]
Alan.
|
|
|
|
|
Yes I saw that post and the artiles. Unfortunately the John Robbins' Blogg and his posts are not clear or simple to follow. It took me a long time just to figure out what I wrote in the post above. I have come across no instructions for putting the two files together in Visual Studio. Eg John Robbins "PDB Files: What Every Developer Must Know" fails to even mention .dmp files which the other blog tells us are the key which makes them useful for debugging.
|
|
|
|
|
I'll second any article by John Robbins. He's also written a great book. Debugging Microsoft NET 2.0 Applications[^] (It doesn't matter that it says 2.0, it's still totally relevant)
Once you have the crash dump and the pdbs you can load them into a tool called WinDbg (which comes with Debugging tools for windows[^]) and figure out the cause of the crash. To get the crash dump you'll need a script called adplus (which also comes with debugging tools for windows) which you can run and attach to your app and when it crashes it will create the dump.
Read Johns articles and/or that book and you'll understand a lot more. It's quite a complex topic though so allow plenty of time.
Simon
|
|
|
|
|
|
Half an hour later and I am still trying to figure out what the customer needs to do to collect the dump files. I don't want the customer to have to run Dr Watson all the time in case my app crashes. These windows .dmp files do not look to be enough. This ADPlus seems to be something I need the customer to install in nine complex steps. It's a nighmare.
modified on Monday, September 21, 2009 6:03 AM
|
|
|
|
|
Yes, ADPlus is a nightmare. From the sound of it you would want to use it in crash mode. You run it and attach it and when it detects a crash it creates a dump. I've never used it on a customers machine, I've always been able to replicate the bug on test machines running release mode binaries.
I think Dr Watson might be an easier way of doing the same thing, but to be honest I've never tried it so you'll have to experiment.
Check out this article on configuring Dr Watson to generate crash dumps[^].
Also, just in case you might want to bookmark this article on disabling Dr Watson[^] for when you want to turn it off afterwards.
And here's a description of Dr Watson[^].
Simon
|
|
|
|
|
hi
how i can connectiong to internet IN my program.
i must enter username & password & my asp number in my program and then conencting to internet.
plz give me small smaple;
|
|
|
|
|
M M A wrote: i must enter username & password & my asp number in my program and then conencting to internet
Who is stopping you???
Jokes apart, you need to give us the details what you need to do.
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
I have a class with a scientific members in physics. I want to let the user to enter a text in a textbox like "x1+x2*3+x3/4" and i want to calc this values in run-time.
(Lets say that i have properties that called "x1", "x2" and "x3".)
How can i do it?
|
|
|
|
|
Have a look at Inside the Mathematical Expressions Evaluator[^].
bonzaiholding wrote: I want to let the user to enter a text in a textbox like "x1+x2*3+x3/4" and i want to calc this values in run-time.
(Lets say that i have properties that called "x1", "x2" and "x3".)
You can search the input string for the variables ("x1", "x2", ...) and replace them with their corresponding values from your properties. After that, you can pass the string to the Mathematical Expressions Evaluator and get the result.
Nuri Ismail
|
|
|
|
|
Thanks for all of your answers.
|
|
|
|
|
You are looking for a Math parser. You can find lot of related help on google.
It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD
|
|
|
|
|
Sigh, I remember having to do this at uni....RPN anyone? Seriously though look up Reverse Polish Notation and stacks. It might help...it might not I am not very helpful am I? I just went on a nostalgia trip is all because of your post! thank you
Cads
|
|
|
|
|
|
private bool Connect()
{
string DB_Path= @"E:\Office Project\salary project\AttendanceSummary.csv";
string Con_Str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + DB_Path + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\";";
con = new OleDbConnection(Con_Str);
con.Open();
string query = "SELECT SNO, ECODE, NAME, PRESENT, ABSENT, OFF, LEAVE, LWP, OTHOURS FROM [AttendanceSummary$]";
OleDbDataAdapter oda = new OleDbDataAdapter(query, con);
DataSet ds = new DataSet();
oda.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
dataGridView1.Update();
if (con.State == ConnectionState.Open)
{
MessageBox.Show("Connected");
return true;
}
else
return false;
}
====>>>> this code is working fine...........Problem is that when i am connecting other file "XYZ.XLS" which is having some text heading in the Top Rows................ its showing error ....... pls kindly help me
Thanks in Advance.( sorry if any mistake i am very new to programming)
|
|
|
|
|
Thanks I GOT 
|
|
|
|