<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>glee's blog</title>
  <link rel="alternate" type="text/html" href="http://www.debian.org.hk/blog/glee"/>
  <link rel="self" type="application/atom+xml" href="http://www.debian.org.hk/blog/50/atom/feed"/>
  <id>http://www.debian.org.hk/blog/50/atom/feed</id>
  <updated>2005-12-17T23:13:34+08:00</updated>
  <entry>
    <title>Flash ads, please make it stop</title>
    <link rel="alternate" type="text/html" href="http://www.debian.org.hk/blog/flash-ads-please-make-it-stop" />
    <id>http://www.debian.org.hk/blog/flash-ads-please-make-it-stop</id>
    <published>2009-10-16T14:37:12+08:00</published>
    <updated>2009-10-16T15:01:59+08:00</updated>
    <author>
      <name>glee</name>
    </author>
    <category term="Personal" />
    <category term="English" />
    <summary type="html"><![CDATA[<p>I really fricking hate Flash.  Not that you needed to be told this.  It kind of looks nice when it works, except when it crashes your browser.  It eats your CPU time and is buggy, there's a word we use to refer to software like that, it's 4 letters, starts in an s and ends in a t.</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>I really fricking hate Flash.  Not that you needed to be told this.  It kind of looks nice when it works, except when it crashes your browser.  It eats your CPU time and is buggy, there's a word we use to refer to software like that, it's 4 letters, starts in an s and ends in a t.</p>
<p>There's another reason not to like Flash though that's got less to do with the Flash program itself but more to do with how people use it.  More than ever advertisers are using Flash to display animated or interactive advertising on webpages.  That kind of nice in a way, I guess, because you can essentially build custom miniature apps in the advertising window.  I do have a problem when advertising starts interfering with what I do.  I mean, auto adverts with cars running across the screen?  How about video adverts which pop up and plays automatically (with sound!) when you load a news site, or a sound-only advertising that plays in the background that has no stop button?  I mean, really?  Seriously, isn't that going too far?  It's really distracting and really fricking annoying.  I've always felt that advertising agencies have a general hate towards content consumers.  I'll tell you the first thing I do when I see junk running across the screen or some video ad running just in the middle of when I'm reading the news, I tell the ad to f-off by clicking the "X" button in the corner (if there's one at all).  Ads, sure, but not like this, thanks.</p>
<p>All thanks for a fairly prominent Sydney-based newspaper which recently started doing this and pushed me over the limit, I've now got Click to Flash installed in Safari.  Now, Flash does not load automatically, it only loads when you click on the Flash window.  Why don't browsers come with these things by default (by the way, Safari already has a checkbox which allows you to disable Flash), all browsers should have a "Webpage De-annoy-alizer" tab in the Preferences window that allows you to do things like this.</p>
    ]]></content>
  </entry>
  <entry>
    <title>How NOT to write software</title>
    <link rel="alternate" type="text/html" href="http://www.debian.org.hk/blog/how-not-write-software" />
    <id>http://www.debian.org.hk/blog/how-not-write-software</id>
    <published>2009-10-03T21:46:51+08:00</published>
    <updated>2009-10-03T22:38:24+08:00</updated>
    <author>
      <name>glee</name>
    </author>
    <category term="Personal" />
    <category term="English" />
    <summary type="html"><![CDATA[<p>The embedded routers available on the market these days are truly wonderful things.  You buy one, it just works, you leave it there until there is a compelling reason to get a new one.  Everybody is happy.</p>
<p>Oops!  Just kidding!  That's the way things ought to work, but it never days.  Getting a router that works these days (perhaps with the exception of an Apple router, I guess) is largely a game of chance.  Even doing due diligence by reading online reviews will not save you.</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>The embedded routers available on the market these days are truly wonderful things.  You buy one, it just works, you leave it there until there is a compelling reason to get a new one.  Everybody is happy.</p>
<p>Oops!  Just kidding!  That's the way things ought to work, but it never days.  Getting a router that works these days (perhaps with the exception of an Apple router, I guess) is largely a game of chance.  Even doing due diligence by reading online reviews will not save you.</p>
<p>The particular one I have, a Dynalink RTA1046VW, which appears to be a rebadged Netcomm, does wireless and VOIP along with the usual Ethernet connection.  The wireless would, however, fail every couple of days.  It would just drop stone cold, and I'd have to reset it, but when I do the VOIP line would drop dead.  This, gentle reader, in case you have not realized now, is very annoying.  I thought the point of the wireless being there was so that you can use it?</p>
<p>Must be tough, writing router firmware, though I offer an alternative explanation.  Maybe the hardware manufacturers of these routers simply do not give a damn about the quality of the software they stick inside these routers.  A scary thought, millions of these devices powering the Intarwebs of the average Joe.  Most of the time the poor quality manifests itself in things that won't work, like my wireless module.  Sometimes they are a bit more egregious.</p>
<p>The particular router I have happens to run Linux.  You don't find any mention of this or the fact that it uses GPL software, because it is not advertised as such.  I am not a lawyer and do not know if  you're required to acknowledge the fact that there's GPL software on the router, but for 10 bucks they do offer to send you a CD with source code on it.</p>
<p>I found it it ran Linux when I started poking around with the router when I wanted to find out whether there was some misconfiguration that caused the wireless to drop out every couple of days.  They have the usual web interface but when I experimented with it, turns out they have a telnet interface.  It drops you into a custom command prompt with a set of built-in commands.  That's not unusual in itself, but the output was.</p>
<p>&gt; ps<br />
  PID  Uid     VmSize Stat Command<br />
    1 admin       316 S   init<br />
    2 admin           SW&lt; [ksoftirqd/0]<br />
    3 admin           SW&lt; [events/0]<br />
    4 admin           SW&lt; [khelper]<br />
    5 admin           SW&lt; [kblockd/0]<br />
   17 admin           SW  [pdflush]<br />
   18 admin           SW  [pdflush]<br />
   19 admin           SW  [kswapd0]<br />
   20 admin           SW&lt; [aio/0]<br />
[etc]<br />
&gt;</p>
<p>Say, what?  Busybox, is that you? Anyway, more on the ps output later.  There's a surprising whole load of things that you can do even when you are in the crappy customized shell.  For example, you can find out what kernel version it is running.</p>
<p>&gt; cat /proc/version<br />
Linux version 2.6.8.1 ( Compiled by michaelc) (gcc version 3.4.2) #1 Tue Apr 14 15:25:39 CST 2009<br />
&gt; </p>
<p>Linux 2.6.8.1 was released in 2004.  I got this router in 2009.  Dear firmware developer, what have you been doing for the last couple of years?</p>
<p>Back to the ps output.  What makes the ps output particular interesting is not the output format per se but what it shows:</p>
<p> 1126 admin      2404 S   rvsip<br />
 1127 admin      2404 S   rvsip<br />
 1128 admin      2404 S   rvsip<br />
 1216 admin       988 S   telnetd<br />
 1227 admin       312 S   sh -c ps<br />
 1228 admin       332 R   ps </p>
<p>It looks like they are using system(), which invokes sh -c, to call the ps command.  With that in mind, I can do this:</p>
<p> 1128 admin      2404 S   rvsip<br />
 1216 admin       988 S   telnetd<br />
 1229 admin       324 S   sh -c ps `cat /proc/version`<br />
 1232 admin       332 R   ps Linux version 2.6.8.1 ( Compiled by michaelc) (gcc</p>
<p>See?  I just got the shell to run another command for me outside of the customized shell.  That's not so interesting, but you can do useful things based on this.  For example, the customized shell does not come with a ls command, but it does come with an echo command.  So I can do this:</p>
<p>&gt; echo /bin/*<br />
/bin/adsl /bin/adslctl /bin/atm /bin/atmctl /bin/autoprovisionlan /bin/brctl /bin/busybox /bin/cat /bin/cfesetup /bin/cfm /bin/chmod /bin/date /bin/ddnsd /bin/df /bin/dhcpc /bin/dhcpd /bin/dhcpr /bin/dmesg /bin/dproxy /bin/dumpmem /bin/ebtables /bin/echo /bin/epi_ttcp /bin/ethctl /bin/false /bin/hotplug /bin/ifstat /bin/igmp /bin/ip /bin/iptables /bin/kill /bin/ln /bin/mkdir /bin/mount /bin/mpd /bin/msh /bin/nas /bin/nas4not /bin/netctl /bin/nstat /bin/ping /bin/pppd /bin/ps /bin/pvc2684ctl /bin/pvc2684d /bin/pwd /bin/rm /bin/rtacct /bin/rtstat /bin/rvsip /bin/sendarp /bin/setmem /bin/sh /bin/sntp /bin/ss /bin/sysinfo /bin/tc /bin/tftpd /bin/true /bin/udhcpd /bin/upnp /bin/voicectl /bin/wl /bin/wlctl<br />
&gt; </p>
<p>OK, this is really annoying.  I want a shell.</p>
<p>&gt; echo `/bin/sh`<br />
(no output)</p>
<p>That was disappointing.  However, from the output listed earlier we know sh -c is used to invoke busybox commands from the custom shell.  The -c argument takes a line of arbitary shell commands, all you have to do is separate it with a semicolon!  So, in theory, I should be able to run the /bin/sh command (or any arbitrary command) if I tacked on the command I wanted to run at the end.</p>
<p>&gt; echo; exec /bin/sh<br />
echo; exec /bin/sh: not found<br />
&gt;</p>
<p>OK, that didn't work.  But what if I separated the echo command and the semi-colon with a space?</p>
<p>&gt; echo ; exec /bin/sh</p>
<p>BusyBox v1.00 (2009.04.14-07:30+0000) Built-in shell (msh)<br />
Enter 'help' for a list of built-in commands.</p>
<p># </p>
<p>Aha!  Success!</p>
<p># help</p>
<p>Built-in commands:<br />
-------------------<br />
        . : break cd continue eval exec exit export help login newgrp<br />
        read readonly set shift times trap umask wait [ busybox cat chmod<br />
        date df dmesg echo expr false ifconfig init insmod kill klogd<br />
        linuxrc ln logger logread mkdir mount msh ping ps pwd reboot<br />
        rm rmmod route sendarp sh sysinfo syslogd test tftp tftpd top<br />
        true tty vconfig</p>
<p># </p>
<p>Next time, do yourself a favor and get a piece of hardware on which you can install custom software, it may require a bit more initial setup but is more likely to work and will almost not be shoddily cobbled together like mine.</p>
    ]]></content>
  </entry>
  <entry>
    <title>AsiaMiles, you suck</title>
    <link rel="alternate" type="text/html" href="http://www.debian.org.hk/blog-entry/asiamiles-you-suck" />
    <id>http://www.debian.org.hk/blog-entry/asiamiles-you-suck</id>
    <published>2008-02-01T10:08:43+08:00</published>
    <updated>2008-02-01T10:08:43+08:00</updated>
    <author>
      <name>glee</name>
    </author>
    <category term="Personal" />
    <category term="Traditional Chinese" />
    <summary type="html"><![CDATA[<p>So I wanted to contact AsiaMiles (which I haven't touched in a while, admittedly) to put some points back on for a recent flight.  Lost my membership number my email's gone stale so I can't retrieve it online, no problem ... ring them up and all you get is a automated response.  They won't put you through to a human operator until you have a membership number, apparently.</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>So I wanted to contact AsiaMiles (which I haven't touched in a while, admittedly) to put some points back on for a recent flight.  Lost my membership number my email's gone stale so I can't retrieve it online, no problem ... ring them up and all you get is a automated response.  They won't put you through to a human operator until you have a membership number, apparently.</p>
<p>OK... no problem.  I'll rejoin, and them call them up.  OK, no problem... I'll rejoin online, and them ring them up an then get them to give me a new one.  Oh nononono, it appears you have already joined!  Call our helpline (the automated response..)</p>
<p>All I want is my membership number!  Why can't I call you up and retrieve it?  You got to thank these morons for coming up with such plans... oh look!  we can replace it with a voice system to save costs!  Don't bother contacting us!</p>
<p>That's it.  I'm flying Qantas.</p>
<p>(By the way, Optus, you are not any much better when you put me through that voice recognition crap when I called tech support.)</p>
    ]]></content>
  </entry>
  <entry>
    <title>Personal information</title>
    <link rel="alternate" type="text/html" href="http://www.debian.org.hk/blog-entry/personal-information" />
    <id>http://www.debian.org.hk/blog-entry/personal-information</id>
    <published>2007-10-11T03:06:13+08:00</published>
    <updated>2007-10-11T03:06:13+08:00</updated>
    <author>
      <name>glee</name>
    </author>
    <category term="Personal" />
    <category term="English" />
    <summary type="html"><![CDATA[<p>What's up with companies asking for personal information that they don't really need, but they ask for it anyways?</p>
<p>Apparently to top up your prepaid mobile phone, you need to provide them with your email address.  What's up with that?  I left it out, which they promptly went, "wah!  we really need it!" ... so when you fill it in, they provide this information on the next webpage anyways.  Thanks guys, for letting me know what frigging retards you are, because you just told me you don't really need it.</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>What's up with companies asking for personal information that they don't really need, but they ask for it anyways?</p>
<p>Apparently to top up your prepaid mobile phone, you need to provide them with your email address.  What's up with that?  I left it out, which they promptly went, "wah!  we really need it!" ... so when you fill it in, they provide this information on the next webpage anyways.  Thanks guys, for letting me know what frigging retards you are, because you just told me you don't really need it. </p>
<p>By the way, I don't like the SMS advertisements they send me which I have no way to opt out of.  I have been thinking of switching, but it's a matter of finding who will piss me off the least...</p>
    ]]></content>
  </entry>
  <entry>
    <title>Rate limiting</title>
    <link rel="alternate" type="text/html" href="http://www.debian.org.hk/blog-entry/rate-limiting" />
    <id>http://www.debian.org.hk/blog-entry/rate-limiting</id>
    <published>2007-09-27T00:40:42+08:00</published>
    <updated>2007-09-27T00:40:42+08:00</updated>
    <author>
      <name>glee</name>
    </author>
    <category term="Personal" />
    <category term="English" />
    <summary type="html"><![CDATA[<p>It never fails to amaze me at the shoddy way that some Australian telcos decide to implement rate-limiting on Internet connections.  The way that this is done is, send as fast as you can, then drop everything.  Rinse, repeat, so that over a period of time, you get the rate that is advertised by the ISP.  This is broken, because it means that you cannot properly share an Internet connection, even just for one person.  For example, one could be legitimately uploading a bunch of photos online, and web-surfing at the same time.</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>It never fails to amaze me at the shoddy way that some Australian telcos decide to implement rate-limiting on Internet connections.  The way that this is done is, send as fast as you can, then drop everything.  Rinse, repeat, so that over a period of time, you get the rate that is advertised by the ISP.  This is broken, because it means that you cannot properly share an Internet connection, even just for one person.  For example, one could be legitimately uploading a bunch of photos online, and web-surfing at the same time.  The photos will be sent as fast as TCP will allow, and then, everything will be suddenly cut.  When you browse and send an HTTP request, it never gets through because everything is cut until the rate-limiting effect wears off.  Hence, you are left with a pretty poor experience.</p>
<p>Seriously, do these people employ people who got their CS degrees off the back of a Cornflakes box, or do they just plain try to get away with getting people to pay for the privilege of being pissed off at them for acting like complete jerks?</p>
    ]]></content>
  </entry>
  <entry>
    <title>Router troubles</title>
    <link rel="alternate" type="text/html" href="http://www.debian.org.hk/blog-entry/router-troubles" />
    <id>http://www.debian.org.hk/blog-entry/router-troubles</id>
    <published>2007-08-05T19:43:38+08:00</published>
    <updated>2007-08-08T13:47:02+08:00</updated>
    <author>
      <name>glee</name>
    </author>
    <category term="Personal" />
    <category term="English" />
    <summary type="html"><![CDATA[<p>Before I used to do NAT on a Linux, but nowadays I have (as have others) gotten lazy and just got a cheap ADSL/Cable router that does the NAT.  The one I was using died recently, I had to replace it.</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>Before I used to do NAT on a Linux, but nowadays I have (as have others) gotten lazy and just got a cheap ADSL/Cable router that does the NAT.  The one I was using died recently, I had to replace it.</p>
<p>You'd think it's quite simple, route some packets, provide some web interface to configure the router, but how come vendors find it so hard to get it right?  One which I replaced it with (which ran VXWorks) would pick up everything except for the ISP's default gateway via DHCP, rendering it completely useless as a router.  The current one would not allow me to initiate any connection, except for anything on port 80, when I get home from work.  I plug it in, I just want it to work.  But it doesn't, everytime I have to login and pretend to configure the router, and press apply, then mysteriously the ability to initiate new connections come back to life.  Oh, and the old one wasn't very good either.  Whenever I configure the router it would behave as if it required a reboot, because it would drop all my existing connections regardless of how trivial the change may be and whether it was actually necessary.   Seriously, the next one has to run Linux or BSD of some kind, instead of whatever useless garbage firmware is sitting in the flash ...</p>
    ]]></content>
  </entry>
  <entry>
    <title>Advertising calls</title>
    <link rel="alternate" type="text/html" href="http://www.debian.org.hk/blog-entry/advertising-calls" />
    <id>http://www.debian.org.hk/blog-entry/advertising-calls</id>
    <published>2007-06-05T01:23:07+08:00</published>
    <updated>2007-06-05T01:23:07+08:00</updated>
    <author>
      <name>glee</name>
    </author>
    <category term="Personal" />
    <category term="English" />
    <summary type="html"><![CDATA[<p>So, I haven't written for ... how long?  I lost count.   Yes, busy with boring work, instead choosing to write about the boring daily drivel, I just choose not to.</p>
<p>So .. .contrary to reports, I have not been run over by a bus, I am NOT dead yet.  I am alive and well.</p>
<p>So, how desperate is HK Broadband for IDD business?  Consider this.  Today, I got a call from a "private number" (my mother, usually).  "Hi, I am calling from Hong Kong Broadband in Hong Kong.  We've got a special deal for IDD HK &lt;-&gt;Australia".  On my mobile.</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>So, I haven't written for ... how long?  I lost count.   Yes, busy with boring work, instead choosing to write about the boring daily drivel, I just choose not to.</p>
<p>So .. .contrary to reports, I have not been run over by a bus, I am NOT dead yet.  I am alive and well.</p>
<p>So, how desperate is HK Broadband for IDD business?  Consider this.  Today, I got a call from a "private number" (my mother, usually).  "Hi, I am calling from Hong Kong Broadband in Hong Kong.  We've got a special deal for IDD HK &lt;-&gt;Australia".  On my mobile.</p>
<p>My first reaction was, "what the?!  How does that happen?!".  Considering the fact that my mobile is not published anywhere but my business card, and I still got a full box of them ... Yes, I am from Hong Kong, but how did my number get leaked?  I'd be very interested to know ...</p>
<p>Speaking of IDD, a friend of mine in town was mentioning it is actually cheaper in Australia to make an IDD call with a calling card than to make a local mobile call.  Go figure....</p>
    ]]></content>
  </entry>
  <entry>
    <title>Debian upgrade</title>
    <link rel="alternate" type="text/html" href="http://www.debian.org.hk/blog-entry/debian-upgrade" />
    <id>http://www.debian.org.hk/blog-entry/debian-upgrade</id>
    <published>2006-10-29T19:46:12+08:00</published>
    <updated>2006-10-29T19:58:12+08:00</updated>
    <author>
      <name>glee</name>
    </author>
    <category term="Debian" />
    <category term="English" />
    <summary type="html"><![CDATA[<p>I upgraded a -stable box to -testing.  Mostly went well, but in one or two cases ... well, not so well.</p>
<p>Random starting of daemons: Yes, this has been the case in Debian for a long time, however, it gets worse when a dependency pulls in a new daemon and restarts *that*, and suddenly you are left with a nice, blank page.  Actually, it didn't do that, but gave you a directory listing of what it *thinks* is the root www directory.  You're left wondering, why? (the culprit, by the way, is Apache2)</p>
<p>Stuff that does not work out of the box: I could not get Exim4 and mailman to play nicely.  First: Exim4 does not handle pipe transport out of the box, so none of the aliases stuck into /etc/aliases for mailman actually work until you uncomment it out.  Mailman does not play nicely because Exim starts with Debian-exim group, and mailman will whine because that's not what the default gid is configured to at compile-time.  The README files does contain some information on how to make it work .... but it was more like "Oh, just enable some random crap in your configuration file to make it work" ... hmm, nice work, considering the popularity of mailman as a mailing list software and exim as a MTA.</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>I upgraded a -stable box to -testing.  Mostly went well, but in one or two cases ... well, not so well.</p>
<p>Random starting of daemons: Yes, this has been the case in Debian for a long time, however, it gets worse when a dependency pulls in a new daemon and restarts *that*, and suddenly you are left with a nice, blank page.  Actually, it didn't do that, but gave you a directory listing of what it *thinks* is the root www directory.  You're left wondering, why? (the culprit, by the way, is Apache2)</p>
<p>Stuff that does not work out of the box: I could not get Exim4 and mailman to play nicely.  First: Exim4 does not handle pipe transport out of the box, so none of the aliases stuck into /etc/aliases for mailman actually work until you uncomment it out.  Mailman does not play nicely because Exim starts with Debian-exim group, and mailman will whine because that's not what the default gid is configured to at compile-time.  The README files does contain some information on how to make it work .... but it was more like "Oh, just enable some random crap in your configuration file to make it work" ... hmm, nice work, considering the popularity of mailman as a mailing list software and exim as a MTA.</p>
    ]]></content>
  </entry>
  <entry>
    <title>Google code</title>
    <link rel="alternate" type="text/html" href="http://www.debian.org.hk/blog-entry/google-code" />
    <id>http://www.debian.org.hk/blog-entry/google-code</id>
    <published>2006-10-07T01:21:54+08:00</published>
    <updated>2006-10-07T01:39:54+08:00</updated>
    <author>
      <name>glee</name>
    </author>
    <category term="Personal" />
    <category term="Traditional Chinese" />
    <summary type="html"><![CDATA[<p>How long haven't I written something?  Probably too long, but why?  Well, nothing really interesting has happened...</p>
<p>So what's been happening?  I guess the major thing was that I was fortunate enough to be in SF, CA (WWDC2006), though it was rather unfortunate that I could not fit attending LinuxWorld also, which was on at around the same time.  Speaking of Linux, LCA 2007 is just across the road, so that will be some extra incentive to attend.</p>
<p>Anyway, Google came out with a new search called Google Code ... in case you have not tried already, it searches through the Internet for code matching some particular pattern (yes, even if it is in a tarball gzipped/bz2).</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>How long haven't I written something?  Probably too long, but why?  Well, nothing really interesting has happened...</p>
<p>So what's been happening?  I guess the major thing was that I was fortunate enough to be in SF, CA (WWDC2006), though it was rather unfortunate that I could not fit attending LinuxWorld also, which was on at around the same time.  Speaking of Linux, LCA 2007 is just across the road, so that will be some extra incentive to attend.</p>
<p>Anyway, Google came out with a new search called Google Code ... in case you have not tried already, it searches through the Internet for code matching some particular pattern (yes, even if it is in a tarball gzipped/bz2).  Makes you wonder what Google is archiving these days ... and might teach me to be a bit more careful and think twice before writing "temporary" (which becomes permanent) crap code.  I was also reminded of some code which I wrote, some of which I did not remember at all (what?  I really patched a segfault in that? ... vaguely recall ...hmm..)  ... though I do vaguely recall that over the years I have patched more open source software than that.</p>
    ]]></content>
  </entry>
  <entry>
    <title>Hey gcc, you stink</title>
    <link rel="alternate" type="text/html" href="http://www.debian.org.hk/blog-entry/hey-gcc-you-stink" />
    <id>http://www.debian.org.hk/blog-entry/hey-gcc-you-stink</id>
    <published>2006-03-12T16:03:42+08:00</published>
    <updated>2006-03-12T16:21:42+08:00</updated>
    <author>
      <name>glee</name>
    </author>
    <category term="Debian" />
    <category term="English" />
    <summary type="html"><![CDATA[<p>I've just hit into a bug in gcc 4.x, it sucks to have a bug in your toolchain when that's probably the last thing you would ever suspect.</p>
<p>The code goes like this: </p>
<p>#include </p>
<p>struct d {<br />
    unsigned int lo, hi;<br />
};</p>
<p>static inline unsigned long long r(struct d x)<br />
{<br />
    return *(unsigned long long *)&amp;x;<br />
}</p>
<p>void<br />
g(unsigned long long x)<br />
{<br />
    printf("%llx\n", x);<br />
}</p>
<p>int<br />
main(void)<br />
{<br />
    struct d c;<br />
    c.lo = 0xdeadbeef;<br />
    c.hi = 0x2;</p>
<p>    g(r(c));<br />
    return(0);<br />
}</p>
<p>Compile with gcc -O2 -m32 ... </p>
<p>You'd expect to see 0x2deadbeef on a 32-bit little-endian machine, right?  No ... the top 32 bits get garbled.</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>I've just hit into a bug in gcc 4.x, it sucks to have a bug in your toolchain when that's probably the last thing you would ever suspect.</p>
<p>The code goes like this: </p>
<p>#include </p>
<p>struct d {<br />
    unsigned int lo, hi;<br />
};</p>
<p>static inline unsigned long long r(struct d x)<br />
{<br />
    return *(unsigned long long *)&amp;x;<br />
}</p>
<p>void<br />
g(unsigned long long x)<br />
{<br />
    printf("%llx\n", x);<br />
}</p>
<p>int<br />
main(void)<br />
{<br />
    struct d c;<br />
    c.lo = 0xdeadbeef;<br />
    c.hi = 0x2;</p>
<p>    g(r(c));<br />
    return(0);<br />
}</p>
<p>Compile with gcc -O2 -m32 ... </p>
<p>You'd expect to see 0x2deadbeef on a 32-bit little-endian machine, right?  No ... the top 32 bits get garbled.</p>
<p>It all works without -fstrict-aliasing (implicitly set with -O2).</p>
<p>On -Os, you get a big fat zero.</p>
<p>On a 64-bit machine ... you get a zero too.</p>
<p>The key, apparently is the inline.  If it's not inlined, then it all works .... sigh.</p>
    ]]></content>
  </entry>
  <entry>
    <title>webct</title>
    <link rel="alternate" type="text/html" href="http://www.debian.org.hk/blog-entry/webct" />
    <id>http://www.debian.org.hk/blog-entry/webct</id>
    <published>2006-02-04T11:25:00+08:00</published>
    <updated>2006-02-04T11:29:00+08:00</updated>
    <author>
      <name>glee</name>
    </author>
    <category term="Personal" />
    <category term="English" />
    <summary type="html"><![CDATA[<p>WebCT is a tool for E learning.  UNSW has one set up.  Unfortunately, I have the dubious honor of having to be put through it one last time for summer courses.</p>
<p>Is WebCT designed to:</p>
<p>(a) enhance user experience by presenting the user unusable interfaces,<br />
(b) help the university dispose of its money acquired via means of international students,<br />
(c) Promote new advances in foolproof interfaces by telling people, for example, not to resize windows during a test as they could "disappear",<br />
(d) What kind of moronic fuck wrote this pile of shit.</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>WebCT is a tool for E learning.  UNSW has one set up.  Unfortunately, I have the dubious honor of having to be put through it one last time for summer courses.</p>
<p>Is WebCT designed to:</p>
<p>(a) enhance user experience by presenting the user unusable interfaces,<br />
(b) help the university dispose of its money acquired via means of international students,<br />
(c) Promote new advances in foolproof interfaces by telling people, for example, not to resize windows during a test as they could "disappear",<br />
(d) What kind of moronic fuck wrote this pile of shit.</p>
    ]]></content>
  </entry>
  <entry>
    <title>sigh..</title>
    <link rel="alternate" type="text/html" href="http://www.debian.org.hk/blog-entry/sigh" />
    <id>http://www.debian.org.hk/blog-entry/sigh</id>
    <published>2006-01-31T20:18:50+08:00</published>
    <updated>2006-01-31T20:19:50+08:00</updated>
    <author>
      <name>glee</name>
    </author>
    <category term="Personal" />
    <category term="English" />
    <summary type="html"><![CDATA[<p>My powerbook requires an expensive trip back to Apple.</p>
<p>Just kill me now.</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>My powerbook requires an expensive trip back to Apple.</p>
<p>Just kill me now.</p>
    ]]></content>
  </entry>
  <entry>
    <title>laptop disk is dead..</title>
    <link rel="alternate" type="text/html" href="http://www.debian.org.hk/blog-entry/laptop-disk-dead" />
    <id>http://www.debian.org.hk/blog-entry/laptop-disk-dead</id>
    <published>2006-01-29T11:42:50+08:00</published>
    <updated>2006-01-29T11:46:50+08:00</updated>
    <author>
      <name>glee</name>
    </author>
    <category term="Debian" />
    <category term="English" />
    <summary type="html"><![CDATA[<p>Great, just not long after the warranty on the laptop runso out, the disk I think is going to die soon.  Fuck, thanks Apple.</p>
<p>It's another 200 dollars if I install it myself, not to mention the trouble of backing all that shit up and restoring it.</p>
<p>The disk made a very bad clunking noise some weeks ago.  I turned it off and turned it back on, seemed ok.  Now, it's happening again ...</p>
<p>Though I know a guy who had his disk fail when the cable went loose.  Maybe I should just take it apart (CAREFULLY so as not to void the warranty ...)</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>Great, just not long after the warranty on the laptop runso out, the disk I think is going to die soon.  Fuck, thanks Apple.</p>
<p>It's another 200 dollars if I install it myself, not to mention the trouble of backing all that shit up and restoring it.</p>
<p>The disk made a very bad clunking noise some weeks ago.  I turned it off and turned it back on, seemed ok.  Now, it's happening again ...</p>
<p>Though I know a guy who had his disk fail when the cable went loose.  Maybe I should just take it apart (CAREFULLY so as not to void the warranty ...)</p>
    ]]></content>
  </entry>
  <entry>
    <title>Symbian phones, and what&#039;s for dinner?</title>
    <link rel="alternate" type="text/html" href="http://www.debian.org.hk/blog-entry/symbian-phones-and-whats-dinner" />
    <id>http://www.debian.org.hk/blog-entry/symbian-phones-and-whats-dinner</id>
    <published>2006-01-12T21:27:55+08:00</published>
    <updated>2006-01-12T21:33:55+08:00</updated>
    <author>
      <name>glee</name>
    </author>
    <category term="Personal" />
    <category term="English" />
    <summary type="html"><![CDATA[<p>What is it with these Symbian phones?  Or is it just mine?  It's clunky, it's slow, it's got a crappy interface ... I do not know just _where_ to start.  Oh and buggy too ... Last night I put my phone through the battery charger ... OK ... when I wake up ... it's still charging...!!  Low battery!!  WTF?!</p>
<p>Ok ... fine.  I need to head off to the office so I take my uncharged phone (supposedly) and the charger with me.  Subject it to several more hours of charging.  WTF??!!  Same!</p>
<p>OK.  In frustration I reset the phone.  Full battery.  WTF?!<br />
Look: can we have a phone that just does _NOT_ suck?</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>What is it with these Symbian phones?  Or is it just mine?  It's clunky, it's slow, it's got a crappy interface ... I do not know just _where_ to start.  Oh and buggy too ... Last night I put my phone through the battery charger ... OK ... when I wake up ... it's still charging...!!  Low battery!!  WTF?!</p>
<p>Ok ... fine.  I need to head off to the office so I take my uncharged phone (supposedly) and the charger with me.  Subject it to several more hours of charging.  WTF??!!  Same!</p>
<p>OK.  In frustration I reset the phone.  Full battery.  WTF?!<br />
Look: can we have a phone that just does _NOT_ suck?</p>
<p>What happened to the days when phones were simple to use?  I like the bells and whistles on my phone, such as the memory card slot and the nice color screen and the camera, but that doesn't mean that it has to suck.</p>
<p>---</p>
<p>In other news, I'm cooking a lot these days.  [Note: doesn't mean that it tastes good.]  Cook in advance, put it in fridge, when you need to eat it take out a portion, slap on some sauce and put it in the microwave, and there's a meal ...</p>
    ]]></content>
  </entry>
  <entry>
    <title>hrm</title>
    <link rel="alternate" type="text/html" href="http://www.debian.org.hk/blog-entry/hrm" />
    <id>http://www.debian.org.hk/blog-entry/hrm</id>
    <published>2005-12-17T23:10:34+08:00</published>
    <updated>2005-12-17T23:13:34+08:00</updated>
    <author>
      <name>glee</name>
    </author>
    <category term="Debian" />
    <category term="English" />
    <summary type="html"><![CDATA[<p>I left Sydney just when the race riots were on.  Am I supposed to feel good that I'm not missing out on any fun because the WTO riots are just as interesting to watch?</p>
<p>Hrm, we live in interesting times.</p>
<p>(Yes, I am back in HK, for 2 weeks.  I don't think I mentioned it anywhere before, the arrangements were rather, er, adhoc, and it wasn't finalized until the very last minute).</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>I left Sydney just when the race riots were on.  Am I supposed to feel good that I'm not missing out on any fun because the WTO riots are just as interesting to watch?</p>
<p>Hrm, we live in interesting times.</p>
<p>(Yes, I am back in HK, for 2 weeks.  I don't think I mentioned it anywhere before, the arrangements were rather, er, adhoc, and it wasn't finalized until the very last minute).</p>
    ]]></content>
  </entry>
</feed>
