Sunday, 9 February 2014

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