Category: Nerd
Posted by: sjf
Programmable completion is a bash feature that does context sensitive tab completion, so it will only show files which the current command can accept. For example
unzip [tab]
will only complete zipped files. It also even knows how to tab complete "-" as an argument for most common commands. In case this seems like magic, it isn't, somebody painstakingly maintains a database of the valid arguments. These are all defined in /etc/bash_completion, all 9,000 lines of filename and argument specifications.

If programmable completion isn't already enabled, you can starting using by doing

shopt -s progcomp

But the problem is that sometimes it just isn't quite smart enough. I know what I'm doing, sometimes I really do want to open that random file in mplayer. Just because something ends in .part (thanks, firefox) doesn't mean it's out of bounds. So what to do when bash thinks it knows better than me?

  1. Avoid programmable completion for the current command.

    To get default tab completion press

    M-/
    instead of
    [tab]
    This completes filenames, which is what you want 90% of the time. To complete hostnames and usernames there are other key combinations, listed here

  2. I want out altogether.

    If you want to disable it forever put

    shopt -u progcomp
    in your .bashrc

  3. I am root and never want my users to suffer this inconvience.

    If it's enabled in /etc/profile, or /etc/bash.bashrc, then comment out the lines that look like:

    if [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
    If it's not enabled in either of these places, then it could have been turned on in /etc/skel/.bashrc or /etc/skel/.bash_profile. Your users got a copy of each of these files when you made them an account. There isn't any easy way to turn it off.
Category: General
Posted by: sjf

Milk that tastes almost not quite like Homo. Does it come from specially selected cows? Or perhaps they are milked by particularly effeminate farm hands? So what does Homo taste like? Well, I was disappointed to discover it tastes just like Hetero milk.

Category: Nerd
Posted by: sjf
Recently Amazon.ca was selling Lisp in Small Pieces for $4 Canadian. I ordered a copy, along with enough other people to put it at the top of the bestseller list, ahead of Harry Potter.

However, Amazon has cancelled the $4 orders for Lisp in Small Pieces, along with several other books which were also priced at $4. The guy from customer service I spoke to says they will be sending out mails telling people about this later today. They claim there were "pricing mistakes", (LISP is now priced at $94.40). Their pricing policy allows them to cancel any orders which haven't shipped and were incorrectly priced. So, no LISP for you!

I find the pricing mistake story suspect as I've seen how good amazon's monitoring software is at predicting orders. And something as anomalous as an obscure programming book outselling Harry Potter would have raised alarm bells long before they repriced it.

This pricing mistake also applies to a couple of other books that were selling for $4 around the same time:

Probability Theory : The Logic of Science by E. T. Jaynes, cancelled due to pricing mistake
Numerical Methods of Statistics by John F. Monahan, cancelled due to unavailability of stock.

Update Amazon has issused $10 vouchers to everyone who tried to order the $4 books. Apparently, some people who ordered a couple of months ago actually received the books.

Category: Nerd
Posted by: Andrei
I came across a post on reddit earlier today which claimed to show the breakdown of instructions on x86 asm generated by gcc. We found it rather curious that 1/4th of the instruction were adds. This sounded fishy, how often have you looked at code that had 1/4th adds, so we looked at how the disassembly was done. The person read in the binary, ran it through UDis86 and outputted the instruction counts. Looking at the documentation revealed that UDis86 takes a binary stream and decodes it, interesting. This means that it doesn't check which section it's in. The tipoff to this was a very high level of invalid instructions. If that person is just decoding the code parts of the text section, there should be no invalid instructions; unless that disassembler is so terrible it isn't worth a mention. Another reason why add may be so prominent is that '00 00' decodes to add; and the fact that add has a lot of encodings, although a lot of x86 instructions do too. In case you're interested, you can find the blog here.

But let's see, is there actually a problem with this? We went forth and disassembled /bin in a few different machines. We used objdump, restricting it to only count the code in the text section. First let's look at debian x86:


Debian x86

We can see from this that add is not the most used instruction. But how does this differ from something like Gentoo, where everything is compiled from source, with optimizations and the appropriate -mcpu options.
Gentoo x86

Interesting, almost the same for the top few instructions. How close these ratios are to each other surprised us. One last thing that we did was looking at an amd64 box, running debian.
Debian amd64

Given how close the other two graphs were, this is very dissimilar to them. With the reasons given above and the acquired data, we think we can safely say the previous blog was quite off in its counts.
We generated these just with: objdump --prefix-addresses -d /bin/*|grep "<"|cut --delimiter=" " -f 3|sort|uniq -c|sort -n followed by a bit of postprocessing.

Here's the data:
debian x86
gentoo x86
debian amd64


Note:
The shoddy graphs are generated using ploticus. It would be great if someone knew of a nicer way to generate them, the fact that some of the tags overlap is rather unpleasant.

Another note:
It was pointed out that maybe it isn't too clear what the striking differences between the x86 and the amd64 charts are. We guess that if you haven't looked at these at these while making them until you were entirely sick of them you might have some trouble readily noticing the differences.
So here's a list of major differences: a lot less moves (the extra registers surely helped here), a lot more xors, more pops than pushes on amd64, but more pushes than pops on x86 (the difference in calling convention probably accounts for this), more adds. There are others, though the above seemed to be the most interesting.
Category: General
Posted by: sjf
This summer I will be mostly sitting in the sun, selling strawberries by the side of road, writing Haskell code, and reading Introduction to Algorithms.

Ok, so that was the dream, now let's take a look at the dream to reality mapping.

This summer I will be mostly enjoying the Canadian summer, hanging out in UWaterloo, writing Java code, and reading The Intel Optimisation Manual.

But this is not a bad thing because it means I have been accepted for Google Summer of Code. Yay. I will be working on the Jikes RVM (formerly known as Jalapeno). The Jikes RVM is a Java virtual machine intended for research into VMs, like adaptive optimisation, garbage collection, etc. It's implemented in Java. I will be working on the instruction scheduler, taking the PPC scheduler and adding support for x86, as well as hopefully improving its performance.

However, if you are one of the thousands of students not accepted, don't feel bad. Just know that the internal selection process can be very, very arbitrary (I will possibly elaborate on a A Tale Of Two Google Apps later).

Category: Nerd
Posted by: sjf
...make an online service that sends a validation code by mail.

Not email, real mail. You know the kind with stamps, and ponies, and Kevin Costner.

ReachServices* allow you to look at your tax record and apply for refunds online. As anyone who has ever been the tax office in Cathedral St can testify, this would be pretty handy. However the catch is they have to confirm your PPS number, and they only way they seem to be able to do this is to send a validation code to your postal address. To avoid making things too inconvenient they will send you a reminder mail around the time the letter should have arrived prompting you to enter your code. The email also warns you that it will expire soon. 'Soon', when is 'soon'? What if I don't get the letter before the code expires? Will they send me another? Will they use exponential backoff or are all of us in the boglands doomed?

* Is that an aging Gary Lineker posing in their business clip art?

Category: Photos
Posted by: sjf

Read the rest.

Thanks to Neil Gaiman for the words, apologies for butchering the poem.

21/03: Flying Cats

Category: Cuteness
Posted by: sjf
Following in the footsteps of other cat flinging photographers, there is a set on Flickr devoted entirely to airborne cats. It seems that these cats become airborne voluntarily which is a bonus. Halsman needed three assistants plus his wife to take the first photo. They really can't pay you enough to throw an angry cat across the room into a shower of water.

To continue with the cat trend, if, like me, you enjoying spending hours of your day looking at things cute and fluffy there are plenty of lolcats here: www.icanhascheezburger.com.

Category: Cuteness
Posted by: sjf
Kitty

Just what was this kitten doing? Suggestions welcome.

Update

Apparently cats sometimes do this if it too hot, like dogs they expel heat through through their pads. So it could be pressing it's feet up against the cold stone.

Category: Photos
Posted by: sjf

09/02: UnDaily WTF

Category: Nerd
Posted by: sjf
This is a highly informative comment from the amsn source:

#TODO:when we write a message to a CW, it should do the same as WLM, 
#try to open an SB, if the CAL answer is 207 
Come on people, is it so hard write 'chat window'?

There is also the most awesome error message I have ever seen. Admittedly, we can't blame this one on the amsn people as it's part of the MSN protocol.

713 {
        status_log "CALReceived: 713 USER TOO ACTIVE\n" white
        return 0
}
Bad user!
Category: General
Posted by: sjf
Terenure We got something in the post today calling itself Local News for Terenure. Apparently the most exciting thing to happen in the village is that you can now turn right in the village outside of peak hours.

You've gotta love suburbia.

Category: General
Posted by: sjf
Google ads just seem to be getting sillier and sillier. The other day someone was trying to sell me a multidimensional database on gmail. What exactly a multidimensional database does is unclear.

Today, I was looking up a quote from the bible to express my dissatisfaction with the world*. Here is the google ad that was on the site.

Union with Jesus

No, the answer wasn't the surprising thing.

* No particular reason, it's just one of those days. Here, by the way, is the quote:
I returned, and saw under the sun, that the race is not to the swift, nor the battle to the strong, neither yet bread to the wise, nor yet riches to men of understanding, nor yet favour to men of skill; but time and chance happeneth to them all.
Ok, I promise no more religious references.

Category: Nerd
Posted by: sjf
I've got a job as a notetaker for some first year computer science classes. One of which is officially named Introduction to Computing, but known by all as assembly class. (This was my favourite class, once you get over all the tedious number systems stuff and just spend the rest of the year writing 68k assembly).

It's 10am on a Wednesday morning, an unspeakable hour of the day. I only cover one lecture out of three during the week, so there should have been two lectures since I was here last week. Last week the prof gave a class on pointers, which was all well and good. But this week, 2 lectures later, he's still talking about pointers. He's even using the same lecture slides. I feel like I should just submit the same notes I took last week. Pointers really aren't that hard. Why do lecturers need to belabour them so much?

Category: General
Posted by: sjf
Coke Cola Blak

I was really looking forward to carbonated coffee, I mean what could go wrong? Coffee is great, fizzy is good, it seemed like a plan. Well the thing is Coke Cola Blāk isn't just carbonated coffee, it's carbonated coffee with coke and something else. A combination of coffee and coke alone couldn't possibly spawn the evil that is this drink.

I wrote the above three months ago but didn't post it because I was missing something. I just didn't know exactly what it tasted like, until now. Something terrible happened this morning. I went downstairs to make some coffee in my fancy-shamncy coffee machine only to discover that it had been on since yesterday morning. So about two cups of coffee had been slowly concentrated into a thick tarry mass.

That is what Coca Cola Blāk tastes like, burnt caramelised coffee that has been sitting in the machine for about week. Does anyone actually enjoy this? What were Coke Cola thinking? So many unanswered questions.

«Prev | | 1 · 2 · 3 · | Next»