Archive

Archive for January, 2013

Smalltalk: Extending the Kernel

January 28th, 2013 No comments

Motivation

Many time I wish I could send a non-existent message to an object that’s part of the built-in Smalltalk library.

For example:

String>>surroundedByDoubleQuotes
 
	^ $" asString, self, $" asString.

Packaging

Simple Case: Project-specific Extensions

In Pharo, I can store this method in a package different from the one of the class in question. This is called an “extension method” and the implementation is currently a bit of a hack… You put the method in a protocol that starts with an asterisk followed by the package name. Thus, for the example above, if my project was packaged in MyPackage, I could package the method with it like this…

Screen Shot 2013-01-28 at 10.24.02 AM

For methods that are project-specific, this is all we need (although hopefully now that Pharo is working on first-class packages, it would be great if we could have both a protocol and specify an extension). However, the method above really has nothing to do with a particular project. It seems generally useful; and indeed, I find myself using it over and over.

Generally Useful Extensions

In these cases, it doesn’t work to package the method with the project that uses it, because if more than one of these projects are loaded into the same image, one method will override the other, creating a mess in Monticello. So I’ve been experimenting with two approaches.

The naive way would be to package all such methods in one package, e.g. “PharoExtensions”. This is the first thing I tried, but I was a bit uncomfortable with the all-or-nothing idea – that I’d have to load every extension I’ve ever created to use just one.

The most flexible tack is to package each method individually. The method above could be in the “StringSurroundedByDoubleQuotes” package. This way, one could load the method without effecting any other parts of the system. However, a package is a bit heavy-weight for just one method.

A Compromise

The current idea I’ve been playing with is to mirror the existing package structure of Pharo. For the above, String lives in “Collections-Strings”, so I tack on a standard suffix, making it “Collections-StringsSpd”. Now, we can load extensions for only the packages we are using, without having a confusing mess of ClassNameMethodName packages.

 

 

Categories: Smalltalk Tags:

Opportunity Cost: No Free Lunch

January 22nd, 2013 No comments

I read a great article about buying an apartment “for free” in NYC. It was well-written and thought-out, but missed a crucial financial factor that we all tend to forget about – opportunity cost.

From Wikipedia:

Opportunity cost is the… sacrifice related to the second best choice available to someone

In other words, we give up the benefits we would have gained had we made a different choice.

This was my comment to the author…

Nice analysis! For me, renting is still preferable because of two other factors. 1. Liquidity – if real estate prices in the area go down (everything has a cycle and it’s happened before in a big way in NYC), and I’m renting, I just walk away, leaving the owner to worry about it. You’ve made a bet that prices will go up; which is fine, but not guaranteed. 2. Opportunity cost – the 3.5% increase you’re hoping for will probably not keep pace with inflation (even the gov’t fantasy number, no less real inflation). But worse (if you’re wrong), you will not be investing any of the money tied up in equity in other asset classes. Again, this is another bet on real estate; this time vs. stocks or precious metals or agriculture… So I’m not saying it’s a bad idea, just that nothing comes for free ;)

Categories: Critical Thinking Tags:

[SOLVED]: iPhone Calendars wil not sync to Mac

January 16th, 2013 No comments

Recently, calendar events entered on my iPhone stopped syncing to my Mac. Calendar syncing was enabled, and I even tried “Replacing Calendar Information on This iPhone” (next sync only).

Luckily, it ended up being pretty easy to fix:

  1. In this Apple article, follow the instructions under “For issues with syncing calendars” (I skipped the steps before that)
  2. Restart iTunes (I tried to sync without this step, but got a message like “sync session cannot be started”)
  3. In iTunes, go to the “Info” tab for your iPhone, and make sure calendar syncing is enabled

That should do it. Good luck!

Categories: Mac Tags: ,

windows 7 product key

windows 7 product key

windows 7 key generator

windows 7 key generator

free winrar download

free winrar download

winzip activation code

winzip activation code

free winrar

free winrar

winzip free download

winzip free download

winrar free download

winrar free download

winrar download free

winrar download free

winzip free download full version

winzip free download full version

windows 7 activation crack

windows7 activation crack

windows 7 crack

windows 7 crack

free winzip

free winzip
\n