Sunday, August 26, 2012

Udacity CS101

Decided to get back into learning mode after being lazy for half of the year. This time, I'm learning a new programming language just for fun.

Late last year I completed the A.I. class offered by Dr. Sebastian Thrun and Dr. Peter Norvig, so it was natural to check Udacity for their course offerings. Since most of the classes offered at Udacity use Python, and because I haven't been exposed to the language in the past, I decided to start with CS101 to get a feel for the language, before moving to the more advanced courses.

After 4 weeks, I'm in unit 5 having completed all the exercise that accompany each unit, and also the extra practice material that was recently added. So far I'm very impressed with the quality of the class, and it probably does a better job as an introduction to Computer Science than some of the introductory classes I took in college.

In the short 7 weeks that the class is designed to take, the student is introduced to non-trivial problem solving with Python. You get to program a very rudimentary search engine, and most importantly, you are briefly introduced to quite a few C.S. fundamentals.

Overall, I give the course my highest recommendation. It is my belief that it would be especially useful to high school students who are thinking about majoring in Computer Science, but haven't been exposed to the field before.

Saturday, August 25, 2012

Accelerated C++ Solutions - Posting partial solutions

It has been a long time coming since I announced that I was going to post the solutions to the book Accelerated C++. Well, I got really lazy and procrastinated. Then at the beginning of the year, life got a little complicated so I put this on hold.


Anyway here it is. I'm posting solutions starting from chapter 2 to the beginning of chapter 12. You will notice that some problems are missing, especially all the *-0. The problems that are missing are what I remember being trivial, such as typing in the source code from the examples in the book, or slightly modifying a previous problem.


I'm really sorry, but I won't be providing detailed explanations for each solution like the author in parks computing, which you can see in a previous post I made. It would just take too much time. However, you can leave a message here, or shoot me an e-mail to arroyjose at gmail dot com, if you need clarification or help.


NOTE These are a set of solutions to the problems. There are many other ways to get the correct result, that aren't the same as mine, and in all likelihood, there are probably better solutions. A word of advice is to try to figure out the problems yourself, and use my solutions to see how another person implemented the same answer.


NOTE 2 I used Visual Studio and I'm providing the solutions in the folder structure that Visual C++ creates for a project. My apologies to those in Linux and other systems.


NOTE 3 The solutions are provided in a dropbox link until I find a better way to distribute them. At some point I intend to finish all the problems, but I don't want to give a date.


Here they are. Good luck!


Accelerated C++ Solutions

Thursday, July 14, 2011

Accelerated C++ Solutions

Well, I'm going to start posting the solutions to the book, but I'm going to skip all solutions from the first two chapters because I believe most of them are trivial. Chapter 3 is where the questions start to ramp up in difficulty. Also, I'm skipping all the *-0 exercises since those are just about running the code from each chapter. If you still want to check the solutions for the first two chapters check:


http://www.parkscomputing.com/accelerated-cpp-solutions/


The author, Paul, is also working on the solutions to the book, so you can use his as another approach to take in the exercises.

Wednesday, June 29, 2011

Testing

#include <iostream>
#include <string>

using namespace std;

int main()
{
 cout << "Please enter your first name: ";

 string name;
 cin >> name;

 const string greeting = "Hello, " + name + "!";

 cout << "Enter the vertical and horizontal padding: ";
 int padTopBottom;
 int padLeftRight;
 cin >> padTopBottom >> padLeftRight;

 const int rows = padTopBottom * 2 + 3;
 const string::size_type cols = greeting.size() + padLeftRight * 2 + 2;

 cout << endl;

 for (int r = 0; r != rows; ++r)
 {
  string::size_type c = 0;

  while (c != cols)
  {
   if (r == padTopBottom + 1 && c == padLeftRight + 1)
   {
    cout << greeting;
    c += greeting.size();
   }
   else
   {
    if (r == 0 || r == rows - 1 || c == 0 || c == cols - 1)
    {
     cout << "*";
     ++c;
    }
    else
    {

     // The line where the greeting goes.  Should only be here twice
     if ( r == padTopBottom + 1 )
     {
      string space(padLeftRight, ' ');
      cout << space;
      c += padLeftRight;
     }
     else
     {
      string space(cols - 2, ' ');
      cout << space;
      c += cols - 2;
     }
    }
   }
  }

  cout << endl;
 }

 return 0;
}

Accelerated C++

Now that I'm done with school I finally have some time to sit and re-learn C++. The last time I did any substantial programming with the language was during an internship back in 2007. To help me in this task, I've decided to read a book, which I feel is the most conformable way of learning things for me.

Since I already know a large portion of the syntax, and semantics I wanted to pick a book that didn't delve into beginning territory, and instead focused on people who already know how to program but want to learn the C++ language quickly. Most of the time, the type of books that cater to programmers are titled "Pro" for example "Professional C#," etc. The reason I'm avoiding books such as C++ Primer Plus, Beginning C++, C++ in 21 days and others like them is not because they are bad, but because too much time is spent explaining the fundamentals of programming, not to mention that some of these tomes are 1000+ pages long.

There is one very popular and well reviewed book for C++ that has stood the test of time due to its unique approach of teaching the language: Accelerated C++. It covers just as much material as other beginners books and doesn't spend hundreds of pages teaching how to use a for loop. My goal is to read and do all the exercises in the book by August 15 of this year.

In the last two weeks I've read the first 4 chapters and I'm still working my way through the exercises in Section 3. What I'm finding is that searching for the solutions online has shown that only a few people have posted them, but not for the entire book. So I thought it would be a cool idea to post all the solutions here in my blog as I work my way through each chapter. Perhaps it will give me a little more motivation to read the book in its entirety, and some people will find it useful to see how I approached each exercise.

Sunday, April 25, 2010

Where?

I've been a little troubled the past couple of months. The time has come where I can practically smell the so-called "real world." The end of the tunnel which was but a pixel-sized dot before is now coming real fast and I'm afraid it will left me blinded and confused. So what is this all about you ask? Well, I'm having a really hard time deciding whether I want to go into embedded systems or digital VLSI. There is always the pure software route, but only if it has something to do with parallel algorithms or 3D graphics.

I keep asking my professors and peers for advice, but I get conflicting responses.
"No one does ASIC anymore, everything is going overseas"
"That's what the FPGA people want you to believe, but Intel, AMD, Nvidia, Micron, Texas Instruments need people who can do VLSI"
"Embedded systems is the hot field now"
"Master you algorithm design skills and apply at Google"

They all sound true, but I can't focus on all of them. A 48 hour day would be my best friend.

Friday, January 9, 2009

Weekend confirmed?

This is the first Friday since fall 2005 that I didn't hear Garnett Lee say the memorable phrase "Weekend confirmed." And to think that I started listening to 1up yours almost by accident, after watching a video of Luke Smith interviewing David Jaffe, the creator of God of War. The scruffy looking dude with the beard, Mr. Smith, kept asking sharp question after sharp question. It was fascinating.

So after discovering that Luke was also host of a "podcast," I knew I wanted to listen more, and thus I became a fan of 1up yours. The years passed, people left: Luke, John. Other people joined: Brian, Mark, Shawn. And the two most controversial and unique hosts stayed: Garnett and Shane.

Now the 1up network is owned by UGO, half of the people working there were fired, and the most entertaining podcasts about video games are no more. It really feels strange coming home and not having those familiar voices go at it for two hours of pure fun. How could anyone forget Garnett saying "This is my god damned show!" or Shane "mangod" Bettenhausen defending everything PS3 related?

I just want to say Thank You to all the people of 1up for providing me with some the most memorable entertainment for the past three years.