I’m plugging Dreamweaver because I’ve used it for years and have grown accustomed to its auto-complete. Please note I am not endorsing the use of Dreamweaver as a code-generation tool, nor recommending its powerful templating functionality for production Web sites. The simple fact is, you can fly through revisions and previewing home brewed MailChimp HTML E-Mail Templates, thus minimizing the need for MailChimp ‘s Send Test feature. Discussion of the convolution of inline CSS within HTML E-Mail designs is beyond the scope of this article. Risking potential ridicule from the hardcore programmers out there, Crimson Editor has been my plain text editor of choice. With a little Regular Expression trickery, you can significantly speed up the process of editing the plain-text message generated within MailChimp using its Copy text from HTML feature.
Jan
04
MailChimp, Dreamweaver and Crimson Editor
Dec
22
Net Neutrality 2010
If the Internet is the most important innovation of our time, consequently, Net Neutrality is the most important issue at hand. As society corrects itself to compensate for disruptive technologies made available through the Communication Revolution, we must never neglect to consider the individual with no money who desires to communicate. Communication facilitates innovation. Inhibiting communication discourages innovation. It is that simple. This is the closest any of us in our generation have seen to a ‘good vs. evil’ battle represented in the non-sectarian world. What side are you on? What is enabling you to read this right now?
Nov
28
jQuery/Google Analytics Script to Track Outbound Links
Usage
Assign link-outbound class to any trackable external links on the page. As scripted here, your outbound links will appear in Analytics as /outbound/ with the full URL of the outbound link appended. This can be modified to suit your reporting needs.
Example
External link:
<a class="link-outbound" href="http://www.externalsite.com">Link to externalsite.com</a>
Script block (assumes jQuery and Google Analytics are both loaded):
<script type="text/javascript">
<!--
$(document).ready(init);
function init() {
$('a.link-outbound').click(function () {
_gaq.push(['_trackPageview', '/outgoing/' + $(this).attr('href')])
});
}
-->
</script>
Nov
24
Regular Expressions in Plain English
This is intended as a running list of regular expressions explained in simple terms. I’m basing it, at least initially, on its usefulness within Crimson Editor, my Windows text editor of choice, which permits the use of regular expressions in its search and replace.
Find bracketed text, including the brackets:
Crimson Editor
\[([^\}]+)\]
GREP
(\[).*?(\])
This is especially useful when cleaning up MailChimp’s autogenerated text-only versions of e-mail campaigns, wherein links are converted to footnotes.
Find parenthetical text, not including the parenthesis (GREP):
(?<=\().*?(?=\))
Find all leading whitespace at beginning of line:
^[ \t]+
Given a document with image tags on each line, remove everything but the source file paths (tested using Find/Replace with GREP in TextWrangler).
Find:
^.+img.+src="([^"]*)".+
Replace:
\1
Sep
24
Clearing the Dreamweaver Image Cache
Quit Dreamweaver.
Version CS3 for Windows
Delete all files in C:\Documents and Settings\{username}\Application Data\Adobe\Dreamweaver 9\Configuration\Temp
Version CS5
Windows
Delete C:\Documents and Settings\{username}\Application Data\Adobe\Dreamweaver CS5\en_US\Configuration\WinFileCache-xxxxxxxx.dat
OS X
Delete [user name]\Library\Application Support\Adobe\Dreamweaver CSx\en_US\Configuration\MacFileCache-xxxxxxxx.dat Restart Dreamweaver.
Jun
11
Outlook: Save Selected Items to Folder with Datestamp
I tend to organize projects in file folders, where I store all project-related information including e-mails. Assign this macro to a toolbar button in Outlook. Select one or more Inbox messages, run the macro, and select the destination folder. Messages will be named according to subject, with a date/timestamp appended. All non-alphanumeric characters are replaced with underscores. (Note: this is a necessary workaround for file naming restrictions within the Windows filesystem.) Please note: This code utilizes the Microsoft VBScript Regular Expressions 5.5 library (enable it using the Tools- References dialog in the VBA IDE). Create a VBA module and name it winapi_folderbrowser. Paste the following code into the new module:
""" BEGIN CODE Private Const BIF_RETURNONLYFSDIRS As Long = &H1 Private Const BIF_DONTGOBELOWDOMAIN As Long = &H2 Private Const BIF_RETURNFSANCESTORS As Long = &H8 Private Const BIF_BROWSEFORCOMPUTER As Long = &H1000 Private Const BIF_BROWSEFORPRINTER As Long = &H2000 Private Const BIF_BROWSEINCLUDEFILES As Long = &H4000 Private Const MAX_PATH As Long = 260 Type BrowseInfo hOwner As Long pidlRoot As Long pszDisplayName As String lpszINSTRUCTIONS As String ulFlags As Long lpfn As Long lParam As Long iImage As Long End Type Type SHFILEOPSTRUCT hwnd As Long wFunc As Long pFrom As String pTo As String fFlags As Integer fAnyOperationsAborted As Boolean hNameMappings As Long lpszProgressTitle As String End Type Declare Function SHGetPathFromIDListA Lib "shell32.dll" ( _ ByVal pidl As Long, _ ByVal pszBuffer As String) As Long Declare Function SHBrowseForFolderA Lib "shell32.dll" ( _ lpBrowseInfo As BrowseInfo) As Long Function BrowseFolder(Optional Caption As String = "") As String Dim BrowseInfo As BrowseInfo Dim FolderName As String Dim ID As Long Dim Res As Long With BrowseInfo .hOwner = 0 .pidlRoot = 0 .pszDisplayName = String$(MAX_PATH, vbNullChar) .lpszINSTRUCTIONS = Caption .ulFlags = BIF_RETURNONLYFSDIRS .lpfn = 0 End With FolderName = String$(MAX_PATH, vbNullChar) ID = SHBrowseForFolderA(BrowseInfo) If ID Then Res = SHGetPathFromIDListA(ID, FolderName) If Res Then BrowseFolder = Left$(FolderName, InStr(FolderName, vbNullChar) - 1) End If End If End Function ''' END CODE
Create a new VBA module and name it mymacros. Paste the following code into the new module:
''' BEGIN CODE Sub SaveMsgToFolderWithSubjectAndTimestamp() Dim Item As MailItem Dim strTargetFilename As String Dim strTargetPath As String Dim objRegExp As New RegExp With objRegExp .Global = True .IgnoreCase = True .Pattern = "[^\w+]" End With strTargetPath = BrowseFolder Dim SelectedItems As Selection Set SelectedItems = Outlook.ActiveExplorer.Selection For Each Item In SelectedItems strTargetFilename = objRegExp.Replace(Item.Subject, "_") + "_" + Format(Item.ReceivedTime, "yyyy_mm_dd_hhnnss") Item.SaveAs strTargetPath + "\" + strTargetFilename + ".msg", olMSG Next Item End Sub ''' END CODE
Assign the macro SaveMsgToFolderWithSubjectAndTimestamp to a custom toolbar button and you’re all set.
One step further: Save attachments!
The code has been extended as follows: If message has attachments, a new folder is created, named according to the message subject, with "_ATTACHMENTS" appended, and all attachments are saved in the new folder.
Sub SaveMsgToFolderWithSubjectTimestampAttachments() Dim Item As MailItem Dim strTargetFilename As String Dim strTargetPath As String Dim Atmt As Attachment Dim strTargetAttachmentsFolderPath As String Dim objRegExp As New RegExp With objRegExp .Global = True .IgnoreCase = True .Pattern = "[^\w+]" End With strTargetPath = BrowseFolder Dim SelectedItems As Selection Set SelectedItems = Outlook.ActiveExplorer.Selection For Each Item In SelectedItems strTargetFilename = objRegExp.Replace(Item.Subject, "_") + "_" + Format(Now(), "yyyy_mm_dd_hhnnss") Item.SaveAs strTargetPath + "\" + strTargetFilename + ".msg", olMSG If Item.Attachments.Count > 0 Then ' Create new folder strTargetAttachmentsFolderPath = strTargetPath + "\" + strTargetFilename + "_ATTACHMENTS" MkDir strTargetAttachmentsFolderPath ' Save Attachments For Each Atmt In Item.Attachments Atmt.SaveAsFile strTargetAttachmentsFolderPath + "\" + Atmt.DisplayName Next Atmt End If Next Item End Sub
Download source file here. Unzip the .bas file to import it directly into your Outlook VBA project.
Jun
08
Document Compatibility and IE
There I was, showing off the cool Web page prototype on my local machine. I copied it up to the network folder and pointed my coworkers at the shared location. The layout broke on Internet Explorer 8, but it tested fine for me locally. I copied the files to another local machine, and sure enough, it looked fine, locally.
Adding the following fixed the issue:
<meta http-equiv="X-UA-Compatible" content="IE=100" />
Here’s the detailed explanation:
MSDN Article
Mar
15
Feb
08
Jan
24
Gia’s First Story
Dictated at Preschool