Sunday, July 21, 2013

Tech Projects that can redefine our daily life

Kickstarter, one of the biggest project funding websites in the WWW always introduce awesome projects that make us say "WOW! Wish I had it now!" Here are some projects that have gone live recently


Generate power while walking! It often happens that we forget to charge our phone and leave for the awesome stuff to do outside(not for me, I am computer addicted geek. Its not that I don't go out or something, I do, but, well, you know..).. Coming back to the point, the phone I had was draining battery like hell(yea, I have mid budget smartphone). Now, I need a power source. Well, SolePower comes to be an exciting point here. You generate power while walking. Just walk a few miles and your phone is charged. Awesome isn't it?


A bulb that we can control over Wi-Fi with an iPhone or an Android smartphone. Its multicolored, energy efficient and basically, really, an awesome idea. The inventors say that it will last for 25 years. Well, its cool enough that I get my hands on it only once.

An actual personal assistant. There are lot of personal assistant apps that are on Android and the leader Siri on iPhone. But, ivee Sleek is actually a wifi enabled assistant that can set alarms and reminders, tune into radio and also read you a bed time story!

Whats more? If  you have any more projects, share them with me in the comments section!

Thursday, July 18, 2013

Developing an eMail validation system using PHP and MySQL

Well, its great that we do create websites that require sign up from users. To prevent random sign ups and span, developers have developed an email verification system. This system can be seen in almost every website throughout the WWW. In this article, I am going to show you how you can develop a simple script that validates email address.
Firstly, let me explain the database structure:
The name of the database is test, and the name of the table is email. The field email is considered unique. The activatecode contains the corresponding activation code for email generated while the user was signing up. The field activatestatus is self explanatory. It contains one character either Y or N to denote the activation status.

Now, recipe that we are going to use to cook this script is the HTTP GET. PHP can read the GET instruction from URL and convert it into an associative array. The same thing we are going to use in this tutorial.
Let's Code!
//Initializing database connection starts
$host = 'localhost';
$user = 'test';
$password = 'test';
$database = 'test';
$con = mysqli_connect($host, $user, $password, $database);
    echo mysqli_error ($con);
//connected to the database
//you can check if URL is in the correct format or not before whatever we are going to do here
$key = $_GET['key']; //key will be the URL parameter
$email = $_GET['email'];//for security, we will also consider email as the paramaeter
$query = "Select * from email where email='$email'";
$result = mysqli_query($con, $query);
$assoc = mysqli_fetch_assoc($result);//an associative array is fetched for better understanding
//as email is a unique field it will only fetch one 1D array
if($key = $assoc['activatecode']){
    $query = "update email set activatestatus='Y'";
    $update = mysqli_query($con, $query);
    if(!$update) echo mysqli_error ($con);
    else echo 'activation successful';
else echo 'Either the Email is wrong or the associated key is not with the email';

Now that we have coded, here's how to change the activatestatus of a given email. Just point your URL to

You email will be activated.
Download this script!
More coding at Let's Code
Warning: This is for testing purposes only. I am giving you this tutorial as an advanced example on how to use several functions in PHP and running appropriate querys in MySQL using PHP. Do not publish!

Sunday, July 14, 2013

Creating own URL Shortner

Well, we have seen many websites like,, and also the $$ earning and Ever wondered how these systems work?
Well, I don't know how exactly do they work, but I can show you how to create something like those websites.
The concepts that we will be using to create own URL shortner are: MySQL access functions in PHP, and the header function in also, PHP.

First we need to set up a MySQL database containing two columns more importantly. Here is the SQL query for the same
CREATE TABLE shorturls
short_url varchar(6),
long_url varchar(256),

Now, we have a table with two columns with the list of the short URL codes and the corresponding long URL. For this instance, I will be using the URL code "tekish" and it will point to Don't worry, we will be talking about generalizing the data. That is every time a URL code is gonna fire, it will redirect to corresponding long URL. So, now as we are done with creating tables, we are now gonna set up the PHP script that will fire when you visit the code. For this, first we will need to do some nice good setting. As we are just dealing with the basic concepts, the sweetness of this desert will be the 404 redirect. To do this, follow these steps:
  1. If you are using Apache as your server, save a file called ".htaccess" in the main directory of your website. The directory in which your index.php lies.
  2. Now, in this directory, enter the following: ErrorDocument 404 /redirect.php
Now we are going are going to write the code for redirect.php. Well, we did the htaccess thing so that whenever some random piece of string goes behind your web domain name, a 404 error occurs. Now, to show that 404 error, we fire up the redirect.php, that is basically a redirecting PHP script.
Now lets do the real thing. Code redirect.php

Basic notes and additional tips:

  •  In handling the .htaccess file, make sure your correctly enter the address of the location of your redirection script. Make sure you enter the path as on server, not as your local domain.
  • There are lot of things I haven't included in the script, which include analytics, form to create new URLs, and an error page if the code is not found. Explore them on your own! 
  • Well, when you are starting a service, you will obviously need to set up a random code generator for new URLs. Here is a small example on how you can create random alphanumeric codes that can be used as your short URLs.
  • Also, trim the URL you get to alphanumeric code for security
  • Got more tips? Share them in comments.
More coding at Let's Code!

Saturday, July 6, 2013

PHP Code Snippets: Generate a random string

Generating random strings might be very useful when developing a website. You can use random strings for various purposes:
2) Generating Coupon codes for a shopping website
And lots more! 
Soon, I will add tutorials to create all the examples that I have mentioned above. But for now, just take a look at the function I have given below:

The variable $length can be set to the length of string that you want to have.

How to use the function?

Just call it whenever you want the random string to interact with the PHP script you are designing.
Ex: $myrand = generatestring(8) // Generates 8 character random string


Add more type of characters you wanna include in your PHP script to the variable in the function $charset

More coding at Let's Code.

Wednesday, July 3, 2013

Get iOS style gestures on Android

One thing that seriously makes an Android user like me jealous of iOS device owners, is the gestures. I mean, the way to manage a iOS device using gestures is seriously awesome. My favorite is the five-finger pinch to minimize the app. Well, I just got a hunch that there must be something for Android users too. May be an app, well at least made for rooted users.
Hence I found the app called GMD Gesture Control. It features the four-finger pinch to minimize the app, five finger counter clockwise rotation to switch the screen off, three finger slide to open dock and lots more. The app is for rooted users only. You need to root your android phone in order to get this app to work.
Get the app here! Available as a free trial or a paid premium.