Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Friday, April 27, 2012

[Java] If-Then-Else Syntax

          Hello, Reader ^^! Back again with source code. This time is a basic syntax If-Then-Else in Java programming language. This source code is to show how to do If-Then-Else statement in Java language. Here's the template:


if <condition> {
       <statement if true> 
} else {
       <statement if false>
}


Okay, that's all I can say. Thank you for reading ^^!

Download/View Source Code
- Dropbox
- Dropbox (Repository)
- GitHub
- GitHub (Repository)







[Java] If-Then Syntax

          Hello, Reader ^^! Back again with source code. This time is a basic syntax If-Then in Java programming language. This source code is to show how to do If-Then statement in  Java language. Here's the template:


if <condition> {
       <statement if true> 
}


Okay, that's all I can say. Thank you for reading ^^!

Download/View Source Code
- Dropbox
- Dropbox (Repository)
- GitHub
- GitHub (Repository)







Thursday, April 26, 2012

[Java] [JSP] Login and Logout

          Hello, Reader ^^! Back again with source code. This time is Login and Logout which is written in Java programming language and JSP extension. This one demonstrates how to do login and logout. It uses session to persistent the information between pages and MySQL to get user data from database. Okay, that's all I can say. Thank you for reading ^^!




Download/View Source Code
- Dropbox
- Dropbox (Repository)
- GitHub
- GitHub (Repository) 







[Java] [JSP] Insert Data to MySQL

          Hello, Reader ^^! Back again with source code. This time is Insert Data to MySQL which is written in Java programming language and JSP extension. In this one, it shows how to insert data input from html page into mysql query. The input itself is processed in jsp page using mysql library. This example also shows error if any of the input is null value, returning to the input page. To ensure that the input is really inserted, after submitting input, it will redirect to view page showing the query in the database, if you see your input, that means the inoput is successfully inserted into MySQL database. Okay, that's all I can say. Thank you for reading ^^!






Download/View Source Code
- Dropbox
- Dropbox (Repository)
- GitHub
- GitHub (Repository) 







[Java] [JSP] Search Based Similarity (Substring)

          Hello, Reader ^^! Back again with source code. This time is Search Based Similarity (Substring) which is written in Java programming language and JSP extension. In this one, it shows how to do a search based on similarity of word using substring. In this case is title. If the title contain the substring, it will be included in query. Btw, you need MySQL library to call it before you can use it. Okay, that's all I can say. Thank you for reading ^^!




Download/View Source Code
- Dropbox
- Dropbox (Repository)
- GitHub
- GitHub (Repository) 







Tuesday, April 24, 2012

[Java] [JSP] Search Based Tag

          Hello, Reader ^^! Back again with source code. This time is Search Based Tag which is written in Java programming language and JSP extension. In this one, it shows how to do search based tag. It will return output based on whether the post has the tag which input is received from user. It also calls from mysql database so you might need a .jar before you can use the mysql in jsp. Okay, that's all I can say. Thank you for reading ^^!


(Note: the picture there is 7, but since my monitor is too big or I was too lazy to minimize it, so I crop it xD)


Download/View Source Code
- Dropbox
- Dropbox (Repository)
- GitHub
- GitHub (Repository) 







Saturday, April 14, 2012

[Java] [JSP] Reuse Existing Class in Other Jsp Page

          Hello, Reader ^^! Back again with source code. This time is Reuse Existing Class in Other Jsp Page written in Java programming language with JSP extension. This one shows how to use existing class so it can be used in other jsp pages. It will be shown in class's values that shows that the class isn't recreated when   accessing other jsp pages. Okay, that's all I can say. Thank you for reading ^^!




Download/View Source Code
- Dropbox
- Dropbox (Repository)
- GitHub
- GitHub (Repository)







[Java] [JSP] User Input: Text

          Hello, Reader ^^! Back again with source code. This time is User Input: Text written in Java programming language with JSP extension. In this one, it will how how to obtain input from jsp which then it will be passed into other JSP page as the result. It also uses Java class as mediator. Okay, that's all I can say. Thank you for reading ^^!




Download/View Source Code
- Dropbox
- Dropbox (Repository)
- GitHub
- GitHub (Repository)







[Java] [JSP] Hello World

          Hello, Reader ^^! Back again with source code. This time is Hello World which is written in Java programming language and used JSP extension. With JSP, Java code can be implemented on web pages. Now, in this one, it will show "Hello World" text. It also use JavaBeans. JavaBeans is just standard extension for JSP page. It made class reusable in jsp page. Okay, that's all I can say. Thank you for reading ^^!


Hello World


Download/View Source Code
- Dropbox
- Dropbox (Repository)
- GitHub
- GitHub (Repository)







Monday, February 6, 2012

[Java] Vigenère Cipher (ASCII)

          Hello, Reader ^^! Back again with source code ^^! This time the source code is Vigenère Cipher for ASCII. The source code written in Java, translated from C++ version. It is a bit different than the Alphabet version. This time the non-alphabet are also encrypted (for the alphabet version, non-alphabets are ignored). Okay, let me explain abit again but with ASCII version.

Just say I have plaintext "Hello World!". I want to encrypt it using key "KEY". If encrypt it using Vigenère Cipher, here will be happens:


Plaintext
H
E
L
L
O
W
O
R
L
D
!
Ciphertext
K
E
Y
K
E
Y
K
E
Y
K
E
Y


The key becomes "KEYKEYKEYKEY". Yup, it is repeated based on the length of the plaintext.


Using the Ci = (Pi + Ki ) mod 256 (C is Ciphertext, P is Plaintext, K is Key, i is Index), it will give result :
"³Êå×Ô™ÂÔë×Éš".


For the Auto-Key, it also uses ASCII range. Okay, that's all I can say. Thank you for reading ^^!







Download/View Source Code






Sunday, February 5, 2012

[Java] Vigenère Cipher (Alphabet)

          Hello, Reader ^^! Back again with source code ^^! This time the source code is Vigenère Cipher for Alphabet only. The source code written in Java. Yup, it is translated from C++ into Java ^^. With this type of encryption, the plaintext is encrypted based on key which consists of a keyword. Each letter will be ciphered differently based on the sequence of its letter on plaintext and the key. Let's take an example.

Just say I have plaintext "Hello World!". I want to encrypt it using key "KEY". If encrypt it using Vigenère Cipher, here will be happens:


Plaintext
H
E
L
L
O
W
O
R
L
D
!
Ciphertext
K
E
Y
K
E

Y
K
E
Y
K



The key becomes "KEYKE YKEYK". Yup, it is repeated based on the length of the plaintext.


Using the Ci = (Pi + Ki ) mod 26 (C is Ciphertext, P is Plaintext, K is Key, i is Index), it will give result :
"RIJVS GSPVH!"


With that type of encryption, cracking the message using frequency analysis can be prevented.


Now, I also made another variant. It is Auto-Key. Using the example above, the key will be "KEYHE LLOWO", taking some part of the plaintext as key. The result will be "AIDSS HZFHR!". Okay, that's all I can say ^^. Thank you for reading ^^!








Download/View Source Code





Friday, November 25, 2011

[Java] Draw Rhombus With Text

          Hello Reader ^^! Back again with source code ^^! This time the source code is Draw Rhombus with Text. It is written in Java language. This source code is a translation from the C language I posted before. This source code will draw a rhombus shape using a character like "1", "I", "?", """, "^", and more. The height of the rhombus depends the maximum width of the rhombus. The wider the rhombus, the taller the rhombus. Okay, that's all I can say. Thank you for reading ^^!





Extra Credit:
- Problem case inspired from my past in high school

Download/View Source Code :
- Dropbox
- Dropbox (Repository)
- GitHub