|
|
The .NET Framework has a lot of classes and which ones you need to know depends a bit on what you want to do, but here are a few ones I'd recommend knowing regardless of what field you want to specialize in:
|
|
|
|
|
Hi all,
I have written a FileSystemWatcher console application, I could able to monitor all changes happening in the folder that's assigned to it and all its SubFolders, if we consider the parent Folder as Root folder, then in our organization there are 10 different root folders where there are going to be at least 200 files are dropped everyday in root folders and sub folders combined.
Hence what I did was I put a table in which admin user can add root folders and start the application then I am using array of FileSystemWatcher and to all these FileSystemWacher objects I am assigning same OnCreated, OnChanged events which in turn are going to call a same function which does only a small thing that's it puts an Entry into Table with FullPath of the file that's dropped with IsProcessed flag false, there's another Application that run different than this and processes those files which are in this Table with flag false and makes the flag to true, anyways my question is not about the second application, but first application that has FileSystemWatcher array.
My question when all those at least 10 different FileSystemWatcher objects assigned with same OnCreated, OnChanged events and in turn those events are calling the same method which is inserting a record into the table, I am worried that can it create any problems in any cases like if files dropped same times or locking etc. But one +ve thing is the method which is being called by the Oncreated and Onchanged events is not doing anything other than simply writing a record, maybe some milliseconds task, the possibility of Files being dropped at the same time even with milliseconds accuracy is minimum.
I am using array of FileSystemWatcher objects to reduce the number of Applications that would be running on the Server, I want to make one Application to start instead of making 10 applications to start.
Please advise me by anyways, a code snippet, a link or even a suggestion would be helpful, thanks in advance my friends.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
200 files a day? That shouldn't be a problem at all.
You have to keep your FileSystemWatcher event handler code execution time as short as possible to avoid buffer overruns in the FSW's. If that means creating a piece of data that another thread picks up to do the actual database processing stuff, so be it. I really wouldn't keep the database code in the event handler because database operations can take longer than expected and cause your FSW's to overrun their buffers, thereby losing changes.
|
|
|
|
|
indian143 wrote: there are 10 different root folders where there are going to be at least 200 files are dropped everyday
I doubt that is significant. Even presuming that you mean 2000 (200 x 10) given a 'day' that means overlaps within the time period of a single database write is very small.
And events can handle more than one at a time (real time) but there are limits.
Given the failure potential is so low it probably isn't worth your time unless you do have the time. If you do have the time or perhaps you have a real concern (based on realistic data) about growth then you can follow the suggestion in the other post.
Basics of what is in the other post.
1. Create a thread safe queue that you can put a request one.
2. Your event handler puts a request on the queue. Your event handler does not interact with the database at all.
3. Create another handler that reads from the queue. It blocks until a request is on the queue. Each request gets written to the queue.
On shut down the application must do the following
1. Shut down the event handler
2. Wait until the queue is empty
3. Exit.
And just to clarify if it really is only 200 a day, your real expectation of growth is low and you do nothing but add a record to the database. And there are no other extenuating circumstances like very poor networks, database is half a world away, etc, then I wouldn't bother spending the time. Between normal business processing, file system overhead, and speed of modern machines it can easily keep up with 200 a day.
You time might be better spent worrying about what happens if your application is not running for a while and then you start it up - how do you resolve what is missing.
|
|
|
|
|
Hi all,
I have an Existing Database, when I use Entityframework DbContext approach I have to write all the classes that are going to be created as Tables in the back-end, but writing all classes is long process, is there anyway I can just create all the classes for my existing database still can use DbContext?
Any help a code snippet, a link or even suggestion is going to be very helpful, thanks in advance.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
|
I'm using MVVM that controller side change different database and table value and signalr push notification. So not supporting transactionscope. Any other available in C# code?
|
|
|
|
|
|
Hi,
Since a few days I receive the following error during debugging of my vb.net program.
With this program I setup a connectionstring with a access datebase.
An exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.Configuration.dll but was not handled in user code
My program is not changed and when i use the same program on a differtent computer it works.
There I expect it has something to do with windows 10, but I'n not sure.
It always worked before.
As fas as I know I cannot attach any picture otherwise i would have attached a screenshot to this forum.
I hope somebody can help me out.
|
|
|
|
|
You need to add a try/catch block to your code to catch and diagnose the exception.
|
|
|
|
|
Depending on the operating system and the way the app is installed, one or more "config" files may be stored in various locations: ProgramData; AppData; Users; etc.
Depending on how the app is "moved" / installed on a different computer, one or more config files may get missed or put in the wrong folders.
The fact that the exception references "System.Configuration" leads me that conclusion so I would trace the code that references "configuration" settings in the app.
(Sometimes an "uninstall" / re-install will work; depending on the install exe / msi).
|
|
|
|
|
Thanks for your answers, now i have some I will check your suggestions.
kind regards
|
|
|
|
|
Hi I have found the reason for this error.
Under Windows, C drive users, the hidden folder AppData there was the config file.
User\AppData\Local\ProgramName\ProgramName.vshost.exe_StrongName_m4e20rktsmm0d44mssjiomu5bbsjaezz\1.0.0.0\user.config
I have deleted this file, now it is working again.
Everybody thanks and have nice holidays.
regards.
|
|
|
|
|
And prettig kerstdagen to you too!
|
|
|
|
|
Hi,
It maybe unrelated issue, but if somebody can help me in
My company is using GitExtensions for Source Control, so far no problem as I was able to use Check-in Check-out etc, but now I got all together different issue, I need to create branching of my Application, I went into GitExtensions UI then selected the application I want to create branch clicked "Create New Branch", I selected branch name, it says it successfully created the branch, yes it shows alongside with the main branch. I am not sure what can I do with that branch, I am not to see it separated from the branch nor able to check it out separately or even I am not able to merge this main branch into the new branch. Any suggestion or a link anything would be very helpful.
Please help me.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
You've already asked one question that has absolutely nothing to do with .NET in this forum and been told that you shouldn't do that. Why did you think we would find it acceptable for you to ask yet another none .NET question in this forum?
This space for rent
|
|
|
|
|
|
|
OK my friend that's why I said sorry before putting the question, for that saying me to get out is big, I said sorry and I didn't know any of the Git forums and I found Git has difficult learning curve.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Hi,
I am sorry if this is little of the topic, I apologize for it.
I am remoting into my Server to do some stuff, but it needs the System to be logged in some specific user, but when I am trying to remote into my Server its always logging in me with my Lan Id, but I want to change the Logged in User to the account that I wanted, but I am not finding the option "Log in as different User" in remote desktop, if I log off my machine and log in with that account I may lose stuff that I am working, is there any way I can select log in as different user option on the Remote Desktop instead of me Logging off my machine and logging in as different account.
Any help a link or suggestion would be very helpful, thanks in advance.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
This has absolutely NOTHING to do with the .NET Framework.
Having said that, open Remote Desktop. In the bottom left corner of the window to specify the machine you want to connect to, there is a drop down that says "Show Options". The rest should be obvious.
|
|
|
|
|
I do agree, that's why I asked for apologies before my friend.
Thanks,
Abdul Aleem
"There is already enough hatred in the world lets spread love, compassion and affection."
|
|
|
|
|
Hi,
Please suggest books for preparing for the Brainbench .net framework 4.0 test
[Brainbench .net framework 4.0]
regards,
NJ
=====================================================
The grass is always greener on the other side of the fence
|
|
|
|
|
Why not go to www.google.com and look for one yourself?
|
|
|
|