Rabu, 21 Oktober 2009

Tes Tulis CPNS Departemen Perhubungan

Tes Tulis CPNS Departemen Perhubungan terlewati, tinggal menunggu pengumuman apakah lolos atau tidak. Pengumumannya sendiri akan diumumkan langsung melalui website Departemen Perhubungan.

Jika anda penasaran apa menjadi materi dalam tes perhubungan kali ini mungkin saya masih dapat mengingat beberapa soal yang akan saya post-kan berikut ini:

Jumlah Soal 200 tipe pilihan ganda dengan Lembar Jawaban Komputer.
100 Soal TKD (Tes Kemampuan Dasar) dan 100 TKB (Tes Kemampuan Bidang)

100 soal kemampuan dasar terdiri dari
1. Pancasila dan UUD
2. Soal Sebab Akitat
3. Soal Pilihan Majemuk
4. Sinonim
5. Antonim
6. Wacana
7. Deret Angka
8. Matematika
9. Logika
10. Psikotes dan Skala Kematangan

100 soal TKB (Tes Kemampuan Bidang) terdiri atas pengetahuan bidang perhubungan dan komputer, sistem perhubungan, pemeriksaan dan pengawasan, sarana dan prasarana perhubungan dan pengetahuan lain terkait Departeman Perhubungan.

semua soal pilihan ganda dan menggunakan sebuah LJK. Pertanyaan yang masih teringat (Tes Kemampuan Bidang) :
1. Apa Plat nomor (pertanyaan kasar) pesawat Indonesia.. PK
2. Apa nama tempat parkir pesawat.. Hangar
3. Apa itu Marka Jalan..????
4. Kepanjangan ASDP..
5. Arti Lampu Hijau..
dll..

maaf-maaf bener-bener lupa yang lain...baru sempat posting malam2..


Balai Latihan dan Pendidikan Perhubungan Darat, Gianyar, Bali

Senin, 19 Oktober 2009

Set Form Element Readonly with Javascript

How we can Set Form Element Readonly with Javascript ..

a piece of the code is here

opener.document.getElementById('jml_aset').setAttribute('readOnly','readOnly');

or the complete forum can be found here

Im affraid any lost.. Maybe copy any source code to this post is good idea...

<script type="text/javascript">

function blah(bool) {
if(bool) {
document.getElementById("ta").readOnly = true;
}
else {
document.getElementById("ta").readOnly = false;
}
}

</script>

<textarea id="ta"></textarea>
<input type="checkbox" onclick="blah(this.checked)" />


or this solution

[1] use setAttribute and removeAttribute

if(document.formOne.fieldInfo.checked)
{
document.forms['myFormId'].myTextArea.setAttribute('readOnly','readonly'); //2nd readonly more freedom
}
else //if(!document.formOne.fieldInfo.checked)
{
document.forms['myFormId'].myTextArea.removeAttribute('readOnly');
// also tried document.formOne.fieldtextarea.focus();
}

[2] property assignment

if(document.formOne.fieldInfo.checked)
{
document.forms['myFormId'].myTextArea.readOnly=true; //true has some freedom
}
else //if(!document.formOne.fieldInfo.checked)
{
document.forms['myFormId'].myTextArea.readOnly=false; //false has some freedom
// also tried document.formOne.fieldtextarea.focus();
}

MySQL Stored Procedure that have Variable Table Name and it's Query Validation

I have try and try about MySQL Stored Procedure that have Variable Table Name and it's Query Validation. First i try to make MySQL Stored Procedure that have Variable Table Name. I so newbie in stored procedure, but after any success it feel so nice.

This stored procedure primary target is giving a increment counter in a field. The increment value of a asset (Asset Information System) giving a unique ID between each number of asset even the asset is the same.

below is primary procedure to do the increment.




DELIMITER $$

DROP PROCEDURE IF EXISTS `db_simaset`.`addnew`$$

CREATE DEFINER=`root`@`localhost` PROCEDURE `addnew`
(in tabel varchar(15), in kodeaset varchar(11),
in banyak numeric,
in awalancounter numeric,
codesppa varchar(20),
id_transaksi numeric,
tglpenerimaan date,
tglpembukuan date)
BEGIN
set @awalancounter=awalancounter;
set @inc=1;
set @ptabel=tabel;

while (@inc <= banyak) do begin
set @awalancounter=@awalancounter+1;
SET @dyn_sql=CONCAT("INSERT INTO ",@ptabel,"(kode_aset,no_aset,
no_sppa,id_transaksi,tgl_penerimaan,tgl_pembukuan)
values ('", kodeaset,"','", @awalancounter,"','",codesppa,"','",
id_transaksi,"','",tglpenerimaan,"','",tglpembukuan,"');");

PREPARE s1 FROM @dyn_sql;
EXECUTE s1; set @inc=@inc+1;
end;
end while;
END$$
DELIMITER ;



the validation is give a single quoted beetwen dynamic value of the field. I mean Here



'",kodeaset,"'



without the validation it will be error column will happen shows that MySQL confuse about integer and varchar value.

Hope it will help you..

Selasa, 13 Oktober 2009

MySQL Stored Procedure that have Variable Table Name

First Time Using Stored Procedure in MySQL 5 is a high class type of database programming to me. I still newbie in this kind of programming.

But in this article i want to show you that a direct variable table name doesn't work in MySQL Stored Procedure. The example below will got error table name

DROP PROCEDURE IF EXISTS addnew;

DELIMITER $$

CREATE
/*[DEFINER = { user | CURRENT_USER }]*/
PROCEDURE `db_simaset`.`addnew`(in ptabel varchar(20), in kodeaset varchar(20), in banyak numeric, in awalancounter numeric)

BEGIN
set @awalancounter=awalancounter;
set @inc=1;
set @ptabel = ptabel ;


while (@inc <= banyak) do begin set @awalancounter=@awalancounter+1; insert into @ptabel (kode_aset, no_aset) values(kodeaset,@awalancounter); set @inc=@inc+1; end;
end while;


END$$


DELIMITER ;



then, to make it works, it should be like this (Using Concat ( String Function))


DELIMITER $$

DROP PROCEDURE IF EXISTS `db_simaset`.`addnew`$$

CREATE DEFINER=`root`@`localhost` PROCEDURE `addnew`(in tabel varchar(15), in kodeaset varchar(11), in banyak numeric, in awalancounter numeric)
BEGIN
set @awalancounter=awalancounter;
set @inc=1;
set @ptabel=tabel;

while (@inc <= banyak) do
begin
set @awalancounter=@awalancounter+1;
SET @dyn_sql=CONCAT("INSERT INTO ",@ptabel,"(kode_aset, no_aset) values (",kodeaset,",",@awalancounter,");");
PREPARE s1 FROM @dyn_sql;
EXECUTE s1;
set @inc=@inc+1;

end;
end while;


END$$


DELIMITER ;