|
Well, you don't want to do the set commands every time you run the batch file because every time you do, it appends your path change to the system path. You should check the environment variables and make sure you need to do that before doing it. As far as the "cmd" line, you can set the working directory for an app by using the Process object..45 ACP - because shooting twice is just silly ----- "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." - J. Jystad, 2001
|
|
|
|
|
I need to write a regular expression to control the textbox input.
Range : 1.00 to 2.00
Please tell me how?
|
|
|
|
|
The first character would be a "1" or "2". The second character would be a period. The third and fourth characters would be "0"-"9".
|
|
|
|
|
1\.\d\d?|1|2\.00?|2
I suggest you get a copy of Expresso[^] if you are going to play with regular expressions - it break them down and helps you design them.If Barbie is so popular, why do you have to buy her friends?
Eagles may soar, but weasels don't get sucked into jet engines.
If at first you don't succeed, destroy all evidence that you tried.
|
|
|
|
|
hi,
I use tcpclient to build client server application
how to detect that the LAN is disconnected (unpluged) when we call networkstream.read()?
//code
while(true)
{
data = new byte[1024];
recv = ns.Read(data, 0, data.Length);
// I unpluged the LAN but it still reading process
if (recv == 0)
break;
Console.WriteLine(
Encoding.ASCII.GetString(data, 0, recv));
ns.Write(data, 0, recv);
}
regards,
andy
|
|
|
|
|
you need to send packet from clients at regular intervals. I may call it KeepAlive. And when it is not received. It means it is disconnected.
Ahsan Ullah
Senior Software Engineer
MCTS 2.0
|
|
|
|
|
hi ahsan,
I have tried to sent the packet with interval 1 second each packet,
but it needs 35 packet to detect that the client is disconnected.
//code
while (isPlugin)
{
Thread.Sleep(1000);
try
{
if (isPlugin == true)
{
byte[] data = new byte[1024];
data = Encoding.ASCII.GetBytes("IsPlugin");
try
{
Log.Write("write Plugin");
sessionNetwork.Write(data, 0, 8);
}
catch (Exception ex)
{
Log.Write("Plugin is remove error : {0}", ex.Message);
isPlugin = false;
break;
}
}
else
{
isPlugin = false;
break;
}
}
catch
{
Log.Write("Plugin is remove");
isPlugin = false;
break;
}
}
if (isPlugin == false)
{
Log.Write("Plugin is remove DisconnectOntraceSessionThread");
ClientDisconnect;
}
|
|
|
|
|
From the snippet that you have shared i can't say for sure what your problem is. But if you could get my point. i.e. Keep track of your client(s) by sending an empty message for acknowledgment that client is alive.
Ahsan Ullah
Senior Software Engineer
MCTS 2.0
|
|
|
|
|
Have you tried to flush? Your "packet" (which isn't a packet, remember this is TCP, you're working with a stream) is so small that it's probably just going to be buffered.
Btw, reserving 1KB and then just throwing it away doesn't help in any way.
|
|
|
|
|
hi,
the problem is solved,
I use Ping to detect the client is disconnected
regards,
andy
|
|
|
|
|
Is there a way to create a program to go to a specific web page and get the source code from that page and store it into a string?
I tried Google-ing this except the moment you put the words "Source Code" and "C#" together all you get is a bunch of code for programs.
Thanks to anyone who has any answers to my question
|
|
|
|
|
|
Thanks for this, I used it along with another chunk of code I had and it worked perfectly, thanks. Only problem was whenever you go to this website, the firs time you visit a pop-up appears and asks for your name, and now C# is getting the HTML behind that pop-up. Sucks, but thanks anyways!
|
|
|
|
|
If you mean the code-behind on an ASP.Net page, the answer is No. If you mean the HTML that was used to render the page, then yes. I wrote an article here that scrapes the CodeProject "My Articles" page and parses the returned HTML.
CodeProject Article Scraping[^].45 ACP - because shooting twice is just silly ----- "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." - J. Jystad, 2001
|
|
|
|
|
Yeah I meant the HTML source code, sorry for not clarifying. And thanks for the article
|
|
|
|
|
Good people,
I built an application that needs to send information to and receive it from a server. I have one questions, how do I do that?
I am new to this aspect of programming.
Thanks for any information you can provide.
Blitz
|
|
|
|
|
There are several methods you could use - WCF, sockets, HTTP...
What are your requirements? What kind of data?.45 ACP - because shooting twice is just silly ----- "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." - J. Jystad, 2001
|
|
|
|
|
Thanks for your reply.
I need to send at least 2 and up to 7 separate strings. In essence, the user will be sending some authentication data to the server which will consists of an authentication code and some other identifying information (e.g. a MAC Address, user ID, etc...).
This will enable me to uniquely identify the user in the database on the server. Then, once the server has certified that the user is unique or doesn't exist, then it will send back an authorization which will either be, I suppose, true or false, etc...
Thanks again.
|
|
|
|
|
If the server is a web server, you could use a web service to do that.
If the user has an account on the server, he could just use the built-in .Net authentication stuff.
If the server does not meet any of those criteria, I'd use sockets..45 ACP - because shooting twice is just silly ----- "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." - J. Jystad, 2001
|
|
|
|
|
Hi,
Can someone point me in the right direction on how to search through all files over multiple drives to look for duplicates?
Thanks in advance!
|
|
|
|
|
Hi,
1.
there must be lots of utilities around that do this, some even for free.
2.
if I were to develop one, I would enumerate all files and calculate a checksum for each; then investigate files with matching checksums only.
Warning: different partitions/devices can use different file systems, resulting in slightly different dates (e.g. FAT is accurate up to 2 seconds only), and maybe even slightly different sizes.
[ADDED]Also Daylight Saving Time conventions may be different on different machines on a network.[/ADDED]
Anyway, this would take a while, as all data has to be read from the disk(s) to do it properly. One can not simply rely on file names!
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
modified on Sunday, February 14, 2010 6:08 PM
|
|
|
|
|
Hi,
I know there are a few tools around that can do it. I'm just in it for the experience.
What do you mean with calculating a checksum?
|
|
|
|
|
something like a longitudinal checksum, summarizing all the data into a short number, so you can store it in memory and compare. Equal files are bound to have equal checksums, and equal checksums probably (but not absolutely) indicate identical file contents.
Google or other search engines should be your friend; you might read this[^] and more.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
|
|
|
|
|
Comparing file contents is slow, so you only want to do it when you have to. You can go through the drives and build a hash table of files and their sizes. Different sizes mean no duplicates.
For the files that have the same size, the next step is to look at contents (I'm assuming you also want to detect duplicate contents stored under different names, or with different times.) You could store check sums with the files, as Luc suggested, but check sums could be wrong for similar files. They can be used for avoiding comparing file contents: If the check sums are different, the files are different. But if they're the same, you have to look at the contents for confirmation.
|
|
|
|
|
i have a digital persona reader on my laptop and i wanted to test for finger print reading integration in my custom application. how can i do this? Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|