page_load doesn’t fire

22 Mar 2006

,


The Page_Load event in one of my pages was not firing – I eventually tracked this down to the InitializeComponent function (inside the “Web Form Designer generated code” block) The following line, which should have been automatically generated, was missing :

this.Load += new System.EventHandler(this.Page_Load);

The trouble is that I tend to stay away from the design view and work almost exclusively in the HTML view. And in making a new page, based on an existing one, this vital line was omitted. Much frustration.

It should be a simple query

3 Mar 2006


Get a list of users and the most recent training course they have attended. This should be a very simple query with a sub-select, but I’m using MySQL 3.23 and sub-selects are not available, so queries have to be rewritten using joins. (Sub-selects are available from MySQL 3.24 onwards). Took me a while:

select
   t1.*
from
   usertraining as t1
   left join usertraining as t2
   on t1.user_id = t2.user_id and t1.training_date<t2.training_date
where
   t2.training_date is null

This matches up the training courses. When the date is at its maximum (ie. the most recent) there are no matching dates in the joined table which are greater than that – so the t2 entries for that row are Null – and we use the where clause to pick out exactly those rows.
Another way to do it:

select
   t1.*
from
   usertraining as t1
   left join usertraining as t2
   on t1.user_id = t2.user_id
group by
   t1.training_date having t1.training_date = MAX(t2.training_date)
where
   t2.training_date is null

And of course, to get the user details is then very simple:

select
    users.*, usertraining.*
from
   users left join
   usertraining as t1 ON users.user_id = t1.user_id
   left join usertraining as t2
   on t1.user_id = t2.user_id and t1.training_date
where
   t2.training_date is null

How to waste time when you’re setting up your own business

21 Feb 2006

,


Trying to decide on a business name is a an incredible distraction, especially when you’re looking for the accompanying domain name. There seem to be three general approaches:

  1. The acronym or the abbreviation. I could become WebAppDevelopers.com or WADCS.com (although I would have to invent a name to fit that last acronym).
  2. Names which can be pronounced but doesn’t mean anything (yet). I could become Beyaro.com, Tashlin.com or Noydart.com
  3. Names made by stringing several words together and hoping for the best. These can be vaguely business-like (e.g. knowledgesolutions.com), or have dubious techie ambitions (e.g. colourfreezone.com, validatedspace.com) or just be plain silly. HappyGreenFerret.com, RealTurtleSoup.com and GorgeousCat.com are all available.

For the moment I’ve knocked this on the head, I’m starting up as BronwenReid. Six months down the line I can revisit this, perhaps if I spend too much time spelling out my name to people on the phone.

Don’t try this at home

17 Feb 2006

,


At the moment I’m looking at every resource I can find on on freelancing. And Anil Dash has some wonderful advice for freelancers who are wondering how much they should charge for their time.

  1. Slap the client in face.
  2. Tell the client your hourly rate.

If the client was more shocked, horrified, offended, hurt, saddened, or wounded by the slap in the face than by the hourly rate, then you are still pricing yourself too low.

Playing nicely with WordPress

9 Feb 2006


I’m not very keen on the wordpress auto-formatting which replaces newlines with html linebreaks; I’ve been using HTML for so long now that I automatically type in the markup I want and (Damnit-Janet) I don’t want to see
unless I put it there myself.

The auto-formatting really should have a disable/enable option, and I’ve been looking at the code to try and understand how the text flows and where it gets formatted.

To turn if off, I have to edit wp-includes\\default-filters.php and comment out the wpautop filter.

// add_filter('the_content', 'wpautop');
// add_filter('the_excerpt', 'wpautop');

But then I have to look at the excerpts and user comments – no quick fixes here.

javascript tree

8 Feb 2006


‘I’ve been using the dtree DHTML script as part of a menu-building tool for clients.
Destroydrop Javascripts Tree Easy to generate the script from a database, which isn’t true of a lot of similar tools.

over-styled-wordpress-themes

7 Feb 2006


Playing with wordpress themes. Most of those I’ve found make me think that a graphic designer somewhere is getting a little bit over-excited, and needs to have some quiet time. I had to remove every single image except the header bar out of this theme before I was happy with it. More exploring and experimenting in order.