how to restart Cron or Crond Service linux

How to restart the Cron/Crond service under Linux / UNIX / ubuntu like os?

Whats is Crond?
While developing any kind of application, we always need to do some common task on some specific time interval. We can simply call such activity as scheduled activity, e.g execute set of commands after every hour. Crond is the service which helps us to do so in linux operating systems.

Use following commands.

How to start Cron service
# /etc/init.d/crond start

How to Stop cron service
# /etc/init.d/crond stop

How to Restart cron service
# /etc/init.d/crond restart

kyun ke tum hi ho aashiqui 2 guitar tabs lesson

Guitar tabs of the title song from movie "Aashiqui 2" (Intro part). Kyun ki Tum hi ho, ab tum hi ho,.. Zindagi ab tum hi ho is a very romantic song by Arijit Singh. I am trying to play this on guitar, so check and leave your comments. :)


How to play this song on Guitar? --> Check out the following notes.
__________Guitar Tabs___________

E|——--1————————————
B|--1--1—-4--4--2--1———2------1--1
G|————————----1--3—————-
Hum tere bin, Ab reh nahi sakte

G|--3--3----1--3--1--0——-0—--
D|———————----------1--3—--3--
Tere bina kya vajoodh mera

E|——--1————————————
B|--1--1—-4--4--2--1———2------1--1
G|————————----1--3—————-
Tujhse jhuda agar ho jayenge

G|--3--3----1--3--1--0——-0—--
D|———————----------1--3—--3--
Toh khud se hi ho jayenge jhuda

B|———1—————--1———
G|--1--3—--1--3—-1--3—--
Kyunki tum hi ho, Ab tum hi ho

G|--0--3--1—--0—-0————----
D|—————————3—--1--3—————-
Zindagi ab tum hi ho............Melody

Best Luck

Enabling query log in MySQL 5.5.28

Enabling query log in  MySQL Version : 5.5.28

MySQL has very strong system to log queries and events, It allows you to log 
 
1. General queries - General record of mysqld activities.
 
2. Binary log  - These are nothing but events describing the changes in database e.g. table creation. It plays important role during database replication.

3. Error logs - It logs all critical errors during of running MySQL server. MySQL is smart , if it finds any table that needs automatic repair then it updates error log file with respected message.

4. Slow query log - MySQL can store SQL statements which takes more time than long_query_time seconds, defined in my.cnf file, which is configuration file of MySQL server. The default value of this variable is 10. This is very important step in order to optimize the MySQL server performance by identifying slow queries.

That's not enough about log, but just gave you rough idea about its log system, lets see how to enable different logs in MySQL.

1. General Query Log - 
OS : Ubuntu 12.04.1 LTS
MySQL version : 5.5.28

1. Locate and edit my.cnf file. We need to change two variables in this file to enable general query log.  
    a.  sudo gedit /etc/mysql/my.cnf
    b.  Locate this variable in the file : general_log_file
    c.  It must have some default value, this variable is nothing but the path of log file.
    d.  The default value is "/var/log/mysql/mysql.log", you can change it as per your wish.
    e.  Now locate variable "general_log", and set it to 1. The means turning on the log system.
    f.  Now restart the MySQL server by running : sudo service mysql restart
    d. now if you open the mysql.log file, you can see all SQL queries in it. :)

Will update the steps for other log system soon. :)








Natrang Intro guitar full Tabs


Checkout Natarang intro guitar tabs.  I will try to upload the text format of tabs soon.



Facebook funny cover picture

Checkout these funny and creative facebook cover images. I am also giving raw files which you can use to for your facebookcover pages too.

___________________________________________________














___________________________________________________

Here is a Raw file for you, you can use this as cover background and put some nice matching profile pic and your creative facebook cover is ready.
___________________________________________________


how to enable internet when vpn is connected - WINDOWS 7

This week I started using my VPN connection for some work. But I notice that whenever I connect my VPN, my machine was loosing the local internet connection. Previously it was not the issue with my machine, but it started appearing once I started using wifi for local internet connection. I am using WINDOWS 7 machine. Here is a fix for this issue.

How to enable local internet connection while using VPN network.
1. Right click on the VPN connector in your network connections.
2. Click properties.
3. Then click on the networking tab.
4. Then click on TCP/IP settings. i.e.(Internet protocol version 4..)
5. Then click on Properties button to view "Internet protocol version 4" properties.
6. This will open a new window.
7. Click on advanced button.
8. Now under IP-settings tab you will find a check box which reads "Use default gateway on remote network".
9. UNCHECK this checkboox.
10. Save all settings.
11. Done.

This will surely get your internet back while connecting VPN.

5th metatarcel bone broken

Broken 5th metatarcel bone. Day 1 & 2 Pics

How to add dynamic rule to jQuery validator

"jQuery validator" is  really a very good plugin for validating your web forms on client side. Why I am recommending this plugin is because its flexibility and set of methods which offers complete customization.  Plugin offers lots of different methods so that you can customize it as per your requirement very easily. I have used it in many applications. There are many other jQuery based form validation tools which actually using this plugin as back bone of there plugins.

I was working on one application yesterday in which I need to load some form fields dynamically from AJAX call. In this case once input fields are populated in your form you may need to apply validation rule for these fields. This step is necessary because the original  $("#formId").validate method was initiated during the page load. So how to add dynamic rule to jQuery validator?? check the following solution.

If you want to add validation rule to form which is already loaded then its kind of tricky and you may need to use following function.

$("#synamicFieldId1").rules("add", {validateApp:['parameter1','parameter2']});

You can find the .rules() documentation with more examples here.

Is Twitter a Waste of Time?

Twitter! What is it?

Internet world has one thumb rule these days, If you don't know any thing then there is only one god GOOGLE, so just ask Google. People ask almost everything to Google :). Believe it see the following example.

Take a look at this funny image, I took this screenshot on Google search page with keyword Twitter is a
If you look at the first suggestion it says "Twitter is a waste of time". that's so funny. It means people use to search this phrase so many times that Google suggest is giving importance to this keyword more than other keywords. :)



 Lots of friends of mine are not actually using twitter but everyone of them says twitter is just a waste of time. What I think is they just don't know how to use it. Twitter is a invention of micro blogging, and its just cool tool , use it in a right way.


CSS1 vs CSS2 & SEO

This post will help you to understand the primary features in CSS2 which are not there in CSS1 and how CSS2 techniques are going to help you in SEO. CSS1 is published in 1996 and CSS2 is published in year 1998. All major browsers supports practically 99.9% of CSS2. I was googlin for the difference between CSS1 and CSS2 and landed on a very good website and found really dam important information about new tags introduced in CSS2. You can check all of them on this website > http://xahlee.org/js/css2.html.

Google bot and other search engines does consider uncompressed HTML size of your webpage, so even if we are using gzip compression techniques, we have to think about the uncompressed HTML size. One of my website's home page is of size 59.23 kb. The which I used to test my site have suggested CSS2 based layout and its new techniques which really helps a lot to reduce your page size. I am working on some of the new tags implementations which will help me to reduce the size of CSS file as well as my HTML page size.

There are few more CSS techniques which helps us to increase the speed of our website. One of the very popular technique is "CSS Sprites". CSS Sprites is basically a technique which combines all small images on your web page in to one big image. In this case we have to just load a single image instead of loading lots of small images separately, this saves a lot of browsers time to make n no of http requests to server so increases speed of your website.

php best practices 1 - Handle unexpected conditions

Are you handling all the possible conditions under which your programs will run?

For instance, do you always have a "default" case in you "switch" statements?

switch($some_value)
{
case 1:
$another_value = 1;
break;
case 2:
$another_value = 4;
break;
}
return(1 / $another_value);

What if $some_value is not 1 nor 2?

Notice: Undefined variable: another_value

Warning: Division by zero

What about "if" conditions? Do you have an "else" code section to all important "if" statements?

If your program is not expecting certain conditions but those conditions are not impossible to occur, having simple calls to error_log may help you to be aware of the problems under unexpected situations.

switch($some_value)
{
case 1:
$another_value = 1;
break;
case 2:
$another_value = 4;
break;
default:
error_log('unexpected some_value '.$some_value.' found ');
exit;
}

php framework comparison - performance comparisons

I am writing this post regarding PHP framework performance comparisons. There are lots of PHP frameworks available and every framework has its own advantages and disadvantages. As all frameworks are based on MVC and thus adopting any of them for product development is not that difficult. Normally developers check for no of libraries load time and some important features like ORM. Also you can check that which framework supports which php version.

Here is a simple chart which programmers can use while choosing the suitable framework for their projects.



phpframeworks[.]com also have explained this thing in detail. You can check that also.

Jquery plugin to read query string - how to

If you are looking for some jQuery plugin to read the query string parameters then you are on right page. Here is a simple function which will help you to understand how to detect/read the values of query string parameters.

Jquery Plugin

$.queryParam = function(name){

var answer = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);

if (!answer)
{
return 0;
}
return answer[1] || 0;
}


How to use
var paramValue = $.queryParam('paramName');

get X days back date from current date

How to get 7(X) days back date from current date?

PHP is very strong server side programming language which simplifies lots of small small tasks like converting date formats etc.

I was working on some task, where I was suppose to get 7 days back date from current date. Actually the task is very simple, I am sharing the code here. Have a look at it and let me know if any one can find better way than this.


$format = 'YmdhIS'; // YOU CAN USE ANY FORMAT WHICH YOU WANT

$date = date ( $format );

// - 7 days from today
$prevDate = date ( $format, strtotime ( '-7 day' . $date ) );

Note: If you want to get yesterdays date then simply do -1 instead of -7.

How to get 7(X) months back month from current month?

// - 7 months from today
$prevDate = date ( $format, strtotime ( '-7 month' . $date ) );

Its so simple.

Problems in enum data type mysql

MySQL ENUM data type looks like a Hot SPOT among all developers n database designers. We all know about ENUM data type, but do we really know disadvantages or lets say problems of using ENUM data type while designing tables.

I was wondering what could be the reason that most of geeks don't want to use this data type, I just googled out some info about it and came across some very serious issues, so sharing on my blog.


1. Changing the member list of ENUM columns is very expensive.

    If your table has more than millions records and you are trying to change any thing in the column which has data type ENUM, then mysql rebuild complete table and look in to every row in that table. This may take lots of time may be hours and thus downtime.  So lets create equation

Server Downtime = MySQL table with ENUM data type + millions of records. Lol.

2. ENUM has limited portability with other databases.
    ENUM is not a standard SQL and lots of other databases doesn't have native support for ENUM.


Well there are lots of more issues with ENUM data type, I would like to share some links which may help you to take decision while using ENUM in your database. Check these links for sure , great information shared on it.

Link 1
Link 2

How to theme search results drupal 6.x

Drupal 6 comes up with preprocess functions and templates which makes theming job easier. So here is my first post to make your theming job easier with drupal 6.x.

Lets take a scenario of having some text below each result in search result page, could be any kind of ad or some image or any HTMl component.

Step 1. Define a variable in a preprocess function in template.php file.
Step 2. Copy the search-result.tpl.php file from /modules/search directory to your current theme folder.
Step 3. echo the defined variable in the search-result.tpl.php file.
Step 4. Clear the template cache.


Step 1. Define a variable in a preprocess function in template.php file.
Append following code to template.php in current theme.

function mytheme_preprocess_search_result (&$vars) {
 
$vars['my_variable'] = t('I am here');
}


Step 2.  This is self explanatory

Step 3. echo the defined variable in the search-result.tpl.php file.
Append following code at end of search-result.tpl.php
if (!empty($my_variable)) {
    echo $my_variable
;
  }
Step 4. Clear the template cache.

Now you can edit these files and can customize your search result page. :)

Do not register Youmint.com

Do not register on Youmint.com
Website is not at all secure , Don't believe.

If you are technical person then you can see that while registering the form data is sent via GET method and your personal data is passed to server without encryption. Password and all details are sent via GET method. I don't even Want to check what features they are providing after registration if this is the start.

► I am not the alone ◄ Check what other blogger are saying
sumans blog

replace last occurrence of substring from string in php

Are you looking out for a built in function in php which replace last occurrence of sub string from string??

You are at right place then. check out the function below which easily replaces the last occurrence of sub string from supplied string.

  1. function str_lreplace(mixed $search, mixed $replace, mixed $subject)
  2. {
  3. return substr_replace($subject, $replace, strrpos($subject, $search), strlen($search));
  4. }

Life becomes for Commuters in Pune

Google launched Transit service in Pune (in partnership with PMPML)

Public transport is a vital part of the infrastructure that makes our cities run efficiently, and can help mitigate congestion, environmental concerns, and increasing energy costs. Google earlier launched Transit in Banglore and delhi and now they come up with the idea in pune, making millions of commuters happy, as they can find out bus schedules and routes for 320 of PMPML buses via Google Maps on desktop and mobile.


As an example, here is the route from Pune University to MG Road.You can now check the bus no and available routes easily.


PMPML is the second Indian Bus service to launch on Google Maps.

Power of Android

Was studying about android, as its being famous in mobile technology these days. Here is summery of my first research.

What is Android?
Android is nothing but a software platform for mobile devices which are based on most flexible operating system i.e. Linux. Android is developed by Open Handset Alliance and acquired by Google. Android is a software stack for mobile devices that includes an operating system, middleware and key applications.

History of google and Android.
Google acquired Android in in July 2005. Early it was a small start up company (actually 22-month-old startup) based in palo alto, CA. Co founder of this company - Andy Rubin, Rich Miner, Nick Sears, Chris White.

Android Development
Android applications are written in the Java programming language. The Android SDK provides the tools and APIs necessary to begin developing applications on the Android platform using the Java.
Download Android SDK


An Android package archive file marked by an .apk suffix. This file is used for distribution and installation of the application on the mobile device.

Power of Android application.

  • Phone's core applications and third-party applications are treated equally.
  • Android actually breaks down all the barriers of application development by providing lots of libraries and tools. e.g Android enables developers to obtain the location of the device.
  • By default, every Android application runs in its own Linux process.
  • Every application has its own virtual machine. So the app runs in isolation from other apps.
  • Each application is assigned a unique Linux user ID which is set with some permissions required by the perticular application only. Where as it is also possible that two or more android application share a same user id in some cases.

Android Architecture
android architecture

Share this post with your friends