Google+ API has final arrived!

Web developers have been waited for a long long time for this big news! Google has just announced the Google+ API is now available. Developers can now visit

https://developers.google.com/+/api/

to try out the API. This initial API release is focused on public data only — it lets you read information that people have shared publicly on Google+. Google will of course continue to announce new APIs when it comes to ready.

Here is the message to developers.

Greetings developers,

Thank you for showing your interest in the Google+ platform on our developer interest form. We promised to let you know when we had more details to share. Well, that time has come…

Today, we’re launching the first of the Google+ APIs. This initial API release is focused on public data only — it lets you read information that people have shared publicly on Google+. Read our blog post for more details.

Also, we’re happy to introduce a new Google+ developers site. This will be the place to go for our policiestermsdiscussions with other developers, access to documentation, tools that make development on the Google+ platform easier and more fun, and of course, the place where announcements concerning new releases will be made.

We’re looking forward to seeing what you build with the API. Today is just the beginning, and your work will affect what comes next, so go ahead and get started.

Happy coding!

- The Google+ platform team

CakePHP 2.0.0-RC1

Over a year after CakePHP 2.0 was announced, the team released Release Candidate 1 yesterday. It’s a very exciting news for all Cake developers. CakePHP 2.0 will not work on PHP4 systems anymore. It integrates SimpleTest, a new rewriting URLs structure, better handling in Authentication and new PDO drivers to work the same with different databases.

Checkout more from the original article.

http://bakery.cakephp.org/articles/markstory/2011/09/04/cakephp_2_0_0-rc1_hot_and_fresh

Firefox 5 is Released. Update your Firebug.

Firefox 5 has just released. Please update if you dare to try the latest features.

As usual for all major updates, most Add-ons are incompatible with the latest version. One of the developer must-have Add-on, Firebug 1.7.3, is incompatible with Firefox 5. You need to install Firebug 1.8 beta to work on Firefox 5. Firebug 1.8 is compatible with Firefox 4-7. So it should even work with the latest nighty build.

Firebug 1.8

 

Yahoo! is shutting down delicious.com

Yahoo! is going to shut down Delicious. Yes! This is real. It’s not a joke. As a tiny little user, we can’t change the fact. What we can do is to export our bookmarks and wait for the death of delicious.com. Matt Crampton has posted an export tool on his blog. Just go there and save your valuable bookmarks.

What a shame that there is no announcements on delicious.com and no notification to any delicious users. We all just do what we supposed to do with delicious to reveal this, bookmark and tag the news. This has become the first bookmark on delicious.com.

RIP…

HTML5 on IE version lower than 9

HTML5 is so good as it makes the html document outline more semantic. This helps better SEO and easier for styling. However, most HTML5 tags are not supported in IE with version lower than 9. And IE9 can only be installed on Vista or 7. For the large amount of WinXP/2000 users, if they use the bundled browser, they would never read a website with HTML5 correctly. There are some workarounds on this issue. You may use Modenrizr to detect whether the browser support an HTML5 feature. Or you may simply include the following script in your html page.

<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
< ![endif]-->

The script will only be downloaded and run if it’s an Internet Explorer with version lower than 9. Therefore, IE9, Firefox, Safari, Chrome and Opera won’t download the file and it optimize the webpage loading time. After running the above script, IE (even IE6) will recognize HTML5 tags and you scan style them accordingly. Do remember to include the script before your CSS.

Although HTML5 tags are recognized, canvas won’t be working. However with the IE proprietary VML, canvas can work in IE. Just include excanvas.js into your project and canvas can be run in IE.

Drupal 6: Ubercart Ajax Cart with jQuery Update

If you are using jQuery Update on Drupal, you may find Ubercart Ajax Cart is not working when you click add to cart. This is because Ajax Cart was developed with the original jQuery with Drupal 6 which is version 1.2. Since jQuery 1.3, the attribute selector was updated and you don’t have to put the “@” sign to select an element with the attribute.

In jquery.ajax.cart.js line 10, the original line is like this.

if ( $form.find('input[@name=uc-ajax-cart-callback]').length  == 0 )

Just update this line and delete the “@” sign

if ( $form.find('input[name=uc-ajax-cart-callback]').length  == 0 )

The UC Ajax Cart will then back to work.

NppFTP for Notepad++

I recently have updated Notepad++ and I found that there is a new function on my FTP explorer.

It finally can create new file directly on the server!!! It’s been years and I believe everybody using Notepad++ shouts on not having this feature. I eventually figured out that it’s not FTP_synchronize anymore. This is an official plugins by Notepad++ which is called NppFTP.

However, all of my old FTP profiles from FTP_synchronize are disappeared. Anyone if you have a solution on how to migrate the old FTP profile to NppFTP, please let me know.

Update: The FTP account information for FTP_Synchronize is stored under %APPDATA%\Notepad++\plugins\config\FTP_synchronize.ini. Username and password of all FTP accounts could be retrieved. The password is encrypted in a very simple way where you can decrypt it back easily. If the password is “iphone”, it will be stored as “ihneop”. Head-tail-head-tail…

Again, Notepad++ is my favourite web development tool on windows (well… it will also be great if there is a Mac version).

Notepad++

HKID Card check digit validation with CakePHP

HKID is always needed when filling application forms. It’s a string with combination of maximum 9 characters. The pattern is like this.

XY123456(Z)

X and Y are 2 letters from A to Z. After that is a 6-digit number. The whole HKID is ended with a check digit displayed with a pair of parenthesis. The validation rule can be found in Wikipeida – Hong Kong Idenitiy Card.

With the strong validation feature of CakePHP, we can define our customized validation rule for HKID check digit.

In the model class file.

var $validate = array(
     'hkid' => array(
        'checkDigit' => array(
            'rule' => 'checkDigit',
            'message' => '請填寫正確的香港身份證號碼。<br />Please input a valid HKID.'
        )
    )
);
 
function checkDigit($hkid){
    // the value is stored in $hkid['hkid'], store it back to $hkid for ease of use
    $hkid = $hkid['hkid'];
 
    // create an array for the weight of the letters
    $weight = array();
    for ($i=65; $i&lt;91; $i++){
        $weight[chr($i)] = ($i-65)%11+1;
    }
 
    // add a space with weight 0 for HKID without the first letter
    $weight[' '] = 0;
 
    if ((strlen($hkid) == 8) || (strlen($hkid) == 9)){
        // convert all letters to uppercase
        $hkid = strtoupper($hkid);
        // make all HKID become 9-digit long
        if (strlen($hkid) == 8){
            $hkid = ' '.$hkid;
        }
        // split the HKID string into a 9-element long array
        $chars = preg_split('//', $hkid, -1, PREG_SPLIT_NO_EMPTY);
 
        $value = 0;
        // calculate the sum with the 9-position value
        $value += $weight[$chars[0]]*9;
        $value += $weight[$chars[1]]*8;
 
        for ($i=2; $i&lt;8; $i++){
            $value += $chars[$i]*(9-$i);
        }
 
        // compare the check digit value and the calculated 11 - 11-modulus 
        if (is_numeric($chars[8])){
            $checkValue = $chars[8];
        }
        elseif ($chars[8] == 'A'){
            $checkValue = 10;
        }
        return ($checkValue == (11 - $value%11));
    }
    return false;
}

So simple but very handy validation function for checking HKID check digit.