code logs -> 2007 -> Fri, 21 Sep 2007< code.20070920.log - code.20070922.log >
--- Log opened Fri Sep 21 00:00:01 2007
--- Day changed Fri Sep 21 2007
00:00
<@ToxicFrog>
Is there something like instanceof that lets me ask "does this thing implement this interface"?
00:01
<@ToxicFrog>
So that I can say, for example: if( !(Thread.currentThread() implementorof MessagePassing) ) { throw new InvalidMessagePassContextException(); } else { /* do stuff */ }
00:04
<@McMartin>
Yeah, instanceof does that.
00:05
<@ToxicFrog>
Aah.
00:05
<@McMartin>
If you actually want "Is this object of precisely this class" you need to do obj.getClass().equals
00:05
<@ToxicFrog>
Yeah, I just want to know if it implements the MessagePassing interface.
00:05
<@McMartin>
instanceof MessagePassing.
00:05
<@ToxicFrog>
Right.
00:05
<@ToxicFrog>
(because sending an interthread message from a thread that doesn't implement it is an error, as it leaves no way to reply())
00:06
<@McMartin>
Java's reflection mechanism is just ugly enough that you won't want to use it much, but the basic bits (getClass(), Class.forName(), Class.newInstance()) are relatively easy, and all the power is there when you really need it.
00:07
<@McMartin>
Oh, and 1.5 makes the static .class field official, IIRC, but I'm a bit unclear on that one, because of Standard McM Java Caveat 1.
00:07
<@McMartin>
(And the question was "which is the rc")
00:08
< MinceR>
gn
00:08
<@ToxicFrog>
'night
00:08 * ToxicFrog snrks at Moodle
00:10
<@ToxicFrog>
So, Moodle is this open-source web teaching thing a bunch of the CIS courses are using.
00:10
<@ToxicFrog>
To enrol in a course, you need a key, which is provided by the prof.
00:10
<@ToxicFrog>
(a passphrase, that is, not a cryptographic key)
00:10
<@ToxicFrog>
If you get it wrong, it will tell you so, and "here's a hint: it starts with '%c'"
00:11
<@ToxicFrog>
The %c has no relation to what the key actually starts with.
00:13 ReivSLEP is now known as ReivClass
00:15
<@gnolam>
Ehm.
00:29
<@ToxicFrog>
...oh, arse
00:29
<@ToxicFrog>
Forgot all about exception signatures
00:33
< Vornicus>
Does eclipse warn about exception signatures live?
00:35
<@ToxicFrog>
No idea. McM?
00:35
< Vornicus>
it probably does.
00:36
< Vornicus>
or, "live" in the sense of "whenever it gets a moment to see what you've done"
00:36
<@ToxicFrog>
(the issue here is that the possible exceptions are all totally different - interthread might throw InterruptedException, whereas intersystem can definitely throw IOException and probably an assload of other, socket-specific exceptions)
00:36
<@ToxicFrog>
(I may need to catch them in the message passing functions and translate to MessagePassException)
00:47
<@McMartin>
I don't really use Eclipse much
01:25 gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has quit [Quit: Z?]
01:30 Kyrre [~Z@87.72.35.ns-3885] has joined #Code
01:36 Vornicus [~vorn@Admin.Nightstar.Net] has quit [Connection reset by peer]
01:45 Vornicus [~vorn@64.252.44.ns-4484] has joined #code
01:46 Vornicus is now known as NSGuest-1149
02:45 NSGuest-1149 is now known as Vornicus
02:54 McMartin [~mcmartin@Nightstar-904.dsl.pltn13.sbcglobal.net] has quit [Quit: brb]
03:10 Forj [~Forj@Nightstar-2472.ue.woosh.co.nz] has joined #code
03:10 mode/#code [+o Forj] by ChanServ
03:10 Forj [~Forj@Nightstar-2472.ue.woosh.co.nz] has quit [Quit: Gone]
03:21 Vornicus is now known as Darius
04:26 Derakon [~Derakon@Nightstar-12550.sea2.cablespeed.com] has joined #code
04:26 mode/#code [+o Derakon] by ChanServ
04:26 * Derakon starts learning Python, yeye.
04:26
<@Derakon>
s/e\./e/
04:29
< Darius>
don't you mean s/e\././ ?
04:29
<@Derakon>
Er, yes. ¬.¬
04:33
<@Derakon>
Okay, I want map.
04:33
<@Derakon>
I have a function "scale" and a list/array/whatever you call it "localCoords".
04:34
<@Derakon>
foo = [scale(2, coord) for coord in localCoords]
04:34
<@Derakon>
That doesn't work.
04:34
<@Derakon>
...oh, wait, namespace collision.
04:35 * Derakon can now generate scaled pyramids, yay.
04:35
<@Derakon>
Now to generate Pascal's pyramid.
04:38
<@Derakon>
Is there some kind of "[0..100]" equivalent in Python (to generate a list containing the numbers 0 through 100)?
04:39
<@Derakon>
..."range(0, 100)". Right.
04:42
< Darius>
range(0,101). It's inclusive left and exclusive right.
04:42
<@Derakon>
Ahh.
04:42
< GeekSoldier|bed>
range(0,101)
04:42
< Darius>
Also technically it's just range(101), because it's implied 0 for the left.
04:42 GeekSoldier|bed is now known as GeekSoldier|work
04:43
< GeekSoldier|work>
yeah.
04:43
< Darius>
there's also xrange, if you want an iterator.
04:43
<@Derakon>
I seem to be okay with "for offset in range(foo, bar):"
04:43
<@Derakon>
Though, uh, I'm not getting the pyramids I expect from it.
04:48
<@Derakon>
from Blender import *
04:48
<@Derakon>
editmode = Window.EditMode() # are we in edit mode? If so ...
04:48
<@Derakon>
if editmode: Window.EditMode(0) # leave edit mode before getting the mesh
04:48
<@Derakon>
# define vertices and faces for a pyramid
04:48
<@Derakon>
coords=[ [-1,-1,-1], [1,-1,-1], [1,1,-1], [-1,1,-1], [0,0,1] ]
04:48
<@Derakon>
faces= [ [3,2,1,0], [0,1,4], [1,2,4], [2,3,4], [3,0,4] ]
04:48
<@Derakon>
me = Mesh.New('myMesh') # create a new mesh
04:48
<@Derakon>
me.verts.extend(coords) # add vertices to mesh
04:48
<@Derakon>
me.faces.extend(faces) # add faces to the mesh (also adds edges)
04:48
<@Derakon>
me.vertexColors = 1 # enable vertex colors
04:48
<@Derakon>
me.faces[1].col[0].r = 255 # make each vertex a different color
04:48
<@Derakon>
me.faces[1].col[1].g = 255
04:49
<@Derakon>
me.faces[1].col[2].b = 255
04:49
<@Derakon>
scn = Scene.GetCurrent() # link object to current scene
04:49
<@Derakon>
ob = scn.objects.new(me, 'myObj')
04:49
<@Derakon>
...erk!
04:49
<@Derakon>
Sorry!
04:49
<@Derakon>
Frickin' Blender doesn't use the OS's standard copy buffer.
05:34 Chalcedon is now known as ChalcyAFK
05:48
< GeekSoldier|work>
that looks proper, Derakon, but it's been a while since I've written for blender.
05:52 GeekSoldier|work is now known as GeekSoldier
06:38
<@Derakon>
That's proper because it was copied from an example.
06:41
< jerith>
Morning.
06:44
< GeekSoldier>
lol, ok.
06:45 ChalcyAFK is now known as Chalcedon
06:46
<@Derakon>
Okay, how do I convince Python to give me a floating point result from dividing integers?
06:46
<@Derakon>
The old "insert a .0 on the end" trick doesn't work.
06:47
< jerith>
At least one of the operands must be a float.
06:47
< GeekSoldier>
float(int/int)
06:47
< GeekSoldier>
bah.
06:47
< GeekSoldier>
float(int)/int
06:48
<@Derakon>
No joy...
06:49
<@Derakon>
for offset in range(-8, 8): func(offset / float(4))
06:49
<@Derakon>
The argument passed in has value 2, 1, 1, 1, 1...
06:49 Darius is now known as Vornicus
06:50
<@Derakon>
Vorn! You know Python!
06:50 * Vornicus knows Python!
06:50
<@Derakon>
Help me delude Python into giving me floating point values!
06:50
< Vornicus>
I'm surprised it isn't.
06:51
< Vornicus>
indeed, it works fine here.
06:51
< jerith>
For me too.
06:51 Chalcedon [~Chalcedon@Nightstar-2472.ue.woosh.co.nz] has quit [Quit: rebooting]
06:52
< jerith>
Perhaps func() is casting it back to an integer?
06:52
< Vornicus>
>>> for offset in range(-8,8): print offset/float(4)
06:52
< Vornicus>
...
06:52
< Vornicus>
-2.0
06:52
< Vornicus>
-1.75
06:52
< Vornicus>
yadda yadda
06:52
<@Derakon>
Hrm...maybe it's Blender that's cracked out, then.
06:52
<@Derakon>
I just did it in the Python interpreter directly and it worked.
06:53
< GeekSoldier>
what version python was it using?
06:53
< Vornicus>
Wouldn't surprise me. Blender is some crazy shit.
06:53
<@Derakon>
I thought it used the Python installed on my box, but I could be wrong.
06:54
< GeekSoldier>
for a while, it refsed to see my installed python. now with the latest update, it sees Python 2.5 and is happy with it.
06:55 Chalcedon [~Chalcedon@Nightstar-2472.ue.woosh.co.nz] has joined #code
06:55 mode/#code [+o Chalcedon] by ChanServ
06:58 Chalcedon is now known as ChalcyAFK
07:05 Raif [~corvusign@Nightstar-5406.hsd1.ca.comcast.net] has joined #Code
07:06 Netsplit over, joins: ReivClass, DiceBot, MinceR, Chalain
07:06 Netsplit DeepThought.NY.US.Nightstar.Net <-> Blargh.CA.US.Nightstar.Net quits: Attilla, @AnnoDomini, @Derakon, @Thaqui, Vornicus, GeekSoldier, @Pi, @ChalcyAFK, jerith, Raif
07:06 mode/#code [+v DiceBot] by ChanServ
07:06 Netsplit over, joins: Derakon
07:06 mode/#code [+o Chalain] by ChanServ
07:06 Netsplit over, joins: jerith
07:06 mode/#code [+o Derakon] by ChanServ
07:06 Netsplit over, joins: Pi
07:06 mode/#code [+o jerith] by ChanServ
07:06 Netsplit over, joins: Thaqui, GeekSoldier
07:06 mode/#code [+o Pi] by ChanServ
07:06 Netsplit over, joins: AnnoDomini, Attilla
07:06 mode/#code [+o Thaqui] by ChanServ
07:06 Netsplit over, joins: Vornicus
07:06 mode/#code [+o AnnoDomini] by ChanServ
07:06 Netsplit over, joins: ChalcyAFK
07:06 Netsplit over, joins: Raif
07:06 ServerMode/#Code [+o ChalcyAFK] by Troika.TX.US.Nightstar.Net
07:06 mode/#code [+o Vornicus] by ChanServ
07:06 mode/#code [-o ChalcyAFK] by ChanServ
07:08 ReivClass is now known as Reiver
07:08 DiceBot [~Reiver@Nightstar-29823.ubs-dsl.xnet.co.nz] has quit [Ping Timeout]
07:09 DiceBot [~Reiver@Nightstar-29823.ubs-dsl.xnet.co.nz] has joined #Code
07:09 mode/#code [+v DiceBot] by ChanServ
07:16 Derakon is now known as Derakon[AFK]
07:34 Vornicus is now known as Vornicus-Latens
07:39 ChalcyAFK is now known as Chalcedon
07:52 McMartin [~mcmartin@Nightstar-904.dsl.pltn13.sbcglobal.net] has joined #code
07:52 mode/#code [+o McMartin] by ChanServ
07:59 Chalcedon is now known as ChalcyAFK
08:10 You're now known as TheWatcher
08:53 ChalcyAFK [~Chalcedon@Nightstar-2472.ue.woosh.co.nz] has quit [Quit: Gone]
09:12
<@McMartin>
Man, as much as I hate XML, SGML is a thousand times worse.
09:13
< GeekSoldier>
hear hear.
09:50 * McMartin docbooks up an eighth of an old text document he wrote.
10:31 * McMartin finishes the rest of it, goes to bed.
11:11 woof [Gotqyc@Nightstar-24128.216-200-24.mc.videotron.ca] has joined #Code
11:11
< woof>
http://st-pitch.miniville.fr/
11:11-woof:#Code- http://st-pitch.miniville.fr/
11:12 woof [Gotqyc@Nightstar-24128.216-200-24.mc.videotron.ca] has left #Code [http://st-pitch.miniville.fr/]
11:12
<@AnnoDomini>
Damnaithe. Was already on the way towards selecting Banjolnir from the context menu.
11:13
< Kyrre>
I generally assume I can't. And mentally blanks the spambots out.
11:15
<@AnnoDomini>
But I like employing the Banjolnir. :(
13:20 Vornotron [~vorn@64.252.9.ns-26300] has joined #code
13:21 Vornicus-Latens [~vorn@Admin.Nightstar.Net] has quit [Ping Timeout]
15:46
< Reiver>
Banjolnir?
15:46 Reiver is now known as ReivSLEP
15:55
<@ToxicFrog>
Bjolnir, the ban-hammer that smites the spambot, the lamer, and the troll.
16:49 Vornotron is now known as Vornicus
16:50 Vornicus is now known as NSGuest-1157
16:50 NSGuest-1157 is now known as Vornicus
16:59
< GeekSoldier>
adapted, naturally, from Mjolnir, of norse legend.
17:12 You're now known as TheWatcher[afk]
17:50
<@Pi>
http://www.temp.sfbok.se/kat/img/46736.jpg
17:59 AnnoDomini [AnnoDomini@Nightstar-29029.neoplus.adsl.tpnet.pl] has quit [Quit: Don't trust the skull.]
18:02 AnnoDomini [AnnoDomini@Nightstar-29029.neoplus.adsl.tpnet.pl] has joined #Code
18:02 mode/#code [+o AnnoDomini] by ChanServ
18:05 Raif [~corvusign@Nightstar-5406.hsd1.ca.comcast.net] has quit [Killed (NickServ (GHOST command used by Raif_))]
18:05 Raif_ [~corvusign@Nightstar-5406.hsd1.ca.comcast.net] has joined #Code
18:05 Raif_ is now known as Raif
18:38 You're now known as TheWatcher
18:44 AnnoDomini is now known as Lerhir
18:47 GeekSoldier [~Rob@Nightstar-5400.pools.arcor-ip.net] has quit [Ping Timeout]
18:47 Raif [~corvusign@Nightstar-5406.hsd1.ca.comcast.net] has quit [Killed (NickServ (GHOST command used by Raif_))]
18:47 Raif_ [~corvusign@Nightstar-5406.hsd1.ca.comcast.net] has joined #Code
18:47 Raif_ is now known as Raif
18:53 GeekSoldier [~Rob@Nightstar-3593.pools.arcor-ip.net] has joined #code
19:49 Forj [~Forj@Nightstar-2472.ue.woosh.co.nz] has joined #code
19:49 mode/#code [+o Forj] by ChanServ
20:12 Chalcedon [~Chalcedon@Nightstar-2472.ue.woosh.co.nz] has joined #code
20:12 mode/#code [+o Chalcedon] by ChanServ
20:34 You're now known as TheWatcher[afk]
20:36
<@McMartin>
Wow, Docbook really does Do The Job.
20:36
<@McMartin>
Except, apparently, for docbook2tex.
20:51
< Vornicus>
what job does it do?
21:04
< GeekSoldier>
The Job.
21:08
< Vornicus>
Wow, really?
21:09
<@ToxicFrog>
The job of generating prettyprinted documentation, IIRC.
21:09
<@ToxicFrog>
Personally, I like txt2man~
21:09
< Vornicus>
aha
21:20
<@McMartin>
txt2man doesn't make automatically cross-referenced web pages.
21:20 * McMartin docbooked the Ophis tutorials.
21:21 You're now known as TheWatcher
21:21
<@McMartin>
They aren't perfect, just yet (some bits need to be modified to work better as RTF/PDF) but it's mostly there.
21:23 Lerhir is now known as AnnoDomini
21:23
<@McMartin>
http://hkn.eecs.berkeley.edu/~mcmartin/P65/db/book1.html
21:24
<@McMartin>
The only major thing left to do on the HTML side is to make it so that references to sample source code are properly hyperlinked.
21:27
<@jerith>
DocBook is much better than LaTeX for generating HTML.
21:27
<@jerith>
It's nastier to write, though.
21:29
<@McMartin>
Yes.
21:29
<@McMartin>
And DocBook seems kind of hopeless for generating usable TeX. I must be missing some .sty file.
21:30
<@McMartin>
Or other library, because there's a bunch of commands it's not understanding.
21:31
<@jerith>
McMartin: It has only a small subset of the functionality.
21:32
<@jerith>
However, do *not* go the route of generating xsl:fo to turn into a pdf. That way lies pain and madness.
21:47 You're now known as TheWatcher[T-2]
21:47
<@ToxicFrog>
Re: docbook nasty to write: this is what preprocessors are for~
21:48
<@ToxicFrog>
(by which I mean totally abusing awk)
21:50 You're now known as TheWatcher[zZzZ]
22:48 GeekSoldier is now known as They
22:52 They is now known as GeekSoldier
23:02
<@McMartin>
jerith: For the record, I was planning on getting a PDF by going Docbook->RTF->OpenOffice->PDF.
23:03 AnnoDomini [AnnoDomini@Nightstar-29029.neoplus.adsl.tpnet.pl] has quit [Ping Timeout]
23:09 AnnoDomini [AnnoDomini@Nightstar-29265.neoplus.adsl.tpnet.pl] has joined #Code
23:09 mode/#code [+o AnnoDomini] by ChanServ
--- Log closed Sat Sep 22 00:00:21 2007
code logs -> 2007 -> Fri, 21 Sep 2007< code.20070920.log - code.20070922.log >