Thursday, 01 November 2012 17:43

This Day in Tech

Console and PHP/Joomla scripts to dump out entries from Tom Merritt's chronology of tech history.

Introduction

This is a couple of scripts and console applications that dump text entries from Tom Merritt's Chronology of Tech History book for the current day: https://merrittbooks.squarespace.com/2012/10/17/chronology-of-tech-history

It's a nice bit of geeky fun. The idea to use Tom's excellent book like this came from the unix fortune program which has kept me amused whenever I load my homepage for many years.

The Joomla plugin does this:-

  • On this day in 1954 - At 5:30 PM the world's first nuclear power station was connected to the power grid Obninsk, USSR, a small town 60 miles south of Moscow.
  • On this day in 1974 - At 8:01 AM, a supermarket cashier scanned a 10-pack of Wrigleys chewing gum across a bar-code scanner at Marsh Supermarket in Troy, Ohio. It was the first product ever checked out by Universal Product Code.
  • On this day in 1997 - The US Supreme Court struck down a portion of the Communications Decency Act as violating the first amendment protecting free speech.

or this:-

  • On this day in 1974 - At 8:01 AM, a supermarket cashier scanned a 10-pack of Wrigleys chewing gum across a bar-code scanner at Marsh Supermarket in Troy, Ohio. It was the first product ever checked out by Universal Product Code.
  • Download

    Binaries for all platforms are in the archive (along with the joomla plugins). Provided in .tar.gz and .zip for convenience.

    FilenameDateSize
    .htaccessMay 25 2014 17:11:1114b
    README.rtf rich text README file for everything here
    README.rtfMay 25 2014 17:11:1118230b
    README.txt plain DOS text README file for everything here
    README.txtMay 25 2014 17:11:113964b
    Tom Merritts Chronology of Tech History Joomla Content Plugin for Joomla 1.5+
    joomla_plugin_content_tdit_1.5.zipMay 25 2014 17:11:1195224b
    Tom Merritts Chronology of Tech History Joomla Content Plugin for Joomla 2.5+ (including 3.0)
    joomla_plugin_content_tdit_2.5.zipMay 25 2014 17:11:1195221b
    Tom Merritts Chronology of Tech History console app - Binaries for OSX, Windows and Linux as tar.gz archive
    tdit-binaries-all-platforms.tar.gzMay 25 2014 17:11:11581305b
    Tom Merritts Chronology of Tech History console app - Binaries for OSX, Windows and Linux as .zip archive
    tdit-binaries-all-platforms.zipMay 25 2014 17:11:11582382b
    Tom Merritts Chronology of Tech History PHP Scripts
    tdit-php.tar.gzMay 25 2014 17:11:1194063b

    The source code is here.

    Installation

    Console versions in the binaries are compiled for Linux, OSX, and Windows.

    It uses an sqlite3 database for it's storage so you need probably need this installed on your system if it isn't already. A Windows DLL is included with the windows binary which should take care of this. On OSX it should work out of the box. On linux you might need to install sqlite3. On Redhat type distros something like

    yum install sqlite

    should do the job. On Debian style distros something like

    apt-get install sqlite3

    Should do the trick.

    Command line usage for the console program:-

    You can copy the database (tdit.db) to /etc for linux distros, or you can specify where to find the db with the -d command line option. The help from the console app:-

     

    This Day in Tech
    Based on Tom Merritt's Chronology of Tech History
    Usage: tdit [-d databasefile] [-r] [--help]

    -d databasefile : specify the database file to use.
                     Will try /etc/tdit.db or ./tdit.db if
                     not specified or found.
    -r              : print a single random entry for the day
                    (otherwise print all entries)
    --help          : print this help

    Plain ol' PHP

    There is a plain PHP version which can be used by including the edit_functions.php file and calling the tdit() function:-

    function tdit($action)

       returns a string with This Day in Tech Quote(s).

    Specify the strings 'all' or 'random' as the $action parameter to print all entries for today, or just a single random one respectively.

    function tdit_dm($action,$day,$month)

    Does as above but lets you specify a day and month. There is also test script which dumps the whole book.

    Joomla Plugins

    There is a Joomla 2.5 and a Joomla 1.5> version.
    Tested with only  Joomla 3.0 and Joomla 1.5 because that is what I had access to.

    Install the plugin in the normal way. You need sqlite3 php support on your server (usually built in to PHP5+). To use the plugin, in your content insert

    {tdit‌}single{/tdit}

    or

    {tdit‌}all{/tdit}

    and the text above will be replaced in an article with the either a single event for the day or all the events for the day as a unordered list with the css class tdit_list.

    NB: If you get no output for an entry check the tdit/tdit_functions.php  file in the joomla plugin install. The htmlentities function was causing output to disappear on one server I tried it on. YMMV.

    Building the console programs from source

    Download the latest source code from here (click on the zip or tar.gz icons). Extract the archive somewhere. I've built successfully so far for 32 bit linux, 64 bit linux, 32 bit OSX and for 32 bit Windows (on 64 bit windows).

    For windows you need a MinGW/msys setup. Though it should build easily enough with any C complier.

    It just seemed to work on OSX. On linux you need the usual gcc GNU make etc.

    To build:-

    cd into the extracted directory.

    Just type:-

    make -f nameofthemakefilefortheplatformyouron

    e.g.

    make -f Makefile.linux

    And it should all build.

    NB: The Makefile.linux32 makefile is to build a 32bit binary on a 64bit linux system.

    Follow the installation instructions to install.

    Licence

    This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License as is Tom's original work.

    http://creativecommons.org/licenses/by-sa/3.0/deed.en

    Thanks to Tom Merritt for a great project.

     

     

     

     

    Read 9032 times Last modified on Friday, 02 November 2012 11:51
    More in this category: Empathy Jukebox »

    Leave a comment

    Make sure you enter the (*) required information where indicated. HTML code is not allowed.