Flex: A Toggle-Style Column Component for Your Views
Adding even more functionality to Flex "view" I've been building I've now added a "toggle column" to the list of available column types:

The idea is simple. You click the icon in the column to toggle a field value on the back end document. The icon in the view is either on or off and is dictated by the value stored in the field. It's an idea I've mentioned before which I've now made into a re-usable and customizable component.
In this example I'm using the idea of being able to mark certain contacts as favourites and you can see a working example in the Contact Manager app. The component itself can be re-used in almost any scenario though.
Adding a toggle column to a View is as simple as adding one line of XML to the View's configuration, which is specified in the backend Domino database, as discussed previously.
The XML looks like this:

As you can see it's fairly easy to configure and customize. You can easily change the icon, field name and what the "on"/"off" values should be for the field. You can also add a tooltip for the column.
The Column value of "starred" refers to the name of the XML node of each document which holds the field value we're interested. When the grid is first loaded it will show the icon as on or off depending on the value in the "starred" node.
Clicking on the toggle column on sets the value of the field called "Favourite" to "1". Clicking it again sets the value to "".
To see the XML used in the demo open the Contacts view as XML. This is the XML format that defines the structure and data of the View component. Simple, no?
Taking It Further
If you want to go further than simply modifying a single field at a time and want to perform a more involved action then you can do what I tend to always do and add a self-referencing "computed for display" field to the backend Domino form called something like "Action". In the WQS agent you can then check the value of this field. If the value is something like "Approve" then you can run a set of actions against the document.
In this scenario the XML data for each row just needs to define a true/false value to let Flex know whether to show the icon as on or off depending on whether it's approved or not. The value for the fieldValueOn would be "Approve" and for fieldValueOff it would be "Unapprove". The actual XML data for approved documents would be "Unapproved" and for unapproved documents the column value would be "Approve". If that makes sense.
Summary
It's the simple little components like this that show how powerful Flex can be once you get going with it. With the View component and the components I'm adding to it I feel like this is getting to the point where it's a viable product that can be re-used in live applications. In fact I already am using it in live applications for paying customers.
In the next couple of days I'll update the downloadable version of the app with updated Flex source code. Before I do I want to blog about another addition to the code -- the ability to store a user's choice of columns across sessions using the Flash/Flex equivalent of cookies - the SharedObject. Give me a day or three.
2/3 Comments Read - Add | Tue 9 Mar 2010 | Open »
Domino's POP3 Server Breaks HTML Emails by Removing Characters
There's a bug when sending and retrieving HTML email from Domino that has been plaguing me for years now. Now I've finally decided to take the time to investigate fully and find a fix.
First, imagine the code below:
While i<100 j = 0 html ="" While j<i html = html + "split string " j=j+1 Wend Set mail = New Email() mail.Subject = "Test " + CStr(i) mail.HTML = html mail.Send("jake howlett") i=i+5 Wend
What this does is send me 20 test emails. Each email is increasingly longer than the one before it and they all just repeat the words "split string" over and over.
The code to send the email is based on my Email class. All it does is create a multi-part MIME message. Nothing out of the ordinary. If you're using the MIME classes to send emails then this probably applies to you.
At some point in the loop the length of the message will get to such a size that something very worrying happens, as you can see below:
Notice the missing p?!
The Problem
From my investigations I've concluded the following:
If you use a 3rd party mail client (like Thunderbird) to download a multi-part HTML email from a mail file on a Domino server using POP3 then the POP3 server will remove the 655th character and put a line break in its place.
Looking at the very same email in the original mail file - using the Notes client - there's no missing character.
What I've also noticed is that it only removes the first 655th char. Not every subsequent 655th char in the whole string.
Obviously this can be very, very bad. At it's least worst, like in this example, it just looks like a typo. However, I've had numerous bug reports because it's broken the string inside an HTML tag, resulting in un-clickable links or -worse still - emails that just show raw HTML.
The problem seems only to occur when sending emails where the HTML content is made up of one very long string. I guess using very long strings is generally a bad idea in any case, but there's nothing actually wrong with it, and nothing half as wrong as the server removing characters.
The Solution
What we need to do is avoid very long lines of HTML code in the email. The obvious solution is to add line breaks in the HTML as you build it in your code.
Unfortunately, in my case, I have way too many instances of code sending HTML email to make it practical to go and add new line breaks in to each email. Instead, what I did was put a fail-safe in to the Email class which sends the email. At the point it adds the HTML to the email it adds a new line at every point an HTML tag is closed, like so:
Call stream.WriteText(Replace(Me.str_HTMLPart, ">", ">"+Chr(10)))
There's still a slight chance that there could be a long string that avoids this rule, but it's unlikely enough for me to feel happy this has resolved the issue for now.
Summary
So, you've been warned. If you're sending HTML emails to a Domino server, make sure you split the HTML string down in to sizeable chunks so that users who access their email via POP3 don't see broken HTML.
It all leaves me wondering why on earth the POP3 server would replace the 655th character in the first place. Assuming it does of course. My investigation wasn't exactly extensive but, from what I can tell, it definitely looks like it does. Why though? What's significant about 655? It's not like it's a base 2 number or anything.
9/20 Comments Read - Add | Wed 3 Mar 2010 | Open »
How Many Programming Languages Is It Possible To Know?
As I go about learning to develop with ASP.NET I can't help thinking what I think about every time I start learning a new programming language or skill -- does my head have the space for all the new information?!
While I'm sure the amount of knowledge currently stored in my head doesn't even come close to pushing the limits of the human brain I do sometimes feel a bit over-whelmed when I consider how much knowledge I need to retain in order to do my daily job.
It all makes me think of the age-old saying:
Does adding yet another skill to my tool belt mean I'll be just a little less able at one of those I already use?
Or, just as worrying, does learning something new mean something else is forgotten. Gotten rid of to make space. I remember reading that Einstein used to try and forget the phone numbers of people he no longer called, so that space was freed-up for something else.
Perhaps we each have our own amount of RAM that can be used. Perhaps this decreases with age. Perhaps I should consider stopping trying to learn more than I really need to and concentrate on getting better at the ones I do know.
Anybody ever think like this or, as I expect, am I just weird?
16/28 Comments Read - Add | Mon 1 Mar 2010 | Open »
Say Hello To Evelyn Howlett
Yesterday morning at 5-something o'clock Karen woke up in the early stages of labour. Within minutes I'd called the midwifes. Remember last time we'd planned a home birth for Minnie, but left it too late to call and ended up speeding to hospital in an ambulance. Didn't want to repeat that experience.
It was a good job I called so soon, as it had snowed during the night and the midwife on call had to come from a town about 14 miles away, which took her an hour. An hour after she arrived, so did Evelyn.
Here's a photo of her in the style of the one of Felix and of Minnie on the days they were born. She looks a lot more like her brother than her sister.
The birth was all very straight-forward, which I guess it's easy for me to say. Mother and baby are doing well.
My plan is to work from the house for at least this week and just spend an hour or so at the laptop each day to keep on top of things. At least that's the plan.
52/55 Comments Read - Add | Mon 22 Feb 2010 | Open »
Are Branded Goods Ever Worth The Cost?
About five weeks ago our 3 year old Hoover washing machine broke for the second time in its short life. The problem was the same as the first time it broke -- the concrete ballast had fallen to pieces. You know when it happens as it starts to sound like a train is coming through the house when it's on full spin.
First time it happened (just outside of its 1 year warranty) they came and fixed it within a couple of weeks (and charged us for it). I remember it well, as the Hoover-supplied "engineer" left all the concrete pieces, the old drum, boxes and various other bits on our doorstep as he left. I pointed out he'd forgotten them only to be told they're not Hoover's property so not their responsibility to dispose of. Yeah, thanks for that.
But anyway, forward on just over a year later and it's happened again. The concrete that makes up the weight is in bits. Lots of bits. Oh, and lots of dust. It's everywhere. It's now obvious it's an inherent problem with the machine. Looking at the ballast it appears to be concrete of the grade you'd expect in a breeze block. Now I'm now engineer (well, actually I do have a degree in it) but even I know that's not going to last very long.
Whether the machine has an inherent problem or not the fact is Hoover's customer service is truly terrible.
Here's what happened in the five weeks since it broke:
- Rang Hoover "customer services" to tell them it had broken.
- Told them it was the exact same issue as before but they said an "engineer" would need to visit anyway.
- Before this first visit I am forced in to paying for either a £110 labour charge or taking a £159 policy with Domestic & General (D&G) to cover the labour charge and any other repairs for a year. Made sense so I went for the £159 option.
- Wait a week for a man to visit, who takes one look inside the utility room door and say "It's your concrete's gone, love". Yeah, you don't say.
- Man then puts parts on order.
- Wait a week and call. Parts still on order.
- Trouble just about every neighbour on the road to do a load of washing for us.
- Wait a week and call. Parts still on order.
- Trouble just about every neighbour on the road to do a load of washing for us.
- Wait a week and call. Parts still on order.
- Trouble just about every neighbour on the road to do a load of washing for us.
- Decide enough is enough and that we might as well buy a new one for the same cost of the policy.
- Call D&G to cancel policy. They say we can but that we'd be liable to a £90 call-out charge for the man who was charged with coming to point out the obvious.
- Realise they have us by the short and curlies and there's little we can do but wait.
- Wait a week and call. Parts still on order.
- Trouble just about every neighbour on the road to do a load of washing for us.
- Karen calls and get very irate. Not until she point our her 3rd child is due any day now does the lady take pity and decide to lodge an internal complaint and to waiver the call-out fee.
- Three days later they confirm they've cancelled and we have nothing to pay.
- We go to Argos and order the cheapest washing machine we can find.
- Due for delivery next Tuesday. Well over 6 weeks since we stopped using the other.
So we got the refund for the policy, but who won? It certainly doesn't feel like we have! We're just back where we started. No better off and certainly worse off, as we owe all our neighbours a lot of favours.
What we've learnt is that buying a top of the range branded domestic appliance is a complete waste of money. I can't remember exactly what we paid for the washing machine but it was in the region of £400. We did this in the naive belief that it was better and would last.
The machine that it replaced cost Karen about £200 and lasted her about 10 years! When I buy things I have an expected life-span for them. With something like a washing machine it's in the region of 10 years. Certainly not three.
So, what we've done (aside for vowing never to buy Hoover again) is buy a cheapo one instead. As has been pointed out to us recently "They're all just the same plastic crap inside nowadays anyway".
We've bought this new cheap one on the premise that if it breaks outside of the warranty then it is, in effect, disposable. When the cost to repair it equals the cost of a new one what are you supposed to do? As much as I hate the idea of sending the "old" one to the tip, what am I supposed to do?
There are some things in life you take for granted until they break. I didn't realise how much we relied on a washing machine until now. Well, not so much me, but my very pregnant wife who was way more patient with this whole saga than I would have been.
It all leaves me thinking extended warranties and the like are a complete waste of money. Just buy cheap and replace it when broke. I never thought I'd be suggesting such a wasteful idea, but it's the only real option here. Hoover should be ashamed of the terrible, terrible customer service.
18/29 Comments Read - Add | Thu 18 Feb 2010 | Open »
More blog entries are available in the archive »
