code logs -> 2012 -> Wed, 14 Mar 2012< code.20120313.log - code.20120315.log >
--- Log opened Wed Mar 14 00:00:54 2012
00:19 RichyB [MyCatVerbs@Nightstar-3b2c2db2.bethere.co.uk] has quit [[NS] Quit: zzz]
01:59 Kindamoody[zZz] is now known as Kindamoody
02:32 Attilla_ [Obsolete@Nightstar-7d4a92bc.as43234.net] has joined #code
02:34 Attilla [Obsolete@Nightstar-7d4a92bc.as43234.net] has quit [Ping timeout: 121 seconds]
02:43 Eri [Eri@Nightstar-3e5deec3.gv.shawcable.net] has quit [[NS] Quit: Leaving]
02:56 Eri [Eri@Nightstar-3e5deec3.gv.shawcable.net] has joined #code
03:16 Stalker [Z@Nightstar-3602cf5a.cust.comxnet.dk] has quit [Ping timeout: 121 seconds]
03:28 Attilla_ [Obsolete@Nightstar-7d4a92bc.as43234.net] has quit [Ping timeout: 121 seconds]
03:37 Syloqs-AFH [Syloq@NetworkAdministrator.Nightstar.Net] has quit [Client closed the connection]
03:37 Vash [Vash@Nightstar-cdeba41f.wlfrct.sbcglobal.net] has quit [Connection closed]
03:40
< maoranma>
Split should work on /n for new lines, right?
03:40
<@ToxicFrog>
\n in most languages
03:40
< maoranma>
\n rather, right
03:40
<@ToxicFrog>
Also might be \r\n depending on where the text is coming from
03:40
<&Derakon>
"foo\nbar\nbaz\n".split("\n")
03:40
<&Derakon>
['foo', 'bar', 'baz']
03:41
< maoranma>
I'm thinking of how to make a listcomp for something I have here. It's a stream of 63 lines, with values seperated by spaces.
03:42
< maoranma>
So I need a ''' {etc} '''.format() to run for each line split by ' '
03:44
< maoranma>
[string for string in stream.split('\n')].split[' ']?
03:46
<@ToxicFrog>
...why not just split on whitespace?
03:48
< maoranma>
Well, I'm using each line to print something
03:48
< maoranma>
So, I'm breaking the stream into strings, then breaking those strings into lists, then running a method on those
03:51
< maoranma>
Ah, [string.split(' ') for string in stream.split('\n')]
03:51
< maoranma>
that's what I needed
03:51
< maoranma>
lolz listcomp is pythonic am i doin it rite?
03:53 * ToxicFrog eyes python
03:53
<@ToxicFrog>
AttributeError: 'list' object has no attribute 'map'
03:53
<@ToxicFrog>
(yes I know list comprehensions are basically map and filter rolled into one, that's still no excuse~)
03:55
< maoranma>
Well, that list comp works for me, but I can't seem to past is to a print().format() method without getting an index out of range error on the tuples
03:57 Eri [Eri@Nightstar-3e5deec3.gv.shawcable.net] has quit [Client closed the connection]
03:58
< maoranma>
print('Name : {1}\n Number : {0}\n Maximum Yield : {2}\n Growth Rate : {3}\n Moisture Use : {4}\n Spiciness : {5}\n Dryness : {6}\n Sweetness : {7}\n Bitterness : {8}\n Sourness : {9}\n Smoothness : {10}'.format([string.split(' ') for string in test.split('\n')]))
04:14 eckse_ [eckse@Nightstar-4ac693e1.dsl.sentex.ca] has joined #code
04:17 eckse [eckse@Nightstar-7db408d9.dsl.sentex.ca] has quit [Ping timeout: 121 seconds]
04:17
< maoranma>
for a,b,c,d,e,f,g,h,i,j,k in [string.split(' ') for string in test.split('\n')]:
04:17
< maoranma>
print('Name : {1}\n Number : {0}\n Maximum Yield : {2}\n Growth Rate : {3}\n Moisture Use : {4}\n Spiciness : {5}\n Dryness : {6}\n Sweetness : {7}\n Bitterness : {8}\n Sourness : {9}\n Smoothness : {10}').format(a,b,c,d,e,f,g,h,i,j,k)
04:17
< maoranma>
that's what I settled on
04:20
< maoranma>
I'm sure there's a way to make that a single line list comprehension...
04:22
< maoranma>
But it saved me 706 lines of tedium, yay python
05:18 Derakon is now known as Derakon[AFK]
05:24
< maoranma>
Heh, after formating my yaml file a little differently, my module for Noah{OYOYO} is now only 8 lines of code
05:24
< maoranma>
Oh, sorry, 6, was counting some test calls
05:29 celticminstrel [celticminst@Nightstar-5d22ab1d.cable.rogers.com] has quit [[NS] Quit: And lo! The computer falls into a deep sleep, to awake again some other day!]
05:42 himi [fow035@D741F1.243F35.CADC30.81D435] has quit [Ping timeout: 121 seconds]
05:43 Eri [Eri@Nightstar-3e5deec3.gv.shawcable.net] has joined #code
05:55 * McMartin fiddles with Hex Inverter, which seems to be failing to recognize legal moves as legal.
06:22
<&McMartin>
Hrm, OK, I can refactor the problem out of existence, I guess.
06:22 maoranma [maoranma@Nightstar-18ea8aaa.pools.spcsdns.net] has quit [Ping timeout: 121 seconds]
06:23 Noah{OYOYO} [Noah{OYOYO}@Nightstar-18ea8aaa.pools.spcsdns.net] has quit [Ping timeout: 121 seconds]
06:25 maoranma [maoranma@Nightstar-b46b20e0.pools.spcsdns.net] has joined #code
06:28
<&McMartin>
Excellent. It now no longer looks like ass. https://hkn.eecs.berkeley.edu/~mcmartin/Inv5/
06:30
<&McMartin>
Now to get a working main menu, I guess
06:30
<&McMartin>
Then I can start playing with animation priority.
06:34 eckse_ [eckse@Nightstar-4ac693e1.dsl.sentex.ca] has quit [Client closed the connection]
06:53 ToxicFrog [ToxicFrog@ServerAdministrator.Nightstar.Net] has quit [Operation timed out]
06:57 ToxicFrog [ToxicFrog@ServerAdministrator.Nightstar.Net] has joined #code
06:57 mode/#code [+o ToxicFrog] by ChanServ
09:01 Rhamphoryncus [rhamph@Nightstar-5697f7e2.abhsia.telus.net] has joined #code
09:06
<@jerith>
McMartin: Do you know of any good Python IF backends?
09:07
<&McMartin>
Hm
09:07
<&McMartin>
Well, there's the insanely experimental Curveship.
09:08
<@jerith>
A colleague wants to hook up an IF engine to vumi for some tutorial stuff.
09:08
<&McMartin>
Mmm
09:08
<&McMartin>
What is vumi?
09:08
<@jerith>
My day job. :-)
09:08
<@jerith>
http://github.com/praekelt/vumi
09:08
<@jerith>
It's a messaging platform, focusing on SMS and other mobile stuff.
09:09
<&McMartin>
mmm
09:09
<@jerith>
But there are IRC and XMPP transports as well.
09:09
<@jerith>
It doesn't actually have to be a Python thing, as long as it's relatively straightforward to use it from Python.
09:09
<&McMartin>
Traditionally one would use Python to bridge the gap between a core engine and the rest of the system.
09:10
<&McMartin>
Which would be something arbitrary.
09:10
<@jerith>
He wants this stuff for an intermediate-level tutorial that shows off session management.
09:10
<&McMartin>
Plotkin's Glk library is an abstract layer, that most IF systems can speak
09:10
<&McMartin>
Glulx is designed for it.
09:11
<&McMartin>
Dumbfrotz is very commonly hooked to IRC bots.
09:11
<&McMartin>
For Infocom-VM games.
09:12
<@jerith>
That seems promising.
09:12
<&McMartin>
Python itself is not commonly used as a terp.
09:13
<&McMartin>
I believe that every serious system's core is written in C or C++.
09:13
<&McMartin>
Dumbfrotz speaks nothing but stdin and stdout.
09:14
<@jerith>
That's actually pretty cool.
09:14
<&McMartin>
And cheapglk does that for any glk-capable terp, which handles Infocom, Glulx, TADS2, TADS3, and Hugo, at a minimum.
09:15
<&McMartin>
Gargoyle and Spatterlight are multiterps that use Glk as their intermediary, and they handle all kinds of stuff
09:15
<&McMartin>
Glk itself can be made compliant with, again, nothing but stdin and stdout
09:15
<&McMartin>
("cheapglk")
09:16
<&McMartin>
Though it's not as shiny as the full windowed versions, or the curses systems.
09:19
<&McMartin>
I'd start with Python's subprocess module and a stock build of dumbfrotz.
09:19
<&McMartin>
Or a custom build with a bigger stack so it can handle I7 cleanly. Stock Z-machines only had 1KB of stack, which is lame.
09:20
<&McMartin>
(16KB is preferred)
09:30 Attilla [Obsolete@Nightstar-7d4a92bc.as43234.net] has joined #code
09:37
<@jerith>
McMartin: Given that this is a tutorial thing and isn't really about IF specifically, simple beats featureful.
10:05 Kindamoody is now known as Kindamoody|out
10:07 RichyB [MyCatVerbs@Nightstar-3b2c2db2.bethere.co.uk] has joined #code
10:57 Stalker [Z@Nightstar-3602cf5a.cust.comxnet.dk] has joined #code
12:54
<@jerith>
Old, but good: http://www.ibiblio.org/harris/500milemail.html
13:05 Attilla_ [Obsolete@Nightstar-bf2c7dd7.threembb.co.uk] has joined #code
13:06 Attilla [Obsolete@Nightstar-7d4a92bc.as43234.net] has quit [Ping timeout: 121 seconds]
13:06 Attilla_ is now known as Attilla
13:39 EvilDarkLord [jjlehto3@Nightstar-a5db08cc.org.aalto.fi] has quit [[NS] Quit: leaving]
13:41
< Tarinaky>
I feel like such a nerd. The facebook group for our dept. is arguing about solutions for speeding up signing of the register.
13:41
< Tarinaky>
Needless to say: I just ran through an example of an improved algorithm >.>
13:41
< Tarinaky>
Hence. Nerdy.
13:42 * jerith considers that kind of thing normal, actually.
13:42
< Tarinaky>
I'm not sure how to work out a quantified efficiency/speed comparison based on a fair distribution of surnames in a room.
13:43
< Tarinaky>
Any suggestions?
13:43
<@jerith>
How does it work at the moment?
13:44
< Tarinaky>
The 'standard' register of one set of stappled pages being passed around the room and an auto-parrallised example where the three pages are colour coded and unbound - travelling at different speeds
13:44
< Tarinaky>
This is the demonstration I posted: http://pastebin.com/YSpayMKs
13:45
<@jerith>
Pass several complete sets around, one per row/section/whatever.
13:45
<@jerith>
Efficient in the class, but then someone has to collate them afterwards.
13:46
< Tarinaky>
That was suggested. I pointed out that increases work for admin staff.
13:46
< Tarinaky>
The three different registers can be collated as simply as stapling them together.
13:47
<@jerith>
But they still all need to traverse the whole population, unless people are seated by name.
13:47
<@jerith>
But what happens to the data from the register?
13:47
<@jerith>
Is it captured into some other system later?
13:47
< Tarinaky>
No idea. I thought it best to make no assumptions.
13:48
<@jerith>
If it is, then multiple copies adds very little work.
13:48
<@jerith>
Just a bit of extra page-turning, really.
13:49
< Tarinaky>
Lets assume it isn't though :p
13:49
<@jerith>
If it's just stored until someone needs it for some reason, it only adds effort at the time it's needed.
13:49
<@jerith>
Which I suspect isn't regularly.
13:49
< Tarinaky>
If only because I'd like to find out how to quantify the characteristics of algorithms more formaly >.>
13:50
<@jerith>
Read up on your algorithms and complexity theory.
13:50
<@jerith>
My solution trades time for space, and possibly a little bit of time in post-processing.
13:51 celticminstrel [celticminst@Nightstar-5d22ab1d.cable.rogers.com] has joined #code
13:52 * jerith heads off to take a colleague to the airport.
13:52 * Vornicus replaces the register with a high resolution camera and a facial recognition system. problem over.
13:52
< Tarinaky>
Okay, thanks.
13:52
< Tarinaky>
Vornicus: That was also suggested.
13:52
<~Vornicus>
aw.
13:52
<~Vornicus>
I was being flippantly expensive.
13:52 maoranma [maoranma@Nightstar-b46b20e0.pools.spcsdns.net] has quit [Ping timeout: 121 seconds]
13:52
<@jerith>
Also unreliable.
13:52
<@jerith>
Face recognition isn't good enough. (Yet.)
13:54
< Tarinaky>
I suggested this method because a maths lecturer used it last semester. So I presumed there was a good reason he didn't go with the multiple registers route.
13:54
<~Vornicus>
Tarinaky: if you really want to try this out, you'd have to science it up some. You need to know how long it takes for a person to recognize which sheet they're on (sorted by last name and divided only at first-letter-changes boundaries helps), how long it takes for them to pass it on, how long it takes for them to sign
13:55
<~Vornicus>
And what people can do while they're signing - they may get bottlenecked often because passing and signing can't happen at the same time
13:55
< Tarinaky>
I'm assuming that passing and signing takes the same amount of time - and that you can pass multiple sheets.
13:56
< Tarinaky>
I'm also assuming that, since the sheets are colour coded, you can recognise your sheet instantly.
13:58 * Vornicus thinks about it
13:59
< Tarinaky>
Also that there's a queue that can receive sheets without intervention (ie: leaving it on the desk next to you)
14:01
< Tarinaky>
Akk. I've gotta dash to robotics. Later.
14:57 Alek [omegaboot@Nightstar-efc8dc53.il.comcast.net] has quit [Ping timeout: 121 seconds]
15:01 Alek [omegaboot@Nightstar-efc8dc53.il.comcast.net] has joined #code
15:01 mode/#code [+o Alek] by ChanServ
15:33
< Rhamphoryncus>
Damned euclidean geometry
15:35 * Rhamphoryncus labels his gimp layer "straight curves"
15:49 Vash [Vash@Nightstar-cdeba41f.wlfrct.sbcglobal.net] has joined #code
15:49 mode/#code [+o Vash] by ChanServ
15:50
< Rhamphoryncus>
Tracks can go "straight" (along the square grid) or "diagonal" (cutting across the square grid). I want to add real curves. That means one set for the straight (radius of n*0.5), another for the diagonal (radius of n*0.5*?2), and a third to transition between
15:54
<~Vornicus>
Are these tracks for OTTD?
15:55
<~Vornicus>
I poked at possible solutions for that once
15:56 maoranma [maoranma@Nightstar-cbbc9ef9.pools.spcsdns.net] has joined #code
16:00
<~Vornicus>
The one I liked most was I broke up the tile into 5 pieces - a small central square, and four trapezoids that connect the central square to the outside edges. Then I used circles, tangent to the target lines, as large as I could make them, to choose the center of the track.
16:00 maoranma [maoranma@Nightstar-cbbc9ef9.pools.spcsdns.net] has quit [Ping timeout: 121 seconds]
16:00 maoranma [maoranma@Nightstar-cbbc9ef9.pools.spcsdns.net] has joined #code
16:03 Derakon [chriswei@Nightstar-a3b183ae.ca.comcast.net] has joined #code
16:03 mode/#code [+ao Derakon Derakon] by ChanServ
16:04
<&Derakon>
So I'm testing some code on my (OSX) laptop, and discover that it's running the Windows-specific branch in a particular area.
16:04
<&Derakon>
I go to look at that code, and it says "if 'win' in sys.platform"...
16:04
<&Derakon>
I check sys.platform...it's "darwin".
16:04
<&Derakon>
Whups!
16:04
<~Vornicus>
whups
16:05
<@Ling>
The "in" operator does substring operations?
16:05
<&Derakon>
Yeah.
16:05
<&Derakon>
if substring in string:
16:05
<@Ling>
:/
16:05
<&Derakon>
This is a bad thing?
16:06
<&Derakon>
Strings already support several array-like operations.
16:06
< maoranma>
Or, more literally... if string in superstring: print true
16:06
<@Ling>
I'm used to it working on arrays/hash-tables
16:06
< maoranma>
shouldn't it be doing if 'win == sys.platform?
16:06
< maoranma>
'win' == sys.platform rather
16:06
<&Derakon>
No, because the actual platform is something like "win32" for 32-bit OSen and I don't know what the 64-bit one is
16:07
<&Derakon>
Probably "win64".
16:07
<@Ling>
Maybe they were expecting it to start being win32 and win64?
16:07
< maoranma>
Oh, hmm
16:07
<&Derakon>
I could do "if sys.platform[:3] == 'win'"
16:07
< maoranma>
that should work
16:07
<&Derakon>
And I get a cat emote in my code.
16:07
< maoranma>
lolz
16:07
<&Derakon>
Of course it would crash if sys.platform is only two characters.
16:08
<&Derakon>
...no, it wouldn't. Nevermind!
16:09
< maoranma>
heh
16:09
< maoranma>
Even I know that (actually, I had to check it in IDLE *weep*)
16:10
< maoranma>
I think I'm gonna rip the !py parser from phenny and put it in my bot
16:10
< maoranma>
Or move all my stuff back into phenny, haven't decided
16:10
<&Derakon>
You want your bot to be able to execute Python code told to it in IRC?
16:10
< maoranma>
sigh, no, Derakon, that would be dumb
16:11
< maoranma>
It passes the code to a webparser that does it in a sandbox, then prints that to chat
16:11
<&Derakon>
...well, so long as you have faith in the sandbox to contain things properly, I guess.
16:12
< maoranma>
It's not my sandbox, so if someone deletes thier root, I'm not concerned
16:12 * Derakon facepalms.
16:12
<&Derakon>
Fair enough.
16:12
< maoranma>
The trick is to make sure it doesn't try to execute before it gets to their parser
16:13
<&Derakon>
Well, that's easy enough. Stay the hell away from exec() and the like.
16:13 Kindamoody|out is now known as Kindamoody
16:13
<&Derakon>
To my knowledge Python has no "I'm accepting input and oooh that looks like code let's run it and see what happens!" bugs.
16:14
< maoranma>
It does if you don't know what a method is supposed to do
16:14
< maoranma>
Ie, raw_input versus input in python < 3.0
16:14
< maoranma>
We had to break our programming teacher from using it, lol
16:14
<~Vornicus>
Unless you use input() on py2, but with the myriad warnings placed liberally about the doc text of that function you're a damnfool if you try
16:15
< maoranma>
lol
16:15
<&Derakon>
>>> help(input)
16:15
<&Derakon>
...
16:15
<&Derakon>
Equivalent to eval(raw_input(prompt)).
16:15
<&Derakon>
Yeah, that's...who decided that was a good idea anyway?
16:15
< maoranma>
>>> help(input)
16:15
< maoranma>
...
16:16
< maoranma>
Equivalent to letting someone tear your harddrive out and brain you with it.
16:16
< maoranma>
Guido probably, be he was all like (nah, people will read the docstring before using it)
16:17
<&Derakon>
Pft
16:17 * celticminstrel does the sandboxing thing too.
16:17
< maoranma>
I have trouble believing something that silly got through several people, so I have to imagine it was veto'd in
16:18
< celticminstrel>
With eval().
16:18 * Vornicus also facepalms.
16:18
<~Vornicus>
oh I was scrolled up
16:21
< maoranma>
durr
16:25
< maoranma>
Hmm, looks like it should be easy enough to modify for my oyoyo bot
16:25
< maoranma>
Though my bot needs another name...
16:28
< maoranma>
Oh, hey, I forgot Aqua snap works on windows that are inside other windows
16:29
< maoranma>
MDI windows? I think they're called
16:37
< Rhamphoryncus>
Vornicus: yeah, openttd. Not sure what you mean by that
16:37
<~Vornicus>
I had a picture somewhere, let me see if I can find it
16:37
< Rhamphoryncus>
alright, thanks
16:39
< RichyB>
Derakon, the String class has a .startswith() method. Idiomatically, use that.
16:39
< Rhamphoryncus>
My current line of thinking is that the third, transitional set is the most important, so I should see if I can get it to look good when used for the other two
16:39
<&Derakon>
Richy: ah, good point.
16:39 * Vornicus hunts around
16:39
< RichyB>
The slice-and-equality method is imperfect because it duplicates information (the length of the tested-for string) in two places.
16:40 * Stalker hunts straight?
16:41
<~Vornicus>
Nope. I can rebuild it relatively quickly though, but first I'm going to the store.
16:41
< Rhamphoryncus>
alright
16:43 * jerith just wrote up a long and detailed code review.
16:43
<&Derakon>
How long was the code change being reviewed?
16:43
<@jerith>
The guy submitting the patch works for another company, but is being paid to work on our stuff.
16:44
<@jerith>
https://github.com/praekelt/vumi/pull/214
16:44
<@jerith>
Derakon: ^^^
16:44
<@jerith>
There were a couple of actual issues, but lots of little style things.
16:45
<@jerith>
As a team, we have *very* strict standards on PEP-8 compliance and pyflakes warnings.
16:45
<@jerith>
(We find this makes our lives much easier, because the code's nicer to work in.)
16:46
<&Derakon>
Yeah, having a good style guideline makes a big difference.
16:46
<@jerith>
Even better is having a good style guideline /with tool support/.
16:47 * Rhamphoryncus ponders 22.5? segments
16:47
<~Vornicus>
Not quite right
16:47
<~Vornicus>
you'll really want ones that step 1-3
16:47
<&Derakon>
22.5^0 = 22.5.
16:48
< Rhamphoryncus>
Oh I'm assuming each segment crosses multiple tiles
16:48
<&Derakon>
Or 1, depending on what you mean by ^0
16:48
< Rhamphoryncus>
huh?
16:48
< celticminstrel>
It's Python, so the class is called "str", not "String". :P
16:48
<&Derakon>
(xor vs. exponentiation)
16:48
<@jerith>
I dislike Twisted's guideline, because it violates PEP-8 and there isn't a replacement tool.
16:48
<~Vornicus>
Rham: yeah, you'll want the, uh
16:49
< celticminstrel>
What's PEP-8 again? Is that the style guidelines?
16:49
<~Vornicus>
you'll want to go from (0,0.5) to (1.5,0)
16:49
< maoranma>
replacement for what?
16:49
<@jerith>
(That's pretty much the only reason I dislike it, although I'm not convinced that the extra vertical whitespace is a win.)
16:49
< celticminstrel>
What's Twisted's guideline that violates it?
16:49
< Rhamphoryncus>
Vornicus: oh that. Yeah, that's an easy option
16:49
< Rhamphoryncus>
I want multiple curve radiuses tough :)
16:49
<@jerith>
maoranma: The "pep8" tool that flags violations.
16:49
< Rhamphoryncus>
I'm doing it all the hard way
16:50
<@jerith>
celticminstrel: They specify more whitespace between things.
16:50
< maoranma>
celticminstrel: See jerith to me
16:50
<@jerith>
PEP-8 says "two lines between top-level classes/functions, one line everywhere else".
16:51
<~Vornicus>
Actually the thing I had wasn't adding any new data to the map
16:51
< maoranma>
Most of my code violates pep8, hehe
16:51
<~Vornicus>
it was just "render curves where it's useful"
16:51
<@jerith>
Twisted says "three lines between top-level classes/functions, two lines between methods of a class, one line everywhere else".
16:51
< Rhamphoryncus>
Yeah, that's what the devs want :P
16:52
<@jerith>
maoranma: That's easy to fix, and the payoff is worth it.
16:52 * Vornicus still cannot stand 4-space indent.
16:52
<@jerith>
Which editor do you use?
16:52
<&Derakon>
As opposed to what?
16:52
<~Vornicus>
2-space.
16:52
< maoranma>
NP++
16:54
<&Derakon>
2-space is overly subtle for me.
16:54
<&Derakon>
Plus Sebastian used to use it. >.<
16:54
< maoranma>
I think 4 space is fine
16:55
<~Vornicus>
I've used 2-space all my life.
16:56
< maoranma>
Two good reasons to break a particular rule: (1) ... (2) To be consistent with surrounding code that also breaks it (maybe for historic reasons) -- although this is also an opportunity to clean up someone else's mess (in true XP style).
16:56
< maoranma>
Maybe twisted falls under that
16:56
<@jerith>
I like 2-space in Ruby where there's a lot of nesting.
16:56
<~Vornicus>
well, 2-space, or in Word, 1/4"
16:56
< maoranma>
celticminstrel: http://www.python.org/dev/peps/pep-0008/
16:57
<@jerith>
If I'm indented far enough for 4-space to be an issue, I probably need to refactor anyway.
16:58
<@jerith>
maoranma: Twisted has some pretty good reasons for their standard.
16:59
<@jerith>
In particular, the proliferation of callback functions means that the more noticeable gap between methods is useful.
17:00
< maoranma>
Limit all lines to a maximum of 79 characters.
17:00
< maoranma>
I break that one ALL the time
17:00
<&Derakon>
I do 2 between methods regardless, three lines after the end of a class definition.
17:00
<&Derakon>
And yeah, the line length limit can be tricky to deal with.
17:01 * Vornicus has to bust up crazy listcomps into several lines surprisingly often.
17:02
<@jerith>
I'd be fine with 85 character lines, but 79 makes more sense historically.
17:02 gnolam is now known as gnolagrippe
17:02
<~Vornicus>
all right really storetime.
17:02
<@jerith>
There are a *lot* of 80-character things out there.
17:03
< celticminstrel>
maoranma: I've been linked that several times. Mere confirmation that it was the style guide was sufficient. :)
17:04
< celticminstrel>
I use 2-space indentation in the browser (eg posting code on a forum), but tabs everywhere else.
17:04
< maoranma>
jerith: But how many of them do I need to look at python code on?
17:04
<~Vornicus>
ACtually if I had my druthers, tabstops would be 2.5 spaces
17:05
<&Derakon>
Ugh, tabs.
17:05
< celticminstrel>
Tabs are the best indentation.
17:05
< celticminstrel>
.
17:05
<@Ling>
<3 celticminstrel
17:06
<&Derakon>
Except for all other methods that have been tried.
17:07
< maoranma>
I have spaces show up as dots and tabs show up as arrows in NP++
17:08
<&Derakon>
http://www.futilitycloset.com/2012/02/20/scooping-the-loop-snooper/
17:08
< RichyB>
80 characters is a nice limit because it's about where you can just about cram two terminals side by side on a cheap and small monitor.
17:08
< maoranma>
meh
17:09
<@jerith>
Or, in my case, split screen between editor and test run.
17:09
< maoranma>
that's what I do, but I just use wordwrap
17:10
<&Derakon>
Better wordwrap than horizontal scrolling, certainly.
17:10
<@jerith>
Wrapping isn't great when indentation level denotes block structure.
17:10
< maoranma>
And NP++ has a wrap symbol, so it's fine for my use
17:10
<@jerith>
Sudden long line wrap can break the flow.
17:11
<&Derakon>
Sure.
17:11
< maoranma>
Plus a wrapped line doesn't have any tiny dots showing spaces on th eleft
17:11
<&Derakon>
FWIW I use vim, and while there's probably a way to make whitespace more visible I don't use it.
17:11
< maoranma>
And if it's anyone elses code, I'll just yell at them for not being PEP8, bwahaha
17:11
<&Derakon>
And I don't have any difficulties.
17:12
< maoranma>
My vision is blurry, so it helps me to have it as a guide
17:12
<&Derakon>
Vim's incredibly powerful search, replace, bookmark, etc. functionality more than makes up for not using a fancier GUI.
17:13
< celticminstrel>
I usually hard-wrap at uh... whatever the width of the window happens to be.
17:13
<@jerith>
maoranma: http://stackoverflow.com/questions/4987920/python-correctness-i-e-lint-analyzing -for-notepad/6273211#6273211
17:13
<@jerith>
But run pep8 and pyflakes instead of pylint.
17:13
< celticminstrel>
Though sometimes I just let TextWrangler soft-wrap.
17:13
< celticminstrel>
3
17:13
< celticminstrel>
It indents the wrapped line to the same level.
17:14
< celticminstrel>
I'll probably never follow PEP-8. :P
17:15
< celticminstrel>
Though I don't think I deviate that much from it.
17:15
< maoranma>
#tag pep8 pyflakes pylint
17:15
<@jerith>
maoranma: One of my colleagues has whitespace display turned on in vim. I think it actually only shows inappropriate whitespace, which is cool.
17:15
< maoranma>
Reading it, I seem to do okay, except the line length
17:37 Kindamoody [Kindamoody@Nightstar-5507a6b5.tbcn.telia.com] has quit [[NS] Quit: brb, reboot!]
17:38
< maoranma>
warning, also be semantically correct in #python, people get grouchy when you say things like array when you mean lists of lists, lol
17:40
<@TheWatcher>
Accuracy is important when discussing programming ¬¬
17:42 * jerith looked around in #python for a while, didn't find it useful at all.
17:43
< gnolagrippe>
They're not using while. They're all about the for.
17:44 * jerith kills gnolagrippe in the face.
17:44
<@jerith>
(But in a nice way.)
17:44
< maoranma>
heh
17:46
< maoranma>
So array basically lists of lists for numbers and matrix functions?
17:47
<@jerith>
Python doesn't have arrays.
17:47 Kindamoody|out [Kindamoody@Nightstar-5507a6b5.tbcn.telia.com] has joined #code
17:47 mode/#code [+o Kindamoody|out] by ChanServ
17:47
<@jerith>
(Although numpy does.)
17:47
<@TheWatcher>
maoranma: Parse failure in sentence.
17:47
< maoranma>
Well, it has packages that makes them don't it?
17:47 Kindamoody|out is now known as Kindamoody
17:47 You're now known as TheWatcher[afk]
17:48
<@jerith>
An array is homogenous. All items in it are of the same type.
17:48
<@jerith>
A list allows you to mix types.
17:48
< maoranma>
Right, but why uses them unless you're using just numbers?
17:49
<@jerith>
Most statically typed languages have arrays.
17:49
< maoranma>
I mean, I can devide a matrix with a list comp right? [int/2 for int in [row for row in listOfLists]]?
17:49
< maoranma>
divide, why do I keep using that second e...
17:51
<@jerith>
I think we're talking in different directions.
17:52
< maoranma>
Perhaps
17:52
<@jerith>
In Java, you can have "int foo[]", which is an array of ints.
17:52
<@jerith>
You can only put ints in there, and everything in there will be an int.
17:53
<@jerith>
Python doesn't have that concept. You get a list, which is an ordered collection of objects.
17:53
< maoranma>
what about array.array?
17:54
< Rhamphoryncus>
Damnit gimp, it's nice to say I can alt-drag a selection, but there's a significant problem with that..
17:54
<@jerith>
I... didn't know about that.
17:55
< maoranma>
You...didn't know about python arrays?
17:55
<@jerith>
No. Never come across them.
17:55
<@jerith>
I've seen numpy arrays, which are different.
17:55
< maoranma>
Oh, hmm
17:56
< maoranma>
Still, I wonder...why use an array of you can use lists? Just making sure that everything is the same type?
17:56
< RichyB>
jerith, packed numerical arrays are in the "array" module in the Python standard library.
17:56
<@jerith>
RichyB: Yeah, maoranma's just pointed me there.
17:56
< RichyB>
maoranma, RAM. Or L1/L2 data cache locality.
17:56
< celticminstrel>
That was just mentioned. :P
17:56
< celticminstrel>
Gah, ninjas. :(
17:57
< maoranma>
RichyB: Oh, processing speed?
17:57
< RichyB>
Just saying they're in the stdlib so you don't need to go looking on pypi. :)
17:57
< maoranma>
celticminstrel: fufufufu
17:57
< celticminstrel>
<_<
17:57
< RichyB>
maoranma, well, kinda.
17:57
< Rhamphoryncus>
Memory. They'd actually be slower.
17:57
< maoranma>
Oh
17:57
<@jerith>
I can see how it might be useful if you're dealing with some kind of binary format.
17:59
<@jerith>
So anyway, just use a list unless you have a good reason not to.
17:59
< RichyB>
Rhamphoryncus, I wouldn't make that statement without carefully benchmarking first.
18:00
<@jerith>
You /can/ have a list containing different kinds of things: [0, 'a', {'foo': 'bar'}, open('/tmp/blah', 'w')]
18:00
< Rhamphoryncus>
Python doesn't have a primitive int type. Accessing an int in the array will require constant packing/unpacking
18:00
<@jerith>
But you don't have to.
18:00
< Rhamphoryncus>
Contrast with numpy which has a collection of operations that operate on the ints directly
18:01
< maoranma>
jerith: that's what I figured, unless I'm doing some kinda crazy number crunching more than a few times, I can't see why I just wouldn't use lists
18:01
<@jerith>
maoranma: See what Rhamphoryncus said.
18:02
<@jerith>
Use lists there too. Or better yet, use numpy.
18:02
< Rhamphoryncus>
There's a reason why nobody pays attention to the stdlib array type
18:02
< maoranma>
jerith: Right, constant unpacking, like in my listcomp example above
18:02
<@jerith>
Different kind of thing.
18:02
< maoranma>
Oh
18:03
<@jerith>
What Rhamphoryncus is talking about is taking a couple of bytes of memory and packing it into a Python object.
18:03
< maoranma>
Ah
18:09 * gnolagrippe begins the de-shovelware process.
18:10
< RichyB>
Rhamphoryncus, you're annoyingly correct, but only in CPython. :)
18:10
< Rhamphoryncus>
heh
18:11
< Rhamphoryncus>
I still forget that pypy is getting mature these days
18:11
< RichyB>
Just benchmarked it at a REPL now. Constructing array.array("i", xrange(1000000)) takes about 1.47 seconds in python2.6 on my laptop, whereas constructing list(xrange(10000000)) takes about 0.36 seconds.
18:12
< maoranma>
Annoying correctness, the worst kind of correctness. It's better to be wrong, apologize now Rhamphoryncus.
18:12
< Rhamphoryncus>
No way, I thrive on annoying correctness :P
18:12
< maoranma>
lol
18:12
< RichyB>
But if I fire up the pypy-1.8 binary, the same code times as 0.177 seconds for array.array, and 2.05 seconds for list.
18:12
< maoranma>
brb, my house is hot as hell
18:12
< RichyB>
Little bit of a regression there but oh well.
18:14
< RichyB>
IMHO, the *good* reasons for the existence of array are twofold: they provide a really good interface on the C-extension side for libraries that want to pass big mutable arrays of numbers through Python, and...
18:14
< RichyB>
...it inspired numpy. :)
18:16
< Rhamphoryncus>
hrm.. Maybe I should do 0.5/1.5/2.5/3.5 radius curves, which let straight tracks do perfect circles, and just pad them slightly to transition to diagonals
18:17
< maoranma>
Tennessee weather: for day in forver:
18:17
< maoranma>
weather = random.choiceOf('Rain','Cold','Hot','Clear','Bacon')
18:19
< Rhamphoryncus>
Hum. The pads would have to be unique to each. Might as well use those end points but have the curve be tweaked to match it
18:23
< Rhamphoryncus>
So I'd have a 0.5x1.5 area to transition 45?, then a 1x3, then a 1.5x3.5 (or possibly also 1x3)
18:24
< maoranma>
Figures, I was hot and the roof was rumbling, then when I open the windows, air stops moving
18:25
<&Derakon>
Rhamph: what are you trying to do?
18:25
< Rhamphoryncus>
come up with a nice set of curved tracks to extend what openttd can do
18:25
<&Derakon>
Ah.
18:26
< Rhamphoryncus>
And refusing to be lazy about it, because I'm nuts
18:26
< maoranma>
Eveytime I think about playing openttd, I get distracted by one of the other 70 games I need to be playing
18:27
<&Derakon>
Well, you could write a spline renderer that laid down track along the curves. :)
18:27
< RichyB>
maoranma, bacon?
18:28
< Rhamphoryncus>
That only works if we switch to floating point and ditch the square tiles ;)
18:28
< RichyB>
<Bill> Hey man, how's the weather? <Ted> Bacon. <Bill> Wha? <Ted> Still bacon.
18:28
< Rhamphoryncus>
Otherwise you're still stuck trying to have a predetermined set of track profiles
18:29
<&Derakon>
Hm, it'd still make prerendering them easier.
18:29 * Derakon eyes one of his scripts, tries to figure out how to handle arguments to it.
18:29
< Rhamphoryncus>
Rendering is the easy part
18:30
<&Derakon>
Current invocation is "python invokeProcessor.py emailAddress invocationFile "file1 file2 ...""
18:30
<&Derakon>
And now I want to have an optional argument that is a suffix string to apply to file1 etc. after they've been processed.
18:32
< RichyB>
getopt
18:32
<&Derakon>
Yeah, that'd involve rewriting the entire arguments passing method, but is probably the right solution. Meh.
18:32
< RichyB>
This is why I usually start with getopt and single options.
18:33
< RichyB>
If I'm writing a script with more than 52 command line options then I'm fucked anyway.
18:33
<&Derakon>
Heh.
18:33
< RichyB>
-i input -o output -y u_no_use_long_names
18:33
< RichyB>
--too-lazy-to-write-them-out
18:34
<&Derakon>
This script is only called by other scripts, I should note.
18:34
<&Derakon>
Which is why I didn't bother providing flagged options in the first place.
18:34
<&Derakon>
None of the arguments were optional and nobody had to remember the appropriate way to call them.
18:34
< RichyB>
Oh, easy solution. Make the suffix nonoptional.
18:35
< RichyB>
And supply an empty suffix parameter if you don't want it.
18:35
<&Derakon>
Hm, I guess '' is a valid empty argument.
18:35
< RichyB>
Yes. Works perfectly in Bourne shells.
18:36
< RichyB>
python -c "import sys; print repr(sys.argv)" '' foo bar # prints ['-c', '', 'foo', 'bar']
18:37
< RichyB>
The '' gets passed along perfectly correctly by shells and Popen.
18:46
<&Derakon>
Oh hey, today's 1/2 Tau Day.
18:48
< maoranma>
Yea, see you June 28th.
18:50
< maoranma>
Of course, we missed the best Pi day, back in 1592
18:51
<&Derakon>
There's also the 22nd of July.
18:51
< maoranma>
I guess in 845 years we can celebrate that day
18:52
< maoranma>
afk for a while
19:03 Kindamoody is now known as Kindamoody[zZz]
19:10 celticminstrel [celticminst@Nightstar-5d22ab1d.cable.rogers.com] has quit [Client exited]
19:17 celticminstrel [celticminst@Nightstar-5d22ab1d.cable.rogers.com] has joined #code
19:22
< Rhamphoryncus>
Okay, new plan. 45? arcs with a rise of 0.75/1.25/1.75/2.25, so you can pair them up for a smooth straight-to-straight curve, or have a tiny (but reused) pad at the end to be diagonals. True circles are not supported.
19:23
< Rhamphoryncus>
So 90? is perfect, 180? or 360? is not.
19:26
< Rhamphoryncus>
the 0.75 is basically that simple one Vornicus suggested, but extended an extra quarter tile to hit the midpoint of the turn
19:27
< Tarinaky>
I thought '//' was supposed to always return an int in Python?
19:27
< Rhamphoryncus>
yes, why?
19:28
< Tarinaky>
TypeError: range() integer end argument expected, got float.
19:30
< Rhamphoryncus>
Ahhh, it's actually floordiv
19:30
< Tarinaky>
Ah. Apparently it returns a float.
19:30
< Tarinaky>
That's... a little silly.
19:30
< Rhamphoryncus>
So it's an integral value but not necessarily int type
19:32
< Tarinaky>
How do I make it an int?
19:32
<@jerith>
int()
19:32
< RichyB>
Call int() on it.
19:36
< Tarinaky>
Cheers.
19:37
< Rhamphoryncus>
Hum. So I can call my ratio 2.4:1. <1% off, good enough
19:37
< Tarinaky>
btw, https://github.com/edu
19:38
< RichyB>
Dammit. The Hell will no one sell me a pre-built desktop without Windows on it.
19:39
<@jerith>
RichyB: Because the OEM licence thing strongly discourages them from doing it.
19:40
< Rhamphoryncus>
Hum. Oops, I wanted 2.333:1. ~3% error.
20:02
< Tarinaky>
Zooming is really, really, hard.
20:23
< Tarinaky>
I wish my solution for handling keyboard events looked less... cthonic :/
20:23
<&McMartin>
RichyB: ISTR Dell having an ubuntu line?
20:23
<@jerith>
Dell. ;_;
20:24 * Vornicus returns from a trip from the store that turned into a walk down the local bike/pedestrian trail
20:24
< RichyB>
McMartin, only for about fifteen minutes.
20:25
< RichyB>
IIRC it actually lasted less than six months?
20:25
< RichyB>
I tried prodding one of their sales reps and I now have a quote in my inbox for desktop machines priced higher than the ones with the Microsoft Tax preinstalled.
20:30
< Tarinaky>
Heh.
20:31
< gnolagrippe>
Dear Mozilla: fuck you. Regards: your users.
20:31 himi [fow035@Nightstar-5d05bada.internode.on.net] has joined #code
20:31 mode/#code [+o himi] by ChanServ
20:31
<@jerith>
gnolagrippe: Howso?
20:32
< gnolagrippe>
Right now? The inability to disable crash reporting.
20:32
<&Derakon>
They're pushing version 87 on him~
20:32 * jerith has switched to Aurora and is much happier.
20:33
<&Derakon>
(I do find it irritating how 5-10 minutes after starting the browser, it'll throw up a dialog in your face prompting you to upgrade and your only options are "upgrade now" or "upgrade later")
20:33
<@jerith>
Experimental, but it has much better memory management.
20:33
<@jerith>
Also much more frequent updates.
20:33
<&Derakon>
Yeah, see, I don't %Bwant%B frequent updates from my browser.
20:33
<&Derakon>
Er, want
20:33
<@jerith>
Derakon: Chrome doesn't even ask you. It just goes ahead and does it.
20:34
< RichyB>
jerith, Mozilla are apparently planning to start rolling an equivalent in FF13. Should hopefully start to cut down the number of people who *notice* that FF's version number is incrementing. :)
20:34
< RichyB>
Aurora sounds silly, though.
20:34 * Derakon googles.
20:34
<&Derakon>
Aurora = Firefox beta?
20:34
< RichyB>
Yes.
20:35
< RichyB>
If you're going to run unstable software anyway, go full retard and run nightlies.
20:35
< RichyB>
It's what I do. ;)
20:35
<&Derakon>
Heh.
20:35
<@jerith>
RichyB: And will they pay my 3G bill (at about US$0.20/mb) for updating at an inappropriate time?
20:35
<&Derakon>
Cripes.
20:35
< RichyB>
No.
20:37
<@jerith>
It's actually closer to US$0.25/mb.
20:41
<&Derakon>
At that rate, maybe you should run the browser on a machine somewhere with a more lenient data policy and VPN in to use it~
20:42
<@jerith>
Derakon: This is when I'm sitting in a coffee shop and using my phone as a wifi bridge.
20:43
<@jerith>
I want to use IRC and look at the occasion website.
20:43
<@jerith>
I *don't* want tens of megs being pulled down the network without my permission.
20:43
<&Derakon>
Yeah, I was not being entirely serious.
20:44
<&Derakon>
Seems like firewall software ought to be able to separate out that kind of behavior.
20:44
<&Derakon>
But I guess the same program that needs network access to load websites needs apparently-identical network access to download updates.
20:45
<@jerith>
Quite.
20:46
< Tarinaky>
Well, it's only going to be http or maybe ftp.
20:47
< Tarinaky>
So, yeah... that's kinda difficult to tell apart without blacklisting addresses.
20:47
< Tarinaky>
You could do that though.
20:47
< Tarinaky>
Blacklist firefox's servers by dns.
20:47
<@jerith>
Chrome's.
20:48
<@jerith>
Firefox asks if it can update.
20:48
< Tarinaky>
Ah. Yes.
20:57 himi [fow035@Nightstar-5d05bada.internode.on.net] has quit [Operation timed out]
20:57
< Tarinaky>
Does anyone have a good RGB value for a stellar blue?
20:58
< Tarinaky>
0,0,255 looks a bit 'off'.
21:01
<&McMartin>
Stellar blue should have more white in it
21:01
<&McMartin>
Try 128, 128, 192
21:02
< Tarinaky>
Looks a bit dull and gray.
21:03
< Tarinaky>
http://imgur.com/FmrqC << Current state of my game.
21:03
< Tarinaky>
More or less back where I was in terms of progress.
21:03
<~Vornicus>
128,128,256
21:03
<~Vornicus>
And fiddle it in HSL instead of RGB, it makes more direct sense that way.
21:04
< Tarinaky>
I'm not sure pygame supports HSL
21:04
< gnolagrippe>
Vornicus: ... 255?
21:04
< Tarinaky>
He turned the blue channel up to 256.
21:04
< Tarinaky>
It's one more than 255 :)
21:05
< gnolagrippe>
Tarinaky: fire up something like Inkscape. Give yourself a black background. Put a few filled circles in. Experiment with the values.
21:05
< Tarinaky>
That sounds like too much of a distraction from actually making this work >.>
21:06
<~Vornicus>
Tarinaky: that's all right, the HSL to RGB conversions are relatively straightforward.
21:07 * Tarinaky goes try to implement a scroll bar.
21:08
< RichyB>
Fun stuff: http://www.sitepoint.com/how-to-disable-google-chrome-updates/
21:08
< RichyB>
You can of course *ask* Chrome to not auto-update.
21:08 Derakon [chriswei@Nightstar-a3b183ae.ca.comcast.net] has quit [[NS] Quit: Lost terminal]
21:10
<@jerith>
RichyB: I don't want to turn the updates off completely.
21:11
<@jerith>
I just want to be able to say "not now, this pipe is expensive".
21:11
< RichyB>
TBH, I'd rather just use a repo and not have to worry about it.
21:11
<@jerith>
Me too.
21:11
<@jerith>
But Mac OS.
21:11
< RichyB>
Click the "update packages" button in Ubuntu, or "yum list updates" or whatever once every now and then, and install them all when I'm somewhere with cheap bandwidth.
21:49 * Vornicus pokes vaguely at drawing commands.
22:13 * Tarinaky derps.
22:14
< Tarinaky>
I can't figure out what position to jump to if the user clicks on part of the scrollbar.
22:14
< Tarinaky>
It took me mounds of post-it notes just to get it clear in my head how to draw the damned thing.
22:15
<@jerith>
Why not scroll a screen at a time?
22:15
<@jerith>
That's easy to do.
22:17
< Tarinaky>
Akk... Doesn't draw right.
22:18
< Tarinaky>
Only draws right if the scale is a particular value. Zooming in/out breaks it.
22:19
< Tarinaky>
Because scrolling a screen at a time is very, very, rarely ever actually useful.
22:29 gnolagrippe [lenin@Nightstar-202a5047.priv.bahnhof.se] has quit [[NS] Quit: IRC client testing]
22:30 Eri [Eri@Nightstar-3e5deec3.gv.shawcable.net] has quit [Ping timeout: 121 seconds]
22:37
<~Vornicus>
Once again I find myself somewhat annoyed that I don't have the graphics chops to just make it happen.
22:40
< Tarinaky>
Okay. So the width of a block is the width of the bar / the total length the bar 'represents'
22:40
< Tarinaky>
The position of that block relates to your position in space by:
22:41 gnolam [quassel@Nightstar-202a5047.priv.bahnhof.se] has joined #code
22:41
< Tarinaky>
Fuck
22:41 gnolam [quassel@Nightstar-202a5047.priv.bahnhof.se] has quit [[NS] Quit: More testing]
22:42 gnolam [quassel@Nightstar-202a5047.priv.bahnhof.se] has joined #code
22:42
< Tarinaky>
Okay. So the position in the grid / width of the grid?
22:42
< Tarinaky>
multiplied by the width of the bar right?
22:44 himi [fow035@D741F1.243F35.CADC30.81D435] has joined #code
22:44 mode/#code [+o himi] by ChanServ
22:44
<@jerith>
Take the position along the bar, scale it to the width of the field, center that location.
22:46
< Rhamphoryncus>
Behold, my insanity! http://i.imgur.com/kem6x.png
22:46
< Tarinaky>
Argh. I don't think I even have the right size for the block.
22:49
< Rhamphoryncus>
The curves for road and rail aren't the same. The best fix for that.. would be diagonal proportions (4 road lanes for 3 rails) and applying it to the straights as well
22:50
< Rhamphoryncus>
Unfortunately that'd also be much harder to get support for. Not that I expect support for this anyway. :P
22:52
<~Vornicus>
Goodness.
22:52
< Rhamphoryncus>
Is that good or bad? ;)
22:52 gnolam [quassel@Nightstar-202a5047.priv.bahnhof.se] has quit [[NS] Quit: Z?]
22:52 gnolam [lenin@Nightstar-202a5047.priv.bahnhof.se] has joined #code
22:53 Attilla_ [Obsolete@Nightstar-7d4a92bc.as43234.net] has joined #code
22:53
<~Vornicus>
It's quite a mess.
22:53 * Vornicus gets a ridiculously stupid idea
22:54
< Rhamphoryncus>
The art or the profiles?
22:55
<~Vornicus>
The art, and how it crashes into itself a lot.
22:55 Attilla [Obsolete@Nightstar-bf2c7dd7.threembb.co.uk] has quit [Ping timeout: 121 seconds]
22:55
< Rhamphoryncus>
It's a half-assed job
22:55 Attilla_ is now known as Attilla
22:56
< Rhamphoryncus>
Since I couldn't figure out how to get gimp to do a curve for me
22:56
< Rhamphoryncus>
That's all rotate by X degrees, manually position, repeat
22:57
<~Vornicus>
Shit shit shit shit shit the stupid idea is not going away
22:57
< Rhamphoryncus>
uh oh :)
22:57
<~Vornicus>
So, so, so
22:58 You're now known as TheWatcher
22:58
<~Vornicus>
Recently jerith and I have been independently poking at the depixel algorithm.
22:58
< Rhamphoryncus>
depixel algorithm?
22:58
< Tarinaky>
Fuck. Why am I finding this so hard :/
22:58
<@jerith>
DEPIXEL IDEA!!! \o/
22:58
<@jerith>
Rhamphoryncus: github.com/jerith/depixel
22:58
< Rhamphoryncus>
Is that vectorizing of pixel art?
22:58
< Rhamphoryncus>
Got a real URI? ;)
22:59
<@jerith>
Rhamphoryncus: http://github.com/jerith/depixel
22:59
< Rhamphoryncus>
thanks hehe
22:59
<~Vornicus>
So here I am staring at... curves. We've got train lines, they "curve" but they don't - they're straight corners.
22:59
<~Vornicus>
And that's not how real train lines look, now is it.
22:59
< Rhamphoryncus>
Ahh, I've seen that algorithm before
23:00
<~Vornicus>
Solution: B splines to the rescue!
23:00
< Rhamphoryncus>
Sure, I want a spline for this
23:00
< Rhamphoryncus>
The relationship has been figured out but the exact positions should be done properly
23:01
<~Vornicus>
And then we have to reknot stuff so that it matches up nicely and while we're there make sure that the train lines actually head to the end of the line as opposed to doing, you know. Ridiculous stuff.
23:01
< Rhamphoryncus>
And how the heck does MS manage to break the img tags o.O
23:02
< Rhamphoryncus>
end of the line?
23:03
<~Vornicus>
B-splines aren't technically valid all the way to the end of their points/knots
23:03
< Rhamphoryncus>
huh
23:04
<~Vornicus>
THough I guess just clamping would work.
23:04
<~Vornicus>
I've been doing too much math on it and not nearly enough applications
23:06
<~Vornicus>
And then trying to figure out what pathing goes like... that'd be another sack of potatoes.
23:09
<~Vornicus>
And putting in proper 3d -- which is what you'd need if you're going to do this -- in ottd is as far as I can tell an exercise in complete insanity.
23:11
< Rhamphoryncus>
I'm not doing proper 3d. Not at all needed for what I'm doing
23:15
< Tarinaky>
Okay. WTF-ery is this?
23:15
< Tarinaky>
self.width - (self.max-self.width) * self.width / self.max
23:16
< Tarinaky>
Does this not simplify to self.width / self.max?
23:17
<~Vornicus>
w - (m-w)*w / m = (w^2 + mw) / m - w
23:17
< Tarinaky>
No, wait... No.
23:17
< Rhamphoryncus>
What language?
23:17
< Tarinaky>
I'd say python, but it doesn't -really- matter does it?
23:17
< Namegduf>
It's WTF.
23:17
< Rhamphoryncus>
Well in C that'd be truncate division and it reminds me of tricks to make C do ceiling division
23:18
< Namegduf>
It is also truncate division in Python 2.x.
23:18
< Tarinaky>
Since 1 is the width of a pixel we can ignore rounding errors.
23:20
< Rhamphoryncus>
I use from __future__ import division in 2.x
23:20
< Namegduf>
Crazy.
23:20
< Namegduf>
For things which are a number of tens
23:21
< Namegduf>
It converts them into the square of the tens digit
23:21
< Namegduf>
That code turns 60 into 36
23:21
< Namegduf>
80 into 64
23:21
< Namegduf>
100 into 100
23:21
< Namegduf>
Or it does with a max of 100, anyway.
23:21
< Rhamphoryncus>
I did some refactoring similar to that yesterday. I added a simplified version and an assertion that the two were the same, then ran it with that
23:21
< Tarinaky>
That's the code that seems to make the scrollbar draw right.
23:21
< Namegduf>
I have no idea what it could be for.
23:22
< Tarinaky>
Max is the width of the canvas. Width is the width of the display area.
23:22
< Namegduf>
Aha.
23:22
< Namegduf>
So... it's calculating some number to do with that?
23:22
< Tarinaky>
Well, actually... that's the width of the 'block' that shows you where you are now.
23:23
< Namegduf>
Some percentage which increases as width increases.
23:23
< Namegduf>
Aha.
23:23
< Rhamphoryncus>
The scroll handle
23:23
< Tarinaky>
Yeah.
23:23
< Rhamphoryncus>
Anything that complicated is a WTF by default
23:24
< Namegduf>
Yeah.
23:25
< Namegduf>
So lesse. It takes the percentage width that the bar should represent...
23:25
< Namegduf>
And...
23:25
< Namegduf>
I don't really understand why it isn't width * width / max, but there must be some reason.
23:26
< Rhamphoryncus>
So if you had max of 100 and width of 10 it'd be 10-(100-10)*10/100.. 10-90/10.. 10-9.. hum
23:26 * Tarinaky goes commit before he breaks it.
23:26
< Tarinaky>
I'm going to be honest. I have no recollection of how I came up with that formula now.
23:27
< Tarinaky>
But it did involve ~3 hours of swearing and a mountain of illegible postits
23:27
< Rhamphoryncus>
If you had 100 and 50 it'd be.. 7.5
23:27
< Rhamphoryncus>
What's it actually doing?
23:28
< Tarinaky>
iirc, I took self.value * self.width / self.max to convert the position of the view onto the canvas into the position of the handle.
23:28
< Tarinaky>
Then I worked out that however much was to the left of that needed to be blue :/
23:29
< Tarinaky>
When it was in the far right position
23:29
< Tarinaky>
Err, everything to the right of it needed to be blue
23:29
< Tarinaky>
Can't brain now.
23:29
< Rhamphoryncus>
It doesn't sound like it should be complicated. Subtract the size of the handle, then scale.
23:30
< Tarinaky>
idk
23:30
< Tarinaky>
It works.
23:30
< Tarinaky>
And it took me 3 hours to make it work.
23:30
< Tarinaky>
Not touching it.
23:30
< Tarinaky>
It's obviously beyond my ken :
23:30
< Tarinaky>
*:p
23:31
< Namegduf>
Yeah, I'm thinking your postits may have invoked the horrorterrors that dwell outside reality there.
23:31
< Namegduf>
Got to be careful with illegibility.
23:32
< Tarinaky>
If they're illegible they can't drive anyone mad.
23:32
< Tarinaky>
Duh.
23:32
<@TheWatcher>
HAhaha, you fool ¬¬
23:32
< Namegduf>
You've obviously never tried to decipher illegible text.
23:32
< Namegduf>
It very much can drive you mad.
23:32
< Namegduf>
Meaning anything and everything at once.
23:32
<@TheWatcher>
And nothing
23:33
< Namegduf>
And nothing.
23:33
<@TheWatcher>
Especially the nothing.
23:33
< Tarinaky>
https://github.com/Tarinaky/DuelFieldStars/blob/master/duelfieldstars/scrollbars .py << Here's the class for the curious.
23:33
< Tarinaky>
Err, hang on
23:33
< Tarinaky>
Forgot to push
23:34
< Tarinaky>
Okay, now works.
23:34 gruber [lenin@Nightstar-202a5047.priv.bahnhof.se] has joined #code
23:34
< Rhamphoryncus>
Nothing beats the agony of figuring out how insanely stupid and simple a complicated piece of code could be reduced to
23:34
< Rhamphoryncus>
Particularly if it was written by someone else and you can't fix it :P
23:34
< Namegduf>
Okay.
23:35
< Namegduf>
So this is width * width / max, which is what I'd have expected, width times the ratio
23:35
< Namegduf>
But there's this extra subtraction in the middle
23:35 gruber [lenin@Nightstar-202a5047.priv.bahnhof.se] has quit [[NS] Quit: Enough testing for one day]
23:35
< Namegduf>
Actually, nevermind.
23:35
< Rhamphoryncus>
jump isn't subtracting the size of the handle
23:36
< Tarinaky>
I know.
23:36
< Namegduf>
Wait a sec.
23:36
< Namegduf>
Are you sure that code isn't *equivalent* to width * width / max?
23:36
< Namegduf>
You're calculating the size of the block to represent the *rest* of the area
23:37
< Namegduf>
Then subtracting it from the total width of the bar
23:37
< Namegduf>
Leaving the block to represent the current area
23:37
< Namegduf>
That's what it does.
23:37
< Namegduf>
I think.
23:38
< Tarinaky>
it is indeed.
23:41
< Tarinaky>
I'm now deducting blockWidth from jump. It doesn't appear to be working as expected though.
23:41 * Vornicus tries the math again.
23:41
< Tarinaky>
The block is... off center after the jump.
23:42
<~Vornicus>
w - (m-w)*w / m = w - (mw - w^2) / m = w - mw/m + w^2/m = w - w + ww/m = w^2/m
23:45
<~Vornicus>
which should have been obvious but apparently I shouldn't be near math today.
23:45 cpux|2 is now known as cpux
23:57 gnolam [lenin@Nightstar-202a5047.priv.bahnhof.se] has quit [Connection closed]
--- Log closed Thu Mar 15 00:00:11 2012
code logs -> 2012 -> Wed, 14 Mar 2012< code.20120313.log - code.20120315.log >

[ Latest log file ]