Jan 12, 2008
Great Android talk
Stanford has a great series of weekly talks related to computer science and of the recent talks was a talk given by Google engineers about Android platform.
It’s a great intro to not only of Android is but also why it was created and sprinkles bits of history.
Jan 10, 2008
Just found in an otherwise good code:
public:
DocDecompressor() {}
~DocDecompressor() {}
size_t decompress(ZLInputStream &stream, char *buffer, size_t compressedSize, size_t maxUncompressedSize);
};
Why is it a class and not just a function?
Rhetorical question, I know. But it illustrates what I’ve seen more than once: people get so enamored with some technique that they blindly use it even when it doesn’t make any sense.
Jan 09, 2008
There’s no justice in the world.
Rebol 3 Alpha: 664 kB
Shoes (Ruby + UI framework): 25 MB
Capabilities: pretty similar
Ok, so Ruby probably does a little bit more, so it’s a bit apples to oranges comparison, but it’s one huge orange and one tiny apple.
Was there ever a better example of a gigantic difference that a thoughtful design can produce.
One data point: libcairo (which is a 2D graphic rendering library and is part of Shoes) comes in at 536 kB which is nearly the size of the whole Rebol system (which is a full blown language interpreter AND a 2D graphic rendering library with capabilities similar to libcario AND a full blown UI framework with buttons, scrollbars and what not).
Jan 08, 2008
Reviewing consumer electronics few days after buying it isn’t very useful because we’re in the hopeful mode and look at it through the lenses of potential and not real life experience.
I’ve had my Thinkpad x60 Tablet for 8 months so I’m past the thrill of novelty and can offer opinion that also incorporates annoyances that show up in real life usage.
The bottom line is: I highly recommend it (well, you can’t get x60 anymore, but there’s x61, an evolutionary upgrade).
You can google for all the boring tech specs, so I won’t repeat them here. Suffice to say that with 2GB of RAM the laptop is plenty fast for real work (I’m a programmer so “real work” involves running Visual Studio, VMWare etc.) and Thinkpads are my favorite laptops (I’ve also used Dells, Fujitsu Lifebook and Sony Vaio).
I bought tablet version because I was excited about tablet features. Turns out I’m not using them much (pretty much only when reading comic books because flipped screen has better aspect ratio for that).
I’m still happy I did it, though, despite higher price over non-tablet version. The reason is that only tablet version has an option of sxga+ (1400×1050) screen resolution.
In notebooks I value small size but I also value high resolution screen and performance. I was afraid that 12″ is too small for everyday work (my previous sweet spot for notebook size was 14″ Thinkpad t42 with 1600×1200 screen). Turns out I was wrong: 12″ with 1400×1050 screen is comfortable enough and I do most of my working on x60. I shelved my (still perfectly good) t42.
Rant: I hate all websites (including Lenovo’s order pages) that use those SXGA, WXGA etc. acronyms and don’t bother to include pixel count, something that I actually understand without googling.
Digression: being spoiled by those resolutions I would have a hard time buying Apple laptop. Their 13″ MacBook has low screen resolution and their 15″ MacBook Pro is too big for my taste.
At some point the LCD broke (half of the display was garbage) but Lenovo fixed it quickly (and at no charge since I was still covered by warranty).
After 6 months the battery pretty much died. It used to last 6 hours, now it can barely get to 2. Doesn’t bother me that much, because where I use it I have power. Besides I think 6 months is standard for batteries so can’t blame Lenovo for that. I could fix the problem by buying new batter.
Semi-rant: I hate all the Lenovo-provided pre-installed software. It’s usually awfully designed, slowing down boot and sucking resources. I uninstalled most of it and saw no difference. Some of that crap I didn’t uninstall (afraid of loosing some crucial functionality) and from time to time Lenovo’s tvsched.exe goes for a wild ride and uses 100% of one of the CPU (which I notice because the computer slows down).
Vista is huge disappointment. I had an option to use XP but I chose Vista because it looked nice on the paper and I thought it has better tablet functionality. Today I would choose XP.
The most annoying aspect of Vista is that it’s slow at some common basic tasks, like browsing folders which is such a fundamental problem that it begs the question: how could they fuck this up? Other annoyances are increased resource usage (they seem to have doubled number of processes running after boot) for no discernible value.
Security improvements are a good thing but not when they lead to breaking significant software (like Visual Studio 2005 or Visual Studio 6), lead to UI aggravations like UAC and try to kill third-party software ecosystem (the “are you sure you want to run this very untrusted application” message box).
At the same time some of the things that I care about and have annoyed me forever are not improved (like a dialog for editing environment variables or the fact that notepad doesn’t understand Unix newlines).
The only improvement over XP I can see is a marginally nicer title bar. I still have XP on my desktop so I have a good comparison. XP wins over Vista by a large margin thanks to better performance and being less fussy and annoying.
A tip: RAM prices at Lenovo (and Apple and most other companies) are exorbitant. I bought my laptop with 1GB in 1 SIMM (important to leave the other slot free) and bought the other 1 GB at crucial.com. It’s a good saving.
Jan 06, 2008
Logging is often useful when debugging software to help understand its behavior.
Consider a problem I was having: Sumatra was crashing because of invalid refcounting of fz_shade object. Refcounting took place only in two functions: fz_keepshade() and fz_dropshade() so my plan of attack was to see who calls those functions and from that hopefully figure out why there is a mismatch.
If I had a logging system with ability to dump callstacks already built into the program, I could modify the program to add logging to those two functions, re-run and look at the logs.
But I didn’t so I used WinDBG as an ad-hoc logger.
The trick is to know the following:
- .logopen $filename WinDBG command
- .logclose WinDBG command
- conditional breakpoints
Under WinDBG I set the following two breakpoints:
- bp SumatraPDF!fz_dropshade “kb; g”
- bp SumatraPDF!fz_keepshade “kb; g”
bp creates a new breakpoint on entry to a given function. A string “kb; g” is composed of WinDBG commands executed when a breakpoint is hit. In this case I just dump the callstack with kb and continue execution with g.
Then I used .logopen $filename so that everything WinDBG prints in output window also gets written to a file and voila - an ad-hoc logging without the need to modify and recompile the program.
And yes, after some staring at resulting log I fixed the crash.
Jan 03, 2008
Sumatra 0.8 released
I’ve released Sumatra 0.8. Changes in this release:
- added search (contributed by MrChuoi)
- added table of contents (contributed by MrChuoi)
- added many translation (contributed by many people)
- new program icon
- fixed printing
- fixed some crashes
- rendering speedups
- fixed loading of some PDFs
- add command-line option -esc-to-exit
- add command-line option -bgcolor $color
If you find bugs, please report them in the bug tracker.
