Pages

Subscribe:

Ads 468x60px

10/24/11

My First Android App dedicated to ME!!!

This is my video demo from my application, but it haven't done 100%. :( still need a touch up... :D
But, please enjoy it!!(^_^)/

10/16/11

Hello NEW Android! How to make simple Android App with Eclipse

Show Text, "Hello Android!!"

This is new easy app for a beginner (ME!^^a), let's start!!
 1.First is make a new project in Eclipse, File > New > Other > Android Project and should be like this :

10/15/11

Android Instalation

Preparing the software :
  1. JDK 6 (Java Development Kit) for environment variable.
  2. Eclipse Galileo as text editor, download it in  http://www.eclipse.org/downloads/packages/release/galileo/sr2
  3. Android Development Tools (ADT),is a plugin for the Eclipse IDE that is designed to give you a powerful, integrated environment in which to build Android applications. Version I used : ADT-0.9.9 from http://developer.android.com/sdk/eclipse-adt.html
  4. SdkAndroid (android-sdk-windows), download it from http://developer.android.com/sdk/adding-components.html
The first is intalling JDK 6

6/8/11

Analogy of Java - JDBC - MySQL

Dunno why, but it's kind of difficult for me to understand the relationship between Java - JDBC - MySQL and GUI programing. Even I' had studied about it before (in my second semester) but when i review it now-it's still need more time to understand it again. So, I write down here my opinion and my understanding about it wishing that it'll help me a lot when I review it someday.
Let's imagine that java is a man who wants to rent a cupboard on a warehouse and JDBC is a name card of the warehouse's owner, and the warehouse owner itself is MySQL.
  1. First of all, the man should make an connection to warehouse's owner with help from the card name. That's read the information in the name card and try to contact the owner. Same like Java, Java must include the JDBC driver coz Java must know the information about MySQL from JDBC - it like when the man read the information in name card ( Java read the information from JDBC). It's explained in my previous tutorial Connect Java and Database (2) Create Database (part : include the driver for java and mysql in Libraries ).
  2. After read the information from JDBC, Java can contact MySQL use class Connection . Like when the man contact the owner via telephone or internet. Class Connection is provided by Java to make a connection between Java and MySQL, that's why we just need to make an object from that class for it. Connection con = DriverManager.getConnection( url_of_database, mySQL_ussername, mySQL_pass);
  3. After contacting MySQL, java should make a tabel that store data in MySQL. A man who rent a cupboard on wirehouse should arrange his racks on his cupboard that could keep his stuff safely and tidy. Imagine that cupboard is table on MySQL, racks is the coloum and bar and the man's stuff is data from Java. But in my previous tutorial, I made the tabel from phpMyAdmin not from NetBean.
  4. Imagine that the man and the owner are a professional, they would make a formal agreement about what is forbidden and the facility for the man. Java also use an agreement, called JDBC Statement. This statement make java could store or update data to MySQL.Statement stated = con.createStatement();
  5. Then, when the man wants to take his stuff he should know where's the rack that store his stuff. Imagine that his stuff is so many till he made a note where's he store his stuff in the rack and stick it to the racks key. Java also have a class that contains values when we operate MySQL, called ResultSet. But I imagine ResultSet as a key that open the racks which is store the data. Actually we could use it without make an object from ResulSet clas. But it easy to type when it have a simple name variable. ResultSet rs = stated.executeQuery("SELECT table_name" WHERE column_name LIKE '0'"); means that variabel rs would akses values from table named table_name with column called column_name when the key is 0 or line number 0. So when we take values from column line 0, we could type rs.getInt("column_name");.

5/25/11

Connect Java and Database (2) Create Database

After XAMPP running, then make a new database using phpmyadmin. You may open your browser and click this URL : http://localhost/phpmyadmin/ there'll be a view like this and you may create a database name "databasename" like I do.
 Then it would be:

Then make a new java project in NetBean, which filled with syntax that could edit the database's proses such as update, delete, insert, etc.
 Then include the driver for java and mysql in Libraries :
then choose MySQL JDBC Driver, but before that you must download it in http://dev.mysql.com/downloads/connector/j/. And you must copy mysql-connector-java-5.1.12-bin.jar to c:/programfile/java/jdk/jre/lib/ext if you are use a windows OS, so do with directories org and com to src folders of your NetBean projects example : D:\NetBeansProjects\javamysql\src.

Next is make a new .java files for connecting the database with java and the main program for execute it. First make a java file named Connecting that have a syntax like this :
And make a main.java for syntax like this :
Then when you execute Main.java, it must be like this :
 Next we'll make a program for database operation..^_^

5/15/11

Connect Java and Database (1) Install XAMPP

Today i'll make an connection between java and database, for the database itself, i'll use XAMPP that can be downloaded in http://www.apachefriends.org/en/xampp-windows.html. And for java and databse connector, i'll use http://dev.mysql.com/downloads/connector/j/.
First of all, install XAMPP on your computer, like this and make an table of database.
 When it's done, double klik XAMPP Control Panel on your dekstop shortcut or from START >> All Program >> Xampp for Windows >> XAMPP Control Panel.
And make sure that the Apache, and MySql is running.
Then let's make a database with MySql, firstly you may access localhost on your webrowser and choose phpmyadmin or http://localhost/phpmyadmin/.




It would shown like this :
There's a warning there that shown there are error in MySQL privileged account. To repair it, click on the “Privilaeges” bar on the top then in “User : root, Host : localhost” choose “edit Privileges” then type your new password on Change Password.
 if there's an error then :
a. Open directory when you install it (C:/Program Files/XAMPP) choose folder : phpMyAdmin then choose config.inc.php (open with notepad).
b. Find line : $cfg['Servers'][$i]['password'] = ' '; type your password then it would be $cfg['Servers'][$i]['password'] = 'your_password';
c. Save your editing
d. Restart your XAMPP (stop then start again..)
e. The error has been fixed

Reference :
http://ayoespot.blogspot.com/2010/01/cara-memberi-password-pada-xampp-for.html

5/5/11

How to make a visualisation of caverage

In my project, i have create a limitation such as :
1. Size of coverage area is 100 x 100 m
2. Total of sensor that used is 4 sensors
3. Every sensor's radius are randomly pick base on the table bellow :
The table itself is taken from Sami J. Habib's paper Modeling and simulating coverage in sensor networks. For visualize the area in Java, firstly we create a new class in NetBean like this :
*Because i have create firstmutation.java for this project.
a new class is created and import these for create a GUI :
import java.awt.*;
And because we make a class that have a characteristic of class Frame, since we need to make a frame for GUI. So, it should be like this :
i set class secondmutation extends Frame as a main class, that's why on class main, i make an object from secondmutation extends Frame class. Which lead the running program to method secondmutation, where's the CanvasKu is called. In method secondmutation, we set the size of frame with this syntax:
setSize(160,160);
Then, make an object of class CanvasKu, and we add that object on the frame. The object will call the progress from class Canvasku where's i put the program of inisialitation and coverage's calculation there. Since CanvasKu is a class that create a canvas on top of frame, so it should have characteristic like Canvas class. That's why the program is should be like this :
And the output of this program would be like this :
because it's random so the second run and another would be different, such as:









4/17/11

Distance Calculation for Coverage

In simulation of WSN coverage, parameters i used are service area, sensors radius, coverage, coordinate position of x and y of sensors and cost. service area is a area for placement the sensors, coverage is the area that covered by sensors. Every sensor has it's radius and it's radius determine how far the coverage of the sensor which means that it's influence the cost of WSN. Where's radius and position of sensors is generate randomly. Example, there are 6 sensors with difference radius like this :




because it generate randomly, so it's position and radius is could be same or difference. And to calculate the sensor's coverage wide, i used this formula :
where's :
 is sensor's y coordinate value
is sensor's x coordinate value

 is service area's x coordinate value
  is service area's y coordinate value
  is sensor's x radius


Here's the example of type A sensor's coverage calculation :
Type A sensor's position is on {xA, yA} and it has radius as A m. So, with the formula i used, it could be determine which is covered by sensor or not. If  it coverage by sensors, it must be painted red as picture above.
on java programing, it'll be like this :


note : this program is continued from the last post, so that may consist a part or variable from previous post.
and the output is like this :
Since i print "1" for sensor's coverage n "0" for service area that wasn't covered so the output becomes like above. That's why i put it on word n analyze it :
  Where's x is count from up to down and y count from left to right, picture above shows 4 type of sensors from Individu 1. We could calculate coverage total use this program :
Then the result is :
for sensor composition like this :

4/15/11

Make a random value in Java

SO SAD!!! i have write my post for this title but suddenly my PC restarting itself and i must to write again... ugh,, so frustrating!!
But, fortunately i still save some data... Praise my Lord...
So, here is my program for generate a random value in java programing. i'll use an printscreen of my program and it's output.



and it's outputs for every running program is always difference because it's randoms behavior. like this :
second running

third running
so, if you want to generate a random value on java programing :
  • import java.util.*;
  • make an object from class Random :
 Random random = new Random() ;
  • and the syntax is :
individu[i][0][index]=random.nextInt(100);
means that generate an integer random value between 0 and 100.

4/14/11

My Final Project Topics

I think I should post this a few month ago, but still i have enough time to do that till now... so sad, but it's fine! coz i finaly can upload it!! hahahhaha...
Well, actually i got my Final Project's theme from my Lecture. Back then I still a novice, don't know what to do even though i love programming better than make a robots.. hohohohoho...

What i do in my final project is about WSN that make a simulation about coverage of wireless sensors in a square flat field, and change the sensor's radius and position randomly. And the purpose of  this projects is to find the perfect combination of the position and the radius of the sensors. And because the radius sensors determine the cost of the sensors, so every combination of sensor's radius and position have it's cost and coverage. to choose the perfect combination, used a MOO algorithm that's sum of weighted cost function. And to determine the position and the radius of the sensors, use a genetic algorithm. I use java programing to simulate this program and i use NetBeanIDE6.8 as my workplace. this is my proposal i used for my Final Project's Title Assembly, PROPOSAL TPPA  and this project base on this paper : Coverage Modeling and simulating coverage in sensor networks.


Finaly!! My Blog execlusively for my FINAL PROJECT!!!^0^)/

I have ever made a blog before, but it just an ordinary blog that time... So, that's why i made this to save my Final Project and modules that i have learned from  my beloved campus

i have doing my final project since July 2010, but so many things happened till i can save my file on this blog now. Since i'm in my last semester, i realize (actually my lecturer did it) that so many things that i have learn a few years ago becomes fading.
That's why i also wants to make this blog as my dictionary, wishing it will help me to remind what i have learn. i don't want graduate with forget anythings..hahahha...

Fighting!!! Do 100% for my beloved Lord!!!