Members:
Login | Register
| Member List
(Register, which increases your permissions on the spot, and then email me to elevate your status to "full" f you'd like access to the entire site - that last part is a waste of time, btw - the good stuff is here anyway)
Here's a little bit of MovableType business, well worth its High Intensity Time Wasting status! I was browsing the MovableType Help Forums, and came across this thread. Sam wanted, as it turned out, to have a counter on his site that would retrieve the current world population, and then be able to use it in something like this:
So, being a bit of a narcissist myself, I thought I would benefit from being regularly reminded of my actual ordinariness, and thus I threw together some World Population code to enable the above demo. The first thing is a MovableType world census plugin which enables a <$MTworldPop$> tag that scrapes a government website for the current world population. Then there is some javascript for updating the population and doing some simple calcualtions.
Read more if you want to take a look at the code and play with this wonderfully frivolous distraction. Maybe you can even put it to some serious use besides the war on narcissism!
|
Maggie 19 Apr, 2003 07:34 PM |
You are such a wiz with coding Oscar |
|
Oscar 20 Apr, 2003 04:22 PM |
Sign of a mis-spent youth Maggie!
And yes, daughter had a fun egg hunt! |
|
Beatriz 23 Apr, 2003 12:22 PM |
Dear God! Someone should have told me about this before I started making statistics of world population in Excel… ha ha! Cool plugin. I just don’t have the patience (or the resources, I’m afraid) to make them work.
|
|
Beatriz 23 Apr, 2003 12:26 PM |
Uh oh! Sorry for the double comment. But I’m sure being a blog-guru you can fix it. |
|
Oscar 23 Apr, 2003 05:47 PM |
Thanks Beatriz! Yes, I used my computer brains to push the delete button on the duplicate comment You know, all you have to do is throw the plugin into the plugins directory, and then you have a new tag at your disposal. But, I know, ya gotta be in the mood for that sort of thing. I was thinking of adding some tags to the plugin, like populations for different countries, or who knows. But I figure, I’ll only do that if someone wants it!
But, hey, I am glad that youy LIKE it in any case! |
|
Neil 19 Mar, 2004 11:53 PM |
Where does the second “Chunk of Javascript code” go? Do both the first two codes go in your head of “index.html”? Also, does the last part have to be in a post, or can it go in the sidebar on the site? Thanks
|
|
Oscar 20 Mar, 2004 12:57 PM |
It can go anywhere you want. You can put it in an individual post if you are going to use it only once, or in your index template or elsewhere if you plan to use it repeatedly, i.e., if you want those functions available to you regularly without having to recode them all the time. Hope that helps ... |
|
Neil 24 Mar, 2004 02:32 PM |
Thanks alot. I have it working now on my site. http://neil.cbulock.com It’s in the sidebar right under the cost of the Iraq war |
|
John Wyles 06 Jul, 2004 07:03 PM |
The script fetches a quote from a page that is double in size (~8k rather than ~4k) and seems to be less “live” than this page from Census.gov: http://www.census.gov/cgi-bin/ipc/popclockw . Might I suggest only the following MINOR modifications?:
sub scrape_pop {
if ($c =~ /<h1>(.*?)<\/h1>/i)
|
|
Oscar 06 Jul, 2004 08:09 PM |
Right you are John (on both size and “liveness")! I’ll change the code and re-post the plugin when I get a few minutes wunna these days soon. Thanks! |
|
Susan 28 Nov, 2004 10:56 AM |
Instead of getting numbers I get letters...3 of them which state “NaN”. What the heck did I do wrong? |
|
Oscar 10 Dec, 2004 06:39 PM |
If anyone is using this plugin, the site has changed just a little, so it hasn’t been working lately. I just now updated it, so download the new one and give it a try! |
|
Susan 12 Dec, 2004 01:09 PM |
Thanks! |
|
Susan 12 Dec, 2004 01:14 PM |
okay, is the new plug-in at the same location? I am still getting the NaN thing. |
|
Susan 12 Dec, 2004 01:26 PM |
I got rid of the NaN thing, but nothing shows up for numbers now.
|
|
Oscar 12 Dec, 2004 03:59 PM |
Hmmm ... If you’ll email me your template code, I’ll try it here and be sure it’s working. But, before that, you might download the plugin again, or make sure it’s the latest one, then delete the current one on your server, then upload the new one. Then CHMOD the plugin to at least 755 (assuming your comfortable with such) - permissions are important here or plugins won’t work. If the plugin is failing to get the data, it should return “could not retrieve population” but if it is not working at all, you get a blank. In the latter case, the plugin has either become corrupted on upload somehow, or permissions are wrong.
Let me know howit goes, and feel free to ask for more help. The thing should be working |
One in a Million
If you are One in a Million, there are 6285 people in the world that are exactly like you....
WorldPop
Uses the census data from Census.gov. oscar@ofhills.com-->
World Population plug-in
Still playing around with plug-ins and track back. I just installed the World Population Gadget which screen scrapes the world population. It is a cute waste of time....
Next entry: Caravan Tablature
Previous entry: PHP Script For Terror Alert Level