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