IRC channel logs

2015-05-30.log

back to list of logs

<paroneayea>mark_weaver: aha okay!
<daviid>guile-gnome [devel] make, make check and make distcheck now all ok! still to fine tune 1 thing and have 1 quiz but good news!
<Chaos`Eternal>helo guilers
<saul>While extracting some records from a database, I am using 'with-output-to-file' to place some of the data in a file. After 4096 chars are written, however, I consistently receive an error while extracting the data.
<saul>Things work fine for stdout.
<mark_weaver>saul: what is the error? can you see what's wrong with the file?
<mark_weaver>here's a guess: one key difference between writing to a terminal and writing to a file is that terminal output is normally unbuffered by default, whereas file output is buffered. that means that until you either close the output port or flush it, some of what you wrote might still be waiting in the buffer.
<mark_weaver>you can use 'force-output' to flush pending output to a port.
<saul>mark_weaver, the error occurs after I read a row from the db "(dbi-get_row db-obj)" and try to take the 'car' of the returned value.
<mark_weaver>what is the error?
<saul>The problem is the returned value is #f upon reading the row, but reading the row works fine when output-to-file is not used.
<saul>In procedure car: Wrong type argument in position 1 (expecting pair): #f
<saul>^ error message
<mark_weaver>and this happens after you've written 4096 bytes to the output port?
<saul>mark_weaver, yes.
<mark_weaver>so you have a loop that iterates over rows and writes the data to an output port? and if the output port is stdout, it works, but if you've redirected output to a file with 'with-output-to-file' then it works at first but fails after 4096 bytes have been written?
<saul>mark_weaver, yes.
<saul>I have on one occasion encountered the error when no re-direction was used, but that was after about 16000 chars were written (and only occurred once out of about 10 tries).
<mark_weaver>which database backend are you using?
<saul>sqlite3
<mark_weaver>are you using multiple threads?
<saul>No.
<saul>mark_weaver, don't stress about it. I will do some more investigation (insert some debugging output). I am probably doing something wrong in my dbi stuff.
<saul>It just seemed strange that the error is somehow associated with output buffering.
<mark_weaver>saul: after #f is returned, there should be information on what went wrong, accessible via 'dbi-get_status'
<mark_weaver>getting that status information would be the next step
<mark_weaver>(dbi-get_status <handle>)
<saul>It say "no more rows to get".
<mark_weaver>that indicates that 'sqlite3_step' returned SQLITE_DONE
<mark_weaver>see __sqlite3_getrow_g_db_handle in guile-dbd-sqlite3.c in http://download.gna.org/guile-dbi/guile-dbd-sqlite3-2.1.4.tar.gz
<mark_weaver>saul: is it possible that the database handle is not properly protected from the garbage collector? if the handle is mostly stored in C or C++ data structures, and only transiently passed to Scheme, that might explain this.
<mark_weaver>guile-dbi probably arranges to close the database handle when the garbage collector thinks the handle is inaccessible, and maybe somehow sqlite will return SQLITE_DONE in that case (?)
<mark_weaver>Boehm GC scans C/C++ global variables and local variables (on the stack), but does *not* scan blocks allocated via 'malloc'
<saul>mark_weaver, I am using pure Guile. No C or ffi of any kind.
<mark_weaver>ah, okay
<mark_weaver>what version of guile?
<mark_weaver>and what versions of guile-dbi and guile-dbd-sqlite3 ?
<saul>guile 2.0.9 guile-dbi 2.1.5 guile-dbd-sqlite3 2.14
<saul>The last one should be 2.1.4
***curie is now known as curie13
<mark_weaver>saul: okay
<mark_weaver>I'm not sure what's going on, sorry
<mark_weaver>if you can produce a minimal self-contained example that would allow me to reproduce the problem on my system, I could investigate further
<saul>mark_weaver, I think I found my problem. I apparently am missing some checks in my database accessing and trying to retrieve a non-existant row.
<saul>I apologize for wasting your time but I really appreciate you walking me through things.
<mark_weaver>saul: okay, no problem. happy hacking!
<saul>The 4096 buffer thing is apparently just a side effect of how the exception causes a shutdown of the output.
<saul>mark_weaver, FWIW I was assuming that a dbi-query that finds no matches would return failure status. It seems that is not the case. The dbi-query returns "query ok" but with no rows available to get (dbi-get_row will return #f).
<saul>I was testing the wrong thing.
*saul is very new to the dbi module.
*davexunit should use that more
<davexunit>does anyone know how to easily create a new geiser REPL with a custom guile command?
<please_help>I figured out what d/dX (f(X) . g(X)) is, with X a matrix. It's the 4-tensor whose elements are the matrices defined by f'(X) . Oij . g(X) + f(X) . g'(X) . Oij; where Oij is the 0 matrix with a 1 at position i,j. That is, if f(X) is m x n and g(X) is n x l, then the diff is a m x n x m x l matrix.
<please_help>My question is, is there an efficient way to perform the computation, or at least to generate the m*n O matrices?
<please_help>the computation is equivalent to f'(X)-,j x g(X)i,- + f(X)-,j x g(X)i,- where x is the cross product.
<please_help>as far as I know, matrix mult is O(n^2.3) and cross product will be O(nm) so I imagine the cross product version will be faster?
<paroneayea>is it possible to make goops objects immutable? It seems like one can always use slot-set!
<paroneayea>but maybe there are ways to do it via the MOP
<paroneayea>davexunit: ooh, I'm guessing that it *is* likely that the language used in The Little Prover will be in schedme
<davexunit>yay!
<paroneayea> http://www.ccs.neu.edu/racket/pubs/dissertation-eastlund.pdf dissertation of one of the authors
<davexunit>great
<davexunit>I should've went to northeastern
<paroneayea>which used allegro common lisp
<paroneayea>so I'm guessing a conversion to scheme, not so hard.
*paroneayea saves that paper to his e-reader
<paroneayea>I really need a database option for taking my activitystreams stuff to the next state
<paroneayea>I guess for now I could just serialize all activities to disk via a simple scheme write but
<paroneayea>I think given that activitystreams is json encoded already, it might be nice to see if I can make use of guile-dbi with postgres and see if I can take advantage of jsonb
<paroneayea>my options seem to be:
<paroneayea> - do an in-memory representation which serializes to disk (has its obvious drawbacks...)
<paroneayea> - use guile-gdbm and hope I don't need anything too relational
<paroneayea> - make use of slib's relational database system (!!!) but I think nobody else in the world is using that, but could be interesting???
<paroneayea> - package guile-dbi and guile-dbi-postgres for guix and try to make some wrapper utilities around jsonb
<davexunit>what is the procedure to get the errno after a syscall?
<paroneayea>there's one more (hilarious?) option for databases that I haven't mentioned
<paroneayea>I could use the opencog atomspace
<paroneayea>which has a guile api
<paroneayea>hm
<paroneayea>opencog's atomspace seems to require a global state
<davexunit>GC Warning: Marker thread creation failed, errno = 22
<davexunit>where do I find out what this error code means?
<paroneayea> https://identi.ca/cwebber/note/dtSlvLB_SoW1-y-A2JKIhw
<paroneayea>davexunit: btw seeing as how searching for that string brings up posts on mono mailing lists
<paroneayea>I'm guessing it's related to the gc library guile uses
<davexunit>paroneayea: turns out the error comes from gnu libc
<davexunit>pthread_create fails
<paroneayea>hum!
<davexunit>my container is missing something in order to run guile as PID 1 ;)
<paroneayea>:)
<davexunit>I'll try something without threads
<daviid>guile-sqlite3 [as another db based option] i use it for kisĂȘ
<daviid>paroneayea: ^
<daviid>still on gitorious though, i shoyuld talk to wingo and we should move it somehwre else
<paroneayea>daviid: oooh I didn't know that existed
<daviid>when goops is fixed, all bugs i reported, i'll write a pgoops using sqlite3
<paroneayea>also, huh, I've never looked at guile-lib before
<paroneayea>oh, guile-1.8
<daviid>saul: ^^ wrt to the guile-dbi problem you reported here yesterday, I'd be curious, if easy and quick enough, you try with guile-sqlite3
<daviid>afaict, linas [guile-dbi maintainer] is still here and active, I think
<daviid>paroneayea: where are the atomspace guile bindings?
<paroneayea>daviid: they come built in
<paroneayea> https://github.com/opencog/atomspace/tree/master/examples/guile
<daviid>thanks! i said pgoops using guile-sqlite3 but i did think some other possibilities as well
<daviid>don't know yet
<paroneayea>daviid: what's pgoops?
<daviid>so much to do... and think about
<daviid>persistant goops
<paroneayea>oh interesting
<paroneayea>daviid: btw I wouldn't use atomspace
<paroneayea>I should mark more in the thing but
<paroneayea>it looks cool but also it's said to be slow, but more importantly, it's single threaded and uses a global state
<paroneayea>updated the post with that note.
<daviid>paroneayea: i looked a bit at redis, whitedb ... but could not yet fix my best choice
<daviid>fir the4 next 20 years...
<daviid>paroneayea: are you so concerned with speed? wrt your project
<daviid>?
<daviid>the fact that atomspace has bindings is good, didn't know that
<paroneayea>daviid: not necessarily yet, it's kind of a proof of concept for now, but in the future I might.
<paroneayea>probably initially I'll just keep an in-memory mapping and serialize to disk, which is terrible but also probably works okay enough to start with :)
<daviid>what do you mean by activitystreams?
<paroneayea>daviid: http://www.w3.org/TR/activitystreams-core/
<paroneayea>I'm part of a w3c group working on federation (decentralized web communication) standards
<daviid>paroneayea: i would not do that [memory stuff..]
<paroneayea>this is the format used by that
<daviid>tx
<daviid>i won't reead it now, but will. i'd like to work on guile-gnome today
<paroneayea>good luck!
<daviid>so late, i'm ashamed really, but was dgragged in pay work recently [and not even for good pay :) haha]
<daviid>oh well
<daviid>tx
<paroneayea>getting paid is good
<daviid>sure, but i live a extremelly simple life, to be able to survive with almost nothing
<daviid>freedom is, by far, more important to me
<daviid>but of course i have to pay some bill
<daviid>too
<daviid>:)
<daviid>i don't think slib's relational database system is maintained?
<paroneayea>it probably isn't
<paroneayea>slib is probably only barely maintained :)
<daviid>paroneayea: https://en.wikipedia.org/wiki/NoSQL
<paroneayea>daviid: I'm familiar with that pseudo-term :)
<daviid>yeh, i pasted because, in case, they compare most of them...
<daviid>i looked at this once: http://whitedb.org/
<daviid>but then did have time to FFI it
<paroneayea>I'd love to have a triple store / graph database option for guile.
<paroneayea>something that could support RDF would be great.
<daviid>whitedb is GPL [i only look at gpl based s/w]
<daviid>who is behind guile's cog binding, do yu know?
<paroneayea>daviid: the opencog team have built it in, I think.
<daviid>ok. i don't why but i like whitedb. toehrwise, for your project, i'd start with guile-sqlite3 or atomspace
<daviid>given the data you'll work with, maybe opencog is a better choice
<daviid>don't know
<paroneayea>daviid: whitedb is all in-memory?
<paroneayea>I'd rather not do that if I was going to take the effort to use something external
<paroneayea>the only reason I'd do an in-memory representation was for prototyping
<daviid>paroneayea: yes, im-mem, with 2 persistent storage mechanisms. their goal is lightweight, it's no going to be oracle nosql...
<daviid>lightweight, speed ... i like the design and the apporeach, but intuition more then knowledge, i'd have to play/study it of course
<daviid>*approach
<daviid>paroneayea: it seems they have some JSON support, see http://whitedb.org/c_api.html#_using_whitedb_in_applications 4.10
<daviid>anyway, we don't have whitedb binding yet, so just for curiosity
<paroneayea>hi ijp
<davexunit>I swear there is a little procedure to get the error number for a system call.
<davexunit>but it's just not documented...
<davexunit>yay I implemented a Guile wrapper for the 'clone' syscall
<davexunit>the libc version is useless in Scheme. needed to use the 'syscall' function
<davexunit>which has the extra complication that the syscall number is platform dependent
<koz_>How fast is Guile relative LuaJIT?
<linas>whoof daviid yes I am active, but have not touched guile-dbi in many years. whatever bug saul has ... I cannot easily debug it right now
<linas>I need to find someone who is actively using SQL and guile and is interested in guile-dbi, and figure out how to hand off maintainership
<davexunit>koz_: not sure, but it's slower.
<davexunit>because we don't have a JIT compiler
<daviid>linas: I see. I suggested saultries guile-sqlite3 directly to see, if easy, quick... if it was a guile-dbi related bug, then if yes, he could try to produce a minimal example and send it to guile-dbi bugs... maybe
<koz_>davexunit: Thanks!
<davexunit>won't be seeing them again probably
<linas>If he sends it to guile-dbi, I will probably ignore it. I currently have a dead server I have to fix. and then I have my day job ...
<linas>streched thin
<davexunit>how to tell the current system architecture from guile?
<davexunit>oh, 'uname'. nvm.
<daviid>davexunit: (system "uname -?") [? i forgot the option
<davexunit>daviid: there's a 'uname' procedure
<davexunit>just releaized
<davexunit>guile has some great POSIX helpers :)
<daviid>nice!
<daviid>guile rocks!
<paroneayea>hi linas
<paroneayea>ah, good to know
<davexunit>w00t, guile as PID 1 in a linux container made with guile :D
<paroneayea>and sorry to hear you being stretched thin
<paroneayea>davexunit: WHOA NICE
<davexunit>it's not fully "containerized" yet
<davexunit>most notably, no user namespace integration or virtual network devices.
<linas>paroneayea well, guile-dbi is not that complex, its not rocket science. A few hundred lines of code, if I recall
<paroneayea>linas: ok! good to know
<paroneayea>linas: you may have seen me dump https://identi.ca/cwebber/note/dtSlvLB_SoW1-y-A2JKIhw in here :)
<paroneayea>it looks like racket also just provides a simple sql-as-strings library
<paroneayea>hey davexunit http://pkg-build.racket-lang.org/doc/racquel/rql.html
<paroneayea>that might be close to the syntax you and I are interested in
<davexunit>oh neat
<davexunit>thanks
<paroneayea>np
<daviid>i need to prepend, automake, how do i do that?
<daviid>I'd need this, http://paste.lisp.org/display/148850
<daviid>but as it is: Makefile:485: *** Recursive variable 'TESTS_ENVIRONMENT' references itself (eventually). Stop.
<daviid>+= won't work here because it append things...
<daviid>i tried this but it still complains with the same error http://paste.lisp.org/+36UQ/1
<davexunit>are exec system calls supposed to kill the processes that call them?
<daviid>amazing! so automake BLUEFOX = $(TESTS_ENVIRONMENT) does affect by reference?
<davexunit>I guess it *replaces* the current process
<paroneayea>linas: btw I guess you don't have the time to maintain it, but I'm still working on packaging guile-dbi
<paroneayea>for guix