Posts

Showing posts from 2013

Simple Pagination using jquery,mySql and PHP

Image
In this post we are going to learn about pagination using jQuery,MySQL and PHP.This is very simple tutorial.It has four files which are as below. (1) config.php file     - For the database connection details. (2) index.php file     - Main file that display the result to the user. (3) data.php file     - File having code to fetch the data from the table. (4) pagination.js file     - Javascript file for acting as a data controller Download Full Source Create Database table CREATE TABLE IF NOT EXISTS `users`(  `id` int(10) NOT NULL AUTO_INCREMENT,  `FirstName` varchar(200) NOT NULL,  `Middlename` varchar(200) NOT NULL,  `LastName` varchar(200) NOT NULL,  PRIMARY KEY (`id`) ) config.php file Change the values of hostname,username,password and database name <?php $mysql_hostname = "localhost";  $mysql_user = "root";  $mysql_password = "";  $mysql_database = "test";  $con = mysql_connect($mysql_hostname, $mysql_user, $mysql_password) or die("Op

Add Read More Link When Someone Copy Paste Your Content

Image
Few days before when i was surfing for the latest news and I noticed(you may have also noticed that) if you copy and paste any text from the site a reference link is added at the bottom of the copied content,indicating the source from where you have copied that.  I was surprised and was sure that i have copied only content then how that link also copied and then tried to figure out how it happened and how to do it. I figured out that they use a service called " Tynt ". Ya its cool but who wanted to use it.After all we are developers so i just wanted to see if we could make it happen by using JavaScript and hurray it was possible.  One function needs to grab the copied selection, tack on a copyright notice and then add the two to the clipboard.  <script type="text/javascript"> function addLink() {      var body_element = document.getElementsByTagName('body')[0];      var selection;      selection = window.getSelection(); var pagelink = "<br />

Add Meta Description and Meta Keywords in opencart

Image
In this tutorial we will see how to add meta description and meta keywords in opencart.Just follow the steps given below. Step 1 : Add new fields "Meta Keywords" and "Meta Description" in the database In order to add Meta Keywords and Meta Description in pages we first have to add Meta Description and Meta Keywords  fields into the database in the table called as information_description. Simply Run the following query: ALTER TABLE `information_description` ADD `meta_description` VARCHAR( 255 ) NOT NULL, ADD `meta_keywords` VARCHAR( 255 ) NOT NULL Note: please consider if you have database prefix or not.(Example: oc_) if so then use "oc_information_description. Step 2 : Add two Text boxes in admin panel Go to : admin/view/template/catalog/information_form.tpl file and search for the $entry_description code and insert the code given below just before it: <tr>    <td><?php //echo $entry_meta_description;?>Meta Description</td>    <td>

Decrease Page Loading Time

Image
Today we are going to talk about how to improve web page speed or how to decrease the loading time. Generally Users are enamored with speedy websites, and if  any  site responds very  slowly, visitors lose their patience and are less likely to come back. Improvement in page loading speed is not only useful for the site users but also for the search engine rankings as well. Google announced that from now website speed will also be included in their search ranking algorithms. So below are some of the solutions which help you in decreasing web page load time. 1. Website’s  Current Speed Analysis The very first thing that is required  is to analyze your current web  page speed. This will allow you to track improvements and ensure that changes mae by you improves page load times. So many free tools are available to check how much time your site takes to load.Below are a few of them: • Pingdom :  provide an easy  site speed test that which shows the way a page is loaded in a web browser. •

How to open Galaxy S4 configuration emulator

Image
How to open Galaxy S4 AVD: Google has not released Galaxy S4 configured built in emulator. It is not available in android SDK. So it is very tough to test app in this configuration basically for who does not have the real Galaxy S4 device. I don’t have this device but I like to test my app in Galaxy S4. In this tutorial I am trying to help to create Galaxy S4 configuration emulator.    Caution: As Galaxy S4 is not available now in android SDK so it will not give you proper feel and behavior.   To get the same behavior it is recommended to use the real device. S4 device screen is HD so your desktop or laptop screen will have to be HD resolution capability if at least you want to create S4 avd.   How to open Galaxy S4 AVD: At first click on the Virtual device manager and set the following attributes like the image below.   Now you are ready to run your Galaxy S4 AVD.   Problems in opening Galaxy S4 AVD: I have seen many developers complain that they did not able to open S4 co

5 Best tools for Web Developers And Designers

Image
Web designing and web development are two professions that are highly on demand in today’s age and time. With the help of the several tools, web designers and developers are in an advantageous position to create the best looking sites today. Dreamweaver : One of the most trusted web development tools that have been with the developers for a long time is Dreamweaver. It gives users a one-stop-shop feel to designers who can use the tool to create almost any kind of site. Photoshop : Photoshop needs no introduction. From designing attractive logos to creating web templates, this is a must-have tool for all. CoffeeCup Free HTML Editor : CoffeeCup Free HTML Editor is a tool that is perfect for beginners. It has all the basic HTML requirement but a few essential tools are missing such as CSS menu, FTP upload etc. Brackets : Brackets is an open source code editor which can be used by web developers to write HTML, CSS and JavaScript-based code. Foundation by Zurb : Foundation is a

Multiple Images Upload in CakePHP

Image
In this post we will see how to uload multiple images in cakephp.I am going to show the additional code for multiple image handling for both the action Add and Edit.What all you need is to simply copy paste in your application according to needs. My table : posts CREATE TABLE `posts` ( `id` int(10) NOT NULL AUTO_INCREMENT, `title` varchar(200) NOT NULL, `body` text NOT NULL, `image1` varchar(200),  `image2` varchar(200),  `image3` varchar(200), PRIMARY KEY (`id`) ) As you can see what are the fields of my 'posts' table.I have three fields for the images.Example: image1,image2,image3 etc.You may have different fields. Add the code given below for multiple image handling. My uploaded images are stored in  app/webroot/img/uploads/posts  folder.I have one default image called 'no-icon.jpg' in the same folder which will be shown if the correct image is not available or in case of NULL value. Controller : PostsController.php Add Function public function add() { $this->Po

Recursive in CakePHP

Image
Today we are going to learn about Recursive in CakePHP . Using this recursive property, Cake will know about the depth of the result that needs to be generated when find() and read() methods are used.It is needed to set the depth of the retrieval of records associated with a model data so we can limit how much data is fetched from the query in case of multi levels of associations between your models. Lets say for example we have Author module which has many Books.Now you have such case in which you want to retrive the data of the authors plus their books too.So in this case how Recursive play its role? We have Model file for Author having the following code. <?php class Author extends AppModel {    var $name = 'Author'; } ?> and Model for the Book, <?php class Book extends AppModel {    var $name = 'Book'; } ?> Now write the index function in AuthorsController.php file   public function index()    {       $authors = $this->Author->find('all');

10+ android based project ideas for programmers or final year students

Many of us interested to develop mobile based application instead desktop based application. You think that you will develop mobile based application especially for android for your final semester project or for fun. But you can't  even think what you should do or should not do. What types of project you can take as you are beginner or don’t know about it. May be searching internet you will not get huge information on this topics. In this discussion I will try to provide you 10+ android based project ideas by which at least you can understand the trends of android project. I will start with some fundamental android project idea and then I will try to provide you some advance project idea that will help you to be a professional android application developer.    In android developer site you can get 20+ sample projects . These projects are one of the best resources for learning android application development. You can take a look on these projects before reading it. So now we can st

Top 5 E-Commerce Themes For Drupal

Image
Drupal is a stable and robust e-commerce platform that is extensively used to run shopping portals. Coupled with the fact that Drupal is also open source and easily available, it is one of the most used platforms along with WordPress, Joomla and Magento. You can easily get extensive range of e-commerce themes for Drupal and make the most of them for your business. 1. BigShop : Developed by TabVN, BigShop is a responsive Drupal theme that can be used to run a sturdy and attractive e-commerce platform. BigShop uses Drupal Commerce module along with API payment method add-to-wishlist, Tax calculation support, product rating etc. 2. Spotlight : The theme is compatible with the latest Drupal version 7. Developers can use the theme to design portrait or landscape designs mainly for the mobile version using the Spotlight theme. 3. Retail Shop :  To add freshness and clarity to designs, Retail Shop is a good theme for Drupal e-commerce. Created by ThemeSnap, Retail Shop supports important m

SVC handlers missing in IIS on Windows8

Image
A quick tip. I recently upgraded OS to windows 8 and installed both VS2010 and VS2012. Post that, my svc files stopped working in IIS and threw a 404 not found error. After a little struggle I found that .svc mappings were missing in IIS and the easy way to restore them is: 1. Open Control Panel 2. Select "Turn windows features on or off" 3. Expand.NET framework and check HttpActivation for WCF and you're done!

Dynamic Fields Validation in CakePHP

Image
In this post we'll learn about dynamic fields validation .Generally validation is achieved by placing the validation rules in the model file.You can get the idea of how validation rules are written in model file by the example given below. <!-- file:app/models/yourmodel.php --> var $validate = array( 'name' => array( 'notempty' => array( 'rule' => array('notempty'), 'message' => 'This field is required..!', //'allowEmpty' => false, //'required' => false, //'last' => false, //'on' => 'create', ), ), 'SRRP' => array( 'numeric' => array( 'rule' => array('numeric'), 'message' => 'This field is required..!', //'on' => 'create', ), ) ); But here,the fields (Example: name,SRRP) are static fields.Following lines of code were written in view