Planet Belfast Linux

August 17, 2010

Jonathan McDowell

New Laptop Frustration

I've been talking about replacing my laptop since November. Now I've somewhat forced the issue by giving away my R200, leaving myself with just the EEE 901. I'm not planning to bring a desktop with me to California (well, I might ship bits for a media box, but probably not even a complete machine), so I've been looking more seriously at what my options are.

I like smaller laptops; the R200 is 12", I had a Compaq N200 previous which was 10". There seem to be a number of 13" options that are light, so I'm prepared to look at those.

This is going to be my main machine, so I need something with some grunt. A decent amount of RAM with a reasonable processor. I'm probably prepared to take the price hit in order to get SSD. Also a decent resolution screen along with built in wifi (does anything not have this these days?) + 3G would be nice too.

Of course, it turns out I can't have all of this. In particular the US market seems pretty dire for 3G support (no, something locked or that can't take a GSM SIM doesn't count. I expect to travel.) The UK market is a bit better, but there are still no perfect answers.

Lenovo X201s



(It's really hard for me to think of this as a Lenovo rather than an IBM Thinkpad.)

This comes in a 1440x900 resolution variant, which is nice for 12". I can have a touchpad too. What I can't have is 3G; with the 1440x900 screen there's apparently no space for the 3G antenna. Doh! Also Thinkpads are *ugly*.

Sony Vaio VPCZ12Z9E/X



I want this. Core i7, 1920x1080 screen, SSD, 3G (Gobi), sub 1.5Kg.

But. Sony. Ridiculously expensive. If it was half the price and made by Lenovo or Toshiba I'd have bought one by now. As it is there's no way I can reasonably expect it to last 3 years (and really I'd want 5 given the cost).

Toshiba R700-155



I've been extremely happy with my R200 and spent a long time eying the R500/R600. The -155 is a Core i7, 1366x768 screen, 13", 3G, sub 1.5Kg.

2 problems. One, I'd like a better resolution if I'm going to 13" - both the Lenovo and the Sony manage that. Secondly, and more of an issue, nowhere seems to have them in stock.

HP Elitebook 2540p



This has potential. Seems to be a little heavier than the other options, and it's only a 1280x800 screen (but in 12"). Available with Core i7, SSD & 3G. Oh, except once again stock is a problem.

Have I missed anything else out there? I can probably buy from the UK or US with equal ease.

by Jonathan McDowell at August 17, 2010 09:53 PM

August 16, 2010

Stuart Hacking

Outlook not so good.

An important person in the company (all praise the company!) has just attempted to send me an updated security certificate by email.

Oh, no, no, no, my friend! Surely you know that I’m running Micros~1 Outlook as my office mail client?

You see: Outlook knows what’s good for you, and apparently, security certificates are not. Indeed, Outlook will not allow me to access this file, or even give me the option of “Don’t worry, I know what I’m doing.”

[Here's a fun fact: The certificate was *sent* *using* *Outlook*. So, Outlook will happily send files that it deems to be unsafe, but the poor sap on the other end won't get to use it.]

Now, I tend to place a degree of value on others’ time. So it pains me to have to reply to someone saying “Hi, Outlook won’t let me open your attachment. Can you jump through hoops X, Y, Z to get it to me?”

Outlook used to simply be a poor email client. Now it has become actively counterproductive.

by smh at August 16, 2010 12:25 PM

August 13, 2010

Jonathan McDowell

Not my usual sort of keys

In a week I'll be in California. I'm not packed, though I've been spending a lot of time trying to figure how exactly what I need to take, what I want to take, and what I really shouldn't take.

One item I've been uncertain about are keyboards. When Simon went to France for a year he took a UK keyboard with him, but then they have AZERTY which is substantially different. There are a number of US keyboards lying around the office so a few weeks ago I switched to one for work to see how it went. I think I'm bringing a stash of UK keyboards with me. Annoyances with the US keyboard:

  • Enter is too small. I have this problem on my EEE 901 as well. Usually this manifests as me typing lots of half written lines on IRC.
  • The " moving location is actually much more irritating than I expected. Likewise ~
  • And, the decider, PERSON RAISING BOTH HANDS IN CELEBRATION simply doesn't flow as easily. On a UK keyboard it's left, middle, right. On a US keyboard it's right, left, right.

by Jonathan McDowell at August 13, 2010 07:38 AM

Philip Herron

Gccpy – Call for help!

Hey guys, so its been a while I’ve got a lot of stuff done and many core things working in Gccpy now more links on how to get up and running with it soon.

I am asking for help from you or from your friend.. anyone, all you need is:

all minezz

all minezz

  • 5 minutes
  • text editor
  • basic knowledge in python

I am trying to build up a test suite for this compiler and i would love to have it all built from scratch for this project rather than taking something from CPython where i think licenses will clash and i want to avoid anything like that. So what does this all mean?

I need people to write up their favourite python snippets, but there are requirements: what you can do is use anything EXCEPT any imports. Imports are something which will be handled soon, and isn’t that important  yet for the core language implementation.

So I have set-up this mailing list and i would love it if as many of you would join: http://crules.org/cgi-bin/mailman/listinfo/gccpy

So join the mailing list or simply post a message if you prefer and we will try to remember to cc you with in. One thing i would ask is only submit a small test case if you are ok with this being pretty much un-licensed because GNU projects require copy approval for you to submit code, but we can negate this by going though me just submit this to me under a http://sam.zoy.org/wtfpl/ (Whatever you want to do license) . This just saves any pain of licensing, you will of course still be attributed! Leave your name and an email within the test-case file, since really that’s all we care about as hackers anyway we don’t care about licensing so long as we have some attribution. To give you a flavour of how simple these test cases can be lets look at one i made earlier:

  1. # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
  2. #  Version 2, December 2004
  3. #
  4. # Copyright (C) 2004 Sam Hocevar
  5. #
  6. # Everyone is permitted to copy and distribute verbatim or modified
  7. # copies of this license document, and changing it is allowed as long
  8. # as the name is changed.
  9. #
  10. # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
  11. # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
  12. #
  13. # 0. You just DO WHAT THE FUCK YOU WANT TO.
  14. #
  15.  
  16. # @Author redbrain – redbrain@gcc.gnu.org
  17. # @Date 13/8/10
  18. # @Expected Result: <5>
  19. #   -Tested against Python Version <2.6.5>
  20.  
  21. def foo ( x , y ):
  22.     return x+y
  23.  
  24. print foo( 2,3 )

Things for testing the expression syntax handling or calling functions, parameter passing like keywords parameters and positional parameters, class’s anything! Even if it is as small as one expression and a print for the result it is more than enough for a test case! The reason I want as many people involved is so i can see what features/trends matter most important to python users and then I can focus on making them extra awesome. And if it only takes you 5 minutes to write a small piece of python code and send an email while you get your name within the Gcc sources the more the better:).

When you create a test case simply send an email to the mailing list with the subject “Test Case <name>”. You can submit as many as you like the more the better  and the funnier the better…. * looks at Jezra :) ! @yamatt i am reusing that python while loop you sent me ages ago to freak out my processor! ;) Thanks so much every one, watch this space in the next week for links on how to use and see your test case running in Gccpy, so you can compile your python code to an executable!

So remember the mailing list is over here. http://crules.org/cgi-bin/mailman/listinfo/gccpy

by redbrain at August 13, 2010 02:38 AM

August 06, 2010

Paul Gregg

Vodafone UK + HTC Desire + Android 2.2 FroYo = Fail.

Well, it looks like Vodafone UK royally messed up the timing of the HTC Desire OTA Update yesterday.  While most owners were eagerly expecting the announced Android 2.2 (FroYo) update that HTC have been pushing out, Vodafone decided to push out a 2.1-update1 which only provides Vodafone branding, apps, a few bugs, and even a couple of "adult" related bookmarks to everyone - and leaving them on Android 2.1 (Eclair).

Needless to say - Users are not happy at all. *Vodafone appears to have moved the thread here. [2010/08/06] Moved again to here (is Vodafone trying to hide the complaints?).

In work, we (coworkers and I) now have a total of 8 HTC Desires (out of 16 people) - even two iPhone users have converted! A few have been espousing the wonders of FroYo on their phone (some had rooted, and did it themselves, others had bought unbranded phones and got the stock HTC FroYo upgrade). I was jealous(ish) and wanted it myself.

Given Vodafone's actions yesterday, it was likely that the FroYo update from Vodafone was minimum several weeks away, if not 3 months (as was intimated on the Vodafone forum - end of October) - it was also noted that the Vodafone FroYo update would include the Vodafone 360 branding and software.

Thus, last night it was time to embark on the adventure of flashing my HTC Desire to a stock image direct from HTC. I reasoned that my goal should be to flash HTC's Android 2.1 (Eclair) image to the phone, and once there, the normal software update process should take me to 2.2.

And so it began...

I knew that I needed to create a gold card because the Vodafone image doesn't let you install non-Vodafone images. This I discovered as I tried to simply apply a stock 2.2 download and using boot recovery update.zip - all attempts met with a complaint of a "Fingerprint error".

I ended up at this page:
  [TUT]Complete upgrading guide(root, unroot, flashing ROM & updates)

and followed Post #3 which details a) How to make a Gold Card* . Ignore the rest of #3
and then Post #4 - the "unrooting" guide.

You then need to find a download of the correct stock HTC Bravo WWE image ROM - I chose the second WWE ROM from this link (140MB download):
  [ROM] Official HTC Desire RUU ROMS and OTA Update URLs
  RUU_Bravo_HTC_WWE_1.21.405.2_Radio_32.36.00.28U_4.06.00.02_2_release_126984_signed.exe

Proceed through the rest of Post #4 "How to Flash ROM" with the Goldcard inside your Desire, and plugged into your PC.

The phone will take 5-10 minutes to complete upgrading (or downgrading) to HTC Stock 2.1 image. When it reboots you will have to go through all the original setup sequences you did when you first unboxed your phone.

You can then perform a Software Update Check and you should find you have a Android 2.2 FroYo update (90Mb) waiting for you.  Proceed and let it do its thing.

Once done, welcome to FroYo.

All future updates will come direct from HTC - not from Vodafone, and you won't ever have the Vodafone 360 branding rubbish foisted upon you.


* My GoldCard creation had a bit of a hiccup, in that it turns out that the 4GB Samsung card which came with my Desire does not work as a Goldcard despite formatting and following the instructions to the letter.  Trying an old 1GB Sandisk I had resulted in a good goldcard.

Aside from the goldcard hiccup - this all went surprisingly smoothly and painlessly.

Good luck.

Disclaimer: If you try any of the above - it is all your responsibility. I take no responsibility should you brick or damage your phone.


by Paul Gregg at August 06, 2010 12:40 PM

July 28, 2010

Colin Turner

Fudoshin

I wrote this essay almost eight years ago. I'm just republishing it in a web format.

In many eastern religions, and indeed their occidental counterparts, great emphasis is placed in reaching states of personal enlightenment or self-improvement. In Zen, this is often approached from several angles (See D.T. Suzuki [2]), but perhaps the most well known is that of zazen meditation. In this practice the mind is encouraged to have no attachments, it may move freely, neither forced to consider thoughts, not forced to leave them.

This state of mind could be described by the word mushin meaning literally “no mind”. In this state the mind is truly focused on the present moment, not anticipating the future and not pondering on the past. The martial arts of Japan have long been looked upon as an alternative, or perhaps at least parallel, means of progressing to this goal. In Budo this can be thought of as a form of meditation in motion, always acting in the present.

This prevents fearful anticipation of the future and also misinterpreting such future events. Although the idea of a budo is that of a way without destination, this goal of mushin should be constantly striven for. Perhaps an intermediary goal is that of fudoshin. This means "immovable mind" although this translation fails to carry the positive implications in this word. For me this means that the mind is immovable by outside influence, or to put it another way the mind can only be “moved” when one desires it.
As the beginner knows nothing about either his body posture or the positioning of his sword, neither does his mind stop any- where within him. If a man striked at him with the sword, he simply meets the attack without anything in mind. As he studies various things and is taught the diverse ways of how to take a stance, the manner of grasping his sword and how where to put his mind, his mind stops in many places. Now if he wants to strike at an opponent, he is extraordinarily discomforted. Later, as days pass and time piles up, in accordance with his practice, neither the postures of his body nor the ways of grasping the sword are weighed in his mind. His mind simply becomes as it was in the beginning when he knew nothing and had yet to be taught anything at all.
extract from the Unfettered Mind, Takuan Soho

So here in "The Mysterious Record of Immovable Wisdom", a letter written by the famous monk Takuan Soho to the equally famous swordsman Yagyu Munenori, Soho advises that a person with no martial experience may be better off than those who embark upon such a path. The person with no such training at least behaves naturally, even if possibly foolishly. Their mind may be affected by many outside influences, but at least they themselves do not cause it to "freeze".

When one begins training in a martial way, one often begins by learning basic skills and body movements and then, of course, waza. When attempting to refine performance of a kata or waza, one’s mind may focus on the future - in the hope of attaining the perfect form - or it may focus on the past, in the recollections of past successes or failures.

Unfortunately these moments of locked focus, the states of "fushin" or frozen mind, however brief cause the body which is forever locked in the present to be deprived of command. In severe cases then, fushin is manifested by the locking in position of the whole body.

How then can we move towards this state of fudoshin, and thus ultimately to mushin? At this stage in my journey it seems that the following are true, whether during the execution of a kata, waza or a more free action.
  • One most resist the urge to anticipate the future except by observing the present. It follows that ultimately waza should not be "selected" but eventually will arise without conscious thought (mushin).
  • One must avoid lingering in the past. Recollections of past encounters and their success or failure are false as the past moment will never truly match the present.
  • One should not let your eyes and mind become locked on the opponents eyes, their weapon, fist or any other point. Gaze should take it the whole person as well and the mind should observe all things.
    Some teachers say that you should always stare at the enemy’s weapons, or at his eyes, or at his feet. This is not a good idea because it fixes your spirit in place and is easily read by an experienced fighter.
    - extract from the Book of Five Rings - Minamoto Musashi

  • Forced aggression may cause the mind to focus too greatly on the future desire for victory and thus ironically deprive the body of the mind in the present to help obtain it. One should not delay the cut, or throw, but neither should one rush it in too great a desire to bring the future more quickly. Indeed it seems from the books "Zen and the art of archery" (see [1]) and the "Unfettered mind" (see [4]) that we wish to obtain a state in which the cut happens because it is natural or the throw happens because nothing else can happen.
  • Such considerations occur outside the dojo when considering our progress along the Way or in other matters. Of course we must always strive to improve and progress, but if we are too desperate we risk placing our mind in the future and not the here and now. Similarly we must have the patience and some tolerance about our state of current imperfection. Focusing too much on the failures of the past denies us the chance to observe ourselves in the present to make us better in the future.


These comments are of course, immensely subjective. However these thoughts map my current way of thinking a short way into a long journey and at this time it seems the best way for me to continue to refine myself.

References

[1] Herrigel, Eugen: Zen in the Art of Archery, Arkana 1988.
[2] Suzuki, D.T.: Zen Buddhism: Selected Writings of D.T. Suzuki, Double- day 1996.
[3] Musashi, Minamoto: The Martial Artist’s Book of Five Rings, (trans. Stephen F. Kaufman), Tuttle 1994.
[4] Soho, Takuan: The Unfettered Mind, (trans. William Scott Wilson) Kodansha 1995.

by nospam@example.com (Colin Turner) at July 28, 2010 10:22 AM

July 27, 2010

Colin Turner

Cthulhu and Cosmic Terror

For many years now, I've been aware of the Cthulhu Mythos, since it infuses lots of popular culture. Indeed, Dread Cthulhu was recently blamed for the horizon oil spill, a theory that I rather enjoyed.

Despite this, I hadn't actually read any of H.P. Lovecraft's books directly. Last week and this, I decided to try out an ebook reader on my phone, specifically the rather excellent Aldiko for android. It's a nice application. I downloaded two of Lovecraft's books; "The Call of Cthulhu" and the "At the Mountains of Madness".

Lovecraft has been, mostly after his death, immensely influential, with references to his work appearing in many modern authors' work (e.g. Stephen King, Neil Gaiman). He is famous for the idea of "Cosmic Horror". The idea that the world is not truly rational, and understandable, but nightmarish, chaotic and hostile or at best indifferent to human nature.

I found "The Call of Cthulhu" rather unpleasant to read in parts, not because of the supposed horror, but because of the unpleasant racism implicit and explicit within the book. It does need to be remembered that everyone is a product of their times however, and I find the implicit racism difficult to accept in the works of J.R.R. Tolkien too. But the book was interesting.

The second book, "At the Mountains of Madness" was more mature and less objectionable.

But I couldn't entirely share the horror of the protagonists. Some of their discoveries were genuinely horrifying (usually acts committed by human beings) but much of the rest would be wondrous. They are horrified by the discovery of non-Euclidean geometry in architecture. Non Euclidean geometry does not frighten me, and indeed Lovecraft understood it wasn't the true nature of the universe. But seeing clearly non Euclidean architecture in a "normal" setting is wondrous, terrifying perhaps briefly, but not horrific. Much of the horror just comes from the primitive frame of reference, either scientific, or religious or both, of the protagonists.

And this is the bit I really can't understand, since Lovecraft was a failed astronomer, so he would have known that the universe is, to the best of our knowledge, indifferent to our existence, and that the laws of physics themselves could see our annihilation in so many ways. Indeed, apart from a (probably literal) Deus Ex Machina solution, every scientist knows that the ultimate future of humanity is doomed... Is that "Cosmic Horror"?

By the way, since the world is Sherlock Holmes mad at the moment, I recommend A Study In Emerald (PDF), a Hugo Award winning short story that is an interesting cross over of the Sherlock Holmes and Cthulhu mythos written by Neil Gaiman.

by nospam@example.com (Colin Turner) at July 27, 2010 06:36 PM

July 15, 2010

Jonathan McDowell

California here I come

On Thursday 19th August I will be leaving Northern Ireland and relocating to California. I'm keeping my current job with 3PAR (who I should point out are actively hiring in Belfast), just moving west by a few thousand miles. I'll be working in the Fremont office, but based on advice from most people I've talked to I plan to live in San Francisco.

I've got a few trips over to England planned between now and then which will give me an opportunity to see people before I go. Also I'll be at DebConf, where I hope to try and meet a least a few other Debian people from the Bay Area and pick their brains for advice about where to live & things to do.

This is something that's taken a lot longer to come together than I originally expected. I'm very glad it finally has, but obviously there's a degree of trepidation about the whole process. If I seem somewhat disconnected from reality for the next few months rest assured I'm sure I'll be back to normal soon enough once I've moved and found somewhere to live.

by Jonathan McDowell at July 15, 2010 07:11 PM

July 10, 2010

Jonathan McDowell

SPI 2010 AGM & Board Election

As SPI secretary I announced that nominations for the SPI board were open at the start of the month. The nomination period closes this Tuesday (13th July) with voting opening up on Thursday 15th. This year over half the board is up for election - 5 seats (currently held by Luk Claes, Joshua D. Drake, Bdale Garbee, Joerg Jaspert & Martin Zobel-Helas). So far I've received only 2 nominations, though I'm aware these things are often left to the last minute, so hopefully more will appear in the next few days. All anyone who wants to stand needs to do is drop secretary@spi-inc.org a (preferably PGP signed) email nominating yourself and providing a position statement (which will all be published once the nomination period is over).

Oh, and if you're a contributing SPI member please do remember to vote once voting is open!

by Jonathan McDowell at July 10, 2010 12:13 PM

July 06, 2010

Stuart Hacking

SWT “Event model”

Have a look at this documentation for a VerifyEvent in SWT:

void VerifyListener() {…}.verifyText(VerifyEvent e)
Sent when the text is about to be modified.

A verify event occurs after the user has done something to modify the text (typically typed a key), but before the text is modified. The doit field in the verify event indicates whether or not to modify the text.

Wait, what?

What we basically want is a simple predicate function that returns true if the Contents of a Text Field are still valid after a change. What SWT gives us is this awkward event model where we have to modify the event that has just been generated. (In my opinion, events should be immutable, since they represent a historical occurence.) Next SWT will have a peek in the event to see how to proceed.

SWT is full of weird bagbiters like this.

by smh at July 06, 2010 08:59 AM

June 29, 2010

Philip Herron

Compiling a Compiler – GCC

From all the work i have been doing on compilers recently i have started to realise a lot of people won’t know how to compile up GCC or even how that works. Since how are you meant to compile a compiler written in a language that itself implements. Well the technique is called bootstrapping. But this is something people try and think its more complicated that it usually is. To understand how it works we have to think how was GCC built; well its as simple as it NEED’s a C compiler :-) . But how did that first c-compiler get there in the first place, well it goes back years of people made the first c compilers in Assembler and then it bootstrapped up!

Within GCC when you start the build we bootstrap 3 times, which means we build it 3 times but why you ask? The generated code for the first compiler run, is by the host compile so the compiler itself cannot be trusted, then the 2nd is done with the newly built compiler and the 3rd for good measure to guarantee we’ve compiled with the new compiler and GCC itself should be running off its own code. Then you can look at something like the GHC the Glasgow Haskell compiler which is written in its own language, but the thing they don’t say is that it is written in a some-what simplified dialect of Haskell and bootstraps off a small amount of C code if you don’t already have a Haskell implementation already present. Which is similar to the bootstrapping languages of GCC which use C90 to maintain language portability.

Then you can look at something like what if someone writes a new operating system how do you port a compiler and libc over to the new system. Well this is done by a mixture of cross complication and complicated kernel work which can take quite some time to get going correctly.

But I digress as usual now onto a little tutorial how do we compile GCC well yes it uses the ./configure, make, make install build system. But it doesn’t quite work like this so we do it slightly different.

First to run experimental I prefer to use git:

# to get my gccpy work use this git repo it merges with gcc master at least weekly into master

$ git clone git://crules.org:gcc-dev.git

# or run the gcc git mirror:

$ git clone git://gcc.gnu.org/git/gcc.git

Now compiling time:

$ aptitude install libgmp3-dev libmpfr-dev

# GCC now requires libmpc which you may need to compile and install from:

# http://www.multiprecision.org/index.php?prog=mpc

$ cd gcc

$ mkdir build

$ cd build

Useful configure options

$ ../configure

–enable-gold | use the GOLD linker

–disable-bootstrap | useful for gcc developers not recommended for users or for your first build

–enable-languages=c,c++,python,gccgo …

….

–with-gmp-lib=/usr/local/lib

–with-mpfr-lib=/usr/local/include

-with-mpc/mpfr …. the same optiosn to point to different library locations.

Now to build:

$ make

$ make install

And you should be good to go. We have to do our build in a separate directory due to the size of GCC some components don’t like being built directly.

by redbrain at June 29, 2010 08:05 PM

Colin Turner

Email, should the "Old Ways" quietly die?

I was having an enjoyable early Summer BBQ chat with Mark Kerr and Jonathan (Noodles) McDowell a few weeks ago. We know each other from the days of Fidonet's greatest glory. Fidonet still exists, but back then the internet did not have a presence in normal people's lives, academics I worked with at Queen's only selectively had email access, and that through the dark arts of Kermit. Back then a few of us ran Bulletin Board Systems, over plain vanilla modems with all sorts of speeds, 1200 bps transfer rates were common.

The systems were held together as nodes in Fidonet, and the hundreds or thousands of users on each system could send a form of email to other users in the same system, or even users across the world. Every message was piggy backed on the daily or nightly phone calls from one system to a neighbouring system. Mark and I would call some odd systems, like that of Joaquim Homrighausen and Mats Wallin in Sweden, and we would happily carry any mail going for Sweden or coming back.

Everyone was sharing a bit of the cost. As such, it was considered the height of poor etiquette to reply to a message tens of lines long, quoting the whole message with a "me too" at the top or the bottom. You were expecting someone else to pay for transmitting the whole original message again, just for your extra words. You were expecting in echomail (the Fidonet equivalent of newsgroups, or mailing lists) that hundreds or thousands or tens of thousands of systems would store all that information on all those hard disks.

No, it was correct to trim a few salient lines from the original, and put your reply below it. That's enough for everyone to see what is going on. Every mail editor in existence showed the quoted text either with a ">" character to the left, or sometimes a "CT>" to indicate the initials of who wrote it.

These trimmed, quoted conversations allowed the full flow of the conversation to be followed by anyone without referring back to every word uttered by the original poster, and showed the coherence of the thread in a way that is hard to do in any other way. Google Wave is perhaps a modern attempt at the same idea.

But than people grew indifferent to bandwidth because there was so much, so they never bothered to trim their replies. You can expect in a modern mailing list to find each reply containing complete copies of all the previous correspondence to that point, which is already stored in the list, shown in a nice threaded view in your editor. Some new email programs (I'm looking at you, Outlook), made it almost impossible for people to do anything other than "top post", because they don't easily show quoted text.

And here I am, an old dinosaur who still tries to stick to the old ways, because I believe it's easier to read properly quoted replies... but increasingly, you can't have conversations with people with braindead mail software because they just can't do it. And they haven't even seen it before, they can't understand it. They complain when you don't top post your replies. Like the stereotypical cantankerous codger sitting in his porch watching the kids mess on his lawn I want to tell them that no, they are the ones doing it in the stupid new fangled way. We were here first. :-)

So maybe we should just give up... those few of us left, but then I was reminded (by Noodles) that now email is being shipped around mobile devices all the old arguments of bandwidth and storage are increasingly relevant again. So I ask the open question, is there any point in trying to stick to the "old ways"? Thoughts on a postcard please.

by nospam@example.com (Colin Turner) at June 29, 2010 12:57 PM

June 28, 2010

Philip Herron

Reference Counted Garbage Collector!

Garbage collection is a subject we all wish we knew more about, many software developers think they understand the concept fully and think building it should then be a trivial task. Building a ref-counted garbage collector, was much much more painful than i ever expected in crules. I am going to focus on how this work in an interpreted language and maybe a few months on how it will work in GccPy an Ahead of time implementation of Python on GCC.

So what is reference counting, take for instance the expression in a dynamic language:

x = 2 + 3 + 4 + 5;

So what happens in this expression in an interpreter? You can tell ‘x’ is a variable which will store the result of the expression ‘2 + 3 + 4 + 5′. Well to understand this simple example you first have to look at how this expression is evaluated, for instance these values ‘2,3….’ are still literals at this parse stage. What that means is they are numbers but dont paticularly have any meaning within the language yet, for instance python and crules need to ‘fold’ this literals into objects @see

`extern crl_symbol_obj * crl_rr_literal_fold( crl_symbol_obj * lit, crl_context_table * context )` in rr_bin_eval.c

In this case it looks at the literal object and then looks up for the apropriate object definition to create the Integer Object so the language knows how to do addition subtraction and some other member functions etc.

So ok lets look at this at a more semantic level what will happen is:

t1 = 2;
t2 = 3;
t3 = 4;
t4 = 5;

These address’s ‘t#’ are not actually accessible within the language its just a way of showing these are folded and we have addresses to them. Then we will have:

t5 = t1 + t2;
t6 = t5 + t3;
t7 = t6 + t4;

And now t7 should have the result of: 14 . And now finally:

x = t7;

So ok now you see how this is evaluated within at least a semantic context, what is ref counting?! So you can notice to get that simple result of 14 we had to create quite a few tmp objects as ‘t#’ But how does the runtime, tell which are temporary and which are still needed. Its as simple as adding in a ’signed long refcount’ to your Intermediate Representation.

In crules the notion of a context is the key to understanding how it all works so for each of these folded objects we create them with:

`Crl_Symbol_Init_Ctx( retval, context );` which is a pre-processor macro to initialize the crl_symbol_obj * retval, within this context. So what that is need for is when the garbage collector is invoked we need to be able to sweep over something to look for dead references in other words any objects with reference count ‘<= 0′ i say <= 0, and not simply zero because of how context poping and pushing can work and you can have a ref count of -2 in some cases but that’s besides the point.

So when this object is created within a context the garbage collection is able to sweep over a stack of context’s and look decide what needs deleted, so lets
look at the ref counting itself now.

Semantic | Refcount
——————-
t1       | 1
t2       | 1
t3       | 1
t4       | 1
t5       | 0
t6       | 0
t7       | 0

This shows the resulted ref counts after this is run:

t1 = 2;
t2 = 3;
t3 = 4;
t4 = 5;

Now lets look at what happens for:

t5 = t1 + t2

Semantic | Refcount
——————-
t1       | 2
t2       | 2
t3       | 1
t4       | 1
t5       | 1
t6       | 0
t7       | 0

So this is where it gets a little more tricky once that t5 has been evaluated t1 and t2 are de-referenced again.

Semantic | Refcount
——————-
t1       | 1
t2       | 1
t3       | 1
t4       | 1
t5       | 1
t6       | 0
t7       | 0

So the same idea happens for t6 and t7, and then we have the resultant table of:

Semantic | Refcount
——————-
t1       | 1
t2       | 1
t3       | 1
t4       | 1
t5       | 1
t6       | 1
t7       | 1

But now we know by common sense t1->t6 are all gabage its only t7 which is of any interest since this is what the variable ‘x’ now points to. But this is kind of down to how you implement it how you dec-rement those ref counts when i run in crules they are handled after each use.

Take a peek at rr_bin_eval.c and rr_math.c and rr_runtime.c in crl_rr_evaluate_expression( … )

So ok we should now have the table of:

Semantic | Refcount
——————-
t1       | 0
t2       | 0
t3       | 0
t4       | 0
t5       | 0
t6       | 0
t7       | 1

The key thing to remember is we dont have ref counts on the variable ‘x’ its what x points to! This is the whole key idea of how a dynamic type system works.

Now in crules the garbage collector is invoked when we have executed a full procedure, so in this case if i was to feed in directly this expression into the interpreter the garbage collector would be invoked if this was part of a function or procedure it would be executed once we hit the end of the block.

So now what comes in the idea of Mark-Sweep, this is probably what you understand of a mark sweep algorithm it sweeps over the stack and heap looking for dead refernces. So ok that makes sense but in the end its horrible vague and if you are to do that its an incredibly linear way of doing things. In essence crules has a mark sweep algorithm. But what really happens is i sweep and mark then free.

So to invoke the garbage collector in crules we call:

`extern void crl_garbage_invoke_sweep( crl_context_table * const );`

So what happens in gg_garbage.c, loops through each context in the context_table stack and looks through the symbol_stack and checks for objects of <= 0 ref count and marks them as garbage and sets the vector entry to NULL so it cant be collected again and result in a double free etc. Then once that is once it automaticaly invokes the garbage collector and runs over a vector of marked objects and free’s them one by one this could be speed up with pthreads but i havent got around to doing that.

This does not mean if your writing a builting object type or module as a dynamic lib .so, you have to invoke the garbage collection yourself you dont and if your writing crules code you dont have to do anything its all automatic except for the real intrinsic bits and pieces to the runtime within the interpreter.

Ok this is a good overview of ref counting but there is more lets take the example:

x = 2;
y = x;
z = y;

So as before we fold the literal ‘2′:

t1 = 2;
x  = t1;            t1 – ref count 1
y  = x = t1;        t1 – ref count 2
z  = y = t1;        t2 – ref count 3

Remember what we check is what the accessors point to, we never have a ref count on x or y or z its the value t1. So we have 3 objects simply pointing to the same object, We cannot free t1 at all! or we will surely break something! ;)

We can only safely delete this if each of these accessors went out of scope in the current context example if we stopped the session. we can decrement. But to understand what i mean more deeply we have to look at how functions and argument passing works and how the context stack works.

So i will finish this in a 2nd part tutorial soon :) in a review of how crules internals work. I hope some of you are still awake!

by redbrain at June 28, 2010 08:22 PM

June 15, 2010

Simon McCartney

The New Toolbox

In days gone by, any computer guy worth his salt had a collection of boot floppies, 5.25″ & 3.5″, containing a mix of MS-DOS, DR-DOS, Toms Root Boot & Norton tools. These days passed and the next set of essentials was boot cd-r, containing BartPE, RIPLinux, Knoppix etc. People quickly switched to carrying these tools USB sticks, smaller, easier to change, great when the dodgy PC you were trying to breathe life into supported USB booting.

I think there’s a better way, based on the last 3 days of hell spent setting up what should have been identical touchscreen machines (no cd, slow USB interfaces)

Your new toolkit is a cheap laptop, with a big hard disk, running the following:

  1. Your favourite Linux distro (I’ve used Ubuntu for this laptop)
  2. tftpd, dhcpd & dnsmasq setup for PXE booting other machines from this laptop (FOG uses dhcpd for all it’s automatic DHCP magic, use dnsmasq for simple local DNS, required for Unattended)
  3. FOG Cloning System
  4. Unattended Windows 2000/XP/2003 Network Install System
  5. CloneZilla PXE Image (for good measure)
  6. RIPLinux PXE Image

Why?  USB booting stills seems troublesome, installing Windows from flash seems very slow.  Nearly everything supports PXE these days, if it has a built in ethernet port, it’s pretty much guaranteed to support PXE booting.  There is nothing like the feeling of being able to image a machine into FOG over a 1Gb crossover cable in a matter of minutes.  Got everything working? image it and walk away, safe in the knowledge that if somebody comes along and breaks things, you can image it back in minutes, instead of having to do another clean install and build all your updates & software back on top.

There’s a little bit of plain in getting all of separate packages to run from the one /tftpboot/pxelinux.cfg/default, but it’s just a matter of careful copy & paste from the canned configs.

by simonm at June 15, 2010 03:05 PM

June 09, 2010

Simon McCartney

MySQL Replication slides from BarCamp Belfast 2010

just incase anybody was interested, the slides from my BarCamp Belfast talk are here:

by simonm at June 09, 2010 09:05 PM

June 04, 2010

Philip Herron

Onwards and Upwards

So its been quite some time since I’ve blogged and i will be meaning to write an update post every Sunday from now on maybe not this Sunday but hey we’ll see. For the next few months and the foreseeable future I’ll be talking a lot about GCC . So lets start from the beginning…

I am currently still a university student, I finished working at SAP in July 2009, so I took 3 Months and worked on Crules full-time for that time until I went back to university and I still worked at it full time since i was only having to do 3 Modules this year and even then i only had to do 2, since i messed up a few in 2nd year due to several personal reasons. I was taking a year to fix up my 2nd year so I could go back to final year and finish it! Although my old Job at SAP are pushing me to apply for a PhD with them, and i am not sure if i want to do that yet but we’ll see! Anyways i still worked at my language Crules since i had a lot of free time and the module material was not interesting to me what so ever!

Then I get this email “Hello From Google” and my god I wish I could put up what it read but i cant for some legal reason i think, and basically it all sounded as if they were offering my a job at Google in California I was so excited the best day of my life I can possibly remember, the amount of work i have done in my own time to learn compiler design and language design, Unix and system administration all on my own may have paid off! So yeah I go to interviews but they didn’t quite go so well, for you see they send you this email but really its asking you to apply for a job with them since they head hunt out people with passions and interests already relating to google in house technologies so you can bet they are going to be good employees. The interviews were tough but enjoyable I messed up some very basic questions and kick my self so hard now. But hey they didn’t go so well but they said they were keeping me on file for something more suitable mainly more programming related instead of the Google.com team. So I wasn’t complaining it was a good result for someone at the age of 21 without a degree with a language project and 1.5 years software developer and System-admin experience. Where things look up for me….

So then came around Oggcamp which is taking over the Mantle of Lug Radio Live, a UK conference on Linux Free Software and Free Thinking! It was a great weekend and i even joined in a gave a talk on my Programming Language the video apparently should be online eventually, but I’ll post up the slides here! I got on well and even got asked if i was interested in giving a talk at the new FlossUK Unix user group conference. Although i have lost the guys email I think he still has mine so if your reading this let me know! Here some photos of me looking freaked out

So yeah I gave a talk, i think it went well although i was annoyed that i could show off some more interesting features in the new release since it was was <sigsev> in some garbage collection bits and bobs. But i shown some more basic old features and I’ll endeavour to give a talk next year and show things off properly. But hey its my first proper talk on my language and no one left on me and i was voted into the 2nd talk room out of the 3 and none left on me! But yeah enough of boring things, most of all we drank ALOT of beer here is some of us with out drinking trousers on at @methoddan’s ratholeradio road-show gig:

It was really good to see some friends again like @Nybill, @Windigo, @yaMatt (Thanks for letting me stay with you mate!), @Dickturpin ( hows that £1 i lent you rofl! <in-joke> ) ,@bobobex (Thanks for pushing me to do my talk!), @corenominal ( Funniest dude ever! ) @Fabsh, @Methoddan, @crhisp (Great bloke to have a beer with!), @jontheniceguy

So since i came back from Oggcamp i was knackered i had already started the whole move in Crules to fully object orientated, with a really cool Builtin type C api which is really nice as well as some embedding features, with a fully automated Ref-Counted Garbage collector. Took a helluva’ lot of time to get going and implemented took 3 weeks planning and alot more time fixing and implementing! I just need some time now some time to fix regressions and write a lot of documentation.

So ok then i finished university for Summer fair enough but I needed a job besides my free lance bits and pieces since i hadn’t heard back from google. So i had already applied for Google Summer of code for 2 projects and god accepted into the one I wanted to do which so happens was one of my original projects i started quite a while back! An implementation of Python as a GCC Front-end I’ve taken a lot of Flak from the PyPy project in the beginner but this is something I want to blog about but I’ll leave that for another day I wanted to write something semi comprehensible for most people before i start talking about in-depth thing in the Crules API or the GCCPY Runtime Library or Parsing the Python Language etc. I hope this is semi coherent and updates you on why i’ve been quiet!

Made my @bobobex

Made my @bobobex

by redbrain at June 04, 2010 04:53 PM

June 01, 2010

Stuart Hacking

while true: Compile; Run; Debug

The more I go through this cycle the more it amazes me that this is the development paradigm that won out. That back in the golden era people sat down and decided that this was the model of the future.

For large applications it’s a major pain – much time spent compiling, starting up the program anew and returning it to the state you need in order to test your latest fix. Even for a fairly trivial change or a bit of experimentation, this is a huge timesink.

And yet there is an alternative approach – incremental compilation, à la Lisp. When the Lisp environment hits a bug it pauses. It shows you the location of the bug, it gives you a full stack trace at the time of breakage. You can inspect just about everything. Here’s the kicker: you can fix the code while the debugger is waiting. Then you can load that fixed code right back into the running program and continue on your merry way.

Let me repeat that last bit: You compile only the code that needed fixed and load it into the running program. The running program then continues using the new code. No stopping, compiling, running, getting back to where you were, debugging.

This is special. It’s not even that new. Lot’s of hip, young, dynamic languages are attempting to copy it. Let’s now, in 2010, make an attempt to catch up to the technology of 50 years ago. We owe the founding hackers that much, right?

by smh at June 01, 2010 09:30 PM

May 28, 2010

Stuart Hacking

Eclipse Development Lossitude

Here are two things about Eclipse which recently annoyed me. (I imagine it’s Eclipse’s fault, I guess It may be Java’s.)

1) When you reach an exceptional condition, the correct response in debug mode is to freeze the program and allow the developer a chance to inspect the current state. Stack, Heap, location, all that good stuff.

Throwing your arms in the air, screaming bloody murder and throwing away all the useful information when an error occurs is not useful. It turns debugging java into a game of “How close can you get to an error, without actually reaching the error.”

If you reach the error you lose the game, along with any useful data that might help you fix it.

2) You only seem to allow me to put breakpoints on lines on code. This implies that I already know where an error is. If I did, I’d probably fix it.

Why can’t you let me break on more useful things like when a particular variable has a particular value. This is similar to the previous point where I don’t want the program to drop everything and run away before I can look into it.

3) In 2010, the best way to debug a Java program is to pepper it with Print statements. This is sad.

by smh at May 28, 2010 01:44 PM

May 26, 2010

Jonathan McDowell

Linux on the mobile is the way forward

I decided last night to upgrade the firmware on my G1. I've been fairly happy with my lightly hacked Android 1.6 (basically the stock T-Mobile image rooted and with a couple of apps added) but I'm interested in whether Froyo will bring performance improvements and the office is now full of Desire users so I figured I'd install 2.1 to see if it was any good, and prepare for 2.2. I went for CyanogenMod as it seems to be fairly sane ROM put together by someone with some clue.

Of course I decided to ignore some of the instructions; particularly the bit about doing a factory reset first. Most of my data is easily backed up, either to Google or locally, but I wanted to keep my SMS+MMS history. There's nothing really that interesting there, and the SMS stuff is backed up automatically via SMS Backup, but still. It was a challenge. What I ended up finding was that if I didn't do the data deletion then Contacts wouldn't work, but I'd keep the SMS/MMS. And if I did the data deletion everything worked fine but I didn't have the SMS/MMS history.

I fired up adb to have a look around the filesystem, to see if there was something obvious. And there was! I found /data/data/com.android.providers.telephony/databases/mmssms.db, which is actually an SQLite database of received messages. So I booted up with the old data present, logged in, tarred up all of /data, copied it across to my desktop, reset the phone and deleted all data, waited for it to boot, extracted mmssms.db from the tarball and put it back on the phone. Result! My message threads reappeared. Turns out that wasn't enough for MMS, but that was solved by copying the contents of /data/data/com.android.providers.telephony/app_parts/ across as well.

Yes, I accept this is kludgey and most end users aren't going to do it, but a couple of points:

  • I'm flashing an unsupported ROM. I expect things to potentially break and not be able to complain to anyone about it. I'm very happy that it's an option, having had issues in the past where an operator wouldn't release an updated Nokia ROM for months after its release even when it fixed major issues.
  • This is something I wouldn't have been able to do under WinMo or Symbian. I've had a world of pain in the past moving between phones, even when using Nokia's PC Suite to try and copy stuff from the old one to the new one. Being able to get a full shell on the phone is hugely useful for dealing with this stuff when it goes wrong or you want to do something slightly different.
While the above is Android specific I'm fairly sure WebOS on the Pre or Maemo on the N900 would offer me the same level of power and control. I think I've just convinced myself that alternative smartphone OSes are no longer viable options.

by Jonathan McDowell at May 26, 2010 08:18 PM

Simon McCartney

May 25, 2010

Colin Turner

More to a book than its cover

Today I have found myself reading about three authors. These three men had various levels of fame and in each case, the interest today was more about them than it was about their work.

Samuel Clements aka Mark Twain, the great American writer was coming to my attention because his century long delay in publishing his memoirs is coming to an end. I must confess that I've never been the biggest fan of Twain's works, though many I have enjoyed. His life is very interesting however, filled as it was at times with great pathos and controversy as well as success. There are many theories as to why his memoirs have been so delayed, but one of the front runners is that some of his comments about (at least orthodox, in the broad sense) religion attracted attention. I'm sure it will be broader than that. Nevertheless, one of his quotes is already in the random section in my blog.

Also it has another name - The Word of God. For the Christian thinks every word of it was dictated by God. It is full of interest. It has noble poetry in it; and some clever fables; and some blood-drenched history; and some good morals; and a wealth of obscenity; and upwards of a thousand lies… But you notice that when the Lord God of Heaven and Earth, adored Father of Man, goes to war, there is no limit. He is totally without mercy - he, who is called the Fountain of Mercy. He slays, slays, slays! All the men, all the beasts, all the boys, all the babies; also all the women and all the girls, except those that have not been deflowered. He makes no distinction between innocent and guilty… What the insane Father required was blood and misery; he was indifferent as to who furnished it.
I have great sympathy for this quote, and it puzzles me when I meet people who cannot remotely consider the possibility that, even if there is a perfect God, perfect in His grace, that it might be the case that the humans who wrote the bible might not have listened so well. Because the only other possibility is that such acts are, in fact, OK to be committed by people when protected by divine wrath.

You may recognise this quote, it is possible that it is illegal to publish it in the Republic or Ireland which is another story altogether. Anyway, it will be interesting to see what else Mark Twain will offer the world in his memoirs.

Martin Gardner is my second author under discussion. I read of his death today, albeit at a ripe old age. His collection of mathematical puzzle books adorned my shelves (they currently languish in a box for now) for many years and with collections of his own puzzles and those of many others, they gave me insight into the nature of mathematics. I still use some of the puzzles I read about in my classes.

I was quite surprised to read that he had written extensively about Lewis Carroll and his work, although as a mathematician I was long aware of the mathematical implications of Carroll's works. So I'll perhaps have to acquire that book for summer reading. However I have long suspected that the more controversial aspects of Carroll have prevented him being enthusiastically claimed by mathematics in the public imagination.

Gardner's book introduced me the Fibonacci Sequence, and so it is fitting that I saw this the day before. I think he would have loved it.

Nature by Numbers from Cristóbal Vila on Vimeo.



Douglas Adams was the third author. I couldn't write about authors on Towel Day and not mention him. I have been marking much of the day, but when I've been out and about running a few errands, I have always known where my towel was. I reflected how Douglas would have marvelled at the fact that already, many of us already have the closest thing to Hitch Hiker's Guide in our back pocket, a smart phone connected to Wikipedia, and the rest of the total of human knowledge on the Internet (and the sum total of gibberish too).

Hmm. And having just added more to that pile with more rambling even than usual, I'll say so long and thanks for all the fish.

by nospam@example.com (Colin Turner) at May 25, 2010 08:08 PM

May 14, 2010

Stuart Hacking

WordPress Lossage

The latest update seems to have screwed up some plug-ins. Most notably the collapsible archives and source code highlighting.

Hopefully this is only temporary.

by smh at May 14, 2010 03:43 PM

May 13, 2010

Jonathan McDowell

Random election related numbers

We appear to have a government again, which is always helpful. Let's see how they do. While all the deliberation was going on Dad and I had a ponder about exactly what your chances of voting for a winner were. The Guardian helpfully have the results dataset available, so I nabbed that. They may have updated it since I did; it certainly seemed to be a bit off compared with the BBC. Anyway.

29,577,337 - total votes cast.
13,982,219 - total votes cast for winning MPs.
7,279,220 - total votes cast for winning MPs in the new government (ie Conservative or LibDem).

So there was a 47.27% chance of a vote being for a winning MP, but only 24.61% chance that a vote was not only for a winning MP but also one that ended up being part of the coalition.

Another interesting number; 220 seats were won with 50% or more of the vote, 540 with more than 40%. That's higher than I expected.

by Jonathan McDowell at May 13, 2010 01:05 PM

May 11, 2010

Jonathan McDowell

Going to DebConf10


im_going_to_debconf10.pngNot that I ever thought I wasn't going, but due to some uncertainty about where I needed flights from I've only got round to booking things today - wish I'd gone ahead and done it last week!

Outbound:

2010-07-31 10:55 BHD -> 12:15 LHR BD85
2010-07-31 16:20 LHR -> 19:00 EWR VS001

Inbound:

2010-08-08 18:15 JFK -> 06:35 LHR VS004
2010-08-09 10:55 LHR -> 12:20 BHD BD84

See you all there!

by Jonathan McDowell at May 11, 2010 08:25 PM

Marty Pauley

Haskell sometime soon

Way back in October last year (but only 2 entries ago) I posted some Perl code and wrote that I’d post the Haskell sometime soon. Well, that is now; the code is below. I intend to rewrite it to use Parsec at some point, but I haven’t tried that yet since this little hacky script works well enough; and look how long it has taken me to blog it!

module Main where

import Text.XML.HaXml.SAX

data ParserState = FindEntry | FindKeb | FindText

scan :: ParserState -> [SaxElement] -> [String]
scan _ [] = []
scan FindEntry ( (SaxElementOpen "entry" _) : es ) =
    scan FindKeb es
scan FindKeb   ( (SaxElementClose "entry") : es ) =
    "(none)" : (scan FindEntry es)
scan FindKeb   ( (SaxElementOpen "keb" _) : es ) =
    scan FindText es
scan FindText  ( (SaxCharData "\n") : es ) =
    scan FindText es
scan FindText  ( (SaxCharData txt) : es ) =
    txt : (scan FindEntry es)
scan st ( _ : es ) = scan st es

findKebs :: String -> [String]
findKebs i =
    let (es, erc) = saxParse "" i in
    scan FindEntry es

To understand how it works the most important line is the type declaration “scan :: ParserState -> [SaxElement] -> [String]“, which is not actually required by Haskell. From that line we know that “scan” is a function that expects a ParserState as its first parameter and a list of SaxElements as its second parameter, and will then return a list of Strings. Everything else is a simple matter of recursion and pattern matching :-)

by Marty at May 11, 2010 03:34 PM

May 06, 2010

Stuart Hacking

Fibonacci Optimisation

Just some stuff I thought about today. Here’s a fibonacci function expressed in Lisp:

  1. (defun fibonacci (n)
  2.   (if (<= n 1)
  3.        n
  4.        (+ (fibonacci (- n 1)) (fibonacci (- n 2)))))

It can be used to compute the fibonacci sequence:

  1. => (mapcar #’fibonacci ‘(1 2 3 4 5 6 7 8 9 10))
  2. (1 1 2 3 5 8 13 21 34 55)

It’s simplicity is elegant, but, frightfully inefficient. In fact, the recursive definition of fibonacci is often used as an example of an inefficient method. Let’s look at why it’s poor. When fibonacci is called for a value of n there are two possible paths the program can take:

  1. If n <= 1 give back the value of n
  2. otherwise return the sum of the previous two numbers in the sequence

So, if n is 0 or 1 then the value is simply 0 or 1 respectively. This is the base case of the function. In other words, from this piece of concrete knowledge, we can derive the remaining values. If n is any value higher than 1, then we need to actually compute what it is. Notice that this case requires fibonacci to be called another two times.

This imposes significant overhead on the machine. In addition to this, the results of these two function calls must be added together. That means we need to hold onto some space in memory to store the results. Simplistically, we refer to the number of significant function calls as the time complexity of the program, and the amount of memory required as the space complexity. Fibonacci sure is expensive.

Anyway, this got me to thinking. What is the main problem with fibonacci? It’s the fact that it must repeat a lot of its calculations. If we want to find the value of Fib(5), we must call Fib(4) and Fib(3). But wait: To find the value of Fib(4) we must call Fib(3). Hence, we do the same operation twice. What if we could tell the program to remember a value once it had been found? Wouldn’t this speed things up? Can this be done without sacrificing the simplicity of a recursive method?

Here’s a modified, partial fibonacci function:

  1. (defun hashed-fibonacci (n)
  2.   (defvar fib-lookup (make-hash-table))
  3.   (let ((val (gethash n fib-lookup)))
  4.     (cond ((not (equal val nil)) val)
  5.           ((<= n 1) n)
  6.           (t (let ((new-val (+ (hashed-fibonacci (- n 1)) (hashed-fibonacci (- n 2)))))
  7.              (progn (puthash n fib-lookup nil new-val)
  8.                                 new-val))))))

This one is a little more involved, but don’t panic: It still does the same thing, in much the same way. It has an extra trick though: Before it attempts to compute the value of n, it check to see if it already has a value. It looks in a structure called a hash table (any type of lookup table should do). Think of this like a telephone directory. If you know someone’s name, you can look it up in a phone directory and it will tell you their number. In our hash table, if you know a value of n, you can look it up and find its fibonacci value. Of course, some fibonacci values won’t be listed just yet. If there is no value in the table, we continue with our normal process: If n <= 2 then return 1. If n is greater than 2 then we find it’s value by adding the previous 2 fibonacci numbers. Now we have one more change to make: Having just found this new value of Fib(n) we store it in the hashtable. This means we won’t have to do the hard work of finding it again later – It’s already there!

Now, this act of remembering our previous work means that we must use a bit more memory, but the gain is a remarkable improvement in speed. Today, memory is pretty cheap, so this is not a bad thing. Look at the method we used. We start with a function that must call itself with a smaller value in order to discover a new value. When we discover a new value, we store it in a table so that we can quickly find it later.

This could most likely be generalised for any function that follows this pattern. There’s another blog post for when I get time to look into that aspect of it. If this post was about the optimisation, the next will be about abstracting that into a common pattern.

I hope this was of some interest. It was just a little thing I thought about this afternoon then decided to try it out. After I tried it I thought it might make a quick, informal blog entry.

Update: It seems that I have inadvertently stumbled across the definition of memoization which was conceived in 1968! It’s fun to try something out and then learn about a formal definition of the same principle. The act of developing an example gives it more meaning. (Further reading: http://en.wikipedia.org/wiki/Memoization).

by smh at May 06, 2010 12:01 AM

April 23, 2010

Jonathan McDowell

Out, damn'd PGP v3

Nearly a year ago people starting worrying about the complexity of SHA-1 being reduced and the potential availability of viable attacks against things such as PGP keys that used SHA-1. Many people (myself included) generated a new key, or updated preferences on keys that were otherwise strong enough. There were worries about what this might mean for Debian. We were getting ahead of ourselves a bit though. Firstly there haven't been any public viable attacks that I'm aware of (though of course this doesn't mean we shouldn't continue to migrate away), but secondly there's a much easier method of attack. PGP v3 keys. To quote RFC4880:

V3 keys are deprecated. They contain three weaknesses. First, it is relatively easy to construct a V3 key that has the same Key ID as any other key because the Key ID is simply the low 64 bits of the public modulus. Secondly, because the fingerprint of a V3 key hashes the key material, but not its length, there is an increased opportunity for fingerprint collisions. Third, there are weaknesses in the MD5 hash algorithm that make developers prefer other algorithms. See below for a fuller discussion of Key IDs and fingerprints.
At the time of writing Debian has 21 remaining v3 keys. This is a significant improvement over a year ago, when we had 200, but it's still 21 more than I'd like. I've been chasing people since last May (starting with those who had v3 + v4 keys, all of whom now only have a v4 key) and we're down to the stragglers. So it's time to name and shame, in the hope of kicking them into action. The following keys are what's left (doesn't match the currently active keyring because we've had a few replacements since the last promote):

0x0D2156BD3D97C149 Michael Stone <mstone>
0x225FD911CD269B31 Carlos Barros <cbf>
0x31E73F14E298966D James R. Van Zandt <jrv>
0x366CD3FEEBC11B01 Chris Waters <xtifr>
0x37A73FE355E8BC4D Frederic Lepied <lepied>
0x3E973117DCC528E9 Ardo van Rangelrooij <ardo>
0x5C7A46637953F711 Rich Sahlender <rsahlen>
0x5D6560F85F30F005 Craig Brozefsky <craig>
0x6B0E322836129171 Jim Westveer <jwest>
0x723724B4A5B6DD31 Christian Meder <meder>
0x7629B22ED71DAABD Adrian Bridgett <bridgett>
0x8FFC405EFD5A67CD Adam Di Carlo <aph>
0xB0D269DE17F3D4D1 Matthew Vernon <matthew>
0xBC151FC8D2A913A1 Peter S Galbraith <psg>
0xC1A0A171C2DCD3B1 Jim Mintha <jmintha>
0xC3168EBA23F5ADDB Ian Jackson <iwj>
0xCE951B1160D74C7D Patrick Cole <ltd>
0xE82A8B0D57137FE5 Paul Seelig <pseelig>
0xF20E242CE77AC835 Brian White <bcwhite>
0xFBAA570C3087194D Alan Bain <afrb2>
0xFFD1B4AC7C19FD19 David Engel <david>

Of these keys only 2 voted in the recent DPL election. 8 have failed to make any response to my mails (3 since last August). Only 9 have uploaded a package since August 2008. And 10 were already known to the MIA database. Some of them have stated they'll sort out a new key, but not yet done so.

If you are one of these people, please either get a new key sorted and signed and reply to the mails I've sent you, or reply and say you no longer wish to be involved in Debian. And if you know any of these people, encourage them to get a new key sorted and offer to sign it for them.

by Jonathan McDowell at April 23, 2010 08:41 PM

April 18, 2010

Paul Gregg

The O2 Joggler - A first hack.

devicev2.JPG
If you were not aware - O2 last week reduced the price of the O2 Joggler from £149.99 to £99.99 to £49.99.  Nothing remarkable in price reductions, however what is remarkable is what you actually get for your money.

The O2 Joggler is a silent 7" touchscreen device with Intel Atom Z520 running at 1.3Ghz, 512Mb ram, 1GB internal flash storage with additional storage available via an external USB port. What makes the device really exciting is that it also has a 1GB ethernet (Realtec 8168) and Wifi.

Looking at that - I know you're all thinking "linux box" - but conveniently, the default operating system on it is based on Ubuntu 8.04 and busybox, The frontend is a custom flash driven UI developed by OpenPeak (makers of the Jogger which is rebadged by O2).

There are plenty of clever individuals over at http://hackthejoggler.freeforums.org/and in the #mer channel on freenode who are working to allow the Joggler to run other Operating Systems such as Android, Ubuntu Netbook Edition, MID, even Windows and OSX.

However, the standard OS supplied is also pretty powerful and allows significant customisation.  You can enable telnet just by turning it on with a custom USB stick plugged in. To do some of the things I'll be describing here you will need to have started with that.

Once you can telnet in, the world opens up and you can do lots of things that you would expect* to be able to do in a linux system. (* except run a web browser.... at this time - we don't have web access with the stock OS due to the custom flash GUI interface.)

Lets install some useful utilities, how about perl, terminfo, irc clients, bit torrent, rsync, ssh/scp ?   Yes, I know what you're thinking - overnight silent downloads - no need to leave PC on... nice...

I've built several of these utilities with installation instructions and uploaded them over here: 
  http://ubu05.pgregg.com/joggler/

Feel free to download, examine, install etc.  Read the README on the download page - it explains how to do it. Most of the packs include an install.sh script that will provide an installation safety net - it won't overwrite existing files or libraries.

Usual disclaimers apply - you try these applications at your own risk. I accept no responsibility if you manage to brick, fry or otherwise trash your joggler.

Comments, suggestions for other applications are always welcome.

Update: Thanks to NP - seems I was a little too brutal with the library stripping to keep the download sizes small and I missed some required libraries (that I mistakenly thought were in the standard Joggler distro).   I have rebuilt the following packages as they were missing some libs: rtorrent, rsync, sudo,ssh
The screen package has been rebuilt too to add one final tweak (to the installer script) so it can be used by non-root users - the only difference you need to do is run the command: chmod 666 /dev/ptmp /dev/tty

by Paul Gregg at April 18, 2010 09:04 PM

April 04, 2010

Stuart Hacking

Games: Math vs. Story

It’s not a great title but none of the other drafts I came up with were any better…

I’ve been thinking recently (and informally) about a schism in game design that seems to be developing. I think in part it’s due to the seeming rise in popularity of Role Playing elements within games. When I say Role Playing elements I’m talking specifically about the idea of the player assuming the role of a protagonist from an early stage and gradually building that character; resulting in, for example, more powerful options during play, unlocked equipment, more locations or simply to make the character look better. This typically happens when a player has accumulated enough experience points to ascend to a new level of play. Experience points are typically accumulated by applying the skills previously unlocked. This idea has started to become more pervasive even in games not commonly associated with character building. Examples include puzzle games (Puzzle Quest, Puzzle Pirates), First Person Shooters (Borderlands, Call of Duty), Racing Games (Forza, Need for Speed) and of course those games which are naturally Role Playing Games (Dragon Age, Mass Effect, Oblivion, Fallout 3, Pokémon, …and many more). (Note: Shameless list of some of my favourite games.) For me, this additional mechanic adds a new dimension to the game: Narrative. I like stories and I like characters.

The observation I wish to describe is the contrast between two different ways of presenting this narrative information to the player. I don’t wish to claim that one method is more correct than the other. Although I think that there are merits and danger for each that should be considered. It is these points I wish to briefly outline. Also: I’m not an expert in this area but I do enjoy games.

Introduction to RPG mechanics

Originally, I included this section in the description for Case 1. As it grew, I decided it merited it’s own section. Note: Some games will use different ideas; this is only intended as an example. I’ll describe a simplified Dungeons and Dragons style method.

In traditional tabletop games (using pen & paper, or boards) mathematical functions were devised as a way to roughly model expected outcomes of conflict/encounter. The idea was to avoid leaving everything to pure chance (dice rolls), but instead to modify the outcome of a dice roll based on the characters abilities. for example, A strong character will deal more damage, however, the range of damage is still affected by stamina and the type of armour the opponent is wearing. The dice roll itself merely introduces the idea of something going wrong, e.g. “Your character slips when swinging his weapon and only manages to graze your opponents forearm.”

It is not limited to performing moves in battle. Some characters in the game will have the ability to lie or persuade to gather information. These outcomes will also be based on the characters skill. Modified by the second person’s skills at detecting lies or flattery, and a chance dice roll. For example, “You attempt to impersonate a foreign diplomat to gain information…” “…however, the guard is not fooled by your accent.”

As your character gains experience, your chances of successfully exploiting a skill increase. On the tabletop, there was no computer to perform these calculations for you, so all of the functions where exposed to the players.

Case 1: “The D&D Method”

Yes: I’m bad at naming but it fits with the introductory example. In this case the player is given the raw numbers: “You will do 5 points of damage per hit. Your foe has 8 points remaining.” This is demonstrated in the Pokémon series, Neverwinter Nights and Eve Online for example. This hails back to the tabletop method.

The benefits of having all the raw information are arguably that you can make strategic decisions by testing the mathematics in advance and your plans can be optimised by carefully adjusting the variables. The drawbacks, perhaps, are that the intended purpose of the functions – to provide a model for realism – are not achieved. i.e. The game is reduced to nothing more than balancing equations.

Case 2: “The Once-upon-a-time Method”

The titles get worse, but what I’m getting at here is that in this case, a lot of the raw information is hidden behind a façade which is more abstract or opaque. This tends to present in games which are more about advancing a plot than performing the precise strategic operations. Abstraction may ranges from cosmetic change (Displaying bars and graphics in place of numbers on screen) to making the game logic fuzzy (“Character is big and strong”, instead of “Character has weight 55 and strength of 60″). City of Heroes by default will show simplified hints about the underlying attributes while Mass Effect 2 gives the impression that knowing the exact power of every attack is not significant for the player.

The benefits here are that you can find ways to hide the games computations from the player and present them with only the experience of the characters and story progression. The player has enough information to decide how the character will develop and move from event to event but without micro-managing individual attributes. The drawback is in giving less control to the player.

Thoughts/Conclusions

Already? Well, this wasn’t intended to be a thoroughly detailed examination or case study. It was just putting down some thoughts into a post. At least my host will know I’m still alive.

If I have one concrete opinion, it’s that a computer game has the wonderful advantage of having a calculator sitting underneath it. To this end, the mathematics of the games progression shouldn’t come at the expense of immersion into the game’s world. Of course, in some games, the math is central to the objective and shouldn’t be compromised. However, for any functionality that can be delegated to the computer, the designer should attempt to make the presentation as natural for the player as possible.

The key challenge is finding the right balance between giving the player absolute control of the numbers and presenting the player with an abstraction of the information that is compelling as a story.

by smh at April 04, 2010 11:49 PM

March 31, 2010

Paul Gregg

Is BT still collecting usage data?

After the recent scandal over BT using Phorm (see here and here) is it still possible that BT is still covertly collecting data profiling its user's internet usage?

I have, as part of my home BT Total Broadband package, a HUAWEI Mobile Connect 3G Modem.  This is a USB dongle that provides internet service.   I rarely use it, but because of the storms last night my internet connection has been very unstable, therefore I plugged it in today.

When I started the "BT Connection Manager" software, it informed me that there was an update to the service and would I like to download it? Yes, ok, and a couple of minutes later it began to install itself.  Then popped up the obligatory EULA which contained the paragraphs:

"Installation of this Software will automatically apply a unique identifier to the Software, this identifying feature will only be used in accordance with the BT privacy policy which can be found at www.bt.com.

This software automatically collects session and client parameter Information for all connections made via this Software. This information is automatically transmitted to BT at the start of each session where Internet access is available. This session information will only be used in accordance with the BT privacy policy which can be found at www.bt.com."

BTConnectionManagerEULA.txt
I also note that the software package uses the Open Source packages libCurl, openssl and sqlite.  Combined they enable the package to record "session and client parameter Information for all connections" in the database (sqlite) and to encrypt (openssl) and transmit the data via a web request (libcurl) back to BT.

At this point I am unable to confirm if such a transmission is taking place as I declined the EULA, but would welcome feedback or comments from others that are able to investigate this more fully.

Update: Even though I clicked "Cancel" to reject the EULA - it did update the application and actually started it up before I exited the installer.  Guess I have this privacy invading feature now.




by Paul Gregg at March 31, 2010 01:28 PM

March 22, 2010

Jonathan McDowell

Neat find of the day: inputlirc

I've recently been fixing up my VDR setup to work with FreeSat and make it brother/parent friendly. I've applied the EPG patches to get the 7 day guide, setup an autologging in user under gdm with vdr-sxfe running and that left getting the remote working. For some reason my old serial dongle wasn't happy with lirc - it got detected ok, and would show some signal when buttons were pressed but didn't work with the old config. The entire hardware of the box has changed, so it seems likely something isn't quite right (in particular the lirc drivers spew out warnings about SMP bits so I should probably try the dongle under a single core setup to rule that out, but there's also a move to 64 bit involved).

The easy solution to have something sorted for Christmas was to pickup a cheap remote from eBay. This ended up being a Cyberlink remote + USB dongle combo. Worked just fine when plugged in, turning up as a normal input device and the obvious keys doing the obvious things. I wanted all the keys to work though, as I'd got used to having a lot of the VDR functions instantly accessible rather than having to work my way through the menus. Various searches suggested I'd need to use LIRC to access the odder keys. That seemed a lot of hassle for something that was doing the decoding itself. Some playing with xev turned up keycodes for a number of the keys, but there were still a few missing (and important ones at that, such as Red/Green/Yellow/Blue). Further digging found me a suggestion of an Xorg keyboard map that would map the KEY_RED etc from the evdev device into something workable under X. And then I found inputlirc via the Debian package. This is really bloody neat - point it at an evdev device and it will present all of the KEY_* codes out as lirc keys. If you pass the -g parameter it makes sure the key presses only go to lirc as well. Exactly what I want and a doddle to setup - no messing with a big configuration file, just edit /etc/defaults/inputlirc to point to the correct /dev/input/by-id/ file, add the -g to the options in that file and restart.

Now the main remaining task is to get it working with BBC/ITV HD.

by Jonathan McDowell at March 22, 2010 10:47 PM

Prettifying Debian boot output

Being a bit of a freak I actually tend to read my boot output. Well, when I'm not using that time to go grab a cup of coffee first thing on a Monday morning. However I don't always find Debian's default output as clear as I'd like (especially when I haven't had that coffee yet, or when I'm half watching a remote machine boot over its serial console). ISTR that RedHat had much nicer boot output (I'm talking about text based here, not the fancy Plymouth stuff) with a row of OK/FAILED etc down the right hand side that made it nice and obvious what was happening. Of course we can do that with Debian, at least for packages that use the lsb-base logging functions. Drop the following into /etc/lsb-base-logging.sh and enjoy a slightly prettier boot. I'm slowly filing wishlist bugs with patches for those bits and pieces I use that don't use lsb-base for their init script logging.

# Colour our init scripts output

# int log_end_message (int exitstatus)
log_end_msg () {
    # If no arguments were passed, return
    if [ -z "${1:-}" ]; then
        return 1
    fi

    retval=$1

    log_end_msg_pre "$@"

    # Only do the fancy stuff if we have an appropriate terminal
    # and if /usr is already mounted
    if log_use_fancy_output; then
        RED=`$TPUT setaf 1`
        GREEN=`$TPUT setaf 2`
        YELLOW=`$TPUT setaf 3`
        NORMAL=`$TPUT sgr0`
        $TPUT hpa $((`$TPUT cols` - 12))
    else
        RED=''
        GREEN=''
        YELLOW=''
        NORMAL=''
    fi

    if [ $1 -eq 0 ]; then
        /bin/echo -e " [   ${GREEN}OK${NORMAL}   ]"
    elif [ $1 -eq 255 ]; then
        /bin/echo -e " [${YELLOW}WARNING!${NORMAL}]"
    else
        /bin/echo -e " [ ${RED}FAILED${NORMAL} ]"
    fi
    log_end_msg_post "$@"
    return $retval
}

log_action_end_msg () {
    log_action_end_msg_pre "$@"
    if [ -z "${2:-}" ]; then
        end=""
    else
        end=" ($2)"
    fi

    /bin/echo -n "${end}"

    # Only do the fancy stuff if we have an appropriate terminal
    # and if /usr is already mounted
    if log_use_fancy_output; then
        RED=`$TPUT setaf 1`
        BLUE=`$TPUT setaf 4`
        NORMAL=`$TPUT sgr0`
        $TPUT hpa $((`$TPUT cols` - 12))
    else
        RED=''
        BLUE=''
        NORMAL=''
    fi


    if [ $1 -eq 0 ]; then
        /bin/echo -e " [  ${BLUE}DONE${NORMAL}  ]"
    else
        /bin/echo -e " [ ${RED}FAILED${NORMAL} ]"
    fi
    log_action_end_msg_post "$@"
}


(This is mostly for my own future reference, because I keep trying to search for details on it and not finding exactly what I want. I forget where I even found the basis for this, though there are lots of similar snippets out there. I've not tried it with a concurrency based boot so it may well look horrible under that.)

by Jonathan McDowell at March 22, 2010 10:32 PM

Fizz buzz

Inspired by a conversation about interview coding tasks from a list I'm on, I present the following - I considered it too long to email there. It took me longer than I expected to write; my x86 assembly is quite rusty. I'm not claiming it's pretty, but it fits in a single sector and most of the overhead is actually ELF structures.

; nasm -f elf fizzbuzz.asm
; ld -melf_i386 -s -o fizzbuzz fizzbuzz.o
; ./fizzbuzz

section .data

fizz	db	" fizz"
fizzlen	equ	$ - fizz
buzz	db	" buzz"
buzzlen	equ	$ - buzz
num	db	"   "
numend	equ	$ - 1
numlen	equ	$ - num
nl	db	0xa
nllen	equ	$ - nl

curnum	db 1

section .text

	global _start

_start:
	mov ax, [curnum]
	call printnum

	mov ax, [curnum]
	mov cx, 3
	xor dx, dx
	div cx
	cmp dx, 0
	jnz notfizz

	mov edx, fizzlen
	mov ecx, fizz
	call printstr

notfizz:
	mov ax, [curnum]
	mov cx, 5
	xor dx, dx
	div cx
	cmp dx, 0
	jnz notbuzz

	mov edx, buzzlen
	mov ecx, buzz
	call printstr

notbuzz:
	mov edx, nllen
	mov ecx, nl
	call printstr

	inc BYTE [curnum]
	cmp BYTE [curnum], 100
	jle _start

	xor ebx, ebx
	mov eax, 1
	int 0x80

printnum:
	mov edi, numend
	mov cx, 10
p1:
	xor edx, edx
	div cx
	add dx, '0'
	mov [edi], dl
	dec edi
	cmp ax, 0
	jne p1

	mov ecx, num
	mov edx, numlen
printstr:
	mov ebx, 1
	mov eax, 4
	int 0x80
	ret

by Jonathan McDowell at March 22, 2010 10:31 PM

March 15, 2010

Philip Herron

Warhammer Models

Well this is a secret passion of mine, years ago i used to be really into Warhammer specifically 40k, where i played Space Marines o’ the cliche; and i loved the game! Though mainly i just loved the models, no one can deny that the Games Workshop models look awesome! For me the fluff, the story and fan fiction around Warhammer is really cool, so the books are always great Sci-Fi reads, although some can be poorly structured  but they all have something you might love! Look out for authors such as Dan Abnet and i think under rated Graham Mc Neill.

I think i read somewhere Games Workshop they have the reputation of doing the best models in the world. Though when you buy these models for those that don’t know they are not assembled nor are they painted. So its the hobby of building your army unique and paint them unique so NO army will look the same which is really nice.

But i am pretty lame at art ( I <3 Compilers so what do you expect ;) ), but i want to share some of the models i am proud of here, so i took some photos and i hope you think they are cool :) . I have many more i still need to paint it takes quite a bit of time and really the only way i can make these models look ok painted is by taking my time! Its really helped me a lot recently, if you read my micro-blog i do a helluva lot of work at crules at the moment and really i need something to take my mind of compilers for a few hours so i can sleep, if i don’t i have trouble sleeping since my mind is racing about work and ways to do things too much. But painting for a few hours really helps. I used to watch TV but TV sucks a lot at the moment so this rocks :) .

by redbrain at March 15, 2010 12:49 AM

March 03, 2010

Jonathan McDowell

Meta: Rant about rants about PGP keysigning problems

(This has ended up longer than I intended, largely because I felt I should then get into why. I'm aware I haven't got into all the nuances, so I hope readers familiar with the area will appreciate this is the compact version.)

Thorsten had a rant last week about PGP keysigning problems. He apologises for his tone, but that's not the issue I take with his rant.

It starts "Keysigning is useless". And yet his complaints seem to be:

  • Dealing with the private half of your GPG key securely involves some faff (in this case booting with a live CD and having to set things up ready to keysign).
  • He doesn't get on with caff.
  • People reject email from machines with invalid HELOs and perform other anti spam measures on ISP access ranges (I'm not clear if it's just greylisting or outright rejects as that's not made clear).
  • PGP/MIME is a protocol violation (yes, but it's much better than inline OpenPGP. Unless you have to deal with RT, which mangles it. *sigh*)
None of these seem to actually be about keysigning being useless. The process of doing it, maybe, though he misses the main valid rant about this I'd have, which is that most mass keysignings don't actually allow you to accurately verify the identity of other participants unless you already know them reasonably well. (The LCA2010 keysigning and DebConf5 in Helsinki spring to mind as 2 good examples of bad keysignings I've attended, but speaking to others suggests it's far from an isolated thing.)

Torsten does say that he'll continue to do keysigning on a per-person basis, so it doesn't sound like he's completely given up. I'm posting this largely so other Debian related people don't get the idea that it's not important to think about keysigning.

Why should we care?

Firstly, let's clarify what I mean when I sign someone else's key. If I sign your key then I think that I believe you hold the private part of a key that has your name and an email address I believe I can use to contact you on it. It means I have seen government issued ID that matches that name. It also means that I have interacted with you (and watched others interact with you) under that persona. In short I am happy that the key is a reasonable digital representation of your identity - something signed by it either comes from you or has involved the key being compromised or you coerced  into using it against your will.

Why is this useful?

It gets useful thanks to the web of trust; ie the idea that there are a bunch of people I trust partially to sign other keys, and if enough of them have signed a key then I can have a reasonable expectation that the key belongs to the person I want to talk to. Which means I might be prepared to send private data to them. Or Debian might be prepared to accept an upload from them. Which, when you're dealing with a community that spans the planet and where most of the contributors haven't met each other, is pretty freakin' useful - I, as part of Debian's keyring team, don't need to personally be able to identify every Debian developer. All I need to do is be able to trust other DDs to be able to do so. (Though maybe I'm missing out on something here - perhaps Debian should be paying for Gunnar and me to travel the world verifying fingerprints. \o/)

(I still do mass keysignings btw. I'm picky about which keys I actually sign - this is in no way intended as a slight against those I don't, but a mass keysigning at least lets me know that the people involved are happy to exchange fingerprints. Though, FWIW, I normally have ID on me and frequently have fingerprint slips, so if you know me and want me to sign your key/want to sign mine then by all means ask me when you see me!)

by Jonathan McDowell at March 03, 2010 10:15 PM

February 25, 2010

Paul Gregg

Valentine's CISS

Printers. Love them or hate them, you still have to feed them Ink (or Toner) cartridges.  
These are expensive little beasts to keep running - it has been commented that printer ink is expensive, and to give to an idea just how expensive it is:
  • Printer Ink is 7 times more expensive than Dom Perignon.
  • Printer Ink is more expensive than the most expensive perfumes.
  • Printer Ink is more expensive than human blood.
Or if you want to see the scale, here is an often posted image (attribution unknown):  Update, found the original source at Gizmodo from Nov 2006.
compare.jpg

Like many people I had found the relative comfort of 3rd-party or remanufactured Ink cartriges which brink the cost per cart down from around £3 (instead of £9) for my particular model.

However, as I was installing the last of my replacement carts, before having to order more, imagine my horror when the magenta cart simply failed to work.   Nothing - printer refused to accept it, thankfully my old cart had a dribble of ink left and was able to convince the printer to keep going while I got my order in for more.

Next step, the online store where I order my carts, SVP, typed in my printer model in the search box as they recommend and the first hit wasn't my usual multipack of 3rd party R265 carts - no, it was a CISS (Continuous Ink Supply System).   Interesting.

Here is the page: http://svp.co.uk/product/ciss_for_epson_r265_r360_rx560_printers_mte058

Intrigued, I read the install manual they have on the page and thought it looked easy enough to try. And so I bought one - couldn't hurt - it cost the same as a complete set of carts and would last 10 times longer on the first fill.

The device arrived a few days later, I sat on it a few days more, then got stuck in.  I took some photos of the completed install and I have to say I am very impressed with it.

IMG_7042_500w.jpgIMG_7046_500w.jpg
I originally had the Inkwells on top of the printer, but I found it was putting out way too much ink - blobs of the stuff - and I figured gravity was playing a part.  Placing it down beside the printer saw the ink flow backwards, so I taped a few empty DVD cases together to get the right approximate height beside the printer and placed it there.

Ink_Well_500w.jpgI have printed the equivalent of 20 full A4 colour pages at photo quality - quality is excellent and although the computer thinks the carts are now half full (or half empty), the evidence above shows just how much money I am going to save even in the short term.

ink_levels.jpgIf you are feeling the cost of Ink is too high (who doesn't?) and if you can find a well reviewed CISS system for your printer, I would encourage you to give it a go.


by Paul Gregg at February 25, 2010 12:28 PM

February 22, 2010

Simon McCartney

What’s changed?

Matt Johnston commented recently that the recent surge in activity in the community side of the local tech & business scene could be “the ‘real’ end of the ‘Troubles’?”.  It’s definitely a positive thing, I’m delighted the next generation of technologists in Northern Ireland has a growing & diverse community around them.  Something that was sorely lacking in my formative years, where it seemed that the only exposure to technology was from inside the technology firm you worked in.  [and I'm a committed technologist, not a 9-5 salary man].  So what’s changed?

Many of us are of a similar age, all in full-time IT roles from the mid-90’s onwards, some for much longer.  Is it the relatively recent additions that have invigorated us? People like the hyper-active Andy McMillen, or what’s caused “the old guard” like Matt to push on with xcake & startvi, or Colm & Norbert to persevere with MobileMondayBelfast, or Darryl & the first Open Coffee Belfast?

Surely none of us would admit to letting Northern Ireland’s previous problems get in the way of the way we lead our lives?

So what changed?  How do we make sure we don’t loose momentum?

How much would your life changed if you had the community & adventure surrounding you 10-15 years ago when you first discovered your passion for technology could pay the bills?  Would you have endured the 10 years in big, faceless corporations? [how did we get brain washed into thinking that the best IT career involved one of 3 or 4 companies in NI?]

Would I still be doing what I’m doing now? Probably, but probably not for who I’m doing it for.  And I hope I would have had a much interesting & independent path here.

by simonm at February 22, 2010 11:48 AM

January 27, 2010

Jonathan McDowell

Sinful admission

Knowing full well that it will cause many of my readers to tut and roll their eyes at me I derive slight pleasure from confessing that I have now eaten at McDonalds on 6 continents. To make it worse I only did so in Asia and Australia so I could say I had.

It does lead me into a slightly more valid ramble. I'm not particularly bothered about eating on my own. I like food (even if I'm picky about what I like), but I prefer it with company. This means I'm not particularly great about being organised to cook complicated things when I'm on my own; largely the whole thing just turns into dealing with hunger. It also mean I'm bad at finding nice places to eat out while travelling. Which, when you're travelling for a month to some interesting places, is a bit of a bugger. I've got a bit better at actually going to nice places, and trying not to bolt my food into me so I can get out ASAP but instead enjoy it. A book helps. Also places that aren't quite as busy (which if you have no agenda is nicely achieved by letting your body clock desync from the world around you). Unfortunately I didn't really do so until after Hong Kong. Guess I'll just have to go back at some point...

(More on my travels at some point, maybe. I've started the tortuous journey home now.)

by Jonathan McDowell at January 27, 2010 09:43 AM

January 17, 2010

Colin Turner

Boot time sound problems with QuickCam Pro 9000 webcam

I've had a Logitech QuickCam Pro 9000 for some time now, and it works well, but I did have one bizarre problem with it when I used it with my main desktop machine (running Debian (Sid)). Namely, that if I had the camera plugged in (usb) at boot time the sound on the computer did not work, if you plugged it in after boot, everything was fine.

This was pretty irritating because if I forgot I would often have dozens of windows open and ready for work before I realised.

Normally this happens because the cards are loaded in the wrong sequence by udev. But, if you listed the sound cards with

cat /proc/asound/cards
 
the main card wasn't just in the wrong order, it simply wasn't there. I tried comparing modules loaded with and without the camera (at boot) and manually loading the differences, but this did not help. I tried forcing the index to be zero on the correct card, but this also did not help.

In the end, I made the following edit to /etc/modprobe.d/alsa-base.conf

# Keep USB (webcam from being loaded as first card)
options snd_usb_audio index=-2
 
and this did the trick. So if like me you were searching for the answer to this, I hope it helps.

by nospam@example.com (Colin Turner) at January 17, 2010 10:21 PM

January 07, 2010

Philip Herron

Parsing the Doom Wad File

So it was a fine Christmas, I was at home with family armed only with 2 seasons of xFiles and my laptop added to the factI didn’t upload my ssh key to my laptop so hacking on Crules was out the window. So it got me thinking on the main goals for my Crules Scripting Language, one of which ( the main one ) is that it should be embeddable into existing C/C++ applications like Lua or Python or even C# (mono) if your using its recently added reflection api!

So why not make a game engine using my language with crules as a scripting language so I can see what the API _SHOULD_ look like for the client. So i choose doom since i am terrible with graphics, i can use the doom.wad and concentrate on programming; So in the past i have written two separate 2D game engines one was a Java 2D Monkey Island clone i done for university and it was terrible since Java is a terrible platform in my opinion, then my 2nd was a port  of it over to C++/SDL and the code was terrible ;) so don’t bother asking me about it.

Anyway’s so the long and short i am writing doom engine from scratch, my original idea was to work with an existing game engine like Crystal Space or Doomsday Engine though, Crystal Space i was put off since it already uses Python and i don’t really feel like trawling though lots of code and forking it essentially would be really more work than its worth. Doomsday Engine is the cream of the crop of Doom Ports at the moment, all others are practically the same in essence using the same ancient code and hacks from throughout the 90’s. And really the technology has changed somewhat since then. Though Doomsday Engine is pretty amazing and works well, it seems to need a massive cleanup and i don’t mean to be nasty on the developers or anything they have done a fantastic job!  And they have really made the code much cleaner than any other port about! Plus the lead developer has been really nice to me ;) . Anyway’s Games have always been a great passion to me and really doom can’t be that hard to re-implement from scratch and really it isn’t i already have a basic game engine working using OpenGL and SDL{ _ttf, _mixer }. With audio, and fps counter and input bla bla. But i am just concentrating on differentiating the wad sprite formats etc while revising for exams and working on crules and many other bits and pieces. So in the end  i’ll just stick in an extract of the log of my game engine when it starts parsing the doom.wad and explain a little on how to parse the wad!

debug: main.c:28 -> Trying to start crldoom wad: data/doom.wad!
debug: doom.c:147 -> parsing wad file <data/doom.wad>!
debug: doom.c:80 -> is a wad file :: <IWAD>!
log: doom.c:155 -> wad file data/doom.wad has length 12408292!
debug: doom.c:27 -> debug seeking…
debug: doom.c:30 -> reading….
debug: doom.c:34 -> parsing…
log: doom.c:49 -> header:: ident -> 1145132873, n_lumps -> 2306, infotableofs -> 12371396!
log: doom.c:62 -> directory:: filepos -> 12, size -> 10752, name -> 1497451600, ident -> PLAYPAL!
log: doom.c:62 -> directory:: filepos -> 10764, size -> 8704, name -> 1330401091, ident -> COLORMAP!
log: doom.c:62 -> directory:: filepos -> 19468, size -> 4000, name -> 1329876549, ident -> ENDOOM!
log: doom.c:62 -> directory:: filepos -> 23468, size -> 6854, name -> 1330464068, ident -> DEMO1!
log: doom.c:62 -> directory:: filepos -> 30324, size -> 9402, name -> 1330464068, ident -> DEMO2!
log: doom.c:62 -> directory:: filepos -> 39728, size -> 15466, name -> 1330464068, ident -> DEMO3!
log: doom.c:62 -> directory:: filepos -> 55196, size -> 3286, name -> 1330464068, ident -> DEMO4!
log: doom.c:62 -> directory:: filepos -> 58484, size -> 0, name -> 827142469, ident -> E1M1!
log: doom.c:62 -> directory:: filepos -> 58484, size -> 1430, name -> 1313425492, ident -> THINGS!
log: doom.c:62 -> directory:: filepos -> 59916, size -> 6804, name -> 1162758476, ident -> LINEDEFS!
log: doom.c:62 -> directory:: filepos -> 66720, size -> 19980, name -> 1162103123, ident -> SIDEDEFS!
log: doom.c:62 -> directory:: filepos -> 86700, size -> 1880, name -> 1414677846, ident -> VERTEXES!
log: doom.c:62 -> directory:: filepos -> 88580, size -> 8964, name -> 1397179731, ident -> SEGS!
log: doom.c:62 -> directory:: filepos -> 97544, size -> 956, name -> 1128616787, ident -> SSECTORS!
log: doom.c:62 -> directory:: filepos -> 98500, size -> 6664, name -> 1162104654, ident -> NODES!
log: doom.c:62 -> directory:: filepos -> 105164, size -> 2288, name -> 1413694803, ident -> SECTORS!
log: doom.c:62 -> directory:: filepos -> 107452, size -> 968, name -> 1162495314, ident -> REJECT!
log: doom.c:62 -> directory:: filepos -> 108420, size -> 6948, name -> 1129270338, ident -> BLOCKMAP!

So this is just some of the output of the code i had written it parses out whats called the ‘directories’ in the file and then i also have functions to parse out whats called the ‘lumps’ from these directories the lumps are the actual data. I’ll explain more detail when i talk about how to parse this. And how to convert the music lumps to proper midi so you can play it in SDL_mixer or even in Totem if in in gnome.

So what do we need, if you have yourself a Doom.wad file lying about i am sure if you go through your old boxes you’ll find yourself a copy of doom, or if you cant find it you can find it on torrent sites but you didn’t read that here ;) . Thing is I have bought the game like 3/4 times I am sure hehe. Lets get started.

In the Doom wad there is whats called the ‘HEADER’ which is of length 12 bytes which contains 3 * 4-byte integers which contain the data we care about, so lets do that lets make some code (i just wrote this code in like 10 min to illustrate the idea its ok does the job!):

  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. #define WAD_HEADER_LENGTH     12
  6. #define WAD_DIRECTORY_LENGTH  16
  7.  
  8. unsigned long parse_int( unsigned char *p )
  9. {
  10.   return ( (unsigned long)   p[0]
  11.            | (unsigned long) p[1] << 8
  12.            | (unsigned long) p[2] << 16
  13.            | (unsigned long) p[3] << 24
  14.            ) ;
  15. }
  16.  
  17. int main( int argc, char *argv[] )
  18. {
  19.   const char* wad_file= "/home/redbrain/workspace/doom-dev/crldoom/data/doom.wad";
  20.   FILE* wad_fd;
  21.   if( !(wad_fd= fopen(wad_file, "rb")) )
  22.     {
  23.       fprintf(stderr, "error opening <%s>!\n", wad_file);
  24.       return EXIT_FAILURE;
  25.     }
  26.  
  27.   unsigned char header_buffer[ WAD_HEADER_LENGTH ];
  28.   fread( header_buffer, WAD_HEADER_LENGTH, 1, wad_fd );
  29.  
  30.   char* wad_ident= (char*) header_buffer;
  31.   wad_ident[ 4 ]= \0;
  32.   if( strncmp( wad_ident, "IWAD", 4 ) )
  33.     {
  34.       fprintf(stderr, "invalid wad header type <%s>!\n", wad_ident );
  35.       return EXIT_FAILURE;
  36.     }
  37.   else
  38.     {
  39.       printf("doom wad is a <%s>!\n", wad_ident );
  40.     }
  41.  
  42.   unsigned long wad_length= 0;
  43.   fseek( wad_fd, 0, SEEK_END );
  44.   wad_length= ftell( wad_fd );
  45.  
  46.   unsigned long directory_offset= parse_int( header_buffer+8 );
  47.   unsigned long number_lumps= parse_int( header_buffer+4 );
  48.  
  49.   printf("wad directory offset <%lu> with <%lu> lumps!\n",
  50.    directory_offset, number_lumps );
  51.  
  52.   unsigned long t_ofs= directory_offset; unsigned long lump_count= 0;
  53.   while( t_ofs <= ( wad_length -- WAD_DIRECTORY_LENGTH ) )
  54.     {
  55.       fseek( wad_fd, t_ofs, SEEK_SET );
  56.       unsigned char *directory_buffer= (unsigned char*)
  57.         malloc( sizeof(char) * WAD_DIRECTORY_LENGTH );
  58.       fread( directory_buffer, WAD_DIRECTORY_LENGTH, 1, wad_fd );
  59.  
  60.       unsigned long filepos= parse_int( directory_buffer );
  61.       unsigned long size= parse_int( directory_buffer+4 );
  62.       char *directory_ident= strdup( (char*) directory_buffer+8 );
  63.       directory_ident[ strlen(directory_ident) ]= \0;
  64.  
  65.       printf("directory name <%s> at offset <%lu> with size <%lu>!\n",
  66.        directory_ident, filepos, size );
  67.  
  68.       free( directory_ident ); free( directory_buffer );
  69.       t_ofs += WAD_DIRECTORY_LENGTH; lump_count++;
  70.     }
  71.  
  72.   printf("directorys parsed <%lu> total lumps <%lu>!\n",
  73.    lump_count, number_lumps );
  74.   fclose( wad_fd );
  75.  
  76.   return 0;
  77. }

So lets compile and test this code <remember to change the path to your doom wad>:

gcc doom_wad_test.c

./a.out

So right what does any of this code mean i just chucked it up there, i wrote it up very quickly from scratch. So as i stated earlier there is a wad header which is a 12 bytes in length which i refer to as ‘WAD_HEADER_LENGTH’ which contains 3 * 4-byte integers. So from the code we have fopen’d the wad_file and i use fread to read in the 12 bytes in a 12 byte ‘unsigned char[]‘ buffer. So to read out the integers in a neutral endian way i found a nice parse_int function in some of the wad documentation i found and in old doom source code which was GPL so it was like…. yoink… but its pretty easy to understand if you know your representations well enough but i wont go into detail.

The first integer is the IWAD or PWAD string, IWAD is what you will find mostly its the deployment version of the wad, the PWAD is a patch wad and very few of them are still around and i think it has similar structure. Anyways, you parse out the first integer like this

  1. char* wad_ident= (char*) header_buffer;
  2. wad_ident[ 4 ]= \0;

Remember to add null string ‘\0′, so we don’t get buffer overflow! This string is always a length of 4 so no need to mess about! And then the next integer is the number of lumps in the wad the lumps are the actual binary data like music and graphics. Third int is the ‘directory offset’ which contains pointers to where the lumps are their idents and the size of the lumps which have lengths of 16 ‘WAD_DIRECTORY_LENGTH’ until the end of the wad file! so note i find the length of the file and do:

  1. while( t_ofs <= ( wad_length -- WAD_DIRECTORY_LENGTH ) )
  2.     {
  3.     }

So how do we parse out these directories? We move to the directory offset and then read the 16 bytes into a buffer, which is 4 integers this time. But still contains only 3 things means the ident strings can be longer or can be with some padding between each directory lump.

  1. unsigned long filepos= parse_int( directory_buffer );
  2. unsigned long size= parse_int( directory_buffer+4 );
  3. char *directory_ident= strdup( (char*) directory_buffer+8 );
  4. directory_ident[ strlen(directory_ident) ]= \0;

Now we know the file offset of the lump the size of the lump and the ident of the lump and we make sure to add the null terminator again to avoid buffer overflow. And then we can parse out the lumps simply just fseek and fread :) Done its so simple and seems like there would be more to it, yet when you think of it is very much common sense there really isn’t that many ways to pack data into a file like this! If your interested i’ll be talking about it soon… on how to convert the D_E1M* lumps which are music lumps to compatible midi tracks. And finally on how BSP works for the levels and maybe how to draw them in C/SDL/OpenGL… if you ask i prefer C over C++, yeah when it comes to building this game engine there have been times i though woo having an object would be really nice here but then i realise well no because that’s what the scripting engine is going to do… :) Mainly due to the fact i dont like C++ syntax it feels messy to me and C is just nice and simple :)

Finally I just want to wrap up with saying John Carmack has to be one of my biggest Hero’s in Computer Science along with Migel De Icaza, Linus Torvalds, Various GCC hackers… like Ian Lance Taylor But John Carmack in particular since he made Doom! But also he attended the University of Missouri–Kansas City for two semesters before withdrawing to work as a freelance programmer. Which i think that is brilliant! Since University does not teach students to be serious programmers or technology well very few do anyway and i think its great he had the balls to do that and so did Migel De Icaza and they have both done some of the most amazing things in computer science!

Anyways if your interested in Crules or CrlDoom see: http://crules.org code for crldoom is over @ http://code.redbrain.co.uk/cgit.cgi/crldoom

This is a project i love Classic Doom 3 it was Doom re-implemented ontop of the Doom3 Engine what more do you want!!!

by redbrain at January 07, 2010 01:12 AM

January 01, 2010

Colin Turner

Michael

Michael stands in the rain, as drops fall from his brow to the ground,
He waits patiently, his steel grey eyes surveying his battlefield,
It is a strange one, strewn with grass and flowers and many a mound,
And rank and file of stones each entreating that He should yield.

Scattered here and there, his kinfolk stand, but none as Michael.
He is the soldier, with breastplate and shield, and sword by his side,
Not drawn since he came to be here; he stands as a stoic sentinel,
Patient, benevolent, the fire in his spirit not worn with boastful pride.

Michael stands in the rain, as he has stood in the blistering Sun,
And when stars wheel above him; when snow coated, but not numb,
Rather with exultant wings renewed, he stands vigilant for the One.
Waiting for his ancient foe, the firstborn seraph, who does not come.

by nospam@example.com (Colin Turner) at January 01, 2010 01:12 AM

December 31, 2009

Colin Turner

Virtual folders with Dovecot and Debian

I use client side virtual folders a bit for my mail. Specifically, I tag messages with IMAP flags like todo and important, and then in Icedove / Thunderbird, I set up a special folder as a saved search which shows message that are either unseen, or marked todo in my inbox. It works rather well, and I use the same set-up on my laptop, and work and home desktop machines.

But it's not very useful on my phone, which doesn't allow such sophisticated client side behaviour. My phone mail applications shows the most recent 25 messages in a folder, but there are times when it would be really useful to look up messages that are labeled as important but rather old. It would be time consuming to look through the older messages, and difficult to find the one I want anyway.

As a result, I've been looking at the possibility of using virtual server side folders using dovecot on my Debian mail server. I was put off by the documentation which left a lot of questions unanswered.

Here's how I did it on Debian. First of all edit the config file /etc/dovecot/dovecot.conf, back up this file first, so you can restore working behaviour if something goes wrong.

#
# You have to add the default namespace
# which is normally NOT added explicitly before
#
namespace private {
  prefix =
  separator = /
  # the next line is very specific to where you keep your mail
  location = mbox:~/Mail/:INBOX=/var/mail/%u
  list = yes
  inbox = yes
  subscriptions = yes
  hidden = no
}

#
# Then add the virtual namespace
#
namespace private {
    prefix = virtual/
    separator = /
    # pick where the virtual folders will be
    location = virtual:~/Mail/virtual
    list = yes
    inbox = no
    subscriptions = yes
    hidden = no
}
 


You must also add the virtual folder plugin.

##
## IMAP specific settings
##

protocol imap {

  # ... you need to enable the plugin
  mail_plugins = virtual
 


Now restart dovecot and check your normal folders are working.

/etc/init.d/dovecot restart
 
Note that I found dovecot will generally not serve physical folders correctly if the virtual mail folder (even if empty) does not exist. I consider this a bug, but one that needs to be worked around, at least for me.

If that's all done and working you can begin to create virtual folders. I created two directories within my ~/Mail/virtual folders; which were inbox-todo and inbox-important respectively. Inside each I put the following files.


# ~/Mail/virtual/inbox-todo/dovecot-virtual
INBOX
  OR (OR (OR KEYWORD $TODO KEYWORD todo) KEYWORD $label4) unseen
 
which shows all unseen and mail labelled todo in my inbox and

# ~/Mail/virtual/inbox-important/dovecot-virtual
INBOX
  OR (OR KEYWORD $IMPORTANT KEYWORD important) KEYWORD $label1
 
which shows only important mail in my inbox.

It seems to be working, my normal folders appear to be working perfectly correctly (but I'll know better in a couple more hours/days); my phone has successfully subscribed to the two virtual folders, though the folder list shows a number of files which I'm certain it should not, again, this looks like a dovecot bug to be honest.

by nospam@example.com (Colin Turner) at December 31, 2009 03:06 PM

December 22, 2009

Colin Turner

Fixing g1 Accelerometer

I had noted before that my accelerometer had broken on my Android g1 phone, so that one axis was out by about 40 degrees. Despite lots of "helpful" suggestions from my friends on how to fix it (you know who you are), nothing worked. This did.

Connect to the phone with adb (from the Android SDK), in the following way.


./adb start-server
./adb shell
# cd /data/misc/
# mv amkd_set.txt amkd_old.txt
# killall amkd
 
Now it works.

by nospam@example.com (Colin Turner) at December 22, 2009 10:56 PM

December 15, 2009

Colin Turner

Cyanogen Android ROM on the g1

I've had my Google development phone, the g1, for some time now. I haven't had the luxury of time to write anything for it, but I mainly wanted it to try out Android anyway. I've reviewed the phone before, and again after some canonical firmware upgrades.

I use the truly excellent K9 application for mail, it has good support for self signed certificates, now has IMAP push support and is generally excellent. However, it stores all the mail on the shockingly limited internal memory on the device. That, and upgrades to things like Google Maps, adding truly excellent new functionality, left me constantly looking for applications to remove.

This is why in the end I decided to try Cyanogen's ROMs. Since I have a development phone, I didn't need to root it, and just followed the relevant instructions (in truth, I couldn't be bothered to downgrade the OS to root it first).

Here are some observations about the new ROM:

  • Apps2sd is amazing.
    I have the whole pleasure of trying different apps all over again, without sweating about every byte. I don't have to worry about how much data is in my contacts (whether I assign them icons), my emails, and so on. I have plenty of room. I was delighted to be able to install DocumentsToGo. Which makes the phone much more useful for work emails. Loads of great apps I had to remove have been reinstated, and I can play with others, like the awesome Google Googles.
  • Extra workspaces
    There are five workspaces, making for more widget playroom. I now have a calendar app taking up a whole workspace with the events to come. Excellent.
  • It fixes several problems I had with MMS functionality.
    • It fakes a variety of user agents, meaning that a test video message I sent myself on o2 finally worked, for the first time ever.
    • The stock ROM allows you to prevent data access when roaming, which is good. But it also doesn't fetch MMS when roaming, which is (for me) a nuisance, and these are usually on a different tariff system. So when you receive an MMS on roaming, you end up enabling all data access to quickly receive the MMS, and then turn it off again. The Cyanogen ROM has an option to retrieve MMS on roaming.
  • UI feels snappier
  • USB tethering
    can be enabled, which JustWorks (TM) with Debian. Excellent.
On the downside, I have had some reset problems, but admittedly I have sometimes been pushing the phone very hard indeed to test it. And the battery life on the g1 is still awful. I know Noodles has solved the problem by not actually using his phone :-), but I want to use mine.

Another minor problem I encountered some weeks ago was the accelerometer suddenly starting serious misreporting on one axis. This problem seems to be becoming less severe, but even reinstalling the stock and then cyanogen ROM did not fix it. However, note I did not wipe the user data.

Cyanogen has made my phone fun to have again. And I will still replace it when a new Android handset comes out that I really like, but a lot of the urgency has gone. I'll certainly buy him a beer for Christmas.

by nospam@example.com (Colin Turner) at December 15, 2009 09:37 PM

December 03, 2009

Philip Herron

Crules and Intermediate Representation

If you follow my blog you may have noticed i have been quiet and thats because i’ve been working on http://crules.org Its the new homepage for my project Crules, its got some good content on it but nothing really on the language yet. Though today i spend a very long time on the HACKING article And i explain a lot on how Intermediate Representation’s work and 3-address code.

So lets just take an extract since i am lazy: So in compilers or interpreters how do we represent:

  1. (( x + y ) -- ( ( x + y ) * ( x -- y ) ) ) + ( ( x + y ) * ( x -- y ) )

Lets see it in a diagram first then in IR code:

Expression

Expression

So what is this? Well early on when i was getting into compiler construction when doing semantic analysis you will need to find a way of representing these semantics for your language, and you will find generally that there are 3 things you need to know: DESTINATION OPERAND A and OPERAND B. This is what’s called 3-address code. This is what sets compilers apart and can make or break them! Its what gives implementations flexibility and the ability to ‘control the flow‘ of execution! Any good compiler book will give you more detailed discussion on this topic its my main interest in compilers since this is what gives an implementation its logic. So lets give it a syntax we can write down to illustrate how mine works: it just so happens a LISP ‘ish syntax can show this very well!

  1. ( ( IDENTIFIER ( TYPE ) ) => ( OPERAND A ) => ( OPERAND B ) );

Since the parser is precedence aware it will construct the tree as shown in a symbol language which looks like this if it was output ( outputting the IR like this is a future TODO ); It may look a little like GIMPLE but this IR I have as I will demonstrate more examples can encompass much much more.. ( this is a 3-address code by the way )

  1. ( ( NIL ( OP_ADD ) )
  2.   => ( ( ( NIL ( OP_SUBTRACT ) )
  3.     => ( ( ( NIL ( OP_ADD ) )
  4.       => ( ( ( NIL ( SYMBOL_ACCESS ) )
  5.         => ( ‘x’ )
  6.         => ( NIL )
  7.       ); )
  8.       => ( ( ( NIL ( SYMBOL_ACCESS ) )
  9.         => ( ‘y’ )
  10.         => ( NIL )
  11.       ); )
  12.     ) ; )
  13.     => ( ( ( NIL ( OP_MULTIPLY ) )
  14.       => ( ( ( NIL ( OP_ADD ) )
  15.         => ( ( ( NIL ( SYMBOL_ACCESS ) )
  16.           => ( ‘x’ )
  17.           => ( NIL )
  18.         ); )
  19.         => ( ( ( NIL ( SYMBOL_ACCESS ) )
  20.           => ( ‘y’ )
  21.           => ( NIL )
  22.         ); )
  23.       ); )
  24.       => ( ( ( NIL ( OP_SUBTRACT ) )
  25.         => ( ( ( NIL ( SYMBOL_ACCESS ) )
  26.           => ( ‘x’ )
  27.           => ( NIL )
  28.         ); )
  29.         => ( ( ( NIL ( SYMBOL_ACCESS ) )
  30.           => ( ‘y’ )
  31.           => ( NIL )
  32.         ); )
  33.       ); )
  34.     ); )
  35.   ); )
  36.   => ( ( ( NIL ( OP_MULTIPLY ) )
  37.     => ( ( ( NIL ( OP_ADD ) )
  38.       => ( ( ( NIL ( SYMBOL_ACCESS ) )
  39.         => ( ‘x’ )
  40.         => ( NIL )
  41.       ); )
  42.       => ( ( ( NIL ( SYMBOL_ACCESS ) )
  43.         => ( ‘y’ )
  44.         => ( NIL )
  45.       ); )
  46.     ); )
  47.     => ( ( ( NIL ( OP_SUBTRACT ) )
  48.       => ( ( ( NIL ( SYMBOL_ACCESS ) )
  49.         => ( ‘x’ )
  50.         => ( NIL )
  51.       ); )
  52.       => ( ( ( NIL ( SYMBOL_ACCESS ) )
  53.         => ( ‘y’ )
  54.         => ( NIL )
  55.       ); )
  56.     ); )
  57.   ); )
  58. );
busy!

busy!

Though one big note its is ok for me to leave the representation like this since in my interpreter i just evaluate this at run time but how does this affect things like code-generators like proper Compilers? Well its quite simple in a sane compiler like GCC ( although most compilers will follow this idiom i am sure) introduce another layer for IR called RTL ( Register Transfer Language ). The wikipedia article lacks and most compiler books overlook this section very much since, most books are written by the academics and generally stay away from the back-end of compilers since that is the actual hard part since a code-gen is very specific to the instruction set your targeting and register allocation algorithms are very difficult and is a huge research project.  Its said in computer science the most difficult things to build software wise is a good JIT or any Code-Generator for that matter.  Anyways back to the problem lets take a smaller expression for sleep’s sake the expression:

  1. unsigned int retval = ( x * 2 ) / ( 7 + y );

Will generate something like:

  1.  
  2. t1 = x * 2;
  3. t2 = 7 + y;
  4. t3 = t1 / t2;
  5. retval = t3;
  6.  

Anyways you’ll notice in my the IR keywords such as SYMBOL_ACCESS or SYMBOL_ITEM or OP_ADD etc, these are what’s called OP_Codes and are generally represented by some symbolic hex values since its cheap to check against for the implementation to figure out what to do with symbol ‘x’; So ok thats a quick and dirty intro to Intermediate Representation’s!

I think this lolcat will sum up your feelings at the end of reading this blog post:

And i started getting out my old grunge cd’s which include my Silverchair collection and this is on of my favourite bands of all time and this is a pretty good song!

by redbrain at December 03, 2009 02:47 AM

November 29, 2009

Jonathan McDowell

DIY laptop SSD "upgrade"

I'm due a new laptop; my Portege R200 is over 4 years old now, I find it much slower than my desktop (no surprise; P-M 1.2GHz/1.2GB vs Core 2 2GHz/4GB), it's had a new battery and it has an annoying whine on the screen unless you press the side in just the right way. It's still better for long periods of use than my EEE 901, which is why I keep it. In particular I'm off to LCA2010 in January, along with some associated travel beforehand, and I'll want more than the EEE for that, but probably not a brand new laptop. Which meant that when the R200 started throwing disk errors recently I wasn't particularly happy.

Having decided it wasn't worth buying a new 1.8" drive I looked for alternatives. eBay offered plenty of options for 1.8" IDE to CF adaptors and I picked up a Kingston 32GB CF card from eBuyer. I copied across the data from the old drive using a USB adaptor, frobbed grub sufficiently that I got it installed on the CF, then swapped out the drive for the adaptor + CF. I had to do the swap a few times; the first I forgot to have a kernel with ext2 support (the HDD was ext3, but I went back to ext2 for the CF). The second I'd done my usual trick of forgetting to populate /dev with things like console and sda* (ie enough to get to the point where udev will run). And then grub needed some prodding to boot without intervention. I got there in the end and I'm currently writing this from said laptop.

I've made a few changes to the Debian install in an attempt to make things smoother; basically the same tricks people have been using on EEEs or other slow SSD devices. No swap, Iceweasel synchronous toolkit writes disabled, filesystems mounted with noatime, /tmp on tmpfs, various daemons that I don't really use disabled. It's still noticably slower than with the HDD, particularly on writes. However it's quieter and as long as it lasts for the next 3 months I'm happy (plus after that I can reuse the 32G CF card somewhere else, which I couldn't have done with a 1.8" HDD as easily).

Now, back to eying the Lenovo X200s (ugly, trackpoint but 1440x900 display, good battery life) and Toshiba R600 (slower, lower res but pretty and trackpad).as potential replacements. Maybe there'll be something even shinier in 12" by next year...

by Jonathan McDowell at November 29, 2009 05:32 PM

November 28, 2009

Philip Herron

Intel C++ Complilers Linux

So if you know me you’ll know i think compilers are cool… yeah i know i am weird lol. So any-way’s this is something i never really got around to until last night. Which was setting up the Intel C/C++ compilers in my Computer which is running Debian. If  you ever look at using compilers other than GCC such as like Sun Studio and Intel C++ you may find its very messy feeling. What i mean is they have like a nasty install.sh, and to be quite honest they fail lol. Since they generally only cared about creating RPM’s and hoping your running Red Hat since most customers who would buy these compilers would be running a Red Hat server farm. So if your project is using Autoconf and Automake you dont have to worry about a thing, once the compilers are installed it will be one quick minor change to your configure.ac. And your all set!

First off go and download the 750mb tarball of the Intel C compilers over at: http://software.intel.com/en-us/intel-compilers/

% tar zxvf l_cproc_p_11.1.059_ia32.tgz

% cd l_cproc_p_11.1.059_ia32

% ./install.sh

# follow all the instructions it complained i didn’t have java installed but you don’t need it. Once your finished it should all be installed to /opt/intel/Compiler

% PATH=$PATH:/opt/intel/Compiler/11.0/069/bin/ia32

% LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/intel/Compiler/11.1/059/lib/ia32/:/usr/lib/

You should be able to run ‘icc’ but you will probably get the error: ” /opt/intel/Compiler/11.1/059/bin/ia32/mcpcom: error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory

compilation aborted for test.c (code 127)”

So you need to install an older libstdc++ on debian it is:

% aptitude install libstdc++5

That should be it lets give it a test:

  1. int main( )
  2. {
  3.   ;
  4.   return 0;
  5. }

% icc test.c

Should work now! If your project uses a Configure.ac lets make a quick change:

Change your AC_PROG_CC to:
AC_PROG_CC([icc gcc cc cl])

This is the order in which the configure should search for each compiler. Since you need GCC installed to use Intel C++ you need to put ICC at the top of the list! Hope this helps someone!

by redbrain at November 28, 2009 04:15 PM

November 19, 2009

Stuart Hacking

C++ Templates for XCode 3.2

Here are a couple of Project templates I made for XCode 3.2. One for a WxWidgets based project (wxMac 2.8), and one for a GLUT project. Hope they work.

  • GLUT C++ Project – Initializes GLUT and creates a scene containing a cube which can be rotated using the keyboard arrow keys. toggle an axis widget using ‘w’, toggle fullscreen using ‘o’ and exit using ESC. The FPS is displayed in the titlebar.
  • WxWidgets C++ Project – Initializes a WxWidgets based app with an empty frame.

by smh at November 19, 2009 04:17 PM

November 18, 2009

Marty Pauley

三年間

Karen and I have now been living in Japan for three years. When we decided to move here we thought it would be an adventure, and it has been. We’ve had some problems, we’ve had some fun, and we’ve had lots of fun-problem combinations. I think we made the right choice.

by Marty at November 18, 2009 04:09 PM

November 15, 2009

Colin Turner

More about LHC black holes

Last week I wrote a little about the size of black holes, and incidentally discussed very primitive calculations I did on the lifespan of any black hole created by the LHC.

A few days later, this interesting article showed the results of professional physicists on just how little such little black holes could grow, in some cases even if their lifetime was not restricted. Enjoy.

by nospam@example.com (Colin Turner) at November 15, 2009 11:20 PM

Jonathan McDowell

Playing with an e-reader

I've always preferred dead tree to reading things on screen; I just find it easier. I've tried reading fiction in the past off a laptop and just didn't find it as enjoyable an experience; whether it was the form factor (hard to curl up with a laptop, even a netbook), the quality of the screen or the interface I don't know. Equally with technical documentation if it's something I'm using a lot I prefer a printed copy to flick through. However e-ink based e-readers are becoming much more common and affordable and I figured I should give the whole ebook experience another try.

I spent 3 weeks in October in the Bay Area on work, so I borrowed my Dad's Sony PR505 for the trip. First problem is that it's picky about USB charging - works fine if attached to a computer, but using a Blackberry charger looks like it's fine but then results in what looks like a hanging reader. However once charged it lasts for ages - I charged it before I went and only hooked it up to my laptop once during the trip to transfer some new content onto it. The form factor is also quite good; a bit heavier than a book, but not excessively so. Holdable in one hand, big enough screen that I wasn't squinting at it. Slightly too big physically to easily go in a coat pocket the way a paperback would unfortunately, but perfectly fine for taking to read at breakfast every morning in the hotel.

The screen was also much better than I'd expected. I knew the technology was different and supposed to be easier to read than traditional LCDs, but I was sceptical. Overall I had no problems with it. I was even quite impressed with the Sony's zoom function - one of the PDFs I was reading was too small when view full screen, so I zoomed in so it was readable. The nice feature was that then the "next page" button gave me the next bit of text to read, rather than the actual next page, so it remained very easy to navigate through as I read. A small touch, but very welcome.

This isn't intended to be a review of the Sony reader; that just happened to be the model I was easily able to borrow. I happened to see a Kindle in use on the plane and I was struck by how much bulkier it seemed, though having looked at the relative specs it seems this is entirely due to the keyboard rather than any difference in screen size. The Nook was also announced during my trip and I'd quite like a play with that as it looks quite nice.

Despite my positive experience with the Sony I'm not planning to go out and get one just yet. And that's the lack of sensibly priced content. When I bought my first mp3 player I could take my exising CD collection, rip it and be able to play it on my new device. This meant I got an immediate benefit of having my entire music collection with me all the time, just by buying the player. If I buy an e-reader then in order to get all my existing books on it I have to go and buy them again. What's worse is they'll cost me the same or more than I paid for the paperbacks. I can't go and exchange my Pratchett collection for the electronic versions for a nominal fee. I can't easily scan them in myself and produce some decent ebooks. I can't even go and buy the entire set for £20; I'd have to spend something like ten times that. With mp3s I can continue to buy the real item and also have it on my portable player. Or, while albums still don't seem to be much cheaper electronically than on CD, there is at least the ability to buy a single track if that's all I want. Books don't have a comparison. I'm not going to want to buy a single chapter, am I?

There are some sites out there that can provide cheaper ebooks - Rachel Willmer runs ebookprice.info which lets you compare pricing from different vendors. There's also Project Gutenberg if you're looking for out of copyright books. Finally Peter Corlett pointed me at the Baen Free Library, which I haven't downloaded anything from but will definitely investigate at some point. I still maintain that none of these are enough and that content provision will continue to be a hinderance for e-reader mass adoption until there is some fundemental change in the way its provision is handled.

by Jonathan McDowell at November 15, 2009 02:25 PM

November 13, 2009

Stuart Hacking

Nethack on OS X 10.6 (Snow Leopard)

O.K. So, this is kind of a followup to a previous post I did about how I like to setup Nethack on my Mac. However, more recently, some of the patches I had used stopped working on later versions of Mac OS (10.5 and 10.6). So I spent a bit of time looking into this today and I got some positive results. (update: I think the problem I had with Menucolor compiling was that it didn’t like the regexp method – I changed this to simply use the wildcard matching.)

Nethack with Status Colors and Menu Colors

Nethack with Status Colors and Menu Colors

Unfortunately, because the two patches I’m applying have resulting conflicts- it meant manually applying the patches to the source code in some cases (also: I’m lazy). I, therefore, don’t have an elegant method of actually applying the two patches that I can pass on. What I am doing instead is providing two things: The complete refined archive of the patched Nethack source which should be ready-to-compile on OS 10.6; And also the .diff file produced from a vanilla copy of the source and my own patched version. I will also provide my new updated nethackrc file. (ok… 3 things :-) )

Here’s some details about the setup this provides:

  1. The Status Colors patch is applied. This is a configurable patch allowing you to color code status effects – hunger, blindness, HP, Gold, AC, etc. It’s very, very cool! :-)
  2. Menucolors patch applied. This is a configurable patch that let’s you apply colors to popup menus. e.g. inventory items can be red for cursed, green for blessed, etc. Again, this patch is very neat!
  3. The initial configuration for getting Nethack to build on mac has been taken care of.

So Here are the links to get everything up and running. I should say at this point that this stuff works on my machine and YMMV. If something is broken and you want my to take a look at it just leave a comment of send an email – I’ll try to fix it if I have time. You may also want to dig through the changes in the patch.

  1. nethack-3.4.3-patched.zip
  2. nh343-_menustatus_orig.diff
  3. .nethackrc

I hope this is useful for someone who wants a nice shiny setup of Nethack on Snow Leopard. :-)

by smh at November 13, 2009 02:47 PM

November 09, 2009

Colin Turner

Black Hole Radius, or How I came to love the LHC

I allowed myself to become rather distracted by my second years last week as the class was finishing. They were talking about an episode of Horizon that discussed General Relativity and theories of Quantum Gravity. What followed was a free ranging discussion on the nature of infinity, mentioned briefly in the program. But we also talked about the nature of a black hole and its size.

It's surprisingly easy to calculate this with reasonably elementary maths and physics. I first did this when I was about 17 (how very sad) using classical physics equations, and was astounded to discover that even so, the answer was correct (I checked it in the Encyclopedia Britannica in the library at the time).

Here is Newton's universal law of gravitation, between two bodies. It describes the force F between two bodies that are r metres apart. Let's take the one with mass M to be the black hole. G is a small (though mysterious) constant.

F = \frac{GMm}{r^2}

You can work out the energy needed to escape the black hole using the old stand by equation that work done is the force times distance traveled against that force, but that only works with a constant force, this force will change as we move, so we need to use the big daddy of multiplication, integration.

 WD = \int_a^b F dr

Specifically, we will work out the energy needed to escape from the event horizon, the surface at which the escape velocity is the speed of light, which is c (299,792,458 m/s). So the energy will be given by moving my little mass m from the radius of the event horizon, let's call is R to infinity, to show we have broken away.

 WD = \int_{R}^{\infty} \frac{GMm}{r^2} dr = \left [ -\frac{GMm}{r} \right ]_{R}^{\infty} = \frac{GMm}{R}

Now, this should just balance the kinetic energy possessed by my little mass m traveling at the speed of light.

 \frac{1}{2} mc^2 = \frac{GMm}{R}

and if we rearrange for R we get that

 R = \frac{2GM}{c^2}

In other words, the radius of the event horizon, the bit we think of as the "hole" is dependent entirely upon the mass of the object. Please note this is based on a very simple model of a non rotating black hole. Nevertheless we can do some nice calculations from this.

The Sun, would have to be compressed from its diameter of about 700 million kilometres into a radius of just under 3 kilometres. The Earth's mass would need to be compressed so much to form a black hole you would need to squeeze its radius of over 6 thousand kilometres into a radius of around 9 millimetres. That's how dense we're talking here.

We can also consider the radius as described by the contained energy of the black hole, since we know that

E=mc^2

and so, replacing our M in our above equation we get

 R = \frac{2GE}{c^4}

Wow. Remember c is a big number, taking it to the power of four is a lot. So why do this? There's been a lot of speculation about the possibility the Large Hadron Collider (LHC) could create a black hole. This has caused a fair degree of panic, and at least one suicide. It's a physicist's dream that a black hole might be created. I just looked up the "high" energies used by the LHC, and high is a relative term. It plans to bash protons together with 7 TeV (Tera electron volts) of energy each, or lead nucleii with 574 TeV each, let's take the latter. Just how much energy is that in a collision? Well, doubling and converting to good old Joules gives 184 micro Joules. That's really not a lot, 184 millionth's of a Joule. A 100W light bulb uses 100 Joules each and every second. How big would the radius of such a black hole that might form be, from that energy? Check the maths, because so far I haven't but I get.

R = 3.040 \times 10^{-48} metres

which is 0.000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,003 metres wide (I hope, I didn't double check the zeros either), which is probably not the planet swallower of people's imagination (but this is fun). But the problem is people think this tiddler will grow very rapidly, but that's because they don't know about Hawking Radiation. This is an interesting quantum effect that means black holes aren't really black, they do emit a little radiation. Large holes would gather surrounding matter faster than their low radiation rate, but small holes have the opposite situation, they radiate more rapidly. The maths for all that is pretty complex, and you need to make lots of assumptions, but the time taken for our little black hole to "evaporate" is (hurriedly calculated by me)

t = 7.21 \times 10^{-79} s

a tiny, tiny fraction of a second. Even allowing for the ambient temperature and some fall in of matter, this little baby is not in equilibrium, it's not getting mass fast enough to accumulate more. It's safe*.


* All disclaimers apply. No liability is assumed for foolish unvalidated experiments done by you or other members of your species. Do not attempt to create black holes in your garage. Any subsequent destruction of your civilization, planet or solar system is at your own risk, and any "EPIC FAIL" signs placed by aliens on the remains is not due to me or my calculation. No calculations have been done on the matter of strange matter either. If you break the planet / system / galaxy or universe you own all the parts.

by nospam@example.com (Colin Turner) at November 09, 2009 02:58 PM

November 07, 2009

Philip Herron

Whoops

So yeah i have lost a fair bit of content but i had some server trouble and reverted to an old backup :P but at least the other people i host on here didn’t seem to loose anything so that was a huge weight off my mind :) anyways its nearly 4 am and its nearly all setup now just need a quick bit of exim tinkering and various bits of pluming to be checked out! :) So hopefully it will be fine!

by redbrain at November 07, 2009 03:46 AM

November 01, 2009

Stuart Hacking

Eat the Jam!

Ladies and gentlemen, May I present “Eat the Jam!” The only game which combines a high powered pop culture quiz with a taxing conserve based forfeit.

by smh at November 01, 2009 05:46 PM

October 20, 2009

Colin Turner

Vidzone working at last!

Success at last. I've written before about my problems getting vidzone working, and tonight while taking a breather from some work I tried the Oracle of Google again, and I found a solution. As I suspected, it wasn't a network problem at all.

Kudos to lyonix, who suggested that deleting a corrupt cache for Vidzone from the game data utility often works. It worked perfectly for me, (note even removing and reinstalling the software doesn't affect that).

by nospam@example.com (Colin Turner) at October 20, 2009 10:57 PM

October 13, 2009

Marty Pauley

Perl’s XML::Twig

I was asked to “Free the code” from my XML parsing experiment , so I will post some here. It may be a bit disappointing though, since these are only some short scripts, and they’re a bit ugly. I’ll explain the Perl one today, and do the Haskell sometime soon.

I was playing with Jim Breen’s Japanese dictionary and I wanted to make a list of the first kanji component in each entry. I wanted one result for each entry, so I used “(none)” if the entry has no kanji part. This is not a difficult problem, although XML makes it as slow and memory intensive as many difficult problems.

use XML::Twig;
my @keb = (); # for the results

sub entry {
    my ($t, $e) = @_;
    my $kt = "(none)";
    if (my $k = $e->first_child("k_ele")) {
        if(my $keb = $k->first_child("keb")) {
            $kt = $keb->text();
        }
    }
    $e->purge;
    push @keb, $kt;
}

my $twig = XML::Twig->new(
    twig_handlers => { entry => \&entry }
);
$twig->parsefile($ARGV[0]);
$twig->purge;

# now the results are in @keb

Using XML::Twig is quite simple. When I create the parser I tell it how to handle the elements I care about, and in this case I only care about “entry” elements. When the parser finds an entry, it calls my entry subroutine, passing the entry’s object as the second parameter, $e. Inside the entry routine I can use DOM-style methods on $e to extract the data I want. Notice that I call $e->purge when I’ve got the data out. This tells the parser that I won’t need that element again, so it can free the memory. This is how XML::Twig manages to parse a file that most other modules can’t.

by Marty at October 13, 2009 04:24 PM

Jonathan McDowell

What to wear?

I tend to dress quite casually - unless there's a good reason to do otherwise I'll be in jeans and a t-shirt, or something similar. I'm comfortable in it and I take the view point that in general people shouldn't be making assumptions based on what I'm wearing. Of course they do, and while this can be infuriating at times it can also be amusing. The man at the RBoS who witnessed me signing the personal DD guarantee form for Black Cat obviously couldn't reconcile my appearance with what I was there to do, for example.

I'd never thought about this from the other side until a few weeks ago. I spoke to someone who explained how difficult it had become to conduct business meetings with other companies with the increased level of business casual. In fact on occasion different branches of the same company that he'd be meeting with would have different dress codes, so he'd go to something involving casual dress in the morning and something with full business suit attire in the afternoon and end up feeling over or under dressed.

This isn't likely to make me change my own behaviour in the immediate future (I don't have to interact with external parties as part of my current job). It did help me realise that there was another explanation for awkward behaviour when I'm my usual scruffy self that wasn't just about judging on appearances though.

(All of the above blatantly obvious once you think about it, but it took that conversation for me to do so.)

by Jonathan McDowell at October 13, 2009 06:17 AM