Friday, September 09, 2005

This site has moved...

I have officially setup a Typo Blog at RedCloth/Textile is enabled, Comments are open to the public, and... well, pretty basic install for now.

Wednesday, September 07, 2005

I've finally done it...

I broke down and ordered a domain through (read about 'em through the awesome blog), and a TextDrive account.

Since the money's spent, hopefully that'll motivate me to setup my own blog there. I'll probably discontinue posting here for now hopefully.

My new domain names are and ( was taken by a squatter). As in: "I'm poor. When am I gonna get mo' substantiality at work?" :D

Javascript is cooler than you thought

We'll write a helper to prove it.

String.prototype.format = function() {
content = this;

if(arguments) {
args = arguments[0] instanceof Array ? arguments[0] : arguments;

for(i = 0; i < args.length; i++) {
regex = new RegExp('\{' + i.toString() + '\}', 'ig');

content = content.replace(regex, args[i].toString());

return content;

alert('{0} is {1}. Yes, I said {0}.'.format('Javascript', 'cool'));

I whipped this up in a couple minutes. It's had no real testing. I wrote something similiar at work, so I don't expect you'll have any problems with this, but no promises. ;)

Also, this should be at least IE6 and Firefox compatible. Been meaning to try it on Safari... The only real concern is that the browser supports the instanceof keyword. If not, there are workarounds online that should do the trick.

Why does the code also accept an Array? So you can write other things like an Array.append(content) method that optionally accepts arguments after the content parameter, sticks them in a new Array like so: for(i = 0; args[i] = arguments[i + 1]; i++);, and then pass the new array to content.format(args).

Tada! Now you not only have a useful Array.append method (this[this.length] to get the next new element), but you also have the equivilent of an Array.append_format in the same method. Now is that slick or what?

Told ya Javascript is cooler than you thought. ;)

Hand me down tools?

Jeremy D. Miller has a great post at CodeBetter.

Here's my mini-response:

I think it's important to keep the "competition" in mind. Ruby and Java both bring something very important to the table .NET only has a poor approximation of (despite many talented developers working on the problem): AOP

This is what makes a truly robust O/R Mapper like Hibernate possible. It's what makes an entire framework like Ruby on Rails take less time to develop than tools like NVelocity, NHibernate, WilsonORMapper, etc.

Not that they don't all have very talented people behind them doing great jobs, but c# is frankly crippling compared to the flexibility of Ruby's mixins, or Java's default virtual methods.

And yet Microsoft spins their wheels coming up with solutions to problems that are already solved with things like Comega. Does anyone with experience with both honestly think ASP.NET + Comega will be able to hold a candle to Ruby On Rails? Will any of it result in less or cleaner code? Will I be able to extend it through metaprogramming?

So what's the point?

It seems a shame that Microsoft made such a really beautiful versioning system, and then crippled their flagship language for versioning concerns. When I can run multiple versions of the .NET runtime side-by-side transparently, why should versioning have been such a problem? Target the assemblies to a version, and be done with it.

But instead of fixing the problem, they put out flashy PR like Comega that really brings little new to the table and misses the boat completely. We need flexibility. Until we get it, c# will always play second fiddle to Java IMO.

This page is powered by Blogger. Isn't yours?