Import * Considered Harmful

Posted by Sean on Jan 27, 2010 under

Something a Java programmer learns first is that there is this big, amazing library already built-in to Java, and you can easily use plenty of useful classes by using an import statement. Possibly the first thing you want to do is pop open a box to prompt your name, or say hello, and thus starts this terrible habit:

import javax.swing.*;

Get the Method Caller in MooTools

Posted by Sean on Jan 19, 2010 under

As I continue to work on my MVC implementation in MooTools, I continue to find new hidden features in MooTools. This weekend, I was adding a view method to the controller, as a shortcut to creating a new View and rendering it. One of the arguments is the view file name, but I also wanted some automagic like CakePHP. It'd be great if the view function could determine the file name based on the function that called it.

Here's what I mean:

var ItemsController = new Class({
	view: function(view_name) {
		if(!view_name) {
			//viewname should default to 'controller/method'
		}
	},
	list: function() {
		$(this).grab(this.view()); // 'items/list'
	}
});

3 Tips When Switching to Python

Posted by Sean on Jan 14, 2010 under

If you write a lot of Javascript or PHP, there are a couple of habits you might be used to that need to change a bit when you switch over to Python.

  1. Accessing a property in a dictionary with a variable
  2. Setting properties on objects with a variable
  3. Using While with a function call

Tablets Will Replace Everything

Posted by Sean on Jan 07, 2010 under ,

Recently, there has been a bit of talk about upcoming tablets like the CrunchPad and the iSlate, and whether we need them, how useful they'll be, or ifthey're only use is browsing the web on the toilet. Many people are of the opinion that we don't need one. Or that only gadget enthusiasts would buy it for couch web browsing. Well, I'll go out and say it: Tablets will replace everything.

Crunchpad prototype