I’m going to make an announcement that may come as a shock to anyone who knows me…
I’ve voluntarily decided to give up coffee.
Those that know me will probably react like the first person who saw me walking around today with a cup of water instead of a cup of coffee: they laughed. I was a heavy coffee drinker, about 5 cups a day. I enjoyed my coffee. I blogged about the wonders of coffee. I identified myself with a cup of coffee. I bought coffee for co-workers, and they bought it for me. I went out for coffee breaks when the smokers went out for cigarette breaks. I looked forward to drinking coffee…
So why the change? Ultimately, it came down to health and stress. I drink too much coffee (caffeine) and not enough water, and I’ve been too stressed lately. Coffee (caffeine) is not helping either of those.
After writing that, I decided to look up the negative effects of coffee. While typing into Google, the instant search instead brought me to this page: 7 Reasons Why Coffee Is Good For You (Popular Science). Not what I was looking for. Perhaps a more balanced review is here: 10 Reasons Coffee is Both the Best and the Worst Beverage Ever Invented (io9). Ugh. Why can’t this be easy?
Coffee isn’t a magic elixir, and it isn’t a doomsday device. Like most things in life, moderation is key. When it comes to coffee, I’ve tipped the moderation scale so far that it fell over. Time to recalibrate. I’ll be off the sauce for a while, and we’ll see where it goes from there…
Some would wonder why such a question is asked… but in my Microsoft Dynamics CRM 2011 environment, we do not require a First Name or Last Name on a Lead. When a Lead is qualified, users often click the buttons to create an Account and a Contact, even when they haven’t specified any contact-specific information (such as first and last name). What results is often a Contact with no name, and that contact is the Primary Contact for the Account. Ouch!
To fix this, we created a workflow on the Contact entity, which would deactivate the Contact if it had a Qualifying Lead, and had a blank First Name or Last Name. This took care of the Contact, but there was still a problem: the Account’s Primary Contact pointed still pointed to the nameless Contact we just deactivated!
Looking at the Audit History on the Account, we were able to figure out that, when qualifying a lead, CRM creates and updates records as follows:
- A new Account record is created. The Primary Contact field is left blank.
- A new Contact record is created. The Contact’s Account is set to the Account created in step #1.
- The Account record created in step #1 is updated. The Primary Contact field is set to the Contact created in step #2.
To solve the deactivated Primary Contact problem, we created a workflow on the Account entity, which would clear the Primary Contact field if the Primary Contact was set to a deactivated Contact.
Problem solved! Users can continue trying to create Contacts with no names, and we’ll make sure they never see them.
Recently, I needed to compress all contents of a folder (including subfolders) to an archive file, and copy it to a remote (network) location, all from a command line. In other words, I wanted to do this:
compressAndCopyFolder <sourceFolder> <destinationFolder> <archiveFileName>
Here’s how each parameter would work:
sourceFolder is the folder, along with all subfolders, to be added to the archive.
destinationFolder is the folder where the archive would be created.
archiveFileName is the file name of the archive
I prefer 7zip for archiving, so I could have done this simply using one command:
7z.exe" a -r "%destinationFolder%\%archiveFileName%.7z" %sourceFolder%\*
The problem with this is that it is inefficient to work with a large archive file over the network — there’s a lot of chatter going on to add files to an archive file. Much faster to create the archive locally, then copy the final archive file to the network. So, instead of one command, we have two:
if "%3"=="" (
echo usage: 7zfolder ^<sourcefolder^> ^<destinationfolder^> ^<destinationfilename^>
echo Note: The suffix .7z will be added at the end of destinationFilename.
if not exist "%1" (
echo ERROR: Source folder does not exist: %1
if not exist "%2" (
echo ERROR: Destination folder does not exist: %2
if exist "%2\%3.7z" (
@echo ERROR: Destination file already exists in destination folder: %2\%3
@"c:\Program Files\7-Zip\7z.exe" a -r "%temp%\%3.7z" %1\*
@copy "%temp%\%3.7z" %2\%3.7z /z
Now, from a command line, I just do this…
7zfolder c:\mysource \\myserver\mydest archive
… and all files in
c:\mysource will be added to an archive
Don’t you just love batch files?