lime icon

Phosphorus and Lime

A Developer's Broadsheet

This blog has been deprecated. Please visit my new blog at klenwell.com/press.
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:

http://klenwell.googlecode.com/svn/trunk/VBS/vbprintr/

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?

Labels:

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:


' *** FILE INCLUDE HANDLER
' Set Files to Include Here
dim aINCLUDE(2)
aINCLUDE(1) = "file1.inc.vbs"
aINCLUDE(2) = "file2.inc.vbs"

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

' *** SCRIPT ERROR HANDLER
' 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)
Err.Clear()
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
Next
MsgBox(sOut)
End Sub
' *** END SCRIPT ERROR HANDLER


' *** FILE INCLUDE HANDLER
' 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
oFileHandler.close
ExecuteGlobal sIncContent

Set oFsoInc = Nothing
Set oFileHandler = Nothing

End Function

' include all files
Sub kwIncludeFiles
dim sFile
For Each sFile In aINCLUDE
kwIncludeFile(sFile)
Next
End Sub

Call kwIncludeFiles


Includes error handling.

Labels:

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

Cancel here: https://cancel.1and1.com




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

http://faq.1and1.com/miscellaneous/2.html

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

Labels:

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: imageshack.com

Anyway, this is a test of bayimg:

failed

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.

Labels:

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:

<TR>
<TD class="ms-leftareacell" valign=top height=100% id="LeftNavigationAreaCell">
<table class=ms-nav width=100% height=100% cellpadding=0 cellspacing=0>
<tr>
<td>
<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:SPSecurityTrimmedControl>
</h3>
<Sharepoint:SPNavigationManager
id="QuickLaunchNavigationManager"
runat="server"
QuickLaunchControlId="QuickLaunchMenu"
ContainedControl="QuickLaunch"
EnableViewState="false">
<div>
<SharePoint:DelegateControl runat="server"
ControlId="QuickLaunchDataSource">
<Template_Controls>
<asp:SiteMapDataSource
SiteMapProvider="SPNavigationProvider"
ShowStartingNode="False"
id="QuickLaunchSiteMap"
StartingNodeUrl="sid:1025"
runat="server"
/>
</Template_Controls>
</SharePoint:DelegateControl>
<SharePoint:AspMenu
id="QuickLaunchMenu"
DataSourceId="QuickLaunchSiteMap"
runat="server"
Orientation="Vertical"
StaticDisplayLevels="2"
ItemWrap="true"
MaximumDynamicDisplayLevels="0"
StaticSubMenuIndent="0"
SkipLinkText=""
>
<LevelMenuItemStyles>
<asp:MenuItemStyle CssClass="ms-navheader"/>
<asp:MenuItemStyle CssClass="ms-navitem"/>
</LevelMenuItemStyles>
<LevelSubMenuStyles>
<asp:SubMenuStyle CssClass="ms-navSubMenu1"/>
<asp:SubMenuStyle CssClass="ms-navSubMenu2"/>
</LevelSubMenuStyles>
<LevelSelectedStyles>
<asp:MenuItemStyle CssClass="ms-selectednavheader"/>
<asp:MenuItemStyle CssClass="ms-selectednav"/>
</LevelSelectedStyles>
</SharePoint:AspMenu>
</div>
</Sharepoint:SPNavigationManager>
<Sharepoint:SPNavigationManager
id="TreeViewNavigationManager"
runat="server"
ContainedControl="TreeView">
<table class="ms-navSubMenu1" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<table class="ms-navheader" width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<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%>"/>
</td>
</tr>
</table>
</td>
</tr>
</table>


(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:

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

tag
a branch tagged for versioning or historical reasons

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

source: Tortoise SVN help

Labels: