The Raspberry Pi Works

My Raspberry Pi finally arrived yesterday, after what seemed like an eternity of waiting. I ordered it October 24. It was shipped November 20 and arrived on my doorstep November 29. That’s over a month! I had a few hours to play around with it. The first thing I did was placed the Raspberry Pi inside an Adafruit Rainbow Pibow enclosure that I’ve ordered several weeks back. It looks amazing. Here’s it is.

Once it was inside the Pibow enclosure, I downloaded the Raspberry image called Raspbian Wheezy. I loaded it to an old 4GB SD card that originally came with my Nikon D90 camera. Once the image was loaded, I inserted the SD card, connected a USB keyboard, a USB mouse, and a HDMI cable.

On a side note, I’m currently using a 5v 750ma USB adapter, which I know is sufficient, but the Raspberry Pi needs more ooomp with multiple USB devices connected to it. They recommend that you have at least a 5v 1amp power adapter.

Finally, I powered the Raspberry Pi. A blank screen! Not good. It turned out to be just a resolution issue. I ended up plugging my Raspberry Pi to my old TV, via a RCA composite cable. It worked, although a good portion of the screen was clipped. I started the GUI, then accessed the Terminal and changed the screen resolution from there.

I found this page with instructions how to change Raspberry Pi to 1680×1050 resolution.

Edit the /boot/config.txt file.

sudo nano /boot/config.txt

Add the following code to the end of the file. 58 is for screens with a 1680×1050 resolution.



sudo reboot

My monitor works! All 1680×1050 pixels. I ran an update next by issuing the following commands.

sudo apt-get update
sudo apt-get upgrade

This process takes a good 20 minutes. Finally, I installed Apache.

sudo apt-get install apache2

Once installed. I checked if the web server works. It does.

Generate Random Characters

This article will show you how to generate random characters in PHP. Random characters are useful in a variety of ways, such as generating random passwords or filenames. The command that we are going to use to generate random characters is a function called mt_rand(). In addition, we will specify which characters we want to include in our random key.

I’ve decided to omit vowels, as well as the number zero, to make the random characters much more unpredictable. I’ve added some special characters in the mix, just for the fun of it. If you don’t want the special characters, you can just take them out. Here’s our list.

// List of random characters
$characters = array(

Next, we will create a variable array to store our random key. We will run a loop 7 times, to generate a key that is 7 characters long. Inside the loop, we count the number of characters on our list, and generate a key, one by one, until the loop is done. Finally, we reveal our random key on the screen using the echo command. Just reload the page to generate a different key.

// Assign an array for our random key
$keys = array();
// generate random key 7 times
while(count($keys) < 7) :
	// count($characters)
	$x = mt_rand(0, count($characters)-1);
	if(!in_array($x, $keys)) :
		$keys[] = $x;
foreach($keys as $key) :
	$random_chars .= $characters[$key];
// display random key
echo $random_chars;


2012 Mac Mini

About a month ago, I bought a Mac Mini at the Apple store in San Francisco. I remember it very well, because it was October 31, which happens to be Halloween. If that wasn’t enough, it was also the day of the victory parade of the World Champions San Francisco Giants. So, I headed out to the Apple store, at the corner of Ellis and Stockton after watching the last motorcade. I picked up the new 2012 Mac Mini, and carried it home, inside an Apple plastic bag.

The new Mac Mini is twice as fast versus its predecessor. It’s powered by a 2.3GHz quad-core Intel Core i7 (Turbo Boost up to 3.3GHz) processor with 6MB L3 cache. It comes with a 1TB (5400-rpm) hard drive, and 4GB RAM. I upgraded the memory to 8GB, which I thought was a good decision at the time. The Mac Mini also comes with a Thunderbolt port, four USB 3.0 ports, a Firewire 800 port, a Gigabit Ethernet port, and a 802.11n Wi-Fi wireless adapter.

The only gripe I have with the Mac Mini is, my widescreen monitor, a HP w2207h HDMI flat screen, doesn’t quite work quite well with the Mac Mini. When connected using a straight HDMI to HDMI cable, the screen would blink or flash every second. I think it’s a display driver issue with this HP monitor. In the end, I had to get a Mini DisplayPort to DVI Adapter, a DVI to HDMI cable, to connect my Mac Mini to the HP monitor. It’s quite a convoluted way to connect to a monitor, if you ask me, but it works. I tried using a Mini DisplayPort to VGA connection, but it’s not quite as sharp.

After a month, I can honestly say, I love my Mac Mini equally as much as my Linux desktop.

Sorting Arrays

I was working on a client project last night. I had to sort a multidimensional array. I came across a neat PHP function called asort. In the end, I had to use arsort instead of asort to get a reverse sort order. This short article will show you how to sort arrays in normal and reverse order. Here’s our array.

$animals = array("a" => "Giraffe", "b" => "Elephant", "c" => "Lion");

We will sort the array using the asort function. We print the array to view the results.


The asort output is:

Array ( [b] => Elephant [a] => Giraffe [c] => Lion )

The arsort (reverse order) output is:

Array ( [c] => Lion [a] => Giraffe [b] => Elephant )

Google Web Fonts Plugin

I’m releasing a WordPress plugin called “Web Fonts.” This plugin takes advantage of the free and open-source Google Web Fonts. If you’re not familiar with Google Web Fonts, it’s a group of fonts that allows designers to customize the looks of their blogs or websites using hundreds of exotic fonts. With a gaggle of external fonts available for use, “Web Fonts” can transform the overall design of a website.

Install and Configure

  1. Upload the “webfonts” folder to the WordPress plugins folder.
  2. Activate the “Web Fonts” plugin from the “Dashboard > Plugins > Installed Plugins.”
  3. Configure stylesheet link and CSS from the “Dashboard > Settings > Web Fonts.”
  4. If you want multiple fonts, just add a second stylesheet link and additional CSS.
  5. “Update Options” to save.


Version 1.1

  • Moved to “Appearance > Web Fonts”
  • Added some documentation