|
There's no substitute for trying.
|
|
|
|
|
PIEBALDconsult wrote: There's no substitute for trying.
Knowing perhaps?
|
|
|
|
|
But as Richard Feynman was fond of saying, don't rely on authority. Perform the experiments yourself and see the evidence for yourself. So long as your knowledge came from your own efforty, your willingness to try, then great. Otherwise, how do you really know? The authority could be lying or simply mistaken.
|
|
|
|
|
My point exactly.
I'd also refer to Edison and his 10000 ways that don't work.
As I say, "You learn more from your mistakes than from getting it right the first time."
|
|
|
|
|
Colin Angus Mackay wrote: or simply mistaken.
It has happened
|
|
|
|
|
it is just that my machine doesn't have more than 2 GB of RAM, so I relied on others who have huge memory space to test it out...
|
|
|
|
|
I created a C# Windows Service to clean up files on some equipment PCs. Along with the service I created a configuration Windows App. that allows me to install, start, stop, uninstall the service and create an configuration XML file to change folder locations and such.
Purpose:
The service uses an OnTimer event to periodically check a folder for files. It then creates a backup copy on a network drive and deletes the local file.
Problem:
The following code does not work in the service but will work if performed from a button in the configuration app. The AddToFile function is working in the service as it just writes the string to a text file.
The Service is configured to log on as a local system.
Question: Why does this not work from within the service?
//Code Section
AddToFile(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + " Copying Reports to Network");
foreach (string sfi in Directory.GetFiles(SC.LocalReportFolder))
{
FileInfo fi = new FileInfo(sfi);
FileInfo fn;
if (SC.CU.AppendMachineName) //Configuration file variable
{
//Adds the machine name to the report
string nwname = fi.Name.Replace(fi.Extension, "_" + SC.MachineName + ".txt");
fn = fi.CopyTo(SC.CU.NetworkReportFolder + "\\" + nwname, true);
}
else
{
fn = fi.CopyTo(SC.CU.NetworkReportFolder + "\\" + SC.MachineName + "\\" + fi.Name, true);
}
fn.Refresh();
//If the copy was successful then delete the local file.
if ((fn.Exists)&&(SC.CU.DeleteLocalReport))
{
fi.Delete();
}
}
//End of Code
|
|
|
|
|
Hi,
my first hint would be that the local system account doesn't have the appropriate rights to access the network folder.
Robert
|
|
|
|
|
After some further searching I found that a service cannot use an existing mapped drive. It must create the map itself to work. This also has problems as a service may start prior log on an thus the network is not available.
Looks like I may have to use my Windows App in the startup folder with a timer or filewatcher event.
|
|
|
|
|
Or periodically check for the existance of the drive.
P.S. I don't use mapped drives. (They're so '80s!)
|
|
|
|
|
If you're going to access a file system on another computer, your service has to be installed with a user account that exists on the remote system. The default user for a service is "Local System" or something like that. So, you need to have (or create a new) user account with appropriate permissions on the remote system, and then install your service with those account credentials on your local box.
Put a try/catch block around your System.IO calls, and you'll see exactly why they're failing.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
I'm writing a soap client that interacts with a web service. I let Visual Studio create the proxy classes from the WSDL file.
During the first soap request, the proxy class's InvokeAsync methods takes about 20-30 to return. I doesn't matter which
soap request I make, the delay is always there the first time. All subsequent soap request return immediately from InvokeAsync.
I subclassed SoapExtension, and set a breakpoint in ProcessMessage. The delay occurs after BeforeSerialize and before AfterSerialize.
Any idea of what is going on, or how to further debug this? Thanks.
|
|
|
|
|
woodrvr wrote: Any idea of what is going on, or how to further debug this?
Any database connections being used on the server?
led mike
|
|
|
|
|
don't know. the delay, as far as i can tell, seems to be during the serialization process, and before the request get sent. i dump the request and response xml to a file, and they're less than a second apart.
|
|
|
|
|
|
What is your question? Do you want someone to tell you how to build the entire system? That's not going to happen. The purpose of this forum is to provide solutions to specific programming questions, not to do someone's work for them. I suggest you purchase a beginner's ASP.NET book and work your way through it.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Thats a great idea. You're a funny guy Paul.
However, I am not looking for someone to build the whole system... I'm looking for some advice re: good articles to reference etc and starting points...
|
|
|
|
|
Roman Olney wrote: good articles to reference etc and starting points...
Well you can start here or here or here or here.
Can't really ask for more now, can you?
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson Because programming is an art, not a science. Marc Clifton
|
|
|
|
|
Roman Olney wrote: You're a funny guy Paul.
Not really. All I did was to point out that your question was of too general a nature to be answered in this forum.
Read the forum rules, paying specific attention to no.2.
I suggest you post again if you have more specific questions relating to the implementation of your project.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Roman Olney wrote: How do I implement such a system using c# in Visual Studio...?
What do you have so far?
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
|
Roman Olney wrote: assigning a coloumn ID to the quote and giving the client a page where they could query that ID and get a copy of their quote...and although that works fine, i want it to be more sophisticated than that.
Why be more sophisticated? That is the general way it is done.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
|
|
|
|
|
Roman Olney wrote: i want it to be more sophisticated than that.
Really? Try researching the KISS Principle and Rube Goldberg.
Hint: Both have pages on Wikipedia
led mike
|
|
|
|
|
I need to be able to parse the following line, I am not even sure regualar expression are
the best option.
LIC#:ABC123 YRMD:03 MAKE:CHEV BTM :CP VIN :1G1JC12F137230800
into
LIC#:ABC123
YRMD:03
MAKE:CHEV
BTM :CP
VIN :1F1JD12F137230735
And then capture the data after the semicolon.
All can be variable length and there isn't a delimiter
Unfortunately, you also can't depend on the tags having no spaces with the colons (i.e. VIN :, vs YRMD:.
I have been trying to use Grouping to parse this.
I am newish to regular expression and thought maybe I should use them to solve this problem.
Are regular expression even a good fit for this problem?
Any suggestions appreciated.
modified on Friday, March 21, 2008 12:01 PM
|
|
|
|
|
You don't parse with regular expressions.
Try something like this:
private string SplitValue(string str, char delim)
{
string[] parts = str.Split(delim);
return parts[1];
}
private bool Test7()
{
bool result = false;
string original = "LIC#:ABC123 YRMD:03 MAKE:CHEV BTM :CP VIN :1G1JC12F137230800";
string[] parts = original.Split(' ');
if (parts.Length != 7)
{
return result;
}
string license = SplitValue(parts[0], ':');
string yrmd = SplitValue(parts[1], ':');
string make = SplitValue(parts[2], ':'); ;
string btm = parts[4].Replace(":", "");
string vin = parts[6].Replace(":", "");
return true;
}
The code above is based on the string you provided. Since there appear to be spaces in places where there really should be none, you can't really get away with a single split command, so you have to improvise. Yeah, I could have used substring instead of writing another function to split the first three parts, but what the hell, I had time...
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|