Thursday, January 8, 2015

How To Use wkhtmltopdf Tool For Windows To Convert HTML to PDF

1. Download wkhtmltopdf from here -

2. Install it on your Windows machine into C:\Program Files\

3. Open command line prompt

4. Write the command - 'cd progra~1/wkhtmltopdf/bin'. Now you are into the bin directory of wkhtmltopdf.

5. Now write the actual command to convert a HTML file into PDF

$wkhtmltopdf /.pdf

Please note here that it would not allow the typical windows path like c:\windows.. etc. It will accept path with your IP address or your path like below example.

wkhtmltopdf \\JohnDow\Users\Public\abc.pdf

Alternatively you can also use forward slashes to access your local drive path from network like below.

wkhtmltopdf //

You can find out your local IP address by firing 'ipconfig' command.

Hope it helps!

Saturday, August 2, 2014

W3C Standards (for retards?) - An insult to web community

Have you ever come across a guideline from "Elite Doctors" on "How To Stay Alive" - A guideline which will prescribe you to keep breathing, keep eating and keep sleeping everyday to stay alive? Do you think such a guideline is needed? Do you think that what I'm asking is hilarious if not idiotic?

Yeah, the question is idiotic. Sadly, that is what W3C standard also is. Idiotic. Plain and simple. Nobody needs W3C standards just like no one would need such a prescription from doctors. In fact it is an insult to the intelligent community of web developers.

If you have some very dumb ideas that you need to present and still want to look like a genius, try putting that idea into very complicated and verbose language that people have to read several times to understand what exactly you are saying. W3C has used this "golden escape rule" marvelously!

W3C is divided in three categories. A, AA and AAA. The first two mostly prescribe silly recommendations, and third is really left upon developers to decide whether to follow or not. In fact, it should not be followed fully in most cases.

In the "level A" they are prescribing the things which are very very hard to *not* to do. Here are the examples.

Although I've provided the link above, click on it only if you want to twist your mind for 15 mins and scream... What The Hell! (this advise applies to all the links that I'm going to post in this post) Basically what this means is that you should always put some caption for any audio or video content and put some description for it. Now, have you ever seen a single page on whole of the web where you get to see a plain page with only a video/audio link on it i.e. without title/description?

1.4 Distinguishable: Make it easier for users to see and hear content including separating foreground from background. 

What this means is that the text or audio content that you put on webpage should be readable and audible respectively. Additionally, the text color should be set in such a contrast that it doesn't dissolve in the background color. If this is not an insult to the most creative community, which web designers is, then what will that be?

3.3 Input Assistance: Help users avoid and correct mistakes.           

What this basically says is that each form fields should have a label beside which indicates what that field is for. At the time of submitting the form, it should do the regular validation and notify the user accordingly. Apparently, only a retard who wants to make huge losses from the website business would require such a guideline. We have yet to see such a retard being born.

Almost all the A and AA level standards are routine common sense issue which anyone, who wants some users to view his site, would invariably do without anyone's recommending. Why did the authors of W3C standards thought that they have to prescribe something that would be followed invariably no matter what? Now does it sound like a team of "Elite Doctors" prescribing the methods of how-to-stay-alive?

The above are the examples for Level A compliance. The Level AA is also not a very smart one. But Level AAA takes the cake of stupidity off all. While A and AA are silly recommendations which no one needs to know (yet invariably follows them), AAA is a standard which hardly anyone should/would follow.

This one prescribes to have changeable background and text color for the users so that they can choose whichever color they want to see on the web page. Think how an ugly place internet would be if everyone followed this standard?!

Point 3.1.5 deserves to be quoted in full.

3.1.5 Reading Level: When text requires reading ability more advanced than the lower secondary education level after removal of proper names and titles, supplemental content, or a version that does not require reading ability more advanced than the lower secondary education level, is available. (Level AAA)             
I have no words to describe this!! How can anyone in his right state of mind can think of such a bizarre thing? And still the authors of this standard expected themselves to be taken seriously.

The problem is that these standards were created in stone age when the authors thought that they are the only ones on this planet with brain. Since then the world has moved on far too advance. The W3C standards should also have evolved to new challenges and provided standard that will actually help in the betterment of the Internet. The issues such as...

  • Most of the content on internet does not have a date on which it was last updated. Apart from the news sites and blog/forum sites, we don't get to see when the page was updated last. There are oceans of pages which don't get updated for years but we just don't know how old that content is. It should be made mandatory to stick a datestamp on each section of content (although in some pleasant manner) for when it was updated last. This will really help users to evaluate the user to understand and evaluate the content in right perspective.

  • To get a higher rank on search engines, the websites put deceiving meta tags and content on their web pages. This makes it very difficult for users to search what they are looking for. Some sites have even made this their  business model. This needs stop somehow.

  • Some websites just simply keep forwarding and redirecting from one link to another just to get more and more hits. And in the meanwhile they hope to get a click on a banner ad. Such sites should be banned. There should be strict policy from W3C, browsers and internet backbone servers in combination to block these sites.

  • A website which shows deceiving ads on its pages should never get a compliance.

  • A website that steals the user data (and sells it) without user's explicit consent should be labbled as "thief" somehow. There should be clear mandate on forcing the website to get an explicit consent of the user *each time* they steal the data. There should be transparency on whom they sold the user's data.

These are the real challenges that internet is facing today. I understand that things things are very hard to achieve but then, creating good-for-nothing standard is also pointless. The world will be same with or without such "standards". They will be appreciated only if they can evolve and do something meaningful.

Right now I have yet to see any sane organization asking for W3C standard compliance from me. Only government bodies and alike bureaucratic orgs ask for such a compliance for obvious reason. And when they come across, I go like... Oh Well!

Sunday, May 4, 2014

Loading Speed Behind Website Success - A Myth

Most people - even technocrates and entrepreneurs - think that loading speed of the website is a very major factor behind the success of the website. This is not true. As long as your website is not prohibitively slow it has minimal to no impact on the success of the website. What matters is how you market it, how easy it is to use, how viral it can potentially be on the social media. But ultimately it all boils down to how much its utility is for the end users. Without that, even if you get some breakthrough in the beginning, it will be very hard to sustain the business.

I've observed painstaking slow performance of GMail many times, even FB/Twitter are also slow sometimes. Not to mention many govt websites. But does that mean you stop using it? Never. As long as the website provides adequate utility to you, you will never go away from the website.

There is another myth peddled (mostly) by "visionary" entrepreneurs that if your website is slow then the first time looker will just go away and never come back. From my personal observation this is not true. The first time looker will be much much more patient than a regular user. For example if I want to explore a new website concept, I will take time to explore it patiently. But if I want to check my GMail account and it starts running slow, then I might just lose the patience because it is used to run fast enough regularly.

Unfortunately, this myth has given a lot of developers sleepless nights and ruined the careers of some. While I don't say that websites don't need to be fast... they must be as fast as they can get, but by no means it is a make-or-brake situation. What matters is how you market it and how interesting your website it. Also, I've seen so many entrepreneurs simply abandon the project just because of the slowness of their website. This is wrong. Unless you are creating a search engine, the loading speed is the last factor you should worry about to get your website do business. Given the "mobile trend" of today's world, I would put the factors like "Responsiveness" far higher than speed.

I ask these two questions to every reader of this blog...

1. How many websites you regularly use/visit mainly for its speed?

2. Would you stop using a website that provides more utility to you in comparison to its competitor if it is bit slower than its competitor?

Heck, I dare say even Google Search is not used primarily for its speed but for its search accuracy and utility.

Tuesday, June 12, 2012

Magento - For No One!!!

When you need 17 tables for categories and 67 tables (yes, freaking 67 tables) to manage products in a shopping cart, as a developer you know you have messed up something a big time. That is exactly what Magento has done. What's more? Magento tom-toms about this very "feature" and shows how flexible structure they have got. However, everybody and his aunt knows how flexible or rather inflexible Magento is.

Slow Slow Slow!!!

The fact that Magento has such an insane database structure it's not and is never going to be fast. It is dead slow in comparison to other carts. Their database structure would kill any database engine. - and they know it. That's why they use the ad-hoc solution of cache management. But it never occurred to them that in a heavy traffic site the cache may do the role of evil. Even cache management took them only thus far. It still is slow. It will require special server settings to make Magento run reasonably well.


Magento claim that their's is a highly customizable structure. That must be a jock of the century!! A flexible system would mean that even a less skilled programmer will also be able to understand and customize a program. But that is not the case with Magento. You will need highly skilled programmers not only just to customize it but even to maintain it. A skilled programmer would tweak any system (good or bad) to suit his needs. But in Magento he will take lot more time to do it than a normal system.

For big organization?

It is a popular belief on internet that Magento is for larger organization. How exactly is that? Why exactly an organization needs a crazily overbuilt and hard to maintain system? Just because Magento is doing an easy stuff in ridiculously hard way, it doesn't make it better for a big org. I would think that if you are creating a website for a big org, you will rather create it from scratch to suit all its needs. The open source platforms provide generalized solution and lot of its features you will not want. Neither you will want the same admin panel. But as an organization you will still need lot of customization which will require hacks/patches in the opensource's default code. So if the budget is not a problem, it is always good to go for the customized solution.

For small shops?

A big NO. A Small shops will want a simple solution which is easy to program and maintain. Magento offers none of these. A Magento implementation will cost you much more money than any other simpler opensource. This is because Magento requires special developers and special hosting. And this is just an up-front cost. As you go along the cost of maintaining a Magento implementation will be bigger.

Magento version migration?

Well all I would say is that - Do it at your own risk!!!

EAV Model?


TWKTDEC = The Winner of "Kill The Database Engine" Competetion.

In short Magento is the "Anti Gravity Pen" that nobody really needed and its structure is "Burg Dubai" which is crazily overbuilt and which almost brought down the great empire.

Thursday, June 7, 2012

Setting up CentOS 6.x server for Magento 1.6 on fresh a Rackspace server

I was asked to create a new server on Rackspace to run Magento CE. It was me who had to take the decisions for suitable OS and hardware configuration. I went for CentOS 6.2 simply because I had worked on it before and there was lot of help available on internet for that. Actually I'm not particularly a server guy. I'm a web specialist. So I had to rely on whatever help I can get from internet. I eventually found everything I wanted but I hoped I could get everything under one single link. I learned this in reasonably hard way so decided to put it up for non-server type guys (like me). I know that PHP programmers are often rotten by the deadline and mostly they don't have time to understand why they are doing what they are doing - as long as it works for them. So I will try to make it as easy and as "laymanish" as possible.

So my first choice was simple. CentOS 6.2. Simply because I had 'some' experience on it. The second choice - of hardware configuration - was under my domain. Magento requires minimum 256MB memory limit and they recommend minimum 512M server RAM. Don't go by this number because they simply don't work. In practice you HAVE to have minimum 1GB RAM of server and 512M for PHP runtime. Even that is not enough if you expect sizable traffic on your site. So I created a server for 2GB RAM with 1GB intended RAM for PHP specifically. The rest of the post will assume that you have a CentOS 6.x server set up with 2GB RAM.

Enough with the story? Let's get to the action!!

Step 1 - Install LAMP

1. Login to your server using PuTty or any other terminal tool

2. Open this URL in a browser - . Follow each and every step exactly. This will install Apache, MySql, PHP and PhpMyAdmin to your server. While you are installing PhpMyAdmin will get stuck on the console after showing some log. Don't worry. Just abort the process by typing Ctrl+C. The PhpMyAdmin would have been installed successfully by then. Then follow the rest of the instructions.

3. Since the Apache is installed you will obviously try to open the IP in the URL to see if it shows the Apache's default page. This won't work straight away!! This is because the port 80 is not open. Type following command to open the port 80.

iptables -I INPUT -p tcp --dport 80 -j ACCEPT

4. Since the PhpMyAdmin is installed you will try to open it in the browser. But it will require a password which you donot have. You have to set a password for root user of MySql to get in. For that run the following command.

mysqladmin -u root password NEWPASSWORD

For more information about changing the MySql password visit this link -

5. Php-mcrypt. is required for Magento. To install php-mcrypt you will have to first update the EPEL on your CentOS. By default php-mcrypt is not available in the centOS's repository so you have to get the extended package. In short, run the following command.

rpm -Uvh

NOTE: The epel releases' version keep changing. So in future the above link may not work. Go to to find out the appropriate release. Copy the URL of that location and add to above command. For more information visit this link

6. Now you can install php-mcrypt by running the command - yum install php-mcrypt

7. You need to install the SOAP as well

yum install php-soap

8. Open the /etc/httpd/conf/httpd.conf file and find for "AllowOverride". You will find this in two places. On both it would be set to "None". Change both setting to "All".

9. Run this command to set Mysqld service to auto start on reboot

chkconfig –-level 2345 mysqld on

Step 2 - Install Sendmail

1. By default the sendmail is not installed. So Magento will not send any system mails. You will have to install Sendmail on the server. Command...

yum install sendmail

Then follow the instructions provided in this link

2. SMTP requires the port 25 to be open. Run following command to open it.

iptables -I INPUT -p tcp --dport 25 -j ACCEPT

Step 3 - Memory Limit

Is your Magento running slow? It would be definitely. The problem is the memory. You have got a server of 2 GB RAM (as per aforementioned spec) but your Magento is not utilizing it -  as yet. For that follow the below steps.

1. Increase the memory limit to 1GB in your php.ini file. This file is by default located in /etc/php.ini. And then run the phpinfo file. See if the master value changed to 1GB? Don't worry about the local value as it is coming from the .htaccess file. If master value is changed then you are good to move on to the next step.

2. Change the memory limit from .htaccess file. This will change the local value of memory limit in the phpinfo. Until this is done the Magento will not use anymore memory than the default 256M. Now check the site again. It would be significantly faster.

Step 4 - Install SSL

You can simply follow the instructions given in this link or go by the following steps.

1. Generate the CSR file. Reference this link for more info

2. Send this CSR file to the site owner and ask him to obtain a CRT file using this CSR file from a certificate authority. 

3. Once you have the CRT file use it to install the SSL on your server. For more info refer this link

4. Run following command to open port 443 (for HTTPS) 
iptables -I INPUT -p tcp --dport 443 -j ACCEPT

After all these is done, install your Magento in the document root (by default in /var/www/html/). Your basic Magento should be running fine after performing all these steps. 

Good Luck!! You need it with Magento ... :)

Tuesday, October 4, 2011

Too many MySql connections - Magento

There was a weird problem I faced with Magento on Bluehost server. The site keeps throwing error saying there are too many connections with MySql database with a single user. On contacting the hosting provider they said they allow maximum of 15 concurrent connections for a single DB user. while 15 is not a good number by any means, it's not very bad for a newly started website either. It's less probable that 15 users are attempting connection to the DB at a moment. But the error log consistently showed me this error and it was far too often.

I tried to look at the phpinof.php file to see if there is anything abnormal related to the MySql settings. Yes, there was a surprise for me. The persistent connection was set to ON in that file. Apparently this had to be THE problem. When I checked in the php.ini file there was no such setting so I assumed that it comes from the default php.ini settings. So I set it to off in my PHP.ini file. Since then, I have not faced this problem.

Although this problem is solved for now, I'm sure it is going to come back at some point of time as 15 concurrent connection is not an adequate number. But it gives me a breath for the moment!

Wednesday, September 28, 2011

HTML 5 with Sencha and Adobe Edge

I'm venturing with HTML 5 these days. Currently I'm studying Sencha and Adobe Edge. These two are Flash like softwares which allow you to create animation through GUI program. Basically what you do is just creating number of frames that would combine up eventually to form an animation. Pretty much like flash. I'm really excited about this stuff. I'll keep posting my experiences. Thanks.

The reference links