Oct 292009

Be it complex .NET/java code or a simple one line php/javascript statement, every technology blogger sooner or later faces the problem of writing code in his blog. The results are sometimes horrendous. From formatting gone awry to markup being processed, it sometimes ends in disaster. I have even had to paste screenshots in one of my blogs.

So I spent quite a bit of time searching for a good plugin to help write and format code properly in my WordPress blog. The first was a Live Writer plugin, though the WordPress online editor is quite good enough for me, I used live writer just to use the code formatting plugin which lets you copy code directly from Visual studio without losing formatting. Now it would have sufficed for my needs had it not been for the dark background color of my blog. Look at the results.

Certainly not good, so my search continued. Then i stumbled upon the code plugin WP_Syntax which can be downloaded from here. After downloading, extract it using Winzip (or any other compression utility). Using a file transfer utility like FileZilla, copy it to your wordpress blog’s wp-content\plugins directory.

After copying, like all other plugins, you need to activate it.


Once activated, your all set. Just switch to the HTML view and copy the code as text enclosed in the <pre> tag which denotes a pre formatted block of text to which no formatting is applied. The format is <pre lang=”language_name” line=”n”> where language_name is any supported language and n is the number to start numbering lines from. For e.g. <pre lang=”csharp” line=”1″> would give the following code

private void button1_Click(object sender, EventArgs e)
      Assembly _AsmObj = Assembly.GetExecutingAssembly();
      Type _t = _AsmObj.GetType("TestClass");
      MethodInfo _MIObj = _t.GetMethod("AddTwoNumbers", new Type[] { typeof(int), typeof(int) });
      object _TestClassObj = Activator.CreateInstance(_t);
      int _ReturnValue = (int)_MIObj.Invoke(_TestClassObj, new object[] { 12, 13 });

And its as simple as that!!!. Here are the languages which are supported. Languages in bold are the popular ones.

abap, actionscript, actionscript3, ada, apache, applescript, aptsources, asm,asp, autoit, avisynth, bash, bf, bibtex, blitzbasic, bnf, boo, c, cmac, caddcl, cadlisp, cil, cfdg, cfm, cmake, cobol, cpp-qt, cpp, csharp, css, d, dcs, delphi, diff, div, dos, dot, eiffel, email, erlang, fo, fortran, freebasic, genero, gettext, glsl, gml, bnuplot, groovy, haskell, hq9plus, html4strict, idl, ini, inno, intercal, io, java, java5, javascript, kixtart, klonec, klonecpp, latex, lisp, locobasic, lolcode lotusformulas, lotusscript, lscript, lsl2, lua, m68k, make, matlab, mirc, modula3, mpasm, mxml, mysql, nsis, oberon2, objc, ocaml-brief, ocaml, oobas,oracle11, oracle8, pascal, per, pic16, pixelbender, perl, php-brief, php, plsql, povray, powershell, progress, prolog, properties, providex, python, qbasic,rails, rebol, reg, robots, ruby, sas, scala, scheme, scilab, sdlbasic, smalltalk, smarty, sql, tcl, teraterm, text, thinbasic, tsql, typoscript, vb, vbnet, verilog, vhdl, vim, visualfoxpro, visualprolog, whitespace, whois, winbatch, xml, xorg_conf, xpp, z80

Oct 242009

I had written a post a few days back on how to backup your wordpress MySql database. A key feature of backing up the database was the ability to send your zipped db backups to your email as per schedule. Saving them to server could be a security hazard. But to send it to your email, the SMTP settings must be configured on the server.

An easy way to do this would be to install the wordpress email plugin WP Mail SMTP. Below are the instructions:-

  • Download the WordPress Mail SMTP plugin’s version from here.
  • Unzip it to your local drive and copy it to the WordPress ( wp-content\plugins) directory using FileZilla or any other FTP client.
  • Go to the admin page of your WordPress blog by giving the blog address/wp-admin/. Click on Plugins-> Installed
  • You should see the WP-Email-SMTP in the list. Click on Activate. Once done, you should see a new category Email in your dashboard Settings.


  • Now that the plugin is ready, we need to configure our email settings on the godaddy server. I ll create a new email id for my WordPress blog here.
  • On your GoDaddy account home page, click on Email -> My Email Account. In the page that opens, choose what kind of email account you want to create and click on the Manage Account next to the plan. The Godaddy Email Control panel should open in a seperate tab. Click on the Add button to create a new email id.



  • Once you come back to your dashboard, Click on Settings -> Email.


  • In the page that opens enter the following details:
  1. From Email: The id which you created in the steps before this.
  2. From Name: Choose a good name!!!
  3. Mailer: Send All WordPress mails via SMTP.
  4. SMTP Host: Enter relay-hosting.secureserver.net .  Dont give the one that Godaddy gives you. It wont work.
  5. SMTP Port : 25
  6. No encryption and No authentication:


  • Now try sending a test mail. If it works, you should see the below screen. And you should get the test mail too!!!!


Oct 222009

One of the most important features I look for while choosing a web host is the backup services he provides. Is there any cap on the number of times I can backup my data and content. Because lets face it, it would be next to impossible to recreate all your blogs, your pages, your data in the unfortunate event of a crash. Even if it was remotely possible, you would lose valuable revenue while the site is down.

To prevent all this its best to backup your database and website content regularly.  Though it is possible to create backups from your control panel, its a ardous task to be repetitively doing say every 2-3 days. Thus I searched for a solution which could automate WordPress database backup for me. The answer: WordPress WP-DB-Backup plugin seemed perfect for me. I jotted down the steps i performed.

  • Download the WP-DB-Backup plugin from here.
  • Unzip the file and extract it to your local drive.
  • Go to your Godaddy control panel and click on Content -> File Manager.


  • All your folders you have on your account will be present here. Click on the folder where you have installed your WordPress blog which needs to have its database backed up.


  • After the folder opens you will see the wp_content folder. Check the box next to it and Click on Permissions. There grant the directory write permissions by unchecking the Inherit box and checking the write box. Click on Ok.


  • With your FTP client, copy the extracted WordPress DB backup folder to your wp-content\plugins folder.
  • After that go to your blog dashboad, click on Plugins. Check whether your WordPress data backup is present in the list. The click on Activate.


  • Once the plugin is active, the option Backup can be seen in the Tools Section of your Dashboard. Click on it to open the DB Backup options screen.


  • Here choose the appropriate options on how you want the backup to be done, scroll down to the frequency and click on schedule backup. This will setup a cron job to do the backup automatically on the scheduled time.

There you go, no more data loss hassles. An easy way to keep track of your backups.

P.S. If you don’t receive a mail after you schedule the backup, there might be a problem with your email settings in your host.

Oct 182009

Favicons are the tiny icons that appear on your browser tabs when we open a website. Most modern browsers (IE/ Firefox/chrome) support favicons. Older versions of Internet explorer insisted on having an icon format file, but nowadays any image format goes. In case if favicons still seem mumbo jumbo to you, see the below screenshot for favicons from popular sites.

What are Favicons?

What are Favicons?

Most mainstream sites use favicons. Its a good exercise in branding your website and getting youo logo through to visitors even when the site’s tab in  not active in the browser. So how do you go about installing (don’t know if thats the word?) a favicon for your website? Since I have written articles for DotNetNuke and WordPress, I will provide instructions for both.

Before installing the favicon, we need to create one. Its fairly simple, Just create any 16 x 16 pixel image and save it as favicon.ico. You can also use the numerous online generators, or use MSPaint to create your own one.

For installing in DotNetNuke, use a FTP client like FileZilla with the username and password provided to you by the web host and copy your favicon.ico to the root directory. This changes the favicon for all the portals in your website. But what if you want different favicons for each portal? In that case go to the  DotNetNuke Root\Portal folder. Inside this you would have different folders called 0,1… n for each of your portals. copy the favicon.ico file to these folders for customizing the favicon for each portal. Pretty simple huh!!

Changing the icon for WordPress is slightly different. Here you have to go to your themes directory. Located in the WordPress_root\wp-content\Themes\<your_theme_name>\ would be a file called header.php.  Just below the head tag, place the following tag

<link rel=”shortcut icon” href=”favicon.ico” />

It would look like


Once you are done with this copy the favicon.ico file to the root directory for your blog. Yes its the root, not the themes folder where you added the link.

Thats it. you should see your favicon in your browser!!

Oct 182009

I have tried two major blogging applications in the past, Google’s blogger and WordPress. Though Blogger is quite good, WordPress takes the cake, its highly customizable, been written on PHP and MySql. Its basically free and open source. In short – My Dream software.

So when I wanted to start a blog on my new website, I didn’t look any farther from WordPress. And WordPress installation is so simple, I was almost disappointed that it got over so quickly.

Here are the steps i used to install WordPress to a separate subdomain in the step. Let me know if you face any issues.

  • First Create a subdomain in your website.  You can do this by going to Settings -> Domain management in your hosting control panel. Then click on add subdomain and enter the name for your subdomain. In my case, it was blog.
Add Subdomains

Add Subdomains


  • Create a new mysql database for WordPress. Click on Databases -> MySql. Click on Add Database and give the details it asks for. My Advice would be to create a strong username and password. i.e. with different capitalizations, numbers and special characters. This would make your database more secure. Once you create your website, you would see the status as Pending Setup. It takes 15-20 minutes for the database to be setup for it to become usable.


  • Download the latest non-beta release of WordPress here. Unzip it to a local folder using WinZip or any other compression utility.
  • In the WordPress directory, there would be a file called wp-config-sample.php. This would be your config file which would contain the your database details. Rename it to wp-config.php and open it in any text editor. There you need to fill in the details of your db username, password and host. Leave the collate and charset settings as it is.


  • Also in the config file, there is a section called Authentication Unique keys. These are the keys that are used to encryt the information stored in cookies for better security. To get strong keys, use the Online Generator. Copy paste the generated keys in the below section.


  • The username and password are what you just entered for your new mysql database that you created. To access the host name. Go to Databases -> MySql. Check whether the database you just created has the status setup now. If so, get the username and password by clicking on the Details button.


  • Once all the details are entered copy all the files in the website folder. I use a FTP client like FileZilla. If you want to install this to the root directory, then copy the files to the website root. Else copy it to the root.
  • After all the files are copied, enter http://example.com/wp-admin/install.php if you installed it to the root. Else, if its installed in a subfolder, enter http://example.com/blog/wp-admin/install.php where blog is the name of your subfolder. Enter the few details it asks.


There you go. All Set!!! Happy Blogging.

There you go. All Set!!! Happy Blogging.