Computing desk | ||
---|---|---|
< November 27 | << Oct | November | Dec >> | November 29 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
These days, all our electronics are getting thinner and lighter but at what cost are manufacturers doing this? Is it performance? I dont think its cost as the high end professional electronic items still tend to be larger and chunkier, as well as more expensive. 82.40.46.182 ( talk) 00:24, 28 November 2013 (UTC)
Thinking of getting a flatscreen HDTV to hook up to my laptop, mostly so I can watch streaming Netflix movies on a bigger screen. I have a Toshiba Tecra A-7 (bought 2006 or 2007). I checked the archives but couldn't find anything that would apply to my case. My laptop doesn't has a HDMI port as far as I can tell but an S-video outlet. Do I need some extra hardware, is there a cable that would do the trick or is the solution, if there is one, completely different? Appreciated for any helpful input. thank you. 71.101.136.168 ( talk) 02:17, 28 November 2013 (UTC)
You will need a converter : http://www.ebay.com/bhp/s-video-to-hdmi-adapter
S video? Do your laptop even have VGA output? 140.0.229.39 ( talk) 02:56, 28 November 2013 (UTC)
I have a dual monitor setup with two different size monitors. The issue I am having is when I use remote desktop to connect to my server, on the left monitor (the larger one), when I maximize, I don't have to scroll right/left and up/down. Then when I move it over to the right monitor, I have to scroll right/left and up/down to display everything on the screen. Is this because I am using two different monitors of different resolutions? Are there are software fixes for the issue? — Preceding unsigned comment added by 2605:E000:5FC0:1E:15CB:3E18:656C:8F1E ( talk) 03:23, 28 November 2013 (UTC)
If I'm working with a deck of cards that is held in an array, can I use Collections.shuffle to shuffle the deck? It says that it's used on lists but I have an array. Dismas| (talk) 06:29, 28 November 2013 (UTC)
Arrays.AsList
which gives a List-like interface to an array. :) --
CiaPan (
talk)
06:51, 28 November 2013 (UTC)Sorry if this is obvious but how do I get my ArrayList back into an Array then? I'm new to this if you hadn't figured that out yet. Dismas| (talk) 12:51, 28 November 2013 (UTC)
Collections.shuffle( Arrays.AsList( tab))
Random rand ; for ( int i = 0 ; i < 52 ; i++ ) // For every card in the deck { int pos = rand.nextInt(52); // Pick a place for this card to go. Card tmp = cards[i] ; cards[i] = cards[pos] ; cards[pos] = tmp ; // Swap the i'th card with the one in some random place. }
OK, I have a little something to report on the question of how far off the "broken" implementation is. I wrote a little program that tries all nn possibilities and keeps track of how many times each possible permutation gets hit.
Of course I couldn't go up to n=52. The program took more than an hour for n=8, and that was several hundred times what it took for n=7, so while there's no doubt some serious low-hanging fruit in terms of making it run faster, we're not going to get past 9 or 10 with this approach.
Still, the results are intriguing, and if they generalize (and aren't just an artifact of some bug in my code), then the implementation actually seems to be rather badly broken:
n | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
---|---|---|---|---|---|---|---|---|---|
Mean hits | 2.000 | 4.500 | 10.67 | 26.04 | 64.80 | 163.4 | 416.1 | 1067.6 | 2755.7 |
Std dev | 0.000 | 0.500 | 1.841 | 5.803 | 17.25 | 49.83 | 141.5 | 397.98 | 1111.3 |
C.o.v | 0.000 | 0.111 | 0.173 | 0.223 | 0.266 | 0.305 | 0.340 | 0.373 | 0.403 |
So subject to the above caveats, it kind of looks like the ratio of the standard deviation (note: s.d., not variance) to the mean is, if anything, going up, not down, as n gets larger. Presumably it will level off somewhere (WAG: e−1), but this suggests that a substantial fraction of permutations may have probabilities differing by at least a factor of 1.3 from their theoretical values. That's pretty bad, at that level of analysis.
It still might be true that Steve is right that it doesn't make much practical difference for actual games; I don't know. (Or, it could be that I have a bug.) -- Trovatore ( talk) 04:09, 2 December 2013 (UTC)
Update: Turned out it's hugely faster to work a little harder on figuring out a code for a permutation rather than just dumping them into unordered_map (though, to be fair, I was using a really dumb hash function, so STL might be more competitive if I worked harder on that). With that change, I was able to get n=9 without too much pain. I've added the extra column above. (My WAG was wrong.) -- Trovatore ( talk) 07:24, 2 December 2013 (UTC)
New update: Added column for n=10. That was painful — my laptop kept threatening to get to 96 Celsius and shut down. I had to nursemaid it by hitting Ctrl-Z every now and then to let the fans catch up. Any further work at higher n along this lines, at least on my computer, will have to be Monte-Carlo, which complicates interpretation. But anyway it looks pretty clear that it's a bad way of doing a random shuffle. (Again, unless I have a bug, and I concede that I don't know whether there's any actual game for which this shuffle would be a problem.) -- Trovatore ( talk) 09:01, 2 December 2013 (UTC)
(unindent) There are clearly two very separate issues here:
The first is all about the quality of that Random class in Java. I suspect it's probably very good...but the algorithm doesn't depend on a particular random number generator - if you need a better one, you can write one and use it. That's really not the question here.
The second issue is the critical one. And I agree that the algorithm that I presented isn't as perfect as I first thought. (It is, however, plenty good for practical card-shuffling purposes because no matter how bad it is, it's not remotely as bad as a human doing the job with a real deck of cards!)
To understand *WHY* it's flawed is a bit subtle. Our article points out that the number of possible permutations of cards (52! or 52 factorial)
80,658,175,170,943,878,571,660,636,856,403,766,975,289,505,440,883,277,824,000,000,000,000
...does not divide exactly into 5252
252,480,111,352,266,526,589,168,512,857,250,850,253,488,701,621,266,216,973,895,038,073,875,801,560,933,776,490,496
...which is the number of possible ways that the algorithm can have moved the cards around. If the algorithm was perfect, then each pattern of cards would come about in exactly 5252/(52!) different ways through the software. That number is:
3,130,248,245,973,452,170.5993100879
And what's significant about that number is that it's not an integer. Which means that some patterns MUST come up more frequently than others - which is the final proof that the algorithm is statistically imperfect even if the random generator that drives it is perfect.
Unfortunately, that tells us nothing about HOW imperfect it is. The best-case scenario would be if one card pattern showed up about 0.00000000000000001% more often than any of the others...which would be entirely irrelevant for any reasonable purpose and way less bad than the statistical flaws inherent in any known software random number generator. But it might be worse than that...maybe MUCH worse.
The tricky part is understanding just how bad that statistical unfairness really is...particularly in the context of a particular kind of card game. For example, in the game of Contract Bridge, it doesn't matter what order each player gets their cards in - only which cards end up which which people. In the childs game of "SNAP" - it doesn't matter what suits the cards are.
However, our OP's question wasn't about finding a halfway decent shuffling algorithm - but actually about moving one data structure into another (and back again) in Java. So I guess we've already gone much deeper than is needed to answer that.
SteveBaker ( talk) 01:39, 3 December 2013 (UTC)
Random rand ; for ( int i = 51 ; i > 0 ; i-- ) // For every card in the deck except the first { int pos = rand.nextInt(i+1); // Pick a place for this card to go. Card tmp = cards[i] ; cards[i] = cards[pos] ; cards[pos] = tmp ; // Swap the i'th card with the one in some random place. }
Hi, I'm looking for a way to temporarily disable the built-in Pre-Boot Authentication feature of TrueCrypt, so that security updates / software installations that require a reboot don't require physical presence of somebody to type in the password. Does anybody know how that could be accomplished, preferably purely in software or with the use of a regular USB storage medium (no special "Token generator")? I'm looking for a way that would either have it bypass the authentication "just once" or a pre-defined, selectable number of reboot cycles, or as long as the USB storage medium is plugged in.
Kind Regards, 149.172.200.27 ( talk) 12:44, 28 November 2013 (UTC)
I know how using a WHERE clause works in the end product. But, recently at work I ran some query and it ran out of spool space. I was eventually able to get it to run by deleting out a couple tables that were joined. I want to know more about writing efficient queries. I know the basic process of writing queries in general. I have several specific questions on this topic. I would love a webpage on the subject if you know of one. I have googled for such a webpage many times and been unsuccessful. I may not know enough to use the right words.
I have heard that when you do a JOIN it creates the Cartesian product of the tables. If I write a query of the form SELECT stuff FROM somewhere WHERE conditions, do the WHERE conditions make the Cartesian product smaller? That is, are the filters applied to the various tables before the Cartesian product is performed? Or, does it create the Cartesian product first and then go through and limit the rows? This would be a huge difference in how much computing power is needed and I can't find the answer any where. If it does create the Cartesian product first, is there a way to make it more efficient?
I once read that if you move the WHERE conditions into the JOIN state it can make it more efficient. Is that true? For example, I'm saying that instead of putting WHERE a.number > 50000 in a WHERE clause, you should put that same condition in the join, i.e., a JOIN b ON (a.ID = b.ID and a.number > 50000). Is this true? Does this make it more efficient?
Also, if you do a bunch of JOINs in one query, does it create a huge Cartesian product of all tables all at once? Or does it do the first two, then limit, then the result with the next table, then that result with the next table, etc.?
Any references or answers would be greatly appreciated. Thanks. I would love references more than anything probably so I can learn more and more.
StatisticsMan ( talk) 15:33, 28 November 2013 (UTC)
MSDN (Microsoft Developer Network) has groups/forums on Sql Server. You can post there because as far as I remember anyone can post even without being a subscriber. http://social.msdn.microsoft.com/Forums/sqlserver/en-US/home?category=sqlserver&filter=alltypes&sort=lastpostdesc — Preceding unsigned comment added by 2601:7:7680:626:86D:846D:AD0B:96BD ( talk) 00:45, 29 November 2013 (UTC)
I can't use Link2SD to transfer movable apps to the SD card unless I "mount" the 2nd partition.
TWRP won't let me select the option "Mount SD Card," so I figure TWRP isn't the right app to mount the 2nd partition from. **What will let me?**
Once I successfully mount the 2nd partition, I'll next get 4 choices: ext2, ext3, ext4, FAT32 / FAT16. I'm trending toward ext4, so ext4 is correct?
I've been wanting to transfer many movable apps to the SD card because I have anemic internal storage space (<5 GB.) That's why I partitioned my 32 GB SD card. I still have yet to figure out how to "mount" said partition and what file system to choose, before I move the apps. Thanks. -- Let Us Update Wikipedia: Dusty Articles 17:30, 28 November 2013 (UTC)
I posted recently on the subject of my having these unnerving popups. They still bother me. This is what I did this morning. When they started I opened "the "Task manager" and looked at processes running. One of them caught my attention: FlashUtil64_11_9_900_152_ActiveX.exe. I noticed that when I close the browser (Internet Explorer) with the popups on it, the process disappears in the Task Manager. I then traced it to this directory: Windows\System32\Macromed\Flash. This subdirectory has a dll, an exe and a log file with numerous downloads. I don't even remember if I ever allowed so many downloads.
Can I delete the whole directory? Is it the one that is the troublemaker?
Thanks, 2601:7:7680:626:BD56:6784:7D52:E377 ( talk) 18:07, 28 November 2013 (UTC)Alex
OK, I just checked. This flash thing is NOT in "Uninstall Programs." What can I do? I don't play any video games. Can I just delete the whole directory perhaps? Thanks 2601:7:7680:626:D430:E4A9:403A:140 ( talk) 01:40, 30 November 2013 (UTC)
It turned out it was Adobe Flash Player. I uninstalled it and it seems those nasty popups are gone now. 2601:7:7680:626:D430:E4A9:403A:140 ( talk) 02:26, 30 November 2013 (UTC)
Sure you are correct. I wonder how do they do it and if there is a law to bring them to justice? I hope it is not Adobe themselves that do it but some people who are familiar with the application, perhaps former employees who have the source code. 2601:7:7680:626:3542:4C7:B0A6:21C0 ( talk) 17:08, 30 November 2013 (UTC)
Computing desk | ||
---|---|---|
< November 27 | << Oct | November | Dec >> | November 29 > |
Welcome to the Wikipedia Computing Reference Desk Archives |
---|
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages. |
These days, all our electronics are getting thinner and lighter but at what cost are manufacturers doing this? Is it performance? I dont think its cost as the high end professional electronic items still tend to be larger and chunkier, as well as more expensive. 82.40.46.182 ( talk) 00:24, 28 November 2013 (UTC)
Thinking of getting a flatscreen HDTV to hook up to my laptop, mostly so I can watch streaming Netflix movies on a bigger screen. I have a Toshiba Tecra A-7 (bought 2006 or 2007). I checked the archives but couldn't find anything that would apply to my case. My laptop doesn't has a HDMI port as far as I can tell but an S-video outlet. Do I need some extra hardware, is there a cable that would do the trick or is the solution, if there is one, completely different? Appreciated for any helpful input. thank you. 71.101.136.168 ( talk) 02:17, 28 November 2013 (UTC)
You will need a converter : http://www.ebay.com/bhp/s-video-to-hdmi-adapter
S video? Do your laptop even have VGA output? 140.0.229.39 ( talk) 02:56, 28 November 2013 (UTC)
I have a dual monitor setup with two different size monitors. The issue I am having is when I use remote desktop to connect to my server, on the left monitor (the larger one), when I maximize, I don't have to scroll right/left and up/down. Then when I move it over to the right monitor, I have to scroll right/left and up/down to display everything on the screen. Is this because I am using two different monitors of different resolutions? Are there are software fixes for the issue? — Preceding unsigned comment added by 2605:E000:5FC0:1E:15CB:3E18:656C:8F1E ( talk) 03:23, 28 November 2013 (UTC)
If I'm working with a deck of cards that is held in an array, can I use Collections.shuffle to shuffle the deck? It says that it's used on lists but I have an array. Dismas| (talk) 06:29, 28 November 2013 (UTC)
Arrays.AsList
which gives a List-like interface to an array. :) --
CiaPan (
talk)
06:51, 28 November 2013 (UTC)Sorry if this is obvious but how do I get my ArrayList back into an Array then? I'm new to this if you hadn't figured that out yet. Dismas| (talk) 12:51, 28 November 2013 (UTC)
Collections.shuffle( Arrays.AsList( tab))
Random rand ; for ( int i = 0 ; i < 52 ; i++ ) // For every card in the deck { int pos = rand.nextInt(52); // Pick a place for this card to go. Card tmp = cards[i] ; cards[i] = cards[pos] ; cards[pos] = tmp ; // Swap the i'th card with the one in some random place. }
OK, I have a little something to report on the question of how far off the "broken" implementation is. I wrote a little program that tries all nn possibilities and keeps track of how many times each possible permutation gets hit.
Of course I couldn't go up to n=52. The program took more than an hour for n=8, and that was several hundred times what it took for n=7, so while there's no doubt some serious low-hanging fruit in terms of making it run faster, we're not going to get past 9 or 10 with this approach.
Still, the results are intriguing, and if they generalize (and aren't just an artifact of some bug in my code), then the implementation actually seems to be rather badly broken:
n | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
---|---|---|---|---|---|---|---|---|---|
Mean hits | 2.000 | 4.500 | 10.67 | 26.04 | 64.80 | 163.4 | 416.1 | 1067.6 | 2755.7 |
Std dev | 0.000 | 0.500 | 1.841 | 5.803 | 17.25 | 49.83 | 141.5 | 397.98 | 1111.3 |
C.o.v | 0.000 | 0.111 | 0.173 | 0.223 | 0.266 | 0.305 | 0.340 | 0.373 | 0.403 |
So subject to the above caveats, it kind of looks like the ratio of the standard deviation (note: s.d., not variance) to the mean is, if anything, going up, not down, as n gets larger. Presumably it will level off somewhere (WAG: e−1), but this suggests that a substantial fraction of permutations may have probabilities differing by at least a factor of 1.3 from their theoretical values. That's pretty bad, at that level of analysis.
It still might be true that Steve is right that it doesn't make much practical difference for actual games; I don't know. (Or, it could be that I have a bug.) -- Trovatore ( talk) 04:09, 2 December 2013 (UTC)
Update: Turned out it's hugely faster to work a little harder on figuring out a code for a permutation rather than just dumping them into unordered_map (though, to be fair, I was using a really dumb hash function, so STL might be more competitive if I worked harder on that). With that change, I was able to get n=9 without too much pain. I've added the extra column above. (My WAG was wrong.) -- Trovatore ( talk) 07:24, 2 December 2013 (UTC)
New update: Added column for n=10. That was painful — my laptop kept threatening to get to 96 Celsius and shut down. I had to nursemaid it by hitting Ctrl-Z every now and then to let the fans catch up. Any further work at higher n along this lines, at least on my computer, will have to be Monte-Carlo, which complicates interpretation. But anyway it looks pretty clear that it's a bad way of doing a random shuffle. (Again, unless I have a bug, and I concede that I don't know whether there's any actual game for which this shuffle would be a problem.) -- Trovatore ( talk) 09:01, 2 December 2013 (UTC)
(unindent) There are clearly two very separate issues here:
The first is all about the quality of that Random class in Java. I suspect it's probably very good...but the algorithm doesn't depend on a particular random number generator - if you need a better one, you can write one and use it. That's really not the question here.
The second issue is the critical one. And I agree that the algorithm that I presented isn't as perfect as I first thought. (It is, however, plenty good for practical card-shuffling purposes because no matter how bad it is, it's not remotely as bad as a human doing the job with a real deck of cards!)
To understand *WHY* it's flawed is a bit subtle. Our article points out that the number of possible permutations of cards (52! or 52 factorial)
80,658,175,170,943,878,571,660,636,856,403,766,975,289,505,440,883,277,824,000,000,000,000
...does not divide exactly into 5252
252,480,111,352,266,526,589,168,512,857,250,850,253,488,701,621,266,216,973,895,038,073,875,801,560,933,776,490,496
...which is the number of possible ways that the algorithm can have moved the cards around. If the algorithm was perfect, then each pattern of cards would come about in exactly 5252/(52!) different ways through the software. That number is:
3,130,248,245,973,452,170.5993100879
And what's significant about that number is that it's not an integer. Which means that some patterns MUST come up more frequently than others - which is the final proof that the algorithm is statistically imperfect even if the random generator that drives it is perfect.
Unfortunately, that tells us nothing about HOW imperfect it is. The best-case scenario would be if one card pattern showed up about 0.00000000000000001% more often than any of the others...which would be entirely irrelevant for any reasonable purpose and way less bad than the statistical flaws inherent in any known software random number generator. But it might be worse than that...maybe MUCH worse.
The tricky part is understanding just how bad that statistical unfairness really is...particularly in the context of a particular kind of card game. For example, in the game of Contract Bridge, it doesn't matter what order each player gets their cards in - only which cards end up which which people. In the childs game of "SNAP" - it doesn't matter what suits the cards are.
However, our OP's question wasn't about finding a halfway decent shuffling algorithm - but actually about moving one data structure into another (and back again) in Java. So I guess we've already gone much deeper than is needed to answer that.
SteveBaker ( talk) 01:39, 3 December 2013 (UTC)
Random rand ; for ( int i = 51 ; i > 0 ; i-- ) // For every card in the deck except the first { int pos = rand.nextInt(i+1); // Pick a place for this card to go. Card tmp = cards[i] ; cards[i] = cards[pos] ; cards[pos] = tmp ; // Swap the i'th card with the one in some random place. }
Hi, I'm looking for a way to temporarily disable the built-in Pre-Boot Authentication feature of TrueCrypt, so that security updates / software installations that require a reboot don't require physical presence of somebody to type in the password. Does anybody know how that could be accomplished, preferably purely in software or with the use of a regular USB storage medium (no special "Token generator")? I'm looking for a way that would either have it bypass the authentication "just once" or a pre-defined, selectable number of reboot cycles, or as long as the USB storage medium is plugged in.
Kind Regards, 149.172.200.27 ( talk) 12:44, 28 November 2013 (UTC)
I know how using a WHERE clause works in the end product. But, recently at work I ran some query and it ran out of spool space. I was eventually able to get it to run by deleting out a couple tables that were joined. I want to know more about writing efficient queries. I know the basic process of writing queries in general. I have several specific questions on this topic. I would love a webpage on the subject if you know of one. I have googled for such a webpage many times and been unsuccessful. I may not know enough to use the right words.
I have heard that when you do a JOIN it creates the Cartesian product of the tables. If I write a query of the form SELECT stuff FROM somewhere WHERE conditions, do the WHERE conditions make the Cartesian product smaller? That is, are the filters applied to the various tables before the Cartesian product is performed? Or, does it create the Cartesian product first and then go through and limit the rows? This would be a huge difference in how much computing power is needed and I can't find the answer any where. If it does create the Cartesian product first, is there a way to make it more efficient?
I once read that if you move the WHERE conditions into the JOIN state it can make it more efficient. Is that true? For example, I'm saying that instead of putting WHERE a.number > 50000 in a WHERE clause, you should put that same condition in the join, i.e., a JOIN b ON (a.ID = b.ID and a.number > 50000). Is this true? Does this make it more efficient?
Also, if you do a bunch of JOINs in one query, does it create a huge Cartesian product of all tables all at once? Or does it do the first two, then limit, then the result with the next table, then that result with the next table, etc.?
Any references or answers would be greatly appreciated. Thanks. I would love references more than anything probably so I can learn more and more.
StatisticsMan ( talk) 15:33, 28 November 2013 (UTC)
MSDN (Microsoft Developer Network) has groups/forums on Sql Server. You can post there because as far as I remember anyone can post even without being a subscriber. http://social.msdn.microsoft.com/Forums/sqlserver/en-US/home?category=sqlserver&filter=alltypes&sort=lastpostdesc — Preceding unsigned comment added by 2601:7:7680:626:86D:846D:AD0B:96BD ( talk) 00:45, 29 November 2013 (UTC)
I can't use Link2SD to transfer movable apps to the SD card unless I "mount" the 2nd partition.
TWRP won't let me select the option "Mount SD Card," so I figure TWRP isn't the right app to mount the 2nd partition from. **What will let me?**
Once I successfully mount the 2nd partition, I'll next get 4 choices: ext2, ext3, ext4, FAT32 / FAT16. I'm trending toward ext4, so ext4 is correct?
I've been wanting to transfer many movable apps to the SD card because I have anemic internal storage space (<5 GB.) That's why I partitioned my 32 GB SD card. I still have yet to figure out how to "mount" said partition and what file system to choose, before I move the apps. Thanks. -- Let Us Update Wikipedia: Dusty Articles 17:30, 28 November 2013 (UTC)
I posted recently on the subject of my having these unnerving popups. They still bother me. This is what I did this morning. When they started I opened "the "Task manager" and looked at processes running. One of them caught my attention: FlashUtil64_11_9_900_152_ActiveX.exe. I noticed that when I close the browser (Internet Explorer) with the popups on it, the process disappears in the Task Manager. I then traced it to this directory: Windows\System32\Macromed\Flash. This subdirectory has a dll, an exe and a log file with numerous downloads. I don't even remember if I ever allowed so many downloads.
Can I delete the whole directory? Is it the one that is the troublemaker?
Thanks, 2601:7:7680:626:BD56:6784:7D52:E377 ( talk) 18:07, 28 November 2013 (UTC)Alex
OK, I just checked. This flash thing is NOT in "Uninstall Programs." What can I do? I don't play any video games. Can I just delete the whole directory perhaps? Thanks 2601:7:7680:626:D430:E4A9:403A:140 ( talk) 01:40, 30 November 2013 (UTC)
It turned out it was Adobe Flash Player. I uninstalled it and it seems those nasty popups are gone now. 2601:7:7680:626:D430:E4A9:403A:140 ( talk) 02:26, 30 November 2013 (UTC)
Sure you are correct. I wonder how do they do it and if there is a law to bring them to justice? I hope it is not Adobe themselves that do it but some people who are familiar with the application, perhaps former employees who have the source code. 2601:7:7680:626:3542:4C7:B0A6:21C0 ( talk) 17:08, 30 November 2013 (UTC)