J’s Blog

Installing IBM WebSphere MQ Server on Linux

Posted by: Jawaid on: 10 February 2010

This is part 1 of the series on IBM WebSphere MQ. Installing IBM WebSphere MQ server on a Linux machine is easy. It takes just a few minutes to install. IBM WebSphere MQ can be downloaded from http://www.ibm.com/developerworks/downloads/ws/wmq/.

Extract it to some folder (e.g /root/download/wmq) after download. Then follow these steps.

1. cd /root/download/wmq
2. ./mqlicense -accept

This is necessary since this instructs to accept the license, otherwise you will not be able install WebSphere MQ. If this gives a JRE error then give the JRE path like this:

2. ./mqlicense -accept -jre PATH_TO_JRE
3. rpm -ivh MQSeriesServer-x.x.x-x.i386.rpm MQSeriesRuntime-x.x.x-x.i386.rpm

where x.x.x-x is the version number like 7.0.1-1

That’s it! WMQ server has been installed. The next steps include adding users in mqm group to grant access to users to perform certain operations like creating/deleting queue manager and queues, then creating queue manager then configuring it.

Hidden Reasons for slipping project deadlines

Posted by: Jawaid on: 26 January 2010

There can be so many factors that affects the deadline and project can be delayed. There is an excellent article 10 ways to get a slipping project back on track on TechRepublic explaining the remedies. But in my opinion tips given by the author are where there are already processes defined and a proper organizational hierarchy is maintained, not just maintained but also everyone at its position has its role and responsibilities defined and he works according to his role. At least to some extent. But what when this is not the situation? Let me explain here by first commenting on the TechRepublic post.

Overtime was on the top in that post. Author has already accepted that this is an option when you are at the end of the project, and there are better strategies if you are in early stages of project. I agree with that. You cannot work overtime for a long period. Few overtimes are acceptable. I just wanted to mention this here.

Few other reasons of slipping the project deadline is setting the deadlines blindly, assuming ideal situation and not keeping the buffer, specially when there is a learning curve when you are working on something new.

Another problem is that if there are lots of senior guys and everyone is imposing his own decisions discarding other’s. Having senior guys is good but everyone should have separate responsibilities and no one should interfere with other. Discussing matters, coordination, and giving opinion is something else. Not having this leads to unstability.

Another major big problem is with the management when talking in terms of investment. Besides company’s plans few things are obvious where anyone can see that investment has been done at wrong place or investment is not done where it was supposed to be. Like hiring skilled people and paying them good. Finding cheap human resource does not always work. You should know when you have to invest in human resource and when not. And if you already have good human resource then appraise them before you loose a good resource and someone else steels it from you. Keep in mind as long an employee works for a company, he becomes more valuable asset since he has learned so many things and new employee will take time to learn those things. If you can understand this then you already know that time is money. And if employee leaves in the middle of a project, then obviously there is a big chance of slipping the deadline. You have to put extra resource, reschedule accordingly, assign resource etc etc.

Another one is related to human resource and team. One should have experts and should have responsibilities and role defined. Don’t expect one to do everything from project management, to design and architecting, to learning, to implementation, to support. Project Manager is one guy, System Architect is another, Developer is another, Designer is another, Tester is another, Network or System Admin is another (sometimes two), and Support personal is one another. If you don’t have enough money to hire all these people then don’t jump into the big business, otherwise you will fail. Start with small and gradually build your team. This is a long term investment.

Besides human resource, other resources are also important, including facilities. Not providing sufficient resources to the team wastes time and at the end deadlines are slipped. Employees also get frustrated. Even a very small resource or facility has its effect. Not upgrading systems, network issues, not providing healthy environment, and even not having standards and policies are the reasons. Having flexibility is something else and not having proper company policies is something else. Not having these demotivates employees and one cannot give his 100% then.

One another important thing is forecasting and future planning. If you don’t have the plan and has approach like we’ll see when that will happen, then don’t be surprised if you fail to accomplish your goals.

When working on projects you should have dedicated resources, not the ones that come on and off. I am typically talking about human resources here. Since working on project and to complete it in time needs concentration and focus. There can be resources who come on and off but don’t assign them critical tasks. Use them for assistance only.

Processes! Just having separate development and testing teams doesn’t mean you are following processes. There are processes for within individual teams as well. If processes are not defined then this is also a reason for not meeting the deadlines.

Besides all this I also recommend reading Peter Steven’s blog post 10 Ways to Save a Slipping Project.

Setting up a CVS repository

Posted by: Jawaid on: 21 January 2010

Setting up a CVS repository is very easy. First create a directory where you want your CVS repository to be located. For example create a folder /cvsroot. Change you directory to /cvsroot and run the following command.

# cvs -d /cvsroot/ init

Obviously, you should have CVS installed. This command will initialize your CVS repository. Remember not to run this command after adding projects/modules, otherwise it will wipe out all your files. After initializing you can add projects to it. Thats it! your CVS repository is ready. Go and add your projects :)

What processes are using a particular port?

Posted by: Jawaid on: 21 January 2010

If you want to see how many processes are connected on a particular port, you can use the following command on Linux platform:

lsof -i tcp:1234

Command is self descriptive. It will show only TCP connections using port 1234. Among other information this command also shows the process, its PID, user, and the IP/Port it is using.

Threads in Perl without using thread module

Posted by: Jawaid on: 21 January 2010

Threads are not good in Perl. If you want to know why, you can read PerlMonks article here. But C/C++ threads are good :) How can you leverage the benefit of C/C++ threads in Perl? Well, if you have a C/C++ library which is multi-threaded then you can write a Perl wrapper on C/C++ library. For writing a wrapper you can use Inline::C or Inline::CPP module, that provides a very gentle and easy way to wrap up your C/C++ calls.

What happens is that if you call a C/C++ function which uses threads from a Perl script/process, it will make your Perl process multi-threaded. You can see this by using -m option of ps if you are on Linux platform.

I was working on a Perl based project and I used a multi-threaded C/C++ library. I was curious how will it work. I ran the Perl process and when I see the process in ps with -m option, it was showing two processes, actually one process and second was the thread. When I was using a single threaded library it used to show only a single process in ps. I also tested the functionality which was supposed to use the multiple threads and it worked as expected.

I think this is a better way to use threads in Perl if you really need threads, instead of using thread module of Perl. If you are not desperate, then try to stick with single threaded model of Perl, or use Perl wrapper over C/C++ multi-threaded library.

MySQL Installation and Configuration

Posted by: Jawaid on: 15 January 2010

Since I have been involved with MySQL development for last several years, so I constantly look for good resources related to MySQL. I found a very good article on this at IIS site (http://learn.iis.net/page.aspx/610/walkthrough—set-up-mysql-51-for-php-applications/). I thought I should refer that to my blog. I am providing whole article as it is here.

Overview

This article provides a basic step by step guide on how to install and configure MySQL on the Windows Operating System. For more detailed instructions about installing and configuring MySQL on Windows refer to the official MySQL documentation.

Downloading and Installing MySQL

The MySQL binaries and installer can be downloaded from the official MySQL site. The instructions in this article are based on MySQL version 5.1 Community Edition installed with the Windows MSI installer.

Run the installer and choose the installation option. For a majority of the cases, the typical installation is sufficient:

However, if you want to control which components get installed or if you want to use a non-default installation path then choose the “Custom” option.

When the installation is complete, make sure to check the box to “Configure the MySQL Server now”. This will launch the “MySQL Server Instance Configuration Wizard” that will guide you through the configuration process for the MySQL instance.

Configuring MySQL instance

Follow these steps in the “MySQL Server Instance Configuration Wizard” to optimize the MySQL configuration for the kind of tasks you expect it to perform.

On the first page of the wizard choose “Detailed Configuration”:

On the next page choose the server type option:

Choose the “Database Usage” option:

The Database usage options control what kind of database storage engine is used on the server:

  • MyISAM – Optimized for high performance SELECT operations. It has low overhead in terms of memory usage and disk utilization, but at the cost of not supporting transactions
  • InnoDB – Provides fully ACID transactional capabilities, but at the cost of more aggressive usage of disk space and memory

For an in-depth comparison of these database engines, refer to MySQL Storage Engine Architecture. As a general recommendation – if the web applications on your server require multi-statement transactions, advanced isolation levels and row-level locking, foreign key constraints, or otherwise have a requirement for ACID features — use InnoDB. Otherwise, use MyISAM.

Next choose the number of concurrent connections to the server:

On the next page choose networking options :

If you have mysql and web server on the same machine you may consider not enabling TCP/IP networking and instead use named pipes. Note though that some PHP applications may require TCP connection to MySQL. Refer to the application’s documentation to confirm if it supports named pipes connection to MySQL.

Choose the default charset to use when creating new databases:

Next ensure that MySQL will be configured as a Windows Service:

Optionally, you can add the MySQL Bin directory to the Windows PATH environment variable. That will make it easier to launch MySQL tools from the command line.

Finally provide the password for the database administrative account, which in called “root” in MySQL. Make sure that you leave the “Create an Anonymous Account” checkbox cleared:

On the next page click “Execute” to apply all the configuration settings and to start the MySQL service:

Now you can logon to MySQL by opening a command line window and typing:

mysql -u root -p
Enter password: ******If MySQL was configured correctly then the MySQL prompt will be shown:

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server Version 5.1.32-community MySQL Community Server (GPL)
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the buffer.
mysql>

XMS.Net Consumer Application for IBM WebSphere MQ

Posted by: Jawaid on: 29 October 2009

Currently we are working on IBM WebSphere MQ to be used in our project. One feature that we need from several features of WebSphere MQ was to subscribe to a topic with selector string from a C#.Net application. IBM provides two libraries for .Net. One is MQI classes for .Net and another is XMS.Net (IBM Message Service Client for .Net). Finally we adopted XMS.Net, although we also tried MQI classes for .Net, but we moved to XMS.Net. Its totally a different story why we moved to XMS.Net. I might write another post on it :)

So, at first place we tried to run sample consumer application came with XMS.Net library. Our center of the focus was selector string. When we were trying to run the sample consumer application and supplied the topic to subscribe to and selector string to filter the messages, it was getting stuck every time after subscription. Even it wasn’t receiving any messages, although we could see the subscription object being created on the WMQ server. One thing that we were doing was that we were running the sample in ‘client’ mode. When we switched the mode to ‘unmanaged’, everything ran smoothly. We were bit surprised! Why it wasn’t running in client mode? I think there is some bug, since I couldn’t find anything related in the docs. Might IBM will fix this issue in the future release.  But at last, somehow we managed to run the sample consumer application and finally we are at the stage where we can move forward.

So, if you are also trying to run XMS.Net application and want to subscribe to some topic with selector string to filter messages, remember to run the application in ‘unmanaged’ mode. You can find further information in XMS.Net doc (ftp://ftp.software.ibm.com/software/integration/support/supportpacs/individual/ia9h.pdf).

Useful vim options for techies

Posted by: Jawaid on: 7 August 2009

Vim is very useful tool for editing files, especially for techies to edit configuration and code files. There are some useful options for them in vim. You can set them in the vim configuration file vimrc usually found in /etc. Here are some of those options:

syntax on            " Turn on syntax highlighting
set incsearch        " Used for incremental searching
set hlsearch         " Turns on highlighting for matched search patterns
set tabstop=4        " Sets the tab size to 4
set shiftwidth=4     " Sets spaces used for (auto)indent
set shiftround       " Indent to nearest tabstop
set autoindent       " Carries over previous indent to the next line

Note: Double quotes (“) are used for comments.

I was having some issues installing MQSeries Perl Extension 1.29 for IBM WebSphere MQ (WMQ). What actually I did was downloaded the MQSeries module from the CPAN, extracted it and ran the perl Makefile.PL. But it gave me the following error:

> perl Makefile.PL
Checking if your kit is complete…
Looks good
ERROR from evaluation of /root/MQSeries-1.29/MQClient/Makefile.PL: No such directory ‘/opt/mqm’
Compilation failed in require at ./Makefile.PL line 14.
# Looks like your test died before it could output anything.

This seem as it needs /opt/mqm directory to install to and its not creating it by itself. But this was foolish assumption, as most applications create the required directories itself when installing, but still there wasn’t any clear error message. Then somehow I came to know about the client and I installed the MQSeriesClient. Installing MQSeriesClient requires MQSeriesRuntime as well. This created two directories:

  • /opt/mqm and
  • /var/mqm

So, that means Perl Extension was unable to find the client, but instead it was complaining about the directory. Well I moved forward and tried again installing MQSeries Perl Extension. But what? again error?

> perl Makefile.PL
Checking if your kit is complete…
Looks good
ERROR from evaluation of /home/jawaid/MQSeries-1.29/MQClient/Makefile.PL: Missing inc or include directory in /opt/mqm
Compilation failed in require at ./Makefile.PL line 14.
# Looks like your test died before it could output anything.

dahhh!! Now its complaining about another directory inc or include in /opt/mqm. That means it requires something else as well. The name of the directory i.e include, sparked in my mind that it might requires some kind of SDK or something. Then I checked the RPMs came with WMQ. I found MQSeriesSDK. hmmm so I thought lets try installing this RPM and try my luck again with installing Perl Extension. So I installed MQSeriesSDK and then MQSeries Perl Extension. woala!! this time it generated the make file without any errors :)

> perl Makefile.PL
Checking if your kit is complete…
Looks good
Writing Makefile for MQClient::MQSeries
Writing Makefile for MQSeries::Message::DeadLetter
Writing Makefile for MQSeries::Message::PCF
Warning: Guessing NAME [MQSeries-OAM] from current directory name.
No libmqm server library found, MQServer disabled
Support for MQServer is disabled on this platform.
Warning: Guessing NAME [MQServer] from current directory name.
Writing Makefile for MQSeries

But hold your breath for more. You can expect anything now after happening all this. Anyway, I ran make successfully then ran make test… what?? it failed??  :’(

aaahhh!! now what?? never mind!! I just ran make install… guess what? no, you are wrong :) no errors this time, it got installed, even after failing the make test :)

To verify i tried to run the example perl script in examples directory of MQSeries Perl Extension to put message in the queue, and i got an error from the MQSeries library that it didn’t find the queue, obviously there were no queues at the moment, that means Perl module is installed correctly…whew!!

That means installing the run time and client are not enough. You need to install the WMQ SDK as well to install the MQSeries Perl Extension.

Since I wanted to play with the WebSphere MQ, so when I failed to install the Perl Extension first time, I decided to install the server first on another machine. Somehow I managed to install the server. Then I tried to install the MQSeries Perl Extension, but to no avail. Even after installing the Client. Then I moved to another machine and did the whole this thing from scratch, and at last it worked :)

Enable X Session over SSH

Posted by: Jawaid on: 5 August 2009

Sometimes there is a need to use the graphical X session on Linux machines but you cannot do so, since you don’t have access to the machine, you can just SSH it. But you can forward your X session over SSH. To do this use the -X option. If you are using putty then you can set the option like this. Go to:

Connection -> SSH -> X11 -> “Enable X11 forwarding”

This will enable X session over SSH on putty.

Enjoy the GUI ;)

J’s Blog Feeds

J’s Archives

Blog Stats

  • 973 hits

J’s Calendar

February 2010
M T W T F S S
« Jan    
1234567
891011121314
15161718192021
22232425262728

J’s Categories

J’s Pages

J’s Blog Feeds Email Subscription

Enter your email address:

Delivered by FeedBurner

J’s Blog Feeds Email Subscription

J’s Feed Count

Twitter Updates

J's del.icio.us