|
OK, I got the answer now.
The only one point caused it did not work is:
watcher.Path = "e:";
the correct code is
watcher.Path = "e:\\";
other similar code works as well when modify them as above.
the conclusion is: The FileSystemWatcher's Path attribute needs a "\" at the end.
fayth
|
|
|
|
|
I hate to chase all the way the latest technologies, this is why while others are switching their lanes to Java or C#, I'm still a C++ programmer. But now I think it's time for me to change, and I'll have to chose among Java and C# my next generation language.
What's your opinion ? I think maybe this is wrong place to ask, cuz it's C# place...
Horace3801
|
|
|
|
|
why one of them?
why not both of them?
It is a tool by itself. I utilize either of them depending on the project.
nhi
|
|
|
|
|
Are you sure that you'll stick to windows during the next few years?
Yes: C# !
No: Java !
Do you code desktop applications, or web applications?
Desktop: C# !
Web: Java !
If you are not sure about what you will use your new language for, I suggest you learn Java. Switching from Java to C# later on is easy, because C# is not much more than a combination of Java and C++.
|
|
|
|
|
I'd have to say that I disagree with your web application recommendation. I don't think a desktop vs. web argument can be made unless you need to be flexible with the client/server OS.
|
|
|
|
|
If you think Java will be useful in your career you should learn to use it. For an experienced C++ developer Java is relatively simple to learn. It is the API that is large not the language differences.
Should you learn C#? IMHO the correct question is should you learn .NET?
Just as with Java if you think .NET will be useful in your career then Yes. However you don’t need to learn C# (not that it would be difficult… just like Java it is the API that is large not the language ) when you can write .NET code in C++. In fact some would say (including me) that C++ is THE language since you can do "mixed mode" development.
Of course, there are some differences in approach and/or capability across the languages but they are few rather than many. Again the most significantly different one is C++ due to the "mixed mode" capability.
But, that’s just my opinion… I could be wrong.
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
As "EastenChild" said, learn both. Of course, that's only if you have time. I went from C/C++ many years ago to Java, Perl, VB, and then several managed languages back in the .NET 1.0 beta days. Of course, I learned HTML, Javascript, etc. etc., though I started when HTML 1.0 was still a draft.
While you can actually learn these in tandem - since there's many common features such as managed allocation, garbage collection, etc. - that might not be suitable depending on your time. But remember this is really a choice between Java and .NET. .NET is actually Microsoft's brand-name for the Common Language Infrastructure, or CLI. This describes how languages interoperate (through Intermediate Language, or IL), how that IL should be formed, metadata, etc. The CLI specs are easy to find on the web. An assembly writtin in one language can be used by another, since they all compile down to the same thing (roughly, not taking into account compilere optimizations or amount of support for the CLI).
As the poster above said, pick which you think will be most useful to you in the future. Both Java and the C# language are similar to C/C++, and very similar to each other. J# is closer to Java, of course, but typically uses assemblies that more closely match the JRE (Java Runtime Environment). It can use the .NET FCL (Framework Class Libraries, sometimes referred to as the BCL, or Base Class Libraries) just like C#, VB.NET, et. al. can use the JRE-like assemblies.
Personally, I like .NET much more. While Java is further ahead in platform support, it's being screwed to the ground. Sun is refusing to open it and it really hasn't advanced much in recent years (and it's not just me saying this, but the whole Java development community outside of Sun...even within Sun sometimes!). .NET is very feature-rich and gives you language independence, so that if you truly understand the .NET Framework and at least have some idea of a particular language syntax, you can write it in any language you want (which is important since many companies don't get it, and require that you know either VB.NET or C#, though sometimes that because an entire team needs to use a particular language).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I agree with a lot of what's been said. I think it's important to learn both Java and C#, but you can do that pretty easily. The APIs are by far the hardest thing to learn. Even those can be learned as you work with projects, though.
My main concern would be: What projects are/will you be working on? If you know of upcoming C++ projects, then stick with that and start learning the .NET Framework. From there, you can slide into C# - and you'll be productive, too, since you already know the Framework. After that, you can take the larger jump to Java. The language will be easy, but the API might take a while.
Personally, I think that the .NET Framework is laid out better and seems to be more thought-out than Java APIs. And, considering Visual Studio is the undisputed champion of development environments, I believe that this would be a good path. But, again, it all depends on marketability. Base your decision on the projects you are working on and those you will be working on in the near future.
Michael Flanakin
Web Log
|
|
|
|
|
Here is my description from getdotnet.com
This will be an eventual os independant grouping of office style applications written in C#. Eventually I also hope to have them web based so you can work with your files from anywhere. As any good programmer should, I will ensure cross compatability with as many other applications related to this application package. Once completed and satisfied with the results portions of the code will be open source and if a proper response is recieved then the whole application package will be open source. As of now only two out of the endless possibilities of applications have been laid out on paper and organized. Those are a web browser and email program. There will be a word processor, spreadsheets, Databases, presentation tools, html/xml/php editors, maybe even a graphics program sub package.
http://www.gotdotnet.com/Community/Workspaces/Workspace.aspx?id=21691a22-ddfe-4fd0-8ce0-88e8b05ed341
I need people asap that would like to help with the project. Im just doing this cause i can. But i do need a bit of help on the coding if i want to finish before im 40.
Email: jd@lucidmind.org
AIM: jdogg172
|
|
|
|
|
You really should post this appropriately and not waste people's time when this is a request for coders, not a request for a specific issue within C#.
You will not receive any help going about it this way.
Yes, I program in VB, but only to feed my addiction to a warm place to sleep and food to eat!
Visit my Code Project blog (Mobile Audio project)[^]
|
|
|
|
|
How is this a waste of time, you saw it, people can learn from this, maybe even solve problems with similar programs they may be writing. All i did was as a question. Instead of whining why dont you just simply state the proper location for this post.
|
|
|
|
|
jroberson10 wrote:
How is this a waste of time
This forum is for people to help other people with a specific issue. Not for recruitment. That's why no one else has responded to you.
jroberson10 wrote:
people can learn from this
I agree, but still wrong forum
jroberson10 wrote:
Instead of whining
There was not any whining. Just post it correctly and you may get responses that don't bruise your delicate ego.
Regards
Eric C. Tomlinson
Yes, I program in VB, but only to feed my addiction to a warm place to sleep and food to eat!
Visit my Code Project blog (Mobile Audio project)[^]
|
|
|
|
|
My ego, i dont think i would be asking for help if i had such a big ego. Why are you so worried about it being in the wrong spot, did i some how offend you, or do you just like to complain
|
|
|
|
|
Did you not notice the at the end of the statement???? Was just kidding.
Now get back on your Prozac [NOTE]
[EDIT]And by the way, loosen up a little! [EDIT]
Yes, I program in VB, but only to feed my addiction to a warm place to sleep and food to eat!
Visit my Code Project blog (Mobile Audio project)[^]
|
|
|
|
|
I created an IExtenderProvider implementation. The extender providers a few string properties that can be modified. I want VS.net to display a dropdown for the user to be able to quickly select a string to use. How can I make it a drop down?
The catch is that I want the items in the drop down to be dynamic. If the items were static it would be easy to just change the string to an enum and VS.net would do the work for me.
|
|
|
|
|
I guess i should have done the research before giving up so quickly.
Well, after researching I found out that you have to do something with UITypeEditor. I'm reverse engineering some of the classes in the System.ComponentModel.Design to find out the best way of doing this.
This was a good resource : http://weblogs.asp.net/okloeten/archive/2003/10/31/35028.aspx
|
|
|
|
|
On your GetPropertyName and SetPropertyName methods, attribute them with the EditorAttribute , which of course references your implementation of the UITypeEditor class. Read more about this attribute and this class in the .NET Framework SDK. Since you've already started playing with the Component Model, you shouldn't have any problems (and this is a much simpler implementation).
Here's a tip, in your override for EditValue , use the IServiceProvider argument to request the IWindowsFormsEditorService in order to display drop downs and modal dialogs instead of doing it yourself. You can read more about this service interface in the .NET Framework SDK as well. This makes sure that the design-time environment of the IDE supports such actions and uses a thread message queue allocated from the IDE, which is far more stable that trying to create one from your component.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
public string getCurrentCpuUsage()
{
PerformanceCounter cpuCounter = new PerformanceCounter("Processor","% Processor Time","_Total");
return cpuCounter.NextValue()+"%";
}
I'm using C# and try to get the total cpu usage....
The above class return 0 or 100 percent(I think this process only return the cpu usage of my application not the total cpu usage of windows and other programs running)...how can I get the Total cpu usage percentage just like the figure in Task Manager of windows?
jim
C#
|
|
|
|
|
thats a method and it should get the total cpu usage as described...
% Processor Time is the percentage of elapsed time that the processor
spends to execute a non-Idle thread. It is calculated by measuring the
duration of the idle thread is active in the sample interval, and
subtracting that time from interval duration. (Each processor has an idle
thread that consumes cycles when no other threads are ready to run). This
counter is the primary indicator of processor activity, and displays the
average percentage of busy time observed during the sample interval. It is
calculated by monitoring the time that the service is inactive, and
subtracting that value from 100%.
If you are comparing this to the task manager, it is pretty close....
I find that using the preformance counters I get close results, but often sporatic ones... probably cause i'm not using them right.
Check this class out, you will like it better...
CpuUsage[^]
/\ |_ E X E GG
|
|
|
|
|
I am a C# beginner. In VB/ASP i had developed an infrastructure that allowed recent trace/debug information to be kept in memory. It would be dumped to an error handler when exceptions were raised. Only the most recent trace entries would be retained. Is it possible to do the same with the .Net Trace class, or will i have to write my own code? From what i have read it seems that a Trace Listener can only be a stream, like writing to a disk file. This is useful, but i have other troubleshooring needs.
Thanks
|
|
|
|
|
Why develop it? It's already developed. If you have tracing enabled (<trace enabled="true"/> in your Web.config file - see the <trace> documentation in the .NET Framework SDK for more attributes), then just point your browser to approot/trace.axd, where approot is the root directory of your web application (not necessarily the root of your web server).
This collects object hierarchies (within the page), exceptions, trace messages (of course), query strings, form variables, HTTP headers, cookies, etc - most likely a lot more than you were tracking before.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
BTW, this is an ASP.NET question and belongs in the ASP.NET forum, regardless of what language you're using. It's important to understand that C# is one of about 30 languages that target the common language runtime, or CLR. I suggest reading through the .NET Framework SDK or picking up a good book (though nothing is as comprehensive as reading the class library documentation in the .NET Framework SDK).
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
Thanks for your comments but there appears to be a misunderstanding here. Both VB and ASP had no tracing ability built-in to the product. This is why the infrastructure was created. I was singularly developing 100K+ lines of code. I only mentioned this as an example of what was done before and what i would like to do in C# applications. What i am trying to determine is whether the Net trace/debug classes can behave a certain way. I hope i described things clearly enough. In my reading of the Microsoft books and documentation, the behavior i seek is not clarified. I also found nothing in an internet search. So i appeal to the forums for more information before i tackle things by trial-and-error.
Thanks for the help
|
|
|
|
|
How does this apply to anything I said? For one, I answered your question in the first reply which is covered in the .NET Framework and I mentioned what all it outputs. In my second reply I was merely pointing out that you asked in the wrong forum - this belongs in the ASP.NET forum since it has absolutely nothing to do with C# because ASP.NET can be used by any managed language (i.e., you could write an MC++ assembly that the .aspx pages expose).
Asking for help in forums is not what I was saying you did wrong - only that it was posted in the wrong forum. Regardless, I hope my first reply was informative. The ASP.NET tracing does provide a lot of information - about everything you could think of - and is better to use then a home-grown solution since the tracing is built deep into ASP.NET. And yes, I am aware of a lack of tracing and what-not in ASP - I've been doing this long before ASP was even an idea.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I have a problem - i have a bunch of processes reading and writing to the disk. I simply want to know which files / directories this processes are accessing.
I tried using the FileSystemWatcher object - but i can only get which files, have been modified deleted, etc. I can get which process caused that change.
So I'm looking for something that when the file system receives a read request, it must be aware of which process is making the request - or something along these lines.
ideas?
|
|
|
|
|