Tuesday 13 December 2011
Friday 9 December 2011
MarkLogic: Using XCC/J to pass content to an installed Module
Wednesday 2 November 2011
MarkLogic: Next steps with the MarkLogic Hadoop Connector (MarkLogic 5.0-1)
Following on from my post yesterday, here's a further example usage for the hadoop connector
Listed below is an example showing how you can use the connector to update an existing document in MarkLogic. As before, we're only focusing on the Map phase of Map/Reduce in order to keep things simple.
Prerequisites:
- You'll need the hadoop connector on your buildpath, which is here
- In addition to having installed MarkLogic 5, you'll need to create an XDBC server (for this example, I'm using port 9999 and targeting the Documents database).
When you're ready, create one XML doc in the database:
Then try the following:
This is the content for the XML config file src/main/resources/marklogic-mlnode-update.xml (referred to in the code above):
And the xcc/j connector for MarkLogic 5.0-1 is now in maven, so all other dependencies can be resolved by this pom:
Enjoy your elephant...
Tuesday 1 November 2011
MarkLogic: First steps with the MarkLogic hadoop connector (MarkLogic 5.0-1)
If you've just installed MarkLogic 5 and you're interested in spending some time checking out the hadoop connector, this may be a useful accompaniment to all the documentation available from the newly [re]launched MarkLogic Developer Community site.
There's quite a lot to get to grips with regarding the hadoop connector and this will probably be a topic warranting a number of posts over time. But as an additional resource for getting started (in addition to all the sample code and resources available here, this may be of some use.
Briefly, it shows a simplistic use of the connector - which in itself is not so useful as all it currently does is completely overwrite a document within the database with a new node, but it should give an idea as to how the connector could be configured to perform updates to existing data - which I hope to comment on within the next few days.
Prerequisites:
- You'll need the hadoop connector, which is here
- You'll also need to grab the latest xcc connector
- In addition to having installed MarkLogic 5, you'll need to create an XDBC server (for this example, I'm using port 9999 and targeting the Documents database).
Sunday 23 October 2011
MarkLogic/XCC/HttpClient: Connecting to an XDBC Application Server using HttpClient
Wednesday 12 October 2011
Scala: Example of heirarchical sorting by distinct values
In this context, bear in mind that sorted will return values sorted alphabetically - but you probably get the idea...
Thursday 6 October 2011
MarkLogic/Apache HttpClient: POSTing form data containing characters with diacritics
Source: http://hc.apache.org/httpclient-3.x/preference-api.html
Friday 30 September 2011
Bash/shell: Quick hints for gathering information from the MarkLogic logs
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
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
Friday 16 September 2011
XQuery/MarkLogic: pulling data out of an Excel spreadsheet
In this example, I'm taking a very simple spreadsheet structure to illustrate the procedure:
HEADER 1 | HEADER 2 |
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:
Monday 8 August 2011
SBT/ScalaTest: Running individual tests through the use of tagging
And to run only the specified test from within in SBT:
Tuesday 2 August 2011
MarkLogic: Example Word Query Specification Template
Wednesday 27 July 2011
Linux: ruby/libxcc bindings - configuring and testing
And some example usage:
MarkLogic: in-mem-update example
MarkLogic: Search API - sort order template
MarkLogic: Search API - removing facet constraints using XQuery and xdmp:set
Wednesday 6 July 2011
Thursday 30 June 2011
MarkLogic/XCC: Copying a Module with User Content Permissions
And you can test by running this against the Modules database in CQ:
And you should see something like this
Wednesday 22 June 2011
MarkLogic: clearing a forest in a database programatically
MarkLogic: Enabling debug options when using the Search API
Tuesday 21 June 2011
Monday 13 June 2011
MarkLogic/XCC: Installing Modules Programatically
Saturday 4 June 2011
Eclipse: Installing XQDT (and DLTK) on Eclipse Indigo [3.7 RC3]
Start by installing the Eclipse IDE for Java Developers from http://www.eclipse.org/downloads/index-developer.php (N.B. this is the link for the Release Candidate version of Eclipse 3.7 - for the current release, the link is http://www.eclipse.org/downloads/).
For everything else, you can use the Eclipse Install manager (Help > Install New Software...)
At outset, there are a couple of dependencies. First, the WST Server Adaptors from the Web, XML, Java EE and OSGi Enterprise Development section within http://download.eclipse.org/releases/indigo:
Then you need to install the DLTK 2.0 Core framework. To do this, add the update site repository http://download.eclipse.org/technology/dltk/updates/ to the "Work with" field and select Dynamic Languages Toolkit (DLTK) 2.0 and choose the package Dynamic Languages Toolkit - Core Frameworks
Finally, add the XQDT update site repository (also paste into the "Work with" input field) http://download.eclipse.org/webtools/incubator/repository/xquery/milestones/ and select all the necessary components:
Tuesday 31 May 2011
Bash: Find the size of a Folder from the shell
Will give you the size of the folder (in this case the Forests folder) in a "human readable" form, like this:
Tuesday 17 May 2011
Bash: recursive search for content in a file
This will search all directories recursively, looking for all files containing the term "search:search"
Wednesday 27 April 2011
VirtualBox: Minimal Install of Fedora - no Network on restart
Java: Handling Large XML Documents with VTD-XML
Tuesday 19 April 2011
XQuery: Replace example
Returns 2007 (the four decimal values in the node)
Monday 11 April 2011
MarkLogic: Performing an operation across two databases using xdmp:eval
This can be achieved using xdmp:eval.
In this example, if you have several documents in a database called "DatabaseA" (and in CQ this is selected as your Content Source). An xdmp:eval statement could be used to write those documents into DatabaseB like so:
Thursday 7 April 2011
MarkLogic: Sending and Receiving XML Content over HTTP
1. Wrap up content in an XML element and send it to a web service
2. On receipt, extract it from the request-body for further processing (insert, validate, transform etc)
To encode the XML element for transmission, you can use a combination of the right content-type options for xdmp:http-post (or xdmp:http-put) and xdmp:quote the element data:
For the service receiving the data, you use a combination of xdmp:unquote and xdmp:quote to extract the element from the request-body, but bear in mind that unquote will return a document-element. This can be easily resolved by switching the the first node() in the document like so:
Thursday 31 March 2011
MarkLogic: Inserting an XQuery Module into the database from within CQ (or XQuery)
If you explore the contents of your modules database after executing this, you should see /simple-example.xqy in the list.
Friday 25 March 2011
Java: Connecting to a MarkLogic WebDAV server using Apache Jackrabbit and Digest HTTP Authentication
The code below uses Apache Jackrabbit and HttpClient 3.x to connect to a MarkLogic WebDAV application server and logs out a list of all the files in a specific location:
I'm using maven to manage my dependencies for this. If you are too, here's the required dependencies:
Tuesday 8 March 2011
Ubuntu / Apache: granting write permissions to a user on /var/www
Adapted from these posts:
http://ubuntuforums.org/showthread.php?t=1694505
http://ubuntuforums.org/showthread.php?t=1242763
Tuesday 18 January 2011
MarkLogic: Extracting useful information from a server/cluster support dump
Here's an example for extracting information regarding specific forests:
Another example - a report for all forests (with a given name prefix) and their host node:
And another example: To give a total in-memory usage for all range indexes on a per-forest basis for the entire cluster (organised by host-id):
Blog Archive
-
▼
2011
(35)
-
►
June
(6)
- MarkLogic/XCC: Copying a Module with User Content ...
- MarkLogic: clearing a forest in a database program...
- MarkLogic: Enabling debug options when using the S...
- Linux: SCP syntax and structure note
- MarkLogic/XCC: Installing Modules Programatically
- Eclipse: Installing XQDT (and DLTK) on Eclipse Ind...
-
►
June
(6)