Simple Star Rating System With jQuery

jQuery Star Rating System

This is jQuery plugin for star rating systems.The code below is modified of original script to make it simpler for you to develop a star rating in your application.

 

Check the demo below

hover and click events on stars to change there state

[code lang=”js”]
$(‘#star1’).rating(‘www.your-url.php’, {maxvalue:1});

$(‘#star2’).rating(‘www.your-url.php’, {maxvalue:1, curvalue:1});

$(‘#rate1’).rating(‘www.your-url.php’, {maxvalue:5, increment:.5});

$(‘#rate2’).rating(‘www.your-url.php’, {maxvalue:5, curvalue:3});
[/code]

 

Find the complete package of Simple Star Rating by the below link:

jQuery-star-rating.zip

Drawbacks of AJAX

AJAX(Asynchronous JavaScript And XML) is nothing but a technique which uses the JavaScript and XML together to provide the flexibility in interactive web pages. It is used to send a request to the server using the XMLHttpRequest and use the result sent by the server in the web page.

 

Once you use an application built with AJAX, it’s easy to see the benefits: The page reloads time are reduced, and features such as automatic type-ahead facilitate data entry, user experience improves but there are some drawbacks of AJAX, you should take care before developing a page using AJAX.

 

AJAX is using JavaScript it may not work when the JavaScript is disabled.
Any user whose browser does not support AJAX or JavaScript, or simply has JavaScript disabled, will not be able to use its functionality. Similarly, devices such as smart phones, PDAs, and screen readers (very much popular now a days) may not have support for JavaScript/XMLHttpRequest object (AJAX), so a user must take care as a reference point for developing applications that are accessible to everyone.

This requires extra development time to deliver an alternative solution (using the NOSCRIPT tag), when a user has disabled JavaScript support within their browser.

 

Not all browsers support AJAX.Though IE 5.x, 6.x, Mozilla 1.x, Firefox still supports.
Browsers use the different objects to handle this technique, you have to code for each browser, XMLHttpRequest is not supported in older version. No standardization of XMLHttpRequest yet.

 

The Really Simple History (RSH) JavaScript library highlights another major issue with Web applications that use AJAX. There is no browsing history, so Back/Forward buttons become useless.
Pages are dynamically updated (do not automatically register themselves with the browser’s history engine) using the AJAX, when the back button is pressed the full information on the page may not be reflected. The browsers don’t remember the partial page refreshes being done by using AJAX.

 

Bookmarking becomes difficult with AJAX. This is because of the fact that in the browser address bar URL remains same when AJAX requests are sent.
Dynamic web page updates also make it difficult for a user to bookmark a particular state of the application.

 

Use of JavaScript slows down the application. There is definitely a performance difference between showing a static HTML page than processing JavaScript events. The older generation of browsers is really awful in this context. Hence this is one of the serious AJAX drawback for browsers like IE6.

 

One of the drawback is that AJAX based applications are difficult to debug than synchronous applications (which use PHP, JSP, Servlets for complete page refreshes).Though there are tools and browser extensions or plugins/addons to debug AJAX code (Firebug, Fiddler2 etc.)

 

The AJAX code is written in HTML or js files and these are downloaded by the browser. So anyone can see your source code for generating AJAX requests. Once the hackers know the URL and parameters to generate AJAX requests, they can very easily generate hoax in AJAX requests to your server.

Like any other application that uses the HTTP protocol, data is sent as clear text. For this reason, no sensitive data should take a ride via HTTP using AJAX or any other technology.

 

Due to the asynchronous nature, now user can keep on generating requests even when he has not received response for earlier requests. This can lead to scenario where more requests are generated than the server can handle and hence you are forced to increase the capacity of your servers.

 

AJAX is a lack of interaction with search engines.
If you are developing an application and then thinking of making it seo optimized then better don’t use AJAX (or use minimal), because the search engines don’t understand AJAX and they need a proper URL for indexing the content which is one of the AJAX Drawbacks for websites that want to reach out in search engine results.

 

Server load and bandwidth can be an issue when delivering AJAX-based applications. These applications often use AJAX to provide features like type-ahead searching in text boxes or loading data in the background. The user may see fewer page reloads, but the server calls are still there.

It is worth considering whether the back-end server can handle countless simultaneous calls to the server when many users are using the type-ahead feature. Displaying interim messages like “Loading” can alleviate user concerns because this lets them know something is happening rather than being presented with a blank page.

 

 

Be sure to consider the above potential issues with AJAX before putting it to use in your application. A hybrid approach is usually the best solution with AJAX because it provides certain features in the UI and other technologies used in other facets of an application.

 

 

Have you encountered with delivering AJAX-based solutions? Share your experience with ScriptArticle.com.

 

 

 

Alternate of Google Map

Even Google Map is free to use and have a large library and blogs to help. It’s good news for developer that there are more Maps Library available now to integrate in your application 🙂

 

Don’t worry to increase or learn new library of Maps, as each Map library have some unique feature, so match your requirement and integrate the Map that best suit to your requirements.

 

The Advanced functionality of these Maps are available on their website, I am also adding the URL of the Map API library.
Go through from these and increase your knowledge about the MAP.

 

1. Microsoft Bing
http://www.microsoft.com/maps/
Microsoft’s Bing Maps gives you a rich set of tools to help you create amazing map experience. Choose from our super fast AJAX Control 7.0, REST Services API.A unique feature of Bing maps is their ‘Bird’s eye’ view, which gives aerial views from several perspective angles.

 

2. Nokia (Yahoo Maps)
http://developer.here.com/
Nokia purchased Navteq (one of the major suppliers of map data) in 2007, and has been powering Yahoo maps since 2011.It provides APIs for mobile applications and web browsers.
JavaScript API, REST API, Mobile HTML5 Framework, Java API, Qt API is available & working fine for Nokia Maps.

 

3. MapQuest
http://developer.mapquest.com/
MapQuest is the company that lets you choose between using licensed maps or open maps. Even using licensed map data, it has free accounts with no limits on map views. However, it does limit you to 5K calls per day for routing (including for multiple destinations), geocoding, and search.

 

4. OpenLayers
http://openlayers.org/
OpenLayers makes it easy to put a dynamic map in any web page. It can display map tiles and markers loaded from any source that shows how flexible and powerful API designed to be used in advanced mapping applications.OpenLayers has been developed to further the use of geographic information of all kinds. OpenLayers is completely free, Open Source JavaScript. It is a mature API with lots of features, but it can be difficult to use in mobile applications since it was designed before they became popular.

 

5. Leaflet
http://leafletjs.com/
Leaflet is a modern and newest open-source JavaScript library for mobile-friendly interactive maps.
Many of the companies switching away from Google Maps use the Leaflet API. It was designed to work well with both desktop and mobile applications and is small and fast. Being newer, it is not as powerful as some of the other APIs, but what it lacks in features it makes up for in flexibility. It has a powerful object model that makes it easy to add features or customize existing features to your needs.

 

6. Modest Maps
http://modestmaps.com/
As its name implies, Modest Maps is a small, extensible, and free library for designers and developers who want to use interactive maps in their own projects. It provides a core set of features in a tight, clean package with plenty of hooks for additional functionality. There are lot of ports, including for Python, PHP, Processing, and Open Frameworks facilitate using Modest Maps in desktop (non-browser-based) applications, native mobile applications, and on servers.

 

7. Polymaps
http://polymaps.org/
The goal of Polymaps is to better support rich, large-scale data overlays on interactive maps by extending the tile metaphor to vector graphics.
Other APIs use image tiles to render maps, but they still need to display geographic information (such as markers and routes) by rendering it directly. Map data can be loaded using standard formats such as GeoJSON and rendered directly.

 

If you have gone through the documentations of these all, you have found that every Map API is unique in his way, so choose the best suits.
Anyway, if you think Google Map is more better then these all, go ahead with Google Map 🙂

 

Really Simple Syndication (RSS)

RSS (Really Simple Syndication) or Rich Site Summary is a format of data for delivering regularly changing web content.Without RSS, users will have to check the site daily for new updates that is very time-consuming.Since RSS data is small and fast-loading, it can easily be used with services like as cell phones or PDA‘s also.

 

An RSS document (which is called a “feed”, “web feed”, or “channel”) includes full or summarized text, plus metadata such as publishing dates and author information.

 

A standardized XML file format allows the information to be published once and viewed by many different programs.They benefit readers who want to subscribe to timely updates from favourite websites or to aggregate feeds from many sites into one place.

 

As RSS files are essentially XML formatted plain text, the RSS file itself is relatively easily read both by automated processes and by human.This could be placed on any appropriate communication protocol for file retrieval, such as http or ftp, and reading software would use the information to present a neat display to the end user.

[sourcecode language=”plain”]
<?xml version=”1.0″ encoding=”UTF-8″ ?>
<rss version=”2.0″>
<channel>

<title>ScriptArticle.com</title>
<description>This is an example of an RSS feed</description>
<link>http://www.scriptarticle.com</link>
<lastBuildDate>Sun, 15 Apr 2012 02:57:45 +0000</lastBuildDate>
<pubDate>Sun, 15 Apr 2012 02:52:32 +0000 </pubDate>
<ttl>1800</ttl>

<item>
<title>Example entry</title>
<description>Here is some text containing a description.</description>
<link>http://www.scriptarticle.com/</link>
<guid>unique string per item</guid>
<pubDate>Sun, 15 Apr 2012 02:52:32 +0000 </pubDate>
</item>

</channel>
</rss>
[/sourcecode]

 

Quick view to RSS

  • RSS stands for Really Simple Syndication
  • RSS is written in XML
  • RSS defines an easy way to share and view headlines and content
  • RSS allows you to syndicate your site content
  • RSS files can be automatically updated
  • RSS allows personalized views for different sites

 

Benefits of using RSS

It allows you to easily stay informed by retrieving the latest content from the sites you are interested in.You save time by not needing to visit each site individually.
With RSS it is possible to distribute/spread up-to-date web content from one website to thousands of other websites around the world easily.

 

RSS of articles of scriptarticle.com
http://www.scriptarticle.com/feed/

 

RSS of comments on articles of scriptarticle.com
http://www.scriptarticle.com/comments/feed/

 

JavaScript function equivalent to PHP’s str_replace

Below is the JavaScript function worked like PHP’s str_replace.

[code lang=”js”]
<script type="text/javascript">
function str_replace (search, replace, subject)
{
var result = "";
var oldi = 0;
for (i = subject.indexOf (search); i > -1; i = subject.indexOf (search, i))
{
result += subject.substring (oldi, i);
result += replace;
i += search.length;
oldi = i;
}
return result + subject.substring (oldi, subject.length);
}
</script>
[/code]

 

You can find more equivalent JavaScript function same as it works for PHP.

 

You can get the library of these functions by php.js or can directly download by below link.

Download php.default.min.js

 

PHP email validation function & file extension validation function

Very easy and handy to use PHP email validation function and File type validation function/methods.

Email validation

[php]

<?php

/**
* Function for email validation
* @param string $email
* @return boolean
*/

function valid_email($email) {
$result = true;
if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$", $email)) {
$result = false;
}
return $result;
}

?>

[/php]

Image File extension validation

[php]

<?php

/**
* Function for checking the image (by extension)
* @param string $file_name
* @return boolean
*/

function is_image_file($file_name)
{
$arr_img = explode(‘.’,$file_name);
$image_extension = end($arr_img);
//    array of all the allowed extensions
$image_extensions_allowed =array(‘jpg’,’jpeg’,’png’,’gif’,’JPG’,’JPEG’,’PNG’,’GIF’);
if(in_array($image_extension,$image_extensions_allowed)){
return true;
}else{
return false;
}
}

?>

[/php]

read out some more ready to use PHP validation functions/methods.