Saturday, February 13, 2010

Disperity and dearth : Does it portrays my identity : A retrospective view of my understanding to my country! Search for Hope.

Being born in the one of the most impoverished nations in the world, having seen and experienced what hunger is, I have seen children's playing in war zone and conflict shattering dreams of many, resulting in a bruised socio-economical and political condition of the beautiful Himalayan Shangrilla. I supposed, the main cause of this was nothing but the poverty and the gap created by poverty between different classes of our society. My definition of a better scientific world when I was in Nepal was (not necessarily a world created with great scientific achievements and lavishness),a place where people would get two times a meal daily, a place where children would not be forced to carry weapons but rather get a chance to go to school and get proper education. Place where there would  be no discrimination amongst caste and creed, where peace and harmony are the languages known rather than war and anguish and where nobody has to give his life either out of any conflict or poverty.This would really be a great challenge for science filling the gap ,the difference between the west and the third world countries like Nepal. My thought is that the next step of science should be in the scientific and uniform distribution of the existing technological achievements throughout the world. As long as there is unevenness in the distribution of the assets of science there will be war zone, inequality, malnutrition and diseases. Up until now, we have had scientific achievements and its distribution in a localized way, leading to the socio-economical segregation between different parts of the world. So, the next step should be to bridge that gap created between technological society and the existing backward society.

Science is knowledge. As until now we have utilized this knowledge in a positive as well as a negative way. Today we are proud to have achieved what our forefathers used to see in their dreams, However, still our achievements are in a tarnished state and the finishing is still left to be done. Hereafter, science should focus on solidifying its achievements in order to avoid the further imbalance prevalent today amongst different sectors of world and society. Similar to the ecosystem if the balance between production and consumption is uneven it will result in the unnatural disturbance, we have to mobilize the achievements of science in order to avoid such disturbance like hunger, poverty, diseases and illiteracy.


Having got a chance to study in Japan, Luckily I got a chance to see what science and technology has had its effect in this foreign soil. At last for a moment I felt I have arrived to the place where I wanted my childhood to nurture, the difference I saw was imminent. A big building I could see reminded me of a common hut in my village made up of bamboo and soil, huge bridge across the river I compared with the wooden logs we used to cross the river, big roads with huge number of vehicles was of reminder of a pathway in my village where I watched sheep's march and I followed behind those. When I saw those crowds of people running after their destinations I compared myself when I used to run after the lost kites in the sky. My stay in Japan was really amazing, great food to eat, I could use laptops now and learned a lot of things about computers, society and cultures. My experience was similar to the dream I used to see when I was a child, At last I was in my dreamland. I was so much immersed in this world that I left all the agony and frustrations at my country.

At the same time, when I looked back the ruins of my motherland I believed that the role science has played in getting the human generation to 21st century has had its limitations and its role is still unfulfilled up until when country like mine will exist in this world.

My personal view regarding scientific change is that Change depends upon the heart of those who initiates it. There may arrive time when civilization may reach inter-terrestrial level and expand its horizon throughout this universe, As the foundation of which has already been created in the developed countries like the US.Poverty is like a disease, it should be stopped from spreading. Back in my country there are many places like Rolpa where we see people fighting for rotten grains unsuitable to eat, Although science has gone a long way still we see such happenings in many parts of the world, while the rest of the world had been developing My country I looked back was going to dark ages day by day. But, one day I heard that some initiation to bridge the gap between technology had been taken by some group of enthusiasts back in my country and they were working for was for the complete transformation of the villages in remote areas of Nepal.

The place called Myagdi,in the heights of the Himalayas it lied seven hours hard climb to the nearest roadway, These people never saw a telephone and even electricity was out of reach. School was miles away and students didn't have pencils or paper to write with. There arose an inspirational man. A Nepali citizen after he finished his studies in USA came to build a high school in this remote area.While he was teaching in that school, he had to travel for two days to reach the nearby city to check his emails. This condition, he informed to BBC and when BBC publicized his ideas, lots of volunteers form Europe and Americas came to help. When he installed four used donated computers in his school teaching students how to use it, it became a start. With the help of donated computers and wireless devices, he had setup relay stations around his village. Now all of sudden these peoples were connected to rest of the world with the latest technology. The impact was imminent. The people have started using computers that were once a waste for the westerners, Suddenly teleteaching has started, local people benefited form the medical facilities from the doctors of big cities, and villagers now e marketed their local products and household goods. People now use online libraries,online health clinic, and e shopping. Really the wireless boon of the science really had a tremendous impact upon the socio-economical aspects of the rural people. The same moment concentrated not only to Myagdi village, but seeing its success the wireless were similarly set up in the nearby villages and rural parts of Nepal, and the once isolated villages are now a global village connected by one of the most fantastic technologies of Science.

So, An example set up, the impact the wireless project had brought about a revolutionary effect in a then so called Dark Village. There are certainly more such rural parts as Myagdi in Nepal and in many parts of the world. Together and with the aid of some of the fantastic innovations of science we can make the world a better place to live.

The places where it was very difficult to reach and where it was almost impossible to access information regarding outside world. Science was making things possible and was easing peoples life in a remarkable way. How did that happened is really a wonderful story I take a great morale from. A man called Mahabir Pun a Nepali student in USA initiated a per dollar program from the abroad Nepalese and collected that money and went back to the inaccessible villages of Nepal and set up wireless devices which enabled the poor mountain peoples an not only an easy access to information and internet but also they could now easily communicate with other peoples of other mountainous regions easily. It seems a small progress to most of the people, But it turned out to be a miraculous aid for the people of that region. Just after 1 year of the installation of the wireless device suddenly the lifestyle of those people changed dramatically and their purchasing power rose at once. Now here we see how can a small change brought about by science can bring about a tremendous change in peoples life. Not only it was the technology which changed their status from normal people but also it enabled them to learn and acquire knowledge in a much similar way the westerners do.

This step was a bold step which filled the gap between the people of remote areas the rich peoples of the cities. A small step like that can really be a giant step for the whole mankind.

Friday, January 29, 2010

Unicode Encoding Problems with Java- Mysql-Tomcat web page and solution

There are many things to take care if we want to correctly display utf-8 characters from mysql properly. Also if we wish to do internationalization based upon database, the following steps serves as a good place to start with.

Thing to take care :

first :
while entering utf-8 data into the table from shell be careful to set names as follows :
By setting name as utf8 we are telling mysql to use the given charset. We need to do it every time we log into the server. If not done mysql regards whatever entered data to the table in the default charset format, which will not make your program display characters properly.

set names utf8 collate utf8_general_ci

Also we can use this command mysql > default-character-set=utf8;

Check your mysql server encodings by this command:

show variables like 'character\_set\_%';
Make sure you have similar response.

Variable_name | Value |

+--------------------------+--------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8


If not edit /etc/my.cnf to make the encodings to utf8 as shown in the above table. Although its not necessary to change all the fields to utf8. I have the following configuration and its working perfectly fine. I am facing no problem of encodings provided i fulfill all other steps carefully.

Variable_name | Value |
+--------------------------+--------+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | utf8 |
| character_set_system | utf8 |
+--------------------------+--------+


second : create the database with character set utf8, create table with charset utf8 also make the columns of table utf8 . we need to do this to make sure we get characters correctly.


Third : set the page charset and default encoding to utf8 if we are displaying table data in a web page.


<%@ page pageEncoding="UTF-8" %>



Adding these lines instructs the browser to use the utf8 encoding for the page.
By performing step three we will be able to see hard coded utf8 characters in the page properly but this might not work in case of database backed utf8 encoded data. For it to work we need to follow step first and second properly.


This also might not work in case the reponse is coming from server. So we have to explicitely tell the server to use utf8 as encoding for our pages, So we need to go to step fourth.

Fourth : We may also have to write a custom filter to encode the response sent by the server as utf-8. Define a filter and set the responseEncoding to utf-8


Write a ResponseFilter class implementing Filter. and in the doFilter() method set following to tell the server explicitely that you want utf-8 encoded response.


response.setCharacterEncoding("utf-8");
request.setCharacterEncoding("utf-8");
chain.doFilter(request,response);



This should display any utf8 characters properly in any web page or console.


Step Five : Well this is not necessary if we performed all the above steps above, at least not necessary for latest Mysql connectors. But for older versions of the driver we need to add the following to the connection url

jdbc:mysql://localhost/table-test?useUnicode=yes&characterEncoding=UTF-8


Note : - Have to set charset utf8 before entering any data into table from the mysql prompt.

Must Read article :
unicode-how-to-get-characters-right


If problems persists ! feel free to post your problem in this blog. I shall try to solve the issue. Well it worked for me in case of Japanese, Arabian, DevNagari characters and others.

Wednesday, January 06, 2010

Richfaces -Facelets -Spring JBoss configuration

JBOSS version is : jboss-4.2.0.GA

In order to run richfaces application with JBOSS-4.2.0.GA we need to have the following libraries in the web-inf /lib directory

Commons-beanutils
commons-digester
el-impl
el-ri
jsf-facelets
richfaces-api
richfaces-impl
richfaces-ui

Other libraries are by default included in JBOSS installation so we dont need to add other JSF libraries and commons libraries. If added could cause deployment problems.

Sunday, January 03, 2010

eclipse java.lang.Error: Unresolved compilation problem solved

Recently I was working on a project when suddenly i had this error in my eclipse :

java.lang.Error : Unresolved compilation problem

Error bubble were shown at all the source files. I went through the web to solve this issue but nothing was working to me. Finally what I did was

Right clicked the project
set the compiler compliance level to 1.6
Initially it was set to 1.5
Now the problem was solved. I guess it was the issue with different versions of JRE used to build.

Sunday, December 13, 2009

Getting started with JINI in Ubuntu Linux

Get yourself running JINI in UBUNTU with the following steps :


Download the java version of JINI distribution from the following page, because the linux versions is facing some problems so its better to download the java version even if you are Linux users.

http://www.jini.org/wiki/Category:Getting_Started

Run the Jini_2.1.jar from the command line by using the following command
java -cp Jini_2.1.jar install

follow the procedure for full or custom installation of JINI

After installtion go to jini2_1/installverify/support folder of the installation
Before you can run the launch-all you have to edit the launch-all file

search export LD_ASSUME_KERNEL=2.2.5 line in the file

comment this line in launch-all
export LD_ASSUME_KERNEL=2.2.5
#export LD_ASSUME_KERNEL=2.2.5

now run launch-all from the commandline
./launch-all

All the jini services will be started.
This completes the installtion procedure of JINI under UBUNTU and Linux platforms.

You can run sample application now.

Wednesday, December 02, 2009

facelet-taglib_1_0.dtd parse problems

Solution for parse problem of facelet-taglib_1_0.dtd in JSF/facelets

initial definition in taglib.xml

"-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"

"facelet-taglib_1_0.dtd">

change it with the following

"-//Sun Microsystems, Inc.//DTD Facelet Taglib 1.0//EN"
"http://java.sun.com/dtd/facelet-taglib_1_0.dtd">

The warning message should resolve . It works for me.

Monday, November 30, 2009

could not synchronize with fileSystem problem in eclipse

could not synchronize with fileSystem problem in eclipse


This problem can be solved by following steps :

windows-> Preferences -> General -> Refresh Automatically

this should solve the synchronization problem with the file System.

Wednesday, November 25, 2009

java.lang.ClassNotFoundException: com.sun.el.ExpressionFactoryImpl

Problem with Running facelets

Environments : JBoss 4.2.0
Error : java.lang.ClassNotFoundException: com.sun.el.ExpressionFactoryImpl

Cause of Error : If we are getting such error while trying to run facelets with JBoss Server, then
the most probable cause for this is the library not included in path.

make sure you include these libraries\jars in \WEB-INF\lib folder.

commons-beanutils
commons-collections
commons-digestor
commons-logging
el-api
el-impl
el-ri
jsf-facelets-1.0

With JBoss we dont need to include jsf libraries and jstl libraries.
Including above libraries should eliminate the error.
Note : Check if the JBoss distribution contains commons-collections and commons-loggin In such case we dont need to include these in our project as they are already included with JBoss distribution. ReIncluding these jars can cause problems of conflict. Also check whether commons-el jar is present on the server distribution or not, In such case it is also not required to be included in the project as by default it will be included in the Project during build.
Thanks.

Wednesday, November 18, 2009

Generics are not supported insource 14 use version 5 or higher error Netbeans

Generics are not supported insource 14 use version 5 or higher

This might be a common error while working with Generics in Netbeans.
The problem is that you are using older version of Runtime environment maybe 4 or less.

Solution :

Right click the netbeans project
Go to Sources
In source Binary Format select 5 or 6

Now you wont get the earlier error.

Tuesday, July 07, 2009

Dashain Ashirwad दशै आशिर्वाद

केटाहरुको दशै आशिर्वाद र अर्थ

आयुर द्रोणसुते श्रीयं दशरथे सत्रु क्षयम राघवे । ऐश्वर्यं नहुशे गतिस्च पवने मानं च दुर्योधने । सौयेर्म शान्तनबे बल हल धरे सत्यम चः कुन्तीसुते । बिज्ञान बिदुरे भवन्तु भवताम क्रिश्तिंचा नारायणे !

द्रोणको छोरा अश्वश्थामा को जस्तै लामो आयु होस् । दशरथको जस्तै श्रेय पाइयोस् । रामचन्द्रले जस्तै शत्रुलाई नाश गर्न सकियोस् । नहुस राजाको जस्तै ऐश्वर्य होस्, पवनको जस्तो गति होस्, दुर्योधनको जस्तो मान-मर्यादा कमाइयोस् । सूर्यका छोरा कर्णजस्तो दानी हुनु, हलोधारी बलरामजस्तै बलवान् हुनु, कुन्तीको छोरा ले जस्तै सत्य बोल्नु । विधुरजस्तै ज्ञान-विज्ञान, शास्त्र बुझेको हुनु, भगवान नारायण को जस्तै र्कीति हासिल गर्नु !


केटीहरुको दशै आशिर्वाद र अर्थ

जयन्ती मंगलाकाली भद्रकाली कपालिनीदुर्गाक्ष्यमा शिवाधात्री स्वाहास्वधा नमस्तुते ! जयन्ती मंगलाकाली भद्रकाली कपालिनी दुर्गा क्षमा शिवधातृ स्वहा स्वधा भनेको देवीका नामहरु हुन् जसलाई मन्त्रमा म नमस्कार गर्छु भनिएको छ ।

Monday, June 29, 2009

nagios email notification in gmail problem and solution

step 1 : check in templates.cfg . The configuration should be similar to the one below(in objects folder in my case)

# Generic contact definition template - This is NOT a real contact, just a template!

define contact{
name generic-contact
service_notification_period 24x7
host_notification_period 24x7
service_notification_options w,u,c,r,f,s
host_notification_options d,u,r,f,s
service_notification_commands notify-service-by-email
host_notification_commands notify-host-by-email
register 0
}

step 2 : check contacts.cfg

define contact{
contact_name nagiosadmin ; Short name of user
use generic-contact ; Inherit from generic-conta
alias Bishal Acharya ; Full name of user

email abc@gmail.com

}


# We only have one contact in this simple configuration file, so there is
# no need to create more than one contact group.

define contactgroup{
contactgroup_name admins
alias Nagios Administrators
members nagiosadmin
}

Make sure we have contact and cotactgroup defined in contacts.cfg. In my case it is with my denominations.


step 3 : Check the commands.cfg file . Make sure we make /usr/bin/mailx in the configuration under Ubuntu systems. Also do install sendmail prior to doing this by using(sudo apt-get install sendmail) and check by command line that you can send mail by using command (mail abc@gmail.com) . If you successfully sent your mail then your nagios too can send mail or else we again need to troubleshoot.


# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mailx -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $ADMINEMAIL$
}

# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /usr/bin/mailx -s "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" $ADMINEMAIL$
}



Make sure ADMINEMAIL has been set accordingly in nagios.cfg file as

admin_email=abc@gmail.com



step 4 : Time to check few things
check whether notifications are set or not in nagios.cfg file if not set it to 1, similarly also make notifications to 1 in services and host definitions, Nagios cant sent notifications unless you enable them.



Now reload your nagios and test by stopping one of the services like ssh or other anyone If you are lucky you will receive notifications according to the timing settings. If not check your log file.

Common problem :

Warning: Contact 'nagiosadmin' service notification command '/usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: PROBLEM\n\nService: SSH\nHost: bishal\nAddress: 127.0.0.1\nState: CRITICAL\n\nDate/Time: Mon Jun 29 17:24:26 JST 2009\n\nAdditional Info:\n\nConnection refused" | /usr/bin/mail -s "** PROBLEM Service Alert: bishal/SSH is CRITICAL **" abc@gmail.com' timed out after 60 seconds

Solution for Nagios notification Timeout problem :
Go to nagios.cfg and increase the notification_timeout to some larger value, In my case i made it 600 from 60


service_check_timeout=60
host_check_timeout=30
event_handler_timeout=30
notification_timeout=600
ocsp_timeout=5
perfdata_timeout=5


Now again reload nagios and you should be alerted when any service goes down. Test it by stopping any service also we are notified when any service recovers. We may give our mobile phone email address so that we are alerted to our mobile phones when problem occurs instead of our computer.


Good Luck ! Comments are welcomed

Sunday, April 12, 2009

sudo not working in Ubuntu and Semantic package manager vanished

I have recently had a problem when sudo did not worked in Ubuntu, The problem was that whenever I tried to do sudo it would ask for my password but it wont carry out the action as per the command.Another symptom was that the synaptic package manager had vanished from the menu. It was a peculiar behavior for me because I had jumped from windows to Ubuntu and it was just few weeks I was trying on Ubuntu. I was trying to install Nagios and this problem suddenly arised when normally working sudo stopped working for my root user.

The problem with it was that I had accidently removed my root admin user from the admin group, So in order to fix I had to do the following steps :

step 1 : I started the computer in recovery mode
step 2 : I entered the root user space
step 3 : And finally I just added my user back to admin group by the following command
adduser username admin

And the problem was solved I again had my synaptic package manager in the menu and I could now do everything back again. I guess my experience might help some novice users.


user@user : adduser username admin


Comments are welcomed !

Monday, February 09, 2009

Sunday, August 06, 2006

bishal

I am Bishal. I am a Computer Engineer in Kathmandu City. I work in Java EE, object-oriented application development, and use of open source frameworks. I primarily work on the design and development phases of Java applications. I have been with my current job for about two years and I have a degree in computer Engineering.
In this blog I will be posting issues about JSF, Facelets, Ajax, Spring, App Server, JINI, javaSpace and anything Java related technologies. I will be concentrating my difficult moments during development phases and how I tackle those issues to perform my daily job.