jeremiah don't feel bad - one of the bigtime vc's called me "alan" yesterday - so i feel your pain - of course i've never heard of an "analist" either - you are so talented you make up new job titles! - Allen Stern
he hit it spot on. That infliction point is not that far away. As soon as we figure out the workings of the human brain, we can potentially replicate it and then its just how fast. - Akshay Dodeja
I want to assign a user a random number (lets say from 0 to 10,000) - but I want to make sure that it is a unique number, no other user has that number. Presumably I'm storing all taken numbers in a database. How do I most efficiently make sure a new number is a unique number? While the set is still sparse, I can just assign a number, and see if it is taken, and then try again until I find an untaken one. But as the set of all numbers approaches being full, this will approach 10,000 tries just to find that last untaken number. Is there a better way? - Shannon Bauman
Hm... thinking about this some more. Perhaps if I just stored all of the untaken items in a list (is that the right structure?)... then do a random role of rand(list.length()), and go to that spot in the list, and then use that number stored there, and remove it from the list. That may work. Not sure how that equates to a database though :-) - Shannon Bauman
Just talking to myself, don't mind me :-) I may have to just have a continuous process running that does the assigning of IDs, and always stores the unused numbers in it - and then just hit up that process whenever i need a new ID assigned. I could then add that number to the DB for bookkeeping, etc. (I need the resulting number stored in a DB for other reasons/Longevity). - Shannon Bauman
It sounds just like dealing with hash collisions... one easy approach is to pick a random number and then scan for the next available number after that (modulo table size). Linear scans should be fast if the database stores things in sorted order. - Jim Norris
@jim - yeah, that totally makes sense. Thanks! - Shannon Bauman
How about just using a larger number? (like perhaps 128bits) - Paul Buchheit
@paul (and jim) - I am actually trying to completely fill the namespace so to speak (or numberspace as the case may be in this case). I basically want to keep assigning people numbers as they come in the door until all 10,000 numbers have been taken, and then close the door. But ideally I would like to do the assigning out of order. Perhaps what I should do is just do the shuffle before hand all at once, and then assign them from first to last after they have been shuffled? - Shannon Bauman
By the way - it is pretty amazing for me to be able to post a CS question, and have the two smartest CS people I know on the planet be able to give feedback. Damn that's cool. - Shannon Bauman
I was just about to suggest pre-shuffling. Create a 10,000 item linked list, generate a random number from 1 to 10,000, pluck it from the linked list and add that number to an array table along with an auto-incrementing sequential ID. Then generate a random number from 1 to (10,000-N), and repeat until the list is gone and you have a table with IDs and random non-colliding numbers. Mind you, there may be a faster method than traversing a linked list each time, but if you're talking about 10,000 instead of 1,000,000 and you're not doing it often then it's probably more efficient to code it quickly than execute it quickly. - Kevin Fox
@Kevin: alternatively: put the N (10,000) numbers in an array A. At step i (for 0 <= i < N), swap element A[i] with A[j], where j is a random number such that i <= j < N. - Tudor Bosman
ff is now your one-stop shop for cheating on your homework. - j1m
@j1m a healthy discussion doesn't do any wrong. Even if it is HW, it is the effort that counts. - Akshay Dodeja
Tudor's method is the best (although I don't agree that j has to be constrained on the lower limit by i) and my understanding is that that's the method used for most card-dealing games to shuffle the deck. The only challenge is making sure your random number generator is really random. - Stephen Mack
Tudor's solution is simple and efficient. If you need a solution that takes even less memory, then you use a vector of booleans indexed by id to keep track of allocated ids. If each boolean is represented as a single bit, then the solution requires 1250 bytes for the 10,000 ids. - Gary Burd
Could you use a block cipher/Feistel network approach? That way, you'd only have to store the number you had last operated on and when you needed the next number, you could pass it through the block cipher to generate the next one. I believe the easier way to do it is on an even number of bits, so 2^14 = 16384 > 10000. Whenever the cipher generated a number > 10000, you could just feed that number back into the cipher until you got one that was less than 10000. - Josh
Do these non-sequential numbers have to be random, or is "random-looking" good enough? If so, pick a primitive root of 10007 (5 works), and then cycle through by multiplying mod 10007 (multiply again if you get a 5-digit numbers). While the numbers are deterministic, they may work good enough for your approach, and you can get a counter that will spit out non-sequential numbers. - Alex Power
So, you'll get 5, 25, 125, 625, 3125, 5618, 8076, 352, 1760, 8800, 3972, ... Not random, but good enough to fool most people. If you use a larger primitive root, you'll probably be OK regardless. - Alex Power
Pre-shuffling is the way to go. Fisher-Yates shuffle is easy to implement. - Neil Kandalgaonkar
Josh and Alex's ideas are interesting. You can use an LCG to generate all numbers between 0 and n with suitable choice of constants. See http://en.wikipedia.org/wiki/L.... Then you just need to remember the last number given out. It might be hard to find a set of numbers for m=10000, but you can choose, say m = 10007 and just not hand out numbers higher than 10000. x = (37 * x + 7753) % 10007 works. - Sanjeev Singh
@Neil: I didn't know that there was a name for that :) @Stephen: apparently, according to the article on the Fisher-Yates shuffle on Wikipedia, not restricting j leads to a biased distribution. - Tudor Bosman
http://en.wikipedia.org/wiki/F... - (modified) - "always selecting j from the entire range of valid array indexes on every iteration also produces a result which is biased, albeit less obviously so. This can be seen from the fact that doing so yields N**N distinct possible sequences of swaps, whereas there are only N! possible permutations of an N-element array." - Tudor Bosman
"Since N**N can never be evenly divisible by N! (as the latter is divisible by N−1, which shares no prime factors with N), some permutations must be produced by more of the N**N sequences of swaps than others." - Tudor Bosman
It's a lot more intuitive to see how this works if you create the possibility chart for N=3; the probabilities for certain outcomes will all be /27 rather than /6, but you can see what is more/less likely; apart from that, I think we've done a good job re-inventing pseudo-RNGs here tonight. - Alex Power
Kudos folks :-) @j1m: for the record, no, this was not homework or anything of the like - just a fun side project I am working on. Tudor, Alex, Sanjeev, Alex, Neil, Josh, Gary, Stephen, Kevin, Paul and Jim - thanks again for all the great ideas. A shuffle as well as the psuedo random idea both seem like great solutions for my project - not sure which I will end up doing, but one will definitely work. I'll investigate them a bit more to see which works better for my situation. Thanks again all! Fun times. - Shannon Bauman
Bayscan list got wind of it by way of someone in Sacramento who heard Santa Clara County Fire Dispatch. I got IM'd and saw it covered on KPIX (live feed and a report from 20 minutes prior). Posted to Twitter + FF. - Eric Rice
Whoa! Glad to hear no injuries reported. Hope the damage isn't too bad. Some people's lives are going to suck for the next little while... - Josh Bancroft
oh no. Cupertino rarely has fires. My hometown :( - Akshay Dodeja
SJFD is also responding-- not sure about the Mutual Aid borders - Eric Rice
So now people are chasing fires on FriendFeed and Twitter? - Rob Safuto
@Rob. I think its the 'I want to be first with news' syndrome that blogging and web2.0 has created! - Steve 'Chippy' Paine
We could certainly report everything via Twitter given the ability to send updates SMS web. The question is this. Should everything we see or hear about be rebroadcast via the web? Where is the line drawn? - Rob Safuto
Yeah I dunno about that LAFD twittering... it's like a weird false sense of security. Feels good, looks good-- useless. I will defer my opinion to those much more qualified than me to weigh in on it. - Eric Rice
i like the LAFD tweets, they helped me on my metblog post on a local fire. especially since the contact at the firehouse never got back to me. - faboo mama
Good stuff - congrats! I quit two and half years ago. One of the best things I ever did. Just kept chanting to myself "stinky-smelly-not-attractive" - Patricia Hanrahan
Thank you! I'm armed with TONS of bubble gum. Patricia: BEST ADVICE EVER - Mona N.
i never smoked a normal cigarette in my life. Only joints and shisha ! Congrats Mona on that decision, although my personal perspective is somewhat different in that regard! - Hayk Hakobyan
good luck, I hope you warned your friends how grumpy you will be in three days. - Bjorn Stromberg
Me? Grumpy? No way. I think, therefore, I am. I'm happy... therefore, I will be...? Or Jedi Mind tricks. Anyone know Jedi Mind tricks?? - Mona N.
:) Also sounds trite but take it one week at a time. It becomes a bit of a goal then. 'I've been 2 wks without one, I *will* make it to three' - it was when I figured out, hey, its been six wks since I've had a smoke I knew I'd made it. Still had to keep chanting though! - Patricia Hanrahan
I already set up a Google calendar... LOVE the internet! - Mona N.
i like to joke telling to those who wanna quit smoking, "your body is going to disappear one way or another. now, why deprive your body and mind of pleasures of life for something as transient as health? it would be pity to die healthy!" - Hayk Hakobyan
Now that I PSA'd it, I can't go back on my word! I'm excited :D. Thanks, Mitch! - Mona N.
I quit and started running to physically torture myself, so I could psychologically tell myself that if I started smoking again, it would be harder. - Pokai
As in, jogging? Oh wow. Exercise... that's something else I need to work on. Babysteps.... - Mona N.
yes, jogging. if not jogging, just insert something to preoccupy your mind (maybe not chocolate malt balls) - Pokai
And Mona :) start reading "Will to Power" of Nietzsche in case you didnt!! will give you all mental food for keeping on "torturing" yourself! - Hayk Hakobyan
Pokai & Hayk: Noted. I'm going to need all the support I can get. So tahnk you, for the advice! - Mona N.
Cold Turkey? The first 72hrs are the worst! All easy after that. Stick with it. I did it last Oct and never looked back! Good luck to you! - Jay Martin
Mona, best of luck to you. May ask what brand you've been smoking? It may seem irrelevant, but many national brands have additional additives that make withdrawal even worse. Gum will help, but also find something to do for 5 minutes each time you get a craving (as that's about how long they last): make tea, take a walk, round of stretching. Something to keep you busy that 5 minutes. - Stupid Blogger (aka Tina)
Welcome to the club LOSERFACE!! The first 48 hours was the hardest for me. That was only because I went to a party in that time, and traditionally drinking = smoking. I was fine after that though. I still have yet to take a single drag. I hope you stick with it and don't end up like my other friends, who have quit at least 4 times within the time that I've quit. LOL - Louie
Good question, wish I was near a microphone so I could give you an audio explanation, bit hard to reproduce with text - Mo Kargas
meh and heh rhyme with the "le" in leopard. Gah rhymes with Baa, the sound a sheep makes. Meh generally means (edit) "I couldn't care less" or "that's kinda dumb" or "I'll pass." "Heh" is light laugh or chuckle. "Gah" usually expresses surprise, with a negative connotation: "There's a spider on your shoulder!" "Gah! Get it off of me!" - invariant
No problem! I guess heh could be used that way, but I usually use it genuinely, with the following hierarchy: heh, :-D or haha, LOL, ROFL. - invariant
hahahahhahahah!! Rodfather, you're awesome - Mona N.
I always thought of heh as flirty and naughty... - Lisa L. Seifert
when "heh" is intended as sarcasm, it's usually pretty obvious. I will use it in place of the pedestrian LOL because I'm too cool for school - Chris Kim A
the last photo in the series offers some contrast. another great 'big picture' post. - eric mortensen
Awesome shots. In the crazy world of internet, I first saw these pictures from the Czech republic at widelec.org before finally seeing the Boston.com website. - Mitchell Tsai
Thx for supporting ! Im very happy to hear that as a Chinese. - Ken
I should really take sometime out and watch the Olympics. Everyone has been raving about it. - Akshay Dodeja
Wow incredible ceremonies. Tiananmen what?? - PC Easy via twhirl
the coverage by nbc and its affiliates is awful and extremely disappointing. prepackaged, heavily edited, commercial-laden and nationalistic - Cee Bee
duh! What would you expect it to be? This is a capitalistic country and they are airing them in order to make a profit. More people care about what their own nation is doing as opposed to the others, sad but true. Live coverage would be nice but that would mean everything would be shown only in the middle of the night. It is unrealistic to think otherwise. - Adrienne Van Houten
I couldn't get amazed as I realize that one of the worst human rights abuse is getting shoved under all the glitterati. - Krishnan Hussein Subraman
Tiananmen Square - "Square of Heavenly Peace" I belive it means. Will have to check that out. But its in the middle of Beijing. the Peoples Liberation Army do their famous flag raising ceremony there every morning. Its also the site of the Tiananmen protests in 1989. http://en.wikipedia.org/wiki/T... - Roberto Bonini
yeah,very great,come on ,my china;come on my people! - suso
I thought it was super amazing this year... that running across the ceiling and then torch light-up. Awesome! - Daynah
It really was a spectacle - good enough that if you missed it, you should find out when they re-air it! - JMaultasch
Krish: when we stop torturing prisoners in the US then we can start worrying about the human rights abuses in other countries. - Robert Scoble
Great opening ceremony - could have done without the commentary, though. - David Worrell
adrienne: i completely disagree with your comment. i've lived in several countries in both europe and south america and while there is some feeling of nationalism in other countries when it comes to wanting their respective teams to win, the level of coverage has tended to not be so unilateral nor has the influence of commercials been so over the top whereby the programming gets preempted every 5 minutes - Cee Bee
The synchronized boxes that had people inside them was scary amazing. It was all scary amazing. - Sprague D
Zhang Yimou did a superb job in creating that dazzling show - imabonehead
Robert, I see where you are coming from. I denounce both with the same vigor. In fact, I respect the chinese people and their pride in the Olympics. I just don't respect their govt. and their abuses. - Krishnan Hussein Subraman
Cee Bee I made no mention of other countries, I am referring to the US only. btw I watched for almost 4 hours this morning before seeing a single US competitor. So the Nationalistic viewpoint was shot down. Capitalistic and commercialized must exist or we would have no coverage at all. - Adrienne Van Houten
Really? They better do some more research. We went looking for a Playstation 3 and they were sold out at four different stores. The salespeople at Target said that they've been flying off the shelves since Blueray won the format wars. - Robert Scoble
And you don't think this has to do with MGS 4? And you really trust those Target salespeople? ;) I find that half of what they say is just wrong whenever I go. - Andru Edwards
Andru: oh, that might have something to do with it too. They had no reason to make THAT up. Yeah, they make up lots of other stuff, though. It matches what I heard from other salespeople in other stores, though. - Robert Scoble
Oh yeah, I agree that once Blu-ray won, the PS3 was a no-brainer for HD optical movies. But the recent sales spike has way more to do with games than it does movies. Just look at Blu-ray disc sales, and compare that to just a couple of the big recent PS3 releases and you will see what I mean :) - Andru Edwards
@robert I really dont think thats because of blu-ray. Blu-Ray will never become DVD. - Akshay Dodeja
This is just a blip. Probably were similar studies when DVD was young. Lots of 1080p FullHD displays being sold; broadcast caps out at 1080i; gotta use BR for the full experience. Plus lots of places to rent BR now. - Steve Follmer via twhirl
You have to see it this way: We are tech-fanatics. Normal customers looking at the price of a dvd and a blu-ray and buy the dvd. They won't even see a big difference in quality, and get a new when the old dies. - Ryo
PS3s have been flying off the shelves since January? the NPD numbers don't back that theory up. sales have spiked when the price dropped, but that's it. - Richard Lawler via twhirl
Ryo: I totally disagree. And for $400 you get a game console, a Blu-ray player, and a bunch of other stuff (photo server) as well. If you think people can't see the difference, well, those people aren't the ones buying 60-inch HDTVs. If you're gonna spend $3,000 on a screen you aren't going to complain about a couple of hundred bucks to get a better player. Plus now the neighborhood kids will think you're cool cause you have a Playstation. - Robert Scoble
Nope. No one thinks you are cool for having a PS3. Only Xbox 360 and Wii get that attention ;) - Andru Edwards
Richard: well, something is happening cause the stores here can't keep them in stock. But maybe we're just ahead of the world. ;-) - Robert Scoble
Andru: I have an Xbox and a Playstation and, sorry, you aren't in tune with the 14-year-olds anymore. Patrick says the Playstation is way better than the Xbox. And after playing games at EA on both systems side-by-side I gotta say I agree with him. Xbox is looking old and creaky side-by-side. - Robert Scoble
The price dropped and they're not restocking ahead of the new 80GB sku, that's what happened. No one is ahead of anything - Richard Lawler via twhirl
Richard: hmm, well, the salespeople in the stores tell me that they've already had the 80GBs and they are sold as soon as they come in. I bought a 40GB model, which now has a 160GB drive in it. It was the last one we found. I'll keep watching the situation. - Robert Scoble
It's simple, interest goes up when the price goes down. blu-ray players should be quite a bit cheaper six months from now, but they're still not going to catch DVD. - Richard Lawler via twhirl
I just wonder if people are becoming disenchanted with media formats they know will become obselete. I used to own VHS taps - I sold them all in one go. I bought a lot of the same movies as DVD - and am not about to get rid of them too. The concept of "good enough" has become persuasive perhaps. - Jonathan Beckett
I never claimed that they would catch DVD. I bet that most consumers are going to just wait for an online movie distribution method. DirectTV, for instance, has HD movies already. So does Comcast. Most consumers just don't care enough to go beyond their cable/satellite systems. So that leaves Bluray to the weirdos who like the best picture and best audio. - Robert Scoble
They had the old 80gb ng out, but it isn't out yet. The one you bought has no PS2 backwards compatibility, which is the same asmodels. There is a new one that is more like the 40gb comi the new 80GB model. It xcomes out in september, the Target guy just wants to make a sale. - Richard Lawler via twhirl
Jonathan: interesting point. I have only bought three or four movies. I never understood why I'd want to watch things again. Yeah, there's exceptions to that rule, but they are pretty rare. Kids, on the other hand, love watching vids over and over again. But I can't stand that behavior so never encouraged it with Patrick and won't with Milan, either. I bet that if I hit that behavior, though, that the hard drive that's in my Playstation or Xbox or MacMini hooked up to TV will provide the answer to THAT. :-) - Robert Scoble
I don't know if people will move to DD that quickly, so far all the interfaces and systems are too hard to figure out. From the Apple TV, the cable STB, the xbox 360, the PS3, Netflix, no one has a system I think my mom wants to use consistently. - Richard Lawler via twhirl
Richard: the Target guy didn't want to make a sale. He had none of the above in stock and sent me to several other stores. But that explains what's going on, I didn't realize we were in between models. I don't care about old compatibility, so that's fine. I just needed a Blu-Ray player and this provided me with a way to get one. Now that I have it I see that the quality blows away the Xbox. - Robert Scoble
Pretty soon everything will be accessible from the Cloud. Right? I just need fatter pipe for HD content delivery. Who can provide it? I'm not sure.... - Brian Daniel Eisenberg
Richard: my dad is still using a 25-year-old TV, so I get where you're coming from there. If my dad does get into this new stuff (he's smart enough to deal with it) he'll just have us set it up. - Robert Scoble
Brian: that is the big question, isn't it? How soon will big fat pipes hit everyone's door? And will the cable companies keep from limiting them to protect their business models (of selling movies to people like my dad)? - Robert Scoble
Well ... I think the point is everyone is pretty happy with regular DVD resolution ... Who wants to pay a bunch of money to get video that is a little better than great. - Todd Loren Sinclair
Robert, do You really need all that stuff? - Luca Conti
Luca: do we really need anything? Someday I'll end up in a cardboard box. It's partly my job to keep up on the industry, so, yes. And it does bring me some enjoyment (my son is a much bigger game player than I am). - Robert Scoble
@Robert - I'm more interested in checking out what China is doing with 5G, what Japan is doing with 4G+ *(iMode?), India seems to be just getting to 3G. Mobile delivery is most certainly the future, and I'm holding out on my iPhone purchase until I can get the 4G LTE(Long Term Evolution) version which will hopefully deliver 21-42 megabit throughput. Until then, our early adopter hacks will have to suffice (e.g. reason why you carry 3 mobiles on your person). Sad state of affairs if you ask me. Progress? Not - Brian Daniel Eisenberg
Todd: I wonder of the people who buy a 50-inch-screen or bigger how do those people justify spending $1,500 or more on a screen and then not spending a couple of hundred bucks more to make it look really freaking awesome? - Robert Scoble
Brian: mobile in the United States will always be behind Japan and China because of the population density is a lot lower here. When you're over in Shanghai you'll totally understand why investing in new infrastructure makes sense. Small screens really don't need that much bandwidth, though. At least not until you have hyper-high-resolution screens and terabyte drives or memory that fit into iPhones (for HDTV). - Robert Scoble
The fact is that it took years for people to take to DVD. The advantage DVD enjoys over BR is that DVDs are backwards compatible with any tv wit composite inputs. BR requires large HD tvs to show the differences. This it stands to reason that progress will be slower ad people slowly migrate to the new platform. And don't forget those people with large DVD libraries. - Roberto Bonini
I believe the target audience for Blu-Ray will be the exact same people who are just going to want the hi-def streamed from some service. Being a movie buff, I doubt I'll be replacing my DVDs with Blu-Ray versions. Goodfellas on DVD still looks great on my Hi-def television. While a little more sharpness and detail would be great, it's far from the most important part of the movie experience for me. Plus, I'm at the point now with media server and streamers that I've retired most of my physical media. - Todd
I'll start getting into Blu-ray as soon as an XBox 360 comes out that supports them. The XBox 360 serves as the media center extender in my home and I'm not interested in anything that doesn't integrate with it. - Thomas Hawk
I wonder what the interest in HD DVD is? - Brian Sullivan
I'm with Thomas. I need a device that acts as a media center extender, plays BluRay, and is a gaming machine. If only the 360 would add a BluRay drive... - Matt
I don't care about blu-ray or HD DVD (right now). I stick with my oldschool DVD collection and I'm pretty fine with the picture quality.. - Daniel
I'd bet that most of the people queried wouldn't know an s-video cable from an HDMI if it bit them. If they can't tell the difference between 480 and 1080, they are either hooked up wrong or looking at a 24" LCD - The Picture Man
I'm definitely with Jonathan: I love watching my favourite movies over and over again, and I still haven't replaced my entire VHS-tape collection with DVDs; "good enough" is a big deal for me, and I say that knowing what HD content via HDMI looks and sounds like. However, I know Robert isn't alone with his see-once mindset, so it'll interesting to see if on-line movie dist. is the way things go. - John Jarvis
I've decided to skip Blu-ray and leave everything on the computer or DVDs. - Chris Luckhardt
Dude, Aaron. You don't even know. That may quite possibly be the number one pick up line I get. "DAAAAAAAAAAAAAAMN You got *ss for an Asian" ...and people wonder WHY I hate clubs/bars - Mona N.
@Cyndy: How do you read a numbered list where 9 items are blank? - Derick Valadao via feedalizr
I couldn't even imagine using that line. Anywhere. Anytime. - Aaron Brazell
Well, I mean... it's loaded. First of all its disrespectful, even for *me*. Second of all, Jesus, it's race-baiting. :-p --- And I'm really really disrespectful at times, by the way :-p - Aaron Brazell
Mona: When I do finally meet you, you better bet you know what I'm saying now :) - Justin Korn
JK: I will drop kick you in the head ;) @Aaron: It's the same, all over the country (NYC/LA/SF/Boston/DC) but then again, this is at clubs/bars. - Mona N.
Mona - I've had an avatar in SL since Nov 2006. What's your av's name? - Tad - just Tad
Mona: No doubt. But, like Justin, now I will use the line on you. But I can haz ninja skillz so will sidestep your headbutt. - Aaron Brazell
I'll see in a few weeks, bitch! ;) SEA, you're going right? @Tad: SECOND LIFE = DO NOT WANT - Mona N.
No I won't be in Sea. But will be in SF next weekend. Avoid me. :) - Aaron Brazell
Seattle, dude. You're not going? Aug. 21~ RE: SF, Wordcamp? - Mona N.
Yeah, Seattle's not working out. But yes, re WordCamp. I'm presenting. - Aaron Brazell