Wednesday, 12 December 2012

MarkLogic: pstack not working?

I recently saw an issue where the usual trick of calling:
sudo /etc/init.d/MarkLogic pstack 
Was not dumping the output from pstack as expected. I put this together to work around this issue by doing the following instead:
sudo pstack $(ps -ef | grep MarkLogic | grep daemon | awk 'END {print $2}')

Thursday, 21 June 2012

Bash: example using grep and sed to process a MarkLogic ErrorLog.txt file

Here's an exammple of how grep, sed, sort and uniq can be used to debug entries in a log file (in this case, I'm debugging a problem with a CPF pipeline in MarkLogic). In essence, this process filters all the lines pertaining to a CPF processing action, removes the first part of the line to remove timestamps and unnecessary information (leaving just a document URI), sorts them into an order then returns just the unique document URIs:
grep "Processing some-problem-query.xqy" ErrorLog.txt | sed "s/^.*.xqy: //g" | sort | uniq

Monday, 18 June 2012

Cygwin: Output text content to the clipboard

Sometimes it's useful to redirect the output directly to the windows clipboard so you can use the content elsewhere later (a text editor, for example):
bash-4.1$ grep "Starting MarkLogic" ErrorLog_2.txt -A50 -B260 > /dev/clipboard

Sunday, 13 May 2012

Ubuntu: easy rapid deployment of wordpress in a local development environment

Here's a very quick guide to setting up wordpress using juju for local development. Install the prerequisite files and disable the firewall so your system can configure itself correctly: Then edit the environments configuration file: It should look something like this after you've set the type to local and added the data-dir for the instance data: The following will bootstrap, deploy mysql and wordpress, then make it available over http: You will need to give juju 5 - 10 minutes before everything is ready. You will probably hear a fair amount of disk I/O while this is happening. To get the status of your juju'd instance: Look at the wordpress configuration information, the public-address will be the address where the instance is made available over http. To teardown the environment:

Wednesday, 15 February 2012

Unix: batch file rename note

Batch file rename example allowing files to be renamed and appending a 'zip' file extension - run from within a directory: