Android, ASE and rsync

I happened to notice that the rsync command was included on my HTC Desire, so I figured I could use it to send scripts to the device, but it also doubles as a very convenient way to backup my pictures and stuff. (It’s probably most convenient for unix users – which is whom this write-up is intended for. You can get rsync for Windows as well, but I haven’t used it much. YMMV.)

Anyway, to get started you need an rsyncd.conf file. Here’s mine, which I chose to place at /sdcard/rsyncd.conf:

port = 1234
pid file = /sdcard/rsyncd.pid

[data]
    path = /
    list = false
    use chroot = false
    read only = false

Then I wrote two tiny shell scripts with ASE to start and stop the service:

start_rsync.sh:

rsync --config=/sdcard/rsyncd.conf --daemon

and stop_rsync.sh:

pid=`cat /sdcard/rsyncd.pid`
kill $pid
rm /sdcard/rsyncd.pid

Yes, I should add some sanity checks to verify it’s stopped or running, but I’m lazy. :P

I put short-cuts to the latter two on my phone’s “desktop” for easy access. Leaving it running permanently might not be such as good idea, unless you add rsync authentication. Or never use untrusted networks.

Anyway, with this setup you can easily copy scripts to the phone like so;

rsync blah.py rsync://192.168.1.100:1234/data/sdcard/ase/scripts/

Or backup your scripts (say, if you edit them on the phone);

rsync -av rsync://192.168.1.100:1234/data/sdcard/ase/ $HOME/ase-backup/

Or just browse:

rsync rsync://192.168.1.100:1234/data/

(And if you don’t realize that you have to replace the IP address above with whatever address your device was assigned, this post probably isn’t for you.)

Hope someone finds this tip useful. I know I find it very handy. :)

Posted in android, tech | 7 Comments

Zombies!

In a strange culmination of coincidences my life has been filled with zombies lately. Go figure.

I recently read Max Brooks’ The Zombie Survival Guide, a hilarious tongue-in-cheek guide to – well, guess! I recently ordered a copy of the more serious World War Z by the same author, having read some very promising reviews of it.

Furthermore, I recently got around to watching Død Snø, a new Norwegian horror movie about zombies – nazi-zombies, even! Good, campy and very gory fun.

And to top it off, this morning, a large number of Twitter-users down under reported a large-scale zombie outbreak in Sydney during a power outtage. Chaos, confusion and hilarity ensued. It even showed up in the media and in a news feed from the
NSW Police Department. Good times!

Posted in general | Leave a comment

Hidoku-bok

(English readers; Pardon the norwegianness of this article, but since it’s about a book written in Norwegian, it’s not very useful to you unless you can read it anyway.)

Jeg har blitt bitt (eller små-tygd på, om du vil) av en ny grublebasill, i min mening en svært så verdig arvtager til Sudoku, nemlig Hidoku (eller Hidato, som det også er kjent som, men det er et registrert varemerke, så…) Boken er på 131 sider, på norsk, og inkluderer 100 oppgaver av varierende vanskelighetsgrad med løsning, samt en veiledning i metoder og strategier for å løse oppgavene. Det høres sikkert vanskeligere ut enn det er, og jeg anbefaler alle å prøve seg på et par oppgaver før de gir opp – du finner et par eksempler hvis du velger forhåndsvisning av boken. Det eneste du må kunne er å telle. Det er gøy og sunt for hjernen. :)

Boken er å finne her: http://stores.lulu.com/vidarino

Posted in general | Leave a comment

Blender stuff

Some random bits showing off some of my Blender projects.

Spider-thingy

2008-03-07

A small test overlaying an animated object on top of a real background.

The Bæ Chronicles - Episode 1: The Jump

Some time ago - in January 2005 I think - I made this short for Marius (my son, who was about 1.5 years old at the time). He has a plush(ish) sheep which he calls "Bæ" (which is norwegian for "baa", in case that wasn't obvious ;), which I thought it would be fun to animate. It was fun, but most of all it was an incredibly useful learning experience, as I had to use many of Blender's animation tools that had evaded my attention earlier (actions, the NLA editor and the sequences, to mention a few).

Movie (3 MB MPEG4) here:

3D self portrait

Click for larger versions:

Alien head

Just an alien head I accidentally modelled. (Yes, "accidentally". I was working on another model, and decided to redo the nose, and when I removed it, it looked like some kind of alien. So i glued the hole shut and went from there...)

Here's a short animation that shows some of the facial movements I've added so far. I need a few more to do any lip-sync, and some of the existing ones need some improvements, but here's what I have so far.

The movie (300 KB MPEG4):

Yet another head project

Click for larger versions:

Started as a "brute" kind of character;

Decided to go for a weary, old fellow instead, here a few shots from the texturing process;

Eyes and ears:

Post-tweaking:

Posted in general | Leave a comment

QuicKutz Silhouette under Linux

Linda recently bought herself a QuicKutz Silhouette plotter/cutter (a re-branded Graphtec CC200-20, actually), and I thought it would be an interesting project to get the device working under Linux. And it was! After a few days of intense observation (my first real USB-sniffing project) I had most of the protocol pat down, and I hereby present graphtecprint v1.0 (a somewhat odd name, considering it?s not really a printer, but since itself claims to be I?ll just go on and humour it).

Posted in general | 1 Comment

graphtecprint

graphtecprint is a driver / cutting application for the desktop plotter / cutter Graphtec CC200-20 or any of the OEM models based on it, such as the QuicKutz Silhouette (and reputedly Xyron Wishblade). It may work on other Graphtec devices as well, but it’s so far only tested on the CC200-20. It was developed on Linux, but in theory it should work on other Unix-like operating systems, too, and perhaps even Windows (not tested!). The rest of this page will assume that you’re using a Linux distribution.

Update Jul 9th, 2008: Wow, that took a while, but I have just released v1.0.1 which incorporates the Wishblade changes as well as fixes a bug with missing text with recent versions of pstoedit. Speaking of recent versions, Inkscape has had a printing redesign, and seems to be missing the “print to pipe” option from earlier, which means you have to print to a file and pipe it to graphtecprint manually for now.

Update Feb 2nd, 2008: Rick Stuart has helpfully provided me with the changes necessary to make graphtecprint work with his (first generation?) Wishblade! I will release a version 1.0.1 shortly, which will support this device properly.

Requirements

First of all, and unsurprisingly, you need a compatible Graphtec cutter.

To see if you have a compatible device, run “lsusb”. You should see a line looking something like this, the important bit in bold:

$ lsusb
. . .
Bus 001 Device 003: ID 0b4d:110a
. . .

If the numbers differ you likely have another model, but it might still work.

You can also use the “usb_printerid” utility that comes with “foo2zjs” package you may or may not already have installed:

$ sudo usb_printerid /dev/usb/lp1
GET_DEVICE_ID string:
MANUFACTURER:Graphtec;MODEL:CC200-20;CLASS:PRINTER;DESCRIPTION:Graphtec CC200-20;

graphtecprint requires the following packages to be installed:

  • python (tested with 2.5, other versions may work)

  • python-gtk2
  • python-glade2
  • python-cairo
  • pstoedit (tested with version 3.44, others may work)
  • ghostscript

If you are using Debian or a Debian based distribution, such as Ubuntu, running “sudo apt-get install ” should do the trick. For other distributions, follow the normal procedure of finding and installing software. Chances are that several of these are installed already. Your mileage will vary.

Installing

There are two ways of “installing” graphtecprint. The first way is to install it alongside other installed programs:

tar xvzf graphtecprint-1.0.tar.gz
cd graphtecprint-1.0
sudo cp graphtecprint /usr/local/bin/
sudo mkdir /usr/local/share/graphtecprint
sudo cp *.png *.glade /usr/local/share/graphtecprint

Alternatively, the program and data files can be installed in their own separate directory, e.g. /opt/graphtecprint:

tar xvzf graphtecprint-1.0.tar.gz
cp -a graphtecprint-1.0 /opt/graphtecprint

Usage

The program was primarily tested to work with Inkscape, but in theory, all applications capable of printing PostScript to a file or a pipe should work. If you come across a program whose output does not work, feel free to inform the author. (Note that raster graphics from programs such as the GIMP can’t possibly work. Only vector graphics elements will be parsed by this program.)

To cut using Inkscape, open or edit your file of choice, then go to the File menu and select Print. In the Print dialog, select “Print using PostScript operators”. Under “Print destination”, type “| graphtecprint” (the first symbol is a pipe symbol). If you have installed graphtecprint under a directory that’s not in your path you must enter the full path instead, e.g. “| /opt/graphtecprint/graphtecprint”

If you’re using another application, see if it can print to a pipe directly. If so, the procedure should be very similar to the one above.

If the application can not print to a pipe, chose “Print to file” (most applications should offer this) and select an appropriate file name. Then, in a terminal window, run “graphtecprint < somefile.ps", substituting "somefile.ps" for the name of the file you just printed to.

If everything goes according to plan, you should now get the main dialog window. If not, check your program's terminal for error messages that may explain what went wrong.

Screenshot

Notes

Everything should be more or less self-explanatory, but there are some things to note:

- You need write access to the USB device file! (The “Device” pulldown menu should list the detected cutter and its character device. To give yourself (everyone, actually, so beware) write permissions, open a terminal window and run the command “sudo chmod a+rw /dev/usb/lpX”, where X is the number of the device shown in the pulldown menu.)

- Paper size should match the page size from your application. This information doesn’t make it through the format conversions, unfortunately.

- Orientation is hardcoded to portrait so far, as the overlying application would normally do the work of rotating it if it is a landscape drawing.

- The fine tuning buttons will not work with the usblp driver. For these to work you will need a separate driver for the cutter, or possibly a patched usblp driver. None of these options are implemented yet, but they might be in the future.

Download

The latest version is 1.0.1 and can be downloader here:
graphtecprint-1.0.1.tar.gz

Posted in general | 38 Comments