Monday, August 13, 2007

Our App on Vista

What's different about Vista, for an application written for Windows XP?
  • We write a config file in our application directory. When the user changes preferences, they are written to the config file. On XP, this file is located at C:/Program Files/DeltaSphere/bin/SceneVision-3D.cfg. Vista pretends that the file is still located there, but silently redirects it to C:/Users/username/AppData/Local/VirtualStore/Program Files/DeltaSphere/bin/SceneVision-3D.cfg. Got it?
  • We need to update some drivers to Vista specific ones.
  • We use the installer from VS2005 standard, and that seems to work fine
    • We even use visual-basic scripts in the installer, and those still work. I bet Norton will still complain, though, just like on XP.
  • We have a splash-screen app that auto-runs from our install CD, and Vista complains that it is unsigned.
That's about it. Not too bad. I was prepared for much worse. Of course, we aren't really following the standards for where to locate our data and such, but we won't worry about that for the first round. Only one customer has tried to run on Vista so far, anyway.

At least they got rid of 'My' everywhere. It's just 'Computer' now. And shared docs go in the 'Public' folder, which makes more sense than 'Shared'.

Wednesday, August 8, 2007

Perl regexp, one liners

The command
perl -pe
lets you do a line-by-line perl command on piped input and output. I discovered today that that means you can't use it on regexp that are supposed to match multiple lines.

Tuesday, August 7, 2007

Keyboard Macros in Emacs

A very useful tool in Emacs is the keyboard macro. Every so often I need to perform a repetitive task that is slightly different each time. This time, I was changing casts again, in C++. I had a series of casts, that looked like this:
(MeasureLine *)(annot->newCopy());

and I needed to replace them with this:
dynamic_cast<MeasureLine *>(annot->newCopy());

So I defined a keyboard macro, where I first selected 'MeasureLine *', and the macro would cut that text, type in 'dynamic_cast<', paste, then type '>'
The keyboard macro is started by the keystroke 'Ctrl-x (', and ended with 'Ctrl-x )'. It is run by 'Ctrl-x e'

When I found another spot in my code that looked like this:
(ConstraintPlane*)(annot->newCopy());

I could drag over 'ConstraintPlane*' with my mouse, and hit 'Ctrl-x e', and it turned into:
dynamic_cast<'ConstraintPlane*>(annot->newCopy());

Done. Another trick is that 'Ctrl-u' followed by a number, then followed by 'Ctrl-x e' will run the macro many times in a row. Good if you include a 'Ctrl-s' incremental search in your macro.