Two Plus Two Publishing LLC Two Plus Two Publishing LLC
 

Go Back   Two Plus Two Poker Forums > >

Notices

Programming Discussions about computer programming

Reply
 
Thread Tools Display Modes
Old 01-02-2015, 09:43 AM   #176
jjshabado
Carpal Tunnel
 
jjshabado's Avatar
 
Join Date: Jul 2006
Posts: 21,665
Re: Programming homework and newbie help thread

I've heard good things about this book: http://www.codersatwork.com/ but haven't actually gotten around to reading it yet.

Steve Yegge writes some great stuff (http://steve-yegge.blogspot.ca/) and I also like this guy (http://randsinrepose.com/) although its often more about managing developers than a pure tech blog.

Joel Spolsky's blog (http://www.joelonsoftware.com/) is pretty old now but was fairly interesting. Although I feel like he frequently states things as fact that are just his opinion and which I disagree with.

I don't read blogs and stuff nearly as often as I should so I'm probably missing a lot of good stuff.
jjshabado is offline   Reply With Quote
Old 01-02-2015, 10:20 AM   #177
adios
Carpal \'Tunnel
 
Join Date: Sep 2002
Location: Russian Troll
Posts: 20,820
Re: Programming homework and newbie help thread

Quote:
Originally Posted by Atlantis1 View Post
Sorry I got a bit confused reading the past couple of pages.

I am looking to apply for a job in option trader, as a trader. However I was told being able to code was a plus. I was told either python or c++. I have the feeling I do not have to be super good, since the job I will be applying to is just screentrading.

I am looking to apply for this job in roughly a year. I have an Economic background, I am handy with computers but have never programmed. I am good with numbers and math, but I do not have a mathematics background.

If you were me.

What would you do?
I think being able to code would be in the context of trying to gain insight into how particular algoritms work. I would look at Python first just because it is fairly easy to experiment with test programs due to the interpretor and "duck typing" would be a little easier to deal with when starting out with coding. I would try to implement some very basic programs that deal with Econ/Finance. Perhaps something like a DCF valuation model in a finite period, ymmv.
adios is offline   Reply With Quote
Old 01-02-2015, 10:48 AM   #178
adios
Carpal \'Tunnel
 
Join Date: Sep 2002
Location: Russian Troll
Posts: 20,820
Re: Programming homework and newbie help thread

Quote:
Originally Posted by Anais View Post
DePaul graduate credits are 800 an hour, woof! For that kinda money, that degree better suck my d...

Uh, anyway.

Are there any good books the seasoned vets or other newbies might know of that would be skill-appropriate for the starter programmers to read, which aren't your basic "learn language x" book?

Giz picked up a few books on programming for us, but I think they're a bit beyond the level we're at. Just looking for something interesting to read between semesters, but also something I'll understand (as the LC thread here isn't always a good source for that).

Heck, even websites or blogs would be good.
There are a lot of books that fit this criteria. This book, even though it was written quite some time ago, is still widely read and is probably the most famous of this ilk The Mythical Man Month
adios is offline   Reply With Quote
Old 01-02-2015, 11:13 AM   #179
ChrisV
Carpal \'Tunnel
 
ChrisV's Avatar
 
Join Date: Jul 2004
Location: Adelaide, Australia
Posts: 34,156
Re: Programming homework and newbie help thread

Joel On Software is frequently cited and usually extremely dubious, in my experience.
ChrisV is offline   Reply With Quote
Old 01-02-2015, 02:46 PM   #180
Alobar
Born Ready
 
Alobar's Avatar
 
Join Date: Nov 2003
Location: 3rd turtle from the bottom
Posts: 39,161
Re: Programming homework and newbie help thread

Quote:
Originally Posted by Anais View Post
DePaul graduate credits are 800 an hour, woof! For that kinda money, that degree better suck my d...

Uh, anyway.

Are there any good books the seasoned vets or other newbies might know of that would be skill-appropriate for the starter programmers to read, which aren't your basic "learn language x" book?

Giz picked up a few books on programming for us, but I think they're a bit beyond the level we're at. Just looking for something interesting to read between semesters, but also something I'll understand (as the LC thread here isn't always a good source for that).

Heck, even websites or blogs would be good.
I felt this book was worth my time to read (im a newb)

http://www.amazon.com/Clean-Code-Han.../dp/0132350882
Alobar is offline   Reply With Quote
Old 01-02-2015, 03:35 PM   #181
Anais
Carpal \'Tunnel
 
Anais's Avatar
 
Join Date: Mar 2006
Posts: 6,666
Re: Programming homework and newbie help thread

Less than six hours, already a handful of well-cited, informative responses.

I told you you guys were awesome, didn't I?
Anais is offline   Reply With Quote
Old 01-02-2015, 04:46 PM   #182
Benholio
Carpal \'Tunnel
 
Benholio's Avatar
 
Join Date: Jun 2004
Location: Atlanta, GA
Posts: 8,291
Re: Programming homework and newbie help thread

Quote:
Originally Posted by Alobar View Post
I felt this book was worth my time to read (im a newb)

http://www.amazon.com/Clean-Code-Han.../dp/0132350882
Seconded.
Benholio is offline   Reply With Quote
Old 01-02-2015, 08:43 PM   #183
adios
Carpal \'Tunnel
 
Join Date: Sep 2002
Location: Russian Troll
Posts: 20,820
Re: Programming homework and newbie help thread

Quote:
Originally Posted by ChrisV View Post
Joel On Software is frequently cited and usually extremely dubious, in my experience.
Dubious, how so? I am an infrequent reader but looking at the links he has, the topics look to be discussion worthy.
adios is offline   Reply With Quote
Old 01-02-2015, 09:00 PM   #184
ChrisV
Carpal \'Tunnel
 
ChrisV's Avatar
 
Join Date: Jul 2004
Location: Adelaide, Australia
Posts: 34,156
Re: Programming homework and newbie help thread

Quote:
Originally Posted by adios View Post
Dubious, how so? I am an infrequent reader but looking at the links he has, the topics look to be discussion worthy.
A lot of the frequently cited articles are from like 2000 and tend to be a bit out of date. I dunno, the articles aren't terrible or anything, I just feel like they tend to be either correct and obvious, or non-obvious and dubious. This is partly because the stuff that is "obvious" was not obvious in 2000.
ChrisV is offline   Reply With Quote
Old 01-02-2015, 10:50 PM   #185
jjshabado
Carpal Tunnel
 
jjshabado's Avatar
 
Join Date: Jul 2006
Posts: 21,665
Re: Programming homework and newbie help thread

For me the biggest problems are the articles where he focuses on shipping installable software. I think a lot of his points here were misguided at the time and are now just plain antiquated.

But his good articles are still good imo.

Edit: I guess some might be considered 'obvious' but he writes about the concepts well and for newer developers there are lots of obvious things that they just haven't thought of.
jjshabado is offline   Reply With Quote
Old 01-03-2015, 08:59 AM   #186
Atlantis1
adept
 
Join Date: Mar 2013
Posts: 1,005
Re: Programming homework and newbie help thread

Quote:
Originally Posted by adios View Post
I think being able to code would be in the context of trying to gain insight into how particular algoritms work. I would look at Python first just because it is fairly easy to experiment with test programs due to the interpretor and "duck typing" would be a little easier to deal with when starting out with coding. I would try to implement some very basic programs that deal with Econ/Finance. Perhaps something like a DCF valuation model in a finite period, ymmv.
Thanks!
Atlantis1 is offline   Reply With Quote
Old 01-03-2015, 10:30 AM   #187
adios
Carpal \'Tunnel
 
Join Date: Sep 2002
Location: Russian Troll
Posts: 20,820
Re: Programming homework and newbie help thread

From his blog:
Quote:
Some of you may have seen my final column in Inc., in which I announce my retirement from blogging effective March 18th, the 10-year anniversary of Joel on Software.

Writing for Inc. was an enormous honor, but it was very different than writing on my own website. Every article I submitted was extensively rewritten in the house style by a very talented editor, Mike Hofman. When Mike got done with it, it was almost always better, but it never felt like my own words. I look back on those Inc. columns and they literally don’t feel like mine. It’s as if somebody kidnapped me and replaced me with an indistinguishable imposter who went to Columbia Journalism School. Or I slipped into an alternate universe where Joel Spolsky is left-handed and everything he does is subtlely different.

I’m not going to stop writing altogether.

What I am stopping is the traditional opinionated essay that has characterized Joel on Software for a decade. I’m not going to write Ten Ways to Get VCs to Salivate, I’m not going to write Why You Have To Buy a $10,000 Italian Espresso Machine for your Programmers, and I’m not going to write Python is For Aspergers Geeks or Ruby is for Tear-streaked Emo Teenagers. After a decade of this, the whole genre of Hacker News fodder is just too boring to me personally. It’s still a great format... the rest of you, knock yourselves out... I just can’t keep doing that particular thing.
I think this combined with his most recent post is basically confirming what Chris and JJ are pointing out. The blog has relevance but was much more relevant years ago. I read his post on Unicode. It was pretty good, a little too wordy, could have been written in one or two paragraphs. He does go a little over the top in my view.

Google is a good friend.
adios is offline   Reply With Quote
Old 01-16-2015, 06:46 PM   #188
pewpewpew
journeyman
 
Join Date: Dec 2013
Posts: 293
Re: Programming homework and newbie help thread

simple function asking user for temp, then asking if they want to convert it from Cels to Fahrenheit or vice versa.

for the 2nd prompt when i hit 'f' it works correctly, when i hit 'c' it gives the answer but also adds "Invalid input". maybe i'm going crazy but what's the difference?

Code:
float main()
{
	float temp;
	char convert;

	cout << "Enter a temperature: ";
	cin >> temp;
	cout << "Press 'c' to convert Fahrenheit to Celsius. Press 'f' to convert Celsius to Fahrenheit. ";
	cin >> convert;

	if (convert == 'c')
	{
		float ftemp, ctemp;
		ftemp = temp;
		ctemp = (ftemp - 32) / 1.8;
		cout << "The Fahrenheit temperature (" << temp << ") is \"equivalent\" to the Celsius temperature (" << ctemp << "). ";
	}
	if (convert == 'f')
	{
		float ftemp, ctemp;
		ctemp = temp;
		ftemp = ctemp * 1.8 + 32;
		cout << "The Celsius temperature (" << temp << ") is \"equivalent\" to the Fahrenheit temperature (" << ftemp << "). ";
	}
	else
	{
		cout << "Invalid input. ";
	}
}
Spoiler:
pewpewpew is offline   Reply With Quote
Old 01-16-2015, 07:36 PM   #189
Mr.mmmKay
Drugs are bad...
 
Mr.mmmKay's Avatar
 
Join Date: May 2011
Posts: 13,232
Re: Programming homework and newbie help thread

Quote:
Originally Posted by pewpewpew View Post
simple function asking user for temp, then asking if they want to convert it from Cels to Fahrenheit or vice versa.

for the 2nd prompt when i hit 'f' it works correctly, when i hit 'c' it gives the answer but also adds "Invalid input". maybe i'm going crazy but what's the difference?

Code:
float main()
{
	float temp;
	char convert;

	cout << "Enter a temperature: ";
	cin >> temp;
	cout << "Press 'c' to convert Fahrenheit to Celsius. Press 'f' to convert Celsius to Fahrenheit. ";
	cin >> convert;

	if (convert == 'c')
	{
		float ftemp, ctemp;
		ftemp = temp;
		ctemp = (ftemp - 32) / 1.8;
		cout << "The Fahrenheit temperature (" << temp << ") is \"equivalent\" to the Celsius temperature (" << ctemp << "). ";
	}
	if (convert == 'f')
	{
		float ftemp, ctemp;
		ctemp = temp;
		ftemp = ctemp * 1.8 + 32;
		cout << "The Celsius temperature (" << temp << ") is \"equivalent\" to the Fahrenheit temperature (" << ftemp << "). ";
	}
	else
	{
		cout << "Invalid input. ";
	}
}
Spoiler:
your second if should be an else if. The way you've written it, it's gonna print "Invalid input. " every time convert != 'f'
Mr.mmmKay is online now   Reply With Quote
Old 01-16-2015, 08:08 PM   #190
pewpewpew
journeyman
 
Join Date: Dec 2013
Posts: 293
Re: Programming homework and newbie help thread

doh ty

edit: hmm still getting the same thing ;[ both c/f computing temps correctly, but the 'c' (and only 'c') getting 'Invalid input' as well.

it's the same code as above except replacing the aforementioned 2nd 'if' with 'else if', but here it is anyway:

Code:
float main()
{
	float temp;
	char convert;

	cout << "Enter a temperature: ";
	cin >> temp;
	cout << "Press 'c' to convert Fahrenheit to Celsius. Press 'f' to convert Celsius to Fahrenheit. ";
	cin >> convert;

	if (convert == 'c')
	{
		float ftemp, ctemp;
		ftemp = temp;
		ctemp = (ftemp - 32) / 1.8;
		cout << "The Fahrenheit temperature (" << temp << ") is \"equivalent\" to the Celsius temperature (" << ctemp << "). ";
	}
	else if (convert == 'f')
	{
		float ftemp, ctemp;
		ctemp = temp;
		ftemp = ctemp * 1.8 + 32;
		cout << "The Celsius temperature (" << temp << ") is \"equivalent\" to the Fahrenheit temperature (" << ftemp << "). ";
	}
	else
	{
		cout << "Invalid input. ";
	}
}
pewpewpew is offline   Reply With Quote
Old 01-16-2015, 08:26 PM   #191
Mr.mmmKay
Drugs are bad...
 
Mr.mmmKay's Avatar
 
Join Date: May 2011
Posts: 13,232
Re: Programming homework and newbie help thread

It works fine for me. Maybe you're somehow still using the old executable?
Mr.mmmKay is online now   Reply With Quote
Old 01-16-2015, 08:30 PM   #192
KatoKrazy
veteran
 
KatoKrazy's Avatar
 
Join Date: Jan 2009
Location: Roch, MN
Posts: 3,082
Re: Programming homework and newbie help thread

Clean, then build.
KatoKrazy is offline   Reply With Quote
Old 01-16-2015, 08:49 PM   #193
adios
Carpal \'Tunnel
 
Join Date: Sep 2002
Location: Russian Troll
Posts: 20,820
Re: Programming homework and newbie help thread

Quote:
Originally Posted by pewpewpew View Post
doh ty

edit: hmm still getting the same thing ;[ both c/f computing temps correctly, but the 'c' (and only 'c') getting 'Invalid input' as well.

it's the same code as above except replacing the aforementioned 2nd 'if' with 'else if', but here it is anyway:

Code:
float main()
{
	float temp;
	char convert;

	cout << "Enter a temperature: ";
	cin >> temp;
	cout << "Press 'c' to convert Fahrenheit to Celsius. Press 'f' to convert Celsius to Fahrenheit. ";
	cin >> convert;

	if (convert == 'c')
	{
		float ftemp, ctemp;
		ftemp = temp;
		ctemp = (ftemp - 32) / 1.8;
		cout << "The Fahrenheit temperature (" << temp << ") is \"equivalent\" to the Celsius temperature (" << ctemp << "). ";
	}
	else if (convert == 'f')
	{
		float ftemp, ctemp;
		ctemp = temp;
		ftemp = ctemp * 1.8 + 32;
		cout << "The Celsius temperature (" << temp << ") is \"equivalent\" to the Fahrenheit temperature (" << ftemp << "). ";
	}
	else
	{
		cout << "Invalid input. ";
	}
}
The code is right, next step is to use argc and argv as input parameters to main. In that way the user has the option to enter temperature and/or temperature type on the command line. Although I know at Intel and from what I've heard it is the same at Microsoft, instead of
Code:
if (convert == 'c')
they do this:
Code:
if ('c' == convert)
In that way if it is coded with = instead of == the compiler will generate an error.

Last edited by adios; 01-16-2015 at 08:57 PM.
adios is offline   Reply With Quote
Old 01-16-2015, 08:54 PM   #194
pewpewpew
journeyman
 
Join Date: Dec 2013
Posts: 293
Re: Programming homework and newbie help thread

Quote:
Originally Posted by KatoKrazy View Post
Clean, then build.
heh, this is the first time i've heard of Clean before, had to check the menus.

i tried cleaning/building/running again and still get the same issue. tried exiting out of visual studio and re-opening, same thing.
pewpewpew is offline   Reply With Quote
Old 01-16-2015, 09:08 PM   #195
pewpewpew
journeyman
 
Join Date: Dec 2013
Posts: 293
Re: Programming homework and newbie help thread

Quote:
Originally Posted by adios View Post
The code is right, next step is to use argc and argv as input parameters to main. In that way the user has the option to enter temperature and/or temperature type on the command line. Although I know at Intel and from what I've heard it is the same at Microsoft, instead of
Code:
if (convert == 'c')
they do this:
Code:
if ('c' == convert)
In that way if it is coded with = instead of == the compiler will generate an error.
thanks i'm confused with part of your comment though, isn't the user already entering temperature/type on the command line with the current code?
pewpewpew is offline   Reply With Quote
Old 01-16-2015, 09:51 PM   #196
adios
Carpal \'Tunnel
 
Join Date: Sep 2002
Location: Russian Troll
Posts: 20,820
Re: Programming homework and newbie help thread

Quote:
Originally Posted by pewpewpew View Post
thanks i'm confused with part of your comment though, isn't the user already entering temperature/type on the command line with the current code?
No the inputs are coming from stdin outpu is going to stdout. Say you name your program ConvertTemp. When you run your program from the command line you type ConvertTemp and your program gets control and it prompts the user. You can add a feature that if you enter something like

ConvertTemp 40 C

The user isn't prompted because the proram reads its inputs from the command line. That is the idea.
adios is offline   Reply With Quote
Old 01-17-2015, 10:53 AM   #197
Anais
Carpal \'Tunnel
 
Anais's Avatar
 
Join Date: Mar 2006
Posts: 6,666
Re: Programming homework and newbie help thread

Thought a switch statement might be a good way to fix the selection error
Anais is offline   Reply With Quote
Old 01-17-2015, 11:54 AM   #198
Benholio
Carpal \'Tunnel
 
Benholio's Avatar
 
Join Date: Jun 2004
Location: Atlanta, GA
Posts: 8,291
Re: Programming homework and newbie help thread

Quote:
Originally Posted by pewpewpew View Post
doh ty

edit: hmm still getting the same thing ;[ both c/f computing temps correctly, but the 'c' (and only 'c') getting 'Invalid input' as well.

it's the same code as above except replacing the aforementioned 2nd 'if' with 'else if', but here it is anyway:
Your current code works fine for me. I think you must have a build problem, like others have suggested. You must be running a stale executable. Try to find any copies of the built executable and delete them all. What IDE are you using? Visual Studio?
Benholio is offline   Reply With Quote
Old 01-17-2015, 12:31 PM   #199
Anais
Carpal \'Tunnel
 
Anais's Avatar
 
Join Date: Mar 2006
Posts: 6,666
Re: Programming homework and newbie help thread

Had so many issues with visual studio when I was first starting, always happened when I tried to save code under a new file and it would refuse to compile the new stuff.
Anais is offline   Reply With Quote
Old 01-17-2015, 03:15 PM   #200
adios
Carpal \'Tunnel
 
Join Date: Sep 2002
Location: Russian Troll
Posts: 20,820
Re: Programming homework and newbie help thread

Quote:
Originally Posted by Anais View Post
Thought a switch statement might be a good way to fix the selection error
A switch statement would work and i think it is probably a better way to go for this function.
adios is offline   Reply With Quote

Reply
      

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Forum Jump


All times are GMT -4. The time now is 04:49 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © 2008-2010, Two Plus Two Interactive
 
 
Poker Players - Streaming Live Online