iPhone programming

iPhone is the brand-new Apple product which has changed the way Apple thinks. Because of iPhone, Apple strip the word "Computers" from its brand name. And because of iPods and iPhone products, Lepoard developmenet slip a bit, blurring the focus on pure technology.
To be true, I do not beat on  the iPhone success, but the product success is at least  bright this year. And the iPod touch has also added value to the iPods product catalog. But I am an IT-man, damn you boy! So I want to buy it to play with it, to program with it!

The iPhone Open Application Development, is a fresh book on iPhone Developement, edited by O'Reilly which come into play. The book has less then 280 pages, and is well organized. First of all, the bad news: the book lacks figures and tables (only one, and not so useful) and no Photo on it. Then breaking the iPod firmware is not a thing Apple likes a lot. As far as I know, it is NOT illegal, because Apple is opening the device too.
Anyway, breaking the iPhone firmware can prevent you to get the upgrades so, you must know what you are going forward to do.

And now the good news: the book is well written, and guide the user from the beggining to the end.  There are a lot of way to free the iPhone from the jail.

After that, you can also use Linux to program on the iPhone, where the Apple SDK seems only "PC Mac"-enabled.

The book is composed of 7 chapters. After unlocking the iPhone (first chapter), the author explain us how to write code for it, and what is Objective-C. Objective-C is a very nice idea developed by Brad Cox, in the 1980. It is a C++ language "ante litteram". I like the ideas of Objective-Ch because you get the power of C for fast tasks (like  you know, coding your quicksort or your perfect B-trees :) and you get a true dynamic O.O. language, like SmallTalk is. Objective-C was not so lucky, and there are only two major implementation: the GNU one and the Apple one, used to build the entire MacOSX.
I have no time to study it a lot, but I suggest you to code the iPhone in Objective-C.
Then the books start to explore iPhone features like:

  • Basic user interface building blocks
  • Graphic Services and animation effects. You get also a Coreflow-like animation in the Appendix
  • Sound Control
  • Deep integration. A nice thing is the way to make calls: you simply ask the emmeded Safari to open a "tel://" url

The code presented is always very compact, and the style is nice.
The Appendix give us a lot of code samples.

Programming a so riche device is not easy, but the good news is you have a full O.S. to work with.
Java midlets and J2ME are much more difficult to use, if you will find your way with Objective-C.
A very good book, for very nice techno-guys, and not (only) for nerds!

 

 

 

pyparsing review

This is the sad true: parsing is boring. And writing parser is even worst.

If you can choose a scripting language for parsing you can think to do it in perl.

For this way, take a big breath and go in the black sea  of perl's funny regexp. They are funny only if you have that special love for the regular expressions.

But if you are more confortable with python, pyparser is a better solution.

Pyparser is a library written in Python, for building parser described with a BNF (Backus-Naur Form).

O'Reilly has just published a "Short Cuts" e-book written by Paul McGuire; in less then 70 pages you get a very good insight of pyparser.

Even if you are new to python, the book is very easy to read.

And if you do not know nothing about parser and Backus & Naur, you will find an easy path to understand it. Parsing is a tricky topic because of the grammar theory behind it, but for all-day work, you can follow the McGuire introduction.

After some simple example, you'll dive into a small web page parser.

It is very amazing how you can do extraction from web pages without a complex Sax parser, and using only  a very compact grammar.

After this intro examples,  the manual take us to a more complex task: a lisp-like expression language parser called S-Expression.

This example is important because complex data structure are oftern recursive as S-Expression are.

The last chapter, "Search Engine in 100 Lines of Code", is a well-written example, and show us how to build a small search-engine-grammar.

 So this e-book is a "must" if you need to do even simple parsing and you… do not want to become crazy with too regular expressions :)

 

 

 

 

iPhone success is hard

iPhone is a very nice project, well designed and manufactered, but the market addressed is
an hard bet for Apple.
Big players are already on the ground: Nokia, Motorola, Samsung and Sony for instance.

So it is difficult to play in such market, and some analysts said  "the touch screen was not successful for GSM/phone products".

The launch of "iPod touch" addressed this fear in my own opinion, because the design of the iPhone is very cool, and you can try to at least have it survive ipod-izing it.

Last and more important factor, the iPhone is locked by one carrier in U.S., and the same will happen in U.K.

This is a very greedy move; big player like Nokia are trying to unbundle their product form the carrier, selling phones which can use multiple wireless network (wi-fi, skype, gsm/edge/umts).

Google is doing the same, from the software perspective using the Android project.

So Apple is always smart, but in the portable phone market you must be also price-affordable, fast in releasing new models, and open for working with other competitor.

All things Steve Jobs is not very good at the present time.

Update: At April 2008, Telecom Italy will carry on UMTS iPhones in Italy. I will write an article on them, to understand if the product is a bit less locked.

 

oracle mass table drop

Sometimes I need to build a small script to delete a huge set of tables of a schema.

In Oracle is easy to do it, using the meta tables "all_tables", "all_views", and "all_sequences":

select  'drop table ' || table_name || ' cascade constraints;' 
   from all_tables where owner='protoss' and  table_name not like 'BIN%';

select  'drop view ' || view_name || ' ;'
   from all_views where owner='zerg' ;
 
  select  'drop sequence ' || sequence_name || ' ;'
   from all_sequences where sequence_owner='spacemarine' ;

The "BIN%" table are special temp tables of oracle.

On PostgreSQL, try use PG_TABLES meta-table

Happy sqlizing!