code logs -> 2012 -> Tue, 13 Mar 2012< code.20120312.log - code.20120314.log >
--- Log opened Tue Mar 13 00:00:39 2012
00:39 Serah [Z@Nightstar-5aa18eaf.balk.dk] has quit [Ping timeout: 121 seconds]
00:45 eckse_ [eckse@Nightstar-dc757741.dsl.sentex.ca] has joined #code
00:47
<~Vornicus>
Why I like math: yes, technically, I could write a formula for each of triangular, square, pentagonal, etc numbers, and then another one to invert that operation for each... but I could alternatively just write two formulas total, so I can just tell it how many sides I want it to have and it'll figure out the rest.
00:48 eckse [eckse@Nightstar-7409157e.dsl.sentex.ca] has quit [Ping timeout: 121 seconds]
00:50 eckse [eckse@Nightstar-62f2991d.dsl.sentex.ca] has joined #code
00:50 mode/#code [+o eckse] by ChanServ
00:52 Attilla_ [Obsolete@Nightstar-e908bc76.threembb.co.uk] has joined #code
00:53 Attilla [Obsolete@Nightstar-4a575f9d.as43234.net] has quit [Ping timeout: 121 seconds]
00:53 eckse_ [eckse@Nightstar-dc757741.dsl.sentex.ca] has quit [Ping timeout: 121 seconds]
01:02 Attilla_ is now known as Attilla
01:02 eckse_ [eckse@Nightstar-20eeace8.dsl.sentex.ca] has joined #code
01:05 eckse [eckse@Nightstar-62f2991d.dsl.sentex.ca] has quit [Ping timeout: 121 seconds]
01:12 Stalker [Z@Nightstar-3602cf5a.cust.comxnet.dk] has joined #code
01:19 cpux|2 [cpux@Nightstar-c5874a39.dyn.optonline.net] has joined #code
01:22 cpux [cpux@Nightstar-c5874a39.dyn.optonline.net] has quit [Ping timeout: 121 seconds]
02:04 Kindamoody[zZz] is now known as Kindamoody
02:26 Attilla [Obsolete@Nightstar-e908bc76.threembb.co.uk] has quit [Ping timeout: 121 seconds]
02:40 Stalker [Z@Nightstar-3602cf5a.cust.comxnet.dk] has quit [Ping timeout: 121 seconds]
02:57
< maoranma>
Vornicus: is that math or progamming?
02:57
< maoranma>
programming even
03:04
<@Alek>
boiling down multiple equations into one, or combinations of equations into one, is fun!
03:05
< maoranma>
And ultimately that's what the theory of everything is supposed to be
03:25
<&Derakon>
Programming is math.
03:25
<&Derakon>
See also http://www.schlockmercenary.com/
03:48 Syloqs-AFH [Syloq@NetworkAdministrator.Nightstar.Net] has quit [Client closed the connection]
03:49
<~Vornicus>
Well, it's mathy programming
03:50
<~Vornicus>
Both functions I just wrote are one-liners.
03:52
<~Vornicus>
figurates = [[figurate(x,s) for x in range(int(defigurate(1000,s)) + 1, int(defigurate(10000,s)) + 1) if figurate(x,s) % 100 > 9] for s in range(3, 9)]
03:52
<~Vornicus>
And then to prove that I really should learn a functional language, I wrote that.
03:53
<&McMartin>
Woo Haskell
03:53
<&McMartin>
Or learn Racket, just for #code diversity
03:54
< maoranma>
quit that, random code showing up in my bot makes me thing something broke in it
03:55
<~Vornicus>
Live with it, this is #code
03:56 Syloqs_AFH [Syloq@NetworkAdministrator.Nightstar.Net] has joined #code
03:56 mode/#code [+o Syloqs_AFH] by ChanServ
03:57 Syloqs_AFH is now known as Syloqs-AFH
03:58
< maoranma>
Well, I was staring at it for a minute trying to figure out what I would write something like that
04:00 Noah{OYOYO} [Noah{OYOYO}@Nightstar-18ea8aaa.pools.spcsdns.net] has quit [Connection closed]
04:00 Noah{OYOYO} [Noah{OYOYO}@Nightstar-18ea8aaa.pools.spcsdns.net] has joined #code
04:01
< maoranma>
There, maybe improve the readability of the output
04:32 eckse_ is now known as eckse
05:04
<~Vornicus>
How to know you're doing a little too much indexing: your line ends ]]]])
05:04
<&Derakon>
Maybe you're doing too many list comprehensions instead.
05:07
<~Vornicus>
indices.append([0,steps[p[len(indices) - 2]][indices[-1][1][indices[-1][0]]]]) nope. it's indexing. I'm not actually sure whether it's right.
05:07
<~Vornicus>
(also listcomps don't all end together like that. they start together.)
05:08
<&Derakon>
Mm, point.
05:08
<~Vornicus>
(unless you're doing something spectacularly untoward with mapping.)
05:10 eckse_ [eckse@Nightstar-717c7ec2.dsl.sentex.ca] has joined #code
05:11 eckse_ [eckse@Nightstar-717c7ec2.dsl.sentex.ca] has quit [Connection reset by peer]
05:13 eckse [eckse@Nightstar-20eeace8.dsl.sentex.ca] has quit [Ping timeout: 121 seconds]
05:16
< Eri>
There's no such thing as too much indexing
05:16
< Eri>
Look at the optimization
05:16 Syloqs-AFH [Syloq@NetworkAdministrator.Nightstar.Net] has quit [Ping timeout: 121 seconds]
05:16
< Eri>
If I could make a program that was exclusively moving around in a huge indexed array based on the user's input, I would.
05:17
<@ToxicFrog>
This is what Von Neumann programs are once you get down to the machine code level~
05:17
< Eri>
Yeah, I was actually about to say that
05:18
<@ToxicFrog>
Personally I like my layers of abstraction.
05:18
<~Vornicus>
mmmm, abstraction
05:18
< Eri>
I bet you also like high level languages like C or Pascal, you cheater
05:18
<@ToxicFrog>
Those aren't HLLs.
05:19
< Eri>
I was kind of making a joke
05:19
<@ToxicFrog>
(lexical closures and tail call optimization or GTFO~)
05:19
< Eri>
About how they're high compared assembly
05:19 * Vornicus has just set up this code that looks like it builds a giant lookup table but there's like 200 entries in the whole table.
05:20
<&Derakon>
Heh.
05:20
<&Derakon>
Just hard-code all the entries then~
05:21 Syloqs_AFH [Syloq@NetworkAdministrator.Nightstar.Net] has joined #code
05:21 mode/#code [+o Syloqs_AFH] by ChanServ
05:21 Derakon is now known as Derakon[AFK]
05:22 Syloqs_AFH is now known as Syloqs-AFH
05:38 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:39 Kindamoody is now known as Kindamoody|noms
05:42 Vash [Vash@Nightstar-cdeba41f.wlfrct.sbcglobal.net] has quit [[NS] Quit: I lovecraft Vorn!]
05:50 Rhamphoryncus [rhamph@Nightstar-5697f7e2.abhsia.telus.net] has joined #code
06:13 Kindamoody|noms is now known as Kindamoody
06:13 himi [fow035@D741F1.243F35.CADC30.81D435] has quit [Ping timeout: 121 seconds]
06:27 Kindamoody is now known as Kindamoody|out
06:49 Stalker [Z@Nightstar-3602cf5a.cust.comxnet.dk] has joined #code
07:00 Syloqs-AFH [Syloq@NetworkAdministrator.Nightstar.Net] has quit [Client closed the connection]
07:01
< Rhamphoryncus>
mmmm gprof
07:02
< Rhamphoryncus>
Interestingly, the first couple lines matched what perf was telling me, implying perf was sane and I just didn't know how to get the right info out of it
07:03
< Rhamphoryncus>
and for those wondering what I'm looking for, here's a clipping from the callgraph of gprof using a particularly intensive game at normal zoom level:
07:03
< Rhamphoryncus>
[2] 94.5 0.00 23.68 1 VideoDriver_SDL::MainLoop() [2]
07:03
< Rhamphoryncus>
0.00 15.24 1305/1305 GameLoop() [3]
07:03
< Rhamphoryncus>
0.00 8.43 1305/1305 UpdateWindows() [7]
07:04
< Rhamphoryncus>
and the same game, ran for the same in-game time period, but zoomed out all the way:
07:04
< Rhamphoryncus>
[2] 97.4 0.00 135.82 1 VideoDriver_SDL::MainLoop() [2]
07:04
< Rhamphoryncus>
0.00 117.64 1279/1279 UpdateWindows() [3]
07:04
< Rhamphoryncus>
0.00 18.16 1279/1279 GameLoop() [16]
07:17
<@ToxicFrog>
Oh god fuck java.io forever
07:17
<@ToxicFrog>
Why would someone ever create this
07:24
< Rhamphoryncus>
heh
07:27
<@ToxicFrog>
The answer to "what class do I need to write to a file with platform-appropriate newlines" is PrintStream, incidentally
07:29
<@ToxicFrog>
Not PrintWriter, FileStream, FileWriter, OutputStream, or any other permutation of {Print,File,Filter,Buffered}{Writer,OutputStream}
07:32
< Rhamphoryncus>
heh
07:33
< Rhamphoryncus>
Does java have a set of interfaces covering all the mathematical properties of different number types? Or does it not bother because it's C?
07:39
< Rhamphoryncus>
Blast. The profile has let me to the entirely unsurprising answer: zoomed out is slow because it's drawing way, way more.
07:44
< Rhamphoryncus>
wait.. I wonder if the dirty rects themselves are wrong
07:46
< Rhamphoryncus>
There's some graphical glitches causing some large newgrf to not draw properly (parts disappear and reappear), but that happens several times a second, and there's nothing moving there
07:49 * TheWatcher readsup
07:49
<@TheWatcher>
Ah, Java.
07:51 You're now known as TheWatcher[afk]
08:11
<@ToxicFrog>
Rhamphoryncus: probably. Unlike file io, Scala provides its own types for numbers and I just use those.
08:12
<@ToxicFrog>
The main thing I remember about numbers in Java is that they're the most obvious place where java's schizophrenic approach to typing causes problems.
08:12
< Rhamphoryncus>
ToxicFrog: I shall proceed to laugh at it then. Ha Ha.
09:30
<&McMartin>
TF: There have been some limited attempts in recent versions to make it better, but it is still terrible
09:31 Attilla [Obsolete@Nightstar-4a575f9d.as43234.net] has joined #code
09:31
<&McMartin>
Fully transparent boxing/unboxing of primitive types, an equivalent to try/finally that doesn't have completely broken scoping, and working method pointers are the three big reasons C# is a better language than Java.
09:31
<&McMartin>
And the CLR is the one big reason it will never, ever be as widespread. =(
09:34
< Rhamphoryncus>
The patent threats from MS's greedy fingerprints don't help either
09:40
<&McMartin>
Quite
09:40
<&McMartin>
Though the core ECMA stuff should be safe, nobody but the GNOME guys uses it
09:40
<&McMartin>
And they're insane
09:40
<&McMartin>
Also Zachtronics Industries, I guess
09:40
<&McMartin>
But *he's* insane, and he shared the madness with us
09:49
< Rhamphoryncus>
ECMA has MS's greedy fingerprints all over it too. Not as bad as direct MS, but it's still there.
10:20 RichyB [MyCatVerbs@Nightstar-3b2c2db2.bethere.co.uk] has joined #code
10:20 RichyB [MyCatVerbs@Nightstar-3b2c2db2.bethere.co.uk] has quit [[NS] Quit: Leaving]
10:21 RichyB [MyCatVerbs@Nightstar-3b2c2db2.bethere.co.uk] has joined #code
10:31 You're now known as TheWatcher
11:58
< ShellNinja>
So, how easily can one use compressed image formats in SDL? I'm talking about GIF, JPG, PNG and so on.
12:01
< gnolam>
Easily.
12:01
< gnolam>
Using SDL_image.
12:02
<@TheWatcher>
And if you need to save them, http://git.starforge.co.uk/?p=SDL_imagesave/.git;a=summary
12:03
<@TheWatcher>
(jpeg and png only with that, but adding extra formats should be easy enough)
12:03
< gnolam>
(Install SDL_Image. Initialize it with IMG_Init(enums of compressed formats you are planning to use). Then load images with IMG_Load().)
12:04
< ShellNinja>
After loading, I can use them the normal way, with SDL_Surface and stuff?
12:04
<@TheWatcher>
Yep
12:05
< gnolam>
IMG_Load() returns an SDL_Surface *.
12:05
< ShellNinja>
Cool.
12:05
< gnolam>
It's simply a drop-in replacement for SDL's built-in BMP loading.
12:06
< ShellNinja>
Hmm. SDL_Image appears to be installed. Do I need the -dev?
12:06
< gnolam>
Yes.
12:07
< gnolam>
The non-dev versions are simply the shared libraries, without any headers.
12:07
<@TheWatcher>
-dev packages include headers and other stuff you need to actually compile code that uses a library
12:08
< ShellNinja>
Cool. That's one mystery solved. :P
12:14
<@TheWatcher>
Gah, wretched daystar making it hard to see my screens.
12:55
< Rhamphoryncus>
damn schroedingbugs
12:56
< Rhamphoryncus>
Made a hack to help diagnose rendering behaviour. Had it working fine. Decided that before I tweak it more I should refactor it into its own function and make it less hacky. Stopped working. Used ctrl-z in the editor. Old version no longer worked.
12:58
<@TheWatcher>
Fun.
13:09
< Rhamphoryncus>
hrm. Yup, everything I'm doing is pretty clearly wrong
13:10
< Rhamphoryncus>
My intent is to take the dirty rects and draw a coloured rectangle over them, changing the colour each time, thus showing what's been redrawn
13:10
< Rhamphoryncus>
However, my 0,0 coordinate seems to be the top *middle* of the *map*.
13:10
< Rhamphoryncus>
And when I created a viewport, rather than drawing the box in the viewport, it draws off to the right somewhere
13:12
< Rhamphoryncus>
More fun: the rectangles only show up if I hit redraw or the game updates an area. However, if I move the viewport without doing this, then move the mouse, the mouse cursor "paints" in the updated spots
13:21
< Rhamphoryncus>
Okay, fixed the coordinates
13:21
< Rhamphoryncus>
it still crashes if I zoom out though
13:29
< Rhamphoryncus>
aaand fixed the crash :D
13:55
< Rhamphoryncus>
aaaaugh god damnit gimp. Convert an image down to one palette: colours are right, but the palette itself is reversed. Undo and do again with a palette that's already reversed: the net result is STILL reversed.
13:58
< Tarinaky>
Rhamphoryncus: Know the feeling. My issues with PySide only occur in situ, not in a test case :/
14:02 Attilla_ [Obsolete@Nightstar-7d4a92bc.as43234.net] has joined #code
14:03 Attilla [Obsolete@Nightstar-4a575f9d.as43234.net] has quit [Ping timeout: 121 seconds]
14:08 Syloqs_AFH [Syloq@NetworkAdministrator.Nightstar.Net] has joined #code
14:08 mode/#code [+o Syloqs_AFH] by ChanServ
14:09 Syloqs_AFH is now known as Syloqs-AFH
14:12
< Rhamphoryncus>
What the heck.. this time the palette double-reversed properly.
14:22
< Rhamphoryncus>
and it turns out my rotation of 16 colours is even worse than I had before
14:31 Attilla [Obsolete@Nightstar-7d4a92bc.as43234.net] has joined #code
14:32 Attilla_ [Obsolete@Nightstar-7d4a92bc.as43234.net] has quit [Ping timeout: 121 seconds]
14:40 You're now known as TheWatcher[afk]
15:15
< Rhamphoryncus>
I need a set of bright, high contrast, rapidly flashing colours that DON'T cause seizures x_x
15:22
<~Vornicus>
YOu pretty much defined seizure-causing colors
15:24
<~Vornicus>
w3 says things should not flash more than 3 times a second
15:25 Vash [Vash@Nightstar-cdeba41f.wlfrct.sbcglobal.net] has joined #code
15:25 mode/#code [+o Vash] by ChanServ
15:26
< gnolam>
Ze flashing knobs!
15:51
< RichyB>
Rhamphoryncus, frequency matters as much as anything else
15:51
< RichyB>
AIUI, above ~30Hz or below ~2Hz you don't get seizures.
15:52
< Rhamphoryncus>
rendering is at 33Hz
15:52
< Rhamphoryncus>
But it may go slower (or faster if you use fast forward), and it's only doing a portion each time
15:52
< RichyB>
Epilepsy issues kick in worst between 5Hz and 10Hz, pretty much proportional to the size of the patch of vision that is flashing.
15:53
< RichyB>
The Pokémon episode killed loads of kids because it was going off at exactly 10Hz and it was the entire screen.
15:54 * Rhamphoryncus nods
15:54
< Rhamphoryncus>
I'm pretty sure this would cause issues
15:58
< RichyB>
http://en.wikipedia.org/wiki/File:Pikachu_seizure-2.jpg
15:59
< RichyB>
6 seconds at 12Hz. Ambulances dragged 310 boys and 375 girls to hospitals.
15:59 * Rhamphoryncus nods
16:00
< Rhamphoryncus>
This is a debugging tool, but I'm activating it from the keyboard (overloading an existing debugging option). People may trigger it by accident
16:07 Attilla is now known as Atilla
16:07 Atilla is now known as Attilla
16:09 * Tarinaky blinks at Python.
16:09
< Tarinaky>
Wut.
16:14
< Rhamphoryncus>
What insanity did it inflict on you?
16:15
< Tarinaky>
It's claiming that a class doesn't have an attribute...
16:15
< Tarinaky>
That's defined...
16:16
< Tarinaky>
AttributeError: 'PySide.QtGui.QMainWindow' object has no attribute 'open_planet'
16:17
< Tarinaky>
I'm not sure why it calls it a PySide.QtGui.QMainWindow object when the class is GameWindow.
16:17
< Tarinaky>
I'm not sure if that's just python being a little silly or if loading the .ui files is causing sheenanigans
16:18
< Tarinaky>
http://pastebin.com/zezqTC49 << To give you an idea of the wtfery.
16:19
< Tarinaky>
I'm beginning to regret my choice of using QT for this.
16:19
< Tarinaky>
Am I doing something hideously wrong or what... :/
16:20
< Rhamphoryncus>
I would guess it's using the wrong class somehow
16:20
< Tarinaky>
Except Python is dynamically styped.
16:20
< Tarinaky>
*typed
16:20
< Rhamphoryncus>
Where are you instantiating?
16:20
< Rhamphoryncus>
It'd be creating an instance of the wrong type
16:21
< Tarinaky>
app = QtGui.QApplication(sys.argv) myWindow = gamewindow.GameWindow() app.exec_()
16:21
< Rhamphoryncus>
hrm
16:21
< Tarinaky>
Insert returns or semi-colons to taste.
16:22
< Rhamphoryncus>
print myWindow out
16:22
< Tarinaky>
<duelfieldstars.gamewindow.GameWindow object at 0x01B2B558>
16:22
< Rhamphoryncus>
Alright, that's sane
16:23
< Rhamphoryncus>
What's the traceback? Is it line 37 of the paste that's failing?
16:23
< Tarinaky>
If I print self though I get <PySide.QtGui.QMainWindow object at 0x01BD2120>
16:23
< Rhamphoryncus>
yeah..
16:24
< Rhamphoryncus>
They're not letting you subclass.. which is quite broken
16:24
< Rhamphoryncus>
Actually refusing to subclass would be fine. That's sometimes appropriate. In this case their __new__ silently ignores it
16:24
< Tarinaky>
NOKIAAAAA! (in the style of Shatner)
16:25
< Rhamphoryncus>
hrm. Wait a sec
16:25
< Tarinaky>
It's a wrapper for a C++ lib so I expected some funkiness. But I expected said funkiness to be clearly signposted.
16:25
< Rhamphoryncus>
the constructor returns the right class, but the __init__ is getting the wrong type
16:25
< Rhamphoryncus>
err
16:26
< Rhamphoryncus>
self = loader.load(file_,self)
16:26
< Rhamphoryncus>
wth is that? :P
16:26
< Tarinaky>
The code to load the widgets from the ui design.
16:26
< Rhamphoryncus>
That's where it's failing. Not the constructor
16:27
< RichyB>
You can't overwrite "self" in a Python constructor like that. This isn't objc.
16:27
< Rhamphoryncus>
Note that reassigning self will NOT have an effect outside the function
16:27
< Rhamphoryncus>
^^
16:27 Derakon [chriswei@Nightstar-a3b183ae.ca.comcast.net] has joined #code
16:27 mode/#code [+ao Derakon Derakon] by ChanServ
16:27
< RichyB>
What that line actually does is re-bind the function-local binding of the name "self"
16:27
< RichyB>
Not change the object. :)
16:27
< Tarinaky>
:/
16:27
< Tarinaky>
Fuck the qt tuts. Seriously.
16:27
< RichyB>
*Not change the object that will be returned to whomever called the constructor.
16:27
<&Derakon>
Style check, folks: I need to select one of two strings based on a boolean value. Would it be bad style to do so by "val = ['firstString', 'secondString'][boolean]"?
16:28
< Rhamphoryncus>
Do they do that in the tutorials?
16:28
< Tarinaky>
Yes.
16:28
< Rhamphoryncus>
Link?
16:28
< RichyB>
Derakon, in Python <= 2.4, that is ugly but fine.
16:28
< RichyB>
Derakon, in Python >= 2.5, there's a much nicer ternary, val = "secondstring" if boolean else "firststring"
16:28
< Tarinaky>
Can't find the particular tutorial off the top of my head.
16:29 * Tarinaky sighs.
16:29
<&Derakon>
I know about the ternary, but I've always found it a bit clunky.
16:29
< Rhamphoryncus>
IMO, both options are clunky
16:29
<&Derakon>
So, no right answer then?
16:29
< Rhamphoryncus>
Unless the strings are trivially short it's better to do "strings = ['firstString', 'secondString']; val = strings[boolean]"
16:30 Attilla [Obsolete@Nightstar-7d4a92bc.as43234.net] has quit [Ping timeout: 121 seconds]
16:30
<&Derakon>
They're "Rolling" and "Global".
16:30 Kindamoody|out is now known as Kindamoody
16:30
<&Derakon>
...though, it occurs to me that there's an alternate mode here that takes an int instead of a string, and I should just use that instead.
16:30
< Rhamphoryncus>
What's the real line?
16:31
<&Derakon>
I'm calling a library function to set an enum.
16:31
<&Derakon>
I can set it by index or by string.
16:31
< Tarinaky>
I can't think htf I am supposed to do this while still being able to use the signal/slot system :/
16:31
<&Derakon>
There's two options for the enum.
16:31
< Tarinaky>
Fuck Qt in the ass.
16:32
<&Derakon>
(So I can call AT_SetEnumString('ElectronicShutteringMode', 'Rolling') or AT_SetEnumIndex('ElectronicShutteringMode', 0) and they do the same thing.
16:32
<&Derakon>
)
16:35 Attilla [Obsolete@Nightstar-1f24e01e.threembb.co.uk] has joined #code
16:43
<&Derakon>
I kinda like how you can instantiate an array and then discard it in a single line, its purpose already having been accomplished.
16:44
<&Derakon>
c.f. http://pastebin.com/Nd7AjuiC
16:44 You're now known as TheWatcher
16:46
<@Ling>
Then someone passes a number that isn't 0-4
16:47
<&Derakon>
And the program throws an exception back at them.
16:48
<&Derakon>
I know precisely who is talking to this code: I am.
16:48
<&Derakon>
It's not worth my time to sanitize all the inputs.
16:48
<&Derakon>
(Ordinarily I'd agree with you though)
16:49
<@Ling>
Health tip: don't take that stance with dildos. Sanatize thost inputs.
16:50 * Derakon facepalms.
16:50
<&Derakon>
Yes, because even if you're the only person using a dildo, you're still sharing it with, what, millions of bacteria?
16:52
<@Ling>
You're supposed to wash your bedsheets every two weeks.
16:52
<@Ling>
Same concept
16:52 EvilDarkLord is now known as Maze
16:53
<@Ling>
Also if you ever get sick, it'll act like a vector and reinfect you.
16:57
<&Derakon>
Honestly if you don't feel a little nasty after two weeks without washing sheets then you're probably too densensitized to dirt.
16:57 * Ling is confused to your stance now
16:59
<&Derakon>
I'm saying that if I let my sheets go two weeks then I don't want to sleep in them until they've been washed.
17:18
< Rhamphoryncus>
Just to be pedantic, you never really "sanitize" inputs. You sanity check them and bail if they're unacceptable. Which is what python gives you by default
17:19
< Rhamphoryncus>
Unless you pass -1 :P
17:23
<&Derakon>
I read the difference between sanitizing and the default behavior as the difference between getting an "invalid index" exception and getting an "invalid argument" exception.
17:23
<&Derakon>
Er, invalid argument value.
17:23
<&Derakon>
Ideally the latter would tell you "hey dumbass, you can only use values between 0 and 4".
17:24
< Rhamphoryncus>
That's general vs specific exception
17:25
< Rhamphoryncus>
It's.. related
17:25
< Rhamphoryncus>
If the exception is buried away then it's not obvious how your argument caused it
17:26
<&Derakon>
Right.
17:26
< ShellNinja>
Hmm. I want to put a % into a C formatted string. What's the code for it? Putting it right there leads to issues with %d.
17:26
<&Derakon>
%%
17:26
< ShellNinja>
Thanks.
17:35 * ToxicFrog does the first official release of the Kessler daemon. My first significant Scala project!
17:45
<&Derakon>
\o/
17:48
<@ToxicFrog>
( http://github.com/ToxicFrog/kessler if anyone wants to take a look )
17:49
<@ToxicFrog>
(yes, that use of mutable collections in ksp.Object does make me feel dirty)
17:50
< RichyB>
It's not particularly dirty if you don't break referential transparency.
17:50
<@ToxicFrog>
The whole ksp.Object API breaks referential transparency hardcore :/
17:50
<@ToxicFrog>
I'm gradually improving this, though.
17:51
< Rhamphoryncus>
Augh, I think I've spent too much time staring at a flashing screen. It feels like everything is still flashing even when I'm looking at IRC
17:51
< Rhamphoryncus>
(maximized, black text on white background)
17:59 Derakon [chriswei@Nightstar-a3b183ae.ca.comcast.net] has quit [[NS] Quit: leaving]
18:15
< Tarinaky>
Hurdurp.
18:16
< Tarinaky>
What does: TypeError: 'module' object is not callable mean?
18:16
<@ToxicFrog>
Exactly what it says: you're trying to call a module
18:16
< Tarinaky>
Ah. Capitalisation fail.
18:16
<@ToxicFrog>
>>> import json
18:16
<@ToxicFrog>
>>> json
18:16
<@ToxicFrog>
<module 'json' from '/usr/lib/python2.7/json/__init__.pyc'>
18:16
<@ToxicFrog>
>>> json()
18:16
<@ToxicFrog>
TypeError: 'module' object is not callable
18:17
< Tarinaky>
I was calling pygame.surface instead of pygame.Surface >.>
18:18
< ShellNinja>
Can SDL_image load BMPs too, or do I need to use the basic load function for those?
18:22
< ShellNinja>
Yes, it can. :D
18:27 Kindamoody is now known as Kindamoody[zZz]
18:30
<@Ling>
SDL_image can load pngs, jpgs, and bmps IIRC
18:56
< Rhamphoryncus>
http://bugs.openttd.org/task/5101/getfile/8220/Skyscrapist%20inc.,%202316-12-02. png
18:57
<@Tamber>
Woah.
18:59
< Rhamphoryncus>
My head is hurting after watching it so much
19:01
< Tarinaky>
I don't even know what I'm looking at.
19:02 Maze [jjlehto3@Nightstar-a5db08cc.org.aalto.fi] has quit [Ping timeout: 121 seconds]
19:02
< ShellNinja>
OpenTTD, with bug.
19:02
< Rhamphoryncus>
Openttd uses dirty rectangles to only update part of the screen. I hacked it to overlay a colour (using checkboard) of each, with the colour changing each tick (frame)
19:04
< Rhamphoryncus>
The effect lets you see which parts of the screen are being redrawn
19:04
< Tarinaky>
Ahah.
19:05
< Rhamphoryncus>
There's quite a lot of unnecessary drawing
19:05
< Tarinaky>
Well, I'm currently handrolling my own ui in PyGame now because Qt annoyed me.
19:05
< Tarinaky>
Upside: Qt was being phenominally slow and would have been difficult to optimise anyway
19:05
< Tarinaky>
Downside: Taking so long to get anything done :(
19:19
<@jerith>
Tarinaky: If you look at the code for Mutable Mamba (mutable-mamba.org) you should be able to extract our widget library.
19:19
<@jerith>
Look at the level editor stuff.
19:20
<@jerith>
I can't remember how good it is, but widget libraries in pygame are a pain.
19:20
< ShellNinja>
Is there an SDL library that expands upon SDL_mixer, allowing MP3 files to be loaded?
19:20
< Tarinaky>
I'm doing okay for now.
19:20
< Tarinaky>
It's just it's going to take longer.
19:20
<@jerith>
Alternatively, maybe look at "albow".
19:20
< Tarinaky>
Which makes me sad.
19:20
< Tarinaky>
Primarily because I am lazy.
19:21
<@jerith>
Tarinaky: It gets horribly complicated as soon as you try to handle focus and modal popups.
19:21
< Tarinaky>
ShellNinja: Not as FOSS; mp3 support requires paying licensing.
19:21
< Tarinaky>
Popups are simple. Don't.
19:21
< Tarinaky>
:p
19:21
< Tarinaky>
Focus will be a bitch, yes. But I think I can handle what little I need of that.
19:22
<@jerith>
Tarinaky: There are good reasons to do modal popups.
19:22
<@jerith>
(We've needed them a lot.)
19:23
< Tarinaky>
https://github.com/Tarinaky/DuelFieldStars/tree/master/duelfieldstars/ui_abstrac t Well, this is the track I'm on atm with it.
19:24
< ShellNinja>
How about other compressed sound formats? I don't really care which, as long as the files aren't 40Mb huge.
19:24
<@jerith>
ShellNinja: oggs.
19:24
<@jerith>
I'm pretty sure that's what we used with pygame.
19:24
<@jerith>
Better format than mp3, anyway. :-)
19:26
<@jerith>
Tarinaky: You probably want to pass your widget's draw method a surface to draw on or something.
19:27
< ShellNinja>
Back to my question: any SDL libraries that load those into MixChunks?
19:27
<@jerith>
ShellNinja: No idea. I've only ever used SDL through pygame, and I haven't really done any of the sound stuff there.
19:28
< ShellNinja>
I see.
19:30
< Tarinaky>
jerith: Not self.surface?
19:31 Maze_ [jjlehto3@Nightstar-a5db08cc.org.aalto.fi] has joined #code
19:31
<@jerith>
Does each widget have its own surface?
19:32
< Tarinaky>
Yes.
19:32
<@jerith>
Or does it have a copy of the main surface?
19:32
< Tarinaky>
It has its own texture to draw on.
19:32
< Tarinaky>
Window blits each widget onto itself.
19:33
<@jerith>
Ah, okay.
19:33
<@jerith>
Cool. :-)
20:04
< Rhamphoryncus>
Ouch. Traced through a bug.. and found a comment explaining why it was done that way. And it's justified.
20:04
< Tarinaky>
Derpy question:
20:05
< Tarinaky>
How do you split a compound if statement over several lines?
20:05
< Tarinaky>
For example if a or b or c or...
20:05
< Rhamphoryncus>
if (a or b
20:05
< Rhamphoryncus>
or c):
20:06
< Tarinaky>
Ahah
20:07
< Tarinaky>
Cheers.
20:09
< Rhamphoryncus>
You can also use \ at the end of the line, but that's kind of discouraged now. Ugly.
20:09
< Rhamphoryncus>
It's good for starting multiline string literals though. x = """\
20:10
< Tarinaky>
""" is a multiline string anyway?
20:10
< Rhamphoryncus>
yes
20:11
< Rhamphoryncus>
But the escape removes the linefeed
20:11
< Rhamphoryncus>
So you can do this:
20:11
< Rhamphoryncus>
x = """\
20:11
< Rhamphoryncus>
Hello World!
20:11
< Rhamphoryncus>
"""
20:11
< Rhamphoryncus>
and x == "Hello World!\n". Otherwise it'd be "\nHello World!\n"
20:13
< Tarinaky>
Oh. Derp
20:14
< Tarinaky>
... Why does list.reverse reverse the list in situ :/
20:14
< Tarinaky>
That seems... silly.
20:14
< Tarinaky>
Indeed, I don't want to actually reverse the list. I just want to iterate backwards >.>
20:16
< Tarinaky>
Ah, I want 'reversed(seq)'.
20:17 Maze_ is now known as EvilDarkLord
20:23 celticminstrel [celticminst@Nightstar-5d22ab1d.cable.rogers.com] has joined #code
20:32 eckse [eckse@Nightstar-7db408d9.dsl.sentex.ca] has joined #code
20:32 mode/#code [+o eckse] by ChanServ
20:38
< Rhamphoryncus>
Yeah, the tense is meant to hint at that
20:39
< Rhamphoryncus>
like .sort() vs sorted()
20:41
< RichyB>
I think PEP-8 demands that when you continue an expression, you end the previous line with an operator
20:41
<@jerith>
reversed() was a later addition people people complained about the in-place stuff, IIRC.
20:42 maoranma [maoranma@Nightstar-18ea8aaa.pools.spcsdns.net] has quit [Ping timeout: 121 seconds]
20:45 maoranma [maoranma@Nightstar-18ea8aaa.pools.spcsdns.net] has joined #code
20:55
< ShellNinja>
I want to convert wav (or mp3) to ogg. What's the command under Linux? (What utilities do I need to install?)
20:56
<&McMartin>
oggenc is the utility
20:57
< ShellNinja>
Doesn't seem to be installed, or in the default repository.
20:58
<&McMartin>
It's probably something like oggutils or vorbisutils
21:00
< ShellNinja>
There's an oggconvert.
21:05
< ShellNinja>
BAH. It is GUI-only. I am disappoint.
21:05
< ShellNinja>
It doesn't seem *proper* to use GUI for something like this.
21:06
<@TheWatcher>
Use sox ¬¬
21:07
< Tarinaky>
http://wav2mp3.sourceforge.net/
21:07
< gnolam>
ffmpeg?
21:07
< Tarinaky>
First hit for wav2ogg
21:08
< Tarinaky>
http://howto-pages.org/ffmpeg/#basicaudio << Using ffmpeg
21:09 * ShellNinja uses the gui-only thing.
21:09
< ShellNinja>
Awright. Development directory slimmed down to 1/10th original size.
21:10
< ShellNinja>
Mix_LoadWAV is misnamed. <_<
21:16
< ShellNinja>
Lots of work done over two days to refactor this mess. Unfortunately, it doesn't really show from the user side. But at least I'll have an easier time expanding content now.
21:16
<&McMartin>
SDL_mixer is very, very finicky.
22:47 ToxicFrog [ToxicFrog@ServerAdministrator.Nightstar.Net] has quit [Operation timed out]
22:51 Attilla_ [Obsolete@Nightstar-7d4a92bc.as43234.net] has joined #code
22:53 Attilla [Obsolete@Nightstar-1f24e01e.threembb.co.uk] has quit [NickServ (GHOST command used by Attilla_)]
22:53 Attilla_ is now known as Attilla
23:02 ToxicFrog [ToxicFrog@ServerAdministrator.Nightstar.Net] has joined #code
23:02 mode/#code [+o ToxicFrog] by ChanServ
23:06 himi [fow035@D741F1.243F35.CADC30.81D435] has joined #code
23:06 mode/#code [+o himi] by ChanServ
23:18 Rhamphoryncus [rhamph@Nightstar-5697f7e2.abhsia.telus.net] has quit [Client exited]
23:31 Derakon[AFK] is now known as Derakon
--- Log closed Wed Mar 14 00:00:54 2012
code logs -> 2012 -> Tue, 13 Mar 2012< code.20120312.log - code.20120314.log >

[ Latest log file ]