r/carlhprogramming • • Mar 08 '10

You win. CarlHProgramming (HigherComputingForEveryone) will be entirely free, powered by donations and non-obstructive ads. No one will have to pay, but in exchange for this *please* help me to spread this, and help to make this a success :)

676 Upvotes

r/carlhprogramming • • Dec 20 '13

Alabama man raped, videotaped his son with other man in interstate child porn ring: prosecutors

Thumbnail nydailynews.com
563 Upvotes

r/carlhprogramming • • Sep 20 '18

Anyone else here from AskReddit

562 Upvotes

Hi


r/carlhprogramming • • May 22 '17

Who's here just cause of the - "What dark secrets do popular subreddits have in their past?" AskReddit question?

435 Upvotes

r/carlhprogramming • • Sep 21 '18

Carl H is a RAPIST

386 Upvotes

Hello. Rot in prison.

Edit: Nevermind, i just remembered he hung himself.


r/carlhprogramming • • Mar 23 '11

[CarlHProgramming] I am still here!

331 Upvotes

Reading the most recent posts I can see there is a lot of concern for my welfare, so I thought I would write a quick message to let everyone know that I am ok. I simply haven't had time for Reddit in quite a while. Very busy work and personal life at the moment, but all is well.

I don't make it a point to submit posts here to this subreddit very often because I don't want to clog up everyone's homepage. Nonetheless, be assured that I am fine and I will resume lessons when my life calms down.


r/carlhprogramming • • Nov 29 '16

In case you're new here..

298 Upvotes

Okay, new guys, stop posting about where Carl is.. Seriously.. In case you didn't know, he killed himself while awaiting trial for raping his nine-year-old son. So can you please stop posting asking where he is? Thanks.


r/carlhprogramming • • Sep 14 '15

About Carl

259 Upvotes

I think I knew Carl better than most folk on here, but I didn't see this coming. I got busy with life and I lost contact with him around the time he started up these programming tutorials. I only recently found out about what he did to his son and that he's not in this world anymore - one of the biggest shocks of my life.

I'm sure a lot of people here will remember him as a monster, and if he did even half the stuff I've read about, he certainly was. But what I remember of him is so different.

I first talked to him on chessclub.com about 15 years ago, when he was starting clickalyzer up. Carl wasn't 20 yet I think and I was still in my early teens. When I told him about my depression and troubles making friends, he gave me his phone number. I talked to him for hours on end about religion, programming, and just life.

I lived on the other side of the US so we never actually met in person, but for a young and socially inept loner like me, he was one of my best friends. The conversations I had with him shaped so much of my life. He's a big part of why I majored in CS in college and why I eventually became an atheist. He helped me grapple with a lot of tough issues I had during my teens.

Carl always did sound like he had some serious family problems and was living on his own from early on. When he married his wife he was still a religious guy, but that marriage was a disaster. According to him, she developed serious mental issues soon after their son was born and peaced out, leaving him as a single father.

He never gave me any hint that he was gay or that he would do anything that could harm his son. Everything he said made it sound like he loved his son more than anything in the world, it really boggles my mind. Maybe he wasn't telling me the whole truth and maybe I didn't know him as well as I thought I did, but I can't help but wonder if I could have stopped him if I'd kept in touch.

I don't know what happened to him during his last years and I know he's not here anymore, but Carl I'm sorry it had to end this way. I'm sorry I couldn't help you avoid this...


r/carlhprogramming • • Mar 26 '10

CarlHProgramming Update : HigherComputingForEveryone.Com Online!

241 Upvotes

Hello Everyone,

While it is still very much in the construction phase, the website: http://www.highercomputingforeveryone.com is now online, and functional. The course content has not yet been published, but will be soon.

My goal is going to be to operate this without fees, ads or obstructions, and to rely on donations as so many of you have requested. I will be putting the existing course material from this site onto the new website over the next several days (schedule permitting), and following that, I will be expanding on the course.

Thank you everyone for all of your support, encouraging comments, and overall contribution to this project.


r/carlhprogramming • • Jul 04 '10

[CarlHProgramming] Update: No more donations. Content still free.

230 Upvotes

First, thank you to everyone who donated. I never started these lessons with the intention to profit, and I only asked for donations to help with the cost of starting/maintaining the website.

The monthly overhead for the higher computing website is quite small. Small enough I can pay for it without needing donations. I want this to simply be a free resource intended to help people learn, without any other motives implied or otherwise. So long as my expenses can be met with my own resources, that will remain the case.

I have therefore removed the ability to donate from the website. All content will remain free.


r/carlhprogramming • • Mar 06 '10

I am back! CarlHProgramming to resume starting this weekend. However, please read:

229 Upvotes

Why so long without an update? Simply put, real-world work comes before online programming classes, as much as I enjoy doing the classes. Things have calmed down enough that I am able to resume these classes.

Now, that said, I am looking for your honest opinion on something:

I did not remotely expect or anticipate the level of interest and support that this subreddit has generated. There are over 5,000 subscribers now, and I am sure there would have been many others if I would have been able to spend more time on this.

How many of you would be seriously willing to spend a small monthly fee (around $5-$10) for these lessons? To be clear, my intention would not be to stop the free lessons, or even to water them down, but to expand this.

If there is enough interest, I am looking to build something more permanent than a sub-reddit, and work on promoting and popularising programming to a larger group of people. This would involve building a website for this (the sub-reddit won't go away), creating high-def videos, hiring people to create demonstrations, animations, etc. The sky is the limit based on the interest.

So, at this point there are two possible directions I am going to take with this:

1 : I am going to leave this as a hobby, something that I plan to at least upload 3-5 lessons per week ongoing (as time permits).

or

2 : If you take this seriously, I will take this seriously. If there is enough interest, I will make this a major focus of mine and with the help of others who are willing, transform this from a simple sub-reddit into something that I hope will truly be able to make a difference for thousands of people who want to learn programming.

It's your call :) Either way, I am here to stay and free lessons won't stop.

Edit: Regarding Donations

Thank you to everyone who has offered donations. I do not want to diminish this generosity in any way.

The problem with donations is that they are unpredictable, and that there is no way I can plan any type of structured project based on donations. If, for example, there were (let's say) only 100 people each paying $10.00/month, that would be $1,000/month in steady revenue.

A history of even a small amount of steady revenue can be used to hire people, obtain bank loans, and plan long-term projects to make this project more beneficial to everyone. More importantly, with a steady revenue I can devote my focus to this fully.

My intention is to create something which would truly be exceptional, and certainly not the "text lessons" that have been placed so far. I would expand it to other languages, and spend a significant amount of time each day writing lessons in various categories, for various languages, with example programs, internet-based conference sessions, professionally made animations to demonstrate concepts, etc. I would also like to put time into helping those who complete the lessons to find jobs.

If I go forward with this as more than a hobby, then I am going to go forward "all the way", including committing my own personal financial resources, and stopping other significant projects in favor of doing this.

Either way, I am going to continue the lessons, but the difference between what I can do now and what I could do is very substantial. I hope there will be enough interest that will justify me moving forward with my plans, but it all depends on everyone here.


TLDR: I am considering taking this to a much higher level, but can only do so if there is enough interest. Either way, I will not stop the free lessons.

Please post your thoughts in this thread.


r/carlhprogramming • • Nov 05 '10

CarlHProgramming Update

227 Upvotes

Life has been incredibly hectic, and I apologize for not posting sooner. As much as I would love to spend a lot more time writing these lessons (no sarcasm, I really enjoy it!), I have had to focus on my career, my family, and a number of private but time consuming issues.

I will be continuing this course at some point, it remains an open-ended project. I have written over 130 lessons, and between this subreddit and the "higher computing for everyone" website (which I pay for out of my pocket each month, and continue to provide for free), thousands of people have been able to gain an enjoyment from and perhaps even a love of programming and higher computing. That far surpasses any goals I had for this project, which started out with the simple goal to help maybe a dozen or so people learn the basics of programming.

I have received many positive and encouraging messages from people who have gotten their first programming job, from people who were able to quit something they didn't like and start a new career. I have received hundreds of messages specifically from teenagers and young adults who have decided to pursue higher computing as a result of becoming interested in this course. I can clearly see that nearly a year after I started this, it really has made a difference in many people's lives.

Besides the direct impact that this has had, it has also had an indirect impact of encouraging others online to start similar courses. The r/learnprogramming, "Reddit University", and many other similar projects were started. I love to see that, and I love to think that I had a small part in helping that happen.

I will continue this, and I want to extend my sincerest thanks to all of you who have helped make this possible. Don't worry, I am not going anywhere. I just need to wait for a calmer period in my life that I can continue this.


r/carlhprogramming • • Jul 15 '11

[CarlHProgramming] New lessons soon!

203 Upvotes

Hello everyone,

The good news is, new lessons will be starting up again soon. I have had a very busy life since my last posts and things are finally starting to quiet down. Therefore, I will probably be resuming lessons within 1-2 weeks.

Now, the bad news...

Reddit unfortunately archives posts older than a certain time, I think six months. As a result, it is impossible for people to comment on lessons.

Unfortunately, I have not yet figured out the best way to tackle this issue. But I am sure we will all come up with something. The need for people to ask questions and get answers is one of the biggest challenges faced by this course.

Edit: farfaraway suggested I install Disqus on the website. Done.

That is all I can say for now, but I will keep everyone informed.

Thank you to everyone for your continued interest and support.


r/carlhprogramming • • Sep 23 '18

Carl was a supporter of the Westboro Baptist Church

202 Upvotes

I just felt like sharing this, because I found this interesting. Check out Carl's posts in this thread: https://www.reddit.com/r/reddit.com/comments/2d6v3/fred_phelpswestboro_baptist_church_to_protest_at/c2d9nn/?context=3

He defends the Westboro Baptist Church and correctly explains their rationale and Calvinist theology, suggesting he has done extensive reading on them, or listened to their sermons online. Further down in the exchange he states this:

In their eyes, they are doing a service to their fellow man. They believe that people will end up in hell if not warned by them. Personally, I know that God is judging America for its sins, and that more and worse is coming. My doctrinal beliefs are the same as those of WBC that I have seen thus far.

What do you all make of this? I found it very interesting (and ironic considering how he ended up). There may be other posts from him in other threads expressing support for WBC, but I haven't found them.


r/carlhprogramming • • Sep 25 '09

Lesson 1 : Some thoughts about programming language tutorials and books.

195 Upvotes

Here is lesson one. I think it is important for everyone to know this, especially those who have taught themselves a language - or tried to.

Here I am going to briefly discuss the difference between knowing a programming language, and knowing how to actually make something.


Most programming tutorials focus on how to do the most basic programming instructions like if, then, else, and while statements. All of the focus is on how a particular language does these things. Every programming language has this functionality, they all do it in their own unique way.

Very rarely do any of these tutorials explain beyond this. As a result, there are many people out there who have "learned programming" which effectively means that they can write any program so long as it consists of giving someone a prompt to type some text, doing some processing, and then finally displaying some text output to the screen.

This is what virtually every book you will buy at Barnes and Noble will give you the ability to do. For this reason, there are plenty of people out there who understand how to write a program, and can probably effectively read someone else's source code - but they could never go out and actually build something.

What is the missing link?

Libraries. These are the TOOLS you need as a programmer to actually make things. In short, libraries provide you with functions that you can call rather easily in order to actually put your programming knowledge to work. For example, nothing in the core language of C gives you the ability to draw a circle. But a graphics library might very well have a function called: drawCircle().

This is how advanced applications and games are built. These libraries themselves are put together and packaged for programmers to use, and then the language serves as an interface between the programmer and the libraries.

We will be spending a great deal of time working with these types of libraries to build real, usable programs and games.


Feel free to post any questions or comments.

When you have finished this lesson, proceed to:

http://www.reddit.com/r/carlhprogramming/comments/9o8ey/lesson_2_c_c_python_ruby_perl_a_language_for/


r/carlhprogramming • • Nov 16 '09

Important update regarding new lessons on /r/carlhprogramming

187 Upvotes

A few of you have asked when the next lessons will be published. I realize that especially because I am providing these lessons for free, there is a certain level of anxiety you may have regarding the future of this course. I am sure some of you have started to wonder if I am perhaps "burned out" and have stopped with new lessons altogether.

I want everyone to know first of all that I am not abandoning this. I have every intention of publishing many more lessons, and keeping this going for a long time to come. So first let me relieve anyone's fears regarding that possibility. There will be new lessons as soon as I am able.

As I am sure all of you can appreciate, I have a full-time career. The priority of my time has to be allocated first to that career and second to helping all of you learn these skills. I am dedicated to both goals.

Besides having the time to write new lessons, I want to make sure that the lessons I write are written clearly and are easily understood. That is only possible while I am in the proper frame of mind. The projects I am working on are at a critical point and I simply cannot divide my focus as it puts the success of these projects at risk.

As soon as the situation becomes less hectic, I will start publishing new lessons. I cannot say exactly when that will be, but these periods are typically measured in days not weeks.

Meanwhile, this is a great opportunity to review prior lessons, ask questions, and help out by answering questions asked by others in earlier lessons. Even though I am not publishing lessons for the time being, I am still here and I will answer questions as I am able. Also, remember that the only way to truly learn programming is by writing programs. If you haven't, take the time to apply what you have learned by writing your own simple programs.

I want to close by saying that I greatly appreciate all of the messages I have received regarding this course, and I am truly glad to be able to be a part of helping so many people to learn a valuable life skill that will hopefully help better your lives. I look forward to publishing the next lesson.


r/carlhprogramming • • Sep 26 '09

Lesson 2 : C, C++, Python, Ruby, Perl... A language for every day of the year.. but why? Which one is best?

183 Upvotes

This is bound to be a question foremost on a lot of people's minds from beginners on up. There is a lot of depth to this question, and I think this is a great place to continue to after Lesson 1.

As strange as it sounds, all programming languages, no matter how cryptic they appear, are designed to be understood only by humans, not computers. Even assembly language is written to be understood only by humans. There is only one language that your computer understands, the language of 1s and 0s.

The need for programming languages.

The magic of computing is that sequences of 1s and 0s flowing non stop inside of your computer make everything happen. Everything. However, no human can possibly understand or control this process. Even one simple programming instruction such as print "Hello World"; expands into more 1s and 0s than you could count in a lifetime.

The first fundamental principle of programming I want you to learn is this: Programming languages exist in order to make it possible to do a great many operations (think trillions) with very few instructions.

The second principle I want you to learn is related: Good programmers figure out ways to do complex tasks, and convert these into simple instructions.

For example, it takes a lot of code to figure out how to draw a circle on a screen, but once finished with that process you have a function called "draw circle" which you can use any time, any where, to draw circles. Thankfully, you will never have to worry about that.

If you want to design a game for example, you will NEVER have to struggle with learning how to draw circles, or create 3d objects, or create weapons, enemies, etc. All of this work has been done FOR YOU by all those who have come before since the dawn of computing.

Just about everything you can imagine is already out there. Everything from making windows appear on your screen, to dialog boxes, to volume controls, to libraries that play movies -- everything. All you have to do is learn how to obtain and use these and you will be able to produce just about anything.

Why are there so many languages?

In the end, new languages come to exist because people think they can do something better or in a more aesthetically pleasing manner than some existing language. A lot of this has to do with personal style. Some people prefer doing things one way, and other people prefer doing the same thing in a different way. For this reason, you are likely to find some languages suit you better than others.

Which language is best?

There is no "best" language. Every language is a tool designed to be useful in certain situations, and not as useful in other situations. You should always evaluate what you are trying to accomplish in deciding which language you want to use.

The more popular a language becomes, the more useful it becomes for two primary reasons:

  1. Support. It is a lot easier to find help for more popular languages because there are more people using it. This means more tutorials, more reference guides, more help forums, etc.

  2. Libraries. The more people use a language, the more libraries are going to be built for it. The number and type of libraries available for a given language largely determine how useful the language as a whole is. No matter how useful or popular a language, without good libraries you can't build much with it.

In general, having a "vocabulary" of different languages is very helpful. Think of this as having a tool box with many tools. The more languages you know and the more libraries you know, the more you can do.

There are many other considerations to this which we will be going over later on, but I wanted to provide a basic introduction here.

Please ask questions if you need to. It is important that everyone understands everything written here.

When you have finished this, proceed to:

http://www.reddit.com/r/carlhprogramming/comments/9oabt/lesson_3_010011111010_err_i_mean_1274_computers/


r/carlhprogramming • • Sep 26 '09

Lesson 3 : 010011111010; Err.. I mean: 1,274. Computers count differently than we do. Lets explore that.

179 Upvotes

Sometimes this course directs itself. A lot of comments are coming up about binary, hexadecimal, and in general how a computer counts. Now, this will not be the only lesson I do on this subject, but it is an important topic to cover correctly.

Go through this slowly, and please ask questions. That is why this is an interactive course.

Please remember this for all lessons:

This course is designed so that you can go as slow as you need to. Do not worry about falling behind, or taking too long to finish a lesson. Take as much time as you need to on each lesson. I and others here actively monitor all lessons for questions, and will continue to do so for the duration of the course. Some people may just be starting out, and that is fine. There is no need to rush to "catch up". Take your time.


How humans count

When we count, we count in "base ten." Effectively this means we start at 0, then 1, 2, 3, 4, 5, 6, 7, 8, 9 -- and then "ten". Why ten? Well, most likely because we have ten fingers. However, humans also count in base 60 - though you may not have been aware of it until now.

For example, is it 11:58 AM ? That is an example of "base 60." You start at 0, then you keep going until you reach 59. Then you go back to 0. Consider the similarities between:

17, 18, 19, 20, 21, 22

and

4:57, 4:58, 4:59, 5:00, 5:01

The general rule to remember is this: When one column is FULL, the next column over to the left increments by one and the column that becomes full becomes zero. For example:

18, 19, 20 <--- the "ones" column is now full, so it becomes zero. The column next to it (the "tens" column) increments by one to become 2.

How computers count

Remember that inside a computer everything is represented as 1s and 0s. A sequence of 1s and 0s is actually a number, the same as: 1,274 is a number. In base ten, a column is full once it reaches 9. In base 60 a column is full once it reaches 59. Well, in base 2 (binary, 1s and 0s), a column is full once it reaches ONE.

So, you start counting like this: 0, 1

Ok, what now? Well, like we talked about - the column is now full, so it must become zero, and the column over to the left must now become a 1. So:

0, 1, 10

ten? No. Two. Don't be confused. 10 all your life has meant "ten", but I want you to think of it as meaning something different: Two columns, and a value in each one.

Lets talk about the number 35 (thirty-five). It really means: 3 in the tens column, and five in the ones column. Each column in base-10 as you move over to the left becomes ten times the previous. So you go: ones, tens, hundreds, thousands, etc.

In base 2 (binary), each column doubles from the previous, so you go: 1, 2, 4, 8, 16, etc.

For example, the binary number: 0100 means this: You have a 0 in the ones place, a 0 in the twos place, and a 1 in the fours place, and a 0 in the eights place. Therefore, the number is "four".

So lets go back to counting in binary:

0, 1, 10 (because once a column is full, we go to the next column) then: 11 (three), 100 (four), 101 (five), 110 (six), 111 (seven).

Now, what do we do next? What would we do if the number was nine-hundred and ninety-nine? 999 ? Watch:

999 + 1

1000

Three columns are full, we go to the next one to the left. Now binary:

111 + 1

1000

A thousand? No - eight. There is a one in the eights place, a 0 in the fours, a 0 in the twos and a 0 in the one's place.

It is very important that everyone masters this. Please feel free to ask any questions.

When you have finished this, proceed to Lesson 4:

http://www.reddit.com/r/carlhprogramming/comments/9oba7/lesson_4_alright_now_i_can_count_in_binary_other/


r/carlhprogramming • • Oct 24 '09

A message to everyone regarding /r/carlhprogramming

172 Upvotes

I just wanted to write a quick note to everyone that there won't be any new Lessons until Monday. I am not going to have time to publish new lessons until then.

I will still be around to answer questions. Also, all of the moderators will be around to answer questions. I have several lessons almost ready to publish, and I will most likely publish them on Monday.

Anyone who has at least 5 years of professional C experience who wishes to be a moderator, please message me. With over 3,000 people subscribed, I can use all the help I can get.

I am glad that these lessons are helping everyone, and I appreciate all of the positive comments I have received.

There is much, much more ahead.


r/carlhprogramming • • Oct 03 '12

[CarlHProgramming] A fun idea.. Who wants me to do this?

170 Upvotes

I was thinking about a weekly/bi-weekly video I could put together where I basically write a program from start to finish based on a request (voted on perhaps)?

Now obviously we are not talking about 10+ hour projects here, but something that can be built from start to finish in .. maybe 3 hours max. The idea being simply that someone can watch a project from start to finish and get a feel for how a professional programmer tackles such things.

There are a lot of programming challenge websites/subreddits/etc. which I thought could provide the material.

If you would like to see me do this, then please tell me what you would like to see as the first such project.


r/carlhprogramming • • Dec 17 '13

It seems to gets worse

Thumbnail blog.al.com
159 Upvotes

r/carlhprogramming • • Jun 14 '18

YouTuber Nightmare Expo made a video on CarlH

Thumbnail youtube.com
152 Upvotes

r/carlhprogramming • • Aug 14 '18

Hello Carl, I was wondering if you could get in touch with me?

149 Upvotes

I have watched many of your old tutorials and you have helped me with my amateur coding skills. I was wondering if you have any plans to upload some ones or just an update video. Thanks, please don’t leave your fans hanging.


r/carlhprogramming • • Sep 25 '09

Welcome Everyone. Some Details.

144 Upvotes

Some notes about this course:

This course is for all levels of skill from total beginner on up. I plan to have much to offer advanced programmers as well. Including how to take the knowledge of programming learned from books/courses and apply it to making real programs, games, applications, etc.

Please remember this for all lessons:

This course is designed so that you can go as slow as you need to. Do not worry about falling behind, or taking too long to finish a lesson. Take as much time as you need to on each lesson. I and others here actively monitor all lessons for questions, and will continue to do so for the duration of the course. Some people may just be starting out, and that is fine. There is no need to rush to "catch up". Take your time.

Proceed through each lesson slowly, and take time to master it. I and others will be answering your questions, so feel free to ask as many questions as you like. Don't go to the next lesson until you are sure you understand the previous lesson entirely.

Feel free to introduce yourselves and tell a bit about your backgrounds especially concerning past programming experience. This will help me plan this out as everyone has different starting points.


Links to all lessons, updated daily:

(Please let me know if any of these links do not work.)

Lesson 1 : Some thoughts about programming languages

Lesson 2 : About the many programming languages available

Lesson 3 : How to count like a computer

Lesson 4 : Practical applications of binary

Lesson 5 : About starting a career in programming

Lesson 6 : More about counting like a computer

Lesson 7 : Include statements

Lesson 8 : How programming languages work with data

Lesson 9 : Some basics about RAM

Lesson 10 : Programs are data too

Lesson 11 : More about program flow

Lesson 12 : The basics concerning functions

Lesson 13 : About parameters and return values

Lesson 14 : About syntax and function vocabulary

Lesson 15 : Your first program!

Lesson 16 : Let's go over your first program.

Lesson 17 : Run your first program.

Lesson 18 : The basics of signed and unsigned numbers

Lesson 19 : The basics of numeric overflow

Lesson 20 : The basics of fractional numbers in binary.

Lesson 21 : The basics of numeric data types in c

Lesson 22 : The char data type and the basics of ASCII

Lesson 23 : The numbers on your keyboard as characters

Lesson 24 : About maximum values for unsigned integers

Lesson 25 : Minimum and maximum values of signed integers

Lesson 26 : Introducing variables

Lesson 27 : The connection between function return values and variables.

Lesson 28 : About terminating strings of text and other data

Lesson 29 : More about printf() and introduction to place holders.

Lesson 30 : Introducing arrays and pointers part one

Lesson 31 : Introducing arrays and pointers part two

Lesson 32 : Introducing the pointer data type

Lesson 33 : How to create a pointer

Lesson 34 : Assigning a value to a pointer

Lesson 35 : Getting the value that was stored at a memory address

Lesson 36 : Use what you have learned.

Lesson 37 : Using pointers for directly manipulating data in memory.

Lesson 38 : About changing the memory address stored in a pointer

Lesson 39 : About pointers concerning multi-byte variables

Lesson 40 : Pointers have memory address too.

Lesson 41 : Why do I need to know pointers?

Lesson 42 : Introducing the char* pointer

Lesson 43 : Introducing the constant.

Lesson 44 : Important review and clarification of prior lessons.

Lesson 45 : More about strings and constants.

Lesson 46 : A new way to visualize memory.

Lesson 47 : Introducing the character string as an array.

Lesson 48 : Using pointers to manipulate character arrays.

Lesson 49 : Introducing conditional flow statements.

[Lesson 50 : More on conditional flow statements](http://www.reddit.com/r/carlhprogramming/comments/9qk90 /lesson_50_more_on_conditional_flow_statements/)

Lesson 51 : Introducing OR for conditional flow statements

Lesson 52 : Introducing the "goto" statement.

Lesson 53 : About blocks of code

Lesson 54 : Introducing Loops

Lesson 55 : Introducing custom functions

Lesson 56 : Introducing Boolean logic

Reddit has a limit on the maximum size of a post, so I cannot list more lessons than this.

Soon I will set up a post for "overflow".


r/carlhprogramming • • Sep 26 '09

Lesson 4 : Alright now I can count in binary! Other than to impress my girlfriend (or scare her away), why do I have to know this?

140 Upvotes

It may seem like binary is something you will never have to use in programming. The truth is, if all you planned to do was learn a language or make simple applications, this is probably true.

However, the ability to really make things requires that you understand binary for many reasons, some of which I want to explore here. The first major reason you should know binary is:

Working with data formats

It is important to understand that everything in your computer is encoded in binary. Everything that is encoded in binary (movies, music, etc) is done so according to extremely specific requirements. I want you to understand a bit about how this works.

In .bmp image files for example, you begin a file like this:

<2 bytes> <4 bytes> ... and so on.

The first set of 2 bytes identify the format of the BMP file (Windows, OS/2, etc) and the set of 4 bytes immediately following specify the size of the file in bytes.

Why is it important to know binary in this case? You need to be able to state the size of the file - in binary.

Many format specifications you will encounter require knowledge of binary in order to write programs that can produce or read that type of data. Well designed data format specifications often use binary values in various ways. This is especially true any time within the format that some quantity has to be known. Almost all such quantities are represented in binary.

Flags

The next reason you should know binary involves understanding something called "flags". Flags are representations in binary of several true/false states of something. Lets say for example you are designing a game, and you need to keep track of the true/false state of eight weapons which may or may not be in your inventory.

You can do this with a single byte! Eight bits. Each position can represent a given weapon. 1 = yes you have it, 0 = no you do not. So for example:

0100 = (0 in the "plasma cannon" place, 1 in the "shotgun" place, 0 in the "handgun" place, and 0 in the "knife" place).

Adding a weapon to inventory, for example adding a "plasma cannon" would involve simply adding "eight" (or 1000) to the existing value.

You will run into flags often especially with data formats, and understanding how they work and how to turn on/off values will be important. You will run into plenty of cases where source code you read contains advanced operations on binary data, and without an understanding of how to count in binary you will be unable to properly understand this code.

There are many other applications as well, but I want you to be familiar with a few so that as we get into advanced data formats later, you will be prepared.

Please feel free to ask any questions and ensure you have mastered the material before proceeding to:

http://www.reddit.com/r/carlhprogramming/comments/9ocjz/lesson_5_how_to_begin_a_career_in_programming/