Friday, 30 September 2011

Bash/shell: Quick hints for gathering information from the MarkLogic logs

One useful debugging / problem tracing tool I find myself using a lot is using grep with the -AXX argument, to find a specific error and dump the first XX lines of the stacktrace out. In this example, it'll find the word "cast" (for an invalid cast exception, for example) and dump the following 20 lines from that term

To get a list of unique GET requests made to a given http application server:

Tuesday, 27 September 2011

Java: Getting started with the TrueZip API

Extremely simplistic example of how you can use the TrueZip API to extract a load of files from a given zip file - it'll dump the files in the resources folder for this example:

You'll need the following dependencies in your POM file:

Monday, 19 September 2011

MarkLogic / XQuery - get a sample of document sizes across a given database

Here's a simple way to get the sizes of sample documents across a given databases

Friday, 16 September 2011

XQuery/MarkLogic: pulling data out of an Excel spreadsheet

Excel spreadsheets can be saved in an xml format - in such cases, it's simple to dump the xml into a CQ buffer (if you're using MarkLogic) and parse the information in adjacent column cells.

In this example, I'm taking a very simple spreadsheet structure to illustrate the procedure:

Val 1a Val 1b
Val 2a Val 2b
... ...

Below is an example of how to parse the XML, pull out the information from the relevant cells and strip white space for good measure:

You should end up with something like this: