RSS

Category Archives: Programming

New Java User Group – Bandung


Java User Group (JUG) Bandung merupakan suatu komunitas pengguna java yang ada di Bandung. Komunitas ini berisikan anggota yang ingin belajar lebih dalam lagi mengenai dunia pemrograman Java. Karena itu, JUG di tujukan untuk semua orang yang tertarik dengan Java.

Anggota JUG sementara ini masih dari regional Bandung, namun tidak menutup kemungkinan anggota dari luar kota untuk bergabung. Silahkan click untuk bergabung dengan JUG Bandung.

Affiliate Partner :

OpenSolaris User Group Bandung

Advertisements
 
1 Comment

Posted by on December 5, 2009 in Programming

 

Simple Countdown-Timer Application

Hi! I want to share a simple countdown-timer application. You can use this application freely. If you decide to view the code, just let me know or send me an email. I will give the whole code to you.
timer2
Basically, it’s using a Thread System. First Thread hold the GUI form, and the second one hold the time and rapidly change the display for the latest time.
You can use this application as a time-manager when you hold an examination. To download the application, click here. Let me know if there’s any bug or need further improvement. Thank you!

 
6 Comments

Posted by on November 8, 2009 in English, Programming

 

What is MVC ? (Release your Blind-Fold)

To build a good and stable software, you need to design your architecture well.. Just like a building, the better architecture, the best quality of building would be done. Software is similar with building. But the different is, Building is built of bricks, cement and roof, while software is built with binary hexadigital code. But if we switch our point-of-view, software and building have many similarity. For example, a building could have a hole, while software either. We will not discuss further about hole, we will discuss about what architecture is good, and i will explain what MVC is. As a brief explanation, MVC is Model-View-Controller. With this architecture, you logically and physically split your code between the code that shown by the user (View), code that operate logical algorithm, access database, controlling flow of program, etc (Controller), and Mapping all tables to class (Model). So, this pattern is provided for object-oriented based application. This architecture was introduced by GangOfFour(GoF) in his book, Head First – Design Pattern. So, what’s wrong with old architecture? check this figure below :

blog-1

Q: So, is that something wrong with that code?
A: No, i don’t think so.
Q: So, can we develop application with this old pattern?
A: Absolutely yes.

Hey, wait! there’s something wrong with my for loop.

Now, i’m gonna entice you to imagine. Imagine if your PHP code is now 100 lines (remember, 100 lines only PHP code), then there’re somehting wrong inside your code. Is that so easy to be found? Are you sure whethere there are 100% human-error free? How about if you change your PHP code, then you ACCIDENTALLY change your HTML code? then you will find another problem, aren’t you?


Just what i’ve said before, with MVC pattern, you split up 3 big things in application. The architecture is about like this :

blog-2

Controller is the core of program because it control program flow and error handling. All related with algorithm or logical thing will be handled by Controller.

A: Hey, there’s nothing special with your architecture!
B: Are you sure? what about if you have any error with your traditional architecture?
A: Just fix it!
B: Fixing with handling much time than before?
A: …..
B: Come on, with this architecture, you are so easy to develop application. You split your code, you can design your UI it self without disturbing the whole algorithm.. once you have errors in your algorithm, you don’t have to distract your UI code..and of course, you could work in team, your mate design the UI, you do the logical programming.. Whoaa.. what a team i have!!
A: Really? So i should migrate my architecture to MVC
B: Absolutely, NO!!

Hey, why B answer No? Because MVC is architecture that fit with Object-Oriented Application. MVC can sometime make you easier, but sometime can make you harder to develop application. So, MVC is not the only one architecture, but it’s just an alternative to develop application much easier.

Another case appear. Is that possible if we disable one of three elements?

The answer is, YES. But, MVC only tolerate if you disable Model element. If you prefer native JDBC or native database accesing and querying then Modelling Class, you can disable Model elements and you do query with using old way. But, you can’t disable view and controller elements! These 2 elements are the core of all application. If you disable view, what should be viewed in monitor? Same with controller, if you disable this element, who should control the flow of application?


I will give you some framework that MVC based (all framework are Web-Based application) :
PHP
– Zend Framework
– CodeIgniter

JSP
-JSF + RichFaces (JSF as Controller, and RichFaces as View)
-Spring + Tapestry (Spring as Controller, and Tapestry as View)
-Struts (As View)
-Hibernate (As Model)

 
3 Comments

Posted by on August 2, 2009 in English, Programming

 

How to develop a light-weight application (a basic tip for a beginner)

Developing application is a interesting thing to learn. Developing application is somewhat easy and somewhat hard, depends on your project or the cases contains in the application. There are several tips to develop application much easier and stronger.

1. Work in team

Create a team. A team is important because you couldn’t develop all by your self. Yes, you could develop everything with your own hands, but will it strong? Or would it optimized?
A team basically should consists of programmer and system designer. But for an optimal one, you could split your team into 4 section : Programmer / Developer, System Analyst / Designer, UI Designer, and Tester. You can define how many person you should put to each section. Note that you have to be wised in putting number of persons into each sections.

2. Design your system

During my experience in internship terms, designing system before developing it help me so much. We could define how the database relation scheme, what classes should i create, and the sequence of my program while it’s executed. For creating database, you could use EntityRelationship Diagram to represent relationship between each node and Class Diagram to represent relationship between tables. Class diagram yet are useful to design what class should you create during Development phase. Sequence Diagram are useful too, to define sequence of the program. UseCase Diagram is useful to define WHAT ROLE should do WHAT THINGS. Be wised in design and prepare it well or you will get failed during development phase.

3. Define your programming language

Programming Language is important because it’s core of developing phase. Wrong or unsuitable programming language will fail you during Development Phase. For example, it’s impossible to use Delphi 7 to create ObjectOriented Application. Or if you want to create interactive web application, it’s impossible if you just use HTML. So, discuss it with your team what programming language that best suit with your cases.

4. Create TimeLine. Never Make it So Long

TimeLine is important to define when should the application finished. Define your timeline that suit with your case and your ability. Never make it too long, otherwise you will be punished with your customer. On the contrary, don’t make a blank hope to your customer by giving a short-time developing phase. Once the customer disappointed with you, they would not call you for any projects.

5. Error Testing

Yeah, during my experience, this part is the most thing that developer forgot to handle to. Error testing is the last important things to be handled. It’s important to check whether any bugs or holes that insist inside the code. This part, yet is useful to make error code if there’s a human-error. Many developer forget this. It should be exist in any project team, so that your application would be 99% perfect (why not 100%, because NOTHING PERFECT IN THIS WORLD, PAL :D)

So, i hope this tip would be useful for anyone who want to start making a project team. Thank you, Good bye!

 
Leave a comment

Posted by on August 1, 2009 in English, Programming

 

Tags: , ,

Basic Introduction of Object Relational Mapping and HQL

Hi! At this moment, i will introduce basic understanding of ObjectRelational Mapping and Object-Oriented Based Query. Firstly i will discuss about ObjectRelational Mapping (ORM). ORM is a method that map all tables in a database into classes. So, if we have 3 tables, than we will have 3 classes. The benefits of ORM method is make your application ObjectOriented. The ORM has it’s own query. Somewhat called Objec-Oriented Based Query. Nowadays, There are 2 big main ObjectRelational Mapper Framework :

1. Hibernate Framework
2. JavaPersistence API

The Benefit of this query is , we don’t have to think native SQL that provided by the DBMS. For example, if you have a project that using MySQL and someday, your customer want to migrate it’s database to oracle, you don’t have to change ALL the query because the characteristics of this query is global. If you use native query, the changes are take so minimal. you don’t have to change the whole entire query.

Now, how does ORM works? Check this figure below :

Graphic1

Suppose we have 2 tables, employees and departments, Departments – Employees is OneToMany relationship. The ORM Framework will see these 2 tables and then convert these 2 tables then it would like something like this :

Conversion

Note that the 2 tables are converted into 2 classes. Two things you have to understand :
1. In Employee class, there is Department class. It means that Employee object HAS-A Department Object. For example, Hans Kristanto is Employee, and IT Department is Department. In old way, we will store the data in database with something like this :
-emp_id = 1
-emp_name = Hans Kristanto
-dept_id = 12 (Suppose 12 is ID of IT Department)
But with ORM way, The employee object store the whole of Department Object. So, the benefit will appear in query. We will discuss it further in HQL.

2. In Department class, there is a Collections with Generic of Employee. It means that the Department class store all Object that is related with Employee. For example, if we have 3 employees in dept-1 and 2 employees in dept-2, than the 3 employees would be stored in a collections which department name is dept-1 and same with the other one.

Note that all classes are filled with data during execution.

Hibernate Query Language

Hibernate Query Language is one of Object-Oriented Based Query. There are so many Object-Oriented Based Query such as JPQL and EJBQL. Not too different between these language.
Now, how to do a query in ORM? I will refresh it first. In the past, if we want to call all employee, we use this query :

SELECT * FROM employees

Now with HQL, we can use something like that, but more simpler and logically easier :

select e from employees e

The result will be Object of employees! You can print the name or the id or whatever by using native object oriented :

System.out.println("ID : "+e.getEmpId())
System.out.println("Name : "+e.getName())

Now the question, how to get the department name? When i use e.getDepartment(), the value printed is the HashCode object?

Don’t get panic. Since department in employee is an Object of Department class, you can call it’s name by using this :

System.out.println("Dept. Name : "+e.getDepartment().getDeptName())

Compare this way with native SQL :

SELECT e.emp_id, e.name, d.name FROM employees e, departments d WHERE e.dept_id = d.dept_id

whooo… a bit complicated… we don’t have anytime to do such a complicated things 😀


Now, further query.. How about if we want to populate all employees whose department is 31 (Suppose dept 31 is Financial Department). There are 2 ways in creating query for this situation :

select e from employees e where e.department.deptId = '31'

OR

select e from employees e join e.department d where d.deptId = '31'

What is the different between theses query? NO, no significant different. Only in the second query, we give an alias in the join, while the first query not..

Okay, that’s all for the introduction. I’m preparing the tutorial in using Hibernate with Netbeans. So, stay tune here!

 
2 Comments

Posted by on August 1, 2009 in English, Programming

 

Tags: , , ,

Security Principle dalam dunia nyata

Si ujang lagi mau login ke facebook. Dia baru ajah bikin facebook dengan tujuan mau cari cewe nih. Sengaja tuh dia pasang foto yang paling baru buat bikin cewe kelepek-kelepek. Dah gitu dia login dah ngeceng-ngeceng. Terus cape tuh mata, tidur deh dia.

Ujang the punker’zz

Udah gitu dia tidur nih. Besoknya, dia login lagi. Eh dia lupa tuh, terus dah gitu dia ga bisa login lagi deh.. yah, kasian deh lu ujang! udah muka u jelek, pikun lagi.. hahahaha


Apa yang di alami oleh ujang ini ada kaitannya dengan security principle dalam dunia IT. Sebelumnya, security principle dalam hal ini ada 3 tahapan utama yaitu

  • Identification
  • Authorization
  • Authentication

1. Identification

Merupakan Proses meng-identifikasi kan seseorang yang hendak masuk atau melakukan akses terhadap suatu sistem. Kita tahu sistem adalah benda mati (ya iyalah, masa ya iya donk 😀 ) Jadi kita perlu memberikan proses identifikasi sendiri. Layaknya kalo misalna ada orang bernama Jupri, punya temen yang namanya Japri. Si jupri ini kalo setiap kali mau maen ke rumah si japri, si japri pasti tau kalo si jupri tuh bentuknya (misal) rambut keriting, badan pendek, dll. Sedangkan sistem tidak dapat mengenali itu. Karena itu, kita perlu memberikan sebuah identitas yang menandakan bahwa kita adalah orang yang layak untuk mengakses domain itu. Contohnya adalah NIM, Nomor Pekerja, Nomor Absen, dan sebagainya.

2. Authentication

Berdasarkan namanya, authentication = proses peng-autentikan. Artinya adalah, dibutuhkan suatu proses yang real untuk membuktikan bahwa orang yang hendak mengakses suatu domain itu layak. Misalnya begini, si Japri curiga nih kalo si Jupri koq giginya ompong dua. Padahal si jupri tuh kaga ompong. Mungkin japri takut kalo ada orang yang pake topeng yang hendak mengakses kamar dia. Akhirnya, si Japri nanya, “Woi jup, hobi u apa?”. Eh, ternyata si Jupri ngejawab nya bener bahwa si jupri tuh hobinya adalah maen gitar. Nah, dalam proses peng-autentikasi, untuk kasus barusan pada saat jupri menjawab hobi nya, kata yang di keluarkan dari jupri itu menjadi data untuk mengautentikasikan bahwa orang itu adalah jupri. Dalam dunia IT, biasanya digunakan password. Ada seseorang, sebut saja namanya A dengan password 1234. apabila ada orang lain yang berhasil mencuri ID dari si A tadi, maka ia tidak dapat mengakses sistem yang hendak di akses oleh A karena si pencuri tidak tahu data apa yang harus di input agar login-nya ter-autentikasi. Untuk topik ini, ada 3 istilah yang harus di ketahui :

  • Something you know
    Merupakan cara peng-autentikasian dengan menginput sesuatu yang kita ketahui. Misalnya : PIN, Password
  • Something you have
    Merupakan cara peng-autentikasian memperlihatkan suatu benda yang anda punya yang mempunyai relasi dengan identitas anda. Misalnya : photo ID atau security Token
  • Something you are
    Merupakan cara peng-autentikasian dengan menggunakan bagian dari tubuh anda (biometric) sebagai alat untuk merekognasi identitas anda. Misalnya : retinal pattern, palm scan

3. Authorization

Dalam bagian ini, sistem akan memberikan otoritas kepada user APABILA proses identifikasi dan otentikasi telah berhasil. Otoritas akan diberikan kepada user yang layak. dalam kasus ini, user itu layak apabila dapat memberikan user id dan password. Karena itu, user sekarang dapat melakukan sesuatu dalam sistem yang sesuai dengan perannya. Misalnya cleaning service, ga mungkin ngubah2 database. Dan seterusnya?

Back to kasus si Ujang. Kenapa Ujang ga bisa login ke facebook dia? Soalnya dia lupa password dia. Sistem akan menganggap ujang sebagai Intruder, yaitu orang yang hendak mengakses suatu sistem tanpa ijin. Dalam kasus ini, identification berhasil tetapi authentication gagal. Sehingga ujang tidak bisa mengakses profile facebook na.

notes : Jagalah password atau PIN anda karena mereka sama berharganya dengan nyawa anda…. wassalam…

 
2 Comments

Posted by on April 7, 2009 in Programming

 

Open Source as a new learning media

We all have known that in the past, computer technology is dominated in one name. I will not mention the name because i’m sure all of you must know it. For many decade, the operating systems, office application, and media are built under one name. It doesn’t mean i dislike with that (currently i’m still using it’s famous OS though :D).
What i want to share here is, there’s a new media, a new place to learn about computer with cost-free. It’s called Open Source. You can learn various product of Open Source such as Java, Linux, Solaris, and so on. Now, i want to talk something about OS. Just what i have said before, for many decade, OS is dominated under one vendor. And of course, in School we’ve taught the basic of computer using it’s operating system. So, i think it’s like a pre-planted habit in our life. Habit that goes our mind to say that IF A COMPUTER, THEN WINDOWS. Not really no i think. A computer is not about a vendor. A computer is a machine. A computer is a thing to make human life more better. About the OS, it’s all about us. I think, there should be a change in thinking paradigm.
What should we do then? We can learn computer with cost-free in open source. You can use linux or solaris as new media to help your life. Actually, i’m not familiar with that 2, but i want to learn more. There’s many unique things you can explore. I’m not promoting about open source, but i want you to expand your knowledge by gaining much more in open source. So, let’s learn more about Open Source!

 
Leave a comment

Posted by on April 6, 2009 in English, Programming

 
Advertisements