Tuesday, 26 June 2007

vpnc-script issues with ash shell

Today I decided to set up vpnc on my Linksys WRT54G router. I want to be able to connect to the VPN at work, and the Linksys is an ideal place to do it.

The setup I'm aiming for (where a single port gets VLANd off and becomes the only available to connect to the inside of the VPN at work) is trivial to do and I'm 98% sure one of the guys at work has already done it (although probably with some slightly different software, I'm not sure).

I run OpenWRT WHITE RUSSIAN 0.9 on my Linksys, which was the latest at the time I installed it. I believe there is a new development release, but this still seems to be quite current.

First step was getting vpnc installed with the necessary bits and pieces. OpenWRT comes equipped with what can only be described as a very streamlined version of apt: ipkg. I searched for vpnc over at http://www.ipkg.be, found a hit and as such added the necessary line to my /etc/ipkg.conf file. A quick update and I could install vpnc, kmod-tun and libgcrypt as required.

With my VPN config file in place, I quickly received an error:
/etc/vpnc/vpnc-script: 222: Syntax error: Bad for loop variable

What's on line 222?
for ((i = 0 ; i < CISCO_SPLIT_INC ; i++ )) ; do

I did some searching and it seems this is perfectly valid Bourne syntax, so what gives? Well, OpenWRT uses ash as the default shell, not bash or sh. I decided to replace it with something equivalent:
i = 0;
while [ "$i" -lt CISCO_SPLIT_INC ]; do
// there was some stuff here, I added the next line just before the "done"
i = `expr $i + 1`

I had to make this fix a little further down too, but this did the trick and vpnc now correctly adds all of the default routes and properly updates the /etc/resolv.conf.

Monday, 25 June 2007

Flash! Aaaaah!

Vlad has an awesome blog post over at http://inomine.walktojapan.com/2007/06/25/i-like-flash/

I encourage you all to go and check it out. It was in response to a recent post of mine involving monitors ;)

I am service!!!

After rebooting to Vista to watch a 720p video, I was much amused by ASUS' attempt at programming.

service.jpg


Reminds me of Judge Dredd's classic "I AM... THE LAW!"

Sunday, 24 June 2007

Tangerine Panic!

http://www.addictinggames.com/tangerinepanic.html  is one of the most awesome games going.

My top score is 203... can you beat it?

CMEHA!

I clearly need one of these bad boys.

smena.jpg

Saturday, 23 June 2007

Hasselblad

I nipped into Camberley today to pick up a two rolls of film (yes, my life really is that exciting).

I bought a roll of 135 TX400 from Jessops, but they didn't have any 120.  Next stop was S&P, a smaller shop just down the road.  These guys didn't have what I wanted, either, but in the end I walked out with a roll of FP4 at a mere £4.50 (remember this is for a whopping 12 exposures).

This Hassie 500C was my Grandad's camera, which my Uncle Quentin inherited (and I subsequently borrowed).  I spend quite a bit of time figuring out how it worked and generally getting all of the various bits and pieces going.   Unfortunately the 120 film back slips slightly near the end of the wind... this put me off using the body for quite some time.

But today, I decided I'd had enough waiting, and began the crazy process of getting a roll of film loaded on Camberley high street.  It took me a good five minutes to figure out all of the looping and winding that goes on, during which time some old timer wanders up and asks: "Is that a Bronica?"

This amused me quite a bit... I guess it's an easy mistake to make when you've not seen one for a couple of decades, and you were never that familiar with them in the first place.

So, anyway, I got to replying and told him that it wasn't a Bronica, but a Hasselblad.

"Oh, even better then."

"Yup."

...

"I just wish I could make the damn thing work."

VMware Workstation CPUs

So... in VMWare Workstation I can tell my Windows XP guest image that it has two CPUs.

What does this mean?

Will it give me more performance, or is it more for testing SMP configs?

Thursday, 21 June 2007

Wednesday, 20 June 2007

GNOME, ensuring your safety

While catching up on my daily dose of Planet GNOME, I spotted a rather interesting blog post requesting info from people with specific Gateway laptops.

Why?

Well, it turns out that the author is compiling a list of known-faulty batteries to be used with hal-info/hald.

Such a list would be able to provide a very neat message to the user, something like:
"The battery you have in your Dell laptop could potentially explode.  Please visit dell.com/explodingbattery for details on ordering a replacement."

Will Microsoft and Apple be following suit?

Sunday, 17 June 2007

Multi-head setup

monitors.jpg


Hah!  I've got a better keyboard than him.

Hacking the Adobe Lightroom Database (lrdb)

On Windows Vista I use EXT2-IFS to mount my home directory, which Windows does not natively support. As my home directory lives underneath the /home mountpoint, I accessed my files via N:\lewiz, as opposed to just N:\ if I were to mount via Samba.

While this all worked very well, I now wanted to use my Lightroom database in my Windows XP VMware image. No problem, I thought, I'd just import the database and all would be well.

As it turned out, Lightroom really didn't seem to like this. All of my folders turned red, I couldn't access the photos and Lightroom went off doing some checking stuff that really didn't interest me.

I attempted to tell Lightroom where my root images directory was, but I didn't have much luck. A little frustrated, I decided to open the database file in vim and do a global search and replace on the offchance. Upon opening the file, I spotted that the lrdb file used by Lightroom is actually a SQLite database.

Impressed, I did some poking and discovered that filename and path data really only exists in two tables: Adobe_imageFiles and AgFolderTagInfo.

As I had no Internet at the time, I had to call Vlad to find out what the SQLite string concatenation function was, but in no time at all I had four SQL queries that I applied to (a copy of) my database:
update Adobe_imageFiles set absolutePath = 'N:' || substr(absolutePath, 9, 9999999);

update Adobe_imageFiles set robustRepresentation = 'WN:' || substr(robustRepresentation, 10, 9999999);

update AgFolderTagInfo set absolutePath = 'N:' || substr(absolutePath, 9, 99999) where absolutePath like '%lewiz%';

update AgFolderTagInfo set robustRepresentation = 'WN:' || substr(robustRepresentation, 10, 99999);

This replaced 'N:\lewiz\...' with 'N:\...' in the appropriate tables.

Import the database into Lightroom, and Voila! My images all work.

That said, Lightroom does appear to be bitching about being unable to write metadata to the files.

This is probably a very stupid thing to do with your Lightroom database, I do not recommend that you try it. I expect that my database will fall apart shortly. In fact, I have this weird feeling that some Lightroom dev is going to pop along, read what I've done, and double over laughing at my stupidity.

Ah, well.

Jelly production in China

I came across a blog entry that includes photos of jelly production in China.

Anybody that has visited a supermarket in China will have spotted the massive sections dedicated to small potted jellies.

Unlike England where jelly is mainly bought in concentrated 'chunk' form, jelly is bought in a ready-to-eat form, and often includes small fruits embedded inside.

Plenty of people seem to eat them, I know Xiaoxiao and her brother do, but the question is... if they knew where they came from, would they still hold the appeal?

Here are two photos from the post you can find at http://www.eatnineghost.com/how-they-produce-jelly-in-china/

jelly1.jpg


jelly2.jpg

Linux Skype 1.4 BETA supports SMS (and other new features)

I've been using the new Skype 1.4 BETA for the last day or two.  It works quite well and the user interface has been massively updated.

In addition, I just discovered that this 1.4 BETA implements the full Skype API, which means that we already have the ability to send SMS messages with Linux Skype.

Currently the GUI does not provide all of the necessary hooks, but by following the simple steps described at http://share.skype.com/sites/devzone/2007/05/skype_api_is_catching_up_on_li.html I was easily able to send a quick test SMS to my mobile.

It won't be long before Skype release an updated GUI, I hope.  But if not, no worries... I can write one myself.

Saturday, 16 June 2007

Awesomeness

Lewis: (lewis.getAwesomeness() * 2) > vlad.getAwesomeness();

Vlad: So if you get your awesomeness and multiply it by two you're only then better than me? Weak.

Lewis: Yeah, I clearly got that wrong :P

lewiz.org post comment count (fixing Wordpress wp_hashcash)

I finally got around to upgrading my blog to the latest and greatest version of WordPress... 2.2 right now.

At the same time I switched away from the WordPress HashCash plugin I was using to prevent comment spam.  It's actually done me pretty well over the last year or so.  I do get the odd spam comment, but nothing is perfect.

Where wp-hashcash has failed me though is in keeping the comment count associated with each blog post up-to-date.  For example, five minutes ago WordPress thought somebody had left a comment on my post about a new keyboard... I believe this to be a side effect of rejected spam comments.

Here's a quick fix for the problem:
update posts set comment_count=(select count(*) from comments where comment_post_id=id);

Very quick, very simple.  Amazingly the stats on my WordPress database were not all that encouraging:
Query OK, 395 rows affected (0.06 sec)
Rows matched: 926  Changed: 395  Warnings: 0

So 395 of my blog posts had the wrong comment count... ouch!

Friday, 15 June 2007

Getting a Sun Ray DTU MAC address

Handy little script to output the MAC address of your Sun Ray DTU. Based on Chris Gerhard's Sun Ray firmware version blog post from a week or two ago:
$ /opt/SUNWut/bin/utwho -c | nawk '$3 == ENVIRON["LOGNAME"] {print substr($5,4)}'
0003ba4ea9dd

Thursday, 14 June 2007

Return to the Trek

A couple of days ago I posted my favourite photo from the China holiday... 'Silence on the mountain'

Vlad suggested 'Thunder on the mountain' and a bunch of word insertion was tried until I settled on silence.

Vlad did the work on this shot... my original version was good, but nowhere near the version that Vlad produced.

I duly uploaded it to TrekEarth, marking the first TE post I've done in months and, lo and behold, got some pretty impressive feedback.

Right now it is sat at 30 points, which is quite impressive.  A few of my other photos are ranked in the 50s, but it was really nice to get such a good response with the first photo in a while.

Hopefully I'll get a few more shots sorted out and upload those too :)

Sunday, 10 June 2007

China, 2007

I've spent most of the day messing around with photos in Lightroom.  I've uploaded all of the shots I've done today.  I'm pretty happy with most of them, although one or two do still need a little more work.

Please visit the gallery at http://www.fajita.org/china2007/ to have a look.  Sometime soon I'll finish off the work I started on the Angkor gallery and make that public too.

Here's one of my favourite shots from the China 2007 gallery:

20070218-08237024.jpg

CDs vs FLACs

How is it that despite owning one of the better PC sound cards and having it hooked up to my pre-amp with decent cables, that CDs still sound a million times more awesome than the uncompressed audio files I ripped from them?

There's a lot to be said for a decent CD player and 'speakers.

Also, go buy the Guillemots.

China Travel Tip #1

Wear fabric-type shoes, for example Gore-Tex Merrells.

If you do this you'll save yourself all sorts of aggravation from shoe cleaners while wandering the streets.

Saturday, 9 June 2007

Lost In Translation

lost_in_translation-charlotte.jpg


Only film that gets better the more times you watch it?

Colour, fast travel and a 'guest' photo :)

These days a lot of the shots I take get converted to B&W more or less straight away.  Looking through the contents of my photoblog (www.lewiz.org/plog) I spotted just how many of the recent shots have been B&W.

I guess there area  couple of reasons for this... many of them were taken with a film body loaded with 400ASA B&W film, and some shots just work better without the colour to distract you.  But to be honest, I think the number one reason I shoot B&W so much is because it has a 'feeling' I don't think I can capture with colour.

Anyway, I just uploaded another shot to my photoblog, please check it out at www.lewiz.org/plog (leave a comment if you wish :).

In addition, here's a shot that I will probably upload to my photoblog sometime soon.  It was taken by my Mum earlier this year while we were visiting a temple in China.  I believe it is somewhere in Hangzhou, but I'd have to check to be sure...

20070216-05592021.jpg

Positive changes in Firefox 3 'Gran Paradiso'

Mozilla released a new alpha of Firefox 3 today.  I have previously looked at Firefox 3 to see what new things were coming.

For me, the big new feature is using libcairo, a screen-drawing library, to handle scaling of images.  What does this mean to you and me -- Firefox will finally use bicubic (i.e. nice, smooth yet sharp) scaling for non-100% images!

One of the big changes due to hit Firefox 2 was the 'Places' functionality -- a complete overhaul of the bookmarks support.  I must admit that since switching to del.icio.us Bookmarks (the name of a delicious plugin for Firefox 2) I've been more or less uninterested.  That said, there is talk that the Places will include tagging support, and that Mozilla may offer some form of bookmark synchronisation.

Today I discovered that the result of the behind-the-scenes work on the Firefox Password Manager will pave the way for pluggable support for the likes of gnome-keyring (in much the same way as I was talking about for Pidgin yesterday (although Firefox does currently encrypt passwords, it could just be nicer)), OS X Keychain, etc. to handle things for us.

Congratulations on this excellent release!

Security around Tiananmen Square

Just recently we've had the 18th anniversary of the Tiananmen Square massacre and since then a few interesting tidbits have popped up.  Most interesting was the report that a newspaper editor is get the sack after printing a short advert in the newspaper.

The advert read: "Paying tribute to the strong mothers of June 4th victims."   According to the BBC News article at http://news.bbc.co.uk/1/hi/world/asia-pacific/6733611.stm the editor called the person who placed the ad, asking about the significance of the June 4th reference, such is the way the incident has been suppressed in the media.

Every year around the anniversary police and army presence is increased.  This is made easy by the fact that Tiananmen Square itself is like an island: there is no official road access, pedestrians must instead walk through subterranean walkways.  On June 4th policy and army men were checking the bags of people entering the square before letting them in.

Interestingly I dug out a photo of a police riot van I took earlier on this year.  This is a van that means business and I doubt that the presence of small round openings in all of the reinforced windows escaped the attention of any would-be protestors.20070305-081690101.jpg

This photo was actually something I was messing around with before I decided to write the post.  You'll see a rare guest apperance in the corner, and the funny colours are due to a cross-processing plug-in for Photoshop CS3 I was messing around with.

Friday, 8 June 2007

New keyboard!

Well, today I decided that I'd do as Liam had done a week or two ago, and clean out my trusty MS Natural Keyboard Pro.

Now, I've been using Natural keyboards for quite some time... I used the first one they did, now called the 'Elite' model, then I moved onto some other one that was built like a tank (a tank with holes, as it went down in flames when I poured a can of Coke into it), followed by the one I cleaned out today... it might have a name, but I call it the plastick-y one with the grey bits that came after the one built like a tank.

The cleaning went fairly well, I washed each key by hand and they're probably dry by now.  Unfortunately I also managed to lose one of the keyboard springs (I never saw it... I suspect it never even existed!) and at the same time break one of the legs at the back.

I'm fed up of cleaning my keyboard now (and will get pissed off quickly with a flat keyboard) so I decided to see what Google Checkout could offer me today...

microsoft_natural_ergonomic_keyboard_4000.jpg


for a mere £26 eBuyer would have sold me the new super-duper fancy black USB keyboard (pictured above).  Unfortunately, this wasn't quite good enough, so I managed to find a cute £4.49 USB wireless mouse I could use with my laptop... dang, still 51p short!

Eventually I settled on the keyboard, a 4-port unpowered (on purpose, I don't like chargers) USB hub and a rather sexy-looking 1m green RJ45 cable.

To be honest, I could have probably done better, but the cable will no doubt be useful for attacking people (I had Chris in mind), so I went with it over an even cheaper RJ11 to BT-style 'phone cable.

Total cost to me: an hour to clean and break my old keyboard, and £25.72 for all of the above mentioned good stuff, including delivery.

Google... I love you!

Pidgin encryption in GNOME 2.22

While browsing through the roadmap for the next GNOME release (2.20) I continued on and spotted that there is a plan to add an encryption plugin for Pidgin in GNOME 2.22.

This is great news for anybody that values the security and privacy of their instant messaging passwords.

One of the common arguments made by the Gaim/Pidgin developers that by its very nature, an IM password was a throw-away commodity.  This may be true, but in Sun (and countless other companies) we have a unified username and password for all services, including IM.  Suddenly the plain-text password in your home directory looks less satisfactory.

Anyway, you can read more about the roadmap at http://live.gnome.org/RoadMap

Tiananmen Square

Just uploaded the first photo to my photoblog in ages...

It's a quick shot from Tiananmen Square in Beijing.  I've included it here for fun :)

20070305-04478013.jpg

Wednesday, 6 June 2007

Pop-Up Hard Gay ftw!!!

Japan's all-time favourite weird thing, Hard Gay, is now available as a Pop-Up Pirate plastic game!

hardgay.jpg


http://www.jbook.co.jp/p/p.aspx/3054988/s/ appears to have them on sale for as little as ¥2646 (about £15).

One more nail in the "Japan is better than every other country" coffin.

Monday, 4 June 2007

Chinese kids

I was just browsing through some of my exported photos (i.e. the full-res images before I resize, tweak and sharpen for web) and spotted these.  I've no idea if I've posted them before, but it's clearly not a bad idea to post them again.

20050723-114651.jpg


12-year-old English learners20050716-155856.jpg


9-year-old English learners (from some other random school)


20050724-124036.jpg


Me... with a very 70s haircut... weird stuff happens when you don't cut your hair!


 

Billy the Bap

At the 130th birthday party (combined ages of my Mum and Grandma) on Saturday I spotted that a certain brown roll seemed to have gone uneaten and was making its way slowly around our table.

20070602-220818.jpg


One thing led to another, which in turn led to another thing, which led to the bap being named Billy... anyway, every single person (young to (very) old) at the 130th birthday party took part in a sensational photoshoot with Billy.

To see the full set visit http://www.fajita.org/billy/

Saturday, 2 June 2007

Cheap China flights

Seriously... what happened to all of the sanely priced flights to China?

Back in the day a flight cost £350 direct.  These days you get to pay about £600 for a return flight that changes somewhere random like Dubai or Moscow.

It's pretty crazy stuff.