Discussion in 'Technologics' started by Charles, Jan 5, 2012.
Every part of this statement qualifies for understatement of the year.
Well, that depends. Forking has its place. To be particularly pedantic, it's the only way to spawn a subprocess on Unix, but even aside from that, the preforking model for making a server with a number of worker processes has its merits. (I'm not sure what you mean about the compiler doing magic with respect to forking. It's a syscall with reasonably well-defined semantics, the compiler has little to do with it.)
But for your everyday parallelism problem? Well, it can depend, but forking, threads, and signals (not to mention file descriptors) all interact in their own delightful ways, and it's really easy to make a hash of it. And forking recursively? You've got to have a pretty clear picture of what all the moving parts are doing.
It's not the forking that the compiler did magic to; it's the recursion.
And I actually implemented the thing this morning and it worked ... interestingly, in that it solved the logic puzzles I was trying to solve as long as certain constraints were present, and if they weren't it forkbomb'd my VM into oblivion.
int main(int argc, char *argv)
int x = atoi(argv);
printf("x! = %d\n", factorial(x));
int factorial(int x)
if(x == 1)
pid_t pid = fork();
if(pid == 0)
int y = factorial(x - 1);
exit(x * y);
waitpid(pid, &ex, 0);
Alas, due to limitations on exit values, it only works for 'x' up to 5. I don't recommend trying negative values...
Is this a good place to ask for web dev help?
I'm updating my webpage template for Unity web games, as I've got a new one I want to put out, and I'm trying to make it look nice when you haven't got the Unity player installed. I haven't done much website coding since I was a teenager, so I'm learning a lot.
Here's the page so far, but with the Unity player embed code commented out:
The Unity player install button should appear in the centre of the blurred screenshot, and it does in chrome and firefox. But in IE, it appears below it. If I remove the link from the button image, it appears closer to the centre.
I've been working on this problem all day, and I have run out of ideas about what could be going wrong. Somebody help me. Please.
IE9 doesn't like this line:
Change it to this and you'll be fine:
To elaborate, for whatever reason it interprets that first <a> tag to be an open tag that doesn't close anywhere. As part of its attempts to handle for that, it wraps the <a> tag around whatever the next element happens to be, in this case your <div class="content"> element. Then, due to some quirk in the rendering engine, it renders the <div class="content"> element again, causing the button to appear below.
As a side note, if the button ends up hiding behind the image after that fix, drop the following line into your CSS for the <div class="missing"> element:
That'll push it on top of pretty much anything else, including the image.
The reason is that it's an open tag that doesn't close anywhere, specifically. HTML isn't XML, even when it's defined as XHTML, unless it's served with a specific application/xhtml+xml datatype. Which you shouldn't do, because it'll work purely worse everywhere. Plus of course nobody uses XHTML anymore because everyone realized it was silly and now we have HTML5.
fork()/exec() is one of those things Unix got wrong. The VMS spawn model is much saner.
Note also that there are modern systems where forking without an immediate exec is fundamentally unsafe and leads to crazy undefined behavior.
So yeah, don't do that. But you already knew that.
Anyway, why the heck not just use threads or task queues or something that isn't abjectly nutty?
Brilliant! Thank you.
I used the auto-generated Unity web player page as the base for my page, and I notice that had some stuff mentioning xhtml at the top. I don't actually have any clue what xhtml is. Should I change/remove it?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
You'll want to leave it alone. If you later decide to build a site for something manually, though, use HTML5 instead of XHTML.
Because using forking was hilarious.
The naive version of the program was something like this:
1 - Do you have any actions left available? If no, terminate yourself.
2 - Pick one of the actions.
3 - Flag it as no longer available.
4 - Test it for whether it satisfies the constraints.
5 - If yes, fork to that move. If no, go back to 1.
When the solution is found, the parent (well, eventually-parent) process is informed and all the forklings terminate.
This is a terrible terrible idea and I did it only to see how hard it would obliterate my VM. The surprising thing was that for about 2/3 of the constraint sets I handed it it managed it stunningly quickly. For the other third, of course, it forkbombed my VM into oblivion, or perhaps just sometime after the heat-death of the universe.
This reminds me of the perpetual problem in academic computing where all shared shell hosting machines royally suck to use for a week or so when the intro Systems Programming course starts up and dozens of sophomores first attempt to use fork() in anger.
Okay, we got any jquery mobile specialists in here? I've got a form that is all fucked and I have no idea why. It keeps pushing the menu off the screen. If I only have like, three form elements it's fine. But if I add more it gets all fucked up. Looks fine on a regular computer browser (of course!) but on my iPhone it's sucking. And driving me crazy.
Oh, this is neat, http://www.realtimerendering.com/blog/graphics-codex-version-1-7-released/
A real time rendering book, but released as an app for iOS. I wish it was out on more platforms.
Ugh, I have a bug that I can 'fix' by doing something that shouldn't fix it. I hate that. Mathematically I shouldn't need to do what I'm doing. So either my understanding of the math is wrong, or the bug is actually farther up the chain in some high level area I know nothing about.
"A graphics program has an even number of sign errors"
Heh, your correct by the way, it is a sign error. Hit-testing as opposed to graphics though.
Your computed normals are pointing the wrong way.
Heh, all hit detection is done in the space of the object, so it's always [0,0,1]. =)
(It's UI, so all the objects are rectangles, allows for some shortcuts, especially if there aren't any 3D transforms)
Your 0,0 is in the lower left rather than upper left.
Hah, no, it's was bug that had to do with right to left languages (dang you hebrew!), so it was more like some stuff having coordinates on left instead of the right, because the root transform with a negative scale in it wasn't be taken into account, but others transforms were. (the aforementioned odd number of sign errors)
Aw yiss, Hebrew messing up everyone since forever. Le chaim!
Lately I've been using "Herp" and "Derp" to test anything I do with Strings. Helps get me through the workday.
Speaking of Hebrew and programming, the Zend Engine for PHP (i.e. the primary engine) was developed by Israelis, which is fine except that sometimes the error messages don't make any goddamn sense:
$ php -r ::
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM
Now, you might be wondering, "What the shit is T_PAAMAYIM_NEKUDOTAYIM?" Well, "paamayim nekudotayim", or more properly "פעמיים נקודתיים", means two colons. So T_PAAMAYIM_NEKUDOTAYIM is this thing: ::
Yeah, similar issues with most modeling packages, except it's french.
I want to write a MIDI app for either my iPhone or an android device. As it turns out, the CoreMIDI interface is woefully undocumented/unsupported on the former, and Android basically just doesn't work with MIDI (in/out). There are no MIDI interfaces for Android devices (that I can find). Well played Google.
And I'm not sure I want to deal with XCode et. al. just to write a simple MIDI thing.
I hate computers.
Earlier today, I was doing some Win32 documentation diving and I noticed something about a function called WaitForInputIdle. I saw WaitForIneptitude.
I saw WaitForInPuddle, but I can't claim much in the way of programming expertise.
So for several days now I've been running into all kinds of the same error with my modeling program related to the change from an embedded derby database to a network one. Lots of access errors, lots of stupid shit.
I even went back to the derby tutorials and worked through them all because, like, clearly I must have fucked up somehow in a huge way. Nope, doing it all right.
Then I checked my config file for the database:
it's supposed to be
fuck all colons
edit: also doing stuff with the derby ij language is notbadface. Nice quick way to check if the db be doin thangs and alive and stuff.
May as well ask in here as I start this idiocy: anyone dealt with libvirt heavily, or ruby's libvirt bindings? I'm off to experiment with controlling a vcenter server remotely, and I really don't feel like playing with vmware's shitty api documentation directly (as of this writing, half the perl documentation 404s on their site)
We use libvirt via python for managing a bunch of qemu/kvm hosts.
Doing some OpenGL ES for simple 2D UI right now.
It's not that bad. I'm amazed. Am I going to hit some suck at some point?
Is there a term for the color format that isn't pre-multiplied alpha? I keep referencing it as unmultiplied alpha, but I'm curious if there is an actual term for it.
RGBA. If the alpha isn't premultiplied it's just another channel.
There's also BGRA. This (obviously) can cause problems if you mix them up.
Yeah, I get that, the RBGA or BGRA or PRBGA or PRGBA. The alpha value stays around, it's not 'baked' away, as it's still used during blend operations. Was just curious if there was a word instead of an acronym to define it.
Color? Color with transparency information? There isn't really a single term even for premultiplied alpha since the RGB channels might be in a different order. It's always acronyms if you want to be precise.
Are there any Ruby tutorials out there that come particularly recommended?
For just Ruby, there's Ruby in Twenty Minutes and also RubyLearning.com. If you mean Ruby on Rails, that's a different story.
I'm taking this online course now and it's time to leave 4004 processor machine code for C. Is there a preferred free solution for newbs compiling and such on a windows desktop or install linux and dualboot?
(Also, multiplying two numbers in machine code, I hate you. I see how it works but I'd never figure it out on my own in the space permitted).
Separate names with a comma.