Undefined behaviour in C/C++

Hmmm. John Regehr’s posts on the implications of undefined behaviour in C/C++ are quite good. It seems like this is one of those reminders that should appear in highlighted, bold, capital letters every time I open a .cpp|.cc|.c|.h file. Maybe I’ll do that.

Posted in Uncategorized | Leave a comment

Keyboard volume control under awesome (window manager)

I recently (as in an hour ago) became frustrated with the process involved in pausing or muting music in order to respond to someone who was trying to command my attention. For instance, say I’ve got my sweet headphones on and I’m blasting Beethoven’s Moonlight Sonata really loudly into my ear canals. It is then rather painful to have to switch context to the other screen, mash the tag selection hotkeys until I land on the right “desktop” where audacious/mplayer/cvlc/xmms2 lives (because with 20 different views on tags you can easily forget where you keep everything), and finally to move my hand all the way over to the mouse, grab it, wave it around, and finally pause the music.

Then I noticed the volume control knob on this keyboard. So, after some Google-search-bashing, I managed to get it to work as my HP Pavilion’s keyboard did back in 1998 with Windows 95.

In awesome’s ~/.config/rc.lua, in the middle of the list of global hotkeys specified as the join of a list of these curious objects returned by awful.key():

...
awful.key({}, "#123", function () awful.util.spawn("aumix -v+") end),
awful.key({}, "#122", function () awful.util.spawn("aumix -v-") end),
...

Importantly, I found the keycodes for the control knob, 122 and 123, using xev. Run it, focus on the X window it creates, and observe the output for whatever input events you generate. You specify keycodes to awful.key with “#x”, x some (non-negative) integer, as discernible from the awesome FAQ.

I first used amixer, too. The command to increment/decrement volume was amixer sset Master 2dB+ (and 2dB-, respectively). Unfortunately, if I decremented below 0dB the volume ended up at -99999.99 dB and no amount of incrementing could resurrect it. I claimed that this was a bug and moved on, instead finding aumix, which is much simpler: aumix -v+ to increment, or -v- to decrement.

Posted in Uncategorized | Leave a comment

Beethoven’s Moonlight Sonata

Wikipedia tells me it’s actually “Piano Sonata No. 14 in C♯ minor “Quasi una fantasia”, Op. 27, No. 2″. I will learn to play the piano all over again if for nothing other than this piece.

Posted in Uncategorized | Leave a comment

How to fail at buying ThinkPads/life

My father told me once that I cannot make money buying and selling things to which I am too attached. They are just things. That means that any endeavour to buy and sell cool computer technology is, for me, futile.

But I don’t give up. Yet, for all the tricks I’ve learnt, the one thing I haven’t mastered is patience. Whether it be in chess, or in buying ThinkPads. I’ve decided now to moan publicly about it instead of internalising my anguish.

Disclaimer: I do this for a myriad of complicated psychological reasons that I’d love to explore in more depth just as soon as I’m done complaining…

FUUUU

Exhibit A. I paid only $200 less for a much more common machine that this not long ago. Unfortunately, it turned out that there were about 40 or 60 of those machines for auction. Grays did the very cunning thing of selling them in lots of two per day over the course of several weeks – truly flooding the market. (I ended up trying to lower my average entry cost by buying another identical model for $200 cheaper still at the end – does anyone need a brand new W510?) Then this comes along. Top of the line, flagship, and something I’d actually want to waste money owning. It made me regret the previous three W510s. I mean, what’s the point if you can’t collect the best…

FUUUUU - again

Exhibit B. I paid $909 for one of these machines two weeks before a bulk lot of them turned up out of nowhere and sold for $784-$809. Dammit. My mistake was classic: I forget to check the auction just before I knew it closed. I remembered 8 minutes late.

In both cases I purchased a machine early because I didn’t know enough about the market. Coming from NZ it was easy to assume that anything you really wanted was scarce. It’s hard, though, when you have no idea how many of these models they’ve got available to sell. If you don’t buy early you might never get one at all. To an uninformed observer, it’s but chance…

Posted in Uncategorized | Leave a comment

Happy post

I noticed my posts were unreasonably negative, so…

THIS IS A HAPPY POST. A LOUD, HAPPY, POST. IT IS THE CANONICAL EXAMPLE OF GOODNESS AND HAPPINESS AND SUNSHINE AND ROLLING MEADOWS and oases and giraffes and rainbows and moonlight and the xylophone.

Posted in Uncategorized | 2 Comments

eBay is just crap

eBay has a lot of faults, but by far the most significant is its refusal to auto-extend auctions. The point of an auction, I thought, was for interested parties to bid the highest amount that they’d be willing to pay to secure to item, naturally depending on how much value they perceive the item to have (to themselves or otherwise). It is therefore in the seller’s best interest to extend the period of the auction to allow as many bidders as possible to make as high bids as they wish, so that they may receive the greatest amount for it.

Of course there should be some limit to this extension, so as to ensure that the auction doesn’t proceed indefinitely. In a real auction, or at least all of the ones that I’ve seen, once the reserve has been met and some time passes between bids, the auctioneer makes it clear that the bidding is drawing to a close and invites additional bids before his hammer falls. If he/she sees interested parties, he or she will make allowance for them to think and place a bid. Crucially, if you want to outbid someone, you are not limited in doing so.

Not on eBay, though. On eBay, last bidder wins, absolutely. There is no auto-extend. There is no ‘going, going, gone’. There is just a single hard deadline and if you want to win, you need either a very fast internet connection with low latency and fast reflexes, or an automated script, such as the many available.

It’s moronic.

TradeMe does it right. GraysOnline does that part even better.

Few things anger me more than banks. Losing auctions for Cisco routers I would’ve paid good money for, had I been there 1 minute or even 12 seconds earlier – or even, as the case was the time before, if I wasn’t waiting for the page to load – are some of those things.

Another is TPG and its technical incompetence (but that’s another rant).

Posted in Uncategorized | 2 Comments

Advice for prospective postgraduate students

I wish I’d read this three years ago. My previous (two) attempts at admission to MIT failed, miserably, for reasons that over a year later become painfully clear. (It’s a long story, but I’m going to write it down… later.) It’s still churning – indeed reading that entire document right now is too painful – but soon I will become my quest to achieve what it is that I want to achieve. As Mr. Harchol-Balter point out, though, one has to first be very sure of what one wants to achieve.

Posted in Uncategorized | Leave a comment

C’est drôle, n’est-ce pas? (or “how I lost my package”)

I’m missing a parcel. The company says it was delivered (to work) and that it was signed for (by the receptionist, with name and signature). Yet, I never got an email informing that it arrived, as normally happens (and before we consider this as the obvious weak link in the chain, I’ll point out that our receptionist is superhuman and has probably never made a mistake in her life).

But that was two weeks ago, and I still don’t know where my package is. If I pre-empted such an email, and went to collect the parcel from the mail room as I’d done around that time for another parcel I was expecting, then I’m sure I’d remember receiving it (I’ve been waiting for it since the day I ordered it with bated breath). I remember one parcel from the same courier company, but also that it was surprisingly empty. I think it contained another item I had ordered from a separate company, on eBay. It was odd.

So now, I’m in a pickle. Did I throw it away by accident? Did I leave it in a pile of rubbish next to my desk and just throw it all in the bin? I am that silly at times. It wouldn’t be my first complete lapse of cognitive function. But… surely it would’ve taken a severe lapse of situational awareness for me to do that. Maybe I was angry at a bank at the time. It’s just so… odd.

There are two other explanations: 1) the receptionist actually misplaced it and it never made it to the mail room; or 2) the courier company mislabelled the package and has false records about its delivery. The first possibility can be discounted because it’s highly unlikely. In the second instance, however, I would normally give the benefit of the doubt to the courier company — except that in this instance the courier company was Fastway, whom I know to be completely useless from my previous encounters with them in NZ. But is that fair?

So, what do I do? Do I buy everything again? Fortunately it was only a $38 all up, for 6 Cat5e RJ45 wall jacks and the wall plates to go with. Still… hmmm….

UPDATE: The package was found! It had been addressed to another Googler working in the same office as me. The company from whom I’d made the purchase decided that because we work in the same building, it doesn’t matter if they addressed it to the wrong person. This is their mistake; I already made a second order having given up but have since told them to cancel it and refund me completely. I’ll make sure this happens.

Posted in Uncategorized | 2 Comments

Living in Sydney, week 2

(In no particular order.)

Reasons living in Sydney is good

  • JJJ, the government-funded radio station that plays an incredible assortment of music, has mostly interesting content, and is commercial free;
  • having some family; and
  • Google.

Reasons living in Sydney is deplorable

  • Some of the accents are disgusting;
  • Westpac;
  • the postal (dis)service;
  • the unjustifiably high cost of bananas;
  • the unjustifiably high cost of everything else;
  • FitnessFirst, the worst gym ever;
  • the lack of culture;
  • all the suits in the city taking themselves way too seriously;
  • the fact that it’s a big city and therefore dirty;
  • how far away everything is;
  • the weather; and
  • EFTPOS is a foreign concept.

 

Posted in Uncategorized | Leave a comment

Take the log out of your own eye

I have so much ranting to do about this typically poor Stuff article that I’m actually at a total loss as to where to start.

Like, I don’t even know.

The worst part is that it’ll sound pretentious and/or arrogant. BUT THE TRUTH HURTS, YOU MYOPIC IMBECILES, AND I’M BITTER AS HELL. WHAT’S THE POINT IN SHOWING GOOD CHARACTER WHEN IT WON’T EVEN COUNT FOR ANYTHING UNTIL I’M 26 FOR FUCK’S SAKE?

Oh, don’t worry Arya, people will figure it out eventually.

Oh, don’t worry Arya, as long as you stay true to yourself that’s all that really matters. Alone.

Oh, don’t worry Arya, the selflessness you once genuinely believed in really did make you a pretty good person after all. Alone.

Oh, don’t worry Arya, your idealism is simply founded in seeking the answer to the questions people seem to ask themselves repeatedly, even if they’re not listening to the answers. It’s not your fault that they can’t quite equate cause and effect.

Oh, don’t worry Arya, after all of that time, when you’re ready to settle down, you can still marry a nice older girl who’s tired of fooling around with the very types of people this article describes as unworthy, because she’ll settle for you, the Nice Guy.

Oh, don’t worry Arya, what actually matters is 1) money and 2) instant gratification. Go immerse yourself in liaisons dangereuses, because the very girls who will “make mistakes” with you are the ones who will later regret it and marry a Nice Guy. HOW’S THAT FOR BITTER?

I’m sorry I even care. I wish I was happy in my own little world. I wish it didn’t occur to me that there was a disparity between ideal and reality and that there is a point to bridging the gap.

Posted in Uncategorized | Leave a comment