|
Search the articles here on CodeProject for "minesweeper" and you'll find exactly what your looking for.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thank you very much. This does look just like what I want.
|
|
|
|
|
hello
I supervise a team for developing software in c# and I always
worry some of my members may steal the code to modify part of them
and then to sell them as software components or as a complete program.
What measures could I take to prevent this ? We develop in a software
components approach to build up a large software.
|
|
|
|
|
I'd recommend hiring people you trust.
Either that, or don't allow any sort of internet access, and body/cavity search people every day for memory keys/floppy discs/etc.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
There is no way your going to prevent this. Even if you disable all the drives on each members computer, remove any Internet access these guys have, and confiscate all flash drives, I've can still think of about a half-dozen methods of getting the source files off of your network.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Oh, and just a FYI... cross-posting is considered rude.
Shog9
I'm not the Jack of Diamonds... I'm not the six of spades.
I don't know what you thought; I'm not your astronaut...
|
|
|
|
|
Hi i need any library and tools for image processing
|
|
|
|
|
Ever hear of Google[^]?
There is also a series of articles by Christian Graus on how to do image processing here on Code Project. Just search the articles for "C# image processing".
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
As has been noted, I've written a series on this very site on image processing, which builds into a reusable library. Google and ye shall find.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
In addition to what Dave and Christian wrote I can only recommend downloading the Paint.NET 2.0[^] source codes and studying those.
Best regards
Dennis
|
|
|
|
|
Hi,
I have an application which runs well until an open dialog box is accessed by the user. What happens is that is appears when the user selects the file to open it changes the default directory for the application and the application tries to access a file in the new directory rether than the application default directory.
For example.
The default directory is C:\Program Files\App
The file path the user selects is C:Temp
I have an .xml file in C:\Program Files\App which is accessed fine before the open dialog but after the open dialog the program crashes because it is looking for the .xml file in the C:Temp directory and not the C:\Program Files\App directory.
What I want to do is force the program to always look for this file in the C:\Program Files\App directory without hard coding the path.
Any ideas and help are appreciated.
Regards
Stephen McAllister
|
|
|
|
|
Before calling the file picker, store your current directory, then set it again afterwards.
string sCurrentDirectory = System.IO.Directory.GetCurrentDirectory();
// DO YOUR FILE PICKING
System.IO.Directory.SetCurrentDirectory( sCurrentDirectory );
|
|
|
|
|
StephenMcAllister wrote:
I have an .xml file in C:\Program Files\App which is accessed fine before the open dialog but after the open dialog the program crashes because it is looking for the .xml file in the C:Temp directory and not the C:\Program Files\App directory.
Assuming that C:\Program Files\App is the path where your executable resides you can use the Application.StartupPath[^] property.
Best regards
Dennis
|
|
|
|
|
Follow Dennis' link to the Application.StartupPath(). The problem your having is that your assuming that the current directory will never change when you app is open. This is simply not the case. As you've found out, it can change at any time.
When you code file paths, NEVER use just a filename. ALWAYS prefix your filepaths with a complete path specification. You can use the Application.StartupPath() to return the directory path that your .EXE was launched from. Then use the Path class' Combine() method to build a full path specification to your .XML file.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I have a class that produce a number. I would like to store the class as a object in a array. The problem is that the class only produce a number the first time, and by some reason seems to keep the next time i call it.
Anyone who can help me?? Thanks // Niklaz
point[] m_point = new point[5];
private void button2_Click(object sender, System.EventArgs e)
{
int x;
for(x=0 ; x < 5; x++)
{
point p = new point();
m_point[x] = p ;
}
public class point
{
public int x ;
Random ran = new Random();
public point()
{
x= ran.Next(100);
}
}
|
|
|
|
|
You need to seed Random in order to get a random starting point in the pseudo random generation of numbers. DateTime.Now.Ticks is a good one.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Christian Graus wrote:
You need to seed Random in order to get a random starting point in the pseudo random generation of numbers. DateTime.Now.Ticks is a good one.
That won't do the trick. Random Constructor ()[^] already uses a time-dependent seed. The problem (even if I explicitly use (int)DateTime.Now.Ticks as the seed) is that a tick is defined as 100 nanoseconds which is quite a long time on a modern CPU. The only way to work around this problem with multiple instances of Random would be to throw in some of these: Thread.Sleep(20)
Best regards
Dennis
|
|
|
|
|
Good point. A more sensible move IMO would be to accept the value in the constructor, or make the Random object static inside the class and seed it in a static constructor.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Niklaz wrote:
I have a class that produce a number. I would like to store the class as a object in a array. The problem is that the class only produce a number the first time, and by some reason seems to keep the next time i call it.
Christian is right that the seed is the problem. However, assuming that you're not doing some intense multithreading the easiest solution would be to simply declare ran as static.
public class point
{
private static Random ran = new Random();
public int x;
public point()
{
x = ran.Next(100);
}
}
Best regards
Dennis
|
|
|
|
|
windows application vs console application mode (1/20/2005 12:51:40 PM)
hello I have a following problem,
i am trying to make a windows form app in c# (.net visual studio) which would be using ndis protocol driver,
for this i need to be able to open a driver file with a handle, which i could then use with function DeviceIoControl() to bind the ndis driver handle to the specific nic device
but i cant find functions in form app mode corresponding to CreateFile() returning a handle to a file and DeviceIoControl() (they both work fine in console app mode)
-------------------------------------------------------------------------
No You have something else going on here (1/20/2005 1:56:34 PM)
You can set references and using statements in a Windows Forms app or in a Console App exactly the same. The only difference is the console app has no Windows GUI, and can response to event-driven programming, whereas a console app is basically linear within its Main method.
Better go back and check your code.
-------------------------------------------------------------------------
appearently not, another question:ms-help binding (1/20/2005 2:30:15 PM)
thanks for reply
i also find it strange but it seems that windows form app simply can't use CreateFile() function while the console app can
when you create same basic apps both in console and form mode and put
IntPtr handle = CreateFile() in a constructor in both apps
the compiler in windows form app will throw an error: no such function in namespace
i also have another question about msdn docs
tried almost everything but i am unable to view help in VS or the msdn docs browser
i keep getting the white unable to open page, i suppose it has something to do with ms-help:// binding, maybe its a service which has a problem?
|
|
|
|
|
pilaf wrote:
i also find it strange but it seems that windows form app simply can't use CreateFile() function while the console app can
This simply is not true. CreateFile is used by just about every single Windows Forms application there is.
pilaf wrote:
when you create same basic apps both in console and form mode and put
IntPtr handle = CreateFile() in a constructor in both apps
the compiler in windows form app will throw an error: no such function in namespace
In either case of a Console app or Windows app, the method for calling Win32 API functions is exactly the same. There are no limitations on either application calling into the API. I'm sorry, but it's you who is making the mistake. Without seeing your code, though, it's impossible to tell you what your doing wrong.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The project I am on reads from a DVD-ROM if one is installed on the client PC. So I need to disable a control if the machine doesn't have the drive. My question is how can my application check for the presence of a DVD-ROM?
I know I can get the logical drive letters from Directory.GetLogicalDrives() , but this doesn't give me any information about what type of drives are on the system.
|
|
|
|
|
I've got a small application that keeps track of a number of small tasks using a threadpool, which suits the soltuion fine.
I'm running 6 objects at a time, and they work fine. However, while attempting to reduce the load on the CPU from some of the processes spin/waiting, I added a ThreadSleep.
This has caused the display to behave oddly. The ThreadSleep seems to free the resources used by the particular thread of the ThreadPool. Which causes the next item in the queue to be processed with the same local values as the item i just put to sleep. (The list basicaly displays blocks of replicataed items)
This is causing me a degree of confusion, as well as a problem, as I do not want to release the thread, simply pause it for 1-2ms per itteration of the process.
Is there anyway to pause a ThreadPool thread, without releasing it?
I've tried using ThreadSpin, but this still chews up a large chunk of CPU power unesscesarily, so i'm looking for an alternative solution.
Cheers
Cata
|
|
|
|
|
Are there any bittorrents written in c# that have source code available. Are there any c++ ones?
|
|
|
|
|
Ask google.
This posting is provided "AS IS" with no warranties, and confers no rights.
Software Design Engineer
Developer Division Sustained Engineering
Microsoft
[My Articles] [My Blog]
|
|
|
|