lime icon

Phosphorus and Lime

A Developer's Broadsheet

This blog has been deprecated. Please visit my new blog at
VBS: vbPrintR
Another vbscript function: vbPrintR is a function that will recursively print a vbscript variable for you. Similar to PHP's print_r function. Looked around the web for a pre-existing solution but couldnt find one, so I rolled my own. Find it in the klenwell code repository:

Includes a test script. On Windows, just right-click and open with Microsoft Window-Based Script Host. On anything else, why would you even care?


VBS: Autoload External Files
Working in vbscript for the first time in a while and one of the first things to do was to write a script to autoload external files. This seems to work:

' Set Files to Include Here
dim aINCLUDE(2)
aINCLUDE(1) = ""
aINCLUDE(2) = ""

' Show Errors?
Const SHOW_ERRORS = True
Const HTML_BR = "

' Config
dim oDictErr, iErrCount
Set oDictErr = CreateObject("Scripting.Dictionary")
iErrCount = 0

' Klenwell Error Trigger
Function kwTriggerError(sMessage)
iErrCount = iErrCount + 1
oDictErr.Add iErrCount, sMessage
If SHOW_ERRORS Then: MsgBox("Error #" & iErrCount & " : " & sMessage)
End Function

' Klenwell Error Dump
Sub kwDumpErrors
dim sOut, vKey
sOut = "Error Dump ("&iErrCount&" Errors): " & VbCrLf
For Each vKey In oDictErr
sOut = sOut & "Error " & vKey & " in oDictErr: " & oDictErr.Item(vKey) & VbCrLf
End Sub

' include file
Function kwIncludeFile(sFilePath)
On Error Resume Next
dim oFsoInc, oFileHandler, sIncContent
Set oFsoInc = CreateObject ("Scripting.FileSystemObject")

If sFilePath = "" Then: Exit Function: End If

If NOT oFsoInc.FileExists(sFilePath) Then
kwTriggerError("unable to load " & sFilePath & " : file not found")
Exit Function
End If

Set oFileHandler = oFsoInc.OpenTextFile(sFilePath,1)
If Err.number <> 0 Then
kwTriggerError("file " & sFilePath & " could not be opened")
Exit Function
End If

sIncContent = oFileHandler.ReadAll
ExecuteGlobal sIncContent

Set oFsoInc = Nothing
Set oFileHandler = Nothing

End Function

' include all files
Sub kwIncludeFiles
dim sFile
For Each sFile In aINCLUDE
End Sub

Call kwIncludeFiles

Includes error handling.


How to Cancel Domain Auto-Renewal for
Update (thank you anonymous commentor):

Cancel here:

After 15 minutes searching the admin control panel, I emailed support. 8 hours later I received a reply with this link:

Hint: it's a separate login. Could they make this any more difficult?


LampBack: Automated MySQL Backups with PHP
I started working on this last December. Picked it up this weekend and refactored it as a PHP class. Simplifies a number of things.

What I wanted: a simple way to make regular backups of my mysql databases on shared host sites using PHP and crontabs. LampBack does this.

To try it out, visit the LampBack google project site. Documentation can be found on the klenwell wiki.

Labels: ,

bayimg: new image host
Lot of buzz around this today. I'm always looking for an easy-to-use free image hosting service. My current favorite:

Anyway, this is a test of bayimg:


Well, it looks like it worked -- except it continues to enlarge it even after I disabled resizing. Hopefully that will be fixed.
How to Sign Up for Google Books
Ok, finally figured it out.

After you've filled out the first form. You must:

1. Select "I have an email address and password I already use with Google services like Adwords, Gmail, Orkut, or the personalized home page."

2. Select "I'd like to choose a new login name and password just for Books."

3. Use a non-Gmail email address to set up a new account

Getting started is easy. Once you know what you're doing.
Google Books Signup Saga, Part III
Got the following response to my second message:

My response:

Still unable to signup. And it doesn't look like anyone else has been able to either. Wonder how long this has been going on. Will probably end up being banned as a nuisance before the problem gets resolved.


PHP: Greqo Analytics Released
An alpha version, but it has succeeded in accomplishing what I set out for it to do: deliver an email summary of stats in-text from my Google Analytics account.

It comes with Greqo Analytics, a PHP class that will query you Google Analytics account and collect the data for a given profile, and Greqo Gmailer, a class that can email the results to you using that same Google Accounts account.

Download: Greqo project site
Documentation: klenwell wiki
Feedback: email
Issues: Greqo project site
Has Anyone Been Able to Sign Up with Google Books?
Got the following response from Google to my note about signup bug:

So I followed the advice and tried to sign up with a new email address. The result:

At the moment, it appears impossible to sign up for the Google Books Partner Program. I've followed up with Google.
Google Books Signup Bug
I have tried a couple times now to sign up with Google Books using this account and I always end up with the following problem:

Screen 1:

Screen 2:

Tried the new account option, too. That didn't work. Frustrating. Using Firefox. Wonder if it works any better in IE? Dropped a note to Google.
Sharepoint Markup
I used to think Myspace markup was a travesty. Until I saw Sharepoint. I realize that some degree of cruftiness is inevitable, given how Sharepoint works. But that still doesn't excuse this:

<TD class="ms-leftareacell" valign=top height=100% id="LeftNavigationAreaCell">
<table class=ms-nav width=100% height=100% cellpadding=0 cellspacing=0>
<TABLE height="100%" class=ms-navframe CELLPADDING=0 CELLSPACING=0 border="0">
<tr valign="top">
<td width="4px"><IMG SRC="/_layouts/images/blank.gif" width=4 height=1 alt=""></td>
<td valign="top" width="100%">
<asp:ContentPlaceHolder id="PlaceHolderLeftNavBarDataSource" runat="server" />
<asp:ContentPlaceHolder id="PlaceHolderCalendarNavigator" runat="server" />
<asp:ContentPlaceHolder id="PlaceHolderLeftNavBarTop" runat="server"/>
<asp:ContentPlaceHolder id="PlaceHolderLeftNavBar" runat="server">
<div class="ms-quicklaunchouter">
<div class="ms-quickLaunch" style="width:100%">
<h3 class="ms-standardheader"><label class="ms-hidden">
<SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,quiklnch_pagetitle%>" EncodeMethod="HtmlEncode"/></label>
<Sharepoint:SPSecurityTrimmedControl runat="server" PermissionsString="ViewFormPages">
<div class="ms-quicklaunchheader"><SharePoint:SPLinkButton id="idNavLinkViewAll" runat="server" NavigateUrl="~site/_layouts/viewlsts.aspx" Text="<%$Resources:wss,quiklnch_allcontent%>" AccessKey="<%$Resources:wss,quiklnch_allcontent_AK%>"/></div>
<SharePoint:DelegateControl runat="server"
<asp:MenuItemStyle CssClass="ms-navheader"/>
<asp:MenuItemStyle CssClass="ms-navitem"/>
<asp:SubMenuStyle CssClass="ms-navSubMenu1"/>
<asp:SubMenuStyle CssClass="ms-navSubMenu2"/>
<asp:MenuItemStyle CssClass="ms-selectednavheader"/>
<asp:MenuItemStyle CssClass="ms-selectednav"/>
<table class="ms-navSubMenu1" cellpadding="0" cellspacing="0" border="0">
<table class="ms-navheader" width="100%" cellpadding="0" cellspacing="0" border="0">
<td nowrap id="idSiteHierarchy">
<SharePoint:SPLinkButton runat="server" NavigateUrl="~site/_layouts/viewlsts.aspx" id="idNavLinkSiteHierarchy" Text="<%$Resources:wss,treeview_header%>" AccessKey="<%$Resources:wss,quiklnch_allcontent_AK%>"/>

(I still think myspace html is a travesty.)
Difference between Branch and Tag
I still get these confused, so I thought it might help me remember if I explained it to myself:

a separate branch of development that is usually merged back into the trunk

a branch tagged for versioning or historical reasons

If you're using Tortoise, right-click for more help.

source: Tortoise SVN help