code logs -> 2020 -> Fri, 27 Nov 2020< code.20201126.log - code.20201128.log >
--- Log opened Fri Nov 27 00:00:39 2020
00:51 Kindamoody is now known as Kindamoody[zZz]
01:18 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has quit [Connection closed]
01:31 Pink [uid208117@Nightstar-h2b233.irccloud.com] has quit [[NS] Quit: Connection closed for inactivity]
01:50 Degi [Degi@Nightstar-lnt37e.pool.telefonica.de] has quit [Ping timeout: 121 seconds]
01:55 Degi [Degi@Nightstar-ceb5pf.pool.telefonica.de] has joined #code
03:34 Pink [uid208117@Nightstar-h2b233.irccloud.com] has joined #code
04:15 VirusJTG [VirusJTG@Nightstar-42s.jso.104.208.IP] has quit [Connection closed]
04:16 VirusJTG [VirusJTG@Nightstar-42s.jso.104.208.IP] has joined #code
04:16 mode/#code [+ao VirusJTG VirusJTG] by ChanServ
05:36 Datawalke [NSkiwiirc@Nightstar-as7dq0.pa.comcast.net] has joined #code
05:41 celticminstrel [celticminst@Nightstar-5pqf1t.dsl.bell.ca] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
06:12 Datawalke [NSkiwiirc@Nightstar-as7dq0.pa.comcast.net] has quit [[NS] Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
07:12 Vorntastic [uid293981@Nightstar-h2b233.irccloud.com] has joined #code
07:12 mode/#code [+qo Vorntastic Vorntastic] by ChanServ
07:54 Pink [uid208117@Nightstar-h2b233.irccloud.com] has quit [[NS] Quit: Connection closed for inactivity]
08:09 himi [sjjf@Nightstar-v37cpe.internode.on.net] has quit [Connection closed]
08:16 himi [sjjf@Nightstar-v37cpe.internode.on.net] has joined #code
08:16 mode/#code [+o himi] by ChanServ
08:54
< Yossarian>
!!! https://github.com/christoomey/vim-tmux-navigator
09:14 Kindamoody[zZz] is now known as Kindamoody|afk
10:01
< ErikMesoy>
What's the Python function (if there is one) that is like min() or max() but returns the value closer to zero of a pair? using min(abs()) loses the sign and getting it back looks so messy, I would expect there to be a standard library function for this.
10:04
<~Vorntastic>
Min ((abs(x),x) for x in pile)[1]
10:07
<~Vorntastic>
This isn't a thing I've ever thought about using
10:18
< ErikMesoy>
that appears to be a syntax error as written and I'm not sure where to interpolate parens.
10:21
< Yossarian>
Tired from Thanksgiving.
10:25
< Yossarian>
I have a question but I'm not sure how to ask it properly.
10:26
<~Vorntastic>
What's the syntax error
10:28
< Yossarian>
There is none.
10:28
< Yossarian>
It's a thinking error.
10:29
< Yossarian>
I want to write some stuff in lua and maybe python, moreso lua but there are lots of libraries that don't have APIs
10:30
<~Vorntastic>
>>> pile = [1,2,-0.5,-4]
10:30
<~Vorntastic>
>>> min((abs(x),x) for x in pile)[1]
10:30
<~Vorntastic>
-0.5
11:07
< ErikMesoy>
oh... min handles pairs nicely. I was thinking the min()[1] part looked wrong because I wasn't expecting min() to return something indexable. thanks.
11:08
<~Vorntastic>
This is a reasonably common idiom
11:09
<~Vorntastic>
min((key(x), x) for x in pile)[1] that is
11:17
<~Vorntastic>
Oh if you wanted, uh, stability, so it matches what using sort would, min((key(x),n,x) for n,x in enumerate(pile))[2]
11:28 catalyst_ [catalyst@Nightstar-ejd4sd.cable.virginm.net] has quit [[NS] Quit: -a- Connection Timed Out]
11:28 catalyst [catalyst@Nightstar-ejd4sd.cable.virginm.net] has joined #code
12:00
< ErikMesoy>
I have fired off some emails to manager and project coordinator while working on this code, and now gotten back stuff that makes me ask MORE questions and maybe obsoletes the question entirely. Because it turns out the manager has been using "X minus Y" and "Difference between X and Y" interchangeably.
12:01
< ErikMesoy>
These are very much not interchangeable to the numbers geeks. :V
12:30
< Yossarian>
Is it just me or does lua not have a lot of libraries or bindings for it? I want to experiment with this codec but luckily it is implemented in C so I can bridge that over to lua
12:35
< catalyst>
Lua is intended to be embedded into applications so usually the application will provide a relevant api
12:35
< catalyst>
thus it doesn't really have as much in terms of libraries and bindings if you use it standalone I guess
12:36
< catalyst>
ToxicFrog might know more, she's big on Lua
12:36
<&ToxicFrog>
catalyst is entirely correct here
12:36
< Yossarian>
yeah lua implemented like a stack machine
12:37
<&ToxicFrog>
"implemented like a stack machine" is entirely orthogonal to this topic
12:37
< Yossarian>
i never wrote a library or binding before so i guess i'll get the chance to do it now
12:37
<&ToxicFrog>
If you want to quick-and-dirty call into C from Lua, LuaJIT has a C FFI built in that lets you call C directly without writing C glue code using liblua
12:37
<&ToxicFrog>
But it has very little in the way of safety checks and is not recommended for production use
12:38
<&ToxicFrog>
If you want to use the FFI, documentation is here: https://luajit.org/ext_ffi.html
12:38
<&ToxicFrog>
If you want to write glue code in C, you will need section 4 of the manual: https://www.lua.org/manual/5.4/manual.html#4
12:39
<&ToxicFrog>
(replace 5.4 with your Lua version, if you are using a different one; if you are using luaJIT I believe it is API-compatible with 5.1 here)
12:41
<&ToxicFrog>
Lua does actually have a reasonably active community maintaining bindings for various libraries, but it's not as extensive as, say, Python
12:42
<&ToxicFrog>
But it may be worth looking; there are, for example, FFI-based bindings for ffmpeg: http://wiki.luajit.org/FFI-Bindings#audio-video
12:43
<&ToxicFrog>
Yossarian: ^
12:44
< Yossarian>
if it were another language like python and the libary I want to use is natively in C would one bridge those?
12:45
< Yossarian>
but thank you for letting me know about LuaJIT / FFI
12:46
< Yossarian>
i'm going to give it a whirl
12:47
<&ToxicFrog>
For python the basic concept is the same, just the details are different -- you either write C glue code to expose a Python API that you can call from Python (ideally one that follows Python idioms more closely than just a 1:1 adaptation of the C API), or you use the Python FFI library to invoke the C code directly
12:47
<&ToxicFrog>
Python also has tools like SWIG that can partially automate the "write glue code" step
12:50 Datawalke [NSkiwiirc@Nightstar-as7dq0.pa.comcast.net] has joined #code
12:52
<&ToxicFrog>
This is fairly typical when you want to intercall between languages; stuff like Clojure/Java where you can call each from the other directly is the exception.
12:55
< Yossarian>
ToxicFrog: I thought lua had a method to call C from within lua? the library is implemented in C but I haven't looked at how easy or annoying trying to call C from Lua is
12:58
<&ToxicFrog>
Yossarian: the canonical way you call C functions from Lua is: write glue code, in C, that translates calling conventions between Lua and C, plus a library initializer that exports that glue code to lua as a function
12:58
<&ToxicFrog>
Then when you load that library (written in C) the function appears lua-side and you can call it from lua
12:59
<&ToxicFrog>
(this is also how the entire lua standard library is implemented, btw; you can look at the source code for, e.g., the lua math library for a simple example)
12:59
<&ToxicFrog>
The "method to call C from within Lua" without writing glue code in C is the FFI, which is not an official part of the language -- it's a luajit extension.
12:59
<&ToxicFrog>
(I believe there are also non-luajit FFIs for use with stock Lua, but I have not experimented with them)
12:59
< Yossarian>
oh i see
13:00
< Yossarian>
sorry i'm very tired, insomnia, starting to get tired now though
13:02 FLHerne [flh@Nightstar-6tv.748.10.86.IP] has joined #code
13:35
<&jerith>
If you want to call C code from Python, cffi is the tool to use.
13:37
<&jerith>
(But there are lots of existing libraries that use the CPython extension API for glue, because that's a lot older. It also needs more maintenance because it exposes a bunch of C implementation details.)
13:39
<&jerith>
I have successfully built my standard adventofcode machinery (harness for running each day's solutions, generated tests for all the solutions currently implemented, etc.) in lua and solved the first four days of 2015 with it.
13:55
< catalyst>
Nice!
13:55
< catalyst>
generated tests?
13:56 catalyst_ [catalyst@Nightstar-2bdn2d.dab.02.net] has joined #code
13:57
<&jerith>
I have a dir full of `inputs/day01.txt` and a dir full of `answers/day01.txt` (where the latter is the solutions for each part, one per line).
13:58
<&jerith>
Then I generate a bunch of tests that are "load inputs, load expected outputs, load solution code, run each part with the input and assert that outputs match expected" for each day.
13:59
<&jerith>
In Rust I had to do it with a macro and a manually updated list of the days I had implemented.
13:59 catalyst [catalyst@Nightstar-ejd4sd.cable.virginm.net] has quit [Ping timeout: 121 seconds]
14:08 celticminstrel [celticminst@Nightstar-5pqf1t.dsl.bell.ca] has joined #code
14:08 mode/#code [+o celticminstrel] by ChanServ
14:10 catalyst_ [catalyst@Nightstar-2bdn2d.dab.02.net] has quit [Ping timeout: 121 seconds]
14:11 catalyst [catalyst@Nightstar-ejd4sd.cable.virginm.net] has joined #code
14:40 Datawalke [NSkiwiirc@Nightstar-as7dq0.pa.comcast.net] has quit [[NS] Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
14:42 Kindamoody|afk is now known as Kindamoody
14:43 Datawalke [NSkiwiirc@Nightstar-as7dq0.pa.comcast.net] has joined #code
14:45 FLHerne [flh@Nightstar-6tv.748.10.86.IP] has quit [Ping timeout: 121 seconds]
15:07 Vornicus [Vorn@ServerAdministrator.Nightstar.Net] has joined #code
15:07 mode/#code [+qo Vornicus Vornicus] by ChanServ
15:43 crystalclaw [crystalclaw@Nightstar-12q9ui.xyz] has joined #code
15:43 mode/#code [+o crystalclaw] by ChanServ
16:16 FLHerne [flh@Nightstar-6tv.748.10.86.IP] has joined #code
17:02 Vorntastic [uid293981@Nightstar-h2b233.irccloud.com] has quit [[NS] Quit: Connection closed for inactivity]
17:04
< FLHerne>
CPython API is still quite a bit faster than cffi if you're calling back and forth a lot
17:04
< FLHerne>
(assuming you're using CPython)
17:04
< FLHerne>
Of course, if performance is an issue why aren't you using PyPy already :p
17:11 Emmy [Emmy@Nightstar-l49opt.fixed.kpn.net] has joined #code
17:29 Datawalke [NSkiwiirc@Nightstar-as7dq0.pa.comcast.net] has quit [[NS] Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
18:00 catalyst [catalyst@Nightstar-ejd4sd.cable.virginm.net] has quit [Connection reset by peer]
18:00 catalyst_ [catalyst@Nightstar-ejd4sd.cable.virginm.net] has joined #code
18:18 catalyst_ [catalyst@Nightstar-ejd4sd.cable.virginm.net] has quit [Connection reset by peer]
18:20 FLHerne [flh@Nightstar-6tv.748.10.86.IP] has quit [Operation timed out]
18:21 catalyst [catalyst@Nightstar-ejd4sd.cable.virginm.net] has joined #code
18:26 Datawalke [NSkiwiirc@Nightstar-as7dq0.pa.comcast.net] has joined #code
19:29 Datawalke [NSkiwiirc@Nightstar-as7dq0.pa.comcast.net] has quit [[NS] Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
20:16 * abudhabi learns how to style pages in Libre Writer.
20:17
<@abudhabi>
Go to page before the page you want to style, right click, page, pick next style. Then go to the styled page, do almost the same, except pick the default style.
20:18
<@abudhabi>
This will result only in the relevant page having a different style.
20:18
<@abudhabi>
Which is like 99% of what I need this for.
20:18
<@abudhabi>
I wish there was a less convoluted method of saying "I want *this* page to be landscape, kthx".
21:20 Netsplit Deepthought.Nightstar.Net <-> Traal.Nightstar.Net quits: @jeroud, @iospace, @ToxicFrog, Kizor, @McMartin, @jerith, @crystalclaw, @gnolam, @sshine, @Vornicus, (+7 more, use /NETSPLIT to show all of them)
21:20 celticminstrel [celticminst@Nightstar-5pqf1t.dsl.bell.ca] has quit [Operation timed out]
21:23 himi [sjjf@Nightstar-v37cpe.internode.on.net] has quit [Ping timeout: 121 seconds]
21:38 celticminstrel [celticminst@Nightstar-4gs.oog.70.76.IP] has joined #code
21:38 mode/#code [+o celticminstrel] by ChanServ
21:42 celticminstrel [celticminst@Nightstar-4gs.oog.70.76.IP] has quit [Ping timeout: 121 seconds]
22:01 Datawalke [NSkiwiirc@Nightstar-as7dq0.pa.comcast.net] has joined #code
22:06
<@abudhabi>
Argh, nope, that's a fail.
22:39 Datawalke [NSkiwiirc@Nightstar-as7dq0.pa.comcast.net] has quit [[NS] Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
22:46 FLHerne [flh@Nightstar-6tv.748.10.86.IP] has joined #code
23:02 Datawalke [NSkiwiirc@Nightstar-as7dq0.pa.comcast.net] has joined #code
23:26 Emmy [Emmy@Nightstar-l49opt.fixed.kpn.net] has quit [Ping timeout: 121 seconds]
23:29 VirusJTG [VirusJTG@Nightstar-42s.jso.104.208.IP] has quit [[NS] Quit: Leaving]
23:38 Datawalke [NSkiwiirc@Nightstar-as7dq0.pa.comcast.net] has quit [[NS] Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
23:54 FLHerne [flh@Nightstar-6tv.748.10.86.IP] has quit [Operation timed out]
--- Log closed Sat Nov 28 00:00:40 2020
code logs -> 2020 -> Fri, 27 Nov 2020< code.20201126.log - code.20201128.log >

[ Latest log file ]