Make Headers Jump Links In WordPress Posts

You might have noticed that the , headers in my blog posts are links that can be used to jump to that section. These links are called Jump Links. These Jump Links can be sent anywhere on web for reading that particular section. This is very useful for tutorials as when someone comments a problem, we can use the link to redirect that user to the section where the solution is situated.

[READ MORE]

Add @mentions To Input Fields – jQuery sMention Plugin

Mentioning persons using @ is pretty common on social web sites. Facebook, Google+ and even StackOverflow have the @mention feature. They developed it on their own and doesn’t share the code with others. If you are developing a social site, then it’s better to have this mention feature. I wanted this, but the jQuery plugins I found was too big. The first plugin I found was 20 KB ! This made me create a plugin of my own to accomplish my need.

[READ MORE]

How To Create A Simple Web Crawler in PHP

A Web Crawler is a program that crawls through the sites in the Web and indexes those URL‘s. Search Engines uses a crawler to index URL’s on the Web. Google uses a crawler written in Python. There are other search engines that uses different types of crawlers. In this post I’m going to tell you how to create a simple Web Crawler in PHP. The codes shown here was created by me.

[READ MORE]

How To Check If Internet Connection Exists In jQuery & Javascript

If you are running an app on the web that requires Internet Connection all the time, sometimes the internet connection will fail on the client side and your app won’t properly work. The best example is the New Tab Chrome Apps that will display the URL icons grayscale when offline and will make the icons back to color when online. To check whether the client’s internet connection is online, we use jQuery.

[READ MORE]

How To Change The Browser URL Without Refreshing Page – HTML5

This post was suggested by Sumit Kumar Pradhan. I recently saw many questions like this on Stack Overflow. Let me start explaining, there is already a function in JavaScript to do this special task. The function is window.history.replaceState. It’s a simple function that needs 3 values. This is actually a HTML5 function that came out on July 2012 (I think). All the latest browsers support the new function except IE 9. Download Demo Here is a small example of the usage of window.

[READ MORE]

Create Your Own URL Shortening Service Using PHP & jQuery

I made a URL shortening service a year back using PHP & jQuery. It was pretty simple. You should know the concept of URL Shortening. The concept is simple. When a user sends a request to short a URL, PHP will check if the URL is valid. If it’s valid then PHP will make a string of 5 or 6 characters. A folder is created with the name of this string and an index.php file with header function code is created in this folder.

[READ MORE]

Program to Replace localhost links with website url

If you are working on a project and wants to upload the project to your site, then you have to manually replace all the localhost links with the site url. I created a small Python program that will replace localhost links with your WWW site url. Here is the Python code : #!/usr/bin/python import os indir = ‘/var/www/mysite‘ #!Folder of your localhost site. for root, dirs, filenames in os.walk(indir):  for f in filenames:

[READ MORE]

Preventing double encode of URL in PHP

There is no practical way to check whether an URL is encoded or not to encode if it’s not encoded. But you can do encode the URL by first decoding like below: $string = url_decode($url); And then you should encode as to prevent double encoding. $string = url_encode($url); By doing this we can prevent double encoding of URL‘s.

[READ MORE]

Encode/Decode URL in Javascript and PHP

URL encoding and decoding can be done in both Javascript and PHP. In this post I’m going to tell you the functions used in both languages for url encoding/decoding. Javascript Encoding encodeURIComponent(url); Decoding decodeURIComponent(url); PHP Encoding urlencode(url); Decoding urldecode(url); There is an encodeURI and decodeURI function in Javascript but it won’t encode/decode the url. Note that the the word used in Javascript is URI not URL.

[READ MORE]

How to find Blogger Blog ID

You may need your blogger blog id for various needs. Here’s a simple tutorial on how to find the blog id. Go to your blog dashboard on Blogger. See the url of the page in the location bar. In the page url you can see a text blogID= followed by a number until it stops with #. Here’s a sample url : http://www.blogger.com/blogger.g?blogID=123456789101112#overview/src=dashboard

[READ MORE]