Building iPhone Apps with HTML, CSS, and JavaScript

Just finished Building iPhone Apps with HTML, CSS, and JavaScript: Making App Store Apps Without Objective-C or Cocoa by Jonathan Stark. It’s a nice introduction to building iPhone applications without having to learn the nuances of Obective-C.While not a very in-depth book, the examples were clear and easy to understand and should provide any experienced web developer with enough knowledge to not only build iPhone apps, but to re-purpose websites for iPhones. Read more of this post

Advertisements

Drag and Drop with Javascript

I found the following article by Mark Kahn: How to Drag and Drop with Javascript while working on a solution for dragging and dropping boxes on web page. Mark’s example works really well except for one small problem: in Firefox, Safari, and Chrome, the boxes disappear as you drag them on top of each other…only to reappear after you’ve released the mouse button. IE works properly. While not a big issue, it’s a little annoying.

I did a little digging and found the solution. In the mouseMove function (shown in the article), there are two lines of code that find the current position of the box that’s being moved:

dragObject.style.top  = mousePos.y – mouseOffset.y;
dragObject.style.left = mousePos.x – mouseOffset.x;

In order to work properly in Chrome, Firefox, and Safari, the calculations need to have to include a “+’px’” to identify the coordinates as pixels:

dragObject.style.top  = mousePos.y – mouseOffset.y+’px’;
dragObject.style.left = mousePos.x – mouseOffset.x+’px’;

This should work in all Javascript enabled browsers and is technically the right way to perform calculations involving pixels.

Engadget Interview with Jonathan Schwartz

Just read the Engadget interview with Jonathan Schwartz, Sun’s CEO, on porting Java to the Google Android platform, and mobile platforms in general. According to Mr. Schwartz, not only is he using an iPhone, Sun’s committed to delivering Java for the device. When asked about Google’s Android platform, Schwartz turned attention to the upcoming JavaOne conference. Anyone who’s used some of Google’s developer products (GWT for example) already knows that Sun is working very closely with Google.

I have an iPhone also. I’ve been playing with the iPhone SDK, developing a couple of test apps. While I like the phone, I’m less excited about developing applications for the iPhone than I am about it having a Safari browser. I’d much rather use GWT to develop Ajax applications that can be run on IE, Firefox, Safari, Mozilla, and Opera browsers.

Think about it, developing rich client programs for browsers opens up a world of web enabled devices to you.

Ajax in Action

I just finished reading Ajax in Action by Dave Crane and Eric Pascarello. I was surprised to find that I’m already incorporating pieces of Ajax into sites I’ve developed…I just didn’t know what I was doing had another name. And, if you’re like me, you’ve been attempting to create rich (fat) client interfaces into your web applications using CSS, JavaScript, and DHTML for some time. The book’s examples involving these concepts will be very familiar to you.

I particularly enjoyed examples involving the XmlDocument and XMLHttpRequest objects. The authors did an excellent job of explaining the use of these objects within the Ajax framework…some of you may object to my calling Ajax a framework, but that’s how I categorize it. Crane and Pascarello also do a good job of tying Ajax into the MVC pattern. Another bonus, for me at least, was an introduction to the X library of JavaScript functions for handling JavaScript across multiple browsers. You can find out more about the X library at cross-browser.com

If you’re looking for a good book on Ajax, try Ajax in Action. It’s money well spent.

%d bloggers like this: