Ngomongin soal merit dan pasangan impian :D

Ni potongan chat aku di pagi tadi, ngomongin soal merit dan pasangan idaman perempuan kaya apa si ? heheh 

aku: PAGIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
aku: ;))
aku: :P
temenku: pagiiiiiii…
temenku: :-P
aku: pernah selingkuh ga ? :D
aku: selingkuh tu dosa kan ya ?
temenku: selingkuh..?? no way..
temenku: :-P
temenku: napa neh???
aku: ehee..
aku: ga kok
temenku: yukkk..bahas selingkuh kayanya seru juga.. Read the rest of this entry »

Pengakuan : ada temenku merit lageeee…

hmm.. pagi ini aku dapet undangan merit teman sekantor, well a young age female, selamat ya.. udah berani komitment mau menempuh hidup baru..

Aku ? Read the rest of this entry »

Validasi Form menggunakan Javascript

Validasi dalam sebuah form input sangatlah penting, apalagi jika isian dalam form tersebut berisi banyak kolom yang lumayan rumit, berikut ini bebera tips yang bisa digunakan untuk mem-validasi form. walaupun teknik validasi menggunakan javascript ini sudah jarang dipakai dengan digantikan dengan validasi dari sisi server (server-side validation) menggunakan pemrograman server-side seperti ASP, PHP, Perl, ColdFussion dan lain-lain. Akan tetapi, teknik validasi menggunakan javascript lebih disukai user, karen secara teknis halaman tidak perlu di-reload dan menghemat waktu, perngunjung tidak harus mengunggu page-loading hasil validari dari server.

Isian kolom yang harus diisi

Fungsi berikut memeriksa apakah sebuah field / input belum disi. Jika input belum diisi / kosong, maka akan muncul sebuah kotak pesan peringatan (Alert) yang menyatakan bahwa kolom tersebut belum diisi, dan fungsi ini mengembalikan nilai false, jika input sudah diisi fungsi ini mengembalikan nilai true.

function validate_required(field,alerttxt) {
with (field) {
if (value==null||value=="") {
alert(alerttxt);return false;
}
else {
return true;
}
}
}

Contoh terapan dalam dokumen HTML sebagai berikut

<html>
<head><script type="text/javascript">

function validate_required(field,alerttxt)

{

with (field)

{

if (value==null||value=="")

{alert(alerttxt);return false;}

else {return true}

}

}
function validate_form(thisform){

with (thisform)

{

if (validate_required(email,"Email must be filled out!")==false)

{email.focus();return false;}

}

}

</script>

</head>
<body><form action="submitpage.htm"onsubmit="return validate_form(this)"

method="post">

Email: <input type="text" name="email" size="30">

<input type="submit" value="Submit">

</form>

</body>
</html>

Validasi penulisan alamat e-mail

Fungsi javaScript berikut akan memeriksa penulisan alamat email secara umum yaitu mengandung paling tidak karakter @ dan sebuah titik (.), fungsi ini juga tidak memperbolehkan penulisan @ di awal alamat email, dan juga tanda titik akhir paling tidak berada pada 1 karakter setelah tanda @ :

function validate_email(field,alerttxt){

with (field)

{

apos=value.indexOf("@");

dotpos=value.lastIndexOf(".");

if (apos<1||dotpos-apos<2)

{alert(alerttxt);return false;}

else {return true;}

}

}

Contoh terapan dalam dokumen HTML adalah sebagai berikut

<html>

<head>

<script type="text/javascript">

function validate_email(field,alerttxt)

{

with (field)

{

apos=value.indexOf("@");

dotpos=value.lastIndexOf(".");

if (apos<1||dotpos-apos<2)

  {alert(alerttxt);return false;}

else {return true;}

}

}
function validate_form(thisform)

{

with (thisform)

{

if (validate_email(email,"Not a valid e-mail address!")==false)

  {email.focus();return false;}

}

}

</script>

</head>
<body>

<form action="submitpage.htm"

onsubmit="return validate_form(this);"

method="post">

Email: <input type="text" name="email" size="30">

<input type="submit" value="Submit">

</form>

</body>
</html>

Nah, selamat mencoba :)

Enable HTTP compression with Gzip

What is HTTP Compression ?

HTTP compression is a capability built into both web servers and web browsers, to make better use of available bandwidth. HTTP protocol data is compressed before it is sent from the server: compliant browsers will announce what methods are supported to the server before downloading the correct format; unsupported browsers will download uncompressed data. Data is usually compressed with either deflate or gzip modules specific to the server software. –wikipedia

The benefit using http compression is visitor get faster data transfered, the loss is it will increase server resource.

Requirement :- Server running LINUX OS with Apache 1.3+

Instalation on Linux based servers :

We are going to use the Gzip compression here, as this article’s title.

  1. Login to your server account with root privilege
  2. Download the Gzip module mod_gzip.so for Apache, you can get this module in SourceForge for free.
  3. Unzip and move it to apache modules directory (typically “/usr/libexec/httpd”).
  4. Edit httpd.conf (typicaly on “/etc/httpd/conf/httpd.conf”) and add this code in modules loader section
    LoadModule gzip_module libexec/mod_gzip.soAddModule mod_gzip.c

    Save the configuration.

  5. Now, create a file called .htaccess in http directory where you want to appy the Gzip compression, e.g.: public_html/ add this lines in the file :
    <IfModule mod_gzip.c>
        mod_gzip_on       Yes
        mod_gzip_dechunk  Yes
        mod_gzip_item_include file      \.(html?|txt|css|js|php|pl)$
        mod_gzip_item_include handler   ^cgi-script$
        mod_gzip_item_include mime      ^text/.*
        mod_gzip_item_include mime      ^application/x-javascript.*
        mod_gzip_item_exclude mime      ^image/.*
        mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
    </IfModule>

    This will compress all files with html/htm/txt/css/js/php or pl extension.

  6. Restart Apache

Test and check the mod_gzip installation

  1. create a php file e.g: i.php and add this line :
    <?php echo phpinfo(); ?>
    find the text “mod_gzip”, got one ? youhave successfully install mod_gzip. !
  2. Now, open a page you have created before in the current directory with html / htm / txt /css/ txt / php or pl extension using Firefox with Web Developer plugin.
    From the Information menu ->View Document Size
    Will look like this :
    Compressed website result
  3. Congratulations, now your site should be more faster to download.