Loading... Cancel

setup maven on mac R

October 14th, 2007

indeed nothing is special, but this post is about to remind me about the steps i followed to get my mac box with maven and jdk 1.5.

my requirements -

1. maven - 2.0.7
2. jdk 1.5
3. set maven bin to PATH variable.

i had 10.4.10 osx version.

to configure jdk 1.5 (jdk 1.4 is set as default jdk):

cd /System/Library/Frameworks/JavaVM.framework/Versions
sudo rm CurrentJDK
sudo ln -s 1.5 CurrentJDK

to configure maven:

download maven binaries, copy it in your preferred location.
in my case i had it in - /Applications/java/maven-2.0.7/bin/ here.

execute following line -

vi ~/.bash_profile

change PATH with following value -

PATH=/usr/local/bin:/Applications/java/maven-2.0.7/bin/:$PATH

test your configuration -

java -version
it should say - java version “1.5.0_0x”
mvn -version
it should say - Maven version: 2.0.7

thats all will make your maven and jdk 1.5 environment up and running.

My first impression “WoW!!” R

July 16th, 2007

As you knew from my last post, you can guess where i was stucking for several days, yea, it was all about determining right jabber server. the pleasant news is i gotta out of my headache after getting in touch with openfire.

openfire is one of those rear projects which made me feel “Wow” on the first run.

as i have mentioned on my last post, i was seeking some way to intercept registration, authentication and authorization process. at least i could came up a solution.

openfire plugin architecture is very simple and much more agile. i have attached my first quick diarty java code which helped me to descide whether i should go with openfire or not.

i must congrats my honored reader and brother, mr. mozammel haque who helped me to find out this outstanding server.

my first experiment was just hooked itself with user registration event dispatcher, when someone register i get the notification and write down to a file which is hard coded to c:/out.txt

this was just 5 to 10 mins preparation to let’s dig inside the plugin architecture.

global-profile.zip

download instruction -

just download the “*.zip” file and extract to your “openfire/plugins/” directory. a new “global-profile.jar” will be created.

let’s look inside the code which made it possible to be notified during user registration process. source is bundled with in “src/” directory.
best wishes,

Struggling with open source jabber server R

July 13th, 2007

My on going project is based on jabber server. i was expecting following features from an open source jabber server implementation -

* Authentication, Authorization  and registration service must be taken from 3rd party. (here i am 3rd party)

* P2P and Group chatting

* HTTP Polling support (optionally  HTTP Binding support)

* Very scalable

* Very flexible user customization

* group messaging subscription

* group moderation role

also following features -  

* none blocking i/o

* optionally java based

* cluster support

thats all.

so after passing some hard time, i fought with “ejabberd”, the ERLang based jabber daemon. i must say this is the best open source implementation. (i didn’t test openfire).

the author really gave a lot of effort. i had a very bad time tough, i tried to invoke external authentication system. but i found php script but i couldn’t able to make it work.

anyway, still it didn’t full fill my requirement, i want to manage user A and A and Registration from my service.

secondly i gave a try Open-im, i show the source code and stuff, my first impression was very bad, i found it was stucking with an infinite loop. later traversing inside the code i found, it was because of the SSL socket initialization related code. code was seeking certificate to initiate a SSL socket. since i didn’t put any certificate it not suppose to do it.

anyway, after working with it i found, it is not complete even code were poorly written.

later i gave a try tigase, it seems very nice and very well written server. still i need my whole control over AA and Registration.

after stucking a lot, i am now cncerntrating on open-im, i am thinking to contribute on this project. first i will implement the following features -

1. move to spring framework

2. Refactor code base
2. move authentication based on JAAS

3. Support 3rd party profile service

4. Support none blocking I/O api

5. Support HTTP Pooling based on servlet container
thats all for now beside my other stuffs from my current project.

Limit of maximum iterfaces per class. R

June 1st, 2007

I was reading through java doc for Proxy class. suddenly my eyes were stucked on the following lines of code - bit interesting perhaps,

The resulting proxy class must not exceed any limits imposed on classes by the virtual machine. For example, the VM may limit the number of interfaces that a class may implement to 65535; in that case, the size of the interfaces array must not exceed 65535.

Visitor Design pattern to traverse hierarchical object structure. R

June 1st, 2007

Those who know about visitor design pattern, i am not triggering my write up for them. but those who didn’t know about this or heard but always ignored i am writing for them.

Visitor design patter is used to traverse through the object structure. it is used to separate the iterating logic from the object.

Let’s imagine, you have the following object structure :

class Tree {

private List mBranches;

public List getBranches() {

return mBranches;

}

}

how we usually iterate through this list of objects, lets think like following code -

// ….

final List branches = tree.getBranches();

for (final Branch branch : branches) {

// …

}

// …

visitor design pattern emphases API designer to hide underlying object structure and iterating logic. now let’s see how we can implement the above example using visitor design pattern:

interface Visitor {

void visit(final Branch pBranch);

}

interface Visitable {

void accept(final Visitor pVisitor);

}

class Tree implements Visitable {

// … previous code

public void visit(final Visitor pVisitor) {

for (final Branch branch : mBranches) {

pVisitor.visit(branch);

}

}

}

now my concern is to make it “n” depth. so it will become a real tree with “n” depth, where can traverse branches and leafs. who is it possible over visitor dp.

here is simple extension over visitor patter, which will enable visitor to visit “n” depth hierarchical object structure.

let’s define our interfaces:

interface Visitor {

void visit(final int pDepth, final TreeItem pItem);

}

interface Visitable {

void accept(final Visitor pVisitor);

}

our tree class:

class Tree implements Visitable {

private TreeItem mRootItem;

// … setter getter

class TreeItem {

private String name;

// .. Setter getter

private List
mTreeItems;

// .. Setter getter

}

public void accept(final Visitor pVisitor) {

visitRecursivlyTreeItem(0, pVisitor, mRootItem);

}

private visitRecursivlyTreeItem(int pLevel, final Visitor pVisitor, final TreeItem pItem) {

pVisitor.visit(pLevel, pItem);

for (final TreeItem item : pVisitor.getTreeItems()) {

visitRecursivlyTreeItem(pLevel + 1, pVisitor, pItem);

}

}

}

That’s all :)

Color Selector V-1.0 R

January 7th, 2007

Hello,

i was searching my old projects, suddenly i found one of my funniest projects. i named it “Color Selector”.

“move your mouse over anywhere and checkout the color’s hexa code. it is very helpful for web designer, who wants to pick color.”

Color Selector Screen Snap Color Selector Screen Snap 2
Color hints popup window
attached with mouse movement
System trey pop up
enable/disable icon

history:
JDK 1.5 was in beta version, one day i was checking through all stuffs. suddenly i get to know about MouseInfo class.

so i wrote the following line of code:

MouseInfo.getPointerInfo().getLocation().getLocation();

now i have prepared a standalone package for windows with installer.
hope you will enjoy..

Button

Monitoring and Managing Java SE 6 Platform Application R

December 14th, 2006

nice article on monitoring and managing java se 6 was published on java.sun.com/developer.

An application seems to run more slowly than it should or more
slowly than it did previously, or the application is unresponsive or
hangs. You may encounter these situations in production or during
development. What is at the root of these problems? Often, the causes
– such as memory leaks, deadlocks, and synchronization issues — are
difficult to diagnose. Version 6 of the Java Platform, Standard Edition (Java SE) provides you with monitoring and management capabilities out of the box to help you diagnose many common Java SE problems.

This article is a short course in monitoring and managing Java SE 6
applications. It first describes common problems and their symptoms in
a Java SE application. Second, it gives an overview of Java SE 6’s
monitoring and management capabilities. Third, it describes how to use
various Java Development Kit (JDK) tools to diagnose these problems.

Note: Any API additions or other enhancements to the Java SE platform specification are subject to review and approval by the JSR 270 Expert Group.

Monitoring and Managing Java SE 6 Platform Applications

powered by performancing firefox

Posted in Java, Java SE

LightObjectBOX IoC container — example R

October 29th, 2006

I usually like less xml configuration, i have a tiny project… IDEAStickyPlugin which is running as IntelliJ IDEA Plugin.

recently i got interest to support IDEASticky as a desktop standalone application, at least for my Ubuntu based pc, (i am not satisfy with Sticky notes and Tomboy).
these days i am working on this stuff. so i felt a tiny light weight IoC container,(though PicoContainer is better) no XML level configuration will be a good addition…

so yesterday evening i made the first test case and implemented the tiny container, here is few example code snaps:

@LightObjectName( name = “a” )
public class A {
……
@LightObjectKey( key = “b” )
public void setB(B b) {
this.b = b;
}
……
}

@LightObjectName( name = “b” )
public class B {
…..
@LightObjectKey( key = “a” )
public void setA(A a) {
this.a = a;
}
…..
}

here @LightObjectName annotation is used to define an object name, this name will be used to store in container.
@LightObjectKey annotation is used to define dependent object. it will be set through the setter on container initialization time.
also cyclic dependency has no problem.

sample usages:

mContainer = LightObjectBox.createBox();
mContainer.add( A.class );
mContainer.add( B.class );
mContainer.init();

here i have created an instance of LightObjectBox though createBox() and ..
add(
Class ) is used to register a component into container scope. later init(); invocation initialize all classes + dependencies …

so i can recall my object instance by “A a = mContainer.getObject( “a” );”
i will publish whole source code after completing my IDEASticky Standalone :) keep reading my blog :)

Posted in Java, Java SE

WoW!!, IDEASticky-1.0-2 out R

October 3rd, 2006

just released IDEASticky (IntelliJ IDEA plugin) 1.0-2

Tried to implement all of your recommanded features from http://www.intellij.net/forums/thread.jspa?messageID=5166955�

please have a look on the features section
http://www.jetbrains.net/confluence/display/CONTEST/IDEA+Sticky+paper+plugin

for your information:
1. project specific sticky
2. global sticky
3. file linked sticky
4. sticky retransmit to the sender using Ctrl+R
more…
you can download it through IntelliJ Standard plugin downloader (File > Settings > Plugin)
also from following URL:
http://plugins.intellij.net/plugin/?id=1064

hope you will enjoy….

Java Swing: resize Undecorated window R

September 17th, 2006

Hi, here is code snap to make resizable your undecorated window

private void _setUpWindowResizeEvent() {
this.addMouseMotionListener(
new MouseMotionListener() {

public void mouseDragged(MouseEvent mouseEvent) {
if( mHozResizeEnabled || mVerResizeEnabled ) {
int x = mouseEvent.getX();
int y = mouseEvent.getY();
_resizeWindow( MouseInfo.getPointerInfo().getLocation() );
}
}

public void mouseMoved(MouseEvent mouseEvent) {
boolean horizontalResize = mouseEvent.getX() < = getWidth() && mouseEvent.getX() >= getWidth()-5;
boolean verticalResize = mouseEvent.getY() < = getHeight() && mouseEvent.getY() >= getHeight()-5;

if( horizontalResize ) {
setCursor( new Cursor( Cursor.W_RESIZE_CURSOR ) );
mHozResizeEnabled = true;
mWindowMouseClickPoint = mouseEvent.getPoint();
}
else if( verticalResize ) {
setCursor( new Cursor( Cursor.S_RESIZE_CURSOR ) );
mVerResizeEnabled = true;
mWindowMouseClickPoint = mouseEvent.getPoint();
}
else {
setCursor( new Cursor( Cursor.DEFAULT_CURSOR ) );
mHozResizeEnabled = false;
mVerResizeEnabled = false;
}

}
}
);
}