Cryptic Ideas

A tech blog by Abhishek Sharma

Fix increased duplicate internal links in webmaster

If you are wondering why you see a substantial number of internal links to a page even when you don’t have any anchor tag roaming around with that link, then there is a possibility that anchor tag might have fooled you.

Many frameworks take some id in href attribute of anchor tag to create a functionality based on javascript. For example, if you are using materializecss framework then it tabs are created like this in it:

  <div class="row">
    <div class="col s12">
      <ul class="tabs">
        <li class="tab col s3"><a href="#test1">Test 1</a></li>
        <li class="tab col s3"><a class="active" href="#test2">Test 2</a></li>
        <li class="tab col s3 disabled"><a href="#test3">Disabled Tab</a></li>
        <li class="tab col s3"><a href="#test4">Test 4</a></li>
    <div id="test1" class="col s12">Test 1</div>
    <div id="test2" class="col s12">Test 2</div>
    <div id="test3" class="col s12">Test 3</div>
    <div id="test4" class="col s12">Test 4</div>

Here you can switch between multiple tabs by id’s mentioned in href attribute like #test1. Though it works pretty fine by for crawlers it just have create 4 more internal links of the page on which this code is present. E.g, if this code is present in a html page say hello.html then when crawler comes on hello.html page then it sees 4 links pointing to hello.html again. This is even worse, when such a code is present in header or footer, because that way it will create multiple internal links of every page.

Now, question is why it behaves like this?

Answer lies in fundamentals of html. Any anchor tag having href attribute that starts with # then it treats as a link to same page or a part of same page. Read more about it here

What is the solution for it then

You can opt for any of the following solutions:

  1. Replace anchor tag with something else, if feasible.
  2. Or, remove # from href attribute and use any other replacement.
  3. Or if you really need to keep it this way only, then start your href attribute with javascript:; that becomes href=”javascript:;#test1″

Any of above approach you can take to fix this internal links issue. Be sure to pay special attention to anchor tags while developing a web page. It can either make your website or it can break it for SEO. All you need to understand how to use it properly and efficiently.

How to get Tomcat home directory

If you want to get tomcat’ home directory or catalina’s home directory in which your current web app is running then you can use following statement to get that


Tomcat’s home directory is stored at the Java System Property environment.

How to install latest Nginx, Java, Tomcat and Tomcat Native on Ubuntu 14.04 LTS

When it comes to installing a complete web server on Ubuntu, some get very frustrated because of availability of information in distributed form and that too relating to different version of software which causes some incompatibility issues with one software or other. Keep note of following things:

  1. This installation assumes fresh ubuntu installation.
  2. This blog post does not describes how to setup nginx for setting up websites.

Lets, install latest stable version of all the software including nginx, java, tomcat, and tomcat native. 1. Installing Nginx

sudo apt-get update
sudo apt-get install python-software-properties
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:nginx/stable
sudo apt-get update

You can now check that you have latest stable version of nginx, using:

apt-cache policy nginx

You can make sure that nginx always starts whenever you reboot your machine:

sudo update-rc.d nginx defaults

Now you can install nginx, using

sudo apt-get install nginx

2. Installing latest Oracle Java

For installing latest Oracle Java – use following:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

This will install java in ‘/usr/lib/jvm/java-8-oracle’

3. Installing latest Tomcat

Visit and copy link of tar.gz under Core, use that url for downloading tomcat, e.g,


After downloading use following to extract it

tar -zxvf apache-tomcat-8.0.15.tar.gz

4. Installing Tomcat Native:

Visit and copy link of *.tar.gz for linux, and use wget to download it as well, followed by extraction e.g,

tar -zxvf tomcat-native-1.1.32-src.tar.gz

After that you would need to execute following:

sudo apt-get install libapr1-dev libssl-dev
sudo apt-get install make
sudo apt-get update

sudo ./configure --with-apr=`which apr-1-config` --with-java-home=/usr/lib/jvm/java-8-oracle --with-ssl=yes && make && sudo make install

This would install Native in “/usr/local/apr/lib”

Now, visit extracted tomcat’s bin directory and edit to include following line in the beginning of this file

export LD_LIBRARY_PATH="/usr/local/apr/lib"

After that when you start tomcat, you can see this line written in catalina log under logs directory of tomcat:

Loaded APR based Apache Tomcat Native library 1.1.32 using APR version 1.5.1.



Fix: Error opening wordpress and other php website after PHP upgrade

Recent update in PHP has resulted in error on many smoothly running websites. If you are using nginx as your webserver then you would see some error like below:

unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream

This has been occurred due to a security fix in recent PHP update. I have struggled a lot finding a correct solution for this fix. And thus, I am providing all the resources and steps I had taken to reach a proper fix.

1. Firstly, open /etc/php5/fpm/php-fpm.conf and add following lines in bottom of file:

listen.owner = www-data = www-data

Here, www-data is the user and group of webserver i.e. of nginx in my case. On ubuntu, this is the default user and group for webserver. Make sure that www-data is actually the user the nginx worker is running as. If you are not sure of what is the user and group on your system, then you can execute following command on terminal:

ps aux|grep nginx

2. Make sure that in /etc/php5/fpm/pool.d/www.conf you have

listen =

3. Make sure location block for catching files with the .php extension, in website file inside sites-enabled directory of nginx have block this way:

location ~ \.php$ {
    include fastcgi_params;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

4. You might face error by wordpress website that you do not have mysql module of PHP available. In that case, run following command to update mysql module for PHP:

sudo apt-get install php5-mysql

5. And you are all done now, run following commands to restart PHP and nginx

sudo service php5-fpm restart
sudo service nginx restart

Your websites must be running well and good now.

For more information, you can consult following resources:


Working with a startup is a roller coaster ride

I have only heard from other people or saw in movies how working in a startup company feels like. Today after working in a startup company (Winni) myself for more than a year, I am finally experienced enough to say that it is a thrill ride. It never let you take rest

I have started my journey with a startup named based out in bangalore which has prime focus on building an ecommerce platform which let people buy quality gifts for their loved ones at a very reasonable price. After reading this line you must have thought like I am reading a slogan from this company’s billboard. True😀 I exactly felt like that. But honestly such sentences are lifeline when you are working for a startup. Goals are deeply injected into the veins of core members of a startup, and they further preach it to other people working for that company. It is like a way of gaining self momentum, and finding a path, always, even when you are surrounded with hundreds of problems around you. If you don’t understand what a company is really trying to do, you just can’t contribute to its development.

Being in a startup is not like a normal 10 – 5 job. Here you don’t care about time you spend working in office or on a problem, only thing that you really care about is development. Its about how you are utilizing your time and space in the overall development of the company. It sometimes demands your to start working from 9 in the morning to 10 in the night and sometimes complete night. And you don’t feel anything bad about it. In such cases you are always excited about the end product which will come in front of everyone and how everyone will appreciate your work. For an instance, we were migrating our website on a new server, some time back and when deadline was very close, we were working for atleast 14 hours day and when finally the day came for migration we were up complete night till morning 9 AM and slept thereafter after making sure that everything is working fine and no customer will face any issue. We were not tired at that moment. But very excited about that we have got a new server, made performance specific changes to the website, customers will feel much more comfortable now. We slept with such a sense of happiness.

Now, you might ask, what gain you get working for a startup then. If there is no time and only work work and work. There is no difference if I say that you people are workaholic and you have no personal life. Well ofcourse it is like this only and but I won’t say that a non-workaholic person will not be able to adjust in a startup. A startup does not need you 12-14 hours every day, all it need is your dedication and honesty towards work. If a task is assigned to you, everybody expects you to complete it in a best possible manner which will ultimately help company. You should not do something just for the sake of doing it, but you should enjoy what you are doing. We don’t always work this much but when we need to do then we are happy to give everything in that task. You generally don’t have supervisors in a startup which keep on looking at your work. We just have faith in each and every team member, and this faith is the only foundation which keep a company strong enough to stand by in all faces.

One thing that extremely excites me here is the variation in work that you do. You not always do same work every month or every other week or every other day. There is constant evolution and diversity in the work. Some day you are developing a sophisticated algorithm to find out people interest, other day you are working on SEO, one day you might be doing maintenance on server and other day you are working on data scraping. Diversity of the work is the sole thing which keep you charged up always. There is a constant phase of learning different things. You make mistakes, you learn from them and this cycle goes on. No one here expects you to be 100% good at something, all are amateurs in many things they haven’t done before, and you should not be surprised if they make any mistake. Only thing that matters is how quickly you learn from these mistakes to avoid them in future and finding a more appropriate path for solving that problem next time.

And another important factors which drives you is your team mates. Their amount of faith in you, their confidence, their support and their appreciation is something that you always seek for. If you make something good for company then you always expect a good level of appreciation from your team mates so you will be more excited to bring more such reforms in future. If you make a mistake then their confidence is something that never let you get down and stand again and work hard to make things right. Our team’s integration also gets reflected in our product and services that we provide, by that way a customer feels more reliable being with us.

For example, Winni majorly focuses on cake delivery in bangalore. And as you know cake is something which is mostly given on birthdays and second most on anniversaries. Now, a person sitting far away from bangalore wants to send something to his loved one, say a sister wants to send a cake to his brother on his birthday who is living in bangalore. When she places an order online for something like cake on a very special occasion like birthday then a lot of emotions and feelings of her gets deeply associated with that order. She would definitely like, company delivering that cake should try to convey her feelings with them. Ofcourse you can’t fill her space with that order. But you can provide various services along with delivering a cake. Like you let her send a personal message, written beautifully on a greeting card, or allowing her to select a delivery time while placing the order, or with some innovative service like “Capture the Moment” in which you provide a photograph of person receiving that gift, clicked at the time delivery.

For making things like this work, you need a very good integrity in your team. Because a startup does not live up with a big number of employees, here everyone contributes in best possible way to delight a customer. Otherwise delivering a cake just don’t light up her happiness in this fashion. Being in a company like this which delivers cakes, flowers and more gifts, one thing that you definitely need to understand is the emotions and feelings every customer associates with the order he/she places on Winni.

To pack it up, I would suggest anyone who want to live up a little more than a normal life filled with thrills and excitement, then work in startup once in his lifetime. You won’t regret that step, I could say only this. I am enjoying my time here at Winni, making people delighted and happy by making giving gifts and cakes much more easier and very reasonable. No matter how much distances are, for some relations distances should never come across. And so Winni and I are always here to serve you to make this happen.

How To Remove White Spaces And New Lines From Tag Files In Java

Its very annoying that wherever you use JSP scriptlets or tags, there in final output appears empty space or new lines which take up unnecessary space in final output HTML file.

For removing these spaces you can add following line in your JSP page at very top:

<%@page trimDirectiveWhitespaces="true"%>

But this does not work for output generated by tag files, so for removing new lines and spaces from output of tag files, just add following line at the top of your tag file and its done

<%@tag trimDirectiveWhitespaces="true" %>

How To Test Connection With Various Microsoft Databases Easily

If you are developing some application and trying to connect to any Microsoft specific database like MS-SQL, MS-Access etc. or even an ODBC connection, but getting some error.

Then you might want to test, are you not giving proper credentials to connect to database server or it is some programming error. Then I would like to share a small and easy tip with you.

  1. Create a new text file in windows, name it as test and also change its extension from txt to udl
  2. That’s it, now open this file and you are provided with Data Link Properties window from where you can test your connection with various database sources.
%d bloggers like this: