a picture is worth more then 300 words

My very good friend Steve Berg, challenged me to find a pre-release of Judas Priest’s new album,  Nostradamus, in under an hour.  The wager was simple, a 300 word or more post on the losers blog in honor of the winner. After searching high and low on the underside of the web, my usual music download locations were fruitless. I accept my lose Steve. Epic records has thwarted my efforts… this time.

Steve, we both agree that pictures are worth more then words, so I present the following picture in your honor.

LOLz!

Mac IN my PC – LEO4VMWARE

If you have been following my blog, you an read that my PC died, and for a moment, I installed OS X Leopard on it. Well, my new drive from western digital arrived, and I am back working in Vista now (I’m not sure if that is a good thing or not!).

Parallels makes it easy to run Windows inside of Mac, but I haven’t found a good way to run Mac inside of windows. Previously, I used a project called “LEO4ALL” to install Leopard on my PC. A little bit of Googeling around after I installed Vista, I found “LEO4VMWARE

LEO4VMWARE is a pre-packaged and running distribution of OS X Leopard for the vmware, a virtual machine software. You can download the vmware payer here http://vmware.com/download/player.

Side Note: I’m going to be honest here, you are going to want to get vmware workstation, so you can tweak the performance settings. If you are looking at virtually putting OS X on your pc, you have enough smarts to download vmware desktop for free, and then find a serial number.

What this all means is all you have to do is download LEO4VMWARE and install vmware and you are off and running!

I have gotten it to work (not well, but it worked) on a pentium 4 3 ghz windows xp computer with 3 gigs of ram. On my intel core 2 duo, 3ghz, 4 gigs of ram running vista to work great! Check out the picture below.

Getting networking can be tricky, so read the posts on how to do it here

Downloads for LEO4VMWARE can be found by going here http://www.mediafire.com/?ggkr1obgrft, downloading the zip and looking at the links inside. I personally suggest buying a month of rapid share and downloading for there. LEO4VMWARE is about 3 gigs, and rapidshare offers amazing download speeds.

Mac on my PC – LEO4ALL

In my last blog post I talked about how my computer had a system drive failure. I am waiting for Western Digital to send me a new 10,000 rpm drive to replace the broken one, so in the meantime, I thought I would screw around with trying to put Mac OS X on my desktop.

My friend Luis Majano is a great software developer and swears by his Mac Book Pro. At work I run Windows XP, at home it Windows Vista. I have Ubuntu on my laptop and run CentOS on my web servers, so I’m not a die hard about one OS or another, they all have their place.

I love Linux operating systems, so learning from Luis that Mac OS X sits on top of BSD made me more interested in switching (Apple don’t tell you that in their cute commercials). The price of Mac computers is insane though, and not something I’m blindly going to jump into.

So to the point… a broken PC a spare harddrive, and the want to try Mac OS X, whats a geek to do? A few google searches, and a torrent download later, I had in hand, Leo4All.

Leo4All is an awesome distribution of the hacked apple OS to run on none genuine apple hardware. They even have a great wiki (http://osx86leo4all.wikidot.com)

I dropped the DVD into my drive, booted up and a few minutes later I was in the OS X installer. Formatted the drive into an apple format, clicked install and 10 minutes later I was working inside of OS X! everything was there, even time machine! check out the screen shot below…

I had trouble with my network card, as OS X doesnt seem to like a lot of on-mother-board devices. I fixed that by powering down, and installing an old pci NIC. Booted back up and it was there!

I had no audio, but after a few minutes of googeling around, and following likes from the Leo4All wiki, I had it going.

I still havent had any luck getting my dual monitors to work. OS X doesnt seem to like nVidia cards with 512 megs of ram. Oh well, one monitor is fine with me for now.

The USB ports work, and recognize my iPod and iPhone just fine.

So it looks like I’m set. If the experience goes well, who knows, I just might become a switcher! If you know of some sweet mac software I need to try out, let me know.

The reason I back up my data

Yesterday was one of those days. I woke up and turned on my Vista powered computer and I saw a blue screen of death staring back at me. I got an uneasy feeling in my stomach, and I knew this wasn’t going to be pretty.

I rebooted the machine and was greeted with a no “no system disk found” error. Awesome.

After about 20 minutes messing around in the BIOS, switching drives, cables and power around, I concluded that the Boot drive of my computer was dead. The BIOS wouldn’t even see it at all. DEAD. KAPUT. FIN.

The drive that died was a Western Digital Raptor, 10000 RPM, 74 GB drive. It’s an expensive drive to replace so I’m glad is was covered under warranty.

For most people, losing a hard drive is a devastating experience. For me, its an inconvenience.

A little background. I build this computer in december of 2006 in preparation for windows vista. All the drives are SATA, and the system was designed with data back up and redundancy in mind, I’ve blogged about it has save my ass before.

The redundancy starts with the machines architecture:

The boot drive (C:) is a small, and fast drive. The operating system and applications are installed on this drive. No working data or documents are ever stored on this drive.

For data storage, I use 2 large drives mirrored together using raid 1. This means that the computer only sees one drive (D:), but all activity happens to both drives. If one of the drives crashes, the other one is there as an instant back up with no loss. Its an expensive solution backup, but is critical in my opinion. All data is stored here. I have the systems users file (my documents, etc) set to use this drive.

External Back Up Drive 1 (X:) uses syncback to pull data from the Data drive (D:) every night at 3am, creating a recovery in case files get deleted from the data drive (D:) during the work day.

External Back Up Drive 2 (Y:) uses syncback to pull data from the Data drive (D:) every third night at 5am. This acts as a recovery drive for D: and X:. Drive X: also backs up my iTunes Catalog every night

To top is all off, I use a service called carbonite to create a real time back up of my data over the internet. At $50 a year, its worth it. If my house burns down, or my equipment is stolen, no amount of drives will keep my data save. Off site is the way to go.

So yes, losing the system drive (C:) means I will have to reinstall the Operating System, and my applications, but at the same time, I haven’t lost anything except the time with will take to get things up and running again.

In the mean time I’m going to try and get apple OS X Leopard running on my PC!

Improving CodeIgniters View Handling

codeigniter logo

Please be aware that I no longer use this method. Please follow this link to see how I handle layout with Codeigniter

If you have ever worked with an MVC framework for web developent, you know that the “V” stands for “view”.

At work, I program in coldfusion, and use the coldbox framework, and I love it. At home, I write PHP code, with the codeigniter framework.

I love codeigniter, but I think that its biggest weakness is the view handeling, all thought codeigniter had taken strides to improve it. At the time of writing this, codeigniter is at version 1.6.1, and allows multiple views to be loaded at one time.

example:

<?php
 
class Page extends Controller {
 
function index()
 {
 $data['page_title'] = 'Your title';
 $this->load->view('header');
 $this->load->view('menu');
 $this->load->view('content', $data);
 $this->load->view('footer');
 }
 
}
 ?>

This is great with one exception, codeigniter simple builds a stack of the view results, appending them to each other.

This means that in header.php, loaded at the start of the view sequence, we would have to opening tags, such as <body>, and then in the last view, footer, we have to close the tags we opened in header.php, in this case, </body>

I don’t know about you, but opening tags in open file, and depending on another file to close them is not a good practice. Using a MVC setup and then doing something like this is very counter intuitive.

To fix this, codeigniter needs to support layouts, as well as views.

A layout is a file that contains the framework for a page, and the views are included and rendered inside the layout. basically filling out the content of the page. This also leaves your code the ability to be more flexible. Your views are pluggable components that don’t care about the layout at all.

One of the reasons I love open source software is the fact that the community will fix weaknesses is the software. Looking at the codeigniter wiki, I came across the “view object” (http://codeigniter.com/wiki/View_Object/)

The view object is a great solution for adding layouts to the codeigniter framework.
Here is a code sample of how to use the view object in a controller:

$this->load->library('view');         // or autoload
 
$this->view->layout = 'admin/layout';
 
$this->view->data(array(              // set the view data
 'privileges' => $privileges,
 'catcode'    => -1,
 'page'       => $page,
 ));
 
$this->view->load(array(             // load the page partials
 'header'     => 'header',
 'menu'       => 'menu',
 'content'    => 'admin/'.$page,
 'footer'     => 'footer',
 ));
 
$this->view->render();               // create the view or

inside the layout file (admin/layout.php)

<? $header->render(); ?>
 
<body>
 <? $menu->render(); ?>
 <div id="mainContent">
 <? $content->render(); ?>
 </div>
 </body>
 
<? $footer->render(); ?>

You can see that the layout file contains the framework of the page, freeing up the views to be individual pluggable items that can be used across your codeigniter application.

I hope that the codeigniter team takes note of the view object and adds it to the core for codeignier 1.7 or maybe even sooner!