Esgaroth
Thought Expounding
Newer Posts Older Posts

tonic
by alan on Sat 5th May 2007 1:23AM

Life is happening. We're out visiting various people quite often, so my 'blogging time has been kept short. It didn't help that I was sick on my birthday. Arrgh. Anyway, I hope people had a good May day on Tuesday.

The last couple of days I've been looking at a php framework called Tonic. It seems to be the type of framework I could work with, though so far, I'm not sure if what I'm looking at is due to Smarty (which the developers of Tonic seem to like) or is part of Tonic itself. I've avoided Smarty since it seems to do some really strange things to me, like allow almost a complete programming language in the template files. And it seems to complicate the PHP code that hooks to it as well.

What's drawing me to Tonic is that they seem to go for the Unix philosophy of lots of small tools that each do one thing really well and work together in a standardised way. I'm still trying to figue out at this point though, is whether they really seem to follow it.

Meanwhile, my templating idea seems to be a go. I've made a couple of changes since I posted about it. I realised that being able to xhtml validate the templates without using namespaces would be a good thing and I came up with a way that seems to work fine. Since all html elements can have a class attribute and unknown classes are just ignored, I realised I could do something like this <span class="aw_name">variable text</span>. There could be any number of other classes, and my program would ignore them an only zero in on the classes staring with 'aw_'. On top of that we can do simple loops by using class="aw_list-1" as an attribute to the first in a list of items. Hopefully, at some point I can show something a little more concrete.

So, no story tonight. It's killing me that it's taking so long.

out of work
by alan on Mon 28th May 2007 3:46PM

Well, I am offically on the job hunt. I've been putting out feelers for a couple of months and started gettings some bites a few weeks ago. I even had an interview. Now I am searching full time. It's only a matter of time. I have the faith to believe that I'll be gainfully employed doing something I love in a short time.

Talking of faith, last week I was at a Leadership Training Time in Mississauga last week. It was quite nice joining with 300 or so people in praise and worship and then sitting under teaching by some real people who admit they are still on the journey.

So, I'm going to write some more story today. Hopefully it won't be too bad.

**********

Dana was hidding in her room. She feared what could happen. Richard had decided to start his suit on this night and had come in with flowers for her. They were actually rather pathetic, drooping down like they had been out of water far too long. Dana guessed that Richard had never tried to pursue a woman before. He really had no idea what he was up to. He was, however, quite sweet and gentlemanly. She decided to brave whatever might come. She was sure he would become himself again after his initial embarrassment wore off. Poor Magra was feeling redundant and in the way. Dana would have to tell her she was doing wonderfully.

The night did end up going well. Richard had relaxed after a while and Dana had enjoyed his company on a moonlit walk through the gardens of a near by park.

The following day, news reached them that the King was indeed returning. He had sent ahead many of his courtiers to prepare for his arrival. It would be at most two days and he would be in the city. Richard raced back to the Hall of Records to be sure that all the work would be done before the King's arrival. The return of the King's Recorder would start them off again with large amounts of work copying, recopying, error checking and filing the new bits of history that had happened on the King's journey. All must be findable by the King when he asked for a particular piece of it.

Dana felt piqued by his sudden departure. He could not have been as interested in her as she had thought. True, she did not want him to be a failure at his job. It just annoyed her and made her feel that his job was worth more to him than she was.

That evening he returned and brought sweets. He was no longer embarrassed and was quite manly. She found the time with him made up for the time he was away. It could be she had underestimated what she wanted.

The next day was again a whirlwind of emotion as Richard spent the day at the Hall of Records making sure everything was in order for the return of the Recorder and the evening with her. Part way through the evening, the Duke sought them out.

'Ah,' he said. 'I thought I might find you alone together. I have some thoughts that I would like to share with the two of you.

'While I did my part in bringing you together, you seem to have lost no time in binding yourselves fast together. I'm afraid your emotions are running very high right now, and I think you're already imaging a wedding day. You're much too far forward thinking of that. It's now time to be just enjoying each other's company and discovering each other's likes and dislikes. It just happens that I know both of you better than anyone, so I'm going to pop a little quiz.'

With that he seperated them into seperate rooms and told Dana to wait while he went into the room with Richard. Dana wondered what kind of quiz he could mean. She waited with increasing impatience. She wanted to be near Richard.

The Duke entered after a while. He sat down near her and started asking strange questions about her hopes and desires, and about Richard. She discovered that the answers to many of the questions she had never thought about. At one point she felt despondent about ever knowing Richard. His father knew him so much better than she did.

'Well, well, well,' said the Duke after a while. 'I see that you are in quite a state with my son. You have answered correctly in many cases by saying that you don't know. That is well. If you had guessed, I would have known. I see that you are for the most part, understanding how well you know him. Well, I'm an old worrywart, apparently. I'll leave the two of you alone for now.'

'How well did you expect me to be able to know him after only 2 evenings together?' asked Dana.

'About as well as you do,' replied the Duke. 'What I was afraid of was that you might be thinking you knew him better than that. I am quite glad to see that my fears were unfounded. Your dreaming is not even outside of healthy if I can read you aright.'

At that minute Richard came in. 'Father,' he said. 'Do you think maybe you were being a bit too much of a busybody? Or maybe interfering?'

'I dare say. I apologise. Apparently I was. I'll go to bed now, I have a meeting with the King tomorrow.'

'How did you arrange that?' Dana asked. 'He isn't even in the city yet.'

'I have ways and means,' said the Duke. 'You are to come with me. Please dress your best. That's why I bought that dress and jewelry for you, not to please my son.'

He went out. Richard and Dana looked at each other and laughed. 'He's a bit stranger every year,' said Richard. 'Sometimes he comes up with the strangest things to do. The fun part is I might do the same when I have children.'

Dana was flabergasted. 'You would do this to your children?'

I dare say I might,' said Richard. 'I am my father's son. Anyway, you'll likely need to bed yourself early. I will say good night now. Please do not worry about this now. I am sure I'll handle it better when I am on the other end. I will see you in the morning.'

Okay, so I really shouldn't be telling the story of Richard romancing Dana from Dana's point of view, seeing as I'm a guy. I'm probably butchering how any woman would really think and feel in a similar situation. :)

interviews
by alan on Thu 31st May 2007 1:15PM

I have an interview later this morning with a head hunter about a specific job. I'm starting to get a little nervous about it. I guess nerves are catching up to me.

This week I've been working on a couple of programming projects. One is still not yet ready to be talked about. The other is my template engine. I've gotten it into a state where it can start to be debugged, I think. And I'm going to share it with the world soon. For now, I'm going to talk about some of the sources for ideas.

First, is Web Forms and HTML5 as defined by the WHAT-WG. In it the Web Forms spec, they describe how to handle repeating objects and form inputs in a clean and concise manner in HTML attributes. As I considered it, I started to think about automatically filling in the same information from the server side. That got me as far as using <span awname="objname"> as I described last month. Then as I moved forward, I realised that this could be a very useful way of seperating the concerns of the designer from the programmer. The designer would be able to design his pages using real data on the page instead of $objname$ to represent the data. He'll see what could actually show up!

The second influence is String Template. The author of that template engine explained why template engines should not have a complete Turing Machine available to the template writer. Indeed, doing so complicates things and makes it harder to create reusable templates. I was already thinking down these lines, and came to a similar realisation, but his paper (pdf) helped solidify the thoughts in my head. He says that the four things a template writer needs are:

  1. attribute reference,
  2. conditional template inclusion based on presence/absence of an attribute,
  3. recursive template references,
  4. and template application to a multivalued attribute

The first one is obvious, and I had already completed the second when I read that. The fourth one I was figuring out how to do in such a way that the template writer can use sample data, all the while creating well-formed and valid HTML. The third one I struggled with, thinking that it would be more complicated to write templates for than I wanted, but have finally created it anyway just to be complete. It would actually be quite useful for including html from a database, since in all cases of attribute reference, the text is escaped to avoid accidentally allowing the programmer from inserting a bunch of html inside the attribute, or worse, someone trying to do cross site scripting. Of course, once I allow html from a database, that immediately opens up the cross site scripting problems again.

Anyway, I've got to go. I'll write some more on this later.

interviews 2
by alan on Thu 31st May 2007 6:42PM

So, the interview wasn't what I was expecting. I thought I might get some information about the company that I thought I was applying to. It was actually a get to know you interview with the head hunter. So, I got a bunch of information about the head hunter. That was great and all, just not what I was expecting. I still don't know anything about the job that piqued my interest in talking to them in the first place.

Anyway, continuing what I was writing this morning, Terence Parr (creator of StringTemplate), in the paper I referred to this morning, went on to describe some good seperation rules to keep the template and the business logic seperate. They are

  1. View cannot modify model.
  2. View cannot perform computations
  3. view cannot compare data values
  4. view cannot make data type assumptions
  5. data from model must not contain layout or display information

Now, for exactly what all those things mean you can read his paper, but if we take those as good guidelines, we immediately see that template engines like Smarty don't make it easy to follow them. Indeed, with Smarty, it's very easy to do data value comparison and to include layout and display information in the model.

I have a few ideas of my own as to what should show up in a web template engine, including:

  1. handle output data as an example with which to work
  2. recognise special html tags (such as input) and set the value attribute instead of between the tags.
  3. allow namespaces in view

There's more, I just can't remember any of it right now. I'll try to get some more up tomorrow.

Newer Posts Older Posts