Mar 09

palm-run: a walk through of building a new webOS application

Palm, Tech, webOS No Comments »

As developers, we often build scripts and tools to sharpen our workflow. One of the simple scripts that I am refining is palm-run, my swiss-army knive of a tool that deals with packaging, installing, launching, and tailing logs as I develop my application.

I put together a walk through of palm-run in the context of creating a new webOS application from scratch. In the screencast below I cover:

  • Generating your webOS application structure
  • Implementing a one-scene application
  • Packaging the application and running it in the emulator
  • Running an IPK directly, no packaging here mate-y
  • Setting up your application for development and production uses (more below)
  • Using the Palm Inspector to take a peak at the structure of your app as it runs

(I recommend going full screen on this bad boy to help read the deets.)

Development vs. Production

I wanted to go into a bit of detail on this one. When you build an app you want to have different builds for development and production. In development, you want debugging turned on with verbose output. In production, you want to exclude all but the necessary files.

The latest version of palm-run lets you tell it that you fancy production mode via -P.

You can enhance your webOS application to do more in this world by doing the following:

  • Create a config directory at the app root
  • Create framework config files for the two use cases. Here are two common versions:

    Development

    {
        "logLevel": 99,
        "debuggingEnabled": true,
        "timingEnabled": false,
        "logEvents": false
    }

    Production

    {
        "logLevel": 0,
        "debuggingEnabled": false,
        "timingEnabled": false,
        "logEvents": false
    }
  • Create exclude files for the two use cases (excludes_development.txt and excludes_production.txt)

Now you are set. To see a shell app that uses this, check out palmrun-configtest. If you build the app you will see that there isn’t console output if you palm-run with the -P option.

What else would you want a high level program like this to do for you?

Dec 17

Project Ares: An awesome mobile web IDE built on the web

Ajax, Palm, Tech, webOS with tags: No Comments »

I am so excited for the Ares team at Palm today as we launch Project Ares a web based IDE for the mobile web.

The full experience packs a lot into the browser: visual designer, code editor, visual debugger, log viewer, source code integration, drag and drop file upload, built-in app preview, and the ability to run your app directly in the emulator or even the device!

I talked more about the details on Ajaxian and the Ares site has more.

I am so jazzed to see this out there. At Mozilla we saw the Ares team building this great product that uses Bespin right now for the code editor, some of the server side, source control and debugger (the first sighting of Bespin debugger!)

The team has worked incredibly hard since then to build what you see now in public beta form.

This also shows how awesome the web platform it is. Because webOS builds on the web we are able to have features like the “preview” feature that shows you how your app will look without even having to go to the emulator or device.

The performance of the app says a lot too. It is incredibly responsive for me, especially since there are a lot of features packed in there. The layout system is really well thought out too and is a dream when you compare to CSS fun. I can’t wait to see what the community has to say about Ares, and I want to hear features that they would like. After using this, I want to be able to build all kinds of web apps from it ;)

I also want to say thanks to my Bespin team mates and community as well as the new friends I have made at Palm. Matt, Scott, Steve, Frankie…. you guys are awesome and it is amazing to see what you have done in short order!

Nov 04

Having your webOS application wake up for background tasks even without an open window

Palm, webOS 1 Comment »

When you think of a Web application, you think of going to an HTML page that then loads scripts and resources to display functionality. Applications in general do not always fit that model. If you launch an “application” like Growl on the Mac, a window doesn’t launch. It merrily kicks off a service in the background.

The same is possible in the world of webOS and browser extension systems. One of the user experiences that I enjoy on webOS is the notification system. Non-modal, and any application can tie into it. There are various levels of notifications:

  • Banners: Thin bottom line one liner that appears quickly
  • Icons: Notifications are grouped together in time
  • Dashboards: Larger areas. A DOM window so you can put controls in there. For example, the media dashboard lets you play, pause, etc.
  • Popups: Even richer larger actionable areas

More on these notifications in another post. If you have an application that wants to tie into the notification system you can do so even if a window isn’t open.

I wanted to find out how to do this, and luckily Mitch Allen has a simple example of this in his RSS News application that he builds in his book on Palm webOS.

I hope to offer a simpler API specialized for this, but it is quite trivial to do thanks to the Power service. The timeout service is located via palm://com.palm.power/timeout and there are various properties that you can pass in to do the real work when you are woken up. What application should be opened? What task should be run when opened? That is all tied in via the application manager service (e.g. see the palm://com.palm.applicationManager/open service below).

The wakeup code in the news application is defined in the setWakeup method in the main application assistant (NOTE: assistants help with the controller part of MVC in Mojo):

// setWakeup - called to setup the wakeup alarm for background feed updates
//   if preferences are not set for a manual update (value of "00:00:00")
AppAssistant.prototype.setWakeup = function() {    
    if (News.feedUpdateInterval !== "00:00:00") {
        this.wakeupRequest = new Mojo.Service.Request("palm://com.palm.power/timeout", {
            method: "set",
            parameters: {
                "key": "com.palm.app.news.update",
                "in": News.feedUpdateInterval,
                "wakeup": News.feedUpdateBackgroundEnable,
                "uri": "palm://com.palm.applicationManager/open",
                "params": {
                    "id": "com.palm.app.news",
                    "params": {"action": "feedUpdate"}
                }
            },
            onSuccess: function(response) {
                Mojo.Log.info("Alarm Set Success", response.returnValue);
                News.wakeupTaskId = Object.toJSON(response.taskId);
            },
            onFailure: function(response) {
                Mojo.Log.info("Alarm Set Failure",
                    response.returnValue, response.errorText);
            }
        });
        Mojo.Log.info("Set Update Timeout");
    }
};

Mojo applications have a certain lifecycle and your application will get callbacks for setting up, shutting down, activation (when you come back to a scene), deactivation, etc.

Thus, you will see that setWakeup is called in the main AppAssistant.prototype.setup and when the application is launched AppAssistant.prototype.handleLaunch.

Anyway, suffice to say, having a lot of fun digging into webOS.

Oct 06

An intense couple of weeks; Palm Developer Program announced

Palm, Tech 17 Comments »

launchingprogramwithben

The first couple of weeks at Palm have been a whirlwind. We wanted to get a developer program out there, and it happened in short order! Add to that the fact that I had the fortune to see a beautiful new son come into this world. Phew. I need to get my breath back.

Ben and I were incredibly excited to be able to come out with a program that gives a glimpse of our vision. In a kick-off event at the Mighty club, we got to share the vision, along with the details. For the nuts and bolts read here, but for some thoughts on the vision and key elements, read on:

We told the story of why we are so excited about Palm and the mobile Web as a-whole right now. It feels like there is a real convergence happening between: the fact that the mobile device hardware has become the hitchhikers guide to the galaxy, or so it feels; and knowing that browser runtimes have finally become application runtimes. There is a lot of room for both of these technologies to grow, but we have reached a good place already. What’s now happening is that we’re bumping up against the browser sandbox like crazy and we’re all trying to expand out what’s possible on the web. We’re doing this because for all its warts, many of us see in the web the potential to be The Platform that we can use across all of these emerging devices to bring sanity to application development. Imagine a world where you can develop Web applications that you can deploy to a plethora of devices and form factors. We have a real opportunity to make this world a reality, and it will take the entire Web community to make this happen.

What about the program itself?

We announced tonight that we’ve decided to free developers to release and market their applications via the web. When you decide to release your app, it is assigned a URL that you can distribute any way you like. With that URL, the user can install the application on the device. With this mechanism, you skip any review process and get a direct conduit to your users.

But for those who want the catalog experience, we’re investing heavily in the creation of a fantastic application marketplace–one that we carefully manage and organize, and where we review each application. There’s so much innovation that can happen here in terms of providing promotional opportunities for your applications and in making them discoverable, and we’re thrilled to be playing in this space.

We going to charge $50 for each app you submit to this catalog, recognizing its value as a distribution channel and as a friction point to control the flow of apps into it.

We actually want the web to win for distribution. We want to see people innovate in marketing their applications themselves and solving the app discovery problem.

To facilitate that discovery, we’re making raw feeds of all the applications available to help you create your own catalogs of applications. We can’t wait to see what people come up with here, and we’re confident the result will strengthen the app ecosystem.

Open source developer program

Almost every line of code I have written for the last 4 years or so has been open source. The Web itself stands on the shoulders of open source (Mozilla, WebKit, Apache, Dojo, jQuery, etc) and it only felt right that we should have a program for open source developers and projects. If your webOS application is released under open source, the $99 program fee is waived.

This is just the beginning. We are hopeful that a vibrant open source community will grow around the mobile Web and Palm. I would love to see tools and services that help make this happen.

The feedback that we have already gotten has been fantastic. We have gotten great ideas on what we should be doing with the platform itself as well as the program. Not that a vision is set, it is time to build on today’s actions by continuously making good decisions for the community. When Palm brought Ben and I into the fold, they indirectly brought in the Web community that we love to be a part of.

Ok, I have gotten little sleep due to a lovely new baby, and a fantastic new opportunity at work. Now it is time to close the laptop, rest up, and work with you to create some kick arse Web apps for devices.

I want to thank the hard work of my new colleagues at Palm who made this happen in short order, and also the great crowd of Web hackers who came together to help make tonight such a fun event. I can’t wait for the next one, and to keep talking.

What do you want to see from us next? Also, if you are excited about the mobile Web and what we are doing, our group is hiring fast and we would love to have passionate advocates who love the technology as well as working with all kinds of developers!

Sep 25

Web platform + Mobile future = A new adventure; Joining Palm with Ben

Palm, Tech 39 Comments »

palmpixi

I remember watching the Palm Pre coming out party at CES with Ben and thinking “wow”. Palm had bet big. They had bet on the Web platform being the base for their new amazing hardware device, and becoming their platform going forward. Given the lead time required to create a device, I was impressed by their forward thinking. It was at this time that Ben and I were exploring how far we could push the Web as an application platform by creating Bespin with the Mozilla Labs team.

Fast forward to today, and I find myself taking on a new challenge with Palm. I will be joining Ben, my best friend, partner in crime, and fellow Ajaxian, as we take a new role as Director’s of the Palm Developer Relations team. We will have the responsibility of the developer experience with Palm. We will be trying to create a rich connective tissue between the company and the Web developer community that we love.

This feels like a pivotal time for the Web. We have a convergence of:

  • The personal Web (some are calling this the you-centric Web)
  • Mobile is truly here. With smart phones that are full computing powerhouses, we are seeing amazing experiences thanks to hardware and software working together
  • The Web browser has become a rich platform and powerful runtime

It also feels like we have only just begun. Browsers aren’t just getting a touch faster, they are getting exponential performance improvements. With HTML5, we are getting new richer APIs that cater for developers trying to create applications versus pages.

I have only really dabbled in the mobile world up until now. I have always been excited about consumer electronics, but never really got into the developer environments. I remember looking at the testing setups at companies such as Google, and realizing the pain in getting applications working across a huge slew of different proprietary API and capability. There is a massive opportunity with Palm webOS to give Web developers the ability to deploy outside of the browser, and onto the device.

I have long been frustrated with the status quo with certain platforms, and as I thought about what makes me happy as a developer, it is freedom, choice, and information flow. I feel passionately about bringing these values to mobile, and carry my Web DNA with me. When Palm came to Ben and I, we were curious to see how much they understood what it really meant to have a “webOS”. The management team impressed us, and persuaded us that they understand how important the principles of the Web are, as well as the crucial role of developers. By giving us the honor of this responsibility, they signal their intent.

Speaking of the Open Web, that brings me to Mozilla. It is a unique opportunity to work for a mission based organization such as Mozilla. They gave us the chance to work on projects that we care deeply about such as Bespin. Bespin has already grown beyond our dreams. It feels like we get daily emails from developers talking about how they are using Bespin in their own projects. Embedding it here, hacking on it there. You gotta love open source. I want to make it clear that Bespin will continue to go from strength to strength, and I can’t wait to see it revolutionize the way that we build applications. There is a fantastic community around the project, and the Mozilla Developer Tools Lab will continue the charge. It has been hard to move on, but the fact that Mozilla is a community gives us a unique opportunity to continue to work with the Bespin project. You can’t say that about too many companies out there.

So, I want to thank the Mozilla community and look forward to continuing to work for the Open Web with you. The crew in both Labs and the entire company is phenomenal. I can’t wait to see the great things that will continue to come out of the project.

Now is the time to knuckle down to create the most amazing developer experience in a mobile environment for you. I look forward to set an example with Ben on treating developers humanely, with trust and transparency. I won’t just use the word “open”, I will define what it means to us.

I hope to see you on the flip side, and look forward to continuing to participate in the Web community with you!