Archive for August, 2009

Ignoring .svn directories with grep

Trying a recursive grep?
grep -RnH (string) (path) gets you all the occurrences of (string) in (path) with line numbers but if you’re working with an SVN folder, a bunch of hits will come up from the .svn folder. Thats pretty annoying… the fix is using the exclude flag.

Try:
grep --exclude *\.svn* -RnH (string) (path)

Beautiful.

, , , , , , , , , ,

49 Comments

Recovering files and folders in SVN

To restore a file or folder from a previous revision (that has been deleted or modified):

svn cp svn://path/to/folder/or/file@rev /path/to/dest

The source has to be the full URI to the file or folder you wish to restore and the destination can simply be ‘.’ (this folder).

, , , ,

No Comments

Build your own remote!

I’ve been telling myself that I’ll do a write-up on how to build one of these for a long time now… its pretty trivial but my friends always ask me how to do it. Anywho, I stumbled upon a site that’s already done it for me, so I’m just going to link you to it.

http://www.diyphotography.net/release_cable_for_canon_dslr

or for something more interesting,

http://www.diyphotography.net/recycling-project-trigger-your-camera-with-a-mouse

Though, (for the first link) instead of using two switches, you really need only one switch to do bulb exposures and two push buttons for normal triggering.

And if you’re not shooting with a rebel camera, but rather one of canon’s higher-end models… you’ll need a way to connect the remote to the proprietary n3 port. I wrote a post on this a while back… you can nab a 3.5mm to N-3 adaptor (see: http://www.incognitomind.com/?p=195).

,

11 Comments

Notes on Multithreaded Debugging with GDB

For the past few weeks I’ve been debugging a JNI DLL with GDB for work… here are a few things I’ve learned.

I was using Cygwin in Windows XP for gdb and Netbeans for java.

Some basic stuff that you’re probably already familiar with if you use gdb:
b symbol – break at symbol
b symbol:line – break at line in symbol
c – continue
s – step
n – do not enter functions/calls, step
p – print

Multithread/DLL/JNI related stuff:

Basically how I went about debugging the dll’s in the java program was by adding a breakpoint early on in the java application (after the dll has been loaded). Once the breakpoint is hit, I launch gdb and attach to the java.exe process. At this point I can set all the necessary breakpoints in the DLL and continue in gdb then continue in java.

To attach gdb to a process, the command is: gdb --pid=1234

To get a backtrace from all threads: thread apply all bt full

To switch threads: thread threadno

To list dll functions: info functions !

To list all functions matching a regex: info functions regex

Did I miss anything?

, ,

No Comments

How exciting!

My photo:
OC Fair at Sunset

was chosen from our local walk group for the world-wide photo contest!

I think this is the first time a photo of mine has been picked in something official :P.

1 Comment