HTML5 geolocation demo

Written on 20 October 2011, 05:39pm

Tagged with: ,

1. Test if the browser supports navigation:

if (navigator.geolocation) {  
  /* geolocation available */  
} else {  
  /* geolocation not supported by this browser */  
//---or use Modernizr
 if (Modernizr.geolocation) {
//---or be geek

2. Getting the current position: navigator.geolocation.getCurrentPosition()

The getCurrentPosition() method initiates an asynchronous request to detect the user’s position, and queries the positioning hardware to get up-to-date information. When the position is determined, a specified callback routine is executed. You can optionally provide a second callback to be executed if an error occurs. A third, optional, parameter is an options interface where you can set the maximum age of the position returned and the time to wait for a request. [#]

		{enableHighAccuracy:true, timeout:30000, maximumAge:60000 }

3. Geolocation success callback function

The success callback function will be called with a single parameter, an object with two properties: coords and timestamp.

Cfexecute tag: a few useful notes

Written on 20 October 2011, 04:50pm

Tagged with: ,

Some quick notes about cfexecute tag:

  1. It is async.
  2. You cannot put other ColdFusion tags or functions between the start and end tags of cfexecute.
  3. You cannot nest cfexecute tags.
  4. In CF8 or less, only stdout output is captured, not stderr. If you need to capture the error, redirect stderr to stdout using 2>&1 – as described here.
  5. In CF9, you can use errorVariable and errorFile attributes to store (into a variable or file respectively) the result of an error. [#]
  6. To capture the output, use variable or outputFile attributes. If no outputFile or variable attribute is specified, output is displayed on page from which it was called.

Flex 4.5: the certification

Written on 18 October 2011, 03:45pm

Tagged with: , , ,

A few days ago I passed the exam for becoming Adobe Certified Expert in Flex 4.5. Now I want to share my experience about the exam.

1. A little background

Because most of my working experience is in ColdFusion and PHP, I approached Flex more like a hobby. I wanted to have a better grip of the RIA concept and event-driven architecture. I started to use it also in real life, but it’s only 3 months ago when I started the preparation for the exam.
I read two Flex 4 books (both published in November 2010):

  1. “Learning Flex 4: Getting Up to Speed with Rich Internet Application Design and Development” by Alaric Cole, Elijah Robison [#]
  2. “Flex 4 in Action” Tariq Ahmed, Dan Orlando, John C. Bland II, and Joel Hooks[#]

While the first one provided a quick-and-easy approach to Flex, the second one came to consolidate my overall Flex knowledge. I recommend them both, preferably in the same order.
Aside from the books above, the Livedocs where always the reference. The problem was that I had to switch from ActionScript documentation, to Flex 4.5, to AIR, and even data services livedocs. Making sure that I am always reading the latest version was a concern, as Google sometimes shows first the old resources (AS 2, Flex 3, etc).

2. Preparing for the exam

After reading and reviewing the two books above (I keep Google Docs notes :)), I bought the Attest 3 exam engine. I learned a surprisingly lot more from there, especially in the AIR and design patterns sections, barely covered in the books. The links to the Livedocs were quite helpful, even though they were pointing to the Flex 3 version and I had to manually switch to the latest Flex version. My test results started from about 70%, and got up as the questions started to repeat (they say the total number of questions is 200+).