• 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

Since the IDE talk is still somewhat fresh, what is the consensus for Codeblocks? Is it actually useful or not?

I have access to Visual Studio 2012 but I would rather not have to migrate over to Windows from Linux to use an IDE if I don't have to do so.
 

JeTmAn81

Member
I've had people tell me that avoiding VS2012 is probably the best idea for now so you may want to consider that I guess :p

I've been liking VS2012 just fine. I can't say it's an incredible improvement, but one thing it does do better is upgrade projects from older versions of Visual Studio.
 
Since the IDE talk is still somewhat fresh, what is the consensus for Codeblocks? Is it actually useful or not?

I have access to Visual Studio 2012 but I would rather not have to migrate over to Windows from Linux to use an IDE if I don't have to do so.

I used to use it for school projects and thought it was pretty decent, certainly better than something like Dev C++. I still find the Visual Studio debugger as the best out there though.
 

AlexM

Member
Yeah i havent used codeblocks in a couple years but it always did the job. Windows or Linux.

Personally i love Visual Studio despite all it's multiplatform issues. I tend to devlop in VS then port from there if need be.

At my current job though we develop in Linux and cross-compile to windows so I have to learn the whole cmake/valgrind/cachegrind toolchain. We use Kdevelop so it's not super painful but it was still a learning experience.

I'd say enjoy VS but dont become complacent.
 

nan0

Member
The only issue with VS is that you don't want to go back to anything else once you get used to it. There is really very little wrong with it, but it can feel a little overwhelming when you're just doing basic stuff with it.
 

Chris R

Member
VS2012 isn't bad per say, it just takes so time to get used to. I use it exclusively (well the Express edition anyways) at home. I'd still say that VS2010 is the best though :p
 

Tomat

Wanna hear a good joke? Waste your time helping me! LOL!
Programming in two (easy) languages I don't have much experience with for a project that is due in two weeks.

Not entirely sure what I'm doing. Experienced members of team disappear frequently.

THIS GONNA BE GOOD
 
Programming in two (easy) languages I don't have much experience with for a project that is due in two weeks.

Not entirely sure what I'm doing. Experienced members of team disappear frequently.

THIS GONNA BE GOOD

If you feel you can't do it. Let other people know, it's your responsibility.
 

Tomat

Wanna hear a good joke? Waste your time helping me! LOL!
It's been alright so far, mostly looking at some of their code and trying to emulate stuff they did. It's just PHP/HTML + MySQL. I have never worked with databases or PHP, and haven't done HTML in yeeeaaars.

I'm managing, but you're right, I'll do that.

Alternatively I could give them the most janky "held together by scotch tape" code and laugh!
 

Harpuia

Member
Well crap, I'm very confused as to why this doesn't work.
Code:
//Assume quantity is 1000.

class Pump
{

	public:
		void setQuantity(double amount);
		void setPricePerLiter(double price);
		void literCounter();
		void displayLitersBoughtAndCost();
		void resetPumpCounters();
		void displayCostPerLiter();
		double decrementQuantity();

		
		double litersUsed;
		double pricePerLiter;
		double cost;
		double quantity;
};


double gasRemaining;

gasRemaining = pumpOne.decrementQuantity();


double Pump::decrementQuantity()
{

	return (quantity-1.0);
}

Nothing else seems to be an issue in my code, unless there's something weird that's not letting me save the return value of the member function decrementQuantity() to the variable gasRemaining. Any tips?
 

Slavik81

Member
Your call to decrementQuantity() doesn't change the value of quantity.

quantity-1.0 returns a new value equal to quantity less 1, but leaves quantity untouched.
quantity-=1.0 reduces quantity by 1.

You want:

Code:
double Pump::decrementQuantity()
{
   quantity -= 1.0;
   return quantity;
}
 

jon bones

hot hot hanuman-on-man action
Solving this crazy ass coding puzzle. Maybe you guys can help me with a few bits. My first problem is this: I want a person object to have within it a vector of luggage objects. That way I can dynamically add luggage objects to a person, and each luggage object will have within it various things that I can access later.

Code:
class person{
public:
		class luggage{
	public:
		int id;
		void setid(int x){ id = x;}
		luggage(){};
	private:
	};

	int H, E, P, id;
	vector<luggage> circs();
	person(){};

private:
};

then in my main, some sample code:

Code:
vector<person> j_vector(100);
int result = 5;
[B]j_vector[z].circs().at(d).setid(result);[/B]

but that last line keeps throwing this error:

error LNK2019: unresolved external symbol "public: class std::vector<class juggler::circID,class std::allocator<class juggler::circID> > __thiscall juggler::circs(void)"

Any idea on what I'm doing wrong?
 
I don't think that syntax is proper for c++ classes? It's hard to follow at any rate.

Try:

Code:
class Person{
    public: //stuff goes here
    private: //stuff
};
class Luggage : public Person {
    public: //stuff
    private: //stuff

Also not exactly necessary but I know that it's usually standard (from what I've seen) for class declaration and objects to start with capital letters. Being picky though.

Also I'm not sure what:

Code:
vector<person> j_vector(100);
int result = 5;
j_vector[z].circs().at(d).setid(result);

is meant to accomplish. What is j_vector[z]?
 

Apoc29

Member
Putting the parentheses after circs declares it as a function, which means you would have to provide a definition for it, e.g.

Code:
vector<luggage> person::circs()
{
    // return vector here
}

But you probably meant to declare it as a variable instead:

Code:
vector<luggage> circs; // Without the parentheses

j_vector[z].circs.at(d).setid(result);
 

jon bones

hot hot hanuman-on-man action
Sorry, I'll try to clarify:

First I'm making a vector of persons (called j_vector)

then I want each person object in that vector to also have a vector of luggage objects (called circs)

j_vector[z].circs().at(d).setid(result);

is trying to attempt the zth person object in j_vector, then the dth luggage object and then set the id of that luggage object to "result"

But you probably meant to declare it as a variable instead:

Code:
vector<luggage> circs; // Without the parentheses

that's exactly what's happening - THANKS! it's throwing a

First-chance exception at 0x762dc41f in yodle.exe: Microsoft C++ exception: std::eek:ut_of_range at memory location 0x0046f2bc..
Unhandled exception at 0x762dc41f in yodle.exe: Microsoft C++ exception: std::eek:ut_of_range at memory location 0x0046f2bc..


error but at least i'm making headway
 

tokkun

Member
Code:
class person{
public:
		class luggage{
	public:
		int id;
		void setid(int x){ id = x;}
		luggage(){};
	private:
	};

	int H, E, P, id;
	vector<luggage> circs();
	person(){};

private:
};

General design suggestion: Make Luggage a separate class from person, rather than a member class of person.
 

Tomat

Wanna hear a good joke? Waste your time helping me! LOL!
Congratulations, you now qualify as a professional PHP-coder!

Great! I'll slap that on my resume.

I ended up sorta finishing what I was working on last night. It works except I haven't figured out how to properly store the date based on a user's input. (User enters date in the format of YYYY-MM-DD, program makes sure the day entered is withing these bounds (5 days from now < entered dated < 45 days from now), then stores it in the database). Not sure if I should store it as a string, or store it as a "date" from PHP. I use strtotime on the user's entered string to convert it to a PHP date.
 
Great! I'll slap that on my resume.

I ended up sorta finishing what I was working on last night. It works except I haven't figured out how to properly store the date based on a user's input. (User enters date in the format of YYYY-MM-DD, program makes sure the day entered is withing these bounds (5 days from now < entered dated < 45 days from now), then stores it in the database). Not sure if I should store it as a string, or store it as a "date" from PHP. I use strtotime on the user's entered string to convert it to a PHP date.

You would have an easier time storing it as a date or datetime.

And I dont know if you can use jquery or not but I would suggest their date picker. It can restrict the date the user can input making it easier for you.
 
To those with a bit of experience with different languages:

Which language is the most "fun"?

Fun fun fun

Great! I'll slap that on my resume.

I ended up sorta finishing what I was working on last night. It works except I haven't figured out how to properly store the date based on a user's input. (User enters date in the format of YYYY-MM-DD, program makes sure the day entered is withing these bounds (5 days from now < entered dated < 45 days from now), then stores it in the database). Not sure if I should store it as a string, or store it as a "date" from PHP. I use strtotime on the user's entered string to convert it to a PHP date.

Why would you store it in anything else but your DB native date, datetime or timestamp field?
 
To those with a bit of experience with different languages:

Which language is the most "fun"?

Lisp by far.

Data types a date should be stored in: DATE/DATETIME/TIMESTAMP

Don't store it as a string :p

As a note would suggest not using Timestamp unless you are sure you want it and understand how your database implements it. Otherwise you can get in trouble with udpate queries and that timestamp being automatically changed to the current time. Datetime is always a good choice.
 

Magni

Member
To those with a bit of experience with different languages:

Which language is the most "fun"?

Ruby. It was designed to make programmers happy. And it makes me very happy indeed. It's a dynamically-typed functional object-oriented language, which gives you a ton of freedom at some performance cost, but unless you're doing very low-level stuff Ruby is awesome.
 

Chris R

Member
As a note would suggest not using Timestamp unless you are sure you want it and understand how your database implements it. Otherwise you can get in trouble with udpate queries and that timestamp being automatically changed to the current time. Datetime is always a good choice.

I just had to take a quick glance to see what data types MySQL supported since I'm a MSSQL person. But yes, I'd stick to DATETIME unless you are sure you will never need any time information for the column.
 

usea

Member
To those with a bit of experience with different languages:

Which language is the most "fun"?
Obviously that's gonna be pretty subjective. For me, getting stuff done is fun so I enjoy the language I'm best at: C#.

But I think Rust is also a ton of fun. I've only written a handful of programs, mostly solutions to google's code jam practice problems, but I love its features. I can't wait for it to settle into a more mature product. I think it's really gonna take off.
 

Milchjon

Member
What aspects of a language give you enjoyment?

Well, since I'm a total beginner, and had to start with C, everything that simplifies coding for me makes it more enjoyable at this point. I had a short look at Python and liked the indentation stuff and not having to specify a type.

It may be a weird complaint, but I also think some parts of codes look "ugly" in some languages. Like the :: in C++ or the use of the $ in jQuery (I think?!).

But, as you might see from the nonsense I'm writing, I'm pretty clueless, and so I'm just looking for any input/opinions.
 

Tomat

Wanna hear a good joke? Waste your time helping me! LOL!
You would have an easier time storing it as a date or datetime.

And I dont know if you can use jquery or not but I would suggest their date picker. It can restrict the date the user can input making it easier for you.
Probably not going to be an option this late in the project, but it's something to consider!
Why would you store it in anything else but your DB native date, datetime or timestamp field?
Well, that's what I'm doing right now as far as I can tell. User enters date in a specific format (wont work otherise, we don't accept the date if it's not entered in YYYY-MM-DD), I use strtotime($theirdate) in PHP which converts it to... a Unix timestamp I guess, and then I store that in the DB.

I haven't created the PHP to call the stored info from the database and display it on page, so I have no idea what our stored date from the DB is going to look like yet.
 
Well, that's what I'm doing right now as far as I can tell. User enters date in a specific format (wont work otherise, we don't accept the date if it's not entered in YYYY-MM-DD), I use strtotime($theirdate) in PHP which converts it to... a Unix timestamp I guess, and then I store that in the DB.

I haven't created the PHP to call the stored info from the database and display it on page, so I have no idea what our stored date from the DB is going to look like yet.

Please dont do this. Just make the input type date.
 

Tomat

Wanna hear a good joke? Waste your time helping me! LOL!
Please dont do this. Just make the input type date.

I should still technically work if we store it correctly right? Personally I don't really care of this thing is the biggest pile of crap, so as long as it works for our demo day in class. Professor doesn't care how we do it, so as long as we do it.

Can only use the date input type if we're using Google Chrome, Opera, or Safari according to w3schools.

*edit*

Damn that's really nifty. Seems dumb not to use that. Guess we're dropping Firefox support, haha. Thanks!
 
MIPS assembly ;)

What are you doing here, jon?


writing a compiler for this must be fun

Starting a war, lol.

The real answer to his question: No such thing. Everyone will have different opinions.

If you're new, which I assume you are given the question, I would just say Python. Seems to be what people like to use nowadays to get something done quick.
 
I should still technically work if we store it correctly right? Personally I don't really care of this thing is the biggest pile of crap, so as long as it works for our demo day in class. Professor doesn't care how we do it, so as long as we do it.

Can only use the date input type if we're using Google Chrome, Opera, or Safari according to w3schools.
Yes, technically.
 

Tomat

Wanna hear a good joke? Waste your time helping me! LOL!
Asking the rest of the team what they think of going with a Chrome-only system since it seems to support a decent amount of HTML5 so far.

As cool as it is, type="date" feels like cheating compared to the garbage that I came up with last night :S
 
First milestone reached in my minor project a simple software renderer.
view transform pipeline completed. Everything is in c++ and god awefull win32 api.

viewtransformikbwj.png
 

iapetus

Scary Euro Man
MIPS assembly ;)

ARM assembly is genuinely fun, especially on a reasonably constrained device (GBA, anyone?) LOLCODE is amusing, but as this sort of language goes, Whitespace is hard to beat. Here's a sample Whitespace program:

Ask the user how many
fibonacci numbers
they want from the sequence
and print
that many one number per line.
 
To those with a bit of experience with different languages:

Which language is the most "fun"?

I've worked with a lot of the popular languages, and I have to say that I enjoy programming in Python the most. It's easy to learn, it gets rid of a lot of the verbosity of "real" languages. You can make changes to your code base and not have to wait 15+ minutes to compile. There are a lot of good libraries available for it, and Python's standard library is top notch. Also, the language has by far the best tutorial I've seen of any language in its official documentation.
 

Zoe

Member
Anybody know of any quirky informative videos about programming that I could show some high school students next week? I get the joy of being shadowed x_x
 

TommyT

Member
So in my experience with programming I haven't had the fun of making a program that communicates with itself across multiple systems (see: chat program on two separate computers). I'm wanting to write something that will have, amongst other things, chat functionality while people wait for other things to happen. So I come looking for advice on how to start approaching this.

Is the basic premise having one client program on people's machines while there is a host program they can talk to? Can you have clients just talk to each other and update the other's information accordingly?
 

barnone

Member
Hey gals and guys! I am want to learn how to develop mobile web apps. I already have some experience with HTML/CSS for PC web browsing. If anyone can recommend their favorite resources/refreshers for learning more about this (maybe an HTML-dedicated GAF thread?) I would surely appreciate it.
 
Top Bottom