Skip to content


Malaysian Independence Day

Love Malaysia, 1Malaysia, Satu Malaysia, One Malaysia. YEAH

Posted in General.


Increment Difference between C and Java

Both C and Java are high-level language.

Both language provides support for variable increment such as the statement: “c++”, “++c”.

However I have discovered some difference between them, where my knowledge is not able to define it currently.

Consider a piece of code in C:

#include <stdio.h>

int main(void) {
    int c = 1;
    c = c++ + ++c;
    printf("this c: %d", c);
    return 0;
}

The output will be c = 5;

#include <stdio.h>

int main(void) {
    int c = 1;
    c = c++ + c++;
    printf("this c: %d", c);
    return 0;
}

The output will be c = 4;

However in Java,

        int c = 1;
        c = c++ + ++c;
        System.out.println(c);
        int d = 1;
        d = d++ + d++;
        System.out.println(d);

The output will be c = 4 and d = 3

Therefore, this is the difference between inner execution structure for both language and need to be researched in order to fill in the blank here.

To be continued…

Posted in Computer and IT.


Introducing Voice Actions for Android

Posted in Tech News.


I don’t want to miss a thing – Yuna Ito

Posted in Music.


We don’t want Java controlled by Oracle

Oracle sue Google because suspected Google using Java in its Google Android Operating System Framework. Oracle said that Java is an operating system framework language, and Google Android publishes its framework had infringed its seven patents. Is Java an operating system framework?

As Java Developer, I want to say something. Java is an open source product, should be maintained by open source community, and free to use by any company, any people, but not fully controlled by one central company, such as Oracle.

This Oracle’s decision to take over Java from Sun, to have fully control of the Java, will be a wrong step for Oracle, or the future of Java. If not Google, IBM, these companies using Java, Java may be die soon.

Oracle, please listen what Java developers thought, freeing Java, please, otherwise Java will die soon. Please don’t play fire yourself, which will burn your hand.

Posted in Java, Tech News.


The Internet of Things (物联网)

In computing, the term Internet of Things (also known as the Internet of Objects) refers to the networked interconnection of everyday objects. It is generally viewed as a self-configuring wireless network of sensors whose purpose would be to interconnect all things. The concept is attributed to the original Auto-ID Center, founded in 1999 and based at the time in MIT.
The idea is as simple as its application is difficult. If all cans, books, shoes or parts of cars are equipped with minuscule identifying devices, daily life on our planet will undergo a transformation. Things like running out of stock or wasted products will no longer exist as we will know exactly what is being consumed on the other side of the globe. Theft will be a thing of the past as we will know where a product is at all times. The same applies to parcels lost in the post.

物联网(The Internet of things)的定义是:通过射频识别(RFID)、红外感应器、全球定位系统、激光扫描器等信息传感设备,按约定的协议,把任何物品与互联网连接起来,进行信息交换和通讯,以实现智能化识别、定位、跟踪、监控和管理的一种网络。物联网的概念是在1999年提出的。

Posted in Computer and IT, Tech News.


黄明志 – 放半粒

Posted in Music.


Proposed HTML5 Simple Payment Protocol

HTML5 is a new generation web browser markup language and the ways the developer to create web application with full of desktop experience. HTML5 had introduced a lot of new tags, such as improvement of semantic tags (<header>, <footer>, <aside>, <section>, <article>) that made the different parts of the website can be represented by these tags rather than using <div>. Additionally, supports of <video> and <audio> make possible for browser to view video and listen music without installing Flash Plugin but using browser-implemented engine to run it. Besides that it had improvement for CSS3 as well, that allowed animation, shadow and many exciting features etc. Moreover, improvement to JavaScript API such as support geolocation API, Canvas (Rich Animation and 2D Drawing, will support 3D Drawing in the future), local Web Storage, and many yet features that not be shown here.

We known that the full HTML5 specification will be completed in 2030. In 2012, WhatWG will submit the suggestion documentation to W3C. Most of the browsers today except IE had already implemented HTML5, although not full features had implemented, but at least implemented a bit. Thanks Apple, Google, Opera and Mozilla implemented HTML5 in their browsers, either from PC or smart phone such as iPhone and Android. Market share is big, due to the fact that mobile market is emerging, associated with the rapid development of HTML5 and cloud computing, it made our future life more easier and convenient.

After thinking from my current country, Malaysia, electronic payment still not very popular like western country. Due to the fact that the security of payment still not getting trust from the users. As well as the supports from government, every aspects such as low internet speed, NEP, and it almost slow down the free development of the technology.

Moreover, due to the fact that nowadays there are many types of payment option in the world, in international we have Visa, MasterCard, Paypal and so on.  In Facebook, we have Facebook Credits also.

Hereby I proposed that new implementation for simple payment protocol for HTML5.

What is Simple Payment Protocol?

Simple Payment Protocol can be implemented in HTML5, by providing <payment> HTML5 tag, that will be rendered as payment panel with showing product name and price and the button where click to submit the payment. Proposed that it is a standard payment panel supported by different types of browser. Different types of browser either from PC Google Chrome, or smart phone such as Apple iPhone, both will render the same payment panel for user to make payment. Any seller or bank can collaborate with browser company, to build certain standard security layer that support encryption up to 128-bit and more. The browser itself can support the e-wallet function, allows user to carry their e-wallet at the same time carry their mobile devices anytime and anywhere.

Advantage is that the payment method will become the standard, using the standard the life of the user will be easier. Using the standard, payment process will be easier and fast and secure. When your web application need to implement payment method, you not need to learn specific API such as Paypal or another types of payment option, even you want to change from one payment method to another you will face problems. By using proposed implementation of HTML5 Simple Payment Protocol the web developers can just learn one API and easier to implement the payment function in their web application.

 

Noted that this proposal is the work of Khor Yong Hao, and this is only a draft and will be improved in the future. The further modification of this page will be carried out anytime in the future without notification.

Posted in Computer and IT.


Recommendation Book: Practical Artificial Intelligence Programming With Java

I have found a online free ebook, entitled as Practical Artificial Intelligence Programming With Java by Mark Watson.

Click here to download if you need it: http://www.markwatson.com/opencontent/JavaAI3rd.pdf

Posted in Computer and IT, General.


Simple Java BBCode Implementation

I have made a simple Java BBCode Implementation, and it is open source and free to use. Feel free to take it into your project.

Below is the Java static method to convert the bbcode-based text into HTML form to be displayed in browser.

public static String bbcode(String text) {

String temp = nl2br(text);

Map<string , String> bbMap = new HashMap</string><string , String>();</string>

bbMap.put(“\\[b\\](.+?)\\[/b\\]“, “<strong>$1</strong>”);

bbMap.put(“\\[i\\](.+?)\\[/i\\]“, “<span style=’font-style:italic;’>$1</span>”);

bbMap.put(“\\[u\\](.+?)\\[/u\\]“, “<span style=’text-decoration:underline;’>$1</span>”);

bbMap.put(“\\[h1\\](.+?)\\[/h1\\]“, “<h1>$1</h1>”);

bbMap.put(“\\[h2\\](.+?)\\[/h2\\]“, “<h2>$1</h2>”);

bbMap.put(“\\[h3\\](.+?)\\[/h3\\]“, “<h3>$1</h3>”);

bbMap.put(“\\[h4\\](.+?)\\[/h4\\]“, “<h4>$1</h4>”);

bbMap.put(“\\[h5\\](.+?)\\[/h5\\]“, “<h5>$1</h5>”);

bbMap.put(“\\[h6\\](.+?)\\[/h6\\]“, “<h6>$1</h6>”);

bbMap.put(“\\[quote\\](.+?)\\[/quote\\]“, “<blockquote>$1</blockquote>”);

bbMap.put(“\\[p\\](.+?)\\[/p\\]“, “<p>$1</p>”);

bbMap.put(“\\[p=(.+?),(.+?)\\](.+?)\\[/p\\]“, “<p style=’text-indent:$1px;line-height:$2%;’>$3</p>”);

bbMap.put(“\\[center\\](.+?)\\[/center\\]“, “<div align=’center’>$1″);

bbMap.put(“\\[align=(.+?)\\](.+?)\\[/align\\]“, “<div align=’$1′>$2″);

bbMap.put(“\\[color=(.+?)\\](.+?)\\[/color\\]“, “<span style=’color:$1;’>$2</span>”);

bbMap.put(“\\[size=(.+?)\\](.+?)\\[/size\\]“, “<span style=’font-size:$1;’>$2</span>”);

bbMap.put(“\\[img\\](.+?)\\[/img\\]“, “<img src=’$1′ />”);

bbMap.put(“\\[img=(.+?),(.+?)\\](.+?)\\[/img\\]“, “<img width=’$1′ height=’$2′ src=’$3′ />”);

bbMap.put(“\\[email\\](.+?)\\[/email\\]“, “<a href=’mailto:$1′>$1</a>”);

bbMap.put(“\\[email=(.+?)\\](.+?)\\[/email\\]“, “<a href=’mailto:$1′>$2</a>”);

bbMap.put(“\\[url\\](.+?)\\[/url\\]“, “<a href=’$1′>$1</a>”);

bbMap.put(“\\[url=(.+?)\\](.+?)\\[/url\\]“, “<a href=’$1′>$2</a>”);

bbMap.put(“\\[youtube\\](.+?)\\[/youtube\\]“, “<object width=’640′ height=’380′><param name=’movie’ value=’http://www.youtube.com/v/$1′></param><embed src=’http://www.youtube.com/v/$1′ type=’application/x-shockwave-flash’ width=’640′ height=’380′></embed></object>”);

bbMap.put(“\\[video\\](.+?)\\[/video\\]“, “<video src=’$1′ />”);

for (Map.Entry entry: bbMap.entrySet()) {

temp = temp.replaceAll(entry.getKey().toString(), entry.getValue().toString());

}

return temp;

}

Posted in Java.