CrashPlan - Another attempt to do proper backups

As I wrote here I am using Wuala. I mostly like it. I don’t like not be anymore able to give away some storage space for others and in return be able to use other people’s storage space. It was a neat point of Wuala, but that was “fixed” last year, and then it’s either pay or stop using it (beside the small initial space everyone gets).

Welcome to CrashPlan. It’s quite similar compared to Wuala but with 2 differences which I like a lot:

  1. You can back up to your own disks or friends disks
  2. If you pay, it’s unlimited data and deleted files are kept

That sounds like a good deal, but with prices for 2TB disks (even after the disaster in Thailand) at about US$150, it probably works out fine for them.

I’ll have to test this a bit more, but so far, it looks like a good backup method. Time to upgrade our ADSL line…

PS: Picture taken from the Italian Wikipedia.

 

 
More 16 Segment LED Fun

I continued to look for a 16 Segment Font, alas, there seems to be none. The best I found are two videos on YouTube. So I finally made my own one, and for the benefit of the world, here the code for all printable 96 ASCII characters:

#include <avr/pgmspace.h>

// Segment bit order is (MSB) A1 A2 B C D1 D2 E F G1 G2 H I J K L M (LSB)
const uint16_t uiCharacterMap[96] PROGMEM =
{
 // SPACE ! " # $ % & '
 0x0000, 0x0300, 0x0110, 0x0fd2, 0xddd2, 0x95db, 0x8eb4, 0x0010,
 // ( ) * + , - . /
 0x000c, 0x0021, 0x00ff, 0x00d2, 0x0001, 0x00c0, 0x0004, 0x0009,
 // 0 1 2 3 4 5 6 7
 0xff09, 0x3008, 0xec41, 0xdc48, 0x01d2, 0xcd84, 0x1fc0, 0xc00a,
 // 8 9 : ; < = > ?
 0xffc0, 0xf1c0, 0x8080, 0x8081, 0x0c09, 0xc0c0, 0x0c24, 0xe142,
 // @ A B C D E F G
 0xfe83, 0x3049, 0xfc52, 0xcf00, 0xfc12, 0xcfc0, 0xc3c0, 0xdf40,
 // H I J K L M N O
 0x33c0, 0xcc12, 0x3e00, 0x038c, 0x0f00, 0x3328, 0x3324, 0xff00,
 // P Q R S T U V W
 0xe3c0, 0xff04, 0xe3c4, 0xddc0, 0xc012, 0x3f00, 0x0309, 0x3305,
 // X Y Z [ | ] ^ _
 0x002d, 0x002a, 0xcc09, 0x8b00, 0x0024, 0x7400, 0x0120, 0x0c00,
 // ` a b c d e f g
 0x0020, 0x8e92, 0x0b82, 0x0a80, 0x0e92, 0x0a81, 0x40d2, 0x8992,
 // h i j k l m n o
 0x0382, 0x0a00, 0x0812, 0x001e, 0x0412, 0x12c2, 0x0282, 0x0a82,
 // p q r s t u v w
 0x8390, 0x8192, 0x0280, 0x0444, 0x04d2, 0x0e02, 0x0201, 0x1e02,
 // x y z { | } ~ DEL
 0x002d, 0x3450, 0x0881, 0x4492, 0x0012, 0x8852, 0x0128, 0x00ff
 };

Note the PROGMEM extra attribute which is helpful on a Harvard CPU like the ATmega are. Without it, the table will be copied and used in RAM. 192 Byte in total does not sound too bad, unless you use an ATmega168 which has only 1 kByte. To access this type of special memory, you need the include file and to access the array, a special function is needed:

a=pgm_read_word_near(&(uiCharacterMap[i]));

It’s all documented here. On a normal CPU (more RAM, no Harvard architecture) you would not bother.

I thought about adding “spinning things”, but those are trivial to make and I thus leave those as an exercise to the reader.

 
Motorola Milestone 2 and Gingerbread!

Unbelievable, but my Milestone 2 has received its update to Android 2.3 AKA Gingerbread. When I bought it with Android 2.2 (Froyo) I though “Surely Motorola will bring out an update as soon as they can, as it will create brand loyality if the company shows after-sales support, so people will want to buy Motorola again.” Well, that turned out to be nonsense and Motorola did not even commit to any updates. I gave up all hope, but for fun I checked, and lo-and-behold: There’s an update available here.

Worked fine. Have patience and follow the instructions. There are 2 times when you think “now it crashed”, but it’s not. The full process takes about 20 min. Afterwards no loss of data (in my case), except my Bluetooth headset wanted to be authorized again. Everything is snappier now and looks better at the same time. It’s a worthy update and if it had some 6 months ago and announced when Gingerbread came out, it would have made me a Motorola fan.

That being said, Samsung is not better. So I guess the next phone or tablet will be a Nexus.

 
RC Helicopter Fun

It looked like fun to do and it turned out to be a lot of fun: flying a remote controlled helicopter. The are hard to control, and if you lose control, they break easily.

Having seen that and ignoring the crashing part, it still looked like fun. And smaller RC heli’s don’t break so easily anymore, and with gyros built-in nowadays, they are reasonably stable to fly. And the very small ones (like 20cm rotor diameter)  are so light, if they fall on the floor, they don’t damage anything severely and don’t get damaged.

I got mine from http://www.hobbyking.com (look for the HK-190 for surprisingly cheap US$30). It’s certainly not high end and not collective pitch, but at that price, who’s to complain? Get some extra batteries (the 160mAh Turnigy are ok).

It’s as much fun as I expected!

Lots of resources available on the web. Example is  http://www.rchelicopterfun.com/ and http://rchelicopterguide.blogspot.com/2009/08/beginner-rc-helicopter-flying-training.html and http://www.swashplate.co.uk/ehbg-v17/ehbg_index.html and there are many more.

 

 

 

 

 
EAGLE - First Impression

EAGLE is probably the most common software used for PCB creation. Many years ago I saw a professional using it on DOS. Looked good and not simple at all. Back then creating PCBs was quite expensive too, so I never thought about making them myself. For most of my purposes a breadboard works well enough. For a bit more permanent things I have those which is just the same layout and connections, but for soldering.

For a bit more complex things though the problems of breadboards become an issue:

Distressing as it may sound, solderless breadboards can be very flakey, especially as they age. If you’re having problems with your circuit, it could be that the little metal clips on the inside aren’t working well. Try poking it with your finger, or moving it to a different section.

It’s still great for small tests, but for permanent things, expect a  low reliability.

Anyway, for a large clock using those quite large 16 segment LEDs, breadboards don’t work well: a single digit is too large and needs 2 breadboards, with some gap between. The next digit will have a lot of gap between the previous digit. All in all, not optimal.

In the end, and because that clock will be permanent, some soldering is needed. Soldering without PCB is not fun: lots of burned fingers, a messy layout and errors are my experiences. A PCB would be sooo much nicer.

Enter the world of low-cost PCB manufacturing. The low price is done by merging small PCBs onto one larger one, which splits the setup costs by many users. In the end, a 5cm by 5cm board with 2 layers of copper, solder stop mask, silk screen is amazingly US$10. Larger ones get a bit more expensive, but it’s still cheap. And I get 10 boards. There is some extra delay of course as all those small boards needs to get pooled to one large PCB.

What does it have to do with EAGLE? EAGLE is the program which is recommended to create the PCBs from. Other programs work too (e.g. KiCAD), but most tutorials are for EAGLE and most services can handle EAGLE files, either directly or indirectly. EAGLE also runs on Linux.

So I downloaded EAGLE v5.1 as

aptitude install eagle

did not work.

And then the steep learning curve of EAGLE started. At first I could not do anything at all; this is an old program and it shows: hardly anything works as expected. This tutorial helped me to get started. It stops where the layout starts though, so here my additions:

  • If you want to fill a plane (e.g. with GND), make a polygon on the board layout of where you want it. RMB (right mouse button) will show the properties of it. Add Isolate to have a distance from signals. 0 is a stupid default value.
  • Use the name command (RMB on the polygon) to merge it with the GND signal (of whatever signal you want to have connected).
  • To start the autorouter, click on the autorouter button (yeah, it sounds very straightforward). Any signals which could not be connected will be air-wires (thin yellow lines).
  • To rip up one trace, use RMB and delete.
  • To rip up all traces, click on the ripup button, then on the go icon (the traffic light next to the STOP icon).
  • Click on ratsnest to see the polygon being poured.
  • It’s fun to watch the autorouter on slightly complex layouts. If your design is complex or space is too limited, you might end up with some air wires. Try to relocate some components.
  • The rules file document dictate what the manufacturer can do. E.g. available drill sizes or capabilities like thinnest possible traces etc. The default values are quite conservative. To load, click on Edit/Design rules and load the rules for your service.
  • The CAM file creates the layers (copper per layer, silk screen, solder stop masks). It creates all the needed Gerber files.
  • gerbv is a nice utility to display those created Gerber files layer for layer. Use it recommended. While you’ll unlikely stop small errors (e.g. a single traces missing), you’ll find layers completely missing.
  • Never only open schematics or board view. Always have both open, as otherwise you create inconsistencies which are not fun to manually fix. As long as both are open, any modification on one window will update the other one.
  • The free version of EAGLE is limited to 8cm by 10cm and 2 layers. Good for small stuff. For hobby use (non-commercial) you can get the standard edition (10cm by 16cm, 6 layers) for modest US$125. I doubt I’ll need those capabilities, but if I do, I know there’s a cheap upgrade path.
TODO on my side:
  • Understand the bus feature. That will clean up the schematics a lot.
  • Name signals
  • Create library items (e.g. for the MCP23017 I found no usable library so I had to use a generic 28 pin DIL socket with no proper names and no knowledge of what is input or output or GND or Vcc.
 
GLANTANK - Resurrected

I have not used my GLANTANK for quite a while. Now it has a new purpose: I use as a server for lsync. lsyncd is what I was looking for for a while: it synchronizes directories a la rsync (it’s actually using rsync for that), but it is using the inotify feature of the Linux kernel which informs a process that a file has changed. So instead of scanning every (say) 1h thousand of files, it copies the ones which are modified much sooner and does not need a full scan of all files except on startup.

The old Debian installation was outdated, so I wanted to re-install Debian Linux on the GLANTANK first. I used the same instructions in the past and it worked as expected. So I was hopeful this time too. ssh never started up though.

The only way to see something happening then is to use a serial console. See also here for some pictures. Pins are 1:3.3V,  2:RxD, 3:TxD, 4:GND. 115200 bps and 8N1.

And the problem is that the latest kernel 2.6.32-5-iop32x has no driver for the GLANTANK disk interface, and that stops the installation process. The fix is on the Debian bug list and that solves it.

Next problem are the not-so-quiet fans. There’s a program to control them called fanctld. Needs kernel header files and gcc-4.3 to create a working fandrv.ko kernel module.

Update: Plugging in and out of disks with a cable which is soldered to the mainboard is a bad idea: the cable broke and no disk worked afterwards. Well, it was fun while it lasted.  Which was until now.

 

While cleaning up some directories on my computer, I found my first (and my only) commercial web page I created when I was at university. Of course it’s updated now, but here is an old copy. The current one for reference is here.

 
Want to buy a HDD in Akihabara? Bad Timing.

Getting a new HDD was always easy enough to do. Until recently with the Thailand flooding. Now it’s hard to get a new one, and if you do, the price increase quite a bit. For those who can read Japanese: http://akiba-pc.watch.impress.co.jp/hotline/20111105/etc_hdd.html and for those who don’t here an English translation.

Prices increased to about 15000 Yen/TB, which is about 3 times as much as before the flooding. Seagate works again but Western Digital is in worse shape it seems.

I was lucky: bought a 750GB 2.5″ HDD for (compared to now) cheap just about 2 weeks ago.

 
Moving Servers

Moving servers from Strato (can’t complain, good enough service, nothing ever broke, few but regular planned outages, and not expensive either), to Linode (quite a bit more expensive for the same performance, but less performance is ok too, so it’s about the same price). The main advantage of Linode is the location: Tokyo.

Main differences:

  • Location Germany vs Japan
  • Ping round trip from home decreased from 310ms to 30ms (and 18ms is my ADSL line already)
  • CPU changed from 1 core Opteron 2347 HE to 4 core Xen L5520 (but in reality it’s only 1 core anyway, however the new one is about 3 times faster according to http://www.webhostingtalk.com/showthread.php?s=&threadid=308055)
  • RAM decreased from 2GB to 0.5GB (but I only use about 0.4GB anyway)
  • Disk size decreased from 80GB incl. backup plus 80GB ftp, to 20GB and no backups
  • Data traffic decreased from 3TB to 200GB (but I never crossed 100GB)
  • Virtualizer changed from Virtuozzo to Xen
  • I now have some transparency about oversubscription of the underlying server
  • DNS is totally different: Strato uses a simple wildcard scheme: anything with *.studiokubota.com is pointing to the server. Linode uses a more traditional scheme where I need to define those DNS entries manually. But now I have control about it and can point hosts in my domain to any IP I like.
  • IP addresses decreased from 2 to 1 (but I used the extra IP only for VPN)
  • I need to use another registrar (I actually don’t need to, but it’s much cheaper if I do)

As you can see, it’s a mixed bag, but I am, generally ok although I’ll lose the ability to do proxy services in Germany, which allowed me to see some content some companies like to prohibit me from watching (streaming movies).

As a reminder to myself, here the additional commands/configs I had to do to move the server with all stuff I need:

# This is pretty much copy & paste. Run as root on the new server.
OLD=the.old.server
NEW=the.new.server
MYSQLPASSWORD=THEMYSQLPASSWORD

# User accounts

# Add encrypted password
echo >>/etc/passwd "harald:*:2000:100:Harald Kubota:/home/harald:/bin/bash"
# Copy root .ssh directory from old server

cd ~root

rsync -av $OLD:~root/.ssh .
# Install packages
aptitude update
aptitude full-upgrade
aptitude install locate
aptitude install apache2 imagemagick openvpn  gcc rsnapshot
aptitude install libapache2-mod-perl2 libapache2-mod-php5 libapache2-mod-perl2-doc
aptitude install phpmyadmin bsd-mailx
aptitude install postfix spamassassin procmail dovecot-common dovecot-imapd
# Configure postfix as Internet site with its local name as hostname

aptitude install mysql-server

# Set mysql "root" password, do not initialize the DB beside creating it

# Installing MT5 support files

aptitude install php5

aptitude install bsd-mailx exim4 libsoap-lite-perl libdbi-perl libimage-size-perl \
libmime-charset-perl libmime-encwords-perl perlmagick libxml-libxslt-perl \
 libxml-simple-perl libxml-libxml-perl libmime-tools-perl
aptitude install libgd-gd2-perl libio-compress-zlib-perl libarchive-any-perl
# copy /var/www

rsync -avz --progress $OLD:/var/www/ /var/www/

# For test purposes, create a symbolic link to one of the existing web pages

cd /var/www
ln -s harald.studiokubota.com $NEW

# Copy apache config

rsync -av $OLD:/etc/apache2/ /etc/apache2/

# Copy backup job from /etc/cron.daily/

rsync -av $OLD:/etc/cron.daily/mysqldump /etc/cron.daily/

# Mail: postfix, dovecot, spamassassin

rsync -av $OLD:/etc/postfix /etc/
# Modify main.cf to contain all domain names and fix the hostname too
# Also add virtual names and rebuild via
postmap /etc/postfox/virtual

rsync -av $OLD:/etc/dovecot /etc/
rsync -av $OLD:/etc/spamassassin /etc/
rsync -ac $OLD:/etc/default/spamassassin /etc/default/

mkdir /var/log/spamassassin
groupadd spamd
useradd -d /var/log/spamassassin -M -g spamd -s /bin/false spamd
chown spamd:spamd /var/log/spamassassin

# To learn ham/spam by putting spam in Spam and ham in Ham, add those to your user crontab:
#10 19 * * * sudo sa-learn --spam -u spamd --dir /home/harald/Maildir/.Spam/* -D
#10 20 * * * sudo sa-learn --ham -u spamd --dir /home/harald/Maildir/.Ham/* -D

# On both servers stop spamassassin and copy the DB over
ssh $OLD "service spamassassin stop"
service spamassassin stop
rsync -av $OLD:/var/log/spamassassin .
# Start spamassassin again
ssh $OLD "service spamassassin start"
service spamassassin start
service postfix restart
service dovecot restart

# Restore mysql DB

d=`date +%d`
cat >/tmp/dump.sh <<EOF
FN="/var/tmp/dbdump-${d}.bz2"
rm -f "\$FN"
mysqldump -p$MYSQLPASSWORD --all-databases | bzip2 -9 >\$FN
EOF
scp /tmp/dump.sh $OLD:/var/tmp/
ssh $OLD "bash /var/tmp/dump.sh"

# Restore on NEW server

rsync -av --progress $OLD:/var/tmp/dbdump-${d}.bz2 /var/tmp/
bunzip2 </var/tmp/dbdump-${d}.bz2 | mysql -u root -p
mysqladmin -p$MYSQLPASSWORD flush-privileges

# Other things

rsync -av --progress $OLD:/etc/openvpn /etc/
rsync -av --progress $OLD:/etc/default/openvpn /etc/default/

Files to modify manually later:

  • /etc/openvpn/openvpn.conf
  • some more files in /etc/openvpn to create/configure (it’s obvious), and adjust the files on the VPN client too
 
Eclipse Indigo and AVR Plugin

How to add the AVR Plugin into Eclipse 4.0 AKA Indigo:

Done. Without the first link you’ll get an error which does not really help a lot.

 

© 2011 Harald's Random Stuff Suffusion theme by Sayontan Sinha