code logs -> 2013 -> Sat, 07 Dec 2013< code.20131206.log - code.20131208.log >
--- Log opened Sat Dec 07 00:00:57 2013
00:42 Turaiel is now known as Turaiel[Offline]
00:54 Derakon[AFK] is now known as Derakon
00:55 redwire [redwire@Nightstar-jm0v9l.wst.mun.ca] has joined #code
01:11 You're now known as TheWatcher[t-2]
01:18 ErikMesoy is now known as ErikMesoy|sleep
01:23 You're now known as TheWatcher[zZzZ]
02:11 Turaiel[Offline] is now known as Turaiel
02:31 * McMartin pokes at translating his Common LISP Klotski solver to Gambit Scheme.
02:32
< McMartin>
Gambit specifically since I'm going to have to use extensions. -_-
02:45 Turaiel is now known as Turaiel[Offline]
02:56 * Shiz pokes at Python packaging
02:57 * Shiz wishes he never poked
03:00 redwire [redwire@Nightstar-jm0v9l.wst.mun.ca] has quit [[NS] Quit: My MacBook has gone to sleep. ZZZzzzâ¦]
03:10 redwire [redwire@Nightstar-27dppb.nl.bellaliant.net] has joined #code
03:33 Vornicus [vorn@Nightstar-sn7kve.sd.cox.net] has joined #code
03:33 mode/#code [+qo Vornicus Vornicus] by ChanServ
04:10 redwire [redwire@Nightstar-27dppb.nl.bellaliant.net] has quit [[NS] Quit: Textual IRC Client: www.textualapp.com]
04:28 Turaiel[Offline] is now known as Turaiel
04:45 Kindamoody[zZz] is now known as Kindamoody
05:31 celticminstrel [celticminst@Nightstar-gj43l1.dsl.bell.ca] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
05:49 RichyB [RichyB@Nightstar-c6u.vd5.170.83.IP] has quit [[NS] Quit: Gone.]
05:51
<@Azash>
Hrm
05:51
<@Azash>
It's been too long since I wrote C
05:51
<@Azash>
I managed to fail compiling hello.c twice
05:52 RichyB [RichyB@Nightstar-c6u.vd5.170.83.IP] has joined #code
05:58 Derakon is now known as Derakon[AFK]
06:04 * McMartin gets the Klotski solver compiled on the shootout machine.
06:04
< McMartin>
Gambit Scheme: 3.5 seconds, comparable to the Python solution, though using the Common LISP algorithm.
06:06
<&jerith>
So, today the local Python User Group is running a port-pygame-to-cffi sprint.
06:06
< McMartin>
On the older machine it's twice as fast.
06:06
< McMartin>
(5s vs Python's 10.5s)
06:07
<&jerith>
I think I shall use the opportunity to to finish the pymonocle work that that thecodelesscode interrupted.
06:07
< McMartin>
Heh.
06:07 * Vornicus is still improving his python klotski implementation on most fridays.
06:07
< McMartin>
I hope to add explicit support for kinds this weekend.
06:08
<~Vornicus>
Lately I'm working on "several pieces of the puzzle have to placed in goal positions, but you can't tell the difference between them", which is in fact harder than if you can.
06:09
<@Azash>
C question, as I can't find the issue here
06:09
<~Vornicus>
well, harder to code; easier to solve, because it reduces state space.
06:10
<@Azash>
In short, typedef struct {struct node* prev} node; void func(node* foo, node* bar) { (*bar).prev = foo; }
06:10
<@Azash>
The last assignment gives me an incompatible pointer type warning but, aren't they both node* ?
06:12
<&jerith>
Isn't "(*bar).prev" also spelled "bar->prev"?
06:12
<@Azash>
Yeah
06:22
<@Azash>
Something about how to use struct pointers inside the typedef I guess
06:25
<@Azash>
Right, fixed
06:36
< McMartin>
Oops, was AFK
06:36
< McMartin>
Yeah, typedefs don't give you what you need for recursive data types like that
06:40
<@Azash>
Yeah I just changed it from typedef struct to typedef struct node and it worked
06:40
< McMartin>
Yeah
06:40
< McMartin>
I personally prefer to give a more artificial name to the struct and then leave the typedef to have the "clean" name
06:41
< McMartin>
See, for instance, https://github.com/michaelcmartin/monocle/blob/master/include/monocle.h#L92
06:43
<@Azash>
Mm
06:43
<@Azash>
Is it just a convention or is there a benefit?
06:43
< McMartin>
Just a convention, at this point. I think you used to risk name collisions more regularly because old C was *fucking terrible*
06:44
< McMartin>
(So bad that in earlier versions, you could not have two structs with fields that had the same name across them!)
06:45
<@Azash>
Ah, yeah, I prefer this, at least until I've got my head wrapped around the syntaxc
06:45 * McMartin nods
06:45
<@Azash>
s/c$//
06:46
<@Azash>
alias gcc="gcc -std=c99 -Wall -Wextra -ansi -pedantic"
06:46
<@Azash>
Should make the learning a bit better :b
06:46
< McMartin>
Heh
06:47 himi [fow035@Nightstar-v37cpe.internode.on.net] has quit [Operation timed out]
06:50
<@Azash>
Any thoughts on this? https://github.com/haeroe/c-algo/tree/master/linked-list/src
06:51
< McMartin>
Well, you aren't doing separate compilation right
06:51
< McMartin>
The typedefs and function prototypes should all be in the .h, and then each .c includes that and implements some of the functions.
06:51
<@Azash>
Ah
06:53
< McMartin>
Since C doesn't really have public/protected/private, it's a little weird that you're writing accessor functions instead of just letting them see the node struct
06:54
< McMartin>
head and tail should probably not be globals
06:54
< McMartin>
Unless you only want one list ever
06:55
< McMartin>
removeValue() will go berzerk and annihilate everything
06:55
< McMartin>
The functions in -node look OK
06:56
< McMartin>
The ones in -list look like they could be problematic.
06:56
<@Azash>
Yeah I intended them to be globals because, well, this is probably never going to get actually used
06:56
< McMartin>
You should start testing them.
06:56
<@Azash>
Any thoughts on unit testing C?
06:56
< McMartin>
You've got an empty main() function. Start filling it with stuff that puts it through its paces and prints out results.
06:56
<@Azash>
main is only there to quiet gcc down
06:57
< McMartin>
Well, start using it for what it's for
06:57
<@Azash>
I will, once I have the tools ready for it :P
06:57
<@Azash>
(I'm just rubberducking my thoughts here)
06:58
<@Azash>
I'm using accessors mainly out of habit, that I admit
06:58
<@Azash>
It's more of a "one place where it goes wrong" thing than anything
06:58
<@Azash>
But, where's the problem in removeValue? The removeNode call is inside the value check
06:59
< McMartin>
And then it doesn't leave the loop
07:00
< McMartin>
Vornicus: http://pastebin.starforge.co.uk/601
07:00
< McMartin>
Hmm. I guess it's more "you don't stop, and just keep going"
07:00
< McMartin>
It's more removeAll
07:00 himi [fow035@Nightstar-v37cpe.internode.on.net] has joined #code
07:00 mode/#code [+o himi] by ChanServ
07:01
<~Vornicus>
Yay scheme!
07:01
<@Azash>
Oh wait yes I see the problem
07:01
<@Azash>
Null dereference instantly if it matches
07:11 iospace is now known as iospacedout
07:13
<@Azash>
This needs a fresh pair of eyes but I fixed the structure up a bit and looked at removeValue, should be better now
07:14
<@Azash>
todo for tomorrow: figure out unit testing C
07:20
<~Vornicus>
McM: yeah, yours already has that ability (because you have to tell it the equivalents anyway); mine doesn't because it detects equivalents on board/goal parsing.
07:26 Turaiel is now known as Turaiel[Offline]
07:28
<@Azash>
By the way, McMartin, if you meant going through the entire list and removing all matching values, that's intended
07:29
<~Vornicus>
so actually I end up having to write equivalents into the data file.
07:30 Stalker [Z@Nightstar-484uip.cust.comxnet.dk] has joined #code
08:23
<&jerith>
McMartin: I don't understand update() in earthball.c.
08:25
< McMartin>
You've pulled the latest version, right?
08:25
<&jerith>
From last time we spoke.
08:25
<&jerith>
This is what confuses me:
08:25
<&jerith>
if (newx < 0) {
08:25
<&jerith>
obj->x = obj->dx; obj->dx = -obj->dx;
08:25
<&jerith>
}
08:25
< McMartin>
I guess what I should be saying is "this version of update() takes a MNCL_OBJECT *)
08:25
< McMartin>
Ah yes
08:26
< McMartin>
That is compensating for the fact that I don't have kinds and subscriptions working yet, so the only callback that works is pre-physics.
08:26
<&jerith>
Oh, I see now.
08:26
< McMartin>
It should be "pre-render", and the first line there shoul dbe "obj->x = 0"
08:26
<&jerith>
You're setting the position to "dx from the left".
08:26
<&jerith>
Because monocle is actually applying dx/dy/df.
08:27
< McMartin>
Right.
08:27
< McMartin>
And the only callback currently there is the one that runs before that application.
08:27
< McMartin>
In the final demo it will instead subscribe to the hook *after* that application.
08:27
< McMartin>
But the list of hooks is currently incorrect and I need to account for that too.
08:27
< McMartin>
(Quite a few of them are ultimately superfluous, and many of the rest are misnamed.)
08:28
< McMartin>
Also note that each event also fires with a NULL object which is the monocle telling the program at large "Do your stuff for this phase". That always happens first.
08:28
< McMartin>
So, for instance, MNCL_EVENT_RENDER with NULL means "It's time to draw the background"
08:36
<&jerith>
Oh, bugger. Damn that past-jerith and his laziness!
08:36
<&jerith>
I haven't wrapped the data resource stuff at all.
08:38
<&jerith>
Whee! It works when I comment out the call to the instructions reader.
08:39 * jerith cleans some stuff up.
08:40
<&jerith>
I have to hardcode sprite size and frame count again, though.
09:06 * jerith pushes his new pymonocle and earthball implementations.
09:07
<&jerith>
There's still a bunch of stuff I can clean up here.
09:07
<&jerith>
McMartin: How stable is the data resource API?
09:28 You're now known as TheWatcher
09:34 ErikMesoy|sleep is now known as ErikMesoy
09:43 Kindamoody is now known as Kindamoody|out
09:43
< McMartin>
jerith: Pretty darn stable. It's just a limited exposure of the JSON parser it uses to marshal everything.
09:46
<&jerith>
McMartin: I can't just call "json.loads()", though. :-/
09:46
< McMartin>
Well, this is true.
09:46
< McMartin>
There is of course nothing stopping you from loading up the JSON via the Raw interface and parsing *that*.
09:47
<&jerith>
Hrm.
09:49
<&jerith>
Can mncl_data_resource() dig around in the some JSON and return a subset?
09:50
<~Vornicus>
arg, damn you Futility Closet
09:50 * Vornicus finds himself fighting with Dog's Mead, a classic math crossword-thing
09:53
< McMartin>
jerith: I'm not sure I understand your question
09:55
<&jerith>
Actually, mncl_raw_resource('instructions') returns NULL.
09:55
<&jerith>
I've forgotten how all the resource stuff works.
09:55
<&jerith>
The resource name you pass is just a "file", right?
09:56
<&jerith>
Err, "filename".
09:56
<&jerith>
So I probably need .json at the end.
09:56
<&jerith>
No.
09:57
<&jerith>
"data" is a key in earthball.json.
09:58
< McMartin>
Yes. You'd use the Python JSON parser to pull just that part out, inside of PyMonocle.
09:59
<&jerith>
How do I get the JSON from mncl_raw_resource()?
10:02
<&jerith>
Ah. It appears I can't.
10:03 * jerith just writes his wrapper around monocle's stuff.
10:04
< McMartin>
jerith: Why can't you? You should be able to absorb the byte buffer into a string, and the byte buffer is directly accessible from the MNCL_RAW * datatype.
10:05
< McMartin>
Or is that not being exported, because it should
10:05
< McMartin>
It looks like it is
10:05
< McMartin>
MNCL_RAW is a char * and a size; can cffi manage to turn that into a Python string?
10:06
<&jerith>
Nono, I can't get mncl_raw_resource() to give me a non-NULL thing.
10:06
<&jerith>
I think it's looking up a resource name in the JSON.
10:06
< McMartin>
Oh, I see.
10:06
< McMartin>
Hmmmmm.
10:07
< McMartin>
I can probably break out the virtual filesystem stuff as part of the raw system.
10:07
< McMartin>
mncl_raw_filedata or similar
10:07
<&jerith>
Ideally, you'd have a "mncl_data_resource_json()" or something that gives me the raw JSON for a given data resource.
10:08
<&jerith>
Except that means you'd need to serialise it.
10:08
< McMartin>
Yeah, which I currently don't bother doing, and would prefer to not do because constructing large strings in C is bullshit on stilts.
10:09
< McMartin>
mncl_raw_filedata would also let you directly access PNGs or whatever too if you had some reason to do this.
10:10
< McMartin>
Right now it's just called mncl_acquire_raw~
10:11 * jerith heads lunchwards.
10:11
< McMartin>
... actually, yeah, if you move mncl_acquire_raw and mncl_release_raw out of monocle_internal.h and into monocle.h and mark them extern MONOCULAR you should be good to go.
10:15 * Vornicus decides he should poke at that another time, but has learned something random about Excel's array-filling magic
10:18
<~Vornicus>
dog's mead is Mean
10:20 Vornicus [vorn@Nightstar-sn7kve.sd.cox.net] has quit [[NS] Quit: ]
10:21
< Shiz>
http://txt.shiz.me/YTgyZWRk
10:22
< Shiz>
I finally have my own pastebin up
10:43 AverageJoe [evil1@Nightstar-fb1kt4.ph.cox.net] has joined #code
11:06 AverageJoe [evil1@Nightstar-fb1kt4.ph.cox.net] has quit [[NS] Quit: Leaving]
11:42
< simon_>
with strict two-phase locking, I get the risk of deadlocks. still, it seems that DBMSes use strict two-phase locking a lot. so how do they avoid deadlocks? simply by using timeouts, or do they do some prioritization?
15:37 celticminstrel [celticminst@Nightstar-m7v.4bu.92.174.IP] has joined #code
15:37 mode/#code [+o celticminstrel] by ChanServ
15:44 Kindamoody|out is now known as Kindamoody
15:50 celticminstrel [celticminst@Nightstar-m7v.4bu.92.174.IP] has quit [[NS] Quit: KABOOM! It seems that I have exploded. Please wait while I reinstall the universe.]
15:50 celticminstrel [celticminst@Nightstar-m7v.4bu.92.174.IP] has joined #code
15:50 mode/#code [+o celticminstrel] by ChanServ
16:01 redwire [redwire@Nightstar-27dppb.nl.bellaliant.net] has joined #code
16:10 Turaiel[Offline] is now known as Turaiel
16:31 NSGuest61131 [orthianz@Nightstar-avg.1ee.224.119.IP] has quit [Ping timeout: 121 seconds]
17:14 Kindamoody is now known as Kindamoody|out
18:18 redwire is now known as redwire|afk
18:18 redwire|afk [redwire@Nightstar-27dppb.nl.bellaliant.net] has quit [[NS] Quit: My MacBook has gone to sleep. ZZZzzzâ¦]
18:47 redwire [redwire@Nightstar-27dppb.nl.bellaliant.net] has joined #code
19:52 iospacedout is now known as iospace
19:52
<&jerith>
Well, I wasn't expecting pygame-cffi to overtake pymonocle in terms of functionality in less than a day.
19:53 Derakon[AFK] is now known as Derakon
19:54
< Shiz>
I feel like the world is conspiring against me to get me to write software
19:54
< Shiz>
'Every IRC bot is shit, I have to make my own IRC bot'
19:54
< Shiz>
'fuck, every IRC library is shit, I have to write my own IRC library'
19:54
< Shiz>
'every python documentation generator is shit, I have to...'
19:54
< Shiz>
maybe I should lower my standards.
19:56
<&jerith>
Shiz: Welcome to my world.
19:56
<&jerith>
Sphinx is probably the least shit doc system.
19:56
< Shiz>
probably, but I don't like rST and the autodoc module seems incomplete
19:56
< Shiz>
:(
19:56
<&jerith>
Also, readthedocs.org.
19:57
<&jerith>
But like I said, "least shit". Not "best".
19:57
< Shiz>
yeah.
19:59
<&jerith>
I don't like some of the design compromises in ibid, but it's reasonably good in places.
19:59
<&jerith>
https://launchpad.net/ibid/
20:03
< Shiz>
huh, I had never heard of it
20:03
< Shiz>
I don't even know if I like the design compromises in my own bot
20:03
< Shiz>
:P
20:03
<&jerith>
Shiz: I was one of the original devs on ibid.
20:04
<&jerith>
I designed the plugin system, among other things.
20:04
< Shiz>
i see
20:04
< Shiz>
well I now already have a fully functional RFC1459+281x(partial)+IRCv3 compliant bot
20:04
< Shiz>
:P
20:05
<&jerith>
But then the other two guys rewrote it to always use blocking I/O in threads instead of allowing Twisted-based plugins.
20:07
< Shiz>
yeah my last effort into using a third-party irc library was lurklib
20:07
< Shiz>
https://github.com/LK-/lurklib/blob/master/lurklib/core.py
20:07
< Shiz>
I think line 24 says enouh here.
20:08
<&jerith>
Also line 25, 26 and 27.
20:10
< Shiz>
well when I wrote the initial implementation of what I have now it was a single 1000-line class that implemented rfc1459+extensions
20:10
< Shiz>
now I kind of have a base class that implements RFC1459 and seperate feature classes that kind of act like mixins
20:10
< Shiz>
... yeah I don't know either.
20:11
<&jerith>
Composition over inheritance.
20:11
< Shiz>
naturally
20:12
< Shiz>
however, extensions can sadly affect core functionality
20:12
<&jerith>
Is your code available somewhere?
20:12
< Shiz>
not yet
20:12
< Shiz>
I can up a tarball though
20:12
<&jerith>
Ah.
20:12
<&jerith>
That sounds like effort to look at. :-)
20:12
< Shiz>
what I'm doing now feels really dirty to me too, let it be known
20:12
< Shiz>
:P
20:13
< Shiz>
you know it gets dirty when you manage to crash Python's MRO algorithm...
20:13 Vornicus [vorn@Nightstar-sn7kve.sd.cox.net] has joined #code
20:13 mode/#code [+qo Vornicus Vornicus] by ChanServ
20:14
<&jerith>
I've written three or four IRC bots and haven't really liked any of them.
20:14
< Shiz>
let's see if my current copy runs first
20:20
< Shiz>
huh.
20:20
< Shiz>
well, this is interesting
20:21 ShizBot [shizbot@Nightstar-vap16c.dynamic.ziggo.nl] has joined #code
20:21
< Shiz>
nevermind, I'm stupid.
20:21
< Shiz>
okay, let me tar her up.
20:22 ShizBot [shizbot@Nightstar-vap16c.dynamic.ziggo.nl] has quit [[NS] Quit: Quitting]
20:25
< Shiz>
https://up.shiz.me/priv/pydle-0.7pre.tar.xz
20:30
<@Azash>
Shiz: When's the repo going public?
20:32
< Shiz>
depends
20:32
< Shiz>
I really want to fix the design of it since this is mostly an experiment
20:32
< Shiz>
(and probably a bad one)
20:34
<&jerith>
Public by default!
20:34
< Shiz>
wel, there is no repo
20:35
< Shiz>
:P
20:35
< Shiz>
at least not on any site
20:35
<&jerith>
What do you use for revision control?
20:35
< Shiz>
git
20:35
<&jerith>
Then just push it to github. :-)
20:42
<&jerith>
Not enough Twisted in your networking. ^.^
20:49 redwire [redwire@Nightstar-27dppb.nl.bellaliant.net] has quit [Connection closed]
20:51
< Shiz>
man
20:51
< Shiz>
I like Twisted's idea and stuff but i think it has a rather bad api
20:53 redwire [redwire@Nightstar-27dppb.nl.bellaliant.net] has joined #code
20:53
<&jerith>
Shiz: It takes a bit of getting used to.
20:53
<&jerith>
But it's vastly better than any other networking library I've used.
20:56
< redwire>
I've used Twisted a little bit. I'm not even sure how I'd tackle mastering the whole thing.
20:56
< redwire>
Is it really _that_ good?
20:58
< Shiz>
I always wondered what made it so much better, than, say, gevent
20:58
< Shiz>
better than*
20:59
<&jerith>
redwire: Its model works better than the usual socket.whatever() interface.
20:59
<&jerith>
Shiz: gevent rewrites half the standard library behind your back.
20:59
< Shiz>
only if you tell it to
20:59
< redwire>
Oh so you're saying you'd use Twisted over just low-level sockets?
20:59
< Shiz>
monkey patching is not on by default
21:00
< Shiz>
and is only useful if you don't write your app with it in mind in the first place
21:00
< Shiz>
and don't want to rewrite stuff.
21:00
< redwire>
Isn't Twisted a little big to replace sockets?
21:01
<@Namegduf>
I think the idea is, what you'd have to do to get a good event loop and such going with sockets directly is complicated enough that Twisted is worth it.
21:01
<&jerith>
redwire: It's not replacing sockets so much as replacing a bunch of things that are built on top of them.
21:01
<@Namegduf>
Since it's a significant time saver.
21:01
< redwire>
That's pretty fair. It's probably a lot better than rewriting a lot of what Twisted does every time you need something new.
21:01
<@Namegduf>
I've not spent enough time with Twisted to be sure.
21:02
<@Namegduf>
But it seems likely, yeah.
21:05
<&jerith>
It's a seriously solid piece of engineering backed by a decade of learning how to solve these problems.
21:20
< Shiz>
well anyway
21:20
< Shiz>
any comments beside from that? :-)
21:21
<&jerith>
Shiz: It is my first (and usually only) choice for anything network-related.
21:22
<&jerith>
Apart from that, you'll need to ask more specific questions.
21:22
<&jerith>
(I work on Twisted-based messaging systems for a living.)
21:51 Kindamoody|out is now known as Kindamoody
22:32 ErikMesoy is now known as ErikMesoy|sleep
22:32 Vornicus [vorn@Nightstar-sn7kve.sd.cox.net] has quit [[NS] Quit: Leaving]
22:33 Kindamoody is now known as Kindamoody[zZz]
22:41 Orthia [orthianz@Nightstar-avg.1ee.224.119.IP] has joined #code
22:41 mode/#code [+o Orthia] by ChanServ
22:41 Stalker [Z@Nightstar-484uip.cust.comxnet.dk] has quit [Ping timeout: 121 seconds]
23:14 Turaiel is now known as Turaiel[Offline]
23:56
< McMartin>
jerith: pygame-cffi has the advantage of wrapping something that's actually done
--- Log closed Sun Dec 08 00:00:13 2013
code logs -> 2013 -> Sat, 07 Dec 2013< code.20131206.log - code.20131208.log >

[ Latest log file ]