Thursday, April 1, 2010

Linux Commands

A few commands I find myself using from time to time and don't want to forget.

To examine a large log with logj4, STDIN, STDOUT, and STDERR printouts all going to the same log file, I find it easier to comb when I can narrow down to specific type(s) of log4j level statements and show them without line breaks.

grep "^\[TRACE\|DEBUG\|INFO\|ERROR\|WARN\|FATAL\]" my.log | less -S

Also, to recursively add files in your svn working copy...

svn status | grep "^\?" | awk '{print $2}' | xargs svn add

Friday, March 26, 2010

SVN Merging : Blocking Revisions

Blocking revisions from auto merging in svn, taken from the manual.





$ cd my-calc-branch

$ svn propget svn:mergeinfo .
/trunk:1680-3305

# Let's make the metadata list r3328 as already merged.
$ svn merge -c 3328 --record-only http://svn.example.com/repos/calc/trunk

$ svn status
M .

$ svn propget svn:mergeinfo .
/trunk:1680-3305,3328

$ svn commit -m "Block r3328 from being merged to the branch."

Friday, February 19, 2010

Debug tests in maven

    If you need to configure a different port, you may pass a more detailed value. For example, the value below will use port 5334.

    mvn -Dmaven.surefire.debug="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5334" test

    Note: if you are not worried about making a connection to the debugger so that you are connected before the program reaches your breakpoint, you can change suspend=y to suspend=n, and the tests will not wait for a debugger connection


Friday, October 30, 2009

Force Quit on Mac Apps

Command + Option + Escape

Tuesday, October 13, 2009

Capturing Screenshots On Mac

Great tips for capturing screen shots on the Mac. I got this from..

http://www.techiecorner.com/138/how-to-do-print-screen-in-mac-os-x/

There are few ways to do screen capture in Mac OS X.
Follow the steps below and you will be able to do a screen capture in Mac OS X.

  • Switch to the screen that you wan to to do screen capture
  • Hold down Apple key ⌘ + Shift + 3 and release all
  • then use your mouse to click on the screen
  • Done. You will see a picture file in at your desktop. That’s the screen capture picture.

You can also do a screen capture for a portion of your screen.

  • Switch to the screen that you wan to to do screen capture
  • Hold down Apple key ⌘ + Shift + 4 and release all key
  • Now, You will see the mouse cursor will change to +
  • You can start to drag your mouse to select the portion you wish to capture.
  • Once finish, you will see a picture file in at your desktop. That’s the screen capture picture!

If you want to do a screen capture for a particular application window, you can follow this:-

  • Switch to the screen that you wan to to do screen capture
  • Hold down Apple key ⌘ + Shift + 4 and release all key
  • Now, You will see the mouse cursor will change to +
  • Press the space bar once
  • You will see the mouse cursor change to a camera
  • Now you can use the camera to select which application window to screen capture
  • Once finish, you will see a picture file in at your desktop. That’s the screen capture picture!

Friday, September 25, 2009

Character-set Encoding Issues

Great site for inspecting characters to troubleshoot character encoding issues.

Thursday, September 24, 2009

DBUnit and Foriegn Key Constraints


DB Unit is great, except for the FK constraint hell you go through until you learn to do..
1. IDataSet dataset = new FlatXmlDataSet(
ClassLoader.getSystemResourceAsStream(
datasetFilename));
2. dataset = new FilteredDataSet(
new DatabaseSequenceFilter(
getConnection()), dataset);
Line 2 there looks at the constraints and the dataset and determines the correct ordering for the SQL statements for your database, so that when they're run in the setup/teardown of your DBUnit tests you don't get FK constraint violations.

There are many blog postings that give all kinds of ways to disable or defer FK checks by the database, but this works better I think, for me since I have the test setup in Java. This came from the comments in a Matt Raible post from 2006.