Combine Two WordPress RSS feed into a single Feed

If you have two blogs installed on same domain, you may want to combine two blogs feed into one blog feed. It will provide few benefits:

a) Ease of feed management

b) More readers

c) Better feed stats and much more

Required tools

=> MagpieRSS rss parser for php (download link)

=> FeedCreator lets you easily create RSS 0.91, 1.0 or 2.0, ATOM 0.3 and OPML 1.0 feeds with PHP (download link).

Download required tools

Download required tools to your desktop and upload to your server in myfeed directory using ftp / sftp client. Following instructions assumes that you have a shell access to server:
mkdir myfeed
cd myfeed
wget http://internap.dl.sourceforge.net/sourceforge/magpierss/magpierss-0.72.tar.gz
tar -zxvf magpierss-0.72.tar.gz
cp magpierss-0.72/*.inc .
mv magpierss-0.72/extlib/ .
rm -rf magpierss-0.72*
wget http://www.bitfolge.de/download/feedcreator_172.zip
unzip feedcreator_172.zip
rm *.zip *.txt

Create rss.php script

Now you have all required tools, just create rss.php script :

Customize script

Set temporary directory to cache rss feed, web server must be able to write to this directory.
$TMP_ROOT = "/tmp";
Set path to rss directory:
$RSS_DIR = "/home/lighttpd/theos.in/http";
Set your domain name, site title, description and author name:
$DOMAIN_NAME = "http://theos.in/";
$SITE_TITLE = "Your Site / blog Title";
$SITE_DESRIPTION = "Your Site / blog Description";
$SITE_AUTHOR = "Vivek";

Finally, set logo file name (replace logo.jpg with actual logo file name):
$SITE_LOG_URL = $DOMAIN_NAME."logo.jpg";

showSummery() function

showSummery($url,$num=10,$showfullfeed=false) fetch remote feed url and build new feed. It accept following arguments:

  • $url = Feed url
  • $num = Show the most recent posts (default = 10 )
  • $showfullfeed = true or false, for each article, show full text or summary (default false )

To combine two RSS feed http://theos.in/blog1/feed/ and http://theos.in/blog2/feed/, call showSummery():
showSummery("http://theos.in/blog1/feed/");
showSummery("http://theos.in/blog2/feed/");
showSummery("http://other-my-blog.com/feed/",5,true); // full feed

Test it

Open a web browser and type url http://your-domain.com/myfeed/rss.php

Download all files and required tools

=> You can download rss.php and required tools here (all GPL licensed except FeedCreator which is under LGPL)

Other tools – Yahoo Pipes

You can use 3rd party service such as Yahoo Pipes, which is an interactive feed aggregator and manipulator. Personally, I like to keep more control on my feed, hence I wrote this script.

Difference between HTML 5 and HTML 4

HTML has been in continuous evolution since it was introduced to the Internet in the early 1990’s. Some features were introduced in specifications; others were introduced in software releases. In some respects, implementations and author practices have converged with each other and with specifications and standards, but in other ways, they continue to diverge.

HTML4 became a W3C Recommendation in 1997. While it continues to serve as a rough guide to many of the core features of HTML, it does not provide enough information to build implementations that interoperate with each other and, more importantly, with a critical mass of deployed content. The same goes for XHTML1, which defines an XML serialization for HTML4, and DOM Level 2 HTML, which defines JavaScript APIs for both HTML and XHTML.

This document describes the differences between HTML4 and HTML5 and provides some of the rationale for the changes. This document may not provide accurate information as the HTML5 specification is still in development. When in doubt, always check the HTML5 specification itself.

Ada Lovelace – was the first programmer

Very few people are aware about history’s first programmer.

Ada Lovelace is popularly credited as history’s first programmer. She was the first to express an algorithm intended for implementation on a computer, Charles Babbage’s analytical engine, in October 1842. She really did write a program, one for calculating Bernoulli numbers. Ada, a computer programming language, is named for her.
Ada Lovelace photo picture  - was the first programmer
According to wikipedia :

She is mainly known for having written a description of Charles Babbage’s early mechanical general-purpose computer, the analytical engine.
Ada was the only legitimate child of the poets Lord Byron and his wife, Anne Isabella Milbanke. She was named after Byron’s half-sister, Augusta Leigh, whose child he was rumored to have fathered. It was Augusta who encouraged Byron to marry to avoid scandal, and he reluctantly chose Annabella. On January 16, 1816, Annabella left Byron, taking 1-month old Ada with her. On April 21, Byron signed the Deed of Separation and left England for good a few days later. He was never allowed to see either again. Ada was born on December 10th, 1815.

More information and photo credit at wikipedia article.

C++ program to calculate tomorrow’s date

Q. How do I write C++ program that calculate tomorrow’s date? For example user input a date 30/03/2007, then it should print 31/03/2007. Your program must take care of following issues:
=> Leap year
=> Validate date for month, day etc
=> Change of date/month/year should be handled properly.
Continue reading “C++ program to calculate tomorrow’s date”