- Calendar -

March 2010
Mo Tu We Th Fr Sa Su
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31

- Archive -

- Browse By Random Tag -

- Most Commented -

- Random Favourites -

- Blogs I Like -

- Email Viruses Received -

- My Geek Code -

-BEGIN GEEK CODE BLOCK-
Version: 3.12
GIT d-- s: a- C++ UL++ P+++ L+++ E--- W+++ N+ o-- K- w--- O- M-- V- PS+++ PE-- Y++ PGP t++ 5+++ X R tv b+ DI+ D++ G e h r+ y+
--END GEEK CODE BLOCK--
Get The Encoder
Get The Decoder

- My Blog Code -

-BEGIN BLOG CODE BLOCK-
B6 d+ t++ k+ s++ u-- f i++ o+ x+ e l c-- --END BLOG CODE BLOCK--
Blog Code Encoder
Blog Code Decoder

- The Internet is Cool -

- Nifty Blog Toys -

RSS Feed

- Content License -

Blog

MySQL Views Don't Like Groups

I ran into something interesting this morning while trying to patch some bugs in my blogger that I thought I should share. In short, you shouldn't use GROUP BY statements in a VIEW if you intend to benefit from any indexes on the original columns. Basically, the GROUP BY nullifies the index.

To explain further, I'll include the example I was working on here.

I have a caching table called c_blog that's populated by a more complex query on blog post creation or comments. That table has the following structure:

CREATE TABLE c_blog (
    id INT UNSIGNED NOT NULL,
    title VARCHAR(255),
    content MEDIUMTEXT,
    music VARCHAR(255),
    created DATETIME,
    modified DATETIME,
    comments INT UNSIGNED NOT NULL,
    private BOOL,
    worksafe BOOL,
    favourite BOOL,
    allowComments BOOL,
    UNIQUE(id),
    FULLTEXT(title,content),
    KEY(created),
    KEY(private),
    KEY(worksafe),
    KEY(favourite),
    KEY(allowComments)
);

Note the FULLTEXT index on title and content. I use this in my search section to get sorted results based on relavence.

However, security is handled by means of a view. I find out what kind of user you are, and select the appropriate view to use so the right people see the right stuff. However, the v_blog_private view looked like this:

CREATE OR REPLACE VIEW `v_blog_private` AS
SELECT
    v.id,
    v.created,
    v.modified,
    v.content,
    v.title,
    v.music,
    v.comments,
    v.private,
    v.worksafe,
    v.favourite,
    v.allowComments,
    l.user
FROM
    v_blog v
LEFT JOIN
    blog_lkp_blogUser l ON l.blog = v.id
GROUP BY
    v.id;

And running that view in my search section blew up with the following error:

Can't find FULLTEXT index matching the column list

Now, clearly, the FULLTEXT index was there. The problem comes with the fact that the GROUP BY statement in the view was generating a completely different result set that was in itself not indexed.

The solution was simple enough, just move the GROUP BY out of the view and into the actual query calling the view. But the problem confused me enough that I figured I should post it here for others to find.

The TTC's Other Survey

A short time ago, The TTC released a survey to the public asking for input in how to deal with their latest budget crunch. It was mostly questions like "We're broke. Would you rather pay more or have less?". The survey was criticised by transit activists all over, and so Torontoist has posted a better survey the results of which will be delivered to the TTC when it's finished.

If you live in Toronto, I encourage you to do both surveys, but definitely do the Torontoist one... it's better.

The Green Party Wants a New ED

The Green Party is looking for a new Executive Director. I found out about the job by way of an email sent out to all GPC members just now. How cool is that really? Here we have a federal political party that's openly posting jobs to the public. It doesn't get more democratic than that.

New Banner Rotation

I've installed some simple code to rotate the header above so now the site should be a little prettier. More prettiness coming... as soon as I figure out how to make stuff pretty :-)

"Highway of Heroes"

I really want to comment on this highway renaming business. For those who haven't heard, a bunch of people have created a petition to rename a portion of highway 401 to "Highway of Heroes" to commemorate the men & women who've died overseas who's flag-draped coffins make the procession down that very stretch of asphalt when their bodies return home.

Maybe I'm being irrational, but this kind of thing makes me absolutely furious. For starters, the term "hero" is thrown around far too much and (at least in my opinion) should not be assigned to just anyone who dies in the line of duty.

These soldiers are Our Honoured Dead, people who died because they chose to fight for Canada and Canada sent them into a warzone. That's both respectable and honourable, even remarkable... but is this heroism? No. This sort of renaming campaign just supports a propaganda machine that works to convince people that war is glorious, even righteous -- a lie so far from the truth it makes me ill.

And if that doesn't piss you off, how 'bout the thought that of all the things in this country we could attribute to our soldiers, we choose a stretch of grey pavement. What a terrible way to honour these people.

A Google Map of where I'm Going


Note that Google appears to have a problem figuring out the whole "round the world" bit. For some reason it will sometimes draw a line between Vancouver and Toronto, or two lines between Rome and Seoul. I can't get it to draw a line between Seoul and Vancouver... o well.

Bedless in Toronto

About 5years ago, two strange men came to my house, gave me a piece of paper and walked off with all of my worldly possessions. Yesterday morning, it happened again.

I'm officially bedless. The movers showed up yesterday, picked up nearly everything I had and loaded it into a tiny corner of their truck (I don't have much stuff). In exchange, I received a little piece of paper with a couple signatures and a promise that it'll arrive in Kelowna in "about ten days". From now until sometime late in November, I'll be living out of my backpack -- a prospect that's both kinda scary and exciting.

Melanie has offered to put me up 'till I leave, so I'll be sleeping there 'till I head to Europe. She's also playing host to my noisy server for which I'm very greatful as it hosts this site, my email and will be the staging area for image uploads while I'm shooting on my trip.

On an unrelated note, I believe I've patched my site to compensate for Internet Exploder's shortcomings as well as a hole I found in my commenter that failed to moderate posts. So if you see any new problems with the layout, or have trouble commenting, please let me know.

New Digs and a New Site

After much lifting and hacking, I've moved moulinrouge to Melanie's house for the duration of my trip. It'll live here while I'm wandering through Europe and Korea so I can have a place to post pictures and blog :-)

As an added bonus, you may have noticed that the site is BRAND FRICKIN' NEW today. I've been coding this baby for months now on the subway, in parks, in bed and on Melanie's couch... it's nifty, it's new, and it has a bunch of kickass features:

  • I've created a truncated RSS feed and plugged it into Facebook. I wanted to make sure that people commented in just one place (here) and not both here and that site.
  • Wider format. Hope you like it. If you don't, you can shrink your window :-P
  • New Spammer protection. I can't say spammer-proof, but it should be enough to make it too complicated for them to bother.
  • New Tagging system. Blogs are now tagged dynamically so I'm no longer bound by those few categories.
  • Sexy new search feature. Try it out :-)
  • New snapshots section. Everytime I shoot something with my camera phone, I can upload it here.
  • New look & feel. Ok, it's not as pretty as the original, but I was in a hurry. I'll try and pretty it up more before I leave.
  • Fully MVC system. This is a complete rewrite using all the tricks I've picked up at Riptown.
  • More admin tools
  • Really cool backend stuff for my imager. I needed these for my trip.

Now, if you'll excuse me I'll be trying to get some sleep before dawn. Do me a favour and try to break the site eh? Leave comments, change your preferences etc. Please email me if you find anything amiss.

"Danlandia"

Danlandia

A few months ago, as we'd just moved into the new downtown office, Ahmad was feeling separated from the rest of our team. The problem was that he was sitting on the far side of our desks and would have to walk all the way around to take part in conversations etc.

His solution was to separate my desk from Aileen's and give himself a little canal in which to pass through and visit with the rest of us. This resulted in the creation of a little island composed of my desk and 2 other empty desks, one of which housed our library. The other teams began referring to it as "Dan's Island" and that's when Corey came over and delivered my flag: Behold, the nation of "Danlandia".

I've had my flag up ever since, even though Danlandia is now populated by two developers and a library (I imagine Talesh will rename the island after I'm gone). The flag stands to my right, next to my Nerf guns (the Danlandian military) and the other "citizens": Ari, Zim, Gir, Naruto, some crazy guy with white hair and a pet frog and of course, my menagerie of plastic animals from Milestones.

Anyway, as a parting gift, my teammates at Riptown gave gave me a commemorative tshirt in recognition of the nation upon which I've served for the few months I've worked in this office. It's a lovely gesture and I'm totally gonna wear it around Europe. Thanks guys, you all rock bigtime.

The Day We Killed a Blow-up Doll to Protest CCTV

In an effort to draw some attention to the CCTV problem downtown, my campaign did up some street theatre where we murdered a blow up doll complete with fake blood. It was fun. Here's the plan, as laid out in our Facebook event:

We will gather at the Tim Hortons, discuss the plan, then leave separately to our designated starting locations. Shayla the blow up doll will wander up the street when the rest of the "suspects", dressed similarly, converge on her.

As everyone passes her, we'll burst a plastic bag of red (water-based) paint will burst on the doll's chest and Shayla will scream: OH MY GOD! MY BLOW UP DOLL'S BEEN STABBED! (complete with flagrant hand gestures etc.)

The suspects will continue in their original directions spraying more water-based paint along the sidewalk showing their direction until they move out of view of the camera (either into an alley, or a crowd.)

While this is happening myself and other interested volunteers will be handing out pamphlets designed by our brilliant graphics guy explaining what's going on and directing people to the website.

Lastly, the "real murderer" will make a confession on Speaker's Corner explaining what's just transpired, directing viewers to our site as well.

Shayla in Mourning

Well the grand plan didn't work out exactly as I had intended, but it was fun nonetheless. Firstly, there were fewer people around than I would have liked, but it's what you can expect on a Saturday I suppose. Secondly, my choreography sucked and our use of less-damaging Silly String instead of paint meant that a lot of the colour of the thing didn't work out. Lastly, I printed up the wrong set of brochures so what was distributed was the version with the draft copy instead of the properly proofed copy and it showed.

With the negative stuff out of the way though, it was still fun and we may still make a valid point. Shayla (the mourning friend) was fucking amazing. Her screaming and improvised (yet high-larious) cries had me laghing my ass off. We'll have to request the footage from the cops and see if anything was really captured and then do another press release explaining how the cameras couldn't have prevented this even if it was a real killing etc. I can't wait to hear if we get any fun press around the Speakers Corner bit. That'd be nifty.

Anyway, if you haven't seen them yet, here's some snippets of what happened. Stephen took some great pictures with his shiny camera and posted it all in his Flickr account, and Torontoist did a story on the whole event:

...and that pretty much marks the end of my career with the Toronto Public Space Committee. It's been amazing and dare I say, "life changing" experience. It's a hell of a feeling being able to engage City Hall and tell the mayor to his face that he's doing it all wrong. Sometimes they listen, most often they don't, but sometimes... you make the world better. ...and that's hard to beat.

pit-faulty