|
You haven't set a NotifyFilter , and you haven't turned on EnableRaisingEvents ...
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Sorry, I've got EnableRaisingEvents = true in the OnStart method for the service. I'm not certain how I would code a NotifyFilter since none of them seem to relate to file size?
C. Richard Wenger
System Administrator
|
|
|
|
|
There are no file size filters in the FSW. The filter is just there so the FSW knows which events you want to check for.
The FSW polls the filesystem, taking snapshot after snapshot of the monitored directies and their files Created and LastModified times. Then it compares the new snapshot with the old one, generating the required events based on the differences between the two snapshots, subject to the NotifyFilter specification.
|
|
|
|
|
Well, I see a NotifyFilters.Size - isn't that what you want?
At the same time, it might be better to filter on NotifyFilters.LastWrite so that you only have to deal with one event when the file is closed. At that point, you see how big the file is, and act accordingly, but you only do it once per file. Much more efficient.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I looking over what you've said and I'm trying to see if there is a way I can leverage this to a useable outcome. As I read it the NotifyFilters.Size reports a CHANGE in file size and I'm not certain how I could use this in my application. The goal is to send email alerts only when files are copied into a directory over a predertimed size limit (if that helps).
C. Richard Wenger
System Administrator
|
|
|
|
|
Then you want to set the LastWrite filter. That way, when the file is closed, you'll be notified, and you can check the size. If your goal is to determine the size of the file *before* it's written, I don't think that's possible.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
rich_wenger wrote: FileInfo fi = new FileInfo(e.FullPath);
if (fi.Length > 524288000)// 500MB = 524288000
This isn't going to work. When a file is created, it's length is always 0. Only when the application flushes it's writes to the file does the filesize increase, for which there is NO FSW event.
Your code has to keep track of the files that are new, then occasionally check back with those files to get their current sizes, then you can do what's necessary.
|
|
|
|
|
I think I understand what you are saying, I am just not certain why I am getting the first email alert?
C. Richard Wenger
System Administrator
|
|
|
|
|
FSW events don't fire exactly when the actual event occurs. In your case, it appears that the system was doning something else, blocking your application, but still queueing up the Create event. By the time your Create handler got called, the file had attained the require size to trip the email.
|
|
|
|
|
Dear All,
I have problem in defining the correct email address using RegEx.
e.g i have 3 email address as follows
1. ______@yahoo.com
2.abc123@yahoo.com
3. abdul_rahmancs@yahoo.com
now if we just look at mentioned email address only 2 and 3 are correct.
how can i identify the valid email address using regex.
Abdul Rahaman Hamidy
B.Comp.S
Kabul, Afghanistan
Database Developer
|
|
|
|
|
|
|
I don't think that there's anything illegal with the first one either, it's just a little unlikely. Trying to validate email addresses as being real is a different matter.
|
|
|
|
|
|
Hi,
I am currenlty working on a project that contains heavy data processing in matlab (the algorithm already exists in matlab as an m-file), however the GUI of the program must be written in c#.
My purpose is to invoke the m-file from c#, and to get the output back to the c# program.
I wanted to know how it can be done (is there a way to include the matlab code in c# as a DLL or something similar?)
Thank you for you help,
Yigal.
|
|
|
|
|
|
Thanks for your reply but this is not what i am looking for.
Believe me, i have been googling the whole morning and didn't find what i have been looking for.
Does anyone have a solution to my problem?
Thank you.
|
|
|
|
|
yrajwan wrote: Thanks for your reply but this is not what i am looking for.
In the OP you said that you wanted C# to be the interface...
quote from Mathworks[^] which is the first hit on that google query. This quote is actually the first line in the second paragraph.
The first method shows how to use the MATLAB as an automation server from C# using the engine interface via com automation.
Edit:
Posted wrong link Click here for a CP article on MATLAB and .NET[^]
modified on Tuesday, January 6, 2009 9:41 AM
|
|
|
|
|
Welcome in the CP's memorable quotes list [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Yay!!
One more item of my list of things to do in 2009.
|
|
|
|
|
Hi guys.
I've added a database in my project. VS2008 SP1 creates a DataSet with Database1DataSet name.
Now I want to update the DataBase with this code :
private void saveButton_Click(object sender, RoutedEventArgs e)
{
Database1DataSet myDataSet = new Database1DataSet();
DataRow myDataRow = myDataSet.Tables["events"].NewRow(); myDataRow["event"] = "new text";
myDataRow["date"] = mdCalendar.Time();
myDataSet.Tables["events"].Rows.Add(myDataRow);
}
but this error has occurred :
Object reference not set to an instance of an object.
I'm sure the events exist in the DataBase.
What's wrong with it ?
Thanks in advance.
|
|
|
|
|
Mohammad Dayyan wrote: Database1DataSet myDataSet = new Database1DataSet();
Since you're creating a new, fresh dataset it may not have any tables in it (depending what you do in the constructor for Database1DataSet).
Without knowing your program logic most likely you should refer to an existing dataset which is defined somewhere in the program (at form level, a static object etc.)
|
|
|
|
|
You create a .Net DataSet in memory, and immediately you do:
myDataSet.Tables["events"].NewRow();//on this line
Don't you think that your forgot to create a DataTable called "events" ?
You are not accessing any Database here, you are instantiating a DataSet object and you attempt to access a DataTable that you don't have created. I suggest reading some article about ADO.Net, it explains very well how to connect to a Database, retrieve data from it encaspulated in a DataSet, update data and stuff like that.
Jean-Christophe Grégoire
|
|
|
|
|
Thanks.
I've done it.
Database1DataSetTableAdapters.eventsTableTableAdapter eventsTableTableAdapte =
new WpfApplication1.Database1DataSetTableAdapters.eventsTableTableAdapter();
Database1DataSet.eventsTableDataTable eventsTableDataTable =
new Database1DataSet.eventsTableDataTable();
eventsTableTableAdapte.Fill(eventsTableDataTable);
DataRow newDataRow = eventsTableDataTable.NewRow();
newDataRow["event"] = "event8" ;
newDataRow["date"] = 654982;
eventsTableDataTable.Rows.Add(newDataRow);
eventsTableTableAdapte.Update(eventsTableDataTable);
eventsTableTableAdapte.Dispose();
eventsTableDataTable.Dispose();
But I don't know why the changes haven't applied to the DataBase
Could you guide me ?
|
|
|
|
|
Can CollectionEditor properties be set programmatically please?
For example, I have two CollectionEditor properties 'AutoWidth'(bool) and 'ColumnWidth'(int).
If 'AutoWidth' is set to 'True' then I would like the property 'Column Width' to be disabled.
|
|
|
|