|
It's beeter to consider readability than line length or line count. Indenting improves readability.
If you need to use a shorthand version of a namespace or class, try out the using statement:
using d3d = Microsoft.DirectX.Direct3d;
As an aside, it isn't recommened you make classes thread-safe by default. Making classes thread-safe comes at the expense of performance; everything has to acquire a lock, which is inefficient and can lead to deadlocks and locking of the UI thread. Rather, if you need a thread-safe class, make a wrapper around your class that uses locks, or have the calling code do the locking.
And an FYI, line lengths are only going to get longer with generics in .NET 2.0, where generic methods must have type argument supplied to them, further lengthening some method calls. Additionally, using foreach over some generic list or dictionary looks pretty long:
foreach(KeyValuePair<tstring, bool> pair in myStringBoolDictionary)
{
}
That alone is 72 characters; the main thing to worry about is readability, IMO.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Conversation With a Muslim
Judah Himango
|
|
|
|
|
I am working on a server application and I need to use the windows ping utility to ping the clients, can anyone tell me how to do this in C#???
|
|
|
|
|
|
I'm not sure why you think you need to do this. It typically won't work properly if the client is behind a firewall - either a personal firewall such as Norton Internet Security or Windows Firewall in XP SP2, or a hardware device. If the client is behind a Network Address Translation device, if anything responds it's likely to be the NAT device rather than the client itself. Most firewalls now refuse to respond to the ICMP Echo messages sent by ping .
Even if you could do this, there's no guarantee that if this packet got through, that the eventual response would do. There's no guarantee that the program connecting to you is still running - just that the client's network stack is responding. So it doesn't actually give you the information you're after anyway.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
code in C# to:
search an entered ip address or computername in a network.(not using any database).
Amar
|
|
|
|
|
What do you mean "search an entered IP address"? Are you trying to run a file search on that machine?
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Conversation With a Muslim
Judah Himango
|
|
|
|
|
Code in C#, where an user enters an ip address or computername, to search in a network. The result will be in the form of a messagebox, saying " the computer is present".
Amar
|
|
|
|
|
You mean your trying to see if a machine exists if you can Ping that machine name or address. Search for "Ping C#", you'll come up with hundreds of examples.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
i need a ready code for ping, where:
1) i enter a ipaddress or computer name in a textbox
2) the response is recorded in a listbox.
the code should b in C#.
i searched in codeproject, but cold not get proper code.
Amar
|
|
|
|
|
The only way you're going to get "proper code" is if you write it yourself. Like I said before, Google for "C# Ping" and you'll come up with tons of examples on how to ping. You then have to supply the rest of the code to get exactly what you want.
The Code Project is about helping people with their code, not writing it for them.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi,
In the following,
double d = double.NaN;
bool bd = d == double.NaN;
float f = float.NaN;
bool bf = f == float.NaN;
both Booleans return false.
What gives?
Thanks,
Tom
|
|
|
|
|
|
How to retrieve admin password?
-> using wmi
-> in c#.net
amar
|
|
|
|
|
The user password for the administrator of the system? I don't believe that is possible...I certainly hope it is not, otherwise anyone with rudimentary knowledge of WMI could learn my password. :-p
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Conversation With a Muslim
Judah Himango
|
|
|
|
|
You can't. It's one-way encrypted. There are no functions anywhere that will give you the password.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
How to show the screen with virtual keyboard on Pocket PC 2003 device, without prompting user to click the icon? I need it to show every time user click in edit box.
thanks.
|
|
|
|
|
Add a Microsoft.WindowsCE.Forms.InputPanel component to your form. Add a SetFocus handler to the edit box. In the handler, set the Enabled property of the InputPanel object to true . If you want to hide the panel again when the user moves to a different control, add a handler for the KillFocus event and set Enabled to false .
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hi,
This might be a stupid question, but is it possible to incorporate directx/opengl into say a data acquisition application? i've pretty much tried every technique possible from double buffering to more efficient screen invalidating but the refresh speed is way to slow. So I was wondering if there is a way to include hardware acceleration into a win app.
thanks,
Brian
|
|
|
|
|
Yes, of course. I've read about some apps that use Managed DirectX to do rendering; it's certainly possible, however you don't get the native look and feel of the standard Windows widgets.
I suggest looking into Managed DirectX or Tao OpenGl.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Conversation With a Muslim
Judah Himango
|
|
|
|
|
so when you say that i wouldn't get the native look and feel, does that mean the screen would blank out similiar to when running a video game?
|
|
|
|
|
No. I mean that, for instance, if you wanted a TreeView control, you'll have to write your own treeview control, because DirectX doesn't draw these for you, you'd have to draw them yourself. And if you're drawing them yourself, they probably won't look exactly like they do in standard Windows applications.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Conversation With a Muslim
Judah Himango
|
|
|
|
|
oh great....i'll def look into it, thanks
|
|
|
|
|
What are you actually trying to do that is causing refresh problems? Maybe, there's another work-around.
|
|
|
|
|
Basically i'm creating a program that analyzes waveforms. Each waveform can consist of around 200 data pts. There can be up to 8 waveforms displayed at once. The app allows the user to "scroll" through the signal to view a zoomed in portion of the waveform. So basically each signal has 3 views that get updated all at once, which causes a lot of processor usage since almost the entire screen gets redrawn. Right now i'm using 3 timers to update each of the views. Even with the delay in drawing, i'm almost maxing out on the processor. I've tried several different drawing techniques that include double buff and specific invalidating but no real luck. I would do the project in c++ but the time-frame i have is rather short so i decided to go with c#. If you have any suggestions on techniques please let me know.
thanks,
Brian
|
|
|
|
|
Just some FYI: If you are graphing a series of point as a continuous line make sure to use the DrawLines function and not DrawLine in a loop. I found a huge performance difference between the two when I was writing a graphing control. I don’t know if you are already doing this, but I thought I might mention it in case you’re not.
|
|
|
|