Building Boost 1.46.1 on Windows XP :: May 22nd 2011


The other day, I was using the Boost libraries to support some ASIO operations that I needed to do. I grabbed Boost 1.46.1 and attempted to use the ordinary bootstrap.bat to build bjam and get the entire library building process underway.
Sadly, the Windows cmd window refused to work, failing with something like "The input line is too long. The syntax of the command is incorrect". It turns out that Windows can't cope with the giant string that the batch file is trying to pass to it to start the compilation, being limited to somewhere around 8000 characters (or just over). You could shorten the paths or use "bjam --abbreviate-paths" once Bjam is built, but this will never happen because it can't even build bjam to start with.
So, in short, just look for the bjam source folder and build it in the Visual Studio command shell. It sits under / tools / build / v2 / engine / src. Once in there, run build.bat, and then run the bootstrap.bat in the base of the Boost tree to get Boost to build.
Then, under ASIO, remember to set the environment variable using set BOOSTDIR = c:/path/to/boost.

Linux Floppy Drive :: February 1st 2011


In Fedora 12, /dev/fd0 is gone. This is bad news if you are trying to use floppy disks. Although they are really an ancient technology, I still have Windows 3.11 on floppies and was trying to copy them to disk images for backup purposes.

Anyway, it turns out that the /dev/fd/ directory is misleading, and is nothing to do with floppies anymore. To get a floppy drive to appear, do sudo modprobe floppy, and /dev/fd0 will reappear. After that, you can do dd if=/dev/fd0 of=myimage.img bs=2x80x18b to copy the 1.44 disk to your machine.

You could probably shove this in /etc/rc.local to get it ran on every boot (bit of a bodge, mind you).

Realtek Linux Kernel Bug :: January 5th 2011


I have been experiencing periodic failure of network connectivity with my Jetway Atom board, which has a Gigabit network card, running under Fedora 12. The relevant output of lspci is:

Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 02)

Anyway, this has been driving me mad, since I thought it was NetworkManager running under a VNC session that was messing it up, along with a host of other things I had tried. Anyway, if you run dmesg | grep eth0, it occasionally mentioned the following line:
r8169: eth0: link down

It appears that it has been a problem with the Realtek driver for a while (see http://lime-technology.com/forum/index.php?action=printpage;topic=3988.0 for an example). Thankfully, some helpful soul on http://fedoraforum.org/forum/showthread.php?p=1401944 found the solution: disable autonegotiation before the interface is brought up, but after the module is loaded. Add a new file /etc/modprobe.d/r8169.conf, with the lines:

# turn off autonegotiation on the r8169 ethernet driver
install r8169 /sbin/modprobe --ignore-install r8169 && /usr/sbin/ethtool -s eth0 autoneg off


Thanks to this man, all appears to be working so far.

Some Myung Bass :: December 23rd 2010

John Myung of Dream Theater makes use of a 6 string bass to play the intro to "Lifting Shadows Off A Dream", where the starting line goes something like (with Hs being harmonics):

C ------H5-------------------------------
G ---------H4-----------H5---------------
D -----------------H5--------H4----------
A --2------------------------------------
E ---------------3----3------------------
B 0---0----------------------------------

The harmonics are left to ring, which involves some finger dexterity.

So, how do we play this on a 4 string? The low Bs are impossible, as is the harmonic on the top C string. So we can redo like this (perhaps with a subbass effect for extra punch). The harmonic on the E on the D string is a bit fussy to get and requires a good strike to sound, but it serves as a good alternative.

G --4--------H4------------H5------------
D -------H2-----------H5-------H4--------
A 2---2----------------------------------
E -----------------3------3--------------

Harmonics are fun!

Myung plays very cleanly, and his tone seems to be very clear, apart from when he uses distortion which doesn't sound harsh at all (unlike a typical Boss overdrive pedal). It sounds more like a thick distortion with a touch of chorus, but I could be wrong (listen to anything from The Jelly Jam for an example! "I Am The King" is a prime example).

For added fun, how do we play the beginning of "Scarred"? You'll need a 5. (You could try it on a 4 but you'll need to replace the last bit with 0 2 on the E string, followed by 0 2 on the A string, but take care to not be messy). I worked it out as (with ^ as a hammer on), and every note is tapped (and left to ring on the G and D strings):

G 19--------19-------16--------16---------------
D 19--------18-------16--------14---------------
A ----------------------------------------------
E --5^7-5^7---5^7-5^7--5^7-5^7---5^7-5^7----5^7-
B ---------------------------------------5^7----

Time to callous the fingers on the right hand.

Android Updates :: December 22nd 2010

I recently upgraded my Android development environment within Eclipse, having been using the old Android 1.6 SDK for a very long time. I must say that the 2.2 GUI designer is much better, and much more responsive. The old one was a pain to use - sometimes it was better to write directly into the XML!

There seems to be lots of fuss about the Android market being fragmented. This is kind of true, given that manufacturers seem intent on dumping their latest GUI "enhancements" onto a phone. I have a HTC Desire that came with HTC Sense - it was poor. The phone call section and contacts section was far worse in my opinion. Anyway, I'm back on Cyanogenmod 6.0. When 6.1 is stable, I shall use that, since it has support for 720 camera resolutions.

Back to the subject: Yes, it seems that manufacturers are dumping their products after about a year (with some devices still on Android 1.5?!?!), which is a pity given that most phone companies here in the UK do not want to give a contract shorter than 2 years. My old trusty G1 was still on 1.6 with no hope of an upgrade (even though T-Mobile said they were "researching" it in one of their bog-standard emails). It was impossible to install anything newer because the partition size in the phone was tiny, hence a resizing is required to install 2.1 or 2.2.

With the development system, you can preview for different screen sizes which should make it easier to see what your customers are going to get, particularly with the convenient wxWidget-sizer-like layout system.

The best thing to do is to fix bugs when customers complain, I suppose. Or keep it really, really simple and use the standard Java libraries for most things.

Also, completely unrelated is how to get a progress indication when copying files on the command line in Linux. cp is alright with the -v flag for verbose output, but for giant files it is no good guessing when the file might finish transferring. I have poached this from here.
Anyway, it actually involves using rsync, and an alias:

alias cpv="rsync -poghb --backup-dir=/tmp/rsync -e /dev/null --progress --"

This will give you a cpv command. If you're using bash, you could put this in your $HOME/.bash_profile to apply on each login. You could put it in /etc/profile for global application I think.

Mac OSX :: December 20th 2010

So, today Mac OSX surprised me when I tried to statically link an application against the Boost libraries. It turns out that the ld command under Mac OSX hates the -static keyword. And here's Apple's technical article:
http://developer.apple.com/library/mac/#qa/qa2001/qa1118.html.


I really must learn more about this odd system.

Items For Sale :: November 2nd 2010

After looking through the garage and realising that I had hardly any space in it, I thought I'd take some time to put some stuff up for sale. The list (and contact instructions) is here. Please have a peruse.

Netbeans J2ME on x64 on Linux :: September 18th 2010

So, this evening I thought I'd try compiling an old J2ME project I had written a long time ago under my old Fedora 7 i586 environment. I had used Netbeans to create it and had been using the WTK 2.5.2 environment as provided then by Sun. Since Sun has been bought by Oracle, Oracle have released a new Wireless Toolkit but called it J2ME 3.0. Sadly, this is currently only available for Windows and Mac (in beta) which was no good for me. Linux users have to make do with the old version.

The downloadable version of Netbeans for Linux for mobile development comes bundled with the old WTK 2.5.2. During the Ant build process for a project, it calls preverify1.1. This is a 32 bit program and will fail to run, complaining about "preveryfy1.1: error while loading shared libraries: libXt.so.6: cannot open shared object file: No such file or directory". I checked that libXt was installed, so this was confusing!
It took me a long time to work this out but all you need to do is grab the i686 version, currently named libXt-1.0.7-1.fc12.i686.rpm in all the Fedora 12 repos.

However, do be aware that the emulator won't run on 64 bit because it is expecting a 32 bit Java environment. For this reason, you'll probably want to grab a 32 bit Linux J2EE release from Oracle's site. When running, the installer for this will tell you that it is a Glassfish installer but it installs the JDK too. Anyway, I dumped my installation of this under /opt/glassfishv3. I have also put my Netbeans installation under /opt/netbeans-6.9.1, as the Fedora 12 Netbeans version is old and doesn't include a GUI JavaFX editor, not that I've got round to using it.
Once the J2EE JDK is installed, modify /opt/netbeans-6.9.1/mobility/WTK2.5.2/bin/emulator in a text editor, changing the line at the top that currently reads:

javapathtowtk

to read:
javapathtowtk=/opt/glassfishv3/jdk/bin/

This will make the emulator use our newly installed 32 bit JRE.

You can also tell Netbeans to run using that JDK and JRE using the --jdkhome flag, for example:
./netbeans --jdkhome /opt/glassfishv3/jdk

You can confirm that Netbeans is running under a 32 bit JVM using Help | About. It will state that its System is i386 at the bottom of the Window.

Finally, you can also add our new JDK to Netbeans using Tools | Java Platforms | Add Platform... | Java Standard Edition, and selecting /opt/glassfishv3/jdk as the JDK folder.

All that was a bit of a headache but worth it in the end I feel, especially with all the J2ME enabled phones I have lying around! Hopefully Oracle will bring out the J2ME 3 for Linux some time.

Code::Blocks headless :: September 18th 2010

I tend to use Code::Blocks for C++ development on my Linux machine at home, mainly because it is stabler than the IDE I use at work, Codegear's offering! In reality, it is quite a good IDE and although I don't make use of the wxSmith integration, when combined with wxFormBuilder, it makes development of wxWidgets apps quite easy without a bloated, do-it-all IDE. Also, it is Native, unlike Eclipse or Netbeans. GDB links in quite well with it, although I haven't found a way of passing parameters to GDB for such things as watch length. The way around this is to use DDD and set the 'Limit on string chars or array elements to print' option, which is useful for long XML strings etc.

Anyway, I have a machine at home that I SSH into. Without having to use X forwarding (which is impossible on some SSH clients, such as ConnectBot on Android, obviously), and without having to force Code::Blocks to export some makefile, is there a way to get it to build your project file and dump the build output? Why yes!

My machine has a VNC server on it which is gobbling up X display :0, so we can run something like Xvfb on the machine to run a virtual X server, and then tell Code::Blocks to do a batch build. For example, after SSHing into the machine do the following:

export DISPLAY=:1
Xvfb :1 -screen 0 1024x768x16 &
codeblocks --build myproject.cbp > output.log

You'll need to kill the Xvfb server afterwards (perhaps making use of killall). Of course, if you're using a Mac machine you can install the X11 server on it and just use X forwarding whilst SSHing:

ssh -X targetmachine

Additionally, if you're running Windows and want an X server, use Xming. The free versions are available on that page under Public Domain Releases (on sourceforge).

S60 Development in C++ :: April 5th 2010

I tried doing some S60 development today, for a Nokia 5800. Absolutely rubbish. Firstly, you need to download a 250Mb IDE (Carbide.C++), which is Nokia's rip-off of the Eclipse IDE for C++ development on Windows. The build system relies on a version of ActivePerl that is no longer distributed (nor included with the IDE), so you have to hunt around to get it. And then you have to install an ARM GCC toolchain (which is included with the IDE thankfully).
Then you need to download a 650Mb SDK, and that's for S60 Release 5 only, NOT S60 Release 3 or Release 2, nor for any of the S40 series phones. If you want to develop for the N97 in C++, you need to download another 600Mb zip file. Ridiculous! Running Java apps on a touchscreen phone with no keyboard is a horrible mess, with a rubbish virtual keyboard that pops up.

Once you have finally got the IDE up and running, it turns out that if your project files are on a different drive to the IDE and/or the GCC compiler, it won't build. This is because it stupidly calls something like 'gcc /path/to/projectfiles' without even mentioning the drive letter.
Finally, if you get the damn thing to build, the emulator is slow (not as slow as loading the Android emulator though!), and wants incessant attention which it alerts you to by flashing constantly in the taskbar.

After all that, the introductory documentation that comes with it is abyssmal and you have no idea on the application architecture. The "Hello World" tutorial is exceptionally thin and doesn't explain what app instances you must inherit from. Only by searching around Nokia's rubbish development site did I find it, and it turns out that it adheres to the MVC approach. How on earth MVC can ever be applied to "OnButtonClick" handlers is beyond me, because surely the event handler then tells the Controller something, which makes it inextricably linked to the Controller anyway? This defeats the purpose of splitting it into Model (which holds the data), View (the GUI) and Controller (which tells the model that we have a request, update the View).

I did try deleting something in the UI and it didn't bother to update any of the generated C++ files, which meant the build failed. Very very very poor.

On top of all that, you have to wrestle with Eclipse, which was clearly designed by a person who liked way too many tabs and wanted to see EVERYTHING at one time.

Absolutely rubbish in my opinion.

Welcome :: 4th April 2010

Welcome to a new site! I thought that it was finally time to actually put something worthwhile up here, reflecting the experiments in audio and software that I carry out. Not that these will be exceptionally interesting or worthy of any attention, but you might find them useful anyway.

Enjoy the peruse.

Copyright 2010 :: [Fetched in 0.0568 seconds]