Using Python to analyse last years forum logs. Good coding practise discussion.
The coming of a new year is a time to look forward - and also to look back. Yes, I know we look back between Christmas and the New Year - and indeed I did so - but some things such as completing the analysis of results for the year just gone have to wait until after the witching hour of midnight!
I anticipate training a lot of people on Python this year, and with that training to be instructing them on good programming practise - from commenting and variable naming standards through to good design and structure. And "structure" means separating the various pieces of code out into logical, robust, testable and re-usable sections which in the case of Python (and most other modern langauges) means objects.
So - pulling those two elements together, I wrote my first program of 2014. It analyses the number of new posts, and the number of new subjects, on the
First Great Western Coffee Shop forum. This is a forum which I look after, as a passenger of First Great Western - it's completely independent of the company and although it started off being much more critical than supportive, times have changed and so has the suitablity of the FGW product for its customers - it's now much better - so we're now much more supportive than critical. Interestingly, where we are constructively critical, we even find our suggestions taken up.
How have the posts on the forum gone? My program (source code
[here], data file
[here]) tells me:
In year 2007 there were 7330 new posts in 1320 new topics
In year 2008 there were 25211 new posts in 2747 new topics
In year 2009 there were 25925 new posts in 1892 new topics
In year 2010 there were 24293 new posts in 2111 new topics
In year 2011 there were 21836 new posts in 1807 new topics
In year 2012 there were 18682 new posts in 1657 new topics
In year 2013 there were 22285 new posts in 1533 new topics
and if you want to read what that means to the forum, I've talked about it
[here].
The Python program's commented, so I won't add a further description here. But I will suggest that you take a look at
Learning to Program in Python which runs 5 times in 2014 if you're a newcomer to Python,
Python programming if you have prior programming experince (also scheduled 5 times in 2014) or
Intermediate Python which is scheduled 4 times if you've already done some Python and want a quick brush up on the basics, before a more serious study of some slightly more advanced stuff.
If you have a group of delegates who you wish to train, please get in touch - we can run private courses ar our centre, or on site at your offices if that makes better sense for you - and those courses can be tailored to meet your specific needs. See
[here] for more details, and a link to our quotation system. 2013 saw me training in London, Manchester, Bristol, Stevenage, Cambridge, Milton Keynes... and many more places as far afield as Switzerland. For 2014, I'm already booked for London, Liverpool, Manchester and Preston... that's during this month of January, and I can add in YOUR town too!
(written 2014-01-01, updated 2014-01-03)
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
Y050 - Python - General [16] Python training - (2004-08-16)
[2017] Python - a truly dynamic language - (2009-01-30)
[2020] Learning Python - many new example programs - (2009-01-31)
[2227] Learning PHP, Ruby, Lua and Python - upcoming courses - (2009-06-11)
[2285] Great new diagrams for our notes ... Python releases - (2009-07-13)
[2367] Learning to program - how to jump the first hurdles - (2009-08-20)
[2394] Two days of demonstration scripts in Python - (2009-09-05)
[2504] Learning to program in ... - (2009-11-15)
[2778] Learning to program in Python 2 ... and / or in Python 3 - (2010-05-24)
[2822] Python training courses for use with ESRI ArcMap software - (2010-06-23)
[3076] Python through the Snow - (2010-12-01)
[3463] Busy weekend of contrasts. - (2011-10-03)
[3489] Python courses and Private courses - gently updating our product to keep it ahead of the game - (2011-10-20)
[3519] Python - current versions and implementations (CPython, Jython, IronPython etc) - (2011-11-13)
[3798] When you should use Object Orientation even in a short program - Python example - (2012-07-06)
[3816] Want to escape the Olympics? Learn to program in the countryside! - (2012-07-23)
[3902] Shell - Grep - Sed - Awk - Perl - Python - which to use when? - (2012-10-22)
[3903] Python Programming class for delegates who have already self-taught the basics - (2012-10-25)
[3911] How well do you know Perl and / or Python? - (2012-11-04)
[3935] Whether you have programmed before or not, we can teach you Python - (2012-11-25)
[4295] A longer Python ... training course - (2014-09-16)
[4408] Additional Python courses added to our schedule - (2015-01-29)
[4434] Public training courses - upcoming dates - (2015-02-21)
[4558] Well House Consultants - Python courses / what's special. - (2015-10-28)
[4656] Identifying the first and last records in a sequence - (2016-02-26)
[4712] A reminder of the key issues to consider in moving from Python 2 to Python 3 - (2016-10-30)
Some other Articles
Melksham Rail LinkFacebook marketing - early experiencesA Question series posed to Melksham Tourist informationWhy the long gap?Using Python to analyse last years forum logs. Good coding practise discussion.Sharing my personal best of 2013Change to Libel and Defamation laws from 1st January 2014Open for the new year - ImberNot wanted here - hotel guests who will not be happyWell House Consultants - Public Training Course times for 2014