|
I must build a program to solve 8-Puzzle with best first search algorithm , but i don't know how to do it.
You can build it in C# help me ( with source code)
Thanks!.
|
|
|
|
|
|
|
Im pretty sure its one of those 3x3 picture puzzles which has 8 parts to the image and you can slide one piece at a time into the epty square.
|
|
|
|
|
I generally see 4x4 with 15.
|
|
|
|
|
|
Dear all,
I got Timeout exception when reading from serial port.
how to overcome?
code:
// ports boudRate =115200, readtimeout=300 and writetimeout=300
private void btnRead_Click(object sender, EventArgs e)
{
OpenPort();
string str;
try
{
Thread.Sleep(1000);
str = _serialPort.ReadLine(); // exception occurs here
}
catch (Exception ex) { str = ex.Message; }
txtReadText.Text +=
string.Format("{0}{1}", "", str);
ClosePort();
}
|
|
|
|
|
Oh how lovely; we're so proud.
|
|
|
|
|
courtesy is a small thing but enough to make a big difference
|
|
|
|
|
Hi,
This is the expected behaviour. If _serialPort.ReadLine() is called and no data is available then the TimeoutException will be raised after 300ms. If you want ReadLine to block then don't set a timeout.
Alan.
|
|
|
|
|
Hi all,
I am working on a feature where in we can allow/disallow changing system time to any user. We can run this application from an administrator's account and set if a particular user can change system time or not. Even the administrator (who itself is logged on) itself can allow/disallow himself changing time.
While googling I found that there is some, The system user right SeSystemtimePrivilege that controls the ability to set the system time. I could not find how to complete my feature via the privilege SeSystemtimePrivilege using C#.
Can somebody help me how to that using c# (or even C++). Even if there is some other way of implementing this feature, please let me know.
Thanks in Advance
Best Regards
Aseem
|
|
|
|
|
If the machines are on a windows domain set the group policy in the Default Domain Controller Group Policy object (GPO) or if they are stand alone machines on a workgroup look in;
Administrative Tools --> Local Security Policies --> Local Policies --> User Rights Assignment --> Change the system time
From there set the users/groups that can change the system time, by default the groups that can change the system time are Administrators and Power Users.
|
|
|
|
|
|
i want get name tittle of WINDOW FORM from a handle of child form. for example : when i click mouse at a point of winform => i will get name tittle of that winform. i used function Getparent(..), GetAncestor(..) of method IntPtr, but it wrong.
wish help me.
thanks very much.
aazz
nothing
|
|
|
|
|
|
Hello everyone,
Would you please tell me if I have option to choose between for and foreach , whichone I should choose ? I know, foreach is better for Maintainance as I reduce the chance of error by misuse of index in for , But, if I use foreach, am I paying any cost for performance where it would be faster if I used for ? I need to decide for a performance critical application.
Thanks again.
|
|
|
|
|
for arrays and normal collections you will not be able to notice a difference in performance. You could however create your own collection with a very fast indexer and very slow GetEnumerator(), or vice versa. On purpose, that is.
And if you don't trust that, why don't you come up with a little test app?
|
|
|
|
|
I once attended an event where a presenter went to great and detailed lengths to show how for was superior to foreach. Of course he was oblivious to the fact that the audience ignored him after the first ten minutes and droned on for 45 minutes concluding that foreach should be removed from the .net framework.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
They should keep foreach and remove that presenter; it may be a fine topic for a white paper, not for a lengthy presentation IMO.
Anyway, I trust the majority of .NET programmers isn't going to come up with a decent way of measuring the difference; and in debug builds, it is much more advantageous to keep the exit condition simple, I once noticed a simple image manipulation slowed down by 33% due to x < myBitmap.Width in the inner for loop.
|
|
|
|
|
With the increased use of LINQ, I wonder if foreach will ever out of the framework.
|
|
|
|
|
that reminds me, I still have to look into the performance aspects of LINQ...
|
|
|
|
|
Though it isn't specifically LINQ this might give you an idea and a place to start, Entity Framework Performance[^]
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
OK. I'll read that tomorrow. Thanks.
|
|
|
|
|
I haven't ever got into performance issues of LINQ. LINQ is pretty handy when one needs quick code. I use it that way.
I am sure that when performance is a concern, there are bigger problems other than LINQ. People usually make mistakes in thinking before using it.
Someone here posted a message about VS being slow, It seemed to me that the code he wrote had too many unnecessary loops. Using a StringBuilder for string conversions won't save him.
|
|
|
|
|
I didn't do any formal 'proper' benchmarks but I did some loose measurements of a few simple functions when I first experimented with Linq and they didn't fair too well IIRC.
Not very scientific but all I have to offer
DaveIf this helped, please vote & accept answer!
Binging is like googling, it just feels dirtier. (Pete O'Hanlon)
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
|
|
|
|