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!