Archive for November, 2004

antispam screensaver

Tuesday, November 30th, 2004

http://makelovenotspam.com/intl/

“Internet portal Lycos has made a screensaver that endlessly requests data
from sites that sell the goods and services mentioned in spam e-mail.

Lycos hopes will it make the monthly bandwidth bills of spammers soar by
keeping their servers running flat out.

The net firm estimates that if enough people sign up and download the tool,
spammers could end up paying to send out terabytes of data. “

ISO 8601

Wednesday, November 24th, 2004

The ISO 8601 date/time format looks like this: 1984-09-01T14:21:31Z. It contains all the information you need. The problem with this format is that it doesn’t look the more presentable.

This is where PHP and a little creativity come into play. Consider the following code:

$isotime = "1984-09-01T14:21:31Z";
$isotime = str_replace("Z"," ",$isotime);
$isotime = strtotime($isotime);
$nicetime = date("jS F Y",$isotime);

Pretty cool, huh?

delicious linkage

Tuesday, November 23rd, 2004

del.icio.us seems to be the flavour of the month! Bloggers around the world are turning their attention to this amazing system.

I’ve been using del.icio.us for a while now and have finally written some code to integrate it into this here blog.

Thanks to an awesome PHP API I’m now able to access the raw data directly from the del.icio.us web API. Its got method calls for everything in the del.icio.us API, namely:

  • Get posts by date - http://del.icio.us/api/posts/dates
  • Get tags - http://del.icio.us/api/tags/get
  • Get posts by tag/date - http://del.icio.us/api/posts/get
  • Get recent posts - http://del.icio.us/api/posts/recent
  • Get all posts - http://del.icio.us/api/posts/all
  • Add new post - http://del.icio.us/api/posts/add
  • Delete post - http://del.icio.us/api/posts/delete
  • Rename tag - http://del.icio.us/api/tags/rename

I use the PHP API to generate the list of link categories in the bottom navigation and all the links on the links page.

I needed to write three bits of code to get the links page to work as I wanted it to.

XHTML

This was probably the most difficult part. Trying to write perfectly semantic XHTML while still being able to manipulate it with both Javascript and CSS.

I decided to use DL’s for the list of links. The code looks something like this:

<dl class="closed" id="tag_auckland">
    <dt><a href="javascript://" onclick="changeState('tag_auckland')" title="1 links">auckland</a> <a name="tag_auckland">&nbsp;</a></dt>
    <dd><h4><a href="https://connect.aucklandcity.govt.nz/ePathway/0216/Web/default.aspx">Pay Fine</a> <small>[<a href="#top">top</a>]</small></h4></dd>
    <dd>Pay your parking fines in Auckland City online.</dd>
    <dd><small>Related tags: auckland new-zealand</small></dd>
</dl>

I don’t really know why I used DL’s…it may be because I’m totally in love with them at the moment. :) Nevertheless, the end result is totally what I was looking for.

javascript

I used a tiny bit of Javascript perform a sneaky little className change as you can see below:

<script type="text/javascript">
function changeState(this_obj) {
    var obj = document.getElementById(this_obj);
    if (obj.className == &#8216;closed&#8217;) {
        obj.className = &#8216;open&#8217;;
    }
    else if (obj.className == &#8216;open&#8217;) {
        obj.className = &#8216;closed&#8217;;
    }
}

</script>

The function takes the id reference of the HTML element and changes the className from either ‘open’ or ‘closes’ depending on the current className of that element.

CSS

The CSS is actually where all the magic happens. The mix of the Javascript and the below CSS allows for the dynamic showing and hiding of the links.

margin-left: 5px;
text-decoration: none;
clear:both;
background: URL(/images/plus.png) no-repeat 0 6px;
}

dl.closed dt a {
font-variant: small-caps;
font-family: Trebuchet MS;
font-weight: bold;
font-size: 140%;
color: #004675;
text-decoration: none;
padding-left: 15px;
margin: 0;
}

dl.open dt a {
font-variant: small-caps;
font-family: Trebuchet MS;
font-weight: bold;
font-size: 140%;
color: #004675;
padding-left: 15px;
text-decoration: none;
}

dl.closed dd {
display: none;
}

dl.open{
margin-left: 5px;
text-decoration: none;
clear:both;
background: URL(/images/minus.png) no-repeat 0 6px;
}

dl.open dd {
display: inherit;
margin-left: 5px;
}

dl.open dd small {
color: #7EA1B9;
}

dl.open dd h4 {
margin: 5px 0 5px 0;
font-size: 100%;
}

so…?

So now we have all the code we need to build a links page listed by tag name. There is just one more thing left to do…make del.icio.us happy.

‘How?’, you ask. Well, there is nothing del.icio.us hates more than getting its bandwidth raped so I decided to only run this script once every 6 hours. I added a line to the crontab to run the PHP code which then generates an include file (I’ve called mine delicious.inc) that I simply include into the links page of my site. Pretty cool, huh?

I’ve included a link to the PHP code I used. Download it, use it, make it better. Just remember where you got it! ;)

Download PHP file

grey lynn festival

Sunday, November 21st, 2004

Summer is most definately on its way!

This weekend proved it by producing some fine weather. To take full advantage of the rays before they left we headed down to the Grey Lynn Park Festival. I alway like seeing how people dress up for these sorts of things. Personally I prefer to stay in my usual getup.

Lots n lots of people and stalls and and food really good music! I’ve posted a few photos of the event on flickr. Check out the flash slide-show, or the conventional HTML version.

It was an awesome day.

new host

Wednesday, November 17th, 2004

Its been quite a mission, but finally I’ve been able to move my site over to our new host.

dontcom.com; vortex.net.nz and webdeveloper.co.nz will all move over to the new hosting and live a lovely happy life…

By the way - welcome to the new site. I’ve decided to start afresh with a completely new format for my website. I’m going to try to publish on a fairly consistent basis but I’m not making any promises. Not only will I be writing stuff, but I’m going to constantly update and tweak my site as I notice the flaws.

If you notice anything, or have questions about anything you see on this site please contact me and I’ll try to explain myself. Take your time to peruse the site and don’tt forget to checkout my buddies down there on the right…