Arkisto April, 2009

View daylight hours

Apr 26, 2009 in Howto

The hours of daylight change a lot in our country. The northernmost parts are above the Arctic Circle and there it’s even quite extreme:
In the summer the sun does not go down at all, and in the darkest winter, during the arctic night, it doesn’t rise.

Here are the sun-times of my location in the south today: (Ihave noticed that sometimes the page needs to be refreshed to show correctly, don’t know why)

“Sunrise 6:00am (EEST), sunset 8:42pm (EEST) at Espoo, FI (14:41 hours daylight)”

For comparison, Santa’s home area in the north today:

“Sunrise 5:07am (EEST), sunset 9:01pm (EEST) at Korvatunturi, Finland (15:54 hours daylight)”

Then why publish this information here? This kind of information is normally published in services like meteorological institutes and such.

I got interested in how to get and display this information.
I learned that Emacs has a feature built in that generates this data. The following step was to get it printed out. And of course The Usenet, once again, was the source of knowledge.
A tiny emacs script is used here and then a php function called file_get_contents. I’ll put the details on line as soon as I’ve straightened it all out, I’m still working on shaping the output a bit.

Vahis

CSS is awesome

Apr 08, 2009 in CSS, Styles, Themes

Having tried to figure out why all strange things happen and how to get them straightened out, all I can really say:

CSS IS AWESOME mug
CSS IS AWESOME by stevenfrank
Design a travel coffee mug At www.Zazzle.com
Browse more Software Mugs

Vahis

Add Javascript in WordPress pages

Apr 06, 2009 in Howto

I tried to add Javascript in these pages.

I found earlier a way to show static uptime on web pages (you’ll find it here)
So a dynamic server uptime script was something I thought was a good approach with javascript.
I ran into a script by Tony Bhimani, here:
http://www.xenocafe.com/tutorials/php/realtime_server_uptime/index.php
It’s a script with both Php and Javascript in it.

To make it work I tested different WordPress plugins.
None of them seemed to work completely.
I was able to get the script to run in Firefox (only), but there were major problems.
The plugins trashed the rss feeds which didn’t load.
At times the whole site’s layout was a mess and thanks to backups I’m still where I am with it.
So I gave up for now. I kept the script on a regular page here:
http://waxborg.servepics.com/testsite/uptime.php

I’d be pleased to hear about any success stories as for this subject :)

Put PHP Code in WordPress pages

Apr 05, 2009 in Howto

Up 57 days 13 hours 39 minutes and 23 seconds

The line above telling this server’s uptime is a result of a piece of php code inserted in this post.
(You’ll find the code in Blogroll: “Your server’s uptime”)
The code there is run and the new uptime is displayed only every time the page is opened though. So it won’t update by itself. This is how far I’ve come at this stage.
I’m not sure whether I’ll need something else than just php to have it updated by itself. Maybe javascript, I’ll have to investigate this further.

Anyway, even putting just php on a WordPress page takes a couple of additional steps though, since normally only HTML code is allowed in WordPress posts.

To insert the code there I was using a plugin called Exec-PHP, which can be found here.

The plugin is just as easy to install and use as any other WordPress plugin.

One thing is important though. The posts including php code can not be edited in WYSIWYG mode.
You’ll need to disable that mode in your user profile when editing such posts.

Enjoy,

Vahis