Category Archives: Internet Marketing

CDN: Content Delivery Network Overview

Content Delivery Networks (CDN)

 

Hi Everybody, I think you all aware about the CDN (Content Delivery Networks).

 

If not, don’t worry I am going to explain you what is CDN and how it works and how to know whether you site need CDN or not.

 

In Short: A content delivery network (CDN) places files in different locations so that the person using your webpage can receive the nearest copy.

 

Let’s discuss more about CDN?
A CDN (content delivery network) is a system of distributed servers (network) located in different parts of the globe that stores files to be used by your website visitors, It deliver web pages and other Web content to a user based on the geographic locations of the user, the origin of the webpage and a content delivery server may differ.

 

The reason why it used is, there is a measurable amount of waiting time (webpage load) for a website user who is visiting a page that may be hosted thousands of miles away. There are also routing issues that can occur when a user is visiting such a webpage. If someone in Jaipur is using a webpage that is hosted in London they are seeing a slower version of that webpage because of the above mentioned routing issues and sheer distance the files have to travel.

 

By having your files on several servers across a geographical area you can make sure the user is loading files that are near them, not all the way across the country or ocean.

This service is effective in speeding the delivery of content of websites with high traffic and websites that have global reach. The closer the CDN server is to the user geographically, the faster the content will be delivered to the user. CDNs also provide protection from large surges in traffic.

 

How it works?
In a CDN, content exists as multiple copies on strategically dispersed servers. A large CDN can have thousands of servers around the globe, making it possible for the provider to send the same content to many requesting client computing devices efficiently and reliably even when bandwidth is limited or there are sudden spikes in demand.

 

Whenever a visitor request a webpage to open, the CDN will redirect the request from the originating site’s server to a server in the CDN that is closest to the user and deliver the cached content. The CDN will also communicate with the originating server to deliver any content that has not been previously cached.

 

CDN management software dynamically calculates which server is located nearest to the requesting visiter and delivers content based on those calculations. This not only eliminates the distance that content travels, but also reduces the number of hops a data packet must make. The result is less packet loss, optimized bandwidth and faster performance which minimizes time-outs, while improving overall user experience (UX) and site health. In the event of an Internet attack or malfunction at a junction of the Internet, content that’s hosted on a CDN server will remain available to at least some users.

 

The process of bouncing through a CDN is nearly transparent to the user. The only way a user would know if a CDN has been accessed is if the delivered URL is different than the URL that has been requested.

 

Why the CDN is so much popular now a days?
The real reason that so many businesses and webmasters are now using CDNs is because Google has started using page speed as a ranking factor. Content delivery networks however provide a faster experience for users, and that means happier users who buy more things and click more ads. An additional reason for CDN use is the explosion of tablet and mobile users who depend on speed more so than desktop users who have stable internet connections.

 

Does your site need a CDN?
Content delivery networks are used for B2B interactions and in serving content to consumers. CDN is well suited for delivering large streaming audio, video, and Internet television (IPTV) programming, although an Internet service provider (ISP) may also use one to deliver static or dynamic Web pages.

 

You can also host your site on CDN, below are some outstanding improvement if CDN used:

  1. Improvement the page speed
  2. Amazing site performance for your users
  3. Make your site mobile ready and available for some geographical user even server is going down or slow.

 

Some types of websites I not recommend for CDN:

  • Local business sites (DJ, restaurants, city hair salon, city shops etc.)
  • Websites that have their main visitors or traffic in only one geographic region.

 

How much it costs for you?
CDN is a paid service provided by many hosting providers and just like every web service offered, there are almost levels of cost for content delivery networks from free to thousands of dollars depends on the service they provides.

 

Below are the list of some CDN provided listed according to popularity (visit their website for more information, cost and configuration/setup along with customer service).

  1. Akamai
  2. Max CDN
  3. Amazon CloudFront
  4. CloudFlare CDN (this has free option as well)
  5. CDNetworks

 

How do you set a CDN up?

Whenever you buy a CDN it provide a complete guide and customer service for setting it up. However below are some steps that generally followed.

 

Sign up for a service

 

Know what files you are using :
In many cases you are using a CDN to serve things like your images, CSS, and JavaScript files. Such files cause many problems for your users visiting your website from far off places. Having these assets on servers closer to your users is the entire point of having a content delivery network. There are different offerings from different CDNS, but in most scenarios your HTML will come from your webhost and your assets will come from the CDN.

 

Getting your files to the CDN servers:
You will need to get the files you want to serve to the CDN web servers. Some places will have options to do it for you almost automatically, some won’t.

Many have automatic setups if you are using WordPress, Joomla, Drupal or other common CMSs (content management systems). The basic premise however is the same across all CDNs. You will need to have your files hosted by the network and this is usually a one step process of loading those files somewhere once and the content delivery network will then replicate those files across their network.

 

Decide on how to name your URLs (CNAME):
Once your files are on the CDN servers they will have a different URL than they once did. Let’s take an CSS fill as an example. Your old CSS file was at “examplesite.com/css/style.css”, well now that you are using a CDN your CSS file is located at a URL that may look as ugly as this “dfg23345678449dhhty74/style.css” ūüôĀ

 

Instead that name you can choose to use a name of our own choosing (the most common being “cdn.examplesite.com”) and then use something called CNAME to make sure it looks correct and nice to our users. This is a simple step that will result in our CSS file coming from “cdn.examplesite.com/style.css”.

 

Ensuring your web pages are calling (using) the files you sent to the CDN:
You can basically just tell your CMS to swap out the files automatically using common caching systems. An example for WordPress would be to use W3 TOTAL CACHE. Any blog should be using a caching system already and if your isn’t then your blog is probably slow. Using caching properly is an important step in improving page speed and will offer massive benefits to your users.

 

Testing after setup:

Most CDNs will have a page or dashboard where you can see the usage of your files. Other ways of testing would be to use webpagetest.org.

 

Whether it affect my website SEO (Search Engine Optimization)?

Yes, in some extent as the file name changes it is going to scare you :-). However the reputable CDNs have good solutions for any common SEO problems.

 

I think above article will help you to understand the CDN and host your site on CDN and some common configuration settings.

 

Share your WordPress page URL on social networking website by using a simple function

Share your WordPress post on facebook & other social networking website.

 

If you want to share your WordPress page URL on social networking website, it’s very simple to do.

Just place this function in your functions.php file, and call the function where do you want it to show.

 

<?php

function GetShareLinks() {
 
/* Your current page URL */
 $URI = get_permalink();
 
/* The js script used for goolge plus share button */
 $sharestring ='<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>';
 
$sharestring .='<a href="https://pinterest.com/scriptarticle/" target="_blank"><img width="16" height="16" alt="Follow Me on Pinterest" src="http://passets-lt.pinterest.com/images/about/buttons/small-p-button.png"></a>
 <a href="http://www.facebook.com/sharer.php?u='.$URI.'"><img src="'.get_bloginfo('template_url').'/images/facebook.jpg" alt="" /></a>
 <a href="http://twitter.com/intent/tweet?text='.$URI.'"><img src="'.get_bloginfo('template_url').'/images/twitter.jpg" alt="" /></a>
 <a href="http://www.linkedin.com/shareArticle?mini=true&url='.$URI.'"><img src="'.get_bloginfo('template_url').'/images/in.jpg" alt="" /></a>
 <g:plusone count="false" size="small"></g:plusone>';
 
return $sharestring;
 
}

?>

 

You can also use this function in other website (non WordPress) site, you have to just replace the get_permalink() function by current page URL and update the social icons images path.

 

If you face any issue to use this, put your comment, I’ll help you ūüôā

 

Use of Environment variables

Environment variables windows

 

Environment variables are a set of dynamic named values that can affect the way running processes will behave on a computer.

 

You can say, It is a dynamic “object” that stores a value, which in turn can be referenced by one or more software programs in Windows (OS). Environment variables help programs know what directory to install files in, where to store temporary files, where to find user profile settings, and many other things.

 

Variable names are NOT case sensitive in Windows OS.

 

Environment variables are dynamic because they can change. The values stored can be changed to match the current system’s setup and design (environment). They can also differ between computer systems because each computer can have a different setup.

 

There are a number of environment variables that get referenced by programs and can come in handy for a computer user to find needed information about their computer environment.

Below is the list of some common and important environment variables.

 

%appdata%
%commonprogramfiles%
%local%
%localappdata%
%programfiles%
%temp%
%userprofile%
%windir%

 

You can get some common information using environment variable quickly.

 

You can quickly access any of the above folders by entering the environment variable in the Windows Run box or Windows Search Box.
e.g: To get into the Application Data folder type %appdata% and then press Enter in the Run box.

 

%appdata%
The %appdata% environment variable contains the directory path to the Application Data folder for your user profile. This folder stores settings and logs, among other things, for various software programs. The settings and logs stored there are specific to your user profile.

 

%commonprogramfiles%
The %commonprogramfiles% environment variable contains the directory path to the Common Files folder, within the main Program Files folder. This folder contains various files for common programs and utilities on a computer, mostly system and services related. The default directory path this variable points to is c:\Program Files\Common Files.

 

%local%
The %local% environment variable points to where the security policies & rules are located for the user’s account, Windows in general, Windows Firewall, Network, and various software programs on the computer. This environment variable is native to Windows 7.

 

%localappdata%
The %localappdata% environment variable contains the directory path to where programs store their temporary files. Common temporary files to be stored here are Desktop Themes, Windows Error Reporting, program caching and Internet browser profiles. This environment variable is native to Windows Vista & Windows 7.

 

%programfiles%
The %programfiles% environment variable contains the directory path to where programs are installed. This directory contains sub-directories for each program, which contain the primary files needed by each program in order to run on a computer. The default directory path this variable points to is c:\Program Files.

 

%temp%
The %temp% environment variable contains the directory path to where temporary files stored. These temp files are often Internet temporary files and other user application temporary files (Microsoft Word, Excel, Outlook, etc.).

 

%userprofile%
The %userprofile% environment variable points to the current logged in user’s profile and the directory where user profile data is stored. It is in this directory that a user can find the following folders: My Documents, My Music, My Pictures, Desktop, and Favorites (Internet Explorer bookmarks).

 

%windir%
The %windir% environment variable points to the Windows directory, where Windows system files are located.The default directory path for most versions of Windows is c:\Windows (for Windows NT 4 and 2000, it is c:\WinNT).

 

Automatically set permission to various file types using .htaccess

Set file permissions with .htaccess, this is a great method for ensuring the CHMOD settings for various file types.

 

Apply the following rules in the root .htaccess file to affect all specified file types, or place in a specific directory to affect only those files (add/update file types according to your needs)

# ensure CHMOD settings for specified file types
# never set CHMOD 777 unless you know what you are doing?
# files requiring write access should use CHMOD 766 rather than 777
# keep specific file types private by setting their CHMOD to 400

chmod .htpasswd files 640
chmod .htaccess files 644
chmod php files 600

 

Require SSL (Secure Sockets Layer)

Here is an easy way you can go using .htaccess file

# require SSL without mod_ssl
RewriteCond %{HTTPS} !=on [NC]
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]

 

Guys, If you still face any issue regarding this, leave a comment in the comment box.

 

Get live currency rates in PHP and currency conversion using APIs

Get live currency rates in PHP & conversion using APIs

In the below method, we get live currency rates from Google.
This function uses CURL so make sure you have enabled curl extension in php.

 

Google has an inbuilt calculator which can also be used for converting a currency into another.Doing so is really simple, you just type “AMOUNT”, “CURRENCY_CONVERTING_FROM” in “CURRENCY_CONVERTING_TO” and search, the inbuilt calculator will give you the result.

Try this
http://www.google.com/finance/converter?a=1&from=USD&to=INR

 

Google also has a secret calculator API (http://www.google.com/ig/calculator) that is usually used for iGoogle gadgets, but its free and open, anyone can use it.
So if you want to convert a currency into another using the API, you can grab the below code.


<?php

function get_currency($from_Currency, $to_Currency, $amount) {

$amount = urlencode($amount);
$from_Currency = urlencode($from_Currency);
$to_Currency = urlencode($to_Currency);

$url = "http://www.google.com/finance/converter?a=$amount&from=$from_Currency&to=$to_Currency";

$ch = curl_init();
$timeout = 0;
curl_setopt ($ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt ($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)");
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$rawdata = curl_exec($ch);
curl_close($ch);
$data = explode('bld>', $rawdata);
$data = explode($to_Currency, $data[1]);
return round($data[0], 2);
}

// Call the function to get the currency converted
echo get_currency('USD', 'INR', 1);

?>

 

You can also do same by using live currency Value from yahoo finance (http://finance.yahoo.com/)

Here is an example to get the value of US Dollar in Indian Rupees.


<?php

$from   = 'USD'; /*change it to your required currencies */
$to     = 'INR';
$url    = 'http://download.finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s='. $from . $to .'=X';

$handle = @fopen($url, 'r');
if ($handle) {
$result = fgets($handle, 4096);
fclose($handle);
}
$allData = explode(', ', $result); /* Get all the contents to an array */
$dollarValue = $allData[1];
echo 'Value of $1 in Indian Rupees is &#8377; '.$dollarValue;

?>

Integrate Twitter Widget to add to your website

The twitter updates are always short – under 140 characters each. Plus, one can post updates and follow her friends using the Twitter website, software on his browser, a mobile phone or instant messages. People¬†aren’t¬†tied to one device. This makes the twitter so popular.

 

It has grown far beyond its microblogging roots to become a fabulous tool for social messaging.

Many people use Twitter clients to update their status and read tweets, but there are also a host of useful Twitter widgets that allow you to check your tweets from your blog/website or even let people re-tweet your blog entries.

 

Display your Twitter updates on your website like this.

twitter-widget

This is one of Twitter widgets that will let you take your status updates and put them up anywhere that allows custom widgets. The great thing about the Twitter Profile Widget is that you can put your tweets on a loop.

 

Twitter provide very rich widgets, where you can easily manage it’s width, height, background¬†colour, text¬†colour, links, number of tweets, loop scroll¬†etc.

 

You can produce the code by follow the below link
https://twitter.com/about/resources/widgets/widget_profile