?

Log in

No account? Create an account
warning: good weekend ahead - Greg [entries|archive|friends|userinfo]
Greg

[ website | gregstoll.com ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

Links
[Links:| * Homepage * Mobile apps (Windows Phone, Win8, Android, webOS) * Pictures * LJBackup * Same-sex marriage map * iTunesAnalysis * Where's lunch? ]

warning: good weekend ahead [May. 26th, 2006|09:37 am]
Greg
[Tags|, , , , ]
[Current Mood |happyhappy! not sick!]
[Current Music |Lordi - "Hard Rock Hallelujah"]

Already this weekend (starts on Thursday!) has been good - we finished Maraudon last night in WoW, which was fun (despite an infuriating part where Dextra and I (the two people who can rez) died and had to spirit rez and fight our way back. Scary!), and I got a shiny new dagger and orb.

Another good thing - I'm not sure yet, but I think I've solved my work problem...but not in a great way. It's like finally arriving at Disney World in Georgia (the country, not the state), and you're tired but happy you finally got there, and then getting out and realizing that Tennessee (where you started) is really right across the street from Georgia (the country, not the state). And you think everyone is mocking you for taking such a roundabout journey when you were right there, except they presumably aren't. Whee. I think I'll put this analogy to rest :-)

I have a problem...I cannot stop listening to "Hard Rock Hallelujah"! Seriously. Sometimes songs stick in my head so long, it actually makes my stomach hurt (and can keep me up at night). This song isn't there yet, but it's headed that way...

I put up pictures of Stephen's graduation. Next up - pictures from wonderjess's graduation! And then the pictures I will have acquired in the intervening time. Yikes.

Had a breakthrough in the palm to google calendar thing last night.

So the problem I had been having was that, when you connected to start the syncing process, it wouldn't return until it was done, which means that you couldn't poll for status updates. (actually, I guess you could, but then you'd have two connections open at once unnecessarily) So, I tried something like this:
# Create session and return session id to browser
pid = fork do
   # Do long-running stuff
end
Process.detach(pid)

Interestingly, this works when you run the script from the command line, but not when you're doing a POST to it! I'm not sure if this is an Apacheism or something. After digging around for a while, I found the solution is to do something like this instead:
# Create session and return session id to browser
pid = fork do
   $stdout.close
   $stdin.close
   $stderr.close
   # Do long-running stuff
end
Process.detach(pid)

(Note: this is incorrect. See update here) and this makes everything work well. Except that I'm having some difficulty access variables declared in the pre-fork section inside the forked process. I bet they're getting destroyed or something when the parent finishes. But, on the whole, I'm closer to getting it to work. Yay!


"How to cheat good" (by a college professor). Tip number 8 is hilarious!

Top 50 Places to Have a Beer in America - I was a little disappointed/surprised there were no Texas places in there. (although this is just the places with highest scores on BeerFly - maybe there's some geographic bias there?)

DeLay campaign cites Colbert bit as evidence of innocence...um, wow. After the White House Correspondents Dinner thing, I thought everyone had figured it out!
LinkReply

Comments:
[User Picture]From: medryn
2006-05-26 04:51 pm (UTC)
I've been to #44!
(Reply) (Thread)
[User Picture]From: wildrice13
2006-05-26 09:12 pm (UTC)
I saw that one, and it sounded extremely familiar. Did you post about it on your journal? Cuz I've been to Baltimore exactly once, and I did go to a bar, but it seems quite unlikely that it happened to be the one on that list.
(Reply) (Parent) (Thread)
From: (Anonymous)
2006-05-26 05:05 pm (UTC)
Is there some reason you're forking instead of using a Thread?
(Reply) (Thread)
[User Picture]From: omega697
2006-05-26 05:11 pm (UTC)
And is there some reason I wasn't logged in? ;o)
(Reply) (Parent) (Thread)
[User Picture]From: gregstoll
2006-05-26 05:18 pm (UTC)
Because, as is my understanding, when the script ends, all threads are terminated.
(Reply) (Parent) (Thread)
[User Picture]From: omega697
2006-05-26 05:28 pm (UTC)
Couldn't you keep an array of all the threads you have open and then join each of them at the end of the script? Or does the script need to terminate?
(Reply) (Parent) (Thread)
[User Picture]From: omega697
2006-05-26 05:30 pm (UTC)
Oh right. Yes, it does.

Don't mind me...
(Reply) (Parent) (Thread)