10 Years $10 – New campaign by Packt Publishing

10 Years $10 - Packt Publishing

July 2014 marks 10 years since Packt Publishing embarked on their mission to deliver learning and information services to IT professionals. To celebrate this huge milestone, they are offering ALL of eBooks and Videos at just $10 each for 10 days until July 5th. Visit this link to learn more

If you’ve already tried a Packt title in the past, you’ll know this is a great opportunity to explore what’s new and maintain your personal and professional development. You can get ANY eBook or Video for $10 in this offer – browse all their categories at the bottom of this page.

All eBooks and Videos are $10 – Visit this link to learn more

URL Rewriting in CodeIgniter

CodeIgniter Logo

As mentioned on EllisLab website, CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications. At the same time, there are few simple things which may stall beginners with this framework.

I faced a problem with URL rewriting in CodeIgniter experiment and with the help of community found a solution as well so posting it as a blog post for everyone’s help so that you don’t need to find the whole internet for this simple solution 🙂

Problem 1) Removing index.php file from codeigniter URL and adding .html suffix to it:
1. Create an .htaccess file in the root directory of CodeIgniter installation
2. Make sure to double check .htaccess extension as notepad might turn it as txt file when saved in default mode so select “All Files” option while saving it as .htaccess file
3. Add the following rules to .htaccess file to have URL rewriting option ready to remove index.php file from URL:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]

4. Then find the following line in your application/config/config.php file:

$config['index_page'] = 'index.php';

5. Set the variable empty as below:

$config['index_page'] = '';

6. If it still doesn’t work, find the following line in your application/config/config.php file: and try to replace following variable with these parameters. For me, AUTO option worked after having above steps:

$config['uri_protocol'] = 'AUTO';

7. To add .html suffix, find following line in your application/config/config.php file and add .html as default suffix:

$config['url_suffix'] = '.html';

That’s all. Here you go 🙂 – good luck!

Simple Linux and MySQL Commands for everyday use

For last few days, I was working on Linux operating system. I liked it but after some time, I figured out that to use it effectively, I should be handy with the simple Linux and MySQL commands. To keep it for archive and easy access purpose, I am writing a blog post so that I and beginners like me can take benefit of these easy to use commands 🙂

To start the Apache server, as root type:

/sbin/service httpd start

To stop the Apache server, as root type:

/sbin/service httpd stop

To restart the Apache server, as root type:

/sbin/service httpd restart

Start/Stop/Restart MySQL server:

/etc/init.d/mysqladmin start
/etc/init.d/mysqladmin stop
/etc/init.d/mysqladmin restart

Note: Redhat Linux also supports service commands as below to start, stop and restart mysql service:
Start MySQL:

# service mysqld start

Stop MySQL:

# service mysqld stop

Re-start MySQL:

# service mysqld restart

Set MySQL server Password:

$ mysqladmin -u root password NEWPASSWORD

Update MySQL server Password:

$ mysqladmin -u root -p'oldpassword' password newpass

Change ownership to grant files writing permission to a specific user/owner:
chown [-R] newowner filenames

Connecting to MySQL server:

mysql -u root -p -h localhost

System will prompt you for password which you can enter and pass this screen.

To create a database structure:

USE bookstore;

To create a database table:


See the created database table structure:


Entering data in database table:

VALUES('value1', 'value2', 'value3', 'value4');

Retrieve table data:

SELECT title

Update table data:

SET COL_NAME1= 'value1'
WHERE COL_NAME2= 'value2';

Delete table records:

WHERE COL_NAME1 = 'value1';

Credit: http://www.redhat.com/magazine/007may05/features/mysql/

Migrate to WordPress from BlogEngine

BlogEngine is a very popular, useful and open source blog management tool based on ASP.NET but with the evolution of PHP more and more tools are coming up fast like WordPress. I have used BlogEngine personally in past but with the evolution of WordPress, things have been changed completely.

Ease of writing plugins and designing themes in WordPress has made it a very popular, easy to use and rich blog publishing tool. Not only for blogs but for many website, WordPress is being used widely.

In this changing time, if you are still on BlogEngine and want to move to a more flexible blog publishing tool then here are the steps to migrate from BlogEngine to WordPress:

  1. Make sure to take files and database backup of your old BlogEngine site and new WordPress site (if already setup) – it might be helpful as if you fall in some trouble to restore everything.
  2. Login to BlogEngine site and export your blog data from blogengine_site>settings>import/export
  3. Download BlogMLimporter plugin and install in your new WordPress site (you can find this plugin at http://wordpress.org/extend/plugins/blogml-importer/)
  4. Go to WordPress_site/Tools/Import/BlogML and select XML file to import
  5. All done – now check your WordPress site.

If everything is followed right, you would see and like your new WordPress site ready with your old data. This way, you won’t loose anything from your past and can utilize your past contents to remain high on SEO too. Enjoy!

Disclaimer: Steps mentioned in this post are for self guidance only and author doesn’t take any responsibility of data loss or any other kind of loss due to this post.

How to change default server port 8080 to 80 in JBOSS?

So here is another day of troubleshooting. I am completely new to JBoss and wanted to change the default port of JBoss which was 8080. Here are some of the steps which I followed and got success.

To run JBoss on port 80, please change all instances of 8080 to 80 in the following files:

1. server.xml in \server\default\deploy\jbossweb.sar

<!-- A HTTP/1.1 Connector on port 8080 -->
      <Connector protocol="HTTP/1.1" port="80" address="${jboss.bind.address}"
               connectionTimeout="20000" redirectPort="8443" />

2. jboss-service.xml in \server\default\deploy\http-invoker.sar\META-INF
3. bindings-jboss-beans.xml in \server\default\conf\bindingservice.beans\META-INF

<property name="port">80</property>
<xsl:when test="(name() = 'port' and . = '80')">

Things to remember:

  1. Ensure that new port number is not already occupied by some other service.
  2. JBoss is very close to Tomcat and many of its properties works the same way.

JBoss Server not running except localhost?

Last week, I started work on one of our new mobile application built using JBoss server. It was a totally new experience for me but as soon as we launched the server and app, we noticed an strange issue that it was working fine on localhost but not able to access the same link from external server.

When I did more study in this, I noticed that if we start JBoss server using run.bat from command prompt without using any special parameter, it will automatically bind to localhost (, means we will be able to access the server only from that machine. To bind it to other (or all) IP, we should start JBoss server from the command prompt with a -b argument.

E.g.: run.bat -b

If you want to bind to a specific IP, say, use run.bat -b
If you want to bind it to all the IPs, including localhost use, run.bat -b

I thought to share this tip with everyone because it took a good two days of mine to understand and resolve the issue. Hope, it would help someone faster and me too next time as a reference post 🙂