Apr 17, 2008
_NT_SYMBOL_PATH considered harmful.
When you debug your software on Windows, it’s sometimes useful to also have access to symbols for Windows DLL. Microsoft is kind enough to provide them for download and the easiest way to make them available locally is to set _NT_SYMBOL_PATH environment variable so that it downloads symbol files locally from Microsoft servers when needed. The right value is srv*c:\symbols*http://msdl.microsoft.com/download/symbols (you can change c:\symbols to any directory on your hard-drive).
I was running such setup for some time but observed that starting up a debugging session too a long time. It was annoying and after a while it hit me that I’ve caused this: even the simplest Windows program implicitly links a lot of DLLs. Both Visual Studio and WinDBG feel the need to load up symbols for all those system DLLs and it turns out it takes a lot of time.
I unset _NT_SYMBOL_PATH and I’m a happier person for it. Most of the time I don’t need system symbols since the bugs are in my code, but sometimes having them is useful (e.g. when the crash happens inside Windows). Fortunately you can still have access them. When needed you can use .sympath to set the path (e.g. “.sympath srv*c:\symbols*http://msdl.microsoft.com/download/symbols”) and then do .reload to force loading of symbols.
Apr 16, 2008
Remapping Page Up and Page Down on Mac to move a cursor.
It’s probably just a matter of being used to certain ways, but being a recent Windows->Mac switcher, the fact that Page Up and Page Down in a text editor moves the text without moving the cursor was driving me nuts.
I’m not the only and this article describes how to fix it. And, as an additional bonus, how to remap Home and End keys to move to beginning/end of a line, instead of beginning/end of a file.
Thinkpad x60 - a retrospective.
The best time to review a gadget is after using it for months. Unfortunately given the churn in PC electronics, it usually means that the gadget will be obsolete.
Nevertheless, I’ll summarize my feelings towards x60 after almost year of use despite the fact that you can’t buy it any more.
As a programmer I like my compilations go fast so I have rather high demands on my laptops but those days it’s almost a non-issue. x60 doesn’t have the fastest processor, a weak graphics card and a hard-drive that is far from being a speed demon, but as long as I stuff it with 2 GB of RAM, I have no problems using it with Visual Studio or even hosting a Linux inside VMWare. Yes, things could always be faster but they’re fast enough for me.
I bought x60 (as opposed to some other Thinkpad laptop) mostly because of its tablet features. I thought that I’m compromising on the size and that 12” isn’t enough work comfortable work (which was not a big deal because I still had my 14” t61 as a backup). Turns out I used it as a tablet only a couple of times. I’m not complaining because I also discovered that 12” laptop is good enough for day-to-day work (as long as it has 1400×1050 screen) and I ended up shelving my t61 and using primarily using x60.
I count myself as disgruntled Vista users. It really is worse in many ways than XP, sometimes in infuriating ways (like taking forever to show files in a folder on the hard-drive or annoying with UAC dialogs to the point that the only sensible solution was to disable it). Kind of pathetic, given that it was promised to be second coming of Windows OS and that every new release of Mac OS X is praised to heavens (and not without reason).
It’s even more infuriating that I can’t upgrade to SP1 because, get this, SP1 won’t install if it detects an known incompatible driver. Turns out my video driver is on that list. Lenovo doesn’t seem very motivated to provide an updated driver even after weeks since SP1 release (seriously, they should have upgraded the driver before SP1 official release - it’s not like it was a tightly kept secret). Driver from Intel site doesn’t install claiming my computer is not authorized. Thank you Intel and Lenovo for exemplary team work - I imagine there’s nothing as rewarding as pissing off people who spend thousands of dollars on your stuff.
I phantasize about downgrading to XP and Lenovo even has a program where they offer to send an XP downgrade CD for a certain price for selected devices (mine apparently included). That’s what one of their web pages claim. However, they were clever enough to make it impossible to actually apply for that. I spent (literally) hours trying to find a way to order that CD and failed. Their web pages just point back to each other, possibly as way to showcase an infinite loop.
Crapware - another annoyance courtesy of Lenovo. There are countless Lenovo branded programs with cryptic names. They all want to load on startup and show ugly icons in the start bar. I can’t understand from their names what they’re supposed to do but apparently not much since I see no functionality loss after uninstalling most of them. Lenovo might not be as bad as Sony or Dell, but it’s bad.
Despite the annoyances, it’s a good laptop and will do until I can buy a laptop with at least 128 GB of SSD much faster than current best for a reasonable price.
I would entertain switching to Mac but Apple doesn’t seem inclined to offer a resolution higher than 1280×1024 on their 13” laptop and I’m spoiled by 1400×1050. Once you taste it, there’s no going back.
Apr 15, 2008
Software worth buying - SftpDrive and ExpanDrive
SftpDrive and ExpanDrive is really the same program, except named differently for different OSes. SftpDrive is for Windows and ExpanDrive is for Mac.
It does one thing very well: it allows mounting any ssh accessible directory as a hard-drive/volume so that all programs running on your Mac/PC can access it as if it was a local drive.
One use for that is as a replacement for sftp GUI client.
But what is really great is that it greatly improves interaction with remote servers, be it an Amazon EC2 instance or a co-located server. When I had to edit files on remote Linux servers, I used to ssh and use Emacs for editing. Despite investing many hours in learning Emacs and elisp (to the point that some of the keystrokes are hard-wired in my brain) but I’m definitely disgruntled Emacs user and in my love-and-hate relation with it I have much more hate than love. Not to mention that for editing C/C++ code nothing comes even close to Source Insight.
Now I can just mount a directory and transparently edit remote files using my favorite, most familiar editor.
It’s a simple idea but the brilliance of SftpDrive is that it works really, really well and on sufficiently fast connection I can comfortably edit big projects. This might seem like an obvious property of such program but my experience with Samba (either when accessing my NAS over wireless Wi-Fi N network or accessing a filesystem exported from Linux running on Windows under VMWare) shows that this obvious property is lacking and trying to edit large code base in Source Insight on a samba-exported files is an exercise in restrain from chewing your own hand when Source Insight locks up for painful seconds when you’re in the middle of typing code.
Two thumbs up for SftpDrive/ExpanDrive. If only they also supported mounting S3 as a filesystem.
Apr 13, 2008
Software worth using: andLinux
I live in a multi-OS world and it’s nice to be able to do multi-platform work on just one physical computer. Since my main OS is Windows, when I need to do Linux work I resort to VMWare. While being great piece of software, it annoys me that the Linux world lives in its own sandbox. Sharing the filesystem doesn’t work very well (regardless of whether I use VMWare’s built-in folder sharing or use samba in either direction) and while I’m in VMware, Alt-tab no longer does the expected thing.
andLinux solves some of those problems and, as a bonus, is free. andLinux is an easy to install Ubuntu distribution based on coLinux.
While VMWare emulates the whole hardware, so that you can install any OS and it won’t see any difference, coLinux is a modified Linux kernel that runs as a process on Windows. Based on that it’s possible to build a whole Linux distributions and andLinux is a pre-packaged Ubuntu with Windows installer.
After installation you get ability to run a console inside Linux and the advantage over VMWare approach is that a console is just another application on Windows. Open five consoles - you just get 5 windows that behave like any other Windows application.
By also running an X-server on Windows side, it’s possible to launch graphical applications.
There are some downsides to coLinux, the biggest one being the fact that it’s slower than VMWare. Latest betas are supposedly faster than what andLinux uses currently, so there’s hope it’ll get better.
The Linux “hard-drive” is just a file on your Windows filesystem. The default size of that file is only 2GB so you’ll likely need to increase it quickly, which isn’t straightforward. The method I used involved expanding the file on Windows with dd command and then running a “resize ext filesystem” program on the Linux side. It’s not the safest way to do it, but it worked for me.
File sharing between Linux and Windows side can be done either by cofs driver which allows mounting any directory on Windows under /mnt, or samba.
On the whole andLinux is an attractive alternative to VMWare. I wouldn’t use for tasks that are heavy on CPU and disk-drive (e.g. compiling a large code base) since it can be twice as slow as VMWare on the same hardware, but when that is not a factor, a better integration with Windows is really helpful.
Apr 12, 2008
Pet peeves of mine - files.
Files are fine, I just don’t like that programs expose me to them for no reason at all.
Take TextMate for example. It allows you to create projects. Project is just a bunch of files so it’s really a tiny amount of information. Yet TextMate forces me manually manage projects by saving them to files.
Instead of just remembering all projects I have ever created and giving me some simple open/create new/modify/delete interface for projects, TextMate forces me to fish them out myself from filesystem.
This disease afflicts many, many programs. The only editor that I know that does projects right is Source Insight.
Apr 08, 2008
Someone concurred
Most people missed it, but not Dave Winer:
What you’re going to see here that you’ve never seen before is shrinkwrap net apps that scale that can be deployed by civillians.
Exactly. I would gloat that I said it earlier, but he dreamed it in advance:
The next step after that will be packaged applications that deploy through Amazon that you can buy for shrinkwrap prices.
Speaking of predictions: one of the Google example apps was HuddleChat, written in a couple of days by 3 people and bearing uncanny resemblance to 37Signals’ paid product Campfire. Bruhaha ensued, the app went offline, 37Signals is “disappointed with Google”.
Like I wrote yesterday, they (and a host of other companies betting their business on providing hosted, specialized app for a fee) will be even more disappointed when apps written to Google’s App Engine copying functionality of those hosted applications will become available (either for a one-time fee or open-sourced and free) and deploying such apps on GAE will be no harder than signing up for the service.
It’s all technically possible. It’s not going to be too hard for Google to build a packaging system and a catalogue of applications and provide one-click deployment of any GAE app.
Google App Engine - the first Internet operating system.
I’ve read all of the commentary on Google App Engine and most people agree: it’s a competition for Amazon’s AWS. Or a copy-cat.
They might be right but that’s not why Google’s service is disruptive. Google App Engine really is the first Internet operating system and given generous free plan it spells death for low-end web hosting and some of the specialized application hosters.
Currently I pay The Planet $150/month to lease a decent server. It’s all mine but all I really use it for is my WordPress-based blog and 2 minor websites. Yes, I overpay, I could move to a low-end web host for tens of dollars per month.
But now I have another choice: I could move my blog to Google’s data center. Hard to beat reliability, no overselling tricks that Dreamhost (and many others) use and their free plan is more than generous to host a website (on a good day I have 3 thousand visitors, which adds up to 90 thousand per month - plenty of room to grow until I reach Google’s estimated 5 million cap).
The free plan is more than generous for many, many people. Need a website for your small company? Host it on GAE for free. Need a blog? Host it on GAE for free (and you don’t even need to show ads). Need a website for your free software project? Host it on GAE for free.
I don’t think that’s exactly what Google had in mind but after skimming terms of service I don’t see anything that says “you shall not host your personal websites”.
Pretty much anything you can do on a low-end webhost you can also do on Google App Engine. I’m pretty sure we’ll quickly see a number of applications like blogs, wikis etc. written to GAE and people will be able to run their own copy of the app in Google’s cloud.
That’s why it is the first, true Internet operating system. It provides a set of services for running an application just as Windows provides set of services for running applications.
An application written to GAE is like a software package and individuals can run their own copies of those software packages on Google’s machines.
Other companies that should be afraid, very afraid of GAE are hosters of specific applications that don’t have network effects. Companies like SixApart, PBWiki, WordPress.com, github, 37signals, FogCreek etc., etc.
They have a very comfortable business: those days hosting a blog, a wiki, a chatroom costs pennies per user per month and they charge several dollars. Sign up few thousands paying customers and you have steady revenue flow and plenty of money to subsidize basic free accounts and work only 4 days a week. But why would I pay 37signals $12/month for Campfire if I could install a Campfire-like application on GAE OS, for free and with full control over my data (as opposed to believing that 37signals will not abuse my data)?
Yes, those companies also benefit from GAE if they use it for hosting, but at their scale it won’t be free and they can only stay competitive if they improve their apps faster than people writing apps for GAE. Or if their apps have built-in network effects (Facebook does, MySpace does, but a blog engine or a wiki doesn’t).
Google even competes with their own ad-supported businesses like Blogspot or even Gmail. If someone writes Blogspot or Gmail clone that could be run on GAE, there’s nothing stopping people to ditch Blogspot (along with forced ads) and run blogspot-like app on GAE. Yay for unintended consequences.
Since GAE is really an operating system, how can people make money? Shrink-wrapped software. I could, for example, write MBE (the Mother of all Blog Engines) and sell it for a fixed price to people so that they can run their own copy on Google’s machines.
Granted, this probably won’t happen because open source is the norm in web apps and the norm has a way of perpetuating itself.
In a way it’s all possible today: I can download a copy of WordPress and run it on a host of my choice, but, coming back to PC analogy, it is as if I had to assemble my own computer from parts and install an OS customized to that application in order to run.
With current approach the language of the application is given (e.g. PHP + MySQL or Python + SQLite or Ruby + PostgreSQL) and I have to assemble environment to run the app. That is a major pain in the ass.
GAE inverts this: the environment is given and application writers need to use available language and APIs. It shifts the burden from users of the application to developers, which is how it should be, because there are much more users than developers.
GAE is revolutionary because it provides a standardized environment for running applications and standardized OS leads to explosion of available applications. Compare number of apps on Windows with number of apps on fragmented Unix variants.
GAE covers some of the same ground that AWS but even though it’s less powerful, it’s also much more ground breaking. By providing an Internet OS it enables shrink-wrapped software model for Internet apps: write the app once, run it many times.
You can expect renewed interest in improving on old ideas. There will be multiple blog engines competing for your attention, all with the same ease of installation. Today there’s little point in writing a new blog engine becuase it’s a lot of work and few big aggregators took the market.
GAE levels the playing field. Once people learn GAE some aspects of developement will be much easier e.g. you’ll no longer need to be accomplished DBA, unix admin, Apache and MySQL deployment master combined into one. Being a Python programmer will be enough.
When each app will be incredibly easy to install, more people will do it and apps will be competing on their looks. Barrier to experimentation and creating new variations will be dramatically lowered.
GAE will create a market for deployable apps and where’s the demand, there’ll be supply.
Everybody is focused on the startup angle of GAE - how it will enable easy scalability for new web services but I think they’re all missing the point (and therefore I’m smarter than everybody else). I say that GAE will be much bigger as a service for running personal applications like blogs, websites, wikis etc. (assuming that Google will remain as generous as they are now with their free plan).
I’m sure that Microsoft works on a similar platform - they used to be the kings of the platform so they should understand what the right model is, but Google not only is first to market but their willingness to be a loss leader might throw a wrench into Microsoft’s plans. I doubt they factored hosting small fish for free into their plans.
Those are indeed exciting times and I almost wish I lived in the future, when I can get my hands on non-beta version of GAE.
Apr 07, 2008
gflags - a debugging story
I hate crashes that disappear when run under the debugger and I had one when porting mupdf to Windows.
It helps to know that there’s at least one reason for a changed behavior under the debugger: it automatically triggers using debugging heap. While debugging heap usually helps find problems, sometimes it does the opposite by changing the details of memory allocation.
One helpful tool when debugging memory problems on Windows is gflags which can enable page heap instrumentation for a given program. It works by putting each allocation into a separate region of memory and putting a non-readable page right after that. Also, upon freeing it makes the memory unreadable. That way an overwrite of memory block while it’s still being used or accessing the memory after it was freed will cause immediate crash.
The downside is that using gflags uses much more memory. But in those days of cheap gigabytes it’s not a problem that can’t be solved with a couple hundred bucks.
Basic usage of gflags.exe is simple: gflags /p /full /enable foo.exe
From now on foo.exe will always be run with this instrumentation turned on. To disable, do gflags /p /disable foo.exe
To see which programs have page heap enabled, do gflags /p. gflags offers many other option and you can learn about them via gflags /?. If you run gflags without any options, you’ll get a (very confusing) GUI.
It worked like a charm. I got a crash on accessing freed memory and all I had to do was to backtrack to where this memory was allocated to figure out the problem.
Feb 02, 2008
Arc has generated an amount of web buzzing way out of proportions to what it has to offer (a small lisp core implemented as an interpreter in MzScheme). At this point it has almost nothing interesting that hasn’t been done elsewhere and by any reasonable standards it’s just a toy for exploring ideas and not a language implementation that can be used for writing software.
- it’s tiny
- it’s very succinct
- built-in support for web applications
- integrated object-oriented database, with direct bindings between (web) UI widgets and database objects
- actively maintained and improved (around 4 new releases per year, latest release is from Dec 30 2007)
- mostly cross-platform (Linux, Mac OS X, FreeBSD, Cygwin on Windows). Unfortunately it doesn’t have native Windows version.
- open-source (GPL)
