TurnKey Linux Virtual Appliance Library

Drupal Rules in a nutshell

In a nutshell, Rules is a visual programming tool. Instead of writing code as a block of text, you configure the desired behavior via a GUI that guides you through the setup of "rule sets" which are basically stored procedures that define conditionals and actions to execute, and triggering those rulesets from various canned events.

Rules sets can can call each other immediately (watch out for infinite loops), schedule each other (or themselves) to be called later, etc.

Negotiating payment as a contractor (issues, tips)

Last week I shared the advice I gave to a friend who was quitting his day job and wanted to do more freelance/contract work. This week I'll share a bit of practical wisdom on negotiating payment that I figured might be useful those of you who are just getting into contracting.

The problem: contracting clients will often ask you to quote fixed bids for contracts.

Potential issues:

Advice on breaking into freelance consulting, contract work, standard rates, wages and billing practices

Not too long ago, a friend told me he was quiting his day job to try going out on his own as a freelance consultant/contractor and asked for some friendly advice regarding wages and billing practices.

I may not have been the ideal person to ask, as I had never worked in the exact market my friend was going into. On the other hand, in my twenties, a few years back I did work as a computer security consultant.

Three strikes - time to automate!

I caught myself today repeating a few basic operations by hand what seemed like a zillion times. Over and over again. I didn't really notice it at the time but it was really slowing me down.

For example, after committing to tklbam I would create a tklbam testing package, copy the package to one of my test machines, install it and remove the archive.

How to debug a broken cron job

I just fixed a broken cron job. It turned out it was a PATH issue. By default cron doesn't have /usr/local stuff in the PATH.

Tips on how to debug cron:

  • change the schedule for the cron job so it runs every minute. It's harder to debug something that happens infrequently.

  • Make sure syslog sends cron logs to /var/log/cron.log. On one of our servers this line was commented out for some reason:

Python optimization principles and methodology

Methodology

The basic methodology for optimization:

  1. Discover where you program is spending its time (hotspots vs coolspots)

    A good way to get an overview is to use the Python profiler. The Python profile will usually be included in Python's standard library:

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).

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.

configuring libresolv to timeout DNS queries to unreachable nameservers more quickly when offline

When I go offline I pull my network cable. This causes DNS queries to take forever to resolve. Actually 40 seconds but it feels like forever.

Smart cache expiration with Drupal Rules

I've been exploring Drupal Rules some more since last week.

We were already using it before to automate the various repetitive tasks involved in creating a new appliance (e.g., creating aliases for the feeds).

Intelligent caching

Now we're also using Rules in conjuction with the Cache Actions module to expire the cache page intelligently so that adding or removing published content expires related page caches immediately.