August 17 2009
Categorized Under: Javascript
The JavaScript Switch Statement
Use the switch statement to select one of many blocks of code to be executed.
Syntax
switch(n)
{
case 1:
execute code block 1
break;
case 2:
execute code block 2
break;
default:
code to be executed if n is different from case 1 and 2
}
This is how it works: First we have a single expression Read more…
August 15 2009
Categorized Under: Articles, Css, HTML
|
all-scroll
Microsoft
|
No |
Yes |
Yes |
Yes |
Yes |
No |
No |
|
|
col-resize
Microsoft
|
No |
Yes |
Yes |
Yes |
Yes |
No |
No |
|
|
crosshair
W3C
|
Yes |
Yes |
Yes |
Yes |
Yes |
Yes |
|
|
default
W3C
|
Yes |
Yes |
Yes |
Yes |
Yes |
Yes |
|
|
hand
Microsoft
|
Yes |
No |
No |
No |
Yes |
No |
|
See the note below.
|
Read more…
August 14 2009
Categorized Under: Articles, PHP, Servers
Kita sering menggunakan looping dalam aplikasi buatan kita seperti menggunakan for, while, foreach, dan sebagainya. Tahukah anda bahwa pemilihan penggunaan metode looping akan mempengaruhi kecepatan eksekusi aplikasi anda. Anda mungkin tidak pernah memikirkan pentingnya optimalisasi kode program karena belum merasakan perbedaan berarti antara kode yang teroptimasi dan tidak. Namun bila anda telah merilis aplikasi anda dan digunakan oleh sangat banyak pengguna maka optimasi aplikasi pasti akan sangat diperlukan.
Resource server akan sangat terbebani oleh aplikasi yang kodenya Read more…
August 13 2009
Categorized Under: Delphi, Programming
Terkadang kita ingin mencari usia suatu file atau sudah berapa lama file tersebut di buat untuk keperluan tertentu. Di pemrograman Delphi kita bisa menggunakan fungsi FileAge() untuk mencari tau berapa lama usia suatu file.
Berikut syntax dasar dari FileAge :
function FileAge ( const FileName : string ) : Integer;
Contoh penerapan telah di contohkan pada syntax berikut yang dijalankan pada event OnClick suatu Button. contoh syntax :
Read more…
August 4 2009
Categorized Under: Javascript, Programming
00:34:19
Kali ini saya akan membuat sebuah object timer dengan menggunakan JavaScript. Object Timer ini sekaligus menampilkan remain time. Bisa digunakan untuk membatasi waktu-waktu jika Anda membuat sebuah program yang memberi batasan waktu kepada pengguna. Misal untuk ujian.
Apabila object ini sudah jadi, cara pemanggilannya sangat mudah. Anda hanya cukup dengan satu baris perintah untuk membuat objectnya yaitu dengan perintah sebagai berikut:
var timer = new myTimer("waktu")
Di situ terlihat ada object baru dengan nama myTimer. myTimer ini nanti yang akan kita definisikan. Object ini juga memiliki fasilitas event onFinish dimana event ini akan dieksekusi setelah waktu selesai.
Read more…
July 27 2009
Categorized Under: Css, HTML, Programming
Small Scrollable Areas
Scrollable areas on webpages has become increasingly popular after being used by some leading design communities on the internet. Scroll areas can be done with a textarea or iframe tags, but a more frequent way of doing it is through using the abilities that already lies within HTML and CSS for any page element. A normal block element like a <div> can be set to a certain height and width. What happens when the content of the DIV exceeds the size given to it?
Enter the CSS property overflow.
- overflow: auto – This will create a scrollbar – horizontal, vertical or both only if the content in the block requires it. For practical web development, this is probably the most useful for creating a scrolling area.
- overflow: scroll – This will will insert horizontal and vertical scrollbars. They will become active only if the content requires it.
- overflow: visible – This will cause the block to expand to view the content.
- overflow: hidden – This forces the block to only show content that fits in the block. Other content will be clipped and not hidden with no scrollbars.
Read more…
July 17 2009
Categorized Under: Programming
Ulir atau thread (singkatan dari “thread of execution“) dalam ilmu komputer, diartikan sebagai sekumpulan perintah (instruksi) yang dapat dilaksanakan (dieksekusi) secara sejajar dengan ulir lainnya, dengan menggunakan cara time slice (ketika satu CPU melakukan perpindahan antara satu ulir ke ulir lainnya) atau multiprocess (ketika ulir-ulir tersebut dilaksanakan oleh CPU yang berbeda dalam satu sistem). Ulir sebenarnya mirip dengan proses, tapi cara berbagi sumber daya antara proses dengan ulir sangat berbeda. Multiplethread dapat dilaksanakan secara sejajar pada sistem komputer. Secara umum multithreading Read more…
July 9 2009
Categorized Under: Javascript, Programming
<html>
<head>
<title>mySimpleJavaScript » Add 'n Delete row table HTML</title>
<script>
function addRow(aTable) {
aRow = aTable.insertRow(aTable.rows.length);
numCells = 5;
var col_dir = ['<input type="button" />',
'<input type="text" name="text1" />',
'<input type="text" name="text2" />',
'<input type="text" name="text3" />',
'<input type="text" name="text4" />'];
aCell = aRow.insertCell(0);
aCell.innerHTML='<input type="button" id="delRow" onClick="delRow(this)" value="delete" />';
for (i=1;i<numcells ;i++){
aCell = aRow.insertCell(i);
aCell.innerHTML= col_dir[i];
}
}
function delRow(row) {
row.parentNode.parentNode.parentNode.deleteRow(row.parentNode.parentNode.rowIndex);
}
</script>
</numcells></script></head>
<body>
<strong>mySimpleJavaScript » Add 'n Delete row table HTML</strong>
<br />
<p><input type="button" value="add" onClick="addRow(document.getElementById('myTable'))" /></p>
<table id="myTable" name="myTable" border="1" width="200">
<tbody id="myTableTBody" name="myTableTBody">
<tr>
<td> </td>
<td>Barang</td>
<td>Harga Satuan</td>
<td>QTY</td>
<td>Sub Total</td>
</tr>
<tr>
<td><input type="button" id="delRow" onClick="delRow(this)" value="delete" /></td>
<td><input type="text" name="text1" /></td>
<td><input type="text" name="text2" /></td>
<td><input type="text" name="text3" /></td>
<td><input type="text" name="text4" /></td>
</tr>
</tbody>
</table>
</body>
</html>
Read more…
June 26 2009
Categorized Under: Java, Programming
contoh thread dengan menggunakan java :
class A extends Thread
{
public void run()
{
System.out.println("Thread A started");
for(int i=1;i< =4;i++)
{
System.out.println("t From ThreadA: i= "+i);
}
System.out.println("Exit from A");
}
}
class B extends Thread
{
public void run()
{
System.out.println("Thread B started");
for(int j=1;j<=4;j++)
{
System.out.println("t From ThreadB: j= "+j);
}
System.out.println("Exit from B");
}
}
class C extends Thread
{
public void run()
{
System.out.println("Thread C started");
for(int k=1;k<=4;k++)
{
System.out.println("t From ThreadC: k= "+k);
}
System.out.println("Exit from C");
}
}
class ThreadPriority
{
public static void main(String args[])
{
A threadA=new A();
B threadB=new B();
C threadC=new C();
threadC.setPriority(Thread.MAX_PRIORITY);
threadB.setPriority(threadA.getPriority()+1);
threadA.setPriority(Thread.MIN_PRIORITY);
System.out.println("Started Thread A");
threadA.start();
System.out.println("Started Thread B");
threadB.start();
System.out.println("Started Thread C");
threadC.start();
System.out.println("End of main thread");
}
}
Read more…
March 6 2009
Categorized Under: Javascript, Programming