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