gusano79 247 Posting Shark

Your question seems a little confused about the role of exceptions in input validation. Do you have a specific example of what you're trying to do?

gusano79 247 Posting Shark

It looks like you're missing a finally before the block that closes the connection.

ChrisHunter commented: Spot on +7
gusano79 247 Posting Shark

Code? In particular, your mouse event handlers, paint method, and anything you're using to track object position & orientation will be helpful.

gusano79 247 Posting Shark
gusano79 247 Posting Shark

You could write a function to loop over array, assigning the appropriate values to the right places.

You could have a duplicate of array that you don't change during the game, then just copy it into array when you want to reset.

My advice is that you don't mix the board-drawing parts like '|' with the game state. Just have a 3x3 array for the game, and handle drawing the lines in display(). Then all you have to do to reset is set everything in that array to spaces.

gusano79 247 Posting Shark

On which line is that error occurring?

gusano79 247 Posting Shark

Here are some thoughts that may help guide you:

  • Is the existing desktop application easily translatable to the Web? Some are, some aren't... if it isn't, that may be a point in favor of Xojo (about which I know nothing), if it can take the same application and publish it for desktop or the Web. If it is, though, Xojo might be overkill.

  • You might also consider turning it into a VB.NET Web application, which should be an easier transition from VB6 than translating it to another, less related language.

  • Do you have any existing Web applications? If so, what language/platform are they written in/for? All else being equal, it's easier to maintain multiple applications if they're built using the same tools.

gusano79 247 Posting Shark

Bitonal: .NET doesn't distinguish 1-bit color... I guess you'll have to scan through the pixels and count colors, or find a library that will do it for you.

Contrast: There are multiple ways to define a contrast value. Dynamic range is a simpler, related measure.

gusano79 247 Posting Shark

You're probably looking for the Image class. Its PixelFormat property will tell you the pixel type.

As for contrast... Do you mean the image's dynamic range? That's something you'll have to calculate yourself from the image contents.

gusano79 247 Posting Shark

Is this graphics context for a control, or for an off-screen image? Do you have a small sample application that we can work with?

gusano79 247 Posting Shark

I understand GA through pseudocode, but I don't know how to apply it in timetabling.

This is the tricky part... if you model your problem well, GAs will do a pretty good job.

Do you have a more specific problem statement?

And can I use PHP to develop this system?

Coding a GA is the easy part, once you have the problem modeled; any language should work, though some might be a little easier to use.

gusano79 247 Posting Shark

If you go with PHP, you can perform XPath queries on your data.

gusano79 247 Posting Shark

Ah. In my experience, some DVD reading hardware is more forgiving than others, so it might be worth trying on a few different machines just in case yours is one of the more finicky ones. I think some software will try harder to detect and handle read errors as well... but I don't know of any "best" programs myself.

gusano79 247 Posting Shark

What's in the "x64" folder?

gusano79 247 Posting Shark
gusano79 247 Posting Shark

What do you mean by "damaged"?

gusano79 247 Posting Shark

The amount of processing to be done is really large. All my implementaions ran far too long.

A naive (brute force) implementation of the tree would certainly take a long time, but you have the cost information available, which should allow you to stop looking at series of more expensive changes.

I can't think of another method right now that would actually be less complex.

I don't have any heuristics that will tell me if a solution is "good enough".

An easy one is "fits within the budget for moving/buying computers."

By good enough I meant one produced by an intuitively convincing greedy algorithm :)

The concepts "intuitively convincing" and "runs in a reasonable amount of time" may be mutually exclusive here, depending on how intuitive trees and recursion are for you.

I've been finding it really hard to write what you say in code. A definition of "closer" is quite complex to me.

If you can identify separate groups of connected rooms and how far apart they are, how about this:

  1. Identify all of the groups of rooms.
  2. Identify all possible moves you can make.
  3. Eliminate the ones that don't actually reduce the distance between any of the groups.
  4. Of the remaining moves, choose the one that is cheapest and make that move.
  5. Repeat steps 1-4 until you've connected all of the groups.

I believe this will always get you a solution, mostly because you always have the option of …

gusano79 247 Posting Shark

About the game tree approach, it is just brute force isn't it :)

It can be. The improvements I mentioned help some.

I don't think it is feasible at all

Why not?

One way or another, you're looking at some kind of decision tree-type analysis.

It would produce the best solution though

If you run it all the way through, yes. But you can also bail out as soon as you find a solution that is "good enough" in your judgment.

Is there a greedy approach?

You could just try the cheapest actions and see if they get you a valid configuration. If that doesn't get you one, though, you have to backtrack and try something else. Stop at the first one you find that works.

This is essentially a depth-first look at the tree, generating it as you go; the method I described earlier is a breadth-first search.

separate it into components and join the components.

Actually this sounds like a good way to limit your choices: Only consider actions that bring you closer (for some definition of "closer") to connecting the parts, ignoring moves that don't really help.

gusano79 247 Posting Shark

Are we missing any information?

Not any more :)

So... it's an optimization problem. Is there a particular strategy you've been working on, or are your options wide open?

You could model the problem as something resembling a single-player game tree, with each "move" being one of the add/delete/move operations. This will probably not be super efficient, but if the grid is relatively small, it won't be unmanageable. Also, there are improvements to the basic tree building process, like stopping if you reach a connected configuration you've already got cheaper elsewhere in the tree, or not delving into subtrees if they're already guaranteed to be more expensive than a solution you already have.

gusano79 247 Posting Shark

The problem wants a solution with the grid structure in mind.

Fair enough.

If "one single connected component" means you're supposed to modify it to be a connected graph, then what does it actually mean to be adding, removing, and moving nodes? There will generally be multiple ways to connect disconnected subgraphs, so if the grid is meaningful, how do you decide which is the "right" connection to make?

A smartass solution is to add a node everywhere one doesn't exist--boom, it's all connected. I'm pretty sure that's not the solution they're looking for, though... it feels like we're missing some important information.

gusano79 247 Posting Shark

our system is running. but we don't know how to share a single database within the 2 computers.

Okay, thanks for the clarification.

I heard about the CENTRAL DATABASE. how can we actually make a central database it and access it by different nodes/computers?

Normally you'd set up something like MySQL to actually host the database, and use a data access library to take care of the details.

Do you have any specific requirements for the database?

gusano79 247 Posting Shark

Is the grid important to the graph, or is it just a convenience for display purposes?

gusano79 247 Posting Shark

Also, at some point you should look into using parameterized queries.

Begginnerdev commented: Safeguarding agaisnt Injection Attacks +9
gusano79 247 Posting Shark

we should create a program that ... how can we make that?

we already made the system

If you already made it, you don't need to learn how to make it, right?

the computers should be able to access 1 database for record sharing

we already made the system

how can we implement this in a networked way?

If your software is running on two different machines and they're sharing a single database, then they are already networked in some way.

Is there something else you need to do over a network besides share a database?

gusano79 247 Posting Shark

What is the type of database_WICs? Also, what line does the error indicate?

gusano79 247 Posting Shark

which makes them perfect for encrypting things like passwords

Just so everyone's clear here: Hashing passwords is NOT encryption. It is part of a technique to verify (to a reasonable degree of confidence) that the password a user provides is correct without having to actually store or transmit the password itself.

(time, electricity used by the computer)

The electric bill doesn't matter; it's all about time. Brute-force attacks are defeated by making it impractical to run through all possible keys before the sun turns into a red giant.

I want to make my app secure, so i want to encrypt & decrypt my transactions every time.

If you're writing a web application, make sure your server only uses HTTPS. If you're managing your own connections, consider something like TLS.

Is there any best algorithms for encryption and decryption

For symmetric algorithms, AES is a common choice.

For asymmetric algorithms, RSA is widely used.

gusano79 247 Posting Shark

Let's look at reversed() real quick here...

if(!this.isEmpty()){
    return this;
}

"If I'm not empty, just return myself"--probably not what you meant.

Seems like it should be the other way around: "If I'm empty, return myself." But that's problematic too... it's a reference to the same object, which again I don't think you mean. I'd pass a new empty stack.

while(this.isEmpty())

"Only build the stack if I'm empty"--also probably not what you meant.

return this;

Wait, it looks like you're building that and then ignoring it completely. That can't be right. You must have meant to return that, right?

that.push(pop());

Combined with the above, this is why you're getting an empty stack. The call to pop() is emptying out the current stack, and then you're returning it.

So:

First, fix up how you're building that and return it, not the original object.

Second, figure out how to actually copy the contents of this without actually removing them. You should be able to follow the nodes directly, starting with upnode, and push them until there aren't any left.

gusano79 247 Posting Shark

MD5 and SHA-256 are hash functions, not encryption algorithms. They only work one way, which is why you aren't finding anything else; that they are non-reversible is quite intentional.

Is this for something specific you're trying to accomplish, or are you just exploring security concepts?

gusano79 247 Posting Shark

Well... a detailed answer could fill an entire university course.

Start here:
http://en.wikipedia.org/wiki/Analysis_of_algorithms
http://en.wikipedia.org/wiki/Category:Analysis_of_algorithms

gusano79 247 Posting Shark

If I were interviewing people, I'd be a lot more interested in ability than enthusiasm. Games are still software, and writing them can be much more demanding than typical business solutions.

Do you have the impression that they're looking specifically for game lovers?

Also, is this a general-purpose "software engineer" position, or is it more specific?

gusano79 247 Posting Shark

there is no execution taking place..

It's hard to tell what's happening when you're using connection and command objects that are declared outside of the code shown. Somewhere you should be calling comm.ExecuteNonQuery().

gusano79 247 Posting Shark

Do you mean like this?

gusano79 247 Posting Shark

UNABLE TU DELETE

What does that mean? What happens when you execute the query?

" DELETE FROM Table1 WHERE Fname =" + textBox1.Text + ""

Why are you appending an empty string to the end of the query? The append would make sense if you were surrounding the text in single quotes:

"DELETE FROM Table1 WHERE Fname = '" + textBox1.Text + "'"

Try that.

The query can be a little clearer using string formatting:

String.Format(
    "DELETE FROM Table1 WHERE Fname = '{0}'",
    textBox1.Text
);

But really, you should be using parameterized queries.

gusano79 247 Posting Shark

Neither do I; you could start at https://developers.google.com/maps/

gusano79 247 Posting Shark

the map is taken from google map

Are you using Google's API? They might have an image-to-coordinates method there.

and it can be any map according to user choice

If you're loading user-provided maps, there is no automatic solution. You need to have more than just the image to determine latitude and longitude.

gusano79 247 Posting Shark

whenever I input an expression, it just comes to an halt, and some time after, it's --"The program is not responding"

That's not what happens when I run it... depending on the input, I've been able to make it stop without doing anything, and also segfault.

What input are you giving it when it spins forever?

The code compiles

Do you get any warnings? GCC gives me a few that you should address. Let's fix these, and see if the situation improves:

main.cpp|50|warning: no return statement in function returning non-void [-Wreturn-type]|

char Push(char ch)

It doesn't return anything. Did you mean void Push(char ch)?

main.cpp|58|warning: suggest parentheses around assignment used as truth value [-Wparentheses]|
main.cpp|59|warning: suggest parentheses around assignment used as truth value [-Wparentheses]|

if(s[i]='(') l++;
if(s[i]=')') r++;

= is assignment, not an equality comparison. You meant ==.

main.cpp|68|warning: unused variable 'st' [-Wunused-variable]|

What is st for?

gusano79 247 Posting Shark

would you put here your table structure with some data in it

^^ This. We can't help you if we don't know what we're working with.

gusano79 247 Posting Shark

Right. The question is how to translate from (x,y) to (lat,long)... and to do that properly, you need to know what kind of projection was used to create the map.

Is there a specific map you're using, or do you want to be able to do this with a variety of user-provided maps?

gusano79 247 Posting Shark

Definitely keep the lexer/parser concept; it makes things much easier to deal with.

You'll see lost of people online recommending that you write a recursive descent parser or use a parser generator, both of which are fine if you want to learn about them.

My preferred approach to parsing algebraic expressions is the shunting-yard algorithm. It's powerful enough to deal with any expression you want (including functions and operator precedence), and it's not hard to extend (new functions or operators, variable substitution) if you're smart about the implementation. But it's also not overwhelmingly general-purpose, so you can focus on the algebra.

ddanbe commented: Thanks for the tip +14
gusano79 247 Posting Shark

Without details, I can't give you a specific answer, but this is where to fix your immediate problem:

FRS.Source = "SELECT * FROM Family"

You could add a WHERE condition to this query to only count entries for a specific branch.

This is a little fragile, though. You might instead select the highest branch number in a particular branch and add one to that instead of relying on the numbers to match the record count.

gusano79 247 Posting Shark

Basic algebra will get you pretty far with most types of software... but not as much with games. If you really have no interest in learning more math, expect to rely heavily on third-party libraries that take care of the details for you, especially when it comes to graphics.

gusano79 247 Posting Shark

What kind of projection does your map use?

gusano79 247 Posting Shark

I would start here and here.

gusano79 247 Posting Shark

I don't think the indirection operator is needed (?) because that kind of code has compiled and worked before when I was comparing variables.

Oh, now that you mention it, I seem to remember that iterators are sometimes implemented as plain old pointers... I'm used to seeing the dereferencing syntax.

So. On my machine, your code builds and runs just fine, after I fill in a few blanks. Can you post the whole thing, including the data file? Just so we're testing the same thing.

gusano79 247 Posting Shark

Just saying it "isn't working" isn't very helpful. Does the code not build? Does it build but not run? Does it run but produce unexpected output? Show us what you've been trying; please be specific.

gusano79 247 Posting Shark

I plan to use the simple REST API method described in URL Click Here & the plugin WPBI (Wordpress Business Intelligence) allow to communicate with an external plugin call .

Okay, so you have RESTful calls into a PHP application. Depending on your code, it may or may not be easily identifiable as one, but wherever you have Web methods, that's your service layer.

I'm not really sure what you're asking for... are you unsure how to connect these RESTful methods to the WPBI plugin?

gusano79 247 Posting Shark

It looks like the error is coming out of the vector class itself, not your code. Hm. I'm not sure from reading the error message what's going on, but your iterator syntax looks odd.

it is the actual iterator, while *it gets you the object to which the iterator refers.

So you have (for example):

(it-1)->Low

...but I think you mean this:

(*(it - 1)).Low

...unless your definition of PriceList is unusual; I'm assuming it's a fairly thin wrapper around vector<PriceInfo>.

gusano79 247 Posting Shark

Since you're already using C++ strings, consider using string::compare instead of strcmp.

gusano79 247 Posting Shark

Ah, ok. For basic WCF services, you shouldn't notice anything different. We've got a number of WCF services at my day job, where we've transitioned from VS 2005 to 2008 to 2012, and I haven't noticed or heard of any problems.

gusano79 247 Posting Shark

You've got a clue right here:

where n is Dataset.begin() + 2

Vectors get you random access iterators, so you can also subtract.

So start at Dataset.begin() + 2, increment your iterator while it's not equal to Dataset.end() as usual, and just refer to the iterators (it - 1) and (it - 2) in your loop.

You could also start with three iterators pointint at Dataset.begin(), Dataset.begin() + 1, and Dataset.begin() + 2, and increment them all, using the last one to control the loop. It seems like this might get you a performance improvement, but I'm not 100% sure about that. At the moment, I prefer the first approach; I consider it more readable.