<phubuh>
when I execute an update with Dbi_postgres and mod_caml's Dbi, I get
<phubuh>
Dbi_postgres: dbh 1: execute update pages set body = ? where title = ?
<phubuh>
Dbi_postgres: dbh 1: finish update pages set body = ? where title = ?
<phubuh>
Dbi_postgres: dbh 1: execute rollback work
<phubuh>
Dbi_postgres: dbh 1: finish rollback work
<phubuh>
which indicates that it undoed what it did, right? the update doesn't get updated.
<Demitar>
Looks like it, looking in the database gives the definite answer as always.
<phubuh>
nothing gets updated in the database.
<phubuh>
oh, it looks like I need to do connection#commit :-)
<Demitar>
Yes, that would be a natural way of using transactions. ;-)
<phubuh>
yeah, but I didn't know this thing used transactions
<phubuh>
and I expected it to commit after itself if it did so
mimosa has quit [Remote closed the connection]
buggs is now known as buggs|afk
Vincenz has joined #ocaml
Vincenz has quit [Client Quit]
ayrnieu has joined #ocaml
lus|wazze has quit ["Copyright is a temporary loan from the public domain, not property"]
ayrnieu has quit [Read error: 110 (Connection timed out)]
Demitar has quit ["Lämnar"]
ASau has quit ["Toffee IRC client for DOS v1.0/b535"]
Hadaka has quit [calvino.freenode.net irc.freenode.net]
wrunt has quit [calvino.freenode.net irc.freenode.net]
liyang has quit [calvino.freenode.net irc.freenode.net]
buggs|afk has quit [calvino.freenode.net irc.freenode.net]
Hipo has quit [calvino.freenode.net irc.freenode.net]
drlion has quit [calvino.freenode.net irc.freenode.net]
det has quit [calvino.freenode.net irc.freenode.net]
smkl has quit [calvino.freenode.net irc.freenode.net]
cm has quit [calvino.freenode.net irc.freenode.net]
wax has quit [calvino.freenode.net irc.freenode.net]
mw has quit [calvino.freenode.net irc.freenode.net]
teratorn has quit [calvino.freenode.net irc.freenode.net]
rox has quit [calvino.freenode.net irc.freenode.net]
lam_ has quit [calvino.freenode.net irc.freenode.net]
The-Fixer has quit [calvino.freenode.net irc.freenode.net]
themus has quit [calvino.freenode.net irc.freenode.net]
mattam has quit [calvino.freenode.net irc.freenode.net]
brwill_zzz has quit [calvino.freenode.net irc.freenode.net]
Riastradh has quit [calvino.freenode.net irc.freenode.net]
Smerdyakov has quit [calvino.freenode.net irc.freenode.net]
Hadaka has joined #ocaml
liyang has joined #ocaml
buggs|afk has joined #ocaml
rox has joined #ocaml
mattam has joined #ocaml
brwill_zzz has joined #ocaml
Hipo has joined #ocaml
wrunt has joined #ocaml
drlion has joined #ocaml
Riastradh has joined #ocaml
Smerdyakov has joined #ocaml
cm has joined #ocaml
lam_ has joined #ocaml
det has joined #ocaml
The-Fixer has joined #ocaml
wax has joined #ocaml
smkl has joined #ocaml
teratorn has joined #ocaml
mw has joined #ocaml
themus has joined #ocaml
mimosa has joined #ocaml
__buggs has joined #ocaml
buggs|afk has quit [Read error: 60 (Operation timed out)]
__buggs is now known as buggs
mattam_ has joined #ocaml
<phubuh>
hmm, I'm having a bit of trouble formulating a lexer with ocamllex
<phubuh>
it's supposed to lex a wiki syntax -- that is, plain text marked up with a very simple markup language that reads like real text. example:
<phubuh>
foo _emphasis_*strong emphasis* <link to another page>
<phubuh>
| this, since it starts with " |", is a line of code
<phubuh>
what I'm having trouble with is the code line syntax
<phubuh>
if a lex regex had a "start of line" special character, it would be easy
mattam has quit [Read error: 110 (Connection timed out)]
mattam_ is now known as mattam
Evolux_ has joined #ocaml
<Evolux_>
hello!
<Evolux_>
how can i tell the :: operator, that i want a scalar at the right side and a list at the left side?
Vincenz has joined #ocaml
<Evolux_>
is it possible to get the last element of a list?
<Evolux_>
anybody alive?
<phubuh>
Hi Evolux_
<phubuh>
You can't add to the end of a list with the :: operator. The most common idiom is lst @ [value].
<phubuh>
Beware, though, that lst @ [value] if lst is 1000 elements long, will require about 1000 steps.
<Evolux_>
hm
<phubuh>
It is often more efficient to use value :: lst to build your list in reverse, and then use List.reverse to get it in the right order.
<Evolux_>
so if i want to search a list in reverse (from end to start)
<phubuh>
I'd use List.reverse and then search it start to end
<Evolux_>
is it ok to go through the list recursively and then comparing the elements from the end to the start?
<Evolux_>
hm, I don't think i can use List.reverse
<Evolux_>
how long does list.reverse take?
<phubuh>
linear time, probably with a very small constant
<Evolux_>
ok
<Evolux_>
another question:
<phubuh>
Err, sorry, it's called List.rev
<Evolux_>
how can i check the return value of a function and return it again when it is > 0?
<Evolux_>
thanks
<phubuh>
Creating and reversing a list of [1 .. 10000] is instantaneous on my computer. :-)
<phubuh>
return it again?
<phubuh>
to check the return value of a function, you can use if and = or pattern matching
<Evolux_>
yes, but i have to store it somehow, i think...
<Evolux_>
x::l, z, p -> if searchReverseRec(l, z, p+1) != -1 then searchReverseRec(l, z, p+1);;
<Evolux_>
something like that
Maddas has joined #ocaml
<Evolux_>
damn... caml is a very complex language
<Evolux_>
how can i do something like elseif?
<phubuh>
else if
<phubuh>
:-)
<Evolux_>
does not work
<Evolux_>
ah, i think i just reverse that damn list
<Evolux_>
and write my own reverse function
<phubuh>
Good idea. :-) It'll probably be faster, too.
<Maddas>
Hello phubuh!
<phubuh>
Hi Maddas!
<Maddas>
Did you ever finish that BitTorrent client?
<phubuh>
Nope. It can currently connect, chat, send files, and I don't remember whether it can receive files
<Maddas>
OK!
<phubuh>
It can't properly send the file list, though, so noone can request anything :-)
<Evolux_>
thanks for your help
<phubuh>
The file list is compressed using a Huffman encoder, and I think my encoder works, but other clients can't decompress it -- I think it's a header problem
<phubuh>
No problem!
<phubuh>
I was about to write a decompressor to test the compressor when I got bored :-)
Evolux_ has left #ocaml []
<phubuh>
I'll probably resume work on it, one of these days
<Maddas>
Nice!
<Maddas>
I'd have a look at it, but I don't have any computer during weekdays anyway, and not too much time today
<phubuh>
I started writing a Wiki in OCaml yesterday, btw :-)
<Demitar>
Could this be the culprit? output_string out ((list_to_string (cleanse (string_to_list str))) ^ "\n");
<Smerdyakov>
No. He's a Cal undergrad who said he had introduced a friend to OCaml and gotten him hooked on it, but I guess that's not you. :)
<async>
are you an undergrad?
<Smerdyakov>
Nope. PhD student.
<async>
under who?
<Demitar>
One of those functions might overflow?
<Smerdyakov>
Necula
<async>
Demitar: they're relatively small
<async>
just cleans up a string a little
<async>
Smerdyakov: cool
<async>
do you know Hilfinger?
<async>
or Clancy?
<Smerdyakov>
I've seen Hilfinger a lot, but I don't like him, and I don't know that I'd want to. :D
<Smerdyakov>
I've seen Clancy much less, but I can pick him out of a crowd. Never spoken to him, either.
<async>
hehe they're my profs
<async>
for cs 61a
<Smerdyakov>
Hilfinger goes to the programming systems related seminars a lot.
<async>
hes a good guy
<Smerdyakov>
He doesn't do research anymore, from what I've heard.
<async>
oh
<Smerdyakov>
Or at least doesn't have any students.
<async>
tail recursive functions don't use the stack right?
<Smerdyakov>
They use fixed stack space, yes.
<async>
then wtf
<Smerdyakov>
But you can use ocamldebug to find out where the actual loop is.
owll has joined #ocaml
owll has quit [Client Quit]
<async>
this is cool - binford's law applies to file sizes on computers
<async>
benford's
<async>
too bad i can't tabulate all data due to stack overflow hehe
<Demitar>
Well I've been unable to reproduce it using a 1000 line file.
<async>
Demitar: i've been using a 220,000 line file
<Demitar>
Well now I've been unable to reproduce it using a 200'000 line file. :)
<Demitar>
The actual code I've been using is:
<Demitar>
let valid_line _ = true
<Demitar>
let rec parsefile infile out =
<Demitar>
let str = input_line infile in
<Demitar>
if (valid_line str) then
<Demitar>
(
<Demitar>
output_string out (str ^ "\n");
<Demitar>
parsefile infile out
<Demitar>
)
<Demitar>
else parsefile infile out
<Demitar>
;;
<Demitar>
parsefile (open_in "foo.txt") stdout
<Smerdyakov>
async, if you haven't used ocamldebug yet to find the exact stack right before the crash, then you should do that before continuing here.
<Demitar>
Try shotgun debugging. :) Remove things until it works... ;-)
<Demitar>
Smerdyakov, how would one do that the best way? running and then backstepping and finally getting the backtrace? (I've never really befriended ocamldebug yet.)
<Smerdyakov>
Demitar, look at the time number when it crashes. Run again, stopping a little before that time.
<async>
Demitar: have you made it crash?
<Demitar>
async, yes by making it obviously non-tail recursive. (returns an int eventually)
<Demitar>
Smerdyakov, but then how do I get useful information about the stack? The backtrace lists thousands of #26187 Pc : 6192 Foo char 202
rox is now known as earth
<Demitar>
Ah, using up does make things more useful since it displays the source line.
earth is now known as rox
<async>
Demitar: the error is in Hashtbl
<Demitar>
So you were using a hash without telling us? ;-)
<async>
it has 10 entries!
<async>
its an (int, int) table
<async>
hmm ill try a list
<Demitar>
But where is it overflowing really?
<Demitar>
Couldn't it simply be the final temporary allocation by the hash that triggers the overflow?
<Demitar>
It seems very odd if a hashtable with 10 entries would cause a stack overflow all by itself.
<async>
i call Hashtbl.replace a bunch of times though