Oh yes. The iPad 2 is here. What you need to know in 100 words or less. It’s thin, it comes with a new dual-core A5 CPU, two colors: black or white, you have choice between AT&T or Verizon, front and rear cameras, a HDMI output, a foldable cover that doubles as a stand, runs on iOS 4.3, and it’s the same price as before. Yea! Now if you need to know the nitty gritty of the new iPad 2, I suggest you visit the Apple website and learn more about it. In the meantime, enjoy the video below.

# Month: March 2011

## Math For Kids

I just created a couple of PHP scripts for my nephew to help him with his math. Actually, any kid or adult can use it. The program performs some basic mathematics such as addition, subtraction, multiplication and division. The numbers and result are totally random. You will get a different set of numbers and result each time. You can play with it as long as you want, and as often as you like.

The result of each equation is hidden when the page is initially loaded. You can click the “Display Answer” link to reveal the answer. Clicking the “New Question” link will generate a different set of random numbers. Navigation is located at the top. You can select: Addition, Subtraction, Multiplication and Division. Give it a try.

Just a couple of other things that I wanted to mention. I’m using Javascript to hide the answers when the documents are initially loaded. The math result is contained inside a hidden div. The div is toggled on or off or displayed or hidden, by simply clicking on a link. The Javascript that I use can be viewed and copied if you look at the source.

In addition, I’m using simple a rand() function to generate a set of numbers. I use basic PHP math operations to perform the math operations. I do a couple of checks in subtraction and division scripts to avoid the following: subtraction which results in negative number, division by zero, and a divisible number, meaning no remainders when performing divisions. The scripts can be easily modified.

### Examples

#### Addition

$a = rand(0, 20); // This generates a random number between 0 and 20. $b = rand(0, 20); // This generates a random number between 0 and 20. $c = $a + $b; // Performs addition |

#### Subtraction

$a = rand(0, 20); // This generates a random number between 0 and 20. $b = rand(0, 20); // This generates a random number between 0 and 20. if ($a>$b) {$c=$a-$b;} else {$c=$b-$a;} // No negative results |

#### Division

$a = rand(2, 100); // This generates a random number between 2 and 100. $b = rand(2, 100); // This generates a random number between 2 and 100. do { $c = $a / $b; } while ($a % $b != 0) // Checks if result is divisible |

It was a fun little project.

## Differences Between CodeIgniter 1.7.2 and 2.0.0

It has been a year since I last touched CodeIgniter. At that time, I was working with version 1.7.2. Wanting to get back into it, I revisited the CodeIgniter website last week, and I learned that there is a new version of CodeIgniter, version 2.0.0. Last year, I created three personal projects that helped me learn how CodeIgniter works, as well as learn how MVC frameworks work in general.

I downloaded the latest version of CodeIgniter hoping that I should be able to move my old projects into the new version of CodeIgniter. Needless to say, the move was unsuccessful. I found out there are some significant changes to how CodeIgniter controllers and models are constructed between version 1.7.2 and 2.0.0. I should mention also, that there was a version in between that was released, version 1.7.3.

Here are the major differences in the way controllers and models are constructed between version 1.7.2 and version 2.0.0. In both cases, I’m using class constructors.

### Version 1.7.2

#### Controllers

class Contact extends Controller { function Contact() { parent::Controller(); } } |

#### Models

class Contact_model extends Model { function Contact_model() { parent::Model(); } } |

### Version 2.0.0

#### Controllers

class Contact extends CI_Controller { function __construct() { parent::__construct(); } } |

Models

class Contact_model extends CI_Model { function __construct() { parent::__contruct(); } } |

I might add, there are other changes I haven’t even mentioned. The biggest change is the removal of PHP 4 support. Version 2.0.0 requires PHP 5.1.6. Scaffolding is deprecated. Plugins have been removed in favor of Helpers, and few more.

## HTML5 Boilerplate

If you’re looking for a rock-solid HTML5 template, check out the HTML5 Boilerplate created by Paul Irish and Divya Manian. Here are more details from their site.

HTML5 Boilerplate is the professional badass’s base HTML/CSS/JS template for a fast, robust and future-proof site.

After more than two years in iterative development, you get the best of the best practices baked in: cross-browser normalization, performance optimizations, even optional features like cross-domain Ajax and Flash. A starter apache .htaccess config file hooks you the eff up with caching rules and preps your site to serve HTML5 video, use @font-face, and get your gzip zipple on.

Boilerplate is not a framework, nor does it prescribe any philosophy of development, it’s just got some tricks to get your project off the ground quickly and right-footed.

Visit and download the HTML5 Boilerplate.