Skip to content

Instantly share code, notes, and snippets.

View apb2006's full-sized avatar

Andy Bunce apb2006

  • Quodatum
  • London, UK
View GitHub Profile
@apb2006
apb2006 / gist:10777961
Created April 15, 2014 21:32
eclipse xquery dependancy problem
Cannot complete the install because of a conflicting dependency.
Software being installed: Dynamic Languages Toolkit - Core Frameworks 4.0.0.201206120848 (org.eclipse.dltk.core.feature.group 4.0.0.201206120848)
Software currently installed: XQuery Development Tools Feature 1.0.0.201108251748 (org.eclipse.wst.xquery.feature.feature.group 1.0.0.201108251748)
Only one of the following can be installed at once:
Dynamic Languages Toolkit Core UI 4.0.0.201206120848 (org.eclipse.dltk.ui 4.0.0.201206120848)
Dynamic Languages Toolkit Core UI 3.0.1.v20110823 (org.eclipse.dltk.ui 3.0.1.v20110823)
Dynamic Languages Toolkit Core UI 3.0.0.v20110609-1525 (org.eclipse.dltk.ui 3.0.0.v20110609-1525)
Cannot satisfy dependency:
From: Dynamic Languages Toolkit - Core Frameworks 4.0.0.201206120848 (org.eclipse.dltk.core.feature.group 4.0.0.201206120848)
To: org.eclipse.dltk.ui [4.0.0.201206120848]
@apb2006
apb2006 / config.txt
Created May 1, 2014 11:11
raspberry pi config nano /boot/config.txt
pi@raspberrypi ~ $ cat /boot/config.txt
# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1
# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
#disable_overscan=0
# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
@apb2006
apb2006 / data.xml
Last active August 29, 2015 14:04
BaseX update query
<bar>
<crumbs type="array">
<link>
<text>Suites</text>
<href>#</href>
<title>List of suites</title>
</link>
<link>
<text>{{activesuite}}</text>
<href>#/suite/{{activesuite}}</href>
@apb2006
apb2006 / gist:0b2a2291b31807e70bb8
Last active August 29, 2015 14:08
BaseX Full text search: To be or not to be
Using http://xml.coverpages.org/bosakShakespeare200.html
Timing BaseX 7.9 GUI find command, numbers in parentheses are fails
q1:to be or not to be
q2:Brevity is the soul of wit
index defined q1 q2
---------------------------------
none 500ms 400ms
fulltext~5mb 30ms 3ms
@apb2006
apb2006 / json-test.xqm
Created December 2, 2014 22:40
BaseX RESTXQ JSON test
(:~
: JSON test apb 2dec 2014
:)
module namespace page = 'json-test';
declare variable $page:data:=<json objects="json _">
<total type="number">15</total>
<entity>app</entity>
<items type="array">
@apb2006
apb2006 / javascripting.xq
Last active August 29, 2015 14:26
Java8 XQuery Javascript
(: Java8 XQuery Javascript :)
declare namespace se="java:javax.script.ScriptEngine";
declare namespace sm="java:javax.script.ScriptEngineManager";
let $engine:= sm:getEngineByName(sm:new(),"nashorn")
return (
se:put($engine,"a","This string is encoded!"),
se:eval($engine,"escape(a)")
)
import module namespace eval = "quodatum.eval" at "../../../app-doc/src/doc/lib/eval.xqm";
let $s:="
declare variable $state as element(state):=db:open('doc-doc','/state.xml')/state;
(replace value of node $state/hits with 1+$state/hits,
1+$state/hits)
"
let $b:= eval:update($s,"",map{})
return ($b,$b?result+100)
@apb2006
apb2006 / powerset.xq
Last active September 18, 2015 15:43
generate powerset
(: let $combs:=[(),1,2,3,(1,2),(2,3),(1,3),(1,2,3)] :)
declare function local:powerset($items as item()* )
as array(*){
if (count($items)=0) then [()]
else let $x:=local:powerset(tail($items))
return array:join(($x,
array:for-each($x,function($v){head($items),$v}))
)
};
@apb2006
apb2006 / gist:1603598
Created January 12, 2012 22:39
Install basex on readynas duo 2
velvet:~# wget http://ftp.us.debian.org/debian/pool/main/b/basex/basex_7.0.2-1_all.deb
--2012-01-12 22:35:23-- http://ftp.us.debian.org/debian/pool/main/b/basex/basex_7.0.2-1_all.deb
Resolving ftp.us.debian.org... 35.9.37.225, 128.30.2.36
Connecting to ftp.us.debian.org|35.9.37.225|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2122208 (2.0M) [application/octet-stream]
Saving to: `basex_7.0.2-1_all.deb'
100%[======================================>] 2,122,208 542K/s in 4.3s
@apb2006
apb2006 / gist:1643724
Created January 19, 2012 23:34
basex 7.02 performance
(: 100ms :)
import module namespace app="/apb/bxnfactbook/0.1" ;
declare namespace functx="http://www.functx.com";
declare function local:foo(){
let $a:=app:entity("city")
let $schema:=$app:schema/schema/db/entity[@name="city"]
let $sorted:=app:sequence-sort($a,"name",1,"string")
let $table:=app:sequence-to-table3($sorted,$schema)
return $sorted