Click here to Skip to main content

Welcome to the Lounge

   

For lazing about and discussing anything in a software developer's life that takes your fancy.
The Lounge is rated PG. If you're about to post something you wouldn't want your kid sister to read then don't post it. No flame wars, no abusive conduct and please don't post ads.

Technical discussions are welcome, but if you need specific help please use the programming forums.


 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page  Show 
GeneralRe: My Lucky DaymemberRichard Deeming27 Feb '13 - 5:42 
Rage wrote:
You mean (7 - n)/6.

Sorry, I was thinking in zero-based steps but writing in one-based steps.
 
Rage wrote:
I am still not convinced, though.

OK, you'd need a bag of 3420 M&Ms for the probability to round to 1.5%; a bag of 12 would give you 6.9%:
void Main()
{
   for (int i = 6; i <= 3996; i += 6)
   {
      Console.WriteLine("Bag of {0}: {1:###0.0%}", i, NomNomNom(i));
   }
}
 
static double NomNomNom(int bagSize)
{
   int remainder = bagSize % 6;
   if (remainder != 0) bagSize += 6 - remainder;
 
   int numberOfEachColor = bagSize / 6;
   double otherColorsRemaining = bagSize;
   double remaining = bagSize;
 

   double result = 1D;
   for (int step = 0; step < 6; step++)
   {
      result *= otherColorsRemaining / remaining;
      otherColorsRemaining -= numberOfEachColor;
      remaining -= 1;
   }
 
   return result;
}
 
I'm not sure how big the American bags get, so that might be a totally normal bag size! Poke tongue | ;-P



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: My Lucky DaymemberRage27 Feb '13 - 5:51 
Mmmhh... I think you are right.
Moreover, the number of M&Ms you need to pick to get all colors would be in average 14.7
~RaGE();

I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Do not feed the troll ! - Common proverb


GeneralRe: My Lucky DaymemberColin Mullikin27 Feb '13 - 8:18 
Richard Deeming wrote:
...a bag of 3420 M&Ms ... I'm not sure how big the American bags get, so that might be a totally normal bag size!
That's actually one serving size. A bag contains about 3.5 servings. Laugh | :laugh:
The United States invariably does the right thing, after having exhausted every other alternative. -Winston Churchill
 
America is the only country that went from barbarism to decadence without civilization in between. -Oscar Wilde
 
Wow, even the French showed a little more spine than that before they got their sh*t pushed in.[^] -Colin Mullikin


GeneralRe: My Lucky DaymemberbVagadishnu27 Feb '13 - 10:17 
Richard Deeming wrote:
with an even distribution of colours,

This is definitely not the case. I bought two bags in a row with no red ones.
M&M color distribution [^]
Schenectady? What am I doing in Schenectady?

GeneralRe: My Lucky DaymemberS Houghtelin27 Feb '13 - 4:23 
Don’t buy the ticket, your luck is already been used up for the M&Ms. You should have bought the lotto ticket instead of the M&Ms.
 
Story of most peoples lives, when you do get lucky, it's not the kind that benefits you significantly… aw shoot, buy the ticket! Big Grin | :-D
It was broke, so I fixed it.

GeneralRe: My Lucky Daymemberwizardzz27 Feb '13 - 5:38 
Just be happy you didn't pull out any Skittles, which is a good prank btw (combining m&m&s's in a bowl for unsuspecting snackers.)
RantWindows Explorer and the Slow Server [modified]memberDave Calkins27 Feb '13 - 3:11 
I think every version of Windows has had this issue going back as far as I can remember. When trying to copy a file from a remote file server and the connection is less than stellar Explorer will hang. This happens often enough that you have to scratch your head and wonder why.
 
This even applies to Windows 8. Just tried copying a file from a work server over VPN on the laptop and, sure enough, Explorer hangs and becomes unresponsive. its like the connection isn't great and/or the server isn't responding, which happens, but explorer will just hang in these situations. Then, it'll also hang when you attempt to cancel it. Not sure what's going on, maybe the remote server isn't sending back the response Explorer (or the SMB subsystem) is waiting for.
 
Its enough to make you want to write your own SMB client or something Smile | :) Seems like this issue persists through every new version of Windows as well. Is there some magic setting I'm missing? I wonder if Samba experiences this same sort of behavior?

modified 27 Feb '13 - 9:30.

AnswerRe: Windows Explorer and the Slow ServermemberBrisingr Aerowing27 Feb '13 - 3:40 
Try Explorer++[^]. I am not sure if it will work (I have never had a bad connection to a server), but it has a lot of super cool features.
 
There is also a Portable Version[^].

Bob Dole
The internet is a great way to get on the net.

D'Oh! | :doh: 2.0.82.7292 SP6a

GeneralRe: Windows Explorer and the Slow ServermemberDave Calkins27 Feb '13 - 4:18 
Just tried it -- same thing as Windows Explorer. I typed \\servername in the top field and the app just hung and became completely unresponsive. I think the server isn't responding promptly, but just as with Windows Explorer the app completely hangs as a result for some reason. Thanks for the suggestion though, it still looks like a nice utility to have.
GeneralRe: Windows Explorer and the Slow ServermemberDave Calkins27 Feb '13 - 4:21 
Also, after waiting for the list of files to show, I tried copying a file to my local machine (same one I was trying to get to before). I noticed the standard Win8 progress window pop up and the app behave the same way as Explorer. App completely hung and the copy was sort of stalled or something. I tried cancelling and the cancel request hung too.
 
I think Explorer++ just uses the regular windows file copy which is whats having the problem so using Explorer++ doesn't really help.
GeneralRe: Windows Explorer and the Slow ServermemberDave Calkins27 Feb '13 - 4:24 
Also, when you open a new tab and type in \\servername the rest of the app is unusable while its talking to the server. You can't switch to another tab and work with local files while its attempting to get the file list from the server. All these replies to simply say, its the same issue as with Windows explorer.
AnswerRe: Windows Explorer and the Slow ServermemberBrisingr Aerowing27 Feb '13 - 4:35 
Teracopy[^]?

Bob Dole
The internet is a great way to get on the net.

D'Oh! | :doh: 2.0.82.7292 SP6a

GeneralRe: Windows Explorer and the Slow ServermemberDave Calkins27 Feb '13 - 5:28 
Nice! Thanks for the link. Just tried it and it looks like it'll be a nice tool to have in the tookit. Granted, by the time I tried it the network issue was resolved and the copying is fine now. But I'll definitely pull it out if I run into this again and see how it handles it.
GeneralRe: Windows Explorer and the Slow ServermemberBrisingr Aerowing27 Feb '13 - 6:12 
Teracopy can actually be configured as the default copy handler for shell copy operations.

Bob Dole
The internet is a great way to get on the net.

D'Oh! | :doh: 2.0.82.7292 SP6a

GeneralRe: Windows Explorer and the Slow ServermemberDave Calkins27 Feb '13 - 7:07 
Looks like that happens automatically when you install it. After installing I tried copying another file from the server via copy/paste and TeraCopy jumped in and did it.
GeneralRe: Windows Explorer and the Slow ServermemberBrisingr Aerowing27 Feb '13 - 7:20 
You had to enable that in an older version, it wasn't enabled by default. Haven't used it in a while, so I did not know that.

Bob Dole
The internet is a great way to get on the net.

D'Oh! | :doh: 2.0.82.7292 SP6a

GeneralRe: Windows Explorer and the Slow ServermemberRoger Wright27 Feb '13 - 5:47 
Dave Calkins wrote:
like the connection isn't great and/or the server isn't responding, which happens, but explorer will just hang in these situations

It's well known that Internet Explorer sucks; apparently it doesn't suck hard enough to complete the file transfer, though.
Will Rogers never met me.

GeneralRe: Windows Explorer and the Slow ServermemberBrisingr Aerowing27 Feb '13 - 6:13 
Windows Explorer != Internet Explorer
 
Windows Explorer == File Manager
 
Internet Explorer == Buggy HTML Renderer used only to download an actual Web Browser, like Chrome.

Bob Dole
The internet is a great way to get on the net.

D'Oh! | :doh: 2.0.82.7292 SP6a

GeneralRe: Windows Explorer and the Slow ServerprotectorAspDotNetDev27 Feb '13 - 6:10 
It's even worse on Macs. Whenever my coworkers encounter network issues (which happens a lot), crazy things happen. They have to force quit things, and sometimes restart.
 
Seriously, you'd think they could build in a little fault tolerance and maybe background processing so a network issue doesn't block the UI.

GeneralAnybody this nerdy out there?memberJohnny J.27 Feb '13 - 2:13 
Nerdy proposal or????[^]
 
I'm glad I don't have the problem with my spouse being way smarter than me... Smile | :)
Why can't I be applicable like John? - Me, April 2011
-----
Beidh ceol, caint agus craic againn - Seán Bán Breathnach
-----
Da mihi sis crustum Etruscum cum omnibus in eo!
-----
Just because a thing is new don’t mean that it’s better - Will Rogers, September 4, 1932

GeneralRe: Anybody this nerdy out there?protectorPete O'Hanlon27 Feb '13 - 2:14 
My wife is smarter than me in all ways, but one. She agreed to marry me.
I was brought up to respect my elders. I don't respect many people nowadays.

CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

GeneralRe: Anybody this nerdy out there?memberNagy Vilmos27 Feb '13 - 2:45 
---"---
Reality is an illusion caused by a lack of alcohol

GeneralRe: Anybody this nerdy out there?mvpMarcus Kramer27 Feb '13 - 2:50 
Funny thing. That's what she said...
I wasn't, now I am, then I won't be anymore.

GeneralRe: Anybody this nerdy out there?memberTobi the Terrible27 Feb '13 - 3:21 
You made my day with this!! Big Grin | :-D
NewsRemove the Cream!memberSuper Lloyd27 Feb '13 - 1:56 
This guy build a Oreo cream remover machine[^]!
Well, I think cream is the best part, no?
But the machine is fun! ^^
My programming get away... The Blog...
DirectX for WinRT/C# since 2013!
Taking over the world since 1371!

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   


Advertise | Privacy | Mobile
Web03 | 2.6.130523.1 | Last Updated 25 May 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid