• Log InLog In
  • Register
Liquid`
Team Liquid Liquipedia
EDT 04:58
CEST 10:58
KST 17:58
  • Home
  • Forum
  • Calendar
  • Streams
  • Liquipedia
  • Features
  • Store
  • EPT
  • TL+
  • StarCraft 2
  • Brood War
  • Smash
  • Heroes
  • Counter-Strike
  • Overwatch
  • Liquibet
  • Fantasy StarCraft
  • TLPD
  • StarCraft 2
  • Brood War
  • Blogs
Forum Sidebar
Events/Features
News
Featured News
[ASL20] Ro24 Preview Pt2: Take-Off7[ASL20] Ro24 Preview Pt1: Runway132v2 & SC: Evo Complete: Weekend Double Feature4Team Liquid Map Contest #21 - Presented by Monster Energy9uThermal's 2v2 Tour: $15,000 Main Event18
Community News
Weekly Cups (Aug 18-24): herO dethrones MaxPax6Maestros of The Game—$20k event w/ live finals in Paris34Weekly Cups (Aug 11-17): MaxPax triples again!13Weekly Cups (Aug 4-10): MaxPax wins a triple6SC2's Safe House 2 - October 18 & 195
StarCraft 2
General
Greatest Players of All Time: 2025 Update A Eulogy for the Six Pool BoxeR's Wings Episode 2 - Fan Translation #1: Maru - Greatest Players of All Time Geoff 'iNcontroL' Robinson has passed away
Tourneys
$5,000 WardiTV Summer Championship 2025 Maestros of The Game—$20k event w/ live finals in Paris $5,100+ SEL Season 2 Championship (SC: Evo) Esports World Cup 2025 Sparkling Tuna Cup - Weekly Open Tournament
Strategy
Custom Maps
External Content
Mutation # 488 What Goes Around Mutation # 487 Think Fast Mutation # 486 Watch the Skies Mutation # 485 Death from Below
Brood War
General
Post ASL20 Ro24 discussion. BGH Auto Balance -> http://bghmmr.eu/ No Rain in ASL20? How do I speak directly to Coinbase?1-(888)-419-97 Recent recommended BW games
Tourneys
[ASL20] Ro24 Group F [ASL20] Ro24 Group E [IPSL] CSLAN Review and CSLPRO Reimagined! [ASL20] Ro24 Group D
Strategy
Muta micro map competition Simple Questions, Simple Answers Fighting Spirit mining rates [G] Mineral Boosting
Other Games
General Games
Stormgate/Frost Giant Megathread Mechabellum General RTS Discussion Thread Nintendo Switch Thread Dawn of War IV
Dota 2
Official 'what is Dota anymore' discussion
League of Legends
Heroes of the Storm
Simple Questions, Simple Answers Heroes of the Storm 2.0
Hearthstone
Heroes of StarCraft mini-set
TL Mafia
TL Mafia Community Thread Vanilla Mini Mafia
Community
General
Russo-Ukrainian War Thread US Politics Mega-thread Things Aren’t Peaceful in Palestine The year 2050 European Politico-economics QA Mega-thread
Fan Clubs
INnoVation Fan Club SKT1 Classic Fan Club!
Media & Entertainment
Anime Discussion Thread Movie Discussion! [Manga] One Piece [\m/] Heavy Metal Thread
Sports
2024 - 2026 Football Thread Formula 1 Discussion TeamLiquid Health and Fitness Initiative For 2023
World Cup 2022
Tech Support
Computer Build, Upgrade & Buying Resource Thread High temperatures on bridge(s) Gtx660 graphics card replacement
TL Community
The Automated Ban List TeamLiquid Team Shirt On Sale
Blogs
How Culture and Conflict Imp…
TrAiDoS
RTS Design in Hypercoven
a11
Evil Gacha Games and the…
ffswowsucks
INDEPENDIENTE LA CTM
XenOsky
[Girl blog} My fema…
artosisisthebest
Customize Sidebar...

Website Feedback

Closed Threads



Active: 2862 users

The Big Programming Thread - Page 210

Forum Index > General Forum
Post a Reply
Prev 1 208 209 210 211 212 1031 Next
Thread Rules
1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution.
2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20)
3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible.
4. Use [code] tags to format code blocks.
supereddie
Profile Joined March 2011
Netherlands151 Posts
December 05 2012 19:12 GMT
#4181
On December 04 2012 08:43 darkness wrote:
Show nested quote +
On December 03 2012 08:42 Morfildur wrote:
On December 03 2012 08:24 darkness wrote:
On December 03 2012 06:09 Fyodor wrote:
On December 03 2012 05:56 darkness wrote:
Java: Is it possible to send output across the network to every user within a linked a list? If yes, how? I've tried some google search, but I found nothing.

for each loop? I'm not sure I understand at what level your problem is.


Some users are added to a linked list. I want to deliver a msg to all of them. They're all connected. loop is ok, but how do I make sure everyone receives the message? E.g. out.println("text") doesn't ask for receiver.


That depends on what you want to send it through...


out = new PrintWriter
(new OutputStreamWriter(client.getOutputStream()));

Does that help? I'd like to send out.println(); to every user that is connected atm. No idea how to do it.

If you're doing what I think you're doing, you should redesign you application in such a way that there is no need to have a reference for every connected client on your server.

Additionally, some clients might not have an outputstream at all, or a binary, or a visual one. Let each client take care of their output themselves - just send the information you wish to display to each client (via events for example) and have the client handle/display/process the information.

Last thing: if you're sending the information across a network (LAN, internet, whatever) there is absolutely no guarantee that the client is still connected or that the infomation is received by the client (network disconnect come to mind).
"Do not try to make difficult things possible, but make simple things simple." - David Platt on Software Design
Recognizable
Profile Blog Joined December 2011
Netherlands1552 Posts
Last Edited: 2012-12-05 19:43:54
December 05 2012 19:43 GMT
#4182
On December 06 2012 04:10 CecilSunkure wrote:
Explanation


Thanks. Silly questions like these are hard to find on google without them assuming you have knowledge of other things ^.^, on another note, I find myself hopping onto CodeAcademy instead of making homework. I don't know if that's good or bad :D
mustache
Profile Joined April 2010
Switzerland309 Posts
December 05 2012 19:47 GMT
#4183
THANKS to all who suggested writing a single string for my snake game to print. definately made the whole thing smoother. not perfect yet, but the flickering is much less noticeable now!
infinity21 *
Profile Blog Joined October 2006
Canada6683 Posts
December 05 2012 19:52 GMT
#4184
Would this be a good way to learn C? I've done a bit of Java before and learned a little about C++ a long time ago but I'm not familiar with the language at all.

To give some context, I want to learn C to develop statistical learning models that run on CUDA.
Official Entusman #21
RoyGBiv_13
Profile Blog Joined August 2010
United States1275 Posts
Last Edited: 2012-12-05 20:17:39
December 05 2012 20:14 GMT
#4185
On December 06 2012 04:52 infinity21 wrote:
Would this be a good way to learn C? I've done a bit of Java before and learned a little about C++ a long time ago but I'm not familiar with the language at all.

To give some context, I want to learn C to develop statistical learning models that run on CUDA.


Sure. The truth is that if you know what other languages look like, C is readable immediately (It's usually a subset of other languages, with very small syntax differences).

But if you already know what you want to do with the language, why not jump right in and try (and fail and try and fail) until it works? Courses and books do a great job at making you aware of problems you won't likely run into, and features that you shouldn't use.

In this case, there is definitely some example code for machine learning methods in C, and some example code for working on CUDA. This will at least give you a platform to start on where you can get by through editing already existent C code.

One of the biggest learning curves in C is the build cycle. So even with example code, you have a bit of a trek before you. Consider running a 'hello world' program using a your own library getting a solid 50% the way through the project.
Any sufficiently advanced technology is indistinguishable from magic
Bigpet
Profile Joined July 2010
Germany533 Posts
Last Edited: 2012-12-05 21:20:35
December 05 2012 21:15 GMT
#4186
On December 06 2012 04:47 mustache wrote:
THANKS to all who suggested writing a single string for my snake game to print. definately made the whole thing smoother. not perfect yet, but the flickering is much less noticeable now!


Well there's a few ways to get it completely flicker free. Currently it's flickering because intermittently the screen is blank (after the cls and before you write to it). You can either set the console mode to emulate the old VT100 consoles and use ANSI control codes to go to the beginning of the screen without clearing it or you use the windows API. Since there's already plenty of calls to the windows API I'd suggest you use that.


/****************************************************************************************/
//initialize this somewhere
char buffer[AREA+HEIGHT+1]; //leave enought room for newlines
char scorebuffer[SCOREBUF];
HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
COORD origin = {0, 0}; //upper left corner
COORD gameArenaOrigin = {0, 1}; //beginning of first line

void Print_Field()
{
SetConsoleCursorPosition(hStdout,origin);
LPDWORD unused=0;//I have no clue how to ignore output parameters in the WINAPI

int cursor=0;
int i;
int h;
sprintf(scorebuffer,"points: %d\n", points);
for(i=0, h=1; i<AREA; i++) // prints gamefield
{
if(i == h*WIDTH)
{
sprintf(buffer+(cursor++),"\n");

h=h+1;
}
sprintf(buffer+(cursor++),"%c", field[i].sprite);

}
WriteConsole(hStdout,scorebuffer,strlen(scorebuffer),unused,NULL);
SetConsoleCursorPosition(hStdout,gameArenaOrigin);
WriteConsole(hStdout,buffer,AREA+HEIGHT,unused,NULL);

}


You have to make sure your compiler is set to mult-byte character output and not unicode or else this will only print garbage. Also, you have to adjust the delays because there is no delay for system("cls"); anymore it goes way too fast now.
I'm NOT the caster with a similar nick
infinity21 *
Profile Blog Joined October 2006
Canada6683 Posts
December 05 2012 23:01 GMT
#4187
On December 06 2012 05:14 RoyGBiv_13 wrote:
Show nested quote +
On December 06 2012 04:52 infinity21 wrote:
Would this be a good way to learn C? I've done a bit of Java before and learned a little about C++ a long time ago but I'm not familiar with the language at all.

To give some context, I want to learn C to develop statistical learning models that run on CUDA.


Sure. The truth is that if you know what other languages look like, C is readable immediately (It's usually a subset of other languages, with very small syntax differences).

But if you already know what you want to do with the language, why not jump right in and try (and fail and try and fail) until it works? Courses and books do a great job at making you aware of problems you won't likely run into, and features that you shouldn't use.

In this case, there is definitely some example code for machine learning methods in C, and some example code for working on CUDA. This will at least give you a platform to start on where you can get by through editing already existent C code.

One of the biggest learning curves in C is the build cycle. So even with example code, you have a bit of a trek before you. Consider running a 'hello world' program using a your own library getting a solid 50% the way through the project.

I figured I should build some base for C before trying to tackle big problems. I don't really have a problem with jumping straight into unfamiliar territory as I've done that for matlab/octave before. But I do give C a little more respect in the sense that I've heard it's difficult to code well with it.
Official Entusman #21
3FFA
Profile Blog Joined February 2010
United States3931 Posts
December 05 2012 23:18 GMT
#4188
On December 04 2012 11:19 CecilSunkure wrote:
Show nested quote +
On December 04 2012 09:47 3FFA wrote:
Can someone explain the use of rand() and srand() in (not objective or ++)C programming to me? I'm very confused as to how I should use it properly, and my google searches on these have lead to nothing that I fully understood. The use of this will be in the rolling of a 6-sided dice 60 times so it would help to also learn how to make it only output random integers from 1-6.

Yeah, there's a huge random number table that C uses to pull numbers from (compiler specific). Rand pulls a number from this table and increments the current table pointer. srand seeds the pointer to this table, which means it sets the index pointer to a randomized location, a very randomized location. So in order to generate "random" seeds your program needs a clever way of seeding the PRNG (psuedo-random number generator) on program start.

http://www.randygaul.net/2010/11/02/prngs-pseudo-random-number-generator/

Thank you. With my teacher's help I was able to figure out exactly why it wasn't working. I didn't think to make variables to hold each value outputted by the rand() ... silly me.
"As long as it comes from a pure place and from a honest place, you know, you can write whatever you want."
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
December 06 2012 02:38 GMT
#4189
On December 06 2012 08:01 infinity21 wrote:
Show nested quote +
On December 06 2012 05:14 RoyGBiv_13 wrote:
On December 06 2012 04:52 infinity21 wrote:
Would this be a good way to learn C? I've done a bit of Java before and learned a little about C++ a long time ago but I'm not familiar with the language at all.

To give some context, I want to learn C to develop statistical learning models that run on CUDA.


Sure. The truth is that if you know what other languages look like, C is readable immediately (It's usually a subset of other languages, with very small syntax differences).

But if you already know what you want to do with the language, why not jump right in and try (and fail and try and fail) until it works? Courses and books do a great job at making you aware of problems you won't likely run into, and features that you shouldn't use.

In this case, there is definitely some example code for machine learning methods in C, and some example code for working on CUDA. This will at least give you a platform to start on where you can get by through editing already existent C code.

One of the biggest learning curves in C is the build cycle. So even with example code, you have a bit of a trek before you. Consider running a 'hello world' program using a your own library getting a solid 50% the way through the project.

I figured I should build some base for C before trying to tackle big problems. I don't really have a problem with jumping straight into unfamiliar territory as I've done that for matlab/octave before. But I do give C a little more respect in the sense that I've heard it's difficult to code well with it.

C isn't much harder to learn, in my opinion. I'm not sure what sort of data structures you'll need for your statistics, but coding data structures in C will probably be quite a bit harder to hack together compared to other higher level languages.
fabiano
Profile Blog Joined August 2009
Brazil4644 Posts
December 06 2012 03:01 GMT
#4190
Coding data structures in C is a huge pain in the ass. At this point you need to completely understand memory allocation, how and when to free it to avoid leaking and most importantly, you need to understand pointers.

If you never worked with anything like that before, just take it easy on yourself when you try to code something and that shit isn't working like intended, it takes a little bit of time to get used to it.
"When the geyser died, a probe came out" - SirJolt
infinity21 *
Profile Blog Joined October 2006
Canada6683 Posts
December 06 2012 05:50 GMT
#4191
Thanks guys. I'm not in any rush so I'll just take it slowly and explore what's been done in the area.
I'm not sure what coding these data structures involves but on a high level, I essentially only need to do matrix multiplication and loops (albeit a lot of them). Not sure how much complexity CUDA will add to the equation but I'm hoping it's not too much lol
Official Entusman #21
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
Last Edited: 2012-12-06 06:18:44
December 06 2012 06:18 GMT
#4192
On December 06 2012 14:50 infinity21 wrote:
Thanks guys. I'm not in any rush so I'll just take it slowly and explore what's been done in the area.
I'm not sure what coding these data structures involves but on a high level, I essentially only need to do matrix multiplication and loops (albeit a lot of them). Not sure how much complexity CUDA will add to the equation but I'm hoping it's not too much lol

You'll want lists/vectors/arrays of structs.
RMonkeyF
Profile Joined April 2011
46 Posts
December 06 2012 19:09 GMT
#4193
In javascript, how do you dynamically adjust the position of a image to move continuously over a period of time?

For example, im trying to make a page with 3 leaves falling down in a straight line with a setInterval of 1 second.

I've set the position of the images on the page and then i tried :

for(var index = 0;index < 3;++index)
{
leaves[index].style.top = leavesTop[index] + "px";
leaves[index].style.left = leavesLeft[index] + "px";
}
leavesTop[index] += 10;

This seems like it should be right to me but the image just stays stationary.
Recognizable
Profile Blog Joined December 2011
Netherlands1552 Posts
Last Edited: 2012-12-06 19:36:21
December 06 2012 19:35 GMT
#4194
Everyone that has experience programming. How did you start learning to program? What sites did you use? I feel like I am missing out on the very, very basic definitions which seem universal for almost all languages. Like my last question of what Indenting does in Python. CodeAcademy didn't explain this. Anyone know a good book/site?
neSix
Profile Blog Joined November 2004
United States1772 Posts
Last Edited: 2012-12-06 19:45:16
December 06 2012 19:36 GMT
#4195
On December 07 2012 04:09 RMonkeyF wrote:
In javascript, how do you dynamically adjust the position of a image to move continuously over a period of time?

For example, im trying to make a page with 3 leaves falling down in a straight line with a setInterval of 1 second.

I've set the position of the images on the page and then i tried :

for(var index = 0;index < 3;++index)
{
leaves[index].style.top = leavesTop[index] + "px";
leaves[index].style.left = leavesLeft[index] + "px";
}
leavesTop[index] += 10;

This seems like it should be right to me but the image just stays stationary.

Rather than coding this yourself, I'd recommend checking out jQuery's .animate() function:

http://api.jquery.com/animate/

There are some demos there that should give you an idea about how to accomplish your goal.


From link above:

<!DOCTYPE html>
<html>
<head>
<style>
div {
position:absolute;
background-color:#abc;
left:50px;
width:90px;
height:90px;
margin:5px;
}
</style>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<button id="left">&laquo;</button> <button id="right">&raquo;</button>
<div class="block"></div>

<script>
$("#right").click(function(){
$(".block").animate({"left": "+=50px"}, "slow");
});

$("#left").click(function(){
$(".block").animate({"left": "-=50px"}, "slow");
});

</script>

</body>
</html>



In your case, you could probably achieve your goal by taking that example and changing "left" in the .animate() calls to "top".


Edit:

On December 07 2012 04:35 Recognizable wrote:
Everyone that has experience programming. How did you start learning to program? What sites did you use? I feel like I am missing out on the very, very basic definitions which seem universal for almost all languages. Like my last question of what Indenting does in Python. CodeAcademy didn't explain this. Anyone know a good book/site?

My quick story: I learned programming through two classes and an independent study in my high school which used this text book:
http://www.amazon.com/C-How-Program-6th-Edition/dp/0136152503/ref=sr_1_1?ie=UTF8&qid=1354822789&sr=8-1&keywords=0136152503

I couldn't give you an equivalent for Python because I've never written a line of Python in my life!

If you aren't totally confident in your ability to force yourself to study independently, I'd recommend seeing if you can find yourself a class at a technical college near where you live to get started. That way you can easily discuss questions with your professor as they come up. Having that said, I also believe you can learn a good bit about programming on your own, as long as you're comfortable with the notion that you won't always have all the answers and you're willing to do research to learn as much as you can.
RoyGBiv_13
Profile Blog Joined August 2010
United States1275 Posts
Last Edited: 2012-12-06 19:45:44
December 06 2012 19:44 GMT
#4196
On December 06 2012 14:50 infinity21 wrote:
Thanks guys. I'm not in any rush so I'll just take it slowly and explore what's been done in the area.
I'm not sure what coding these data structures involves but on a high level, I essentially only need to do matrix multiplication and loops (albeit a lot of them). Not sure how much complexity CUDA will add to the equation but I'm hoping it's not too much lol



I'll take a jab at your design since I once did something similar in an FPGA (drool, infinitely parallel computations makes neural nets fun and easy )

For matrix multiplication, take a look at SO for suggestions of a fast library: http://stackoverflow.com/questions/2637249/whats-a-good-matrix-manipulation-library-available-for-c

Theres a suggestion specific to CUDA: https://developer.nvidia.com/cublas Looks like those libraries are probably the best.

Though what people say about needing to know a ton about memory allocations and data structures to write good code in C is true, you should never reinvent the wheel. A fantastic programmer would know exactly how the data structures are implemented within the library code in order to best accommodate it within their own code (for example, lookup times in a certain table may be fast, but adding something is slow, so you would add everything in the table at the beginning and modify values as you see fit). This is true of all languages though.

For your system, you can trial and error your way to a workable code base without having to know everything about C and data structures. Honestly, as long as it runs, then you have written 'good' C code.

I'm not sure exactly what machine learning model you want to use for your system, so I'll let you find the library for that yourself.

In any case, please do take your time in tackling this Just don't stress about the language part of it. C is pretty easy to pick up and use, but incredibly difficult to master, like most things in computers/life.

Any sufficiently advanced technology is indistinguishable from magic
Recognizable
Profile Blog Joined December 2011
Netherlands1552 Posts
Last Edited: 2012-12-06 20:13:28
December 06 2012 20:11 GMT
#4197
If you aren't totally confident in your ability to force yourself to study independently, I'd recommend seeing if you can find yourself a class at a technical college near where you live to get started. That way you can easily discuss questions with your professor as they come up. Having that said, I also believe you can learn a good bit about programming on your own, as long as you're comfortable with the notion that you won't always have all the answers and you're willing to do research to learn as much as you can.


I can definitely force myself to study independently. I'm most definitely not comfortable without having all the questions. They nag me like crazy :/ I feel so stupid not having chosen the CS class in my school, altough apparently it's pretty bad. Instead I have history, blergh. I'm in the Netherlands so I don't know how stuff works but I don't think it's possible for me to hop into a class somewhere because I haven't gotten my diploma. I will be, most likely, studying Physics in a year so I guess it should be possible to attend some introductory CS classes or something. Anyway, would this be good? http://www.amazon.com/Python-How-Program-Harvey-Deitel/dp/0130923613
I can get it used for 30 bucks.
CecilSunkure
Profile Blog Joined May 2010
United States2829 Posts
December 06 2012 20:17 GMT
#4198
On December 07 2012 04:35 Recognizable wrote:
Everyone that has experience programming. How did you start learning to program? What sites did you use? I feel like I am missing out on the very, very basic definitions which seem universal for almost all languages. Like my last question of what Indenting does in Python. CodeAcademy didn't explain this. Anyone know a good book/site?

I suggest getting a really good book and start with that. I recommend this book for C. Absolutely the best book I've read for a beginner on programming.

The way I learned was I started learning some C, then some Python, then some other things, then back to C. I didn't really learn any of the languages very well until I stuck with C, and at the time I stuck with C I was also reading the book I linked you.
Necosarius
Profile Blog Joined September 2009
Sweden4042 Posts
December 06 2012 21:11 GMT
#4199
On December 07 2012 04:35 Recognizable wrote:
Everyone that has experience programming. How did you start learning to program? What sites did you use? I feel like I am missing out on the very, very basic definitions which seem universal for almost all languages. Like my last question of what Indenting does in Python. CodeAcademy didn't explain this. Anyone know a good book/site?

I used these to really get the basics down for Python:
CodeAcademy, Learn Python the hard way, How to think like a computer scientist.

Things got repetitive but I really got the basics down. The last one is the best one IMO.
neSix
Profile Blog Joined November 2004
United States1772 Posts
Last Edited: 2012-12-06 21:18:40
December 06 2012 21:15 GMT
#4200
On December 07 2012 04:44 RoyGBiv_13 wrote:
Though what people say about needing to know a ton about memory allocations and data structures to write good code in C is true, you should never reinvent the wheel. A fantastic programmer would know exactly how the data structures are implemented within the library code in order to best accommodate it within their own code (for example, lookup times in a certain table may be fast, but adding something is slow, so you would add everything in the table at the beginning and modify values as you see fit). This is true of all languages though.

Your comment here could be a bit misleading (though I'm sure that wasn't intended). I couldn't agree with you more when you suggest avoiding creating your own implementation of data structures if you plan to distribute or sell or application. Smart people have figured out how to create these structures and make them efficient; most of us should take advantage of this. Good programmers will investigate and understand the pros and cons of the libraries they use.

However, I think it should be noted that reinventing the wheel can often be a great way to ensure that you understand the tools and structures you're using in a strictly academic sense. What better way to learn how data structures work than trying to create them yourself?

On December 07 2012 04:44 RoyGBiv_13 wrote:
For your system, you can trial and error your way to a workable code base without having to know everything about C and data structures. Honestly, as long as it runs, then you have written 'good' C code.

Unfortunately here, I couldn't disagree more. There is a huge difference between working code and good code. Sure at a leisurely or academic level the different is not huge, but once you start talking about professional-level code, the difference is astronomical.

I did a quick Google for examples. Which would you rather read?:
http://www.programming4scientists.com/2008/09/26/good-code-bad-code-an-example/

FUNCTION comppoly(x)
float y1, y2
float a1=0.1, b1=0.3, a2=2.1, b2=5.3, c=0.22
y1 = a1*x + b1
y2 = a1*x^2 + b2*x + c
return(y2>y1)
END FUNCTION


FUNCTION ComparePolynomials(x)
//DECLARE VARIABLES, PARAMETERS
float y_line, y_quadratic
float lineParam = [0.1, 0.3]
float quadParam = [2.1, 5.3, 0.22]

//CALCULATE THE LINE AND QUADRATIC VALUES AT X
y_line = lineParam[0]*x + lineParam[1]
y_quadratic = quadParam[0]*x^2 + quadParam[1]*x + quadParam[2]

//COMPARE THE FUNCTIONS, RETURNING A LOGICAL
return(y_line > y_quadratic)
END FUNCTION

There's so much that goes into writing good code, and I think these practices should be reinforced from the beginning. Variable names, naming conventions, usage of whitespace, comments are the big ones I can think of. I think it's a huge mistake to tell any beginner that "if your code works, it's good code".

On December 07 2012 05:11 Recognizable wrote:
Show nested quote +
If you aren't totally confident in your ability to force yourself to study independently, I'd recommend seeing if you can find yourself a class at a technical college near where you live to get started. That way you can easily discuss questions with your professor as they come up. Having that said, I also believe you can learn a good bit about programming on your own, as long as you're comfortable with the notion that you won't always have all the answers and you're willing to do research to learn as much as you can.


I can definitely force myself to study independently. I'm most definitely not comfortable without having all the questions. They nag me like crazy :/ I feel so stupid not having chosen the CS class in my school, altough apparently it's pretty bad. Instead I have history, blergh. I'm in the Netherlands so I don't know how stuff works but I don't think it's possible for me to hop into a class somewhere because I haven't gotten my diploma. I will be, most likely, studying Physics in a year so I guess it should be possible to attend some introductory CS classes or something. Anyway, would this be good? http://www.amazon.com/Python-How-Program-Harvey-Deitel/dp/0130923613
I can get it used for 30 bucks.

I'm not sure whether or not this question is directed at me specifically, but I can't answer either way. It's produced by the same author and publisher as the book I learned C++ from, but they're notably different languages and I've never written any python (and obviously then never read a page of that book). I'd recommend talking to someone who is proficient in python and get their recommendation. When it comes to any textbook, I'd recommend being careful trying to go by author / publisher alone. Any of you python gurus have any comments on this?

Also note that on the first page of this thread there are some resources for people looking to get into Python. Have you looked into any of those?
Prev 1 208 209 210 211 212 1031 Next
Please log in or register to reply.
Live Events Refresh
Next event in 2h 3m
[ Submit Event ]
Live Streams
Refresh
StarCraft: Brood War
Larva 346
BeSt 223
TY 132
Leta 129
Mind 111
Hyuk 74
Zeus 73
Hyun 70
ggaemo 67
ToSsGirL 66
[ Show more ]
ZerO 55
sorry 46
NotJumperer 45
Sacsri 25
Sharp 21
Bale 15
Rush 7
Dota 2
XcaliburYe161
XaKoH 2
League of Legends
JimRising 498
Reynor3
Counter-Strike
Stewie2K524
zeus97
Super Smash Bros
Westballz39
Other Games
summit1g8146
singsing1325
ceh9650
Happy136
SortOf88
Hui .88
NeuroSwarm39
ZerO(Twitch)2
Organizations
Counter-Strike
PGL5751
StarCraft 2
Blizzard YouTube
StarCraft: Brood War
BSLTrovo
sctven
[ Show 14 non-featured ]
StarCraft 2
• Berry_CruncH270
• AfreecaTV YouTube
• intothetv
• Kozan
• IndyKCrew
• LaughNgamezSOOP
• Migwel
• sooper7s
StarCraft: Brood War
• BSLYoutube
• STPLYoutube
• ZZZeroYoutube
Dota 2
• lizZardDota242
League of Legends
• Stunt702
• Jankos526
Upcoming Events
LiuLi Cup
2h 3m
MaxPax vs TriGGeR
ByuN vs herO
Cure vs Rogue
Classic vs HeRoMaRinE
Cosmonarchy
7h 3m
OyAji vs Sziky
Sziky vs WolFix
WolFix vs OyAji
Big Brain Bouts
7h 3m
Iba vs GgMaChine
TriGGeR vs Bunny
Reynor vs Classic
Serral vs Clem
BSL Team Wars
10h 3m
Team Hawk vs Team Dewalt
BSL Team Wars
10h 3m
Team Hawk vs Team Bonyth
Code For Giants Cup
13h 33m
SC Evo League
1d 3h
TaeJa vs Cure
Rogue vs threepoint
ByuN vs Creator
MaNa vs Classic
Maestros of the Game
1d 7h
ShoWTimE vs Cham
GuMiho vs Ryung
Zoun vs Spirit
Rogue vs MaNa
[BSL 2025] Weekly
1d 9h
SC Evo League
2 days
[ Show More ]
Maestros of the Game
2 days
SHIN vs Creator
Astrea vs Lambo
Bunny vs SKillous
HeRoMaRinE vs TriGGeR
BSL Team Wars
2 days
Team Bonyth vs Team Sziky
BSL Team Wars
2 days
Team Dewalt vs Team Sziky
Monday Night Weeklies
3 days
Replay Cast
3 days
Sparkling Tuna Cup
4 days
PiGosaur Monday
4 days
LiuLi Cup
5 days
Replay Cast
5 days
The PondCast
6 days
RSL Revival
6 days
Maru vs SHIN
MaNa vs MaxPax
Liquipedia Results

Completed

CSL Season 18: Qualifier 1
WardiTV Summer 2025
HCC Europe

Ongoing

Copa Latinoamericana 4
BSL 20 Team Wars
KCM Race Survival 2025 Season 3
BSL 21 Qualifiers
ASL Season 20
Acropolis #4 - TS1
CSL Season 18: Qualifier 2
SEL Season 2 Championship
BLAST Open Fall Qual
Esports World Cup 2025
BLAST Bounty Fall 2025
BLAST Bounty Fall Qual
IEM Cologne 2025
FISSURE Playground #1
BLAST.tv Austin Major 2025

Upcoming

CSL 2025 AUTUMN (S18)
LASL Season 20
BSL Season 21
BSL 21 Team A
Chzzk MurlocKing SC1 vs SC2 Cup #2
RSL Revival: Season 2
Maestros of the Game
EC S1
Sisters' Call Cup
Skyesports Masters 2025
IEM Chengdu 2025
PGL Masters Bucharest 2025
Thunderpick World Champ.
MESA Nomadic Masters Fall
CS Asia Championships 2025
ESL Pro League S22
StarSeries Fall 2025
FISSURE Playground #2
BLAST Open Fall 2025
TLPD

1. ByuN
2. TY
3. Dark
4. Solar
5. Stats
6. Nerchio
7. sOs
8. soO
9. INnoVation
10. Elazer
1. Rain
2. Flash
3. EffOrt
4. Last
5. Bisu
6. Soulkey
7. Mini
8. Sharp
Sidebar Settings...

Disclosure: This page contains affiliate marketing links that support TLnet.

Advertising | Privacy Policy | Terms Of Use | Contact Us

Original banner artwork: Jim Warren
The contents of this webpage are copyright © 2025 TLnet. All Rights Reserved.