< Browse > Home

Google Wave Invitations Round 2

March 11th, 2010 | 2 Comments | Posted in Blog, Contests by Diego | - [Full Entry]


Want a Google Wave Inviation?

Do you want a Google Wave invitation so you could ride the wave? Simply reply below and state why you should receive an invitation. I have fourteen invitations and will be sending them once I get enough entries. This should be open for a few days and once the wait is over I’ll randomly choose the winners. Good luck.


What is a wave?

A wave is equal parts conversation and document. People can communicate and work together with richly formatted text, photos, videos, maps, and more.

A wave is shared. Any participant can reply anywhere in the message, edit the content and add participants at any point in the process. Then playback lets anyone rewind the wave to see who said what and when.

A wave is live. With live transmission as you type, participants on a wave can have faster conversations, see edits and interact with extensions in real-time.

About Google Wave


Read more »

C++ Recursion – Palindrome

March 10th, 2010 | No Comments | Posted in C++, Functions by Diego | - [Full Entry]

Determining if a string is a Palindrome using recursion

Below is an example of how to determine if a word is a palindrome using recursion. A Palindrome is a string that could be read the same way in either direction such as racecar, mom, and even a. This tutorial expects you to understands the following.

C++ Recursion

Example of finding if a word is a palindrome

To determine if a word is a palindrome do the following.

  1. Compare the first and last character
  2. If these characters are the same, disregard these characters and repeat until one one character or no characters remain

Example:

// Check first and last character
[ r ] [ a ] [ c ] [ e ] [ c ] [ a ] [ r ]

// Second iteration
[ a ] [ c ] [ e ] [ c ] [ a ]

// Third iteration
[ c ] [ e ] [ c ]  

// Fourth iteration
[ e ]

// The word is a palindrome.
 

Now let’s try one that isn’t a palindrome.

// First iteration
[ t ] [ a ] [ b ] [ t ]

// In our second iteration, a and b don’t match
[ a ] [ b ]

Read more »

How to add Open in Terminal support To Nautilus in Ubuntu

March 9th, 2010 | No Comments | Posted in Linux, Tips, Ubuntu by Diego | - [Full Entry]

Wouldn’t it be great to open up Nautlius (equivalent to Windows-Explorer in Ubuntu) and be able to open up your terminal in that specific folder by simply right clicking and choosing an Open in Terminal option? Unfortunately this option isn’t set by default. Luckily there are two ways to install this option.

  1. Installing through the terminal (easiest)
  2. Installing through the Synaptic Package Manager

Read more »

C++ Recursion – Reverse elements of a vector

March 8th, 2010 | No Comments | Posted in C++, Functions by Diego | - [Full Entry]

Reversing the elements of a vector using recursion

Below is an example of how to reverse the elements of a vector using recursion. This tutorial expects you to understand the following.

C++ Recursion

Example of reversing the elements of a vector

Below is an example of how one would reverse the elements of a vector by simply intuition.

// Our vector with size 5
[ X ] [ B ] [ A ] [ N ] [ Y ]
[ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ]

//Step 1: Swap entry 0 (first) with the entry n (last)
[ Y ] [ B ] [ A ] [ N ] [ X ]
[ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ]

//Step 2: Swap entry 1 with entry 3 (n -1)
[ Y ] [ N ] [ A ] [ B ] [ X ]
[ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ]

//Step 3: No swap needed for 3rd entry (or middle entry)
[ Y ] [ N ] [ A ] [ B ] [ X ]
[ 0 ] [ 1 ] [ 2 ] [ 3 ] [ 4 ]
 

Notice how once we arrive at the entry in the middle of the vector we don’t continue. Why? The values beyond this entry have already been swapped. Keep this in mind.

Reversing the elements of a vector using iteration

Before we try making a recursive function to reverse the elements of a vector, let’s make one using iteration. By following the method described in the method above, it’s easy to see that we are simply swapping the ith and (nth – ith) variables (Example: the 0th and the 4th (4th – 0th) element).

Reversing the elements of a vector using iteration

The iterative solution for reversing the elements of a vector is below. Make sure you are trying all these functions if you haven’t before on your own.

//We pass the vector by reference
void reverseElements(vector <int> &vec) {

     //Temp variable for swapping
     int temp;

     int n = vec.size()-1;
 
     //Iterate vec.size()/2 times
     for ( int i = 0; i < vec.size()/2; i++ ) {
 
          // The swapping of elements
          temp = vec[i];
          vec[i] = vec[n-i];
          vec[n] = temp;
   
     }

     return;
}

Make sure you understand this completely before moving forward. Try working it out by hand.

Read more »

C++ Recursion – Greatest Common Divisor

March 7th, 2010 | No Comments | Posted in C++, Functions by Diego | - [Full Entry]

Greatest Common Divisor using the Euclidean Algorithm


Below is an example of how to create the recursive function of computing the greatest common divisor using the Euclidean Algorithm.

* This tutorial assumes you understand the following.

Euclid’s Algorithm

When studying computer science a famous algorithm taught to students is the Euclidean Algorithm which is used to compute the greatest common divisor of two integers. It’s definition is below.

gcd(x,y)

Computing various examples


So how does it work? Well, let’s follow the definition, but before doing that, do you remember how to compute the remainder of two integers in c++? If you don’t, well it’s the % (mod) operator.

// Computing the gcd of 45 and 9 //
gcd(45, 9)
= gcd(9, 45 % 9 ) = gcd(9, 0)
= 9

// Computing the gcd of 54 and 12 //
gcd(54, 12)
= gcd(12, 54 % 12) = gcc(12, 6)
= gcd(6, 12 % 6) = gcd(6, 0)
= 6

Read more »

Beej’s Guide to Network Programming

March 2nd, 2010 | No Comments | Posted in Network, Programming by Diego | - [Full Entry]

Learn Network Programming


Learn network programming with Beej’s Guide to Network Programming. For those wanting to learn this guide is a great choice. The guide is concise and makes learning networking programming a lot easier. It is not by any means a complete guide, but it’ll help you enough so you could start on your own.


But why learn network programming? At the time of this writing, I’ve been taking a course in Networks and we’ve already programmed quite a simple terminal based instant messaging client in C. You can join and login to a network, create buddies, and have conversations with them. If I was given more time, I would’ve implemented a gui but since we were given a one week period to work on it I didn’t have as much freedom as I had hoped for. I did use the following guide to understand network programming and I don’t think I could have found a faster and easier way to learn than this.

Beej’s Guide to Network Programming

Lighthouse – Short Movie

February 25th, 2010 | No Comments | Posted in Blog, Videos by Diego | - [Full Entry]

Lighthouse, a short movie


I wanted to share something with all of you today. It might not make a whole lot of sense today why I’m showing you this, but if you stick around you’ll have the opportunity to find out the importance of this video. Trust me, it’s one of those videos that make you feel good inside by the time it’s over and at 2:00 minutes long, you really can’t say no. Can you? Well, let’s get on with it.


Read more »

Page 1 of 2712345...Last »