Pages

Monday, July 6, 2009

Deploy app on iPhone - no wifi - no appstore with full explanation

I received an iPhone (OS 3.0) 2 days ago. My new task is: learning how to deploy our iPhone applications on this device. There is no wifi at my home. Our application is also not uploaded into Apple App Store. So, I need a way that:
1. Only need to copy our application into iPhone and run.
2. No need wifi to copy and setup

Is that difficult?

I read tons of articles and search on many forums but when I follow their steps (no understanding) I got different failed results.

Finally, I find a way after analyzing from many sources. Below is the list of step that I will guide you with my explanation. Anyway, I write this article just for iPhone developers (not for end user). However, in case you are an end user, you can also find some helpful information to solve your problem here.

The solution is:
Connect to your iPhone by using SSH with root account. With the console on SSH, you have the full access right to run any commands (supported by the kernel system behind) to copy/set access right/install/remove your software. However, if you have no wifi - you need a software to bind your an available port on your computer with port 22 (of SSH) on iPhone. The soft to do that is called iTunnel.
iTunnel is worked based on iTune. You should choose to install latest version of iTune to make sure this works ok.
Below is the list of step you need to follow:

Step 0: install latest version of iTune in your computer


This is very important. Without iTune, iTunnel can be run on command line ok. However, when you use SSH to connect to the available port - it will throw error.
In the past, I think this trick does not need installing iTune anymore but I found a problem when I help my team member to do this. At last, we found that the difference between our computer is the iTune version. You must download the latest version of iTune and install it on your computer to make sure this trick works.

Step 1: Install OpenSSH on your iPhone

You need wifi only in this step. To do this, you just need to connect to wifi - go to Cydia - search OpenSSH and install this package. The final result of this step is: OpenSSH will be run as a service in background and open the port 22 to connect. Anyway, you need to check whether the service is turned on or off. To do this, you need to install another software to check. I recommend you should search BossPref (also using Cydia to install).

Step 2: Download and run iTunnel

You can search on Internet to download this software into your PC. I recommend a link that you can download as below:
http://www.makkiaweb.net/blog/2008/09/iphone-tunnel-suite-27

After downloading this, you only need to unzip into a folder. Open the console and go to this directory. Type into the console:

iTunnel.exe 22 [any available port on your computer]
The final result of this step is: iTunnel binds port 22 on your iPhone with a port on your computer.

Step 3: Use any SSH client to connect to the port (on step 2) with root account.


I recommend that you should use WinSCP. The password of root account is: alpine

Example: if I use the port on my computer to bind is: 9000. I will login to SSH on my computer with below information:
HOST: 127.0.0.1 (localhost)
Account: root
Pass: alpine
Port: 9000

After this step, you can see a window (if you use WinSCP) with 2 panels. Left is for your computer, right is folder structure on iPhone. You can copy your app and set execute rights on this. You can also go to menu, open terminal to run any commands you like with root account on iPhone.

Good luck! If you have any problem, leave comments here and I will help.

Update for common questions:
Question 1: I meet "bind error" on the command line when I run iTunnel.
Answer: The port you want to bind was used by another program. So, please try with another port. See step 2 with the command line

iTunnel.exe 22 [any available port on your computer]
After you run the iTunnel successfully, use above port to connect with WinSCP.

Saturday, June 13, 2009

iPhone programming kungfu

I have a bad habit: before starting learning, researching something, I always want to know what is the highest level of the expert in that domain. Usually I map the research domain into kungfu. I call this bad habit because it often takes my time to know that.
In recent months, we setup a team to research iPhone programming. So, this is a good chance for me to learn a new kungfu. After a few months, I identified the Kungfu levels of iPhone programming. It helps me to know what our current level is to improve more skill.

iPhone programming kungfu

Level 1: Tool master

At this level, you must know:
+ Tools using in iPhone programming, the role and how to use them.
+ MAC OS environment: if you're user from Window, Unix, ... you will be surprise with differences on MAC OS and you must get acquainted with the environment here.
+ Hack to install MAC OS in PC: you should know this if you do not have money to buy a real MAC.
+ Master of languages using in iPhone programming: Objective C, C

Level 2: Native application master

At this level, you must have strong experience with building user interface for native application. Below is the list of thing required:
+ Have deep understanding about Model View Controller pattern and how to implement that using iPhone SDK.
+ Strong knowledge about common UIControl.
+ Experience with touch programming.
+ Must know user interface patterns in iPhone interface design.
+ Familiar with data storage: XML, SQLLite
+ Familiar with interact with calling remote services.
+ Familiar with UI animation and effects.

Level 3: Game programming master

Game is a common application type on iPhone. So, you should know how to develop a game on iPhone. You can use some popular game engines on iPhone to do that. Currently, we choose Cocos2D for the 2D game engine and Chipmunk as the physic engine behind. (Remember that: a game engine can not be completed if it does not have a physic engine)
I don't want to talk much about this level because I am not a master in this domain (game programming). However, below is the required list for level 3 (that I've discovered until now)
+ Can load/use sprite/bitmap into game engine
+ Create scene and navigate between scenes
+ Move and animate with 2D object
+ Using physic engine to create physic effect and animation.

Note: the above list is just for 2D game programming. You can find another list in 3D programming - but it is out of the scope because we do not have enough land to write about that here.

Level 4: Web programming master

At this level, you must know:
+ HTML tags that allows in iPhone safari browser.
+ Layout an HTML page to view best on iPhone
+ Using iUI library to build a web app liked native app.

Level 5: iPhone kungfu master

This is the highest level in iPhone programming. At this level, you can understand and program fluently with 4 above levels. Besides that, you must know:
+ Using advanced services and utilities in iPhone: geopositioning (GPS), maps, weather.
+ Can combine both Web + Native application into one.
+ Can design the system architecture for bigger application on iPhone with big storage data, synchronization solution, ...
+ Know how to optimize the program on iPhone and how to use tool for detect leak memory and high rate CPU cost in code.
Above is the list of 5 levels - kungfu in iPhone programming. Please feel free to post your comments or another level if you found.
Happy programming!

Monday, June 1, 2009

Windows script to change network configuration

Currently, I am using a new laptop (with Windows Vista Home Premium) for working at office and home. At home I always use DHCP network configuration (it depends on the ISP). In my company, I have to change to static IP configuration. It takes my time to switch between them. Anyway, I am a lazy man. I want to do all things just by one click or one command. So, I create script to do these thing easily and package them into 2 script file:
ChangeToStaticIPAtWork.bat and ChangeToDynamicIPAtHome.bat.

ChangeToStaticIPAtWork.bat file
netsh int ip set address "Local Area Connection" static your_static_ip your_net_mask your_default_gateway_ip

netsh int ip set dns "Local Area Connection" static your_dns primary

"Local Area Connection" is the name of your network connection. You can find it in the network connections setting.

ChangeToDynamicIPAtHome.bat
netsh int ip set address "Local Area Connection" dhcp
netsh int ip set dns "Local Area Connection" dhcp
When I need to change to any configuration, I just click to run the bat file.
Hope it may help you in necessary case.

Monday, May 25, 2009

Virtual social 3D World

Today, I take a look on SecondLife and its competitors.

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


I notice 2 things related to business in this article:

"In September 2008, over 15 million accounts were registered" => this is a good community and good place for business.

 

"In 2007, Brazil became the first country to have its own independently-run portal to Second Life, operated by an intermediary—although the actual Second Life grid accessed through the Brazilian portal is the same as that used by the rest of the worldwide customer base" => Localizaiton is one of trends in SecondLife

 

Below is  the list of competitor with SecondLife:

 

Virtual social 3D World is one of trends in the future and going to be a rich land for business. Why don't we start something with it from now?

Friday, May 22, 2009

Ubuntu 9.0.4 shutdown dialog - who wants?

In previous version (Ubuntu 8.10), when you shutdown your computer - no dialog appears. I am happy with this. I think many users also like this - same to me. In Windows, if you shutdown - it asks you for confirmation. It makes us confuse a lot and take time for an action to choose OK - I REALLY WANT TO SHUTDOWN - BECAUSE I FEEL SO TIRED - I WANT TO LEAVE MY COMPUTER AS SOON AS POSSIBLE.


To improve it, MS Vista and Windows 7 do not show this dialog any more. Why Ubuntu 9.0.4 does a backward thing? Why they don't research common behavior of end user? I don't know. It's quite difficult to understand.