code logs -> 2007 -> Tue, 06 Mar 2007< code.20070305.log - code.20070307.log >
--- Log opened Tue Mar 06 00:00:51 2007
00:02 timelady [~romana@Nightstar-14874.lns6.adl2.internode.on.net] has joined #Code
00:05
<@ToxicFrog>
Hoi, Romana.
00:05
< timelady>
hey tf:)
00:10 MahalBed is now known as Mahal
00:19 BlueTiger [BlueTiger@Nightstar-567.natsoe.res.rr.com] has joined #Code
00:19 ReivSLEP is now known as Reiver
00:38 Chalcy [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has joined #code
00:38 mode/#code [+o Chalcy] by ChanServ
00:38 Chalcedon [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has quit [Ping Timeout]
00:40
<@Vornicus>
I really should figure out how to get my script to not regenerate images newer than the sources.
00:41
<@ToxicFrog>
I can think of at least two different ways to do that.
00:41
<@ToxicFrog>
...three.
00:41
<@Vornicus>
Teach me, o wise frog.
00:42 Janus [~Cerulean@Nightstar-10302.columbus.res.rr.com] has joined #Code
00:42
<@ToxicFrog>
(find -anewer, ls -ltr and checking the order they appear in, and state + explicit timestamp checks)
00:42
<@ToxicFrog>
(...four. You can also abuse make for this, which is in fact What It's There For.)
00:42
<@ToxicFrog>
s/state/stat/
00:42 Chalcy is now known as Chalcedon
00:43
<@Vornicus>
...this is true.
00:44 Janus is now known as Jan[birday]
00:44
<@ToxicFrog>
Something like:
00:44
<@ToxicFrog>
%.png: %.ps
00:44
<@ToxicFrog>
gs $(PSFLAGS) $< > $@
00:45
< MyCatVerbs>
make is the ideal solution, indeed
00:45
< MyCatVerbs>
</me too>
00:47
<@Vornicus>
Well, that's new language 5 on the month.
00:47
< MyCatVerbs>
Vornicus: awesome.
00:48
<@ToxicFrog>
Language 5?
00:49
<@Vornicus>
Javascript, PostScript, Make, Erlang, Haskell. The latter two I only wrote Hello World in, but.
00:49 * MyCatVerbs wonders if make is Turing-complete.
00:50
<@ToxicFrog>
Make isn't a programming language, really.
00:50
<@ToxicFrog>
It's a DDL, which describes how to control bash, which is.
00:51
<@Vornicus>
hm. i have one PS file that expands to 18 PNGs.
00:52
<@ToxicFrog>
...oh.
00:52
<@Vornicus>
And others that expand to 10, 10, 8, 6, 6, and 3.
00:55 timelady [~romana@Nightstar-14874.lns6.adl2.internode.on.net] has quit [Quit: run away! run away!]
01:02 * Vornicus fiddles with stack manipulations.
01:03 * gnolam fiddles with stock manipulations, then runs from the SEC.
01:04
< gnolam>
Well, actually I'm fiddling with the Very High Demonic Language, which is driving me fscking bonkers.
01:04
<@Vornicus>
I'm trying to define between such that {a b c between} yields true if b <= a <= c
01:07
<@Vornicus>
-1 3 roll dup 1 4 roll ge 1 3 roll ge and
01:13 Chalcedon [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has quit [Quit: ]
01:13
<@Vornicus>
My poor brain.
01:19
<@Vornicus>
And I can't read the damn documentation. :P
01:20
<@ToxicFrog>
...why not?
01:20
<@ToxicFrog>
...also, wouldn't a <= b <= c make more sense?
01:21
<@Vornicus>
I got roll's params backwards.
01:21
<@Vornicus>
and "a is between b and c" is the way I'd said it.
01:24
<@ToxicFrog>
Aah.
01:24 ToxicFrog is now known as CommanderFrog
01:25 * Jan[birday] draws hentai on it.
01:29
<@Vornicus>
woot, my number token ps works.
01:49 Vornicus is now known as Vornicus-Latens
01:51 Mahal is now known as MahalAFK
01:54 BlueTiger [BlueTiger@Nightstar-567.natsoe.res.rr.com] has quit [Quit: ]
02:17 * Raif eats it.
02:22 gnolam [Lenin@Nightstar-13557.8.5.253.se.wasadata.net] has quit [Quit: Z?]
02:58 MyCatVerbs is now known as MyCatSleeps
03:01 Jan[birday] [~Cerulean@Nightstar-10302.columbus.res.rr.com] has quit [Quit: Nyah!]
03:03 Reiver is now known as ReivClass
03:14 MahalAFK is now known as Mahal
03:39 Mahal is now known as MahalWORK
03:48 Serah [~Z@87.72.36.ns-26407] has quit [Ping Timeout]
03:49 MyCatSleeps [~mycatownz@Nightstar-379.dsl.in-addr.zen.co.uk] has quit [Ping Timeout]
03:50 MyCatSleeps [~mycatownz@Nightstar-379.dsl.in-addr.zen.co.uk] has joined #code
04:01 Thaqui [~Thaqui@Nightstar-25354.jetstream.xtra.co.nz] has quit [Quit: This computer has gone to sleep]
04:30 Thaqui [~Thaqui@Nightstar-25354.jetstream.xtra.co.nz] has joined #code
04:31 ReivClass is now known as Reiver
04:39 Serah [~Z@87.72.36.ns-26407] has joined #Code
04:49 Forj [~Forj@Nightstar-869.bitstream.orcon.net.nz] has joined #code
05:06 CommanderFrog is now known as ToxicFrog
05:09 Serah [~Z@87.72.36.ns-26407] has quit [Connection reset by peer]
05:11 Serah [~Z@87.72.36.ns-26407] has joined #Code
05:19 Forj is now known as ForjTraining
05:19
<@Reiver>
Does anyone here know anything at all about UPSes?
05:20 Derakon [~Derakon@Nightstar-12737.sea2.cablespeed.com] has joined #code
05:20
< Derakon>
G'd'ven'n.
05:24 MyCatSleeps [~mycatownz@Nightstar-379.dsl.in-addr.zen.co.uk] has quit [Connection reset by peer]
05:25 MyCatSleeps [~mycatownz@Nightstar-379.dsl.in-addr.zen.co.uk] has joined #code
05:41 * GeekSoldier awakens.
05:42 * Reiver stabs UPSes.
05:42
<@Reiver>
No-one knows a thing it seems.
05:42
< GeekSoldier>
Not really.
05:42 * Reiver is looking into buying one as a power conditioner type deal thing for his computer setup.
05:43
<@Reiver>
As I suspect power surges have been what was causing the carnage in hardware.
05:43
<@Reiver>
But!
05:43
< GeekSoldier>
From what I understand, APC is a decent brand.
05:43
<@Reiver>
I'm not even sure if all UPSes are also actually power conditioners.
05:43
<@Reiver>
Or if a UPS on a bad power supply is as survivable as a computers PSU.
05:46
< GeekSoldier>
hmmm... sounds as if the fan in my laptop is going wonky...
05:53 Reiver is now known as ReivOut
05:56 ErikMesoy|sleep is now known as ErikMesoy
07:04 Forjeh [~Forj@Nightstar-869.bitstream.orcon.net.nz] has joined #code
07:05 ForjTraining [~Forj@Nightstar-869.bitstream.orcon.net.nz] has quit [Ping Timeout]
07:06 Derakon is now known as Derakon[AFK]
07:13 ReivOut is now known as Reiver
08:00 ErikMesoy [~ejm@Nightstar-12501.bb.online.no] has quit [Quit: Go not gently into that good night, but rage against the dying of the light.]
08:13 Schlock [~schlock@Nightstar-6915.hsd1.or.comcast.net] has joined #code
08:13 mode/#code [+v Schlock] by ChanServ
09:01 Forjeh is now known as Forjadon
09:06 Forjadon [~Forj@Nightstar-869.bitstream.orcon.net.nz] has quit [Quit: Gone]
09:23 Thaqui [~Thaqui@Nightstar-25354.jetstream.xtra.co.nz] has left #code [Leaving]
09:25
<@Reiver>
500 VA will power a 400W computer for /how/ long?
09:41 Derakon[AFK] [~Derakon@Nightstar-12737.sea2.cablespeed.com] has quit [Connection reset by peer]
09:52 Vornicus-Latens is now known as Vornicus
09:54 You're now known as TheWatcher[wr0k]
09:54 gnolam [Lenin@Nightstar-13557.8.5.253.se.wasadata.net] has joined #Code
11:05 Serah [~Z@87.72.36.ns-26407] has quit [Connection reset by peer]
11:06 NSGuest-830 [~Z@87.72.36.ns-26407] has joined #Code
11:20 gnolam is now known as gnolam|Saltmines
12:13 MyCatSleeps is now known as MyCatVerbs
12:38 Reiver is now known as ReivZzz
13:17 MahalWORK is now known as Mahal
13:29 gnolam|Saltmines is now known as gnolam
13:32 * Vornicus fiddles with makefiles.
13:35
< MyCatVerbs>
ARGH! Why the fuck am I listening to J-Pop off Youtube?
13:37
<@Vornicus>
I don't know.
13:38
<@Mahal>
I have no idea.
13:39
< MyCatVerbs>
Oh hey, idea.
13:39
< MyCatVerbs>
Clapton CD over there. *grabs it*
13:40
< gnolam>
Interesting. From "vacuous" to "pretentious" in just 4 minutes!
13:43
< MyCatVerbs>
Actually I changed my mind in mid-swipe. Now it's some random indie stuff.
13:45
< gnolam>
Then it still stands.
13:46 NSGuest-830 is now known as Serah
13:55 * Vornicus eyes various makefile tutorials.
13:55
< gnolam>
GNU make?
13:55
<@Vornicus>
Yeah.
13:55
<@Vornicus>
I'm trying to figure out how to do something with it.
13:56
< gnolam>
Good luck. IT's the epitome of "kludge".
13:56
<@Vornicus>
heh
13:59 * Vornicus pokes at TF. How are you with makefiles?
14:01
<@ToxicFrog>
Middling.
14:02 * Mahal EYES her iTunes.
14:02
<@Mahal>
WHY do I have BOYZONE?
14:02
< MyCatVerbs>
gnolam: I wouldn't say that, myself.
14:03
< MyCatVerbs>
Mahal: you think that's bad? Up until far-too-recently, I had the Spice Girls. In *FLAC*. *shudders*
14:03
<@Mahal>
erm
14:03 * Mahal has them too
14:03
< MyCatVerbs>
gnolam: mainly because I'm supposed to be on this whole "pretentious" kick right now. I'd have to use longer words. =D
14:03 * Mahal ponders.
14:03
<@Mahal>
also aqua, bewitched, backstreet boys
14:04
<@Mahal>
What, did I import my 13-year-old-self's music colelction in mys leep???
14:04
<@Vornicus>
You know how variables work, right, and you can put a whole bunch of words... I want to use those words one at a time, like I would with a for loop in bash.
14:04 * Mahal finally works out what happened.
14:04
<@Mahal>
Normally I have a particular playlist I play.
14:04
<@Mahal>
It's all my library, except the music I've flagged not to play.
14:04
<@Mahal>
Right now I"m playing from my /library/
14:04 * Mahal feels mildly better.
14:06
<@ToxicFrog>
Vornicus: "use" them in what sense?
14:06
<@ToxicFrog>
If you mean use in an action block, that is bash; use a for loop.
14:06
<@ToxicFrog>
I should probably organize my id3s and set up playlists and stuff sometime.
14:07
<@Vornicus>
Well, okay, here's what my bash script looks like: http://pastie.caboo.se/45038
14:07
<@ToxicFrog>
I tend to just put all ten thousand odd tracks into one massive playlist and play from that.
14:08
<@Vornicus>
(this is only a small part of it)
14:08
< MyCatVerbs>
Vornicus: for x in long list of words; do echo $x; done
14:08
< MyCatVerbs>
Vornicus: outputs: "long" "list" "of" "words" (each on a seperate line)
14:08
<@Vornicus>
MCV: yeah, I get that, approximately, but the thing is...
14:09
< MyCatVerbs>
Ack, mein machine ist gerfuck'd.
14:09
< MyCatVerbs>
Machine cuts out randomly, screen flickers from time to time -> bad PSU?
14:09
<@Vornicus>
I am trying to make it figure out whether each individual object needs regenerating
14:10
< MyCatVerbs>
Vornicus: MAKEFILE!
14:10
<@Vornicus>
MCV: yes!
14:10
<@Vornicus>
I'm trying to figure out how to do this /in a makefile/
14:10
<@ToxicFrog>
Err.
14:10
<@ToxicFrog>
So, we have a ps.
14:10
<@Vornicus>
We have a ps.
14:10
< MyCatVerbs>
Oh and inexplicably high packet loss on WiFi card. Like, 15% while sitting with just *fifty centimetres* between the laptop and the desktop that the RALink card is in.
14:10
<@ToxicFrog>
We have a bunch of PNGs, all of which are generated from the ps.
14:10
<@Vornicus>
Yep.
14:10
<@ToxicFrog>
There exists a situation where some, but not all, of those need to be regenerated?
14:11
<@Vornicus>
Sure, if I delete a directory.
14:11
<@ToxicFrog>
Aah. Like if you deleted the dir for one scalefactor but not another.
14:11
<@Vornicus>
Right
14:11 * ToxicFrog ponders
14:11
< Serah>
par2?
14:12
<@ToxicFrog>
I know you can do this with make, but I'm not sure that my make-fu is up to the task.
14:12 * ToxicFrog does some research
14:14
<@ToxicFrog>
...this is sick, but it might just work
14:14
<@Vornicus>
Show me.
14:15
<@ToxicFrog>
.for base in ${BASES}
14:15
<@ToxicFrog>
. for scale in ${SCALEFACTORS}
14:15
<@ToxicFrog>
. for terrain in ${TERRAINS}
14:16
<@ToxicFrog>
${base}/${scale}/terrain/${terrain}.png: ${terrain}.ps
14:16
< MyCatVerbs>
...
14:16
<@ToxicFrog>
gs $(GS_OPTS) -dSCALEFACTOR=${scale} -sOutputFile=$@ $<
14:17
<@Vornicus>
$BASE is actually the root directory of my system; inside of base is master, where all the ps files are stored. There's only one base, but.
14:17
< MyCatVerbs>
Naahhh, that's rather nice.
14:17
<@ToxicFrog>
. endfor
14:17
<@Vornicus>
Okay.
14:17
<@ToxicFrog>
. endfor
14:17
<@ToxicFrog>
.endfor
14:17
<@Vornicus>
Do I need those dots?
14:17
<@ToxicFrog>
I have not actually tested this and some twiddling may be needed to get variable expansion working right, it behaves oddly inside for.
14:17
<@ToxicFrog>
Yes.
14:17
<@Vornicus>
ok.
14:17
<@ToxicFrog>
They are like #directives in C.
14:18
<@ToxicFrog>
The loop is in fact unrolled to generate a bunch of rules when the makefile is loaded.
14:18
<@Vornicus>
What are $@ and $<?
14:19
< MyCatVerbs>
Vornicus: pain and hatred, respectively.
14:19
< MyCatVerbs>
It *is* a makefile, after all. ^_^
14:19
<@ToxicFrog>
$@ is the name of the output file.
14:19
<@ToxicFrog>
$< is the name of the first (or possibly the last) prerequisite file.
14:20
<@Vornicus>
gnumake says first. Okay.
14:21 * ToxicFrog ponders
14:21
<@ToxicFrog>
The gnumake manual mentions $(foreach), but not .for
14:21
<@ToxicFrog>
At least not that I can find
14:22
<@Vornicus>
ok
14:24
<@ToxicFrog>
So .for may be a BSDism, but you can get the same effect with $(foreach)
14:25
<@ToxicFrog>
http://www.gnu.org/software/autoconf/manual/make/Foreach-Function.html#Foreach-F unction
14:26
<@Vornicus>
I'm reading that, I have /no idea at all/ how it is supposed to be correctly use.
14:26
<@Vornicus>
used*
14:28
<@Vornicus>
hrm
14:31
<@Vornicus>
ah, that's how.
14:31
<@Vornicus>
okay.
14:33
<@Vornicus>
...wait, how do I repeat a foreach, so I get (1 1) (2 2) (3 3) instead of (1 1) (1 2) (1 3) (2 1) (2 2) (2 3) (3 1) (3 2) (3 3)?
14:34
<@ToxicFrog>
...er?
14:34
<@ToxicFrog>
How do you mean?
14:35
<@Vornicus>
As it is, if I do
14:38
<@Vornicus>
er
14:38
<@Vornicus>
damn, that's hard to write anyway.
14:39
<@Vornicus>
If have two distinct places that I have to say things - note how your original setup has ${terrain} showing up twice?
14:39
<@Vornicus>
Well, each $(foreach) is independent.
14:40
<@ToxicFrog>
...I'm still not sure what you're trying to say here.
14:42
<@Vornicus>
So instead of getting $base/1/terrain/hill.png: hill.ps and then $base/1/terrain/mountain.png: mountain.ps and that's it (if terrain only holds "hill mountain"), I also get $base/1/terrain/hill.png: mountain.ps and $base/1/terrain/mountain.png: hill.ps
14:44
<@ToxicFrog>
...
14:44
<@ToxicFrog>
You have two nested foreach loops both iterating over terrain?
14:44
<@Vornicus>
No, they're not nested.
14:44
<@Vornicus>
They're independent.
14:44
<@ToxicFrog>
What do you mean by "independent"?
14:46
<@Vornicus>
$(foreach terrain,$(terrains),$(terrain).png): $(foreach terrain, $(terrains),$(terrain).ps)
14:46
<@Vornicus>
is equivalent to
14:46
<@Vornicus>
for terrain in terrains:
14:46
<@Vornicus>
for terrain2 in terrains:
14:46
<@ToxicFrog>
Oh. Right.
14:46
<@Vornicus>
$terrain.png: $terrain2.ps
14:47
<@ToxicFrog>
$(foreach terrain,$(terrains),$terrain.png: $(terrain).ps)
14:47
<@ToxicFrog>
Only with the correct parens.
14:47
<@Vornicus>
...wow, okay, this is going to be insanity.
14:48
<@Vornicus>
(I didn't think you would be able to create a whole damn statement in a foreach)
14:51
<@ToxicFrog>
$(foreach scale,$(SCALEFACTORS),\
14:51
<@ToxicFrog>
$(foreach terrain,$(TERRAINS),\
14:51
<@ToxicFrog>
$(BASE)/$(scale)/terrain/$(terrain).png: $(terrain).ps
14:51
<@ToxicFrog>
gs etc etc etc
14:51
<@ToxicFrog>
))
14:51
<@ToxicFrog>
I think this will work.
14:52
<@Vornicus>
...lordy. Okay.
14:54
<@ToxicFrog>
(completely untested etc etc)
14:55
<@ToxicFrog>
...oh, hey.
14:55
<@ToxicFrog>
It looks like there may be a better way to do this. Kind of.
14:55
<@ToxicFrog>
Argh, maybe not
14:56
<@Vornicus>
?
14:56
<@ToxicFrog>
http://www.gnu.org/software/make/manual/html_node/Multiple-Targets.html#Multiple -Targets http://www.gnu.org/software/make/manual/html_node/Text-Functions.html#Text-Funct ions
14:56
<@ToxicFrog>
This is exactly what you need if we disregard scaling factors.
14:57
<@ToxicFrog>
With scaling factors, I think it can still be done more elegantly with foreach+subst than with foreach alone, but I just work up and can't put it together in my head.
14:58
<@Vornicus>
heh. Some segments need three variables; there's one file that gets run 144 times, over (red blue orange white brown green) * (1 2 3 4 5 6 7 8) * (east north sourth)
15:21
<@Vornicus>
hokay.
15:45 Mahal is now known as MahalBEDD
15:48 Doctor_Nick [~fdsaf@Nightstar-1992.9-67.se.res.rr.com] has joined #code
15:49 Vornicus [~vorn@67.50.40.ns-3674] has quit [Quit: Leaving]
15:51 Vornicus [~vorn@Admin.Nightstar.Net] has joined #code
15:51 mode/#code [+o Vornicus] by ChanServ
16:18 You're now known as TheWatcher
16:25 ErikMesoy [~ejm@Nightstar-12501.bb.online.no] has joined #code
16:36 AnnoDomini [~farkoff@Nightstar-29119.neoplus.adsl.tpnet.pl] has quit [Ping Timeout]
16:37
< MyCatVerbs>
Hrmn. Is it a good habit to get into to write all nontrivial code in tail-recursive form?
16:37 * Vornicus has No Make-Fu At All
16:38
<@Vornicus>
MCV: I would say not really.
16:39
<@Vornicus>
WEll, if the alternative is something recursive but not tail-recursive, then that's bad. But.
16:40
< MyCatVerbs>
Vornicus: wrt make-fu: join the club.
16:40
< MyCatVerbs>
Vornicus: but it just seems like such a natural way to phrase most code. :/
16:41 * ErikMesoy looks up tail-recursive.
16:42
<@Vornicus>
Tail recursive: def foo(): bla; bla; bla; return foo()
16:43 AnnoDomini [~farkoff@Nightstar-29026.neoplus.adsl.tpnet.pl] has joined #Code
16:43 * TheWatcher eyes this regexp, wtfs
16:46
<@TheWatcher>
my @foomatch = $foo =~ m{\[(<a href="../../references.html\#.*?">.*?</a>)\](?:\[(<a href="../../references.html\#.*?">.*?</a>)\])+}gm;
16:46
< ErikMesoy>
\#.*?">.*?</ indeed. Sounds like Donald Duck swearing.
16:46
<@TheWatcher>
should match a test string three times - it's actually matching twice, and capturing the first and last match, but not the middle one...
16:47
< MyCatVerbs>
ErikMesoy: "slashemhashemstarrquemark?"
16:47
< MyCatVerbs>
ErikMesoy: to me, that sounds rather more like Muttley. =D
16:47
< ErikMesoy>
Snide remark. Donald's curses are printed as "(?"%& et al to avoid actually using any word that poor innocent children might use in front of their parents.
16:48
< ErikMesoy>
Just hold Shift or AltGr and pres snumber keys.
16:48
< ErikMesoy>
s/s sn/ss n
17:11
< MyCatVerbs>
Is it wrong of me to build the whole of PLT Scheme just for the sake of running a single program which uses a circular list to endlessly print the string, "Teletubbies fucking in your brain! "?
17:11
< ErikMesoy>
No.
17:11 You're now known as TheWatcher[afk]
17:11
< GeekSoldier>
not at all, Verbing Kitty.
17:12
< ErikMesoy>
Anything with the words "teletubbies" and "fucking" in the same sentence is usually justified, although normally they are in reversed order. :P
17:12
< MyCatVerbs>
Thanks.
17:59
< MyCatVerbs>
Grumminitgrits. Is it actually possible to efficiently sort a linked list, or is it always neccessary to scribble its contents into an array and run an array sorting algorithm on them that way?
18:00 * GeekSoldier saw something relevant to this recently.
18:00 * GeekSoldier goes to search.
18:02
< GeekSoldier>
http://en.wikipedia.org/wiki/Radix_sort
18:03
< MyCatVerbs>
OTOH, I can think of one implementation, where you build an array of list elements and sort normally, dereferencing the pointers before passing them to the comparison function.
18:04
< GeekSoldier>
IIRC, this allows you to create a new, sorted list without the need of a new array.
18:05
< MyCatVerbs>
Schweet. Thanks.
18:05
< GeekSoldier>
nod nod.
18:05
<@ToxicFrog>
You can also use some array sorting algorithms such as insertion sort effectively.
18:05
< GeekSoldier>
no prob.
18:05
<@ToxicFrog>
Keeping in mind that element access is O(n) in a linked list.
18:06
<@jerith>
I was about to suggest an insertion sort.
18:06
<@ToxicFrog>
(indeed, insertion sort works better on linked lists than on most array implementations)
18:06
<@jerith>
O(n^2) time, iirc.
18:06
< MyCatVerbs>
ToxicFrog: !?
18:06
< MyCatVerbs>
ToxicFrog: singly- or doubly-linked?
18:06
<@jerith>
In an array you have to do a lot of copying.
18:07
<@Vornicus>
Insertion and merge sort are better on linked lists than on arrays, because linked lists you don't have to rearrange stuff to get it sorted, just change pointers.
18:07
<@ToxicFrog>
MyCatVerbs: either.
18:07
<@jerith>
Shouldn't really matter. You can still only traverse it linearly and inserts/deletes are cheap.
18:07
<@ToxicFrog>
This isn't intuitively obvious?
18:08
< MyCatVerbs>
Ah. So, if I understand this correctly, radix sorting is O(N), with the caveat that you need to be able to compute keys for elements, rather than using a function like cmp(x,y)?
18:08
<@Vornicus>
Other kinds of sorts - quicksort and heapsort in particular - are less friendly to linked lists because of all the rearrangement that goes on.
18:08
<@ToxicFrog>
MyCatVerbs: yes.
18:08
< MyCatVerbs>
ToxicFrog: not really, as I don't know what the insertion sort algorithm is.
18:08
<@ToxicFrog>
Oh, I thought you were !?ing at the O(n) thing.
18:09
<@ToxicFrog>
Insertion sort is basically this:
18:09
<@jerith>
Radix sort is O(n) because it pushes a big chunk of work out of the sort.
18:09
<@ToxicFrog>
for each element in the unsorted array:
18:09
<@ToxicFrog>
- search through the sorted array for the first element larger than this or the end of the array
18:09
<@jerith>
You still can't do better than O(nlogn) except with lots of duplicates.
18:09
<@ToxicFrog>
- insert the element from the unsorted array just before it
18:09
<@ToxicFrog>
I wasn't saying that the sort algorithm is O(n).
18:10
<@ToxicFrog>
Just that element access in an LL is, and that will affect the performance of the sorting algorithms.
18:10
< GeekSoldier>
what about a nice bubblesort?
18:10
<@jerith>
TF: I was referring to MCV on the radix thing.
18:10 * GeekSoldier invokes flame-shield.
18:10
<@Vornicus>
GS: Insertion sort is bubble sort where you can skip a lot of the bubbling.
18:11
<@jerith>
GS: Bubblesort is really good for small datasets.
18:11
<@Vornicus>
...I have the song from the Mushroom Kingdom in Mario RPG stuck in my head.
18:12
< GeekSoldier>
This one works well for some cases:
18:12
< GeekSoldier>
http://www.dangermouse.net/esoteric/intelligentdesignsort.html
18:14 * GeekSoldier suggests using IDS for all programs now.
18:14
<@jerith>
My personal favourite is the bogosort.
18:14
< Doctor_Nick>
oh GeekSoldier-kun -_-;;
18:15
< AnnoDomini>
http://www.cs.ubc.ca/~harrison/Java/sorting-demo.html
18:15
< MyCatVerbs>
One of my favourites is java.util.Array.sort.
18:15
< MyCatVerbs>
Specifically, because somebody *else* wrote it, saving me from bothering. =D
18:15
<@Vornicus>
Anno: that's great stuff.
18:15
< AnnoDomini>
I know, you've told me that the last time I linked that, in the past. :)
18:16 * GeekSoldier just came from there. is dizzy from all the blinkenlines.
18:21
< ErikMesoy>
Niiiiifty sort page!
18:21
< MyCatVerbs>
Hrmn. AI-22 algorithm.
18:21
< MyCatVerbs>
How does this sound for an RTS AI system?
18:22
< MyCatVerbs>
(for individual units' tactics, not the strategic stuff)
18:22
< AnnoDomini>
Mysterious.
18:22
< MyCatVerbs>
- if current situation doesn't fit any known pattern, do something entirely at random
18:22
< ErikMesoy>
Snrrk.
18:23
< ErikMesoy>
Can I make a suggestion?
18:23
< MyCatVerbs>
- if the unit that attempted something random survives, add situation and the association to the pattern list when it gets back to base =D
18:23
< ErikMesoy>
LOL
18:23
< ErikMesoy>
How random is "random"?
18:23
< ErikMesoy>
This reminds me of the two-circles problem.
18:23
< MyCatVerbs>
(with a priority factor based on its health and how much stuff it managed to kill along the way)
18:23
< MyCatVerbs>
ErikMesoy: oh?
18:24
< MyCatVerbs>
Er, I mean, which is?
18:24
< GeekSoldier>
That could be a plan, MyCatVerbs.
18:24
< ErikMesoy>
Given two circles centered around the same point, one half the size and one quarter the area of the other, how many chords through the large circle pass through the small circle?
18:24
< ErikMesoy>
"chords" may be the wrong word, heard it in Norwegian, "korde"
18:24
< GeekSoldier>
that way the whole society learns from the experienco of one.
18:25
<@Vornicus>
chords is the right word, Erik.
18:25
< GeekSoldier>
if only there was a way to help them learn from the deaths of their compatriots, though...
18:25
< ErikMesoy>
Ah. See, depending on how you calculate, the answer varies
18:26
< MyCatVerbs>
GeekSoldier: every time a unit dies, reduce the prioritisation of whatever plan it was following?
18:26
<@Vornicus>
2/3 is the right answer.
18:26
< ErikMesoy>
eg. start with a point on the edge of the large circle, draw all possible chords from it (180 degrees), figure out how many intersect the small circle.
18:26
<@Vornicus>
er, 1/3
18:26
< MyCatVerbs>
ErikMesoy: if there's more than one answer, depending on how you go about the calculation, then the problem must be underspecified.
18:26
< ErikMesoy>
Or, going along the plane in direction A, how many of the perpendicular lines to A touch the small circle?
18:26
< ErikMesoy>
1/2
18:27
<@Vornicus>
Then you don't have the same density of points on the large circle, that one's wrong.
18:27
< ErikMesoy>
MyCatVerbs: No, that isn't the problem with it according to my teacher, the problem is how to divide a plane into lines/chords or dividing a line into points.
18:28
< MyCatVerbs>
ErikMesoy: whut? If there's a method that must be followed to solve the problem which isn't specified then the whole problem is underspecified.
18:29
< ErikMesoy>
Vornicus: Seeing as I can map a small circle to a large circle by using points defined with fractional polar coords, the density of points is, if you'll pardon the ATROCIOUS pun, completely pointless.
18:29
< MyCatVerbs>
(I phrased that badly. Whoopsie.)
18:29
<@Vornicus>
sigh.
18:30
< ErikMesoy>
MyCatVerbs: There is no one method that must be followed. There are several methods which give different answers as all of them involve (inf/inf) in their calculations.
18:30
< MyCatVerbs>
ErikMesoy: "there are several possible methods which give different results and the problem doesn't specify which one to use" <-- that is underspecification!
18:31
<@Vornicus>
The problem with the various answers other than 1/3 is that they do not assume uniform density of points along the outside circle.
18:31
<@Vornicus>
And, yes, continuous things can have relative density.
18:31
< ErikMesoy>
Well, if I asked you to simplify (x-3)(x?-6x+9) you could either write it out as a third-degree polynomial or as a first-degree parenthesis to the third power. But those are still equivalent to one another.
18:32
< ErikMesoy>
Vornicus: How are you getting 1/3?
18:33
< MyCatVerbs>
ErikMesoy: results are not different if they are equivalent to one another, duh?
18:33
< ErikMesoy>
wait, I'm googling
18:33
< ErikMesoy>
I didn't really understand it (it's a paradox after all) and nor did my teacher
18:34
<@Vornicus>
Simple - 2 * asin(1/2) = pi/3. Therefore, from any given direction, 1/3 of the far side of the large circle is shadowed by the small circle.
18:34
< ErikMesoy>
Aha - it appears to be a variant of Bertrand's. http://www.cut-the-knot.org/bertrand.shtml
18:35
< ErikMesoy>
Anyway, they have that point which I was trying to make when MyCatVerbs was proposing an AI algorithm to do random things - "The notion of uniform randomness is actually less obvious than appeared at the first glance."
18:35
< Doctor_Nick>
whats the best way to seed randomness, system time?
18:35
< MyCatVerbs>
ErikMesoy: you could've just *said* that. And you'd have actually succeeded in making your point, too.
18:36
<@Vornicus>
Doctor_Nick: hardware noise. /dev/urandom if you have it
18:36
< MyCatVerbs>
Doctor_Nick: Hell no. Well, it's the easiest, but it's crap.
18:36
< MyCatVerbs>
Doctor_Nick: thermal noise is a good one, disk interrupt timings, network interrupt timings...
18:37 Thaqui [~Thaqui@Nightstar-25354.jetstream.xtra.co.nz] has joined #code
18:37
< Doctor_Nick>
thermal noise?
18:37
<@Vornicus>
Many old console games ran the generator constantly during the title screen.
18:38
< MyCatVerbs>
A good one if you're writing programs where there's guaranteed to be a) a human at the keyboard and b) a paragraph or so (at least) of textual input before you need to pull any random variables out is to use a high-resolution clock to time the user's keystrokes and throw the third or fourth differentials of them into the entropy pool.
18:38
< MyCatVerbs>
However, /dev/*random trumps all other solutions because the kernel developers already did the hard work on your behalf.
18:41
< MyCatVerbs>
(First time you bring a FreeBSD system up, it will generate SSH keys. The way it gets entropy with which to do this is by requesting that the user bang on the keyboard like a monkey for about a page's worth of text or so. ^_^)
18:42
< Doctor_Nick>
but won't it tend towards home row keys?
18:42 You're now known as TheWatcher
18:42
<@jerith>
It's measuring timing rather than keys.
18:42
<@jerith>
Or as well as.
18:42
<@jerith>
Keys will be too clumped.
18:42
< ErikMesoy>
With high precision and discarding the early digits, I suppose?
18:43
< MyCatVerbs>
Quite probably yes. But it doesn't matter.
18:43
< MyCatVerbs>
You don't read data out of the entropy pool for the /dev/random interface.
18:43 Thaqui [~Thaqui@Nightstar-25354.jetstream.xtra.co.nz] has quit [Quit: Leaving]
18:44
< MyCatVerbs>
Instead, you hash the entropy pool, subtract the length of the hash from the entropy pool's quality value and then return the hash.
18:46 Thaqui [~Thaqui@219.88.81.ns-11836] has joined #code
18:46
< MyCatVerbs>
Adding data to the entropy pool then works as you'd expect it to - you munge the new data in to the entropy pool by some means and add a -conservative- estimate of how random the data you just added was to the pool's quality value.
18:47
< MyCatVerbs>
Then the only difference between the secure and unsecured interfaces to the random number generator is that the secure one blocks if asked for data while the quality value is zero. ^_^
18:51
< MyCatVerbs>
Hmmm. Java's interface to random number generation seems to be damn good.
18:52
<@Vornicus>
Java's actual random number generation, on the other hand, is unmitigated crap.
18:52
< MyCatVerbs>
SecureRandom class?
18:53
< MyCatVerbs>
I presume java.util.Random is probably something shit
18:54
<@Vornicus>
I've never heard of SecureRandom - java.util.Random is a 48-bit Linear Congruential piece of shit.
18:55
< MyCatVerbs>
Ugh, no, it's pretty poor, too.
18:55 Chalcedon [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has joined #code
18:55 mode/#code [+o Chalcedon] by ChanServ
18:56 * Vornicus wants Mersenne Twister for non-secure randomness.
18:56
< MyCatVerbs>
The API's good, but the default implementation that Sun ships is apparently something called "SHA1PRNG"
18:57
< MyCatVerbs>
Hrmn. Does Windows provide any secure random number sources equivalent to /dev/random?
18:57 * MyCatVerbs hugs Chalcy.
18:57
< GeekSoldier>
yes.
18:57 * Chalcedon hugs MCO
18:57
< MyCatVerbs>
Yay, hugs!
18:58
< GeekSoldier>
time.bluescreen(last)
18:58
< MyCatVerbs>
GeekSoldier: whassit called, please?
18:58 * Vornicus applies stoatherd's pie to Chalcy.
18:58 * GeekSoldier was being a retarded smartass.
18:58 * Chalcedon carefully put stoatherd pie away for later and hug Vornicus
18:58
< MyCatVerbs>
Haw haw. That's deterministic and can be calculated from when.isItMostInConvenientFor(thiscomputer.User);
18:59
<@ToxicFrog>
MyCatVerbs: no, it doesn't.
19:00
< MyCatVerbs>
That's kinda disappointing, even for Microsoft.
19:00
< MyCatVerbs>
Surely .NET does, at least!?
19:02
<@ToxicFrog>
Perhaps, but in that case I wouldn't count it anyways.
19:02
<@ToxicFrog>
Since it's only accessible to .NET languages.
19:03
< MyCatVerbs>
Well, assuming MS get their own way, they're going to be pretty much equivalent pretty soon.
19:04
<@ToxicFrog>
What are?
19:05
< MyCatVerbs>
.NET and, "programming on Windows," in general.
19:06
<@ToxicFrog>
Aah.
19:09
< MyCatVerbs>
They're already passed the point where it's plain uneconomical to program in anything else, and it's shipping preinstalled on all new computers now.
19:10
< ErikMesoy>
wate wut
19:10
< ErikMesoy>
How did it get uneconomical to program in better languages?
19:11
< ErikMesoy>
Did they add a Clippit that springs up an annoys you if you're not programming in .NET?
19:12 Chalcy [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has joined #code
19:12 mode/#code [+o Chalcy] by ChanServ
19:12
< MyCatVerbs>
ErikMesoy: AFAIK, the .NET API is much easier to program against than the Win32 API. Plus all the .NET languages have GC and other related goodness, so that the easiest way to program in Windows now should theoretically be to use a .NET language.
19:12 Chalcedon [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has quit [Killed (NickServ (GHOST command used by Chalcy))]
19:12 Chalcy is now known as Chalcedon
19:13 * ErikMesoy prefers to program in what's basically notepad with syntax highlighting, ATM
19:18
<@ToxicFrog>
ErikMesoy: no, that's the editor you're using.
19:18
<@ToxicFrog>
.NET is an API, and a set of languages that use that API, all of which are windows-specific.
19:18
<@ToxicFrog>
For example, I program using NEdit, but in Lua and POSIX C99.
19:24 * jerith slips a copy of emacs onto ErikMesoy's machine.
19:27 * ErikMesoy had understood what .NET was.
19:27 * ErikMesoy is fixing a punctured bicycle
19:27 * ErikMesoy programs *in* Java, then, atm. For lack of options.
19:27 * EvilDarkLord suggests Python, for it is fun.
19:28 * jerith suggests Erlang, for it is brainbendy.
19:29
< GeekSoldier>
yay pytherlang!
19:31
<@EvilDarkLord>
Pyrlang, perhaps?
19:32 * GeekSoldier ponders at teh syntax of pyrlang.
19:34
< MyCatVerbs>
Of course, I'm assuming that the .NET API really is easier to use than the Win32 API (and whatever replaces it in Vista - which is .NET, isn't it?)?
19:34
<@EvilDarkLord>
I think that's .NET with a bigger version number slapped on.
19:35 * MyCatVerbs suggets Scheme, for it is made to look like oatmeal due to the enormous quantity of parens.
19:35
< MyCatVerbs>
*suggests, dammit.
19:35
< GeekSoldier>
Yay Schpyralng!
19:36
< GeekSoldier>
Schpyrlang, I meant.
19:36
<@EvilDarkLord>
Schpyrlang++!
19:36
< MyCatVerbs>
One thing I don't understand in Scheme. Why design the language to *force* people to use tail recursion?
19:36
< GeekSoldier>
.Schpyrlang++
19:37
< MyCatVerbs>
Not that it's inconvenient or in any way a problem, but, eh. To anyone coming from C or whatever it's going to feel ridiculously convoluted.
19:38
< GeekSoldier>
indeed it is, but most functional languages require recursion to loop, IIRC.
19:38
<@jerith>
It avoids looping constructs.
19:39
<@jerith>
And replaces them with function calls, which is what fp is all about anyway.
19:39
< GeekSoldier>
plus it looks impressive to your C++-only friends.
19:39
< GeekSoldier>
:D
19:40
<@ToxicFrog>
MyCatVerbs: scheme is minimalist. You can implement looping constructs in terms of tail recursion (as in, actually write for/while/etc) without touching the terp.
19:40
<@ToxicFrog>
So, why build them in when, if you need them and want the syntactic sugar, you can easily provide your own implementation?
19:40
<@Vornicus>
Muaha, cheesypoofs!
19:40
< MyCatVerbs>
Jah, but since there's nothing stopping me implementing "while" as a macro anyway, there's no point not putting it in the interpreter?
19:41
<@ToxicFrog>
...too many negatives there.
19:41
<@ToxicFrog>
Since you can do it without putting it in the terp, there's no point in putting it in the terp.
19:41
< MyCatVerbs>
Sorry. There's nothing stopping me from implementing C's looping constructs as macros.
19:41
<@ToxicFrog>
If it could only be done by modifying the terp, maybe it would be a language builtin.
19:41
<@ToxicFrog>
But this isn't the case.
19:42
< MyCatVerbs>
However, real terps have many things implemented in them that could alternatively be done entirely with macros instead, for the sake of speed.
19:43
< MyCatVerbs>
So why force people to reinvent the wheel when you're already having to provide two thirds of the rest of the car anyway?
19:43
<@ToxicFrog>
Speed has nothing to do with this.
19:43
<@ToxicFrog>
First of all, if it were a builtin, it would be written in Scheme anyways and give no performance benefit.
19:43
<@ToxicFrog>
As well as making the scheme terp larger.
19:43
< MyCatVerbs>
I didn't say it did.
19:44
<@ToxicFrog>
Personally, I don't actually agree with this design decision. But I can see why they made it.
19:44
<@ToxicFrog>
Especially since, as Scheme is used heavily as a teaching language, this provides incentive to learn about tail-recursive loops by implementing them yourself.
19:44
< MyCatVerbs>
I said that Scheme terps are always less minimalist than they could get away with, for performance reasons, making this particular piece of minimalism vaguely pointless.
19:45
<@Vornicus>
Schpyrlangellby++, surely.
19:45
< MyCatVerbs>
You can dump the "for performance reasons" clause from that sentence even, it's not really relevant.
19:45
< MyCatVerbs>
Vornicus: you forgot Haskell and FORTRAN.
19:45
<@Vornicus>
ell is haskell.
19:45
< MyCatVerbs>
Oh, right. Um, Pascal?
19:46
<@Vornicus>
FORProSchpyascrlangellby++#, surely.
19:46 * MyCatVerbs thinks, carefully.
19:46
< MyCatVerbs>
Vornicus: Whitespace!
19:46
<@Vornicus>
FORProSchpy ascrlangellby++#
19:47
< ErikMesoy>
Hmm. Could one usefully merge Whitespace with Haifu?
19:47
< MyCatVerbs>
ErikMesoy: that's the beautiful thing. With the exception of Python, you can successfully embed Whitespace programs inside of programs in pretty much *any* other language.
19:48
< MyCatVerbs>
OOOOH, there's an idea! A Whitespace terp written in C which runs a Whitespace program embedded within itself.
19:48
< GeekSoldier>
brainf*ck?
19:49
< ErikMesoy>
Haifu requires that your programs have english haiku sentence structure.
19:49
< MyCatVerbs>
Which, in turn... er, I dunno. Factors large numbers efficiently?
19:49
<@Vornicus>
sigh.
19:49
< GeekSoldier>
Vorn is working on ending all flame wars of "my language is better than yours" by creating the Esperanto of programming languages.
19:50
<@Vornicus>
I am?
19:50
< MyCatVerbs>
There are something like eight thousand programming languages, dude. Dunwurry 'bout it.
19:50
< GeekSoldier>
.FORProSchpy ascrlangellby++#
19:50
< MyCatVerbs>
GeekSoldier: and you just *know* that as soon as he succeeds, somebody else will come up with the programming equivalent of Lobjan and the two communities will forge a rift between one another that destroys the entire human race.
19:51
<@Vornicus>
ah, so
19:51
< GeekSoldier>
Yay!
19:51 * GeekSoldier waits in the wings.
19:51
< ErikMesoy>
Tolkien's Elvish languages > Esperanto.
19:51
< ErikMesoy>
And iirc, Klingon is somewhere between them.
19:51 * GeekSoldier once was able to speak passable Quenya.
19:51
< MyCatVerbs>
ErikMesoy: you what?
19:52
<@jerith>
I've dabbled in Quenya.
19:52
< MyCatVerbs>
ErikMesoy: Tolkienian Elvish is based on Welsh, dude.
19:52
<@jerith>
But now I sleep.
19:52
< GeekSoldier>
finnish, largely.
19:52
< MyCatVerbs>
Nin.
19:52
< GeekSoldier>
night again, jerith.
19:52
< ErikMesoy>
Based on whatever sounded pleasing.
19:52
< MyCatVerbs>
GeekSoldier: hmmm?
19:53
< MyCatVerbs>
No, the grammar is just Welsh with all the inconsistent forms pruned. The *vocabluary* is based on whatever sounded pleasing.
19:53
< GeekSoldier>
grammar mostly comes from finno-ugric languages, with word constructs and such coming from welsh and other celtic-derived languages.
19:54
< MyCatVerbs>
What, really? I thought it was the other way around (though I didn't know Finnish was involved at all).
19:54
< ErikMesoy>
And the vowel marks are based on Hebrew, I hear.
19:54
< ErikMesoy>
And some of the plurals too.
19:55
< MyCatVerbs>
So, um, what's Klingon based on?
19:56 GeekSoldier_ [Rob@Nightstar-3475.pools.arcor-ip.net] has joined #code
19:56
< GeekSoldier_>
the idea of vowel diacritics comes from semitic languages, like Hebrew and Arabic.
19:56
< GeekSoldier_>
damn.
19:56 GeekSoldier [Rob@Nightstar-5487.pools.arcor-ip.net] has quit [Killed (NickServ (GHOST command used by GeekSoldier_))]
19:56 GeekSoldier_ is now known as GeekSoldier
19:56
< MyCatVerbs>
Last I got from you was "And some of the plurals, too."
19:57
<@Vornicus>
Klingon is a language with an intentionally odd grammar structure
19:57
< MyCatVerbs>
Adn I asked "So, um, what's Klingon based on?" >_>
19:58
<@Vornicus>
The most common word order in Klingon is Object Verb Subject, and in some cases the word order is the exact reverse of word order in English:
19:59
<@Vornicus>
http://en.wikipedia.org/wiki/Klingon_language#Grammar
19:59
< MyCatVerbs>
Do they at least have German style subject-the and object-the?
20:00
< MyCatVerbs>
"Subject-the postman bit actor-the dog." <--- means Postie needs new trousers.
20:00
< MyCatVerbs>
s/object-/actor-/
20:17 Chalcedon [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has quit [Ping Timeout]
20:17 Chalcedon [~Chalceon@Nightstar-869.bitstream.orcon.net.nz] has joined #code
20:17 mode/#code [+o Chalcedon] by ChanServ
20:24 Thaqui [~Thaqui@219.88.81.ns-11836] has left #code [Leaving]
21:40 ErikMesoy is now known as ErikMesoy|sleep-soon
21:55 ErikMesoy|sleep-soon is now known as ErikMesoy|sleep
22:05 You're now known as TheWatcher[T-2]
22:09 You're now known as TheWatcher[zZzZ]
22:15
<@Vornicus>
...hrm. You know, I remember a fourth way of line capping. It's not common anymore though.
22:15
< MyCatVerbs>
Vornicus: hmmm? Whassat?
22:16
< AnnoDomini>
Take a hammer. Apply to kneeca--
22:16
< AnnoDomini>
Oh, wait. Nevermind.
22:16
< AnnoDomini>
Wrong cap. :P
22:17
<@Vornicus>
Well, usually you have three ways of capping lines: the "butt" cap, which squares off the line at the exact point where it ends, the "round" cap, which puts a circle at the endpoint, and the "square" cap, which extends the line by half a line width and squares it off there.
22:19
<@Vornicus>
Old drawing programs would use a "clip" cap, which cuts off the line along the horizontal and vertical axes.
22:30 MyCatVerbs is now known as MyCatHungers
22:42 Thaqui [~Thaqui@Nightstar-25354.jetstream.xtra.co.nz] has joined #code
22:55 BlueTiger [BlueTiger@Nightstar-567.natsoe.res.rr.com] has joined #Code
22:58 GeekSoldier is now known as SleepingSoldier
23:18 BlueTiger [BlueTiger@Nightstar-567.natsoe.res.rr.com] has quit [Quit: ]
23:21 ToxicFrog [~ToxicFrog@Admin.Nightstar.Net] has quit [Quit: Leaving]
23:21 ToxicFrog [~ToxicFrog@Admin.Nightstar.Net] has joined #code
23:21 mode/#code [+o ToxicFrog] by ChanServ
23:36
<@Vornicus>
Arg! Why does gs not recognize that I'm giving it extra include paths!?
23:39 ReivZzz is now known as Reiver
23:41 MahalBEDD is now known as Mahal
23:50 Reiver is now known as ReivOut
--- Log closed Wed Mar 07 00:00:51 2007
code logs -> 2007 -> Tue, 06 Mar 2007< code.20070305.log - code.20070307.log >