hasan's blog (বল্গ)

work for fun!!!

Archive for September 2006

PHP Fragment cache solution

with 5 comments

PHP Fragment cache solution Sometimes we want to cache a part php script rather caching the whole page.

dyanmic_updated_part.gif

For example above right side list is updating after 1 hour, so why not cache it for 1 hour rather shooting database for each request.

My illustration will cache a time stamp (so when can verify when it was updated lastly):

Read the rest of this entry »

Written by nhm tanveer hossain khan

September 26, 2006 at 5:25 am

Posted in PHP, tutorial

www.IDG.no up NOW!!!

without comments

www.IDG.noAfter a long journey now www.IDG.no is up and running from production server.
we all are very happy and excited for new challenge on phase two.

another news escenic CEO and CTO are coming …
we had a lot of andersen’s icecream today and also filled our stomach with Chicken King friend chicken… and coke…
after a long road trip we could reach at home…

another information today is first Holly Ramadan night… :D

Written by nhm tanveer hossain khan

September 25, 2006 at 6:52 pm

Posted in News

Java Swing: resize Undecorated window

with 2 comments

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()-5;
boolean verticalResize = 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;
}

}
}
);
}

Written by nhm tanveer hossain khan

September 17, 2006 at 8:44 pm

Posted in Java, Java SE, java swing

Great Song from “Yatri” “Akta gopon kota….”

without comments

I am not much music fan… few days back I stacked with a music of “Yatri” “Akta gopon kota ….” Bangladeshi musician…. I really wondered How great a music could be….

I continued this music for more than 40 times still repeating…. Great one….


Thanks Omi Azad whom I called and heard such great music…. And also thanks Yatri….


Album: shopnochura

Written by nhm tanveer hossain khan

September 17, 2006 at 7:01 pm

Posted in life

Résumé in Web 2.0 way ….

with 2 comments

I have made a presentation to demonstrate, how people can use web 2.0 concepts on  a silly stuff like personal Résumé….

Download “Résumé in web 2.0 way” Presentation…

I will be pleased if people get it interesting… best wishes…

Written by nhm tanveer hossain khan

September 17, 2006 at 6:29 pm

Posted in Ideas

drag java undecorated window

without comments

Just for reminder,

“How to drag undecorated window”
place a JLabel or what ever component which does support mouse mototion and mouse event listener.

undecorated window: when window is head less. no caption bar no resizable border. is enabled by  setUndecorated( true );

private boolean mMoveStart = false;
private Point mMouseClickPoint = null;
private void _setUpMoveEvent() {
mWindowTitleLabel.addMouseMotionListener(
new MouseMotionListener() {
public void mouseDragged(MouseEvent mouseEvent) {
if (mMoveStart)
_moveWindowTo(mouseEvent.getPoint());
}

public void mouseMoved(MouseEvent mouseEvent) {

}

}
);
mWindowTitleLabel.addMouseListener(
new MouseAdapter() {
public void mousePressed(MouseEvent mouseEvent) {
mMouseClickPoint = mouseEvent.getPoint();
mMoveStart = true;
}

public void mouseReleased(MouseEvent mouseEvent) {
mMoveStart = false;
_fireStickyUpdated();
}
}
);
}

private void _moveWindowTo(Point point) {
int musDiffX = point.x - mMouseClickPoint.x;
int musDiffY = point.y - mMouseClickPoint.y;

setLocation( getLocation().x + musDiffX, getLocation().y + musDiffY );
sticky.setLocation( getLocation() );
}

here, mWindowTitleLable is JLable component

:D

Written by nhm tanveer hossain khan

September 17, 2006 at 5:00 pm

Posted in Java, Java SE, java swing

For old Fan!!!

without comments

hi, i am getting some request for my previous “ajax-new-color” theme.

i have changed my file system thats why previous files are lost.

please find out this attachment…. ajax-new-color
thank u :D

Written by nhm tanveer hossain khan

September 17, 2006 at 4:48 pm

Posted in PHP

Java Limited list

with one comment

sometimes, you may need a list objects which is limited by its’ fixed length.
let’s think: you need a maximum 10 items list.
if more value is added it will remove the last one and append on top of the list.

this code snap could be used for such purpose:

public class LimitedListCacheObject {

    private int listSize = 20;
    private LinkedList list = new LinkedList();

    public LimitedListCacheObject() { }

    public int getListSize() { return listSize; }

    public void setListSize(int listSize) { this.listSize = listSize; }

    public LinkedList getList() { return list; }

    public synchronized void addItem( Object o ) {
        _clearListLastItem();
        getList().addFirst( o );
    }

    private void _clearListLastItem() {
        if( getList().size() == listSize )
            // remove last item from the list
            getList().removeLast();
    }

}

Written by nhm tanveer hossain khan

September 12, 2006 at 6:26 pm

Posted in Java

IntelliJ IDEA Plugin contest – Plug in and win $5000

with 2 comments

very interesting…

Plugins created by our community members and others have made IntelliJ IDEA even more intelligent and smart over the years. In appreciation, we’d now like to give a little something back – like about $25,000! Enter your new or modified plugin in our 2006 Plugin Contest and you could take home the grand prize of $5,000, or one of the other super cash and software prizes from JetBrains and other contest sponsors totalling over $25 K.

Someone is going to win all these very nice prizes – why not you? Use the links above to get all the details, and then blow us away with your best stuff – we just can’t wait to see what you’re going to come up with!

http://plugins.intellij.net/ 

Written by nhm tanveer hossain khan

September 2, 2006 at 12:36 am

Posted in Java, News

New resume, with new idea.. Skill cloud, Interest Cloud etc..

with 4 comments

My new resume uploaded, few ideas are added, How does it look like to other peple? :D , Thanks to emran bhai (for editing my english construction)
Download Hasan’s Resume

Skill Cloud:

skill_cloud1.gif

Interest cloud:

interest_cloud1.gif

Written by nhm tanveer hossain khan

September 1, 2006 at 12:04 pm

Posted in Ideas, News