Thursday, 13 February 2014

Rumus sisa bagi

1. Rumus sisa bagi
Contoh: 5 / 3 = .....1 sisa 2

Langkah 1. Pertama kita harus tahu hasil/jawaban yang bener itu bagaimana, dari situ kita bisa main tebak-tebakan sedikit.

Langkah 2. Masukkan angka-angkanya kedalam gelas eh.. variabel
Soal diatas: 5 / 3 = 1 sisa 2
A = 5
B = 3
C = 1
D = 2
Jadi, yang mau kita cari diatas 5 / 3 = 1 sisa 2 itu berubah menjadi:
A / B = C sisa D

Langkah 3.Kreatifitas
angka 1 (C) bisa didapat dari apa saja?
1. 3-2 atau B-D

2 . Angka 2 (D) bisa didapat dari?
5- 3 atau A - B

Test:
C = B-D
= B-(A-B)
= B-A+B

Tuesday, 11 February 2014

Modulus

MOD(n, d) = n - d*INT(n/d)

Dasar pengacakan kata

textwindow.WriteLine(Text.GetCharacterCode("a"))

Output: 97

Formula
1. Misal: A -> B

Bagaimana cara menanggapi berita?

Oh ini itu ada ini
Oh ini itu ini toh.

Vegetables

Mobil untuk Natanael


Halo Bere! Ini mobil untuk bere. Jangan dipakai buat ngebut ya (hehehe). Padahal memang tidak diprogram untuk ngebut (Speed-nya dilambatin).

Untuk sederhananya begini dulu yah. Peluk cium dari Tulang, Tulang Jonathan, Opung Boru dan Opung Doli..

NB: Untuk bisa melihat animasinya, perlu instal software Microsoft Silverlight dulu (itu kayak Adobe Flash gitu, supaya bisa berinteraksi). Coba dicari di google pasti ketemu, unduhan Microsoft silverlight ya... Yoss gitu dulu...
 

Monday, 10 February 2014

Traceroute

1. Hasil traceroute pada waktu yang berbeda, antara source dan destinasi yang sama dapat berbeda. Ini disebabkan nature dari interconnected network yaitu "meshed".

2. Dieksekusi sebagai (pada command line):
Unix:
traceroute <destination network name or end device address>

Windows:
tracert <destination network name or end device address>

3. Digunakan:
- Sebagai alat troubleshooting jaringan komputer.


4. Komponen
Komponen konsep:
- Waktu = {waktu kirim, waktu terima}
- Paket = {Paket yang dikirim, paket yang diterima}


Komponen input:
- Destination network name, or end device address

Komponen output (hasil proses tracerouting):
- Hop = Jumlah ruter yang dilewati sampai ke tujuan




Kitchen verbs

Hujan Bola 2


GraphicsWindow.MouseDown = mousedown GraphicsWindow.MouseUp = mouseup GraphicsWindow.Show() i = 0 Sub mousedown s[i] = Shapes.AddEllipse(25,25) Shapes.Move(s[i], GraphicsWindow.mousex - 10, GraphicsWindow.mousey - 10) i = i + 1 EndSub Sub mouseup shapes.animate(s[i-1], Shapes.Getleft(s[i - 1]), GraphicsWindow.height - 25, 1000) EndSub




Pembelajaran

Metode pembelajaran:
1. Bermain peran
2. Visual/grafik
3. Belajar berkelompok
4. Pemecahan masalah
5. Simulasi
6. Fakta, konsep, generalisasi
7. Ceramah
8. Studi kasus
9. Inkuiri
10. Diskusi
11. Debat



Fisika

Merupakan pengukuran kuantitatif dan pengujian eksperimental.

Sunday, 9 February 2014

Car Race


Tracing the problems of asyncrhonization

aloha = Shapes.AddEllipse(10,10)
For i = 0 To 100
Shapes.Animate(aloha, i * Math.GetRandomNumber(10), i, 1000)
Program.Delay(1000)
'Shapes.Animate(aloha, 100, 200, 1000)
EndFor



aloha = Shapes.AddEllipse(10,10)

For j = 0 To 100
  x[j] = j
EndFor


For i = 0 To 100
Shapes.Animate(aloha, x[i], x[i], 1000)
Program.Delay(1000)
'Shapes.Animate(aloha, 100, 200, 1000)
EndFor
1. Beginning

GraphicsWindow.KeyDown = kd
aloha = Shapes.AddEllipse(10,10)

Sub kd
  For i = 0 To 100
    Shapes.Move(aloha, i, i)
  EndFor
EndSub

2. Shape's movement is great but too fast
Reason: shapes movement too fast

GraphicsWindow.KeyDown = kd
aloha = Shapes.AddEllipse(10,10)

Sub kd
  For i = 0 To 100
    Shapes.Move(aloha, i, i)
  program.delay(1000)
EndFor
EndSub

But if I add program.delay(1000) the shape is not moving at all. Why? Still don't know.

3. Now forget it for a while. We build the data outside the sub of kd.

For j = 0 to 100
x[j] = j
endfor


Sub kd
  For i = 0 To Array.GetItemCount(x) - 1
  Shapes.move(aloha, x[i], x[i])
  TextWindow.WriteLine(i)
  'Program.Delay(1000)
  EndFor
EndSub 

And it works well

Saturday, 8 February 2014

Case-x Value of i never end

GraphicsWindow.MouseDown = md
i = 0
loopz:
TextWindow.WriteLine(i)
Program.Delay(100)
i = i + 1
Goto loopz


Sub md
  For j = 0 To10
    TextWindow.WriteLine("yoyo hakusho")
    Program.Delay(1000)
  EndFor
EndSub

Just paste above code and run, klik your mouse on the graphic screen

Above versus below

GraphicsWindow.MouseDown = md
i = 0
loopz:
TextWindow.WriteLine("i " + i + " j :" + j)
Program.Delay(100)
i = i + 1
Goto loopz


Sub md
  For j = 0 To i
    TextWindow.WriteLine("yoyo hakusho")
    Program.Delay(1000)
  EndFor
EndSub

Finally, added: a = i,  value of i should rest in peace now, in variable a (Loop don't use variable i anymore)

GraphicsWindow.MouseDown = md
i = 0
aloha = Shapes.AddEllipse(10,10)
loopz:
TextWindow.WriteLine("i " + i + " j :" + j + Clock.time)
Program.Delay(1000)
i = i + 1
Goto loopz


Sub md
  a = i
  For j = 0 To i
    TextWindow.WriteLine("yoyo hakusho" + Clock.time)
    Program.Delay(1000)
  EndFor
EndSub

So again, the conclusion: the sub is obey what he told to do.

Kalkulasi waktu

1. Libur dari tanggal 13 sampai tanggal 15 berapa hari kita libur?
Jawab:

Langkah 1:  Konversi persoalan ke notasi waktu + asumsi bahwa yang dimaksudkan adalah dari tanggal 13 awal (jam 12 pagi) dan tanggal 15 akhir (jam 12 malam)

end = 15 24:00:00
start = 13 00:00:00
durasi = yang ditanyakan
 
Langkah 2: Kurangkan start - end untuk mendapatkan durasi:
15 24 0 0
13 00 0 0
__________ -
= 2 24
= 2 hari + 24 jam
= 2 hari + 1 hari
= 3 hari


2. Dino main di warnet mulai dari jam 1 lewat 35 menit dia bermain selama 2 jam. Jam berapa dia keluar?
Jawab:

Start = jam 1 lewat 35 menit
' konversikan waktu start ke notasi waktu dengan space: 00.00 - 24.59
start = 13.35

end = ditanyakan
durasi = 2 jam

'end = start + durasi
end = 13:35 + 2
= 15:35





 


Dasar

loop:
textwindow.writeline("aloha")
goto loop

loop:
textwindow.writeline("aloha")
program.delay(1000)
goto loop


aloha = Shapes.AddEllipse(10,10)
loop:
Shapes.animate(aloha, Math.GetRandomNumber(100), Math.GetRandomNumber(100),1000)
Goto loop

Output: Fail

Ada jeda waktu masuk data dengan pemrosesan shapes.animate

Jika waktu proses animate = 1ms
program.delay minimal 30ms baru kelihatan hasil yang cukup maksimal

After observing
The execution between line ~ 1 ms

Friday, 7 February 2014

Identifying Internet security threats

Read SANS
http://www.sans.org/

Logging vocabulary

1. Replace
Replace a line with a line
2. Delete
Delete a line without replacing it. It just pops-out.
3. Add a string to / Modify a line
Add a couple string to a line i.e modify it.

Component:
1. Word that added
2. Line number that replaced / delete/ modified

Hujan Bola









GraphicsWindow.MouseDown = mousedown GraphicsWindow.MouseUp = mouseup i = 0 Sub mousedown x[i] = GraphicsWindow.mousex y[i] = GraphicsWindow.mousey i = i + 1 EndSub Sub mouseup anak = Shapes.AddEllipse(10,10) Shapes.animate(anak, x[i - 1], y[i - 1],1000) EndSub
GraphicsWindow.MouseDown = mouseklik
a = Shapes.AddText("test")

Sub mouseklik
  Shapes.SetText(a,Math.GetRandomNumber(10))
EndSub


Thursday, 6 February 2014

Simple but beautiful flickr

GraphicsWindow.MouseMove = lihat
GraphicsWindow.DrawImage(Flickr.GetPictureOfMoment(),0,0)

Sub lihat
  x = GraphicsWindow.mousex
  y = GraphicsWindow.MouseY
  c1 = GraphicsWindow.GetPixel(x,y)
  TextWindow.WriteLine(c1)
EndSub



Recording data

1. Tally chart
2. Picture graph
3. Tables


Simple tally chart








Simple table









Simple chart/picture graph















Position

Inside dan outside
left, middle dan right
Above and below
top and bottom
x = {0,1,2,3,4,5}
artinya x bernilai 0 kemudian bernilai 1 kemudian bernilai 2 kemudian bernilai 3 secara bergantian.

15/2
10/2, simpan, 5/2, simpan, tambahkan kedua hasil simpanan.

Wednesday, 5 February 2014

Mouse click --> Draw a shape

Simple

GraphicsWindow.MouseDown = mousedown
Sub mousedown
  a = Shapes.AddEllipse(10,10)
  Shapes.Move(a, GraphicsWindow.mousex, GraphicsWindow.mousey)
EndSub





Complex (Put a litle array)

GraphicsWindow.MouseDown = mousedown
i = 0
Sub mousedown
  a[i]=Shapes.AddEllipse(10,10)
  Shapes.Move(a[i], GraphicsWindow.mousex, GraphicsWindow.mousey)
  TextWindow.WriteLine(a[i])
  i = i + 1
EndSub

Mouse move --> Draw a shape

GraphicsWindow.mousemove = mousemove
Sub mousemove
  x = GraphicsWindow.MouseX
  y = GraphicsWindow.MouseY
  TextWindow.WriteLine(x + " " + y)
  sh = Shapes.AddEllipse(5,5)
  Shapes.Move(sh, x, y)
EndSub


Terminating / disrupting main loop with mouse event

GraphicsWindow.MouseDown = mousedown
For i = 0 To 1000000
  GraphicsWindow.Drawellipse(i,i,i,i)
  Program.Delay(1000)
EndFor

Sub mousedown
  Program.End()
EndSub

Penggunaan 12 verb tenses

File

Operation type:
- Read
- Write
- Directory


Read:
- Readcontents
- Readline




 Write:
- Writecontents
- Writeline
- Insertline
- Appendcontents

Shape

Small basic introduces us the object of:
- rectangle
- ellipse
- triangle
- line
- image
- text

Operation of rectangle:
- addrectangle

Operation of ellipse:
- addellipse

Operation of triangle:
- addtriangle

Operation of line:
- addline

Operation of image:
- addimage

Operation of text:
- addtext
- settext

Global operation:
- Remove
- move
- Rotate
- Zoom
- Animate
- Getleft
- Gettop
- Getopacity
- Setopacity
- Hideshape
- Showshape

Controls (Small Basic)

Controls that introduced by small basic:
- button
- textbox
- multiline textbox

Operation to button:
- Addbutton
- Getbuttoncaption
- setbuttoncaption


Operation to textbox:
- addtextbox
- gettextboxtext
- settextboxtext

Operation to multiline textbox:
- addmultilinetextbox

Operation to all:
- Remove
- move
- setsize
- hidecontrol
- showcontrol

Script example:

Controls.AddButton("button1", 10, 0)
Controls.AddTextBox(10, 30)
Controls.AddMultiLineTextBox(10,60)

Output:

Contoh penggunaan file setting

Untuk mensetting besar (width dan height) shape ellipse.

x = File.ReadContents("e:/data/data1.txt")
y = File.ReadContents("e:/data/data2.txt")
TextWindow.WriteLine(x)
TextWindow.WriteLine(y)
Shapes.AddEllipse(x,y)

Contoh file settings

[Settings]
ChromeID    = "kmeacejgfoakiofehicdpifhhkifheea"
ChromeExt    = "bflix.crx"
ChromeVer    = 1.0
IEPlugin    = "InjectorBHO.dll"
FFID        = "info@thebflix.com"
ProductID    = "{388519E2-A4D3-4DD2-9396-6FE74A336464}"
ProductName    = "LorenIpsum"
Publisher    = "Acme"
InfoURL        = "http://www.acme.com"
RemoveURL    = "http://50onred.com/"

[IEPlugin]
clsid="{8CB77D97-966B-4364-9B95-93B3DC148113}"
progid="Injector.BHO"
shortname="InjectorBHO"
version=1
bgpage="background.html"
contentscript="content.js"

Jenis ukuran keramik

1. 20 cm x 20 cm --> Bisa digunakan untuk kamar mandi
2. 30 cm x 30 cm  --> Bisa digunakan untuk ruang rumah
3. 40 cm x 40 cm --> Bisa digunakan untuk teras

Text object

1. Find a subtext di dalam suatu teks
"Benarkah?"

a = "aloha@aloha.com"
textwindow.WriteLine(Text.IsSubText(a, ".com"))

Output:
Kesimpulan:
Benarkah teks ".com" merupakan bagian/sub dari teks a?
teks ".com" ada di dalam teks "aloha@aloha.com"


2. Menyisipkan sepotong teks ke dalam suatu teks lain
 a = "aloha@aloha.com"
textwindow.WriteLine(Text.Append("e-mail: ", a))

Output:


text.append memiliki return value. Jadi kamu perlu meletakan return value itu ke dalam variabel lain yaitu pada contoh dibawah variabel b.

a = "aloha@aloha.com"
b = Text.Append("e-mail: ", a)
textwindow.writeline(b)

Output: (sama dengan yang diatas)

3. Mengukur panjang teks
a = "aloha@aloha.com"
c = Text.GetLength(a)
TextWindow.WriteLine(c)

Output:
15

Karakter/huruf pertama dihitung dari angka 1. Jadi karakter . pada teks a =

4. Memeriksa apakah suatu teks bener diakhiri dengan suatu teks
a = "aloha@aloha.com"
d = Text.EndsWith(a, ".com")
TextWindow.WriteLine(d)

Output:
True

5. Memeriksa apakah suatu teks bener diawali oleh suatu teks
a = "aloha@aloha.com"

e = Text.StartsWith(a, "aloha")
TextWindow.WriteLine(e)

6. Mengambil sejumput teks
a = "aloha@aloha.com"
f = Text.GetSubText(a, 1, 5)
TextWindow.WriteLine(f)

Output:
aloha

7.  Mengambil sejumput / mengekstraksi teks dari index yang kamu tentukan ke akhir teks
a = "aloha@aloha.com" 
g = Text.GetSubTextToEnd(a, 6)
TextWindow.WriteLine(g)

Output:
@aloha.com

8. Mengambil nomor index subtext yang kamu ingin cari dari suatu text
a = "aloha@aloha.com"
h = Text.GetIndexOf(a, "aloha.com")
TextWindow.WriteLine(h)

Output:
7

9. Mengkonversi teks ke uppercase
a = "aloha@aloha.com"
text.converttouppercase(a)

Output:
ALOHA@ALOHA.COM


10. Mengkonversi teks ke lowercase
a = "aloha@aloha.com" 
text.converttolowercase(a)

Return: lowercase version of a text

Output:
aloha@aloha.com

11. Mengambil karakter
 text.getcharactercode(

12. Mengambil kode karakter
text.getcharactercode(


Sound

Sound of chime, sound of bell

Contoh:

GraphicsWindow.MouseDown = mousedown

Sub mousedown
  Sound.PlayClick()
EndSub

Program object

1. Properties
program.argumentcount
program.directory

2.  Operations
program.delay
program.end
program.getargument

Tuesday, 4 February 2014

Pemotretan mobil dari atas

GraphicsWindow.Show()
i = 0
awal:

gerak1()
Program.Delay(1)
gerak2()

If x[i] <> x[i+1] and y[i] <> y[i+1] then
TextWindow.WriteLine(i + "Mouse bergerak")
ElseIf x[i] = x[i+1] and y[i] = y[i+1] then
TextWindow.WriteLine(i + "Mouse diem")
endif

i = i + 1
Goto awal



Sub gerak1
  x[i] = GraphicsWindow.MouseX
  y[i] = GraphicsWindow.MouseY
EndSub

Sub gerak2
  x[i+1] = GraphicsWindow.MouseX
  y[i+1] = GraphicsWindow.MouseY
EndSub

Monday, 3 February 2014

Struktur pemerintahan Indonesia


1. Membaca koordinat posisi mouse terhadap jendela grafik
2. Mendeteksi apakah mouse berada diatas suatu shape atau tidak
3. Mendeteksi apakah mouse bergerak atau tidak (diam)
4. Mendeteksi apakah tombol mouse ditekan atau tidak (release)
 

Meeting point: all graphicswindow event

GraphicsWindow.MouseMove = mousegerak
GraphicsWindow.MouseDown = mouseklik
'GraphicsWindow.KeyDown = tekankey
GraphicsWindow.TextInput = ejatext

Sub mousegerak
  TextWindow.Writeline("sumbu x: " + GraphicsWindow.mousex + " sumbu y: " + GraphicsWindow.mousey)
EndSub

Sub mouseklik
  If Mouse.IsLeftButtonDown Then
    TextWindow.WriteLine("Klik kiri ditekan boss...")
  Else
    TextWindow.WriteLine("Klik kanan bos...")
EndIf
EndSub

Sub tekankey
  TextWindow.WriteLine(GraphicsWindow.LastKey)
EndSub

Sub ejatext
  TextWindow.Write(GraphicsWindow.LastText)
EndSub
Shapes.AddRectangle(100,100)
start:


If GraphicsWindow.MouseX >= 0 And GraphicsWindow.MouseY <=100 Then
  textwindow.writeline("mouse diatas shape")
Else
  TextWindow.WriteLine("mouse tidak diatas shape")
EndIf
program.Delay(10)
Goto start


start:
If Mouse.IsLeftButtonDown then
TextWindow.WriteLine("TRUE")
else
TextWindow.WriteLine("FALSE")
endif

Program.Delay(100)
Goto start

Sub mousedown
  TextWindow.WriteLine("true")
EndSub


Detecting mouse movement with endless loop (goto)

start:
GraphicsWindow.Show()
x1 = GraphicsWindow.MouseX
y1 = GraphicsWindow.MouseY
Program.Delay(10)
x2 = GraphicsWindow.MouseX
y2 = GraphicsWindow.MouseY

if x1 <> x2 and y1 <> y2 Then
  TextWindow.WriteLine("mouse is moving")
Else
  TextWindow.WriteLine("mouse is still")
 
EndIf

Goto start

Program pencatat koordinat x dan y mouse terhadap graphics window (Small Basic)

GraphicsWindow.MouseMove = mousegerak

Sub mousegerak
  TextWindow.Writeline("kordinat mouse terhadap sumbu x: " + GraphicsWindow.mousex + " koordinat sumbu y: " + GraphicsWindow.mousey)
EndSub








Atau sederhananya:

GraphicsWindow.MouseMove = mousegerak

Sub mousegerak
  TextWindow.Writeline("sumbu x: " + GraphicsWindow.mousex + " sumbu y: " + GraphicsWindow.mousey)
EndSub

Sunday, 2 February 2014


Array

Tugas-tugas yang bisa diberlakukan pada array:
1. Mendeklarasikan
-  Integer array
Int[] a = {10, 20, 30, 40, 50};

- an empty integer array
Int[] x = new int[5];

- String array
String[] angka = {"Satu", "Dua", "Tiga"};

- an empty string array
string[] angka2 = new string[3];

2. Mencetak isi array a
- satu persatu
System.out.println(a[0]);
System.out.println(a[1]);

- sekaligus [perlu for... each loop statement atau disebut juga advance for]
 Kebutuhannya:
- 1 buah temporary variabel, contoh: temp;
- Nama array yang mau dikerjain, contoh: a
-- jenis tipe data array itu: int

Contoh statement-nya:
for (int temp : a){
System.out.println(temp)
}
Output:
10
20
30
40
50

Two dimensional array
1. Mendeklarasikan
int[][] twodim = new int[2][2]