Wikipedia:Reference desk/Archives/Computing/2012 October 26
Computing desk | ||
---|---|---|
< October 25 | << Sep | Oct | Nov >> | October 27 > |
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. |
October 26
[edit]How do I create different colored place marks in Spreadsheet Mapper 3?
[edit]want to be able to have different colored place marks (or even different shapes) for different types of sites. How do I get that to occur via the PlacemarkData sheet? Thanks, Kingturtle = (talk) 01:36, 26 October 2012 (UTC)
- This may be helpful. They (talk) 07:58, 28 October 2012 (UTC)
Scratchy looking font colors in PPT 2003
[edit]I like to use a black background as standard and Garamond font. White and yellow font color comes out really nicely but red, light green and light blue comes out scratchy -- why is this and how can I avoid it? It improved with increased text size but I can't have everything written in 50+ font. Must I change to a sans-serif font -- I don't particularly like them. DRosenbach (Talk | Contribs) 05:24, 26 October 2012 (UTC)
- My guess is that when you pick those colours you are not lighting many of the pixels on your monitor and you are seeing lower resolution because of that. Dithering may help. Graeme Bartlett (talk) 08:43, 26 October 2012 (UTC)
- How would I modify the dithering? DRosenbach (Talk | Contribs) 20:31, 26 October 2012 (UTC)
https://code.google.com/p/gdipp/ Might help on your end, but each individual end user of the presentation might have the same problem. The only reliable solution would probably be to use images instead of text. Even then, certain primary colors will always clash. ¦ Reisio (talk) 12:16, 26 October 2012 (UTC)
- Ha! I have no idea what any of that means -- I'll have to check with my computer-guy landlord. Thanx! DRosenbach (Talk | Contribs) 20:31, 26 October 2012 (UTC)
- One thing to check is that your monitor is not currently set to display a small number of colors, like 256. Under Windows, go to Start + Control Panel + Display and pick the Settings tab, then check the color quality setting. StuRat (talk) 17:59, 26 October 2012 (UTC)
- There is no "display" icon in my control panel. DRosenbach (Talk | Contribs) 20:31, 26 October 2012 (UTC)
- What version of Windows are you using ? Under some versions, I believe you need to pick a button to change back to the traditional list of icons. StuRat (talk) 02:05, 28 October 2012 (UTC)
Scan holofoil
[edit]Is there a way to reliably scan or otherwise digitize holofoil, so that the pattern in the holofoil shows up? All my attempts have resulted in either flat black or grey. Horselover Frost (talk · edits) 12:22, 26 October 2012 (UTC)
- I am not sure if this is helpful in your case, but laminator pouches can be helpful if you want to scan or photograph reflective surfaces. http://www.heiko-popp.de/temp/Scanning%20reflective%20covers.pdf They (talk) 01:44, 28 October 2012 (UTC)
- I suspect that you'll have better luck with a camera than with a scanner. The holofoil is designed to be viewed through a lens system, such as your eye or a camera, and the direction that it is illuminated and viewed from can be important. 209.131.76.183 (talk) 12:27, 29 October 2012 (UTC)
Android browser
[edit]How can i delete history of visited web sites and stop them appearing when i click on the internet icon? I have Samsung Galaxy Tab2--78.148.129.254 (talk) 13:55, 26 October 2012 (UTC)
- On my Samsung Galaxy S II I open the app and touch the menu key, then Settings -> Privacy and Security. You can clear a number of items from here, including the history. You might find it useful to use Google Chrome, which is available through the Play store and has an Incognito mode to allow browsing without recording the sites you visit. - Cucumber Mike (talk) 14:13, 26 October 2012 (UTC)
Better RAM?
[edit]8GB Kit (4GBx2) DDR3 PC3-10600 • CL=9 • Unbuffered • NON-ECC • DDR3-1333 • 1.35V • 512Meg x 64
8GB Kit (4GBx2) DDR3 PC3-8500 • CL=7 • Unbuffered • NON-ECC • DDR3-1066 • 1.5V • 512Meg x 64
What's the difference between both sets? Both cost the same. I suppose that 1.35 consumes less power than 1.5, and that 1333 is faster than 1066, although both things together sound contradictory. And if the first is better, why the same price? OsmanRF34 (talk) 17:19, 26 October 2012 (UTC)
- You've got it. My personal knowledge of this doesn't extend to exactly how it's possible to produce one memory module that's both faster and more efficient than another, but that's what's happening here. This seems like a good explanation of memory transfer speeds. My Internet searches on the subject seemed to throw up only forum posts, which seemed to all take the format "Will I notice a difference when using faster memory?" "No, you defo won't" "Yes, you totes will". The best advice would seem to be under "About adding faster memory" in the link above. - Cucumber Mike (talk) 20:24, 26 October 2012 (UTC)
- Assuming that both sets of memory 'chips' are from the same manufacturer, it is possible that they are in fact the 'same' i.e. produced on the same integrated circuit fabrication line to the same Integrated circuit design and then tested and sorted to see what voltage/frequency they will actually work correctly at. As I have no reference: [citation needed], though there is a brief mention here, Wafer testing#Wafer prober "In some very specific cases, a die that passes some but not all test patterns can still be used as a product, typically with limited functionality."
Of course it it also possible that they are totally different designs! - 220 of Borg 01:03, 27 October 2012 (UTC)- very true; often observed that similar chips with lower ratings can be just defective individuals of their more robust brethren, and may therefore harbor other untested defects; but I don't know anybody who has ever proved this. also, the Rule of $1; all chips, no matter what their complexity or initial cost, asympotically trend over time to a final cost of $1, so that the actual selling price at the end reflects supply, demand, shipping and storage, marketing, and a zillion other factors more than the actual cost to make the chip. Gzuckier (talk) 04:16, 27 October 2012 (UTC)
- Assuming that both sets of memory 'chips' are from the same manufacturer, it is possible that they are in fact the 'same' i.e. produced on the same integrated circuit fabrication line to the same Integrated circuit design and then tested and sorted to see what voltage/frequency they will actually work correctly at. As I have no reference: [citation needed], though there is a brief mention here, Wafer testing#Wafer prober "In some very specific cases, a die that passes some but not all test patterns can still be used as a product, typically with limited functionality."
Creating variable list names in Python
[edit]I want to create lists named listX thru listY, with, say, X = 4, and Y = 392. How can I do that without using 389 lines of code to define each explicitly ? If you suggest using something other than lists, keep in mind that I want each list to have a dynamic length, so I can add to it as much as I want. This is how I'm explicitly defining them currently:
list4 = [] list5 = [] . . . list391 = [] list392 = []
I'm also interested in creating lists containing two variables, like:
list1_1 = [] list1_2 = []
list2_1 = []
list4_1 = [] list4_2 = [] list4_3 = [] . . . list99_6 = [] list99_7 = []
StuRat (talk) 18:08, 26 October 2012 (UTC)
- So you want to create 389 variables, or just 389 mappings? The latter (which is surely the sensible thing) is to use one of the in-built collection types (say a list of (name, value) tuples, or a dictionary that maps {name:value} pairs). Depending on what you plan to do with all these things, you might instead use namedtuple or OrderedDict from the collections library. If you really wanted to actual manufacture real variables, locals() and globals() return the local and global namespace contexts respectively, so you can say locals()['foo']=13 to magically create a variable called foo and give it the integer value 13. But don't do that, you probably just want a dictionary. -- Finlay McWalterჷTalk 18:16, 26 October 2012 (UTC)
- You can say
globals()['foo'] = 13
, but you can't do that withlocals()
([1]). Python is designed such that all local variable references can be resolved at compile time. Munginglocals()
at run time may do what you expect in some implementations, but you can't rely on it. -- BenRG (talk) 22:24, 27 October 2012 (UTC)
- You can say
- For your second thing, the key of a dictionary can be a tuple, so you'd say
mystuff = {} # create an empty dictionary
mystuff[(99,98)] = [1,2,99,104]
mystuff[(99,99)] = ["orange", "lemon", "lime"]
Maybe it will help to show what I'm actually trying to do. In the first case, I want to sort words by scores they produce in a word game, in the most efficient way possible. Those scores vary from 4 to 392 per word. The best type of sort for this type of thing is a bin sort. So, I want to create bins named score4list through score392list and place each English word in one of those bins. It's not necessary to sort within each bin. I'd then like to create a list from the concatenation of all those bins, in order. StuRat (talk) 18:24, 26 October 2012 (UTC)
- I'm off running, so I won't have time to think properly about your problem for a few hours, but I think OrderedDict will be what you need. -- Finlay McWalterჷTalk 18:28, 26 October 2012 (UTC)
- OK, no hurry. I tried out "locals", and that seems to do what I need as far as defining the lists, but there's also the question of referencing the lists later (see below). StuRat (talk) 18:41, 26 October 2012 (UTC)
- Don't do that with
locals()
– see above. -- BenRG (talk) 22:24, 27 October 2012 (UTC)
- Don't do that with
- OK, no hurry. I tried out "locals", and that seems to do what I need as far as defining the lists, but there's also the question of referencing the lists later (see below). StuRat (talk) 18:41, 26 October 2012 (UTC)
Note that when I add to each bin, I'd like to be able to use a variable list name, as well, to avoid avoid a whole bunch of ifs, like so:
if score = 4: score4list.append(word) elif score = 5: score5list.append(word) . . . elif score = 392: score392list.append(word)
Instead, I'd like something like:
score[score]list.append(word)
StuRat (talk) 18:36, 26 October 2012 (UTC)
- You can nest data structures in Python:
scorelist = {} # Rule of thumb in Python - when in doubt, use a dictionary for score, word in entries: # Or whatever loop gets you (score, word) pairs #setdefault() methods of dictionaries gets the entry if it exists, or sets it to the given value and then returns it if not. scorelist.setdefault(score,[]).append(word)
outlist = [] for k in sorted( scorelist.keys() ): outlist.extend( scorelist[k] )
- Although, the "decorate-sort-undecorate" idiom is probably going to be the simplest way to do your sorting (and probably faster), if you don't need to preserve the order within a bin. (The following DSD will alphabetize within each bin, though you can massage the decorating to change that.)
#Insert whatever code you need to build an arbitrarily ordered list of (score, word) tuples here sort(entries) outlist = [ word for (score, word) in entries]
- Generally, anytime you want to make some sort of systematic variable naming convention, you'd be better served with some sort of data structure. -- 205.175.124.30 (talk) 18:53, 26 October 2012 (UTC)
- What do you mean by "data structure" ? Aren't lists data structures ? StuRat (talk) 19:03, 26 October 2012 (UTC)
- Exactly - use a data structure like a list, dictionary, tuple, structure or class to group and organize related data, rather than some ad hoc variable naming scheme. Having a number of variables like "name01, name02, name03, name04 ..." is a code smell. (I'd also argue that doing things like having seperate x, y and z variables to store the coordinates of a 3D object, as opposed to having a self contained "3D point" class/object is also a bit on the outré side.) -- 205.175.124.30 (talk) 00:09, 27 October 2012 (UTC)
As for the second case, an added rub to the game is that there's a 50 point bonus for using all the letters remaining in your hand (2-10), whatever that number of letters is. So, the scores for each word are no longer based on the word alone, but also whether the word uses all the letters in the person's hand. So, now we have list names like this:
score392MaxLetters10List
Note that there are many "holes", in that not every combo of scores (4-392) × number of letters in the hand (2-10) exists. StuRat (talk) 19:01, 26 October 2012 (UTC)
- I have not quite understood your domain problem, but I very much doubt that your approach can beat the build-in sort function of Python, if only because that is is implemented in native code, not interpreted Python. Sorting a list of 100000 random elements does not take much longer than creating it in the first place. --Stephan Schulz (talk) 19:27, 26 October 2012 (UTC)
- Well, I will check my bin sort against Python's sort, and go with whichever is faster. But first I must figure out how to write mine. StuRat (talk) 19:38, 26 October 2012 (UTC)
- Well, if you want to do this as a learning project, go ahead. But if you want use this in a working program, the productive approach is to first go with the system sort, and only when you identify the sorting as a bottleneck that makes your program too slow (notice two conditions ;-), you can optimise it. That said, what you want to do cries for an array of lists. In Python, arrays and lists are the same data structure, but indexing is O(1) as in "proper" arrays. So you can set up your data structure as
bins = [list() for i in range(4, 393)]
" and add a word to it via "bins[score].append(word)
". Variables in Python are implemented via a name lookup in a dict, and probably have worse performance than indexing into a list. --Stephan Schulz (talk) 20:04, 26 October 2012 (UTC)
- Well, if you want to do this as a learning project, go ahead. But if you want use this in a working program, the productive approach is to first go with the system sort, and only when you identify the sorting as a bottleneck that makes your program too slow (notice two conditions ;-), you can optimise it. That said, what you want to do cries for an array of lists. In Python, arrays and lists are the same data structure, but indexing is O(1) as in "proper" arrays. So you can set up your data structure as
- Well, I will check my bin sort against Python's sort, and go with whichever is faster. But first I must figure out how to write mine. StuRat (talk) 19:38, 26 October 2012 (UTC)
- Note that your sorted list is only ever going to be valid for a single given hand. A different hand will mean each item will fall into different bins, and hence different sort locations, regardless of the method you use to create it. With that in mind, I'd just adjust the score of the word to add in the bonus. (So you would have a global base score, and a hand-specific score, and you'd bin/sort on the hand specific score.) When you're populating your bins, or building your list of tuples, just do your "do I get a bonus" test, and add the bonus to the base score as appropriate. If you want the list for each hand, just repeat the populating and sorting. Regarding sparseness, dictionaries are great for that, as you don't need to have all the intermediate keys populated. But given the small number of possible entries (sounds like less than 450 in your case), having a list-of-lists with some of the inner lists being empty won't be anything close to a performance/memory hit. - BTW, I whole-heartedly agree with Stephan. While trying to come up with the best way to do things is a great learning experience, optimizing for optimizing's sake rarely works out. By the time you get your optimized solution debugged and working, the simple/straightforward way typically would have already finished running. -- 205.175.124.30 (talk) 00:22, 27 October 2012 (UTC)
- RE: "your sorted list is only ever going to be valid for a single given hand"; not so, it will be valid for every hand with the same number of letters. Hence, it is my intention to produce multiple lists, one for each possible hand size, each sorted by score. I can then go through the appropriate list from high score to low, and the first one which matches my letters is the best word.
- And, yes, I am just learning Python, and am trying this out as a learning experience. StuRat (talk) 00:58, 27 October 2012 (UTC)
- I'm surprised no one has mentioned collections.defaultdict yet. I think the easiest way to do this is:
from collections import defaultdict
bins = defaultdict(list)
for score, thing in unsorted_things:
bins[score].append(thing)
sorted_things = [(score, thing) for score, thinglist in bins.items() for thing in thinglist]
- However,
sorted_things = sorted(unsorted_things)
is easier and may well be faster, as already mentioned. -- BenRG (talk) 01:00, 27 October 2012 (UTC)- (Actually, this doesn't really work because
bins.items()
won't return the scores in order, and I guess sorting them isn't allowed. Silly me.)
- (Actually, this doesn't really work because
- OK, I implemented your first suggestion, like this:
from collections import defaultdict
def buildWordScoreLists(wordList):
words = defaultdict(list)
for i in range(len(wordList)):
score = getWordScore(wordList[i] )
wordLength = len(wordList[i])
for maxHandSize in range(wordLength+1,9+1):
words[maxHandSize,score].append(wordList[i])
words[wordLength,score+50].append(wordList[i])
wordsByMaxHandSize = defaultdict(list)
for maxHandSize in range(2,9+1):
for score in range(442,4-1,-1):
for i in range(len(words[maxHandSize,score])):
myWord = words[maxHandSize,score][i]
wordsByMaxHandSize[maxHandSize].append(myWord)
return wordsByMaxHandSize
- It took a bit under 1.5 seconds to run against 83667 words. Does anyone see a faster "do it yourself" approach (versus using Python sort methods) ? (Incidentally, I realize some of those hardcoded values, like the maximum possible score of 442, should be made into variables, and that's my next task). StuRat (talk) 04:38, 27 October 2012 (UTC)
Here's the above function with the hardcoded values removed and comments added:
def buildWordScoreLists(wordList,minWordLength,maxWordLength,allLettersUsedBonus):
# Create a 2-dim array of lists of words: words[maxHandSize,score]:
words = defaultdict(list)
minScore = 99999
maxScore = 0
for i in range(len(wordList)):
score = getWordScore(wordList[i] )
if score < minScore:
minScore = score
if score > maxScore:
maxScore = score
wordLength = len(wordList[i])
for maxHandSize in range(wordLength+1,maxWordLength+2): # Really maxWordLength + 1.
words[maxHandSize,score].append(wordList[i])
words[wordLength,score+allLettersUsedBonus].append(wordList[i]) # Case where wordLength == maxHandSize.
# Flatten to a 1-dim array of lists of words: wordsByMaxHandSize[maxHandSize], in order or decreasing scores:
wordsByMaxHandSize = defaultdict(list)
for maxHandSize in range(minWordLength,maxWordLength+2): # Really maxWordLength + 1.
for score in range(maxScore+allLettersUsedBonus,minScore-1,-1): # Really minScore.
for i in range(len(words[maxHandSize,score])):
myWord = words[maxHandSize,score][i]
wordsByMaxHandSize[maxHandSize].append(myWord)
return wordsByMaxHandSize
StuRat (talk) 05:26, 27 October 2012 (UTC)
- Instead of
for i in range(len(array)): item = array[i]; ...
, it's simpler to writefor i, item in enumerate(array): ...
. Actually in this case you don't need the index at all so you can just writefor item in array: ...
. And you can replace the last loop withextend
. Here's a rewritten version with some other changes:
def buildWordScoreLists(wordList, minWordLength, maxWordLength, allLettersUsedBonus):
# Create a 2-dim array of lists of words: words[maxHandSize,score]:
words = defaultdict(list)
scoreList = map(getWordScore, wordList) # or list(map(getWordScore, wordList)) in Python 3
minScore, maxScore = min(scoreList), max(scoreList)
for word, score in zip(wordList, scoreList):
wordLength = len(word)
for maxHandSize in range(wordLength+1,maxWordLength+2):
words[maxHandSize, score].append(word)
words[wordLength, score+allLettersUsedBonus].append(word) # Case where wordLength == maxHandSize.
# Flatten to a 1-dim array of lists of words: wordsByMaxHandSize[maxHandSize], in order or decreasing scores:
wordsByMaxHandSize = defaultdict(list)
for maxHandSize in range(minWordLength, maxWordLength+2):
for score in reversed(range(minScore, maxScore+allLettersUsedBonus+1)):
wordsByMaxHandSize[maxHandSize].extend(words[maxHandSize, score])
return wordsByMaxHandSize
- No guarantees I didn't introduce a bug. -- BenRG (talk) 06:42, 27 October 2012 (UTC)
- Yep, it got a bug alright. "minScore, maxScore = min(scoreList), max(scoreList)" produced the error: "TypeError: 'int' object is not callable", even when I broke it up into two lines, and tried both versions of the preceding line. StuRat (talk) 18:56, 27 October 2012 (UTC)
- That's because someone (not BenRG) has defined an integer variable called "min" (or "max"), which has overridden the system min or max function. -- Finlay McWalterჷTalk 19:03, 27 October 2012 (UTC)
- Interesting. The variables "minWordLength" and "maxWordLength" are indeed called "min" and "max" where I make the function call. I thought those names wouldn't be defined within this function. Are they, by default, global variables, if defined in the main ? StuRat (talk) 22:20, 27 October 2012 (UTC)
- Any variable assigned in a function is local unless you declare it global. Any variable assigned outside a function (at the top level) is global. If your "main" is not a function, you should probably put it in a function named
main
and just callmain()
at the top level, to avoid this kind of problem. -- BenRG (talk) 22:29, 27 October 2012 (UTC)
- Any variable assigned in a function is local unless you declare it global. Any variable assigned outside a function (at the top level) is global. If your "main" is not a function, you should probably put it in a function named
- OK, thanks for the hint. (This learning exercise is apparently working, as I'm learning quite a few new things here.) StuRat (talk) 01:15, 28 October 2012 (UTC)
Is someone using my email for spam?
[edit]Hi, I hope you can help. I just exited Outlook after writing two emails but I got a message saying that there were unsent emails being sent. Well I was surprised as the two I sent were short text only and would normally have gone immediately in a second or two. Also the message said it was sending three emails and I only wrote two. I waited till the outbox was empty and check my sent emails. There were only the two I knew I had written. Is there some way my email account is being used to send spam and how can I check it if those emails don't show in my 'sent' box? there must surely be a more certain way of checking what emails have been sent from my PC. Hope you can help. Gurumaister (talk) 19:53, 26 October 2012 (UTC)
- There is malware (such as ILOVEYOU) that sends email to people in your address book with your name in the From: line, but I don't think there's ever been any malware that uses Outlook to send the mail. Spammers can also send forged email with your address in the From: line without involving your computer at all, but again Outlook wouldn't report that mail. I don't know what caused this glitch but I'm pretty sure it isn't spammers. -- BenRG (talk) 00:53, 27 October 2012 (UTC)
Thanks, BenRG. Hopefully it was just a glitch then. Gurumaister (talk) 07:03, 27 October 2012 (UTC)
- It's possible that a previous email failed to send properly the last time you used Outlook. I've had such a thing happen, but it usually re-sent as soon as I started Outlook again, but that would probably depend on the settings you have for sending and receiving messages. Matt Deres (talk) 22:44, 27 October 2012 (UTC)