Jerry Carter on How-To: Shade Your Views Based on Document's Age
Colin Williams on How-To: Shade Your Views Based on Document's Age
Kerr on How-To: Shade Your Views Based on Document's Age
Kerr on How-To: Shade Your Views Based on Document's Age
andy on How-To: Shade Your Views Based on Document's Age
Jake Howlett on How-To: Shade Your Views Based on Document's Age
Debunking Dojo Toolkit Myths
Thu 30 Oct 2008
Design principles for Windows 7 - istartedsomething
Thu 30 Oct 2008
Obscenity Filters: Bad Idea, or Incredibly Intercoursing Bad Idea?
Wed 22 Oct 2008
Ending Expressions
Fri 17 Oct 2008
Firefox 3.1 beta: Geolocation, @font-face, Video and Audio, XHR++, and TraceMonkey
Wed 15 Oct 2008
This Week in HTML 5: Web Forms 2, Search, and more
Mon 13 Oct 2008
Awesome Music using ONLY sounds from Windows XP and 98!
Mon 13 Oct 2008
Web-Based Rich Text Editors Compared
Fri 10 Oct 2008
Let's say you have a view of support tickets that are awaiting processing. The older the ticket gets the more important it is that somebody does something about it.
How do we convey this to the user though? Well, there's various methods, but yesterday I came up with a new way, which I think you'll like. Imagine each row of the view is a varying shade of red, based on the document's age. The older the document the redder the row.
You can see an example of this in the screen-grab to the right and in this DEXT demo page. On the demo page you'll need to scroll down to see it in effect.
In terms of CSS this works by virtue of the fact you specify a colour as three numeric values representing the mix of red, green and blue. You might be used to seeing something like this:
<tr style="background-color:#ff0000;"><td>I should be bathed in red</td></tr>
But did you know you can also do it like this (in all browsers!):
<tr style="background-color:rgb(255,0,0);"><td>I should be bathed in red too</td></tr>
An RGB value of 255,0,0 is red, whereas 255,255,255 is white. You can specify any shade of pink by passing 255 for the Red value and any number for Green and Blue, as long as they're both the same. See this table as an example:
| rgb(255,0,0) | Red |
| rgb(255,60,60) | ↑ |
| rgb(255,127,127) | Pink |
| rgb(255,200,200) | ↓ |
| rgb(255,255,255) | White |
The smaller the number you specify for Green and Blue the redder the colour. Can you see where this is going?
What we need to do in our view is have each row calculate a number between 0 and 255. Brand new documents need to come out of the formula with a value of 255, whereas really old documents need to compute to 0.
The view itself needs to be treated as HTML and one of the columns would have a formula like this:
days_passed:=1+(@Date(2008;11;20)-@Date(@Created))/(60*60*24); factor:=20; val:=@Min(@Round((1/(days/factor))*255); 255); "<tr style=\"background-color:rgb(255,"+@Text(val)+",+@Text(val)+");\">
As you can see (hopefully) the G and B values of the row colour are worked out as a "percentage" value of 255, based on how many days have passed since it was created.
The number you multiply 255 by should be somewhere between 0 and 1. If it's 0 then you get red. if it's 1 then you get white. So it might seem the opposite way round to what you'd expect.
Note that I've introduced a "factor" in to the formula above. What I found was that you need to spread the shading of your rows out over the range of dates you expect to encounter. The factor needs to be about the same order of magnitude as the top end date expected. The best way to work this out is to play with it in your real world scenario.
By now you might have noticed the view uses today's date in a column formula. Although the way I've done doesn't invoke the problems with indexing that using @Today does you might be wondering how it gets updated, as the date appears hard-coded.
Remember I've talked before about how you can use scheduled agents to update view selection formula. Well, you can do the same thing with column formulas too! Imagine this code running every night at shortly past midnight:
Set TodayDT = New NotesDateTime(Now) tmp = |days_passed:=1+([+TodayDT.DateOnly+|]-@Date(@Created))/(3600*24); factor:=20; val:=@Min(@Round((1/(days_passed/factor))*255); 255); "<tr style=\"background-color:rgb(255,"+@Text(val)+","+@Text(val)+");\">"| Set folder = database.GetView("TicketsByDate") folder.Columns(1).Formula = tmp Call folder.Refresh
It's as easy as that. There's little wonder I'm so fond of Notes.
Used in the right place this technique can add much usefulness to the user and help them immediately recognise documents in need of attention. How you use it is down to you (it doesn't have to be a support ticket system!). It doesn't have to be shades of red either. You can use shades of any colour, as long as one of the RGB values always stays the same. Brilliant.
Next blog entry will discuss the use of this technique with LotusScript.
7 Comments Read - Add | Thu 20 Nov 2008 | Open »
As developers it's easy to email users of our systems. How do we know if the email ever reached the user though? And (more importantly in some cases) can you ever prove it got there?!
Most systems I've worked on have sent email notifications out. Until recently I've never really thought much about what happens after the .send() method has been invoked. Hey, I've sent the email. Now it's in the hands of the internet gods. Whether the user ever actually reads it or not, I just don't know.
One recent scenario involved sending a Booking Confirmation email to users of an online booking application. The first line of the email is in big bold letters and reads:
Please print this email out and bring it with you on the day as proof of booking.
The trouble is that some users didn't print it and didn't bring it. In fact they claim they never even received it.
This is the point where email fails as an effective form of communication. It just can't be relied on. This is especially true nowadays thanks to our friends the spammers. Spam filters are having to get more and more aggressive in order to be effective. In doing so there are bound to be false positives. As I understand it system-generated emails themselves are more likely to fall prey of spam filters, especially when faking from headers. It's a wonder any of the emails we send get there at all.
So, my question to you is, if you have an important message that your user must see, how do you make sure it gets to them?
Alternatives to the booking confirmation email which I've discussed with my customer are:
It all leaves me feeling sad that the spammers have all but destroyed a wonderfully simple means of world-wide communication. Maybe that's the problem. SMTP is too simple a protocol.
Do you rely on email? If not, what do you do to get round its shortcomings?
13 Comments Read - Add | Tue 18 Nov 2008 | Open »
Last week I finished a blog about learning JavaScript by saying "more on that next week". I don't know why I make promises like that. I should just say nothing and surprise you with the "more" when I get round to it.
What happened as a result of my (empty) promise was that I felt pressure (especially after a couple of you said you were looking forward to it) to write something concise and meaningful at some point last week. What actually happened was I never felt the inspiration needed in order to do so. Hence the solitary blog entry last week.
The real reason is that I just haven't had the time to write such an in-depth blog. A typical blog entry can take an hour or so to write. Something along the lines of what I was planning would take at least twice as long as that, if not longer still. I just don't have that much time spare right now.
You'll have to make do with more seemingly-random entries until I get more time.
In the mean time here's a copy of the file I have on my desktop at the moment. It's a HTML file with some JavaScript in it (see source). What I'm doing is going back to basics. Instead of reading I'm just doing. I've started by creating objects in JavaScript and seeing what happens when I mess around with them and add prototype functions etc. In testing what I think is true I'll hopefully learn what actually is.
Back to normal from now on though. Hope I haven't disappointed any of you. I'll try and talk about JavaScript at some point. Just don't expect anything amazing!
2 Comments Read - Add | Mon 17 Nov 2008 | Open »
Last month I talked about how being Mr Computers can sometimes pay dividends. This weekend was another example of that. Friends of ours own a group of holiday cottages in the Peak District called Hurdlow Grange. For the design, hosting and upkeep of that site I get to stay there free of charge. Since designing that site they've bought the local pub, The Royal Oak, for which I also host the site (a modified copy of the other). In return I have been given every man's dream - a free tab in the pub.
This weekend a group of us had a get together, based around the pub. We (the Howletts) stayed in the cottages and ate/drank in the pub. All free of charge. Although I'm paying the price in other ways this morning. I'm getting too old for a whole weekend in the pub and probably won't feel myself again until at least Wednesday.
Having a free tab in a pub is only a good thing now that I've grown up somewhat and learnt to drink responsibly. Having children really does make you think about how that extra pint at the end of the night is going to make you feel in 7 hour's time when you wake up.
Talking of drinking responsibly I was in our local pub the other week with the guys off our street and fiddling with one of the beer mats on the table. On it in small (about 8pt) font in one corner was the web address D-RINKAWARE.CO.UK. I'd seen it before on other adverts for alcohol and wondered why they'd had to register d-rinkaware.co.uk. Was drinkaware.co.uk already taken? Drink-aware.co.uk too? How do they expect people to remember the dash. Especially if they've a fuzzy head in the morning, as I'd imagine their target audience might.
Now what was that address I saw last night? Oh yeah it was dee dash rink aware dot co dot uk. Catchy.
Then, while fiddling with said beer mat I must have tilted it enough to notice the "clever" part. As you'll see from the logo above the D and R help form a wine glass on its side. While this is a nice little visual trick (although not half as good as the FedEx arrow) and immediately(?) obvious in the full-size colour logo it doesn't work on the scale that most people see it. They must know this as they have in fact registered d-rinkaware.co.uk as well as drinkaware.co.uk.
8 Comments Read - Add | Mon 10 Nov 2008 | Open »
For ages now I've been trying to find the time to learn JavaScript. That statement might surprise some of you who I know consider me as something of a JavaScript "guru". Bear with me.
As with most languages I'm self-taught and have learnt by the modification of example code. Undoubtedly this isn't the best way to learn. At some point you need to go back to basics.
Sometimes I think my problem is that I misunderstand too much about JavaScript to ever be able to truly understand it. Is there any way back or do I already have too many bad habits!?
<analogy quality="medium">I guess it's a bit like learning to speak English by coming to live in a Northern working-class town in England (like one where I were born). You'd pick it up fairly quickly but you'd learn some bad habits along the way, such as not using the word "the", saying "Am going te pub" or "Working down pit". You'd probably use double negatives such as "I haven't got no money" and way too many clichés, such as "At the end of the day I turned round to him and said..." which do nothing but pad-out what you're actually trying to say.</analogy>
My accent and way of speaking has changed considerably since I left home. Mainly due to my stint down south where they tend to talk proper (like what the Queen does). Having a job in "business" means you need to communicate effectively with people. This means talking clearly and concisely, which I do do now. This is especially useful when dealing with international clients on the phone.
However, although my speech has improved I still don't know the basics of my first (only!) language. My education didn't really dwell on the grammar side of things. Although I do consider myself something of an expert on the proper placement of apostrophes I still don't really know what a past participle is or what a split-derivative means. Although I can write in a way that I think is easy for others to read I don't know if it's correct.
Take this question from an online quiz at the BBC as an example:
Q. Which sentence has the adverb in the wrong position?
Now, to me, all of the sentences work (in that they make sense and convey the message to the reader) and I'm not sure which is correct or exactly why or what an adverb is for that matter.
Writing code is the same in many ways. Especially with JavaScript. There are numerous ways to achieve the same thing. Chances are most ways will work but only one way is the "proper" way. Coding the proper way means it's more likely to be understood by a greater number of people and make you seem a much cleverer person. Nobody wants to be the Vicky Pollard of the coding world do they!
What I want to do is learn to code JavaScript properly. More on that next week...