Friday, December 30, 2005

Bright Young Sparks

Dan Egnor, anyone? You probably don't know him and neither did I, so here's why he's a smart boffin:

Geographic Search
Google contest submission

This is the submission that won the 2002 Google Programming Contest. It includes a geocoder (which uses TIGER/Line data to turn street addresses into latitude/longitude coordinates), a simple indexer that looks for addresses and keywords in documents, and a query engine to search for documents matching certain keywords that also contain addresses within a certain distance of a target location.

If any of these components might be useful to you, feel free to download a tarball, read the README file or browse the CVS repository.

Update (5 Nov 2005): The builder now supports Second Edition TIGER data, and a bug affecting address geocoding accuracy has been fixed. Thanks to Bill Thoen for the patches!

My code is available to the public under the terms of the GNU General Public License. Portions of my submission are derived from Google's contest materials, which are covered by their own license. See the LICENSE file for details.

You may find it helpful to download a pre-built index of the 2000 TIGER/Line data; you can feed this to "geo-client" to get a functional geocoder. Be careful, this is a 300MB download.

Please do not ask me to support this code. I will accept bug fixes but that's about it.

-- Dan Egnor

Resume.


Google local, anyone?

Thursday, December 29, 2005

Chandler 0.6

Chandler 0.6 is out. I have no idea how to describe it apart from "it does everything".

It's meant to be based around the idea of organising information in one global pool, rather than in individual applications to do each thing which are all unable to communicate.

Some observations:
* I'm setting an alarm on my calendar - am I setting it for N minutes BEFORE the event? After? What's going on here?

* It lets me pop in a new collection of information from, say, Flickr: My computer slows to a crawl and Chandler doesn't show any visual indications of doing things. I wander off for coffee and find it's finished - this speed issue is bad :(

My work machine is a beast too.

* When setting up email accounts: "use as default from account" is a radio button; I've only got one account, and now I can't deselect it.

* It needs a quick and dirty training tour - "get started by adding..."

* When I create a new item, it's not obvious enough that I have to click the "prepare this item as a (thing)" icon(s).

* I'm in a task view, and I create a new item, I expect it to be a task (by default) - but it isn't.

* New mail: the notifications aren't clear enough. When new mail is received, it's non obvious that you have to switch to the mail tab.

Saturday, December 24, 2005

Holy Catfish, That's The Biggest ***NING mug I've Ever Seen

Christmas haul to date:
* Drinks from work where there was a bar tab - eleventyonebillion pints of pale consumed.
* A pool pony (Henry).
* A package from Ning with the BIGGEST FUCKING MUG I EVER SAW.

Wednesday, December 21, 2005

Tuesday, December 20, 2005

Random Encounters

I was just loafing about on IRC trying to upload a minor change to BookFeed to stop the bastard from sending me a thousand identical posts each day, but Ning was having none of it.

I ditched FileZilla for the day and went with PSFTP: at least I could properly connect each and every time. But since (?) the upgrade there's snafu me being able to edit files.

So I was just loafing about, as I said before, when in pops Fabricio Zuardi - maker of the great and impressive Flash XSPF player which is now a widget on my google homepage.

This has prompted me to (plan to) make an Upcoming.org + Audioscrobbler mashup: find artists coming to my metros and fill my playlists with their music, the closer the event the more tracks in my daily playlist.

Sunday, December 18, 2005

Just Look At Some Of The Crap On In Adelaide

Adelaide events on Upcoming.org - with the Adelaide festival coming soon, I'm getting excited.

Why am I excited?


Flying Balloon People. 'Nuff said.


It occurs to me that I need a button to click in firefox to extract highlighted information, and pull up the upcoming.org "add event" interface - albeit as a firefox extension. It's too much like hard work any other way.

Being sleepy, I'm just going to ask the almighty LazyWeb for help on this one.

Friday, December 16, 2005

Think Ning Triples : How to build an object content store searcher thingamus

I've been thinking about patterns a lot more recently. I'm really fond of the Ning style of chaining together objects magically.

$foo = Foo::factory()->name("bar")->age("old");

I'm also really fond of thinking in triples: I just haven't gotten PHP to do triples nicely. In other RDF handling code it's awfully complicated when you start getting to literals, resources, and all sorts: you get dazed and confused before you know it.

In an effort to better grok a php + triples + ning pattern, I gave the below a bit of a bash.


<?php
class Relation {

public $s;
public $p;
public $o;

public static function factory() {
return new Relation();
}


public function p($predicate) {

$this->p = &$predicate;

return $this;
}

public function s($subject) {

$this->s = &$subject;

return $this;
}

public function o($object) {

$this->o = &$object;

return $this;
}

public function __toString() {

ob_start();

print $this->s;
print ' ';
print $this->p;
print ' ';
print $this->o;

return ob_get_clean();
}
}


class Person {

public $email;

public function __construct($email) {
$this->email = $email;
}

public function __toString() {
return $this->email;
}
}

$bob = new Person("mailto:bob@bob.com");
$susan = new Person("mailto:susan@susan.com");
$frank = new Person("mailto:frank@frank.com");

$graph = array();
$graph[0] = Relation::factory()->s($susan)->p("likes")->o($bob);
$graph[1] = Relation::factory()->s($graph[0])->p("=")->o(.50);

$graph[2] = Relation::factory()->s($bob)->p("hates")->o($frank);
$graph[3] = Relation::factory()->s($bob)->p("hates")->o($susan);

$graph[4] = Relation::factory()->s($graph[2])->p("=")->o(.77);
$graph[5] = Relation::factory()->s($graph[3])->p("=")->o(.11);

function whoLikesBob($graph) {
$bob = new Person("mailto:bob@bob.com");
$susan = new Person("mailto:susan@susan.com");

$target = Relation::factory()->p("likes")->o($bob);

$pattern = array("s" => false, "p" => true, "o" => true);
$triple = find($graph, $target, $pattern);

print "Who likes bob? ";
print $triple;
}

function find($graph, $targetTriple,
$matchPattern = array("s" => true, "p" => true, "o" => true)) {
$match = array("s" => false, "p" => false, "o" => false);
foreach ($graph as $triple) {

foreach (array("s","p","o") as $property) {
if (isset($targetTriple->$property)) {
if ($triple->$property == $targetTriple->$property) {
$match[$property] = true;
}
}
}

if ($match == $matchPattern) {
return $triple;
}
}
}

foreach ($graph as $triple) {
print $triple;
print "\n";
}


whoLikesBob($graph);
?>



What does it do? The triple pattern (Foo::s(), Foo::p(), Foo::o()) allows us to just stick anything into anywhere and define a predicate of any kind.
find() is a really simple method to get an array of triples, and a target triple and return that. Not wanting to build a SPARQL parser or anything that large, we've just got a simple match pattern.
find($graph, $triple, array("s" => true, "p" => false, "o" => true)) simply matches the subject (s) and object (o) properties, and doesn't even inspect the predicate.

find() could be quite readily changed to return an array of triples, which you then can render, manipulate, etc.

It's GAIM 2.0.0 day

Gaim 2.0.0 is to be released today, Friday Dec 16th!

Semantic Web Technologies Tutorial Slides

Yet more Semantic Web related slides - even if you don't grok well enough, keep clicking, there's some nice colors in there :D

Tuesday, December 13, 2005

Yahoo Widget Engine vs Google Desktop Search

I trawled through the "2000" or so widgets available for Konfabulator.

I got the "days till retirement" ticker, a HAL9000 widget, and one other: a coffee alarm.

Now while these things certainly look pretty, I am struck by the non-functional nature of them. My Google Desktop Search Sidebar handles: Google Talk, Email, ToDo and Scratch Pad, plus rapidly locating files. It would be nice to be able to float these elements around the place, ala Konfabulator, but I'm not too fussed. It would be nice also to stick MSN or GAIM into it, and tuck it away.

YWE however, doesn't appear to have anything really that useful: perhaps the Hash comparer widget isn't such a mundane idea, but there's nothing... stunning.

Where has all of the innovation gone?
Nothing here will change my computer usage habits much at all - the coffee break alarm, maybe.

Erstwhile, Jon has been watching the sunset, and I think that's a very, very nice idea - reminds me to stop working and admire the granduer of nature.

Monday, December 12, 2005

Regression Session

We're being bitten in the ass by a minor but maddening Firefox Regression Bug. Cookies aren't staying set properly, in both 1.0.7 and 1.5.

This means our users are getting booted out every three seconds. ACK!

The First Proactive Steps

So I was recently dumped-but-not, which has put me in a pickle. In an effort to cut myself off from dealing with the individual in question, I told her no contact for about two weeks, otherwise it's just going to be messy.

That was not received well at all. To distract myself from the constant thoughts of misery, I took to cleaning my desk: a fresh start, new beginning, whatever.

It turns out that the entire office uses my desk as a clearing house for problems - I'm finding stuff marked urgent that I've never seen before that isn't even anything to do with me.

It would appear that most things marked urgent can actually be worked around, because it's been buried in the pile and promptly forgotten; but nothing has burned down.

So, when I get to the bottom of the mess infront of me, maybe... just maybe... I'll be able to find some left over coins for the coffee delivery guy and remember what happynessan effective work day is like.

Friday, December 09, 2005

Cart Shelter

http://www.designboom.com/cart_shelter.html - cart design for the homeless; this is something I want to enter

Bookmarklet: Online Scam Retailers

Drag this to your toolbar: Online Scam Retailers.

After reading http://thomashawk.com/2005/11/priceritephoto-abusive-bait-and-switch.html and having being burnt before by some dodgy site operators, I whipped up a bookmarklet to help me avoid Online Scam Retailers.

SNAFU of the day: All things are not created equal.



class blah {
public static function getJobs($valfirm_id, $alloc_status = self::ALLOC_PENDING, $alloc_status2 = self::ALLOC_ACCEPTED) {
global $db, $log;

$sql = "SELECT DISTINCT job_id
FROM tbl_valfirm_allocation_queue
WHERE valfirm_id = ? AND alloc_status = ?";

if ($alloc_status = self::ALLOC_PENDING) {
$sql .= " ORDER BY job_id DESC LIMIT 25"; // Pending
}

var_dump($alloc_status); //I produce int(1)

///extra stuff
}
}

var_dump(blah::ALLOC_REASSIGNED); //I produce int(4)
blah::getJobs(1, blah::ALLOC_REASSIGNED);



Puzzle: What's wrong with it?

All things are not created equal. I found this mistake of mine only after reading everything thrice; I rarely do this so didn't look for it straight away.

This particular bug has annoyed our admin girls for 3 days now, which means we get yelled at.

Angry Parkers & Cluttr Followup

I'm beginning to get a little worried. The other week I was talking about how I heard about the chemical effect of love wearing off after a limited time (but I couldn't find any papers / articles to support what I'd heard years ago) to a friend, then I came across an article on the subject published within days.

In the same fashion: Google has read my mind and come out with Google Transit - public transport route planning.

Hurry up Google, I want my maps of Adelaide, and I want my public transport timetables of Adelaide too.

Thursday, December 08, 2005

Cluttr: Part N

So guess who's been thinking about designing carparks?

I found Cluttr, again - this is a spatial analysis tool for doing the exact thing that Cluttr was meant to have.

Now you just need to be able to mash up the random CAD plan maker / design your house thinger into it.

People Should Be Shot

I had a friend come to visit me at lunch today.

She made the mistake of parking for 20 entire minutes in a company's carpark, because there was nowhere anywhere to park.

When we returned, an angry man started a verbal sledging. His company stuffs about 7000 cars into a carpark with sufficient space for ... 5. When people do this to the company, the company gets employees to box in the offender's car with their own.

What, exactly, is the point? To catch the offender and yell at them? I don't see how this solves the company's parking problems. Once he started brindling, I found that I was too tired and too hungover to tolerate it - so I asked "how do we rectify it".

He looked about ready to hit me that I'd cut him off mid tirade with "let's make a solution, because I really don't care for this". When he'd finished I think we were largely unmoved, perhaps my companion was a little unsettled.

Apparently it was the company director and sales manager who'd boxed us in: they were polite and we were polite in return, when they emerged to shift the cars. Politely and calmly telling us not to park here in the future would have resolved the issue; but now I'm thinking I'd like to purchase a shitbox of a car just to park there. Spite is a wonderful thing.

Problems raised by the angry gentleman:
Did we not see the sign that says don't park here? (no, we didn't)
Can we not find any other place to park? (no, not really)
This happens regularly.
There are too many people working and trying to park in too small of a place.
The cars are unused except for transport to work, lunchtime, then returning from work - but must be stored.
For one person to leave requires up to 3 other people to move their cars first.


Possible solutions:
Make the sign more visible, and put up a fence to encourage the idea of private parking - it looks public, and easy, so people park in it.
Speak to Adelaide Metro about the Workplace Deal - see what could be done.
Ride a bike to work (If I can do it, he can do it).
Optimise parking order to make edge cases easier to deal with.

What other innovative solutions are out there for revamping urban sprawl?

Tuesday, December 06, 2005

Note To Self: OpenID / Some kind of SSO for Bugzilla

How hard can it be to hack OpenID support into Bugzilla? Original complaint.

I'm thinking this might be a good "learn perl better" project for myself.

Seagull 0.4.6 is a snap!

Seagull is a PHP framework: think rails, but... not in ruby. To get up and running with it, I simply downloaded the right file, went into the command line and did a bit of a
"pear install -a seagull-0.4.6.tgz".

It's a snap to install.

The next step for me will be Creating a Simple Site - let's see if I can't get my latest project out in under a week.

Seagull 0.4.6 is a snap!

Seagull is a PHP framework: think rails, but... not in ruby. To get up and running with it, I simply downloaded the right file, went into the command line and did a bit of a
"pear install -a seagull-0.4.6.tgz".

It's a snap to install.

The next step for me will be Creating a Simple Site - let's see if I can't get my latest project out in under a week.

Monday, December 05, 2005

Wanted: Lxr + DokuWiki + Google Desktop Search

I want a plugin for GDS that indexes and cross references PHP code - it should work like Zend's control+click to load a class, but it should be fast and easy to search.

It should also tie directly into documentation if it exists.

I'm sick of have a funky method added to a class by a codeveloper in an effort to increase the size of a big ball of mud, only to be unable to deprecate it properly because I don't know what it will break.

That's What I Call A Googlefight

Google vs Whingers - authors and publishers have launched into a suit against Google booksearch, claiming that it's wrong on principle that Google has "appropriated" their catalogs of books.

It's an intellectual smackdown well worth your watching; and though I am biased, I'd say that the publishers look like dinosaurs - unsuited to the digital age.

Get the torrent today.

Friday, December 02, 2005

The Beer O'Clock Bug

A report on our system was going from
mktime(0,0,0,1,1,2005);

to

mktime(11,59,59,1,31,2005);

This report concerned the amount of work done in a month.

So why is it called a beer o'clock bug ?

:D

A problem

Word picture of problem.

Clients order jobs.
Companies (valfirms) accept jobs.
A job can be distributed to a number of companies.
A client states a preferred order of companies for a job to be offered to.
A company may accept or reject a job.
If a company accepts a job, it is not offered to any other companies in the queue.
If a company rejects a job, it is offered to the next company in the queue.
A company may accept then DISTRIBUTE a job on behalf of another company:
i. The client sees a job as accepted by the first company, and never knows about the second.
ii. If the second company rejects a job, we go back to the DISTRIBUTE stage.

Code so far:

table queue (client_id, job_id, valfirm_id, sequence, timestamp, allocation_status).


SELECT * FROM queue WHERE allocation_status = 'PENDING';

foreach $result as $job {
//If a job is not accepted already by ANYONE
//If a job is not rejected by ME
//If I am the topmost valfirm, as ordered by SEQUENCE.
SELECT magicsql...
}

Problem with this approach:
27000+ jobs in DB.
Grabbing all that have PENDING somewhere in them means that we have to iterate through 27000 rows, performing 3 checks (anyone, rejected by me, am i topmost?)
Slow!

Better approaches?

Thursday, December 01, 2005

Opera Community SPARQL platform

Reminder to self; play with opera's sparql endpoint later on.

This might even make me go back to being a bit more of a Starving Hungry Web Designer!