30 Eylül 2008 Salı

A Nice Maven Feature In Intellij 8

There is a useful maven feature in Intellij 8. As you know, maven doesn't download the sources.jar files of the libraries into the local repository, by default. You can download the sources.jar files of the dependencies of the project by just one click of a button. First open the Maven view in Intellij. Then press the "Download artifacts" button from the toolbar:



Actually this feature also exists in Intellij IDEA v7 but I can't make it work. Probably, there is a bug. Please inform me, if there is anyone who can use the feature in version 7.

17 Ağustos 2008 Pazar

Intellij Knows Swing

As I use Intellij more and more, I get more and more suprised, more and more excited.

Yesterday, I was trying to change the cursor in a swing project, using setCursor() method. I expected Cursor.W_RESIZE_CURSOR would return a java.awt.Cursor object and coded as below. But something was wrong with my code:












...And immediately, Intellij told me what was wrong with my code:). I should have called Cursor.getPreferredCursor(). I applied Intellij's suggestion, and the error was corrected. My intelligent IDE again saved me to search for example codes on the internet:

4 Ağustos 2008 Pazartesi

How To Sort Collections Using commons-beanutils?

Hi everybody,
Following is another simple way of sorting collections using commons-beanutils package:
Assume that we have an object as below:

public class User {
private long userId;
private String userName;
private String password;
}

And we want to sort based on userName field. We can use BeanComparator class of commons-beanutils package as below to sort the list:

ArrayList list = new ArrayList();
//...
//add User object inside the list.
//...
Collections.sort(list, new BeanComparator("userName"));

Notice that, we passed the name of the field to be sorted, as the parameter, to BeanComparator class constructor. We accomplished sorting of a collection using just one line of code:).

Download commons-beanutils from http://commons.apache.org/beanutils.

28 Temmuz 2008 Pazartesi

JBoss server'a IP numarası ile erişim

Lokal makinemizde çalışan jboss'a http://localhost:8080 adresiyle erişebiliyoruz. Ama http://127.0.0.1:8080 adresiyle denediğimizde, şeklinde erişemeyiz. Bununla beraber uzaktaki bir istemci de ip numaramızı bilmesine rağmen erişim problemi yaşayacaktır. IP numarası ile erişimi aktive etmek için Jboss'u "-b" parametresiyle başlatmamız gerekmektedir. Bu durumda kullanacağımız komut aşağıdaki gibi olacaktır.

> run.bat -b 0.0.0.0

27 Temmuz 2008 Pazar

JBoss'u baska bir domain ile başlatmak

Standart Jboss kurulumu "default" adli server instance'ı başlatmaktadır. Başka bir server instance'i başlatmak için "-c" parametresini kullanmalıyız. Örneğin standart kurulumda gelen, "minimal" adli server'ı başlatmak için aşağıdaki komutu kullanmalıyız:

> run.bat -c minimal

21 Haziran 2008 Cumartesi

JSTL Reference

Following document is a good resource about JSTL for java web developers.

http://www.manning-source.com/books/bayern/bayern_apxA.pdf

This document can also be found in Shawn Bayern's book JSTL In Action.

22 Mayıs 2008 Perşembe

Javascript ile TEXTAREA'ya metin eklemek

Javascript kullanarak, bir HTML sayfasındaki TEXTAREA'da cursor'un bulunduğu yere nasıl text eklendiğini bulmak için yaklaşık 1 saat araştırdım. Basit gibi görünen bu işlemi, en sonunda, Alex King'in blogunda buldum. Yazıya, http://alexking.org/blog/2003/06/02/inserting-at-the-cursor-using-javascript adresinden inceleyebilirsiniz. İlginçtir ki, Alex King de bu fonksiyona PhpMyAdmin'de raslamış.