Archive for October, 2006

JavaScript On Steroid

After downloading the Firefox 2.0 beta, I found that It has JavaScript 1.7 engine. I never update my JS skills, so when I found out about several new feature of JS, it amazed me. It seems that JS 1.7 language design becoming more influenced with Ruby and Python. Remember to enable JS 1.7 parser in your HTML script use:

<script type="application/javascript;version=1.7"> Tags

Generators

function range(begin, end) {
  for (let i = begin; i < end; ++i) {
  yield i;
  }
}

for (i in range(0, 10))
  document.write( i );

// or you can use these below
/*
var r = range( 0, 10 );
while(true)
  document.write( r.next() );
*/

Both Will Output:

0123456789

yield is a generator-iterator, so the range function produce an iterator. and whenever the next() method is called, yield got executed. Kinda influenced by the Ruby design.

Array Comprehensions

You can called array initialization shortcut. A one-liner favorite. Example:

var ten_squares = [i * i for (i in range(0, 10))];
document.write( ten_squares );

output: 0,1,4,9,16,25,36,49,64,81

ten_squares will be an array contains of square 0 to square 9. This is python influenced. Another python influenced designs are:

Swapping

a = 10; b = 20;
[a, b] = [b, a];

function f() { return [1, 2]; }
[c, d] = f();

function f2() { return [1, 2, 4]; }
[x, , z] = f2();

I’m tired, I will continue this next time, holidays waiting :p

Friday, October 20th, 2006 | Tags: Articles, Javascript | 1 Comment

Idul Fitri 1427H

Lagi planning template SMS buat kirim2 waktu lebaran. Yakin nanti pasti pending, tapi emang ga masalah. Waktu browsing2 di Google, saya nemu beberapa template lucu semacam:

Selamat Hari Raya Idul Fitri. Mohon maaf lahir & batin. Ketik MAAF YA dan kirim ke 9288 untuk memohon maaf kepada saya.

http://hermansaksono.blogspot.com/2005/11/sms-ucapan-lebaran.html

Atau, ada lagi yg versi IT

Sebening fiber optic, setinggi tower antena radio, secepat broadband access. Kami sekeluarga mohon dibukakan bandwidth maaf selebar-lebarnya.

Banyaknya baris kode xhtml,
Sulitnya memvalidasi hasil design,
Susahnya menyesuaikan kode di berbagai browser,
tidak bisa dilukiskan dengan kecantikan design css,
juga tidak bisa menghalangi niatku untuk meminta maaf.
Selamat Hari Raya Idul Fitri 1426H.
Taqabbalallahu minna wa minkum
Minal Aidzin wal fa idzin

http://didats.net/page/256/sms-di-hari-lebaran/

Saya sendiri, karena ada sedikit skill di VB, punya desain khusus:

On Error Goto Maaf:
Err.Raise -1
Maaf:
Msgbox "Selamat Idul Fitri 1427H, Mohon Maaf Lahir & Batin"

Karena gw lagi belajar python, ada ini:

import sys
sys.stdout.write("Selamat Idul Fitri 1427H, Mohon Maaf Lahir & Batin")

Kalau punya kamu bagaimana?
karena besok, udah libur jadi susah untuk online lagi, maka saya mau mengucapkan:

Selamat Idul Fitri 1427H,
Mohon Maaf Lahir & Batin,
Semoga Amal & Ibadah diterima oleh Allah SWT

Friday, October 20th, 2006 | Tags: Weblog | 5 Comments

Web 2.0 Thinking Game

Funny Mr. Zeldman post about the Web 2.0 buzzwords, and read alotof comments, just can’t help myself. Here’s mine, Mr Zeldman:

web 1.0: flash,dhtml
web 2.0: ajax

web 1.0: sloppy PHP code
web 2.0: bloated ruby on rails and frameworks

web 1.0: konferensi
web 2.0: kopi darat

web 1.0: newsletter
web 2.0: syndicate rss/rdf

web 1.0: geocities
web 2.0: blogsplot,wordpress

web 1.0: email spam
web 2.0: comment,referer spam

web 1.0: http://example.com/x=1&y=2&i=dont&know=1,x123,x234
web 2.0: http://example.com/some/very/silly/long/urls/with/trailling/slashes

Wednesday, October 18th, 2006 | Tags: Weblog | 4 Comments

Ngeklaim Technorati

Ga tau kenapa kok aku ndaftar di Technorati. Yang jelas aku hrs ngeklaim domain ferdianto.com

ini link technoratinya:
Technorati Profile

Tuesday, October 17th, 2006 | Tags: Weblog | 2 Comments

Windows Longhorn RSOD

Found a screenshot of Windows Longhorn RSOD (Red Screen of Death).
http://en.wikipedia.org/wiki/Image:Longhorn_RSoD.png

They do can’t spell.

Tuesday, October 17th, 2006 | Tags: Weblog | 2 Comments

Bug Wordpress Or PHP?

While I was importing my old Textpattern data into Wordpress using the Import tool, I found some interesting bugs or maybe flaws in Wordpress-Textpattern import tools.

It’s get a script-timeout error while doing the imports, so I’ve added the set_time_limit(0) into the first line of the file (wp-admin/import/textpattern.php) and finally it works just fine

The second, that the import tool cannot find the textpattern table if not in the same database. It seems that PHP cannot create 2 different connection in one application. The solution is, I’ve copied the textpattern tables into the wordpress database. And it works just fine. So strange, it didn’t happenned in localhost. The problem exists only in the server.

Monday, October 16th, 2006 | Tags: PHP, Weblog | 4 Comments

Viva Indonesia

While was browsing the wikipedia, I found interesting fact that Indonesia (my country) is one of the strongest country (#13) right above Thailand, that is a bit irony, since how the House Of Representatives is neglecting the Indonesia Military Forces regarding budget (remember the SU-27 problems during Megawati reign). Anyway, did anyone notice on How many tanks that Russia has, 21,870 tanks (imagine how much tanks does the Predecessor Soviet has), compare to US (7,620) or China (7,180).

See it for yourselves (List Of Countries By Size of Armed Forces)

Thursday, October 12th, 2006 | Tags: Weblog | 4 Comments