|
First,I'd like to thank you for this great effort
how can I shutdown and restart my computer from my app
Dad
|
|
|
|
|
Hi.
You can use WindowsController class, which you can find here: http://www.mentalis.org/soft/class.qpx?id=7
It's really easy to use, for example to shutdown your computer, just write:
WindowsController.ExitWindows(RestartOptions.ShutDown, false);
In file with this class, you'll find simple example.
-- modified at 16:58 Thursday 1st March, 2007
|
|
|
|
|
Hi,
the single-line solution is:
System.Diagnostics.Process.Start("Shutdown", "/s"); // shutdown
System.Diagnostics.Process.Start("Shutdown", "/r"); // restart
/
|
|
|
|
|
|
Hi all,
I am new to c#, learning lots iof new things everday!
I would like help with a simple function, what few lines of code do i need in order to do the following:
A String is passed into the function as parameter (string s), what would i need to add in the function for the number of words to be counted in that string and the result returned as a integer?? any ideas
I know its a simple thing, but im new and would like some help.
Cheers
|
|
|
|
|
This should do the trick:
inputString.Split(" ").Length
"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." - Rick Cook www.troschuetz.de
|
|
|
|
|
it.all,depends;on_the_definition of a'word'.
|
|
|
|
|
Luc Pattyn wrote: it.all,depends;on_the_definition of a'word'.
Very clever.
|
|
|
|
|
for example, if the string is:
"programming is great"
the result would be 3. i.e. 3 words
hope this helps.
Cheers
|
|
|
|
|
Sure, but what about:
r.s.v.p. 0, 1 or 4 words ?
I don't know 3 or 4 words ?
that's really great 3 or 4 words ?
is programming great ? 3 or 4 words ?
three words here 3 or 4 words ? (double space used!)
So you really must specify in detail ... What constitutes a word, how do you
recognize its begin and end, how do you treat composite words, what with abreviations, etc.
BTW: I would say r.s.v.p. is five words (repondez s'il vous plait).
-- modified at 15:43 Thursday 1st March, 2007
|
|
|
|
|
Luc Pattyn wrote: it.all,depends;on_the_definition of a'word'.
Good point. I count three
"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." - Rick Cook www.troschuetz.de
|
|
|
|
|
Hi,
Here your function (I presume that each two words are separated with a space) :
public int GetWordsCount(string s)
{
if (s==null)
return 0;
string trimmedString = s.Trim(); // To remove spaces at the begin/end
string[] words = trimmedString.Split(' ');
return words.Length;
}
|
|
|
|
|
I have a client/server application written in C#, i use TCPCLient and TCPListener methods to establish the connection.
I want add an HTTP Tunnel at my application to bypass my firewall, on my system i have a software firewall (Sygate Personal Firewall), i don't use a router and proxy server to access the net.
How, i can use HTTP Tunnel to bypass my firewall software whit my program?
Thank?
|
|
|
|
|
1) Disable the software firewall.
or
2) Enable a DMZ in the firewall for your app that maps the ports.
File Not Found
|
|
|
|
|
Thanks, but i want to find a solution to bypass my firewall without disable it or to map the ports.
A solution software, tunneling etc...
|
|
|
|
|
Well considering the job of the firewall is to block access ...
Download an SSH server and an SSH client. Find a port which the firewall will let you use and then you can use SSH to tunnel.
File Not Found
|
|
|
|
|
But how i can integrate SSH Tunnel in my C# program?
|
|
|
|
|
Basically when you create an open connection in your c# application you pick a specific port. The SSH tunnel then captures that port and tunnels it for you automatically.
Really though from the questions you are asking disabling the port on the firewll seems like the right answer.
File Not Found
|
|
|
|
|
Hi
I am making mp3 player in c# and i want to know how to access to the tag where i can get the name of artist,..
It's name is Id3 or something like that i have libaries but i dont know how to acces this informations...
if you have example it will be very useful.
Thanks
nemanja
|
|
|
|
|
The ID3 Version 2 tag is very complicated and pretty complex to parse.
You might want to check the much easier ID3 Version 1 tag. It's typically at the end of the MP3 file, starting 128bytes from the end to then end. If there is an ID3v1 tag, then the last 128bytes start with 'TAG'.
It's very easy to read and write.
Check google for the exact format of the ID3v1 tag.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thanks for the answer but how i ko wthat the mp3 file is id 1 or id 2 .I am beginer at this ...
What is the diffrence and how i can recognize the diffrence
thanks!
nemanja
|
|
|
|
|
Put the mp3 in a text editor like "Notepad" and read the last 128 characters of the file. If it commences with the word "TAG" its a type 1 id3 tag.
|
|
|
|
|
Hi,
Because of the requirements of my project, I have to create a downloader/updater installation. I've got the download part working just fine, but when I loop through the dlls to decide which versions I overwrite I've come across a problem.
As soon as I do Assembly.LoadFile( toFile) to get the version information of the from and to dlls they are loaded into the AppDomain.
So, I've been reading and it seems I have to create a new AppDomain, but no matter what example I find I can't follow it from there. All the examples seem to assume I'm going to want to use the loaded assemblies to create something. I'm simply wanting to do a straight comparison of version info (the app is nothing complex) and replace if newer in version numbering.
Any ideas / hints?
|
|
|
|
|
|
Why do you need to do Assembly.LoadFile ? Wouldn't FileVersionInfo work as well? This can be used to read the version data from the DLL without loading it into the AppDomain.
-----------------------------
In just two days, tomorrow will be yesterday.
|
|
|
|