|
nolen posted:Yeah, I can set the mode to passive then parse the IP and port that it returns. I guess I'm just confused about if I'm supposed to open another socket using that IP and port combination and then send my LIST and whatever commands over that socket instead of the control socket that's originally created. You still send all your commands over the control socket. The other socket you open is for data, so that's where the actual data will come from, and then you should get the response code over the control socket again.
|
# ? Jun 12, 2008 13:32 |
|
|
# ? May 15, 2024 03:19 |
|
tripwire posted:Lets say I have reference_pop, and I do a bunch of ticks on 3 different cpus, ending up with result1, result2, result3. Do the "individuals" in result1, result2, and result3 still have a fitness value associated with them at the point you want to merge your stuff? If so, you could merge the three populations, remove non-unique members, sort the remainder by fitness, then trim from the bottom until you get down to your correct population size. The big issue I can see with this is that it won't guarantee that a loser removed on one CPU won't be re-added to the population. But the only way that would happen is if there were a significant number of worse members from the other CPUs. This terminology is getting a little confusing, so if you want me to try to clarify anything, just ask.
|
# ? Jun 12, 2008 14:22 |
|
more falafel please posted:You still send all your commands over the control socket. The other socket you open is for data, so that's where the actual data will come from, and then you should get the response code over the control socket again. THANK YOU. I finally got this working. Your explanation was exactly what I needed to know.
|
# ? Jun 12, 2008 19:15 |
|
I'm drawing a blank coming up with a Google string for it, but a while ago (maybe 6 months) on The Daily WTF, there was a post with the output of a tool (or maybe just a quick perl script) that took Java code and printed only the control structures and method declarations (with no identifiers), so you were got "code" that looked like:code:
|
# ? Jun 13, 2008 00:46 |
|
This? http://thedailywtf.com/Articles/Coding-Like-the-Tour-de-France.aspx
|
# ? Jun 13, 2008 00:53 |
|
Avenging Dentist posted:This? http://thedailywtf.com/Articles/Coding-Like-the-Tour-de-France.aspx Yeah, that's it... they didn't post the tool though. Nevermind. I'd like to do that same thing with some work code.
|
# ? Jun 13, 2008 00:59 |
|
more falafel please posted:Yeah, that's it... they didn't post the tool though. Nevermind. I'd like to do that same thing with some work code. Looks like that was done by hand, not by a tool.
|
# ? Jun 13, 2008 01:05 |
|
Scaevolus posted:Looks like that was done by hand, not by a tool. That still means it was done by a tool though.
|
# ? Jun 13, 2008 01:22 |
|
At work there is a problem with a printer. Basically when I try to print to it there are particular colors that will not work (specifically if Red is at 1.0 and Blue and Green are some combination of 0.0 or 1.0). Instead of trying to track down the bug in this stupid host-based driver I have to use, I was thinking it would be possible to write a small program to fix this (basically search and replace the bad colors to something that will print). Since I primarily need to print postscript files, which are plain-text documents, this seems like it should be straight forward. However I've got no real experience with Postscript. Is writing a filtering type program here really as simple as my mind thinks it is?
|
# ? Jun 13, 2008 22:03 |
|
6174 posted:However I've got no real experience with Postscript. Is writing a filtering type program here really as simple as my mind thinks it is? Postscript is a turing-complete programming language. You can't, in general, programatically replace some colors with others. You could write a Postscript interpreter that parsed the document and produced a sequence of draw commands that produced the same document, but has a predictable interior structure. Then you would be able to post-filter those commands to remove colors you don't want. This may result in a massive increase in the size of the document. Also, keep in mind that there are several different color spaces that Postscript operates in, and depending on where the bug is in your printer, you may have to handle them as well.
|
# ? Jun 13, 2008 22:34 |
|
ShoulderDaemon posted:Postscript is a turing-complete programming language. You can't, in general, programatically replace some colors with others. Hmm... So it seems that it might be a little more complicated than I had hoped. But what I do have going for me is almost all of the files I need to print are generated from the same program which should mean that it will use colors in a uniform manner (It is output from IDL). So I guess I'll make sure to check that it was created by IDL first (which is conveniently a comment at the top) and then proceed to replace colors with how IDL sets things up. Hopefully that will allow it to become doable without writing a whole Postscript interpreter. Of course this isn't ideal, but it sounds better than manually printing ~1000 files by copying them to another computer and printing them one by one (and then doing that same process whenever I have something to print). edit: I just had a potential idea. Since Postscript being Turing complete is the big problem, would it be reasonable to leverage that by inserting some postscript code into the file that changes the colors? 6174 fucked around with this message at 23:16 on Jun 13, 2008 |
# ? Jun 13, 2008 22:53 |
|
How different are Scheme and Common LISP? Similar like C++ and Java?
|
# ? Jun 15, 2008 06:08 |
|
happylf posted:How different are Scheme and Common LISP? Similar like C++ and Java? The two big differences are namespaces and libraries. You'll see Scheme and Common Lisp referred to as Lisp-1 and Lisp-2 respectively. Lisp-1's have everything in one namespace (functions, variables, etc.) while a Lisp-2 has separate namespaces for the previously mentioned things. Because of this, Common Lisp code can get a little messy when you're dealing with function application. This paper explains the differences much more extensively. Scheme is generally used as a teaching language because the language itself is very small. Common Lisp has a much more robust built-in library (this might be a good comparison between Java and C++ without the STL). I'd argue if you wanted to develop a 'serious' application, you'd want to use Common Lisp, but if you just want some experience with functional programming, Scheme would be a better choice. There are some other minor differences between the two (syntax, Scheme can generally compile to C or binaries more easily than Common Lisp, etc.), but these are the biggest.
|
# ? Jun 15, 2008 06:59 |
|
Thanks. ArsDigita has a course on SICP which uses Scheme. Seemed interesting, but since I'll be learning Common this semester I didn't want to confuse myself. Pretend edit: http://www.aduni.org/courses/sicp/
|
# ? Jun 15, 2008 07:29 |
|
You can't really get confused by Scheme vs Common Lisp. Scheme is so small that you've quickly got a good grasp of it, and then you just have to learn the differences and the rest is CL.
|
# ? Jun 15, 2008 18:01 |
|
Neslepaks posted:You can't really get confused by Scheme vs Common Lisp. Scheme is so small that you've quickly got a good grasp of it, and then you just have to learn the differences and the rest is CL. Is that not about the naive C vs C++ assumption?
|
# ? Jun 15, 2008 18:57 |
|
Vanadium posted:Is that not about the naive C vs C++ assumption? I have no idea what this means, but I don't think the comparison is similar on anything but a very superficial level (small/non-oo vs big/oo).
|
# ? Jun 15, 2008 20:36 |
|
Neslepaks posted:I have no idea what this means, but I don't think the comparison is similar on anything but a very superficial level (small/non-oo vs big/oo). That's probably the only level that would really matter to a beginner.
|
# ? Jun 15, 2008 22:19 |
|
GT_Onizuka posted:That's probably the only level that would really matter to a beginner. But the discussion was whether or not learning Scheme and CL at the same time would be confusing. And I stand by my claim that it wouldn't, at least not in any degree approaching what it would be to learn C and C++ at the same time.
|
# ? Jun 15, 2008 22:23 |
|
Neslepaks posted:But the discussion was whether or not learning Scheme and CL at the same time would be confusing. And I stand by my claim that it wouldn't, at least not in any degree approaching what it would be to learn C and C++ at the same time. Well, agreed in that case.
|
# ? Jun 15, 2008 22:31 |
|
I've got a bash script that needs to test if a bunch of machines are up and able to be rshed into. So something like this:code:
Everything I find through google talks about running processes in parallel and then killing them if they hang with a timeout. But that's not what I want. test_updown() needs to be a blocking function that is guaranteed to return in a set time limit. Edit: After some more searching I've found something that I think should work, but it's acting loving weird: code:
But in either of those cases where rsh returns immediately, we need to kill the timeout subshell process. The * case calls kill $k to do this, but it doesn't work. I can call jobs before and after that command and I can see that the loving command just doesn't work. I can't for the life of me figure out how to actually kill the subshell process. Wtf? Edit again: Bah. Figured it out: code:
Lexical Unit fucked around with this message at 16:28 on Jun 17, 2008 |
# ? Jun 17, 2008 14:38 |
|
Does anyone know why I cant get in to #cobol using my favorite IRC client, mibbit.com??
|
# ? Jun 18, 2008 08:20 |
|
bijou posted:Does anyone know why I cant get in to #cobol using my favorite IRC client, mibbit.com?? 10:44 -!- 1 - #cobol: ban *!*@synIRC-F5376B42.mibbit.com [by rocketsauce, 14847 secs ago]
|
# ? Jun 18, 2008 09:44 |
|
Vanadium posted:10:44 -!- 1 - #cobol: ban *!*@synIRC-F5376B42.mibbit.com [by rocketsauce, 14847 secs ago] Unbanned now. We should use the (eugh) unreal extentions to ban people by whois info for mibbit clients.
|
# ? Jun 18, 2008 09:49 |
|
Does anybody know of a quick and easy (and lite) web based rich text editor that I can use for a site I am making that will allow a businessman (and technophobe) post updates, with the ability to make crap like headers, bold, italic, tables, etc. I would service you orally for a pointer. Edit: PHP and MySQL
|
# ? Jun 18, 2008 12:59 |
|
Safety Shaun posted:I would service you orally for a pointer. code:
|
# ? Jun 18, 2008 15:03 |
|
Zombywuf posted:
What color bike shed? I think it should be green. Discuss.
|
# ? Jun 18, 2008 15:55 |
|
I saw a link the other day to a website that provided a free web service for creating maps. I'm 99% sure I saw it in these forums, or maybe this thread, but with search down I'll be damned if I haven't read 100 pages looking for it agail.
|
# ? Jun 18, 2008 16:08 |
|
Moving question to mac thread...
Your HILARIOUS fucked around with this message at 18:05 on Jun 18, 2008 |
# ? Jun 18, 2008 17:50 |
|
I'm doing some audio code in fixed-point (this is for SDL). I need a way to multiply two fixed-point numbers, treating them as fractions. That is, I need to treat, for example, int, as having a range [-1, 1). If you're familiar with fixed-point conventions, I need to treat it as a Q1.31. One way I've thought of is:code:
schnarf fucked around with this message at 19:10 on Jun 18, 2008 |
# ? Jun 18, 2008 19:08 |
|
schnarf posted:Is there any way to do it that preserves the precision a bit better? You could multiply them before shifting, then shift the result down by 32? You'll have to cast up to 64-bit integers first, I think.
|
# ? Jun 18, 2008 19:16 |
|
ShoulderDaemon posted:You could multiply them before shifting, then shift the result down by 32? You'll have to cast up to 64-bit integers first, I think. Edit: Yeah, basically I'm trying to figure out how to calculate only the upper 32 bits of the 64-bit result of a 32-bit multiplication. schnarf fucked around with this message at 19:29 on Jun 18, 2008 |
# ? Jun 18, 2008 19:22 |
|
schnarf posted:Right, I was thinking about that, but SDL is built for so many platforms, and some of them don't have 64-bit integers. Not exactly what you're looking for, but this has how to do it with 16 bit numbers getting a 32 bit result on a 16 bit machine. The algorithm is spelled out pretty well so even the the code is in Assembly you can probably apply it pretty easily to your situation. http://www.8052.com/mul16.phtml
|
# ? Jun 18, 2008 20:14 |
|
Aredna posted:Not exactly what you're looking for, but this has how to do it with 16 bit numbers getting a 32 bit result on a 16 bit machine. The algorithm is spelled out pretty well so even the the code is in Assembly you can probably apply it pretty easily to your situation.
|
# ? Jun 18, 2008 20:33 |
|
My bash script looks very unusual and won't run anymore. The whole thing would break tables, so here's a representative snippet instead:code:
As to the cause, there are three prime suspects: 1. tar 2. the in-house script that I have no control over and have never fully understood 3. mischievous computer gremlins What I'm hoping for, is that one of you will say, "Ah yes, this is a common and well-documented bug in the tar program. Simply run 'unmangle' on your source to get it back". What I expect, is that the in-house script ruined my work and I didn't make a backup
|
# ? Jun 18, 2008 21:33 |
|
magicalblender posted:My bash script looks very unusual and won't run anymore. The whole thing would break tables, so here's a representative snippet instead: Type "file name-of-script" and it'll tell you what the OS thinks the script is. If it's tarred or zipped or something, that should be a recognizable file format - if it just says "binary data" it's nothing the OS knows about.
|
# ? Jun 18, 2008 23:00 |
|
I wrote a script in Ruby where I tried to do some Unix-style forking but it didn't run on my Windows machine. I found out that Windows doesn't support forking, but it must have something similar. What is it and how do I use it in Ruby?
|
# ? Jun 19, 2008 02:44 |
|
Free Bees posted:I found out that Windows doesn't support forking, but it must have something similar. Ha ha ha. How naive.
|
# ? Jun 19, 2008 02:58 |
|
Free Bees posted:I wrote a script in Ruby where I tried to do some Unix-style forking but it didn't run on my Windows machine. I found out that Windows doesn't support forking, but it must have something similar. What is it and how do I use it in Ruby? Any API provided by your scripting language would be using CreateProcess/CreateProcessEX under the covers -- you shouldn't have to deal with that in your ruby code.
|
# ? Jun 19, 2008 03:22 |
|
|
# ? May 15, 2024 03:19 |
|
_aaron posted:Do the "individuals" in result1, result2, and result3 still have a fitness value associated with them at the point you want to merge your stuff? If so, you could merge the three populations, remove non-unique members, sort the remainder by fitness, then trim from the bottom until you get down to your correct population size. I thought about how/why this kind of "search" works. I think its most instructive to imagine a tree branching out from some point and trying to cover the most space as possible; its ultimately trying to find the point in this space which corresponds to a fit chromosome and to do that it has to travel through search space on the shoulders of slightly less fit chromosomes, testing the space around them for potential high quality chromosomes, but also drifting around to some extent. By covering a huge space, the chances of finding that magic point which corresponds to high fitness are higher. So then, there is two essential things this algorithm does in a loop: 1. It stochastically explores/samples some area of "search space" neighboring an existing member of the population, to see how fit it is. 2. It deterministically updates the frontier of new sample points by removing the least fit member of the population. The two actions are really just a formalization of the idea "throw stuff at the wall and see what sticks". If you are in a situation where getting new poo poo to throw is easy and cheap, then its not hard to see that the real paydirt (computationally) is in seeing which things actually stick. To make this conversation less painful, lets just call these two steps a "tick". If you perform a whole bunch of ticks serially, let's call that a "batch". If you imagine the population as a scatterplot in search space, then over many batches it will travel to new areas, converge to narrow points, or diffuse in all directions quasi-uniformly depending on how savage the selection criteria is and how the fitness landscape looks at that point. It is worth mentioning that on the current domain I'm testing this algorithm on, (bipedal walking), after letting evolution stabilize a bit, I can generally expect that 1 out of every 500 new individuals will be an improvement and displace someone in their population. If a batch consists of 10 ticks, thats a 2% chance that a given batch will actually add a useful new guy the population... HOWEVER, search doesn't just work by getting useful new guys, it also works by weening out lovely old guys. After a batch, a resulting population will either have removed a number of individuals in the original population, removed individuals that were newly added in the same tick, or some combination of the two. So lets say we perform a batch thats 10 ticks long, and we do it on 5 different processors. After they are all done, you can have anywhere from 0 to a maximum of 5*10 new guys to choose from in the set of resulting populations, but odds are you'll be lucky to get one. The number of guys removed from the population prior to the batch is going to be equal or less than the number of newly added guys; for example two batches might remove the same guy to bring in two different improvements. Given this situation, its easy to just make a new guy, but actually weeding out a member of the original population is a lot harder (and more valuable!). Because of that I think removals should be incorporated from any batch that has them, but new guys should only be added while there is room for them (and maybe selected on merits, or randomly, to see if that is any better) What I need to know now is how the resulting populations from concurrent batches can be distinguished.. normally a single-threaded algorithm, each chromosome keeps a unique identifier, but if its going to be in parallel the identifiers can (and WILL) have collisions.
|
# ? Jun 19, 2008 08:31 |