hasan's blog (বল্গ)

work for fun!!!

Archive for June 2005

JsHashMap

with one comment

I have tried to implement one JavaScript based Collection object with iterator……
Here is my code snaps….

JsHashMap.js


/////////////////////////////////////////////
///// Js Object //////
///////////////////////////////////////////
// Author: NHM TAnveer Hossain Khan (Hasan)
// http://hasan.we4tech.com
// mail:admin@we4tech.com

// hashmap internal data object
JsObject=function(key, value) {
this._key=key;
this._value=value;
}

// set some methods for JsObject
JsObject.prototype.getKey=function() {
return this._key;
}

// get value
JsObject.prototype.getValue=function() {
return this._value;
}

/////////////////////////////////////////////
//// Iterator ///////
///////////////////////////////////////////
JsIterator=function(array) {
// set internal array
this._array=array;

// create inernal index counter
this._counter=0;

// set _hasNext value
if(array.length>0)
this._hasNext=true;
else
this._hasNext=false;
}

// return boolean value
JsIterator.prototype.hasNext=function() {
return this._hasNext;
}

// return object in next method
JsIterator.prototype.next=function() {
if(this._array.length>this._counter) {
// get object
var rtnObj=this._array[this._counter];
// increment counter value;
this._counter++;
// check is has next true of flase
if(this._array.length>this._counter)
this._hasNext=true;
else
this._hasNext=false;

// return data
return rtnObj;
}
else {
this._hasNext=false;
}
}
// remove object
JsIterator.prototype.remove=function() {
this._array.splice(this._counter,1);
if(this._array.length > this._counter)
this._hasNext=false;

}

/////////////////////////////////////////////
//// HashMap Object ///////
///////////////////////////////////////////

// create JsHashMap class object
JsHashMap=function() {

// init. internal array
this._array=new Array();
// set internal counter value as 0
// this counter will keep track the current index
// of array
this._counter=0;
}

// create add method
// put key and value
JsHashMap.prototype.put=function(key, value) {
// add new value
var newJsObj=new JsObject(key, value);
// add in internal array
this._array[this._counter]=newJsObj;
// increment the internal index counter
this._counter++;
}

// retrive data based on iterator
JsHashMap.prototype.iterator=function() {
// create iterator
var it=new JsIterator(this._array);
// return iterator
return it;
}

// retrive data based on keyword
JsHashMap.prototype.get=function(key) {
// create iterator object
var it=this.iterator();

// iterate untile get success
while(it.hasNext()) {
// fetch object
var getObj=it.next();

// check is found or not
if(getObj.getKey()==key)
return getObj.getValue();
}
}

// remove key and object
JsHashMap.prototype.remove=function(key) {

}

Example

//———————————-
// Usages
//———————————-
var hash=new JsHashMap();
hash.put(“key1″,”my_value1″);
hash.put(“key2″,”my_value2″);
hash.put(“key3″,”my_value3″);
hash.put(“key4″,”my_value4″);

// retrive iterator
var it=hash.iterator();

alert(“FIRST”);
/// check iterator
while(it.hasNext()) {
var getObj=it.next();
alert(getObj.getKey()+”:”+getObj.getValue());
}
alert(“SECOND”);
/// check iterator
while(it.hasNext()) {
it.remove();
}
alert(“THIRD”);
/// check iterator
while(it.hasNext()) {
var getObj=it.next();
alert(getObj.getKey()+”:”+getObj.getValue());
}
// get single object
alert(“KEY2: “+hash.get(“key2″));
alert(“KEY3: “+hash.get(“key3″));

Thank you……

Written by nhm tanveer hossain khan

June 29, 2005 at 10:43 pm

Posted in Other

At last feature completed…..

with one comment

At last feature completed…..

After writing many lines of code including (java and php) I could develop one RC version (Feature completed). Now waiting for final release….

Everyday near many people (Though it’s not officially open) are using SMS based yahoo and MSN messenger….

For this project I have developed some tools to monitor and debug my software properly.

I am using Remote Admin.. tools (like VNC) for windows to connect my deployed server and to check logs and sending request and also uploading downloading files.

My developed tools for this project:

1. Telnet Server (Java+GCJ)

I developed one Telnet server and complied my java application (Telnet Server) using GCJ.

2. Debug Server (Ruby)

I also wrote one debug server to work with my project it helps to checkout current activities and interaction of my controller and software….

3. YahooAppender (Java)

If you people familiar with apache logging api you must know about “Appender”. But for newbie here is little definition. Appender is one log4xx class which main function is to write logging information in any output able area. For example “ConsoleAppender” append the logging information in STDOUT.

My YahooAppender can send my software logging information through yahoo messenger.

What’s the benefit?
- You can now promptly get your software exceptions.

Current features

1. Userid and password registration system (to generate small id against messenger id and password)
2. Remove any registered account.
3. Login (using user id and password / using account id)
4. Logout
5. Online contact list
6. Contact list to get short code (3 digit)
7. Contact list searching option
8. Sending buzz
9. Sending normal chatting message
10. MSN and Yahoo messenger supported.

Upcoming feature

I will soon start Struts + Hibernate+ Velocity based Administration panel for this application.

Features:

1. Session monitoring
2. Evil user detection
3. Killing sessions
4. Checking spamming
5. Online registration
6. etc…

Written by nhm tanveer hossain khan

June 26, 2005 at 9:58 pm

Posted in Java

Now member of SomeWhereIn….

with 2 comments

…. Now i am also one of the members of SomewhereIn……

Written by nhm tanveer hossain khan

June 26, 2005 at 4:39 pm

Posted in Introduction

Develop ecosystem to get your success…..

leave a comment »

Develop ecosystem to get your success…..

The current tends in ICT world is to develop own ecosystem for there own solution.
Let’s see How ecosystem make one company more stable and minimize risk.
You PHP developer you are using PHP for more than 1-2 years.
If any own tell you “What’s your preferred development platform?” You will of course give PHP your first preference.

That’s mean you depending on PHP and you also defender of PHPl, and you now member of PHP ecosystem.

Somehow if PHP got some problem, you will face a big problem for your career. That’s mean you will never want that PHP stop forever but instead of that you will want PHP should stay forever. Zend is now core PHP Company they are promoting PHP to keep up-to-date with programmer and business needs. You will get around you there will a lot of PHP based development firm. Now think how strong, stable and secure company has Zend designed. Its not only fact for Zend, it also fact for Adobe, Microsoft, Sun, etc…

This is strategy of ICT business. To develop own ecosystem for make one secure and stable company base.

How to get success in you ICT business is depend on your ecosystem’s strength. How strong ecosystem you could build. And how many people depends on your company’s survival.

SOA based platform is another technique to make your ecosystem more spreads.

Let’s see Google, Yahoo, Ebay, PayPal etc… they provide some API for other developer or vendors and so forth… So that they could develop one big wing. So they are able to walk towards success.

— Hasan

(Above materials are my own views, not enforcing you to agree with me)

Written by nhm tanveer hossain khan

June 20, 2005 at 6:45 pm

Posted in Introduction

AJAX( ASync. JavaScript And XML)

with 4 comments

Why do you need AJAX instead of your traditional Web designing/Developing method??
———————————————————————————————
How easy to surf one 100% data driven web site? I think its not so easy because it take too time to load every module when I press each link. That’s the great problem. You need only details information or one article but your web browser is loading every modules as well as graphics. How funny things. You want to know one’s name but he will give you all of his history as well as his Grand grand father information @-)

I think some people have some know how about game programming or animation programming etc… or concept..

Think you are designing one game or something animation related program. But when your end user run this game every time (for refreshing each motion) it loads every module to represent changes. Can you imagine how disgusting program that will??..

That’s the same thing happing for web technologies. You are developing one 100% data driven web site but how its possible without refreshing web pages to load dynamic content??

Of course its one great question.
To resolve this problem you should use the concept of AJAX.

Read the rest of this entry »

Written by nhm tanveer hossain khan

June 18, 2005 at 2:02 pm

Posted in Introduction, PHP

PHPXperts Get-Together…..

with 2 comments

PHPXperts Get-Together…..

Wow!!. Alhamdullila… At last we could complete our PHPXperts Get-Together without facing any problem… This event was our second PHPXperts Event.. After completing one successfully event we are really impressed and got more energy to organize our upcoming PHPXperts seminar..

Summary:
Total participated members: 35
Talked regarding :

Open source projects,
Addressed with all members..
SomeWhereIn presents some Mag for all PHPXperts moderators.
And collected suggestions…
Also talked about our upcoming seminar topic…
And many more….

 Loading...
Picture: Here Rafiq bro, Hasin bro, Anam bro, Me and Sunny bro (left to right)

Loading...
Picture: Here Anam bro and Hasin bro in Action

Loading...
Picture: Here we are with PHPXperts Banner

Loading...
Picture: Having some foods :-P

Loading...
Picture: After having foods ppl are talking about our next event ;-)

Loading...
Picture: Taking good bye snaps(1)..

Loading...
Picture: Taking good bye snaps(2)..

Good Luck PHPXperts…… Spread your Hood…..

Written by nhm tanveer hossain khan

June 18, 2005 at 2:41 am

Posted in News, PHP

Again !!!!!

with one comment

Checkout this picture… U will be surprised….. :)
Unplugged Network works some times...

Written by nhm tanveer hossain khan

June 14, 2005 at 4:46 pm

Posted in Introduction

Opera!!!

with one comment

Once i did not use any browser except Opera (for my daily life)… Since FireFox 1.0 beat or something i was using FireFox… Some comments regarding FireFox::

1. FireFox is a nice Browser..
2. But its resource hungry (due to its mass functions)
3. Book mark manager is nice.
4. Download manager is not good.
5. Skining effects after restarting Browser
6. Supports all standard formatting (MSIE =~ FireFox)

….

But my PC has only 256 RAM so i am forced to give up FIreFox and now using Opera 8.0

About Opera:

1. Opera is less RH than FF
2. Reliable
3. Fastest
4. Proven
5. Mature
6. 100% tab browsing
7. Nice Skining
8. not well HTML CSS formatting supported.
9. Supports Build in POP3 and IMAP mail client
10. RSS ATOM reader is addon

…. :D

Written by nhm tanveer hossain khan

June 14, 2005 at 1:06 am

Posted in Introduction

Congrats Hasin bro….

with one comment

Today got one new news… Hasin bro is now WebDev Forum’s moderator…..

Hasin bro started PHPExperts yahoo group and within a few days we got lot of response.. Hasin bro ofcourse frank and talent people i ever seen…

But one thing disappointed me today thats is he did not tell me about his succssful history…… :(

Written by nhm tanveer hossain khan

June 14, 2005 at 12:23 am

Posted in News

Strange !!!!!!

with one comment

Today morning when i logged in my computer i got one strange things….
Check this image:
Unplugged Network is working....

Check this system tray….

My Network is unplugged.. But yahoo messenger logged its Yahoo server without any problem…. @-)

Written by nhm tanveer hossain khan

June 8, 2005 at 1:13 pm

Posted in Introduction