Display Date in OS X Menu Bar

On November 23rd I ordered my first Mac laptop since my Powerbook in grad school, a white Macbook. 2.2 GHz Intel Core 2 Duo. So far I’ve been reasonably impressed but one thing I wanted is for the menu bar to display the full date. It always bothered me that you can’t do this on Windows w/o third party applications.Fortunately on Mac OS X there is somewhat of a hack to do this, How To: Display Date in OS X Menu Bar.The format I ended up choosing is:Thu Jan 10 7:07 PMwhich I think is a little cleaner than the one used in the aforementioned article.Update: As of March 19, 2008, this cute hack no longer seems to work.  Seems like one of the Mac OS X updates changed the way the date is displayed in the OS X menu bar.  Now my date looks like this:Wed 9:23 AM PDT 

Perforce and Cygwin

To get Perforce to work with Cygwin is not too difficult. One just has to make an alias for p4 like this (thanks to this excellent Perforce FAQ).

if [ -e /bin/cygpath ]; then
  alias p4='p4 -d `cygpath -w $PWD`'
fi

This alias works all the time except I think when you are in a directory you accessed via a link.

Note you don’t need to go such lengths as described in this post.

Turning off Perforce Windows Explorer Integration

Since I am no longer using Perforce I wanted to turn off the Windows Explorer because somethings I would accidentally select the Perforce option in the right click menu and it would hang for a long time as it tried to reach the Perforce server.

This blog article says that the simplest way to do this is to select Change/Remove Perforce P4Win Components from the Add or Remove Programs Control Panel and then select the Windows Explorer integration for uninstall. When it is done uninstalling a reboot is required.

Another possibly simpler way is to:

  1. right click any folder
  2. choose Perforce > Options
  3. uncheck all check boxes

Subversion Branching

Drippy

Drippy by jurvetson

Subversion branching and tagging is basically copying from one repository directory to another.

This article gives great instructions on how to branch and tag with subversion. This article is also good.

This is an example of creating a branch from the trunk.

$ svn copy svn+ssh://fkim@betweengo.com/home/fkim/svn/foo/trunk svn+ssh://fkim@betweengo.com/home/fkim/svn/foo/branches/stable

This is an example of tagging the trunk.

$ svn copy svn+ssh://fkim@betweengo.com/home/fkim/svn/foo/trunk svn+ssh://fkim@betweengo.com/home/fkim/svn/foo/tags/2012-03-06

To compare branches you can simply do something like this svn diff [path] [path]. For example:

$ svn diff http://foo.com/branches/stable http://foo.com/trunk.

To merge from a branch to the trunk you can use svn merge like this. Note that you need to have the trunk checked out.

$ cd trunk
$ svn merge -r 3:4 svn+ssh://fkim@betweengo.com/home/fkim/svn/foo/branches/stable/doc/html doc/html

To merge from the trunk to the branch you can try something like this.

$ cd branches/stable
$ svn merge svn+ssh://fkim@betweengo.com/home/fkim/svn/foo/trunk

You may want to use the --dry-run option when you first run the merge to see how it will go. There might be a lot of conflicts.

Save the Output in a Shell Script Array

I wanted to do some shell processing on the contents of a directory. To do this I needed to put the contents of the directory in an array. Fortunately this is not difficult with bash.

  1. First capture the output.

    ls_output=$(ls /images)

  2. Next declare an array and reference the output with this array.

    declare -a img_files
    img_files=($ls_output)

  3. Now you can access the array directly or loop through it.

    echo ${img_files[0]}
    for img_file in ${img_files[@]}
    do
      ...
    done

Thanks O’Reilly’s Bash Cookbook.

Save the Output in a Shell Script Variable

I was counting how many times a file was referenced by other files. I then wanted to do some processing based on this number.

To do this I saved the output of this count in a variable which I was then able to reference later in the shell script.

num_files=`find . -type f -name '*.html' | xargs grep $img_file | wc -l`

# delete this file if it is not referenced
if [ "0" = $num_files ]
then
  rm $IMAGE_DIR/$img_file
fi

Persisting Orders

When troubleshooting orders it is really helpful to be able to view the order in the ACC.

By default orders are saved because persistOrders property of the /atg/commerce/ShoppingCart component is set to true. If you don’t see incomplete orders being saved then this means this property is not set to true.

More information on Troubleshooting Order Problems can be found in the ATG Commerce Programming Guide.

DistributorSender startup warning

When starting ATG instances with the DCS module I will often see this warning.

DistributorSender No remote servers configured

This is because in the product catalog two item descriptors, media-internal-binary and media-internal-text, are configured to use the Dynamo content distributor system if it is available. This is documented in the Using Content Distribution with a SQL Content Repository section of the ATG Dynamo Programming Guide.

Since out of the box the Dynamo content distributor system is not configured we see the above warning. To turn it off simply set loggingWarning=false for the /atg/commerce/catalog/ContentDistributorPool component.

ClientLockManager useLockServer property is false warning

In many ATG instances I will see this warning upon startup.

/atg/dynamo/service/ClientLockManager The useLockServer property of: /atg/dynamo/service/ClientLockManager is false and so global locking is disabled

As explained in the Enable the Repository Cache Lock Managers section of the Installation and Configuration Guide for DAS the ClientLockManager must be enabled if you are using locked mode caching anywhere in your SQL repository, which is typically the case in production when you are running more than one ATG server. The above warning is to inform the ATG administrator that currently the ClientLockManager is not enabled.

To enable it follow the instructions in the Configuring Lock Managers subsection of the Locked Caching section of the ATG Repository Guide.

On a single ATG instance environment you might still choose to setup the ClientLockManager and ServerLockManager just to get rid of this warning. To do this do the following.

  1. Enable ClientLockManager by creating localconfig/atg/dynamo/service/ClientLockManager.properties.lockServerAddress=localhost
    lockServerPort=9010
    useLockServer=true
  2. Start ServerLockManager by adding it to localconfig/atg/dynamo/service/Initial.properties.initialServices+=ServerLockManager

After doing this though you’ll see a warning like this.

/atg/dynamo/service/ServerLockManager No backup server is configured for Lock ServerCRAPBOOK-PRO/localhost:9010 It becomes Primary Server

So maybe in the end it’s better just to ignore the ClientLockManager warning, maybe even disable it. 🙂