HTML5 WebSockets build Real Time Web

HTML5 WebSockets is a solution to drive the real time web. The common use case says a real time stock application, online collaboration (multi-user sketching)

Refer: http://websocket.org/quantum.html for the introduction of WebSockets.

Currently, only Google Chrome the client browser supports HTML5 WebSockets natively. There is also less server support for HTML5 WebSockets, since this specification still new. Jetty WebSocket Server is one of an open source solution built on top of Java EE.

iOS5 iCloud Storage API

Apple announced iCloud service part of the features built in with iOS5. iCloud sync automatically the content across all your devices, you can take a photo on your iPhone and immediately share it to your friends using iPad, or store anything, your photo, music, calendar notes, mail, messages on iCloud. It is completely free to use.

Apple allows iOS and Mac Developer Program members utilized this great feature iCloud integrated into their apps by providing iCloud Storage API. Utilizing iCloud Storage API the developers can store the user documents on iCloud, or storing key-value data for small amount information. Developers need not worry about the background operation of iCloud service, as iCloud service resolved all the possible conflicts may happened. iCloud also provides auto notification of file changes to your apps.

Your apps may be a document-based application. You sure familiar with document-based application existed on both desktop and mobile application such as word processors, spreadsheets and drawing program. In iOS5, you can easily implement a document-based application by subclassing UIDocument class, and providing any details of your document structure, while iCloud technology takes care of the background reading and writing of data asynchronously.

Your apps can store key-value data to share small amount of information, you may store integer, string, or date data in the key-value pair. The key-value data is stored in iCloud and shared across all user devices and all the apps. Any changes of data from one apps will automatically reflected in changes into other apps that using that data. Therefore, you may configure your bundles of apps to share certain key-value data to store some configuration or else.

iOS5 New feature added on Reminder with Geofence

iOS5 will be released on 12 October 2011 which released 200 more new features.

I love one of the feature, said set up a geofence around an area, your device will set off a reminder once you enter or leave the place.

Sometimes I passed by MRT station and wanted to insert money into my EZ-link card I will always forgotten and I got a similar idea if I can set up a reminder when I passed by MRT station then the device will remind me to insert money. I found this updated feature is very convenient for me.

Replicate Imgshow Sandbox into iPhone Apps

In my journey learning developing iPhone Apps, I try to replicate Imgshow Sandbox feature into iPhone Apps.

Imgshow Sandbox is a feature to test it out the services provided by Imgshow Platform. It is a web page integrated inside Help Content of Discuz Plugin of Imgshow Platform.

The original sample of Imgshow Sandbox can be found here:
Chinese Site: http://www.qxinnet.com/misc.php?mod=faq&action=plugin&id=qx_imgshow:help&topic=sandbox
English Site: http://www.discuz.my/misc.php?mod=faq&action=plugin&id=qx_imgshow:help&topic=sandbox

I am going to use Titanium API to make Imgshow Sandbox on iPhone Apps. The results would like this:

In the first screen, it shows a list of Imgshow Sandbox supported Services, with a thumbnail icon, name and description of the service.

Then, clicked on ‘youtube’ service, it brings us to a new window showing the parameters.

Enter a keyword, e.g. ‘Avril I love you’, a youtube song title, then click on ‘Show’ button. It will make an API request to Imgshow Platform and redirect you to the related Youtube video. In the back end, actually it sent an Imgshow Query to the Imgshow Platform server, in the form of (q:name=youtube,k=Avril I love you). You can however preview this Imgshow Query at this website, http://apps.facebook.com/imgshow/q:name=youtube,k=Avril I love you.

Here open the Youtube video in the iPhone embedded browser.

Back to the apps, we choose another service, such as ‘twitter’.

We enter a keyword, ‘Steve Job’, then click ‘Show’ button.

It will then open embedded browser to show the Twitter conversation box where back end it actually issued an API request to the Imgshow Platform. The example of this Imgshow query is in this form: (q:name=twitter,k=Steve Job)

This apps is just an experiment for imgshow API integration.

New Java Certification Question For You Guys

Today, fyhao gives you another Java Certification Question, see if you can answer it right. More practice before you earn a certification.

Q4

Develop code that implements all forms of loops and iterators, including the use of for, the enhanced for (for-each), do, while, labels, break, and continue; and explain the values taken by loop counter variables during and after loop execution.

2) Given:

5. public class Buddy {

6.   public static void main(String[] args) {

7.     def:

8.     for(short s = 1; s < 7; s++) {

9.       if(s == 5) break def;

10.       if(s == 2) continue;

11.       System.out.print(s + “.”);

12.     }

13.   }

14. }

 

 

What is the result?

a) 1.

 

b) 1.2.

c) 1.3.4. (*)

d) 1.2.3.4.

e) 1.3.4.5.6.

f) 1.2.3.4.5.6.

g) Compilation fails.

Q5

What will happen when you attempt to compile and run the following code?

 

public class Agg{

static public long i=10;

public static void main(String argv[]){

switch(i){

default:

System.out.println(“no value given”);

case 1:

System.out.println(“one”);

case 10:

System.out.println(“ten”);

case 5:

System.out.println(“five”);

}

}

}

 

A. Compile time error

B. Output of “ten” followed by “five”

C. Output of “ten”

D. Compilation and run-time error because of location of default

Is it simple to you?

Read Java Certification Question Q1 to Q3