Archive by Author

How to install JDK in Ubuntu

Those who are involved in Java based application development must need to use Java Development Kit (JDK). And those are newbie in the world of Ubuntu may don’t know how to install JDK in Ubuntu. This is quite simple to install JDK in ubuntu. Just run the following command in the terminal and follow the steps.

$sudo apt-get install sun-java5-jdk

After this the rest of the process will display a dialog that will require you to accept the license agreement. When you do, the rest of the setup will happen on its own.

When you’re on the command prompt type

javac -version

or

java -version

Now you should be ready to work with Java.

Installing true type fonts in Ubuntu

Even we are using Ubuntu we may sometimes want to or need to use some Microsoft true type fonts. For that we can follow the following steps to install true type fonts in our Ubuntu.

We can install the MS core fonts by installing the msttcorefonts package.
To do this, enable the “Universe” component of the repositories.
Then run the following command in the terminal:

$sudo apt-get install msttcorefonts

This will give us the core fonts, but if there are other TrueType fonts that we want installed, it is as easy as copying the font files to the ~/.fonts/ directory.

After installing new fonts, we will have to log out and log in again to be able to see and use the new fonts. If we want to avoid this, we can regenerate the fonts cache by issuing the following command:

$sudo fc-cache -fv

How to set a cron job using PHP in webmin

I have a CentOS server to test my all projects. According to clients requirement webmin is installed as admin panel. Today I had tried to use a cron PHP script in that server and succeeded. This is how I have setup the cron job.

In the webmin panel ther is a menu group named ‘Cluster’;
So from that menu group -> Cluster Cron Job.
Then I have added a new cron job.
1. Selected user ‘apache’.
2. in the command box:
/usr/bin/php -q /full/path/to/the/cronjob.php
3. Then selected the time which I want the cron job should be done.

Wow… It’s working. Please feel free to ask if you need any further help regarding this.

Using Mobile as USB Modem in Ubuntu

Now I am at Chittagong, enjoying my eid vacation here. Normally I use broadband at my home at Dhaka. But I am so much addicted in Internet that I can’t pass a single day without it and also I can pass all my time without eating or drinking if I get Internet. So, I faced a problem here that is my sister use GP Edge and I have to use this as alternate here. But I use Ubuntu Hardy 8.04 in my laptop and I don’t have any other OS. I never used any phone as modem in Ubuntu. I could have used my sister’s laptop but I didn’t feel comfortable as I will miss all my personal settings in which I am used to. So I started looking for how I can install the mobile set in my laptop. It’s a Nokia 6280 phone. I have searched over internet and finally by taking help from two site I have succeeded using it. The steps I have followed to install it are as follows:

1. Connected the phone using USB cable.
2. Open the terminal.
3. Check the USB detection:-
$ lsusb

Bus 003 Device 003: ID 0421:045a Nokia Mobile Phones
Bus 003 Device 002: ID 04f3:0210 Elan Microelectronics Corporation
Bus 003 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000

4. Autodetect the modem using WVDial:-
$ sudo wvdialconf
Found an USB modem on /dev/ttyACM0.
Modem configuration written to /etc/wvdial.conf.
ttyACM0<Info>: Speed 460800; init “ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0″
ttyACM1<Info>: Speed 460800; init “ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0″

5. sudo gedit /etc/wvdial.conf

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,”IP”,”gpinternet”
Modem Type = USB Modem
Baud = 460800
New PPPD = yes
Modem = /dev/ttyACM0
ISDN = 0
Phone = *99***1#
Username = gp
Password = gp

6. sudo ifdown eth0 [it will disable your LAN connection]

7. finally executed $ wvdial

Now I am connected to GP Internet.

Special thanks to Mr. Hasan for the step 6. Without this I tried again and again but couldn’t get connected.

Working as Remote Developer

Hurray! I got an offer to work as remote developer for an US company. First I thought it could be fraud but later on I have searched and knowing about the company and their working style I have decided to work. That company has no office in Bangladesh and they have such kind of teams in several countries. I am the first person working for that company in Bangladesh. My working time starts at 7.00pm (local time) and ends at 3.00am (local time). My manager assigns my daily tasks online and I do those from home. We have meeting online using IM. It’s really a new and uncommon experience for me.

Ruby on Rails

Why not we try Ruby as the whole world is suffering from Ruby fever. As I thought I had started playing (here I used word ‘play’ because I became fan of it) with Ruby on Rails.

Firstly I started reading one of four books named ‘Springer Ruby on Rails for PHP and Java Developers’. The book is so good and in fact perfect for me as I know PHP and Java.

There I found that once you install the Rails it will create and make your small application one-third done. OK let me share from the beginning what I did.

1. First of all I have downloaded the installer of Ruby from site for WIndows and installed it according to the instruction.

2. Then I have configured Rails.

3. Then I have created the database manually in mysql.

4. Then I created my project directory ‘c://ruby/myprojects’.

5. After that following the instruction I run my command prompt and by going to my project dir I run a command ‘rails myfirstpro’. Wow! It creates the complete directory structure of Rails!!

6. Then I entered to that directory using command prompt.

7. Then I have edited the ‘database.yml’ file in the ‘config’ directory.

development:
adapter: mysql
database: yourdatabase
username: yourusername
password: yourpassword
host: localhost

timeout: 5000

8. Then run another command ‘ruby script/generate scaffold user’ to create basic controller, model and views for a database table called users. WOW!! Now it has created model, controller and four views along with a layout.

9. Then you have to run a command in the command prompt ‘ruby script/server’ and keep it running untill you finish using your ruby application.

10. After that I found that the pages don’t show the data. That was beacause only the basic view pages were created and you have make the changes according to your database table fields.

11. Here is the sample how the index page was created:

<h1>Listing users</h1>

<table>
<% for user in @users %>
<tr>
<td><%= link_to ‘Show’, user %></td>
<td><%= link_to ‘Edit’, edit_user_path(user) %></td>
<td><%= link_to ‘Destroy’, user, :confirm => ‘Are you sure?’, :method => :delete %></td>
</tr>
<% end %>
</table>
<br />
<%= link_to ‘New user’, new_user_path %>

But to view my data I had made some changes. And after that the file is like below:

<h1>Listing users</h1>

<table>
<tr class=”thead”>
<td><strong>Email</strong></td>
<td colspan=’3′><strong>Action</strong></td>
</tr>

<% for user in @users %>
<tr>
<td><%= user["email"]%> </td>
<td><%= link_to ‘Show’, user %></td>
<td><%= link_to ‘Edit’, edit_user_path(user) %></td>
<td><%= link_to ‘Destroy’, user, :confirm => ‘Are you sure?’, :method => :delete %></td>
</tr>
<% end %>
</table>

<br />

<%= link_to ‘New user’, new_user_path %>

Here the red colored texts are added by me.

12. Now it shows the data. Here let me clear you one thing that is my database table name is users. And here is the following controller which was created:

class UsersController < ApplicationController
# GET /users
# GET /users.xml

def index
@users = User.find(:all)

respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @users }
end
end

# GET /users/1
# GET /users/1.xml
def show
@user = User.find(params[:id])

respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @user }
end
end

# GET /users/new
# GET /users/new.xml
def new
@user = User.new

respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @user }
end
end

# GET /users/1/edit
def edit
@user = User.find(params[:id])
end

# POST /users
# POST /users.xml
def create
@user = User.new(params[:user])

respond_to do |format|
if @user.save
flash[:notice] = ‘User was successfully created.’
format.html { redirect_to(@user) }
format.xml { render :xml => @user, :status => :created, :location => @user }
else
format.html { render :action => “new” }
format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
end
end
end

# PUT /users/1
# PUT /users/1.xml
def update
@user = User.find(params[:id])

puts

respond_to do |format|
if @user.update_attributes(params[:user])
flash[:notice] = ‘User was successfully updated.’
format.html { redirect_to(@user) }
format.xml { head :ok }
else
format.html { render :action => “edit” }
format.xml { render :xml => @user.errors, :status => :unprocessable_entity }
end
end
end

# DELETE /users/1
# DELETE /users/1.xml
def destroy
@user = User.find(params[:id])
@user.destroy

respond_to do |format|
format.html { redirect_to(users_url) }
format.xml { head :ok }
end
end
end

And the model was created as following:

class User < ActiveRecord::Base

end

13. Then I found I am unable to use the add and edit form as their is no input box. Here is the following insert form.

The red colored code was added by me and then it worked nice.

<h1>New user</h1>

<% form_for(@user) do |f| %>
<%= f.error_messages %>
<p>
<label for=”user_email”>Email:</label><%= f.text_field :email, :live=> true %>

</p>
<p>
<label for=”user_password”>Password:</label>
<%= f.password_field :password, :live=> true %>

</p>

<p>
<%= f.submit :Create %>
</p>
<% end %>

<%= link_to ‘Back’, users_path %>

14. For validation I have added the following code in the mode:

class User < ActiveRecord::Base

validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i, :on => :create
validates_presence_of :email, :password, :message => “Missing required field”
validates_length_of :password, :minimum=>5 ,:message => “Please provide password with minimum of 5 charecter”
validates_uniqueness_of :email, :message=> “already registered”

end

Then the form was a fully working with validation.

16. And then I have tried to use ajax validation and used live validation. And then added the red colored code in the form.

<h1>New user</h1>

<% form_for(@user) do |f| %>
<%= f.error_messages %>
<p>
<label for=”user_email”>Email:</label><%= f.text_field :email, :live=> true %>

<script type=”text/javascript”>

var user_email = new LiveValidation(’user_email’);
user_email.add( Validate.Email);
user_email.add( Validate.Presence );

</script>
</p>
<p>
<label for=”user_password”>Password:</label>
<%= f.password_field :password, :live=> true %>
<script type=”text/javascript”>

var user_password = new LiveValidation(’user_password’);
user_password.add( Validate.Presence);
user_password.add( Validate.Length, { minimum: 5, maximum: 20 });

</script>
</p>

<p>
<%= f.submit :Create %>
</p>
<% end %>

<%= link_to ‘Back’, users_path %>

and also added <%= javascript_include_tag ‘prototype’, ‘livevalidation_standalone’ %> to the layout header.

Now it worked with ajax validation.

Hurray! Now I know Ruby as well. And became a fan of it. I want to say like McDonanlds tv commercial “I’m lovin it”.

My First FaceBook Application

Hey guys! Ever tried to develop a FB Application with PHP or Ruby? I did and succeeded. It’s just a simple application showing latest blog post of one of my blog (বাংলাদেশ ১৯৭১).

The link for the application is My App

You can try it. It’s not a spam and none of your personal information will be hacked. After adding the application you also can send invitation to your friends.

IT Jobs in Bangladesh

People of IT Sector in Bangladesh often suffers from Job insecurity and this mostly happens in case of small companies. There are hundreds of small software companies in Bangladesh and their business depends mostly on the online bidding sites (i.e. Odesk, getAcoder, etc).

But highly skilled and experts don’t prefer to work in those companies as organizational structures are not well formed and stable in those companies. And from my personal experience I can say those small company often fails to utilize their skill and knowledge.

Working under a junior is very dangerous and harmful for anyone’s career and also those who knows very little but thinks himself a ‘GURU’ are the most dangerous insects for this field. During my last three years of professional career I found several of them. None of them were technically sound and skilled enough to deliver quality solution to the clients. Thus we are loosing overseas trust day by day. Those people are not being loser only but spoiling our total industry as a whole.

And if any developer want to shows his creativity and knowledge they are being terminated. This is only because if any developer or software engineer want to follow a sound architecture of course it will take minimum more time than usual. But the company urges for immediate release of the project so that their bank accounts get more healthier in short time. But they can’t think they are getting the money but loosing a very big amount in the long run.

I strongly stand to protect them. Otherwise total IT industry will fall and we will never be able to turn back if we loose this now.

IT Sector in Bangladesh

I am just writing this article for my self interest. This is nothing but my own saying. I am an IT professional in Bangladesh. Doing job in a software company as software engineer. But I don’t feel this sector in Bangladesh is matured enough. And also this sector is not growing in a speed which we expected. There are some reasons behind this. As, I am not a very experienced person my assumptions might be wrong. I have identified few reasons behind this.

The first and most important reason in my opinion is education. We, in Bangladesh, lots of students go to the university to achieve the degree. University is the highest educational institution in a country. But what we learn from our universities? From my experience I will say, there are also lack of experienced teachers of our field. They just know what is written in the books which were printed several years ago. They are just teaching the same thing again and again. They don’t update themselves. They just deliver the same lecture for every batches. So, a gap is created between the industry and the educational institutions. As a result the fresh graduates fail to get the job in the right way and time. There are also faults in the students not only in the teachers. Students often don’t want to learn more. They even don’t want to ask the teachers more about the latest technologies. This is because, they want to know less so that they have to answer less in the exam. I even saw lots of students have passed with a very high grading point. But they are still jobless. The reason behind this is their target in the university time was to achieve the grade not to learn. I hate this kind of students. I also identified a reason behind this. First boy of every batch gets the job in the university. So, everyone want to be the first boy.

Secondly, I want to blame the seniors of this field, obviously not the all. Most of the senior technical guys in Bangladesh are responsible for not developing this sector in our country. They always tried to solve a problem but did not follow proper way and steps of Software Engineering. As a result the clients faced lots of problem and difficulties after using a software for 4/5 years. And also those developers failed to give any solutions to the users. So they lost their trusts on technology.

Thirdly, I want to blame our current developers also. Whenever we face a problem we just solve in the way which we find first. We even don’t want to know more and compare several solutions so that we can pick the best one. Another thing is observed in the developers is they always remain in hurry to do anything. Of course, developers have to meet the time line of a project. But a developer has to prove himself by his quality, logic and style of solving problems. There is nothing beyond art of solving problems in life.

The forth reason in my opinion is the management of software companies. There are lack of managerial capacities in the management of most of the companies. Most of them are professional businessmen who know money only. They just want the early income. They don’t think of their product’s quality also. Again the companies are paying the developers very low.

Another thing I have observed personally. That is our non residential Bangladeshis are not helping us lot. Which is very remarkable in case of Indians. I knew some of them who told me that they always try to take even a single table database system from India. Thus their small companies surviving. But in case of us, we even don’t trust ourselves. If the reasons stated above could be solved I hope we can gain the trust again.

We, the new generation, want a revolution in this sector and we are sure we can do. We have the quality and confidence. We just need a proper care. I may have said something wrong. But all those I have written is my personal opinion. If it matches anyone, I am sorry that this would be just a co-incidence and please try to overcome your lacks.

No more today.