Wikipedia:Reference desk/Archives/Computing/2008 March 16

From Wikipedia, the free encyclopedia

Computing desk
< March 15 << Feb | March | Apr >> March 17 >
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.


Contents


[edit] March 16

[edit] Project euler

I am trying to do problem 56. I want to find the maximum sum, so I wrote this python program:

def ndig(n):
   count = 0.0
   while n >= 1.0:
       count = count + 1
       n = n / 10.0
   return count
def sumdig(n):
   c = 0.0
   d = ndig(n)
   count = 0.0
   sum = 0.0
   while n > 1.0:
       count = count + 1
       c = n / (10 ** (d - count))
       sum = sum + ((c - (c % 1.0)))
       n = n - ((10 ** (d - count))) * (c - (c % 1.0))
   return sum
for b in range(0,100):
   count = 0.0
   while count < 99.0:
       count = count + 1.0
       if sumdig(b ** count) > 900.0:
           print b, count, sumdig(b ** count)

I get 980 as the maximum with 95 ^ 96, but apparently this isn't the right answer. What am I doing wrong? 70.162.25.53 (talk) 00:06, 16 March 2008 (UTC)

Also, why is is that when I quit the python window it doesn't actually quit the program? I have to use the task manager to close it. 70.162.25.53 (talk) 00:32, 16 March 2008 (UTC)


I get 972 for 99**95 using the code below. "while n > 1.0" in sumdig should be "while n >= 1.0", other than that your code looks ok --h2g2bob (talk) 02:35, 16 March 2008 (UTC)

Hold it. Are you seriously trying to brute-force add up the digits of every number up to 100100? Do you realize that if adding up all the digits for a given number takes only one processor cycle (yeah right), you're going to be waiting a long time for that program to finish. :D\=< (talk) 04:03, 16 March 2008 (UTC)
No, just brute forcing through ab where 0<a<100 and 0<b<100, so only less than 10000 numbers need to be brute-forced.
Running the original programme I get a maximum of 952 for 94**98, and 95**96 is only 931, which is different from what you've got. The outputs of h2g2bob's version though, is consistent on my machine. --antilivedT | C | G 04:24, 16 March 2008 (UTC)
Oh. It blows my mind how you can just twiddle 194-digit numbers. :D\=< (talk) 04:42, 16 March 2008 (UTC)
Python has an extension to integer variable type called 'long' which can handle any length integers - maybe thats why it's called python ... long ? (immensly funny computer joke)87.102.75.250 (talk) 12:27, 16 March 2008 (UTC)

In case somebody isn't yet sure about the result, I also got 99^95 "=" 972 with C and GMP. —Preceding unsigned comment added by 212.149.216.233 (talk) 15:40, 16 March 2008 (UTC)

[edit] caps lock key

what was the original purpose of the Caps Lock key -- ie, why was it necessary to include such a key on a computer keyboard? what case-sensitive task required caps such that holding down the "shift" key would be too difficult? 99.245.92.47 (talk) 04:08, 16 March 2008 (UTC)

For some reason our caps lock article doesn't say, but if you go back a few days-- there it is o_O :D\=< (talk) 04:24, 16 March 2008 (UTC)
Reverted. --antilivedT | C | G 04:31, 16 March 2008 (UTC)
Oddly there's no discussion of its real origins, which is in typewriters. If you don't think typing in all caps comes up all that much, you clearly are used to have more than one font and text styling (bold, italic) at your easy disposal. Typewritten correspondence often used all-caps for things like titles. (At least, that's what I find doing research with type-written documents). Holding down shift works fine for small amounts of text but if you are typing things in all capital letters on a routine basis, caps-lock can come in handy. With computers though it is a lot less pressing, though it does serve to identify the computer illiterate pretty easily, and makes it so that tech support will always have a good number of very easy questions to answer.
It should also probably be noted that a caps-lock key on an old typewriter did not function like a caps-lock key on a modern keyboard. For one thing, it would be physically depressed the entire time -- no needing to pay attention to little LEDs to see if it was on or not -- and if you pushed shift again it would un-lock it. --98.217.18.109 (talk) 05:58, 16 March 2008 (UTC)
And, of course, on a mechanical typewriter, it didn't function as a "caps lock" key, it functioned as a "shift lock" key. That is, it mechanically locked the shift levers depressed and so had the effect of not only capitalizing the letters but also of changing all the numbers to symbols and so on. It was only with the advent of computer logic that it became possible to implement a true "caps lock" key that only affected the alphabetic characters. Even on some of the earliest computer keyboards, it was still a "shift lock" key!
Atlant (talk) 16:11, 16 March 2008 (UTC)
Indeed, I have seen (exceedingly old) computers that had both shift lock and caps lock. Sam Korn (smoddy) 14:16, 17 March 2008 (UTC)
When PLATO users asked why there was no shift lock, Group 's' explained that it would inevitably affect spaces too; shift-space on PLATO was a backspace. —Tamfang (talk) 20:00, 19 March 2008 (UTC)

[edit] CPU temp?

i downloaded the app CoreTemp to monitor my CPU temperature. i have a dual core AMD64 Athlon X2 and they're both hovering around 50 degrees right now at about 4% usage. i'm told this is VERY bad. i use a laptop and i always try to keep the fan vents open... is there anything else i can do to cool down my poor computer? 99.245.92.47 (talk) 04:20, 16 March 2008 (UTC)

Sigh.. fahrenheit or celsius? 50 degrees F is perfectly fine (maybe a little godly), celsius.. you're in trouble. Did you just close a game? Why do you have 4% cpu usage? :D\=< (talk) 04:26, 16 March 2008 (UTC)
sorry, celsius. i have no idea why i have 4% usage; that's just what the task manager says. i don't play games; all i have running is Pidgin, Opera, AVG and Notepad. 99.245.92.47 (talk) 04:29, 16 March 2008 (UTC)
Well chances are that 4% is just task manager itself. If it's a laptop there's not a whole lot you can do to improve airflow.. try blowing out the vents with a can of compressed air to dust it out. As a last resort, buy some Arctic Silver and reseat your heatsink on your processor (a major job for a laptop) :D\=< (talk) 04:32, 16 March 2008 (UTC)
Mine (Sempron 3100+) hovers around either 60 or 50 degrees C depending on which sensor I choose (Core0 Temp or CPU temp) under 100% load and had been running fine for more than 3 years now, so it's not that bad. You might want to look at the temperature when on high loads though, and turn on Cool'n'Quiet in your BIOS and OS. --antilivedT | C | G 04:35, 16 March 2008 (UTC)
But while idling? 100% load is one thing but 50C while idling is ridiculous. BTW mine dies within 5 minutes under 100% cpu load even with the below-mentioned cooling pad :( stupid heat :D\=< (talk) 04:38, 16 March 2008 (UTC)
i looked at the page linked and AMD's website and i couldn't for the life of me figure out how to turn this feature on. the PDF instructions provided seem to be quite outdated as they refer to tons of things on the site that don't exist. you would think that instead of providing a PDF file they would just link directly to the page it's on! i did a search but didn't find anything useful. can anyone point me in the right direction? 99.245.92.47 (talk) 04:47, 16 March 2008 (UTC)
BTW, i'm on Vista Home Basic 99.245.92.47 (talk) 04:49, 16 March 2008 (UTC)
Oh and I had crazy heating problems with my thinkpad so I got one of these. Dropped the cpu temp 10-15 celsius, YMMV since the steel bottom of T60s is a giant heatsink :D\=< (talk) 04:36, 16 March 2008 (UTC)
Hopefully a can of compressed air will help, there's not really many other simple solutions (for a laptop). Useight (talk) 06:02, 16 March 2008 (UTC)

It may be original research, but according to iStat Pro, CPU A in my macbook (OS X 10.4, 1.83 Intel Core Duo) is at about 59 degree centigrade, running at about 30%. (I can see Froth jumping into it so I will say it beforehand that Macbooks are not the best when it comes to heat management. :D) Kushal 15:42, 16 March 2008 (UTC)

Over the history of my MacBook, the temperature has gone up. Right now it's probably is averaging 70 C at 50%, and goes past 80 with more load. But Intel processors are also known to handle heat much better than AMD. Mac Davis (talk) 04:41, 17 March 2008 (UTC)
Har har. Pentium 4. :D\=< (talk) 05:30, 17 March 2008 (UTC)

[edit] Able to confirm colorblindness compatibility?

Resolved.

I want to ensure that a color scheme I am using will be easy to use for people with different colorblindnesses. Is there a program or website that either OKs certain color schemes, or perhaps adjusts hexadecimal color codes to show how they would look to people different color deficiencies? HYENASTE 07:36, 16 March 2008 (UTC)

http://colorfilter.wickline.org/Matt Eason (TalkContribs) 11:11, 16 March 2008 (UTC)
Thanks Matt that's precisely what I wanted. HYENASTE 21:23, 16 March 2008 (UTC)

[edit] Commanding the Storm botnet

How would the creators of the Storm botnet give it instructions? If it spends a lot of its time evading traces, then how do they know where or how to send instructions to it to do various things? Or am I misunderstanding something really obvious? Dismas|(talk) 07:59, 16 March 2008 (UTC)

A simple way: every n minutes, a bot downloads a file from WWW and parses it.
Another way: every bot connects to an IRC server (DALnet, EFnet, owner's server), joins a secret channel and waits for text. If the owner sends a command to the channel, every bot executes it.
--grawity talk / PGP 13:18, 16 March 2008 (UTC)
Also, remember that Storm heavily relies on encryption. You can bet that the bot-herders encrypts every command with the bot's public key and signs every command with their own private key. That way, the communications can't be snooped, and they can't be faked. This probably makes it tons easier to control the entire bot-net without detection (or hijacking). --Oskar 16:58, 16 March 2008 (UTC)

[edit] spellcheck.py of Pywikipedia

Do you know how to get this working? I already have all the python scripts, and has used them many times in the Tagalog wiki but I can't seem to use this script even here in this wiki. I am trying to use it here at User:Felipe Aira/sandbox. But it's not working. Can you give me an example syntax for it and exactly how to make it work? Thank you. -- Felipe Aira 04:58, 16 March 2008 (UTC)

[edit] Going through an url-list

I have a list of newline separated addresses (28,490 addresses to be exact) I want to go through, not to view. I had to do that as logged in, so there should be some sort of cookie management involved. I have Windows XP, Knoppix and Cygwin/MingW on XP for C programming, but I have only once done similar before and it was a pain, and apparently I have in my unlimited wisdom deleted the source . Command line would be preferred. What to do? (as an extra problem: I have tried to compile msdn winsock client example with line "gcc -o test test.c -mno-cygwin -lws2_32 -lmswsock -ladvapi32" but only got undefined reference to _getaddrinfo and _freeaddrinfo) --212.149.216.233 (talk) 13:04, 16 March 2008 (UTC)

try wget. If I understand correctly, you need to load every URL from a list.
Use wget with these parameters:
  • -i file - use URLs from file
  • --spider - do not save the document (only visit it)
  • --load-cookies=file - load cookies from file (Mozilla format, so you can just use the one from your Firefox profile)
  • --save-cookies=file - save cookies to file
Here's a wget for Windows.
--grawity talk / PGP 13:14, 16 March 2008 (UTC)
It looks too easy, I just got to get Firefox first. Currently using Opera. (Hail Norwegians!) Thank you! --212.149.216.233 (talk) 14:37, 16 March 2008 (UTC)
by the way, you can do wget -b and just check wget-log once in a while.
wget --help (duh) for help. --grawity talk / PGP 19:17, 16 March 2008 (UTC)

[edit] no net at home - is there a cheap self-powered palm-sized thing I can take on walks to download from WiFi connections

I don't have Internet at home unfortunately (long story) but is there something I could walk around with all day, and when I get home, read what I've downloaded, ie something that will run a custom Python script and has a wifi connection and can be on all day. It can be headless (no screen) the battery and small size and above all LOW COST is what interests mme.

Anyone know of anything that fits the bill? —Preceding unsigned comment added by 79.122.1.135 (talk) 14:06, 16 March 2008 (UTC)

First off: cool idea :). Do you have a laptop? It's easily doable with a laptop, just set it to be as promiscuous as possible when it comes to connecting to wireless-networks, and then have a list of urls to download. I suppose you could do it with pretty much any PDA or smart-phone, but it's not as easy.
That said, I don't think that this is such a great idea. When you're some distance from a network (as you would be when you're walking the street) and the signal is weak, it takes a while to connect, and by then you'd probably have walked to far already. It's not very efficient. Do this instead: find a nice library or coffee-shop with free wi-fi, get a cup of joe, and start surfin! Save all the stuff you need (podcasts and Google Reader with Google Gears integration comes to mind as useful, as does POP email). Again, this is assuming you have a laptop. If you don't have a laptop, use a computer at a computer-place (internet cafe or such), plug in a usb-drive (an iPod, for instance), and save stuff to it. I did that for a while when my internet went down. --Oskar 17:14, 16 March 2008 (UTC)
Maybe something like the Sony mylo would do the trick, but I don't think it's all that cheap (considering its feature set), laptops are getting close to that price point. Also there's not really ubiquitous WiFi anywhere yet, as far as I know, so you'd have to find a hot-spot and hang out there while your downloading is going on. --LarryMac | Talk 14:18, 17 March 2008 (UTC)

Two words:

ScrapBook Firefox

Regards,

Kushal 15:44, 19 March 2008 (UTC)

1) how does a software only solution address the question? 2) why don't you EVER indent? --LarryMac | Talk 15:49, 19 March 2008 (UTC)

FIREFOCK? :D\=< (talk) 03:40, 20 March 2008 (UTC)

Sorry, LarryMac. I try to avoid indenting as far as practicable.

He could take his computer with him when he is on a walk and then have Scrapebook download whole websites, well the public parts of the website. If he could stay on one WiFi network for long enough, he could get a small website copied in just a few hours. I would suggest playing around with Scrapbook on Mozilla Firefox. Kushal 05:23, 21 March 2008 (UTC)

PS: Froth, what was that supposed to mean? :( Kushal 05:23, 21 March 2008 (UTC)

Just being obnoxious at larrymac's annoying enumerated line of questioning :D :D\=< (talk) 05:25, 22 March 2008 (UTC)

[edit] Nforce 700 compared to Nforce 600

Hello


I am almost ready to buy and build my new computer but I saw a problem with the motherboard I was looking at. The Nforce 680i motherboard supports SLI but does not support PCI-E 2.0, where as the £40 more expensive 780i supports both. I have decided upon buying this graphics card:

http://www.ebuyer.com/product/135258/show_product_overview

What I was wondering was will there be a performance hit if I use it on this motherboard:

http://www.ebuyer.com/product/132813/show_product_specifications?spectype=extended

An Nforce 680i

Compared to if I use it on this motherboard:

http://www.ebuyer.com/product/139340

An Nforce 780i (with slightly dubious specs compared). I noticed in the system specifications that it didn't explicitly say PCI-E 2.0, but after reading the wiki page I assumed this was given on the chipset.

Thanks 78.145.34.125 (talk) 19:27, 16 March 2008 (UTC)

PCI-E 1.1 and 2.0 are compatible. The difference is that if both the board and the card support 2.0 you get twice the transfer rate. However, the common opinion (at least the one I've heard) is that today's cards barely make full use of 1.1's bandwidth, and the extra bandwidth of 2.0 is completely redundant.
You speak about SLI, and then say "graphics card" singular. Do you intend to leave the option of buying another one open? In either case (this board supports both slots at x16 so having two cards shouldn't matter) I don't believe you'll see any difference between 1.1 and 2.0 (I'd be singing a different tune if you were to buy, say, two GeForce 9800 GX2 cards). If that's your only concern, go with the 680i. -- Meni Rosenfeld (talk) 21:12, 16 March 2008 (UTC)

[edit] text browser

Is there any way to browse a website using only source code? I know you can just check the source of each individual page, but if there is an intentionally destructing object embedded into a page, how would you go about checking the source if it crashes right away? Let me know if this is possible, or done before. Thank you Hpfreak26 (talk) 21:47, 16 March 2008 (UTC)

Open the html file in notepad perhaps?87.102.124.155 (talk) 22:05, 16 March 2008 (UTC)
Trouble is, you need to get the file first. You need a program that knows how to talk to webservers but one which doesn't immediately try to interpret the html. wget any good for you? --90.203.189.150 (talk) 22:08, 16 March 2008 (UTC)
Notepad actually can get the file, in XP at least. Just go file, open and type the url into the file name box. Think outside the box 10:46, 17 March 2008 (UTC)
There are many alternatives. I suggest using Firefox with Adblock and NoScript. The combination of the two block all the nasty flash, applet, and javascript junk. You can allow things one by one and figure out what exactly is causing the crash. Alternatively, you can go text-only and use something like Lynx to surf the web. Since it doesn't have pictures or videos, there isn't much to crash. I need to have Adblock and NoScript because I run Linux and the flash plugin for Linux is, at best, a system crash waiting to happen. Often, I hit a page and Firefox just goes away without warning. Then, I realize that something wasn't blocked, so I block it and try again. -- kainaw 22:10, 16 March 2008 (UTC)
AHA! Lynx looks perfect. I do have firefox with Adblock, but there is still the occasional rick-roll that gets through to me. I'll check out NoScript as well. Thanks a bunch for the speedy assistance. Hpfreak26 (talk) 22:13, 16 March 2008 (UTC)
Rickrolls aren't exactly malicious, and examining the page HTML before loading it is cheating. :D\=< (talk) 23:03, 16 March 2008 (UTC)
There's actually a lynx mode that disables the actual rendering and just displays the HTML source. It's kind of complicated to set up- see this tutorial :D\=< (talk) 23:06, 16 March 2008 (UTC)
Yep, you got me. --90.203.189.180 (talk) 00:25, 17 March 2008 (UTC)
It's almost painful, people are so easy. :D\=< (talk) 05:29, 17 March 2008 (UTC)
Oh wow. I saw your comment but didn't really care that much about the source code. I guess apathy is the best protection... Hpfreak26 (talk) 23:45, 17 March 2008 (UTC)