Thursday, June 24, 2010

One-liner for errors per hour in a rolling log4j log

Because I keep forgetting valid syntax and having an example is very very handy:



for h in $(seq 0 23); do hh=$(printf "%02d" $h);  echo $hh $(grep "^2010-06-24 $hh.*general exception" some-dir?/ALogFile?.log* | wc -l); done;

Monday, June 7, 2010

So you smashed your macbook screen and want to use an external monitor as primary

After destroying the screen on my macbook I got to thinking the machine should work fine with an external monitor. The system would boot fine and display an exciting kaleidoscope of colors but aside from the monitor problem it appeared to be working. On connecting an external monitor I found that it does indeed start using that monitor. Now the only problem was that everything likes to start on the main monitor and when you can't see that monitor it is challenging to move things onto the secondary display.

Searches for keyboard shortcuts to move things between screens or ways to disable the primary monitor on startup didn't turn up much. Simply searching for the actual problem "macbook monitor broken" turned up a thread titled "Macbook screen broken, help w/ external monitor" (here). This proposed use of "clamshell mode" to get around the problem. This sounded perfect. Unfortunately, after getting a keyboard and mouse from IT the Macbook just went to sleep every time I closed it. Imperfect clamshell.

More googling revealed (eventually) that the Macbook only works in clamshell mode when connected to power; no battery powered clamshells, as described on both Forever For Now (here) and an Apple support page regarding clamshell (here).

Luckily next time I smash a Macbook screen I will remember that it happened to me before and I wrote down how to deal with it!