Friday, December 29, 2006

Webdav server with lighttpd

MacOS and Windows clients can mount fileservers using WebDAV. This runs over port 80 so it will probably work anywhere on the interweb. It seems really efficient too.

I couldn't find simple instructions on how to set this up so here's my mini howto for Linux. (Sorry for the rather technical content on this one, it's really just a note to myself).
  • Get lighttpd
  • ./configure --with-webdav-props --with-webdav-locks
  • make install (as root)
  • mkdir /var/run/lighttpd
  • mkdir /var/log/lighttpd
  • /usr/local/sbin/lighttpd -f lighttpd.conf
Here is a minimal lighttpd.conf that will share your docroot for read & write.

# lighttpd configuration file for a webdav server
#
# in MacOSX you can mount this with http://host/
#
# See:http://trac.lighttpd.net/trac/wiki/Docs%3AModWebDAV

server.modules = (
"mod_access",
"mod_webdav",
"mod_accesslog" )

server.document-root = "/var/www/"

server.errorlog = "/var/log/lighttpd/error.log"
accesslog.filename = "/var/log/lighttpd/access.log"

webdav.activate = "enable"
webdav.is-readonly = "disable"
webdav.sqlite-db-name = "/var/run/lighttpd/lighttpd.webdav_lock.db"

server.pid-file = "/var/run/lighttpd.pid"

# at least server html pages
mimetype.assign = (
".html" => "text/html",
".htm" => "text/html"
)
----
Update: After using this as a server for a few days, I have to report that there are two issues:

  • Re-naming folders takes ages, reports an error, but does work
  • You can't cancel a file copy

Thursday, December 21, 2006

Cheap Chinese VHF/UHF radios via ebay


A recent meetup with my old ham buddies introduced me to a range of cheap two way radios I hadn't seen before. Costing around AU$90 including delivery, these high tech radios are almost a disposable item. The bit I most like is the specs which look like they've been simply run through translator software.

Item Description :
  • 99 memory channels, adoption of phrase-lock loop frequency
  • synthesis, micro-computer controller, forthrigh menu, expedient operation.
  • LCD apheliotropic lights of showing screen, facile operation in dark.
  • Multi-function, excess value, fashion outline, pettiness, portability,
  • sturdiness, durability, stable property, high quality original battery,
  • long-time using, original sound, relaxed A.
  • Electricity sparing functions, prolong using time.
  • Earphone/Microphone/Auto-charger rabbet, expedient for talking and charging
  • CTCSS
  • English Sound Reminding Function

Features :

  • Rated Voltage : DC7.2V
  • Memory channel : 99 channels
  • Antenna disposition : inductively loaded antenna
  • Antenna impedancd : 50 Ω
  • Working manner : same frequency single operation or different
  • frequency single operation
  • Ground method : negative pole
  • Size : 80X50X28 mm
  • Output power : ≤5W
  • Modulation mode : frequency modulation
  • Maximun frequency deviation : ≤±5KHz
  • Remanent radiation : <-60dB
  • Preemphasis character : per fold frequency patch 6dB
  • Emission current : ≤1600mA

By all accounts, these radios are pretty decent, certainly for the price. I've ordered one and will report more when it arrives.

----
Update: it arrived. It's a Quangsheng TG-25AT (the VHF model).

You get what you pay for. It does work as advertised but:
  • I haven't figured out how to adjust the squelch. It's too tight.
  • The manual is rather cryptic, the same translator as the feature list above.
  • The drop in charger station came for 110V (I need 240V)
  • Scanning is very slow
Anyhow nice new toy for the summer break. I've put my interpretation of the manual here.

Wednesday, November 22, 2006

Buying a TV today

Each month I visit an electrical goods store to check out the televisions. The screens get bigger, have more resolution, and are cheaper every time I look.

There are four distinct technologies generally available:
  • Cathode Ray Tubes, where a large, evacuated, glass tube shoots electrons at a phosphor layer.
  • Plazma, where a flat screen also makes phosphor glow with excellent contrast.
  • LCD, where liquid crystals block or allow through the backlight.
  • Projection, either forward or back.
The other variable is the resolution of the displays. Here are the current options:
  • 625 Lines is what standard definition is today (525 for NTSC)
  • 1024 (wide) by 768 (lines) is a bit better and very common
  • 1920 (wide) by 1080 (lines) is real "high definition"
When you visit a shop it's not easy to find out what you are looking at. Labels such as "HD Ready" don't tell us what the screen is actually able to display. Combine this problem with the fact that as I write there isn't much true HD content around, means that it's very hard to judge the screens in a shop.

So what's the best screen technology? It's not clear unfortunately. Plazma has better blacks and therefore higher contrast but they are reputed to fade within a few years. LCDs have a poorer colour gamut but consume less power and therefore run cooler.

Computer screens are getting larger and it's likely that soon we'll be watching some sort of computer in the living room that can either record or simply download programs for direct view. Whatever happens I hope we can soon dispense with the multitude of remote controls that litter the room.

Sunday, November 12, 2006

Media ratings survey asks wrong questions


My fourteen year old daughter recently completed a two week media survey diary for Roy Morgan Research.

They paid her to the value of about $35, it wasn't worth it. The survey was a combination of a detailed questionnaire about her interests and behavior and a diary of what she watched or listened to on TV or radio.

She's tech savvy and doesn't like watching ads so TV is mostly watched in delay by recording it on our digital video recorder so the ads can be fast forwarded through. The strange thing is that the diary asked only the time and channel, but not the program. As my daughter pointed out they weren't asking the right questions.

Luckily for them she was kind enough to look up the time and date of the recording and try to fill in the diary to reveal the program, which is presumably what they wanted to know. But what about when she watched a program while recording another, there was no way to reveal this.

Incidentally, it appears she listens to no radio at all. All music is on iPod from various sources. That's a depressing thing for a radio lover like me.

Reading their site, Roy Morgan Research, seem to be on the ball, but after seeing how they survey I would have to be highly skeptical about the accuracy of their media survey results.

Friday, November 10, 2006

Fedora Core 6 - linux for my mother

FC6 seems like a great release. Install is smoother than ever, not quite as beautiful as ubuntu, but no hitches.

I've tried it on a Dell desktop, a Dell laptop, and my MacBook (via BootCamp). I couldn't get wireless going on the Apple laptop which is a showstopper for me, but the cool new "Desktop Effects" did work while they didn't on the other two machines.

Desktop effects so far seems to make windows and menus "wiggle" in to view. I guess this is the beginning of the effects we've come to expect in MacOS X and soon Vista.

The web browser is Firefox and is as good an experience as it is anywhere. Now that I use Google Browser Sync, I can jump from machine to machine and feel right at home with all my bookmarks and even cookies following me around.

On the software side, I enabled IPV6 and have had trouble with WebService clients that used to connect to "localhost" that now need "127.0.0.1" for some reason. Yes it's in /etc/hosts.

What a great set of default apps you get. The OpenOffice suite is looking fantastic and any MS Office user would feel right at home.

Recommended.

Friday, October 27, 2006

django on windows mobile 5


Hey, I just got the web framework django running on a Windows Mobile 5 PDA. I'm running under python 2.5 from here.

There is a bit of messing about which I'll blog about later but mostly it's installing stuff and getting around the lack of the command line shell. The only other tip is to start the development server with --noreload.

As sqlite3 is available it should be possible to build a proper web app but I haven't tried that just yet.

Update: mentioned on the Django blog!

Wow, I am so proud to be mentioned on the django site, thanks very much.

Here's my startup script that lets you use the server over WiFi. To run it you open it in File Explorer:

import sys
import socket

sys.argv.append("runserver")
ipPort = "%s:%d" % (socket.gethostbyname(socket.gethostname()), 8000)

sys.argv.append(ipPort)
sys.argv.append("--noreload")

from django.core.management import execute_manager

import settings # Assumed to be in the same directory.
execute_manager(settings)

# so we can see any error
raw_input()

I installed Python on a compact flash card. Here's the layout from the "Program Files" directory down. I simply copied the django directory over from another machine.

Thursday, October 26, 2006

Sucker for a PDA


I've always been attracted to PDAs. Possibly it's my fear of being stuck somewhere and getting bored with nothing to listen to or read.

A loyal, and satisfied, Palm OS user for many years, I recently got tired of the lack of advancement of the OS and particular the poor web browser and started tinkering with Microsoft CE, PocketPC, Windows Mobile 5.0 or whatever they're called these days, devices around the office.

I ordered a Dell Axim X51v and thought I'd share my impressions.

  • The v means the screen is full VGA (640x480) and the resolution is lovely.
  • Windows Mobile 5.0 seems to have better battery life than earlier versions due to some memory tricks with flash memory and that's a good thing.
  • Bluetooth is there but is lame. It doesn't support OBEX so I can't browse the device from my computer which I've done on mobile phones for years.
  • Wifi works well as in quite sensitive, but the UI is a shambles. It's very hard to figure out how to leave one network and connect to another. Other users give me tips like click the icon in the top bar, don't use the Settings->Connection tools. Dell provide their own utility but it shouldn't need to.
  • Dell provide a little app for switching between running applications but it's pretty rough and overwrites things in the top bar.
  • Heaps of storage slots. I have populated the SD and Compact Flash sockets which is great.
  • I use MacOS computers and so use Missing Sync which works quite well at least over USB. It's nice that they let you "upgrade" from the Palm version.
  • The device has needed a soft reset 4 times this week. Twice when plugged in to USB for some reason, the other times on being unresponsive possibly due to a buggy app. Anyhow, too much really. My Palm TX almost never needs re-booting.
  • Python 2.5 runs pretty well and I'm trying to get Tkinter going on it.
Anyway, the Palm PDA with it's inferior screen and browser is still sitting near by, it hasn't gone to eBay just yet.

Sunday, October 22, 2006

They know where you live


Searching a torrent indexer (for public domain content) the other day I noticed that the "find pretty girls in..." ad has got unnervingly accurate.

Forestville is the suburb right next to where I live.

How on earth do they do this? I know that there are geolocation systems that triangulate where people are by tracerouting from several locations around the globe, good for things like pre-selecting the country in a popup menu or tailoring a banner ad, but how can this work down to the suburb?

There are some services around that can figure out the ISP and your state but they're not as good as those super smart pretty girls.

Saturday, October 21, 2006

Vista RC1 experience

I was working on site this week and thought I saw MacOS X running on a Dell laptop. On closer inspection it turned out to be running windows Vista.

The owner gave me a quick demo, expose equivalent, gadgets, window animation, it looked pretty slick and seemed to run well in 1G of RAM.

We have a recent HP laptop so I thought I'd give it a go at home. I think it's great they have a free download installer available.

The download was great, using an Akamai java download manager on our Optus Cable connection gave me a sustained 1Mbit/sec download rate and I had burned the .iso file to a DVD on my Mac within minutes. (The image is 2.52G).

The installer said it was incompatible with some HP Protect software and forced me to exit and remove it before it would go on. It took some searching to figure out how to do that as the utility has no uninstaller and in the end needed to be killed and the .exe manually deleted.

I did an upgrade from XP and takes over 2 hours to install. There are a couple of mysterious steps including "Gathering files" and "Completing upgrade" that seem to take a long time.

In the end it does look great, clearly security is increased as it keeps asking the user if it's ok for things like the google toolbar to talk to a server. This might be annoying for an end user but it's a bit like running little snitch all the time.

It looks like an improvement over windows XP but I still like MacOS X better, but then again having unix underneath is something I see as very valuable.

There's some nice eye candy, I do like the transparency with blur through window title bars.

No Junk Mail - works!


Each fortnight our paper recycling bin was filled to the brim. The combination of a daily broadsheet newspaper (my wife likes inky fingers) and a heap of junk mail was too much.

I printed a very simple "No Junk Mail" notice and stuck it on the letterbox.

It worked instantly, and comprehensively. Clearly the folks that walk the streets delivering the junk mail are under instructions to not waste the printing on folks that ask not to receive it. Our house is less cluttered, the paper recycling bin has some room, and no doubt there's some products we haven't felt compelled to buy.

If only there was a way to associate the label "No Junk Mail" with an email address. Maybe SMTP could be extended to be able to return properties. On the other hand mail goes through many servers and that would have to be passed back somehow. Perhaps it belongs in the DNS for the domain that accepts that email.

Sunday, October 15, 2006

Belkin TuneTalk mini review


From time to time I record stories for radio and these need to be recorded in the field in "HiFi" quality. Currently I use a Marantz PMD660 digital recorder, which is fantastic quality, but rather large.

I was excited by the idea of using my Video iPod to record "CD Quality" audio in the field and so rushed out to get a Belkin Tunetalk.

It's physically a neat little unit that clips on to dock connector on a Video iPod as shown above.

The recording quality is good, using the built in microphone, and on "High" quality setting is recorded in WAV format at 44,100 Hz sampling.

There is no way to see the audio level on the iPod and you only have the choice of turning "Autogain" on or off. Basically, on means mic level and off means line level. The recording for me is rather low in level but I guess that's needed to avoid clipping. It's here.

I tried an external mic, a high quality Sony mic, and it sounded rather thin and low level compared to the built in mic.

Apple must have changed the software since the manual was printed as recordings now seem to be automatically transferred into your iTunes library rather than needing to be dragged or respond to a prompt to get them over. This mystified me for a while and I thought it was not saving my recordings.

High quality recordings are going to be big. My 12 second test is already 2.2Mb so this is not a dictation machine. I guess the application is recording interviews for podcasts or radio, which suits me but I find the lack of a VU meter and any way to monitor the recording a bit worrying.

Summary

Yes, it works and the internal mics sound really great. iPod user interface for recording is not great, it needs a VU meter, monitoring of the recording in the headphones, and it seems to take a long time to "Save" the recording when you stop.

Oddly the Belkin device includes one of those mini USB sockets (why can't they standardise these) and a cable so you can charge your iPod while recording. Wouldn't it have been better to repeat the dock connector on the device?

Note that this product only works with the iPod with video.

Saturday, October 14, 2006

Better locate with mdfind

I wanted a way to search for the name of a file locate style but using mdfind. mdfind finds files with the search term in any way associated with the file. I created this little script called mdf, did a chmod +x and placed it on my path:

#!/bin/bash
mdfind "kMDItemDisplayName == $1"

Now I can find files by doing: $ mdf filename

It's better than locate because spotlight is updated live.

Python and Xcode


I've been doing a lot of very productive python work recently and have been looking around for the best programmer's editor but still haven't found it.

If you spend you whole day in an application you do start to think about how it could be made more productive, and of course anyone who programs can't help but customise.
Features I'm after are:
  • Syntax colouring
  • Syntax aware (auto indenting etc)
  • Real code completion (I mean language aware like looking into imported modules for possible completions)
  • Ease of showing documentation on a module and it's methods
  • Code folding might be nice
  • A full gui debugger might be nice
  • Native MacOS X application
  • Handles large projects fast
  • Subversion GUI
TextMate blew me away and was the first editor to get me off a long term addiction to BBedit, but I got a bit dissatisfied with how long it takes to check all the files in a large project when I switch back to it. (I know you can turn this off but that would be a pain too).

XCode

I've used XCode of course for Cocoa development and it has python syntax colouring built in. XCode is particularly good with large numbers of source files, it's fast and searching is really great. There's a little Script menu I hadn't played with before now and I want to share what I've discovered with you.

User scripts for that little menu go in ~/Library/Application Support/Apple/Developer Tools/Scripts/ (insane eh?).

Inside that Scripts directory you should copy the default StartupScript and 10-Users Scripts folder from /Library/Application Support/Apple/Developer Tools/Scripts/

Here are my scripts, mostly adapted from the excellent ones that come with TextMate.

10-PyChecker.sh

#! /bin/bash
#
# -- PB User Script Info --
# %%%{PBXName=PyChecker}%%%
# %%%{PBXKeyEquivalent=}%%%
# %%%{PBXInput=None}%%%
# %%%{PBXOutput=None}%%%
#
PYCHECKER=/opt/local/bin/pychecker
TEMPOUT=/tmp/check.txt

${PYCHECKER} --only %%%{PBXFilePath}%%% > ${TEMPOUT}
open -a /Developer/Applications/Xcode.app ${TEMPOUT}

20-run.sh

#! /bin/bash
#
# -- PB User Script Info --
# %%%{PBXName=Python Run...}%%%
# %%%{PBXKeyEquivalent=}%%%
# %%%{PBXInput=None}%%%
# %%%{PBXOutput=SeparateWindow}%%%
#
#
PYTHON=/opt/local/bin/python
TEMPOUT=/tmp/out.txt

echo "Running %%%{PBXFilePath}%%%..." >${TEMPOUT}
${PYTHON} %%%{PBXFilePath}%%% >> ${TEMPOUT}

open -a /Developer/Applications/Xcode.app ${TEMPOUT}

30-pydoc.sh

#! /bin/bash
#
# -- PB User Script Info --
# %%%{PBXName=pydoc}%%%
# %%%{PBXKeyEquivalent=}%%%
# %%%{PBXInput=Selection}%%%
# %%%{PBXOutput=None}%%%
#
#
pydoc -k %%%{PBXSelectedText}%%%

# This command takes the currently selected word and
# displays the python documentation for the module
# corresponding to said word.
#
# It falls back on the current word.

# change to /tmp to avoid possibly overwriting
# an html file in the working directory.

PYDOC=/opt/local/bin/pydoc

cd /tmp

${PYDOC} -w "%%%{PBXSelectedText}%%%" >/dev/null
if [[ -f "%%%{PBXSelectedText}%%%.html" ]]; then
open "%%%{PBXSelectedText}%%%.html"
#rm -f "%%%{PBXSelectedText}%%%.html"
else
echo "

No documentation found for:

%%%{PBXSelectedText}%%%

This command only looks for Python modules."
fi

40-python reference.sh

#! /bin/bash
#
# -- PB User Script Info --
# %%%{PBXName=Python Reference}%%%
# %%%{PBXKeyEquivalent=}%%%
# %%%{PBXInput=None}%%%
# %%%{PBXOutput=None}%%%
#
#
open http://www.python.org/doc/2.4/modindex.html

Thursday, October 12, 2006

One image spam

I've been getting tons of spam that gets through our office's SpamAssasin filter. This was brought home to me big time after being away from the internet for 10 days. I was faced with almost 300 emails - mostly spam to plough through.

Apple Mail's spam filter is good if it has something to munch on, but these messages have one big gif image and then a random few lines of text from a story.

I created this little mail rule to filter them and it works nicely. Note that I get mail from several servers so I only do this filtering on mail direct to the office server.

I check the Junk folder and if there's somebody there I do want to get mail from I simply right click their name and "Add to Address Book".