?

Log in

No account? Create an account
Rob Mayoff [entries|archive|friends|userinfo]
Rob Mayoff

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

Moved [Nov. 4th, 2006|07:50 pm]
Rob Mayoff
I have moved my blog to qwan.org.
link5 comments|post comment

(no subject) [Sep. 17th, 2006|10:48 pm]
Rob Mayoff
We're sitting around watching a video on youtube of "strikeouts", which is where you take a bong hit and hold it in, chug a beer, take a shot, and then exhale. Tony says, "I bet bird flu will put an end to this."

Everyone else says, "Bird flu? What the fuck?"

Tony says, "Who would want to share a bong with bird flu running around?"
linkpost comment

making spotlight tolerable [Aug. 15th, 2006|12:28 pm]
Rob Mayoff
The Mac OS X Spotlight menu (the blue circle in the upper right corner of the screen) is incredibly annoying.  You decide to use Spotlight to find something, so you click the menu or press Command-Space, you type your search string, and then you remember how annoyingly slow Spotlight is.  And you can't decide to do anything else on the computer while you're waiting, because clicking anywhere else will abandon the search.

The key to making Spotlight useful is to change Command-Space to pop up the Spotlight window instead of the Spotlight menu.  The window can perform a search while you're doing things in other windows - the menu can't.  So the frustrating slowness of Spotlight becomes tolerable because you're not locked out of your Mac while waiting for the search results.

You can change the mapping by opening System Preferences.  Click on Keyboard & Mouse.  Then click the Keyboard Shortcuts tab.  Scroll down a bit to the Spotlight section.  Uncheck the checkbox next to "Show Spotlight search field".  Double-click the shortcut area at the right end of the line that says "Show Spotlight window" and then press Command-Space (or whatever you want to use).  Now, pressing Command-Space will open the Spotlight window with the insertion point right in the search field, waiting for your input.  While waiting for the results, you can work in other windows.
linkpost comment

Mortgage Calculator [Jul. 2nd, 2006|05:11 pm]
Rob Mayoff
I've been thinking about how to compare mortgages, because I'm buying a house. There are several decisions to make. I've written a mortgage calculator that takes them all into account. It's in Javascript, and I've tested it in Safari and Firefox. I seriously doubt it works in Internet Explorer. Anyway, here are the decisions.

Any money used to pay off the loan principal is effectively an investment with the same interest rate as the loan. Several of the decisions are between paying down the principal and investing the money elsewhere. You have to decide whether you think you can invest at a better rate than the loan's. If so, you generally want to invest rather than pay down the loan principal. If (like me) you think you can't invest at a better rate than the loan's, then you have to decide how much liquidity you want, because money used to pay down the loan principal can't easily be reclaimed.

You can spend money on "points" to get a lower interest rate, or you can put that money into a larger downpayment, or you can invest the money. This has an additional tradeoff: if you think you'll refinance the loan at some point, you have to consider whether the lower interest rate will cover its cost by the time you bail out, which involves looking at your equity and your investment at the time of the bail-out. On the other hand, if you intend to pay off the loan without refinancing, then you will always end up with the full equity of the property and you only need to consider your investment's value at the end of the loan.

You can choose a shorter loan term, which gets you a lower interest rate, but your monthly payment is higher. Or you can take a longer loan term, which gives you a higher interest rate but a lower monthly payment. You can then go ahead and pay extra each month, paying off the loan early. By taking the longer term loan and higher interest rate, you're buying the option of making lower payments, which is handy if you might want or need to live off your savings for a while.

You can deduct the mortgage interest from your taxable income, so a higher interest rate gives you a larger tax deduction. You can either invest the tax savings or you can add it to your monthly payments.

There's another factor which I haven't implemented yet: inflation. You're borrowing today's dollars and paying back future dollars. Because of inflation, future dollars will have less buying power than current dollars. If you assume that your earning power will keep up with inflation, then inflation effectively reduces the interest rate of the loan. I haven't decided exactly how to handle this in the calculator yet.
linkpost comment

John Raese is a spammer [Jun. 29th, 2006|11:35 am]
Rob Mayoff
If you live in West Virginia, please don't vote for John Raese.  He's a spammer.  I don't even live in West Virginia and he's sending me his junk email.
linkpost comment

fedora core 4 upgrade problems [Mar. 4th, 2006|12:21 pm]
Rob Mayoff
I tried to upgrade my Thinkpad A30p from Fedora Core 3 to Fedora Core 4. First I tried using a DVD, but apparently the A30p doesn't boot off DVDs. Then I tried a CD and it booted that but after LILO the screen just went black; even the text mode install ("linux text" at the boot prompt) didn't fix it. Using "linux nofb" at the boot prompt fixed that problem.

Then when I told it to start the upgrade, I got an unhandled exception:

Traceback (most recent call list):
  File "/usr/lib/anaconda/gui.py", line 1137, in handleRenderCallback
    self.currentWindow.renderCallback()
  File "/usr/lib/anaconda/iw/progress_gui.py", line 244, in renderCallback
    self.intf.icw.nextClicked()
  File "/usr/lib/anaconda/gui.py", line 873, in nextClicked
    self.dispatch.gotoNext()
  File "/usr/lib/anaconda/dispatch.py", line 174, in gotoNext
    self.moveStep()
  File "/usr/lib/anaconda/dispatch.py", line 242, in moveStep
    rc = apply(func, self.bindArgs(args))
  File "/usr/lib/anaconda/packages.py", line 827, in doPreInstall
    f.close()
IOError: [Errno 22] Invalid argument


This happened because I had replaced my /etc/mtab file with a symbolic link to /proc/mounts. Anaconda (the RedHat/Fedora Core installer) tries to truncate /etc/mtab and could not do so. Replacing the symbolic link with an empty file fixed this problem.
linkpost comment

How to get a $1550 discount on a flat-panel TV [Dec. 12th, 2005|09:22 pm]
Rob Mayoff
Step 1. Own a TV stand that takes about 7.75 square feet of floor space.
Step 2. Buy a house for $200 per square foot.
Step 3. Buy a flat-panel TV and mount it on the wall.

You have now reclaimed approximately $1550 worth of square footage.

(No, I haven't bought a new house yet.)
linkpost comment

video games [Dec. 3rd, 2005|11:21 pm]
Rob Mayoff
David Plays Guitar Hero

Shadow of the Colossus: Excellent. It's longer than Ico, with more action, and just as beautiful and intriguing.

Ratchet: Deadlocked: Disappointing. They kind of phoned it in on this installment, I think. The story was virtually non-existent. I didn't find the weapons to be as entertaining. Maybe I'm just getting tired of this series. I haven't tried the multiplayer support.

SSX On Tour: Satisfying. The snowboarding gameplay is largely the same as in SSX3 (except for the ubertrick system), but on a new set of runs. I haven't tried skiing yet.

Guitar Hero: Satisfying. Almost excellent. The guitar controller makes it easy for non-video-gamers to get into this game. However, for the hardcore gamer this game falls short of Dance Dance Revolution. DDR has an extensive practice mode, and GH desperately needs a similar mode.
linkpost comment

Tracing message sends in Objective-C [Oct. 30th, 2005|10:05 pm]
Rob Mayoff
[Tags|, , , ]

So now I'm trying to get bindings working when I put my NSCell subclass in a table column. It appears, for the standard NSCell subclasses, that NSTableColumn looks at the subclass's exposed bindings and re-exposes them on itself. However, it's not doing that for my NSCell subclass's bindings.

So, I want to trace the messages that are flying around inside Interface Builder to see if I can figure out how NSTableColumn decides what bindings to expose. Ideally I'd have a little dynamic library with a logging version of objc_msgSend and I could get Interface Builder to run using that. I don't have that (yet). I found this old Usenet post from a NeXT engineer showing how to trace objc_msgSend using GDB. That will be much slower than smashing in a logging version of objc_msgSend, but it's better than nothing.

Of course, the GDB command in that Usenet post is for NEXTSTEP running on Intel. It'll probably work on MacOS X running on Intel, but my Powerbook has a PowerPC processor. Also, Apple introduced a new message-send function in Tiger, so you have to set two breakpoints. These commands work on MacOS X on PowerPC:
b objc_msgSend
comm
silent
printf "%c[%s %s]\n", $r3&&((id)$r3)->isa->info&2?'+':'-', $r3?((id)$r3)->isa->name:"nil", $r4
cont
end
b objc_msgSend_rtp
comm
silent
printf "%c[%s %s]\n", $r3&&((id)$r3)->isa->info&2?'+':'-', $r3?((id)$r3)->isa->name:"nil", $r4
cont
end

Here's some sample output from GDB, tracing the first few messages sent in -[NSObject exposedBindings]:
-[NSTableColumn _bindingAdaptor]
+[NSBinder binderClassesForObject:]
+[NSBinder _allBinderClasses]
+[NSDisplayPatternTitleBinder isUsableWithObject:]
+[NSBox self]
-[NSTableColumn isKindOfClass:]
+[NSWindow self]
-[NSTableColumn isKindOfClass:]
+[NSWindowTemplate self]
-[NSTableColumn isKindOfClass:]
+[NSTableBinder isUsableWithObject:]
+[NSTableView self]
-[NSTableColumn isKindOfClass:]
+[NSObjectParameterBinder isUsableWithObject:]
+[NSObjectParameterBinder binderClassesSuperseded]
+[NSArray array]
+[NSArray allocWithZone:]
linkpost comment

Dragging an NSCell subclass from an Interface Builder palette [Oct. 30th, 2005|05:18 am]
Rob Mayoff
[Tags|, , ]

If you've got your own NSCell subclass that you want to put on an Interface Builder palette, you'll probably think that you need to call -[IBPalette associateObject:ofType:withView:] using IBCellPboardType as the type. This doesn't work. It turns out you need to use IBTableColumnPboardType. I don't know what IBCellPboardType is for.

Also, IB will send -[NSCell setObjectValue:] to your cell to fill in the dummy values in puts it tables in design mode. So you have to be able to accept the values it sends (probably of type NSNumber and/or NSString), even if your cell doesn't normally accept values of those types.

Also, if you want to see how IB's built-in "Data Views" palette (the one with the table view and the cells on it) draws the built-in cells, open up this nib:

/Developer/Applications/Interface Builder.app/Contents/Resources/CocoaFramework.palette/Contents/Resources/IBDataViews.nib

It turns out to be kind of a hack, with two NSTextFields and some appropriate control (NSButton, NSSlider, etc.) on top of each other, nested in a simple NSView. The NSTextFields are set up to overlap, with the bottom one having a black border and the top one having no border and covering the sides of the bottom one.

It's very handy to add a "custom executable" to your IB palette Xcode project, with the executable being "/Developer/Applications/Interface Builder.app". Then you can press Command-R to start IB to test out your palette, or Command-Y to run IB under GDB so you can debug your palette. Be careful not to start IB by some other mechanism (like by double-clicking a nib) if you're going to use this technique, because IB won't start up correctly and (at least for me) Xcode will probably hang.
linkpost comment

navigation
[ viewing | most recent entries ]
[ go | earlier ]