4 simple software optimization tips

1) Always be experimenting!

Trying to squeeze out more performance out of your program? Don't be afraid to experiment!

In practice what that means is you setup small, simple throwaway experiments to establish how things work when you're not absolutely sure you fully understand something such (e.g., how many times a second a certain function can be invoked, how the profiler measures blocking IO or the time it takes a sub-program to complete).

How to setup an email to SMS forwarding gateway address with Postfix

SMS is an important tool in the arsenal I use to fight my never-ending war with productivity-destroying distractions.

Colleagues, friends, mailing lists, foes, viagra peddlers and nigerian princes send me in aggregate about 300 pieces of of e-mail every day, most of it not really that important. All of this noise can eat up an enormous amount of my attention so when I really need to concentrate I'm pretty much forced to ignore e-mail altogether for sometimes weeks at a time.

Blog Tags: 

Vim smartopen plugin adds Vim support for CDPATH

Overview

Ever since I discovered CDPATH last year I've been thinking wouldn't it be great if Vim could access files using CDPATH without having to chdir anywhere first. In other words, why can't Vim understand that it has to look for tklbam/restore.py in the CDPATH instead of telling me that it doesn't exist in the current working directory?

I started experimenting with Vim hooks and eventually figured out how to implement this as a generic mechanism that defines a more useful way for Vim to access the filesystem.

Blog Tags: 

Transcend the Drupal documentation, use the source Luke!

During the first few months of my Drupal experience I looked for answers to any issues that came up first in the official documentation, then on Google. It's a big Drupal world out there so more often then not I would find someone had come across exactly the same issue before and I could just parrot the solution without necessarily understanding why it worked.

Pythonic attribute magic (property, customized attribute access)

Many languages encourage programmers to use a getter/setter pattern.

Like this:

Tips for the Object Oriented Programming novice

The following is written for programmers who don't really understand object oriented programming yet. They probably understand the language semantics, but don't really understand how to use them correctly.

If you find yourself misusing object oriented semantics that probably means you don't have the skills to develop good software. This is a problem because bad software is much harder to develop and even harder to maintain.

Scaling web sites: a brief overview of tools and strategies

Monolithic server architecture

The easiest way to support additional capacity is to simply use a bigger server (big iron approach), but the disadvantage is you need to pay for that capacity even when you're not using it, and you can't change the amount of capacity for a single server without suffering some downtime (in the traditional monolithic server architecture).

load any external javascript file asynchronously

Sticking <script></script> tags referring an external resource in the middle of your HTML code will hang the loading of your page while your browser gets the missing script.

On the TurnKey website, this was a problem with the loading of the AddToAny sharing script, and the quantcast tag which I have since removed. There were also a couple of custom scripts that slowed down the site.

The solution is generic and simple. Use this code to load your Javascript asynchronously:

Unix buffering delays output to stdout, ruins your day

Let's say you have the following program:

cat>example.py<<'EOF'
#!/usr/bin/python
import time
while True:
    print 'hello world'
    time.sleep(1)
EOF

chmod +x ./example.py

If you run this program from a terminal, it will print hello world every second.

But redirect the output to a file and something different happens:

./example.py > output &
tail -f output

You won't see any output! (At least not for a long while)

The same is true if you redirect example.py's through a unix pipe which you can do on the shell:

Reflections on the correlation between intelligence and success

Having recently reread Malcolm Gladwell's excellent book: Outliers - the story of success, I've been thinking about the correlation between high IQ and success in life. I think I may have come up with a nice way to clarify Malcolm Gladwell's conclusions. Malcolm writes that to succeed in a given field you need to pass a certain threshold of intelligence, but that having more intelligence than the required threshold will not increase your chances of success.

Pages