-
Posted: January 6th, 2009, 10:08am CET
pIf anybody is getting the codeVERR_SUPDRV_COMPONENT_NOT_FOUND/code error when trying to start a VM in VirtualBox when trying to set up Host Interface networking, the error is occurring because VirtualBox can#8217;t communicate with the codevboxnetflt/code driver./p
pTo fix this, simply load the codevboxnetflt/code module:/p
blockquote
pre# modprobe vboxnetflt/pre
/blockquote
pThen, try starting the VM again. If it works, you know that the problem is that the codevboxnetflt/code module is not loading on startup./p
pOn most Linux systems, you can add an entry to code/etc/modprobe.conf/code to make the module load on startup. (On OpenRC-based Gentoo systems, you can add an entry to code/etc/conf.d/modules/code to do it the Gentoo Way™.)/p
-
Posted: January 6th, 2009, 6:01am CET
pbr //ppSomeone who seemingly would like to remain anonymous (88.209.73.252 252.73.209.88.dsl.monaco.mc) has
been reading my blog and getting into a froth about something or other./p
pblockquoteI have read your Blog and for the life of me I can't see why anyone would be interested in consulting you or having you on the same planet./blockquote/p
pblockquoteYou are an offensive cunt, with not a single redeamable feature which shines through in your blog. You are a sad and embitered little man./blockquote/p
pblockquoteFuck off and die./blockquote/p
pAll I can offer is a thorough and heartfelt imeh?/i. Feel free to continue consulting my blog. Or not./p
pPS: some red pen corrections: iredeamable/i should be redeemable, iembitered/i should be embittered./pp align=righta href=http://www.rumble.net/contact/Contact me/a/p
-
Posted: January 5th, 2009, 11:33pm CET
pQuite often, you may have simple setter methods that need to do a just a tiny bit of work before or after setting an instance variable. For example, maybe you need to redraw something after setting the property of an object. So, instead of writing this:/pcodenbsp;nbsp;nbsp;nbsp;font color=#990000[/fontself setBackgroundColorfont color=#990000:[/fontNSColor blueColorfont color=#990000]];/fontbr /nbsp;nbsp;nbsp;nbsp;font color=#990000[/fontview setBackgroundColorfont color=#990000:[/fontNSColor blueColorfont color=#990000]];/fontbr //code
pYou#8217;d probably want to move the relevant code to your code-setBackgroundColor:/code accessor instead:/pcodenbsp;nbsp;nbsp;nbsp;font color=#990000-/font font color=#990000(/fontfont color=#009900void/fontfont color=#990000)/fontsetBackgroundColorfont color=#990000:(/fontNSColorfont color=#990000*)/fontcolorbr /nbsp;nbsp;nbsp;nbsp;font color=#FF0000{/fontbr /nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;ifont color=#9A1900// Assuming that _backgroundColor is the ivar you want to set/font/ibr /nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;bfont color=#0000FFif/font/bfont color=#990000(/font_backgroundColor font color=#990000!=/font colorfont color=#990000)/fontbr /nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;font color=#FF0000{/fontbr /nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;font color=#990000[/font_backgroundColor releasefont color=#990000];/fontbr /nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;_backgroundColor font color=#990000=/font font color=#990000[/fontcolor retainfont color=#990000];/fontbr /nbsp;nbsp;nbsp;nbsp;br /nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;ifont color=#9A1900// Update the view's background color to reflect the change/font/ibr /nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;font color=#990000[/fontview setBackgroundColorfont color=#990000:/font_backgroundColorfont color=#990000];/fontbr /nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;font color=#FF0000}/fontbr /nbsp;nbsp;nbsp;nbsp;font color=#FF0000}/fontbr //code
pThen you can simply call code-setBackgroundColor:/code and expect it all to work nicely:/pcodenbsp;nbsp;nbsp;nbsp;ifont color=#9A1900// -setBackgroundColor: updates the view's background color/font/ibr /nbsp;nbsp;nbsp;nbsp;ifont color=#9A1900// automatically now/font/ibr /nbsp;nbsp;nbsp;nbsp;font color=#990000[/fontself setBackgroundColorfont color=#990000:[/fontNSColor blueColorfont color=#990000]];/fontbr //code
p(You could use a href=http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueObserving/index.htmlKey-Value Observing/a to do this, but I generally avoid KVO for simple intra-class property dependencies like this. I don#8217;t think the overhead of maintaining all the KVC dependencies and KVO-related methods is worth the cost.)/p
pOf course, the above method requires that you write all that stupid boilerplate memory management code in the accessor. Instead of doing that, I tend to declare a private code_backgroundColor/code property in the class, code@synthesize/code a method for the private property, and then use the private property#8217;s generated accessors instead:/pcodenbsp;nbsp;nbsp;nbsp;@interface bfont color=#000000MyClass /font/bfont color=#990000()/fontbr /nbsp;nbsp;nbsp;nbsp;br /nbsp;nbsp;nbsp;nbsp;ifont color=#9A1900// Declare a _private_ _backgroundColor property (thus the underscore/font/ibr /nbsp;nbsp;nbsp;nbsp;ifont color=#9A1900// in front, and why it's declared in a class continuation rather than/font/ibr /nbsp;nbsp;nbsp;nbsp;ifont color=#9A1900// in the public header)/font/ibr /nbsp;nbsp;nbsp;nbsp;@bfont color=#000000property /font/bfont color=#990000(/fontcopyfont color=#990000,/font setterfont color=#990000=/font_setBackgroundColorfont color=#990000:)/font NSColorfont color=#990000*/font _backgroundColorfont color=#990000;/fontbr /nbsp;nbsp;nbsp;nbsp;br /nbsp;nbsp;nbsp;nbsp;@endbr /nbsp;nbsp;nbsp;nbsp;br /nbsp;nbsp;nbsp;nbsp;ifont color=#9A1900///font/ibr /nbsp;nbsp;nbsp;nbsp;br /nbsp;nbsp;nbsp;nbsp;@implementation MyClassbr /nbsp;nbsp;nbsp;nbsp;br /nbsp;nbsp;nbsp;nbsp;@synthesize _backgroundColorfont color=#990000;/fontbr /nbsp;nbsp;nbsp;nbsp;br /nbsp;nbsp;nbsp;nbsp;font color=#990000-/font font color=#990000(/fontNSColorfont color=#990000*)/fontbackgroundColorbr /nbsp;nbsp;nbsp;nbsp;font color=#FF0000{/fontbr /nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;bfont color=#0000FFreturn/font/b font color=#990000[/fontself _backgroundColorfont color=#990000];/fontbr /nbsp;nbsp;nbsp;nbsp;font color=#FF0000}/fontbr /nbsp;nbsp;nbsp;nbsp;br /nbsp;nbsp;nbsp;nbsp;font color=#990000-/font font color=#990000(/fontfont color=#009900void/fontfont color=#990000)/fontsetBackgroundColorfont color=#990000:(/fontNSColorfont color=#990000*)/fontcolorbr /nbsp;nbsp;nbsp;nbsp;font color=#FF0000{/fontbr /nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;ifont color=#9A1900// Use the private property to set the background colour, so it/font/ibr /nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;ifont color=#9A1900// handles the memory management bollocks/font/ibr /nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;font color=#990000[/fontself _setBackgroundColorfont color=#990000:/fontcolorfont color=#990000];/fontbr /nbsp;nbsp;nbsp;nbsp;br /nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;font color=#990000[/fontview setBackgroundColorfont color=#990000:[/fontself _backgroundColorfont color=#990000]];/fontbr /nbsp;nbsp;nbsp;nbsp;font color=#FF0000}/fontbr /nbsp;nbsp;nbsp;nbsp;br /nbsp;nbsp;nbsp;nbsp;font color=#990000.../fontbr /nbsp;nbsp;nbsp;nbsp;br /nbsp;nbsp;nbsp;nbsp;@endbr //code
pWith that technique, it#8217;s possible to completely directly setting ivars, and thus avoid code-retain/code and code-release/code altogether. (You#8217;ll still need to use code-autorelease/code at various times, of course, but that#8217;s reasonably rare.) We have some source code files that are well over 2000 lines of code without a single explicit code[_ivar retain];/code or code[_ivar release];/code call thanks to this technique. (Yeah, 2000 lines is also large and the class needs refactoring, but that#8217;s another story.)/p
pOf course, you could just a href=http://www.mac-developer-network.com/podcasts/lnc/lnc036/use garbage collection/a which avoids 99% of the need for this bollocks:/pcodenbsp;nbsp;nbsp;nbsp;font color=#990000-/font font color=#990000(/fontfont color=#009900void/fontfont color=#990000)/fontsetBackgroundColorfont color=#990000:(/fontNSColorfont color=#990000*)/fontcolorbr /nbsp;nbsp;nbsp;nbsp;font color=#FF0000{/fontbr /nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;ifont color=#9A1900// Yay GC!/font/ibr /nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;selffont color=#990000-gt;/font_backgroundColor font color=#990000=/font colorfont color=#990000;/fontbr /nbsp;nbsp;nbsp;nbsp;br /nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;font color=#990000[/fontview setBackgroundColorfont color=#990000:/fontselffont color=#990000-gt;/font_backgroundColorfont color=#990000];/fontbr /nbsp;nbsp;nbsp;nbsp;font color=#FF0000}/fontbr //code
pBut plenty of us don#8217;t have that luxury yet. (iPhone, ahem.)/p
-
Posted: January 5th, 2009, 3:34pm CET
pFor the UNIX users out there who use the a href=http://git.or.cz/git/a revision control system with the oldskool a href=http://www.greenwoodsoftware.com/less/less/a pager, try adding the following to your code~/.gitconfig/code file:/p
precode[core]
# search for core.pager in
# lt;http://www.kernel.org/pub/software/scm/git/docs/git-config.htmlgt;
# to see why we use this convoluted syntax
pager = less -$LESS -SFRX -SR +'/^---'
/code/pre
pThat#8217;ll launch less with three options set:/p
ul
licode-S/code: chops long lines rather than folding them (personal preference),/li
licode-R/code: permits ANSI colour escape sequences so that emgit/em#8217;s diff colouring still works, and/li
licode+'/^---'/code: sets the default search regex to code^---/code (find code---/code at the beginning of the line), so that you can easily skip to the next file in your pager with the coden/code key./li
/ul
pThe last one#8217;s the handy tip. I browse commits using codegit diff/code before committing them, and like being able to jump quickly back and forth between files. Alas, since emless/em is a dumb pager and doesn#8217;t understand the semantics of diff patches, we simply set the find regex to code^---/code, which does what we want./p
pOf course, feel free to change the options to your heart#8217;s content. See the a href=x-man-page://1/lesscodeless(1)/code manpage/a for the gory details./p
pAs the comment in the configuration file says, you#8217;ll need to use the convoluted codeless -$LESS -SFRX/code prefix due to a href=http://www.kernel.org/pub/software/scm/git/docs/git-config.htmlinteresting git behaviour/a with the codeLESS/code environment variable:/p
blockquote
pNote that git sets the LESS environment variable to codeFRSX/code if it is unset when it runs the pager. One can change these settings by setting the codeLESS/code variable to some other value. Alternately, these settings can be overridden on a project or global basis by setting the codecore.pager/code option. Setting codecore.pager/code has no affect on the codeLESS/code environment variable behaviour above, so if you want to override git#8217;s default settings this way, you need to be explicit. For example, to disable the codeS/code option in a backward compatible manner, set codecore.pager/code to codeless -+$LESS -FRX/code. This will be passed to the shell by git, which will translate the final command to codeLESS=FRSX less -+FRSX -FRX/code./p
/blockquote
p(And sure, I could switch to using a different pager, but I#8217;ve been using emless/em for more than a decade. Yep, I know all about Emacs amp; Vim#8217;s diff-mode and a href=http://changesapp.com/Changes.app/a. It#8217;s hard to break old habits.)/p
-
Posted: January 5th, 2009, 12:09pm CET
pI see James Polley posted about a title=Shittyrail fail again href=http://zhasper.com/?p=761City Rail/a once again changing how they measure something to make their figure look better instead of solving the problem. I#8217;d like to add last week to the list of complaints. Between 29 December and 2 January (4 working days for me) I was force to put up with City Rail running trains to a Saturday timetable while still feeling they should charge me a peak hour rail fare. If you want to operate an off peak service then try charging for it./p
-
Posted: January 5th, 2009, 8:17am CET
pFor a little personal project I’ve been working on recenly, I
needed to create some unit tests for a CGI script, sorry, that should
be, ema cloud computing application/em. Of course, I turned to my
trusty hammer, a href=http://python.orgPython/a, and was a
little disappointed to discover it didn’t quite have the batteries
I needed included./p
pI kind of thought that urllib2 would more or less do what I wanted
out of the box, but unfortunately it didn’t and (shock, horror!) I actually
needed to write some code myself! The first problem I ran into is that
urllib2 only supports strongGET/strong and strongPOST/strong out
of the box. HTTP is constrained enough in the verbs it provides, so I really
do want access to things like strongPUT/strong, strongDELETE/strong
and strongHEAD/strong./p
pThe other problem I ran into, is that I did’t want things automatically
redirecting (although clearly this would be the normal use-case), because I
wanted to check I got a redirect in certain cases./p
pThe final problem that I had is that only status code strong200/strong
is treated as success, and other 2xx codes raise exceptions. This
is generally emnot/em what you want, since strong201/strong, is
a perfectly valid return code, indicating that new resource was created./p
pSo, urllib2 is billed as qAn extensible library for opening URLs
using a variety of protocols/q, surely I can just extend it to do
what I want? Well, it turns out that I can, but it seemed to be harder
than I was expecting. Not because the final code I needed to write was
difficult or involved, but because it was quite difficult to work out
what the right code to write is. I want to explore for a little bit
why (I think) this might be the case./p
purllib2 is quite nice, because
simple things (fetch a URL, follow redirects, POST data), are very
easy to do:/p
code
ret = urllib2.urlopen(http://some_url/)
data = ret.read()
/code
pAnd, it is definitely empossible/em to do more complex things, but
(at least for me), there is a sharp discontinuity in the API which means
that learning the easy API doesn’t help you learn the more complex API,
and also the documentation (at least as far as I read it), doesn’t make
it apparent that there are kind of two modes of operation./p
pThe completely frustrating thing is that the documentation emin
the source file/em is much better than the online documentation!
Since it talks about some of the things that happen in the module,
which are otherwise “magic”./p
pFor example, the codebuild_opener/code function is pretty
magical, since it does a bunch of introspection, and ends up either
emadding/em a handler or emreplacing/em a handler depending on
the class. This is explained in the code as: q if one of the
argument is a subclass of the default handler, the argument will be
installed instead of the default. /q, which to me makes a lot of
sense, where-as the online documentation describes it as: q
Instances of the following classes will be in front of the handlers,
unless the handlers contain them, instances of them or subclasses of
them: ....lt;list of default handlersgt;/q. For me the former is
emmuch/em clearer than the latter!/p
pAnyway, here is the code I ended up with:/p
pre
opener = urllib2.OpenerDirector()
opener.add_handler(urllib2.HTTPHandler())
def restopen(url, method=None, headers=None, data=None):
if headers is None:
headers = {}
if method is None:
if data is None:
method = GET
else:
method = POST
return opener.open(HttpRestRequest(url, method=method,
headers=headers, data=data))
/pre
pSo, conclusions, if the dos don’t make sense, read the code.
If you are writing an API, try to make it easier to get from the
easy case to the more complex case. (This is quite difficult to
do, and I have definitely been guilty in the past of falling into
the same trap in APIs I have provided!). If you can’t get the
API to easily transition from easy to hard, make sure you document
it well. Finally, Python is great language for accessing
services over HTTP, even if it does require a little bit of work
to get the framework in place./p
-
Posted: January 5th, 2009, 6:39am CET
My vacation scholarship started today. I'm sitting in one of the honours offices slowly summarising from the textbook I've been assigned to understand. It's the sequel to the analysis textbook I used in second year, so I'm familiar with the author's writing style and standard methods of proof. I loved that course not only from the front and from behind, but from every sequence converging to it in Rsup3/sup, so I'm enjoying it so far. For those that way inclined, I'm looking at derivatives of measures and absolute continuity.br /The office you occupy during a vacation scholarship is usually the one you stay in for your honours year, so I'll spend some time making the place comfortable. It seems like a good place to work.
-
Posted: January 4th, 2009, 11:00pm CET
Here's a rare thing. Something of value actually enters the public domain (in some parts of the world):br /br /a href=http://entertainment.timesonline.co.uk/tol/arts_and_entertainment/tv_and_radio/kids_tv/article5415854.ecePopeye the Sailor copyright free 70 years after Elzie Segar's death - Times Online/abr /br /... though I fear that Popeye will now be portrayed as a victim of 'weak' copyright protection legislation and used to encourage law makers to extend copyright terms yet again.br /br /I hope, instead, that we see some excellent derivative Popeye works over the next year that show value in the economy, and that this strengthens the arguments for resisting copyright term extension, and perhaps even for shortening those terms to more useful levels for the wider economy.
-
Posted: January 4th, 2009, 10:31pm CET
pRight, so we all know that a href=http://www.theage.com.au/news/home/technology/optus-makes-it-harder-to-call-home/2008/12/26/1230399085370.htmlOptus decided to charge international call rates for some local numbers/a, to try to claw back some of the money they#8217;re losing as customers choose cheaper options to call home. A more sensible option would be to provide reasonable rates to existing customers - or set up such a span class=capsVOIP/span service yourself, and let customers choose between the cheaper lower-quality span class=capsVOIP/span service, or paying more for a #8220;premium#8221; connection[1] - and maybe even snagging some customers from other carriers. That woud be hard though - so instead, lets just slug prepaid customers with additional fees to access the span class=capsVOIP/span services, and pray that not too many of them port their service to a differentnbsp;provider./p
pBut that#8217;s just stupidity. a href=http://business.smh.com.au/business/dial-x-for-optus-20090104-79vl.htmlThis/a is outrightnbsp;theft:/p
blockquotepThe most recent legal case, decided on November 27, also forced Optus to concede it had stolen 100 numbers from a tiny telecommunications carrier in Vanuatu and then allowed a pair of its pornographer partners, Global Internet Billing in Britain and span class=capsMDC/span in Europe, to use the stolen numbers for theirnbsp;business./p
pOptus then kept the proceeds of these calls, money which would have normally been payable to the Vanuatunbsp;carrier./p/blockquote
p[1] Of course, the difference would probably be entirely in the marketing and not in the implementation of the service, but that#8217;s nothingnbsp;new./p
div class=feedflare
a href=http://feedproxy.google.com/~f/zhasper?a=sWmAezG4img src=http://feedproxy.google.com/~f/zhasper?d=41 border=0 //a a href=http://feedproxy.google.com/~f/zhasper?a=pjKHuyAximg src=http://feedproxy.google.com/~f/zhasper?d=45 border=0 //a a href=http://feedproxy.google.com/~f/zhasper?a=sNKZnHy9img src=http://feedproxy.google.com/~f/zhasper?i=sNKZnHy9 border=0 //a a href=http://feedproxy.google.com/~f/zhasper?a=RuvnEE2nimg src=http://feedproxy.google.com/~f/zhasper?d=52 border=0 //a a href=http://feedproxy.google.com/~f/zhasper?a=ml1NbQm0img src=http://feedproxy.google.com/~f/zhasper?d=243 border=0 //a a href=http://feedproxy.google.com/~f/zhasper?a=f49FkYVBimg src=http://feedproxy.google.com/~f/zhasper?i=f49FkYVB border=0 //a
/divimg src=http://feedproxy.google.com/~r/zhasper/~4/wsElsrvOVcI height=1 width=1 /
-
Posted: January 4th, 2009, 10:19pm CET
pRemember when Cityrail decided that trying to get trains to run on time was too hard, so they just a href=http://www.smh.com.au/articles/2004/06/10/1086749842501.htmlredefined #8220;on time#8221; to make thingsnbsp;easier/a?/p
pRemeber how shortly afterwards Cityrail had posters all over the stations with graphs showing the huge increase in on-time running compared to the same time last year - and didn#8217;t mention that the two sets of numbers used different definitions of #8220;onnbsp;time#8221;?/p
pThey#8217;re a href=http://www.smh.com.au/news/national/train-crush-load-limit-to-triple/2009/01/03/1230681809446.htmldoing it again/a. Cityrail has a target of no more than 5% of services running at more than 135% passenger capacity - but over the last two years, the actual figure has been 16%. Rather than trying to fix the problem, they#8217;re redefining the target to benbsp;17%./p
pKeep in mind that this is not 16% of services at full capacity: this is 16% of services at least 35% *over* the rated capacity of thenbsp;carriage./p
pWell donenbsp;Shittyfail!/p
div class=feedflare
a href=http://feedproxy.google.com/~f/zhasper?a=k38Ra4Blimg src=http://feedproxy.google.com/~f/zhasper?d=41 border=0 //a a href=http://feedproxy.google.com/~f/zhasper?a=qi6hOpAEimg src=http://feedproxy.google.com/~f/zhasper?d=45 border=0 //a a href=http://feedproxy.google.com/~f/zhasper?a=k3TNfoIrimg src=http://feedproxy.google.com/~f/zhasper?i=k3TNfoIr border=0 //a a href=http://feedproxy.google.com/~f/zhasper?a=OGnf8YUWimg src=http://feedproxy.google.com/~f/zhasper?d=52 border=0 //a a href=http://feedproxy.google.com/~f/zhasper?a=QP0rWbP9img src=http://feedproxy.google.com/~f/zhasper?d=243 border=0 //a a href=http://feedproxy.google.com/~f/zhasper?a=691GXZ7Zimg src=http://feedproxy.google.com/~f/zhasper?i=691GXZ7Z border=0 //a
/divimg src=http://feedproxy.google.com/~r/zhasper/~4/hnHxu9q0ed8 height=1 width=1 /
-
Posted: January 4th, 2009, 12:42pm CET
pI spent the last few days doing some nice research for Vquence, where I was able to watch lots of videos on YouTube. Fun job this is! img src=http://blog.gingertech.net/wp-includes/images/smilies/icon_smile.gif alt=:-) class=wp-smiley / The full article is on the a href=http://www.vquence.com.au/metrics-blog.htmlVquence metrics blog/a./p
pOne of the key things that I#8217;ve put together is a list of top 10 commercials for 2008:/p
table border=1
tbody
tr
tdstrongRank /strong/td
tdstrong Video/strong/td
tdstrong Views /strong/td
tdstrong Added/strong/td
/tr
tr
td 1/td
tda href=http://www.youtube.com/watch?v=TnzFRV1LwIo title=Cadbury Gorilla AdCadbury - Gorilla/a/td
td3,338,011/td
tdAugust 31, 2007/td
/tr
tr
td 2/td
tda href=http://www.youtube.com/watch?v=anwlpTgbQTE title=Nike Superbowl adNike - Take it to the NEXT LEVEL /a/td
td3,184,329/td
tdApril 28, 2008/td
/tr
tr
td 3/td
tda href=http://www.youtube.com/watch?v=GBCfW9-hjKI title=Macbook Air adMacbook Air/a/td
td2,648,717/td
tdJanuary 15, 2008/td
/tr
tr
td 4/td
tda href=http://www.youtube.com/watch?v=zKAW96N-Vms title=Insurance adCentraal Beheer Insurance - Gay Adam/a/td
td2,512,425/td
tdMay 30, 2008/td
/tr
tr
td 5/td
tda href=http://www.youtube.com/watch?v=yi1Jy5i88Zw title=Vodafone beatbox adVodafone - Beatbox/a/td
td2,380,237/td
tdMarch 17, 2008/td
/tr
tr
td 6/td
tda href=http://www.youtube.com/watch?v=6vW9gUmooFg title=Trading Baby AdE*Trade - Trading Baby/a/td
td2,061,818/td
tdFebruary 01, 2008/td
/tr
tr
td 7/td
tda href=http://www.youtube.com/watch?v=-BddCq1zFI4 title=Guitar Hero AdGuitar Hero - Heidi Klum/a/td
td1,068,055/td
tdNovember 03, 2008/td
/tr
tr
td 8/td
tda href=http://www.youtube.com/watch?v=Fu9ibUWIq8A title=Bridgestone scream adBridgestone - Scream/a/td
td980,406/td
tdJanuary 30, 2008/td
/tr
tr
td 9/td
tda href=http://www.youtube.com/watch?v=I-XbmIntWn8 title=Bud Light adBud Light- Will Ferrell/a/td
td966,177/td
tdFebruary 04, 2008/td
/tr
tr
td10/td
tda href=http://www.youtube.com/watch?v=bpVP70U9LDg title=Follow your heart adCareerbuilder - Follow your heart/a/td
td605,465/td
tdFebruary 03, 2008/td
/tr
tr
tdFavorable mention/td
tda href=http://www.youtube.com/watch?v=4b4GkGMiBDQ title=OLPC John Lennon adOLPC - John Lennon/a/td
td527,953/td
tdDecember 25, 2008/td
/tr
tr
tdFavorable mention/td
tda href=http://www.youtube.com/watch?v=DLxq90xmYUs title=Blendtec iPhone 3g adBlendtec - iPhone 3G/a /td
td2,711,195/td
tdJuly 11, 2008/td
/tr
tr
tdFavorable mention/td
tda href=http://www.youtube.com/watch?v=zlfKdbWwruY title=Stride gum Matt dancing adStide Gum - Where the hell is Matt?/a/td
td15,859,204/td
tdJune 20, 2008/td
/tr
/tbody
/table
pEnjoy! And let me know in the comments if you know of any other video ad released in 2008 in the same ballpark number of views that is an actual tv-style commercial./p
-
Posted: January 4th, 2009, 10:30am CET
pAlmost a week ago today, Julia and I tied the knot./p
pimg alt=Julia and I signing the marriage certificate src=http://farm4.static.flickr.com/3114/3158068955_3e53cc0275.jpg?v=0 title=Julia and I signing the marriage certificate width=500 height=334 //p
pYou can find photos a href=http://flickr.com/photos/tags/julialindsay2008on Flickr/a, and highlights on a href=http://holmwood.id.au/~julia/Julia#8217;s brand new blog/a. /p
-
Posted: January 4th, 2009, 7:14am CET
pCopying a href=http://www.purecaffeine.com/2008/12/meme-2008/ title=Meme 2008Nathanael/a who stole if from a href=http://www.fifikins.net/index.php/2008/12/28/meme-2008/ title=Meme 2008Fiona/a, here’s a quick rundown of 2008, quesshy;tion and answernbsp;style:/p
pQ: strongWhat did you do in 2008 that you’d never done before?/strongbr /
A: Left the country and moved overshy;seas for half a year back to Germany to touch up my German, started freeshy;lancshy;ing propshy;erly, co-(un)organised Canberra’s very firstnbsp;a href=http://barcamp.org/ title=BarCamp: (un)conferences for awesome web people!BarCamp/a./p
pQ: strongDid you keep your new year’s resshy;oshy;lushy;tions, and will you make more for next year?/strongbr /
A: Much like Nat, I can’t rememshy;ber any of my new year’s resshy;oshy;lushy;tions from lastnbsp;year./p
pQ: strongDid anyone close to you give birth?/strongbr /nbsp;No./p
pQ: strongDid anyone close to you die?/strongbr /
During this past year not, but Blacky passing away on Christshy;mas Day last year is still fresh in our memshy;oshy;ries. We all miss the furry, barkingnbsp;bugger./p
pQ: strongWhat countries/states did you visit?/strongbr /
A: In Ausshy;tralia: Vicshy;toshy;ria for acronym title=Linux.conf.auspan class=capsLCA/span/acronym, acronym title=New South Walesspan class=capsNSW/span/acronym a number of times for work; abroad: Germany (Frankshy;furt am Main, Mainz and Berlin), Turkey (Istanshy;bul for acronym title=GNOME User’s and Developer’s Europe Conferencespan class=capsGUADEC/span/acronym) and the acronym title=United Kingdomspan class=capsUK/span/acronym for LugRashy;dionbsp;Live./p
pQ: strongWhat would you like to have in 2009 that you lacked in 2008?/strongbr /
A: To have have attended a number of more conshy;fershy;ences, or rather, not missed the ones with parshy;ticshy;ushy;lar speakshy;ers, notablynbsp;acronym title=Web Directions Southspan class=capsWDS/span/acronym./p
pQ: strongWhat was your biggest achieveshy;ment of the year?/strongbr /
A: Becomshy;ing more indeshy;penshy;dent as a result of my time in Europe and sumshy;monshy;ing the courage to get my most recent twonbsp;piercshy;ings./p
pQ: strongWhat was your biggest failure?/strongbr /
A: Not manshy;agshy;ing to organshy;ise a more thorshy;ough trip throughshy;out Europe alone through youth hostels and the like, partly due to money, partly due to time and partly due to my own negshy;ashy;tivenbsp;misshy;conshy;cepshy;tions./p
pQ: strongDid you suffer illness or injury?/strongbr /
Nothing seriousnbsp;thankshy;fully./p
pQ: strongWhat was the best thing you bought?/strongbr /
A: The acronym title=Australian Dollarspan class=capsAUD/span/acronym $1,800 return air ticket to Germany includshy;ing health insurshy;ance, closely folshy;lowed by my beloved black MacBook,nbsp;emLeno/em./p
pQ: strongWhose behavshy;iour merited celshy;eshy;brashy;tion?/strongbr /
A: Both Mum and a href=http://arcwhite.org/ title=Personal website and blog of Andy WhiteAndy/a for overshy;comshy;ing more pershy;sonal emcrap/em/p than any one person should put upnbsp;with.
pQ: strongWhose behavshy;iour made you appalled and depressed?/strongbr /
A: Appalled and depressed are strong words, and I’m pretty laid back, so nothing really gets on my nerves much—and more imporshy;tantly I try not to let someshy;thing bother me for more than half a year. So, with this in mind, the name that rises to the top of the bad people cesspool in recent memory probshy;ashy;bly include Senator Stephen Conroy for his a href=http://nocleanfeed.com/ title=No Clean Feed — Stop Internet Censorship in Australiapathetic Ausshy;tralian mandashy;tory clean feednbsp;idea/a./p
pQ: strongWhere did most of your money go?/strongbr /
A: Travel costs and design books, most of which were typogshy;rashy;phy books,nbsp;natshy;ushy;rally./p
pQ: strongWhat did you get really, really, really excited about?/strongbr /
A: My Europe trip, conferences—notably Canberra’s first BarCamp—and attendshy;ing a href=http://en.wikipedia.org/wiki/KitKatClub title=Wikipedia (en): KitKatClubKitty/a in Berlin. Oh, and curshy;rently still intershy;nally raving about the posshy;sishy;bilshy;ity of landing an excitshy;ing job (and thus stopshy;pingnbsp;freeshy;lancshy;ing)./p
pQ: strongWhat song will always remind you of 2008?/strongbr /
A: emKrishy;latie Kacheli/em by Evgeniy Krishy;lashy;tov, this amazing Russian tune that was overshy;laid on video on a a href=http://news.bmezine.com/category/modblog/ title=BME: Tattoo, Piercing and Body Modification NewsModBlog/a (acronym title=Not Safe For Workspan class=capsNSFW/span/acronym) video of the Russian Pain Theatre gang doing some awesome multi-#8203;tiered a href=http://wiki.bmezine.com/index.php/Suicide_Suspension title=BMEzine Wiki: Suicide Suspensionsuicidenbsp;susshy;penshy;sions/a./p
pQ: strongComshy;pared to this time last year, arenbsp;you:/strong/p
ul
lihappier or sadder?—happy as a clam at the time ofnbsp;writing;/li
lithinner or fatter?—went up a kilo or two but still thin asnbsp;usual;/li
liricher or poorer?—my bank stateshy;ments would indishy;cate little change, but I’ve accushy;mushy;lated new assets (booksnbsp;mostly)./li
/ul
pQ: strongWhat do you wish you’d done more of?/strongbr /
A: Parkour, rock climbshy;ing, andnbsp;travshy;elshy;ing./p
pQ: strongWhat do you wish you’d done less of?/strongbr /
A: Nothing really… maybe sleep a littlenbsp;less?/p
pQ: strongHow did you spend Christshy;mas?/strongbr /
A: With my Opa in Budenshy;heim, near Mainznbsp;(Germany)./p
pQ: strongDid you fall in love in 2008?/strongbr /
A: Big fatnbsp;negashy;tory./p
pQ: strongHow many one-#8203;night stands?/strongbr /
A:nbsp;Two./p
pQ: strongWhat was your favourite span class=capsTV/span program?/strongbr /
A: The Westnbsp;Wing./p
pQ: strongDid you make a friend with anyone that you didn’t know this time last year?/strongbr /
A: Yes, after entirely coinshy;cishy;denshy;tally meeting both Söda and his girlshy;friend, Eugenie from Canshy;berra all the way in Frankshy;furt. And to think in all the time I had known Söda he never menshy;tioned hisnbsp;girlshy;friend!/p
pQ: strongWhat was the best book you read?/strongbr /
A: emThe Eleshy;ments of Typoshy;graphic Style/em by Robertnbsp;Bringhurst./p
pQ: strongWhat was your greatshy;est musical disshy;covshy;ery?/strongbr /
A: a href=http://www.last.fm/music/Vibrasphere title=Last.fm: VibrasphereVibrashy;sshy;phere/a, an amazing proshy;gresshy;sive psyshy;trance group fromnbsp;Sweden./p
pQ: strongWhat did you want and get?/strongbr /
A: To improve my German and anbsp;MacBook./p
pQ: strongWhat did you want and not get?/strongbr /
A: An iPhone that wouldn’t become a paper weight when I were to take it home to Oz, and posshy;sishy;bly a romanshy;tic relashy;tionshy;ship. The iPhone is being taken care of hopeshy;fully thisnbsp;week./p
pQ: strongWhat was your favourite film of this year?/strongbr /
A: emDeath Proof/em, part of the Grindshy;house double set by Quentinnbsp;Taranshy;tino./p
pQ: strongWhat did you do on your birthshy;day, and how old were you?/strongbr /
A: Celshy;eshy;brated it in Budenshy;heim with my Mum, Opa, and German friends. Age:nbsp;undisshy;closed./p
pQ: strongWhat one thing would have made your year immeashy;surshy;ably more satshy;isshy;fyshy;ing?/strongbr /
A: To be with the many friends I left behind in Oz during my time innbsp;Europe./p
pQ: strongHow would you describe your pershy;sonal fashion concept in 2008?/strongbr /
A: Altershy;nashy;tive whilst approachshy;able and friendly? Just someshy;thing difshy;fershy;ent Inbsp;guess./p
pQ: strongWhat kept you sane?/strongbr /
A: Mum andnbsp;sleep./p
pQ: strongWhich celebrity/public figure did you fancy the most?/strongbr /
A: I don’t really romanshy;tishy;cally fancy any celebrishy;ties, but was quite hot for seeing Obama get into the Whitenbsp;House./p
pQ: strongWhat politshy;ishy;cal issue stirred you the most?/strongbr /
A: The thought that even still in my lifeshy;time the bolshy;locks that’s going on in the Middle East probshy;ashy;bly won’t be solved. That, and the aforeshy;menshy;tioned proshy;posed Ausshy;tralian Intershy;net filternbsp;bolshy;locks./p
pQ: strongWho did you miss?/strongbr /
A: Chewie our aging, barking furball of a lady, close friends from Canshy;berra andnbsp;Mum./p
pQ: strongWho was the best new person you met?/strongbr /
A: Eugenie Edquist, Mr. Söda’s lovelynbsp;girlshy;friend./p
pQ: strongTell us a valushy;able life lesson you learned in 2008./strongbr /
A: It goes likenbsp;this:/p
blockquote cite=http://klepas.org/feed/Merlin MannpFind your obsesshy;sion;br /
Every day, explain it to one person you respect;br /
Edit everyshy;thing, skip shortshy;cuts;br /
And try not to be a dick.br /
Get better at thenbsp;above./p/blockquote
pI’ve decided to skip the last quesshy;tion of which song lyric most sums up my year (I don’t know nor have the time right now to figure itnbsp;out)./p
hr /
pThat’s it for ’08. What aboutnbsp;you?/p
-
Posted: January 3rd, 2009, 10:47pm CET
pI’ve been setting up my new Android phone and found out that
the password handling code in the IMAP client doesn’t work so
well with my Dovecot IMAP server./p
pNow, I really can’t be bothered working out which side is doing it
wrong, but Dovecot expects your password to be contained in
double-quotes if it contains emspecial/em character. (No, I don’t
precisely know what those characters are!). And, of course, if you are
double-quoing the string, you then need to escape and double-quotes in
the password itself. Now, like I said, no idea of this is the correct
(according to the standard) behaviour, but it is the behaviour that I
have to deal with, since I can’t mess with the server. Of course,
the Android IMAP client doesn’t do this escaping, and so you get
an error message indicating your username / password is incorrect.
Frustratingly, the error message doesn’t pass on the information
from the server giving detail on exactly emwhat/em the problem is
so you are left guessing./p
pAnyway, it turns out if you manually escape the password that you give
to the Android email client things work fine. Of course, the SMTP server
doesn’t need this escaping, and fails if you do have it, so you need to
type in a different, unescaped, password for SMTP. Fun and games!/p
pLooking at the lastest source code for Android, it looks like
this has been properly fixed, so hopefully and upgrade to the
Cupcake branch in the near future will solve the problem./p
-
Posted: January 3rd, 2009, 12:39pm CET
p class=entry-titleFrom a href=http://www.davethehappysinger.com/blog/2009/01/02/my-new-years-resolution-be-a-proud-creationist/My New Year’s Resolution: Be A Proudnbsp;Creationist/a:/p
blockquotepThe second message was even more bizarre. After the excitement of the first message and the realisation that there was only Australian beer left and the sun hadn’t yet set, we were rapt to see the skywriter trace out the word ‘span class=capsTHE/span’. We gazed on as he added, ‘span class=capsCREATOR/span’. Intrigued, we cooed as the pilot scrawled ‘span class=capsIS/span’… and waited for thenbsp;payoff…/p
p‘a title=I'd have posted a photo to the blog if I knew anyone who gave a fuck enough to take one. href=http://flickr.com/photos/andybui/3155235999/span class=capsJESUS/span/a‘./p
pFuck. I mean, that’s not even embiblically/em accurate, surely! Jesus doesn’t come in until after the Triwizard Tournament! According to Genesis, Yahwehdidit. He was so clever, a title=Oops, said God, and smited His script supervisor href=http://skepticsannotatedbible.com/contra/accounts.htmlhe managed to create the world emtwice/em in two differentnbsp;orders/a!/p/blockquote
pSee, I lost interest in this even earlier: when I last saw this bit of drivel it had just turned into #8220;span class=capsThe/span#8221;, and I got bored and went back inside. For a few moments before that, the sky had proudly been advertisingnbsp;#8220;span class=capsTHC/span#8221;#8230;/p
p(Side note: I found this past via a pingback on Stilgherrian#8217;s post #8220;a href=http://stilgherrian.com/politics/telstra-you-goddam-bloody-idiotsTelstra, you goddam bloody idiots!/a#8221; - you#8217;ll have to read both posts to figure out thenbsp;connection)/p
div class=feedflare
a href=http://feedproxy.google.com/~f/zhasper?a=5FSO2wUEimg src=http://feedproxy.google.com/~f/zhasper?d=41 border=0 //a a href=http://feedproxy.google.com/~f/zhasper?a=h2LjeEmeimg src=http://feedproxy.google.com/~f/zhasper?d=45 border=0 //a a href=http://feedproxy.google.com/~f/zhasper?a=JIYc1k8bimg src=http://feedproxy.google.com/~f/zhasper?i=JIYc1k8b border=0 //a a href=http://feedproxy.google.com/~f/zhasper?a=AKPnf9wNimg src=http://feedproxy.google.com/~f/zhasper?d=52 border=0 //a a href=http://feedproxy.google.com/~f/zhasper?a=4M1F27LDimg src=http://feedproxy.google.com/~f/zhasper?d=243 border=0 //a a href=http://feedproxy.google.com/~f/zhasper?a=f8ZmJy1jimg src=http://feedproxy.google.com/~f/zhasper?i=f8ZmJy1j border=0 //a
/divimg src=http://feedproxy.google.com/~r/zhasper/~4/peA1DQnhJM4 height=1 width=1 /
-
Posted: January 3rd, 2009, 7:16am CET
pIn the context of a blog, with lots of posts from different years, how would copyright apply? Would each post on the blog have a separate copyright? Or would the blog have a copyright as a whole? Or is it up to the author how it should work?/p
pSay I added a footer to the bottom of my blog in the year 2005, which reads:/p
blockquotepCopyright © 2005 by Jeremy Visser. All rights reserved./p/blockquote
pem(Please note that the copyright notices in this post are purely for discussion and illustrative purposes, and are not intended to state the true copyrighted nature of any of the content on this website.)/em/p
pNow, it#8217;s the year 2009, so there seems to be two popular ways to update this kind of line:/p
ol
liCopyright © 2005-2009 by Jeremy Visser. All rights reserved./li
liCopyright © 2009 by Jeremy Visser. All rights reserved./li
/ol
pSo in the latter one, the copyright date is simply bumped up to 2009. Is it legal to arbitrarily bump the copyright expiration date like that without formal renewal?/p
pIn Australia, this is not a problem, as copyright expires 70 years after the author#8217;s death #8212; it has nothing to do with the publication date. In which case, it does not make sense to add a year to copyright declarations of Australian works. I think the following would do fine for me:/p
blockquotepCopyright © by Jeremy Visser. All rights reserved./p/blockquote
pIt would then be up to somebody to look up the date of my death to find out if any of my works are in the public domain./p
pSo why do we add dates to copyright notices? In the United States, the case is the same as Australia #8212; copyright expires 70 years after the death of an author./p
pI could not find any information on how copyright expiration applies to a corporation in Australia (after all, a corporation cannot die), but in the United States, copyright on a work produced by somebody as part of their official duties while working for a corporation expires 95 years after publication or 120 years after creation (whichever is shorter). In this case, adding dates to copyright notices emdoes/em make sense./p
pSo, it seems to me that the reason we all add dates to our copyright notices is because we are all sheep and simply copy each others#8217; copyright notices. Ironic, eh?/p
-
Posted: January 3rd, 2009, 2:28am CET
pVia a href=http://hardware.slashdot.org/article.pl?sid=09%2F01%2F02%2F1546214slashdot.org/a
(yes really, I still pull in the headlines, although the miracle of feed
readers has allowed me to confirm that yes, a href=http://arstechnica.com/Ars Technica/a is a better read), a site
called Journal Space, which hosted weblogs, a href=http://journalspace.com/this_is_the_way_the_world_ends/not_with_a_bang_but_a_whimper.htmllost
all their data/a. They only had a RAID setup as backup, that is, a system
that mirrors content between two disks and is designed to protect against disk
failure. If you've heard of RAID, you hopefully already know that it is emnot
the same as a backup/em: if software error or an accident or a malicious act
deletes data from one disk, the RAID setup faithfully mirrors it to the other
disk. If not, imagine that you have two magical whiteboards. One is copied
exactly to the other. If one magical whiteboard totally breaks down, excellent,
you have a full copy of your meeting notes and doodles on the other. (Note for
accuracy, not all RAID configurations produce a full mirror and sometimes the
mirror is spread over more than one spare disk. But you get the idea.) However,
if someone rubs something off the whiteboard, or falls over while holding a can
of solvent and splashes it on the first whiteboard, everything on it is
immediately deleted from the other./p
pInstead, for home machines you want, most likely, an incremental backup,
that is, a separate disk/machine with several copies of your data going back in
time. Your data as it was an hour ago. Your data as it was a day ago. Your data
as it was a month ago. And so on. I have snapshots of my data for every three
hours over the last two months. (Sensible backup programs will notice when data
is the same across two or more time periods and only store it once, so your
backup disk does not need to be so very much larger than your normal disk.)/p
pFor business systems you want both: the quick recovery from disk failure
that mirroring systems such as RAID offer, emand/em incremental backups. (I
don't maintain business grade systems, ask someone else for best practices if
you need them. Internally consistent database backups are something you want to
pay particular attention to.)/p
pI note this because in November I gave a href=http://users.puzzling.org/users/mary/Presentations/SLUG2008/a talk on
home backups for Linux/a at a href=http://www.slug.org.au/SLUG/a and
there is one other point of interest: do not trust third party providers to
have good backups. It is getting increasingly common to have a lot of your most
interesting data on someone else's servers: your email on Google's, your blog
over at wordpress.com, contact details for all your friends on Facebook, and so
on. But your provider can make both their own catastrophically bad decisions,
like Journal Space, and have their creditors suddenly sell their hard disks off
in a fire sale, as a href=http://blogs.zdnet.com/digitalcameras/?p=362happened to Digital
Railroad/a./p
pWhich is a big problem, because a lot of third party providers do not
provide an easy way to get your data ('easy' would be emboth/em a
documented API accessible from common programming languages emand/em an
installable application), and lots don't provide any way at all. (There's also
a whole batch of interesting issues to do with your comments or Wall postings
or whatever: you don't necessarily have the right to reproduce them and there
would be a href=http://autonomo.us/2008/12/new-thinking-on-privacy-and-data-portability/privacy
implications/a when allowing you to back them up and reproduce them on some
other side. LiveJournal, for one, solves this problem by not allowing easy
backups of comments left on your journal.)/p
pIf your email host, blog host, calendar host, documents host or social
networking host failed or deleted your account, how would you fare?/p
-
Posted: January 1st, 2009, 11:35pm CET
pFrom a href=http://ravenblack.livejournal.com/247823.htmlRavenBlack/a:/p
blockquote
bNew Year's Encouragements./b Instead of making pressurey resolutions for
yourself, make positive uplifting recommendations for other people. No
negativity allowed, and try not to even imply something negative (eg. quot;eat
betterquot; implies you were eating poorly, but quot;make delicious home-cooked meals
at least once a weekquot; is pretty cleanly positive, and quot;make more delicious
home-cooked meals because your cooking is greatquot; is better still.)
/blockquote
pAnyone with encouragements of this positive type may contact me via a href=http://puzzling.org/identity/onlinemy preferred method/a or a href=http://puzzlement.livejournal.com/my LiveJournal/a, if you have
access. (I am beginning, finally, to think about allowing comments on
puzzling.org directly, but it's not likely to happen very soon.)/p
pYou are hereby invited to do this in your own weblog./p
-
Posted: January 1st, 2009, 10:55pm CET
pThis post is basically a crash course in using a href=http://www.gnu.org/software/gdb/gdb/a to run and debug
low-level code. Learning to us a debugger effectively can
be much more powerful than ghetto codeprintf()/code and codeputc()/code
debugging. I should point out that I am far from a power-gdb user, and
am usually much more comfortable with codeprintf()/code and codeputc()/code,
so this is very much a beginners guide, written by a newbie. With those
caveats in mind, lets get started./p
pSo the first thing to do is to get our target up and running. For
this our target will be a virtual device running with a href=http://www.skyeye.org/index.shtmlSkyeye/a. When you start up
Skyeye and pass it the code-d/code flag, e.g: code$ skeye -c
config.cfg -d/code. This will halt the virtual processor and provide
an opportunity to attach the debugger. The debugger will be available
on a UNIX socket. It defaults to port code12345/code. Of course
a decent JTAG adapter should be able to give you the same type of
thing with real hardware./p
pNow, you run GDB: code$ arm-elf-gdb/code. Once gdb is running
you need to attach to the target. To do this we use:
code(gdb) target remote :12345/code. Now you can start the
code running with code(gdb) continue/code./p
pNow, just running the code isn’t very useful, you can do that already.
If you are debugging you probably want to step through the code.
You do this with the codestep/code command. You can step through
code line at-a-time, or instruction at-a-time. At the earliest stages
you probably want to use the codesi/code command to step through
instruction at-a-time./p
pTo see what you code is doing you probably want to be able to display
information. For low-level start up code, being able to inspect the register
and memory state is import. You can look at the register using the
codeinfo registers/code command, which prints out all the general-purpose
registers as well as the program counter and status registers./p
pFor examing memory the codex/code command is invaluable. The
examine command takes a memory address as an argument (actually, it
can be a general expression that quates to a memory address). The
command has some optional arguments. You can choose the number of
units to display, the format to display memory in (hex (x), decimal
(d), binary (t), character (c), instruction (i), string(s), etc), and
also the unit size (byte (b), halfword (h), word (w)). So, for
example to display the first five words in memory as hex we can do:
code(gdb) x /5x 0x0/code. If we want to see the values of
individual bytes as decimal we could do: code(gdb) x /20bd 0x0/code.
Another common example is to display the next 5 instructions, which can
be done with code(gdb) x /5i $pc/code. The code$pc/code expression
returns the value in the codepc/code register./p
pPoking at bits and bytes and stepping instruction at a time is
great for low-level code, but gdb can end up being a lot more useful
if it knows a little bit more about the source code you are
debugging. If you have compiled the source code with the
code-g/code option, your ELF file should have the debugging
information you need embedded in it. You can let gdb know about this
file by using the code(gdb) symbol program.elf/code. Now
that you actually have symbols and debugging information, you can
do things like normal then codestep/code command, and it will
step through lines of source code (rather than instructions)./p
pThe other nice thing you have is that you can easily set
breakpoint and watchpoints. (You don’t emhave/em to have
source debugging enabled for this, but it makes things a lot easier!).
Seting a breakpoint is easy, you can set it on a line e.g: code(gdb) break file.c:37/code,
or on a particular function e.g: code(gdb) break schedule/code.
Breakpoints are neat, but watchpoints are even cooler, since you can
test for a specific conditions e.g: code(gdb) watch mask 2000/code.
/p
pNow that you have these nice watchpoints and breakpoints, you
probably find that most of the time, you just end up printing out some
variables each time you hit the point. To avoid this repetitive typing
you can use the codedisplay/code command. Each expression you
install with the display command will be printed each time program execution
stops (e.g: you hit a break-point or watch-point). This avoids a lot
of tedious typing!/p
pSo, this is of course just scratching the surface. One final thing
to consider that will likely make your time using gdb more useful and
less painful (i.e: less repetitive typing), is the codedefine/code
command which lets you create simple little command scripts. The other
is that when you start gdb you can pass a command script with the
code-x/code. So, you might want to consider, instead of littering
your code with printf() statements everywhere you might want to write
some gdb commands that enable a breakpoint and display some the relevant
data./p
pGood luck, and happy debugging!/p
-
Posted: January 1st, 2009, 8:43pm CET
pa href=http://benno.id.au/blog/2009/01/01/space_conserving_codeYesterday/a
we saw how with some careful programming, and the right compiler flags
we could get GCC to generate optimally small code for our particular
function. In this post we take a look at one of the ways in
which GCC emfails/em to produce optimal code. Now there
are actually many ways, but the I want to concentrate on in this post
is the use of literal pools./p
pSo, what is a emliteral pool/em? I’m glad you asked. The
literal pool is an area of memory (in the text segment), which is used
to store constants. These constants could be plain numerical
constants, but their main use is to store the address of variables
in the system. These addresses are needed because the ARM instruction
does not have any instructions for directly loading (or storing) an
address in memory. Instead codeldr/code and codestr/code can only
store at a ±12-bit offset from a register. Now there are lots of ways
you could generate code with this restriction, for example, you could ensure
your data section is less than 8KiB in size, and reserve a register
to be used as a base for all data lookups. But such approach only works
if you have a limited data section size. The standard approach that is
taken is that when a variable is used its address is written out
into a literal pool. The compiler then generates two instructions, first
to read the address from this literal pool, and the second is the
instruction to access the variable./p
pSo, how exactly does this literal pool work? Well, so that a
special register is not needed to point at the literal pool, the
compiler uses the program counter (codePC/code) register as the
base register. The generated codes looks something like: codeldr r3,
[pc, #28]/code. That codes loads a value at a 28-byte offset from
the current value of codePC/code into the register
coder3/code. coder3/code then contains the address of the
variable we want to access, and can be used like: codeldr r1, [r3,
#0]/code, which loads the value of the variable (rather than the
address) into coder1/code. Now, as the codePC/code is used as
the base for the literal pool access, it should be clear that the
literal pool is stored close enough to the code that needs to use it./p
pTo ensure that the literal pool is close enough to the code using it,
the compiler stores a literal pool at the end of each function. This
approach works pretty well (unless you have a 4KiB+ function, which
would be silly anyway), but can be a bit of a waste./p
pTo illustrate the problem, consider this (contrived) example code:/p
pre
static unsigned int value;
unsigned int
get_value(void)
{
return value;
}
void
set_value(unsigned int x)
{
value = x;
}
/pre
pNow, while this example is contrived, the pattern involved exhibits
itself in a lot of real-world code. You have some private data in a
compilation unit (codevalue/code), and then you have a set of
accessor (codeget_value/code) and mutator (codeset_value/code)
functions that operate on the private data. Usually the functions would
be more complex than in our example, and usually there would be more
than two. So lets have a look at the generated code:/p
pre
00000000 lt;get_valuegt;:
get_value():
0: 4b01 ldr r3, [pc, #4] (8 lt;get_value+0x8gt;)
2: 6818 ldr r0, [r3, #0]
4: 4770 bx lr
6: 46c0 nop (mov r8, r8)
8: 00000000 .word 0x00000000
8: R_ARM_ABS32 .bss
0000000c lt;set_valuegt;:
set_value():
c: 4b01 ldr r3, [pc, #4] (14 lt;set_value+0x8gt;)
e: 6018 str r0, [r3, #0]
10: 4770 bx lr
12: 46c0 nop (mov r8, r8)
14: 00000000 .word 0x00000000
14: R_ARM_ABS32 .bss
/pre
pYou can see that each function has a literal pool (at address 0x8
and 0x14). You can also see that there is a relocation associated with
each of these addresses (codeR_ARM_ABS32 .bss/code). This
relocation means that at link time the address of codevalue/code
will be stored at locations 0x8 and 0x14. So, what is the big deal
here? Well, there are two problems. First, we have two literal pools
containing duplicate data, by storing the address of
codevalue/code twice, we are wasting 4 bytes (remember from
yesterday, we have a very tight memory budget and we care where every
byte goes). The second problem, is that we need to insert a codenop/code
in the code (at address 0x6 and 0x12), because the literal pool must
be aligned./p
pSo, how could the compiler be smarter? Well, if instead of generating
a literal pool for each individual function it did it for the whole
compilation unit, then instead of having lots of little literal pools
with duplicated data through-out, we would have a single literal pool
for the whole file. As a bonus, you would only need alignment once as well!
Obviously if the compilation unit ends up being larger than 4KiB then
you have a problem, but in this case you could still save up producing the
literal pool until after 4KiB worth of code. As it turns out the commercial
compiler from ARM, RVCT, does exactly this. So lets have a look at the code
it generates:
/p
pre
00000000 lt;get_valuegt;:
get_value():
0: 4802 ldr r0, [pc, #8] (c lt;set_value+0x6gt;)
2: 6800 ldr r0, [r0, #0]
4: 4770 bx lr
00000006 lt;set_valuegt;:
set_value():
6: 4901 ldr r1, [pc, #4] (c lt;set_value+0x6gt;)
8: 6008 str r0, [r1, #0]
a: 4770 bx lr
c: 00000000 .word 0x00000000
c: R_ARM_ABS32 .data$0
/pre
pYou see that the code is more or less the same, but there is just
one literal pool right at the end of the file, and no extra
codenop/codes are needed for alignment. Without merging literal
pools we have a .text size of 24 bytes, with the merging we slash
that down to 16 bytes./p
pSo merging literal pools is pretty good, but the frustrating thing is
that in this example, emwe don’t even need the literal pool!/em. If
we examine the final compiled image for this program:/p
pre
Disassembly of section ER_RO:
00008000 lt;get_valuegt;:
get_value():
8000: 4802 ldr r0, [pc, #8] (800c lt;set_value+0x6gt;)
8002: 6800 ldr r0, [r0, #0]
8004: 4770 bx lr
00008006 lt;set_valuegt;:
set_value():
8006: 4901 ldr r1, [pc, #4] (800c lt;set_value+0x6gt;)
8008: 6008 str r0, [r1, #0]
800a: 4770 bx lr
800c: 00008010 .word 0x00008010
Disassembly of section ER_RW:
00008010 lt;valuegt;:
8010: 00000000 .word 0x00000000
/pre
pYou should notice that the actual location of the codevalue/code variable is
code0x8010/code. At address code0x800c/code we have the literal pool storing
the address of a variable emwhich is in the very next word!/em If we optimised this
by hand, we would end up with something like (need to verify the offset):/p
pre
Disassembly of section ER_RO:
00008000 lt;get_valuegt;:
get_value():
8000: 4802 ldr r0, [pc, #4] (8008 lt;set_value+0x8gt;)
8002: 4770 bx lr
00008004 lt;set_valuegt;:
set_value():
8004: 6008 str r0, [pc, #0]
8006: 4770 bx lr
Disassembly of section ER_RW:
00008008 lt;valuegt;:
8008: 00000000 .word 0x00000000
/pre
pIf we get rid of the literal pool entirely, we save the memory of the
literal pool itself (4 bytes), plus the two instructions need to load
values out of the literal pool (4 bytes). This cuts our text size down
to a total of only 8 bytes! This is a factor 3 improvement over the
GCC generated code. Granted, you are not always going to be able to
perform this type of optimisation, but when you care about size, it
is quite important. It would be nice if gcc supported a small data
section concept so that you could specify variables that essentially
resised within the literal pool instead of needing an expensive
(in terms of space and time) indirection./p
pFor this project, it looks like the code will have to be hand
tweaked assembler, which is frustrating, because when you use a person
as your compiler iterations become emreally/em expensive, and you
want to make sure you get your design right up front./p