Monday, June 9, 2008

Developer's Guide - Google AJAX Language API - Google Code

Over the last few months I've been attempting to learn Portuguese, and, having finally been dismayed by the lack of an API from Babelfish (formerly AltaVista, now Yahoo!), I was pleasantly surprised to see that Google now has a translation service.

I'm really excited about this, since not only do they have a decent translation page, they're also exposing an API:

Developer's Guide - Google AJAX Language API - Google Code


Way to go, Google!

This opens doors for applications, both web and [internet connected] desktop, to perform translations.

They also have the ability to detect the source language, but I'm not sure how useful that would be for me personally, but it's a cool feature nonetheless.

Friday, April 11, 2008

Casting with "as" in C#

C# provides a couple of methods for casting. One way is the way most familiar to C/C++/Java programmers:


Foo foo = (Foo)bar;


The second way is through the use of the "as" keyword, which may feel more comfortable to ex-VB programmers (since it also has an "as" keyword):


IFoo foo = someObject as IFoo;


...and the great advantage of the latter form is that "as" returns null if the object does not support the type (or interface) in question, instead of throwing an exception. This is really handy if you're trying to do invoke a method at runtime and you want to only do it to the object if it supports the interface:


if (foo != null)
{
foo.DoSomethingInterestingNow();
}


I guess you could also do this with "is" and a cast too:


if (bar is IFoo)
{
foo = (IFoo)bar;
// or:
//foo = bar as IFoo;
foo.DoSomethingInterestingNow();
}

Thursday, April 3, 2008

How to Automatically Generate XML Comments in C# using Visual Studio .NET 2005

(Since I don't have a desktop software development blog right now I figured I'd better just put this here, since it could apply to C# programming with ASP.NET...)

To automatically generate XML comments in C# using VS.NET 2005, all you have to do is type a triple-whack ("///") in your code before a method definition and the IDE will build out the XML for you.

I accidentally stumbled on this on the same day I was trying to find out how to do it, which doesn't happen too often. I actually found it while nosing around in the VS.NET preferences:

Tools --> Options --> Text Editor --> C# --> Advanced

...which has an "XML Documentation Comments" section and a "Generate XML documentation comments for ///" checkbox.

You really need your miner's helmet for that one! Whew!

Wednesday, March 12, 2008

JavaScript in Internet Explorer 8

This sounds like really good news for JavaScript programmers...

John Resig - JavaScript in Internet Explorer 8

(in case you're wondering, John Resig is the developer behind JQuery...)

Saturday, March 1, 2008

Setting up Ruby on Rails on Mac OS X with Locomotive and MAMP

Here's a succinct rundown on how to get ruby on rails running on your mac using locomotive and mamp...

locomotive mamp = ruby : Red91.com

It's a lot easier than the steps on Hivelogic, but the Hivelogic tutorial definitely is a good introduction to setting it up with the command line and is probably more flexible as a result, even if more complex -- especially when you start running into bizzare "Could not find rails (> 0) in any repository" errors, which can be remedied by using these blog posts:

Army of Evil Robots | Could not find rails (> 0) in any repository
Mac OS X 10.4 (Tiger) + RubyGems + Rails

Tuesday, February 19, 2008

Great Intro Description of Adobe Flex

I thought this article contained a great description of Adobe Flex, and how it differs from Flash as a development tool...

Get oriented to Flex - Flex 3 Getting Started - BETA - Adobe Learning Resources

Thursday, February 7, 2008

YUI Blog: iPhone Performance Research

Since web development for the iPhone is a hot topic lately, this article on the YUI Blog is very timely and informative...

Performance Research, Part 5: iPhone Cacheability - Making it Stick - Yahoo! User Interface Blog

Here's a brief introduction:

This article, co-written by Wayne Shea, is the fifth in a series of articles describing experiments conducted to learn more about optimizing web page performance

Chris Heilmann: Code tutorials for lazy people with Ajax Code Display

Perfect! Just for me!

Code tutorials for lazy people with Ajax Code Display

Chris Heilmann: "Five things to do to a script before handing it over to the next developer"

I thought this was a pretty interesting set of best practices for use when developing in JavaScript in a team environment...

Chris Heilmann's Blog: Five things to do to a script before handing it over to the next developer