C++ is getting Lambda expressions! (and Cadbury creme egg cakes)

2008-03-31 00:28:00 PST

Tags: , , ,

C++0x, the next version of C++ due by the end of the decade has just had Lambda expressions added to the language. This is great!
Read about it at herbsutter.spaces.live.com/blog/cns.
It should look something like the following

 
find_if( w.begin(), w.end(),
             []( const Widget& w ) -> bool { w.Weight() > 100; } );
 

Sadly, Lambda expressions haven't made their way into GCC, so I can't play with them... yet!

Also, thanks to George for this:

Cadbury Egg Cake :D

Experiment:

Replace ordinary eggs in cake recipe with Cadbury Creme Eggs and observe results.

Hypothesis:

THIS IS GOING TO BE SO AWESOME

bigmixup.com/content/cadbury-cake

More new toys: Nokia 5200

2008-03-10 23:11:15 PST

Tags:

So after a year and a few months, my old cell, a Sony Ericsson k510a was dying. It wasn't the greatest phone but it wasn't bad, but now the keys were sinking and becoming unresponsive. Time for a new phone. So I ordered one last week.

And today, my brand new Nokia 5200 showed up! I'm reasonably impressed with it. Right off the bat it does a few things right. It has an adapter so you can plug any good 3.5mm headphone you spent money on into the phone to listen to your music, so you aren't stuck with their proprietary and bad headphones. This is awesome. Second, it comes a USB cable and when plugged in has the option to be a mass data storage device which is perfect.

The interface though is a bit weird. The addressbook uses such a large font only two entries can ever fit on the screen, which makes it feel cramped, even though there is no reason for this.

Next, even though this phone is well set up as an mp3 player, you cannot use your mp3s as ringtones. It's some DRM "issue". What a waste. Anyways, I picked a song I like, loaded it into audacity, turned it to mono, selected 10 seconds, and exported it as a .wav and that seemed to work. It will accept any wav, but it has to be with in a certain range. <300Kb is ok and around 800Kb is not, (my two tests) so somewhere in there is the magic number.

Now all my contacts were imported from my SIM card, but they came in a little messed up and not grouped, so I've been going through and cleaning them. Not optimal, but I think at least part of that is the fault of my last phone too. Better than not having the numbers at all but a pain, becase I have 123 contacts.

As I alluded to earlier, this phone, equipped with a 1GB mini SD card, might just replace my mp3 player. The pros are that it has a reasonable interface for it and volume buttons on the case and accepts and headphones I want to use. The con is that it doesn't do ogg. But to carry around one less device I might be able to put up with that. I'll give it a try and see how it does. Again though, they use way too large a font and most of the filenames in the browser are cut off.

So all in all, some nice hardware, and some good low level choices. I'm pretty impressed. The biggest problem for me is that the interface really could stand to use a smaller font so a reasonable amount of information could fit on the screen. It feels cramped.

I can’t help myself: Ubuntu Hardy (8.04) Alpha 6

2008-03-10 18:26:46 PST

Tags: , ,

So I walked into class today and my buddy waves me over to sit with him. I look over once seated and see a nice brown screen with a progress bar. Apparently that morning he finally had enough of Windows Vista being slow (his complaint) so he decided that class was a good time to install Ubuntu, and he picked the upcoming release 8.04, which is currently in alpha 6. Now I know since I've been using Ubuntu on my laptop I've been a little less on the bleeding edge than I was when using Gentoo, but I didn't feel like being out done, so I decided to upgrade my nice stable Gutsy (7.10) to Hardy right then and there.

Easy really. Open '/etc/apt/sources.list' in your favorite text editor under sudo and comment out the CD source line and search&replace all instances of 'gutsy' with 'hardy'

then

 
sudo apt-get update
sudo apt-get dist-update
 

Apparently you can also

 
sudo update-manager -d
 

and tell it to check for updates and then it will offer you the option to upgrade to the development version, but the console version is slightly more interactive when it comes across system files you modified.

It was a 1.8GB download for all my software, and that might be large compared to some people because I installed a bunch of open source FPS games a bit ago and they do have a habit of taking up lots of space. Thankfully the UBC pipe is very fat and in 14 minutes everything was downloaded and it then went ahead and installed and updated everything.

Reboot.

And volia! Nice stable desktop is now a bleeding edge Alpha quality desktop with all the latest.

The good: My laptop's graphics card, and Intel i965, is 'new' and desktop bling wasn't supported under Gutsy, but it is under Hardy. Awesome. I installed compizconfig-settings-manager and tweaked away for a while. Things are very blingy.

Firefox beta 3 is pretty fine, but my Google browser sync plugin isn't supported for now. Hopefully in a bit.

Surprisingly, my latex plugin for Tomboy still works so awesome!

Everything else so far has more or less worked.

The not so great: Sound initially completely failed to work. No sound card detected, and the sound card module failed to load. Apparently a whoops over at Ubuntu HQ, they'd just compiled it against the wrong kernel. When I checked there was a 2 hour old bug. It was fixed this afternoon, and I got the fix from the update manager. Woo.

So everything so far seems to work. However things do crash every now and again. 'Eh, it's alpha software, everything. I knew what I was getting into, I've done this before.

So rad, I'm pretty pleased and impressed. Such an easy update to the bleeding edge system. And considering it's still all Alpha software, stuff is running fine enough. And I have all the cutting edge toys.

Now the fun will be in the next month as everything moves from alpha to beta to release and all my shiny toys become stable. :D

I heart free software.

Ubuntu 8.04 Hardy: Compiz in action

Update: Oh wow! Firefox 3 finally shows image's full alt over text, which is fantastic because several comics I read have second punch lines there and previously you had to look at the image properties to get the full thing (lame). So awesome they fixed that.

References:

Planet.mindstab.net updated, now resynced with my daily reading list

2008-01-29 12:13:38 PST

Tags: , , , ,

So I've been adding a lot to my RSS reading list lately. In an attempt to broaden my world view a bit I added some stuff from the BBC and CBC. And for my own interest in random things I added some stuff like grinding.be, Coilhouse and a few other treats. I've also expanded my geek reading with sites like Phoronix and a few others. So in summery, lots of new additions!

Anyways, through all this, planet.mindstab.net grew less and less reflective of what I've been reading, but I finally got around to refreshing it's list of feeds, so go take a look, thats what I read or skim every day. It's a massive flow of information on things I wish to stay informed on. (The full reading list is displayed on the right side of the site, it's not small :))

As a note, the PlanetPlanet software that runs it is glitchy. I cannot seem to make it do times properly, and it insists on adding my timezone onto everything (+8 hours) even though no other webapp or app on the server has this problem.

Trivially getting my laptop internet access over the cell network.

2008-01-23 09:26:18 PST

Tags: ,

Again, I have to thank Rob for a year or two ago chewing me out over the fact I used to just use this site to mention the cool things I did without documenting them. I just dug up a tutorial I wrote last year on setting up Laptop internet access over a cell phone and got it set up on Umbriel, my new laptop, in about 5 minutes. Awesome. That was easy. And handy for when I'm downtown as people have finally started securing their Wifi routers. And yeah, easy as compared to the day of research I did the first time to figure out how to get this working. So thanks Rob for making me document my work!

Synchronization

2008-01-06 23:53:43 PST

Tags: , , ,

So with a laptop again I'm really keen to find ways of not duplicating data entry and getting weirdness between my computers, so all kinds of synchronization catch my attention. Here's two I've jsut gotten working and love and make my life better:

Google Browser Sync: It lets you sync data from your browser (Firefox) to Google's server and the to other copies of Firefox you're using. I'm only using it to manage my bookmarks but it's wonderful to now have one set of bookmarks across my desktop and laptop.

Tomboy note syncing: Tomboy is awesome. It is my brain dump. I store tons of stuff in there but till now it has been a bit limited because the information in it doesn't follow me around so I can't count on it to be with me when I'm out or at home. Now I can. Since I have a nice reliable server, I just set it up to use sshfs (thanks to fuse) and both my copies of Tomboy (laptop and desktop) sync to a shared dump on my server. On Ubuntu it was super easy and everything was configured to work already, I just had to enable the sshfs sync plugin. On Gentoo, I had to add FUSE support to my kernel, install sshfs-fuse, and then add a fuse group and modify /etc/udev/rules.d/99-fuse.rules to look like

KERNEL=="fuse", NAME="%k", MODE="0666", OWNER="root", GROUP="fuse"

and then add myself to the fuse group. Once that was all done, Tomboy on Gentoo was syncing too and now my notes will follow me around where ever I am. This is truly amazing and takes Tomboy from a neat app, to an incredibly useful app.

I'm feeling the synchronizational love tonight!

New laptop (Umbriel)

2008-01-05 20:52:27 PST

Tags: , , , ,

So in September, my laptop Nika died of an electrical system failure. Going through a semester of university without a laptop was a hassle, but I waited and on Boxing Day I picked up a new laptop for $600 CDN ($300 off!). So what does one get for about the cheapest laptop in the store? Well, I got an Acer Extensa 5620 equipped with a Core2 Due 1.6GHz cpu, a pleasing 2 GB ram and a 250GB harddrive. It also had a Intel X3100 video card. So really, I couldn't have asked for any more in laptop. I'm pretty pleased. I named it Umbriel.
Then I threw Ubuntu 7.10 on it.

First, a few install details. I decided to save Vista since a) I paid for it and more importantly b) I might need it for Starcraft 2. Vista did at least come with a nice partition+filesystem resize tool that shrank it right down. So that was nice. And then Ubuntu installed smoothly onto the rest of the disk and setup Grub to dual boot them flawlessly. So that was all nice.

So what are the good and bads?

The goods: All the open source Intel hardware I could want, including a surprisingly good built in web cam. The Ubuntu install went without a hitch and everything worked. Popped in media and it went out in search of codecs and installed them. Cool.

The medium: I did have to manually install DVD support. But it took like 1 minute so whatever. Same for enabling CPU scaling control from the Gnome panel applet (and I understand the rational for that).

The bad: Even though the graphics drivers for the newest Intel video card are open source and Intel backed no less, I can't have desktop bling AND video playback. One or the other. That's kind of lame. But will probably be fixed, and I'm really hoping by the time Ubuntu 8.04 comes out.

More annoyingly, the sound situtation. The speakers are way to quiet in some situations, like playing a DVD and only acceptably loud other times. Ditto for the headphones. The only minor saving grace is that this is also the case in Windows Vista which the laptop came with. That the computer industry as a whole is shipping laptops with crippled gimpy sound like this is a little discouraging and amazing. Does no one test the hardware and software they ship? Max sound on both headphones and speakers should be better than a whisper. Also, some weird regression in Ubuntu in that when I plug headphones in the speakers don't turn off. Awesome. I though we had that licked like YEARS ago. It worked on my old laptop :p

Still, as a work and school machine the laptop is wonderful and more than sufficient. Additionally it can smoothly play UT2004 with all the features turned to low (which is really a a nice bonus) and I'm hopeful that with in a year it'll handle video and audio just fine. And lets face it, $600 is pretty damn cheap :)

Good work, and good to see

2007-12-19 21:13:28 PST

Tags:

Credit where credit's due, Internet Explorer 8 passes the Acid2 test. Way to go guys!

Another power outage

2007-11-19 15:16:32 PST

Tags: , ,

I'm beginning to wonder about my city's power system as of late. There have been a couple of power outages in the last year in my general area, and several other in neighboring areas.

Ah well, my APC UPS did the trick keeping my server powered and online. I gave it an extra boost it wasn't thrilled about in an effort to the power last longer by plugging my UPS into my XPower Pocket PowerPack (The one I picked up in the summer to power my IPaq and IRiver during a cabin trip). The thing says it can portably run a laptop for a while, and it has a 3 prong AC power outlet on it, but my UPS, probably understandably, insisted on flashing its faulty wiring light while sucking power from the thing. Still, it worked. You on the net never knew I had another power outage.

There's something kind of satisfying about being on a dark block in a dark house, but still having a server connected to the internet.

Making Familiar 0.8.4 Linux useful on the IPaq hx4700

2007-11-09 13:42:42 PST

Tags: , , , ,

These are notes and utilities and files I've gathered together to make my IPaq hx4700 useful to me, and setting it up decently easy. I know it took forever to type them up and finally publish them, but better late than never.

Mission

To turn basic Familiar 0.8.4 on the IPaq hx4700 into something useful. More specifically, to make IR and Bluetooth work, to make my Belkin IR Keyboard (F8U1500-E) work, and then to install a Debian chroot on an SD card where we can then install, for example, every programming language and text editor we could want for portable programming purposes.

Getting Started

So, first things first, you need an IPaq hx4700. Or at least an IPaq, and hopefully one supported by Familiar Linux. As you can see from the list the hx4700 is supposed to have A+ support. It turns out that's kind of a lie. But we can do surprisingly well with some work. First off, throw away the Familiar Installation guide, it doesn't apply to the hx4700. They put together a different one on the wiki at handhelds.org/moin/moin.cgi/HpIpaqHx4700HowtoInstallLinux. Read it.

Files and Filesystems

So now's as good a time as any to mention that I've collected all the files you'll need and put them on my FTP at ftp.mindstab.net/ipaq-hx4700.

First off you need a SD card and you need to write the bootloader all over it so whip out DD and does as the instructions say. Then when that's done toss an ext2 file system on your SD card, we'll need it later.

Now for some work with the CF card. Since we're flashing from it I'd suggest using the FAT filesystem. We'll stash all our system stuff on it here's a quick list of what you should grab from the FTP and put on it.

  • zImage-2.6.15-hh2-ipaq-pxa270: kernel
  • zImage-2.6.17-hh3: exciting new and more useful kernel, but we can't install it until the system is up and we copy it's modules over to the ipaq.
  • bootgpe-v0.8.4-ipaq-pxa270.jffs2: Root filesystem with GPE installed. I'd recomend GPE over OPIE.
  • reflash.ctl: Control file for hte bootloader to know what it can flash. This one is updated with an option for the new kernel.
  • RADIO0d.BIN: Firmware driver
  • radio11.bin: Firmware driver
  • wlangen.bin: Firmware driver
  • 2.6.17-hh3.tar.gz: Kernel modules for a newer kernel. Untar it in place.
  • install-firmware.sh: Shell script to install the firmware. The names are case sensitive so depending on how your FAT filesystem performs this might not work :/.
  • install-modules.sh: Install the kernel modules for the 2.6.17 kernel. Assumes it's running with the untarred file 2.6.17-hh3.tar.gz. Copies the modules to /lib/modules on the ipaq.

And now is a good time to mention that I got an IR keyboard with my IPaq, specifically a Belkin F8U1500-E, which didn't work with the IPaq for a number of reasons at first. I solved them all. If you have this key board you'll also want the following files. If you have any IR keyboard you still might want at least the init.d file from the list.

  • install-kbdd.sh: Shell script to install the files
  • init.d.kbdd: Adds lines to the start function to remove extra IR kernel modules that prevent simply IR keyboards from working. Also kill irattach.
  • kbdd.conf: Config file that just says use a belkinir keyboard on /dev/tts/2.
  • kbdd: My patched kbdd program with proper support for my keyboard.

I also put up kbd.c which is the file I modified from the kbdd source for anyone who wanted to see what I'd done (also, I suppose, to comply with the GPL ;)). I know it's a hideous mess and hack, but using a case statement was easier initially in order for me to figure out how to get the keyboard working. I fully intended to turn it into an array latter, but once it worked I got lazy and left it. Meh.

Getting Familiar up and Running

Ok, you now have the CF card with all the files you need. Toss it in the IPaq and follow the flashing instructions on the wiki. Flash the 2.6.15 kernel, and then the GPE root filesystem. Then you can let GPE boot. It might take a bit.

Also, the boot loader and possibly the IPaq itself are kind of finicky. If it just won't turn on, don't worry, you probably haven't bricked it, its just in a funk. Let it sit for like 5 minutes. Also try pulling its battery for a bit, putting it back in and then putting it on AC power. Eventually it'll decide that the time is right to try booting again.

So, once GPE is up, there are a few change that we need to make to make life easier and better. First, go to "Setup->Login Setup" and set "Automatic Login" to yes. This will automatically log you on as root, instead of asking you for user name and password of some non root user. Really much beter in the long run for this device. Then log out and you should automatically be logged back in as root.

Now we can proceed.

We'll need to do some typing to get the necessary files installed, so you'll need to bring up the on screen keyboard. It kind of sucks, but I've seen worse. It is usable. Also, I've tried to write scripts to automate a bunch of stuff to keep the typing to a minimum until a real key board can be used.

So, bring up a root console from "Others->Root Console". "cd" onto the CF card, "/media/cf".

First we'll install the firmware, so run "sh install-firmware". Ideally this will work but you should double check and fix if it doesn't. What should happen is the 3 ".bin" files are copied into "/lib/firmware" and their names are all uppercase except the "d" in RADIO0d.BIN.

Next run "sh install-modules" which should copy the 2.6.17 kernel module directory (you untared the .tar.gz right :)) into /lib/modules. Now when we flash our new kernel it'll find it's kernel modules installed and actually work, as opposed to choking in boot, or booting but being generally useless.

If you have a Belkin IR Keyboard (F8U1500-E) then you'll also want my kbdd, and if you have any IR keyboard you might want my init.d.kbdd file.

So run "sh instal-kbdd". It should copy kbdd to /usr/sbin/kbdd (saving the old one as /usr/sbin/kbdd.old), copy kbdd.conf to /etc and copy init.d.kbdd to /etc/init.d/kbdd.

Now you should have your base system much closer to ready. Now that the firmware is installed if you were to reboot your Bluetooth should work. However the kernel that shipped with Familiar 0.8.4 had broken IR support, so we need to upgrade to the 2.6.17 kernel I compiled for the IPaq. If you have a different piece of hardware there are instructions in the handhelds.org wiki for getting and compiling kernel source. Ignore the part about them making their own configs, it didn't work for me, instead just copy /proc/config.gz to your sd/cf card and use that.

So to flash the new kernel after the modules are installed, reboot the IPaq holding the two upper keys (as the instructions said) as well to bring up the boot flasher and this time pick the 2.6.17 kernel.

Now it should boot up and Bluetooth and IR should work and your Belkin IR keyboard should work. Like magic. I still haven't gotten wireless to work but I'll update this if/when I do.

Wired USB internet

Next? We need connectivity. I still haven't gotten the wireless to work, but you can easily do ethernet-over-usb and use a desktop as a router. My instructions are Linux specific but I'm sure other OS specific instructions can easily be found by Google.

I already wrote instruction on how to get a mobile Linux device online with Linux so check out the instructions at www.mindstab.net/wordpress/archives/174#gp2x_networking.

The net.sh script for the IPaq has an extra line and looks like

#!/bin/sh

ifconfig usb0 up 10.1.0.2
route add default gw 10.1.0.1

and you can get it at ftp.mindstab.net/ipaq-hx4700/net.sh.

Native Video

So the IPaq can play video. It's a smidgen of a hack for GPE because the version with familiar doesn't actually have a mplayer compiled for it so I nicked the one for OPIE and flubbed one of the dependancies: instead of using the SDL 1.2.7 compiled for OPIE and depending on OPIE on used teh 1.2.4 version compiled for GPE. This might be why the video is currently choppy until I can find a better solution because there might be a much faster rendering path on OPIE for SDL than there is under GPE. Still, this will work if you don't mind choppy video (but at least the audio is 100% solid). What I think I really need to do is find a way to make XV work on GPE and get mplayer to use it.

As for getting this working, all you need are some packages I've collected. Just grab the following from my iipkg collection at ftp.mindstab.net/ipaq-hx4700/ipkg:

  • libmad.ipk
  • libpostproc.ipk
  • libsdl.ipk
  • mplayer.ipk

I think that's all you need. Either way, if it asks for other dependancies they are in the folder, so just grab everything. I think you have to force one of them to install ignoring it's dependancies with the '-nodeps' flag. Anyway, once you get mplayer installed, it uses the SDL video output plugin. In order to make video and audio sync and not play laggy or slow I recomend the following flags:

mplayer -framedrop -nocache $MOVIE

As I said, it's currently laggy, but it works, and I'm looking for a better solution.

Making an ARM Debian Chroot

Note: For anyone who has been waiting for almost a year for my promised guide on how to make a Debian chroot for the GP2X, this is it. The instructions are the same. I originally did this on my GP2X until I got netwokring working on the IPaq, and shared the chroot SD card between them.

Now the IPaq only has limited space and only a limited number of programs compiled for it. If you want access to absolutely all software, then we need another source. The answer is a Debian chroot. Debian has great arm support so about 99% (Not Java) of stuff in the Debian repository will be accessible to you. All you need is space. So grab a decently sized SD card and put a reasonable filesystem on it, like ext2. Now, in order to install Debian we need Debootstrap, their utility for installing Debian from anywhere. You could try and install it on the IPaq but it'd be a hassle. I found the best solution was to download the ARM install disks (or minimal CD) and just copy off the entire filesystem. It's only a few MB. You can get my copy at ftp.mindstab.net/ipaq-hx4700/deboot.tar.gz Untar it on the SD card.

For this to work you'll need a network connection on the IPaq so make sure that's setup and working.

(For GP2X users, for each chroot (the debootstrap one, and the final one) you'll also want to run 'cp /lib/libiconv_plug.so lib' where lib is what will be the root lib directory in the chroot.)

Then on the IPaq execute the following to set up the environment to chroot into the Debian install environment.

cd deboot
cp /etc/resolve.conf etc
mount -t proc none proc
mount -o bind /dev dev
chroot .

Now you're in the actual minimal Debian install environment that is really only capable of doing one thing: running Debootstrap. So go for it. Install it in the chroot for now, you can always move it out once done.

debootstrap --verbose --arch arm etch /mnt/etch http://gulus.usherbrooke.ca/debian

Keeping in mind to change the Debian release name to what you want and to change the mirror to something appropriate to you. For a full list of Debian mirrors look at www.debian.org/mirror/list.

When it's done, you'll have your very own Debian chroot in /mnt/etch under the chroot or /media/card/deboot/mnt/etch in the IPaq filesystem.

You'll probably want to move the chroot to either the root of the SD card or just a subdirectory, so exit the chroot and then

mv /media/card/deboot/mnt/etch /media/card/etch

Now you have your very own Debian chroot. A few last things need to be set up before using it. Again, it will need internet too if you want to be able to install software, so run

cp /etc/resolve.conf /media/card/etch/etc

Next you need to add a few things so the environment will be have as Debian expects, and not inherit the slightly different IPaq environment, so grab profile and profile.ipaq and put them in the /etc directory of your chroot. Mostly it just sets your home directory to /root instead of /home/root and a few other minor things but important things.

Finally, get the chrootme.sh script and put it in the root of your chroot.

Now all you should need to do to use your chroot is

cd /media/card/etch
./chrootme.sh
source /etc/profile

Now you are in your live Debian chroot! Congrats! So why did we go to all this effort to just get another Linux environment when IPaq already has one? Well, this one can now install any software that Debian supports, which is pretty much all software :). But first, at least in my case, we have to do a few things for apt so it will be happy. Run

touch /root/.gnupg/trustedkeys.gpg

gpg  --keyserver subkeys.pgp.net --no-default-keyring --primary-keyring /etc/apt/trusted.gpg --recv 359AAB34 

wget http://ftp-master.debian.org/ziyi_key_2006.asc
gpg --no-default-keyring --primary-keyring /etc/apt/trusted.gpg --import ziyi_key_2006.asc

This install the required gpg trust info so that you can securely talk to the Debian package server.
You can also select a mirror by editing '/etc/apt/sources.list'. Now just

apt-get update

and then you can 'apt-get install ' any piece of software you want. I'd recommend starting off with a text editor like vim and/or emacs, and the some programming languages like Python, Ruby, Lisp, or C. Now you have a mobile coding environment that fits in your pocket!

Conclusion

Well, now you have an ultra portable computer that can run any piece of Linux software. I turned mine into a portable development machine. I've been using it at University in my CS classes, but you can do what ever you want with yours.

As for the future, the only real things this tutorial still need are ways to get the WiFi working and usable, and a way to squeeze better framerate out of MPlayer. If anyone has any ideas, please get in touch and let me know :)

I hope this set of notes/tutorial/howto is useful to anyone.

Valid XHTML 1.0!
Valid CSS!
Mindstab.net is proudly powered by WordPress
Entries (RSS) and Comments (RSS).
18 queries. 0.594 seconds.