Tuesday, 4 November 2014

Live Digital Clock - Javascript 0

Here is the code for Live digital clock.

Just we are going write a function to get the current time and display it in span. We are calling that function for each 1000 milli seconds. so, live clock is working.

var int=self.setInterval("clock()",1000);
function clock(){
var now=new Date();
var time=now.toLocaleTimeString();
document.getElementById("clock").textContent=time;
};
 Here is the live Demo

Thanks Christian White

Monday, 6 October 2014

Find how many times a search phrase is found in a string 0

Here is the function to tell how many times a search phrase is found in a string.

Note: It's case sensitive.

function howMany(str, term){
return str.match(new RegExp(term, 'g')).length;
};

var text='Visit WHAK.com for WHAKy things!';
var phrase='HAK';
alert(phrase+' is found in\n'+text+'\n'+howMany(text,phrase)+' times.')

Thanks Christian White

Sunday, 24 August 2014

MySql return rows matching year month 0

If we want to get rows by filtering given month and year, We can use 2 popular ways.

  1. EXTRACT()
  2. BETWEEN
1. EXTRACT( ):
The EXTRACT() function is used to return a single part of a date/time, such as year, month, day, hour, minute, etc.

SYNTAX:
EXTRACT(unit FROM date)

This function have a following units to use.
MICROSECOND, SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, YEAR, SECOND_MICROSECOND, MINUTE_MICROSECOND, MINUTE_SECOND, HOUR_MICROSECOND, HOUR_SECOND, HOUR_MINUTE, DAY_MICROSECOND, DAY_SECOND, DAY_MINUTE, DAY_HOUR, YEAR_MONTH.

This function is really useful when working with dates in mysql. Ok, Let we see how to use EXTRACT() in this case,

SOLUTION 1 :
SELECT * FROM table
WHERE EXTRACT(YEAR_MONTH FROM timestamp_field) = EXTRACT(YEAR_MONTH FROM NOW())

We can replace NOW() with our date like this below code.

SELECT * FROM table
WHERE EXTRACT(YEAR_MONTH FROM timestamp_field) = EXTRACT(YEAR_MONTH FROM '2014-08-25')

2. BETWEEN :
We can use BETWEEN clause to replace a combination of "greater than equal AND less than equal" conditions.

SYNTAX:
BETWEEN A AND B

Ok, Let we see how to use BETWEEN in this case,

SOLUTION 2:
SELECT *
  FROM myTable
 WHERE date_column BETWEEN '2014-08-01' AND '2014-08-31
We should make sure our date_column have a date format like 'Y-m-d' when using this method. Or, simply change your timestamp format to DATE_FORMAT().

Note:
You could extract the year and month using a function, but that will not be able to use an index. 
If you want scalable performance, you need to use BETWEEN.

 Still have any doubt? Feel free to comment here...


Monday, 18 August 2014

How to resize image diagonally using javascript 0

In general we don't like to see our images stretched in view. In this case, If we want to reduce size diagonally, what should we do?

We can do it by changing width property of image.

  • First We need to get original width of image using javascript's naturalWidth property. 
  • Then Multiply it with 0.5 to get 50% reduced image.
  • If you want 2x larger image, then multiply it with 2. like this below code,
domElement.width = doemElement.naturalWidth * 0.5;
  • Then assign resultant number to image width.

Still you have doubt??? see this below DEMO. It will make you understand what I'm saying.

Related Post : HTML DOM Image naturalWidth, naturalHeight Property

HTML DOM Image naturalWidth, naturalHeight Property 0

The Javascript's naturalWidth and naturalHeight properties will return original width and height of an image.
For an example, If we are using an image with 350px original width and 225px original height, It will return the same height and width even we made changes in DOM's height and width property.

The following DEMO will make you understand more what I'm saying. 


In this DEMO the original image size of image is 350 x 225 px. We are also changed image width and height property. But now also it's returning the actual size.



Saturday, 9 August 2014

$_GET vs. $_POST - PHP 2

$_GET and $_POST
  • Both GET and POST create an array.
  • e.g. array(key=>value, key2=>value2, key3=>value3, ...).
  • This array holds key/value pairs, where keys are the names of the form controls and values are the input data from the user.
  • Both GET and POST are treated as $_GET and $_POST. These are superglobals, which means that they are always accessible, regardless of scope - and you can access them from any function, class or file without having to do anything special.
  • $_GET is an array of variables passed to the current script via the URL parameters.
  • $_POST is an array of variables passed to the current script via the HTTP POST method.

When to use GET?
Information sent from a form with the GET method is visible to everyone (all variable names and values are displayed in the URL). GET also has limits on the amount of information to send. The limitation is about 2000 characters. However, because the variables are displayed in the URL, it is possible to bookmark the page. This can be useful in some cases.
GET may be used for sending non-sensitive data.
Note: GET should NEVER be used for sending passwords or other sensitive information!
When to use POST?
Information sent from a form with the POST method is invisible to others (all names/values are embedded within the body of the HTTP request) and has no limits on the amount of information to send.
Moreover POST supports advanced functionality such as support for multi-part binary input while uploading files to server.
However, because the variables are not displayed in the URL, it is not possible to bookmark the page.


Thursday, 7 August 2014

How reloadAfterSubmit working in jqGrid 1

This reloadAfterSubmit attribute always confusing with data type. I have seen so many post related to reloadAfterSubmit not working like that in jqGrid forum and stackoverflow posts. Here I gave explanation about reload process in jqGrid.


  • jqGrid using AJAX to post data to Server Side (add, edit, delete). So, our page will not get refresh.
  • jqGrid reloadAfterSubmit : true will again load our data source to jqGrid.
  • So, If we set reloadAfterSubmit : true for JSON or XML dynamic data source, it will work. We can see updated data in jqGrid. Because, jqGrid again will get the updated data source from dynamic JSON or XML data type (data source).
  • If we set reloadAfterSubmit : true for local data, It will also work. But, We can't see any updated data in jqGrid. Because, our local data is static till we manually refresh our complete page. So, this reloadAfterSubmit : true will again load our declared local data.
So,
  • For local data data type, we should set reloadAfterSubmit : false.
  • For, JSON or XML data type, we should set reloadAfterSubmit : true.

Tuesday, 29 July 2014

Solution : Can't quit Packagekit - adding software package in OpenSuse 5

Problem

We can't run 2 updaters at the same time so if packagekit is running then you can't run Yast update or zypper.

So, it will through confirm message to stop packageKit process.
PackageKit is blocking software management.
This happens when the updater applet or another software management
application is running.
Ask PackageKit to quit?

if you click on 'Yes', it will try to stop the process of packageKit. If it is still busy, it will again arise the popup with this message.
 PackageKit is still running (probably busy).
Ask PackageKit to quit again?

Again click 'yes'. If it won't stop the process, follow the below method to kill the processes.

Solution
 
Kill the process using following commands.
sudo killall -KILL packagekitd
Make sure you are in super user mode. Just run this command in Command line Interface (CLI).

It will kill all currently running packageKit processes.

Have any doubt? Feel free to comment here....


Monday, 28 July 2014

Resize jqGrid based on number of rows 0

To resize grid based on number of rows, Just we need to say this in configuration settings of jqGrid.

Yes. we need to set like this below.

$("#mygrid").jqGrid({
    ...,
    ...,
    ...,
    height:'auto',
    ...,
    ...
});
 
simply set height property to auto.

How it actually works?

This height configuration for the body of the grid. Our grid table is actually placed within the body of the grid. We can get that body of the grid by this selector ".ui-jqgrid-bdiv".

So, If we not set height property in jqGrid configuration, It will take the default height to 150px. If we send one record to jqGrid, it will show like this below,


If we set height property to auto in jqGrid configuration settings, and we are sending only one record to grid. It will showing the grid like below,


So, If we sending more than 20 records, and we set our grid limit to 20 per page. So, Grid showing correctly showing 20 records in first page. See the below image.


Have any doubt? Feel free to comment here!!!


Sunday, 27 July 2014

Convert CSV to Two dimensional array (2D Array) - PHP 3

When you get the data from CSV file, It will return return array of each row. To work with this, we need to convert it as 2D array. So, this following code snippet will help you to covert CSV array to 2D array. In this we used PHP's array_combine function.

FUNCTION DEFENITION
function get2DArrayFromCsv($file, $delimiter) {
    if (($handle = fopen($file, "r+")) !== FALSE) {
        $i = 0;
        $data2DArray = array();
        while (($lineArray = fgetcsv($handle, 0, $delimiter)) !== FALSE) {
            for ($j = 0; $j < count($lineArray); $j++) {
                $data2DArray[$i][$j] = $lineArray[$j];
            }
            $i++;
        }
        fclose($handle);
    }
    return $data2DArray;
}

HOW IT WORKS

* Just used incremental variable $i to mention number of row in 2D array.
* Once finished the iteration for a row, then increment $i for the next row.
* See how array_combine works.

PARAMETERS 

$file - File path
$delimiter - delimiter used in this CSV

FUNCTION USAGE
get2DArrayFromCsv($file_path, ',');
Recommended Article : Convert CSV to JSON with header row as key - PHP

Have any doubt? Feel free to comment here!!!


Monday, 21 July 2014

Add border-bottom / border-top to table row using CSS 2


We can do it with table's border-collapse property.
Collapse

In which both the space and the borders between table cells collapse. So, there is only one border and no space between cells.

Just change the table border-collapse style into collapse using this following css
table {
    border-collapse: collapse;
}
Now the each cells are independent. So, you can apply border-bottom or border-top style for each td like bellow CSS.

To Set border-bottom,
.border_bottom {
    border-bottom: 1px solid #000;
}
To Set border-top,
.border_top {
    border-top: 1px solid #000;
}
LIVE DEMO
Have any doubt? Feel free to comment here!!!

Saturday, 19 July 2014

24 jQuery UI themes 0

Here we listed 24 jQuery UI themes... Click on the names to get raw code of themes.
 Click...! Download...!! Enjoy... !!!


Thursday, 17 July 2014

Uncaught TypeError: Cannot read property 'integer' of undefined - jqGrid 0

This sounds "Language supporting file is missing".

* One get the error message typically if one don't included required language file grid.locale-xx.js (for example grid.locale-en.js).

* You can Include it before jquery.jqGrid.min.js or jquery.jqGrid.src.js. See the example of the usage of jqGrid in Documentation

* If you don't have that file, Click Here to download.

Have any doubt? Feel free to comment here!!!

Related post : jqGrid "reloadGrid" using Local Data (JSON Object)



Wednesday, 16 July 2014

Convert CSV to JSON with header row as key - PHP 0

When you get the data from CSV file, It will return return array of each row. If we want this array in JSON as header row as key and cell value as value, We can use PHP's array_combine function.

So, We can use this following function to achieve this task.

FUNCTION DEFENITION
function getJsonFromCsv($file,$delimiter) { 
    if (($handle = fopen($file, 'r')) === false) {
        die('Error opening file');
    }

    $headers = fgetcsv($handle, 4000, $delimiter);
    $csv2json = array();

    while ($row = fgetcsv($handle, 4000, $delimiter)) {
      $csv2json[] = array_combine($headers, $row);
    }

    fclose($handle);
    return json_encode($csv2json); 
}
HOW IT WORKS

* Just read the first line separately and merge it into every row.
* The above function opens a file handle, reads the first line into $headers
* Then reads the remaining lines.
* It combines each line with the $headers.
* See how array_combine works.

PARAMETERS 

$file - File path
$delimiter - delimiter used in this CSV

FUNCTION USAGE
getJsonFromCsv($file_path, ',');
Recommended Article : Convert CSV to Two dimensional array (2D Array) - PHP

Have any doubt? Feel free to comment here!!!


Saturday, 12 July 2014

Strict Standards: Non-static method DOMDocument::load() should not be called statically - PHP 0

In PHP recently I faced this issue. When I tried to use my xml file using php's document load() function.

Problem
$dom = DOMDocument::load('myXml.xml');
It works perfectly. But I throws error
Strict Standards: Non-static method DOMDocument::load() should not be called statically
Solution
The reason why it's happening is because I called a load() method in the DOMDocument class in which is not static.

 Instead of calling it with :: We need to call it with ->

I found PHP document about the usage of DOMDocument load() method.
$doc = new DOMDocument();
$doc->load('myXml.xml');
Now the error is gone...!!!

Have any doubt feel free to comment here!


Thursday, 3 July 2014

Get all the dates between two dates - Javascript 6

We can do this using Javascript's Date() object. You can use this following function to get between two dates. It will return array. Here we are using isDate() and isValidRange() functions to make sure is the given string is Date and end date is not greater then start date. If the given string is not date, then it will return "error occured!!!... Please Enter Valid Dates" in browser console and it will return empty array.

Parameters:

Start - Starting Date
end - Ending Date
Note: you should pass Date object as parameters.
If you are using jQuery Date picker, you can get selected date object like below,
var start = $("#from").datepicker("getDate"),
    end = $("#to").datepicker("getDate");
you can get selected date object using 'getDate' parameter in datepicker.

usage and Example :

If you are using datepicker, you can use this code,
var start = $("#from").datepicker("getDate"),
    end = $("#to").datepicker("getDate");

var between = getDates(start, end);

If you are going to use your own date string, you should make it as date object. Then only you can use in it. You can use this piece of code,
var start = new Date('2014-07-13'),
    end = new Date('2014-07-17');

var between = getDates(start, end);

Live Demo

Have any doubt, feel free to comment here!

Tuesday, 24 June 2014

Get all dates in given month and year in php 0

To get all dates in given month and year, we need to know how many days in that given month and year.

to do that we are going to use PHP's date() and mktime() functions.

Syntax :

date(format,timestamp)
mktime(hour,minute,second,month,day,year,is_dst);

Function:

the following function will return dates in array format for given month and year in Y-m-d format.

Parameters:

$month   -  Month number
$year    -  Year        

usage:

$dates = get_dates($month,$year);

Example:
output:

Explanation:

We just calculated the number of days in month and using for loop, we are creating array in our own format.

Have any doubt, feel free to comment here!

Monday, 16 June 2014

எவ்வளவோ மேல்... 0


Saturday, 14 June 2014

வெற்றியை நோக்கி... Towards victory... 0

வெற்றியை நோக்கி பற !
பறக்க முடியாவிட்டால் ஓடு !
ஓட முடியாவிட்டால் நட !
நடக்கவும் முடியாவிட்டால் ஊர்ந்து செல்.
ஆனால், எப்படியாவது நகர்ந்து கொண்டே இரு.

English Version: 
Fly to Victory!
If you can't fly, then run !
If you can't run, then Walk !
If you are unable to walk, then Crawl.
But, Somehow, Keep Moving...

Friday, 13 June 2014

Help !!! உதவி !!! 0

முற்காலத்தில்
 உதவி என்பதை கேட்காமல் செய்வார்கள்!
ஆனால்,
இக்காலத்தில்
உதவி என்று கேட்டாலும் செய்வதற்கு
நல்ல மனமும் இல்லை,  நல்ல மனிதர்களும் இல்லை

English Language Difference:

"May I help you" (past)


" Please Help Me" (Present)


Google Search: "Definition of Help" (Future)

 

Peace in the world 0

Where there is righteousness in the heart there is beauty in the character,
when there is beauty in the character there is harmony in the home,
when there is harmony in the home there is order in the nation,
when there is order in the nation,
there is peace in the world.

Thursday, 12 June 2014

Don’t compromise with time... 0

Don’t compromise with time...
Time will not change our life...
Time only changes the expiry dates of  opportunities....

Iyarkai Thai Kavithai | இயற்கைத் தாய் 0

இயற்கைத் தாய்
நம்மை அன்பாக
அரவணைத்து, உணவூட்டி,
சகல தேவைகளையும்
பூர்த்தி செய்கிறாள்.!
நாமோ நன்றியற்றவர்களாக
அவளை அழிப்பதைச்
செய்து கொண்டிருக்கிறோம்..!
தாயின் பொறுமைக்கும்
எல்லையுண்டு..!
அவள் பொறுமை இழந்தால்
நாம் பெற்ற
அறிவியல் வளர்ச்சிகள்
முன்னின்று அவளைச்
சாந்தப்படுத்த முடியாது..!

                                 - Source

பூமிக்கு வேறு எங்கும் கிளைகள் கிடையாது. 0

மண் வளம்... மழை வளம்... காடுகள் வளம்...
ஆகிய வளங்களை நம் வருங்கால சந்ததிகளுக்கு நல்லபடியாக விட்டு செல்வோம்.
செழிப்பான பூமியை பாதுகாப்போம்... 
ஏனெனில்,
பூமிக்கு வேறு எங்கும் கிளைகள் கிடையாது.

Wednesday, 11 June 2014

Compare and remove array element - javascript 2

In this post we are going to see how to compare two array elements? and do something, when the element is matched.

This below prototype method will do that trick.
Array.prototype.diff = function(arr2) {
    this.sort();
    arr2.sort();
    for(var i = 0; i < this.length; i += 1) {
        if(arr2.indexOf( this[i] ) > -1){ 
            arr2.splice(arr2.indexOf( this[i] ), 1);
        }
    }
};
from the above code, first we are sorting both arrays. Then, We searching for index of same element occurred in both arrays.

arr2.indexOf( this[i] > -1)

If the first array element found in the arr2 array, It will return true. Inside the if block we can do whatever we want. In this post I'm just going to delete that matched element from arr2 array.

See this Example Demo. Go to the javascript tab and change your array and test it here itself.
var array1 = ['a', 'c','d','f','h'];
var array2 = ['a','b', 'c','d','e','f','g','h'];

//prototype method for array to find and remove matched element from argument array.
Array.prototype.diff = function(arr2) {
    this.sort();
    arr2.sort();
    for(var i = 0; i < this.length; i += 1) {
        if(arr2.indexOf( this[i] ) > -1){
            arr2.splice(arr2.indexOf( this[i] ), 1);
        }
    }
};

//code usage for above prototype method.
array1.diff(array2);

See the Demo below.
Have any doubt, feel free to comment here!

Wednesday, 4 June 2014

Solution for noreply@blogger.com in blogger feed 2

Problem

 This issue is arise with only RSS feed not in ATOM feed. 

Example

I'm going to show my blogger blog feed as an example in this post.

RSS Feed

This below URL is my blog post feed URL which will return my RSS feed data of posts.
http://cj-ramki.blogspot.in/feeds/posts/default?alt=rss
It creates the JSON data empty blog author name and noreply@blogger.com(author name). I just parsed that JSON object and checked what is getting from RSS feed from JSON. It returns the below result.

ATOM Feed

By default Blogger using ATOM feed. So, I changed my feed URL like below. So, this below URL is my blog post feed URL which will return my ATOM feed data of posts.
http://cj-ramki.blogspot.in/feeds/posts/default
It creates the JSON data with correct blog author name and post author name. I just parsed that JSON object and checked what is getting from ATOM feed from JSON. It returns the below result.

SOLUTION

The solution to this problem is, use ATOM feed instead of RSS Feed. 

Just remove ?alt=rss from the URL to use your Blogger blog feed as ATOM feed.

Have any doubt, feel free to comment here!

Tuesday, 3 June 2014

How to get full referrer url in php 0

To get referrer url, we are going to use $_SERVER variable called HTTP_REFERER.

In some cases we need to check, this page redirected from where? To fill up that "where" we should use  $_SERVER[HTTP_REFERER].

NOTE:
  • If users use a bookmark or directly visit your site by manually typing in the URL, HTTP_REFERER will be empty.
  • If the users are posting to your page programatically (CURL) then they're not obliged to set the HTTP_REFERER as well.

So, to get full referrer URL in your PHP page, we need to use,
echo $_SERVER[HTTP_REFERER];
Have any doubt, feel free to comment here!

Related Post : How to get current full URL in PHP

How to get current full URL in PHP 0

To get current full url in php, we can use php's $_SERVER variables.

We are going to use
  • $_SERVER[REQUEST_SCHEME]  - It will print which type scheme (ex.http)
  • $_SERVER[HTTP_HOST]       -  Server host name
  • $_SERVER[REQUEST_URI]      - current URI 
So, We can combine those three like below,
$URL = $_SERVER[REQUEST_SCHEME].'://'.$_SERVER[HTTP_HOST].$_SERVER[REQUEST_URI];
 Simply echo it like this echo $_URL; to test it.

Have any doubt, feel free to comment here!

Related Post : How to get full referrer url in php

Monday, 2 June 2014

வெற்றி பற்றிய புரிதல் 0

தோற்காமல் இருக்க வேண்டுமே என்பதற்காக நீங்கள்
ஜெயிக்க பார்த்தால், தோல்விதான் உங்களுக்கு மிஞ்சும்.


வெற்றியை  மட்டும் மனதில் வைத்துக் கொண்டு ஓடுங்கள்... அதிவேகமாக ஓடுங்கள்.
தோல்வி உங்களைத் துரத்தட்டும்... பரவாயில்லை. ஆனால்
தோல்வியை துரத்திக் கொண்டு நீங்கள் ஓடாதீர்கள்...

                                    கோபிநாத் சந்திரன் (ப்ளீஸ் இந்த புத்தகத்தை வாங்காதீங்க.)

சந்தோஷம் எதில் தான் இருக்கிறது? 3


சந்தோஷம் எதில் தான் இருக்கிறது?
ரொம்ப சுலபம்.
சந்தோஷமாக இருக்க வேண்டும் என்ற உங்கள்
எண்ணத்தில்தான் அது இருக்கிறது.

                         - கோபிநாத் சந்திரன் (ப்ளீஸ் இந்த புத்தகத்தை வாங்காதீங்க.)

Sunday, 1 June 2014

30 lessons from Narayana Murthy - Infosys 0

NR Narayana Murthy, who steps down as Infosys chairman on August 20, is a role model for not just what he achieved but also how he did it. Here are 30 lessons from Murthy, one for each year he spent at company.

1-Seize Your Gandhi Moment
Murthy, a self proclaimed socialist in the mid '70s was jailed for 72 hours in Bulgaria. The experience taught him that entrepreneurship and job creation is the way to alleviate poverty.

2-You might fail, but get started
Learn from mistakes and move on. In 1976, Murthy founded Softronics, a company that lasted a year and a half. When he realised that his first venture wasn't taking off, he moved on.

3-Think Big. Don't Hesitate to Start Small
In 1981, a determined Murthy started Infosys with Rs 10,000 he borrowed from his wife. In few years, Infosys went on to become one of the largest wealth creators in the country.

4-Cut Yourself a Slice, Not a Large One Always
When Infosys was set up, Murthy took a pay cut while salaries of other co-founder's were increased by 10 percent. According to Murthy, a leader needs to show his or her sacrifice and commitment.

5-Lend a Hand and Throw in a Foot Too
After Murthy convinced seven of his colleagues, there was a problem. Nandan's future inlaws were not sure about him. Murthy met Nandan's uncle and convinced him.

6-Own Up, and Then Clean Up
In the '80s Infosys developed an application for a German client. Murthy noticed a single character error and informed the client immediately.

7-Trust in God, But Verify with Data
In God we trust, the rest must come with data, is perhaps Murthy's favourite statement. When confronted with difficult decisions, he tends to rely on data.

8-Keep the Faith
Infosys almost wound up in 1990. Murthy did not want to sell the company. He asked co-founders if they wanted out and offered to buy their shares. All of them stuck together.

9-Get Involved
Infosys won a contract from Reebok in the early '90s. Seeing the founders involvement, the software, was nick named 'Dinesh, Murthy and Prahlad.' Infy veterans still recall those days.

10-Sharing is Caring
After the IPO, Infosys decided to share a portion of its equity with employees. This helped them retain talent and gave employees a sense of ownership. Murthy is proud of having given away stocks worth over Rs 50,000 crore to employees.

11-Treat your People Good, but Your Best Better
Murthy always had a thing for good performers. And he rewarded them well. When Infosys decided to give its employees stock options, Murthy insisted that some shares be given to good performers through the 'Chairman's quota.'

12-Hire a Good Accountant, Even if he is Argumentative
A young, argumentative Indian, was asking too many questions at an annual general body meeting of Infosys. More impressed than irritated, he hired Mohandas Pai, who went on to help Infosys list on Nasdaq.

13-When in Doubt, Disclose
Keep your books clean and leave the cooking to the chef. Murthy's philosophy about being open and transparent has given the company a lot of credibility. He often says, "When in doubt, please disclose."

14-Leave the Family Out
Murthy told his wife that only one of them could be with the company. Murthy, along with other founders, said that none of their children would work for Infosys. This left no room for nepotism at Infosys.

15-Don't be a Pushover
In 1994, when General Electric wanted to re-negotiate rates, Murthy said no to selling services any cheaper. This helped Infosys not to be overly dependent on any one client.

16-Make hay While the Sun Shines
In late 90's, India's tech companies made use of the Y2K opportunity to make themselves known in the global market. For Infosys, it was a great opportunity to enter into long-term relationships with their customers.

17-Brand-aid First, Get Clinical
When the sexual harassment case against Infosys' top sales guy Phaneesh Murthy threatened to tarnish the company's brand, Murthy decided to quickly react. He let go of Phaneesh, and settled the case out of court despite Phaneesh wanting to fight it out.

18-Mind your Business, you'll See Things Coming
Murthy carries and updates a mental model of Infosys' business all the time. According to him, every leader must have a model, consisting of six to seven parameters that might affect business.

19-Keep it Simple, Not Silly
Keep your life simple and straight. That way, you get to work more and worry less. Murthy is known to be frugal with money. Despite being one of the richest Indians, he leads a simple life. However, he does not cut corners on buying books or brushing up on literature.

20-Founders Keepers, but Not Forever
Murthy's decision to not allow founders to continue with the company after the age of 65 set another standard for the company. This way, younger leaders at Infosys had a greater chance at the top positions.

21-Talent Spotting and Division of Labour
Murthy is known to have an eye for talent and a talent for dividing labour. Nandan was given sales responsibilities while Kris and Shibu did the tech stuff. N S Raghavan was asked to handle people and Dinesh was assigned quality.

22-Hold on to Your People but don't Cling
Letting go is never easy but its not good to cling on to your colleagues either. Amongst the founders, Ashok Arora, Nandan Nilekani and K Dinesh have quit Infosys. Infy veteran Mohandas Pai has also left Infosys.

23-Give, it only gets you more
In 2010, the Murthy's donated $ 5.2 million USD to Harvard University Press for a project that aims to make India's classical heritage available for generations to come. He is also supporter of the Akshaya Patra Foundation.

24-Do it First and Do it Right
Infosys did many things first. And most things right. For example, it was the first Indian company to list on Nasdaq. It was the first Indian company to make it to the Nasdaq 100 list and it was the first Indian company to attain the highest level of quality certification.

25-Perils of Being a Poster Child
Being the poster child of Indian IT industry, Infosys and Murthy have been at the receiving end of many criticisms. The company has been accused of taking away American jobs and been called a "chop shop."

26-Get Rich. Honestly
Rich businesses were considered to be dirty in the days when the country had a socialist bent. Infy was a company which got rid of this sentiment. Murthy, with his 'no compromise' policy on greasing palms and doing ethical business, set the standards.

27-Do Not be Afraid to Court Controversy
Ever since Infosys became a success, Murthy was under constant public glare. This did not deter the straight talking Murthy from courting controversy or voicing his opinions openly.

28-Invest in Learning
With big investments in training, development and building facilities, India's IT bell-weather has always been keen on grooming the younger generation. Murthy drove the culture of learning in the company in its early days.

29-Never Lose the Common Touch
The big man of Indian IT kept his personal life simple. He lives in a simple, middle class house and flies economy till date. Murthy has always been accessible to people around him.

30-Do Good, Look Good
Murthy knew the importance of creating an image for Infosys. He invested in creating a sprawling, world class campuses early on, bigger than any other company's headquarters in the country, that would make his global customers feel like they were in a global office.

Source : TECHGIG.com