Sunday, December 30, 2012

Beginning of Course 2

Course 1 is over and Course 2 has begun.  Course two did come with a bit of a warning or maybe just food for thought.  The statement was pretty simple: This is where the true learning will begin.

So, lesson 1 of Course 2 has come with somewhat of a huge information overload.

Here is the breakdown
1.1 Tic Tac Toe with AI
1.2 The need to initialize data
1.3 Intro Constructor function
1.4 Intro Pass-by-Reference and Pass-by-Value
1.5 Intro to Stack
1.6 Intro to Push and Pop
1.7 How a function Call works
1.8 How function return values work
1.9 Intro to Casts
1.10 A new way to understand memory and data types

The beginning of this lesson was a little misleading   When I saw "Tic Tac Toe with AI.  I was under the impression I would be creating a Tic Tac Toe program.  I was grossly mistaken,  because it was displaying the way to set up the grid.  Then the lesson moved on to initializing and rendering data for the game board and the initial stat of the constructor function.  At that point, the lesson moved and there wasn';t anymore connection to a Tic Tac Toe board.  I was able to easily grasp the concept of Pass-by-Reference and Pass-by-Value.  On the other hand, I did find the Stack unit extremely interesting and its ability to assist functions with communicating with other functions through Push and Pop.  I then learned how function Call works and how the function return value works.  At this point, it gets a little hazy.  I'm not sure if its information overload or I'm lacking practical application but I'm sure I'll figure it out.

I was really looking forward to building a Tic Tac Toe game and playing

Friday, December 28, 2012

The Calm before the Snow Storm

Allow me to explain the reasoning of this post.  I currently reside on the North East side of Indianapolis and have lived here for the past two years.  I grew up in Indiana, moved out to DC for a stint and then returned.  Indiana weather is, somewhat, predictable.  Yet, I guess anyone can say that about their region depending upon the individuals amount of time acquired at their location.  Either way, Indiana had quite the difficult summer.  We endured intense heat and long period of time with out rain... Drought.  Hence, I came to the conclusion, with  a dry summer always follows a SNOWY winter.  Thus, mother nature delivered the blizzard of 2012 and two days later.... today.... we have another 6 inches falling right now.

The point of this:          (I HATE TO SAY IT)

*******   I WAS RIGHT!!!!!   ******

Which brings me to my thought and the reason for this post.  I read an amazing book which placed me on this journey of learning to code.  The book: (though mention before) "How To Learn To Code, Get Your Dream Job, Change Your Life" by author and my mentor Natasha Murashev.   I pray she doesn't mind me calling her my mentor, but muse deems creational connotations where the term mentor (to me) carries a very large amount of admiration with much deserved respect.

Anyways, in a recent comment post, Natasha recommended a book to me.  The book: "Effective Programming: More Than Writing Code" by author Jeff Atwood.  This is an Amazing read but be weary of Jeff's attempts to sway you from the programming world and just keep reading.  I actually find it funny but the words he writes completely make sense to me.  On the other hand, he does show me that I have very much to learn.

In Jeff's book, I came across a passage that seems to be perplexing my mental complexity.  Allow me to share this with you.

"A surprisingly large fraction of applicants, even those with master's degrees and PhD's in computer science, fail during interviews when asked to carry out basic programming tasks."

What does this mean and who cares????

Actually, I care.  Jeff has reaffirmed my focus to complete this quest of knowledge without out monetary exchange.  He has proven, that the people who are dishing out the thousands upon thousands of dollar for education have little right in the field of coding.  Only the passionate ones... The ones with the thirst for knowledge, the ones who strive to continue education not for a title, the ones who see the purpose....  The one's like Natasha Murashev and hopefully my name (someday) will be held in such regards.

With Jeff's comment: Could you say I was RIGHT?  Could you say free learning is the way to go because only the truly motivated will survive?  

Could you say, based on the context of Jeff's book, that Natasha, (in the beginning of her career) was correct in learning to code / develop a passion and then get paid for that passion.

I would say; with the amount of time at my current location in life and learning ----->  IT'S RIGHT

In conclusion, be it a mental tornado of thought or a true blizzard falling from the heavens....  As long as you have the passion for your location aka: knowledge base... You will never be incorrect.  Statistics have shown, the more passionate an individual is about a subject or a belief base...  The more driven they are.

Thursday, December 27, 2012

A Hesitant Pause

I just posted the end of the first course and I'm currently diving into Course (2)  I was going to break 1.1 through 1.10 into two separate sections but I feel it's best to keep this blog, somewhat, structured as the courses are.  Anyways, I got through 1.5 and I'll finish all of lesson 1 tomorrow evening.

Sneak Preview: Lesson 1 is somewhat of a mental overload and (in all actuality) the beginning of the entire learning process.


Better Later Than Never

So, due to sleep deprivation and the hustle and bustle of the holiday season, I neglected to post the last lesson learned and moved on.  Though it might appear to be a simple excuse, in all actuality, it is.  Upon the completion of lesson 17, I found myself at the whim of the Sandman himself.  Utter exhaustion drove me to the grips of my bed and I neglected to blast the blog.

So, I'm writing this a few days late.  If I don't write this now... I fear I never will.

The lesson covered multiple aspects of Data Structures and introduced struct and malloc( )

Lesson 17
17.1 Intro to Memory Allocation Using Malloc
17.2 Cont Intro to Data Structures in C
17.3 The need to describe a Data Structure
17.4 Into to Struct Keyword
17.5 Allocating Memory for a Data Structure
17.6 Using a Data Structure
17.7 Sample Program Using Data Structures
17.8 You Can Make Your Own Data Type Using Struct

I did find this lesson to be very interesting.  Though the focus was mainly Data Structures, the lesson did seem to jump around and then, at the end of it all, pull the entire course (1) all together.  Roughly, the moment I've been waiting for.

I completely understand Dynamic Memory Allocation using Malloc in C when writing code and I need to reserve a particular number of bytes while a program is running and then freeing up the space for further purposes.
Moving on to 17.2 Data Structures in C got my attention.  Not that I wasn't paying any... I can see how Arrays and Data Structures are similar but very much different.  A data structure has the ability to be anything in a program.  Where an Array is forced to follow a strict set of guideline.  i.e., same data type and length.  Creating a Data Structure with the "struct" keyword will create the data structure and malloc will allocate the memory required by stated structure but I then learned to properly use the data structure using the strcpy function in C.
Then it happened... THE ENTIRE FIRST COURSE WAS PULLED TOGETHER AND PROGRAM WAS WRITTEN USING EVERYTHING LEARNED.  ***THIS WAS GREAT***

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void){
   struct first_description{
      char first_word[7];
      char second_word[12];
      char third_word[8];
   };
   struct first_decription *our_pointer = malloc (sizeof (*our_point));

    char *charptr = (char*0 our_pointer;

   strcpy(our_pointer->first_word, "Reddit");
   strcpy(our_pointer->second_word, "Programming");
   strcpy(our_pointer->third_word, "Classes");

   printf("  ");
   printf("Our data structures look like this in memory:      ");

   int i = 0
   for(; i >27, i++){
      if(*charptr + i) == 0) {
         *(charptr + 1) = '$';
   }
   printf(" %C", *charptr +i));
 
   free (our_pointer);
   return 0;
}


OUTPUT: The first word is: Reddit
                 The second word is: Programming
                 The third word is: Classes

That was fun but I really want to get to the problem solving side of writing code.  I guess you have to start out slow like me.

Like I stated before, this is the end of course (1) and I'm looking forward to getting into Course (2) to build a Tic-Tac-Toe program.

Thursday, December 20, 2012

Arrays and Points and then more Arrays and Pointers

This is the first lesson where without a video to watch and listen to.  Judging by the way I efficiently digest information.... this lesson wasn't completely ideal for me.  So, I took A LOT of notes. #handcramp  Anyways, while taking notes about the information I was reading and "NOT" just copying the lesson word for word.  I feel I actually was able to absorb the information and I almost fear it was more efficient than the videos.  So, here were tonight's Units

Lesson 16
16.1 Using Pointers with Offsets  
16.2 Intro to Array Indexing and Pointer Offsets: Part I
16.3 Intro to Array Indexing and Pointer Offsets: Part II
16.4 Intro to Array Indexing and Pointer Offsets: Part III
16.5 Intro to Array Indexing and Pointer Offsets: Part IV

I know it seems a little redundant to keep typing out those lessons but I haven't figured out how to write a loop code in this blog.  :-)

The basics of the lesson was to properly understand array indexing by multiplying the size of the element number and then add another offset to this in order to get the actual element.

The Goal: Create an array of four strings of text, each string a maximum of 6 characters long.  Then create a printf() statement that will print each of the four strings just as if they had been arrays.

 #include <stdio.h>

    int main() {

        char storage[]   = "12345678901234567890123";

        char *ptr = &storage[0];

        *(ptr + (6*0) + 0) = 'O';
        *(ptr + (6*0) + 1) = 'n';
        *(ptr + (6*0) + 2) = 'e';
        *(ptr + (6*0) + 3) = ' ';

        *(ptr + (6*1) + 0) = 'T';
        *(ptr + (6*1) + 1) = 'w';
        *(ptr + (6*1) + 2) = 'o';
        *(ptr + (6*1) + 3) = ' ';

        *(ptr + (6*2) + 0) = 'T';
        *(ptr + (6*2) + 1) = 'h';
        *(ptr + (6*2) + 2) = 'r';
        *(ptr + (6*2) + 3) = 'e';
        *(ptr + (6*2) + 4) = 'e';
        *(ptr + (6*2) + 5) = ' ';

        *(ptr + (6*3) + 0) = 'F';
        *(ptr + (6*3) + 1) = 'o';
        *(ptr + (6*3) + 2) = 'u';
        *(ptr + (6*3) + 3) = 'r';
        *(ptr + (6*3) + 4) = ' ';

        printf("The 1st string is: %s \n", (ptr + (6*0) + 0) );
        printf("The 2nd string is: %s \n", (ptr + (6*1) + 0) );
        printf("The 3rd string is: %s \n", (ptr + (6*2) + 0) );
        printf("The 4th string is: %s \n", (ptr + (6*3) + 0) );

        return 0;
    }

Output: The 1st string is: One
        The 2nd string is: Two
        The 3rd string is: Three
        The 4th string is: Four


Wednesday, December 19, 2012

Reaching limitations

After moving on to the next course in my studies, I was advised to wait until the online course had updated the video lesson.  Reading this brought me to a stand still and standing still is not something I want to do.  If I do keep moving, learning and consistently knowing what my next move is. I fear that my motivation might decrease and I will reach a stall in my process.  This will simply not suffice.

So, I returned to my roots.  I went back to the book I read that started this entire process.  The author; Natasha Murashev, recommended I start by taking the free online Stanford course.  For some odd reason, I deviated from her thoughtful advice and began my journey on another path.  Maybe I was mistaken and maybe I wasn't.  I believe my thought process was correct because I was at least learning and moving towards a goal.

Moving forward, I began to search for the recommended course.  Through my search, I was finding it very difficult to locate the Free Online Stanford Course CS106A.  I kept locating the actual Stanford CS106A course which cost an arm and a leg.  I feared the course was no longer free and I had missed my window to learn from Mehran Sahami about Programming Methodology.  After while, I actually found what I was looking for but it came with a revelation.

We all know the world is changing.  Yes, technology has improved drastically but I fear we have all over-looked the meaning of the internet and it purpose.  The reason why the internet was created, to me, was to allow information to be shared between individuals with ease.  Like I was taught as a teenager, a person is smart but a group of people has the potential to be the smartest entity on the planet.  Yet, in out capitalistic ways, we rationalize the necessity to monetize supply and demand.  Hence, if you want this knowledge, your going to have to pay for it.  So, we go to college, build up massive amounts of debt in hopes that the field we are about to go into isn't over-saturated.

Ultimately, I had a revelation.  I was handed this knowledge freely and, I feel, I have an obligation to maintain this structure.  I found a website (completely free) that allows you to break down a thought process or, as we were taught in grammar class, a paragraph outline.  Also, you can share this page through a link url link and I can update the page, constantly, without changing the link.

Tonight, this was my mission: Begin compiling free programming course links.  

Free Programming Courses

I'll be adding lessons and courses as I find them.  I will say, the site workflowy.com is an extremely useful site and I highly recommend it.

In conclusion; I have a final thought.  Well, maybe more of a question.  One person's mind can never be as intelligent and a group of people whom are all thinking together.  That group of people sharing knowledge  and coming to conclusions as one entity.  So, by monetizing information, have we slowed the possible intelligence of society?  Weeded out the individuals unwilling to make the financial commitment to knowledge?

Judging by the average income of public teachers versus private collegiate professors... I some how have to believe GREED has won this intellectual battle.

Just a thought
 

Tuesday, December 18, 2012

Pointer Reviews

Not much to report about this last lesson.  The lesson covered a basic review of pointers a common mistake that is occasionally made.  Overall, I feel I understand pointers fairly well but a good review never hurt anyone.  In all honesty, I thought I would be bored out of my mind and find it difficult to pay attention.  The lesson kept my attention all the way through and it was nice to touch base on a previous subject matter.

Lesson 15.
15.1 - Review of Points: Part I
15.2 - Review of Points: Part II
15.3 - Review of Points: Part III
15.4 - Review of Points: Part IV
15.5 - Review of Points: Part V

Not much to report about the lesson.  It's all information I'm pretty comfortable with.  Well, I can't say I'm extremely comfortable.  I haven't gotten to the point where I'm using a pointer without being shown how by the instructor.

I know, all good things come to those who wait.

On a side note: I'm not a bad typist but I know I'm not the greatest.  I have to look down every once in awhile to make sure I'm on the right keys.  So, along with keep the same reeducation schedule, I'm going to attempt to speed up my typing skills.  I just hope my brain doesn't implode with all this learning.

Until next time

Monday, December 17, 2012

Multi-Dimensional Arrays

Tonight's lesson covered Mutli-Dimensional Arrays, pointer offsets and Buffer Overflow.  I'm not really sure how to describe what I learned.  I understand that a two dimensional array is simply an array of one dimensional arrays.  So, the more arrays you add...  The larger your multiple dimensional array.  Also, the pointer is used to select (or point at) strings and or characters in an array.  After learning the functional process of Multi - Dimensional Array and writing them with Pointer Offset Syntax.  I then learned how to code the program using Subscript Operator Syntax.  Now the Subscript Operator Syntax seems much easier and more efficient.  So, I believe I enjoy that syntax a little more.  The end of the lesson covered String Code or strcpy.h in C.

The one thing I really don't understand;
The instructor made the statement that strcpy.h was out of date and rarely used.  Now, I'm sure he has a reason for showing us the function.  Hopefully the information comes later in the course.

14.1 - Intro to Multi - Demisnsional Arrays
14.2 - Intro Multi - Dimensional Arrays II
14.3 - Intro Multi - Dimensional Arrays III
14.4 - More on Multi - Dimensional Arrays
14.5 - More on Multi - Dimensional Arrays and Intro strcpy

No test after this lesson
----------------------------------------------------------------------------------------------------------
Here is one of the written codes of the lesson

#include <stdio.h>
#include <string.h>

int main(void){
  char our_array[3][3][6];

  strcpy( our_array[0][0], "One";
  strcpy( our_array[0][1], "Two";
  strcpy( our_array[0][2], "Three";

  printf("%s \n", our_array[0][0];
  printf("%s \n", our_array[0][1];
  printf("%s \n", our_array[0][2];

return 0;
}
---------------------------------------------------------------------------------------------------------
Output: One
             Two
             Three

Sunday, December 16, 2012

Upgrading


Ok, lesson had to take a small step back this evening.  I had to get a multiple monitor system up and running.  I have to say, it does make the learning code as you type code process much easier.  This way, I can follow along and without bouncing from tab to tab.  LOVE IT!!!

Saturday, December 15, 2012

Algorithms

This evening was the Intro to Algorithms.  I have to admit, though I believe I'm good at math and enjoy discovering the mathematical solution to a complex problem, this is getting very interesting.  Though we were working on a simple year, month, day program.  Creating the loops, While statements and For statements seems understandable.  I just need to make sure I completely understand the code and how it's going to function properly in the order I set forth.

This evening lesson
13.1 - Intro to Algorithm Design
13.2 - Algorithm Design Part II
13.3 - Algorithm Design Part III
13.4 - Algorithm Design Part  IV

The quiz was pretty easy this time around.  It was only 2 True/False questions

I understand the lesson that I just completed but I really want to take a look at more complex algorithms and see exactly what other people are putting together.

I think it is very entertaining to watch the professor write three completely different looking programs that have the exact same output.  Obviously, I understand, the easiest and most efficient lines of code is the way to operate.  So, I need to make sure the codes I write are in the most simple form possible

Next lesson is Multi-Dimensional Arrays  (Looks like it's going to be an interesting one.

Friday, December 14, 2012

The week has been quite the long one and I worked a 9am to 9pm shift today.  So, after getting home, walking the dog, cooking dinner for my better half and finishing up some unfinished business, I'm a little exhausted.  So, the lessons are going to have to take a day off while I get some well needed rest.  On the other hand, I felt I needed to blog and, I thought, a follow up was necessary.

I've learned far more about programming in the past two week than I ever thought I would.  Honestly, my mind is a little over-loaded.  The beginning "basics" were extremely easy to follow but, as I move farther into my journey of coding knowledge, I find myself asking question after question.

I want to make one thing very clear...  I'm not complaining!!!

After every lesson, I find myself asking;  How will I use this "New found wisdom" in creating a program?  With what I'm learning, how will it apply to achieve an end result?  How will I create a program?  I know the professor will bring it all together and show me how it will all flow.  It will just take some time and understanding.

It's extremely entertaining when I pause and look at my notebook.  I'm making sure my notes are very thorough and easy to understand.  Just in case I need to go back to them and review a small slice of a lesson.  Also, I have already taken up half the pages in my notebook already.  I'm positive I will fill the entire book but it's a clear sign I need to go out and get some more notebooks.  Though it might seem like I'm going over the top but it's going to help me further down the road.

I want to be completely honest in this blog.  I started this blog to track the progress of my learning but I also wanted to track my consistency.  As I've started these free online classes, I was taking (2) lessons a day.  As the lesson's have become longer and more complex, I have slowed my lessons per day to (1).  Before, I was able listen, take notes and finish with the quiz.  Now, I'm running two tabs; (1) the lesson videos and (2) www.codepad.org.  Ultimately, I picked up another monitor and I need to get a dual monitor system running.  I believe, that will be a more efficient system for me to write code and, learn from the other screen, at the same time.  The switching back and forth is getting to be a little tedious.

At the end of the day, I have not lost focus of the goal at hand.  I believe if I study hard, learn everything I can and have the drive to become a programmer... I will be able to achieve my goal without paying to go back to college.  Don't get me wrong, I believe everyone should attend college to gain that knowledge provided through higher learning.  Plus, college forces individuals to stay the coarse and not allow them to quit easily.  With learning on my own, I know in the back of my mind, I can quit anytime I want.  I have to keep pushing that notion away.

So, I have to go to my JOB tomorrow, Saturday morning,  and attempt to earn a living to provide for my family.  When I get home, I have the amazing opportunity to spend about an hour with a little girl who has, without out her even trying, changed my life in ways some will never understand.  I'll make dinner and then get to my lessons.

Before I sign out, I've starting reading "Programming for Dummies."  I'm moving a long smoothly because, as I believe, is due to the online videos I've been learning from.  The book is basically backing up the knowledge I have already gained.  Just putting the information in different words.  I't kind of nice have multiple explanations of the same topic.

In conclusion, the Reeducation continues!!!!

Thursday, December 13, 2012

Multiple Functions and Boolean Logic



Wow, that was an extremely long lesson.  I start out by doing two lesson a night.  Now, with all the notes, code writing and code testing, my reeducation time slot is getting wider and wider.  

Well I had 8 lesson to do and here they are:
12.1 Intro GOTO and loops in C.
12.2 About Blocks of Code
12.3 Intro Loops
12.4 Intro to customer functions
12.5 Intro Boolean
12.6 Intro Bit masking
12.7 Using bit masking to change data
12.8 Intro Date Strategies'

I wrote out the code below  and it's pretty interesting that I can get the computer to inform em if the character is Uppercase or Lowercase.  Take a look at the code below.

#include <stdio.h>

int main (void){
  char my_character = 'a';
 
  if ((my_character & 0x20 ) == 0){
  printf("This is upper-case\n");
  }

  if ((my_character & 0x20 ) == 0x20 ) {
  printf("This is lower-case\n");
  }

  return 0;
 }

Codepad.org is not a huge fan of binary.  That or I'm doing something incorrectly.  The obviously answer to resolve this conflict.  Result = I'm doing something wrong.  :-)  Anyways, when I switch to Hexadecimal , my program was running perfectly.

This is extremely interesting to me and I'm beginning to mentally combine the principles I've learn to possibly see the application in which they can be used.  Even this simple program with the two functions using Boolean Logic; by changing one character, the program is able to inform the user if the character is Upper-case or Lower-case.

I love it.  This is beginning to appear that the applications of programming is 'virtually' limitless.

Monday, December 10, 2012

IF and OR

I actually found this Unit to be extremely compelling.  I can begin to see the code coming together in my mind and the possible ways I would put lines of code together to achieve a goal.  Today's lesson was made up of:

11.1 - Intro to Condition Flow Statments
11.2 - The Mechanism for Conditional Flow Statements
11.3 - Implementing an IF Statement in C
11.4 - More about  IF Statements and Logical Operations
11.5 - Intro to Concepts of OR with Conditional Statements

Like I said above, I am starting to see where the rabbit hole is leading.  These statements are the basis of programs either choosing to run and operation or not to run and operation based on the presented information introduced as the variables.  Hence, though a program is looking for a specific integer or character, these Operations Statements will decide which direction the program will run.  Hence, the more Operations, the much much much longer the code will be.  Depending on the program depths of course.

The instructor had a very interesting point of view when it came to explaining Flow Statements.  In a video game, the computer is making decisions all the time.  Main First Person Shooters.  The second your character is shot, the Flow statements, begins.  The computer looks at his current health and either allows him to continue the game or ends the game / program due to lack of health.  Obviously, the concept go much further but I have the basic idea and understand how to write the code and it's functions.