Skip to content

Instantly share code, notes, and snippets.

View baburdick's full-sized avatar

Bruce Burdick baburdick

View GitHub Profile
@baburdick
baburdick / xpath-heavy.sql
Last active December 19, 2015 15:49
This is a query that gathers 12 pieces of information from an XML column by using the xpath function. It performs very poorly, and causes PG's memory use to balloon, risking the availability of what is a production DB. (PG 9.1) How can this be rewritten to be more RAM-efficient, and possibly return results more quickly?
drop table if exists temp_foo1;
select
foorr.id as foo_raw_responses_id
, foorr.created_at as foo_created_at
, foorr.customer_id
, (xpath( '////foo:response/foo:RecordCount/text()',
xmlconcat( foorr.value::xml ),
ARRAY[ ARRAY[ 'soap', 'http://schemas.xmlsoap.org/soap/envelope/' ],
ARRAY[ 'foo', 'http://example.com/ExampleService' ] ] ))[1]::varchar::numeric
as foo_RecordCount
01:29 PM bruce@Bruces-Studio-Mac-Pro ruby-2.0.0-p247: ~
$ rvm info
ruby-2.0.0-p247:
system:
uname: "Darwin Bruces-Studio-Mac-Pro.local 10.8.0 Darwin Kernel Version 10.8.0: Tue Jun 7 16:32:41 PDT 2011; root:xnu-1504.15.3~1/RELEASE_X86_64 x86_64"
system: "osx/10.6/x86_64"
bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0)"
zsh: "/bin/zsh => zsh 4.3.9 (i386-apple-darwin10.0)"
$ rvm reinstall rbx
Removing /Users/bruce/.rvm/src/rbx-2.0.0
/Users/bruce/.rvm/rubies/rbx-2.0.0 has already been removed.
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.6/x86_64/rbx-2.0.0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Certificates in '/opt/local/etc/openssl/cert.pem' already are up to date.
Requirements installation successful.
rbx-2.0.0 - #downloading rubinius-2.0.0, this may take a while depending on your connection...
+ [[ -n '' ]]
+ set -o errtrace
+ export 'PS4=+ $(__rvm_date "+%s.%N") ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > '
+ PS4='+ $(__rvm_date "+%s.%N") ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > '
+ 1381174777.N /scripts/cli : __rvm_parse_args() 688 > [[ -z '' ]]
+ 1381174777.N /scripts/cli : __rvm_parse_args() 688 > [[ -n '' ]]
+ 1381174777.N /scripts/cli : __rvm_parse_args() 691 > [[ error == '' ]]
+ 1381174777.N /scripts/cli : __rvm_parse_args() 691 > [[ 0 -eq 1 ]]
+ 1381174777.N /scripts/cli : __rvm_parse_args() 691 > [[ -n '' ]]
+ 1381174777.N /scripts/cli : __rvm_parse_args() 15 > [[ -n install ]]
@baburdick
baburdick / gist:6874268
Created October 7, 2013 20:20
First install of rbx with latest rvm head on OS X 10.8. (Fails)
This file has been truncated, but you can view the full file.
$ rvm --trace --debug reinstall rbx-2.0.0 2>&1 | tee big.log
+ [[ -n '' ]]
+ set -o errtrace
+ export 'PS4=+ $(__rvm_date "+%s.%N") ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > '
+ PS4='+ $(__rvm_date "+%s.%N") ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > '
+ 1381176580.933710000 /scripts/cli : __rvm_parse_args() 688 > [[ -z '' ]]
+ 1381176580.939178000 /scripts/cli : __rvm_parse_args() 688 > [[ -n '' ]]
+ 1381176580.944321000 /scripts/cli : __rvm_parse_args() 691 > [[ error == '' ]]
+ 1381176580.949402000 /scripts/cli : __rvm_parse_args() 691 > [[ 0 -eq 1 ]]
@baburdick
baburdick / big.log
Created October 7, 2013 23:50
New install of rbx with latest rvm head on OS X 10.8. (requests sudo password for mkdir -p: `bruceb password required for 'mkdir -p ':`)
$ rvm --trace --debug install rbx-2.0.0 2>&1 | tee big.log
+ [[ -n '' ]]
+ set -o errtrace
+ export 'PS4=+ $(__rvm_date "+%s.%N") ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > '
+ PS4='+ $(__rvm_date "+%s.%N") ${BASH_SOURCE##${rvm_path:-}} : ${FUNCNAME[0]:+${FUNCNAME[0]}()} ${LINENO} > '
+ 1381189387.292630000 /scripts/cli : __rvm_parse_args() 688 > [[ -z '' ]]
+ 1381189387.297973000 /scripts/cli : __rvm_parse_args() 688 > [[ -n '' ]]
+ 1381189387.303203000 /scripts/cli : __rvm_parse_args() 691 > [[ error == '' ]]
+ 1381189387.308031000 /scripts/cli : __rvm_parse_args() 691 > [[ 0 -eq 1 ]]
@baburdick
baburdick / rvm-info.txt
Last active December 25, 2015 02:59
Installing jruby with RVM's head version asks for sudo password to do this: `mkdir -p /usr/lib/ssl`. (On both OS X 10.6 and 10.8.) This is only for the first install attempt. The second succeeds (see big.log output).
$ rvm info
system:
system:
uname: "Darwin Dax.local 12.5.0 Darwin Kernel Version 12.5.0: Sun Sep 29 13:33:47 PDT 2013; root:xnu-2050.48.12~1/RELEASE_X86_64 x86_64 i386 MacBookPro8,2 Darwin"
system: "osx/10.8/x86_64"
bash: "/bin/bash => GNU bash, version 3.2.48(1)-release (x86_64-apple-darwin12)"
zsh: "/bin/zsh => zsh 4.3.11 (i386-apple-darwin12.0)"
diff --git a/lib/simplecov.rb b/lib/simplecov.rb
index 1c2b982..e1c749c 100644
--- a/lib/simplecov.rb
+++ b/lib/simplecov.rb
@@ -2,6 +2,7 @@
# Code coverage for ruby 1.9. Please check out README for a full introduction.
#
require 'lockfile'
+require 'pathname'
Nov 5 21:57:12 MacBookPro SourceTree[25513]: SourceTree(25513,0x105f12000) malloc: *** auto malloc[25513]: error: GC operation on unregistered thread. Thread registered implicitly. Break on auto_zone_thread_registration_error() to debug.
Nov 5 21:57:12 MacBookPro.local SourceTree[25513]: registerCustomValueTransformers on main thread
Nov 5 21:57:20 MacBookPro.local SourceTree[25513]: BUG in libdispatch client: kevent[EVFILT_WRITE] delete: "No such file or directory" - 0x2
$ rvm install 2.1 --disable-binary
Checking requirements for osx_port.
Updating certificates in '/opt/local/etc/openssl/cert.pem'.
bruceb password required for 'mv -f /var/folders/pm/lhs0kfv48xj6l2001s75zmr00000gn/T//tmp.YVlIfvGQDBxmBDhxZq /opt/local/etc/openssl/cert.pem':