|
(?'Type'\S) There must be a non-whitespace character, capture it in group Type
\s Then there must be one whitespace character
(?'Time'\d\d:\d\d:\d\d) Then there must be a sequence of six decimal digits separated by colons, capture it in group Time
\sLine\s* Then there must be a whitespace character, the characters L i n e, and zero or more whitespace characters.
(?'Line'[^:]*) Then capture everything up to (but not including) the next colon in group Line
\s:\s Then there must be a whitespace character, a colon, and another whitespace character.
(?'Operation'[^\r]*) Then capture everything up to (but not including) the next carriage return in group Operation
\r\n There must then be a carriage return and a linefeed.
(?'Data'([^\r]*\r){1,3}) And finally capture everything from there through the next few carriage returns, there must be at least one and at most three carriage returns. Capture this into the Data group.
|
|
|
|
|
thanks this is working perfectly except for one thing. under operation, serveral of the operations have spaces between them. I cant seem to find an expression that says "include everything here, and if it has a space include that too" into the operations group. is that even possible?
|
|
|
|
|
The Operation group should contain everything up to the next carriage return. Doesn't it? Culd you post an example of a problematic string?
|
|
|
|
|
example here:
E 10:45:05 Line 5 : Wash Tips
|
|
|
|
|
so i was playing around and it seems it will include if there are spaces as it is. The problem seems to be from the data portion.
|
|
|
|
|
OK, so what's the problem?
|
|
|
|
|
these are the two different operations i have:
E 10:45:03 Line 4 : Dispense
tip 1 : dispense 20.56µl 6, 3 Deep Well, landscape [1,1]
10.00µl ">> Water << 23" Fixed <3 - 50µl> Single
and
E 10:45:05 Line 5 : Wash Tips
wash (2ml + 1ml), grid 20 and grid 20
the first line is great works fine, but with wash tips it doesnt seem to follow the pattern. when i replace the 2nd line in wash tips with the 2nd and 3rd line of dispense everything is kosher.
another problem im having is, id like to have the file read line by line but i cant seem to get that done too.
|
|
|
|
|
sorry for the trouble... i think i fixed it... again thanks and sorry
|
|
|
|
|
I'm developing a vector graphics app and I'm to the part of allowing rotations to the shapes. Since I'm using C# I don't know all of the pros and cons of the two following methods. Could one of you gurus out there clear up the confusion? Keep in mind that I'm using the Matrix class for page scaling and panning. The functionality that I'm refering to must allow independent transforms on each shape.
Method 1: Rotate the shape (vectors) purely by trig. If the user then resizes the shape, the shape must be resized along the rotated axis.
Method 2: Use the matrix class to transform the vectors. My drawback on this method is that on every paint and mouseover, mousedown, mouseout event, the shape would have to be repeatedly transformed. Wouldn't this be a cpu hog?
My code this week has no errors. But it's Monday morning and I haven't got out of bed.
|
|
|
|
|
Didn't you ask this before? I suggested you take a look at Piccolo.
Matrixes are going to be faster than trig. Transforming a point by a matrix is a handful of operations.
If you have a great deal of points, then regardless of using matrixes or trig, you will need to implement view caching / damage and spatial indexing.
|
|
|
|
|
Hey Mark,
Thanks for the info. I'll take a more serious look at Piccolo.
In the mean time I've done some research about matrixes. It does appear to be the way to go! My work will definitely be much easier.
Thanks again,
Richard Blythe
My code this week has no errors. But it's Monday morning and I haven't got out of bed.
|
|
|
|
|
I am coding an override for OnDragDrop , only DataFormat.FileDrop is valid, tested for in OnDragEnter and in the OnDragDrop handler.
I've just reviewed the code and noticed that I have put in a if (File.Exists(filename)) test before allowing the drop.
Is this test redundant? I mean, are there any circumstances in which a DataFormats.FileDrop can occur apart from when dragging from explorer, or other shell source.
This must be a really daft question but my brain is going in circles at the moment and I can't get my head round it.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Henry Minute wrote: are there any circumstances in which a DataFormats.FileDrop can occur apart from when dragging from explorer, or other shell source.
I've never tried it, but I suspect any application can create a FileDrop event. Furthermore I suspect it is possible to do it such that your test would evaluate to false.
|
|
|
|
|
Cheers.
I'll leave it as is, I think, unless I hear otherwise from the C# sages.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Hi Henry,
one can programmatically drop just about anything on an app, including non-existing files.
Also files can get deleted while a drag-drop is going on.
On the other hand, when a file gets operated on (as in after the drop), you need to have
error handling anyway, so you may as well skip the test.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
Luc Pattyn wrote: when a file gets operated on (as in after the drop), you need to have
error handling anyway
Good thinking Batman!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
// StatusID =2
// xGetStatusOID = 2
if (StatusID.CompareTo(xGetStatusOID).Equals(true))
{
ii = 1;
}
else
{
ii = 2;
}
//Result
//ii = 2
|
|
|
|
|
well, CompareTo returns an int, saying whether the passed argument is less, equals or greater than the object.
You can rewrite your code like this:
ii = (StatusID.Equals(xGetStatusOID) ? 1 : 2);
That's all.
Regards
Sebastian
|
|
|
|
|
Hi,
what are you doing?
did you check the return type of CompareTo?
does your code even compile?
why not simply if(StatusID==xGetStatusOID) { ... } else { ... } ?
I recommend you buy a book on the language or technology of interest and study it.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
This code does compile and returns false,
perhaps you should of read what I wrote, it was a question.
|
|
|
|
|
ziwez0 wrote: perhaps you should of read what I wrote, it was a question.
No you didnt, you just posted some code!
Perhaps you should buy a beginner book on C# and work your way through it!
|
|
|
|
|
Hi j4amieC,
J4amieC wrote: No you didnt, you just posted some code!
Suject "Why not True"
http://www.thefreedictionary.com/why[^]
I asked a question?, perhaps if you spent more time reading what people write, maybe your reponse might be helpful (like Alan's post), instead of your alternative which was a quick dismissal of someone's question.
|
|
|
|
|
Hi,
yes you are absolutely right, it does compile (well, after one adds type declarations for all the variables used), although it does not make sense whatsoever.
CompareTo returns an int
int.Equals(true) returns false no matter what.
It may help to read some documentation[^] especially if you insist on using methods you don't really need and apparently don't understand well.
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
modified on Friday, June 10, 2011 11:35 AM
|
|
|
|
|
Why use methods when operators will suffice?
|
|
|
|
|
is it because :
bool == 0; is false?
you are comparing an 'integer' to a 'bool' which is always false as they are different types
My opinion is... If someone has already posted an answer, dont post the SAME answer
|
|
|
|