Suse 11.3 and you must load kernel first …

•January 26, 2011 • Leave a Comment

Recently i had a strange experience updating my OS to Open Suse 11.3 .  I have system with Ubuntu and Suse 11.2 . Since Suse 11.3 was available i decided to update my Suse OS . The update went fine and the first time after the update my system rebooted properly to Suse 11.3. However after a couple of hours when i rebooted my system and chose Open suse ( 11.2 since it didn’t show 11.3 ) from the boot menu  and to my horror an error showed up “you must load kernel first…” .It was sort of a heart break for me since i had spent so much time in updation . After some hours of reinstalling and  other changes i kept on getting the same problem . Disappointed i logged into Ubuntu to do some other work , as i booted in and was going from the programs menu  one thing suddenly flashed in front of my eyes “Bootloader” . I immediately did “sudo update-grub” at the terminal , rebooted my system ,selected Suse from boot menu and viola  … i successfully logged into Open Suse 11.3 .

Watching TV under ubuntu

•November 22, 2010 • Leave a Comment

I had purchased a Hauppauge win tv pvr 150 tv tuner card last 6 months ago . The card was bundled with hauppage wintv application which ran fine on windows .However i use ubuntu and didn’t wanted to switch over to windows just for watching tv .I tried configuring myth tv for the card but it was a real pain and didn’t work . I was losing hope on watching tv on ubuntu when i met a thread over web which mentioned the capabilities of vlc . I did some searching over the net and figured out a way to watch my tv (using composite 1 ) input over ubuntu ,the trick was obviously using VLC . Here is the quick and dirty summary of what i did .

sudo apt-get install ivtv-utils
sudo v4l2-ctl -d /dev/video0 -i 2

Opened VLC  , Media-> opened capture device->capture mode PVR and click play (with norm as pal for me ).

Immediately my output started displaying on the VLC screen . Initially there was some flicker on the video displayed , but once i installed the latest nvidia drivers using following commands the flicker disappeared and a clear video was displayed .

sudo add-apt-repository ppa:ubuntu-x-swat/x-updates
sudo apt-get update
sudo apt-get install nvidia-current nvidia-settings

MSXML 6 issues in MSSQL server installations

•June 9, 2010 • Leave a Comment

Most often while installing some Microsoft products (or even some other products ) you might encounter errors related to MSXML . Morever installing the latest MSXML 6 installer again from the site doesn’t work often ,  in such a scenario even the add remove program menu also shows error in uninstalling the faulty component .Recently i had the fortune of encountering such an error and after hours of searching i found a valid feasible solution in form of a microsoft utility used for install clean ups .

In case of MSSQL server you need to uninstall  MSXML6  components by using Windows Install Cleanup Utility which can be downloaded from http://download.microsoft.com/download/e/9/d/e9d80355-7ab4-45b8-80e8-983a48d5e1bd/msicuu2.exe.

After the un installation of the component , you can download the latest MSXML SP from the download site , install it and then proceed with your installation of MSSQL server .The installation goes on smoothly  .

Even tough the post is mostly oriented towards MSXML and MSSQL server , I have tried this scenarios with most of the IBM applications which tend to render a further re-installations of the same application to fail .The cleanup utility helps in removing most of the erroneous components from the system which often fail from the “Add-Remove “program menu

Simple Spring MVC application

•June 7, 2010 • Leave a Comment

I was hearing about Spring MVC application since quite a time time now , recently i  had the fortune to have a go at it .At first what looked too be a too horrendous application resolved into one of the simplest app that i have coded in recent times .The files involved for getting a bare bone MVC application working are as follows :

  • web.xml
  • dispatcher-servlet.xml
  • HelloController.java(controller)
  • index.jsp,mypage.jsp
  • Library files as usual

Lets start with each component step by step :

1.web.xml
This file contains the as usual the servlet stuff and the mapping stuff required for forwarding to any particular servlet .The intercept in the web.xml file for my app  is as follows :

<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>
/WEB-INF/pages/index.jsp
</welcome-file>
</welcome-file-list>

Well this file explains itself and states necessity of the .htm extension for forwarding to the servlet .

2.dispatcher-servlet.xml
Spring  by default looks for this file under the WEB-INF directory , so  this lies in parallel to the web.xml file . This file contains the controller names to which any particular request would be mapped based upon the url .This file also lists the view resolvers which are helpful in mapping and forwarding the views from the controller .The main intercept of a basic dispatcher-servlet.xml file is as follows :

<bean id=”viewResolver”>
<property name=”prefix”>
<value>/WEB-INF/pages/</value>
</property>

<property name=”suffix”>
<value>.jsp</value>
</property>
</bean>
<bean name=”/normal.htm”/>

3.HelloController.java(controller)

This is the main part of the application , this is where your java code exist .Controller performs the  business logic (if any or delegates it further) and forward to a view (ideally ViewResolver which further renders view).The intercept for a bare bone controller is as follows :

package com.mvcapp.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

public class HelloController extends AbstractController {
private String message;

@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws                                                     Exception {
Thread.sleep(500);
return new ModelAndView(“mypage”,”mymessage”, message);
}

public void setMessage(String message) {
this.message=message;
}

}

In this file the final return statement hints toward the view that we intend to render . The first parameter “mypage” is the view name and the ViewResolver would resolve it to “/WEB-INF/pages/mypage.jsp” with help of the definition in the in the dispatcher-servlet.xml file .The second parameter “mymessge” is the view parameter and   can be accessed on the view .

4. index.jsp,mypage.jsp

These are the jsp’s that i have used for the demonstation purposes . mypage.jsp is the final jsp that you are rendering through your controller , while index.jsp is the jsp file use for redirecting to your controller url .The intercept for the index.jsp file is as follows :

<a href=”normal.htm”>Click here for normal dispatcher</a><br/>

The pages of course need to be placed under “WEB-INF/pages” directory .

5. Library files
I m not too sure about the exact library files required , but the ones that i required are as follows :

  1. spring.jar
  2. spring-webmvc.jar
  3. spring-web.jar
  4. spring-core.jar
  5. spring-context.jar
  6. spring-context-support.jar
  7. spring-beans.jar
  8. spring-aop.jar
  9. commons-logging-1.1.jar

This is the minimum that you are required to have to get your spring MVC app working (you could have also used annotations , but this did the trick for me ) .

Minimal MySQL master-slave replication

•February 25, 2010 • Leave a Comment

Today i was a bit interested in some mysql configurations when i stumbled across the mysql replication docs on MySQL . The docs seem to be interesting , so instantly i decided to give it a try . I went through the docs entirely and at the end found myself overly confused about the minimum changes required .After a couple of hours of my head storming with the configurations i found the minimum changes required for the replication .Here are the steps to do a minimal master slave replication for a MySQL server .

The mysql installation used for this article is mysql no install binary installation .The detailed steps for the replication are as follows :

1.Download the binary distribution for the mysql .
2.Extract the downloaded mysql binary zip files twice to two folders namely the “master” and “slave”.
3.Make a copy of “my-huge.ini” in the two folders and rename it as “my.ini”.
4.Make the configurations to the “my.ini” files in the master and slave folder as follows :

Section required in master my.ini

port=5000
log-error = c:/newmylog/mysql.err
log-bin = c:/newmylog/mysql-bin

Section required in slave my.ini

#log-bin=mysql-bin
server-id = 2
log-error = c:/newmylog/mysql.err

Execute the following code on the master server :

mysql -uroot
mysql>grant replication slave on *.* to slaveuser@'localhost' identified by 'secret';
mysql>\q

mysqldump -u root --all-databases --single-transaction --master-data=1 > masterdump.sql

Execute the following code on the slave server :

mysql -uroot < masterdump.sql
mysql -uroot
mysql> CHANGE MASTER TO MASTER_HOST='localhost',MASTER_PORT=5000, MASTER_USER='slaveuser', MASTER_PASSWORD='secret';

mysql>start slave;
mysql>show slave status\G
mysql>\q

After the last command on the slave for the status we get an output as shown below :

Output for the slave status command

slave status command output

With no error displayed on the slave status you can see that any changes made on the master server databases are reflected on the slave immediately .

Simple MySQL binary installation

•February 5, 2010 • Leave a Comment

Today i was stuck around for sometime having default MYSQL installation to work on one of my linux boxes . Tried installing it using Yum but for some reason it didn’t start at all . As i was having an urgent need for the database for some time i decided to dig up around with Mysql binary distribution .I tried a few combinations to get it work the steps that i used for the installation are as listed below :

wget http://dev.mysql.com/get/Downloads/MySQL-5.1/mysql-5.1.41-linux-i686-glibc23.tar.gz/from/http://ftp.jaist.ac.jp/pub/mysql/

gunzip mysql-5.1.41-linux-i686-glibc23.tar.gz

tar -xvf mysql-5.1.41-linux-i686-glibc23.tar

mv mysql-5.1.41-linux-i686-glibc23 mysql

cd mysql

./scripts/mysql_install_db --user=root

./bin/mysqld_safe --user=root &

./bin/mysqladmin -u root password 'mypassword'


In case you want to keep this installation for a bit longer , you can add the mysql installation bin directory to the “PATH” environment variable.

RT61pci driver configurations on Open Suse11.2

•November 17, 2009 • Leave a Comment

I have an AMD 64 bit machine with Dlink GW510 wlan card . The default driver on open suse for it is “rt61pci” .The default drivers doesn’t work with my wireless card . So i decided to configure it , but no matter how i do configurations the wifi didn’t work . So i decided to opt for the “madwifii” based drivers .However madwifii based drivers are to be built on the system itself , and on my system the “make” failed to build the driver .Ultimately my last option was to turn to the ol Ndiswrapper .I installed the “Ndiswrapper” from the package manger in Suse .I Downloaded the 32 bit driver and extracted the driver file .Then installed the drivers as given below :

1. ndiswrapper -i path/to/NetRt61G.INF
console output :- installing netrt61g

2. ndiswrapper -l
console output :- Installed ndis drivers:
netrt61g

3.modprobe ndiswrapper
console output :- ndiswrapper version 1.55+CVS loaded

4.ndiswrapper -m

The driver didn’t work and no wifi .So i decided to try with a 64 bit driver and it did the trick for me .
Then i configured the network card using following steps :
1.Browse to “nework settings” from YAST .
2. Enter “Wireless” as device type in the configuration section .
3.Kept the default configuration name as it is .
4.Kept the default hadware config name .
5.Enter “ndiswrapper” in the field Module name.
6.Browse to next step by pressing the button “Wireless settings”.
7.Operating mode is kept as “managed “.
8.Added the network name used by the access point in the field Network Name (ESSID).
9.Kept the encryption settings as WEP-Shared and added a hexadecimal key .
10.Rebooted the system .

And after reboot my wifi was up and running .

The 64 bit driver for Dlink GW510 can be found at DWL-G510_XP64bit_Vista64bit_Driver_v2.1.2.0.zip

exec: 48: ./catalina.sh: Permission denied

•June 16, 2009 • Leave a Comment

Today as i was deploying a simple tomcat application on EC2 i encountered a strange problem . I copied my war to the webapps folder and tried to start the server using the standard ./startup.sh from the command line . To my surprise i got this error
” exec: 48: ./catalina.sh: Permission denied” i checked the permission on the script files present in my bin directory and all of them reflected the flags indicating that the execution of catalina.sh file is permissible . I tried using the root privileges just to check the permissions but the problem still persisted . I tried googling it but mostly as expected i got replies doing a “chmod” on the script files .After a few hours for the sake of doing and in a state of desperation i did the “chmod a+x *.sh “on script files in the bin directory . As expected the permission flags still reflected the same state as they were earlier , but to my surprise the server started and deployed the application correctly.
(Still wondering whether i am becoming a zombie or what due to such type of unbelievable experiences that i am getting these days ).

Kubuntu Jaunty and Knetworkmanager Problems

•June 5, 2009 • Leave a Comment

Day before yesterday i updated my Laptop OS from Kubuntu Interpid version to Jaunty version . The new OS version had a new Knetworkmanager version installed .My earlier Knetworkmanager worked fine for me , but after the update the network manager gave me tremendous problems with frequent dis-connectivity and password popups .The remedy for this solution was to get “wicd” installed on my system.Wicd removed the buggy Knetworkmanager and works as breeze with my office and home wifi network.All i did to solve my issues was to use couple of commands :

1. sudo apt-get install wicd
2.wicd-client

LazyInitialization Exception

•June 3, 2009 • Leave a Comment

Few days back i was creating a sample project for sake of my own prcticising .I was using spring struts 2 and hibernate 3 in it . At certain point while loading a collection i encountered an exception viz. “LazyInitializationException: illegal access to loading collection”. It wasn’t the first time i had seen this , but it forced me to write this post due to its common occurence in the day to day projects .

This exception is caused when an object from the database is detached and a collection from the object (which is supposed to be lazily loaded ) is accessed . Due to the closing of the session this exception is thrown .

To overcome this exception either we can use an Open Session in View interceptor or my personal favourite a servlet filter .The configuration required for the filter is a simple one and involves addition of following snippet in web.xml file

<filter>
        <filter-name>hibernateFilter</filter-name>
        <filter-class>            org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
        </filter-class>
    </filter>
    <filter-mapping>
        <filter-name>hibernateFilter</filter-name>
        <url-pattern>/*</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>ERROR</dispatcher>
    </filter-mapping>

That’s it , the exception goes away with such a small addition . However an interesting point to note was the place of application of filter . If i applied the filter after the struts 2 filter ,the filter didn’t seem to work.But if its before the struts 2 filter ,then everything works as breeze

 
Follow

Get every new post delivered to your Inbox.