Posted by Mike on May 15th, 2009
If you’re ever been annoyed by VIM throwing your cursor to the left margin when you type “#” in a python file, there’s a simple remedy. It’s the fault of “smartindent” in VIM, which in reality isn’t all that smart. If you want to leave smartindent on but fix the weird hash behavior, [...]
Posted by Mike on Mar 29th, 2009
Just wrapping up a fantastic few days at PyCon Chicago 2009. I went with a group of about 10 guys from AGI, and we managed to have a little bit of fun in between some great mind-enriching talks.
Here are some notes I jotted down while at the conference. It’s a bit overwhelming, but [...]
Posted by Mike on Feb 19th, 2009
I stumbled across “Dammit I’m Mad” by Demetri Martin, a rumored-to-be 224 word palindrome poem.
I was impressed, but needed to check the accuracy of such a statement. So I dialed up a python session.
import re
awesomedrome = """Dammit I’m mad.
Evil is a deed as I live.
God, am I reviled? I rise, my bed [...]
Posted by Mike on Feb 17th, 2009
Although I’ve been enamored with Python for the last 13 or so months, I’ve often dreamt longingly for days of Java glory. Things from the past seem so desirable at times — IDEs with good code completion and integrated debugging, staticly-typed compiler hand-holding, mature application servers and deployment tools. There was never much [...]
Posted by Mike on Feb 15th, 2009
I’m going to PyCon 2009! I’ll be there with a few other guys from work. We’re flying in Wednesday night, taking a tutorial on Thursday, and trying to have a little fun throughout the weekend.
Posted by Mike on Jan 13th, 2009
We generally preach that you should not use real data in your unit tests. You should instead mock said data out in an effort to lesson potential side-effects, including degrading test performance and adversely affecting live data.
Sometimes, you’d like to test actual file handling in a unit test. If you do, you should [...]
Posted by Mike on Jan 13th, 2009
After pulling most of my hair out, I realized a simple mistake in my Python regular expression usage. I had been trying to search a simple HTML document for some text, which happened to be broken across a newline such as:
<div>I’m some
[...]
Posted by Mike on Jan 13th, 2009
A new list of the most dangerous programming mistakes was released today by SANS Institute. This is a great followup to the OWASP Top 10. The list of potential application security flaws is broken up into three sections, one for dealing with each of application component interaction, resource management, and weak defenses.
CATEGORY: Insecure [...]
Posted by Mike on Jan 5th, 2009
<flame>
Javascript seems to gets left in the dust when we consider code quality. It’s been rigged, scattered, and smeared every which way from Sunday. Most sites of significant complexity have a severe amount of legacy, rotting code buried deep in a countless number of files. There is little separation of concerns in [...]
Posted by Mike on Oct 2nd, 2008
Here’s a quick example of how to incorporate the Decorator Pattern into your javascript code using the Dojo framework. Rather than decorating an entire class, this example merely decorates a single function, extending the original function with some extra logic.
// Instantiate widget class
var w = new core.widget.MyWidget();
// Decorate the original "method1" function
var _old_method1 = [...]