Thursday, 11 November 2010

iPhone SDK Troubles - Web Services

«I'm sorry Dave. I'm afraid you have to write it by yourself»

Write a web service should be easier than implement a new protocol. The iPhone SDK is an endless source of surprises to me. I discovered there's no methods to encode a NSString in base64; no library to write easier data and HTTP headers; and just a small C-function to get a MD5 hash. Ok, it's enough to get an hash, but it's not well embedded on Cocoa-Touch.
Ok, I can still write them by my own. But I really can't understand how is possible a network-oriented platform as a smartphone doesn't have this basic functions. Do you think they're not "basic"? Well, Python and PHP have them as built-in modules. And on Android? I found the answer here.
Anyway, a web service on iPhone is just a NSMutableURLConnection, with HTTP headers setted with [theRequest addValue:@"text/xml" forHTTPHeaderField:@"content-type"], passed to a NSURLConnection.
But I will pass the night writting the other necessary functions.

Wednesday, 10 November 2010

Buy now your new iBrick!

Think heavy

A news from Ars Technica


I am (for work) a iPhone 3GS user. I like my phone, it works well and it has a large application store. ACTUALY I haven't troubles with my iPhone. But last Apple politics doesn't calm me down. When I bought my Macbook Pro I was convinced I could buy another PC after five or six years, maybe even more. I'm still convinced this is true, because Apple's tight integration between hardware and software is good. But his "tight integration" is becoming a hell on iOS devices.
Building a software good for a Mac G4 and a Mac-Intel isn't easy. Anyway, if I should have Mac G4, I will probably accept it's slower to launch a program than a new Mac-Intel. But a smartphone isn't a computer and it has a completly different "way of mind": when I compose a number, if I have to wait three seconds, I think something is going wrong; if I see a delay when scrolling my contacts list, then I think there's too many processes in background.

Apple forbids iOS downgrade to prevent users to pass to a jailbreakable version. I can understand this. But I can't understand how Apple can pretend that a user gently accepts to choose between a unusable "brick" or 500$ to buy a new iPhone 4. I can understand that supporting patches for three or four iOS versions (e.g. 2.x.x, 3.1.x and 4.1.x) to grant a unbreakable OS for different hardware isn't easy neither cheap. But these solutions aren't well accepted.
After the drop of XServe line, I expect more attention on its consumer products.

Tuesday, 9 November 2010

This is my Way (land)

This is "MY" way: AC/DC, no Sinatra!
 In these days, the FOSS world seems shaked by a earthquake called "Ubuntu". Mark Shuttleworth, founder of the most widespread GNU/Linux distribution, in a post on his blog, talks about the possibility to replace X.org and the whole X-Server architecture with the modern and clean Wayland display. Mr. Shuttleworth admits X.org is a living project, more active now than ever and he admits and it's die hard. But, also, he said

«[..] we don’t believe X is setup to deliver the user experience we want, with super-smooth graphics and effects.
[..] We’re choosing to prioritize the quality of experience over those original values, like network transparency.»

Yeah mr. Shuttleworth! This is the first time I heard statements like this since the Waldo Bastian's analysis about KDE[1]. Statements about the importance of user experience over technical decisions

Now, let's see differences between X.org and Wayland

X architecture (curtesy of Wayland's site)


As you can see in this graph, rendering a frame is a very long path of APIs. And this is because (from Wayland's site):

«In general, the X server is now just a middle man that introduces an extra step between applications and the compositor and an extra step between the compositor and the hardware.»

Now, let's look Wayland's architecture:

Wayland's architecture (curtesy of Wayland's site)


In this graph, you see that Wayland embeds the compositor. This reduces passages to render a frame and then, accelerate displaying speed. But, most important, Wayland embeds the detection of window whom recive an I/O message (such as a click). This task, in X, is done by the compositor: in Wayland is part of the display manager.

Wayland, also, it's smaller than X.org and less resources-hungry. These features makes it perfect also for small computers, such as netbooks and tablets. Furthermore, X can works as a Wayland client and this can help the passage to the new display manager.
It's true Wayland doesn't work on old hardware. But this means we'll never use it on a Pentinum I 233. About this, mr. Shuttleworth said

«The requirement of EGL is new but consistent with industry standards from Khronos»

And he's right. Now the bad news: NVidia (AaronP's words) say

«We have no plans to support Wayland.»

Does this means the end of Wayland project? Who knows? Actually NVidia just said ACTUALLY they have no plans, so in future this decision could change. Anyway, a passage to Wayland is a big step for FOSS world, at least as the begining of KDE project.

[1] I read this analysis on a italian magazine (Linux &C.), when KDE 3.0 was released. I can't find Waldo Bastian's post anymore, because all forums are now dead-links. Can you help me to find it?

Monday, 8 November 2010

Adieu XServe

I'm sorry too, XServe
Another move from Apple. XServe, the Apple-based server rack, will no more shipped from january 31 2011. It's a big delusion. I always dreamed to work on a XServe with Mac OS X Server. I was so curious to test its power, the usual tight integration between hardware and software and its user interface.
Will Apple exit from the servers makert? I don't know: is still possibile "convert" a Mac Pro or a Mac Mini into a server installing Mac OS X Server and this document shows how to do. Probably, they're just cutting unnecessary hardware. But, as you can read, to have the same power of a XServe you need from 3 to 30 MacMini; obviously, a MacPro is a bit bigger than a XServe.
In few words, Apple admits its big-iron line is no profitable. Apple is great for the client, but sysadmins with really big requests, still prefer to work with IBM or SUN servers with GNU/Linux or Solaris. Well, «this is business» (citing Lance Vance).
But, let's reflect: a Mac Mini costs 600€ and it's ready to work out-of-box if you install Mac OS X Server. Ok, it's not powerful as a SPARC T3-1 Server or a "home-build" server with GNU or *BSD, but for a small company whom needs a mail server, file server and a SVN it's enough. With the same price you can purchase another Mac Mini as "backup unit". If there's a system fail, with Time Machine it's easy to restore all services in an hour. Ok, it's not enough for a medium or big company. But there are more small companies and some of them already use Apple solutions. Apple isn't interested to face IBM or Oracle on the big-servers battlefield. But these small companies, with 8-20 employees, can't buy (and aren't interested) on big-irons: a Mac Mini or a Mac Pro are more affordable than a Blade Server and easier to configure and to mantain than a GNU/Linux or *BSD.
So, is this the end for Apple's servers? Who knows? Market is a strange beast. Maybe we'll see clusters of Mac Mini; maybe Mac OS X will allow to "assemble" some Mac Minis into a single system; maybe the Mac Pro will become an "ibrid" (iBrid?) between a big client and a medium-sized server. Let's see. I hope we'll enjoy the show.