Yahoo! 360° News | Beta Feedback
Start your own Yahoo! 360° page

Zaenal's Bookmark

Top Page  |  Blog  |  Friends

Add

Zaenal's Bookmark is not connected to you in Yahoo! 360°.

Last updated Tue Dec 09, 2008 Member since December 2006

Total Page Views

8,472

My new blog at blog.lokamaya.net--> Click here Reply

1 - 5 of 44 First | < Prev | Next > | Last

MetaText Full Post View | List View

Just about my bookmark on everything...

My New Blog: Lokamaya
My New Blog: Lokamaya magnify
Hi all,

I'm moving to new blog at http://blog.lokamaya.net. I still update this blog for my bookmark, and the new one for my articles.

***

Sempat menimbng-nimbang beberapa saat, apakah blog yang baru di Lokamaya akan menggunakan bahasa Inggris atau bahasa Indonesia. Akhirnya saya memilih menggunakan bahasa Indonesia. Semoga dengan demikian bisa memberikan kontribusi untuk Tanah Air dan berbagi dengan para netter dari Indonesia.

@zaenal
Tags: blog
Saturday November 22, 2008 - 04:31am (ICT) Permanent Link | 0 Comments
Javascript DateFormatter Class
I have heard prototype.js for long time, but I avoid to use any javascript library for the sake of my skill (or my ego?). But at least I have to deal with a project that use prototype.js as main library. So, I download it (version 1.6.0.2) along with scriptaculous.js. Please be patient with me (my script), because I just learn prototype and for few days. And try to play with it and making some fun.

My script, DateFormat.js, need prototype.js version 1.6.0.1 or 1.6.0.2. I never check the compatibility with lower version. Just for note, this script does not need scriptaculous.


Here to dwonload: Multilingual Javascript DateFormat Class


And here the showcase: http://www.lokamaya.net/protoculous/


Tags: javascript, common
Monday September 1, 2008 - 04:38pm (ICT) Permanent Link | 0 Comments
Speed Up HTTP Load - On Apache 2.x
First of all, you’ll need to install (enable) mod_deflate on Apache 2.x.

Basic Configuration
  • Explicit Exclusion
    To turn on mod_deflate for all files except we tell don't:
SetOutputFilter DEFLATE
DeflateFilterNote ratio
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.(?:exe|t?gz|zip|bz2|sit|rar)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI \.pdf$ no-gzip dont-vary
  • Explicit Inclusion
    To turn off mod_deflate for all files except we tell so:
DeflateFilterNote ratio
AddOutputFilterByType DEFLATE text/*
AddOutputFilterByType DEFLATE application/ms*
application/vnd* application/postscript


Other Configuration

  • To deflate specific directory:
AddEncoding x-gzip .gz
AddType application/x-javascript .gz
AddOutputFilter DEFLATE js
  • To limiting compression for certain browsers:
# Netscape 4.x has some problems...
BrowserMatch ^Mozilla/4 gzip-only-text/html
# Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4\.0[678] no-gzip
# MSIE masquerades as Netscape, but it is fine
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html


Tags: apache, common
Friday August 29, 2008 - 10:19pm (ICT) Permanent Link | 0 Comments
Compressed prototype.js & scriptaculous.js
I just compressed both prototype.js and scriptaculous.js (all library, excluding unittest.js) in one file. The result is about 95kb.


To reduce more size, just use gzip compression using Apache, PHP or else. The good example come from Ali Farhadi (http://farhadi.ir/), where the code can be downloaded at http://code.google.com/p/smartoptimizer/.


The compressed file can be dowloaded at here...
To download, go to my new blog at blog.lokamaya.net.

--and happy nice day!
Tags: javascript, compress, optimize, prototype.js, scriptaculous.js
Thursday August 28, 2008 - 05:34am (ICT) Permanent Link | 0 Comments
PHP (Locale) Date Format
To format a local time/date according to locale settings, like month and weekday names and other language dependent strings, we can use strftime() function respect the current locale set with setlocale().


Example
  • PHP on Linux
On Linux, you have to use xx_XX format for locale country code

<?php
echo '<pre>' . "\n";

setlocale(LC_ALL, 'id_ID');
echo strftime("Today in Indonesia is %A") . "\n";

//And output in UTF-8 charset is easy
setlocale(
LC_ALL, 'id_ID.UTF8');


echo strftime("Today in Indonesia is %A") . "\n";

//And will output "March"
//in German language correctly:
"März"

setlocale(LC_ALL, 'de_DE.UTF8');

echo strftime("This month in German is %B") . "\n";
echo '</pre>' . "\n";
?>


  • PHP on Windows
On Windows you have to use XXX format for locale country code. If it's does not work, try xx_XX format.

<?php
echo '<pre>' . "\n";

setlocale(LC_ALL, 'IND');
echo strftime("Today in Indonesia is %A") . "\n";

//To output in UTF-8, it's not easy
//And to output "March" in German language correctly ("März")


setlocale(
LC_ALL, 'DEU');

$str1 = strftime("This month in German is %B");
$str2 = iconv('ISO-8859-1', 'UTF-8', $str1);

echo
$str1 . "\n"; //not correct
echo $str2 . "\n"; //correct

echo '</pre>' . "\n";
?>

  • Workaround: for Linux, Windows and All Platform
If we develop our PHP code on Windows workstation, it's really pain if we have to change locale format everytime we upload it to Linux or Nix server--as post production machine. For example, on FreeBSD machine some user report that they have to use the charset to get desired result, ie: setlocale(LC_ALL, 'fr_FR.8859-1') to display correct French language.

Fortunately, we can put as many parameters for setlocale() function to solve our problem.

Syntax:
setlocale(category, param-1 [, param-2, ... param-n])

PHP will use the first available parameter provided by the machine.

<?php
echo '<pre>'
. "\n";

//Add english as default (if all Indonesian not available)

setlocale(LC_ALL, 'id_ID.UTF8', 'id_ID.UTF-8', 'id_ID.8859-1', 'id_ID', 'ind_IND.UTF8', 'ind_IND.UTF-8', 'ind_IND.8859-1', 'ind_IND', 'IND.UTF8', 'IND.UTF-8', 'IND.8859-1', 'IND', 'Indonesian.UTF8', 'Indonesian.UTF-8', 'Indonesian.8859-1', 'Indonesian', 'Indonesia', 'id', 'ID', 'en_US.UTF8', 'en_US.UTF-8', 'en_US.8859-1', 'en_US', 'American', 'English');

//will output something like: Kamis, 17 Agustus 2008

echo strftime("%A, %d %B %Y") . "\n";

echo '</pre>' . "\n";
?>



Links

  • Locale Codification for Window from MSDN-Microsoft
    Using XXX format or ISO-639
    This list is specific for Visual Studio or .NET Framework. Altough not all countries listed here, as my country (Indonesia), I successfully change the locale setting to Indonesian in PHP using setlocale(LC_ALL, 'IND'). So you can try the same...



Tags: php, common, tutorial
Friday August 22, 2008 - 12:11am (ICT) Permanent Link | 0 Comments

Add MetaText to your personalized My Yahoo! page:

Add to My Yahoo!RSS About My Yahoo! & RSS
1 - 5 of 44 First | < Prev | Next > | Last