All posts by

Apache2 Setup

sudo apt-get install apache2

sudo apt-get install php5

sudo apt-get install libapache2-mod-php5

sudo /etc/init.d/apache2 restart

sudo apt-get install mysql-server mysql-client # u/p root/root

sudo apt-get install vim # ;-)

sudo apt-get install php-pear
sudo apt-get install php5-dev
sudo apt-get install php5-curl
sudo pecl i pecl_http

cd /etc/php5/apache2
add extension to php.ini
sudo apachectl restart

sudo apt-get install phpunit

# Add Virtual Host

Code Camp Notes

# Software Craftsmanship

## Things to look at:

* Utah Software Craftsmanship Group
* Code Katas
* Apprenticeship Patterns Book

Different language communities can be considered as Dojos, you can expert in one and cross pollinate so to speak.

# HTML5

## Things to look at:

* Modernizer
* Protocol Registers
* Stream API
* getUserMedia (Webcams, Audio, Etc)

# Distributed Systems

## Fallacies of Distributed Systems

* The network is reliable
* Latency is zero
* Bandwidth is infinite
* The network is homogeneous

## Things to look at:

* Udi Dahan
* [http://goo.gl/kyDAE](Cap Theorem)
* Eventual Consistency is sexy.
* /h/a/r/r/y/p/o/t/cache.json
* CQRS, Event Sourcing
* Messaging is hot.

# RIAS and Node.JS

## Things to look at:

* Yahoo Design Patterns
* Pattern Tap
* Patternry
* UIPatterns

Sustainability In Computer Science

This video and talk is top notch.

Content Warning: There is a bit of vulgarity in his more honest parts.

View Partials In Kohana 3

To create view partials within a Kohana view just use this bit of code..

<?php include(Kohana::find_file('views', 'path/to/partial')); ?>

Remove jQuery From Your WordPress Theme

New post on the JavaScript Blog, get it while its hot: The JavaScript Blog

Kohana 3 Routes and Request Class

Kohana 3 Routes and Requests

Kohana sports a powerful and lean Request class. The most useful I’ve seen of any PHP framework, it essentially takes a regular expression and routes it to the appropriate controller, directory, action, or other value using keys, this allows for some robust URLs and applications. Lets take a look at how to mimic Basecamp style URL’s in Kohana minus the sub domain. If there is interest I’ll add that in a later article, just let me know in the comments, yeah?

Basecamp Project Style Route

Route::set('projects', 'projects/
(/(/(/)))', array(
    'project_id' => '\d+'
  ))->defaults(array(
    'controller' => 'log',
    'action' => 'index',
));

This route will take a URL like projects/1/, and load up the Controller_Log.php file and fire the action_index. In fact anything after projects/1/ will be fired like the default route. So this allows you to use, projects/1/todos/add and fire the action_add in the Controller_Todos.php file. Even better if you want to scope your todos to the project referenced in the URL, you can set the project in the controllers before() method:

public function before()
	{
		parent::before();

		$property = ORM::factory('project')
						->where('id','=', $this->request->param('property_id'))
						->where('user_id', '=', $this->user->id)
						->find();

		if($property->loaded())
		{
			$this->property = $property;
			$this->template->property = $property;
		}
		else
		{
                        // Couldn't find the project
			$this->request->redirect('/');
		}

	}

Notice I grabbing the parameter from the URL using the param() method in the Request class using the specified key in the route.


$this->request->param('project_id');

You could grab any parameter this way:


$this->request->param('id');

Using this method in your actions allows you to never pass parameters to your functions again, thus you can change the order of your routes and the site will function the exact same way.

Kohana Framework

Real-time Syncing Your iPhone With Google

One of my good friends, Will Robertson showed me a trick buried deep inside of Google’s documentation. You can use real time syncing across all your Google products using Exchange.

I add a calendar event on my phone, instantly it is added to my iPad, iPhone, and both computers (work and home). I get this real-time effect for Calendars, Email, and Contacts.

Skip IMAP, use exchange.

http://www.google.com/support/mobile/bin/answer.py?answer=138740&topic=14252

Rubik – A Pleasant Suprise

Last night I had the opportunity to go see a band I have always wanted to see, mewithoutYou. I was able to get on the guest list because one of my friends, Trent Davis, was doing a photo shoot with them. One of the warm up bands was called Rubik and absolutely blew me away; it was like Sigur Ros meets Modest Mouse. An entertaining display of different instruments, brass, percussion, guitar, and beautiful vocals, Rubik is a band I would really recommend.

It is funny how you almost always walk out of a concert, with a different band burned into your head then the band you intended to see.

A Thanks To David Archuleta

The Story

A few years ago I was blessed to record two songs that I had written with David Archuleta. The first Angels in The Alleyway was primarily written about my struggles with the mental illness I’ve dealt with for several years. The fear I think we all feel that we’ve lost our mind, are somehow different, and have let everyone including ourselves and God down.  The end of the song attempts to portray the hope & salvation I know and feel when I turn to God. His supporting me, and my realizing it.

The second, The Most Beautiful Part About This Is… was written for an uncle of mine who was diagnosed with terminal illness at a relatively young age. The song is about the faith and inspiration I felt and witnessed from him, and his entire family. I am still amazed every time I think about them. David was kind enough to record these songs with me. This song, in particular, has been a huge strength to my family, or at least I like to think so.

A huge thanks…

I can’t thank David enough for the incredible impact his recording these songs have had in my life and my family’s. He is truly a gifted man and everything you perceive about him, you know that wholesome, good, humble person; in my opinion and experience is entirely true. I can’t think of a better person to have the success that David has since American Idol, I have never even heard of someone handling such fame and growth with such grace and humility; especially at such a young age. I can’t give David enough props for that and all the other things I’ve been able to see. I hope this post isn’t perceived as a plug for the songs I’ve done with him, as  you can see that aren’t linked anywhere on this site. This is just me sincerely expressing my gratitude.

Assets – A PHP 5 Asset Combining Class

Assets takes multiple JavaScript or CSS files and combines them into one.

So mootools.js, drag.js, slider.js, and tips.js can become script.php?load=mootools,drag,slider,tips.

Rather then four script tags, you have one. I recently published this Open Source PHP class to combine different text files into one in real time. The benefit here is JavaScript management and page loading speed. Making a bunch of HTTP requests to external JavaScript will slow down the page load, if you don’t believe me just open your website and profile it using the WebKit Inspector.

Documentation

There are two ways to really use Assets.

Automatic

Assets::factory()->get()->render();

This method implies that you are calling the page with a parameter of “load” in the URL. The file names need to be separated by commas. Example: script.php?load=mootools,drag,slider,tips

Manual

Assets:factory()->add('file.js')->add('file2.js')->render();

This methods adds each file individually passed in using PHP. It is worth noting that you can also pass and array of file names into the add() method.

Notes

If you prefer to use the new Assets that is completely OK. You don’t have to use the factory() method. Also, I am open to feedback; in fact that’s half the reason I release my code for free is for people to tear it up and tell me what to improve.

Download

Assets is on GitHub