glennji.com

A chaotic problem domain requires an iterative solution

linux

Oct 06

Detecting USB media players (Rhythmbox, Banshee, Amarok)

The GNU/Linux music players can detect USB devices as media-players and playback from them, just by adding a little metadata to the devices' filesystem. Create a file in the root of the filesystem named .is_music_player with the following content:

  1. audio_folders=Music/

Restart Rhythmbox, Banshee or Amarok and you're done!

Oct 29

Mount an ISO as a DVD drive

To mount an ISO image, use the loopback device:

sudo mount -o loop somedvd.iso /media/fakedvd

Now you can point any DVD programs at /media/fakedvd rather than /dev/dvd, for example.

Unison

http://www.cis.upenn.edu/~bcpierce/unison/ Unison File Synchronizer is a tool for synchronizing files and directories on Windows, Mac OS X and Linux. Unison works on both local and remote (SSH) filesystems, and handles "merges" in both directions (i.e. files can be updated on both the local and remote filesystem, and Unison will ensure that after synch both filesystems contain only the latest versions). It also handles deletes.

Unison also runs on the Nokia 770 (and probably the Nokia N800).

Linux
Mac OS X
Microsoft Windows

Jul 11

Gaming for self-improvement

Some people are naturally strategic thinkers. We all subconsciously process a multitude of data-points -- other peoples' emotional states, for example; the tiny signals that say "danger!"; even driving a vehicle. But some people take that processing to a higher abstraction and think in terms of situations, outcomes, agents -- even if they don't realise that's how they think.

Someone who is good at chess is obviously a strategic thinker. But so is the social or corporate climber, or the rally-organiser, or the RTS-gamer. Hell, business-people and entrepreneurs are strategic thinkers of a high-order. This might be obvious to a lot of people, but I've realised that I don't think this way. Strategy lets me down. I play instant-action games (FPS) and live for the moment, with only a cursory nod towards the future ... since the future I plan for may not eventuate!

So I decided that I should take steps to improve my strategic thinking abilities, and after talking to a friend I decided upon a computer game called "Dawn Of War". Set in the distant-future Warhammer 40,000 universe, you control squads of the post-human "Space Marines" and battle various alien and other-dimensional beings. What I like about Dawn Of War is the rich mythology and storyline -- I read some Warhammer 40,000 books growing up, and have seen the table-top game in stores (although not tried it). So it fulfils my basic need for imagination-fuel better than the old favourites Starcraft, Total Annihilation or Command & Conquer.

Better, the game was £10 from Amazon, and ran first-time in Wine on Ubuntu Linux.

Like I say, I'm not naturally a strategic-thinker, but I have noticed a certain change in my abilities as I play through the levels (sometimes multiple times, to try out different tactics). I was also thinking this morning about the general rules for RTS games I've determined so far, and how they might apply to things in Real Life® (RL):-

Nail the build-order
Or: Determine the optimal process
In-game, this means figuring out what the best order of build commands should be: do I need a main base, then a plasma generator, then a barracks, another generator then a squad? There is definitely an optimal process to building up big in as short a time as possible, and games like Dawn Of War capitalise on that by introducing new units, vehicles and structures with each tutorial mission.

In-RL, process optimisation is the best way to either lighten your workload (if applied to a 9-to-5 job) or get more done (if applied to your own entrepreneurial endeavours). To optimise a process you have to both observe the process and consider it -- that is, apply conscious analysis and effort to an accurate mental model of the process, rather than just following a process because it is familiar or for its own sake. Most humans will just follow the process without deep-thinking it -- why else do we exchange most of our time for money? Even if we are the boss?

Keep your troops close
Or: proximity begets communication/cooperation
In-game: any army can be defeated if spread too thin, and having more than a few clusters of troops means you cannot effectively monitor them -- a war on too many fronts is a losing proposition. (This has been used by military leaders historically, and is the reason we use the singular phrase "The Front" or "The Front Line" rather than something like "The Fronts".) So cluster together, build a secondary base near the front if possible and replenish your troops from there.

RL: Apart from the obvious military tactics, it makes sense to keep your resources close-at-hand. For personnel, co-locating business (sales, marketing) and technology (operations, manufacturing) means real communications and faster reactivity to the changing market (the "front" for commercial enterprise). For personal, having a "dashboard view" (e.g. of finances) allows for situational analysis and problem avoidance that is both fast and intelligent. Continuing the finance example, it makes sense to have a portfolio (hell, a spreadsheet will do) of all investments, assets, savings, debts, debtors and budgeted projected requirements in one place.

Automatic-fire gun turrets are your friend
Or: automate everything -- including notification
In-game example: For the last mission I played, I had multiple attack points -- enemy troops (those damn Eldar) would hit me from a number of sides, and it was all I could do to move my retalitory troops from one side of the base to the other. Not good. So I built up the necessary capabilities and started placing automatic-fire gun turrets at the usual incursion locations.

Suddenly my troops weren't even needed -- a couple of turrets could take out all but the most concerted attack, and my builder (technician, drone) was nearby to repair or replace the turrets as needed. I could build up my army and begin my own strikes, expanding the "safe" territory ... and then building more automatic-fire turrets, expanding, rinse and repeat ad infinitum (or at least until the end of the mission).

In RL as in the game, automation is a necessary tactic for getting beyond the level of survival (putting out fires, keeping the show on the road, keeping our heads above water -- we have so many colloquialisms for this because it's deep in our psyche) towards actually doing something useful. Utilising humans as brainless robots is stupid; doing it to ourselves is even more ridiculous.

When I refer to automation in RL, I mean getting a more efficient system to do repetitive tasks for us, leaving us to do the things we are good at. It includes the field of "intelligence augmentation" (using systems to provide us with appropriate information in a ready-format which augments our decision-making) and even, say, World Wide Web search engines. If I pay my bills by direct-debit or standing order, it's automated. If my PC backs up my personal files for me, it's automated. If my Oyster travel card adds £20 every time the balance gets too low ... you guessed it.

In Timothy Ferris' Four Hour Work Week, automation is the key to a low-maintenance "muse" business -- every possible part of the order-fulfillment backend is integrated, so an order on the web is sent directly to the factory, which sends the completed goods to a drop-shipper (who was also automatically advised of the delivery destination). This leaves Tim to either deal with customer queries, or go swimming in Greece. Whichever he prefers.

But of course you have to trust your automated systems, and the only way to do that is to be notified of exceptional situations. Automation's noisy twin is thus notification -- you want to know if you're double-charged, or your manufacturing chain breaks down, or your solar collector array is on fire. Unless it's AI, an automated system will eventually be out-of-date and out-of-sync with it's environment i.e. the model upon which the system was based no longer matches reality. So timely, appropriate notification of exceptional "edge-conditions" can allow you to tweak the automated system back in-line.

Anyway, that's all I've got so far. I'm sure there's much more that can be learned from strategy games.

Stompbox

Take a hackable wifi router and add an EVDO card and you have a http://www.stompboxnetworks.com/ Stompbox - a mobile wifi hotspot to carry in your car or backpack.

TuxDroid

http://www.tuxisalive.com Tuxdroid by http://www.kysoh.com KYSOH is a remote-controlled robotic penguin that resembles 'Tux', the Linux mascot. A transceiver connects to your PC via USB and allows wireless (RF) communications with Tuxdroid, allowing you to script actions and responses in Python.

Tuxdroid can, for example:
  • announce news, emails and/or status of home-automation devices
  • recognise when you turn the lights on in the room
  • flap his wings when the home-automation system detects someone approaching outside
  • act as a VOIP microphone and loudspeaker
  • ... and so on
May 23

Evolution new mail notification

    #!/usr/bin/env python
    import dbus
    import dbus.glib
    import gobject

    bus = dbus.SessionBus()
    bus.get_object("org.freedesktop.DBus","/org/freedesktop/DBus")
    notify_service = bus.get_object('org.freedesktop.Notifications', '/org/freedesktop/Notifications')
    notify_interface = dbus.Interface(notify_service, 'org.freedesktop.Notifications')

    def newmail_handler(msg, msg2):
        notify_interface.Notify("evo-notify", 0, '', "New Email", msg, [], {}, -1)
    
    bus.add_signal_receiver(newmail_handler, dbus_interface = "org.gnome.evolution.mail.dbus.Signal", signal_name = "Newmail")
    
    loop = gobject.MainLoop()
    loop.run()

Nokia 770

Nokia_770.jpgThe Nokia 770 (and the latest incarnation, the Nokia N800) are "internet tablets": small, portable devices specifically for accessing the Internet, including web-browsing, email, instant messaging and VOIP. The Nokia 770 has a large touchscreen, a small directional keypad and some other function buttons. It can connect to the Internet via Wifi (IEEE802.11b/g) or Bluetooth (i.e. connecting through your phone to use dial-up or a data plan).

The 770 is based on Linux and a Gnome-derivative user interface called "Maemo". As both Maemo and Linux are open source, there is an active developer and hacker community writing different applications and software for all sorts of things -- e-book readers, intrusion (detection) tools, integrated media browsers and players, automotive telemetry, GPS and even aeronautical displays for experimental aeroplane designs.

For home automation, the 770 supports application programming in a number of languages, including Python. Also, the default browser (a version of Opera) can do AJAX, which opens the way for dynamic web-based interfaces.

Resources

Developer

Tips

I just watched Rise of the Silver Surfer. That's a Nokia 770 that Reed Richards is obsessed with! I hadn't thought of hooking the tablet into a world-wide satellite network, I must admit ...
--glennji 03:58, 4 October 2007 (PDT)

Linux

http://www.linux.org Linux is an open source operating system comprised of the Linux kernel and a number of GNU libraries and utilities. There is a huge number of different GNU/Linux distributions, with various differences and intended applications (e.g. firewalls, embedded systems, media centres, workstations, clusters, home PCs).

DNS-SD

http://www.dns-sd.org/ DNS-SD is a protocol for enabling the automatic discovery and configuration of network services such as printers, websites, music collections, file shares, etc. As the name suggests, it utilises standard DNS messages and servers.

DNS-SD has been implemented and marketed under a number of different names, including Rendezvous, Bonjour, and Avahi. It is used in Zeroconf networks.