Tech link coming up: http://www.gnome.org/~seth/blog//xshots
Programming
More on Comment Spam
I’ve been doing some minor perl programming to convert the standard MT security code plugin to use plain text rather than an image. This is the same conversion that I did on this blog too, but obviously I used a nucleus plugin as the basis :)
I understand that using plain text is not as “secure” as using an image, but it’s much easier to copy/paste as a user than trying to work out what the number and letters on the image are. I wouldn’t want to make the barrier to entry for posting a comment too hard!
M3
Have been working on M3 today. This is our super duper new CMS system that’s building on the solid rock of M2, our current system. It all looks so clean on paper and I have every confidence that it will speed up our site builds too. I quite like the process of planning how it’s all going to work; it’s the nitty gritty of getting it done that’s a pain!
Design Patterns
I’ve recently got a new book about design patterns. It’s really interesting and I’ve now got plans to completely redesign the back end systems at work :) I’m new in the job still (only six months!) and so inherited the mess that I’m currently working with. The current system will become unmaintainable in the next year ish without some sort of surgery, so the knack is to have the replacement come online before that happenss…
IE and modern CSS
Stupid browser doesn’t support the CSS property “min-width”! grrr…
If you need this style, the look here for a solution that work in IE5+/Win. Unfortunately it doesn’t work in IE/Mac. I have also heard that using a 1px gif that’s the same width as the min-width you want should work too.
CMS System
I’m currently setting up another site separate to the-allens.net for the software I write. I thought that rather than coding all the pages, this time I’d use a content management system instead. The only criteria I imposed was that it must be free, not impose a “box” layout and produce a site that is “search engine friendly”. By this I mean that all pages are accessible using urls without a ? in them as Google and other search engines don’t spider pages with ? in them. After a bit of searching, I found Drupal and Xaraya. I’m giving Drupal a go first as it appears a more mature product, but we’ll see.
Struggling
I’m struggling with SQL today. I’ve got a lookup table of a lookup table and can’t work out the SQL to do a search. As an example, consider the following:
Table 1 – books:
fields: book_id, price, title, author
example:
1, 2.99, ‘Life’, ‘A. Slug’
2, 4.99, ‘The Universe’, ‘A. Planet’
Table 2 – book_fields:
fields: field_id, field_name
example:
1, ‘cover_colour’
2, ‘cover_type’
Table 3 – book_field_lookup:
fields: book_id, field_id, field_value
1, 1, ‘blue’
1, 2, ‘hardback’
2, 1, ‘blue’
2, 2, ‘softback’
How do I find all hardback books that are blue?
Sorting PHP Arrays
The links section of my blog is generated from a php array because I’m too lazy to sort the list myself.
The current code is:
<?php
$links = array(
"Pewari's Prattle" =>"http://pewari.may.be"
,"Mitchell's LiveJournal" =>"http://www.livejournal.com/users/mjquinn"
,"Wintermute's Journal" =>"http://www.livejournal.com/users/wmute/"
,"Glazblog" =>"http://daniel.glazman.free.fr/weblog/"
,"Adot's notblog*" =>"http://www.mozillazine.org/weblogs/asa/"
,"Brinx" =>"http://www.brinx.org/"
,"famousamy" =>"http://famousamy.livejournal.com/"
,"sjd blog" => "http://www.stephsjournal.says.it/"
);
ksort ($links);
foreach($links as $title => $url)
{
echo "<a class='menu' href='$url' target='_blank'>$title</a>";
}
?>
i.e. it’s really simple. I just use the ksort() function to do the sort.
Question: how do I get it to do a case-insensitive sort without resorting to doing most of the work myself?
The question may become moot, as I’m considering converting it to a database system so that I can edit them using a simple on-line form rather than editing a file :)
Update
Of course, having linked to the function call in the manual, I started having a hunt around as it’s more fun that actually working!
The answer is to use the SORT_NUMERIC flag, which when I think about it, it pretty obvious… *sigh*
So, the correct call is
ksort($links, SORT_NUMERIC);
So I can now correct the title of famousamy‘s link :)
Update 2
Okay, I’m being dense; it’s still not working :)
So the original question still stands!
Work
Work, work and more work!
Finished off the 404 stuff and am very pleased that it’s all working as intended. Rest of today was spent integrating my testbed app with the actual website it’s going onto. I do wish the designers wouldn’t do fixed height designs as it makes dynamic content that much harder!
Taking control of 404
I’ve been given a requirement to provide some “marketing” URLs on one of our websites. These URLS will then be advertised and we can see which work and which don’t. The URLs will change each month with new one’s being required. So.. thinking back to a solution that a friend used, I’ve decided to do it by processing the 404 request and if the requested URL is in the database, do a redirect and if it isn’t provide a nice error page of some sort.
Doing via a database means that I can write an admin page that will allow the bods upstairs to do the changes each month and I won’t be bothered :)
Also, I need to store the request counts in a database as the standard webserver logs don’t contain the information required. No great hardship and providing some simple stats is easy enough.
All in all a good solution and I’m glad Cliff told me about about his solution to a related problem :)