• Hey, guest user. Hope you're enjoying NeoGAF! Have you considered registering for an account? Come join us and add your take to the daily discourse.

Programming |OT| C is better than C++! No, C++ is better than C

I have to make a program that allows the user to select Metric or Us, then to do the calculations.

It keeps getting an error after the else statement.
Wherever you can, use integers. When you start using floats/doubles for calculations, you have to be very aware that youll want to be testing within (very) small ranges for equality tests due to fp precision errors.

You'll be fine for now with this very simple problem, but be wary of this fact in the future. Also try to cut down on code duplication. Quick use of the ternary operator could cut your program size in half.

That or I would just have to user enter in the variable values as per normal, and have a simple if/else statement to have the proper calculation performed on the input (based on whether the user selects us or metric). I'll do up a solution when I'm not on my phone.
 

shintoki

sparkle this bitch
Program keeps crashing again, though it boots up at least now.

It is stating "Run-Time Check Failure #3 - The variable 'metric' is being used without being initialized."

So I guess I need to use int somewhere with metric and us?


Does someone have a decent example, since I'm considering now to just rewrite the program completely?
 

Harpuia

Member
Just need some verification/help here, I'm having the toughest time formatting this math expression correctly in C++.

So, I have to write the taylor series formula of sine for the first 5 iterations. So, this is what I've got:

Code:
for(int n = 0; n < 5; n++)
	{
	 currentIteration = (pow(-1, n) * pow(x, 2*n+1)) / fact(2*n+1);
	 sum += currentIteration;
	}
EDIT: Read pow(-1, n) as -1 to the power of n, and fact(2*n+1) as the factorial of 2*n+1.

This will limit the accuracy of the sine of pi/2 to the first 5 iterations of the series.



Now, theoretically, entering in pi/2 should give you a value near sin(pi/2), which should be about 1.000003206.
However, this is giving me some fucking weird random number instead of a value near or around 1.

Help GAF! I seriously do not know what the hell to do here, it's diving me insane!
 

Kalnos

Banned
Program keeps crashing again, though it boots up at least now.

It is stating "Run-Time Check Failure #3 - The variable 'metric' is being used without being initialized."

So I guess I need to use int somewhere with metric and us?


Does someone have a decent example, since I'm considering now to just rewrite the program completely?

Sounds like you declared the variable 'metric' but didn't set it equal to any initial value. For example:

int metric;

instead of:

int metric = 0;
 
Program keeps crashing again, though it boots up at least now.

It is stating "Run-Time Check Failure #3 - The variable 'metric' is being used without being initialized."

So I guess I need to use int somewhere with metric and us?


Does someone have a decent example, since I'm considering now to just rewrite the program completely?

Your program is kind of "doubly" typed.

Code:
double vi;
double vf;
double d;
double f;
double metric; // this guy here
double us; // and this guy here
double x;
double y;
double unit;

You compare those highlighted variables to your variable "unit" but you've never initialized the previous variables to anything. And what is the person entering when you ask "metric or us?" A number? Because that's what a double is. Is it text? Do you give the person any indication what text (or number) is even valid? So yeah, your program could use some work.
 

Randdalf

Member
Just need some verification/help here, I'm having the toughest time formatting this math expression correctly in C++.

So, I have to write the taylor series formula of sine for the first 5 iterations. So, this is what I've got:

Code:
for(int n = 0; n < 5; n++)
	{
	 currentIteration = (pow(-1, n) * pow(x, 2*n+1)) / fact(2*n+1);
	 sum += currentIteration;
	}

What type is currentIteration? If it's a double or float I think you should be casting the value of n into a float/double before using it. I personally take no chances in C++ any more when dealing with different primitive types and have casts everywhere, after wasting lots of time fixing casting problems.
 

usea

Member
Just need some verification/help here, I'm having the toughest time formatting this math expression correctly in C++.

So, I have to write the taylor series formula of sine for the first 5 iterations. So, this is what I've got:

Code:
for(int n = 0; n < 5; n++)
	{
	 currentIteration = (pow(-1, n) * pow(x, 2*n+1)) / fact(2*n+1);
	 sum += currentIteration;
	}
EDIT: Read pow(-1, n) as -1 to the power of n, and fact(2*n+1) as the factorial of 2*n+1.

This will limit the accuracy of the sine of pi/2 to the first 5 iterations of the series.



Now, theoretically, entering in pi/2 should give you a value near sin(pi/2), which should be about 1.000003206.
However, this is giving me some fucking weird random number instead of a value near or around 1.

Help GAF! I seriously do not know what the hell to do here, it's diving me insane!

I ran your code, adding the stuff that was missing. I got 1.00000354258429

Here's what I have in full (C#):
Code:
void Main()
{
  var currentIteration = 0.0;
  double x = Math.PI / 2.0;
  double sum = 0;
  for(int n = 0; n < 5; n++)
  {
    currentIteration = (pow(-1, n) * pow(x, 2*n+1)) / fact(2*n+1);
    sum += currentIteration;
  }
  sum.Dump();
}

public double pow(double a, double b)
{
  return Math.Pow(a, b);
}

public int fact(int n)
{
  var r = 1;
  for (int i = 1; i <= n; i++)
  {
    r *= i;
  }
  return r;
}
 

Harpuia

Member
Blargh I left out a lot of things, including where the problem keeps happening.

Code:
#include <iostream>
#include <cmath>

using namespace std;

long fact(int);
double sin(double);
double cos(double);

long fact(int n)
{
	long product = 1;
	while(n > 1)
	 product *= n--;
	return product;
}

double sin(double x)
{
	double currentIteration, sum;

	for(int n = 0; n < 5; n++)
	{
	 double currentIteration = pow(-1, n)*pow(x, 2*n+1) / fact(2*n+1);
	 sum += currentIteration;
	}
	return sum;
}

int main()
{

	double number, sum = 0, sineOfnumber;

	cout << "Enter a number, then I will calculate the sine of this number" << endl;

	cin >> number;

	sineOfnumber = sin(number);
	cout << "The sine of " << number << " is: " << sineOfnumber << endl;
	
	return 0;
}

Ok, I'm assuming that my issue are with the data types? Because otherwise I feel like my math expression for the taylor series of sine is ok.

EDIT: After changing every single variable and function to the type double, it stopped randomly giving me an answer for input. Fuck?
Also, criticisms for my code structure? My professor is picky to the nth degree and I want to know if anything about this is overly sloppy/disgraceful.
 
I have to create a program where it reads off from a text file that contains:
Code:
Circle 1
Circle red true 1
Rectangle 10 20
Rectangle blue true 1 5

The first string is the object type (Circle or Rectangle) then it either follows stating the radius or the color of the object type, then if it is filled.

ex,

Rectangle [object type], blue [color], true [is filled], 1 [height], 5 [width].

Since this text has many different variable types, how would I go around adding this into an ArrayList?

I have this:
Code:
Scanner s = new Scanner(new File("mydata.txt"));
	ArrayList<String> Objects = new ArrayList<String>();
	while (s.hasNext()){
		Objects.add(s.next());
	}
	s.close();
but I know it is wrong since they aren't all Strings.

Any suggestions would be appreciated! :)
 

Harpuia

Member
Well I solved my previous issue, but now I wonder, why is type casting even a thing? My program worked once I just declared every single variable and function to double. Type casting just seems like a non issue if you just save all your data types to the same. Maybe this issue arises once you HAVE to use different data types? Also when variable allocation size starts becoming an issue?
 

Kalnos

Banned
I have to create a program where it reads off from a text file that contains:
Code:
Circle 1
Circle red true 1
Rectangle 10 20
Rectangle blue true 1 5

The first string is the object type (Circle or Rectangle) then it either follows stating the radius or the color of the object type, then if it is filled.

ex,

Rectangle [object type], blue [color], true [is filled], 1 [height], 5 [width].

Since this text has many different variable types, how would I go around adding this into an ArrayList?

I have this:
Code:
Scanner s = new Scanner(new File("mydata.txt"));
	ArrayList<String> Objects = new ArrayList<String>();
	while (s.hasNext()){
		Objects.add(s.next());
	}
	s.close();
but I know it is wrong since they aren't all Strings.

Any suggestions would be appreciated! :)

Sounds like Rectangle/Circle should be derived from some sort of base 'Shape' class which contains the general properties that are shared by them, and that you should have an ArrayList of type 'Shape'. Color, isfilled, etc are variables of the 'Shape' class since they're relevant to both Circles and Rectangles. You loop through each string of the file, create the object, initialize the variables (isfilled, etc), and then add it to the ArrayList.

This is assuming I'm understanding what you want, anyway.
 
Well I solved my previous issue, but now I wonder, why is type casting even a thing? My program worked once I just declared every single variable and function to double. Type casting just seems like a non issue if you just save all your data types to the same. Maybe this issue arises once you HAVE to use different data types? Also when variable allocation size starts becoming an issue?

My experience with typecasting is pretty much this:

Static:

7 divided with cats

Code:
type error

Dynamic:

7 divided with cats

Code:
five bananas
 

Jokab

Member
I have to create a program where it reads off from a text file that contains:
Code:
Circle 1
Circle red true 1
Rectangle 10 20
Rectangle blue true 1 5

The first string is the object type (Circle or Rectangle) then it either follows stating the radius or the color of the object type, then if it is filled.

ex,

Rectangle [object type], blue [color], true [is filled], 1 [height], 5 [width].

Since this text has many different variable types, how would I go around adding this into an ArrayList?

I have this:
Code:
Scanner s = new Scanner(new File("mydata.txt"));
	ArrayList<String> Objects = new ArrayList<String>();
	while (s.hasNext()){
		Objects.add(s.next());
	}
	s.close();
but I know it is wrong since they aren't all Strings.

Any suggestions would be appreciated! :)

Similar to what Kalnos says, I think the best idea would be to use an interface (this looks like Java), collect the methods that the different types share and put them there, then have the classes you want to put in the arraylist implement that interface.
 
Well I solved my previous issue, but now I wonder, why is type casting even a thing? My program worked once I just declared every single variable and function to double. Type casting just seems like a non issue if you just save all your data types to the same. Maybe this issue arises once you HAVE to use different data types? Also when variable allocation size starts becoming an issue?

Type casting is a thing because if the compiler doesn't know how to interpret that series of bits in memory then the value is just random noise. C/C++ is more dangerous than most languages in that respect in that you can effectively cast anything to anything, even if there's no way for the data to make sense in the new type. One example of a use of type casting is random number generation Yes, careful choice of type can solve a lot of problems. Not sure what you mean by variable allocation size. Do you mean when do the quantity of variables you declare start using too much memory?
 
Kinda general question:

I have a list of elements (tabs). When I open a new tab, I want to check if that tab already exists. If it exists, I change the view to that tab. If it doesn't, I open up the new tab.

What is the best way to do this? Currently I am basically iterating through the elements with

Code:
for (var i:int = 0; foo.numElements; i++){

var bar:Object = foo.getElementAt(i);

if (bar.thing == current.thing){
..
}

..

Is there a better way?
 
Kinda general question:

I have a list of elements (tabs). When I open a new tab, I want to check if that tab already exists. If it exists, I change the view to that tab. If it doesn't, I open up the new tab.

What is the best way to do this? Currently I am basically iterating through the elements with

Code:
for (var i:int = 0; foo.numElements; i++){

var bar:Object = foo.getElementAt(i);

if (bar.thing == current.thing){
..
}

..

Is there a better way?
Well, if you have a good way of uniquely identifying the tabs (are these browser tabs? URL would work), putting them in a dictionary would give you a faster way of seeing whether a tab already exists.
 
Well, if you have a good way of uniquely identifying the tabs (are these browser tabs? URL would work), putting them in a dictionary would give you a faster way of seeing whether a tab already exists.

They are AS3/Flex tabs... it's working the way I did it but yeah, Dictionary would be faster I guess. I'll try that, thanks.
 

leroidys

Member
Can someone with a good handle on C pointers explain this to me?

I have a bunch of examples of a linked list implementation. I don't understand why you have to pass a pointer to the pointer into the functions, like this one:

Code:
voide removeHead( Node **head){
        Node *temp = (*head)->next;
        delete *head;
        *head = temp;

but the beginning of another function goes like this

Code:
bool remove(element *elem){
...
...
...
        head = elem->next;
        delete elem;

Why can we directly reference head in one but not the other? Also, when is -> notation and when is dot notation used?

Thanks!
 

Blizzard

Banned
Can someone with a good handle on C pointers explain this to me?

I have a bunch of examples of a linked list implementation. I don't understand why you have to pass a pointer to the pointer into the functions, like this one:

Code:
voide removeHead( Node **head){
        Node *temp = (*head)->next;
        delete *head;
        *head = temp;

but the beginning of another function goes like this

Code:
bool remove(element *elem){
...
...
...
        head = elem->next;
        delete elem;

Why can we directly reference head in one but not the other? Also, when is -> notation and when is dot notation used?

Thanks!
In the first case, I don't think the double pointer is needed at all. You would use a double pointer if you wanted to set the original pointer passed in to NULL, but your code sample does not do that.

-> notation is used to access struct or object members on a pointer to an object, like "pObject->_someVariable".

. notation is used to access struct or object members on a object, like "myObject._someVariable".
 

leroidys

Member
In the first case, I don't think the double pointer is needed at all. You would use a double pointer if you wanted to set the original pointer passed in to NULL, but your code sample does not do that.

-> notation is used to access struct or object members on a pointer to an object, like "pObject->_someVariable".

. notation is used to access struct or object members on a object, like "myObject._someVariable".

Ah thanks. The code examples are straight from a programming interview book. It says that updating *head will do nothing if we pass *head into the function because c passes by value or something.
 

Bruiserk

Member
I'm trying to build a simple login page for a class project website. I have my login page:

Code:
<!DOCTYPE html>
<head>
<title>Login Page</title>
</head>
<body bgcolor="#FFE4C4">
	<h1>Login</h1>
		<form action=&#8221;login.php&#8221; method=&#8221;POST&#8221;>
			Username<input type=&#8221;text&#8221; name=&#8221;user&#8221;>
			Password<input type=&#8221;password&#8221; name=&#8221;pass&#8221;>
			<input type=&#8221;submit&#8221; value=&#8221;Login&#8221;>
		</form>
</body>

When I load the webpage (REDACTED ) you can see the there is no login button, but it is a text box. Does anyone know why?

Also, the password is shown when typing when it should be filled with black circles. I've tried this code before )although not in a form) and it works.
 

Bruiserk

Member
EDIT 3: I got it working now. feels good bro.
EDIT 2: So i changed the code. I read it into an array instead of the row method. I then ask it to output "Correct" if the credentials are right, and it is working. Now I just have to redirect them to the webpage.
EDIT: Sorry for the double post...

So, what about this:
REDACTED

It redirects me to a blank page, namely: /login.php

It is then a blank white screen from there. Even when I replace the password to the database, it doesn't give me the error so I guess the first line isn't running in the first place.

disclaimer: First time doing PHP today, so. Yea.
 
Can someone with a good handle on C pointers explain this to me?

I have a bunch of examples of a linked list implementation. I don't understand why you have to pass a pointer to the pointer into the functions, like this one:

Why can we directly reference head in one but not the other? Also, when is -> notation and when is dot notation used?

Thanks!


In the first case, I don't think the double pointer is needed at all. You would use a double pointer if you wanted to set the original pointer passed in to NULL, but your code sample does not do that.

-> notation is used to access struct or object members on a pointer to an object, like "pObject->_someVariable".

. notation is used to access struct or object members on a object, like "myObject._someVariable".

Courtesy of a relatively recent Linus Torvalds Q & A:
At the opposite end of the spectrum, I actually wish more people understood the really core low-level kind of coding. Not big, complex stuff like the lockless name lookup, but simply good use of pointers-to-pointers etc. For example, I've seen too many people who delete a singly-linked list entry by keeping track of the "prev" entry, and then to delete the entry, doing something like

if (prev)
prev->next = entry->next;
else
list_head = entry->next;

and whenever I see code like that, I just go "This person doesn't understand pointers". And it's sadly quite common.

People who understand pointers just use a "pointer to the entry pointer", and initialize that with the address of the list_head. And then as they traverse the list, they can remove the entry without using any conditionals, by just doing a "*pp = entry->next".

So there's lots of pride in doing the small details right. It may not be big and important code, but I do like seeing code where people really thought about the details, and clearly also were thinking about the compiler being able to generate efficient code (rather than hoping that the compiler is so smart that it can make efficient code *despite* the state of the original source code).

And here's a more in-depth analysis of his statement.
 

Blizzard

Banned
Ah thanks. The code examples are straight from a programming interview book. It says that updating *head will do nothing if we pass *head into the function because c passes by value or something.
Well each pointer is just a number, say a 32-bit value for example (may depend on the operating system and machine). Take some contrived examples:

Code:
void bad_set_to_null( Robot* pSomeRobot )
{
   pSomeRobot = NULL;
}

void good_set_to_null( Robot** pSomeRobot )
{
   if(NULL != pSomeRobot)
   {
      *pSomeRobot = NULL;
   }
}

Now take some code to actually call those functions:
Code:
Robot aRobotObject;
Robot* pRobotPointer = &aRobotObject;

bad_set_to_null(pRobotPointer);
// pRobotPointer is not NULL at this point.

good_set_to_null(&pRobotPointer);
// pRobotPointer is now NULL.

The call to bad_set_to_null passes the VALUE of pRobotPointer, which is just a number, a memory address. The bad_set_to_null function gets a local parameter called pSomeRobot, which contains the VALUE...the memory address. It then sets the value of pSomeRobot to NULL, but since it is a local variable, it has nothing to do with pRobotPointer back in the main code.

In comparison, the call to good_set_to_null passes another VALUE to a function...but this value is the memory address of pRobotPointer. The & operator means "address of".

So, the good_set_to_null function receives a VALUE that tells where the original pRobotPointer pointer is stored, which means that good_set_to_null can use * to access what is at that memory address: pRobotPointer. This all means that good_set_to_null can directedly modify the value of the original pRobotPointer and set it to NULL.


Hopefully some of that made sense and wasn't just an excessively complicated explanation. :p


*edit* I really dislike the style, readability, and comprehensibility of that two-star programming article, though. :(
 

KageZero

Member
Hello,
can anyone recommend me some sites to start learning java? I found something but it's based on videos and covers only basics so if you know some other sites i would appreciate it. And yeah i prefer text instead of only videos because it's faster and easier to follow. Thanks in advance
 

jokkir

Member
Can someone help me understand this one part

#include <cstdio>
#include <cstring>

class United { // be careful some functions have multiple statements on 1 line!
char x[6];
long y;
public:
United( ) { y=6; strcpy(x, "H sox"); }
United(const char a[ ], long b) {
y=b; strcpy(x, a); printf("United... %ld\n", y);
}
~United( ) { printf("%s", x); }
int change(United *); // be careful, this function accepts an object by address!
void change( ) { x[y] -= 2; y--; }
int operator!( ) { y--; return y; }
};
int United::change(United *p) {
if(p->y) {
p->x[p->y] += 1;
}

if(p->y < 5 && p->y >= 0 && p->y != 1) {
x[p->y] -= 3;
}
printf("%s ... %s\n", p->x, x);
int temp = p->y;
p->y--;
return 1 + temp;
}
int main( ) {
United many(" tmtl", 4);
United one("tkdwu", 4);
United dollar;
printf("You call this an election?\n");
while(!dollar) { // be careful here, the ! is an operator overload
if(dollar.change(&many) != 0) {
one.change( );
}
}
return 0;
}

That was my quiz but I got the changing ASCII values wrong. When "dollar.change(&many) != 0" is called, what does it transfer over to the function?

The function is: int
Code:
United::change(United *p)

And I thought the string values of many were changed but the dollar string was changed. What exactly from many was sent to the function?

EDIT - Nevermind. I'm an idiot -__-
 
I'm having a problem with the text formatting in Android SDK.

Source code
Code:
<string name="blah">\
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque a nisi risus, in
imperdiet lacus. Quisque diam sapien, tristique eget
elementum at, laoreet in sem.</string>

Expected output
Code:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque a nisi risus, in
imperdiet lacus. Quisque diam sapien, tristique eget
elementum at, laoreet in sem.

Actual output
Code:
 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque a nisi risus, in
imperdiet lacus. Quisque diam sapien, tristique eget
elementum at, laoreet in sem.

The backslash is suppose to remove an extra blank on the first line, "Lorem ipsum dolor sit am...". It doesn't do that.
 
Courtesy of a relatively recent Linus Torvalds Q & A:


And here's a more in-depth analysis of his statement.
I'd argue that what Linus says isn't quite fair -- beyond knowing how to use pointers, there's another insight that makes it work.

That insight is that assigning the ** pointer to the next element is iteration, and assigning the * pointer to the next element is deletion. Or put another way, deleting linked list elements is just an iteration gone intentionally awry.
 
I'd argue that what Linus says isn't quite fair -- beyond knowing how to use pointers, there's another insight that makes it work.

That insight is that assigning the ** pointer to the next element is iteration, and assigning the * pointer to the next element is deletion. Or put another way, deleting linked list elements is just an iteration gone intentionally awry.
Very well put.
 
For C: Does anyone know if you can return a double value from a int type function? Either this is possible or there is a typo in the assignment because I just can't figure this out.
 

hateradio

The Most Dangerous Yes Man
I'm having a problem with the text formatting in Android SDK.

Source code
Code:
<string name="blah">\
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque a nisi risus, in
imperdiet lacus. Quisque diam sapien, tristique eget
elementum at, laoreet in sem.</string>
Expected output
Code:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque a nisi risus, in
imperdiet lacus. Quisque diam sapien, tristique eget
elementum at, laoreet in sem.
Actual output
Code:
 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque a nisi risus, in
imperdiet lacus. Quisque diam sapien, tristique eget
elementum at, laoreet in sem.
The backslash is suppose to remove an extra blank on the first line, "Lorem ipsum dolor sit am...". It doesn't do that.
I've noticed that, too. I'm not sure why it adds a space/tab at the start when you use a new line (\n).
 

Bollocks

Member
ok fellow programming GAF, what's a good desktop keyboard for programming?
I have a Sony Vaio laptop and the keyboard is just amazing to type on but my desktop keyboard just sucks in comparison and therefore I rarely want to code on it because it isn't as smooth as on my laptop.

But I want a desktop keyboard that replicates the smoothness of my laptop keyboard.
This is the keyboard in question:
24618_3.jpg


And this is the current desktop keyboard which sucks:
47570_l.jpg


I'm tempted to buy one that looks like my laptop keyboard but I don't know if the keystrokes are as smooth.
 

leroidys

Member
Well each pointer is just a number, say a 32-bit value for example (may depend on the operating system and machine). Take some contrived examples:

Code:
void bad_set_to_null( Robot* pSomeRobot )
{
   pSomeRobot = NULL;
}

void good_set_to_null( Robot** pSomeRobot )
{
   if(NULL != pSomeRobot)
   {
      *pSomeRobot = NULL;
   }
}

Now take some code to actually call those functions:
Code:
Robot aRobotObject;
Robot* pRobotPointer = &aRobotObject;

bad_set_to_null(pRobotPointer);
// pRobotPointer is not NULL at this point.

good_set_to_null(&pRobotPointer);
// pRobotPointer is now NULL.

The call to bad_set_to_null passes the VALUE of pRobotPointer, which is just a number, a memory address. The bad_set_to_null function gets a local parameter called pSomeRobot, which contains the VALUE...the memory address. It then sets the value of pSomeRobot to NULL, but since it is a local variable, it has nothing to do with pRobotPointer back in the main code.

In comparison, the call to good_set_to_null passes another VALUE to a function...but this value is the memory address of pRobotPointer. The & operator means "address of".

So, the good_set_to_null function receives a VALUE that tells where the original pRobotPointer pointer is stored, which means that good_set_to_null can use * to access what is at that memory address: pRobotPointer. This all means that good_set_to_null can directedly modify the value of the original pRobotPointer and set it to NULL.


Hopefully some of that made sense and wasn't just an excessively complicated explanation. :p


*edit* I really dislike the style, readability, and comprehensibility of that two-star programming article, though. :(

Courtesy of a relatively recent Linus Torvalds Q & A:


And here's a more in-depth analysis of his statement.

That's great. Thanks!
 

mackattk

Member
ok fellow programming GAF, what's a good desktop keyboard for programming?
I have a Sony Vaio laptop and the keyboard is just amazing to type on but my desktop keyboard just sucks in comparison and therefore I rarely want to code on it because it isn't as smooth as on my laptop.


I'm tempted to buy one that looks like my laptop keyboard but I don't know if the keystrokes are as smooth.

I am trying to look into mechanical keyboards myself. You can look at the thread here
 

leroidys

Member
FFFFuuuuuuuuuuuuuuuuck

Just had two back to back Amazon phone interviews literally 45 minutes after a stats midterm. Questions were super easy but I totally fucked it up. The first one I ended up with an optimal solution, but it twas kind of painful getting there. The second one I only got an nlogn when there was an easy linear solution using hash tables. Damnit. Haven't got more than 5 hours of uninterrupted sleep in a night in over a month and have so much other stuff going on I was just totally frazzled. It wouldn't feel so bad if the questions weren't so easy. Fuck.
 
ok fellow programming GAF, what's a good desktop keyboard for programming?
I have a Sony Vaio laptop and the keyboard is just amazing to type on but my desktop keyboard just sucks in comparison and therefore I rarely want to code on it because it isn't as smooth as on my laptop.

But I want a desktop keyboard that replicates the smoothness of my laptop keyboard.
This is the keyboard in question:
24618_3.jpg


And this is the current desktop keyboard which sucks:
47570_l.jpg


I'm tempted to buy one that looks like my laptop keyboard but I don't know if the keystrokes are as smooth.

??

The keys feel nice and smooth but i wound up going with a mechanical keyboard for speed/feel reasons. Razr Black Widow. Don't look back.
 

Slavik81

Member
Lots of talk about Amazon recently. Coincidentally (?) I was recently planning on interviewing with them... But I think I'd rather go back to school instead. I missed a few useful CS classes by going EE... And it would get me a chance to work on some hobby projects for a few months.
 

FerranMG

Member
Ok, so I'm probably going to have a work interview next week, and I need some help.

I know my way through C++, meaning I'm not new to OOP at all.
I have also used Java, but more for non-professional, smaller projects.
In this job interview, they'll throw a Java technical test on me.
Is there some kind of Java crash course I could follow in a couple of days so I can do as good as possible in that test?
Any good tips would be appreciated as well.

Thanks!


edit: ok, I've just seen the post above me.
Still, if anyone had something more general, instead of an introduction to Java, that would be great.
 

Aleph

Member
I've been wanting to learn OpenGL for some time now, after searching on the interweb I couldn't find a good, updated tutorial. Someone in this thread recommended NeHe's tutorial, but unfortunately the code was written in 2000.

I found three tutorials on modern OpenGL using C++ that I have found to be good:

  • Tom Dalling - Modern OpenGL: This is the tutorial I have completed, it uses OpenGL 3.2 and explains very well how OpenGL works, without making it too complicated. Chapter 5 explains how to make a very simple system to load/use 3D assets. The author will supposedly expand this tutorial.
  • Durian Software - Intro to Modern OpenGL: I have read the first chapter of this tutorial and it seems to explain, also, how OpenGL works, using some very useful diagrams.
  • OpenGL-Tutorial.org - OpenGL 3.3: I haven't read this tutorial in detail, but it seems to be good. Covers some more advanced topics like shadows and lightmaps.

This is for anyone who has been trying to learn modern OpenGL and needed a tutorial.
 
Top Bottom