Friday, March 20, 2009

The Name of the Wind

What a great book! I've not been following the fantasy scene closely, since most fantasy these days is complete dreck. The last good novel I read was Susanna Clarke's Jonathan Strange and Mr. Norrell, and then I happened upon Patrick Rothfuss' work in a rather roundabout way that landed me on this page:

http://www.patrickrothfuss.com/blog/2009/02/concerning-release-of-book-two.html

I found it entertaining, but when I got to "P.S. Your tears are delicious to me", I realised I simply had to read this book.

And wow, what a book. Kvothe is inhumanly good, like Superman, but without being tiresomely superior[*], and seeing the world through his eyes makes him enormously more sympathetic than he might have been in the third person.

The great thing about Rothfuss is the sense of wonder that he manages to capture. I loved the interludes of music the most, far more than the descriptions of "sympathy". Looking back at the book, I can't say I remember any outstanding characters - most of them are two-dimensional compared to the hero - but I did like Master Elodin the Namer.

I read the book in two sittings, maybe around 12-14 hours, and loved almost every minute, and I now get to join the giddy throng waiting for "The Wise Man's Fear."

The waiting sucks, but I can wait. I had to wait years for Stephen King to finish the Dark Tower (that might have been better if left unfinished at say, Wizard and Glass). I'm already nine years older than I was when I read Martin's Game of Thrones, so I think the wait for Wise Man's Fear isn't going to kill me yet.

Recommend: BUY!
The Name of the Wind
Patrick Rothfuss
ISBN 978-0756404079
[*] Batman so totally kicks Superman's ass in the likeability department.

Thursday, March 19, 2009

Truncated date row in AjaxControlToolkit CalendarExtender

Recently I and a friend have been moonlighting building an ASP.NET web site. This was our first time using C#, and my first time doing any real work in Visual Studio.

I'm no Microsoft lover (I ran Visual Studio in a VM on my Linux laptop), but I have to admit Visual Studio is slick. It's light (compared to Eclipse, at least), its autocomplete is great, and the code-deploy-test cycle is gratifyingly quick.

To my surprise, I quite liked C#. Properties, delegates and var foo = new Bar() alone would make it better than Java, but its lambda expressions simply blow Java away. The only catch with lambda expressions that I could see is that you can't declare a Func that returns void (Func). You either have to declare a delegate, or make the poor Func return a junk object just to keep the compiler happy.

One of the things I needed in this web app was to use date choosers. A little Googling suggested that the AjaxControlToolkit's CalendarExtender control was the way to go. It took me a while to figure out how to actually use it in a page after including the assembly reference in the project. This involved:


<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>


and then attaching a calendar extender to a date input text field as:


<asp:TextBox ID="SomeDate" runat="server" />
<ajaxToolkit:CalendarExtender ID="SomeDateCalendar"
TargetControlID="SomeDate" runat="server" />


This worked great, right up until I noticed that the date chooser was missing the last row of dates, pretending that every month had 28 days or less. I checked the example project for the date chooser, and the date chooser looked fine there, so I guessed that the AWOL last row involved something in my webapp's CSS. After some mad Googling for a quick fix, and much cursing, I decided to investigate the matter with Firebug, which revealed that the calendar was likely barfing on the extra padding and margins that the page's CSS used for divs and table cells.

For posterity, here's the CSS style I had to add to my page to make the calendar behave correctly:


.ajax__calendar * {
font-family: "Tahoma", "Verdana", "Helvetica", "Sans-Serif";
padding: 0;
margin: 0;
}


(This is probably a bug in the calendar's own CSS - it should certainly reset margins and padding if it doesn't want it.)

Thursday, March 5, 2009

Lagwifi

For a while now, I've been dissatisfied with the performance of my laptop, a Macbook Pro running x86_64 Arch Linux. Everything worked great most of the time, but every now and then, the laptop would go nuts and become horribly unresponsive.

When in this weird condition, the laptop had trouble even keeping up with keyboard and mouse input. I could hold down a key and I'd get "kkkk (long pause) kkkk (long pause) kkkk...". It was so bad I couldn't use the laptop at all once it hit this snag, and I'd usually have to reboot, because I couldn't work out what was causing the problem (no userspace CPU usage, no I/O activity).

Finally, several days back, I accidentally happened on the cause of the problem - my Madwifi wireless drivers. I caught the laptop in the throes of another fit of lag and did an rmmod -f of the ath* modules, and bingo! Input was smooth as silk again. I blacklisted the ath* modules, and I haven't run into the spastic-laptop syndrome since, so I'm reasonably sure that madwifi was the culprit.

Amusingly, I wasn't even _using_ my wireless connection at the time - I prefer cabled ethernet where available.

The question: how do you troubleshoot such problems, in general? I have no good material for a bug report to the madwifi folks and I'm not sure how to go about gathering evidence for this. syslog[*] had nothing to say about madwifi's woes.

[*] I've recently moved to Arch, and it took me a while to figure that /var/log/everything.log had the stuff I might look for in /var/log/syslog on Debian.