Tag: Google

  • Trouble comparing dates in PHP

    The scenario.
    I’m building a custom tool which automates the curation of blogs from member bloggers’ feeds. These blogs must be fetched on a weekly basis because the intention is to make sure every member blogger, blogs at least once a week.
    Where to the feed URLs come from?
    Member joins by submitting a blog feed URL, which will save in the system manually at the moment.
    The system(bot) must;

    1. Retrieve the feed URLs from the database.
    2. The system should loop the URLS.
    3. Connect to each URL.
    4. Fetch one feed item(latest).
    5. Get the feed item date and compare it to the date of last Sunday. If the feed date is greater than the date of last Sunday.
    6. Connect to the database again and retrieve a blog item whose item title is similar to the feed item title. If a blog item similar to the feed item is returned, skip that feed item since we already have it and move to the next. Repeating steps 2 to 6.
    7. If the blog item similar to the feed item is not returned, insert it in our blog database to store it permanently.

    Tools used.
    First of all, I chose PHP programming language to accomplish the task. I would have chosen Python, however, my hosting environment doesn’t have python. Yet am also more experienced in PHP than Python.
    I also hard to extend WordPress so that I don’t have to build everything from scratch. Using WordPress will give me the opportunity to automate member sign up, log in and feed submission easier than if I used something different.
    I will eventually build a frontend interface for the system. This interface will enable the public readers to choose and read any blog of their choice as well as enable bloggers to sign up from any part of the world. Building a WordPress theme will be much easier than if I built everything from scratch.
    Alternative tools one could look at Joomla, Drupal and Django and many others.
    What have I built so far?
    So far I have built a WordPress plugin, with the following features.

    1. Automated Feed fetcher
    2. Shortcode which lists active bloggers. This is helpful for displaying member bloggers on the homepage or any page. Hence make it easy for readers to navigate blogs of any member(author)
    3. Shortcode for listing blogs. The intention of the system is to curate blogs from consistent bloggers around the world and make them accessible by consistent readers. This shortcode helps in displaying the blogs on the platform.

    Challenges

    1. Comparing dates.

    PHP has several inbuilt date functions and objects such as DataTime(), CreateDate() etc but they were not helpful. Sometimes they could function but they were never consistent. Luckily enough converting the date strings to time saved me after many trials and struggle.

    Solution

    $TimelastSunday = strtotime(‘last Sunday’);

    $TimeFeedItem = strtotime($feedItem->get_date(‘m-j-Y’));

    if($TimeFeedItem > $TimeLastSunday) {

    // Do the rest

    }

    Whoa! Whoa!
    Can’t wait to enable automated signing up, blog submission and attachment of categories and tags to the fetched/retrieved feeds.
    Thanks for reading until next time.

  • Learn the modern way of developing Web applications this festive season for free.

    Learn the modern way of developing Web applications this festive season for free.

    If there is anything I’m passionate about nothing beats the passion to use technology to benefit fellow humans.
    Since I got the opportunity to live in the generation where the world is a global community because of internet, it gifts me the privilege to learn and share. This festival season, I would like teach you about developing functional web applications using modern tools and approaches.
    Take a look at the table of contents.

    1. Prerequisite
    2. Web design vs Web applications development
    3. Extending is smart!
    4. Components of a Web application.
    5. Powering web applications with WordPress
    6. The do list application

    At the end of the tutorial I expect the reader to:-

    • To differentiate web design from web development.
    • To learn the different components together with their functionality in web applications.
    • To develop web applications using WordPress as an underlying framework.

    Stay tuned for the next post, in which I will reveal my experiences and the requirements you need to benefit from this short but practical tutorial.
     
     
     

  • A millionaire despite offering a world changing product for free for over 20 years.

    A millionaire despite offering a world changing product for free for over 20 years.

    Today I would like to publish about the creater of the web who happens to inspire me a lot because I resonate with his works.
    If you don’t know him, his real name is Sir Timothy John Berners-Lee from United Kingdom, born on June 8th, 1955 and a professor, computer scientist, engineer and public speaker widely known as Tim Berners-Lee.
    I think during his early days of employment there was a challenge to share and update information not only by the researchers where he used to work at CERN. In 1980 he proposed a solution which would for decades be change the entire planet.
    So he proposed a project based on the concepts of hypertext, to solve this problem among researchers.
    Though HyperText Markup Language was achieved in 1990, a decade after his proposal, he provided it to the world free of cost without any patents and licenses whatsover. In my personal opinion, I doubt if google, facebook and numerous popular web platforms would be in existence the HTML invention and being free of charge. Would I be able to send emails and blog?
    Some sources say his networth is $50M, rich enough to retire. The challenge we face today as young men and women is our ability to put in a lot of efforts to solove a problem we all face and open it to world for free.
    Sir Timothy John Berners-Lee has never put it to rest, at 62 years, a World changer he is still an advocate for the web, he has never made HTML private, he still teaches and talk to people.
    A take way from all this. People matter.
    Photo credit to http://olayemiogunojo.com
Verified by MonsterInsights