Amazing Solar Technology
Here's an example of a technology that, if what they say is true, could effectively remove the need for polluting power plants forever. It sounds like hype, but watch the video, do the research and decide for yourself.
Free Knowledge
I often brag that I received a better education at McGill University than many of my high school friends who went to top universities in the US, and at a fraction of the price. (With the US dollar on par with the Canadian, it is only slightly less attractive).
But now, thanks to iTunes and independent university initiatives, everyone can have access to the world's most brilliant scientists, professors, and lecturers. And you can pick your curriculum from multiple courses at multiple university. And it's totally free.
One article discussing this phenomenon is from the New York Times, which discusses Walter H. G. Lewin, a physics professor. A really good read which reminds me of my Physics 101 professor, Bob Moore, which I once commented "splits the atom, like, daily." Although I certainly struggled through the assignments and remembering the equations, I definitely learned to appreciate physics by watching a crazy person ride a unicycle on a lecture stage or calling Americans "barbarians" because we (they) use inches and not centimetres.
Anyways, if the thought of free lectures interests you, why not check out some of the great content available on iTunes, or MIT's Open Courseware? If you're looking some interesting business-related content, check out Melbourne Business School's Leadercasts which my team here at MBS worked on.
Another Clever Person
I'm loving this whole World Wide Internets thing, as there is no shortage of smart people who are writing things that I can read any time I like. Apparently, blogging is really hip with the kids these days, just like the MTV and the YouTube.
My mom suggested a couple of years ago to read The World Is Flat: A Brief History of the Twenty-first Century by Thomas Friedman which was a good call. I've since lent this book to a number of my friends.
Today I read his really satirical account of America as seen through and Iranian intelligence estimate. Simply brilliant. Here's an excerpt:
Our fears that the U.S. was engaged in a covert “Manhattan Project” to achieve energy independence have been “assuaged.” America’s Manhattan Project turns out to be largely confined to the production of corn ethanol in Iowa, which, our analysts have confirmed from cellphone intercepts between lobbyists and Congressmen, is nothing more than a multibillion-dollar payoff to big Iowa farmers and agro-businesses.
This is exactly what we need. Just like we "needed" the atomic bomb and we "needed" to land on the moon. Except this time it's not just the free world at stake; it's the whole world. At least Australia, my adopted country, has started to take this issue seriously lately.
If You Only Read One Blog...
- Introduction to Best Software Writing
- Fire And Motion
- The Guerrilla Guide to Interviewing (version 3.0)
Highest Level of Giving Made Easy
...endowing him with a gift or loan, or entering into a partnership with him, or finding employment for him, in order to strengthen his hand until he need no longer be dependent upon others...Thanks to the Internet, this way of giving is actually the easiest to accomplish thanks to the phenomenon of microloans: small loans (less than $200) made to individuals to help fund a business venture. Web sites such as Kiva make this extremely easy. Simply pick the individual you want to sponsor, choose a loan amount, and use Paypal to complete the transaction. The whole process took me less than 5 minutes.
Interested? Check out a worthy cause below and get involved!
I'm Leaving to Scotland
I'm leaving good old Boca Raton today to head to Scotland, and then on to London and Europe thanks to Contiki.
I will probably leave my laptop in London, so please forgive me if I don't respond to your e-mails, or become an apparent Facebook creep.
After Europe, I will be heading to Hong Kong for a couple of days before returning to Australia. The day after my return, I will starting a new job at Melbourne Uni. And it will be my birthday!
Something good happenned to Mozy
The earlier adopter that I am, I signed up for the Mozy online backup service a couple of months ago. The service was -- and I believe still is -- in public beta, at least for Mac clients. For those who never heard of it, Mozy offers unlimited online storage for only $4.95 USD per month.
In the beginning, Mozy really pissed me off. It didn't reliably backup. I get errors like
Error: ((Null) (Null)))
But yesterday, after attempting a backup, my Mac did something it never does: it froze. I was ready to move Mozy into the trash.
But, after restarting, something amazing happened. Mozy is running perfectly. I now have 3 different restore options (desktop client, online client, or DVD mailing). Growl is now supported. I get visual confirmation that an upload is in progress. It's faster. It shows real upload progress (although still a bit inaccurate with the time remaining). I'm a happy customer.
For those who don't perform regular backups, you should. And I suggest giving Mozy a try.
In My Country There Is Problem
iPhone: Apple should support Google Gears
Under most circumstances, a web application is probably preferred because:
- there is no overhead in installing or updating the application
- data is stored remotely, so it's accessible regardless of where you are or which computer you are using
- it will run on multiple operating systems with little extra work
So what's missing? Naturally, there are a few things:
- Access to other applications, either currently running or otherwise installed on the system
- Using the application when no Internet connection is present, although I tend to agree that also think that this has diminishing returns
- Security; individuals often think twice about storing private data on third-party servers
I'm probably in the Apple camp with regards to the first point. We don't want applications to interact with each other (or with the Phone OS itself) because this may have security implications for the owner and the network. I don't want to have an anti-virus running on my phone or iPod, to be sure. And I don't want to risk the possibility of my phone being hijacked to run some scams using my voice minutes. The risk is just too great.
So how can Apple help mitigate the second and third point without introducing a complex SDK? Easy! Apple should support the Google Gears on mobile Safari (and regular Safari, for that matter). With Adobe's support for Google Gears in AIR and Apple's adoption, we may see the Gears API become the de facto standard API for occasionally connected web applications.
Wouldn't that be nice?
Great New Feature in Opera 9.5
Recently, Opera released an Alpha version of their 9.5 release. One important feature that I don't see on any changelog is how Opera offers to remember passwords using its "wand". Now, when you submit a form on any site, Opera, like most browsers, offers to remember your username and password. However, this is now done asynchronously so that the page continues to load in the background.
Why is this so great?
If you're like me, you're never quite sure if you've entered the right username/password combination, and you might be hesitant to save the information until you're sure its correct. Now you can be sure you are saving the right info because you can wait for the form to submit and the new page to load.
It's the little things.
Funniest Music Ever
Update: Most of you probably already knew that there was a whole episode of South Park about this singer. Despite being a South Park fan, I totally missed that one until now.
Building a Better CFLOOP
My improved looping tag uses a little known ColdFusion feature, the
<cfexit method="loop" />
tag. When used inside a custom tag, this returns control to the top the tag's "end" execution mode. This is ColdFusion's way of allowing custom iterators.Here's what the syntax of my array looping tag:
<cfimport taglib="/custom-tags/loop/" prefix="loop" />
<loop:array array="#myArray#" index="i" element="e" cycle:shading="light,dark" cycle:odd="true,false" cleanup="true">
</loop:array>
Let me break it down:
- array: this is the array you want to loop through, just like a regular CFLOOP
- index: again, just like in CFLOOP, except this attribute is not required and has no defaults. it simply is not set.
- element: the current item in the array. By default this a variable called element
- cycle:variableName: the tag sets variableName to one of the values based on current index. This is inspired by a similar function in Rails. For example, in the above example, the variable odd will either have the value of true or false depending on the iteration number.
- cleanup: This is perhaps the nicest feature. cleanup will remove references to all variables created during the iteration of the tag. This eliminates the need to var-scope lots of variables inside a CFC. By default, this is true.
ColdFusion and YAML
After a little server configuration, it's easy to turn YAML text in a file into a ColdFusion structure.
I'm using JYaml as my YAML parsing library, but other options are available. Unfortunately, JYaml requires Java 5, which is not the standard ColdFusion operating environment. To remedy this, download a Java 5 JRE and follow Ben Forta's concise directions. Don't forget to put the JYaml jar file in your classpath and restart your ColdFusion server.
Assuming your .cfm file and .yaml file are in the same directory, creating a ColdFusion structure out of it is a easy as:
<cfscript>
Yaml = CreateObject("java", "org.ho.yaml.Yaml");
configFile = CreateObject("java", "java.io.File").init(ExpandPath('.')&"/settings.yaml");
settings = Yaml.load(configFile);
</cfscript>
Dumping the "settings" variable reveals exactly the structure you were expecting.
One caveat: you may experience unexpected behavior when trying to access your struct's properties using dot notation. Instead, use the "associative array" with square brackets option.
So do this:
value = settings['credentials']['username']
not this:
value = settings.credentials.username
Site Layouts and Application.cfc
Let's take a look at solving this using the onRequest method in Application.cfc to capture our outputted content, and then placing it within a template. Here's a skelteton onRequest method:
<cffunction name="onRequest">
<cfargument name="thePage" type="string" required="true" />
<!--- Magic will happen here --->
</cffunction>
For those of you familiar with onRequest, you'll know that if we don't manually included the requested page, ColdFusion won't send any content to the browser. This might strike some people as odd, but it opens a world of possibilities. For example, see my previous post on using Application.cfc as the application controller in an MVC framework.
In this case, instead of invoking a method within the Application.cfc, we'll store what ColdFusion would have outputted into a variable using the cfsavecontent tag. We'll then include another .cfm page, which will have access to all the variables in the onRequest function, including the just-saved content of the included page. Thus, the onRequest magic looks like this:
<cfsavecontent variable="contentForLayout">
<cfinclude template="#ARGUMENTS.thePage" />
</cfsavecontent>
<cfinclude template="Layout.cfm" />
Now, the code within Layout.cfm has access to the contentForLayout variable which contains the dynamic region of your page. A simple layout could simply output the content within the HTMl body:
<html>
<body>
<cfoutput>#contentForLayout#</cfoutput>
</body>
</html>
Naturally, you've have a much more complex layout, where you'd include Javascript, stylesheets, a header, footer, etc.
Another very important consequence of this is that your Layout.cfm has access to all the variables available within your Application.cfc so there is no reason which your layout cannot content dynamic content.
Using Application.cfc as your application controller
Rather than moving custom application event handling logic in a seperate controller, why not handle them with the Application.cfc? After all, the Application.cfc framework is a well-documented, frequently used ColdFusion features which already handles many application-level events.
To that end, I've written yet another ColdFusion MVC framework I call "Boca", which is Rails-esque insofar as mapping event names to controller methods (handlers) to view pages without configuration. But what makes Boca unique (and uniquely ColdFusion) is that Application.cfc serves as the controller for all application events. A sample Application.cfc would like this:
<cfcomponent displayname="My Great Application" extends="BaseApplicationController">
<cffunction name="onApplicationStart" ...
<cffunction name="onSessionStart" ...
<!--- Custom Event Handlers --->
<cffunction name="addToCart" access="public" returntype="void">
<cfargument name="productId" type="numeric" required="true">
<!--- Do application logic here --->
</cffunction>
<cffunction name="signIn" access="public" returntype="void">
<cfargument name="username" type="string" required="true">
<cfargument name="password" type="string" required="true">
<!--- Do application logic here --->
</cffunction>
</cfcomponent>
While I cannot make the source code public, I can offer insight on how to accomplish this in your application. The secret is using the onRequest function in Application.cfc to intercept calls, call the appropriate function within the Application.cfc, and include the corrent view page(s). This can all be done in less than 100 lines of code. To reuse this filter across Application.cfc files within your site, simply extend the base component which implements the onRequest method, and don't override that method.
If, like in other MVC frameworks, the event contains the union of FORM and URL scopes, I suggest invoking the event handlers using the event as the argument collection of the handler method like so:
<cfset event = StructNew() />
<cfset StructAppend(event, URL) />
<cfset StructAppend(event, FORM) />
<cfinvoke method="#action#" argumentcollection="#event#" />
You the get better event documentation by enumerating the arguments and types for your event handler (although this is optional, since ColdFusion supports dynamic arguments, and will also preserve the name-value pairs passed in). See the sample component above for an example.
A consequence of this approach is that variables set (and not var-scoped) within the event handlers are available in the view pages included within the onRequest method (this is a well-documented Application.cfc behaviour), saving Model-Glue like usage of event and view-state components across controllers and views.