Fresh Meat

April 8th, 2009

We’ve updated our site. The look is much more reflective of the values we have at Hacked: Code, Death Metal, and Horror. We’ve done a few things to keep the new design both appealing and usable. The combined focus of pretty (kinda) and readable will make all of you cower in fear.

We’ve implemented the famous sIFR technique to display headings in non-standard web fonts. Windows, Mac, and Linux do very few things the same way. The one thing they all do the same though, is render Serif, Sans-Serif, and monospaced fonts the same. While we’ve gone with a monospaced font for the content of this site (a homage to coders everywhere), it was our feeling that the headings should be much different. Keeping with the grungy theme of the vertical logo, we used the same font for the h2 and h3 headings.

We’ve also kept the base font-size at the default level. There’s a great article about this here, with a lot of reasoning for not altering the base font size. The takeaway for us: most screens aren’t that small anymore and small text is just too hard to read.

So, we’re all new. We hope you like it. You’d better …

Dual Boot OS X 10.5 and Ubuntu 8.10

March 27th, 2009

First of all, this isn’t easy. Dual booting Ubuntu and OS X requires a very specific set of instructions. There is no quick way around this, so get a cup of coffee, and settle down. You will be working on this for the next couple of hours.

With the disclaimer out of the way, I can say that I’m running Ubuntu 8.10 (Intrepid) on my 24″ iMac, alongside the typical OS X 10.5 (Leopard) software that comes with the machine. The results are stunning. I have never seen Linux look so amazing, as it does on the machine I’m writing this tutorial on. If you’ve got some patience, I highly recommend performing this.

So, I’ll presume that you’re already running OS X (Leopard) on the existing Apple computer. The first thing you’ll need to do, is to use the Bootcamp Assistant Utility to set aside some hard-drive space for Linux. This is a trivial task, but make sure you leave enough space for Ubuntu to run comfortably, as well as double your RAM amount (which will be used as swap space by Ubuntu).

Bootcamp

In case that’s confusing, the amount to give Ubuntu = Ubuntu Disk Space + ( 2 * RAM)

Once you’ve done that, you’ll be prompted to start the assisted install of windows. DO NOT ALLOW THIS. Kindly click the ‘Finish Later’ button, and close the program.

The next thing  you’ll need to do, is install rEFIt. rEFIt modifies the boot setup for the Mac, to allow for multiple boot scenarios. This is a very necessary step, before trying to install Ubuntu on the freshly reserved hard-drive space. The install of rEFIt is easy. Mount the image that comes with the download, and run the package. No configuration required ;)

Once you’ve gotten that done, you’ll need to insert the Ubuntu install disk into the CD / DVD drive of your computer, and restart. rEFIt is supposed to recognize the disk on boot, and provide you the option to choose what you want to boot from. This wasn’t the case for me however. So, just to be safe, when you restart your computer, hold down the ‘c’ key as soon as the machine starts back up. This should force the computer to boot from CD, thus allowing you to run the Ubuntu install.

Go through the typical steps to install Ubuntu, until you get to the disk options. Once there, you should be able to click the option to ‘install to the largest continuous free space’. Again, I was not able to do this. I got a bunch of errors when I tried to do this, so I had to setup the Ubuntu partitions manually.

If you don’t need to setup the Ubuntu partitions manually (i.e., the i’nstall to the largest continuous free space’ option works for you), skip past the next instructions.

If you do need to setup the Ubuntu partitions manually,  here’s how to do it:

  1. Select the manual option instead of the ‘install to the largest continuous free space’ option.
  2. Select the Free Space partition of the hard drive.
  3. Create one partion, equal to twice the amount of RAM in your computer, and set it’s type to Swap.
  4. Select the newly modified Free Space partition of the hard drive.
  5. Create one partition, equal to the remaining free space,
  6. Select the option to format the drive
  7. Set the filesystem to ext3.

Click ‘Forward’ to proceed to the last part of the install. Once here, you’ll need to ‘Advanced’ button to specify where GRUB will be loaded. If you were able to use the ‘install to the largest continuous free space’ option, then select /dev/sda3, if you had to do a manual partition setup, then select /dev/sda4.

Click Advanced

Finally, let the install proceed. Ubuntu usually takes about an hour to install, so go mow the yard or something. Once the install is done, the CD will be ejected. You’ll see a prompt to remove the disk, and press enter to complete the install. Do this.

When the computer reboots, you should see the rEFIt screen. This screen will have a few options, but one of them (a small option in the lower left of the icons) will be the partition tool. Run that option. A quick script will run, and you’ll be prompted to continue. Confirm this option. Afterwards, shutdown the computer. Do not restart the computer. You need to specifically shut it down.

rEFIt

Finally, turn the computer back on. You’ve done it. Hoo-ray.

I’d like to take the time to thank the MactelSupportTeam for the instructions they provided at their own site :

https://help.ubuntu.com/community/MactelSupportTeam/AppleIntelInstallation

They’ve provided a number of boot scenario tutorials that are amazing, and well worth the read.

Repair Broken iPhone Screen

March 10th, 2009

Recently, I had the opportunity (problem) to replace my wife’s iPhone screen. I broke it, by dropping it on our tile floor. the digitizer was completely intact, but the glass covering it was shattered. We were lucky that we were using a clear film protector over the glass, which helped keep everything in place.

At first, I figured I’d use the AppleCare plan we purchased to have the phone replaced / repaired. Apparently, Apple’s AppleCare plan’s do not cover accidental damage. They told us that the phone could be replaced at the subsidized cost ($199.99). As you can imagine, I was a bit upset with Apple.

Since I’m a technical guy, I figured I’d find a way to repair the screen myself. I found a site (pdaparts.com) that sells replacement screens for $49.99. That’s way cheaper than what I was expecting, so why not? I’ve replaced MacBook screens before, so how hard could the iPhone be?

The hardest thing ever. Read the rest of this entry »

Decorator Pattern

March 9th, 2009

In our ongoing series about design patterns, we introduce the Decorator Pattern. The decorator pattern serves to add specific functionality to an existing class. The classic example of this is in GUI programming, when a widget needs a border, or graphic surrounding it. Not using the Decorator Pattern, one might just subclass out the widget class and add a border to the subclassed widget. This becomes more difficult however, when there are multiple classes of widgets. This becomes almost impossible when dealing with a collection of widgets.

So, enter the Decorator Pattern. Read the rest of this entry »

Observer Pattern

March 3rd, 2009

One of my favorite design patterns, is the Observer Pattern. The Observer Pattern is used far more often then you might realize. The Observer Pattern is quintessential, for instance, in most GUI applications. Most applications that respond to key strokes, mouse clicks, or network updates use Observer Pattern. The idea, is that some object in the application is observable, and it has other objects that observe it.

It’s a lot like a bunch of soldiers waiting for the order to charge. The general is observable, and the soldiers are observers. When the general gives an order, the soldiers react in a way appropriate to the order. This is the essence of the Observer Pattern. Here’s the class diagram of the situation : Read the rest of this entry »

Factory Pattern

March 1st, 2009

In following the theme of design patterns we’re starting this site off with, we’re talking about the Factory Pattern here. The Factory Pattern, true to it’s name, acts as a factory to produce objects depending on the parameters provided to it.

A common example of this are configuration objects. Suppose you’ve setup a configuration for you’re application to use an XML configuration file to run. Now, let’s say for some unknown reason, you need to use an INI file for configuration. Or, let’s say that today you’re using MySQL for database storage, but tomorrow, you might be forced to use Oracle.

Having to find where you create the instances of classes could be difficult, or maybe even impossible. The solution to this dilemma, is to use factory pattern to produce objects where any future ambiguity might cause a disaster.

Typically, the way a factory is implemented is to implement some sort of class that acts as a quasi-gateway to the object that’s needed. To keep things simple, we’ll assume we’re trying to get a database object and we need to not worry about the actual implementation of the database Read the rest of this entry »

Singleton Pattern

March 1st, 2009

One of the things I see all the time with developers, especially PHP ones, is a complete lack of understanding for basic computer science principles. Key among those principles missing from many programmers, are design patterns. While it could be said that some folks use design patterns far too much, most software guys / gals (especially freelancers) don’t use them nearly enough.

The idea behind design patterns, is to make routine the typical problems encountered by most software development. It’s likely that any problem get stuck in when trying to write the next biggest app in the world, someone already figured out. So, in much the same way that Object Oriented programming lets applications reuse code, Design Patterns help developers reuse algorithms and ideas.

The most basic, and classic design pattern is the Singleton Pattern. The principle, as you might have figured out, is to ensure singularity of an entity. There are some objects that should never be duplicated throughout the life of an application. Great examples of these are database connectors, request dispatchers, registries, etc …

So, at it’s most basic, a singleton is a class. What make it special, is that it’s constructor is not publicly available. Instead, the instance of the class is publicly available through a special method, getInstance. This function handles the acutally getting of the instance, and prevents duplication of the class.

Easy enough, here’s an example in PHP : Read the rest of this entry »