[]RSS

About Archives Artwork Comic Contact Philosophy Projects Tags

SVN Status code cheatsheet

[Comment]

July 21st, 2008 in Howto. Micro Blog

Here’s a quick cheatsheet for svn stat codes, as I can never find a good one when I need it.1

    U        Local file updated
    G        Local file safely merged
    M        Local file has been modified, needs to be checked in
    C        Local file contains conflicts that need to be resolved
    ?        Local file not in repository
    !        File missing from local copy
    A        Local file scheduled to be added
    A+       Local file scheduled to be moved
    D        Local file scheduled to be deleted
    L        Local file is locked by a running svn command
  1. Note: this is a just a summary of the much better detailed svn help stat. The one some most of my developers are unaware of.

HOWTO make horrible digital photos look less horrible

[Comment]

May 7th, 2007 in Howto. Weblog

Taking pictures is fun. It’s an ego trip. Armed with a camera, anyone can slice the world into tiny planes of expression. Photography can be art, history, science, or just plain interesting. But how can you escape the mundane?

road shotThe inspiration for this HOWTO came from a friend who reminded me that the greats of photography worked with primitive equipment, and that even the simple cameraphone was enough to create art. So I grabbed my camera phone and took some very average shots. I then I applied a few simple tweaks using the Gimp, and the results were surprising. In the end, good photography is more than just equipment and light.

It turns out that the process is really quite simple:

  1. Shoot. Get closer. Try different angles, and take several shots.
  2. Crop. Rotate. Find the interestingness.
  3. Blur the image and reduce the camera noise (unless it looks cool).
  4. Adjust the levels.
  5. Fit the contrast to the texture of the image. Higher contrast for crispy, lower for fluffy.
  6. Nudge the colours. Try different tones and saturations.
  7. If the colours are really horrid (or the image is still noisy), drop to black-and-white.

HOWTO make cheap iced coffee

[Comment]

March 3rd, 2007 in Howto

brainOkay, I’m a cheap bastard. I like the occasional iced coffee, but I can’t fathom spending CAD$5 per glass. This recipe costs about $3 in total and makes 8 tall glasses of the stuff (that’s about 40 cents per glass). The worst batch I’ve made tastes better than the instant supermarket stuff, and the best ones (like today’s) taste better the yuppy-priced specialty coffee shops.

My method

Makes 2L

  1. Bring 1.5-2L of fresh cold water to a rolling boil.
  2. Pour boiling water over 2cm (1 - 1.5 cups) of fresh, reasonable-quality dark roast coffee. Let sit for 5-10 minutes. The slurry should generate a thick foam at the top, if it doesn’t then either your water is too cold or your coffee grounds are crap.
  3. Fill 1/3 of a 2L jug with something milk-like (and add chocolate syrup if you want mocha-ness).
  4. Pour coffee and grounds through a sieve over the jug of milk and chocolage. Stir. Cool for 24 hours for better flavour.
  5. Drink over ice.

HOWTO enable coredumps

[Comment]

January 6th, 2007 in Howto

A quick note for anyone wondering how to enable core dumps from within most Linux distributions.

First, make sure debug symbol are enabled in your project’s configuration (in configure.ac if you’re using autoconf).

CXXFLAGS="-g"
LDFLAGS="-g"

If you’re using autoconf, you’ll need to rerun configure too.

./configure --enable-debug

Then make sure core dumps are enabled in your shell (Ubuntu disables them by default).

ulimit -c unlimited

Debug away!

ddd src/swatchr -c core

If you happen to see the error:

$PATH/core: not in executable format: File format not recognized

You’ve problably got the options to gdb wrong. The error is horribly misleading as it’s really saying that the core isn’t a recognized executable; the debugger wants the path to the executable first, then the path to the core file.

Canadian chili 101

[Comment]

December 16th, 2006 in Howto

chillCanadian chili, in my books, differs from classic American chili as it’s mostly bean-based (rather than OD-my-colon-with-beef-based). Where I grew up, chili was the natural conclusion of a classic pasta meat sauce. Both the meat sauce and the chili are lean on the meats, but fat with flavour.

The meat sauce

  • 1 small package of hamburger (or soy equivalent)
  • 1 onion, diced
  • 5 cloves of garlic diced
  • 2 tsp garlic powder
  • 1 tbsp kosher salt
  • 2 tsp black pepper
  • 4 tbsp of balsamic vinegar
  • 2 large cans of diced tomatoes
  • 1 can of tomato sauce
  • 1 can of tomato paste
  • 3 tbsp dried basil, 4 basil cubes, or both if you like basil

You make the meat sauce in two simple steps:

  1. Brown the brownables. Take the onion and hamburger and brown in a large pot (add some olive oil if the hamburger starts to stick). Add the garlic, salt, and garlic powder, and stir. Brown it all nicely. Remember, browned doesn’t mean cook-the-crap-out-of, it means hot-enough-to-turn-it-brown. Actually turn beef brown, otherwise it adds no flavour.
  2. Simmer the whole lot. Add the balsamic vinegar to the browning meat, and scrape off any flavour stuck to the bottom of the pot. Add the tomatoes slowly, allowing them to sizzle in the pot. Add the remaining ingredients and bring to a quick simmer, and drop the heat to prevent a tomato-covered stove top.

Taste the sauce. It should taste good by now, if it doesn’t balance it with sugar, salt, garlic, basil, pepper, and cayenne if you like it hot. Add the final seasonings slowly, stiring thoroughly and tasting before adding more.

The chrysalis (put it in the fridge)

Enjoy some pasta and meat sauce, put what’s left over in the fridge, and let it sit a day or two. Something magical happens in the fridge, and the flavours deepen.

Fly away chili

Turning the sauce into chili is simple. Add a bunch of crap to it. I’ve made dozens of combinations of this dish, and you can get away with many variants. I usually make chili as a ploy to clean out my fridge/cupboards.

  • 2 cans of brown beans
  • 1 can of kidney beans
  • Some veggies/fruits. I usually use 2 of: mushrooms, carrots, corn, peppers, pineapple
  • Some flavourful meat(s). Any of these work: bacon, steak, chicken, sausage, pork chops
  • More tomato sauce, paste, or marinara (I always have some on hand)
  • 4-6 tbsp chili powder
  • 1-4 tbsp cayenne
  • 1 tbsp black pepper

The chili-ization is one simple step:

  1. Add chili stuff. Add the above ingredients (seasoning last, and in steps), and simmer for a while. If you need to pre-cook the meat, do so, and add it at any time. You know you’re done when the lot is spicy, beany, and tasty.

Making iced tea

[Comment]

November 26th, 2006 in Howto

I like iced tea. I drink a lot of it. I like it mostly for the subtle caffeine effects, but it’s also damn tasty.

But I don’t buy it pre-made. The stuff in the bottles on the store shelves is horrible: it’s sweetened with HFCS (a.k.a., the sickly-sweet flavour), contains un-natural-tasting flavours, and is usually brewed with the powdered dregs left over from general tea production. Ick.

My method

Makes 4L

  1. Add 2L of just-under-boil water to 10-15 orange pekoe tea bags (or about a cup of loose black tea leaves). Stick with mid-grade quality at best.
  2. Steep for 5-15 minutes, depending on how bitter you like it.
  3. Add 1 cup of brown sugar (after removing the tea), and some flavouring.
  4. Split the 1.5L of tea concentrate (about .5L evaporates) into 2-2L containers. Top off the concentrate with water, and refrigerate for 12 or more hours. The longer you cool it, the better it tastes.

Flavours

There are a number of great flavours for iced tea. Here are a few of my favourites:

  • 125ml of fresh (or concentrated) lemon juice, and some (optional) fresh mint leaves.
  • 1/4 cup of juice crystals (raspberry and peach are my favorites)
  • 1/2 a can of frozen juice

Tweaking and Tuning Ubuntu

[Comment]

September 20th, 2006 in Howto. Weblog

There are a few things that I recommend you tweak and tune in your Ubuntu install, based on my recent experience upgrading all of my home PCs from various versions of to .

Install a kernel for your CPU

A tip in one of the Ubuntu forums suggests installing a more specific kernel. For my system, all I had to do was:

$ sudo apt-get install linux-k7-smp

I noticed a significant performance improvement, including a shorter startup time, faster compiles, and snappier windowing.

Note that you need to install the bundled package, not just the kernel (linux-k7-smp, not kernel-image-2.4.27-2-k7-smp). The bundles include much more than just the kernel, resulting in a seemless upgrade. Installing a kernel-only package would break things like non-free drivers (NVidia support, wireless, etc.).

Compviz/GLX

Ubuntu 6.06 + CompvizIf you have a newer video card you can install the insane eye-candy desktop stuff. The result looks far cooler than OSX, though I can’t say much of it is useful. I was surprised how far has progressed: it has a full GUI configuration tool, theme manager, and is both fast and stable. I’m running it on a NVidia 6600GS (a mid-range, CAD$175 card), and it goes like stink.

Automatix

The Automatix tool installs all of the non-free pieces needed for a useful system (NVidia drivers, Flash, Mplayer, Java, etc.). The tool is a bit rough around the edges, popping up XTerms and such, but it does the trick.

Apt is your friend

Ubuntu ships with a GUI frontend to apt called . It’s a good tool, but isn’t as quick to use as apt itself. A few apt tips:

# install an application
$ apt-get install some-app

# remove an application
$ apt-get remove some-app

# search for applications
$ apt-cache search some-app

# check for newly available packages (does not install them)
$ apt-get update

It’s also worth learning to add new package repositories to your /etc/apt/sources.list, but that’s a topic for another day.

Other notes

There are a few other things I recommend installing/tweaking on a fresh Ubuntu system:

  • Install Synergy, which makes it possible to share one keyboard/mouse with two or more PCs running any combination of Mac, Windows, and Linux. It’s like a multi-head system, but with multiple CPUs.
  • Set a root password: sudo passwd (and follow the prompts).
  • Turn off un-needed daemons. See the System->Administration->Services tool, or install the Boot-up manager from .
  • Turn off your system beep. For some reason, updating to the k7-smp kernel kills the UI tool for turning off the PC speaker (the kernel may not support it).

Yum nugget of the week

[Comment]

February 14th, 2006 in Howto. Weblog

Every once and a while gets confused and starts spewing Missing dependency errors. Once Yum gets buggered like that, it isn’t able to run its updates properly. And from that point on, you have to work around it by telling Yum to ignore the broken package (--exclude=some-random-package). Eventully you will want to fix the problem so you can run system updates without exclusions.

There are a few steps to fixing the problem. First, make sure that your Yum repositories are mixable. There are some package problems that are caused by . I’ve had good luck with the default, , and related repositories.

Second, it’s worth making sure that both the Yum and RPM databases are healthy. I haven’t seen a Yum or RPM database issue since their early versions, but it’s worth your time and sanity to be sure:

# clear cached yum data (it rebuilds it on the next run)
yum clean all

# clean/rebuild the rpm database
rpm -rebuilddb

Now find the package that’s causing your problem. Yum will be reporting a missing dependency, which may be a package (or a component of it). In my case, gst-register-0.8 was installed, but RPM and Yum thought that it was not. To determine what package provides a dependency, you ask it:

yum whatprovides gst-register

# yum tells us that gst-register-0.8 is provided by gstreamer-tools.i386 

Yum and RPM will be unable to remove the package using the default commands (yum erase, and rpm -e), as they don’t know that the gst-register-0.8 package is installed (which can happen for a variety of reasons). Luckily, you can force RPM to do the right thing:

# tell rpm to erase the database entry for the buggered package
# (this does not actually erase the libraries or its dependencies)
rpm -e --justdb --nodeps  gstreamer-tools

# now reinstall the buggered package
yum install gstreamer gstreamer-tools

# voila!

Now a yum update will return bliss, or at least will no longer complain about a missing package that isn’t really missing.

Note that I’ve found only a small number of these Yum bugs, which have become more rare as the packagers and repositories improve. I find that Yum breaks very rarely now, and then only when living on the bleeding edge (as most of us developers do). In fact, this particular failure wasn’t a packaging bug, it was my own damned fault: I installed a gstreamer plugin by hand, from a different repository, and the rpm had a broken spec file.

Local Backups with Rsync

[Comment]

August 12th, 2005 in Howto. Weblog

I picked up a 3.5in drive last week for backups, and boy is it handy. A full backup (a few gigs) takes less than 5 minutes, and an incremental backup takes less than a minute.

Here’s my imperfect backup script:

#!/bin/bash

DEST="/media/usbdisk/laptop"
mkdir -p $DEST

echo "Starting backup to $DEST"

FULL="/home/images/ /home/mx/sites/ /home/mx/projects/ 
    /home/mx/bin/ /home/mx/.thunderbird/"

for d in $FULL; do
    echo "Full backup of $d ..."
    rsync -ax --delete $d $DEST/$d
done

DAILY="/etc/ /home/mx/archive/ /home/mx/.bash_history"
DAY=`date "+%A"`
DAILY_DEST=$DEST/daily/$DAY

mkdir -p $DAILY_DEST

for d in $DAILY; do
    echo "Daily backup of $d"
    mkdir -p $DAILY_DEST/$d
    rsync -a --delete $d $DAILY_DEST/$d
done

The script backs up a set of home directories incrementally, and a few important things daily. Rsync figures out what has changed and copies only the changed files (as well as deleting files that are no longer there). As most recent Linux distributions automount USB devices, there is no need to worry about mounting the backup drive from the script.

Stupid Yum/RPM tricks

[Comment]

May 9th, 2005 in Howto. Weblog

I’m in the middle of updating from to . Maybe not the best idea when one’s brain is riddled with development ideas, but my system has been un-updatable for several weeks now. So now it is.

I’m following one of the many documents on the subject, and things went awry. I fixed the first few problems (conflicting packages), and then I ran into the dreaded Error: Missing Dependency:, also known as oh shit, I’m fsked. The offending dependency exists, of course, but neither yum nor rpm can be convinced it’s true. So I rebuild the rpm database, then the yum cache, and ignore the package. The problem in this case isn’t the tools, but a bad package spec (and some poorly mixed repositories).

Which reminds me, there are several yum and rpm commands I always forget:

$ rpm --query udev  (find an installed package)
$ rpm --erase udev (remove said package)
$ rpm --rebuilddb (rebuild rpm db)
$ yum clean all (clean yum cached data)
$ yum clean metadata (clean only meta data)
$ yum --exclude=udev update (ignore a pesky package)

While the process sounds complicated, it’s not. It’s simpler to resolve than removing broken applications, which requires determining component dependencies (finding COM GUIDs, removing from the registry, rebooting, rebooting, rebooting). Most people with machines prefer to rebuild a machine instead of fixing dependency problems. systems, on the other hand, can be fixed without much grief. The difference? Most Unix-like systems provide a view into how dependencies are managed, and tools to do something about it.

Next page [>>]