Modern cameras equipped with GPS receivers add the GPS coordinates to every photographs it takes. Using this data, the exact location where the photograph was taken can be determined. This information can be very useful when archiving or organizing the photographs. The GPS data will be embedded in the photo along with the EXIF header. In this post I will show you how to extract this information and convert it to some meaningful data using PHP.
Tuesday, 17 July 2012
Monday, 16 July 2012
Convert Latitude and Longitude From Degrees Minutes Seconds format to Decimal
Latitudes and Longitudes are mostly represented in the DMS (Degrees Minutes Seconds) format but for many applications, you need the values in decimal format. The decimal values can be easily stored and retrieved from database compared to DMS format. For creating maps using applications like Google Maps, it would be quite simple if you have those values in decimal format. In this post, the steps involved in this conversion are described.
Friday, 13 July 2012
Understanding Latitudes and Longitudes
You might have come across these terms in may be your 8th grade science class or sometimes even earlier. If you are looking for some short refreshment course then go ahead.
Any location on Earth can be described by two numbers, its latitude and its longitude. These are two angles, measured in degrees, minutes and seconds. These are denoted by the symbols ( °, ', " ) e.g. 33° 21' 16" means an angle of 33 degrees, 21 minutes and 16 seconds. A degree contains 60 minutes of arc and a minute contains 60 seconds of arc. You may omit the words "of arc" where the context makes it absolutely clear that these are not units of time. Now lets see how these values are measured.
Any location on Earth can be described by two numbers, its latitude and its longitude. These are two angles, measured in degrees, minutes and seconds. These are denoted by the symbols ( °, ', " ) e.g. 33° 21' 16" means an angle of 33 degrees, 21 minutes and 16 seconds. A degree contains 60 minutes of arc and a minute contains 60 seconds of arc. You may omit the words "of arc" where the context makes it absolutely clear that these are not units of time. Now lets see how these values are measured.
Wednesday, 11 July 2012
Maximum execution time exceeded - Error in PHP
You might have come across a Fatal error stating Maximum execution time of 30 seconds exceeded when running time consuming PHP scripts. Well, PHP sets its default maximum execution time for a script to 30 seconds so that the server is not overloaded running long scripts. But there are times when you need to run some time consuming scripts that does some database maintenance or processing large amounts of data. In such cases you are likely to exceed the 30 seconds time limit. PHP has a built in function set_time_limit which can be used to change the maximum execution time.
Wednesday, 6 June 2012
World IPv6 Launch - 6 June 2012

Tuesday, 22 May 2012
Characteristics of a Network
Every network is characterized by a set of properties or factors that determines the usability of the network. These characteristics may be imposed due to hardware limitations or due to the implementation technique used. The seven major characteristics of a network are described here.
User Applications and Network - Balancing Point
There are plenty of applications that rely on a network for its operation. Applications can effect network performance and, conversely network performance can effect applications. So a careful prioritization has to be implemented so as to maintain a perfect balance between user experience and running cost.
Physical Components of a Network
A network is a collection of interconnected devices and end systems such as computers, servers etc which can communicate with each other. Networks can be found in different types of environments such as home, small office or large enterprises. Every network is composed of a few essential components which are described here.
Saturday, 19 May 2012
Geolocation in HTML5
HTML5 has added plenty of resources that enhances the web browsing experience of its users. As a web developer, the point to note is that implementing these features on your site is much easier compared to what it has to offer. In this post, I will introduce you to Geolocation, a feature with which you can obtain the position in coordinates of a user.
Thursday, 17 May 2012
Replace default Blogger Title With Post Title
You might have noticed that the default title for your blogger pages is the name of your blog itself. The disadvantage of using the default settings is that you will see the same title for all your posts. So if a user bookmarks any of your posts, he will see the blog name as the bookmark instead of the post title. This can also have a negative impact on search results as priority will be given to your blog name rather than what you post. You can easily modify the template to make the title change dynamically according to your posts, which is explained in this post.
Wednesday, 16 May 2012
Import CSV file to a Database using PHP
A CSV file, as the name suggests, contains a list of values separated by comma. The end of each row is marked by a line break. This is one of the oldest file format used in computers and hence is supported in almost all operating systems. In this post, I will describe how to use a CSV file to populate a MySQL database.
Check if Remote File Exists using PHP
You can easily check if a file exists using the PHP function file_exists(), but this function is limited to files within the same server. It will not work if you specify a location on a different domain. In that case you might want to use functions like file_get_contents(). Using these functions will download the whole file just to make sure that the file exists. This will take time and consume more memory. But this might not be what you want. You might just want to check if the file exists and not download it. In this post I have included a function with which you can do exactly the same.
INSERT IGNORE in MySQL
When you try to insert a new record in MySQL and the primary key specified in the insert query already exists, then an error will occur and the query will be aborted. Using the "IGNORE" keyword prevents errors from occurring. The records containing duplicate primary keys are ignored and the rest of the records are added. In the former case, no record will be inserted if such an error occurs.
Tuesday, 15 May 2012
Use PHP with MySQL
The main reason for many web developers to learn a scripting language like PHP is because of the ease with which it can interact with databases. In this post I will show you how to use PHP and the MySQL database to store information on the web and include it into your website. Before you read this tutorial you should have at least a basic knowledge of how to use PHP.
Introduction to AJAX
AJAX stands for Asynchronous JavaScript And XML and is a technique used by web developers to make their web sites fast and dynamic. The advantage of using AJAX is that you can update a part of your webpage without reloading the whole page. That is you can send and receive data to and from a server without refreshing the page. This enables you to minimize data transfer and hence improve performance. Now in this post, lets see how to start using AJAX on your web application.
Monday, 14 May 2012
Tables in HTML
Tables are one of the most common elements that you see on a web page that are used to organize and display data. Using a table, the data can be represented as rows and columns with suitable heading for each. It quite easy to create a table for your web page as it requires the understanding of only a few tags. So, in this post lets see how to create a table in html.
Introduction to Image Maps
Image maps helps us to specify areas in an image that can be clicked and works similar to a hyperlink. This can be used to make web pages more interactive and user friendly. A single image can have a number of regions defined each pointing to a different URL. In this post, all required tags along with examples are given to gain a complete understanding of image maps.
Saturday, 12 May 2012
Add Images To Your Web Page
Images are an important part of every page and adding a few of them will really make your page more attractive. It is quite easy to add an image to a web page, but there are several things to keep in mind while adding images to balance the performance and quality. In this post, I have described how to add an image and also the various parameters that goes along with the <img> tag.
Introduction to HTML Links or Hyperlinks
HTML Links or Hyperlinks are letters, words or images that can be clicked to move from one page on the web to another or to navigate within a single page. These links are responsible for linking one web page to another and make internet browsing easier. In HTML, a hyperlink can be created using the <a> tag. A hyperlink can be made to point to a different section in the same page or to a different page in the same domain or to a different page in another domain. It can also be used to send an email to a specific email address. Continue reading this post to know how all these can be done.
Friday, 11 May 2012
How a Mobile Phone Call is Made
For most of us, a mobile phone is a part of the life, and we use it regularly to make or receive a number of calls. Have you ever wondered how a mobile phone establishes a call or receives a call. If you think yes, then read on. In this post I have tried to explain the steps that occur to establish a mobile phone call. Before jumping to the steps, you need to know some basic terms related to mobile phone communication system which is also given. After that, the steps involved in making and receiving a call is also described.
Wednesday, 9 May 2012
Create JSON from MySQL To use with AJAX
Now a days most websites use the power of AJAX to make their website more lively and productive. To transfer large amount of raw data, that JavaScript can process, the best way is to transfer it as a JSON file. It is quite easy for a PHP script to generate a JSON file from raw data. This data can be received using a suitable AJAX call. As JavaScript can easy parse JSON object, the rest of the processing with the received data can be done using JavaScript.
Saturday, 5 May 2012
Photography - Position Your Subject, Cheat AutoFocus
Do you still take a snap with the subject at the centre of the frame..?? Well, keeping the subject at the centre stage is suitable for stage events and is not always pleasing for a photograph. To make your photograph better, it is sometimes required to move the subject to a side of the frame. There are some simple tricks that you can try to achieve this. Remember, this does not require a costly DSLR, it can be done even with an ordinary point to shoot camera.
Thursday, 3 May 2012
Make a case sensitive MySQL Search
You might have noticed that when you search for a string in MySQL using '=' or 'LIKE' keyword, the search is not case sensitive. That is you will receive all records irrespective of the case (Uppercase or Lowercase). This is advantageous in several cases, but there are situations when you want the search to be case sensitive.
Get the details of an image in PHP
Every image file has a header section in it which describes the size of the image, its type and other parameters. This header can be used to retrieve the image details. It can be helpful in a PHP program either to validate the file type or to prepare the image for output. This function can be used to find the actual file type (GIF, JPEG...) eventhough the file extention provided is different or is not provided. This function can be used along with file upload scripts so that the actual file type can be verified.
Saturday, 28 April 2012
Get Selected Text From a Text Box Using JavaScript
There are times when you need to process the selected text from long text inside a text area or a text box. This can be easily implemented in JavaScript. The starting index and ending index of the selection can be obtained using "selectionStart" and "selectionEnd". The JavaScript function implementation using this is shown in this post.
Guide to Good Programming Habits
From a novice programmer to a veteran, there are a few rules to be followed so that the code you write has a professionalism in it. These might be simple things like adding comments or using proper variable names, but following it in a systematic way will make your code more easy to develop, test, debug and deploy. These rules are applicable to any programming language and making it a habit will help you in the long run. In this post, I will explain a few rules that could be followed.
Sorting Numbers Using Bubble Sort
There are a lot of algorithms available for sorting a set of numbers. Here I will give you the logic behind bubble sort and a c++ function implementing the same. The bubble sort can be used to sort a given set of numbers either in ascending order or in descending order in minimum number of iterations. Bubble sort starts by comparing the first two numbers and arranging them in the correct order, then the next two numbers and again arranging them. This process is repeated for all the numbers in the list a number of times until the list is sorted.
Tuesday, 24 April 2012
Factorial Using Recursion
Recursion can be used instead of looping statements to find the factorial of a number. Recursion can be defined in simple terms as a function calling itself. Factorial of a number is the product of all numbers from 1 to the number itself. Example: Factorial 5 written as 5! = 5*4*3*2*1 = 120. Here let us see a simple program that uses recursion to find the factorial of a number. I will be using C++ syntax, but you may take the logic and change the syntax to suit any programming language. In some programming languages, you might get a stack overflow error if you use too much recursion.
Sum of First n Natural Numbers Using Recursion
Whenever you call a function inside the body of the same function, it is called recursion. This technique can be utilized instead of looping statements to find the sum of first n numbers. In this post, I will show you how to implement this. I will be using C++ syntax, but you may take the logic and change the syntax to suit any programming language. In some programming languages, you might get a stack overflow error if you use too much recursion.
Swap two numbers without using a temporary variable
It is a common question in interviews which involve some algorithmic or programmatic requirements. Even though this logic has got nothing much to do in the real world programming, it helps to check the ability of a candidate to form simple logic.
Swapping two numbers means interchanging the value present in the two variables. Normally it can be done using a third variable using the following algorithm.
Swapping two numbers means interchanging the value present in the two variables. Normally it can be done using a third variable using the following algorithm.
Wednesday, 18 April 2012
Samsung Galaxy Y, A Smart Choice
If you are looking for an entry level smart phone running on android, then the Samsung Galaxy Y is a perfect option. Priced slightly under Rs8000 in the Indian market, this phone is worth the price. Packed with features, yet simple and elegant, this phone is gaining serious attention. This phone with a 3 inch TFT screen and a full touch bar form factor, weighs under 100g and runs on the Android 2.3 (Gingerbread) OS.
Why choose Android?
Android is an open source software stack for mobile devices under Google Inc. The maintenance and development of Android open source code is led by Google. As android is open source, no manufacturer can control the innovations of another. The mistakes of one manufacturer in the code gets corrected by another and hence get improved each time. Major manufacturers like Samsung, LG, Motorola, HTC choose Android OS for their smart phones. Smart phone users also choose Android OS ahead of its rivals. With millions of devices running on android and unlimited android apps available for download, it became the best selling smart phone platform in the world.
Tuesday, 17 April 2012
How to Face An Earthquake
Earthquakes are highly unpredictable and occur without any warning. This causes panic among the people and they run around not knowing what to do. This can some times cause more damage than the earthquake itself. People living in earthquake prone areas like Japan regularly experience earthquakes and they are accustomed to it. They know exactly what to do during an earthquake. India is a country which is not in the list of earthquake prone areas, but things seems to have changed in the past few years.
Common Email Protocols
A protocol can be defined as a set of rules or language for performing a specific task. E-mail has it's own set of rules or protocols to control its travel over the Internet. In order to deal with your email you must use a mail client to access a mail server. The mail client and mail server can exchange information with each other using a variety of protocols. The most common of these e-mail protocols are listed below.
Monday, 16 April 2012
Database - Primary Key And Foreign Key
The primary key of a table uniquely identifies each row in a table. In a table, only one field can be assigned as a primary key. The primary key will be guaranteed as unique in the entire table, that is no two rows in a table will have the same primary key. The foreign key field of a table is used to match the primary key field of another table.
Sunday, 15 April 2012
Basics of IP Address
Every machine connected to a network has a unique identifier.
Computers use this unique identifier to send data to specific computers on a
network. Most networks today, including all computers on the Internet, use the
TCP/IP protocol as the standard for communication on the network. In the TCP/IP
protocol, the unique identifier for a computer is called its IP address.
There are two standards for IP addresses: IP Version 4 (IPv4)
and IP Version 6 (IPv6).
Friday, 13 April 2012
Random String Generator in PHP
There are many occasions where you might require a random string in your application. It may be used for generating a key for an encryption algorithm or just to supply a random password to a user. Here a simple PHP function gen_rand_str() is given which can meet these requirements.
MAC Address - A brief Note
A MAC Address or Media Access Control Address is a unique number given to every Network Interface Card (NIC) which forms the interface between the network and the hardware. It is usually a 48bit number which is hard coded into the hardware during manufacturing. MAC address is written in hexadecimal format and is divided into 6 octets. Typically a MAC address looks like 00:0A:FF:C3:5B:88 or 00-0A-FF-C3-5B-88. It is a globally unique number, that is no two devices will have the same MAC address.
Thursday, 12 April 2012
Validation - Client or Server Side
Whenever data is transferred from a client to the server, it is extremely important to validate the data so as to ensure the secure and successful completion of the process. The question lies with whether the validation has to be done in the server alone or in both server and client side. Which one will be the better and efficient choice. Obviously validation in the client side alone is not at all an option because it can be easily bypassed.
Wednesday, 11 April 2012
Basics of Photography - Histogram
Digital cameras from simple point-and-shoot cameras to professional DSLRs comes with an option to display histogram on the LCD screen. Ever wondered what this graph indicates and how can it be useful in photography? If your answer is yes then go on. You can get your photography skills improved.
Tuesday, 10 April 2012
Common HTTP Status Codes
When a browser sends a request to a server, the server responds with a corresponding HTTP Status Code. This status code can be used to identify the status of the request. You might have seen error messages like 403 forbidden which means you don't have the required authority to view the page or 404 page not found error. A list of commonly seen HTTP status codes and their meaning are listed here.
Saturday, 7 April 2012
MySQL tips for Better Performance
MySQL is one of the most popular database management system preferred by web developers around the world. The ease with which queries can be written and the seamless integration with various web scripting languages is the primary reason for this popularity. Most of the web programmers would have a hands on experience with MySQL. Complex database operations can be written quite efficiently with this open source database management system. This is true for low traffic web applications. But what happens when the traffic goes up? Will your applications perform well at high demands?
Friday, 6 April 2012
Password Strength Indication Using JavaScript
It is a good practice to indicate the strength of the passwords that the users of your website choose so that they can make a secure choice. You can make a password strength indication for your website using JavaScript. A simple JavaScript function to accomplish this is discussed below. It gives a visual indication of the strength using a progress bar and also a textual description.
Progress Bar Using JavaScript
A simple progress bar can be created using JavaScript and HTML which shows graphically the percentage of work completed along with numeric indication. A user defined JavaScript function prog_bar is used here.
On - Screen Number Pad Using JavaScript
It would be quite interesting if you provide an option to enter numbers using an on-screen number pad in your website. Since most of the new mobile devices doesn't come with a separate number pad, it is difficult to enter numbers fast. So providing an on-screen number pad would be a good alternative.
Here I have described a simple on-screen number pad developed using CSS, HTML and JavaScript.
Here I have described a simple on-screen number pad developed using CSS, HTML and JavaScript.
Subscribe to:
Posts (Atom)