free web stats

A Computer Science Blog


Quick Ruby Tip #1


Ruby logoHere’s a quick tip for those using (or learning) the Ruby programming language.  As you may know, Ruby 2.0 has been released, and if you have downloaded and installed the newest version, you will more than likely have more than one version of Ruby installed on your computer.  If you are maintaining older programs that are written in Ruby, you will probably want to keep these older versions on your computer.

That said, here are a few helpful commands in working with multiple versions of Ruby.  First, you may want to see how many (and specifically what) versions of Ruby are already installed.  Fire up Terminal and type:

You will see similar output to the screenshot below.  The available versions of Ruby are listed, and if there is more than one, the current and default versions will be marked with = and * , respectively.

Listing Versions of Ruby

If you need to change the current version of Ruby, use the following command:

Note that setting the current version only applies to the open Terminal session.  If you close Terminal and relaunch, the default version of Ruby will be running again.  If you know that you will be using one version of Ruby more than the others, then set it as the default using the following command:

Of course, if at anytime, you want to see what version of Ruby you are using, use the following command:


DataStax Logo

Calling All Girls (and Boys) Who Write Code


DataStax, the company that provides a Big Data platform built on Apache Cassandra for real-time, enterprise applications, is sponsoring an exciting scholarship for computer science and engineering students pursuing a Bachelor’s or Master’s degree. The program is aptly called “The Next Great Data Developer,” and two participants will receive a $10,000 scholarship as well as a paid internship at DataStax. Yes, you heard that right…the winners get both scholarship money and an internship in Silicon Valley. But that’s not all–in order to encourage more women in technology, one of the scholarships will be given to a female developer.

Six finalists will be named in May and invited to the Bay Area Cassandra Summit on June 11-12th to present their projects. Two winners will be selected from the six finalists and awarded their scholarships at OSCON (July 22-26th) by Apache Cassandra Project Chair, Jonathan Ellis.

To participate in the program, build any type of application that uses the Apache Cassandra database and complete the following requirements to document your experiences developing the application:

  • Create an activity blog (minimum of 5 postings on your project activity)
  • Make a YouTube, Vimeo, etc. channel for video recordings (minimum of 2 recordings, any length)
  • Using your activity blog, describe a business case–that is, how your app can be used in a business setting (minimum of 1 page)
  • Create a working prototype and post your code to

Entries are judged on not only the working prototype, but also your ability to communicate and document the development process using the tools above. The progress of each applicant’s work will be reviewed and monitored on an ongoing basis.

If you’ve never used Cassandra before, now is the perfect time to start. For those new to Cassandra, DataStax provides a step-by-step tutorial on how to get up and running on the Next Great Developer Program Website–just click the “Getting Started” tab.

Best Git Book for Beginners


Git: Version Control for EveryoneAbout a month ago, I posted a list of the best tutorials I found on Git. A couple of weeks ago, however, I came across the e-book Git: Version Control for Everyone. I didn’t have a chance to read it until a few days ago, but now that I have, I’ve added it to my list of tutorials and wanted to write a new blog post on it (since, unlike most of the other tutorials which are Web based, this one is a book).

My main problem with other Git books I had bought from Amazon was that they either glossed over the basics or that they were too technical to follow. It’s not easy to wrap your head around what is actually going on when you enter commands while using a version control system. Sure, it’s not that difficult to learn/memorize the different commands, but having an understanding of how Git is working, what it’s doing and why we’re using it is a little more complicated.

This book walks you through all aspects of Git–from installation (on every popular platform), configuration, basic commands and more intermediate features. When I say it walks you through it all, I mean it baby-steps, which is great if you’re just learning Git and have little to no experience with version control systems. It also shows you how to accomplish each task from both a GUI and the command line. If you’re already a Git expert, then this book probably isn’t for you. If you’re starting out with Git or if you feel you need more explanation on the topics than other tutorials and books offer, then this a great book to check out. It’s not long, but it covers enough so that when you are done, you know how to use Git and, more importantly, you know exactly what it’s doing behind the scenes and why you are using it.

This was the first book I had read by Packt Publishing–most of what I buy is published by O’Reilly. However, I was so happy with it that I picked up another book by Packt on AngularJS. Hopefully I’ll be able to post a review up on that as well once I’ve had a chance to read it.

I Just Got an Awesome Mentor


Chad Fowler, author of “The Passionate Programmer“, wrote: “I’ve often thought ‘just give me 3 months with a smart person and I can have them running circles around the average developer.’” Even though I’m not quite sure 3 months is enough to go from zero to hero, I completely agree with the general crux of his statement. Having a great mentor–in any field–is incredibly important to being successful. I’m not saying that if you don’t have a mentor, you’ll never be successful; I’m just saying that if you have one, your chances will be much greater. Every individual I have ever met who was great at their job had at least one person they could refer to as their “mentor.” I’ve read that Chad Fowler, himself, attributes much of his own growth and success to mentors he had when he first started out.

I’m writing about this because today I had an amazing meeting with an individual in my town (who also happens to be an amazing programmer and Web developer) about possibly interning at his startup, and I left the meeting with a mentor. It all started when I emailed him regarding an event he was organizing in my town (he’s also incredibly active in the tech community). We exchanged a couple emails about the event, and I told him I was starting to learn Ruby and Rails in earnest and to please let me know if he ever hears of any internships or cool opportunities. He wrote back with several possibilities I could pursue and was willing to help me get in contact with those companies (Yes, he’s the coolest!).

“A mentor is someone who sees more talent and ability within you, than you see in yourself, and helps bring it out of you.”

Bob Proctor
Author, Speaker and Success Coach

Anyway, one of the opportunities he mentioned was a startup he’s working on, and when I asked more questions and wanted to know more about it, that’s how the meeting was set up. So, here’s lesson number 1: BE PROACTIVE.  If you’re interested in something, if you want something, then ask around–inquire–be curious–talk to people. I got lucky and happened to talk to a really cool guy. However, if the first person you talk to isn’t very helpful, ask someone else. If you’re a graduate student and want to get some real-world experience (a.k.a. learn useful skills instead of just theory and stuff that you’ll probably never use at your first job), get out there and talk to people in industry.

I emailed him tonight to thank him and to tell him I’d love to intern at his company this summer if he had room for me.  I also thanked him for agreeing to mentor me as I started my quest to be an amazing Web developer. Before we left the meeting, he gave me a list of topics to study and resources to explore. I am to study these independently and then contact him with questions I’m having. He was also receptive to the idea of doing some pair programming in the future to reinforce the skills I’ve learned.

I was happy, so I thought I would share the good news with my readers. In any case, my feeling is that having a mentor like this is a blessing. I am thankful, and I’ll share what I’m learning on my blog. At the same time, though, I want all of you to reach out to people in your tech community if you have questions or want to explore more opportunities, but don’t know where to start. Chances are, you will find someone who is friendly, receptive and helpful; and if you’re lucky, you will find a mentor whom you will acknowledge 10 years from now as being pivotal to your success.



pwd stands for “print working directory” (though, I’ve also heard a few people say that it stands for “present working directory”).

Use pwd at the command line to display the current directory you are in (or, more specifically, the “absolute path” of the directory you are in). You can use pwd whenever you are lost–that is, whenever you have no idea what directory you are in. When you’re working at the command line, it’s extremely important to know what directory you’re in. Let me repeat that…you have to know where you’re at!

Why is it so important? Well, if you don’t know where you are, you’ll run into problems when you try to open (or do anything to) a file. At the command line, opening a file is not as simple as clicking on an icon. Nope, the interpreter is not that smart. You actually have to tell the interpreter specifically WHERE that file is…and usually you tell it where the file is in relation to where you are. That makes sense, right? In real life, for example, if you ask me for directions to the nearest Starbucks, I’ll give you directions in relation to where we are currently standing–not in relation to my house (which could be miles away). Doing this, in technical terms, is called giving a “relative path”–not an absolute path. Since a relative path is defined in relation to where you currently are in the directory system, you cannot specify it correctly without knowing what directory you are in. Here’s an example:

Suppose I want to open and edit a file named dearjohn.txt that is located in the home/Mary/documents/important/letters directory. Technically, I could just open it using the absolute path by typing:

This, however, can get tedious, long (and really annoying) when files are located deep within the directory structure. A smarter way to reference a file is using its relative path. To do so, I need to know where I am in the directory system, so I type:

Now that I know where I am, I can simply open the “dearjohn.txt” file by typing the following (i.e. a relative path):

Note that those two dots and slash (../) are just like directions–they tell the interpreter to move up one directory from your current location (or current working directory).  So, in the example above, ../ allows the interpreter to move out of the poems folder, bringing it into the important folder, from which it can then proceed into /letters/dearjohn.txt.

Knowing the distinction between absolute and relative paths is also very important when doing Web development (that’s right…even away from the CLI it’s important!). Since Web pages are simply files stored on a server somewhere, links to pages on the same site (i.e. on the same server) are often specified in HTML using relative paths.

“The Bourne Again Shell” In Theaters Everywhere


The Bourne Supremacy movie posterIf you think using the command line is scary, I have something cool in store for you.  First of all, don’t be ashamed if the thought of entering commands at the shell prompt is daunting.  Unless you are a complete geek or a complete liar, you will have found the command line interface (CLI) to be intimidating at some point or another.  Okay, I’ll admit it…The first time I heard the term “Bourne Again shell,” I thought it was probably the latest installment in the Bourne film series. Then I realized that the “Bourne Again shell” was the same thing as bash (which I had used and heard of a million times before–and which is the most commonly used command line interpreter or shell in Linux).  It turns out that bash is just an acronym (of, you guessed it…Bourne Again SHell).

The point is that anything to do with the CLI can be confusing.  The first many times I worked at the shell prompt, I didn’t know all the commands I needed.  When I looked them up, more often than not, I was surprised…not by how intuitive they were, but quite the opposite.  As you start learning the commands, you will also start wondering why certain command names were chosen, and quite possibly, you will come to the same conclusion I did…that whoever came up with these commands wanted to deter others from working at the command line.

So, let’s prove this person wrong.  The best thing you can do if you want to become adept at using the CLI is to learn and practice commands.  Learning too many commands too soon can be overwhelming, so I thought I could use this blog as a way to gradually introduce new commands to my readers (and to myself).  I plan to have an ongoing series of blog posts in which I introduce a new UNIX command and its usage (don’t worry if you use Linux…the commands are nearly identical).  It’s up to you then to fire up the command line and practice.  If you are a Mac user, just fire up your Terminal, since Mac OS X is UNIX under the hood.  I’m sure that as you learn more commands, the thought of using the CLI will no longer be scary, but may actually be enticing.  You will discover what many computer geeks before you have learned and few have shared with others: that using the CLI is actually far, far more powerful and quicker than using a graphical user interface.


Git with the Program


So you want to learn Git? Good idea. So do I.  But, where to begin, right? First of all, the fact that you have an interest to learn Git and do tutorials is a wonderful thing, so pat yourself on the back. Go ahead, no one’s looking. Learning and using a version control system is extremely important, if not vital, to software development. There are many version control systems out there; the most popular ones being Subversion, Mercurial, and Git. These days, though, Git is becoming more and more popular due to the fact that it’s a distributed version control system, it’s open source and there is a very popular Web site (GitHub) that provides free online code repositories in addition to social networking features. If you are learning Ruby on Rails (RoR), you will also quickly see that the RoR community almost exclusively uses Git as their version control system.

Anyway, the Web is full of Git tutorials, but here is a list I compiled of the best ones…in other words, the ones a) you will actually learn something from and b) you won’t fall asleep doing.

GitHub Training

GitHub offers free Webinars about not only using GitHub, but Git too–and, naturally, how the two work together. Each Webinar has one single topic.  For example, there was one recently that covered how to correct mistakes in Git from the command line using commands such as commit amend, reset (mixed, soft, hard) and revert. I personally attended a Webinar taught by Tim Berglund recently and was extremely impressed. After each class, the instructor also holds Office Hours where you can ask questions not only about the material covered, during the Webinar but also basically anything you want regarding Git or GitHub (that’s right, no holds barred). These Webinars with the Office Hours are truly a gift, so take advantage of it before they decide to charge money. Incidentally, they also offer courses that you must pay for. I’m planning to save up to enroll in the Advanced Git and GitHub course after I work through all the resources below.

Pro Git Book

This Web site provides the full text of the book “Pro Git” by Scott Chacon (published by Apress). The Web site also offers some introductory videos on Git.  The book is available in traditional print format too, in case you’re old school like me.  If, however, you’re hooked up with an iPad or a Kindle Fire, by all means, whip out your e-reader of choice and start reading and learning about Git.  The book covers the very basics (such as installing Git) to some more intermediate topics, such as hooks.  On the same site you will also find a great quick Git reference guide.  If you plan on becoming proficient in Git, then this is a great list of commands that you should know.

Git from the Bottom Up

Since we are talking about iPads and Kindles, you might also want to load the pdf at this site.  This pdf is not only helpful, it is also a quick read.  So, for those of you who are too lazy to read an entire book or for those whose “Books to Read” list is already way too long, this pdf might be your best bet.

Learn.GitHub - Introduction to Git

This is a tutorial that spans only 5 html pages and covers essential topics, including set up, initialization, cloning, committing, branching, merging and pushing.  It has nice diagrams and command/output examples where appropriate.  It is worth noting that this introductory tutorial is just one part of the GitHub Learning Gateway, where you can find other helpful resources (including a link to the Code School – Try Git tutorial listed below).

Git Immersion

When you get bored of all the tutorials that just require you to read, head over to the Git Immersion tutorial, which is structured as a series of 53 mini labs.  Each lab has a goal or objective (such as “Learn how to commit changes to the repository”).  The steps to achieve the goal are numbered, and since the labs are brief, some of them only require one step to complete (even better!).  For each step, you are given the command(s) to execute at the command line as well as the output you should see on your screen after running the command(s).  I cannot stress enough the importance of getting hands-on experience when learning a new technology, and even though this is just a tutorial, it is a great way to get your feet wet and to get a feel for Git.

Git – The Simple Guide

This tutorial is good times and aesthetically pleasing. It’s to the point–short and sweet.  If anything, check it out just for its clever, fun design.  The author provides a link to a great Git Cheat Sheet.  Print it out and keep it by your computer when you start using Git on your first project.

Code School – Git Real

I’m a big fan of Code School…they offer tutorials on a great variety of topics for Web developers, but most of them you have to pay for. However, they do offer a few free ones (SCOOOORE!), including one on Git.  Their tutorials have fantastic design, so you will never be visually bored completing them.  Not only that–there’s more!  Their tutorials are also interactive…what better way to learn than by doing?  Once you are done with the Try Git course, check out the Git Real tutorial by Code School.

Pull Requests

Do you think all Help documents are invariably useless?  Think again.  GitHub has a pretty darn good Help section, if I may say so.  And, while it may not technically be a tutorial, you can learn a great deal if you just read a section or two.  For example, if you are planning on using Git to contribute to open source projects or to collaborate with other developers, you will certainly hear the term “pull request.”  This page straight from GitHub help documentation is amazingly lucid and helpful to learn exactly what pull requests are and how to use them.

A Visual Git Reference

Do you learn better when there are pictures?  Yeah, me too.  We’re in luck!  This site offers diagrams to illustrate common Git commands.  The diagrams are in color too.  The diagrams aren’t anything fancy, but don’t be quick to dismiss them.  A lot of times pictures can better describe what’s going on than cryptic commands.  If you are a visual learner, check this site out for sure.  I suggest first doing some of the better tutorials listed above and then reinforcing the concepts by reviewing the diagrams.

Easy Version Control with Git

The graphic design on this page won’t blow you away, but this tutorial is ideal for those in a rush who need to learn just enough about Git to get by.

I hope these tutorials help those of you who are interested in learning and using Git.  If you find any other great resources, please share them with me and the other readers by leaving a comment.

Git: Version Control for Everyone

I am adding this ebook to my list of resources even though I published this article over a month ago.  I just finished reading it and will post my thoughts on it in a new post.  However, since my thoughts are positive, I wanted to include it with the other great Git tutorials I have found.

New Year…New Resolutions


Happy New Year!  I can’t believe it’s already 2013…It feels like yesterday we were ringing in 2012.  I guess it’s true what they say about getting older–the years just go by faster.  With each New Year’s Day comes new resolutions.  I will admit that I’ve never been great about keeping my New Year’s resolutions.  In fact, the last resolution I actually kept was…uhhhh…back in…hmmmm….what was I saying?  Exactly.  Okay, I’m exaggerating, but the curious thing is that even though I’m not great at keeping my resolutions, I still make them with every new year.  I guess I’m a romantic like that.

For 2013, most of my resolutions center around learning and coding, so I’m pretty sure I will be keeping most all of these.  Don’t worry, I still have the obligatory “Run a marathon” and “Eat healthier” resolutions on my list (though I can pretty much guarantee those will make the list again in 2014).  Here is what I hope to achieve in 2013 (in no particular order):

  1. Take 2 computer science classes on (some of the classes actually look very interesting)
  2. Finish up my graduate program course work
  3. Design and code 2 Ruby on Rails Web applications (novel ideas I come with)
  4. Attend at least 1 meetup (from each month on a programming or tech-related topic
  5. Design and code an iPhone mobile app
  6. Become a better C programmer
  7. Be good about keeping this blog active (and hopefully get a handful of loyal readers who share a common interest in programming and computer science–no matter what level they may be).

I’m wary about making the list any longer, but am I missing any good resolutions?  What are your resolutions for the new year?

I hope 2013 brings great happiness and success for everyone.

Get Some REST


Everywhere you go, you hear about REST–RESTful, REST this, REST that, blah, blah, blah. The term is thrown around so casually in Web development these days that it goes without saying everyone knows what it means. Do you want to know my theory? I bet half the people that use the term don’t know what it means. How do I know that? Well, it’s because if you ask someone who uses the term what exactly REST means, you get some half-assed answer. The worst is when someone just tells you what it stands for (“REST is Representational State Transfer”). If you get that answer, REST assured that the person you asked has no idea what it is either.

If you are interested in Web development, you should not only have an understanding of what REST is, you should be able to explain it to somebody else. For this reason, I’ve put together a little (very basic, ultra simplified) tutorial of REST below without all of the gory details. Hopefully you’ll have a better idea of what it is after reading this article. Of course, if you have ideas to share or better explanations, let me and the other readers know by leaving a comment. I’m still learning myself.

The Big Picture

As I mentioned earlier, REST stands for Representational State Transfer. No, the “E” doesn’t stand for a particular word. Yes, you should absolutely know what REST stands for, but you should know much more than that.

Simply stated, REST is a way of designing networked applications. If you want to be Miss Fancy Pants (who doesn’t?), you can say that it’s an “architectural style” for designing networked applications. A little more specifically, REST is a way of designing networked applications so that the HTTP protocol is used to make requests and transfer information between machines. Thus, in an application that uses REST (i.e. a RESTful application), HTTP is used for all CRUD operations (i.e. Creating, Reading, Updating or Deleting data). What this amounts to, basically, is that the HTTP PUT, GET, POST and DELETE request methods are used, respectively to handle all of these operations. You may have thought that HTTP is always used…Well, not quite…RPC (Remote Procedure Call), SOAP (Simple Object Access Protocol) and WSDL (Web Services Description Language) are also ways to exchange information between two communicating machines. Applications using these mechanisms are NOT considered RESTful. The latter mechanisms are much more complex than REST and, as such, can be much less efficient (e.g. require more bandwidth). Actually, those mechanisms are so complex that they are usually used with extra libraries to create the request and also to parse the response. No such libraries are needed for REST (although a few do exist).

REST is not an official standard–it’s just a way of doing things (i.e. a model, a style, a convention, etc). Some Web development frameworks, such as Ruby on Rails, use REST. REST is platform and language-independent (that is, REST works exactly the same regardless of what OS is running at the client or server. Similarly, REST can be implemented in any language or any combination of languages). Using REST allows your application to run on almost any device (even if that device had not even been created when you programmed your application). Basically, if you can access the World Wide Web on a device, you will be able to use a RESTful Web application on that device. Being RESTful has nothing to do with security, authentication, encryption, or quality of service, but those aspects of an application can be added on top of the HTTP protocol.

The Nitty Gritty

You might also see the term “named resources” as you dig into the deeper meaning of REST. In RESTful applications, requests and responses transfer representations of named resources. Don’t worry…it sounds more complicated than it actually is. Basically, a “named resource” would be something your Web application would want to remotely manipulate or transfer information about. In the context of HTTP, “named resources” are just any “entities” that can be addressed in a URL (or, more correctly, in a URI). A “representation” of that named resource is just the document (e.g. an html or xml document) that contains the state of that resource. So, what that boils down to is basically what you learned above–that REST is a way to design your application such that HTTP is used to transfer information between machines via URLs. In order to use URLs in this way, each named resource or entity that your application may need to transfer information about must have a unique ID so that the HTTP request method (PUT, GET, POST or DELETE) can specifically address that resource.

This is a good place for a real-world example. Take a Web site like…each product that is sold on can be thought of as a named resource, since each of those products would likely be sold, updated, removed, bookmarked, etc. at some point or another. Thus, for an e-commerce site that uses REST, a plausible URL for a product can look like That URL would get information regarding the product (e.g. the product page). Another product could be at What all of this amounts to is basically a naming scheme that is used for machine-to-machine communication and what that amounts to basically is using links to refer to resources. Not exactly rocket science, but it does simplify things immensely. If it becomes necessary to edit or remove that product, its URI is used in that request. It is important to note that your resources should provide correct implementations of the HTTP request methods in order for all of this to work. Using a RESTful Web framework to develop your application makes doing so that much easier.

Final Last Words

The point of this article was not for you to become a REST expert, but rather to have an idea of what it means when someone says REST in the context of Web development. There are a lot of details that I’ve left out, but if you’re interested, peruse the Web and you will find plenty of comprehensive tutorials. I hope to follow up on REST in future articles, so stay tuned! Also, you may find it interesting to know that REST was first introduced in Roy Fielding‘s Ph.D. dissertation. Here’s a link to his original dissertation on REST.

Hello World…What’s Your Number?


When you start a blog using WordPress, it automatically generates your first blog post.  They aptly title the post “Hello World!” for you.  Clearly, programmers set that up.  For any newbies out there, whenever you are learning a new programming language, it is tradition to write a “Hello World” program as your very first program…In fact, some even say that it’s bad luck if you don’t.  Suffice to say, after I heard the bad luck thing, I have always first written a “Hello World” program when I am learning a new language (and even when I’m done setting up my IDE and want to make sure everything is working).  So, what exactly does a “Hello World” program do?  All it has to do is output the words, “Hello world” to the screen.  That’s it.

Since I’m a computer science student and this blog is brand-spanking new, I thought I should keep my first post titled “Hello World.”  That got me thinking…how many programming languages do I really know how to write a “Hello World” program in?  Well, it didn’t take too long to count…I’ll tell you my number, but you can’t hold it against me…4 (Java, Python, Ruby and C).  The sad thing is that I could also do it in PHP and JavaScript, but I haven’t used them (or even looked at them) in so long, I’ve completely forgotten the syntax.  Keep in mind, though, that IMO it’s far better to know one language extremely well than to barely know a bunch.  So now that you know my number…what’s YOUR number?  Oh, and HTML does *not* count.

I think this is a good time to learn a few more “Hello World” programs!  So, I’ve compiled (LOL–I said compiled) a list of “Hello World” programs in languages that I think are relevant and worth knowing.  Please see below and try to learn one or two that you didn’t already know, so you can improve your number.























Visual Basic