Senin, 06 Mei 2013

A Little Variation of Good 'Ol J2ME Analog Clock

If you manage to get here by typing "analog clock j2me" or some sort in Google, chances are you have five or more tabs opened in your browser. It's just that an analog clock is pretty much a common thing around, with J2ME being no exception.
That's why this time I'll take a little spin on the analog clock and give it a way to make the thing run faster - or so I hope. In this post we will see how  - instead of the usual sine & cos function (or method, whatever) - to use arrays containing values that corresponds to certain sine & cos value of an angle in an analog clock program using J2ME.

Why Array?

If you have done this before using the sine & cos function, you may ask "Why reinvent the wheels?". You see, the wheels are really a staple of human creativity, as it allow us to move heavy things such as a carriage with much ease than before. That's why, to improve it's usefulness, many improvements are made to the wheels itself, such as using rubber instead of just wood or iron as the outer shell to maximize friction while maintaining the same reliability, and also...
Wait, why are we talking about wheels? Okay, so using sine & cos function, the same goal can be achieved (which is making a line spin, seriously) but if there's one thing we all know about mobile phone: it's slow. Okay, maybe not that slow, but it still run very slowly compared to PCs. So, instead of telling the phone to calculate sine & cos value of an angle every second (which is the same sixty values, anyway) we will give the phone a set of numbers, perfectly ordered from 0 to 360 degrees value of sine & cos, and then told the phone to "skim the catalog" instead. It will be much faster to simply look up a value from a table than calculating it all the way (even humans know it). A lecturer in my college told me about this - and even manage to give an assignment about it (guess which one it is, haha).

Selasa, 25 September 2012

Port Scanner with Java

Hello guys, it's been a while. Let's continue.

(Yeah, that's it. I'm not a big fan of being talkative. Sue me.)

In this post, I'm about to show you how easy it is to make simple port scanner application using our everyday - lo and behold - Java SE language.

The idea is simple; just check all the ports available, one by one, and if you got lucky (you know what I mean) we memorize the port number. In this code example, we use the Socket class from the client to try to connect to all the ports available in a host (Too many "to"? Sue me).

The only drawback from this simple source code is that it runs very slow. Hell, it takes one port a second to scan on my AMD C-60 netbook. You don't like it? Well, I did say this is a simple program. You still don't like it? Sue me.

And since this is - again - a simple program, I only used the basic text interface, so you might want to run this app from DOS mode or the Terminal Linux equivalent. Why? It makes you look cool, working on text-based program and such. You don't like it? Sue me.

Kamis, 10 November 2011

"Text Moving" Web Application Using Java Applet (jApplet)

One of the reason why Java becomes a very popular language is because it can run on multiple platforms, be it a PC, mobile phone, or even in a web browser!

In this post, you will see one simple application that can run in a Chrome browser (or any other browser with JRE available) which involves buttons, text, event-handling and of course: the Java Applet form.

The "Text-Moving" Application Running on Chrome

The application above is used with eight different buttons, each representing directions. When each button is pressed, the text on the center will move to the direction the button is representing, so pressing "Up" button will make the text move up, "Down" button to go down, and so on.

Rabu, 28 September 2011

The Seed of Honesty

Once upon a time (no, it's not a fairy tale), there was a CEO from a successful, multinational, billion-dollar company who is nearing his retirement age and in a need of finding a replacement. So, in order to find someone worthy enough to continue his legacy, he called all of his employee - from the top-level executive to "just-ordinary" employee - and told them to gather in one place (mess hall, probably).

After all the future inheritors gathered, he gave each one of them a seed of a plant (yes, they don't know what plant it is).
"Take care of the seed, raise them properly to a full-grown plant, and one year from now we will gather back here to show me what you have grown. Anyone with the best plant will take my position as a CEO, therefore taking the chance to lead one of the most successful company in the world.", said the CEO.

And they all set out to grow the best plant. One of the ordinary employee, Rahmat, also did the same. Everyday he watered the seed, gave it nutrients and did everything he can to make the seed grow (which is fairly difficult since he didn't know what plant it is).
Unfortunately, it wouldn't. The seed didn't even change it's shape, never mind growing into a full-grown plant of whatever plant it is. Even after 6 months, when all the other top-level and better-educated executives talked proudly about how they seed grew beautifully (even though each plant was of different kind), Rahmat's seed didn't even make a hint of it - it's simply lying dormant in the vase he bought for it.

Ultimately, he felt that he had failed.

Minggu, 06 Februari 2011

Curhat soal komputer ( atau lebih tepatnya laptop)

Sial banget gw !

Ceritanya gini:
Kemarin kan gw pinjem laptop sekolah, maksudnya buat ada acara dari speedy gitu, jadi tuh laptop pertama gw dapet, ngeselin bener.
Alhasil, dengan penuh keyakinan (dan kegoblokan) gw install ulang dah tu laptop.
Pertama mau nginstall XP aja gitu khan, biar lebih humanis. Eh pas udah masuk ke Setupnya, si Setup jahannam itu bilang dengan tenangnya: "Setup cannot find any harddisk"

Aspire 4710 : harddisknya diseret jadi tersangka ke pengadilan

Pada saat itu yang dalam pikiran gw cuma pengen masukin tangan gw ke dalam monitor, cengkeram si Setup itu, tarik dia keluar trus jitak kepalanya sampai tewas. Tapi berhubung Setup itu cuma sebuah program komputer idiot berkecepatan tinggi ya gw cuma bisa ngelus dada doank.

Akhirnya setelah menghabiskan 5 jam mengelus2 dada (nggak ding, cuma hiperbola) gw putuskan untuk mancing si harddisk. Gw coba format pake CD Ubuntu, abis ntu CD Ubuntu nya gw keluarin, masukin lagi XP. Eh si Setup idiot berkecepatan tinggi itu ngomong lagi dengan bahasa yang lebih halus: "Setup cannot find any harddisk".

Wah gerem luar biasa gw. Akhirnya daripada gw kena poin kejahatan (menganiaya laptop sekolah) mendingan gw ngalah. Gw install Vista dan ternyata... berhasil dengan mulus !
Bwahahaha... Untunglah Setup Vista agak sedikit lebih terdidik daripada Setup XP, bisa tau yang mana harddisk yang mana idung.

Tips mempercepat PC anda

Biasanya setelah menekan tombol "Power" pada PC, Anda akan memiliki cukup waktu untuk menyeduh secangkir kopi atau teh akibat lamanya waktu yang dibutuhkan oleh komputer Anda untuk boot. Apalagi jika PC Anda memiliki segudang aplikasi yang secara otomatis menyala, mungkin selain kopi, Anda bisa sekalian mandi dan membuat sarapan terlebih dahulu.

Tanpa adanya peningkatan kinerja perangkat keras yang signifikan, memang tidak banyak yang bisa Anda lakukan untuk mempercepat boot Windows. Tetapi masih ada cara untuk mempercepat waktu yang dibutuhkan oleh desktop untuk mencapai kondisi "siap bekerja". Mari kita simak beberapa cara di bawah ini, baik yang menggunakan kemampuan yang memang sudah tersedia dan aplikasi dari luar.

Ketika Anda menginstal aplikasi baru pada komputer Anda akhir-akhir ini, tidak sedikit yang langsung menjadikan dirinya sebuah program startup; entah untuk mengecek upgrade atau sekedar mengingatkan pengguna bahwa aplikasi tersebut telah di-instal sebagai ikon pada bagian kanan bawah PC seperti aplikasi chat seperti Skype.

Beberapa ciri-ciri komputer Windows yang terserang virus

Berikut salah satu ciri-ciri Komputer Yang Terjangkit Virus (khusus Windows):

1. Komputer Anda berjalan lebih lambat dari biasanya.
2. Menu Run, Search disembunyikan oleh virus.
3. CTRL+ALT+DEL tidak bisa digunakan.
4. Regedit dan MSCONFIG di disabled
5. Folder asli pada komputer anda disembunyikan dan diganti dengan file virus.
6. Menu Folder Options di Windows Explorer hilang.
7. Komputer sering berhenti atau tidak merespon.
8. Komputer tiba-tiba restart atau crash dan ini terjadi beberapa menit sekali.
9. Aplikasi komputer tidak berjalan dengan semestinya dan sering error.
10. Muncul File dengan Icon Folder tetapi mempunyai file type .exe
11. Hardisk atau disk drive tidak bisa diakses.
12. Aktivitas print tidak bekerja dengan semestinya.
13. Sering terjadi pesan error yang aneh dan tidak biasanya.
14. Sering terlihat menu atau dialog box yang rusak.
15. Terdapat Duplikasi nama folder di dalam folder tersebut.
16. Komputer selalu mengeluarkan pesan dari mana virus ini berasal.

Jika komputer anda mengalami salah satu ciri-ciri diatas, berarti ada kemungkinan komputer anda terkena virus, segera update antivirus anda dan scan komputer anda
untuk membersihkan virus tersebut.

Sumber :