<< Previous | Home | Next >>

Subclipse 1.10 + Maven (M2E)

I had a tricky time getting the Eclipse Maven tool (m2e) to work in Eclipse Luna with the latest version of Subclipse 1.10.6.  It turns out that the Maven SCM Handler for Subclipse (m2e-subclipse)  linked to in the Luna Marketplace on the Sonatype site is no longer supported.  The gory details and a .zip file containing an updated m2e-subclipse plugin are available at subclipse.tigris.org/issues/show_bug.cgi.

Tags : , ,
Social Bookmarks :  Add this post to Slashdot    Add this post to Digg    Add this post to Reddit    Add this post to Delicious    Add this post to Stumble it    Add this post to Google    Add this post to Technorati    Add this post to Bloglines    Add this post to Facebook    Add this post to Furl    Add this post to Windows Live    Add this post to Yahoo!

Export this post as PDF document  Export this post to PDF document

curl Authentication

Using curl to GET data from an authenticated source.  Works great with Cygwin on Windows...

curl -v -u admin:password --digest https://127.0.0.1:8101
Tags : , ,
Social Bookmarks :  Add this post to Slashdot    Add this post to Digg    Add this post to Reddit    Add this post to Delicious    Add this post to Stumble it    Add this post to Google    Add this post to Technorati    Add this post to Bloglines    Add this post to Facebook    Add this post to Furl    Add this post to Windows Live    Add this post to Yahoo!

Export this post as PDF document  Export this post to PDF document

MarkLogic XQuery MultiUpload

Some jQuery and XQuery code to load content into a MarkLogic database:

'form#uploadForm': function(idx, elm) {
    var form = $(elm)
    form.submit(function(evt) {
        evt.preventDefault();
        rn_util.log('SUBMITTED: ', form);
        
        $.ajax({
            url: 'spike/uploadController.xqy',
            type: 'POST',
            data: new FormData(elm),
            cache: false,
            contentType: false,
            processData: false,
            beforeSend: function(jqXHR, settings) {
                rn_util.log('beforeSend', jqXHR.upload);
            },
            success: function(data, textStatus, jqXHR) {
                rn_util.log('POST COMPLETED: ', textStatus, '; ', jqXHR);
            }
        });
    });
}
xquery version "1.0-ml";

declare namespace zip = "xdmp:zip";
declare namespace aib = "co.wlv.xml.aib";

xdmp:log("GREETINGS:UPLOAD"),

for $headerName as xs:string in xdmp:get-request-header-names()
return 
    xdmp:log(concat("HEADERNAME: ", $headerName, " = ", xdmp:get-request-header($headerName))),
    
for $fieldName as xs:string in xdmp:get-request-field-names()
return 
    xdmp:log(concat("FIELDNAME: ", $fieldName)),
    
for $inputFile as xs:string in xdmp:get-request-field-filename("inputFiles")
return xdmp:log(concat("FILENAME: ", $inputFile)),

let $fileNames as xs:string* := xdmp:get-request-field-filename("inputFiles"),
    $inventory as element(aib:inventory) := doc("/packages/inventory.xml")/aib:inventory
for $inputFile as item() at $i in xdmp:get-request-field("inputFiles")
let $fileName as xs:string := $fileNames[$i],
    $packageUri as xs:anyURI := xs:anyURI(concat("/packages/package-", xdmp:random())),
    $zipManifest as node() := xdmp:zip-manifest($inputFile)
return (
    xdmp:log(concat("FILE: ", $fileName, ";&#10;", xdmp:quote($zipManifest), "&#10;COUNT: ", count($zipManifest/zip:part))),
    xdmp:node-insert-child($inventory, element {QName("co.wlv.xml.aib", "package")} {
        attribute uri {$packageUri},
        attribute name {$fileName},
        attribute added {current-dateTime()},
        for $part as element(zip:part) in $zipManifest/zip:part
        let $file as node()+ := xdmp:zip-get($inputFile, string($part)),
            $XXX := xdmp:log(xs:anyURI(concat($packageUri, "/", replace(string($part), "\\", "/")))),
            $fileUri as xs:anyURI := xs:anyURI(concat($packageUri, "/", replace(string($part), "\\", "/")))
        return (
            xdmp:log(concat("PART: ", string($part), "; COUNT: ", count($file))),
            xdmp:document-insert($fileUri, $file[1]),
            element {QName("co.wlv.xml.aib", "file")} {
                attribute uri {$fileUri},
                attribute size {$part/@uncompressed-size},
                $part/@last-modified
            }
        )
    })
)
Social Bookmarks :  Add this post to Slashdot    Add this post to Digg    Add this post to Reddit    Add this post to Delicious    Add this post to Stumble it    Add this post to Google    Add this post to Technorati    Add this post to Bloglines    Add this post to Facebook    Add this post to Furl    Add this post to Windows Live    Add this post to Yahoo!

Export this post as PDF document  Export this post to PDF document