27 Aug 2005 10:15

Gnocatan Falls off the Face of the Earth

At least, that's what it seemed like. Actually it looks like they just changed the name to Pioneers and conspired with Google and SourceForge to make it nigh unto impossible to find. But find it I did: http://pio.sf.net/

17 Aug 2005 23:30

Mac OS X Calculator

I have never seen a default calculator included with the OS that I like. For that matter, I have never seen a GUI calculator that I like with the exception of HP emulators (which are too clunky) and the RPN Calculator Dashboard Widget (which is great but dashboard currently means heavy swapping because of the RAM shortage). I have been pleasantly surprised once again by my iBook. Apple's Calculator is a marvel to behold.

It starts out as unassuming as you ever thought the default calculator would be.

Basic Mode

Then you explore the menu and find that not only can you use RPN, but you can do scientific mode. Neat, but not new. (The RPN bit was exciting though)

Scientific Mode

Wait! What is this Progammer view all about? Oh wow. Easy base conversion, 64-bit binary, 2's complement, every operation you ever needed to make your CS and EE homework a piece of cake. I'm sold!

Programmer Mode

Ok, one thing does bug me. RPN is hard to work with without a stack. Sorry, the paper tape doesn't cut it (it might, if it responded to enter). But all in all the best designed software Calculator I have ever seen. It even beats out bc and dc thanks to the programmer feature. Still, there's nothing like my HP 48G...

17 Aug 2005 18:09

ADP

I love Asterisk. It is a superb piece of software and a fine example of open source success. However, the extensions.conf syntax is painful at best. I haven't had to worry about linenumbers since my GW-BASIC days, and even then it wasn't necessary that line be numbered sequentially. So I did some thinking about how to solve this problem, and decided the best approach would be to write a translator that takes something sane, which I will call ADP, and translate it to standard extensions.conf format. Let's look at an example. Instead of this:

[incoming]
exten => s,1,Wait(1)
exten => s,2,Answer
exten => s,3,Playback(greeting)
exten => s,4,VoiceMail(77&80)
exten => s,5,Hangup

we write this:

[incoming]
ext s {
    Wait(1)
    Answer
    Playback(greeting)
    VoiceMail(77&80)
    Hangup
}

Now, adding Zapateller between Answer and Playback does not require manually reordering priority numbers.

I decided on the language and wrote a grammar for it, then dusted off my lex/yacc skills (and book) and wrote me a C implementation of ADP. You can find the current version and darcs repository at http://hans.fugal.net/src/adp. It works, but there are probably bugs and certainly memory leaks (but unless you have a gargantuan extensions.conf, who cares?)

I hope you find it useful. Suggestions and patches welcome.

05 Aug 2005 16:10

Coming to Terms with cupsaddsmb

Adobe Acrobat Reader 7.0 and CUPS windows postscript drivers spooled over Samba to a CUPS server is the recipe for not getting all pages printed. I'm not sure who was at fault, although I am prone to blame Adobe. A workaround is to use Adobe's postscript driver instead of the CUPS one. I'll try the CUPS driver again when version 6 is released.

Along the road, I picked up a decent understanding of how Windows network printing works, how Samba works with it, and all the idiosyncrasies of the black art that is setting up network printing with Samba. At first, my already-strained relationship with cupsaddsmb was in a nose dive. Here I was tooling around in rpcclient seeing very long lists of drivers that were all the same files. If every printer was using the same CUPS (or Adobe) postscript driver, why have 100+ drivers? At this point I was ready to write my own slightly intelligent cupsaddsmb.

Then out of the blue I found something in Google Groups that indicated that each driver should have its own PPD, and that CUPS stores the PPD for each file. The reason for this is that many options of the sort set with lpoptions are just stored right there in that PPD. One of the things cupsaddsmb does is to grab that PPD from CUPS and upload it along with the rest of the CUPS driver. Well, ok, now I can see a good reason to do all of what cupsaddsmb does with each printer even though you have almost 50 HP 4000 Series printers that all use the same PPD, to say nothing of the other printers that use different PPDs. So cupsaddsmb is off the hook for now. Still, it's not intelligent to tell me quietly whether each printer succeeded or failed, and it's an obvious scripting application written in C for crying out loud, so I am not letting it off parole quite yet.

05 Aug 2005 08:43

NuFone Outgong Call Woes

NuFone is my VOIP provider of choice, but I had a devil of a time being able to call out from my Sipura SPA-1001, through Asterisk, to NuFone. It turns out the problem was Caller ID. When I set my sipura's extension to 42 instead of sipura, I was able to dial out, but the CID said simply 42. Well that is kind of cool, and demonstrates that the reason NuFone's Asterisk (or PSTN connection) was rejecting my call is that I had invalid Caller ID for the number ("sipura"), but I would like to be a good phone system citizen. Junction Networks, of whom I had never before heard until google matched us up, has the answer. So I added that SetCIDNum call and things are working great.

04 Aug 2005 21:59

Montage

Kudos to ImageMagick for all the cool tools like this one. But I want to know what the author of montage was on when he decided that the default behavior should be to shrink the final image by one fourth or more. There's no obvious option to prevent the shrinkage either. But if you use -geometry +0+0 the shrinkage magically goes away. How's that for logic. I still can't even see a reason why that parameter should help, let alone why I should be required to know it just to get what I think is perfectly obvious default behavior. Oh well.

04 Aug 2005 11:14

Only Share Some Printers

At work we have a server that has a bunch of printers that should not be shared, and incidentally also happens to be the file/print server. The standard cups which is so easy to implement shares all available printers, even the ones we didn't want to share. Here's how to share only some.

First, we have to not share everything. To do that, remove (or comment out) the [printers] section. It seems like load printers = no would be important too, but I have not been able to discern any difference when changing that.

Second, you need to put a share for each printer. Well, with 52 printers that is tedious and prone to decay, so I wrote a script to generate the stanzas:

#!/bin/sh
# cd /etc/samba
# ./gen_printers.sh > printers.conf

printers=`lpstat -a | cut -d ' ' -f 1 | egrep -v '(label|DEVNULL|test)'`

echo "# auto-generated `date -R`"

for p in $printers; do cat <<EOF
[$p]
path=/var/spool/samba
printable = yes
public = yes
writable = no
browseable = yes

EOF
done

Now that you have printers.conf, you just need to include it from smb.conf, which you do like this:

echo "include = /etc/samba/printers.conf" >> /etc/samba/smb.conf

Warning: I tried putting the include directive in the [global] section and it really messed with samba's mind, creating AWOL processes that needed to be killed with signal 9 and other ugly stuff. I don't know if it was the indentation or the file position, but it works best if you include it at the end of the file instead.