Archive for 2010

Steven Pinker: The stuff of thought

August 8th, 2010

The title is too vague and not very good. The subtitle is much better: Language as a window into human nature.

steven_pinker_-_the_stuff_of_thought

Go read it!

Dry and minute at times, but very rich. Don't get discouraged by the wikipedia page, it doesn't begin to do justice to the content between the covers. Neither does Pinker's google talk where he's selling the book and gives a superficial impression of it.

A non-exhaustive feature list:

  • Why can you not interchange "give her a hand" with "give a hand to her"? Is there any logical explanation for these quirks? (Answer: yes. In fact, language is far more logical and far less arbitrary than we imagine most of the time.)
  • Linguistic determinism. Is it really true that our language/vocabulary is the language of our thoughts, and thus it can empower/limit what we are able to think? (Answer: no.)
  • Why do you say "the stars are out" when you can see them and "the lights are out" when you can't see them? (Answer: don't remember the explanation for this one, but it's a neat example, no?)

And so on. But Pinker doesn't just explain a whole bunch of riddles, he reaches deep into a whole range of topics, like how language routinely states time in terms of distance (and vice versa), how language expresses causation (and what this implies for our perception of causation) and many more such topics. In short, he does exactly what he's promised to do, he shows how language codifies our human nature.

If I never read a second book about linguistics, I still think this one will have been a pretty good choice.

ansicolor: because the view is better in colors

August 6th, 2010

If you're a coder you probably try to modularize everything to death on a daily basis. If not, your practices are a little suspicious. :nervous: Alas, it's not so easy to knock out something that I can say with confidence will be reusable in the future. One piece of functionality I keep reimplementing is output in colors, because it's hugely helpful to making things look more distinct. The first time I wrote this module I knew I would be using it again and I wished to make it nice and reusable, but I didn't know what the future uses would be. So I put that off until "later". In the meantime I copy/pasted it a couple of times into other projects. Shameful, but effective.

I finally got around to organizing these types of bits that have no specific place of their own into a new github repository, appropriately named "pybits". It holds the pretty printer and this rewritten ansicolor module, and it'll probably grow with the ages.

But to business. Anyone spitting out ansi escapes who has figured out the system knows it's trivial to make a color chart. So to keep the tradition going, here's proof that ansicolor is able to enumerate the colors:

ansicolor_chart

Notice that section at the bottom about highlighting colors. As you might be able to deduce by sheer logic, black and white are not great colors for highlighting something in a terminal, because they are typically used respectively as the background and foreground of the term (or vice versa). (The colors of a term can actually be anything, but black and white are the common ones. Ideally, code should detect this at runtime, but I don't know of a way to check for this. Besides, lots of programs [eg. portage] do make this assumption also.) So the highlighting colors are supposed to be useful for when you want to output a wall of text and mark something in the middle of it, so the user can spot it.

Suppose you are (as I have been in the past) developing a regular expression and you can't get it right on the first try (yeah, unbelievable, I know). Well, what you do is highlight the string so you can see how the matching worked out:

ansicolor_1regex

Regular expressions tend to get hairy (yes way) so it helps to compare their results when you're trying to unify two half-working variants into one. Adding a second regex will show the matches from both. Where they overlap the styling is bold:

ansicolor_2regex

Think of the green highlighting as a layer of paint on the wall. You then paint a layer of yellow on top, but you don't cover exactly the same area. So where the green wasn't painted over it's still green. Where the yellow covered it, the paint is thicker. And where the yellow didn't overlap the green it's just plain yellow.

Adding a third regex potentially produces segments highlighted three layers thick, so there the color becomes reverse.

ansicolor_3regex

And then bold and reverse.

ansicolor_4regex

ansicolor doesn't support background colors, but that's a product of my use so far, I've never needed it. I don't think they improve readability.

You will find this cutting edge technology in the repo:

cygwin essentials

July 21st, 2010

This isn't really appropriate for a blog entry, because it's bound to be updated over and over, but I need a place to keep these notes.

Essential packages (not including pre-selected):

  • xinit. Effectively what is called Cygwin/X. (Creates a new shortcut in the start menu called XWin Server that you probably should stick in your startup list.) With this you can run gvim, xterm etc.
  • binutils (if you want strings)
  • file
  • git, gitk
  • openssh
  • ping
  • python
  • rsync
  • vim, gvim
  • wget, curl
  • zip, unzip
  • make/patch

Decent terminals:

  • mintty
  • puttycyg (ie. putty modded to use locally) You have to get this one separately, but it has a nicer feel to it imo.

Rome on foot

July 8th, 2010

This summer I spent 4 days in Rome in June. As with vacations in general, I did quite a lot of walking. At times it seemed like more than just "a lot", so I traced my walking on a map so that I could figure out how much "a lot" really is. It turns out that you can cover pretty much all the sights in Rome on foot, they're not that far apart. A walk would take anything from 1.5h to 2.5h. It turns out I would cover up to about 13km in that time. In three and a half days (also took a half day trip to Ostia Antica) I did about 40km of walking.

rome_on_foot

Tele2: so cheap it hurts

June 30th, 2010

In English the word "cheap" has two meanings (probably more than two, but let's not get into that right now). Thus, when someone describes a thing as cheap you should hesitate to assign to it the more laudable of the two meanings, that of being good value for money. Because it may also be that the opposite meaning is sought, namely little value for little money.

I imagine this being the reasoning which compelled Tele2 to choose their slogan so carefully: "born to be cheap", which they apparently use untranslated in every country where they operate.

The fact is that if all you want is an internet connection at home then there is no cheaper option than Tele2 on the Dutch market, at least to my knowledge.  Wherever you may go you will end up forking over 20 bucks per month, plus the 5 bucks ransom paid to would-be roadside bandits KPN for their generous permission to use your phone line. What you get in return for the 25 may vary, but noone will give you a better price. At least there is no sign-up fee, or installation fee, or additional surcharge on the precharge etc.

The 15th of May contact is made, Tele2's website affirms they are able to connect me at my new address. I immediately dispatch the order form. A week or so later, not having heard so much as a dolphin sqeak from Tele2, I call their support department. They've never seen my order. What's more, they're saying there's another customer at my address (previous tenant probably) whose personal information must be wiped from the record before they can take my order. This could take as long as a week.

A few days later, just as a sanity check, I try to re-make my order on their website. The order number printed on the screen is 0. Their system is hosed. It was probably like that the first time, but I failed to notice amid all the other output. So I call again. This time they have to do some deep digging to ascertain the fitness of my phone line vis a vis the yadayadayada. But at least they have my order now, per phone. Unless they lose it we're one step ahead.

A week rolls by. I finally get the letter in the mail, I'm proud to call myself Tele2's newest customer. The order is in, the letter has been sent out, surely it's imminent now. I have a tentative activation date on June 15.

Another week and a half and the modem arrives. Albeit in many small pieces and totally banged up. The package is rejected and Tele2 is tasked to send a modem that has the plastic shell intact. A week before the end of June it arrives, all is set now.

To my great satisfaction, DSL service has come such a long way that you don't need a technician to come to your house anymore, they send you printed instructions instead. You pay less and you get it sooner. So I set it up as per the instructions, only to realize that they've sent me all the pieces except the actual plug that plugs into the telephone socket. Oh, it's in the picture, but it's not in the box, why would it be? Don't you like when they get you involved with the problem solving too? I bet you can figure out where to buy a plug like that, you clever devil you.

Alas, the plug fits, but the modem works not. 20 minutes on the line with the support guy leads me to the illuminating realization that just because there are telephone sockets in the apartment doesn't imply they are connected to anything. So now they have to send an engineer anyway, albeit Tele2 is paying for it.

The guy termed the engineer is precisely what I expect him to be, a guy from KPN, the overlords of the telephone networks. He goes to work downstairs in the entrance hall. Says the phone line reaching as far as the apartment building works just fine, to which I ask him about the phone sockets in my apartment. "No no, that's not up to KPN, that's up to you or your provider, Tele2. We only check that it works up to this point." How terribly helpful of you. What they call the "ISRA punt" is a thick blue wire, the master phone line into the building. This goes into a gray connection box, which provides a connection point for every apartment in the building. Some of the wires going up to the various apartments are plainly disconnected from the box entirely, including mine. It might just be a matter of trying all the disconnected wires into my socket, one by one, and see if that makes it work. If I could borrow the guy's tools for 10 minutes I could try that. But he left.

So I'm back on the phone with Tele2. It turns out they don't give a rat's ass if the phone line in your apartment works (even though, I should mention, they're also a telephone provider), just as long as it works in the basement of your building where you may plug in at your convenience. So now I have to get their technician to come afterall, paying the 69.95 installation cost. This on top of probably 30 bucks I've already spent calling their not-at-all-cheap support line a dozen times.

It's six weeks since I made my order and I still have nothing. This isn't a phone line in rural Afghanistan, it's in The Hague. I have *several* Tele2 wireless networks in range of my laptop. I just can't get mine.