Keep running

Google Wave

June 21st, 2009 by Tkjune

Restaurant and review site, interact on mobile

June 15th, 2009 by Tkjune

3G is just lunched in China for not so long. No doubt it's a huge market for the fast network is finally moving on hand. Let the information fill the gaps of life. Finding a restaurant on mobile network is not new. Maybe restaurant and review site can do more inter-activities.

Before, it happens like this: The food hunters like hanging around with their camera. When they find out something delicious, take a photo, enjoy the meal, when they get home, they use computer to post a review on websites, mostly on review sites.

See what we have now: Faster internet connection on hand and high resolution camera build-in mobile phone. That means everybody and do the live review work. Think about the "Customer Comment Book" in some restaurants. Has it been made fully use of? Usually, the boss of the restaurant may see it. Then what? How about encourage customers to comment directly on the web and let more customers see?

This requires the review sites provide a mobile portal which is easy to use, an application for iphone, blackberry and other mobile phones could provide seamless searching and commenting services. The restaurants provide coupon or discount to encourage customers to post a comment directly when they are waiting for the bill.

It meant to be cool

June 15th, 2009 by Tkjune

Use Automator to quick edit "hosts" in Mac OS X

May 24th, 2009 by Tkjune

A web developer often edit hosts file for developing use. In windows, you can create a shortcut to use notepad to open and edit the hosts file. In Mac OS X, I like using Spotlight to quick open the stuffs I want. But the hosts files is hidden by default and can not be found in Spotlight. So I use Automator to triger TextMate to open hosts file for editing.

Here's what I did in Mac OS X 10.5.6:

  1. Open Automator
  2. In Library of Automator, choose "Get Specified Finder Items" in "Files & Folders" category. Drag it to the right panel.
  3. Open Finder, select "Go -> Go to Folder..." from menu (or use shortcut key "CMD+SHIFT+G"), input "/private/etc/". You can find "hosts" file here. Drag it to Automator, the file list area in "Get Specified Finder Items".
  4. In Library of Automator, choose "Open Finder Items" in "Files & Folders" category. Drag it to the right panel. Choose the application you like to open the hosts file. As to me, I chose TextMate.
  5. Click "Run" button on the top right to test it.
  6. Save it as application in "Application" folder.

This works alright in 10.5.6. But I just upgrade to 10.5.7 a few days ago and I found that it does not work. When test run, the automator can find out the file but cannot open it, even after I repairing the disk permissions. Then I changed another way for step 4 here:

4. In Library of Automator, choose "Run AppleScript" in "Utilities" category. Input following lines:

on run {input, parameters}
tell application "TextMate"
open input
end tell
return input
end run

Test run and bingo!

DOMINO

May 22nd, 2009 by Tkjune

When domino was releasing in Korea, I hope I could one day stands a group of this little ones a line. Now it comes true. See? Good wishes always come true. That's the power of my will.

iriver domino
iriver domino 02
iriver domino 03
iriver domino 04
iriver domino 05

Simplified Chinese Language Pack for NextGEN Gallery

April 13th, 2009 by Tkjune

NextGEN Gallery in Chinese
NextGEN Gallery is a very powerful plugin for WordPress that can manage the photo easily. It has many features and provides multiple language support. I've just made the Simplified Chinese language pack for the current version(v1.21).

Download: Simplified Chinese Language Pack for NextGEN Gallery 1.21 1.33

There is a bug in this version when using other languages which will result in a notice's translation can not be shown. It a very small issue but if you are completist you can fix it in this way:

Open this file [NextGEN plugin folder]/lib/core.php and find out line 419.  Replace it with following code:

  1. $result = sprintf(  __( 'Note : Based on your server memory limit you should not upload larger images then <strong>%d x %d</strong> pixel', 'nggallery' ), $size['width'], $size['height']);

This notice appears in [Add Gallery / Images] -> [Upload a Zip-file] and similar pages.

Well, in fact, there are two more bugs if you really want to fix...

Open this file [NextGEN plugin folder]/admin/tinymce/window.php and find out line 29-30.  Replace them with following code:

  1. <li id="gallery_tab" class="current"><span><a href="javascript:mcTabs.displayTab('gallery_tab','gallery_panel');" onmousedown="return false;"><?php echo __ngettext( 'Gallery', 'Galleries', 1, 'nggallery' ); ?></a></span></li>
  2. <li id="album_tab"><span><a href="javascript:mcTabs.displayTab('album_tab','album_panel');" onmousedown="return false;"><?php echo __ngettext( 'Album', 'Albums', 1, 'nggallery' ); ?></a></span></li>

Checkout what I did (very simple) with this wonderful plugin and know more about how to use it.

Coding standards

April 13th, 2009 by Tkjune

For a beginner of programing, it's a good habit of writing codes in standard format. There are different rules in different companies/teams. Better than form your own, follow a standard of a popular application could be easier and more acceptable by people. For example, the WordPress Coding Standards and Inline Documentation.
Some good approach I just learned from it:

  • When doing logical comparisons always put the variable on the right side.
    I saw this in some codes, now I know why: If you forget an equal sign it'll throw a parse error instead of just evaluating true and executing the statement. It really takes no extra time to do, so if this saves one bug it's worth it.
  • Use real tabs and not spaces, as this allows the most flexibility across clients.
    In some courses, it's suggested that using spaces instead of tabs. Either of they has their reasons. As mentioned above, using the standards of popular applications could be better. And I have already had the habit of using tabs, so I just follow WordPress here.
  • Tabs should be used at the beginning of the line and spaces should be used mid-line.
    Exception for previous point: if you have a block of code that would be more readable if things aligned, use spaces.
  • Ternary operators are fine, but always have them test if the statement is true, not false. Otherwise it just gets confusing.
    1. // GOOD example:
    2. // (if statement is true) ? (do this) : (if false, do this);
    3. $musictype = ( 'jazz' == $music ) ? 'cool' : 'blah';

Custom Fields and Category Order in Atahualpa Theme

April 7th, 2009 by Tkjune

Atahualpa theme for wordpress
Atahualpa
is a wonderful Wordpress theme that can be customized with 200+ options. It can be use to build simple websites with a bunch of settings. I found that custom fields can not be displayed as it described. I'm not sure if it's a bug. I did some modifications and it works now. Here is how (For version 3.3.2):
Open /wp-content/themes/atahualpa332/functions/bfa_postinfo.php
Find line 10

  1. return get_post_meta($post->ID, $matches[1], TRUE);

Replace with the following lines

  1. ob_start(); the_ID(); $post_id = ob_get_contents(); ob_end_clean();
  2. return get_post_meta($post_id, $matches[1], TRUE);

I don't know why $post->ID can not get the post's id. And the way above is not efficient, but it works.
Now you can use the custom files with the tag %meta('fieldname')% in the theme options -> Post/Page Info Items.
I also would like to manually arrange the order of categories. This function is not built in. There are some plugins can make it happen. I'm using Category Order. Some modifications should be done in Atahualpa too.
Open /wp-content/themes/atahualpa332/functions/bfa_hor_cats.php
Find line 3

  1. $list_cat_string = wp_list_categories('orderby=' . $sort_order . '&order=' . $order . '&title_li=&depth=' . $levels . '&exclude=' . trim(str_replace(" ", "", $exclude)) . '&echo=0');

Replace with

  1. $list_cat_string = wp_list_categories('&title_li=&depth=' . $levels . '&exclude=' . trim(str_replace(" ", "", $exclude)) . '&echo=0');

This removes orderby, order parameters to meet the requirement of Category Order plugin.

Feeling web-based 3D graphics

March 18th, 2009 by Tkjune

3D graphics on mobile Safari

After turning to Mac, in a sudden, I'm thinking why it's so attractive to me? When there are a lot of reasons like OS X is more stable, virus free (though partly because of  market share is smaller than Windows) and so on, it's much more important to me that OS X has a great user interface. I got the impression from friends that Mac has a strong graphic engine, more powerful than PC. Since they are using similar hardware, then it's all about the beauty of software.

Apple mobile system inherits this.  Safari on iPhone could provide web-based 3D graphic. 3D graphic is not new to web browser. JavaScript, Java Applet, Flash has been working on it all the time. You can even start a 3D virtual tour of  THE FOBIDDEN CITY which requires extra plug-in. Powered by WebKit, Safari supports CSS Transforms and now CSS Animation. With Safari 4, you can see beautiful leaves falling here. The more wonderful thing is on iPhone OS:

Though this 3D animation can be created by JavaScript too, WebKit's CSS transforms offer greater performance. And CSS could be handier for Web UI designer to create and manipulate elements to interact with users.

"It's hardware accelerated, and all the timing and intervals needed for the animations are handled more efficiently by Safari itself instead of Safari's JavaScript engine," Peter Zich, a Chicago-area developer, told Ars. "The framerate for JS animations on the iPhone usually doesn't get past 5fps, for instance, while with CSS it is far more."

Personally, I'm using Firefox more for there are many convenient plug-ins. Hope it could catch up soon.

When 3D graphic control becomes a standard of industry and more web applications get involved, we are getting one step near to the Matrix world.

Charlotte's Riverside

March 17th, 2009 by Tkjune

Charlotte's Riverside

After no updating for 2 months, Charlotte is back with new mood. I like this photo she posted, the peaceful riverside. There are some more here.