BeagleBone Black pinmux and DTS helper

Tags: , , , , , ,

To make creating a consistent Device Tree overlay easier for the Beagle Bone Black, I’ve created a small helper. It can:

  • Read the contents of the various pinmux files, and display a combined output
  • Generate a template DTS file

To display the current pin configuration, just run the utility without any parameters:

$ ./bb-pins.py
Header P8_25 Name: GPIO1_0 Number: 0 GPIO: 1 0x800/000 Mode: mmc1_dat0 (1) Direction: in PUD: pull-up (Allocated: group: pinmux_emmc2_pins)
Header P8_24 Name: GPIO1_1 Number: 1 GPIO: 33 0x804/004 Mode: mmc1_dat1 (1) Direction: in PUD: pull-up (Allocated: group: pinmux_emmc2_pins)
Header P8_05 Name: GPIO1_2 Number: 2 GPIO: 34 0x808/008 Mode: mmc1_dat2 (1) Direction: in PUD: pull-up (Allocated: group: pinmux_emmc2_pins)
Header P8_06 Name: GPIO1_3 Number: 3 GPIO: 35 0x80c/00c Mode: mmc1_dat3 (1) Direction: in PUD: pull-up (Allocated: group: pinmux_emmc2_pins)
Header P8_23 Name: GPIO1_4 Number: 4 GPIO: 36 0x810/010 Mode: mmc1_dat4 (1) Direction: in PUD: pull-up (Allocated: group: pinmux_emmc2_pins)
Header P8_22 Name: GPIO1_5 Number: 5 GPIO: 37 0x814/014 Mode: mmc1_dat5 (1) Direction: in PUD: pull-up (Allocated: group: pinmux_emmc2_pins)
Header P8_03 Name: GPIO1_6 Number: 6 GPIO: 38 0x818/018 Mode: mmc1_dat6 (1) Direction: in PUD: pull-up (Allocated: group: pinmux_emmc2_pins)
Header P8_04 Name: GPIO1_7 Number: 7 GPIO: 39 0x81c/01c Mode: mmc1_dat7 (1) Direction: in PUD: pull-up (Allocated: group: pinmux_emmc2_pins)
Header P8_19 Name: EHRPWM2A Number: 8 GPIO: 22 0x820/020 Mode: gpio0[22] (7) Direction: in PUD: pull-down 
Header P8_13 Name: EHRPWM2B Number: 9 GPIO: 23 0x824/024 Mode: gpio0[23] (7) Direction: in PUD: pull-down 
Header P8_14 Name: GPIO0_26 Number: 10 GPIO: 26 0x828/028 Mode: gpio0[26] (7) Direction: in PUD: pull-down 
...

But more interestingly, to generate a DTS file just specify the various pin-functions you would like to enable, the pin direction and any pull-up/pull-down you want:

$ ./bb-pins.py 'gpio2[2],out' 'gpio2[3],out' 'gpio2[5],out' 'gpio2[4],out' 'gpio1[13],out' 'gpio1[12],out' 'gpio0[23],in,pullup' 'gpio0[26],in,pullup' 'gpio1[15],in,pullup'

This will dump the following DTS to stdio.

/dts-v1/;
/plugin/;

/{
  compatible = "ti,beaglebone", "ti,beaglebone-black";
  board-name = "CustomizeThis";
  part-number = "CustomizeThis";
  version = "00A0";

  exclusive-use =
    "P8.07" /* gpio2_2 */,
    "P8.08" /* gpio2_3 */,
    "P8.09" /* gpio2_5 */,
    "P8.10" /* gpio2_4 */,
    "P8.11" /* gpio1_13 */,
    "P8.12" /* gpio1_12 */,
    "P8.13" /* gpio0_23 */,
    "P8.14" /* gpio0_26 */,
    "P8.15" /* gpio1_15 */,
    "gpio2_2",
    "gpio2_3",
    "gpio2_5",
    "gpio2_4",
    "gpio1_13",
    "gpio1_12",
    "gpio0_23",
    "gpio0_26",
    "gpio1_15";

  fragment@0 {
    target = < &am33xx_pinmux>;

    __overlay__ {
      pinctrl_generated: RNS_Generated_Pins {
    pinctrl-single,pins = < 0x090 0x0f /* P8_07 36 GPIO 66 out Mode: 7 */
          0x094 0x0f /* P8_08 37 GPIO 67 out Mode: 7 */
          0x09c 0x0f /* P8_09 39 GPIO 69 out Mode: 7 */
          0x098 0x0f /* P8_10 38 GPIO 68 out Mode: 7 */
          0x034 0x0f /* P8_11 13 GPIO 45 out Mode: 7 */
          0x030 0x0f /* P8_12 12 GPIO 44 out Mode: 7 */
          0x024 0x37 /* P8_13 9 GPIO 23 in Mode: 7 */
          0x028 0x37 /* P8_14 10 GPIO 26 in Mode: 7 */
          0x03c 0x37 /* P8_15 15 GPIO 47 in Mode: 7 */
    >;
      };
    };
  };

  fragment@1 {
    target = < &ocp>;
    __overlay__ {
      test_helper: helper {
    compatible = "bone-pinmux-helper";
    pinctrl-names = "default";
    pinctrl-0 = < &pinctrl_generated>;
    status = "okay";
      };
    };
  };
};

The generated file has some comments to make it easier to understand the various ports, functions, modes and pin configuration.

This utility was inspired by a small perl script someone else had written.

You can get the tool via GitHub.

Light Painting with the BeagleStick

one response

Having seen the pixelstick and the neopixel-painter, I decided to build my own.

Instead of an Arduino, I decided to build this using a BeagleBone Black. Why? Because I had just recently bought a BBB and wanted to use it in a project!

Materials needed:

At $121.12, This is significantly cheaper than the Pixelstick’s post-kickstarter $325 price tag. Plus I don’t have to wait till May to play with it!

According to the specs of the NeoPixel strip, at full draw one would need 60mA * 144 = 8.64A of current to drive the pixel strip. This makes powering the strip and board slightly challenging. Doing some research it looked like 4 3.7V 18650 batteries rated at 2400mAh would do nicely. Setting them up as two parallel pairs of two batteries in series gives me 7.4V with 4800mAh which passed through the 10A DC buck converter supplies a consistent 5V to power the strip and the BBB. Interesting though was that when I measured the current to power the strip, I read ~2.4A with the strip showing a blue and green lit at full intensity, with ~2A for the red at full intensity, but with the strip at full intensity white I never got it to budge beyond 5A. This seems to be fine for powering the strip without it experiencing brown-out.

The NeoPixels are extremely timing sensitive requiring a steady 800KHz data-stream (although there’s been some recent work on identifying much lower timing specs for the WS2812 chip that drives it). This rules out using an RPi as it’s not running a realtime OS (although there are various projects to run a realtime Linux on the RPi). The Arduino has no problem running the necessary real-time code, as I said, I wanted to try my hand out at using the BeagleBone Black for a project. Given the BBB is also running standard Linux like the RPi, this wouldn’t have been possible, except for the fact that the BBB’s ARM Cortex-A8 has two additional CPUs known as Programmable Realtime Units (PRUs). The image decoding is done on the linux side, populating a buffer which is then made available to the PRU. The PRU runs a tight assembly code which cycles through the buffer, bitbanging the data out to the NeoPixel.

Here are the images I’ve taken so far using it:

I still need to add an LCD display and a control interface for more flexibility. I’ll release the code once I’ve done some more testing and refined it.

Update: and thank you to Adafruit – I’d submitted one of my Beaglestick images to their BeagleBoneBlack Case contest, and it turns out I won a case.

“The Man From Earth”, and funding the sequel on Kickstarter

If you’ve not yet seen the movie “The Man From Earth”, I highly recommend watching it. It’s one of my favourite movies and has made the Top 5000 list on IMDB with a rating of 7.9. The movie centers around a group of people, with one of them telling a story. Most of the story takes place in the living room of one of these people, and there’s hardly any action or CGI, but the movie will keep you at the edge of your seat throughout, wondering what’s going to happen next! The movie spread mostly through file-sharing networks and gained recognition as a result. The producers acknowledged that the movie gained far higher recognition than they had initially imagined and thanked file-sharers, encouraging fans to either buy the DVD or to donate.

As of yesterday there’s a Kickstarter project to fund the sequel – “The Man From Earth II: Man From Earth Millennium”. There’s the promise of an equally enthralling story, a worthy successor, but at this point it’s too early to say. If you’re interested in supporting the sequel of an amazing movie, head on over to their Kickstarter page and see if their write-up tempts you to pledge.

Compiling your own binaries for the Transcend WiFi SD-card

Tags: , , , , , , ,

Transcend WiFi SD CardAfter reading recently about how someone had hacked the Transcend WiFi SD cards, I thought I’d get one and see what I could do with it. Following the instructions and getting a login-shell on the card was easy enough. It was kinda surreal though that an SD-card was running a complete WiFi networking enabled embedded Linux (SoC FTW!) and being able to telnet onto it.

Taking advantage of what has already been discovered by other people, I’ve placed an autorun.sh file in the root of the SD card via the PC to enable access via password-less telnet and ftp:

#!/bin/bash
rcS6
tcpsvd -vE 0.0.0.0 21 ftpd -w /mnt/sd/ &
# Optionally install the latest busybox binary with more applets enabled
# cp /mnt/sd/busybox* /sbin/busybox
# chmod a+x /sbin/busybox
#### Obsolete
# /sbin/busybox telnetd -l /bin/bash &

The next time you insert the WiFi SD-card into the SD-card reader and connect to the WIFISD network, you’ll be able to telnet directly to the card. If you haven’t changed any settings on the card that’s as simple as:

telnet 192.168.11.254

For my own record:

# cat /proc/cpuinfo
Processor       : ARM926EJ-S rev 5 (v5l)
BogoMIPS        : 421.06
Features        : swp half fastmult edsp java 
CPU implementer : 0x41
CPU architecture: 5TEJ
CPU variant     : 0x0
CPU part        : 0x926
CPU revision    : 5

Hardware        : KeyASIC Ka2000 EVM
Revision        : 0000
Serial          : 0000000000000000

# cat /proc/meminfo 
MemTotal:          29824 kB
MemFree:           15940 kB
Buffers:              16 kB
Cached:            10388 kB
SwapCached:            0 kB
Active:             3280 kB
Inactive:           7840 kB
Active(anon):        716 kB
Inactive(anon):        0 kB
Active(file):       2564 kB
Inactive(file):     7840 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:           740 kB
Mapped:              796 kB
Shmem:                 0 kB
Slab:               1224 kB
SReclaimable:        364 kB
SUnreclaim:          860 kB
KernelStack:         272 kB
PageTables:          120 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:       29824 kB
Committed_AS:       6568 kB
VmallocTotal:     825344 kB
VmallocUsed:         324 kB
VmallocChunk:     824240 kB

# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00100000 00010000 "SPI NOR Flash Partition1"
mtd1: 00300000 00010000 "SPI: kernel"
mtd2: 00300000 00010000 "Ramdisk"

The next challenge of course was to get my own binary running on the card. I’m running an Ubuntu 12.04 system. YMMV depending on what distro you use.

Download and install CrossTool. It greatly simplifies setting up your cross-compiler toolchain. Once you have CrossTools up and running create an empty directory and build the config for the ARM/ucLibC combo:

$ ct-ng arm-unknown-linux-uclibcgnueabi

You can optionally configure the generated config via menu-config: ct-ng menuconfig.

Now start the actual build:

$ ct-ng build

This last step is time-consuming as it’ll download sources for several packages and does the actual compile of everything. When it completes you’ll have a new cross-compiler toolchain at ~/x-tools/arm-unknown-linux-uclibcgnueabi/ .

Try compiling your first hello world program:
$ ~/x-tools/arm-unknown-linux-uclibcgnueabi/bin/arm-unknown-linux-uclibcgnueabi-gcc -Os -s -DNDEBUG hello.c -o hello.out

I prefer to fetch the file from a web-server which serves out the compiled file which I can then fetch via wget from within the SD-card as I don’t have to deal with running /usr/bin/refresh_sd had I copied the file directly onto the SD-card from my PC instead.

# cd /tmp
# wget http://192.168.11.11:8080/hello.out
# chmod +x hello.out
# ./hello.out
Hello, world!
#

And there you go. The binary is a 6kb dynamically linked executable. You can statically link it too of course with a jump in file size to 72kb.

There are some folks working on getting OpenWRT to run on the card. Also noteworthy is that they’ve managed to compile a completely new kernel, but they seem to be having issues with the WiFi driver.

Running HDR Efex Pro 2 in VirtualBox

Tags: , , ,

Open the folder containing your Nik Software configuration. The easiest way to get there is to type the following into the Windows-Run window:

“%userprofile%\Local Settings\Application Data\Nik Software\HDR Efex Pro 2”

Open the HDREfexPro2.cfg file in a text-editor, and add this small XML snippet into the top of the file:

1
2
3
4
5
<configuration>
<group name="INTERN">
<key name="UseSafeMode" type="bool" value="1"></key>
</group>
</configuration>

Start HDR Efex Pro-2, and start playing with HDR!

Running WordPress and Plugins from an SVN repository

Tags: ,

The process of installing/updating WordPress using Subversion is well documented, but keeping your entire WordPress installation in SVN is less-well documented, although there are several people who’ve also thought along these lines and have documented what they’ve done.

Here’s my take on it, very closely related to PB30’s method linked above, but with some enhancements…

svn mkdir http://svn.example.com/projects/wpblog -m "Creating blog directory"
mkdir blog
cd blog
svn co http://svn.example.com/projects/wpblog .
svn propset svn:externals . -F < (cat <<EOF
 core http://core.svn.wordpress.org/tags/3.5.2/
EOF
)
svn ci -m "Add externals for Wordpress"
svn export core/wp-content wp-content
svn add wp-content
svn ci wp-content/ -m "Add wp-content"
cp core/wp-config-sample.php wp-config.php
svn add wp-config.php
svn ci wp-config.php -m "Add default wp-config.php"

Edit the wp-config.php file and add your database configs, as well as the following three lines:

define('WP_CONTENT_DIR', realpath(ABSPATH.'../wp-content/'));
define('WP_CONTENT_URL', 'http://www.example.com/blog/wp-content');
define('WP_HOME', 'http://www.example.com/blog');
 
svn ci wp-config.php -m "Add database and wp-content settings"
cat < <EOF > .htaccess
# BEGIN WordPress
<ifmodule mod_rewrite.c>
  RewriteEngine On
  # Base is the URL path of the home directory
  RewriteBase /blog/
 
  # Serve the main page
  RewriteRule ^$ core/index.php [L]
  # Serve real files and directories directly
  RewriteCond %{REQUEST_FILENAME} -f [OR]
  RewriteCond %{REQUEST_FILENAME} -d
  # Serve uploads and plugins directly
  RewriteRule .* - [L]
 
  # And serve everything else from the core directory
  RewriteRule ^(.*)$ core/$1
 
  # Skip real files and directories
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  # Otherwise send it to WordPress
  RewriteRule .* core/index.php [L]
</ifmodule>
# END WordPress
EOF
svn add .htacess
svn ci .htaccess -m "Add .htaccess"
cd wp-content/plugins/
svn rm akismet
http://plugins.svn.wordpress.org/
svn propset svn:externals . -F < (cat <<EOF
 akismet http://plugins.svn.wordpress.org/akismet/tags/2.5.7
 any-hostname http://plugins.svn.wordpress.org/any-hostname/tags/1.0.3/
EOF
)
svn ci -m "Add akismet and any-hostname"
svn up

Playing around with the Raspberry Pi

Tags: , , ,

Placing an order for the Raspberry Pi via the Farnell website was almost impossible, as all the RPi followers were hammering away at the site, trying to get in their order. I chose to do things the “old-fashioned” way instead, and just called them up! Five minutes on the phone with them, and my order was in. The fact that I’d previously ordered via Farnell made things a lot simpler.

After having been away on vacation the last 5 weeks, I returned this week to find that my Raspberry Pi had been delivered almost a month ago. I headed by the office to pick it up, and have been playing around a bit with it since then.

Since the price difference between 4GB and 8GB cards is so small now anyway, I got an 8GB card to play around with as well. Populated the card with the Debian-based image and performed the necessary steps to expand the partitions to make full use of the available space on the card.

Plugged in a USB keyboard, mouse, Ethernet, HDMI cables and power, and was watching the boot-screen running at FullHD, booting up. Nice!

Started the SSH-server and set it up to start at boot as well. Logged in via SSH to confirm everything is working as expected, set up for appropriate SSH key, and shutdown.

SSH is cool, but I want to be able to see what’s happening with the RPi at boot-up without necessarily having a display attached to it.

I already had a serial USB-board, but reading the specs of the RPi it seems it uses 3.3V whereas the serial USB-board provides 5V signals. So I set up a logic-level converter in between too, hook up the cables, and soon I’m watching the serial console output of the RPi while it boots.

Next-up: exploring the GPIO pins.

Using a GeoTrust QuickSSL certificate with OpenFire

Tags: , , , , , ,

Download the GeoTrust DV Intermediate CA file from https://knowledge.geotrust.com/support/knowledge-base/index?page=content&id=AR1422

Log in to the openfire admin UI ( http://server:9090/ ) and navigate to “Server Settings” -> “Server Certificates” and click on the “import” link ( http://server:9090/import-certificate.jsp ). Copy the appropriate sections from your certificate into the two text fields. Next, open the GT_QuickSSL_and_Premium_and_Trial_intermediate_bundle.pem file you just downloaded and paste the contents of this file into the certificate text field. Make sure there isn’t any space between the end of your certificate and the start of the intermediate certificates.

Here’s what the text field should look like given the intermediate bundle as of 2011:

-----BEGIN CERTIFICATE-----
Your certificate
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIID+jCCAuKgAwIBAgIDAjbSMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT
MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i
YWwgQ0EwHhcNMTAwMjI2MjEzMjMxWhcNMjAwMjI1MjEzMjMxWjBhMQswCQYDVQQG
EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEdMBsGA1UECxMURG9tYWluIFZh
bGlkYXRlZCBTU0wxGzAZBgNVBAMTEkdlb1RydXN0IERWIFNTTCBDQTCCASIwDQYJ
KoZIhvcNAQEBBQADggEPADCCAQoCggEBAKa7jnrNpJxiV9RRMEJ7ixqy0ogGrTs8
KRMMMbxp+Z9alNoGuqwkBJ7O1KrESGAA+DSuoZOv3gR+zfhcIlINVlPrqZTP+3RE
60OUpJd6QFc1tqRi2tVI+Hrx7JC1Xzn+Y3JwyBKF0KUuhhNAbOtsTdJU/V8+Jh9m
cajAuIWe9fV1j9qRTonjynh0MF8VCpmnyoM6djVI0NyLGiJOhaRO+kltK3C+jgwh
w2LMpNGtFmuae8tk/426QsMmqhV4aJzs9mvIDFcN5TgH02pXA50gDkvEe4GwKhz1
SupKmEn+Als9AxSQKH6a9HjQMYRX5Uw4ekIR4vUoUQNLIBW7Ihq28BUCAwEAAaOB
2TCB1jAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFIz02ZMKR7wAoErOS3VuoLaw
sn78MB8GA1UdIwQYMBaAFMB6mGiNifurBWQMEX2qfWW4ysxOMBIGA1UdEwEB/wQI
MAYBAf8CAQAwOgYDVR0fBDMwMTAvoC2gK4YpaHR0cDovL2NybC5nZW90cnVzdC5j
b20vY3Jscy9ndGdsb2JhbC5jcmwwNAYIKwYBBQUHAQEEKDAmMCQGCCsGAQUFBzAB
hhhodHRwOi8vb2NzcC5nZW90cnVzdC5jb20wDQYJKoZIhvcNAQEFBQADggEBADOR
NxHbQPnejLICiHevYyHBrbAN+qB4VqOC/btJXxRtyNxflNoRZnwekcW22G1PqvK/
ISh+UqKSeAhhaSH+LeyCGIT0043FiruKzF3mo7bMbq1vsw5h7onOEzRPSVX1ObuZ
lvD16lo8nBa9AlPwKg5BbuvvnvdwNs2AKnbIh+PrI7OWLOYdlF8cpOLNJDErBjgy
YWE5XIlMSB1CyWee0r9Y9/k3MbBn3Y0mNhp4GgkZPJMHcCrhfCn13mZXCxJeFu1e
vTezMGnGkqX2Gdgd+DYSuUuVlZzQzmwwpxb79k1ktl8qFJymyFWOIPllByTMOAVM
IIi0tWeUz12OYjf+xLQ=
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIDfTCCAuagAwIBAgIDErvmMA0GCSqGSIb3DQEBBQUAME4xCzAJBgNVBAYTAlVT
MRAwDgYDVQQKEwdFcXVpZmF4MS0wKwYDVQQLEyRFcXVpZmF4IFNlY3VyZSBDZXJ0
aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDIwNTIxMDQwMDAwWhcNMTgwODIxMDQwMDAw
WjBCMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEbMBkGA1UE
AxMSR2VvVHJ1c3QgR2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9m
OSm9BXiLnTjoBbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIu
T8rxh0PBFpVXLVDviS2Aelet8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6c
JmTM386DGXHKTubU1XupGc1V3sjs0l44U+VcT4wt/lAjNvxm5suOpDkZALeVAjmR
Cw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagUvTLrGAMoUgRx5asz
PeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo4HwMIHtMB8GA1UdIwQYMBaAFEjm
aPkr0rKV10fYIyAQTzOYkJ/UMB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrM
TjAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjA6BgNVHR8EMzAxMC+g
LaArhilodHRwOi8vY3JsLmdlb3RydXN0LmNvbS9jcmxzL3NlY3VyZWNhLmNybDBO
BgNVHSAERzBFMEMGBFUdIAAwOzA5BggrBgEFBQcCARYtaHR0cHM6Ly93d3cuZ2Vv
dHJ1c3QuY29tL3Jlc291cmNlcy9yZXBvc2l0b3J5MA0GCSqGSIb3DQEBBQUAA4GB
AHbhEm5OSxYShjAGsoEIz/AIx8dxfmbuwu3UOx//8PDITtZDOLC5MH0Y0FWDomrL
NhGc6Ehmo21/uBPUR/6LWlxz/K7ZGzIZOKuXNBSqltLroxwUCEm2u+WR74M26x1W
b8ravHNjkOR/ez4iyz0H7V84dJzjA1BOoa+Y7mHyhD8S
-----END CERTIFICATE-----

If you don’t include the intermediate cert data in the second field or the intermediate certs don’t match you’ll see errors such as “Incomplete certificate chain in reply”, “Failed to establish chain from reply” or “Certificate chain in reply does not verify: Signature does not match.”

If you see the message “invalid DER-encoded certificate data” then you most likely have an empty line between one or other of the certificate lines.

I’ve confirmed that this works with the Openfire 3.7 server and Empathy as the IM client.

Transliterate to Sinhalese using Google Transliterate

Tags: , , , ,

Google Transliterate has been available for a while, but what’s nice is that it now supports Sinhalese too. Check it out:

http://www.google.com/transliterate/sinhalese

If you type “Roshan”, it’ll transcribe exactly as it should. My surname is a bit trickier so you can’t type it as it’s normally written in English but you instead have to type “sembakuttiarachchi” to get the correct transliteration.

Windows Vista and Windows 7 come with Sinhala support out-of-the-box. Windows XP doesn’t initially support Sinhala, but there’s an extra language-pack you can install to make things work. Once you install the correct fonts, things work properly on Linux too, but it’s a different story with Mac OS X. Even with the latest version of Snow Leopard, Mac OS X has problems rendering Sinhala properly.

Using Firefox 3.0+ cookies with wget/curl

Tags: , , , , ,

Firefox versions prior to 3.0 stored their cookies in a standard cookies.txt file that could be used by tools like wget or curl. From version 3.0 onwards, Firefox uses sqlite for persistence of cookies and other data, making it slightly more difficult to use the same cookies. Here’s an invocation you can use to generate a cookies.txt file from your cookies.sqlite file:

sqlite3 -separator $'\t' cookies.sqlite \
    'select host, "TRUE", path, case isSecure when 0 then "FALSE" else "TRUE" end, expiry, name, value from moz_cookies' > cookies.txt

Make sure you’re in the proper profile directory, and that Firefox isn’t running. Otherwise, you’ll get a message that the database is locked.

I’ve tested this so far with Firefox 3.5 and 3.6. Should work as long as the structure of the cookies.sqlite file doesn’t change.