[QUOTE=DrTaxi;45925824]Not a safe bet. If you write programs to run for a couple hours, the extra work hours that go into optimisation are probably still gonna be more expensive than the CPU hours you'd save.
Now, if you're writing software to run on other people's supercomputers, and you're in direct competition based on performance...
Or processors in general. Someone in WAYWO was talking about their work at ARM a while back.
Code that runs on GPUs is also good - though you'll always be at C level, no higher, no lower (unless you work for the card manufacturer).[/QUOTE]
I mean working for the card manufacturer.
[QUOTE=Cold;45925875]I mean working for the card manufacturer.[/QUOTE]
I know that's what you meant, I was saying that third-party development is also a good option if it involves GPUs.
[QUOTE=Cold;45925503]The C++ standard only defines a minimum size, 4 bytes is enough to hold an "long int".
In visual studio its 4 bytes, in G++/Clang its 8 bytes i think.
The reason why sizeof(int) and sizeof(long int) is the same in visual studio, is because its a leftover from 16 bit systems.
Back then ints where 16 bits and long ints 32 bits, at some point in time ints where changed to 32 bits because processors where faster when working with machine-word sized integers.
And according to the C++ standard thats a valid change to make because it only defined a minimum size.[/QUOTE]
Specifically:
* char is the smallest addressable size and at least eight bits,
* short is at least 16 bits,
* int is at least as big as short,
* long is at least 32 bits and at least as big as an int,
* long long is at least 64 bits and at least as big as a long.
[editline]8th September 2014[/editline]
If a machine can only address 64 bit values, it's perfectly legal for every integral type up to long long int to be 64 bits in size.
[QUOTE=Cyberuben;45902715]I have an assignment for Game Technology which is basically creating a mathematically correct physics simulation based on gravity without energy loss (or with energy loss, however, this is only a variable I have to change). The thing is, I have a ball and a plane. As long as the plane has no rotation other than the Y axis, the simulation works.
To get additional points, I have to make it possible with arbitrary planes, meaning it should be able to bounce of any plane with any orientation. I am planning on creating a triangular shaped "bowl" that makes the ball bounce off. I don't necessarily have a problem by making the ball bounce off the plane correctly, but the requirements for this assignment are that the balls position has to be calculated using a function.
The suggestion was that there would be a function called Pt (Position over time) and Vt (velocity over time). Instead of using Unity colliders to detect the collision or apply the physics, I have to calculate the time of impact myself using the ABC formula. Now I [url=http://stackoverflow.com/questions/25682990/intersect-parabola-with-rotated-plane-in-3d-engine/25690454?noredirect=1#comment40157277_25690454]asked some help on Stackoverflow[/url] but my Vector math got a bit rusty and I am not that good with planes in a 3D coordinate system anymore. The guy described how to get to the time of impact but I do not have a function that represents the orientation and position of the plane, I only have the position and rotation as Vectors (eulerAngles and position in units).
Is there anyone here who could explain me how I could retrieve the function of my plane and what the "w" in the Stack Overflow question is?[/QUOTE]
If anyone cares, I think I have it!
[img]http://ss.rubensrv.nl/i/1382Ww.png[/img]
Why does my C textbook tell me to use [code]_Bool[/code] for C99 Boolean, when Netbeans + Cygwin doesn't recognize that? It recognized [code]bool[/code] instead, which my textbook specifically says would interfere with existing C programs that had to create their own Boolean type.
[IMG]http://i.imgur.com/VvAYOLA.png[/IMG]
The following program compiles with no issues and outputs "True":
[code]#include <stdio.h>
#include <stdbool.h>
int main(void)
{
bool flag = true;
if (flag == 0)
printf("False\n");
else if (flag == 1)
printf("True\n");
else
printf("Error\n");
return 0;
}
[/code]
[URL="http://www.amazon.com/Programming-Modern-Approach-2nd-Edition/dp/0393979504"]The book came out in 2008, did this change over 6 years?[/URL]
Answered my own question:
[url]http://stackoverflow.com/questions/8724349/difference-between-bool-and-bool-types-in-c[/url]
bool is an alias for _Bool when <stdbool.h> is included
Supp guys,
After I finally move in to my own flat, I'm able to start doing stuff for serious.
I picked C#, cuz it's really good for me, I can do simple (and bit more complicated) programs with it, but dunno where to head first, just not to stay in one place.
I'm also interest in networking (i finished CISCO CCNA course and really like networking) so I thought I could start network programming, small programs to comunicate with each other, server-client stuff etc.
What do You think guys? Any similar "problems"?
I wanna do something visually pretty in 3D/2D using C++, I have somewhat decent math skills, so what do I use? I haven't used C++ in 4 years and I'd like to get back into it, got any suggestions? I don't think I'll be needing an entire game engine for this thing though.
[QUOTE=Hoffa1337;45931796]I wanna do something visually pretty in 3D/2D using C++, I have somewhat decent math skills, so what do I use? I haven't used C++ in 4 years and I'd like to get back into it, got any suggestions? I don't think I'll be needing an entire game engine for this thing though.[/QUOTE]
You should take a look at [URL="http://libcinder.org/"]Cinder[/URL].
My Comp Sci professor gave us an assignment;
to write a 2 page paper on a "java compiler like JGrasp, Eclipse, Blue-Jay etc."
Now I know those are IDEs, but that's what he called them. So should I... write about the JRE/JVM and include a couple things about Eclipse, or should I just do what I think he confusedly wants me to do and write about Eclipse only. He's not the kind of professor that really appreciates you going above and beyond the homework assignment, so if I include a bunch of stuff on what a compiler actually is, I'm likely to get a 0 for the assignment. What do I do?
Can you ask him about it or is he gonna be mad?
But yeah he probably wants you to write about what one of these IDEs automates for you. Project management, build system, code completion/highlighting, symbol lookup, refactoring...
Just ask him, if he wasn't clear it's his own fault.
Well I emailed him. In the meantime, how do I write a paper on an IDE, if that is what I'm to do? What components should I be describing? Syntax completion? Eclipse's compiler? all the runtime shit and the really specific details? he wasn't really specific in what we were to write aboot
For IDE, feature comparison in a unbiassed way i would say. Take the major shared features (syntax completion, project management, ...), some standout features that the others don't have (if applicable), extensibility, stability/speed.
Anybody know how to get key-presses from game-pad's in c++? Or something that might help me out.
I got a ps2 controller hooked up to a parallel port (recognized in windows) and i wan't to send the key's to my desktop.
[QUOTE=0lenny0;45940475]Anybody know how to get key-presses from game-pad's in c++? Or something that might help me out.
I got a ps2 controller hooked up to a parallel port (recognized in windows) and i wan't to send the key's to my desktop.[/QUOTE]
SDL2 has pretty good gamepad support. Not sure if it can read from the parallel port, but you could give it a try.
[QUOTE=Z_guy;45940648]SDL2 has pretty good gamepad support. Not sure if it can read from the parallel port, but you could give it a try.[/QUOTE]
I mapped the controller to a keyboard using JoyToKey. All that's left to do now is to write a simple program that send the keyboard output to my desktop.
The university that I attend gave out the sixth edition of Deitel's C: How to program, is this a good book for a complete beginner?
Are there better books that I should read instead?
[code]
#include <iostream>
#include <complex>
#include <vector>
int main()
{
auto x = 20;
auto y = true;
double d1 = 2.3;
double d2 {2.3};
std::complex<double> z {d1,d2};
std::vector<int> v {1,2,3,4,5,6};
return 0;
}
[/code]
Why doesn't this compile? I am confused. Am I missing a header?
[QUOTE=RaTcHeT302;45941213][code]
#include <iostream>
#include <complex>
#include <vector>
int main()
{
auto x = 20;
auto y = true;
double d1 = 2.3;
double d2 {2.3};
std::complex<double> z {d1,d2};
std::vector<int> v {1,2,3,4,5,6};
return 0;
}
[/code]
Why doesn't this compile? I am confused. Am I missing a header?[/QUOTE]
Maybe you should, you know, post the error?
Visual Studio doesn't support that apparently, but here it is anyway.
[code]
error C2552: 'v' : non-aggregates cannot be initialized with initializer list
1> 'std::vector<_Ty>' : Types with a base are not aggregate
1> with
1> [
1> _Ty=int
[/code]
So I got an email back from my professor. I sent:
[quote]Professor Anwari,
For the paper that was assigned (2 pages about a java compiler). You mentioned IDEs such as JGrasp and Eclipse. Was the assignment to write about Java IDEs, or to write about the Compilation process for Java, including portions about the JRE and JVM (for example)?
Thanks a lot,
Collin ******[/quote]
he replied:
[quote]Just about java compiler that you use[/quote]
So I guess I'm going with an IDE since he refuses to acknowledge the difference between the two.
[QUOTE=proboardslol;45941356]So I got an email back from my professor. I sent:
he replied:
So I guess I'm going with an IDE since he refuses to acknowledge the difference between the two.[/QUOTE]
Ah, dear poor sod. We all feel for you. Alas, more often than not you'll end up with a programming teacher that's incompetent as fuark.
[QUOTE=Kirth;45941437]Ah, dear poor sod. We all feel for you. Alas, more often than not you'll end up with a programming teacher that's incompetent as fuark.[/QUOTE]
We're not doing any programming this semester. Which is normal, from what I hear
Because not doing the thing you're supposed to be learning will help you learn it. It speaks for itself you can't just sit behind a keyboard and code without any guidance or theoretical knowledge. However: only learning theoretical knowledge, you'll never be able to fully understand or properly apply it without practical skills.
If I can give you a word of advice: get a good book on programming (preferably start with Charles Petzold's CODE; which is a brilliant and easy to get in to introduction to the world of computers, code and programming). Read, try doing some pet projects. Because at this rate, the biggest thing school is preparing you to aspire for is becoming yet another mediocre "programmer".
You're asking questions and seem interested; keep at that and you'll turn out just fine. Best of luck.
[QUOTE=Kirth;45941729]Because not doing the thing you're supposed to be learning will help you learn it. It speaks for itself you can't just sit behind a keyboard and code without any guidance or theoretical knowledge. However: only learning theoretical knowledge, you'll never be able to fully understand or properly apply it without practical skills.
If I can give you a word of advice: get a good book on programming (preferably start with Charles Petzold's CODE; which is a brilliant and easy to get in to introduction to the world of computers, code and programming). Read, try doing some pet projects. Because at this rate, the biggest thing school is preparing you to aspire for is becoming yet another mediocre "programmer".
You're asking questions and seem interested; keep at that and you'll turn out just fine. Best of luck.[/QUOTE]
I've been coding for a few years now. Since middle school. I'm currently working on C. My ultimate goal by the end of my freshman year is to write a very simple BASIC interpreter.
Thanks for the advice; I'll check that book out and see if my school library has it online
My ps2 controller is able to send fake keys to my desktop now, but i can't seem to get any key presses recognized by the emulator (works fine in notepad).
I tried SendInput and keybd_event but that doesn't work with the emulator.
The only thing i came across when searching is writing a fake keyboard driver but i'm not capable of that.
Anybody that could help me out in a way?
Java Question:
I want to make a program to generate a random password after the user inputs what they want in the password and how long they want it to be.
Here's what I got so far.
[code]import java.util.Random;
import java.util.Scanner;
public class Password
{
public static void main(String [] args)
{
Scanner in = new Scanner(System.in);
Random rn = new Random();
String selection = "";
int passwordLength = 0;
System.out.println("\t\t\tPassword Generation Menu");
System.out.println("*****************************************************************");
System.out.println("*\t[1] Lowercase Letters\t\t\t\t\t*");
System.out.println("*\t[2] Lowercase & Uppercase Letters\t\t\t*");
System.out.println("*\t[3] Lowercase, Uppercase & Numbers\t\t\t*");
System.out.println("*\t[4] Lowercase, Uppercase, Numbers & Punctuation\t\t*");
System.out.println("*\t[5] Quit\t\t\t\t\t\t*");
System.out.println("*****************************************************************");
System.out.println();
System.out.print("Enter Selection (1-5): ");
selection = in.next();
int selectionNumber = Integer.parseInt(selection);
if(selectionNumber == 5)
{
System.out.println("Ending program. Goodbye.");
}
else{
System.out.println();
System.out.print("Password Length (1-14): ");
passwordLength = in.nextInt();
}
if(selectionNumber == 1)
{
}
else if(selectionNumber == 2)
{
}
else if(selectionNumber == 3)
{
}
else if(selectionNumber == 4)
{
}
}
}[/code]
Now, I was thinking for generating the random letters to do this.
[code]
Random r = new Random();
char c = (char)(r.nextInt(26) + 'a');
[/code]
Would this be correct or would I have to do something else?
What emulator are you talking about?
SendInput [I]should[/I] work with any Windows program, but you need to make sure that the control you're trying to type into actually has input focus, not your application.
[editline]10th September 2014[/editline]
[QUOTE=joshuadim;45942612]Now, I was thinking for generating the random letters to do this.
[code]
Random r = new Random();
char c = (char)(r.nextInt(26) + 'a');
[/code][/QUOTE]
This should work, did you actually try it?
Note you don't have to create a new instance of Random every time you want a number, you can (and should) reuse it between generations.
[QUOTE=DrTaxi;45942615]What emulator are you talking about?
SendInput [I]should[/I] work with any Windows program, but you need to make sure that the control you're trying to type into actually has input focus, not your application.
[editline]10th September 2014[/editline]
This should work, did you actually try it?
Note you don't have to create a new instance of Random every time you want a number, you can (and should) reuse it between generations.[/QUOTE]
I just wanted opinions if there was a better way to do it or not.
Thanks though :)
[editline]10th September 2014[/editline]
Ok so for generating random letters for option 1 in my program, would this
[code]
if(selectionNumber == 1)
{
for(int generating = 0; generating <= passwordLength; generating++)
{
char random = (char)(rn.nextInt(26) + 'a');
}
System.out.println();
}[/code]
be correct?
Also, how would I print out all the chars that were randomly generated?
[QUOTE=DrTaxi;45942615]What emulator are you talking about?
SendInput [I]should[/I] work with any Windows program, but you need to make sure that the control you're trying to type into actually has input focus, not your application.
...
[/QUOTE]
I think it's because i did key pressed and released directly after each other. I added a slight delay between them and it seems to function now.
I'm wondering if i'm gonna be able to do combo's (such as constant running + an attack) this way.
I hope i can else i'm gonna have to figure out a way to delay the key up for periods of time or something but i don't think i can do that tonight (my head is still spinning from trying to figure out how to write to the keyboard buffer at a low level).
edit:
Seems like i can't.
Sorry, you need to Log In to post a reply to this thread.