[QUOTE=cartman300;45106746]Instead of formatting string you could do
[code]
if (N < 0.9999) or (N > 1.0001) then
...
end
[/code][/QUOTE]
why dont you just do
[code]
if (N != 1) then
...
end
[/code]
or is there something im missing?
[QUOTE=G4MB!T;45106960]why dont you just do
[code]
if (N != 1) then
...
end
[/code]
or is there something im missing?[/QUOTE]
Floats are never exact, so you usually test them against a small range that's "close enough", or rework the algorithm entirely to avoid equality comparisons.
[QUOTE=ECrownofFire;45107015]Floats are never exact, so you usually test them against a small range that's "close enough", or rework the algorithm entirely to avoid equality comparisons.[/QUOTE]
oh right i didnt even see that haha (i need to sleep)
[QUOTE=elevate;45089418]You need to simplify the above and figure out what it's actually doing. Each if statement checks if the first letter is less than the second letter. If this is true, then we swap the two letters. Do note that the statements are evaluated sequentially, not all at once, so each letter may not have the same value in one if statement as it does in the next.
The swap works by using a temporary variable because otherwise once you set the first letter to equal the second letter, both your letters are the same and therefore you can no longer swap the two letters. You can also swap using only two variables with bit level hacks, but that's another thing entirely, and it's efficiency is questionable at best!
Here's the following pseudo code. Hopefully you can figure out the rest.
[code]
if letter1 < letter2 then swap letter1 and letter2
if letter2 < letter3 then swap letter2 and letter3
if letter1 < letter2 then swap letter1 and letter2
[/code][/QUOTE]
Sorry I'm late to reply. I appreciate the effort you went into to explain this to me. I understand the process, though I still don't quite understand how you would figure it out. (I'm really dumb)
Thanks for helping though.
[QUOTE=ECrownofFire;45107015]Floats are never exact, so you usually test them against a small range that's "close enough", or rework the algorithm entirely to avoid equality comparisons.[/QUOTE]
They are exact (as per their standard, but not common maths), but their arithmetic is neither associative nor trivial so it's difficult to evaluate them by hand.
Floats being truly uncertain would make RNGs so much easier :v:
[QUOTE=Tamschi;45109587]They are exact (as per their standard, but not common maths), but their arithmetic is neither associative nor trivial so it's difficult to evaluate them by hand.
Floats being truly uncertain would make RNGs so much easier :v:[/QUOTE]
Well it's more that you'll often have things like trigonometric functions (or other functions) and various constants such as pi that cannot be represented exactly. Not to mention many platforms don't follow the spec exactly and have many variations on each other.
I have a program, I want to create a database of accounts, and manage the servers they own, how would I go about it? I am thinking give them an account ID on creation, and link the servers to the account ID, yeah that sounds alright but I don't want to load all the accounts onto the client then check if it exists when people try to login, for obvious reasons, how do I do this? I'm using C#, accounts are in a MySQL database. How do I check if user is valid without retrieving all the accounts.
Is there some MySQL syntax? I have little knowledge of MySQL syntax and when I look at the site for it there is so much information and it confuses me :v:, something a little more straight forward with examples is better for me, without placeholders, can I use the select statement?
[QUOTE=AnonTakesOver;45109847]I have a program, I want to create a database of accounts, and manage the servers they own, how would I go about it? I am thinking give them an account ID on creation, and link the servers to the account ID, yeah that sounds alright but I don't want to load all the accounts onto the client then check if it exists when people try to login, for obvious reasons, how do I do this? I'm using C#, accounts are in a MySQL database. How do I check if user is valid without retrieving all the accounts.
Is there some MySQL syntax? I have little knowledge of MySQL syntax and when I look at the site for it there is so much information and it confuses me :v:, something a little more straight forward with examples is better for me, without placeholders, can I use the select statement?[/QUOTE]
Linq to SQL, but I [I]seriously[/I] hope that you're not letting clients access the database directly.
[QUOTE=Tamschi;45109960]Linq to SQL, but I [I]seriously[/I] hope that you're not letting clients access the database directly.[/QUOTE]
Yes, that's what I need help with also, the database creds is hard coded :v:
I haven't actually released it yet, it was for testing. How exactly do I retrieve values from a MySQL database without direct creds? I am a big noob to databasing.
[QUOTE=G4MB!T;45092012]he is dead serious. pay him $30/hour.[/QUOTE]
Dude, the thing my friend wanted is just some dumb ****, if he's willing to get paid for something that anyone can make, I'd rather learn to do it myself.
[QUOTE=RedCause;45111880]Dude, the thing my friend wanted is just some dumb ****, if he's willing to get paid for something that anyone can make, I'd rather learn to do it myself.[/QUOTE]
Go learn it, then maybe you'll realize why programming isn't charity
[QUOTE=RedCause;45111880]Dude, the thing my friend wanted is just some dumb ****, if he's willing to get paid for something that anyone can make, I'd rather learn to do it myself.[/QUOTE]
Congratulations, you figured out the point as to why he said that and meant that.
[b]ANYWAYS[/b], more C# / SFML questions.
If I am using a view that moves about for my camera, how do I draw "static" elements? In example, a UI, that is always in the same locations on the screen, regardless of where the view may be or what it's Zoom may be.
Seeing as I don't know how to precisely word this question, Google hasn't been much help for me.
You can switch between multiple views and draw before displaying the final frame.
[QUOTE=CRASHFORT;45112429]You can switch between multiple views and draw before displaying the final frame.[/QUOTE]
Oh? I must investigate this.
[editline]fish[/editline]
Perfect. That is exactly what I needed. Thanks!
For posterity's sake, since I hate when people post a problem and then go "Okay I got it solved" and never explain their solution, in the event that other people Google a similar question and find this post:
The RenderWindow class you instantiate has a DefaultView property. Simply switch to that to draw your static shapes, then switch to your actual camera(s) and draw as necessary.
For example:
[code]
while (app.IsOpen()) {
app.DispatchEvents();
app.Clear(windowColor);
app.SetView(app.DefaultView);
app.Draw(my_static_shape);
app.SetView(camera);
app.Draw(my_world_shape);
app.Display();
}[/code]
[QUOTE=AnonTakesOver;45110077]Yes, that's what I need help with also, the database creds is hard coded :v:
I haven't actually released it yet, it was for testing. How exactly do I retrieve values from a MySQL database without direct creds? I am a big noob to databasing.[/QUOTE]
You need a server program running somewhere that marshals between clients and server along fixed paths, manages and verifies logins and sessions (against a [U]cryptographically secure and salted hash[/U] stored in the database) and otherwise keeps unauthorized access away from the database (ideally not even letting the database accept any connections from outside hosts).
Super Meat Boy didn't do that, guess what happened to the user submissions when someone here found out :v:
(I don't remember who it was but someone surely knows.)
[QUOTE=RedCause;45111880]Dude, the thing my friend wanted is just some dumb ****, if he's willing to get paid for something that anyone can make, I'd rather learn to do it myself.[/QUOTE]
lol. seriously though programming is no walk in the park. it takes months even years to get some decent stuff going (depending on the language and motivation).
if you "friend" wants stuff done, either fork out the money for it or they can do it themselves.
[QUOTE=Tamschi;45112980]You need a server program running somewhere that marshals between clients and server along fixed paths, manages and verifies logins and sessions (against a [U]cryptographically secure and salted hash[/U] stored in the database) and otherwise keeps unauthorized access away from the database (ideally not even letting the database accept any connections from outside hosts).
Super Meat Boy didn't do that, guess what happened to the user submissions when someone here found out :v:
(I don't remember who it was but someone surely knows.)[/QUOTE]
Oh gee, I just wanna do something simple...
What about a website that you login from, would I need to do the same? Can clients see PHP code?
[QUOTE=AnonTakesOver;45113895]Can clients see PHP code?[/QUOTE]
No.
-snip-
[QUOTE=cartman300;45114189]No.[/QUOTE]
So I can hardcode my MySQL creds into the php and it will be completely safe?
[QUOTE=AnonTakesOver;45115807]So I can hardcode my MySQL creds into the php and it will be completely safe?[/QUOTE]
Yes, but you can also write it in a file that only (for example) apache can read.
[QUOTE=AnonTakesOver;45113895]Oh gee, I just wanna do something simple...
What about a website that you login from, would I need to do the same? Can clients see PHP code?[/QUOTE]
The PHP stuff counts as server program but... you really have to make sure that you know what you're doing if you use that.
If very easy to accidentally publish/expose things you didn't want to with that system, as far as I know.
(Error messages being sent to the client etc.)
[editline]16th June 2014[/editline]
[QUOTE=Mete;45116195]Yes, but you can also write it in a file that only (for example) apache can read.[/QUOTE]
Optimally outside the served directory.
[QUOTE=Teddybeer;45119829]Has someone more useful information on Awesomium than this [URL="http://wiki.awesomium.net/winforms/webcontrol.html"]very helpful wikipage[/URL].[/QUOTE]
Yes: Don't use it for Windows programs. Web GUIs are extremely bloated in comparison to native frameworks and are a common source of security issues.
(The C++ version shouldn't be too different, you can probably just use that after you drag/drop the Control onto the Form. Also check the API reference in the .dll, I would be surprised if there wasn't any.)
[QUOTE=Tamschi;45122188]Yes: Don't use it for Windows programs. Web GUIs are extremely bloated in comparison to native frameworks and are a common source of security issues.
(The C++ version shouldn't be too different, you can probably just use that after you drag/drop the Control onto the Form. Also check the API reference in the .dll, I would be surprised if there wasn't any.)[/QUOTE]
There are some neat uses of web UI's in desktop applications, for example Adobe's Brackets editor. I wouldn't say it's always bad, sometimes the flexibility can outweigh the "bloatedness".
[QUOTE=Teddybeer;45122671]Well then what should I use (better be easy to use, the only reason why I want to use a Web GUI is because I know I can make it look pretty :v:).[/QUOTE]
Visual Studio has Drag'n'drop UI design for Windows. As simple as it gets.
[QUOTE=Teddybeer;45122671]Well then what should I use (better be easy to use, the only reason why I want to use a Web GUI is because I know I can make it look pretty :v:).[/QUOTE]
If you only target Windows I recommend WPF: There are a ton of existing styles, you can make your own fairly easily (actually maybe easier than with CSS, since it's more powerful - and there are good tools to do it like) and it has native performance.
If you want to go cross-platform: I know WinForms runs on Mono too, and can be styled pretty well if you know how (I don't.) but there are likely better alternatives.
You also have to consider the value of native look-and-feel, which is usually automatic with native GUI frameworks except in Java: They obey the system's visual and accessibility settings, which won't be that easy with a browser GUI.
[QUOTE=Teddybeer;45122671]Well then what should I use (better be easy to use, the only reason why I want to use a Web GUI is because I know I can make it look pretty :v:).[/QUOTE]
QT is also very easy to handle on the UI part :)
Quick question: I'm working on a multiplayer game, and I have separate two separate projects for it: client (javascript), and server (java). Now I want to start git repo on it. Should I create one repo, or separate repos for client and server?
[QUOTE=Deseteral;45124165]Quick question: I'm working on a multiplayer game, and I have separate two separate projects for it: client (javascript), and server (java). Now I want to start git repo on it. Should I create one repo, or separate repos for client and server?[/QUOTE]
your decision
If it functions as a whole, you'd preferably keep them in the same repo,
You won't have to go and search for the right server revision with the right client revision, you can just pick any "game" revision and you'll be assured that its a valid pair, because its in the same repo.
Sorry, you need to Log In to post a reply to this thread.