< Browse > Home

C++ Recursion – Power

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

Creating a power function using Recursion


Below is an example of how to calculate the x to the power of n. This tutorial expects you to understand the following:

  1. C++ Recursion
  2. C++ Recursion – Summation
  3. C++ Recursion – Factorial

Example:

pow(2,3);
pow(5,4);

Result:

8
125

Iterative version of a function that calculates the power function


To understand how to calculate the power function using recursion, let’s write a simple algorithm that will do it for us using iteration.

int power(int base, int exp) {

     if ( exp == 0 ) {
          return 1;
     }

     //Initial value for the result is the base
     int result = base;
     
     //Multiplies the base by itself exp number of times
     for ( int i = 1; i < exp; i++ ) {
          result = result * base;
     }

     return result;
}

Read more »

Split Browser add-on for Firefox

February 2nd, 2010 | No Comments | Posted in Software by Diego | - [Full Entry]

Split your Browser Window like in emacs, or vim

Recently, I was looking at source code over the internet and had trouble looking at the entire code in one window without having to create another just to see the entire content of that page.

Hoping there was a “split window” add-on for Firefox out there similar to emacs or vim, I began my search and found Split Browser. Split Browser allows you to split your browser window however you like. You can split your browser in order to see more of the current page without the need of having to open a new window which I thought was great. A preview of it in action is below.


Read more »

C++ Recursion – Factorial

January 26th, 2010 | No Comments | Posted in C++ by Diego | - [Full Entry]

Creating a factorial function


Below is an example of how to calculate the factorial of n. This tutorial expects you to understand the following:

  1. C++ Recursion
  2. C++ Recursion – Summation
  3. Example:

    factorial(5);

    Result:

    120

    Iterative version of a function that calculates the factorial


    To understand how to calculate the factorial using recursion, let’s write a simple algorithm that will do it for us using iteration.

    int factorial(int n) {

         //Initial value for the final value is 1
         int factorial = 1;
         
         for ( int i = 2; i < = n; i++ ) {
              factorial = factorial * n;
         }

         return factorial;
    }

    Read more »

Google Chrome OS revealed

November 19th, 2009 | 5 Comments | Posted in Tech News by Diego | - [Full Entry]

Google Chrome OS was finally revealed this morning. So what is it? Google Chrome OS is focused on making your OS revolve around an internet browser since we spend 90% of our time on the internet anyway. With that, all your files, music, applications, and whatnot will be accessed using the internet, thus eliminating the need to store anything on your PC. So where is everything going to be? In the cloud.

Impressions on Google Chrome OS

I don’t know about this, but I certainly don’t have access to a reliable internet connection 24/7 with my mobile laptop. Does that mean I wouldn’t have any access to any of my files when I’m on the road? Then, this would be useless for me in that situation.

Also, so far it only seems like its going to support a very small number of applications since its geared towards people who only use a computer for accessing the internet. What about developers? I use a lot of tools to program in various languages and platforms. Will this be suitable for me? So far, it looks like it won’t.

Either way, it looks quite interesting naturally being a Google product, but doesn’t necessarily look like something I’d switch over to yet. Maybe once it matures and comes closer to beta, I’ll probably be interested, but until they stick with having everything in the cloud and having a very specific functionality, I just don’t know.

Download Google Chrome OS Virtual Machine

Update: Believe it or not, you can actually download a build of the disk image. Check out Download the Google Chrome OS Virtual Machine from Geeklad.


Read more »

Google Wave Invitation Winners

November 16th, 2009 | 2 Comments | Posted in Blog by Diego | - [Full Entry]

gwaveRemember the Google Wave Invitations post? Well, people asked, and 7 lucky winners will get an invitation! (I randomly picked 7 people using a random number generator).

Congratulations!!!


C++ Recursion – Summation

November 13th, 2009 | No Comments | Posted in C++ by Diego | - [Full Entry]

Creating a sum function


Below is an example of how to calculate the total of a sequence of numbers. In this case we will be calculating the sum of 10 + 9 + … + 2 + 1

Example:

sum(10);

Result:

55

Iterative version of a function that calculates the summation


To understand how to calculate the sum using recursion, let’s write a simple algorithm that will do it for us using iteration.

//Our initial total is zero
int total = 0;

//We want the sum from 1 + 2 + … + 9 + 10
int n = 10;

//The following for loop will calculate the summation from 1 – n
for ( int i = 1; i < = n; i++ ) {
     total = total + i;
}

Read more »

Google Wave Invitations

November 13th, 2009 | 15 Comments | Posted in Blog, Miscellaneous by Diego | - [Full Entry]

gwaveI recently got invited to the invite-only Google Wave and fortunately for you, I also got invitations to give out to you. But…wait a minute? What is Google Wave?

What is Google Wave?

According to their About Google Wave, Google Wave is an online tool for real-time communication and collaboration. It can be used to discuss and collaborate texts, photos, videos, maps, and so much more.

ss2

Google Wave Invitations

So how do I get one? Post a comment on why you should have an invitation in the comments and make sure you post your e-mail address correctly. Then, in a day or so, I’ll announce who gets an invitation. Simple as that.
Read more »

Page 1 of 2512345»...Last »