Tuesday, October 24, 2006

Web 2.0

After all the hubbub about Web 2.0, it's refreshing to see someone who really understands the implications...

Wednesday, October 04, 2006

How to shoot yourself in the foot...

Today's Digg feed produced this gem, along the same lines as this one.

So how would you shoot yourself in the foot in Notes? @SetFoot("Shot"), maybe?

Friday, June 23, 2006

Show-n-Tell Thursday - Color Palette Utilities

This isn't really a Notes/Domino tip, although my applications have certainly benefitted. For those of you (like me) who are color-challenged, coming up with a color scheme for a new app is difficult. How many times can you do shades of gray? But you don't want the yellow, purple, and red nightmare that every company has one of, right? That's where this little site comes in handy. You can enter a starting hex value or choose from a color wheel, and it generates a nice coordinated palette for you. You can then create variations on the palette, like pastel, contrast, etc. There's even a dropdown that lets you view the palette as it appears to various types of color-blindness. It then provides you with the hex values of all the colors in the palette.

Which you can then take over here to convert to Notes-friendly RGB values.

Show-n-Tell+Thursday
show+'n+tell+thursday
sntt

Friday, May 26, 2006

Show-n-Tell Thursday - Updating FolderReferences

We recently enabled FolderReferences on a database that already contained a lot of documents. According to everything I've read, you can only get FolderReferences for documents added to a folder after the property is enabled, but we needed to get it set for all the existing documents as well. I found a pretty simple way to do it. Just add an action to your folder template and refresh the design of all folders (or add the action to each folder) and run on selected documents.

Here's the code:

Sub Click(Source As Button)
On Error Goto errhand
Dim w as new notesuiworkspace
Dim s As New notessession
Dim db As notesdatabase
Dim v As notesview
Dim uiv as notesuiview
Dim doc As notesdocument
Dim dc As notesdocumentcollection

Set db = s.currentdatabase
Set dc = db.unprocesseddocuments
Set uiv = uiw.currentview
Set v = uiv.view

Set doc = dc.getfirstdocument
While Not doc Is Nothing
Call doc.RemoveFromFolder(v.Name)
Call doc.PutInFolder(v.Name, False)
nextDoc:
Set doc = dc.getnextdocument(doc)
Wend

Call uiv.deselectall
Call w.ViewRefresh

Exit Sub
errhand:
Print "Error at line " & Erl & ": " & Error & " for UNID " & doc.universalid
Resume nextDoc
End Sub


This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.


Show-n-tell thursday
Show-n-Tell Thursday

Thursday, May 04, 2006

Show-n-Tell Thursday - Sending links to a view; open in a frameset

One of the things we do pretty frequently is allow users to send notifications with links to views/folders from various applications. This is usually to let someone know that data has changed in the folder, or that a flag has been set on the folder configuration document to indicate a change of status for the group of documents contained in the folder. The problem is, if you send a doclink to a view, it opens with the default navigator, rather than in the frameset that you've designed to contain navigation. I've gotten around this by making use of Julian's excellent DXL button creator class.

First, copy the code into a script library (or use as is in .lss format). In the Globals of each view/folder, include the script library, and add this sub:


Sub CreateButton(db As notesdatabase, thisv As notesview, mailDoc As notesdocument,
body As notesrichtextitem, label as string, frameName as string)
On Error Goto errhand
Dim button2 As New RichTextButton
Dim result As String
Dim openDatabaseString As String
Dim openViewString As String
Dim stringToPass As String
Dim frameToPass As String
Dim filepath As String
Dim viewName As String

filepath = Cstr(Replace(db.filepath, "\", "\\"))
viewname = Cstr(Replace(thisV.Name, "\", "\\"))

openDatabaseString = |@Command( [FileOpenDatabase]; "| + db.server + | ":"| + filepath + | ");|
openViewString = |@Command([OpenView]; "| + viewName + |");|
frameToPass = |@SetTargetFrame("| + frameName + |");|
stringToPass = openDatabaseString & Chr(13) & Chr(10) & "@UpdateFormulaContext;" & _
Chr(13) & Chr(10) & frameToPass & Chr(13) & Chr(10) & openViewString

'** append a Formula button to the body
Call button2.SetLabel(label)
Call button2.SetEdgeType(RTB_SQUARE)
Call button2.SetButtonLanguage(RTB_FORMULA)
Call button2.SetCode( stringToPass )
Call body.AddNewline(1)
result = button2.AppendButton(body)
If (result <> "") Then
Call body.AppendText("There was an error creating the button. " & result)
End If

Call maildoc.Save(True, True)
Exit Sub
errhand:
Msgbox "CreateButton error at line " & Erl & ": " & Error
Exit Sub
End Sub


This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.


Here's what our action bar button looks like:


Sub Click(Source As Button)
On Error Goto errhand
Dim s As New notessession
Dim w As New notesuiworkspace
Dim db As notesdatabase
Dim thisV As notesview
Dim mailDoc As notesdocument
Dim body As notesrichtextitem

Set db = w.currentdatabase.database
Set thisV = w.currentview.view
Set mailDoc = db.createdocument

mailDoc.Form = "Memo"
mailDoc.Subject = thisV.Name & " is ready for your review."
mailDoc.SendTo = "Esther Strom"

Set body = New notesrichtextitem(mailDoc, "Body")
Call body.appendtext(s.commonusername & " has indicated that the " & thisV.Name & _
" catalog is ready for MarComm review. " )
Call body.addnewline(2)

'create button here
Call CreateButton(db, thisv, mailDoc, body, "Open Bid Folder", "contentFrame")

Call mailDoc.Send(False)
Call maildoc.RemovePermanently(True)
Msgbox "MarComm has been notified"

Exit Sub
errhand:
Msgbox "Info Ready for MarComm error at line " & Erl & ": " & Error
Exit Sub
End Sub


This LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.


The recipient then receives a nicely-formatted email (if you bother to do any formatting) containing a button that will open the folder in the context of the frameset as intended.



Show-n-tell thursday
Show-n-tell Thursday

Thursday, April 20, 2006

HR from hell...

My sister, a kindergarten teacher in Florida, just sent me this. I'm assuming it's a joke, but I wouldn't be surprised to find that some of these really are in effect in some workplaces.

EFFECTIVE IMMEDIATELY- Company Policy Changes

Dress Code
It is advised that you come to work dressed according to your salary. If we see you wearing Prada shoes and carrying a Gucci bag, we assume you are doing well financially and therefore do not need a raise. If you dress poorly, you need to learn to manage your money better, so that you may buy nicer clothes, and therefore you do not need a raise. If you dress just right, you are right where you need to be and therefore you do not need a raise.

Sick Days
We will no longer accept a doctor's statement as proof of sickness. If you are able to go to the doctor, you are able to come to work.

Personal Days
Each employee will receive 104 personal days a year. They are called Saturday & Sunday.

Bereavement Leave
This is no excuse for missing work. There is nothing you can do for Dead friends, relatives or co-workers. Every effort should be made to have non-employees attend to the arrangements. In rare cases where employee involvement is necessary, the funeral should be scheduled in the late afternoon. We will be glad to allow you to work through your lunch hour and subsequently leave one hour early.

Toilet Use
Entirely too much time is being spent in the toilet. There is now a strict three-minute time limit in the stalls. At the end of three minutes, an alarm will sound, the toilet paper roll will retract, the stall door will open, and a picture will be taken. After your second offense, your picture will be posted on the company bulletin board under the "Chronic Offenders category." Anyone caught smiling in the picture will be sanctioned under the company's mental health policy.

Lunch Break
Skinny people get 30 minutes for lunch, as they need to eat more, so that they can look healthy. Normal size people get 15 minutes for lunch to get a balanced meal to maintain their average figure. Chubby people get 5 minutes for lunch, because that's all the time needed to drink a Slim-Fast.

Thank you for your loyalty to our company. We are here to provide a positive employment experience. Therefore, all questions, comments, concerns, complaints, frustrations, irritations, aggravations, insinuations, allegations, accusations, contemplations, and input should be directed elsewhere.


Human Resources Manager

Show-n-Tell Thursday - Preferred views

Silly little technique that I use a lot, since we have many databases with lots of views. To allow users to set their own default view, create a shared action and add it to all views:
tmpText:="Do you want to set this as your default view?";

x:=@Prompt([YesNo]; "Set view"; tmpText);

@If(x=1; @Environment("newArtTrackDefaultView"; @Subset(@ViewTitle;-1)); @Return(""))


Then set your frame content to Computed and enter the following formula:
y:=@Environment("newArtTrackDefaultView");

@If(y="";"vwUsages";y)


Show-n-tell thursday
Show-n-tell Thursday

Tuesday, April 18, 2006

Welcome back, Myron!

In a previous post I had mentioned that Harlan Coben stated he might not be writing any more Myron Bolitar books. I'm happy to report that he's changed his mind...

Promise Me sounds like it's not going to be the usual Myron, though - the descriptions make it sound like Myron has been plopped into one of Coben's standalone thrillers. Which are all very good, don't get me wrong. But Myron has a unique voice, and I hope that's carried over into this new release.

Thursday, April 06, 2006

Show-n-Tell Thursday - updating folder design

Folders can be a really useful design element. The only problem is that if you allow users to create shared folders in a production database, they don't inherit design changes from the template's default folder. Here's a fairly simple way to selectively update the design of those folders, or even allow an end user to update the design (after a developer has made changes and refreshed the design of the default folder from the template.)

Create a form that contains two visible dialog list fields, folderChoices and templateFolder. Also create a hidden field called folderList and a SaveOptions field set to "0". The default value of folderList should be @Unique(folderList). folderChoices should be set up to use formula for choices, and the formula should just be the field name folderList. The default value of templateFolder could go two ways: if you have only one folder template, make the field a text field instead, and set the default value to the name of the template folder. If, as we do, you have more than one folder design that can be used as a template, leave the field as a dialog list using formula for choices, and set the default value to folderList : "(Default Folder)" where the appended value is the name of your default folder (hidden in our case.)

Add this code to your PostOpen event:


Sub Postopen(Source As Notesuidocument)
Dim s As New notessession
Dim db As notesdatabase
Dim fList As NotesItem
Dim doc As notesdocument

Set db = s.CurrentDatabase
Set doc = Source.Document
Set fList = doc.GetFirstItem("folderList")
Forall v In db.Views
If v.isfolder And v.name <> "Default Folder" And v.name <> "(Default Folder)" And Not fList.Contains(v.name) Then
Call fList.AppendToTextList(v.name)
End If
End Forall
End Sub


Create a button and put this code behind it:


Sub Click(Source As Button)
On Error Goto errhand

Dim w As New notesuiworkspace
Dim db As NotesDatabase
Dim folderTemplate As String
Dim doc As notesdocument
Dim fName As String

Set db = w.currentdatabase.database
Set doc = w.currentdocument.document
folderTemplate = doc.templateFolder(0)

Forall x In doc.folderChoices
fName = Replace(x, "\" , "\\") Evaluate(|@UpdateViewDesign("|& fName & |";"| & folderTemplate & |")|)
End Forall
Msgbox "Update complete"
Exit Sub
errhand:
Msgbox "error at line " & Erl & ": " & Error
Exit Sub
End Sub


Add a button or outline entry in your database navigation that creates a new document using this form. The user can then choose which folders to update, and which folder to use as the design template.

LotusScript was converted to HTML using the ls2html routine,
provided by Julian Robichaux at nsftools.com.


Show-n-Tell Thursday

Tuesday, March 21, 2006

If it looks like a duck and talks like a duck...

I don't remember who first recommended Go Fug Yourself - maybe Duff. Whoever it was, thank you! It's provided a sorely-needed chuckle (and sometimes an outright snort-guffaw combination) every day.

Today's was particularly amusing... if Ms. Love's lips get any bigger, she's going to need to join the quacker's club with Melanie Griffith.

Friday, March 17, 2006

Programming in Klingon :o)

Last week, Rich had a Klingon horoscope posting; ever since then I keep accidentally running across more Star Trek references. Just found this one: a programming language based on Klingon. So now you can be a geek twice over... :o)

Thursday, March 16, 2006

Domino hosting

I'm involved with Basset rescue. Here's why. I'm looking at putting together a simple web app that would allow people in the community to enter fundraising information. That's easy enough to do. How do I host it, though? I have a Domino server at home, and a broadband connection - is it possible to host it myself? What do I need to do to make my server accessible to the world? And do I want to?

If not, can anyone recommend a very low-cost hosting company? I don't need dedicated hosting; I just want to be able to attach a domain name to the site and be able to maintain the database. I've done the obligatory Google search and come up with a lot of companies, but would like to hear good things about a company from someone who's worked with them, since this is a non-commercial endeavor and I don't really have any kind of budget.

Show-n-tell Thursday: highlighting web view rows on mouseover

This tip is actually a solution I posted on Notes.net... er, LDD, uh - developerWorks Forums... whatever. Someone was looking for a way to highlight rows in a web view as the user was mousing over them. Although I started out as a web developer, I've spent the past 5 years working primarily on client apps, so I occasionally try to answer questions like that just to refresh my memory.

Create your view and set it to treat contents as HTML. Don't bother trying to concatenate all of your content into a single column; just create individual columns, each using td tags around the content.

The first column of the view should just be this:

"<tr onMouseOver=\"TrowOn(this,'#ffffcc');\"
onMouseOut=\"TrowOff(this,'#DFDFDF');\">"

Then create all your columns, creating links inside td tags. Your final column is just a closing tr tag.

Then, in the JS Header of your viewtemplatedefault, add these functions:

function TrowOn(src,OnColor){
src.bgColor = OnColor;
}

function TrowOff(src,OffColor){
src.bgColor = OffColor;
}

This will handle the mouseover row color changes. Obviously you can adjust the hex values passed into the function in the view tr tags to get the colors you want.
Show-n-tell Thursday

Thursday, March 09, 2006

Show-n-Tell Thursday - viewing SnTT posts

I've only recently started using Technorati, so maybe everyone else already knows this, but... if you set up a watch list in Technorati for Show-n-tell Thursday, you can view the list as RSS. In other words, no need to search for Show-n-tell Thursday posts at multiple blogs, or even go to Technorati to look them up. They'll be delivered right to your RSS reader.

Show-n-tell Thursday

Show-n-tell Thursday - date entry formatting on the web

Just a quick way to validate date formatting on the web using regular expressions...

function checkDates() {
missinginfo = "";
re = /^([0-9]{1,2}\/){2}[0-9]{4}$/
if (re.test(document.ReportDates.strStartDate.value)){
}
else{
missinginfo += "\n - Start Date";
}
if (re.test(document.ReportDates.strEndDate.value)){
}
else{
missinginfo += "\n - End Date";
}
if (missinginfo != "") {
missinginfo ="______________________________________________________\n" +
"Please edit the following fields to use the xx/xx/xxxx date format:\n" +
missinginfo + "\n______________________________________________________";
alert(missinginfo);
return false;
}
else return true;
}

Show-n-tell Thursday

Tuesday, March 07, 2006

Defining career goals

So the time is coming up for our annual reviews, and I'm dreading it. Not because my performance is below-par, but because I'll have to fill out the self-review form - specifically, the career goals section.

In five years with this company, I've never figured out exactly how to answer the question of, "what are your goals for the next 12 months, and what kind of training is necessary to achieve them?" When I was in consulting, I could say I wanted to learn a new technology, and my manager would look at it and say, "Well, we have a new client who uses that technology", or "So-and-so is an expert in that technology - you can be a junior on her team for this project and learn it." But working in-house, how do I answer this question? If I say I want to learn a new technology, there's always the question of why. My company has very specific uses for Notes/Domino, and saying I want to learn AJAX because it can do cool things for our web databases doesn't fly, since we don't have many web-enabled databases. And if I were to say I wanted to learn a completely unrelated technology, like Ruby, the assumption would be that I was looking for a new job, and the company is certainly not going to pay to train me in a technology I can't use for their benefit.

Thursday, February 23, 2006

Is it Thursday again already? Show-n-tell

Just a quick little tip today. We have a lot of forms that contain dialog lists whose choices can be set in a profile document by an "administrative user." Occasionally they want to allow regular users to be able to add values to those fields, but for various reasons we don't want to give regular users unrestricted access to the profile document. Here's how we do it:

1. The dialog list field should be set to allow values not in list.
2. Create a hidden field on the form that uses the same @GetProfileField formula as the dialog list.
3. On querysave, test value of dialog against values in hidden field with this code:


FIELD fileType:=fileType;
FIELD fileTypeOld:=fileTypeOld;

@If(@IsNotMember(fileType; fileTypeOld); @SetProfileField("choicesForm"; "fileTypeChoices"; fileTypeOld : fileType); @Return("") )


Show-n-tell+thursday

Wednesday, February 22, 2006

More vanishing MS content

I wonder about Microsoft's control over their employees... every time something is posted to their website that generates not-so-positive interest, that content suddenly vanishes. Either "it was a private beta" or "it was posted prematurely."

Isn't there some kind of limitations to who can post things to their website? You know, to make sure that the stuff that gets posted actually should have been? Maybe FrontPage doesn't require authentication...

Thursday, February 16, 2006

Code to format formula language

After the last post, I'm thinking my next side project is extending Julian and Joe's code to allow formatting of formula, as well as LotusScript...

Show-n-Tell Thursday


Taking up the call to arms, here's my tip. Not as impressive as many, and quite a hack to boot, but it solved a problem we had.

Issue: our field users' mail files were getting huge, and needed to be compacted on a regular basis. But many of them didn't even realize they had a server replica; all their work is done locally, with replication settings that are just a magic button to them. Asking them to open their server replica to compact it would cause major panic. I don't know why there wasn't a server task in place to handle this; I'm not an admin. In any case, there's a lovely Compact method available in the NotesDatabase class, but it only works on local replicas. So how do we get these users to manually compact a server-based replica they're not even aware of?

Solution:

1. Put an action button in my Inbox (or any other view/folder) with this code:

server := @Name([CN]; @Subset(@DbName; 1));
serverFile:="mail\\" + @Subset(@DbName; -1);

@If(
server!=""; @Command([FileDatabaseCompact]);
@Do(
@Environment("CompactNow"; "true");
@Command([FileOpenDatabase]; "yourServer" : serverFile ; "($Inbox)"; "" ; "1" ; "1" )
)
)

This first tests to see if the database is local or server; if it's server it does the compact; if it's local it sets an environment variable and opens the server database. Again, I'd need to add a few lines of code to determine the correct mail server for each user (just a dblookup to their local names.nsf to get their location document, I think.)


2. In the Database Script PostOpen event, I put the following code:

x:=@Environment("CompactNow");
server:=@Subset(@DbName; 1);

@If(server!="";

@If(x="true";
@Do(@Command([FileDatabaseCompact]);
@Command([FileCloseWindow]));
""
);
"")

Every time the mail database opens, it tests to see if it's server or local. If it's local it does nothing. If it's server, it checks to see if the environment variable that was set by the button is equal to "true". If it is, it runs the compact and immediately closes the database. If it's not "true", it does nothing (just leaves the database open for people who normally work in-office with server replicas.)


3. In the Database Script QueryClose event, I put the following code:

@Environment("CompactNow"; "")

This ensures that the variable is cleared out when the script from PostOpen closes the database so that the next time the user opens it, it doesn't automatically compact.

At least in my tests, all of this happens so quickly that you don't actually see the server replica open at all. It will take a few minutes for the Percent Used number on the server replica to adjust, but this is the case even when you run compact manually using the Compact button on the database properties box.


Show-n-tell Thursday

Wednesday, January 18, 2006

Skype integration

I've been using Skype at home for a while now with my dad, who's an even bigger geek than I am - he actually has a USB phone handset. Anyway, I just read this posting on Chris Toohey's DominoGuru blog, and I think I'm going to have to convince the company to start using it to communicate with our outside vendors just so I can play with integrating it into Notes apps.

I was going to try adding one of the Skype buttons from the button wizard, but Blogger won't allow script tags, so I guess that's not going to happen...

Update: I can add the button; just can't use the script that will detect if the person clicking has Skype installed or not.

Chat with me

Tuesday, January 10, 2006

Notes calendaring

Am I the only one frustrated by the lack of documentation accompanying the alternate time zone feature on R6? I need to programmatically create a calendar entry. I've created one, and according to my document viewer, it's identical to a calendar entry I created manually, and yet it doesn't display the alternate and local time zones - it just treats the times I've chosen as local, period.

Wednesday, January 04, 2006

Follow-up on VoIP

In case anyone is still reading, I did eventually go with AT&T CallVantage. There was a bit of a problem at first with the sound quality, but once they diagnosed it as a faulty adapter, they sent out a new one overnight and it's fine. I've had it for almost two months, and I love it. I was able to forward my home phone while I was on vacation; I can set do-not-disturb hours (even set a regular schedule); get my voicemail messages emailed to me; all kinds of cool stuff. Their phone tech support is available 24/7, and are in general very knowledgeable. And the unlimited monthly plan is 50% less than my old local/long distance package. I would recommend it to anyone looking to switch to VoIP.

Ruby on Rails

I've been hearing about Ruby for a long time, but never had any time to look into it. Last week was slow at work since so many people were out, so I was able to fiddle a bit, and found a total-beginner's tutoral. It's actually intended for beginning programmers, not beginners in Ruby, so it's a bit simplistic, but a good place to start. It seems like it could be a really powerful platform, although I'll have to start reading the more advanced articles to see what it's really useful for.

Tough times...

I haven't been keeping up with this, and it bothers me. Things have been tough for the last few months: I had walking pneumonia, then my dog had emergency surgery while I was out of town. His back is healing nicely, but he is not eating, so he isn't recovering. He's lost more than 10% of his total weight in three weeks, which is extremely dangerous. He's going back in on Friday to have a gastroscopy tube put in; I'll have to use a syringe to shoot food directly into his stomach. Hopefully this will get him back on track. I haven't slept more than 2 hours a night in almost 2 weeks, and I'm worried that I'm going to end up sick again - then how will I take care of him? So it's been a bad few months.