A little inspiration from a fellow Greek

Just ran across this short video which is basically an interview with Less Rain founder Vasillios Alexiou a fellow Greek ... enjoy :)

Flex lives!

We haven't heard much Flex news lately but as of this month Apache took Flex out of incubation and made it a top-level project! Apache Flex now has also reached version 4.9 and contains the following changes:
  • New localizations for Australian, British, Canadian, Greek, Switzerland (German) and Portuguese
  • The SDK natively supports the Flash Player versions 10.2 through 11.5. Previous versions were locked to a single version.
  • Better support for Vectors, including new VectorList and VectorCollection classes.
  • Inclusion of the new PostalCodeFormatter and PostalCodeValidator components for more consistent internationalization.
  • The TLF (Text Frame Framework) was updated to version 3.0.33, and is now baked in the SDK. No need to download it separately.
  • Support for Java 7 for compiling the SDK.
Also Spark versions of the following components are coming in a future version: Alert, ColorPicker, HDividerGroup, VDividerGroup, Menu, MenuBar, and ProgressBar.

Turn OFF register_globals in PHP

Having now used two different hosting companies for PHP web site hosting, I would like to quick describe the configuration issue that have occured with both hosting companies. They both set PHP's register_globals configuration variable to On, which can have undesirable effects on your application and make you easily second guess why your application is behaving in a certain way.

When register_globals is set to On, this means that your variables are registered globally and available on every page. So if you declare a variable called $userCount and assign it some value in a page called script1.php and then have another variable with the same name ($userCount) but with a different meaning on another page (say script2.php), it will initially take the value assigned when script1.php was executed!

So let's say script1.php performed the following assignment:

$userCount = 5;

When script2.php executes, if it also has a variable called $userCount, its initial value will be 5! Very confusing!

So take my advice, if you can configure PHP yourself on your web hosting site, then set register_globals to Off, or ask your web hosting company to do this for you. 

Also note that the register_globals configuration variable has been removed as of PHP version 5.4.


Adobe's Create the Web Tour - Montreal Edition

Adobe is passing by Montreal on Thursday December 6th, 2012 for the "Create the Web Tour". At this event you will get a chance to see the various Adobe Edge Tools in action and also how to create mobile apps using HTML, JavaScript and CSS using PhoneGap.

So all really cool stuff and if you want to attend follow this link to register, there is still places available.


Brackets is now Adobe Edge Code

I recently wrote about Adobe's foray into creating an HTML/CSS/JavaScript code editor called Brackets. Since then Adobe has created the Adobe Edge Tools and Services platform, which contains a suite of tools to help developers build better web applications and as such, Brackets has become Adobe Edge Code within this suite. The difference between the two is that Adobe Edge Code integrates with other Edge tools such as Edge Web Fonts and PhoneGap Build; while Brackets remains the open source version of the code editor. The open-source Brackets web site is still maintained on GitHub.

You can currently download the preview of Adobe Edge Code from the web site to give it a try if you are interested. I wrote about some the features in a previous post here. Also, if you want to see the editor in action, there is great demo video that can be found on YouTube right here.


HTML5 / CSS / Javascript documentation

One of the best tools we have at hand when developing is online documentation. Online documentation is available for many programming languages such as Java, PHP, Ruby and can also be found for application frameworks such as jQuery and Spring.

For HTML, CSS and JavaScript, I typically go to the W3Schools web site to look something up and it has been a great resource for many years. Recently however, Adobe put forth a community drivin Web Platform Docs wiki site for all related web technologies. Although the site is currently in alpha form, it seems to have gotten off to a very good start. So I suggest you head on over there to take a look and contribute if you can :)

Other sites that I typically go to for such information is caniuse.com and the HTML5 comparison of layout engines.


Getting responsive design to work

I was recently working on a web site and wanted to make it work across several mobile devices. In my case I was testing on an iPhone 4, Android Tablet and an Android phone. So no big deal, I created three different CSS files to cover the range of devices, namely phones, tablets and PC. The low level details are that you create the different CSS files and then specify which one to use based on the screen size using CSS media queries, like so:

<link rel="stylesheet" media="all and (max-width: 320px)" href="site-max320.css"/>
<link rel="stylesheet" media="all and (min-width: 361px) and (max-width: 800px)" href="selene-max800.css"/>
<link rel="stylesheet" media="all and (min-width: 801px)" href="selene.css"/>

However, once I started testing on the phone and tablet something wasn't working right. It was like the mobile browsers were ignoring the media queries; they were auto-zooming out to display the web site in its entirety, which was not what I wanted. After some googling, I discovered that you have to tell the browsers scale the content to the width of the screen, this way the media queries will be taken into effect. To accomplish this, you have to put the viewport meta data tag in the head of your HTML document, like so:

<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1"/>

Once I added this meta data tag, it all worked as expected :) A more detailed explanation about this meta data tag can be found here.


Firefox 15 is great for development

Firefox 15 was just released this week and I have been using it since the beta began and as far as I am concerned it is the best browser for development purposes. Let me highlight a couple of reasons why.

Working with CSS
A lot of times when developing a web site or web application, getting the "look" just right requires quite the effort. Up to now one of the best tools for working with CSS in Firefox was Firebug. However with the latest Firefox, you can just right-click on any element on a page and select "Inspect Element  (Q)" and you get to see all the properties of the element and adjust them on the fly and see what effect your changes. Now this has been there for a while, but with version 15, in the bottom-right corner, you now get visual tool showing you the overall size of the element and the size of each of its properties (borders, padding and margins). Quite useful, here is a sample:

Testing for Mobile
As we go along in 2012 and beyond, a good portion of work will require us to make sure a site is mobile-ready. So if you are doing Responsive Design (using CSS Media Queries), you can now test your design in Firefox 15 without the need of having various physical devices. Simply navigate to the site and select from the Firefox menu, "Web Developer > Responsive Design View" and you will be able to see how your site looks based on some predefined screen resolutions that are available.

So happy developing using Firefox 15!


Adobe Inspire

Once upon a time, Adobe used to have something called the Edge Newsletter, which was renamed earlier this month to Inspire Magazine. Its actually a nice little web site, with some interesting articles about Fluid Grid Layouts in Dreamweaver 6 (on my to-do list), a post about web standards, web site design with Fireworks 6 and so on and so forth. So I recommend you head over there and check things out, you might find something interesting to read about!


PHP Namespaces

I've been working on a PHP project lately and when I started working on it, I remember thinking to myself that there must be the equivalent to Java packages in this language. Otherwise loading/including/referencing classes from another class can be a bit of nightmare. There is the common PHP autoload pattern, but I find this is not enough and so I kept on digging and eventually ... success! Since PHP 5.3 there is the concept of PHP Namespaces, similar to Java packages which is very helpful in creating re-usable code. Basically in your class declaration, start it off with putting your namespace definition before anything else, like so:

namespace acme\utils;

class User {

And then you can re-use your class from another class or PHP file, like so:

namespace acme\business;

use acme\utils\User;

class ProcessCommand {
$user = new User();

Hope that helps and happy PHP coding!

Learn to build

There are a lot of technologies out there these days to work in: Flex, PHP, HTML, CSS, JavaScript, Ruby, the list goes on and on. And each one of them has their place in the grand scheme of things, each with its own strengths and weaknesses, each with its own particularities and each one has its appeal.

At some point in time, you will have to use one technology or another to get a job done, be it either by your own choice or because it is a requirement. And the technology of choice might not be one that you have used before. So what are you to do? Grab a book of course and starting reading. I've done that many times in the past. Another way is to read online tutorials and yes I've done this many times before as well. But honestly, the best way to learn is to ... build something! Ain't nothing like writing the lines of code yourself and seeing the results unfold right before your eyes. Really its the best way to learn, I can't stress that enough. It's the best way to learn the little hidden details of a language (or just a technology or framework for that matter) and to put what you have been reading into practice and really get a good grasp on things. You don't have to build anything complicated, just a simple contact manager will do, just enough so that you can really understand how something works.

So like my blog post title says, "Learn to build", or more like "build something" to "learn" :)


Brakets, the code editor

I've been doing a lot of HTML/JS/CSS development in the last year and most of this work has been done in Eclipse. Now Eclipse is good for this type of development, but with many 3rd party JavaScript libraries out there, it is hard to find good support for these libraries in IDEs.

So I am always trying to find a better HTML/JS/CSS code editor, having used Dreamweaver, Sublime Text and WebStorm over the past year, and now we have Brackets.

Brackets is an HTML/JS/CSS code editor, developed, interestingly enough in HTML/JS/CSS :) And it's goal is to be an editor focused on HTML/JS/CSS development. Right now, the currently available download could be considered beta 1 (or perhaps not even that) and offers very little. It does have two interesting features however. First, it connects with your browser, so as you edit your file(s) and the browser will auto-refresh to show you what your changes look like. Secondly, if you highlight say a Javascript function call or a CSS class and hit CTRL+E, you will get what's called "Quick Editing". Quick Editing, allows the related piece of code from another file to appear in an overlay in the current file so you can make changes right away and save them. Saves you the hassle of having to go open a file and look for related piece of code.

Apart from that, Brackets doesn't offer much, for now. There is no code auto-completion of any kind, as this editor is still in its infancy. And hopefully at some point, it will have 3rd party library support as well. You can actually recommend features or vote for exiting ones here. But it will be growing from week to week, so I recommend, checking it out from time to time, or even contributing to the project if you can!


ColdFusion 10 features

ColdFusion 10, the next major release of the Adobe Programming language is almost ready for prime time and they have recently released some articles to explain all the new features the language will support.

The next version has greatly improved support for HTML5 related technologies, such as web sockets, next it now generates charts using JavaScript (instead of Flash - but this is still a fallback mode if needed) and it also adds support for closures. You can look at the videos here and here for some quick demos.

Finally, a change under the hood has been made to make ColdFusion more mainstream, it now uses the Apache Tomcat Web Server, instead of antiquated JRun Server, which it had been using for many years now. A short video regarding ColdFusion and Java changes can be viewed here.


Page caching and the HTML5 onPageShow window event

Just last week I was confronted with a problem that occurred only in Firefox. This is rare, since Firefox is very good at implementing HTML/CSS/JavaScript standards. Basically what I had was a report criteria page being displayed to a user and then once he hit the submit button, we pop-up a JavaScript overlay saying "Processing...". Thing is, if the user hits the browser's "Back" button (yes that horrible button), the overlay was remaining, even thought in the window onLoad event we were telling the overlay to unload itself.

I believe the problem starting with a recent version of Firefox where the browser implemented page caching. Subsequently, when the "Back" button is hit, the page is loaded from the cache and the onLoad event is not fired again. So our code to unload the overlay was not being executed.

The solution as I found it, is that in this scenario, Firefox is firing the onPageShow event, giving us a chance to do our clean up work. So we basically added the following line of code in the window onLoad event handler:

$(window).bind( "pageshow", function() { $.unblockUI(); } ); 

We still left the old code there so that it works for other browsers and older versions of Firefox.

More info on Adobe Shadow

In my last post I spoke about Adobe Shadow, their new tool for test web applications on various mobile devices concurrently. Since then, Adobe has posted a couple of short videos displaying the capabilities of Adobe Shadow. So what are you waiting for, click on the links below to check them out!


Adobe releases Shadow beta

In this mobile crazy world we work and live in today, as web application developers one of the hardest things to do is testing. With all the various devices and all the various screen sizes, testing your web application to make sure it looks and works properly in various permutations can be a difficult thing.

Enter Adobe Shadow, an inspection and preview tool. Here is how it works. You link a device (phone, tablet) to your main computer and then as you browse your web site on your main computer, the same web site automatically appears on your linked device(s). Furthermore you can remotely inspect the DOM and CSS from the web browser of the device, make on-the-fly changes and see them take effect in real-time. This is a great way to do testing across different devices and get your web application just right. Check out the quick tutorial video to learn more!


Using Flex SDK with Intellij

A long time ago, I use to use JetBrain's Intellij IDE for all my Java development. But since then I have mostly used Eclipse to do so. But with all my HTML/JavaScript/CSS development lately I have been looking for a good IDE for such development so I am considering going back to Intellij in the neat future.

And actually, Intellij has supported Flex very well for long time, so that's a good thing as well. And now that Adobe has donated Flex to Apache, you might be inclined to download the open source SDK and play with it. And if you are thinking of doing so, there is a very nice demo of how to do so right here.


HTML5 Local Storage vs Session Storage

Some new features in HTML5 are really useful, like Web Storage, but you have to make sure you understand how it works and make sure you use it in the correct scenarios. There are actually two ways that HTML 5 Web Storage works: local and session storage. I ended causing some end-user confusion by using local storage all the time, so here is breakdown of how both work and when they should be used.

Local Storage
When using window.localStorage, the data associated to this object will never expire. So long as you don't uninstall your browser (or forcefully delete the data), the data held within this object will remain forever.

So a good example of using localStorage is when you have a web application where you create data and want to remember the last country selected, so the user doesn't always have to re-select it. So write your JavaScript code to remember the last country used and then retrieve it the next time the user comes to the page to preset the last selected country.

Session Storage
When using window.sessionStorage, this data will only be retained for a browser session. Meaning that once the user closes the browser instance, the data is gone.

This is useful when you have a search page and want to always retain and show the last criteria entered by the user. But once the user closes the browser, you want the data to be gone, so when he or she re-enters your application the next time, they start with a fresh page.

New Apache Flex Logo

With Apache now taking over the Flex SDK, one of the first order of business was to get a logo for the project. They did creating a contest and allowing people to submit their own creations. Well as of January 26th (yes I know I am late in posting this), a winning logo was voted upon and you see it here or in animated fashion here.

I think the logo is nice and I am eager to see how the future pans out with all the changes being made this year. Anyways, time will tell, in the meantime you can visit the official Apache Flex website here.


Editing CSS on the fly in Firefox 11

As a developer, designing the look and feel of an HTML site using CSS can be a tedious task. Trying to get the dimensions of components or the colors of elements just right, can surely take its time. Thankfully over time, on-the-fly editing of CSS styles has been added to browsers and this is a great help. If you use Firefox or Chrome, you know what I am referring too, where you can right-click on an element on a page and then select "Inspect Element" using the context menu allows you to see all associated styles, make changes and see the effects of those changes directly on the page. 

There is one complaint I have with this on-the-fly editing method and that is that the UI used to make the changes is too small and can be a pain to work with sometimes. However with the upcoming Firefox 11 release, there has been a new feature added, called the Style Editor. You can access the Style Editor by hitting SHIFT-F7. What it does is display a floating window (see below), that allows you to access all the CSS files associated with the currently displayed page and then make changes on the fly. So nothing new there, but it's more akin to working in your favorite editor and even allows you to save the CSS to a file. It also provides Import functionality, which allows you to quickly load different CSS files and see the effect they would have on how your page looks.

I believe this to be a great development tool going forward, so get the Firefox and give it a try!


Two great books to study JavaScript

Since I've been concentrating mostly on Flex development since 2004 and have been getting back to JavaScript development in the last year, I thought it would be a good idea to get a couple of books to refresh my skills. Thus I've listed below two books which I've picked up recently to this effect:

I've just started reading the second book and I must say both books are well written and are worth the dollars I spent. Both are for intermediate to advanced level and you sure do learn some little nuances of the language that go the extra step to help a developer write the most efficient JavaScript code. So go check them out and become and better developer!

Flash saved my hockey viewing

I've been meaning to write about this since the day it happened, but haven't gotten around to it until tonight. Call me buzy or lazy, doesn't really matter, but hopefully you will find this short story interesting.

I was at home a couple of nights before Christmas 2011 and the Canadian World Junior Team was playing that night. So, like any good Canadian I turned on my TV to watch in HD the fastest sport in the world. But alas there was a little problem. Since early December I had been experiencing problems with my HD receiver on a on-and-off basis. Unfortunately the problem occurred that night and watching the hockey game on my TV was simply impossible. At that same moment I remembered that TSN was streaming the game live on their website, so I went to my PC to watch the game. But sitting on a chair and watching a hockey game is not as comfortable as sitting on my couch. That's when the light blub went off in my head: "wait a minute, why don't I watch it on my Android tablet?". So sure enough, I turned on my tablet, surfed to the tsn.ca website and watched the game in its entirety - and while sitting in my bed now, which was even more comfortable :) 

Thing is, it didn't occur to me until the next day, that it was thanks to the Flash Player running on my Android tablet that I was able to watch the game streaming live. If I would have had an iPad, I would not have been able to comfortably watch the game that night. Just goes to show you, that in 2011 you still need Flash to get the full web experience and that HTML5 browsers still have a ways to go.


My mini-browser review

Being the first post of 2012 and seeing how I am currently brushing up on my JavaScript skills, I'd thought I'd post a mini-browser review.

Over the last month, this has been my browser of choice at both home and work. Based on my perception, it is the fastest browser out there. It is also smooth (meaning initial start-up & opening app tabs) and when something goes wrong, you can just open up the Chrome Task Manager and kill the offending tab. I think its what most people think Firefox should be like. The only downside is that the developer tools are clunky to work with.

Firefox 4+
I have always love this browser from the start and it has been my main browser since then. But do I dare say, it seems bloated at times? The initial start-up can cause it to freeze for 30 secs (with only 2 app tabs mind you) and if a tab crashes, it takes a moment or two to recover. But for development purposes, its tools are unmatched.

Internet Explorer 9
I just can't use it. Its UI, while trying to catch up to Chrome and Firefox is still ugly. Some web sites still don't render properly and it is still behind its in implementation of HTML5/CSS3 web standards. Also how many releases have Chrome and Firefox have their been since IE9 came out? That's what I thought. Slow output from a company that needs to greatly pick up the pace. I'll wait till version 10 to see if my mind changes.

Opera 10+
I think Firefox stole its UI :) I use it from time-to-time to just see what it can offer and its pretty good. Pages load fast and it has interesting built-in development tools. How fonts look could use a little work however. It truly is the little browser that could.