freenode/#lisp - IRC Chatlog
Search
11:15:39
vydd
flip214: something like https://gist.github.com/vydd/6484a05906ebc10595f6b7e15b41d048 ?
11:16:35
vydd
oh wow. so last time I visited was 2 years ago :\ Shinmera, if you still know what this was about, I'm happy to answer
11:17:23
jackdaniel
I feel stagnant, it doesn't feel as if you haven't said anything for two years, hm
11:24:17
drmeister
no-defun-allowed: So you have ABCL running as a Minecraft (Forge) mode but there's no documentation or any information on how to access the Java classes? What I would do starting in a situation like that is I would punch some trees and then take the wood and craft planks and sticks and use those to craft a wooden pick. Then you can mine for cobblestone and use that to craft a stone pick.
11:26:45
drmeister
ACTION usually spends his first night in Minecraft crying in a dark hole - trying to avoid zombies.
11:32:58
no-defun-allowed
drmeister: Oh, ABCL is very, very well documented and I got myself through some examples.
11:33:24
no-defun-allowed
But as a proprietary program, all the methods' names are obsfucated and you need a very big table of method names to translate your way out.
11:34:14
no-defun-allowed
For most mods, this is no problem, because the toolchain has a post-processing step that consults that table and replaces all the methods, but ABCL doesn't benefit from this as its method lookups are done at runtime.
11:35:26
no-defun-allowed
In #lispcafe we figured out where that table is and how to read it, and I was able to pull out a method (net.minecraft.client.Minecraft.getMinecraft) and call it using it.
11:37:04
no-defun-allowed
So now I just have to figure out Forge, which doesn't have any nice documentation pages with a list of classes and methods, and instead wants you to rip out some bulky Java IDE to work things out.
11:37:19
jackdaniel
I'm still waiting for a CL implementation written for a hardware built with mnecraft
11:38:32
no-defun-allowed
"Compiling Common Lisp to Minecraft Redstone", a paper by the S-expressionists published in ELS 2029
11:40:13
no-defun-allowed
The plan is to write a wrapper around java:jmethod (call it jmethod*) which performs this swizzling and I can work through a few Forge examples from there.
11:46:53
no-defun-allowed
drmeister: I advise you make charcoal early on, then make torches, so you can cry in a lit up hole at least.
14:08:51
thijso
Jeeshh. I've just about kicked my minecraft addiction, guys. Stop talking about that in here.
14:14:43
dlowe
as part of the forge installation process, they decompile your installed minecraft back into java code and then patch annotations into it. You're intended to read the code to find out what to tweak/override.
14:21:34
tourjin
is there any preassigned style in emacs like dark mode? white screen hurts my eyes.
14:55:47
drmeister
no-defun-allowed: Please keep me up to date on your minecraft/common lisp exploration.
16:07:41
thijso
If I do a (make-instance inside of a package, I shouldn't need to fully qualify the classname, right? I'm trying to indirectly instantiate a class, by doing (let ((class (intern (format nil "~a~a" classname suffix))) and then using that to (make-instance class ..
16:08:28
thijso
But it's not working. If I print out some stuff it looks like the difference is that it works with <package>::<class> and not with just <class>
16:08:38
Bike
depends on what you mean by "inside a package". that code will create the symbol with intern, so it'll be interned in whatever *package* is in place when intern is called.
16:09:22
thijso
yeah, but it's all inside the same file which has an (in-package :bla) at the top...
16:14:46
Shinmera
you can also do `(let ((*package* #.*package*)) ...)` to bind the runtime package to the one used during compilation.
16:23:32
flip214
minion: memo for vydd: thanks, but I'd hoped to _not_ touch the individual bytes - just push the address on
18:07:18
Bike
Yes, you can take the method-function and then call it with a list of arguments and list of next methods.
20:34:21
sameerynho
hey folks, I'm using slime and swank with Emacs. When i use slime-connect to connect to swank server it just output connecting to .... and do nothing
21:09:50
jgkamat
Hey, does anyone know a library or easy method to get a super simple hackable calculator in common lisp. Eg: "1 + 3 + 4" = 8. I'm trying to eventually make a dice roller, ie: 5 + 2d4 = 5 + roll(4) + roll(4).
21:10:55
jgkamat
I would like to avoid doing any work like building a parser or whatever if possible, but ideally it would be nice to support parenthasis and subtraction and other stuff like that
21:15:48
thijso
How does CL manage class cleanup? If I have a class that contains a slot for a usocket socket, and I connect and use it, do I need to explicitly close the connection before the class instance goes away? Seems like the proper thing to do, but how? I'm looking in CLHS, but can't find anything on class instance destruction...
21:18:01
Bike
thijso: try looking at the finalizers in the trivial-garbage library, but I think you're supposed to use more reliable means
21:18:22
jgkamat
Bike: yes that would work, but ideally I would like it to be pre-packaged (ie: I wouldn't have to come up with grammars and all). If you know a good parser that's easy to use I'll take that as well
21:21:38
Bike
thijso: yes, as in, you should close the socket more explicitly than leaving it for whenever the object holding the reference to it happens to be garbage collected
21:22:31
makomo_
ralt: agreed, i miss that idiom as well -- it gets rid of the trivial cases early and prevents indentation of the general case
21:23:36
thijso
So now I have a number of 'exit' points in my class where basically processing stops and the class instance can die, having filled it's purpose. Seems like I need to sprinkle usocket:close-socket calls around those then?
21:24:19
makomo_
jgkamat: do you really need that particular syntax? you could make a sexp-based calculator, so your original expression would look something like (+ 5 (d 2 4))
21:27:56
jgkamat
I did find http://www.github.com/jech/cl-yacc/blob/master/calculator.lisp though, which will probably be my starting point unless I find something more convienent
21:45:47
no-defun-allowed
hmm, dunno, but arecord is like that, you just read samples from its stdout
21:47:44
semz
skidd0: I don't have enough experience to meaningfully recommend a SQL library, but I've used clsql in the past. If I remember correctly it follows the common Lisp (hah) theme of working with ASTs rather than strings, which means most input sanitation issues are avoided and only occur when you finally move from AST to string in a library function.
21:49:22
skidd0
i'm not sure how that avoids the SQLi issue. if you convert some input string from AST to string, can't the malicious string content make it through those transformations?
21:50:12
aeth
skidd0: I haven't generated SQL before, but I have recently generated HTML. No, the malicious string content cannot make it through the transformations as long as you use our own write-escaped-string instead of write-string or whatever
21:50:56
aeth
skidd0: The hypothetical write-escaped-string doesn't do write-string or write-line, it iterates through every character and does write-char if it's safe, and otherwise writes a string representing an escape instead of the char.
21:52:51
semz
skidd0: "if you convert some input string from AST to string" << The AST is not a string, that's the point. The input string occurs as some part of the AST
21:54:10
aeth
And if the AST contains strings, then those strings are the only danger points (unless you e.g. convert symbols to strings automatically) so you just write your own write-string
21:55:02
skidd0
semz: the 'input string' was, at some point, a string. then it got put into the AST, then somehow back out to string for the DB to hold
21:55:30
skidd0
i was confused how turning the string into data for the AST, by its nature, removed the worry of malicious input
21:55:36
jmercouris
that's the thing, what if you write (theoretical) (select "drop table;" from xyz)?
21:56:40
jmercouris
I would suggest pick up SXQL and see if you can generate some malicious statements
21:57:03
semz
whereas otherwise you have people munging strings everywhere and haphazardly escaping this and that
22:00:26
semz
Let's take the example from above: If you represent the query as, say, `(select ,user-input from xyz) , then no matter what user-input is, as long as the conversion to a query string happens through the (escaping) library function, there is no injection issue.
22:01:00
semz
And since the conversion to a string must happen somewhere (ideally inside the lib), you only get injection issues if you go really out of your way to introduce them
22:01:47
skidd0
and yet, i'm no closer to a simple escaping/sanitization library unless i want to write my own