bash - printing parameters

A parameter is an entity that stores value and is available to a program. There are many system variables available to BASH. They could be retrieved easily by prefixing a $ sign to the variable. Alternately, you can also surround them with curly braces and prefix a $ sign

#: Title       : print parameters
#: Version     : 1.0
#: Description : print parameters
#: Options     : None

printf "%s " "Current Working Directory"
echo $PWD
printf "%s " "Home Directory"
echo ${HOME}
printf "%s" "Command Directories $PATH"

Output of the script

Changing file extensions

Suppose I need to change the file extensions of certain files in a directory.

echo "Please specify a directory: "
read folder
cd $folder
for i in *.txt
    mv "$i" `basename $i txt`fasta

The directory address specified by the user is read into the script in line 2. This address is used to cd to the directory. This script changes the extensions of .txt files to .fasta.

Creating users and groups in Linux

Note: To try out the examples in this document, you would need root access.

To create a new user you use the adduser command. To add a user by called linuxjunky:

$ adduser linuxjunky

If you get a command not found error

$ /usr/sbin/adduser linuxjunky

To assign a password to your new user

$  passwd linuxuser

To grant ownership of a file to the new user

$ chown linuxjunky filename

To change grant ownership of a directory to the new user


Cascading Style Sheets (CSS) is a design language for styling HTML documents. In modern websites, HTML controls the structure while CSS controls its presentation. Let's suppose that you have some HTML formatting in numerous pages across your website. Would you want to manually modify 10,000 HTML elements to implement the new formatting? Ideally, there should be one place where you can make a change that modifies that formatting everywhere you need in the website. Technical term for this concept is "modular design". This technology already exists and it is called CSS.


If you had to work with IBM products, you probably have had to work with DB2. This page will get you up and running with DB2 in 10 minutes.

Delete (Drop) MySQL database

It is very easy to drop a MySQL database:

drop database database_name

Tons of blogs and articles online mention this command. Recently, however, I came across a database name which had spaces in them. For example:

company balances
electronics inventory
store employees

If I do:

drop database company balances

MySQL would complain that the databases company and balances do not exists. Naturally, the first thought on my mind was to enclose them the database.

Displaying directory contents

For security reasons, most servers on the Internet do not show the contents of a directory if the directory address is typed. The user is either redirected to index.whatever, a default page, page not found or access denied. Thus the list of files in the directory are not displayed.

If you need to show the contents of your directory, you can use the following code:


The web is the most popular feature of the Internet and HTML is the backbone of the web. Everything that we see on the web is used with HTML. All fancy web technologies either generate or manipulate HTML in different ways.

Jar, War, and Ear files

.ear, .war, and .jar files are simply files zipped using Java jar tool. Each file is created for a different purpose:

.jar files

Jar (Java Archive) files contain libraries, resources and accessory files such as property files.

.war files

War (Web Archive) files contain web applications that can be deployed on any servlet/jsp container. It also contains other files required by the web application such as html, javascript, css, etc.

.ear files

Ear (Enterprise Archive) files contain EJB modules.

Java and Memory

From a programming point of view, there are essentially six different places to store data on your computer. The fastest storage is the registers since this memory resides inside the processor itself. No high-level language gives you direct access to this memory.

Java break and continue

Java’s break and continue statements are used to alter the flow of control.

break The break statement can be used in for, while or do-while loops. It is also used in switch structure. A break statement exits the loop without executing the rest of the code in the loop. In other words, if the program encounters a break inside a for loop, it exits the loop without executing the remaining statements even if the test condition of the loop is still valid.

jQuery quick start

Before learning jQuery, you should learn HTML, CSS, JavaScript, and learn how to debug JavaScript. You should also be familiar with JSON. Knowing XML will also be helpful.

Laravel 5


Laravel is a free and open-source PHP web framework like CodeIgniter and Zend. It is built on the Model-View-Controller (MVC) architectural pattern. It has very good documentation and training material. The community is also significant enough. I find it to be much easier than Zend and about as easy to use as CodeIgniter. Better training material and documentation makes Laravel easier for beginner than CodeIgniter.

Linux vs Linux Distributions

What is the difference between Linux and Linux distribution?

Linux is the core of the operating system i.e. the kernel. Kernel manages the physical resources of the computer and performs tasks such as starting and stopping programs, allocating memory, managing the processor, and managing network connections.


MongoDB is document based NoSQL database. This means that:

  • it has no schema
  • it has no relations
  • it is agile and scaleable
  • stores information in nested documents of two-dimensional key/value pairs.

What are the benefits of using MongoDB?

  • you do not have to pre-define your schema or data model
  • works nicely with JavaScript
  • ideal for client-side applications

Installing MongoDB

Installing MongoDB on Mac with Homebrew

MySQL Alter Table

Alter table command is used for altering tables, table fields and table indexes

To rename a table:

ALTER TABLE mytable RENAME yourtable;

To add a column:


The first example create a column in the first position. The second command creates a column after the column id. The last example creates a column in the last position.


Node is an open source runtime environment for server-side applications. It allows you to run JavaScript on the server in addition to the browser. Almost all of the new and most widely used JavaScript solutions use Node in one form or another.

Installing Node.js

Download from Install with default options. To check, type the following on the terminal

PMP notes

Project Management Knowledge Areas Project management knowledge areas describe key project management competencies. There are four core knowledge areas, four facilitating knowledge areas and integration management.


PostgreSQL also called Postgres is an object-relational database management system that focuses on extensibility and standards-compliance.

Installing PostgreSQL

This quick walk-through are my notes for installing the PostgreSQL database server and the PgAdmin administration application on Ubuntu Linux, and also set up the server so it allows access to other PC's on your network.

Right for the basic installation, at the command-line, enter the following commands (or search for the listed packages in synaptic if you prefer that way of working):


Why learn python? Because it packs a powerful punch. Python is is easy to learn, user-friendly, highly extensible and overall a very powerful language. Like Java, it is fully object-oriented and it is as fast as C++. It allows scripting. I find that development in Python is more rapid than C++ or Java.

Python is free and fully supported by Linux, Windows and MacOS. There is strong community support and there are thousands of packages to extend the language.

Who is using python? Google. Need I say more?

Getting Started

To install on Linux:


UNIX processes generally take input from standard input (keyboard), write output to standard out (screen) and may write to standard error if there are any error message which need to be displayed. Among the various powerful functions of Linux systems is the ability to redirect both input and output of commands.

The > symbol redirects output of a command. For example, cal command prints the calendar to screen. Using > we can save this calendar into a file.

Sorting and merging files

The following script merges several files into one file.

echo "Please specify a directory"
read folder
cd $folder
ls | sort -n
for i in *.fasta
    cat $i >> virus

Line 5 creates a sorted list of directory contents. Line six loops through all files with .fasta extension. Line 8 appends contents of every file to the file virus.


Subversion (SVN) is a very popular open source versioning system. It manages files, directories, and changes made to files and directories over time by single of multiple users. If you have the time to thoroughly learn SVN, the only book you should read is available online for free. It can be found at However, if all you want to do is get started with SVN within an hour, you have come to the right place.

Ubuntu: could not reliably determine the server’s fully qualified domain name, using for ServerName

Error: Could not reliably determine the server’s fully qualified domain name, using for ServerName

Solution: 1. Open httpd.conf for editing

sudo vi /etc/apache2/httpd.conf

You might be surprised to see that the file is empty

  1. type the following:

    ServerName localhost

  2. Save file and restart apache server

    service apache2 restart

VI Editor

The VI editor is a screen-based editor. It is very powerful and has been around for more than a decade. Programmers are especially fond of the VI editor due to its powerful features to aid programmers. VI is often overwhelming for beginners. It takes some time to get used to VI but it is often well worth the effort. The key to mastering VI is to learn sequentially, getting used to the commands you learn at each step.

Starting the VI Editor

VI editor lets you create new files or edit existing files. The command to start is: