Training, Open Source computer languages

PerlPythonMySQLTclRubyC & C++LuaJavaTomcatPHPhttpdLinux

Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
A few of my favourite things

"Raindrops on roses and whiskers on kittens; Bright copper kettles and warm woollen mittens ..."

Sorry - the raindrops get me all wet, and I always get caught up on the thorns of roses. Mittens restrict the hands and make me even more butter-fingered than I am normally ... isn't it great that we're all different - we all have different favourite things!

I was in Cambridge last week, running a Perl course - and someone asked me which my favourite programming language was. Now there's a tough question, but it did lead on to a demonstration - in Perl because that's what the course was - that showed the favourite things that bring people to our web site from Google. Here are the results - showing the top words for 23rd October!

$ perl search_fodder
2385 - Perl
2055 - Java
1850 - In
1844 - Php
1754 - Python
1331 - Mysql
1003 - To
880 - Example
870 - Join
739 - Tcl
Total 14416 searches and 118619 others
0.71 0.13 0 0
$



Here's the code ... showing some really very bad things (like a complete lack of comments) and some really "wicked" things where Perl is such a passed master!

open (FH,"ac_20081023") or die;
while (<FH>) {
  if (/[&?]q=(.*?)[&"]/) {
    $ss = $1;
    $seaches++;
    @words = split(/\++/,$ss);
    foreach $w (@words) {
      $w =~ s/%(..)/pack("C",hex($1))/eg;
      $sw{ucfirst(lc($w))}++;
      }
  } else {
    $others++;
  }
}
@words = sort {$sw{$b} <=> $sw{$a}} keys %sw;
foreach $word(@words[0..10]) {
  print "$sw{$word} - $word\n";
  }
print "Total $seaches searches and $others others\n";
@taken = times();
print "@taken\n";


You'll note ...
• Use of $_
• Regular expressions to decode URLs
• Sparse matching in a regular expression
• A hash of counters
• List Slice syntax to report just "top 10" results
• Anonymous sort subroutine
• A timer to tell me how much resource was being used.

If you can identify each of those, great ... if you need help in identifying them, perhaps I should run a Perl Programming Course for you!
(written 2008-10-26 00:45:35)

 
Associated topics are indexed under
G902 - Well House Consultants - Web site techniques, utility and visibility
P211 - Perl - Hashes

Back to
Volunteer v Employee - a skewed balance? (FSB)
Previous and next
or
Horse's mouth home
Forward to
November and December Public Course Schedule
Some other Articles
Seven new intermediate Perl examples
Wiltshire at dawn - the tourist trail
Camera with night vision, youth with no vision
November and December Public Course Schedule
A few of my favourite things
Volunteer v Employee - a skewed balance? (FSB)
Three Seasonal Pictures
Well structured coding in Perl
Perl and Blackberries
Pictures from a delegate
1975 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40 at 50 posts per page


This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

© WELL HOUSE CONSULTANTS LTD., 2009: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 707126 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho