Monthly Archive for September, 2005

Preparation and Application

It struck me today that I’m prone to doing too much preparation and not enough application. I’m like a farmer who spends all day sharpening his blade, and never gets around to harvesting. Others have the opposite problem. They are farmers who spend all day hacking away with a dull blade.

The trick is to strike the proper balance, I suppose. If I tried to err on the side of too much application, at least I’d be accomplishing something.

Still, there’s something about being totally prepared that I like. I love having a tool that does exactly what I need. I love putting systems in place so “I’ll never make that mistake again!” For any given question, I love being equipped to find the answer faster than anyone else.

Aliases in CMD.exe

Turns out that Microsoft’s doskey command can actually create aliases that work in a command prompt (cmd.exe). Microsoft calls these things “macros”. Here’s my current list:


C:\>doskey /macros
measure=start /B /WAIT /HIGH /AFFINITY 1 ntimer.exe $*
sad=jvf -r -mmaster.amd64 -ddiffs.amd64
view=vim -R $*
vimrc=vim %ESSENTIALS%\vim\_vimrc
spec=cd G:\cpu2000
p2=nenscript -2GNr -TUS $*
p1=nenscript -GNr -TUS $*
svn=svn --config-dir %ESSENTIALS%\subversion\config $*
vsdbg=devenv /debugexe $*
cmd=start %ComSpec% /K %ESSENTIALS%\setenv.cmd
vc32=vc80env.cmd x86
vc64=vc80env.cmd amd64
ss=sd sync * && for /D %D in (*.*) do start sd sync %D\...
ap=PATH=%PATH%;%CD%
wl=less -S -# 2 $*
dis=link /dump /disasm $1 | less -S -#3
which=where $*
vf=jvf $*
vi=vim $*
ll=ls -l $*

One of my personal favorites is “ap”, which adds the current directory to your path.

Update: Kevin found a bad-ass application for this.

Google Blog Search

Technorati beware, Google Blog Search has launched.

If you search for “craptimizing”, I’m the only hit.

Don’t Mess with Convenience

My local library has many good books and CDs, which I can borrow for free. All I have to do is go down there, find that what I want is out, get on the waiting list, come back a few weeks later to pick it up, and remember to return it on time. This is not convenient at all, but it’s free and totally 100% legal.

Similarly I could borrow a DVD from a friend. Yes I’d probably be imposing somewhat on my friend, and if I forgot to return the DVD, perhaps this person would cease to be my friend. But, the point is, I could do this legally and for free.

Ok so what if, during one of the above scenarios, I decide just to make a quick copy for myself. Look, I’m never going to buy the thing. I buy things I want to own. If I just want the option to read a book twice, maybe once a year, it doesn’t make sense to own it 24/7/365. Besides, at any given time I could “re-borrow” the thing anyway — it would just be more convenient to have a copy readily available.

Of course, this is illegal.

The MPAA and the RIAA and many publishers don’t get this. They want you to see black and white here. Unfortunately, the reality is a whole lot of grey. The convenient method is illegal. If you want convenient access to a work, you must pay for it. Otherwise, if you’re satisfied with the inconvenient methods, they are — at least currently — resigned to the fact that those methods are legal.

(Don’t be fooled, though. If they could make libraries and friends illegal, they would.)

In a nutshell, this is why the MPAA and the RIAA are doomed to lose the copyfight. Convenience is not theft. Convenient things are not wrong. If you get between people and convenience, you’re going to lose every time.

Apology

Today I was looking for information on GCC’s -static switch. Naturally, I Googled gcc -static.

The results were horrible.

I was shaken to the core. How could this be? Google is infallible. Google is the second coming of Christ. Google can borrow my car and go on romantic vacations with my wife. I trusted Google.

I was just about to go on a profanity-laced tirade, when I realized: Google has a special meaning for minus.

To Google, a minus prefix means “please only give me results that do not include this word”. Thus, I was actually asking for pages about “gcc” but not “static”. The query gcc "-static" was far more effective.

Please forgive me, Google. I’m sorry I ever doubted you.

BTW, Google has a nice cheat sheet to help prevent such mishaps.

Craptimizing with Const Member Functions

Bheeshmar has pointed out a major flaw in my const-member optimization.

Continue reading ‘Craptimizing with Const Member Functions’

Autocompleteophobia

Imagine you are typing a URL into Firefox, or peraps a search string into Google, while others watch. You key in the first few letters, and suddenly…

Autocompleteophobia: the fear that your browser’s auto complete function will embarrass you.

Update: apparently, shift-delete is a Firefox user’s best friend. Thanks Bheesh.

Optimizing with Const Member Functions

What’s the point of a const member function? If you asked me last week, I would have said that const in general is just a “safety net” to protect you from yourself. I would have proceeded to babble something about how mutators must be non-const, and accessors should always be const.

I’m sure I would have said “always”.

But last night I realized that, in certain instances, you can optimize by breaking this rule.

Continue reading ‘Optimizing with Const Member Functions’




Creative Commons Attribution-NonCommercial 3.0 United States
Creative Commons Attribution-NonCommercial 3.0 United States