31 Mar 2006 09:50

Building QCad with GCC 4

QCad is a really nifty open-source 2D CAD program for POSIX systems. They don't distribute free binaries, though, so you have to build it yourself.

There's two catches when building. First is trying to figure out where to start. It looks to me like this is the starting point:

cd scripts
./build_qcad.sh notrans

The second catch is if you get an error about ISO C++ and 'long long'. This actually applies to Qt in general, but I know that my Qt build environment is fine so I was a little confused. Turns out that the -pedantic compiler flag is what brings this error to the surface. So this patch will fix your QCad build:

--- qcad-2.0.5.0-1-community.src/mkspecs/defs.pro.orig  2006-03-31 09:12:28.000000000 -0700
+++ qcad-2.0.5.0-1-community.src/mkspecs/defs.pro       2006-03-31 09:07:55.000000000 -0700
@@ -1,6 +1,6 @@
# $Id: defs.pro 606 2004-12-25 03:08:40Z andrew $
-QMAKE_CXXFLAGS_DEBUG += -pedantic
-QMAKE_CXXFLAGS += -pedantic
+#QMAKE_CXXFLAGS_DEBUG += -pedantic
+#QMAKE_CXXFLAGS += -pedantic

win32 {
QMAKE_CFLAGS_THREAD -= -mthreads

What do I need QCad for? I'm designing two Really Neat™ DIY projects: a keyboard stand and a compact against-the-wall under-the-keyboard music stand. If that piqued your interest, stay tuned. If it didn't, well I'm sorry for you.

29 Mar 2006 10:18

Prepend the Area Code with Asterisk

If you want to prefix the area code for 7-digit numbers with Asterisk, it usually looks like something like this:

ext => _NXXXXXX,1,goto(505${EXTEN},1)

But if you need to server all area codes dynamically, you can do something like this:

ext => _NXXXXXX,1,goto(${CALLERID(number):0:3}${EXTEN},1)

This assumes caller id is set, and that your callers are using standard PSTN-like DIDs.

17 Mar 2006 15:55

No-knead Sourdough Bread

Over at r.f.s people have been experimenting with making bread with minimal kneading. This is right up my alley, I thought, so I gave it a few tries. It works astonishingly well.

The basic idea is that gluten development is a hydration process. When you knead a dough, you are working in the water and possibly creating little air bubbles. If you leave a ball of dough long enough, the water will work itself in. I know you don't believe me, but it's the truth. In my experience the loaves I make are plenty fluffy - more fluffy than when I knead - so I don't think the air bubbles part is an issue. You be the judge.

So the goal is to let water do the hard work over time. With normal bread, this poses a challenge in that you can't leave the yeasted dough a few more hours without ruining things. With normal bread, people do things with part of the flour and water beforehand and then mix in the rest and the yeast later, etc. etc. I'm no expert on what they do, and frankly it's too complicated. We don't have that problem because sourdough is naturally slower and gives us sufficient time.

Here's what I do. Let's say I want to bake on Saturday morning, and I plan on getting 6-8 hours of sleep. 6-8 hours is a nice rise time for chilled sourdough so I prep the starter so it's nice and active when I get home from work, then I mix up the dough and put it in the fridge. I take it out of the fridge after a few hours, just before bed, and form it into a loaf. I place it under a plastic container (I call it the greenhouse, because that's basically what it does: keep in moisture and heat) and go to bed. In the morning, unless something has gone drastically wrong, it's ready to pop in the oven and bake.

So let's review:

  • mix
  • rest
  • bake

And now some more ramblings about the boring details. You do need to mix it to get the water distributed, and maybe there's some air bubble action going on there too. But you don't have to use your hard-to-clean mixer or get your hands dirty. Mix all the ingredients, including salt.

If you want to deflate or knead or stretch and fold during the rest phase, by all means have at it. Remember that even with sourdough you can only rest so long before the yeast eats all its food. Chilling retards this.

For those of you who like recipes:

No-knead Sourdough Bread (small loaf)

  - 200 g    active 100% hydration starter
  - 125 ml   water
  - 174 g    flour
  -   1 tsp  salt
  -   1 Tbsp oil
  -   1 Tbsp honey

Mix well. Let rest for 1.5 hours at room temperature, or up to 24 hours in
the fridge. Deflate/work it mildly and halfheartedly, then form into a loaf
and rise in a humid (and preferably warm) environment until ready to bake
(use the finger test). Bake in a cold-start oven at 400 degrees for 20
minutes, then at 350 degrees until internal temperature reaches the boiling
point. (You do have a probe thermometer, don't you?) Turn off the heat and
let it bake another 5 minutes and then take it out of the oven and let it
cool thoroughly for best flavor. If you can't hold off the ravening butter
slatherers, don't blame me.

15 Mar 2006 23:46

Atom Feed

So Blosxom spits out an RSS 0.91 feed by default, which is fairly despicable. For one thing RSS 0.91 doesn't allow for attaching dates to posts. So I grabbed an atom feed template. Now if you want a decent feed you can point your feed reader at http://hans.fugal.net/blog/index.atom.

13 Mar 2006 09:57

pack and unpack broken on Tiger's Ruby

Imagine my surprise when my iBook told me that network byte order had been changed to little-endian:

irb(main):001:0> [1].pack 'n'
=> "\001\000"

Just to make sure I wasn't losing my edge, I ran the same code on my x86 box:

irb(main):001:0> [1].pack 'n'
=> "\000\001"

Array#pack (and String#unpack) are broken on OS X Tiger's shipped Ruby. After some research, it appears the reason is that they cross compiled it from x86, and when built Ruby remembers the architecture for the purposes of the NnVv formatters of pack/unpack. The purported remedy is to build your own Ruby. I reported the bug to Apple, I have a small hope that eventually they'll update it. In the meantime ruby programs using pack can either work around this or require users to install a fixed Ruby.

Update: Here's a workaround with thanks to Paul Battley:

# Test for broken pack/unpack
if [1].pack('n') == "\001\000"
  class String
    alias_method :broken_unpack, :unpack
    def unpack(spec)
      broken_unpack(spec.tr("nNvV","vVnN"))
    end
  end
  class Array
    alias_method :broken_pack, :pack
    def pack(spec)
      broken_pack(spec.tr("nNvV","vVnN"))
    end
  end
end