code logs -> 2007 -> Mon, 01 Oct 2007< code.20070930.log - code.20071002.log >
--- Log opened Mon Oct 01 00:00:20 2007
03:16
<@Vornicus>
Chalain: so you know, the non-curving way to do it (useful if you're dealing with fast creatures where the guidance is highly visible) is to 1. determine the function that describes the ratio of distances from the tower's point and the critter's starting point (not hard); solve that for the ratio of speeds of the critter and the bullet (may be hard; best bet is probably to use Newton), and have the tower aim at that point (trivial)
03:17
<@jerith>
Vorn: did you see our trig in #math?
03:18
<@Vornicus>
if you're doing a hell of a lot of one-speed bullets vs. one-speed critters, you can define an overall function as the level line of the first function through all of space.
03:18
<@Vornicus>
jerith: I did not.
03:19
<@jerith>
Ah. We solved for the angle required to cause bullet/bug intersection based on the ratio of speed, the relative position and the bug's velocity.
03:20
<@Vornicus>
aha
03:35 Vikedal[zzz] [~bubbad@Nightstar-25812.dhcp.roch.mn.charter.com] has joined #code
03:35 Vikedal[zzz] [~bubbad@Nightstar-25812.dhcp.roch.mn.charter.com] has quit [Killed (NickServ (GHOST command used by Vikedal))]
03:36 Vikedal[zzz] [~bubbad@Nightstar-25812.dhcp.roch.mn.charter.com] has joined #code
03:36 Vikedal[zzz] [~bubbad@Nightstar-25812.dhcp.roch.mn.charter.com] has quit [Killed (NickServ (GHOST command used by Vikedal))]
03:38 Takyoji [~caleblang@Nightstar-25812.dhcp.roch.mn.charter.com] has joined #code
03:45 Vikedal [Vikedal@Nightstar-18893.hsd1.nm.comcast.net] has joined #code
03:51
< Takyoji>
Is there any other languages that uses an invocation like perl has? You know, the #!/bin/perl thing
03:51
<@jerith>
That's a *nix shell thing.
03:52
< Takyoji>
Oh..
03:52
<@jerith>
All it does is tell the shell to to run the command after the #! and feed the file to it.
03:53
<@jerith>
So pretty much any language with an interpreter will do it.
03:53
< Takyoji>
ahh
03:53
<@jerith>
And some compiled languages can play tricks to do it as well.
03:55
< Takyoji>
I know it sounds like a stupid question, but what interpreted languages run just by simply calling them from bash?
03:55
< Takyoji>
Or wait..
03:55
< Takyoji>
A better question would be..
03:56
< Takyoji>
What language would you suggest to make a cross-compatible server program?
03:56
<@jerith>
What do you want it to do and what must it be compatible with?
03:57
< Takyoji>
To be able to accept requests in a special format, and to be able to access databases.
03:57
< Takyoji>
To accept requests in TCP, that is
03:57
<@jerith>
Any of them, really.
03:58
< Takyoji>
Like..?
03:58
< Takyoji>
C++, Java, Perl?
03:58
<@jerith>
Python, Ruby, Java, Perl, C/C++, Erlang, Haskell, SmallTalk, Scheme, ...
03:58
<@jerith>
I could go on for ages.
04:00
<@jerith>
I'd probably use Python or Erlang, depending on the requirements.
04:00
<@jerith>
But that's mostly because those are my current favourites.
04:00
< Takyoji>
If I were to use C++, what library should I use for sockets or threads?
04:00
< Takyoji>
ahh
04:01
<@jerith>
You don't want to use threads ever.
04:01 * Vornicus highly recommends Python.
04:01
<@jerith>
And even when you do, you don't.
04:01
<@jerith>
They are an evil, stupid performance hack.
04:01
<@Vornicus>
there are good cases for threads, but you really have to know what you're doing.
04:01
<@jerith>
And cause nothing but pain.
04:01
<@Vornicus>
I mean, /really/.
04:02 GeekSoldier|bed is now known as GeekSoldier|work
04:02
< Takyoji>
Threads are for allowing several instances to be processed at once, right?
04:02
<@jerith>
No.
04:02
< Takyoji>
Then?
04:02
<@jerith>
Threads are one implementation of concurrency that uses shared memory.
04:02
< Takyoji>
oh
04:02
<@jerith>
This leads to much woe and gnashing of teeth.
04:03
< Takyoji>
I'd assume so
04:03
<@jerith>
You want coroutines or processes.
04:03
<@Vornicus>
If you can manage a message/socket/pipe-based model you're better off.
04:03
< Takyoji>
k
04:04
<@jerith>
Processes are non-shared-memory concurrency. Usully message passing.
04:04
<@jerith>
Coroutines can be shared memory, but context switches are explicit, so locking and race condition woes are more manageable.
04:05
< Takyoji>
So when someone means a 'multi-threaded server', what would it specifically mean?
04:05
<@jerith>
Usually exactly that.
04:05
<@Vornicus>
Generally it means that individual requests are handled asynchronously, using threads, processes, or coroutines.
04:05
<@jerith>
Most languages have native (or hacked-on) support for threads because they look easier at first glance.
04:05
< Takyoji>
ahh
04:05
<@Vornicus>
Apache uses processes.
04:06
<@jerith>
"multi-threaded" has become something of a catchall name for concurrency.
04:06
<@jerith>
Vorn: Modern apaches can use threads too.
04:06
<@Vornicus>
True.
04:06
<@jerith>
Which has performance benefifts.
04:07
<@jerith>
As I said, threads are a performance hack.
04:07
<@Vornicus>
Generally threads tend towards the other two forms as your design grows up.
04:07
<@jerith>
Lightweight processes would be better, but few systems support them properly.
04:07 * jerith hugs Erlang.
04:07
<@jerith>
I'm babbling.
04:07
<@jerith>
I need sleep.
04:08
<@Vornicus>
Get some sleep.
04:08
<@jerith>
I think I'm going to leave my car parked here and walk up the hill to my cousins.
04:08
<@jerith>
I have no bed for the next hour or so.
04:08
<@jerith>
I'm at work still.
04:09
< Takyoji>
What's your career?
04:09
<@Vornicus>
:(
04:09
<@jerith>
Software developer for Amazon Web Services.
04:09
< Takyoji>
ahh
04:09
<@jerith>
That stuff you're asking about now? That's pretty much what I do.
04:09
<@jerith>
Only moreso.
04:09
< Takyoji>
ahh
04:09
< Takyoji>
Which aspect of it?
04:10
<@jerith>
I write application servers.
04:10
<@jerith>
I write billing systems.
04:10
<@jerith>
I write fleet management interfaces.
04:10
<@jerith>
I write machine buildout systems.
04:11
<@jerith>
I used to write docs, but we hired a techwrite.
04:11
<@jerith>
+r
04:11
< Takyoji>
ahh
04:11
<@jerith>
I get paged in the middle of the night when servers catch fire.
04:11
<@jerith>
I fix things on weekends and order takeout lunch for the boss to pay for. ;-)
04:12
<@jerith>
(Yay Wang Thai, btw.)
04:13
<@Vornicus>
Everybody Wang Thai Tonight!
04:23
< Takyoji>
night folks
04:24
<@jerith>
Morning.
04:24
< Takyoji>
heh
04:24 Takyoji [~caleblang@Nightstar-25812.dhcp.roch.mn.charter.com] has quit [Quit: ]
04:53 Vikedal [Vikedal@Nightstar-18893.hsd1.nm.comcast.net] has left #code []
04:59 Forj [~Forj@Nightstar-10836.ue.woosh.co.nz] has joined #code
04:59 mode/#code [+o Forj] by ChanServ
05:24 ReivOut [~reaverta@Admin.Nightstar.Net] has quit [Ping Timeout]
05:25 DiceBot [~Reiver@Nightstar-29823.ubs-dsl.xnet.co.nz] has quit [Ping Timeout]
05:26 ReivOut [~reaverta@Admin.Nightstar.Net] has joined #Code
05:26 DiceBot [~Reiver@Nightstar-3908.ubs-dsl.xnet.co.nz] has joined #Code
05:26 mode/#code [+v DiceBot] by ChanServ
07:09 Vornicus is now known as Vornicus-Latens
07:27 GeekSoldier|work [~Rob@Nightstar-3294.pools.arcor-ip.net] has quit [Ping Timeout]
08:50 You're now known as TheWatcher
10:08 Chalcedon [~Chalcedon@Nightstar-10836.ue.woosh.co.nz] has quit [Quit: Gone]
10:45 Forj [~Forj@Nightstar-10836.ue.woosh.co.nz] has quit [Quit: Gone]
12:32 Thaqui [~Thaqui@Nightstar-26516.jetstream.xtra.co.nz] has quit [Quit: This computer has gone to sleep]
12:47 gnolam [lenin@Nightstar-10613.8.5.253.static.se.wasadata.net] has joined #Code
12:47 mode/#code [+o gnolam] by ChanServ
14:30 * ToxicFrog upreads. Hey, I like threads!
14:32
<@ToxicFrog>
Although in fairness I should note that the form of threads I like doesn't actually require shared memory~
14:34
<@ToxicFrog>
(synchronous message passing, specifically, which you can make way faster with shared memory - especially if your underlying design guarantees the integrity of pointer passes - but doesn't absolutely require it)
14:36
<@ToxicFrog>
(furthermore, as long as your ITC graph is acyclic, you can't deadlock without introducing more synchronization gestures)
14:43 * TheWatcher generally likes threads, in pretty much every language he knows. Except Java, wherein they appear to have been /specially designed/ to be a source of unending woe, gnashing of teeth and hair loss
14:53
<@ToxicFrog>
Java threads are ok, provided you toss out their existing synchro mechanism and replace it with message-passing~
14:54
<@ToxicFrog>
(or, rather, build message-passing on top of it, which is surprisingly easy)
15:15 KarmaBot [~fark.off@87.72.35.ns-26506] has quit [Ping Timeout]
15:15 Kyrre [~Z@87.72.35.ns-26506] has quit [Ping Timeout]
16:09
<@jerith>
ToxicFrog: If you use mesage passing and don't share memory, they are no longer threads.
16:09
<@jerith>
+s
16:15 GeekSoldier|work [~Rob@Nightstar-5167.pools.arcor-ip.net] has joined #code
16:18 GeekSoldier|work is now known as GeekSoldier
16:23
<@ToxicFrog>
jerith: they are if the OS thinks they are. Surtr, for example, does not share memory between VMs (although the underlying message pass implementation does), but they still share a process ID.
16:24
<@jerith>
ToxicFrog: Sure, you're using OS threads as a base for implementing processes.
16:33
<@ToxicFrog>
So what would you say it was if the -OS- implemented threads such that they can't directly share memory, but share a PID and other process-specific properties?
16:33
<@ToxicFrog>
Alternately, what if there's no distinction between threads and processes, and everything has a unique ID and shares memory with everything else?
16:35
<@jerith>
ToxicFrog: The distinction is that threads share memory and processes don't.
16:37
<@ToxicFrog>
I disagree. By those standards everything in SGOS is a thread in a single metaprocess, but there's a clear conceptual division between threads and processes even in those circumstances.
16:37
<@jerith>
There are different types of threads and processes.
16:38
<@jerith>
OS processes are very different from Erlang's VM processes.
16:41
<@ToxicFrog>
And Thoth OS processes are very different from Linux ones.
17:18 You're now known as TheWatcher[afk]
17:27 Vornicus-Latens is now known as Vornicus
17:48 KarmaBot [~fark.off@130.227.16.ns-12529] has joined #Code
17:48 mode/#code [+v KarmaBot] by ChanServ
17:54 Kyrre [~Z@130.227.16.ns-12529] has joined #Code
18:23 ToxicFrog [~ToxicFrog@Admin.Nightstar.Net] has quit [Operation timed out]
18:24 ToxicFrog [~ToxicFrog@Admin.Nightstar.Net] has joined #code
18:25 mode/#code [+o ToxicFrog] by ChanServ
18:26 Forj [~Forj@Nightstar-10836.ue.woosh.co.nz] has joined #code
18:26 mode/#code [+o Forj] by ChanServ
18:50 Forj [~Forj@Nightstar-10836.ue.woosh.co.nz] has quit [Quit: Gone]
19:01 You're now known as TheWatcher
19:47 * ToxicFrog fiddles with genetic algorithms
19:47
<@ToxicFrog>
Anyone here grok tournament selection?
19:49 * Vornicus looks it up.
19:50
<@Vornicus>
oh, it's like this.
19:51
<@Vornicus>
You rank your guys on order of fitness, then put them into a single-elimination tournament.
19:51
<@Vornicus>
and each "match" has a set probability p of choosing the "more fit" over the "less fit"
19:52
<@Vornicus>
and that's it.
19:53
<@Vornicus>
...well, except that technically the numbers it's giving aren't that. I wonder how it actually does it.
19:54
<@ToxicFrog>
The explanation I have is "population P, tournament size k, select k members of P and then grab the best of those, repeat for n iterations"
19:54
<@ToxicFrog>
But that feels too simple, somehow
19:54
<@Vornicus>
It is a bit too simple.
19:55
<@Vornicus>
Okay, you have population P and tournament size k, and a probability p.
19:55
<@Vornicus>
select k members of P.
19:55
<@Vornicus>
Sort them in order of fitness.
19:56
<@Vornicus>
for each member in the tournament:
19:56
<@Vornicus>
get a random number from 0 to 1, compare to p.
19:56
<@Vornicus>
if less than p: choose this member, stop iteration.
19:56
<@Vornicus>
else: keep going.
19:58
<@Vornicus>
p should be higher than 0.5
19:59
<@Vornicus>
What you have described is with p of 1.
19:59
<@ToxicFrog>
Aah.
20:00
<@ToxicFrog>
Thank you. This will be useful.
20:00
<@Vornicus>
I don't know what to do if you run out of members. Probably start the tournament at the beginning.
20:03
<@Vornicus>
you can also get different selection landscapes if you use different metrics; you can, for instance, use a single elimination tournament instead of the setup given here, or vary the probability based on the fitness of various competitors.
20:06 GeekSoldier is now known as GeekSoldier|bed
20:40 AnnoDomini is now known as AbuDhabi
20:40 AbuDhabi is now known as AnnoDomini
20:51
<@McMartin>
Grr.
20:51
<@McMartin>
This lab machine's version of CentOS doesn't have OCaml in its repository.
20:55 * McMartin builds from source
21:26
<@ToxicFrog>
I cannot wait for the end of this semester.
21:26
<@ToxicFrog>
My evaluation of prof Xiang will look like the -ing Sack of Rome.
21:29
<@gnolam>
Dangling?`
21:29 * gnolam hides.
21:40
<@Vornicus>
That bad, eh?
21:47 Chalcedon [~Chalcedon@Nightstar-10836.ue.woosh.co.nz] has joined #code
21:47 mode/#code [+o Chalcedon] by ChanServ
21:52
<@ToxicFrog>
Yes.
21:52
<@ToxicFrog>
I have doubts about both his qualifications to teach comp sci, and his sanity.
21:53 * Chalcedon cookies TF
22:59 Chalcedon is now known as ChalcyAFK
23:03 AD [AnnoDomini@Nightstar-29035.neoplus.adsl.tpnet.pl] has joined #Code
23:03 AnnoDomini [AnnoDomini@Nightstar-29195.neoplus.adsl.tpnet.pl] has quit [Killed (NickServ (GHOST command used by AD))]
23:03 AD is now known as AnnoDomini
23:25 Thaqui [~Thaqui@Nightstar-26516.jetstream.xtra.co.nz] has joined #code
23:25 mode/#code [+o Thaqui] by ChanServ
23:33
<@McMartin>
Yeesh.
23:34
<@jerith>
>"
23:34
<@jerith>
} ['
23:34
<@McMartin>
ML is stupidly efficient at the stuff I'm trying to deal with here.
23:34
<@jerith>
Gah! Dropped the laptop. Almost hit my face.
23:37
<@ToxicFrog>
I'm tempted to learn ML or Haskell for this AI project I've just been given.
23:37
<@jerith>
Erlang ftw!
23:37
<@McMartin>
http://pql.svn.sourceforge.net/viewvc/pql/trunk/pql/ocaml/TestEpsilon.ml?revisio n=141&view=markup
23:37
<@ToxicFrog>
It's genetic algorithms, which look like they lend themselves naturally to functional languages
23:37
<@McMartin>
Learn Haskell, because I don't know it~
23:37
<@ToxicFrog>
Heh~
23:38
<@McMartin>
(The linked file, incidentally, is an "interprocedural" analysis to determine which event patterns in a query can match without anything actually happening)
23:38
<@ToxicFrog>
(on the other hand, I only have two weeks to do it in, and I have juggle this with writing an HTTP proxy. In Java. Without using any of Java's built in URL parsing code.)
23:38
<@McMartin>
Mmm. There's a small bug in query_epsilon, though. Not visible in the source code.
23:39
<@McMartin>
(;.;)
23:39
<@gnolam>
<jerith> Gah! Dropped the laptop. Almost hit my face.
23:39
<@gnolam>
So... you're lying on your back, holding your laptop over your head?
23:40
<@McMartin>
The relevant bit here is lines 3 through 11 which, in Java, imply the existence of ungodly numbers of classes, and the six or seven cases eaten by line 11 simply Can't Be Done with visitors.
23:40
<@McMartin>
Then lines 23-26 are "Run this pass to a fixpoint".
23:41
<@ToxicFrog>
But, yeah, I was designing it in my head, and it's basically a tail-recursive loop wrapped around a set -> set mapping function and a fitness evaluator function, the former of which consists of a selector and a mutator.
23:41 * McMartin ndos
23:41
<@McMartin>
nods, etoo
23:42
<@McMartin>
Hmmm. Speaking of Haskell
23:42
<@McMartin>
Which I know is more popular outside of the States.
23:42
<@McMartin>
Anyone have any book suggestions for introductions thereto?
23:42 ChalcyAFK is now known as Chalcedon
23:49
<@jerith>
gnolam: balanced on my belly, actually.
23:49
<@jerith>
Buit close enough.
--- Log closed Tue Oct 02 00:00:26 2007
code logs -> 2007 -> Mon, 01 Oct 2007< code.20070930.log - code.20071002.log >