|
Have you resolved this? Or looked around at the WPF articles here. Josh Smith might be the guy to ask.
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Yes, I resolved it, thanks. It was just a matter of passing "Connections" and "Local" queue types to GetPrintQueues.
Jeff
|
|
|
|
|
Hello,
I am currently developing an application that will serve as a client interface for a Rimage cd-producing server. This application is intended to run on the same Windows box that the Rimage is connected to and monitor a directory on the file structure or network for folders (patient studies to be burned to cd) that are sent there to be processed. Once a folder is detected in the target directory, that folder is moved to a temp directory, where an order is created and the processing begins.
The process for the order is managed entirely within a worker thread, and each order gets its own thread to run in. The thread method contains a WHILE loop that cycles until the order's state property is set to indicate completion. Inside this loop are sets of conditionals that move the order along as the order's state is advanced by the server. Once the order is done the loop exits, and a cleanup routine is executed that removes the files that were processed and other completion-related tasks (logging, UI updating, etc).
I have a couple questions related to my design that I'm hoping a more seasoned developer (read: anyone) might be able to answer and possibly point me in a better direction (read: something that actually works).
1) In the order detection process, when a folder is found in the target directory, I load that folder into a DirectoryInfo class and check the LastWriteTime property. If LastWriteTime.AddSeconds(10) < DateTime.Now , I move the folder for processing. If not, the folder is left alone until the next pass, during which it will be checked again. The objective of that check is to make sure that all contents to be burned have been copied over before the order process begins.
This has usually seemed to work fine, but lately when I test using larger folders of data (+100megs), the folder will be sent for processing before the files are done copying.
My question is: does the LastWriteTime (or even LastAccessTime, for that matter) account for any subfolders inside the folder being written to or does it only check for files being written to in that particular folder, ignoring any subfolder activity?
2) In the method that the worker thread runs, the constantly cycling WHILE loop doesn't seem like the best way to do it. However, the thread needs to stay alive through two different processes; the first process that tells the Rimage to create an ISO image of the files and the second process that sends an order to the Rimage to burn that ISO image to a cd. So having the method loop while it worked its way through those processes seemed the best way to do it at the time. Upon further reflection, I'm sure there's a better method than that to manage multiple orders independently while not tying up my UI thread and making my form non-responsive...I just don't have a clue what it is and a lot of the tutorials that I've looked at just don't seem to fit with what I'm trying to accomplish here.
In case you couldn't tell by now, I'm a very inexperienced programmer (read: HTML monkey/Layout guy) that has been assigned with this project. Kind of like learning to swim by being tossed in the middle of a lake. With an anvil around your ankle. And sharks. I would really appreciate any guidance or links to resources that some kind-hearted guru can provide that would help with the above issues.
Thanks in advance.
|
|
|
|
|
1 - you could check the size of the folder with subfolders, then check it again a few seconds later to see if it's being writtn to. Also, if it is being written to, attempts to rename it will fail.
2 - You need to create a BackgroundWorker thread, and then keep that alive, if need be.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
1 - you could check the size of the folder with subfolders, then check it again a few seconds later to see if it's being writtn to. Also, if it is being written to, attempts to rename it will fail.
Thanks for the idea, I think that will work better than what I'm using now.
2 - You need to create a BackgroundWorker thread, and then keep that alive, if need be.
Maybe I don't understand exactly how the BackgroundWorker class works, but doesn't each BackgroundWorker only run one thread at a time? And if this is the case, and my application needs to be able to process orders as they are dropped in the target folder, wouldn't I have to create a new BackgroundWorker for each order? Would this be a heavy performance hit on the server's memory with all those components being created (in the case of say...20 orders...are submitted at the same time), as opposed to just launching threads to run it and keeping it alive via the loop?
|
|
|
|
|
Well, I was saying you could keep the one thread alive, but if that's your goal, then there's no reason not to create a thread for a new job, and let it die when the job ends. Then you can either choose to only have one thread running ( and have a job queue that it keeps pulling from until it ends ), or have multiple jobs going ( not likely, as I believe you have one piece of hardware to control, right ? )
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
If I'm understanding this correctly, your solution would make it so that there was only one order being processed at a time, with the thread constantly cycling and picking up the next order in line once the previous order is finished. If we were simply interfacing with a direct piece of hardware, that would work...
However (and I apologize for not mentioning this and causing the confusion), I am programming this to work with an established API from Rimage, and my client software is actually connecting to a software-system as opposed to directly to just one machine. Theoretically, there could be as many actual Rimage servers attached to the system to process 20 orders at once, and their software has its own queue internally. My application simply prepares the order, sends the ticket and monitors the status via a listener class that inherits an interface of their design. By designing each order to run in its own thread, I was attempting to maximize the use of their internal queuing system as well as the efficiency of my own program. Technically, I should be able to throw as many orders as possible at the API and it will manage the workflow on the server side...I just have to monitor the status on my end of the orders that I send.
My question regarding the threading was really me asking if there was some way to make the process that runs in the thread more event-based instead of so rigidly set inside of conditionals. Say, for instance, if I were to create events on the order object and assign handlers for those events from inside the worker thread to progress the order along, and then didn't loop the worker thread to keep it alive, the thread would just exit and those handlers would just fire into nothingness? Or would they fire on the main thread and cause exceptions because the handlers were declared inside a thread other than the UI thread and caused UI interaction indirectly when the handlers were called and the UI was updated with results (which I know enough to know that is a big no-no)?
I don't know...I've been pondering over some of these things for a few hours and been doing some more searching on the web for answers. I think I might have thought of something that will make this whole project a lot easier, but I have to flesh out the idea in the morning to make sure I'm not overlooking something...if it works, the whole threading issue might be moot.
Thanks for the advice so far, though...most assuredly this is not the end of my stupid questions
|
|
|
|
|
Don't keep worker threads alive, just create threads as you need to, one for each job. You can create a thread pool, just create a container of threads, and look through for an idle one to start, if you want a fixed number, or keep adding to it if you're happy for there to be unlimited threads.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi all,
I want that the dll of my application which are on the client machine after deployment should be protected that no one can see the code and logic using some deassembler tool. How should i protect this???
i tested a third party tool to read a dll of some trial version application from internet. Its opens the code easily, but when i tried the same tool with some system32 dll, the dll showed to be locked. I want this to be in my dll also. How is it possible ???
Sample Code, Suggestion, References welcom ........
Thanx
sandeep
|
|
|
|
|
sandeep kumar pundhir wrote: How should i protect this???
You can't. If the processor can run the executable, there will always, at some point, exist an unprotected version in order that it can be sent to the processor. Therefore there must be some way to decrypt the code for the processor, and once that is cracked then you have no protection at all. The best you can ever hope for is to slow down someone.
sandeep kumar pundhir wrote: i tested a third party tool to read a dll of some trial version application from internet. Its opens the code easily, but when i tried the same tool with some system32 dll, the dll showed to be locked.
Define "locked". Could it be that the DLL you were using was not a .NET DLL and the tool could not interpret it.
|
|
|
|
|
Please don't cross post.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
You used a tool, probably .NET Reflector to look at a .NET DLL. This is exactly what it's good for. .NET Reflector won't work on native code .DLL's, like on just about everything in the System32 folder.
What you want is not possible with a .NET DLL, or any managed code assembly for that matter. You can obfuscate the code and make it more difficult to be reverse engineered, but you cannot stop anyone from eventually getting at that code.
|
|
|
|
|
This seems to be the recurring nasty surprise about .NET. This has to tie with 'how do I deploy without needing the framework' as the top question asked.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I know. I hate answering the same question over and over again. Maybe we should put together a FAQ and post a link to it in everyone signature. "The top 10 questions asked on CP"
|
|
|
|
|
I'm bored to tears up here! I got called back into work (an hour drive) after being home for an hour and a half. Problem with IP tunnels in the WAN. I've been on hold with our "Lack of" Help Desk for just over 2 hours now waiting for them to figure out what they need to do to fix the problem.
So, what was for lunch?
|
|
|
|
|
I would like to know what happens when
you write unmanaged code in NET. The compiler
generates Intermediate Language code, but just
this code isn't "supervised" by the framework?
Also, I would like to know what happens when
you write assembly code in a .NET project. I
noticed that the __asm keyword is "syntax-hilighted".
Can machine code and Intermediate Language code exist
in the same .exe file ???
I am asking all these because, despite the fact that
I like the new capabilities the NET framework provides,
I am seriously concerned about the speed of my apps.
Thanks.
kostas KEL
|
|
|
|
|
|
1) All .NET code is converted to CLR compliant Intermiediate language code. This code is readable if you open .NET exe files in some of the native .NET debugging/.NET servicing applications. Most programmers who want to keep their code fairly safe use Obfuscators (hopefully that is spelled correctly). These applications make it harder for hackers to get the source code for the program.
2) It depends on your perspective with regards to program security with .NET compilations over native compilation.
3)One project can only have one language type files in the project. VC# applications can only have .cs files in the project, you will not be able to put VB or VJ# codefiles in the C# application. You can however have multiple assemblies or projects in the same solution that are of different languages. All compiled .NET assemblies can be used as references to VS projects of any .NET language.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Hi,
I have been asked to take a seminar of 30 minutes on advantages of Microsoft .NET framework 2.0. Our company is currently using framework 1.1, so they want me to tell them in my seminar whats the advantage of moving to Framework 2.0.
I have to take this seminar on this friday (18 - May), can someone provide me some resources or more information on this. I dont have access to google here, but have access to code project, msdn and some .NET related web sites.
Regards,
Blumen
|
|
|
|
|
It will be better for u to access MSDN & be prepared for that event.It consist of all the features that framework 2.0 is providing along with comparison to framework 1.1.u can also have the option to get knowledge of Framework 3.0 for Cross Question.
Bye
Ashwani Kumar
|
|
|
|
|
|
I am writing a command line utility in C#. When I try to run the program from a different directory with a batch file or if I put the program folder in the Path statement I get a file not found error on the App.config file. How do I build a command line program that can be called from outside it's build or installed location?
Jay Bowman
Springfield, IL
|
|
|
|
|
Hi all,
I came across a funny and I hoped you could help, I was profiling the performance of different operations in .NET and I found that double operation was faster in debug mode, than in release mode. I created a small project to test this premise it can downloaded here.
double i, j, dTest = 0;
DateTime tmrStart;
TimeSpan spanCost;
tmrStart = System.DateTime.Now;
for(i = 0; i < 100000; i++)
{
for(j = 0; j < 100000; j++)
{
dTest += i+j;
}
}
spanCost = System.DateTime.Now - tmrStart;
Console.WriteLine("Test took {0} milliseconds", spanCost.TotalMilliseconds);
The project code is the same as above code snippet. All my optimizations are set to the project defaults. Surely this can't be right ??? I have tested this on two boxes; my laptop and a performance machines with multiple processors and acres of ram, and I getting comparable results on both. So what am I doing wrong ?
C:\Documents and Settings\Administrator\Desktop\DoubleTrouble\DoubleTrouble\bin>
debug\doubletrouble.exe
Test took 82218.75 milliseconds
C:\Documents and Settings\Administrator\Desktop\DoubleTrouble\DoubleTrouble\bin>
release\doubletrouble.exe
Test took 311218.75 milliseconds
C:\Documents and Settings\Administrator\Desktop\DoubleTrouble\DoubleTrouble\bin>
|
|
|
|
|
Confirmed. Weird!
I looked at the IL between the two version. Ther'yre not that much different at all. Both are doing just about the exact same thing, with the Debug version peppered with NOP instructions and a couple of extra blocks like this:
ldc.r8 10000.
stloc.s VB$CG$t_double$S0
ldloc.s VB$CG$t_double$S0
ble.s IL_001b
The Release version doesn't have the to stloc.s and ldloc.s instructions, but it otherwise identical.
If you were to read through the IL only, you'd say that the Debug version must run slower! Hmmm....
|
|
|
|
|
I examined the IL earlier and thought they where more or less identical.
Will have another look, thanks for the confirmation. I am not sure where this leaves me though.
|
|
|
|
|