|
The '\' right after the * character is what is causing the compiler to baulk. Either escape it ('\\') or make the string verbatim by prefixing the @ symbol (Regex theRegex = new Regex(@"[-+]?([0-9]*\.)?[0-9]+ "); )
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
A.
Specify the RegexOptions.Compiled flag when you create the object if you plan to use it more than once. It takes longer to create the object, but it runs faster.
B.
As regular expressions and C# strings use the same escape character, you have to escape the escape character. Use \\ to put \ in the string.
Also, you are missing the ^ and @ to specify the beginning and end of the string. Without them, any string containing a number will be valid, for an example the string "We have 200 horses.".
You have an extra space at the end of the pattern. Remove that.
[0-9] can also be written as \d.
Regex theRegex = new Regex("^[-+]?(\\d*\\.)?\\d+@");
Or you can use an @-quoted string:
Regex theRegex = new Regex(@"^[-+]?(\d*\.)?\d+@");
---
b { font-weight: normal; }
|
|
|
|
|
The problem is the "\." - characters after the backslash are interpreted Escape Sequence, which in your case makes (luckily) no sense.
Two ways to fix it:
<br />
Regex theRegex = new Regex("[-+]?([0-9]*\\.)?[0-9]+ ");<br />
Regex theRegex = new Regex(@"[-+]?([0-9]*\.)?[0-9]+ ");<br />
----------------------
~hamster1
|
|
|
|
|
Hi,
I have a requirement I am loading the image in an image object and I would like to rotate the image using mouse pointer just like images can be rotated in powerpoint.
If any one is aware of the code plz do help.
Regards
Suresh
|
|
|
|
|
|
Hi,
I did not get the screen shot provided by u and I think it is not suiting my requirement.
Plz help me ina any other way
|
|
|
|
|
as the above response told you use matrix class somthing like
Matrix mx=new Matrix();
mx.Rotate(angle);
Image img=Image.FromFile(imagePath);
Graphics g=pictureBox1.CreateGraphics();
g.Transform=mx;
g.DrawImage(img,rect);
img.Dispose();
g.Dispose();
MCAD
|
|
|
|
|
Thanks for the help but my requirement is when I use the mouse buttton click then I would like it to rotate just like we can rotate an object in powerpoint.
Plz do hlep me in this area.
Advance Thanks
|
|
|
|
|
So can someone help me out here. This is the code that is confusing me the most
<br />
public void SaveAsXML(Stream s)<br />
{<br />
XmlSerializer sr = new XmlSerializer(this.GetType());<br />
sr.Serialize(s, this);<br />
}<br />
In my class I call this function like this:
<br />
commMain.ComSettings.SaveAsXML(saveFileDialog.OpenFile());<br />
Can someone please explain this in newbie terms. It works, but I'm not sure I understand how. And I may want to change this function so that it does not open saveFileDialog everytime, I may want to pass the name of the settings file instead.
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
The SaveFileDialog.OpenFile method opens the file and return a stream that is associated with it. You can use any method you want to create a stream for the SaveAsXML call.
For an example, if you create a memory stream, the data from SaveAsXML will go into a buffer in memory, and you can then get the serialized data as a byte array.
---
b { font-weight: normal; }
|
|
|
|
|
XML Serialization is a technique that allows to save your object's state in an XML file and read it back.
saveDialog.OpenFile() returns a Stream, most probably a FileStream , which is passed to the SaveAsXML function. That function then serializes the current instance (this, which is commMain.ComSettings) on which it was called to the stream passed to it.
The effect of running this code is that the commMain.ComSettings instance would have gotten serialized to the stream returned by OpenFile.
Tom Wright wrote:
And I may want to change this function so that it does not open saveFileDialog everytime, I may want to pass the name of the settings file instead.
Create a System.IO.FileStream yourself and pass it to SaveAsXML, like this
using (FileStream fs = new FileStream(filePath, ...)
{
SaveAsXML(fs);
}
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Not sure if this goes here but I didnt want to post it in the lounge either.
So here is the question.
If I take a file and start reading through it as I look at each bit could I flip that bit?
So if it is a 0 make it 1 ... ect?
Here is what I want to do.
Pass 1) Read through a file and reverse all the bits in the file
Pass 2) Take the file and turn all bits off
Pass 3) turn all bits on
Pass 4) Delete the file
Do you think this could allow me to securly delete a file from my system making it unrecoverable?
Thanks
Will
|
|
|
|
|
Not if someone is willing to dismantle the drive and use lab equipment to read residuals directely off the platter. The writehead only erases ~95% of the bit and it's movement over the platter afffects which part is missed so N passes won't erase 100*(1-.05^N) percent of the data. I've got a tool called BCWipe that uses a 35 pass algo designed by someone with initmate knowledge of how the HD writehead works that should render it unrecoverable. If you want to write your own program the used bit patterns are user view/editable. It also has an older 7pass DoD routine.
|
|
|
|
|
OMalleyW wrote:
Do you think this could allow me to securly delete a file from my system making it unrecoverable?
Definately not! After having visited the inside a computer forensics lab, I was surprised astonished at what you have to go through to stop these guys from getting at that data. What're suggesting on doing, really, is very weak.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
thanks for the reply's
even if they could get to the file, the data is not recoverable...
i guess that is really what I care about is the ability to get rid of data i dont really care if they can recover the file as long as the data is gone...
any thoughts?
will
|
|
|
|
|
You need to use a cryptographic wipe to do that. the program I mentioned in my previous post BCwipe will do one, and exposes the bit patterns used to do so. IT also names the used algo if you want to read up on how it works.
|
|
|
|
|
OMalleyW wrote:
even if they could get to the file, the data is not recoverable...
First, there is no difference between the two. file=data
You said you wanted a SECURE way to get rid of the data. Well, the way you suggested overwriting the data, it IS still recoverable. Not by your program or the file system, but by some hardcore tools and a little overtime in a lab...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thank you again for the quick replies...
Dan,
I will look into BCWipe I read a little and it sounds very interesting.
Currently I use SDelete from Sysinternals that is a cool program also.
From what I understand (now) what I would like to write is no trivial task
and will require me to do far more research.
Dave,
You mentoined that you were astonished at the tools the forensics lab
had to get data. I guess I should also become more familar with the
technologies that are used to recover data also.
Thank you again for all your help.
Will
|
|
|
|
|
OMalleyW wrote:
I will look into BCWipe I read a little and it sounds very interesting.
Currently I use SDelete from Sysinternals that is a cool program also.
From what I understand (now) what I would like to write is no trivial task
and will require me to do far more research.
If you want to actually design your own algorythm (bad idea!) you will, but to just implement it yourself is trivial. All you'd need to do is copy the bit patterns used and sequentially write each to the entire file. What would be nice would be a program that would also wipe 'underneath' existing files. It shouldn't be that hard to do either.
|
|
|
|
|
Hi Every body
I have a usercontrol (Named DatePicker) with a property called 'Date'.This is the syntax of this property :
<code>
[Category("Date Info"),Bindable(true)]
public string Date
{
get
{return this.dateString;}
set
{this.dateString = value;}
}
</code>
This control also have some string properties (Day,Year and month)without 'Bindable(true)'Attribute.I use this user control and bind the 'Date' property of this control to a string column of a DataView in my form :
<code>
this.datePicker1.DataBindings.Ad("Date",this.dvDataSource,"Birthday");</code>
When I delete all rows of dataview whith this code :
<code>
this.BindingContext[this.dvDataSource].RemoveAt(this.BindingContext[this.dvDataSource].Position);
</code>
and then try to add a new row using the following code,
<code>this.BindingContext[this.dvDataSource].AddNew();</code>
I receive the following Exception :
"DataBinding could not find a row in the list that is suitable for all bindings"
Note :
When I comment the line of code that contains instruction for Binding this property,everything works ok.I bound some other controls (Like DataGrid and TextBox) to the other columns of DataView.They haven't any problem !!
Please help me if anyone knows the answer.
Best Regards.
[ _ Always there is another way _ ]
|
|
|
|
|
I need to include a .dll and an .ocx in my application.
How can I do that;
Thanks.
Osvaldo Rosario
Email: orosario@multisysid.com
-- modified at 10:44 Thursday 1st September, 2005
|
|
|
|
|
If you mean that you need to use unmanaged dll and ocx in your application
For Dll you can use P/Invoke to use function from unmanaged dll in your application
look at this article Calling Win32 DLLs in C# with P/Invoke[^]
For OCX
write click in toolbox select
Add remove items ...
then select com tab ---> select ocx you want it will be display in toolbox
MCAD
|
|
|
|
|
I want to write a program in C#. I have met a problem which i want to control the scanner and get the image.How to do it?Thanks~~
|
|
|
|
|
Hi All,
Is there any better and reliable method to watch for directories then filesystemwatcher.I am watching all files and folders on fixed drives.The behaviour of filesystemwatcher is different for different files for example for a .txt file if something is changed it fires the change event two times.for .xls file change event will fire even if it had been just opened also sometimes it shows it as deleted and then renamed when there is nothing being changed in the file.for .mdb file the creation and change both event fires just on creation.Is there any other reliable method.Thanks in advance.
|
|
|
|
|
This is not because the FileSystem watch treats different file types differently. You're actually getting some insights as to how those applications really behave! No matter what you use to monitor the file system, you'll see the same behaviors.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|