hasan's blog (বল্গ)

work for fun!!!

Archive for May 2007

CSS Hack only for IE 6

with one comment

these days we got many browsers, sometime i feel if i were a king of the world i would love to eliminate all extra browsers. anyway, our designer bro (_ryan) and me were struggling to figure out some IE 6 specific hack. which won’t affect IE 7.x or other browsers.

we tried applying “@” prefix hack, for example: @width, but it worked on IE 6 and 7. so later we tried the old style “/* \*/” comment hack, exactly the same problem.

so suddenly our designer bhai (ryan), got a nice hack, it was “_”. for example: “_width: 22px”.

surprisingly it worked Wow on IE 6 without affecting IE 7 or other browsers. thanks allah, at least we found something that is working.

this blog is for those who are stucking with such problem.

best wishes,

Written by nhm tanveer hossain khan

May 31, 2007 at 2:51 pm

Posted in CSS, Introduction

Open Search Servlet – build open search configuration on the fly

leave a comment »

Here is open search specification – http://www.opensearch.org/Specifications/OpenSearch/1.1

Let’s enable your browser to detect your search engine automatically; using open search servlet you can generate open search configuration file on the fly.

Download information is here –

Binary library

Source maven project

Binary war file (includes example usages)

Usages:

  1. Copy “open-search-x.jar” file on your WEB-INF/lib/ directory
  2. Edit web.xml file.
  3. add these entries -
< servlet >
    < servlet-name >openSearch< /servlet-name >
    < servlet-class >com.we4tech.openSearch.servlet.OpenSearchServlet< /servlet-class >
    < !-- URL matching pattern -- >
    < init-param >
      < param-name >url-match< /param-name >
      < param-value >.*/(.+).osd< /param-value >
      < !--< param-value >.*/search/(.+)< /param-value >-- >
    < /init-param >
    < !-- map open search configuration with url -- >
    < init-param >
      < param-name >open-search< /param-name >
      < param-value >open-search.properties< /param-value >
    < /init-param >
    < init-param >
      < param-name >somewherein-blog< /param-name >
      < param-value >somewherein-blog.properties< /param-value >
    < /init-param >
  < /servlet >

  < servlet-mapping >
    < servlet-name >openSearch< /servlet-name >
    < !--< url-pattern >/search/*< /url-pattern >-- >
    < url-pattern >*.osd< /url-pattern >
  < /servlet-mapping >
  1. Now place configuration properties file with in your WEB-INF/classes/
  2. for example: “open-search.properties”
# Default open-search. properties
shortName=colorful moment.
description=somewhere in blog
contact=hasan@somewherein.net

url.1=text/html,get,http://www.somewherein.net/blog/index.php?s={searchTerms}&submit=
image.1=16,16,image/x-icon,http://www.searchmash.com/favicon.ico
  1. Congratulations you have completed all steps ;)

Sample usages on your web site can be found here –

http://www.opensearch.org/Specifications/OpenSearch/1.1#Autodiscovery_in_HTML.2FXHTML

Best wishes,

Written by nhm tanveer hossain khan

May 20, 2007 at 5:58 am

Posted in Java, api, java ee

JavaFX: Parse HTML content with DOMParser

with one comment

I have started an interesting project. I will illustrate a crawler based on JavaFX scripting. Though there is no specific reason beyond using JavaFX except to enhance my knowledge on JavaFX scripting.

Here is some preliminary code that I have already written:

Import statement and package declaration –

———————————————————

package com.we4tech.linkcrawler.fx.script;

import java.lang.*;

import java.io.*;

import java.net.*;

import java.util.*;

import org.xml.sax.SAXException;

import org.w3c.dom.Document;

import org.w3c.dom.NodeList;

import org.w3c.dom.Node;

import org.w3c.dom.NamedNodeMap;

import com.sun.org.apache.xerces.internal.parsers.DOMParser;

Read the rest of this entry »

Written by nhm tanveer hossain khan

May 18, 2007 at 3:43 am

Posted in Java, JavaFX

Remind me: servlet, Jsp performance tuning note

with one comment

hi,
here is a great collection on servlet jsp performance related stuffs.
http://www.javaperformancetuning.com/tips/j2ee_srvlt.shtml

best wishes,

Written by nhm tanveer hossain khan

May 14, 2007 at 12:02 am

Posted in Java, java ee, remind me

JavaFX: How to run your HelloWorld

with 5 comments

Today i have started learning JavaFX. so you will get my new learning over my blog site.

Problem how to run your first hello world FX:

there are 3 alternatives as far i know -
1. using NetBeans.
2. using Eclipse JavaFX plugin.
3. using manual execution

1. using net beans – you will find enough information from the starter example over here

https://openjfx.dev.java.net/Getting_Started_With_JavaFX.html

2. using eclipse plugin – install plugin from this url :
http://download.java.net/general/openjfx/plugins/eclipse/site.xml

3. using manual execution:
include 4 directory/jar over your classpath
i. javafxrt.jar
ii. swing-layout.jar
iii. Filters.jar
iv. your src directory (where you will store your *.fx) files

Main-class: net.java.javafx.FXShellyourPackage.ScriptFileName

best wishes,

Written by nhm tanveer hossain khan

May 12, 2007 at 11:22 am

Posted in Introduction, Java, JavaFX

ApacheDS – Directory Service

leave a comment »

I knew about this project since it has started, but never felt interest to give it a try. so today at morning i just had it with my breakfast yammy yammy. it taste like sweat meat though bit fatty. it was really a great breakfast.

ApacheDS is using Spring IoC container. it seems more promising, i wrote the following configuration to let my “dc=escenic, dc=com” DN works .

(#) File: $APACHE_DS_HOME/conf/server.xml

—————————-

escenic

dc=escenic,dc=com

objectClass
ou
uid

objectClass: dcObject
objectClass: organization
dc: escenic
o: Escenic
description: Escenic content management system

Yet another configuration. let apacheds know about your new partition. this could be done adding a new property under “configuration” bean.

Thats all, it is working like shhhhhhhhhhhhh…..!!

best wishes,

Written by nhm tanveer hossain khan

May 12, 2007 at 7:00 am

Posted in Introduction, ldap

struts rewrite, link rewrites url with “;jsessionid=” session id.

leave a comment »

hi,
on my server i found some strange problem. it was actually related with tag. the problem was with the url rewriting, which was performed by struts tag library. struts tag library was creating an invalid URL.
for example i wrote the following code:
< img src=”my-image.gif” />

as i have only wrapped “${urlPrefix}” with in html:rewrite tag. so struts tag library wrote the following output.

which is totally a wrong url.

so how i resolved it?
very simple just fixing my weired code. now it looks like the following -
< img src=”" />

the generated output looks like -

here is a regex which may help you to find out the error tags:
“(.+)”

yeap it is working now :)

Written by nhm tanveer hossain khan

May 7, 2007 at 8:34 am

Posted in Introduction, Java, java ee, jsp

আসো আদর্শ সফটও্যয়ার প্রোগ্রামিং শিখি – ২ (”final” এর ব্যবহার)

leave a comment »

“আমার টারগেট রিডার হল যারা java জানেন”।
(টপিক: “final” keyword এর ব্যবহার).

java তে final ব্যবহার হয় কোন variable কে read only করার জন্য ।

member/local variable গুলো ভুল বশত value override হবার সম্ভনা দুর করার জন্য final ব্যবহার করার প্রয়োজন ।

final এর কিছু ব্যবহার দেখানোই আমার আজকের পোস্ট:

১. static initialized variable গুলো তে final ব্যবহার করুন । যেমন:
private static final BLA = new Bla(..);

২. class member variable গুলো তে value override করার প্রয়োজন না হলে, initialize করার সময় final ব্যবহার করূন । যেমন:
private Bla mBla = new Bla();

৩. local variable গুলোতে final ব্যবহার করুন । যেমন:
final String name = mBla.getName();

৪. for loop এর index variable কে final ব্যবহার করুন । যেমন:
for (final int i = 0; i < 10; i++) {…}

৫. foreach loop এর variable কে final ব্যবহার করুন ।
যেমন:
for (final Bar bar : bars) {…}

৭. method parameter কে final করূন । যেমন:
private void doBla(final String pName, final String pEmail) {…}

৮. protected method গুলোতে extended class গুলোর override করা দুর করার জন্য final  ব্যবহার করুন । যেমন:
class Animal {
protected final String getRootType() {
return “animal”;
}

protected String getType() {
return getRootType();
}
}

class Cat extends Animal {
/* Compilation error block start */
protected String getRootType() {
return “Bang”;
}
/* Compilation error block end */

protected String getType() {
return “Cat”;
}
}

এখানে
protected String getRootType() {
return “Bang”;
}

এই কোড টুকু কম্পাইল টাইম এরর দিবে …

আর মনে পরছেনা (ক্লোজআপহাসি)

Written by nhm tanveer hossain khan

May 2, 2007 at 5:23 pm

Posted in Java, bangla