Friday, July 15, 2005

switching between tabs (worksheets) in Microsoft Excel

It's been annoying me for a long time that Ctrl-Tab and Ctrl-Shift-Tab don't switch between worksheets in the currently open workbook in Excel.  I haven't dealt with changing it yet, but at least found what the existing keyboard shortcuts are.
 
Found this in:
Help | Microsoft Excel Help
 
then:
Contents | Accessibility in Excel | Keyboard shortcuts
 
under section: Keys for workbooks and worksheets
 
expand: Work with worksheets
 
CTRL+PAGE DOWN
Move to the next sheet in the workbook.
CTRL+PAGE UP
Move to the previous sheet in the workbook.
 

Thursday, July 14, 2005

How to reattach to GNU screen sessions in windows (cygwin)

I use a Windows version of the GNU Screen window manager/terminal multiplexer every day, and wanted to share a trick that I've learned over time.  A lot of people have trouble with reattaching to existing screen sessions in the windows/cygwin version. You can probably accomplish this different ways, but this is what I have been doing every day at work for at least 9 months now:
 
  1. open first bash shell window
  2. run: screen
  3. open another bash shell window
  4. run: screen -x

    NOTE: this window will probably not reattach, at least it doesn't for me.  if it does, these instructions are useless for you.
  5. close second bash window (opened in step 3).
  6. open another bash shell window
  7. run: screen -x
At this point, both bash windows are now connected to the same screen session.
 
Variations on this may work.. I've done this in a lot of different conditions, including of course ssh-ing into a box and attaching to the existing screen session, and also using ssh-agent just right to avoid having to type passwords all day long.  More on that later, but for now, I just wanted to get this basic information out there. 
 
The main idea is that the first attempt to attach to an existing screen session will fail, but if you try again in a new window it should work.
 

 

Friday, July 08, 2005

cvsrecent.bsh

This is a bash shell script to get a list of CVS revisions and log messages for all checkins within the past (some number) of days.

I'm using this to help me when writing weekly status reports, so I can make sure I don't forget anything.

It searches recursively, starting from the current directory, for all files that contain a '.' in their names (I only care about *.jsp, *.java, *.xml, etc. at this point), and whose paths do not include '/CVS/' or '/build/'. For each filename it finds, it checks the number of lines that cvs log returns for that file, based on the number of days back that you tell it to look, and if that number is greaterthan the number of lines returned for an unmodified file, the relevant cvs log info is displayed.

Usage: cvsrecent.bsh [DaysAgo]

[DaysAgo] is the number of days past that you want to get cvs log info for. I usually run it with '7' to get the past week's worth of cvs log messages.

NOTE: You will want to have your system configured to not require a password everytime you run the 'cvs' command, or you will get prompted for the password WAAAAY too many times. I do this using ssh-agent.

#!/bin/bash

## cvsrecent.bsh
##
## Author:
## Dave Nelson
## spugbrap.com+blog@gmail.com
##
## Source:
## spugbrap's random geek notes blog
## http://spugbrap.blogspot.com
##
## Debug version available from:
## http://www.oatmealcookies.org/blogdl/cvsrecent-debug.bsh
##
## Date Posted:
## 07/08/2005

# No [DaysAgo] parameter specified
if [ -z "$1" ]
then
  echo "Usage: `basename $0` [DaysAgo]"
  exit -1
fi

DaysAgo=$1
RefDate=$(date --date="$DaysAgo days ago" +"%Y-%m-%d")
TempFile=/tmp/cvsrecent.$PPID
JunkLogLines=11
fileList=`find . -mtime -$DaysAgo -type f -name '*.*' |            grep -v '/CVS/' | grep -v '/build/'`

for curFile in $fileList
do
  cvs -Q log -SNd ">=$RefDate" $curFile >$TempFile

  totalLogLines=`cat $TempFile | wc -l`

  if [ $totalLogLines -gt $JunkLogLines ]
  then

      echo $curFile

      tail -`expr $totalLogLines '-' $JunkLogLines '+' 1`         $TempFile
  fi
done