The Register® — Biting the hand that feeds IT

Comments on: How I wrote an iPhone application

Not sure who u will piss off more 

Posted Wednesday 14th November 2007 11:07 GMT

Java or Mac fanboi's, i think i can hear their foot steps coming in the distance, no wait its my team lead better start to look busy....

Ah! A blast from the past 

Posted Wednesday 14th November 2007 11:26 GMT

In the spirit of the "retro" PET article, finally a code listing that we can type somewhere, and then wonder why it doesn't work. Do we get a "corrections" section in next month's issue?

Useless? 

Posted Wednesday 14th November 2007 11:28 GMT

Thumb Up

This removes all references of the iphone from el reg - what's useless about that?

A+ on Java Script... 

Posted Wednesday 14th November 2007 11:48 GMT

F on HTML. WTF did you do? The page is a mess. Youve removed the %ages somehow! It may be somthing else, but I cant be botherd to surch your sorce code. It is hell to read.

Not just Safari 

Posted Wednesday 14th November 2007 11:57 GMT

This also works fine using Opera. (It works on 9.24 under Linux anyway). I tried it yesterday to see what would happen and was most delighted when all mentions of the iPhone changed to 'crock of shite'...

Nice 

Posted Wednesday 14th November 2007 12:38 GMT

Works on Opera under Windows too, although (surprise surprise) not IE7 (although I'm sure you could persuade MS to add functionality in if they know it's being used to have a dig at Apple). Nice to see it reported as the "SHiTEphone" after running the app :-)

@Michael Compton 

Posted Wednesday 14th November 2007 12:51 GMT

Jobs Horns

Javascript isn't Java, and the Javascript fanbois are already pissed off because it's awful. Hopefully the Mac fanbois will already be just as pissed off because the iPhone is awful.

mile wide 

Posted Wednesday 14th November 2007 13:10 GMT

article aside, why does it not wrap in my browser (the article, that is) - its about 2 screens (1024) wide? Someting to do with all the javascript you've put there? weird.

Utter tosh 

Posted Wednesday 14th November 2007 13:19 GMT

Perhaps someone at El Reg who does not think that JavaScript is 'an annoying scripting language with aspirations of objecthood' should have attempted this task. This article seems to be a bitter stab at what the author considers a weak language, rather than an insight into builidng iPhone apps.

Having read to the end, it is clear that the author is unwilling or incapable of learning what is in-fact a very powerful language. I've not yet written an iPhone app, but if I did, I'm sure I would not need to use iFrames in my HTML markup, nor worry about page onload events, or the XmlHttpRequestObject. I'd use one of the popular JavaScript frameworks to do the plumbing - JQuery, Prototype, Dojo, and get rid of those global variables and functions.. maybe even use objects.

Bill. Stick to being a journalist. You're clearly not a developer. Mind you, based on this article, I'm not sure which you are worse at

XMLHttpRequest is a cross-browser standard 

Posted Wednesday 14th November 2007 13:54 GMT

Thumb Down

"XMLHttpRequest doesn't exist anywhere else"

You know, a simple Google search would have saved you from writing obvious nonsense.

http://en.wikipedia.org/wiki/XMLHttpRequest

Worked on the N95 

Posted Wednesday 14th November 2007 13:59 GMT

Thumb Up

It worked well on my N95, and I was tickled with my preferred moniker of sack'o'shite... :)

Back button 

Posted Wednesday 14th November 2007 14:10 GMT

IIRC, you should be able to address the back button issue by altering the window.history Array, as for the onLoad issue, search for the </body> and inject a <script>parentFrame.doOnLoad()</script>.

Firefox 

Posted Wednesday 14th November 2007 14:23 GMT

Works on FF too although the layout isn't quite right.

@ Shakje 

Posted Wednesday 14th November 2007 15:12 GMT

You are most correct my pedantic friend and I stand corrected :) *tongue in check humour, no offence intended* :)

Though they are close enough for me not to particularily like either. Just personal preference though, more a desktop programmer than web, in the immortal words of BG 'it will never catch on' :).

Half works. 

Posted Wednesday 14th November 2007 16:09 GMT

Well, your lovely app seems to work with Safari on a Mac, but it completely fails in Firefox. Although why you'd write applications for the iGorilla is beyond me.

And how is this an iPhone app? 

Posted Wednesday 14th November 2007 16:30 GMT

Thumb Down

I'm sorry if I'm being a bit of an old school kind of guy, but please someone explain to me how writing a javascript web page being an application which is loaded on to your iphone?

Did the definition of an application change when the IT press monikered web 2.0?

Not that I'm being critical of this little "hack" (again old school reference...)...

Any 'Developer' Jobs going at el reg 

Posted Wednesday 14th November 2007 16:57 GMT

Thumb Down

Hmm, doesn't know anything about XMLHttpRequest

Doesn't understand that Javascript does have objects and is a powerful prototype based language (although with many issues!)

Uses javascript global variables

Can't write a valid HTML page.

Uses 'old school' event handling

How much do people on this site get paid to write 'web apps'? I can do a lot better than this and I'm pretty woeful :-) Please let me know how much my salary will be

I'm sure I'm not missing the point here when I say: 

Posted Wednesday 14th November 2007 17:04 GMT

Joke

<?php

$change_to = $_GET['change_to'];

$fp = fopen([document]);

$document = fread($fp , 10000000);

fclose($fp);

echo preg_replace("\biphone\b/i" , $change_to , $document);

?>

... and you don't have to have bloody iPhone either.

Re: Any 'Developer' Jobs going at el reg 

Posted Wednesday 14th November 2007 17:14 GMT

(Written by Reg staff.)

James, you seemed to have skipped over the first paragraph.

Bill Ray is a hack, not a hacker. Our software developers will arm wrestle you any day.

Javascript "language" ? 

Posted Wednesday 14th November 2007 19:39 GMT

Flame

"it is clear that the author is unwilling or incapable of learning what is in-fact a very powerful language."

I reel in shock from the sudden IQ loss. All I have to say about JavaScript is what Joe Buchanan said about Frankenstein's Monster: "It's an abomination in the eyes of God".

Instead of dying as it should have, some wise-crack decided to "mate" the damn thing with Web Services, which were NEVER meant to be used by end-users, but instead for B2B EDI transactions, and create the AJAX "technology". Urggggh...

That said, its a useful app 'coz it blocks "iPhone" and its source code shows how shite the Javascript "language" is!

I prefer server-side Java (J2EE) or even client-side, as it'll run independently of your browser or OS.

@Javascript "language" ? 

Posted Wednesday 14th November 2007 21:07 GMT

Stop

> I prefer server-side Java (J2EE) or even client-side, as it'll run independently of your browser or OS.

Right, because I really want to have to load an external VM and suck down huge quantities of memory and CPU cycles just to have a little interactivity on my web forms. On a mobile device even. That'll be sweet.

Seriously, yes Javascript has its fair share of problems - probably more than a lot of other common languages - but if you really think its object model is weak then you're doing it wrong. Go read a book - hell, a web page - and come back when you know something about the subject.

@By Daniel B. 

Posted Wednesday 14th November 2007 21:44 GMT

Flame

Amen Brother.

The app can't even work consistently across versions of Safari, let alone play nice with IE and Opera!

Do everything server side and render nice HTML. A shame that javascript was never replaced by a client side equivalent of Java or PHP with access to the browser DOM....

JQuery 

Posted Wednesday 14th November 2007 22:12 GMT

Let me emphasise something an earlier commenter mentioned.

Use JQuery.

JQuery.

Don't not use JQuery.

http://jquery.com.

From someone who's happy that JQuery makes Javascript into a language that looks as though it was designed to interact with the DOM (CSS3 selectors, no less), rather than one that looks like Java, which clearly was not designed for this task.

GreaseMonkey? 

Posted Thursday 15th November 2007 02:45 GMT

Boffin

Sounds to me like your app does the sort of thing GreaseMonkey is very good at. If you could turn your app into a full GreaseMonkey thing, it might actually become popular.

Wake me when it's all over ... 

Posted Thursday 15th November 2007 09:47 GMT

ZZZZZZZZZZZZZZzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz...................

I know I am going to get flamed for this but... 

Posted Thursday 15th November 2007 10:57 GMT

Dead Vulture

...I don't care.

Your article was, quite frankly, poor. You clearly did NOT research your subject matter before posting, somthing which is becomming more and more prevelant across dead reg.

The code is an abomination, whilst I won't get drawn into the JavaScript is shite debate (it is shite, but I have no need to qualify that statement) you could/should have at least made sure your code works properly. For a start it is possible to do what you have done on ANY half modern browser, any good developer of web based systems knows to make crosss browser capabilities a priority. But, your not a developer.

Once again a register posting that could have been somthing usefull, let down by lazy 'reporters' who have about as much IT knowledge as a cabbage...sort it out or close down.

what has this gota do with an iphone ??????? 

Posted Thursday 15th November 2007 13:09 GMT

Thumb Down

This is a beginners guide to a javascript webpage. Thats it {shrug}

This has as much to do with an iphone as it does Windows CE, WML etc.

But then is that meant to be web-2.0 ironic ???

hmm 

Posted Thursday 15th November 2007 19:25 GMT

Stop

Here's a useful resource for anyone that mistakenly thought this article would be useful for anything other than starting fires: http://groupaware.mobi/iphone/#_Samples

@M Gumby and anon. 

Posted Saturday 17th November 2007 18:08 GMT

Paris Hilton

Believe it or not, Jobs and Co. have actively tried to break any and all hacks letting people install their own software onto their own devices with each new firmware release. Despite Apple fans calling it a smartphone, it is not -- the end user cannot install their own apps. Apple's official method to write apps "for" the iphone is to do javascript, html, ajax, etc.

As for XmlHttpRequest, on paper it's standardized. In practice I keep reading about people having to throw in hacks to make it work properly on various browsers.

Works in Konqueror 

Posted Sunday 18th November 2007 20:14 GMT

Thumb Up

which might not be too much of a suprise.

Snags:

The buttons in the bottom frame are a bit over sized, and the couple of second delay while nothing happens.