|
You are talking about the brute force search, aren't you?
mohammadkaab wrote: it gave me an error stackoverflow in big problems like {8,0,4,2,3,1,6,7,5}
It's implemented recursivly?!
You have to test, wether a state has already been calculated or not, otherwise you get an infinite loop and a stackoverflow!
------------------------------
Author of Primary ROleplaying SysTem
How do I take my coffee? Black as midnight on a moonless night.
War doesn't determine who's right. War determines who's left.
|
|
|
|
|
ofcourse im doing this , i'll check if the current node it has been in the qeue or not , if its in the qeue then i'll ignore and go to the next part .
but a fellow in the algorithm section give me a soluation that i cant find out what that supose to mean .
fellow in algorithm section said :
The problem is that breadth-first search (bfs) tries ALL sequences of length N before it tries any of length N+1. And it stores all these intermediate attempts, resulting in your stack overflow for a deep solution.
An approach more specific to the problem would give better results, e.g.
for (int tile = 0; tile <= 8; ++tile)
placeTileInCorrectPosition (tile, board);
"Microsoft -- Adding unnecessary complexity to your work since 1987!"
i dont know what does that mean .
|
|
|
|
|
mohammadkaab wrote: breadth-first search
Ahh! Breadth-First Search!
Yes, that is... no solution. Because in every turn it increases exponential. The only way is another algorithm:
depth-first search or (even better) A* search<
------------------------------
Author of Primary ROleplaying SysTem
How do I take my coffee? Black as midnight on a moonless night.
War doesn't determine who's right. War determines who's left.
|
|
|
|
|
mohammadkaab wrote: i have asked my qustion in algorithm section but no one have respond me
The forums are international. You have to have patience - the person who can answer your question may be asleep or at work. As we don't get paid for helping out, we get to answering questions when we can.
Second point - I found your question difficult to read, not because English isn't your first language, but because you don't use capitals. Please, at the start of a sentence, use some capitals.
|
|
|
|
|
Hi
I have a situation where we have an application that we have written and a third party application. Basically when a change happens in the 3rd party SQL database, we want to make changes to our own SQL database.
What would be the best way to achieve this? Obviously a combination of SQL triggers/stored procedures could achieve this, but was wondering if there was another alternative?
Thanks
|
|
|
|
|
UCLAdam wrote: Obviously a combination of SQL triggers/stored procedures could achieve this, but was wondering if there was another alternative?
There are other ways, but to use triggers/stored procedures is the best.
------------------------------
Author of Primary ROleplaying SysTem
How do I take my coffee? Black as midnight on a moonless night.
War doesn't determine who's right. War determines who's left.
|
|
|
|
|
Thanks ihoecken. I thought that might be the case. Out of interest what are the other ways?
|
|
|
|
|
UCLAdam wrote: Out of interest what are the other ways?
Well depending on the situation.
- Replication - if just data has to be transfered
- adding a "sync" column in the tables, but then the 3rd-party solution has to clear it when it changes or add a column - otherwise triggers would be needed
------------------------------
Author of Primary ROleplaying SysTem
How do I take my coffee? Black as midnight on a moonless night.
War doesn't determine who's right. War determines who's left.
|
|
|
|
|
It really depends on what changes you want to make, and when you want to make those changes. You could do this with triggers, but that would mean modifying the 3rd party database, and you could have issues if you change the schema of the 3rd party database (say during an update). Also, some 3rd parties will have warranty/support clauses that would be invalidated by you altering their schema - we do, for instance, because of a particularly troublesome client who broke the database and then expected us to bail them out at our expense.
If you are just looking to replicate the data, and the change doesn't need to be instantaneous, you could use something like the Sync Framework[^] to accomplish this.
BTW - this isn't a C# question. It belongs in the database forum.
|
|
|
|
|
Thanks Pete. Unfortunately the changes do need to be instantaneous and we need to manipulate the data before putting it into our database. Luckily we are able/allowed to change the 3rd party DB schema, but obviously have to bear updates in mind like you say.
Apologies for posting in wrong forum, you're completely right. May be I was subconsciously hoping for a C# solution!
|
|
|
|
|
Then triggers are your best choice - don't forget to take into account the fact that the database you are trying to copy into might be down, so your solution will have to cope with this.
|
|
|
|
|
If the change involves transformation of data, you might use a combination of Triggers and Procedures, otherwise Replication[^] will be the right choice.
modified 26-Sep-12 10:26am.
|
|
|
|
|
With Visual Studio 2012, setup projects will no more be available.
Setups have aways been a pita with Visual Studio, but after a first glance, WiX feels even more painful. InstallShield LE is said to not support Windows Services...
What will you do then - use free WiX, or buy a commercial tool (which one)?
|
|
|
|
|
Well...this article[^] provide a point of view to why setup was removed.
I guess WIX is the future (as per the author of the blog).
|
|
|
|
|
|
Thanks for the link. I've just added this to the Free Tools forum here on Code Project. My 5.
|
|
|
|
|
|
Looks interesting. I'll give it a try.
|
|
|
|
|
I've been very happy with Advanced Installer[^]. I use the free version for my freeware apps.
/ravi
|
|
|
|
|
That's a good tool. We need Custom Actions, and additionally the Dialog Editor - consequently, it costs just a thousand dollars per developer ("Enterprise" version)...
At least, I could create such an advanced install project within a few hours, quite easily.
|
|
|
|
|
how to find a menu item name by passing menu text in a mdi form ?
|
|
|
|
|
anushikaroshan wrote: how to find a menu item name by passing menu text
Enumerate the ContextMenuStrip Items and take a look the items[nr].Text or use cms.Items.Find(key, true) to get all Items corresonding the name.
------------------------------
Author of Primary ROleplaying SysTem
How do I take my coffee? Black as midnight on a moonless night.
War doesn't determine who's right. War determines who's left.
|
|
|
|
|
What is the best way to encrypt the connection string in web config file?
|
|
|
|
|
I'd use the inbuilt .NET functionality to accomplish it. You can find info here[^].
|
|
|
|
|
Sorry if this posted more than once.
I have a method that creates this value:
0x0001000000FFFFFFFF01000000000000000601000000036162630B
It is stored in the DB as <Binary Data>.
I use Select value from table where id = 1234.
This is the code that writes creates the value:
<pre>
public void SetSessionData(string token, object data)
{
DataService ds = null;
try
{
ds = new DataService();
using (MemoryStream stream = new MemoryStream())
{
DALArgs args = new DALArgs();
ds.SetRealmConnection(_realm);
Args.Add("sessionkey", _sessionkey);
args.Add("sessiontoken", token);
BinaryFormatter b = new BinaryFormatter();
b.Serialize(stream, data);
stream.Position = 0;
byte[] buffer = new byte[stream.Length];
stream.Read(buffer, 0, buffer.Length);
args.Add("sessionvalue", buffer);
ds.Execute("olb_SetSessionData", args);
</pre>
I'm trying to figure out how I can assign the results of the select statement to a variable and create this response:
0
1
0
0
0
255
255
255
255
1
0
0
0
0
0
0
0
6
1
0
0
0
3
97
98
99
That array comes from this:
<pre>
if (reader.Read())
{
byte[] data = (byte[])reader["SessionValue"];
<pre/>
I hope that is enough information, and that it can be done.
Any help is appreciated.
Sign In·View Thread·Permalink
|
|
|
|