Announcing a series of web conferences organized by Adobe Romania

On February 2nd we will host the first conference from a series of conferences about web technologies and development. Our presenter will be Vincent Hardy, principal scientist at Adobe Systems.

See you on February 2nd!

You can find more info about this conference and register here (the presentations will be in English).

PS. I am so happy to see this finally get started as I’ve been working on it for some time.

Getting Started with PhoneGap resources

If you want to learn how to use PhoneGap to build mobile applications with JavaScript and HTML, one good way is to watch this great series of nine videos. My fellow evangelist Kevin Hoyt spent some time in the studio for shooting and the result is great. It will take you less than a hour and a half to watch all the videos.

Here is the list:

Read more

Barcelona Mobile World Congress

February 26, 2012toMarch 1, 2012

gotoAndSki() 2012 Switzerland

January 26, 2012toJanuary 28, 2012

I will be presenting at gotoAndSki() conference.

Debugging web pages remotely using a PlayBook tablet

In  a previous post I explained how you can use weinre to remotely ”debug” web pages that run on your mobile devices. If you are familiar with weinre then you also know its biggest limitations: no JavaScript debug support and CSS styles introspection.

Now there is no need to be sad if you happen to have a PlayBook device. If so, then you are back in business. What do I mean by that? I mean full access to Web Inspector/Developer Tools goodies while browsing web pages on the PlayBook tablet. Yes, including JavaScript debugging and CSS introspection.

A question or a doubt might pop in at this point … how this could this be possibly useful for developing web applications that run on mobile devices when Android and iOS devices have the greatest market share? Relax my friend, no need to lose your faith :D Because iOS, Android, and PlayBook default browsers are all based on WebKit. Although there are some differences between them I think they are close enough that you can get lots of value out of using the PlayBook device as the “debug” mobile platform. It also performs fine, at least today. I mean it is not too far off from the latest mobile phones or tablets.

So let me guide you through the steps you need to complete if you want to remotely debug web pages using a PlayBook.

Read more

Canvas Quirks

While using Canvas 2D context for drawing stuff I discovered that the drawing line API can surprise you a bit especially when drawing horizontal or vertical lines. Here is a screenshot with a Canvas element and 5 lines drawn using lineTo() calls:

In case you haven’t noticed, let me tell you what’s wrong with this: the lines are suposed to be 1 pixel width and black. Clearly what you see on the screen is not 1 pixel and the lines are somehow grayish. It looks more like 2 pixels. The code for drawing this looks like this:


<input onclick="draw()" type="button" value="draw" />

<script type="text/javascript">// <![CDATA[
function draw() {
    var context, i, y;

    context = document.getElementById('canvas').getContext('2d');
    y = 20;
    context.lineWidth = 1;
    context.strokeStyle = '#000000';
    for (i = 0; i < 5; i++) {
       context.moveTo(0, y);
       context.lineTo(450, y);
       y += 10;
    }
    context.stroke();
}
// ]]></script>

Let’s change the line width to 2 (line 10 in the above code snippet) and check the result:


Interesting, isn’t it? So the lines width is basically the same, but the color now is really black. Now, let’s try something else: change the line width back to 1 and adjust the y property of the moveTo/lineTo functions with o.5 (line 13/14):

context.moveTo(0, y + 0.5);
context.lineTo(450, y + 0.5);

And surprise, surprise the lines are now exactly 1 pixel and black:

So what’s happening? After some research I think that this is what is happening:

Using fillRect() function instead of lineTo()

If you don’t like adding those 0.5 to any coordinate when using the lineT0() API then you can actually use the drawing rectangle API. As you probably already guessed, the trick is to draw a rectangle of one pixel for one dimension and the length you need for the other one. So here is the script for drawing 5 horizontal lines:

function draw() {
    var context, i, y;

    context = document.getElementById('canvas').getContext('2d');
    y = 20;

    for (i = 0; i < 5; i++) {
       context.fillRect(0, 10 + y, 450, 1);
       y += 10;
    }
}

And here is the result:

If you are wondering about performance differences between lineTo() and fillRect() then you shouldn’t. fillRect() is probably even faster than lineTo().

You can see here a page that illustrates the differences between lineTo() and fillRect() when using integer coordinates.

Debugging Web Pages and PhoneGap apps on mobile devices

If you are a web developer chances are that Google Chrome Developer Tools, Safari Web Inspector, or a Firefox equivalent are your best friends when it comes to debugging web pages (check CSS styles, verify generated HTML, or debug JavaScript). Isn’t that great? I mean not so long ago we used to debug JavaScript using alert() calls.

Once you get used to these tools it is hard not to have them. And this is exactly what happens when you move to mobile web development. As you probably know there is no web inspector running on your iOS device browser.

How do you debug your web apps when running on mobile devices? The best answer to this question is using weinre (if you know a better way, please let me know).

Read more

Happy New Year!

I intended to write this post last month. But because the last two months were so busy, in the end I could find neither the time nor the energy to write. So here I go with my first post in 2012 that partially talks about 2011.

Speaking of the previous year, I’d like to extend a big thank you to all my readers and followers. Knowing that people will read your posts and send feedback is like fuel for engines. Next, I’d like to say thank you and applaud all the community leaders who worked so hard to organize events. I know firsthand the hard work needed to put together an event. You guys did an amazing job in 2011. I feel both proud and lucky being able to be part of some of the events you organized around the world.

People asked me what the highlights of 2011 were for me. Many things come to mind, but once I boiled them down they distilled  down to only two:

  1. Adobe AIR and Flex demonstrated that development for multiple mobile platforms can be both fun and efficient. Indeed, what started as a promise back in 2010 grew to an amazing platform in less than a year.
  2. Adobe increased investment and effort in HTML/CSS/JavaScript. The last part of 2011 only accelerated a process that started long ago and produces things like: CSS Regions and Exclusions, CSS Shaders, Dreamweaver support for jQuery and PhoneGap, contributions to WebKit and jQuery Mobile. The PhoneGap and Typekit acquisitions cemented these trends and set up a perfect scene for more things to come moving forward.

What about me (I know, I know it’s a bit too much :D)? Well, I couldn’t be happier to tell you the truth! I am still having the time of my life and enjoy every bit of my job :) I’ve been doing evangelism for almost four years and I’m looking forward to many more. However 2012 marks a change regarding what my focus will be: I will focus more and more on HTML, JavaScript, and CSS. And I have to confess that I’m excited. First, because this is how I started to make money programming years ago (HTML/JavaScript/CSS and server-side technologies). And second, I think Adobe is extremely well positioned on moving forward the web standards and HTML authoring/services tools.

What about Flex, AIR, and Flash Player? Despite what some people are saying I think they will be doing great. The runtimes are pushed harder and harder because Adobe wants to make the Flash Platform the game console of the web. This means that even if you are not in the gaming industry your Flash apps will benefit. What about Flex? I think the Flex framework is mature, it has a great community around it, and it is used for big enterprise projects and consumer apps. Having said that I think that the Flex framework will be relevant as long as the community wants it to be. Because if the community doesn’t believe in it and stops using it then it doesn’t matter what Adobe does and who’s behind it. I will surely keep an eye on what you guys will be doing :).

I wish you a Happy New Year!

Switch to our mobile site