The March 2011 Blog
send me a comment

New Neal Stephenson Book: Reamde (Wednesday, Mar 16)
[ permalink ] [ e-mail me ] [ ]

The HarperCollins website now has a page for the next Neal Stephenson novel. It's called "Reamde" (not "Readme") and will be out on September 13th. It's already available for pre-order on Amazon too.

I have no idea what it's going to be about, but I can't wait.

Lorem Ipsum @Formulodo Est Laborum (Thursday, Mar 3)
[ permalink ] [ e-mail me ] [ ]

For billions of years, when typesetters and graphic designers needed dummy text for their sample layouts, they've taken big chunks of lorem ipsum text and dropped it into various areas of the page as placeholders. As I was working on some UI design for a new Lotus Notes application, I decided to take a classic approach and lorem ipsufy the design elements to see how they looked.

On text fields and documents, it's easy enough to go to the Lorem Ipsum generator (or if you're feeling cheeky, the Gangsta Lorem Ipsum generator) and copy-and-paste as many fake sentences and paragraphs as you want.

In my case, I was working on a view design and I wanted something like this:

lorem ipsum in a view

Well, much nicer looking than that, but that's the idea. My two choices were: (1) generate a bunch of documents that all had different random text in various fields, or (2) use column formulas to generate the text. Writing a formula seemed like less work, so here's what I came up with:

minWords := 5;
maxWords := 9;

fillerText := "lorem ipsum dolor sit amet consectetur adipisicing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua ut enim ad minim veniam quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur excepteur sint occaecat cupidatat non proident sunt in culpa qui officia deserunt mollit anim id est laborum";

fillerArray := @Explode(fillerText; " ");
fillerWordCount := @Round( ( maxWords - minWords )*@Random + minWords );
startWord := @Integer( (@Elements(fillerArray) - fillerWordCount)*@Random );

output := "";
@For(n := 1; n <= fillerWordCount; n := n + 1;
     output := output + fillerArray[n + startWord] + " ");
output

I added a bunch of blank documents to the database so the view would have some content, adjusted the minWords and maxWords for each column, and I was done. Now it was easy to see how the view design looked with a bunch of data.

You can use that formula to compute text fields on forms too, if that's your game.

I also put this button at the top of the view to refresh the data:

Sub Click(Source As Button)
	Dim workspace As New NotesUIWorkspace
	Call workspace.ViewRebuild
End Sub

On a related note: if you need image placeholders, a lot of people have been raving (in some sense of the word) about placekitten.

placekitten image. So cuddly!