I return to school at noon, but before then, I’d like to share my evening project: agcc.bash, a rewrite of agcc and agcc2.pl that works with revisions 6 and 7 of the Android NDK.

The NDK is a GCC-based cross-compiler that lets you embed object code in a traditional Android app. It also works as a standalone cross-compiler, though it is not advertised as such. It is quite rough when used by itself, and agcc wraps the complexity in a little script. While agcc and agcc2.pl are written in Perl, agcc.bash is a Bash script. It also supports the latest revisions of the NDK, though r7 is slightly buggy.

With agcc.bash, building native Android software feels almost like working with GCC. As a quick example, let’s try the classic hello world:

AGCC_NDK=~/android-ndk-r6 ./agcc.bash hello.c -o hello

That wasn’t too exciting… but what happened there? I have the NDK installed at ~/android-ndk-r6 and I told agcc.bash where to look for it, using the AGCC_NDK environment variable. I then invoked agcc.bash as if it were GCC. Let’s see what agcc.bash did behind the scenes:

AGCC_NDK=~/android-ndk-r6 AGCC_ECHO=yes ./agcc.bash hello.c -o hello

=> ./agcc.bash hello.c -o hello
<= /home/jyio/android-ndk-r6/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin/arm-linux-androideabi-gcc -o hello -I/home/jyio/android-ndk-r6/platforms/android-8/arch-arm/usr/include -D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ -DANDROID -DSK_RELEASE -DNDEBUG -UDEBUG -march=armv5te -mtune=xscale -msoft-float -mthumb-interwork -fpic -fno-exceptions -ffunction-sections -funwind-tables -fmessage-length=0 -march=armv5te -mtune=xscale -msoft-float -mthumb-interwork -fpic -fno-exceptions -ffunction-sections -funwind-tables -fmessage-length=0 hello.c -Bdynamic -Wl,-T,/home/jyio/android-ndk-r6/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/arm-linux-androideabi/lib/ldscripts/armelf_linux_eabi.x -Wl,-dynamic-linker,/system/bin/linker -Wl,–gc-sections -Wl,-z,nocopyreloc -Wl,–no-undefined -Wl,-rpath-link=/home/jyio/android-ndk-r6/platforms/android-8/arch-arm -L/home/jyio/android-ndk-r6/platforms/android-8/arch-arm/usr/lib -nostdlib /home/jyio/android-ndk-r6/platforms/android-8/arch-arm/usr/lib/crtend_android.o /home/jyio/android-ndk-r6/platforms/android-8/arch-arm/usr/lib/crtbegin_dynamic.o -lc /home/jyio/android-ndk-r6/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/lib/gcc/arm-linux-androideabi/4.4.3/libgcc.a -lm -ldl

See how it transformed our innocent little command into a monster! This might be overkill for a hello world program, but it provides pretty good support for more complex software such as OpenSSL, cURL, and Python. It would be a good idea to add the NDK toolchain and agcc.bash to $PATH before trying to build a big program. In my case, the toolchain resides in ~/android-ndk-r6/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/bin. If you want to build some software that come with configure scripts, you might start with:

CC=agcc.bash ./configure

Do try this at home! Relevant links:

I sampled some sparkler candles today. These are narrow cylinders 2.5 mm across and 17 cm long. They burn just like regular candles, but they also sparkle intermittently and relight when blown out. I just had to investigate this strange pyrotechnic device.

on the left, a stripped candle

So I scraped the wax off one of the candles and found some gray flakes (fairy dust!) surrounding the wick. The material could be seen through the thin layer of wax along the entire length of the candle. The sparkling effect suggests that the flakes are metallic. They should also have a low heat capacity and autoignition point, so that even after the flame appears to be extinguished, they are warm enough to continue burning and light the candle again. What are these metallic flakes? I burned a candle to find out.

burning the candle

The white sparks of light were reminiscent of burning magnesium. Magnesium burns at or above 473 °C (883 °F), which is more than sufficient to ignite the paraffin vapor streaming away from a recently-extinguished candle wick.

magnesium turnings on fire

Other metals could be added for a variety of spark colors.

It appears that Mark Pilgrim, the author of one of my favorite Python language resources, has pulled a disappearing act. I wanted to recall a certain page on diveintopython.org, but was instead greeted with a 410 error:

Gone

The requested resource
/
is no longer available on this server and there is no forwarding address. Please remove all references to this resource.

His other websites, as well as social networking accounts, have also gone:

His personal site is missing, too.

Whoa. How does someone just evaporate off the Internet like that? The search continues, but there may be a ray of hope

Pilgrim has shared an incredible volume of information with Internet users everywhere. I hope he is alright.

Update:

ultimatebuster pointed me to firehose.diveintomark.org [ATOM], which contained recent Twitter activity; the site is now inaccessible, so the link points to my personal mirror copy.

Jason Scott called Pilgrim’s local police department, and Pilgrim was less than amused…

I called his police department to ask for a welfare check – someone had done it 4 minutes before me.

Mark Pilgrim is alive/annoyed we called the police. Please stand down and give the man privacy and space, and thanks everyone for caring.

The communication was specifically verified, it was him, and that’s that. That was the single hardest decision I’ve had to make this year.

… and that’s that!

With a Windows 7 guest comfortably installed on my Ubuntu host, I turn my attention to making it automatically boot and shutdown with the host. Traditionally, we would use a SysV-style init script that uses VBoxManage/VBoxHeadless to start the guest and VBoxManage to stop it. Upstart seems to be the way to go now, so let’s make a configuration file for that. And instead of powering off the guest every time (which should be done using ACPI events), it would be easier and faster to simply save the running state and restore it during the next boot.

Read on »

VirtualBox comes with a rather nice commandline interface, and here’s how you’d work it. The following commands have not changed much since VirtualBox 3.1, and they have just been tested on VirtualBox 4.1.

Before we start, here’re the guest specifications that we’re looking for…

  • VM name mustard
  • RAM 1 GiB
  • SATA controller with 20 GiB disk at mustard.vdi
  • IDE controller with CD/DVD at installer.iso
  • Bridged networking using host adapter eth0
  • OS Windows 7

Read on »

One of the improvements in the Amazon Kindle3 OS is the WebKit-based browser. Based on a tip, I tried communicating on Freenode using the Webchat interface.

How do you get this particular OS update on a second-generation Kindle? Well, let’s just say it’s not officially supported.

Since I’ve been asked several times to demonstrate how to make a reblox, I decided to put together a little photo tutorial. Enjoy!

Look at the pretty pictures.

The Bloxes website features construction images as well, and the process is similar.

Bloxes are nifty “modular adult-sized building blocks.” They are actually interlocking cardboard boxes that can be used to build things such as furniture.

They’re not exactly inexpensive, and shipping takes a while. Instead of ordering bloxes, I decided to prototype my own on paper just for fun. This design might require some modification for use with cardboard (in particular, I’m sure you could figure out how the original design works and apply it to your project).

If you have the resources, go ahead and roll your own cardboard modules. As usual, it’s easier said than done…

For months, I’ve been using a Kubuntu 11.04 pre-release on my Lenovo IdeaPad S10-3t, a convertible tablet netbook. In general, the Plasma Netbook interface is reasonably touch-friendly with large buttons that I could easily access with my fingers. It tries to save space by hiding the global application menu behind a button, but I would have liked easier access to the menu. Application support for touch input is rather spotty, as expected, but some software come with plugins to make the touch experience a bit more compelling. For example, Firefox has the Grab and Drag extension and Chromium has chromeTouch. The virtual keyboard (kvkbd) is somewhat awkward, however, so I usually have the keyboard out.

Read on »

A minor mishap with my current host recently forced me to restore from my incomplete backups. Thankfully, not much was lost, and what remaining [textual] data was scraped off the Google and Bing caches. As far as images go, we’ll have to see what the Internet Archive Wayback Machine could do for us. At any rate, I’m not blaming the host, because these things do happen from time to time and I should have paid more attention to redundancy.

During the downtime, EveryDNS/DynDNS kept the DNS service going and Freenode chugged along as usual. The wiki was completely wiped, but I managed to scrape most of the text from caches everywhere; it will be returning shortly, and I’ll probably need some help moving the cached content to their rightful place.

Until next time ;)