freenode/#lisp - IRC Chatlog
Search
8:43:19
dim
about the presentation thing, I want to have my own clickable (select-able) objects, a grid of say 10x20 of them, and at the moment they're just rectangles being drawn, not gadgets, and I just don't know if I should make them gadgets or just handle the select event in the frame, get the coordinates and figure it out myself
8:47:07
dim
well now I should get to work rather than play with McCLIM, but well, maybe late tonight I'll be able to play around again
8:48:04
jackdaniel
elderK: you may load it with asdf first and then experiment with load/compile-file on your own
8:48:15
jackdaniel
but you may load alexandria without asdf like this: http://ix.io/1utu (change paths etc)
8:48:16
dim
goal 1: minesweeper in McCLIM, goal 2: racket tutorial with images in McCLIM, hopefully with a pane having a lisp editor and a pane with a REPL like thingy that can also display images, handling positions for you I guess
8:48:39
scymtym
jackdaniel: when dim asked about fonts yesterday, i said https://irclog.tymoon.eu/freenode/%23lisp?around=1543190146#1543190146 . is there a better way?
8:49:22
dim
scymtym: oh I wasnt' around anymore when you said that, thanks for pointing it now again!
8:50:18
elderK
jackdaniel: I assume a good test would be to compile everything, but not actually load it until everything had been compiled.
8:50:57
elderK
But it seems like it would be a good test to make sure my stuff isn't relying on any side-effects that are you know, not guaranteed to happen during compilation.
8:50:59
scymtym
dim: sure. i just suggested that as stopgap solution until someone more familiar with the subject could point out a better solution
8:51:15
jackdaniel
there is, and it is part of clime: (port-all-font-families port) and on results you may call (font-family-all-faces …) and (font-face-all-sizes …)
8:51:42
jackdaniel
but sadly not documented (afaik); Examples/font-selector.lisp shows (in a messy way) how to use that
8:52:13
jackdaniel
making a text style with arbitrary names will most likely fail on other backends (pdf/postscript etc)
8:55:01
elderK
jackdaniel: An unrelated question: What's the deal with any errors encountered during write-sequence?
8:55:18
elderK
I see that read-sequence returns the position of the unwritten-element. Like, the one after what was read. So, you can test how many was succesfully read.
8:56:09
elderK
I know file-error exists, so, I'm curious as to whether that is generated by write-sequence if, for whatever reason, it cannot write to the stream.
8:57:47
jackdaniel
I'm afraid I can't help you, I'm not sure where that would be described in clhs. but I would indeed expect that file-error (or something similar) happens at some cases
8:58:03
jackdaniel
otoh we do not expect cl:list to list heap exhaustion as one of the exceptional situations
9:00:33
jackdaniel
The type file-error consists of error conditions that occur during an attempt to open or close a file, or during some low-level transactions with a file system. The ``offending pathname'' is initialized by the :pathnameinitialization argument to make-condition, and is accessed by the function file-error-pathname. (from file-error)
9:00:57
jackdaniel
so write-sequence, if it implies a low level transaction which may error, could signal file-error
9:01:05
dim
ok when using (setf mcclim-truetype::*truetype-font-path* "#P/Users/dim/Library/Fonts/") (mcclim-truetype::autoconfigure-fonts) in the REPL then I could have ♣ display properly with (clim:make-text-style :serif :bold 24)
9:02:31
elderK
jackdaniel: I guess I could play with it, like, experimentally :P Give read only access to a file, and try and write to it. Or, have a file that is writable but on an tmpfs with very little space.
17:05:47
tryingoutlisp
I get an unbound-variable error. Let me pastebin an example so I can show you.
17:45:42
jmercouris
so, I'm running (bt:make-thread (lambda () (uiop:run-program "xyz"))), how can I know when xyz has started?
17:46:09
jmercouris
mind you, xyz is a long-running process, and will continue to run, it's not like I'm looking for an exit code or anything
17:52:29
flip214
or you look at the child process' CPU usage - and after 1 sec or so you know it's "up" (and not crashed yet)
17:52:54
flip214
or you can use ptrace and see when it has reached some important point (listening socket open, etc.)
17:54:24
|3b|
but yeah, if you need to interact with it, probably better to just have it tell you when it is ready if possible
17:54:50
flip214
jmercouris: is there some external effect you can watch for? like a http server which you can ask for /status or so?
17:55:06
flip214
jmercouris: signals are not that easy to handle correctly; even less so in multi-threaded programs.
17:59:57
jmercouris
so I'm not sure how to loop on retrying the command until I don't get a connection-refused-error
18:06:11
fortitude
jmercouris: you might want to use that handler case in a function that returns T or NIL based on whether the connect succeeded
18:08:25
fortitude
jmercouris: if it helps, handler-case is known as try/catch in other languages, so if you've ever used that before, you can do the same sort of things
18:09:04
jmercouris
(make-window) in the above code is making the XML-RPC call which depends on the other program to be running
18:10:29
jmercouris
dlowe: ah, so you set the loop expression it is looking out for within the cases
18:18:31
|3b|
ACTION tends to just loop on 2nd value of ignore-errors when i'm expecting lots of errors :p
18:23:04
fortitude
jmercouris: your handler-case form doesn't have any error clauses, and your handler-bind form doesn't have a body (they're two separate ways of handling errors)
18:24:13
fortitude
what you want is (handler-case <your thing> ((sb-bsd-sockets:connection-refused-error () <your handling code>)))
18:26:20
fortitude
jmercouris: if it makes you feel better, I can never remember which syntax goes with which form either
18:31:07
jmercouris
you know, I often look at the hyperspec, and I'm still not that good at understanding it
18:31:49
fortitude
jmercouris: the grammar notation can be a little tricky sometimes, but it helps if you pair it with the examples
18:37:48
malice
However, there is an effort by phoe called CLUS, short for COMMON LISP ULTRASPEC, which tries to provide a better hyperspec: http://phoe.tymoon.eu/clus/doku.php?id=cl:macros:handler-case
18:38:08
jmercouris
I don't want to disparage the ultraspec project, but it is on permanent hiatus afaik
18:39:06
malice
dlowe: On more than one occasion I found that examples weren't clear enough or didn't showcase what I wanted to know (and I do not think I was looking for anything extraordinary).
20:15:42
veddox
Hey everyone, I have a bit of a problem with usocket and I'm wondering whether somebody here might have the time to help...
20:16:45
veddox
Basically, I am working on a client-server game. The relevant code is here: https://gist.github.com/veddox/d0df0d6ea685a348d5674c30b2cdfe6d
20:18:08
veddox
I can create the server (`run-server`), and connect to it (`connect-server`), and `handle-connection` will confirm a connection has been made
20:18:34
veddox
However, when I then call `query-server`, the string I send to the server socket won't arrive
20:19:36
veddox
It appears the stream is not being flushed, but I do call `finish-output` (line 102), so I'm a bit baffled.
20:20:06
dlowe
(format servstr request) request should probably be a string or you shouldn't use FORMAT
20:20:48
veddox
It is one. For test purposes I call it as (query-server "ACK") - which ought to return "ACK ACK"
20:21:15
sjl_
dlowe is saying that if your request happens to contain format directives, it'll do surprising things
20:22:13
sjl_
How do you know the string you're sending doesn't arrive? I see where you log the connection, but not where you log the strings you receive
20:23:54
sjl_
I've had this bite me before -- everything's actually working, but my final log line was stuck in a buffer waiting to be flushed
20:24:18
veddox
logging is a macro: (defmacro logging (str &rest format-args) `(write-to-file (format NIL ,str ,@format-args) *logfile* T))
20:26:43
veddox
`write-to-file` takes a string or a list of strings and writes them all to file (calling `open` directly), the closes the file connection
20:30:52
dlowe
veddox: right. if you know the packet is sent then you know a lot more about where the problem might be
20:31:39
veddox
@sjl_ Yes I do. I get "received a connection", "sending request" and "waiting for server response"
20:34:33
sjl_
be careful wil parsing user-supplied input into symbols in a package -- since they don't get GC'ed you can exhaust the server's memory by just sending tons of symbols