|
It might be a bit complex for the application, but I work with a SCADA system that has to collect log entries from multiple devices and is at risk from the same potential problem. The solution in my situation is a small log server that runs on its own. When devices come online, they register with the server, then maintain a queue of events internally. The free-running server adds each active device to its polling list, and sequentially requests a dump of queued events from each device, one at a time. Since each device includes a time stamp for each entry, the complete set of events is easily sorted by the log server so that all events appear in the log sequentially.
You could implement something similar in your app, with each instance of it generating an event when it has something to log, and the separate log server subscribing to the events. The server component would retrieve log events from the sending instance of your program and manage the log file itself, eliminating contention. Just a thought...
Will Rogers never met me.
|
|
|
|
|
sheldons wrote: when writing/appending to the log from my app while someone else is.
Just to verify - this is because multiple applications are writing and not just because there are multiple places in one app that does it?
Also have you looked at nlog? Or log4net?
|
|
|
|
|
I don't see a reason why you want to use a single log file for multiple user, this problem will definitely happen. A separate log file for each user will be advisable.
|
|
|
|
|
Sounds like your logger class needs to implement a queue based approach - each call to AddLog() or whatever you've called your main logging method doesn't attempt to do the write there and then, but puts the details of what to write onto the queue....the queue then proesses each one in turn, meaning that you shouldn't get mulipe write attemps....
C# has already designed away most of the tedium of C++.
|
|
|
|
|
I'm somewhat new to OOP & having a little trouble setting up some classes. Here's a quick little background on my project:
--------------------------------------------
Basically, I need to create some objects for working with excel similar to that of the excel objects within the "Microsoft Office Object Library" (I'm using the ms open xml sdk kit, which seems to require a little more work than the ms object library). In particular, I'm looking to create 3 objects:
-Workbook
-Worksheet
-Range
-My Workbook class would contain methods such as "OpenWorkbook" and "Save".
-My Worksheet class would contain methods such as "OpenWorksheet", "InsertWorksheet", and "CopyWorksheet".
-My Range class would take a range of cells and contain methods for formatting that range such as "FontColor", "FontSize", etc.
-----------------------------------------------------
My issue:
I need to pass around properties from object to object but unsure on how to do so in the cleanest fashion. For example, within my Workbook class, I declare the following property:
public WorkbookPart WbPart { get; set; }
I will then need to use this "WbPart" property within my Worksheet class. For example, to insert a new worksheet, I need to use the following:
WbPart.AddNewPart<worksheetpart>();
My question
What's the best way to pass around these properties from class to class? Should I create a base class for this or something, and if so, how would I create this base class (I'm unfamiliar with base classes)?
Thanks.
|
|
|
|
|
I don't understand the purpose of the WookbookPart.
The simple approach to this is that there are ownership relationships here (a sheet belongs to a book, and a range to a sheet), which implies classes like:
class Workbook {
List<Worksheet> Sheets;
}
class Worksheet {
Workbook Owner;
List<Range> Ranges;
Cell GetCell(int x, int y);
}
class Range {
Worksheet Owner;
List<Cell> Cells;
}
class Cell {
Worksheet Sheet;
object Value;
}
I'm not sure that the list of ranges actually makes sense as ranges are dynamically created (correct?) so there isn't a fixed list to add to and read back from. I've given each class a reference to its owner, which can be null if you have 'orphaned' references (creating a sheet dynamically and not yet added to the book, etc). You'd then want to make sure that when adding things to the list in the parent, they had their Owner property updated accordingly.
|
|
|
|
|
|
hi to everyone
i want to loading a big image(350 m) in my application how can i do it?
when i try to load it from normal way it's take 900m of my memory
|
|
|
|
|
You are trying to load image with size 350MB?!
I Love T-SQL
"VB.NET is developed with C#.NET"
If my post helps you kindly save my time by voting my post.
www.cacttus.com
|
|
|
|
|
It's a fairly common to have large file sizes when doing print or other work requiring high resolution graphics.
|
|
|
|
|
|
In that case, it's not going to take less than 900 MB's of memory unless you don't need it to be in memory as a bitmap.
What is the image going to be used for? Possibly the application allows you to stream in the original 350 MB file (which I assume is a compressed format?) rather than a bitmap.
|
|
|
|
|
i want to use it for GPS map. the image is in jpg format
is there anyway to loading a part of the image in to application?
|
|
|
|
|
You want to partition the image. (Or do the drawing in a better way ... a GIS style data backed vector render is probably what you want for a GPS map, but I digress.) A JPEG isn't a partitioned format, so I suggest that on first use, you partition it into sensible size (one screen or larger, file size a few MB) tiles and save each one as a file, then dispose of the huge image. You can then implement a load-on-demand tiling algorithm. This will still take 900MB of memory (in fact a little more, that plus one tile so maybe 920MB) during the partitioning operation, and I don't think there's a way to avoid that if you are required to use a huge JPEG as the source. Once the app is running you will need to have up to 4 tiles loaded at any one time, possibly up to 9 if you want to preload for scrolling.
Note though that your OS will almost certainly leave these files in some sort of in memory cache and they will still shunt other things out of the cache, so although your application will play more nicely with the memory it is still going to be slightly unwieldy.
|
|
|
|
|
BobJanova wrote: Note though that your OS will almost certainly leave these files in some sort of in memory cache and they will still shunt other things out of the cache, so although your application will play more nicely with the memory it is still going to be slightly unwieldy.
Odd comment. If the OS decides to cache those files, even at the cost of other cached items, then it probably has good reason. It could speed up scrolling over an area a second time, as the tile will still be in memory. Exactly what caching is supposed to do.
You make it sound like the OS caching is a bad thing... If the OS is good, then it's quite capable of predicting what files are more likely to be reused.
So, what point you are trying to make here, I don't know ...
|
|
|
|
|
Yeah I couldn't quite find the words to phrase that how I wanted. It is not a bad thing, but just something to be aware of.
|
|
|
|
|
Ahh like that. It's true that it might be fun to be aware of, but actually it's not your concern as a programmer what the operating system does and doesn't. Certainly where, in this case, it can only work to your advantage.
Not to mention that there is no easy way of preventing this behaviour. I think there might be a way, on opening, to specify that a file will only be used once and therefore does not need to be cached. Not entirely sure on that though.
|
|
|
|
|
IMO, I have to tell you that there are certainly memory issues when dealing with bitmaps especially of larger size. For project such as GPS, just have larger memory and couple of parallel programming techniques with memory cleau-ups
|
|
|
|
|
Hi to whomever may be reading this, my name is Njabulo Mpungose I am a first year IT student at the Durban University of technology in Durban South Africa.My current programming subjects are JavaScript,Java and c#, I am trying to teach myself some other languages as well.I am looking for somebody who has the time and patience to help me along.I think I have grasped the basics but I require someone to help me sort out the murky areas of computer programming. I would highly appreciate it if someone took a chance on me.
My personal email address is: 21124627@dut.ac.za
|
|
|
|
|
First, don't include an email. This is a public forum and any responses should be posted here. Also, if anyone would like to respond privately to you they can use the functionality here to do so.
You may want to contact any of the CP Mentors[^] to ask this.
And of course, post any questions you have here. Just make sore to read the posting guidelines, http://www.codeproject.com/Messages/1278604/How-to-get-an-answer-to-your-question.aspx[^]
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
What about rate payment?
I Love T-SQL
"VB.NET is developed with C#.NET"
If my post helps you kindly save my time by voting my post.
www.cacttus.com
|
|
|
|
|
1) Never post your email address in any forum, unless you really like spam! If anyone replies to you, you will receive an email to let you know.
2) Nearly everybody here works for a living, and doesn't have the time available to do one-to-one mentoring. Besides, isn't that what you are paying your course fees for? A Tutor?
3) Don't try to learn everything at once: if they are teaching you JavaScript,Java and C#, then stick to just them - there is a heck of a lot to learn in the last one alone! Learning in breadth can only be effective when you have reached a sufficient depth of knowledge and experience.
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
I want to connect biometric device in my web base application please help me
|
|
|
|
|
That's far too broad a question. Presumably the device has an API associated with it - you should contemplate using this API, reading the documentation beforehand. Also, are you intending for the device to be situated on the client side? If so, you're probably not going to be able to do what you think you want to do without deploying your functionality as an ActiveX control, and that opens up a whole can of worms.
|
|
|
|
|
How to use goal seek like approach or alternative in calculation
|
|
|
|