|
|
Well, you could increase the size of the stack, don't know what the limit is with .NET, on the other hand, I never came across a recursive function *that* recursive
And remember that there is always a perfomance hit on each function call.
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
|
leppie wrote:
What do you mean by that? I have seen no difference between running it in a while(true) loop vs a recursive function.
Yes, the difference is very small, you should measure it in millisecons.
Every recursion makes a call to a function, there's a small penalty there. If you are using a virtual method is a little bit bigger (big as in really small )
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
Problem:
I can't seem to catch any file or directory activity events for IIS's log files.
I have seen this problem behavior before with both NT Shell Hooks and .Net FileSystemWatcher code (which I assume is basically hooking into the same NT event mechanisum)
Basically, I want to "scan" IIS logfile activity whenever a website is browsed.
I could use ISAPI filters but really wanted to just be "alerted" each time someone
hit's the site using FileSystemWatcher code.
But it don't work. How can one "watch" an (I assume) in memory file ???
Any ideas ???
|
|
|
|
|
This isn't the right way to do this for so many reasons.
First, because IIS writes logs to memory and batches a write operation from time to time (for which the actual file doesn't often change because enough space is allocated for several batch writes).
Second, you're right: ISAPI is a better solution; however, if you are interested in ASP.NET pages (after all, do you really want to know each request for an image, "robots.txt", "favicon.ico", etc.?), you can easily write an IHttpHandler that will write a custom log for you somewhere or use remoting to update a chart in a different application.
There is yet another option that already exists and one which you could extend: performance counters. If you look in your Computer Management MMC snap-in (right-click on "My Computer" and select "Manage..." for easy access), you'll see an extension for logs. You could start by creating your own log file there for this specific purpose. You can also see this in "perfmon.exe" for which you can setup new counters. The .NET Framework has good support for counters, too, so you can take advantage of the file in many ways.
Third, as I touched upon before, you don't want to be notified for requests to things like "robots.txt", "favicon.ico", and all the various spiders do you? If you're interested in legitimate hits to your *pages*, the IIS log will never tell you that unless you plan on parsing a very large file yourself every time it changes.
"Well, I wouldn't say I've been missing it, Bob." - Peter Gibbons
|
|
|
|
|
Thanks for your input.
I didn't think of the PerfMon approach which seems to be as un-intrusive as one could
get which is what I was shooting for.
I will try out your suggestion.
Thanks again for your time.
Steve Cox
|
|
|
|
|
Problem:
I can't seem to catch any file or directory activity events for IIS's log files.
I have seen this problem behavior before with both NT Shell Hooks and .Net FileSystemWatcher code (which I assume is basically hooking into the same NT event mechanisum)
Basically, I want to "scan" IIS logfile activity whenever a website is browsed.
I could use ISAPI filters but really wanted to just be "alerted" each time someone
hit's the site using FileSystemWatcher code.
But it don't work. How can one "watch" an (I assume) in memory file ???
Any ideas ???
|
|
|
|
|
In Java, you can say:
if (obj instanceof java.lang.String)
{
}
What is the C# equivalent, if any?
|
|
|
|
|
if (obj is String)
|
|
|
|
|
(o.GetType().Equals(typeof(System.String))) for exact type equality.
(o is System.String) will also return true if o can be explicitly cast to String ...
Some ideas are so stupid that only an intellectual could have thought of them - George Orwell
|
|
|
|
|
As Nnamdi said, use the is keyword; but if you are just going to turn around and cast it, you should use as instead. as will do the cast and if it isn't of the correct type it will return null and you can check for that instead.
string str = obj as string;
if( str != null )
{
}
else
{
} HTH,
James
"It is self repeating, of unknown pattern"
Data - Star Trek: The Next Generation
|
|
|
|
|
|
I put internet Exporer in a UserControl derived class and added this control to a form. When the form initializes at startup I get the following exception:
A first chance exception of type 'System.Runtime.InteropServices.COMException' occurred in system.windows.forms.dll
When a similar standalone application is created,the code runs fine.WHat might be the problem..Can anyone provide a solution?
Mani
|
|
|
|
|
Hi , any idea how to make a toolwindow not steal focus from the parent form?
what i mean is , when i show my window , i dont want it to gray-out the parents wnds caption.
ive tried to simple reset focus to the parent when i click something on the tooltip , but that makes the parent flicker.
ive tried to just dispose the wm_activate message in the wndproc , no luck there either (for some reason the parents caption dissappeared (??))
ive also tried to apply various styles to the window , like:
this.CreateParams.ClassName ="tooltips_class32";
this.CreateParams.Style=TTS_ALWAYSTIP | TTS_NOPREFIX | WS_POPUP;
this.CreateParams.Parent =ParentControl.Handle;
no luck there either...
any ideas??
//Roger
|
|
|
|
|
I admit I haven't done my homework here, but I need to have my application process files after they show up in a directory. The FileSystemWatcher seems like the perfect object to use. When I plug this guy in and add handlers for the FileCreated and FileChanged events, I catch 4 events for every file I copy into my directory; 1 file created and 3 file changed events (this is XP Pro). Is there a simple way to make this object give me 1 notification that a file has been copied and fully written to my directory? I really don't want to have to keep track of waiting for the 4th event. Thanks.
Ron
|
|
|
|
|
That's basically the way the underlying Win32 function works.
One common approach is to try to open the file - it will be there and accessible when you can open it.
|
|
|
|
|
Can anyone help me understand why this connection string is not working. I have the following piece of code
string connString = "user id=sa;password=;initial catalog=dbName;data source=Test;Connect Timeout=30";
SqlConnection connect = new SqlConnection(connString);
try
{
connect.Open();
.....}
catch
{
...
}
It gives me the error "SQL server does not exist or access denied." The datasource is correct and tests out correctly in the ODBC administrator. It does not matter what database name I put in there. Another interresting thing, If I change the connection string and eliminate the data source completely it give me the error
"Login failed for user "sa" Not associated with a trusted SQL server connection" I have used the ODBC connection and database in my C++ application and they work just fine. Any ideas why C# is causing me such a headache? Thanks for any help.
|
|
|
|
|
I believe the SqlConnection object is not an ODBC object, but a native SQL Server connection. So your data source needs to be the IP Address of your server or the DNS server name, rather than an ODBC data source name.
Ron Ward
|
|
|
|
|
Try ODBC.NET[^] and a connection string like "DSN=Test;".
Paul
Pleasently caving in, I come undone - Queens of the Stone Age, No One Knows
|
|
|
|
|
- Check that the server "Test" is running, and that you can see it from your machine;
- Check that the server is set to allow SQL Server authentication - the default settings only allow Windows authentication;
- If your server is set to Windows authentication, change the connection to:
initial catalog=dbName;data source=Test;Connect Timeout=30;Integrated Security=True; - If the server allows SQL authentication, check the password for sa - if it really is blank, you should set it immediately!
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
|
|
|
|
|
|
|
|
scroll down to the heading Keystroke Message Flags. thats what i need. i am using KeyboardProc for a windows hook, and i need to get the information returned in the lParam. only problem is, i cant understand how to turn that IntPtr into a structure so i can get the info.
1001111111011101111100111100101011110011110100101110010011010010 Sonork | 100.21142 | TheEclypse
|
|
|
|