Job Hunters Trailer!

Here’s the trailer to a web series called Job Hunters that I got to be a part of. The series premieres April 1st at the Emerald City Comicon.

Dynamic getters and setters with php

I’ve been using Magento pretty heavily for almost a year now and I’ve come to know it fairly well, thanks mostly to the guys at goSolid who mastered it by means unknown to me. Documentation for Magento ranges from near useless to pretty thorough, but the Magento forums look like some kind of developer purgatory, rife with poor souls asking “Has anyone figured this out yet?!” Regardless, one of the features that I really enjoy about it is how any attributes within a class are, by default, assigned get and set methods. Good object design entails not making your object attributes directly accessible from outside of the class, so making functions to get and set those attributes is a good idea. I find it very tedious to craft these methods myself every time I make a custom class because for every attribute you add you need to write 2 functions. Thus, I present to you an abstract class that will create getters and setters dynamically

class SM_Abstract{

	public function __call($method, $params){
		//get all the attributes from this class and store them in an array
		$attributes = get_class_vars(get_class($this));
		
		//check if the first 3 characters of $method = "get" or "set"
		$request = substr($method, 0, 3);
		
		//the variable that was requested. ex. Cars if method was getCars
		$varRequested = substr($method, 3);
		
		//check to see that the requested variable is in our list of varables
		$varInArray = false;
		foreach($attributes as $key=>$value){
			if(strcasecmp($varRequested, $key) == 0){
				$varInArray = true;
				$attribute = $key; //set the matched attribute
			}
		}
		
		if($request != 'get' && $request !='set' || !$varInArray){
			echo "call to undefined method $method";
		}else{			
			switch($request){
				case('get'):
					return $this->{$attribute};
				case('set'):
					$this->{$attribute} = $params[0];	
					return $this;
			}	
		}
	}	
}

This class can be inherited from so there won’t be any need to make standard getters and setters. Thanks to polymorphism, any of these dynamically generated methods can be overridden.

New Partybox Site

I just finished an overhaul of the site for my friends’ band Partybox


Go to the page and like them on Facebook to download their whole album free!

Smarter Phone

For about a year I’ve been on my mom’s T-Mobile family plan after we realized she had an unused line on it. I’ve enjoyed basically a free phone since my monthly bill was eliminated and her costs didn’t change. Recently, she let me know that the rest of the family had migrated to another plan and that my free ride was being phased out. Because I’d been spoiled and I barely use 100 minutes in a month, I seriously balked at the idea of forking over, at a bare minimum, $30 a month for a purportedly essential item.

In an effort to maintain my title as a cheap bastard I followed this guide and wound up with an LG Optimus T, GrooVe IP, and a T-mobile prepaid sim. All told I spent $103 for a wifi only smartphone that will have no recurring costs at all. The advantages of this system are obvious and the disadvantages are overblown. First, when in transit from A to B, I am most often on a bicycle or Motorcycle which inhibits talking on the phone anyway. Second, the overwhelming majority of calls that I make and receive are non-urgent. It is not worth a recurring monthly fee simply to let someone know right away that I can meet them for a beer. Third, emergency phone calls could still be made with prepaid minutes.

Nonetheless, I have been met with a certain smug disbelief at my derision of smart phone culture and unwillingness to get with the times. Several friends have been so bold as to suggest that their use of smart phones and data on the fly is necessary and that going back to life without it would be excruciating. This is a poisonous misunderstanding of what constitutes a need and a luxury as well as a denial of living in a world already saturated with too much information to process. To be frank, most are impressed with Carlo’s strategy that I’ve adopted (I even have a friend that has done the same well before me), but the lack of critical thinking over why one “needs” a cell phone, or even a landline, is disturbing and indicative of a broader lack of introspection on topics such as organic food culture, faith healing vs. traditional medicine, and the consequences of being constantly wired into an ever-evolving information system. The horrible irony is that the wealth of information at our fingertips makes acquiring an insightful position on any given topic child’s play, yet being dialed in around the clock is more often used to send a nigh forgotten high school acquaintance a birthday greeting.

I think my new phone is cool and suits my needs, but I would be naive to say that it’s perfectly free. The cost of having a map at your fingertips negatively affects your sense of direction, googling any trivial question suppresses filtering information that is, well, trivial, and dulls researching skills. How often has someone offered insight into a topic and simply said “I read online that…” When someone cites an actual source, I am challenged by their increased credibility. To summarize, attention is a finite resource which deserves to be administered judiciously and with purpose and vigor. Smart phones and instant information, while wildly convenient and remarkable, have the insidious side effect of mollifying critical thinking, dismantling focus, and obscuring what is necessary. In a culture such as ours where consumerism plays such a powerful role in our lives, it is mystifying that such a potential for enrichment has become yet another vehicle for over-consumption.

Speaking of over-consumption, I ate a donut as large as 6 donuts in less than 80 seconds on Saturday. Couldn’t really incorporate that in from the soapbox.

Attack the Block

Last night Hillary scored still more free movie passes, this time to Attack the Block. All we knew going in was that the movie involved inner city street kids versus aliens from outer space. Now, it’s not difficult to sell me on a movie, so I was game as soon as I knew there were aliens involved, but had someone told me that each kid in this movie had crazy South London accents I would have been genuinely stoked from the outset. Each word out of these kids’ mouths sounded as if they learned pronunciation from Lady Sovereign and Dizzee Rascal then injected all sorts of bastardized inflections and slang wherever the need arose. Needless to say there are some new catch phrases that I hope to integrate into my vocabulary. Believe.
The film is about a rag-tag group of teenagers who, while mugging a nurse, get caught up in killing a chimp sized alien that falls from the sky and destroys a parked Volvo. I know this sounds boring, but please bear with me. Turns out that the first alien was just one of many that soon fall from the sky. Having 86’d the first one within the first 10 minutes of the movie, the kids all decide to kill some more space gremlins just for fun. After gearing up with swords, bats, machetes and firecrackers and hopping on their bicycles, they quickly discover that this second wave of aliens are of a larger, more dangerous variety. The remainder of the movie basically involves the children being chased into their apartment building and then dying a series of excruciatingly gruesome deaths. So if I had to summarize this movie in a sentence, it’d be “cockney Goonies plus aliens and gore.” Truth.