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.

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

15 Feb 2006 22:26

Airport Extreme in Linux

I am writing this blog entry from my iBook G4 with a wireless connection from Linux, with no external wireless device. That's right, you heard me correctly.

The Broadcom 43xx Linux Driver has made this possible. See this LWN article for a good starting place.

I stubbornly compile my own kernel so it wasn't as simple as installing bcm43xx-modules-2.6.15, but with module-assistant it wasn't hard either. The only trick was knowing to compile the softmac module and install its headers. Something like this should work:

apt-get install bcm43xx-source dpatch
m-a -t a-i ieee80211softmac
dpkg -i /usr/src/ieee80211softmac-headers*deb
m-a -t a-i bcm43xx
modprobe ieee80211_crypt_wep
modprobe bcm43xx
ip link set up eth1
iwconfig eth1 channel 1 essid fugal key restricted yourkeyhere
udhcpc -i eth1

It's still in the not-for-the-weak-of-heart stage, but it seems to work well to me.

25 Jan 2006 15:28

VLC

At P. of D.'s prodding, I gave VLC a try. Despite the horrendous website, I am happy to report that VLC is a beautiful and effective media player on OS X Tiger. It handles Ogg and FLAC out of the box, it's compact and OS X native, it has a convenient .dmg installer, and it has a really neat icon.

I only have three wishes for VLC. First, I'd like to be able to drag links to songs and playlists onto the playlist. You can drag onto the dock icon, which is almost good enough, but for a truly usable interface it should work to drag onto the playlist too. Second, I'd like it to handle podcasts. I think this is in the works and hopefully we see it in the next version, or in 1.0. Last but not least, I really wish it would remember the playlist from session to session.

I think all of the above is minor compared to the consideration that this is a beautiful, simple, native player that does Ogg and FLAC and Speex out of the box, and is free software. Oh, and it does the right thing with the following playlist:

#EXTM3U
#EXTINF:0,lam.m3u
http://lam.fugal.net/songs/lam.m3u

Think about that for a minute. Now if I could get that LAM guy to clean up a few bogus URLs in lam.m3u...

24 Jan 2006 22:03

XiphQT

The wait is over! XiphQT is here. It's got a little room for improvement, but it's a proper QuickTime codec for QT7 (e.g. Tiger) that plays Ogg. In particular, iTunes' ugliest corners show through. Streaming is a bit broken, and there's some metadata problems. But this is primarily iTunes' fault, and as it's closed-source there's not much one can do about it.

So now that I have more RAM (didn't I tell you?) and Ogg support, I actually sometimes listen to music on my laptop now. But mostly I listen on the desktop with my nifty XMMS xml-rpc remote I hacked up in no time flat thanks to ruby. As a bonus I get IMMS there too, although it's contaminated with my wife's preferences too.

I hear tell that VLC supports Ogg and isn't half bad. I'll have to give it a try tomorrow. If I like it you'll hear about it. If I hate it you'll hear about it. Otherwise you'll know I'm still listening to Sugar Tax on the desktop speakers...

13 Jan 2006 07:46

Hardware Keys on iBook 10.4.3

Update: The same thing just happened on the upgrade to 10.4.4. Again, shutting down the laptop and cutting all power did the trick. I didn't have to hold down the power button.

The 10.4.3 "trick or treat" update of OS X Tiger caused my hardware keys (volume, brightness, power button, and even, oddly, the About This Mac menu option) to stop working. I tried a few reboots, heard a rumor on /. about the airport update so updated that, and searched and searched for a solution. Apparently people with TiBooks have had this trouble since Tiger first came out and were told, more or less, to wait for 10.4.3. Well maybe whatever they fixed "broke" things for us iBook G4 users. Or maybe it was something entirely unrelated. In any case, one of those sites gave a recommendation that I tried as a second-to-last ditch effort (the last would have been to boot into linux and see if I could jump-start things from there). Shutdown (you may need to do this from the command prompt: sudo halt), take out the battery and disconnect the power, and (for good measure) hold down the power button for one minute. That last bit may not be necessary but the TiBook people talked about a reset button that I don't seem to have so I figured it couldn't hurt. When I booted up, things worked as they should. Phew!

10 Dec 2005 08:57

ADB caps lock hack goes into -mm

The ADB keyboard caps lock to control hack that I ported to 2.6 from a 2.4 patch that was floating around has just gone into Andrew Morton's -mm tree. Andy Wingo took the patch and added a /proc entry (way cool), and submitted it for inclusion.

Wow. Something I touched, in the kernel.

04 Nov 2005 15:32

iTerm

While I'm talking about my iBook, I should mention that I have fallen in love with iTerm. It was a rocky road to satisfaction though, so don't give up too soon. The trouble I had was getting Terminus to look good (1.2 on the horizontal spacing), getting it to pay attention to the changes I made to the default colors, terminal, etc., terminal emulation issues (but not nearly as many as Terminal.app), and that annoying bounce when something is new behavior.

Get the CVS version. No bouncing, and I suspect better behavior with remembering settings. You might need to nuke your iTerm settings when upgrading to get things to work smoothly (they tell you how on their site). The rest is to be persistent and believe that it will do its best to disappoint you. With that attitude you should successfully configure it to your liking. Some of the more annoying problems with Terminal.app are gone in iTerm, but only when you choose rxvt as the TERM setting. Who knows, that might even work in Terminal.app. It also seems faster and seems to use less memory (a very noticeable thing on my 256MB iBook!).

11 Oct 2005 09:04

QtRuby on Tiger

I got QtRuby working perfectly on my iBook. It wasn't easy, but it's reproduceable. I wrote up the instructions on ruby-talk, go read them and let me know if it doesn't work for you.

09 Sep 2005 11:32

OGG Vorbis

iTunes does not support OGG Vorbis, which makes me sad. The qtcomponents project used to fill that gap, back in the Panther/Quicktime 6 days, but that project has not done a thing to get it working in Tiger (more accurately, Quicktime 7). More on that in a later post, probably.

So what is an OGG-lover to do? I looked for native OS X OGG players, I really did. All the links were broken, and the promising players were broken or maliciously murdered (e.g. Mint Audio) by their authors. Audion 3 turned out to be the only one that could play OGG, but it has serious stability problems, is EOL, is not libre, and is crippleware to boot. No thanks.

Once upon a time (just after getting Tiger and finding the qtcomponents OGG compenent was broken), I tried XMMS (via DarwinPorts), but XMMS didn't play. Lot of good that did. Today I decided to try again, to see if it had been fixed. Sure enough, XMMS will play (with the ESD output plugin) and happily handles OGG files. Why, I might even be able to use IMMS! (But this much optimism should be discouraged.)