Kamis, November 24, 2011

Javascript : Reload Target / Parent Window From Second Child Window

I have problem like this guy on this link.

Solution : use window.name, and target it to reload

On parent page :
window.name = "parent_window";

On the first child page :
function open2print(id_cek_in,diskon) {
 window.open( "cek_print.php?id_cek_in="+id_cek_in+"&cetak=y&diskon="+diskon, "print","status=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,width=600,height=800" )
}

On the second child page :
function reloadWin(){
 var parent_window = window.open("", "parent_window");
 parent_window.location.reload(true);
}

<body onload=reloadWin();>

So when the second child window load, it will be reload parent window.

Source : http://www.codingforums.com/showthread.php?t=113902


PS : I hate javascript, too many parents and children involved :(

Kamis, November 17, 2011

Bash : Auto Delete Old Backup Files

Based on my experience on maintenance project.
It's about to create auto delete old backup files on Mandriva 2005 (Linux) server.

This article is related with this article

After create backup file there will be alot of files created in our backup folder.
So we need an auto delete old backup files.

1. Create recycle.sh
$ mcedit /recycle.sh

File content :

#! /bin/sh
find /backup | grep `date -d '1 week ago' +%Y-%m-%d` | xargs --no-run-if-empty rm

2. Edit crontab

$ mcedit /etc/crontab

File Content :

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
00 15 * * 1-6 root /bin/sh /recycle.sh

3. Reconfigure your crontab

$ crontab -u[username] /etc/crontab
$ crontab -l

Auto delete scheduled every Monday through Friday 2 pm :)

Modified from : http://unix.stackexchange.com

Bash : Auto Backup Mysql on Mandriva 2005

Based on my experience on maintenance project.
It's about to create auto backup mysql on Mandriva 2005 (Linux) server.

1. Create file backup.sh, you may using mc or pico

$ mcedit /backup.sh

File content :

#! /bin/sh
/usr/bin/mysqldump -u[username] -p[password] [database_name] > /[your_backup_directory]/[filename].sql
cd /backup
tar --remove-files -czf backup-`date '+%Y-%m-%d' `.tar.gz -R *.sql
sudo cp -f *.tar.gz /[another_backup_directory]

2. Edit your cron list

$ mcedit /etc/crontab

File content :

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
00 7-14 * * 1-6 root /bin/sh /backup.sh

3. Reconfigure your crontab

$ crontab -u[username] /etc/crontab
$ crontab -l

MySQL auto backup scheduled every Monday through Friday beginning at 7 am till 2 pm :)

Senin, September 26, 2011

phpMyAdmin : How to Import Large CSV

Case : You have a big file size csv to import to mysql using phpmyadmin
Solution : Use mysql script instead of import form from phpmyadmin (that will save you a lot of time)
Script :
LOAD DATA LOCAL INFILE 'file_name.csv'
INTO TABLE table_name
FIELDS TERMINATED BY ','
LINES TERMINATED BY '\n'
(column1,column2,column3);


Note : place your csv file in your phpmyadmin directory

Source : http://www.phpfreaks.com/forums/index.php?topic=343906.0

Rabu, Agustus 31, 2011

Javascript : URL Validation

function urlValidator(elem, helperMsg){
	var urlExp = /^http?\:\/\/(www\d?\d?\d?\d?\.)?([A-Za-z0-9-_]+\.)?[A-Za-z0-9-_]+((\.[A-Za-z]{2,6})(\.[A-Za-z]{2})?([0-9-_%&\?\/\.=]*))$/;
	if(elem.value.match(urlExp)){
		return true;
	} else {
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

Kamis, Agustus 18, 2011

Excel : Delete new line

Case : You have a text :

I want
to
eat

in column A1, and  you want to replace into single line : I want to eat.
This kind of thing gonna be a troublesome if you have 1000 lines to change.
Instead of replacing manual one by one, you can do this trick :

1. Press Ctrl + F
2. Switch to "Replace" tab
3. Put active cursor into "Find what" column
4. Press Alt + 010
5. Press "Replace All" button

Now all new lines will be delete.

Source : http://www.excelforum.com/excel-general/670112-deleting-new-line-character.html

Excel : Merge Spreadsheets into One Spreadsheet

Sub CopyFromWorksheets()
    Dim wrk As Workbook 'Workbook object - Always good to work with object variables
    Dim sht As Worksheet 'Object for handling worksheets in loop
    Dim trg As Worksheet 'Master Worksheet
    Dim rng As Range 'Range object
    Dim colCount As Integer 'Column count in tables in the worksheets
     
    Set wrk = ActiveWorkbook 'Working in active workbook
     
    For Each sht In wrk.Worksheets
        If sht.Name = "Master" Then
            MsgBox "There is a worksheet called as 'Master'." & vbCrLf & _
            "Please remove or rename this worksheet since 'Master' would be" & _
            "the name of the result worksheet of this process.", vbOKOnly + vbExclamation, "Error"
            Exit Sub
        End If
    Next sht
     
     'We don't want screen updating
    Application.ScreenUpdating = False
     
     'Add new worksheet as the last worksheet
    Set trg = wrk.Worksheets.Add(After:=wrk.Worksheets(wrk.Worksheets.Count))
     'Rename the new worksheet
    trg.Name = "Master"
     'Get column headers from the first worksheet
     'Column count first
    Set sht = wrk.Worksheets(1)
    colCount = sht.Cells(1, 255).End(xlToLeft).Column
     'Now retrieve headers, no copy&paste needed
    With trg.Cells(1, 1).Resize(1, colCount)
        .Value = sht.Cells(1, 1).Resize(1, colCount).Value
         'Set font as bold
        .Font.Bold = True
    End With
     
     'We can start loop
    For Each sht In wrk.Worksheets
         'If worksheet in loop is the last one, stop execution (it is Master worksheet)
        If sht.Index = wrk.Worksheets.Count Then
            Exit For
        End If
         'Data range in worksheet - starts from second row as first rows are the header rows in all worksheets
        Set rng = sht.Range(sht.Cells(2, 1), sht.Cells(65536, 1).End(xlUp).Resize(, colCount))
         'Put data into the Master worksheet
        trg.Cells(65536, 1).End(xlUp).Offset(1).Resize(rng.Rows.Count, rng.Columns.Count).Value = rng.Value
    Next sht
     'Fit the columns in Master worksheet
    trg.Columns.AutoFit
     
     'Screen updating should be activated
    Application.ScreenUpdating = True
End Sub

Source : http://www.vbaexpress.com/kb/getarticle.php?kb_id=151

Sabtu, Juli 23, 2011

PHP : Fungsi Terbilang

function kekata($x) {
 $x = abs($x);
 $angka = array("", "satu", "dua", "tiga", "empat", "lima",
 "enam", "tujuh", "delapan", "sembilan", "sepuluh", "sebelas");
 $temp = "";
 if ($x <12) {
  $temp = " ". $angka[$x];
 } else if ($x <20) {
  $temp = kekata($x - 10). " belas";
 } else if ($x <100) {
  $temp = kekata($x/10)." puluh". kekata($x % 10);
 } else if ($x <200) {
  $temp = " seratus" . kekata($x - 100);
 } else if ($x <1000) {
  $temp = kekata($x/100) . " ratus" . kekata($x % 100);
 } else if ($x <2000) {
  $temp = " seribu" . kekata($x - 1000);
 } else if ($x <1000000) {
  $temp = kekata($x/1000) . " ribu" . kekata($x % 1000);
 } else if ($x <1000000000) {
  $temp = kekata($x/1000000) . " juta" . kekata($x % 1000000);
 } else if ($x <1000000000000) {
  $temp = kekata($x/1000000000) . " milyar" . kekata(fmod($x,1000000000));
 } else if ($x <1000000000000000) {
  $temp = kekata($x/1000000000000) . " trilyun" . kekata(fmod($x,1000000000000));
 }
  return $temp;
}
function terbilang($x, $style=4) {
 if($x<0) {
  $hasil = "minus ". trim(kekata($x));
 } else {
  $hasil = trim(kekata($x));
 }
 switch ($style) {
  case 1:
   $hasil = strtoupper($hasil);
   break;
  case 2:
   $hasil = strtolower($hasil);
   break;
  case 3:
   $hasil = ucwords($hasil);
   break;
  default:
   $hasil = ucfirst($hasil);
   break;
 }
 return $hasil;
}

Source : http://maseko.com/code-snippet/php/fungsi-terbilang/

Kamis, Juli 14, 2011

JQuery : Autocomplete Force Input

case : you use jquery autocomplete to replace an old style drop down menu and you want to force user to choose at least one of these input option.
solution : use a "mustMatch";

        $().ready(function() {
            $("#kategori").autocomplete("../actions/autocomplete.php?p=kategori", {
                width: 190,
                max: 2000,
                selectFirst: false,
                mustMatch:true,
            });
        });

Senin, Juni 20, 2011

Excel : Speed Up Calculation

Case : You want to delete bulk of rows (more than 50.000 rows) on excel
Solution : Use VBA
Script :

Sub delete_rows_zero()

Application.ScreenUpdating = False

Dim nMaxRow As Long, nrow As Long
nMaxRow = ActiveSheet.UsedRange.Rows.Count
For nrow = nMaxRow To 1 Step -1
      If Range("A" & nrow).Value = "delete" Then
      Range("A" & nrow).EntireRow.Delete
      End If
Next nrow

Application.ScreenUpdating = True

End Sub


Source : http://www.databison.com/index.php/how-to-speed-up-calculation-and-improve-performance-of-excel-and-vba/

Rabu, Juni 08, 2011

Install Ubuntu Perfect Server

This tutorial shows how to prepare an Ubuntu 10.04 (Lucid Lynx) server for the installation of ISPConfig 3, and how to install ISPConfig 3. ISPConfig 3 is a webhosting control panel that allows you to configure the following services through a web browser: Apache web server, Postfix mail server, MySQL, BIND or MyDNS nameserver, PureFTPd, SpamAssassin, ClamAV, and many more. 


Rabu, Mei 18, 2011

Mass User Creation in WordPress

Case : you want to add mass user in your wordpress
Script :

require( '/wp-load.php' );
wp_create_user('otto', 'password', 'otto@ottodestruct.com');
wp_create_user('fake', 'fakepass', 'fake@example.com');
...


Source : http://wordpress.org/support/topic/mass-user-creation-in-wordpress-30

Kamis, April 14, 2011

20 Things You Must Have on Your Blog

20 things you must have on your blog :
  1. SEO Design
  2. Page : Home
  3. Page : About
  4. Page : Disclaimer
  5. Page : Contact
  6. Addthis
  7. Searchbox
  8. Shoutbox
  9. Follower
  10. Popular Post
  11. Recent Post
  12. Blog Archive
  13. Blogroll
  14. Feedjit
  15. Tagcloud / Wp-Cumulus like
  16. Backlink
  17. Paging
  18. Linkwithin
  19. Share Facebook button
  20. Google Adsense sengihnampakgigi

Source : http://www.google.com

Selasa, Maret 29, 2011

JQuery : Tooltip and Image Preview

Case : You want to create cool tooltip or image preview from your thumbnail
Solution : JQuery
Script :

this.imagePreview = function(){
/* CONFIG */

xOffset = 10;
yOffset = 30;

// these 2 variable determine popup's distance from the cursor
// you might want to adjust to get the right result

/* END CONFIG */
$("a.preview").hover(function(e){
this.t = this.title;
this.title = "";
var c = (this.t != "") ? "
" + this.t : "";
$("body").append("

Image preview"+ c +"

");
$("#preview")
.css("top",(e.pageY - xOffset) + "px")
.css("left",(e.pageX + yOffset) + "px")
.fadeIn("fast");
},
function(){
this.title = this.t;
$("#preview").remove();
});
$("a.preview").mousemove(function(e){
$("#preview")
.css("top",(e.pageY - xOffset) + "px")
.css("left",(e.pageX + yOffset) + "px");
});
};

// starting the script on page load
$(document).ready(function(){
imagePreview();
});


Source : http://cssglobe.com/post/1695/easiest-tooltip-and-image-preview-using-jquery

PHP : Auto Resize Image on Upload

Case : you want to resize image on upload
Solution : PHP imagecopyresampled
Script :

if ($_SESSION[username_administrasi] != "" && $_POST[submit] == "Simpan") {
$cek = cek("select * from ktp where no_ktp = '$no_ktp' and npwp = '$npwp' ");
if ($cek > 0) {
alert("Data sudah ada !");
loncat("../index.php");
} else {
$tmp_filename = $_FILES[file1][tmp_name];
$filename = $_FILES[file1][name];
$file = explode(".",$filename);
$nama_file = $file[0];
echo $nama_file;
list($old_width, $old_height, $type, $attr) = getimagesize($tmp_filename);
if ($type == 1 || $type == 2 || $type == 3) {
if (($_FILES["file1"]["size"]/1024) > 250) {
if ($type == 1) {
$new_image = imagecreatefromgif($tmp_filename);
} else if ($type == 2) {
$new_image = imagecreatefromjpeg($tmp_filename);
} else if ($type == 3) {
$new_image = imagecreatefrompng($tmp_filename);
}

echo "
width asli = ".$old_width;
echo "
height asli = ".$old_height;
$new_width = 800;

if ($old_width > $old_height) {
$percentage = ($new_width / $old_width);
} else {
$percentage = ($new_width / $old_height);
}

$new_width = round($old_width * $percentage);
$new_height = round($old_height * $percentage);

echo "
width resize = ".$new_width;
echo "
height resize = ".$new_height;

echo "
".$_FILES[file1][type];
echo "
".$_FILES[file1][size];


if (function_exists(imagecreatetruecolor)){
$resized_img = imagecreatetruecolor($new_width,$new_height);
}else{
die("Error: Please make sure you have GD library ver 2+");
}

imagecopyresampled($resized_img, $new_image, 0, 0, 0, 0, $new_width, $new_height, $old_width, $old_height);

if ($type == 1) {
imagegif($resized_img,"../images/uploaded/tumb_".$nama_file.".gif");
} else if ($type == 2) {
imagejpeg($resized_img,"../images/uploaded/tumb_".$nama_file.".jpg");
} else if ($type == 3) {
imagepng($resized_img,"../images/uploaded/tumb_".$new_image.".png");
}

$move = move_uploaded_file($_FILES['file1']['tmp_name'], '../images/uploaded/real_'.$filename);

ImageDestroy ($resized_img);
ImageDestroy ($new_image);

loncat("../index.php");
} else {

$move = move_uploaded_file($_FILES['file1']['tmp_name'], '../images/uploaded/real_'.$filename);

if ($move) {
alert("Upload sukses.");
} else {
alert("Upload gagal.");
}
loncat("../index.php");
}
} else {
alert(" Tipe file yang diijinkan : GIF, JPG, JPEG, PNG");
//loncat("../index.php");
}
}
}



Source : http://www.php.net/

Jumat, Maret 25, 2011

Blogger : Show hide Guestbook/Shoutbox/Shoutmix

Script CSS :

#gb{
position:fixed;
top:50px;
z-index:+1000;
}
* html #gb{position:relative;}
.gbtab{
height:200px;
width:30px;
float:left;
cursor:pointer;
background:url("http://purwomartono.googlepages.com/slider_shoutmix.gif") no-repeat;
}
.gbcontent{
float:left;
border:5px solid #000000;
background:#FFFFFF;
padding:5px;
}


Script Javascript :

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-4639370-4']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

window.google_analytics_uacct = "UA-4639370-4";

function showHideGB(){
var gb = document.getElementById("gb");
var w = gb.offsetWidth;
gb.opened ? moveGB(0, 30-w) : moveGB(20-w, 0);
gb.opened = !gb.opened;
}
function moveGB(x0, xf){
var gb = document.getElementById("gb");
var dx = Math.abs(x0-xf) > 10 ? 5 : 1;
var dir = xf>x0 ? 1 : -1;
var x = x0 + dx * dir;
gb.style.right = x.toString() + "px";
if(x0!=xf){setTimeout("moveGB("+x+", "+xf+")", 10);}
}

var gb = document.getElementById("gb");
gb.style.right = (30-gb.offsetWidth).toString() + "px";



Source html :







ShoutMix chat widget






Source : http://rtn-alwaysforyou.blogspot.com/2010/08/membuat-show-hide-guestbook.html? kiss

Senin, Maret 21, 2011

JQuery : Autocomplete extraParams

Case : You want to create an autocomplete that depends on another fields
Solution : Using JQuery Autocomplete with extraParams
Script :


$("#ProvinsiCalonSuami").autocomplete("actions/autocomplete.php?p=provinsi", {
max: 100,
width: 260,
selectFirst: true,
});

$("#KabupatenCalonSuami").autocomplete("actions/autocomplete.php?p=kabupaten", {
max: 100,
width: 260,
selectFirst: true,
extraParams: {
provinsi: function(){
return $('#ProvinsiCalonSuami').val();
}
}
});

$("#KecamatanCalonSuami").autocomplete("actions/autocomplete.php?p=kecamatan", {
max: 100,
width: 260,
selectFirst: true,
extraParams: {
kabupaten: function(){
return $('#KabupatenCalonSuami').val();
}
}
});

$("#KelurahanCalonSuami").autocomplete("actions/autocomplete.php?p=kelurahan", {
max: 100,
width: 260,
selectFirst: true,
extraParams: {
kecamatan: function(){
return $('#KecamatanCalonSuami').val();
}
}
});
Source : http://docs.jquery.com/Plugins/autocomplete

Sabtu, Maret 19, 2011

JQuery : Autocomplete not working more than 10 rows

Case : You are using JQuery autocomplete, but the data cannot display more than 10 rows
Solution : using option "Max"
Script :

$().ready(function() {
$("#targetDiv1").autocomplete("actions/autocomplete.php?p=provinsi", {
max: 100,
width: 260,
selectFirst: false,
});

$("#targetDiv2").autocomplete("actions/autocomplete.php?p=kabkota", {
max: 100,
width: 260,
selectFirst: false,
});

$("#targetDiv3").autocomplete("actions/autocomplete.php?p=kecamatan", {
max: 100,
width: 260,
selectFirst: false,
});
});

Selasa, Maret 15, 2011

Javascript : getElementById inside looping For

Mikir gini habis seharian


function formValidator(numrows,jumlah_soal) {
var id_soal = "";
if (numrows < jumlah_soal) {
var x = jumlah_soal;
} else {
var x = numrows;
}

for (var i=1;i<=x;i++) {
var id = document.getElementById("id_soal_"+i).value;
if (id_soal == "") {
var id_soal = id;
} else {
var id_soal = id_soal+', '+id;
}
}

$.post("actions/soal_simpan.php", { id: id_soal} );
window.location.href = "index.php?p=soal_create";
window.open("cetak/soal_simpan.php?id_soal="+id_soal,"print","width=800,height=400px,scrollbars=yes");
}

Install Office 2003 dan Office 2007

http://uksbsguy.com/blogs/doverton/archive/2007/07/21/how-to-get-rid-of-the-installer-configuration-dialog-when-running-office-2007-and-office-2003-on-the-same-system-for-vista-and-other-versions-of-windows.aspx


reg add HKCU\Software\Microsoft\Office\11.0\Word\Options /v NoReReg /t REG_DWORD /d 1
reg add HKCU\Software\Microsoft\Office\12.0\Word\Options /v NoReReg /t REG_DWORD /d 1

reg add HKCU\Software\Microsoft\Office\11.0\Excel\Options /v NoReReg /t REG_DWORD /d 1
reg add HKCU\Software\Microsoft\Office\12.0\Excel\Options /v NoReReg /t REG_DWORD /d 1

Rabu, Maret 09, 2011

JQuery : Reload whole page

Case : You want to reload whole page after add/edit/delete data
Solution : JQuery
Script :


function update(id,tanggal,keterangan,pengeluaran) {
//alert(id + ' ' + tanggal + ' ' + keterangan + ' ' + pengeluaran);
var keterangan = keterangan;
if (confirm('Yakin mau diedit ???')) {
$.post('actions/pengeluaran_edit.php', {id_pengeluaran: +id, tanggal: tanggal+'', keterangan: keterangan, pengeluaran: +pengeluaran, ajax: 'true' },
function(){
location.reload();
});
}
}


Source : http://www.jquery.com/

JQuery : Delete row without reload whole page

Case : You want to delete row of data without reload whole page
Solution : Use JQuery
Script :

function hapus(id){
if (confirm('Yakin mau dihapus ???')) {
$.post('actions/hapus_pengeluaran.php', {id: +id, ajax: 'true' },
function(){
$("#row_"+id).fadeOut("slow");
$('#total_pengeluaran').load('index.php?p=pengeluaran_list #total_pengeluaran');
$('#total_saldo').load('index.php?p=pengeluaran_list #total_saldo');
$('#total_pendapatan').load('index.php?p=pengeluaran_list #total_pendapatan');
});
}
}


Source : http://jquery.com/

Blogspot : Desain themes for adsense

Sample blogspot design themes for adsense :


http://hotbookmark.blogspot.com

























http://nyangkem.blogspot.com/

























http://devjobs-indonesia.blogspot.com/

http://formulaone-mania.blogspot.com/
http://motogpmaniax.blogspot.com/

Senin, Maret 07, 2011

Batch File : Repacking XAMPP

Case : You want to repack xampp to fit your web based application.
Solution : Combine with this, and you will have XAMPP custom installation

@ECHO OFF & SETLOCAL
PUSHD %~dp0

ECHO Mohon untuk sabar menunggu...
ECHO Install Apache masuk ke service Window dulu
xampp_cli.exe installservice apache

@ECHO:
@ECHO:

IF NOT ERRORLEVEL 1 (
ECHO Sekarang memulai Apache :)
xampp_cli.exe startservice apache
)

@ECHO:
@ECHO:

ECHO Mohon untuk sabar menunggu...
ECHO Install MySQL masuk ke service Window dulu
xampp_cli.exe installservice mysql

@ECHO:
@ECHO:

IF NOT ERRORLEVEL 1 (
ECHO Sekarang memulai MySQL :)
xampp_cli.exe startservice mysql
)

@ECHO:
@ECHO:

ECHO Mohon untuk sabar menunggu...
ECHO Install Shortcut ke desktop
copy [your_file_name] "%userprofile%\desktop"

@ECHO:
@ECHO:

ECHO Sabar... Install Firefox kalo belum ada, upgrade kalo sudah ada.
ECHO Tunggu sampai instalasi Firefox selesai, dan window ini akan menutup sendiri :)

@ECHO:
@ECHO:

ECHO Terima kasih

Firefox.exe

exit(1)



Source : http://www.google.com/

Jumat, Maret 04, 2011

Yulgang Online : BOT

Case : You want to play yulgang but too lazy to type on your keyboard, click your mouse, and stare at your monitor for a couple hours setan
Solution : use QuickMacro to bot


//Script mulai
VBS dim darah,mana,darahT,manaT
//pendefinisian variable
//gunakan quick macro pick tool untuk mendapatkan nilai (x1,x2,y,color)
UserVar darah=30 If HP<darah%, supply HP
UserVar mana=30 If MP<mana%, supply MP
UserVar darahT=256 Delay setelah mengisi darah(in milliseconds)
UserVar manaT=256 Delay setelah mengisi mana(in milliseconds)
Rem Begin
Delay 50
//Delay untuk meringankan kinerja CPU
Rem HP
//IfColor hong/100*(x2-x1)+x1 y color 2
IfColor darah/100*(45-30)+30 13 313429 2
//x2=Sisi kanan bar HP, x1=Sisi kiri bar HP
//y=Y axis dari center bar HP, color=warna ketika bar HP kosong
KeyPress 115,1
//Tombol Pot
Delay darahT
//Delay setelah mengisi HP
EndIf
Rem MP
IfColor mana/100*(45-30)+30 26 313429 2
//x2=Sisi kanan bar MP, x1=Sisi kiri bar MP
//y=Y axis dari center bar MP, color=warna ketika bar MP kosong
KeyPress 116,1
//Tombol Gingseng
Delay manaT
//Delay setelah mengisi MP
EndIf
Rem Target
MiddleClick 1
Delay 500
Rem Hit
KeyPress 113,1
//Tombol Skill F9
Delay 100
Rem Pick
KeyPress 120,1
Goto Begin
//script selesai

";})();ButtonMouseDown(this);'>

Source : http://sarifuddin-sarif.blogspot.com/2010/03/macro-bot-for-yulgang-online.html

Rabu, Januari 26, 2011

JQuery : Delete row and fade out the row affected

Case : You want to delete row without refreshing whole page
Solution : Use JQuery


function hapus(id){
if (confirm('Yakin mau dihapus ???')) {
$.post('actions/hapus_pengeluaran.php', {id: +id, ajax: 'true' },
function(){
$("#row_"+id).fadeOut("slow");
});
}
}


Source : http://www.bitsntuts.com/css/simple-jquery-delete-table

Selasa, Januari 18, 2011

Blogger : Add Syntax Highlighter

Supported language : http://code.google.com/p/syntaxhighlighter/wiki/Languages

Source : http://heisencoder.net/2009/01/adding-syntax-highlighting-to-blogger.html

Javascript : Format number function

Case : You want to display format number in javascript
Solution :


function formatNumber (num,dec,thou,pnt,curr1,curr2,n1,n2) {
var x = Math.round(num * Math.pow(10,dec));if (x >= 0) n1=n2='';var y = (''+Math.abs(x)).split('');
var z = y.length - dec; if (z<0) i =" z;" z =" 1;"> 3) {
z-=3; y.splice(z,0,thou);
}
var r = curr1+n1+y.join('')+n2+curr2;
return r;
}


Source : http://javascript.about.com/library/blnumfmt.htm

Jumat, Januari 14, 2011

JQuery : Autocomplete hidden input, Autocomplete multiple field



Kamis, Januari 06, 2011

JQuery : Autocomplete not working with Date picker





















Solution : load datepicker before autocomplete.

Minggu, Januari 02, 2011

Flash CS3 : Create Dynamic Text Box with Scrollbar


var url:String = "menu.txt";
var loadit:URLLoader = new URLLoader();
loadit.addEventListener(Event.COMPLETE, completeHandler);
loadit.load(new URLRequest(url));

function completeHandler(event:Event):void {
menu.text = event.target.data as String;
mytext_scroll.update();
}


modified from :

http://www.tyronedavisjr.com/2007/12/03/flash-cs3-uiscrollbar-scroll-arrows-not-displaying-on-dynamic-text/

Flash CS3 : Load External Text File Data

var url:String = "bio.txt";
var loadit:URLLoader = new URLLoader();
loadit.addEventListener(Event.COMPLETE, completeHandler);
loadit.load(new URLRequest(url));

function completeHandler(event:Event):void {
biotext.text = event.target.data as String;
}


http://www.actionscript.org/forums/showthread.php3?t=135839

Flash CS3 : Button gotoAndPlay


stop();

nextButton.addEventListener(
MouseEvent.MOUSE_UP,
function(evt:MouseEvent):void {
//trace(evt.target.parent.parent.name);
evt.target.parent.parent.gotoAndPlay(11);
}
);



modified from :

http://www.quip.net/blog/2007/flash/making-buttons-work-in-flash-cs3#comment-113406