Wednesday, April 26, 2006

EText @ Adelaide Uni

Etexts under Creative Commons NC-SA licencing - including stuff like, well, all of these authors.

The paradox of pictures

The paradox of pictures: " I got busted at the Stop and Shop this morning.

It turns out that there are now even more than 19 flavors of Oreos. So I needed a photo of the new flavor for my presentation. The manager saw the flash and ran over. He made it clear that I needed permission from corporate headquarters to take pictures, and followed me around the store to make sure I didn't take any more illicit photos.

Compare this to the easiest way in the world to attract a crowd at a trade show--hire some folks to film your booth, preferably with bright lights, Bauer battery packs and a big-ass camera. Sure enough, people will show up, like moths to a candle.

The irony of the Stop & Shop approach is that the people who you don't want taking pictures--snoopy journalists or competitors--can easily conceal their cameras and you'll never know. But the raving fans, the bloggers, the folks twisted enough to want to take and flickrize their supermarket experiences are your friends.

Of course, Ahold (owner of S&S) has every right to discourage shoppers "


This happened to me some time ago (adelaide railway station & 'the warehouse'); and I couldn't make anyone understand why it felt so wrong to be treated like a shoplifter for owning a camera.

At least *now* Seth Godin has managed to articulate better what I have been trying to convey.

Sunday, April 23, 2006

Multi Format Document Generation from PHP with Open Office

My boss suggested that I take a look at the open office wiki developer documentation competition, and perhaps submit how we use OOo as an article.

On the face of it, I initially thought that what we do really falls out of the scope of the competition; but it would be interesting.

We have:
* A bunch of web servers.
* An open office machine or two.
* Load balancers galore.

When someone wants to download a PDF from our site, we open an Open Office document template, modify the XML and replace set fields, add or remove DOM nodes; then push the XML document off to the open office machine, receiving in turn a complete PDF (or word document, or anything else OOo supports).
This means that we can generate almost anything we want, have the full backing of Open Office's underlying code to handle layout; and scale very easily: the web server doesn't do any thinking, that's strictly the job of our document server.

Over the next few posts I'll add pieces of our code and a full writeup.

Monday, April 17, 2006

Firefox 1.5.0.2

Firefox 1.5.0.2 is released, fixing the annoying crashing-while-loading gmail bug and many more.

Thank christ...

Saturday, April 08, 2006

Why Google Desktop Search Doesnt Work


Here’s a quick (and extremely simplified) explanation of PageRank from Google’s site:

PageRank relies on the uniquely democratic nature of the web by using its vast link structure as an indicator of an individual page’s value. In essence, Google interprets a link from page A to page B as a vote, by page A, for page B. But, Google looks at more than the sheer volume of votes, or links a page receives; it also analyzes the page that casts the vote. Votes cast by pages that are themselves “important” weigh more heavily and help to make other pages “important.”

Now, you can understand why on the web this makes sense right? Every page should link to another, and so on. The genius of PageRank is that it establishes relevance by determining if good content is linked to by other good content. If it is, then you’ve got a nice PageRank. This is a radical departure from the early days of search where webmasters would cram keywords into the sections of their webpages in order to rank higher. That method tended to work when the earliest engines looked at the frequency in which keywords appeared in a given document. PageRank is brilliant because it tries to establish context.

Now that I’ve bored you to death, I’ll get back to the point: 9 out of 10 of the documents on your network have no links between them.
Link


So what you really need to build a half decent search tool / semantic desktop is something that helps you add metadata to documents - the like the MusicBrainz Tagger and MP3s.

A further thought:
If you can find links in word documents, for instance in homework etc; and you have access to a huge range of information about those links (like, say, google), you should be able to hazily guess that word document X with 3 links to cancer journals is a source of information on cancer.

Friday, April 07, 2006

C#

Me:

The ABR web service is handy, but it has a really annoying hidden gotcha.
Say you are doing a search of some kind with the REST style url...

ABRXMLSearch.asmx/ABRSearchByNameAdvancedSimpleProtocol2006?name=steve&postcode=&legalName=&tradingName=&NSW=&SA=&ACT=&VIC=&WA=&NT=&QLD=&TAS=&authenticationGuid=&searchWidth=&minimumScore=&maxSearchResults=

... will work, but should you not pass in some of the query params it breaks messily...

For instance:
ABRXMLSearch.asmx/ABRSearchByNameAdvancedSimpleProtocol2006?name=steve

Surely you can make it so you don't have to pass in everything!

Them:

Thanks for the feedback. As you are no doubt aware, web methods cannot be defined with optional input parameters. Therefore if you call the web method and omit some parameters then you will probably get a HTTP 500 error. I guess the theory is that web services are called from within an application and therefore ensuring the correct and complete parameter list is always supplied by the web service consumer is not such a big deal as when you have to type it by hand.

Me (to self):

WTF. You obviously are pulling my leg you lazy government red tape machine. I know: I'll google up a basic how-to-build-web-services tutorial in C# and paste it to you. Hah! That'll show you.

At this point, I ran into troubles, not knowing enough of C#'s standard ways of doing things to save my life.

Me to IRC:

Q: What am I trying to find on MSDN
(much confusion and milling about)
A: You are looking for WebMethods
A: You are looking for Overloading methods to supply default arguments
Q: AH! I remember using a language that made me do that once. So I should be able to do...


//Tacky, Tacky psuedocode
[WebMethod]
void KillAllHumans(int N) {
KillAllHumans(N, true);
}

void KillAllHumans(int N, bool everybody) {
/* Get all Dalek on somebody's ass*/
}

?
A: Yes
A: No
A: We're confused.
A: Use properties!

Q: Like this?


// dalek.aspx?method=KillAllHumans&N=1000

class Dalek {
private int n;
public int N {
get { return x; }
set { if (value == null) { x = 99; } else { x = value; } }
}

private bool every1;
public bool every1 {
get { return x; }
set { if (value == null) { x = true; } else { x = value; } }
}

[WebMethod]
public void KillAllHumans() {

//Magically inspect the request varibles / web method arguments
//and try to set all of Dalek's properties

//this.N = MagicallyGetArgument("N");
//this.every1 = MagicallyGetArgument("every1");
//Get all whoopass on Dr Who.
}

}



A: *Silence...*



How the hell do you (if at all) do this, and if you can't, why the fuck not! What kind of retarded design decision is it to be so very narrow in defining what you can take in?

So off I go to read MSDN. Voila.



public class Service1 : System.Web.Services.WebService
{
[System.Web.Services.WebMethod(MessageName="AddDoubles")]
public double Add(double dValueOne, double dValueTwo)
{
return dValueOne + dValueTwo;
}
[System.Web.Services.WebMethod(MessageName="AddIntegers")]
public int Add(int iValueOne, int iValueTwo)
{
return iValueOne + iValueTwo;
}
}



So it is possible. Somewhat. But it's still shocking.

But most annoying, are the helpful drunks:

sabiancrash: right now your trying to build a house with a screwdriver
sabiancrash: you need to learn more tools
sabiancrash: suppose i wanted to get to florida
sabiancrash: and the only way i knew how was walking
sabiancrash: would i get to florida?
sabiancrash: sure, but it should would take me longer and be a lot more inefficient than if i explored other alternatives
sabiancrash: c# is really powerful, don't just look for quick hacks
sabiancrash: what i would like to see is a searcher class
sabiancrash: that you can instance and set some properties
sabiancrash: and then call a method and it can return results in a way you want
sabiancrash: that way you only write the code once
sabiancrash: and if you need to change it you can update it in a single location
sabiancrash: but you can utilize it everywhere


Rrr. That's... really nice, but I'm not trying to build a web service, I'm trying to find out why it's "impossible" make WebMethods that are human friendly. I told you that at the start.

Trying... not to stab... people with aforementioned... screwdriver.