Wikipedia:Reference desk/Archives/Computing/2009 March 5

= March 5 =

Vista taskbar problem
I'm running Windows Vista (Home Premium version 6.0). The taskbar includes a little desktop button that takes me right to the desktop - very handy for me as I tend to work with a billion windows open. A couple of days ago, that handy little button disappeared, and I can't figure out why or how to get it back.

I know how to add items to the taskbar, but the desktop thing is stumping me. I can seemingly drag and drop any other object onto the taskbar, but nothing I have done can get that button back. I'm sure I am missing something simple. Any advice would be appreciated. - EronTalk 03:34, 5 March 2009 (UTC)


 * You can re-create it with notepad: see this site for info. — Ched ~ (yes?) 04:16, 5 March 2009 (UTC)


 * Perfect. Problem solved, thank you. - EronTalk 04:27, 5 March 2009 (UTC)


 * We aim to please - glad we could help. — Ched ~ (yes?) 06:32, 5 March 2009 (UTC)

Find the Maximum of a Set
Given an array(set) of integers, how do the various computer languages go about finding the maximum value? More to the point, if they use a specific algorithm to do it, what is that algorithms complexity class? While on the subject of what certain built in functions do; is there any place where this information can be looked up for Ruby/Python/C++, etc? Phoenix1177 (talk) 04:40, 5 March 2009 (UTC)


 * Obviously, if the array is sorted, it's pretty easy. If it's just an array, then it will take O(n) time. Of course, integers can be stored in a binary search tree, and in that case getting the maximum integer takes O(log(n)) time - it's simply a matter of traversing the nodes to the right. I don't know of any specialized algorithm for finding maximums, nor any special data structure that works with an ordered set of integers to help find the maximum. --wj32 t/c 04:54, 5 March 2009 (UTC)


 * Although alluded to by Wj32 above, on a sorted array which includes maxindex (a count of items), the time taken to dereference array[maxindex] would be O(1). Sorted arrays implemented as linked lists and sorted arrays without a count of items would require traversing the array to the final item, with complexity O(n). Such arrays, however, would likely be quite rare. –  7 4   05:55, 5 March 2009 (UTC)
 * If it's an unsorted array, all you can do is make a linear scan through it, keeping track of the biggest number you've seen so far. There is a very detailed analysis of the complexity in Knuth TAOCP volume 1, using the method of generating functions, which iirc lets him figure out the probability distribution of how many times the "biggest number seen so far" has to be updated during the scan, etc.  But the main point of the analysis is to show how to use the techniques on a very simple algorithm so that they can be used on more complicated algorithms later. 207.241.239.70 (talk) 13:06, 5 March 2009 (UTC)

Read from /dev/urandom and convert to binary
In a bash script, what's the simplest way to read 119 bits (or, if /dev/urandom can only be read an octet at a time, 120 bits) from /dev/urandom, express them in binary (in order to work with the individual bits as substrings) and store them in a variable? Neon Merlin  07:46, 5 March 2009 (UTC)
 * I find scripts like that very ugly. It's better to write a program in a more reasonable language, python or perl or whatever.  It would probably be a perl one-liner using the "%b" format specifier to get binary out, but my Perl is way too rusty to write it for you, and anyway this sounds a little too much like homework. 207.241.239.70 (talk) 13:20, 5 March 2009 (UTC)
 * It is homework (for once), but it's a small part of a much larger project. The reason the shell script is a shell script is that it involves a large number of command line invocations, in iterated loops, with lots of options. I don't know how to invoke the command line in Linux in any non-shell-scripting language; even if I did, a shell script seems most logical. Neon  Merlin  19:25, 5 March 2009 (UTC)


 * dd if=/dev/urandom bs=119 count=1 | xxd -b | grep -o '\([01].\{8\}\)\{6\}'


 * That leaves the hex-offset at the begining, but you should be able to figure out how to remove that pretty easily. Shadowjams (talk) 10:29, 6 March 2009 (UTC)

Fire suppresor for computers/servers?
Do dry-chemical/clean agent fire extinguishers really leave no damage to computers? Argonite can be (and it is) used on servers and other sensitive equipment, but my professor argued that such extinguishers can still damage them.

Is my professor right about that, or not? Blake Gripling (talk) 08:56, 5 March 2009 (UTC)


 * Well, there may well be reactions I'm unaware of, but I don't see how argonite gas it could damage computers. It's inert, and anyway, computers don't require oxygen to operate (unlike fire). In any case, a fire is bound to be far, far more destructive to a server room than argonite. You professor didn't offer any explanation as to how it would damage the computers? -- Captain Disdain (talk) 12:31, 5 March 2009 (UTC)
 * He only said that it is ineffective (perhaps based on his own experiences), and so do other types of extinguishers, practically leaving me and my mates with nothing to use for our defense/thesis. It is obvious that we can't treat a fire in a sensitive area such as a courtroom or a server as inevitable, right? Blake Gripling (talk) 13:07, 5 March 2009 (UTC)
 * Well, if argonite isn't an efficient fire extinguisher -- and I'd bet that has as much to do with how the system is set up as it does with the gas in question, because properly used, the argonite is going to replace all of the oxygen, and the fire pretty much has to go out -- that's a completely different thing; in that case the computers aren't damaged by the argonite, but by the fire that isn't going out. I'm not sure what his point is, beyond "fire bad" -- I mean, I don't think any fire extinguishing system is going to be 100% effective and prevent all damage. -- Captain Disdain (talk) 13:53, 5 March 2009 (UTC)


 * They don't require oxygen, but they do require air cooling. The environmental requirements specs for some server/comms grade equipment specifies a minimum air pressure, as lower air pressure means there's less air into which a heatsink can shed excess heat (and thus the cooling system is less efficient). Some high-end Sun servers, for example, ship with a barometer, and will shut down if air pressure falls too low (in practice this is only rarely an issue - only when the machine is installed in relatively high-altitude locations like ski resorts). Now I wonder what the specific heat of the extinguisher gasses is (I really don't know).  If it is considerably lower than that of the air it has displaced, then that might compromise the cooling of the densely packed equipment, and maybe lead to dangerous or damaging overheating.  Now I guess the power will be automatically switched off by the same fire alarm that triggered the extinguisher, but some will be held up by UPSes (and will still be engaged in the rather hot process of an ordered shutdown when the extinguishers go off). 87.115.143.223 (talk) 20:38, 5 March 2009 (UTC)


 * Well, the argonite atmosphere isn't going to persist for very long anyway, though. It's only there to extinguish the fire... and frankly, I'm pretty sure that in most cases, any overheating problems involved are probably not going argonite-related, what with the fire and all. Still, fair enough. -- Captain Disdain (talk) 09:00, 6 March 2009 (UTC)


 * I'd be more worried about people than a bunch of servers. I remember some carbon dioxide being used in a server room and these firemen rushed in and promptly fell down, they had to be dragged outside into the fresh air to recover. The computers weren't affected but the pressure caused some damage to the ceiling.Dmcq (talk) 13:38, 5 March 2009 (UTC)


 * I've seen server rooms with gas-fire extinguishing setups, and they have panic cut-off buttons for people who would happen to be trapped in the room. I don't remember what the gas was, but argon seems plausible. Another pressure issue, aside from heat-transfer, is that most hard drives require normal atmospheric pressure to operate. As the drive spins it creates an air-bearing that the drive-head floats above. If you were to use your drive at 40,000 feet without pressurization, the drive head would crash into the platter. That's a far-fetched scenario, but another one to consider. Shadowjams (talk) 10:23, 6 March 2009 (UTC)

Reverse a diff file
In Linux, do any utilities exist that can reverse the direction of a diff file (i.e. turn the output of diff file-a file-b into the output of diff file-b file-a) without having either of the input files? Neon Merlin  09:16, 5 March 2009 (UTC)
 * Don't know offhand, but maybe what you really want is the "patch -R" command. 207.241.239.70 (talk) 13:59, 5 March 2009 (UTC)
 * No, that requires the second input file. Neon  Merlin  19:22, 5 March 2009 (UTC)


 * I don't know of a way to do what you want using just one command, but here's an idea:
 * Create a fake  using the information in the diff file, call this  . (The idea is that   will have the same lines as   where   would change in the next step, so that   won't choke)
 * Patch  using the diff file to produce
 * --98.114.146.46 (talk) 03:55, 6 March 2009 (UTC)
 * --98.114.146.46 (talk) 03:55, 6 March 2009 (UTC)


 * Unless I'm not catching something complicated, wouldn't this be a rather simple script to write? The logic is:
 * If the line begins with &gt;, change it to &lt;
 * Else if the line begins with &lt;, change it ti &gt;
 * Else if the line has a d in it, change it to an a and flip the numbers (ie: 1,10d3 becomes 3a1,10).
 * Else if the line has an a in it, change it to a d and flip the numbers.
 * Else, the line must have a c in it. Flip the numbers.
 * The results will not be identical to what you'd get if you ran diff on the files in opposite order, but it should work for running patch. -- k a i n a w &trade; 04:13, 6 March 2009 (UTC)

Emacs has delightfully good support for editing diff files. To reverse a diff, all you need to do is open the file in emacs, press control-C then control-R. 84.239.160.166 (talk) 17:25, 7 March 2009 (UTC)

mobile broadband (1)
Thinking about getting mobile broadband from mi laptop but I do not have a credit or debit card. How exactly does one pay for mobile broadband such as those listed here: http://www.broadband-expert.co.uk/mobile-broadband/ ? I'm in the UK. —Preceding unsigned comment added by 194.80.240.66 (talk) 09:35, 5 March 2009 (UTC)

bump —Preceding unsigned comment added by 194.80.240.66 (talk) 12:58, 5 March 2009 (UTC)
 * Generally all of those on that site are contract only and have to be paid by debit card, credit card or by direct debit. Some Mobile ISPs do have Pay-as-you-go options where you would top up the connection in the same way as a mobile phone - but you would have to buy the USB dongle outright at the start for a cost of between £30-150. See for example the Mobile Broadband Pay as you go packages on 3. Nanonic (talk) 18:00, 5 March 2009 (UTC)

Applying column width changes to every sheet in Excel
Is it possible to make a change to a column's width in Excel be applied to every sheet contained in a single MS Excel document? Thanks. 213.13.148.4 (talk) 10:47, 5 March 2009 (UTC)
 * Do you know visual basic in excel? If so, use the following (it resizes column D in all the sheets):

Sub Macro1 For i = 1 To Sheets.Count Sheets(i).Columns("D:D").ColumnWidth = 12.43 Next i End Sub
 * Zain Ebrahim (talk) 11:19, 5 March 2009 (UTC)


 * Or, without macros, control-click on the "tabs" (at bottom) for the sheets you want to change, control-click the column headings you want to change, right-click on one of the column headings, and enter the desired column width. Jørgen (talk) 13:44, 5 March 2009 (UTC)

want to save HTML of current page from Firefox 3
I'm looking at a particular web page and want to save the HTML of the page I'm looking at from the browser into a file. "View page source" does not do this--it sends a new request to the server which can send back different contents than it did for the first request. I want to save the stuff that's already in the browser's memory (I know it's there because Firebug can see it). I could take a screen shot but that loses a lot of information. Any other ideas? (The screen contents are a crash dump from an intermittent server side bug that I want to report). Thanks. 207.241.239.70 (talk) 14:13, 5 March 2009 (UTC)
 * I assume that "Save Page As" (Ctrl+S), and then "Web page, only HTML" does not work? --Andreas Rejbrand (talk) 15:02, 5 March 2009 (UTC)


 * That sounds like faulty behavior; I would not expect "View source" to return a new copy of the page. I tested this in FF 3.06 with a page that I know has changed and it displayed the source of the version already loaded (not the most recent version). On the other hand, *updates* since the page was fetched may or may not appear (some type of Ajax/XMLHTTP modifications). Presumably you could select that which you wish to save and copy it into a text file&mdash;again, you'll lose some information (the formatting) but the actual text should remain. If the error report contains diagnostic HTML comments (like the Wikipedia rendering statistics) then those will be lost, however. –  7 4   17:25, 5 March 2009 (UTC)


 * Well, you could always just save the page, but that might send a new request to the server, too. Although I'm not sure if you're right that "view source" sends a new request. Well, anyway, the only sure-fire way I know to capture the exact HTML that the browser was displaying is to manually browse to your FF cache directory. Your page will be in there, but you might have to search through the files for a phrase that was in your webpage. There might also be FF plugins to do this, but I don't know of any. Indeterminate (talk) 09:16, 6 March 2009 (UTC)


 * I'm certain that you're wrong, view source does not send a new request to the server, it shows you the page that it has already downloaded. I've tried it on a number of pages that generate automatic time-stamps and random numbers and the like, and it's always the same in the source as on the page (this page for instance generates two lottery tickets randomly, and if it did send a second request to the server, the numbers would be different in the source, but they're not. It also contains a time-stamp showing you exactly when the page was generated, and that doesn't change either). Another way to check this is to simply temporarily turning off your internet connection, and try viewing the source again. See, it works just fine. If it needed to send an additional request, using "View source" wouldn't work if you went offline after a page was loaded.
 * Using "view source" in Firefox gives you exactly what Firefox wanted in its original request. I'm curious to find out why you thought otherwise? Did you happen upon some page which look different in the code compared to how it looked layed out? Belisarius (talk) 23:35, 7 March 2009 (UTC)

internet on the go
what is the cheapest way to get the internet on the move with a laptop? i'm in england —Preceding unsigned comment added by 194.80.240.66 (talk) 15:30, 5 March 2009 (UTC)


 * Look for unsecured wireless hotspots - I used one in a pub in London a couple of months back. All it cost me was a couple of pints that I would have had anyway.  If you want access "on the road", you are probably better off looking for a mobile phone contract with an inclusive 3G data package.  All the mobile networks offer such deals (though not to pay-as-you-go customers).  However, the deals are pretty expensive once you go over the download limit.  Also, your laptop will need a HDSPA slot in which you stick a SIM card, or a bluetooth facility, or you will have to get a USB dongle from network.  Astronaut (talk) 16:36, 5 March 2009 (UTC)

The mobile network three offer mobile-broadband on pay-as-you-go basis. They sell 1gb for £10, 3gb for £15 etc. the biggest problem it has is A) Your credit runs out 30 days after topping up regardless of whether you use it all and B) It is rubbish. I have had it for the past year in my apartment (didn't want to pay for a phone-line just for casual internet usage as never use home-phones) and it was constantly slow, regularly struggled to connect and frustratingly picky about where in the apartment you sit. Still it's pay as you go. 194.221.133.226 (talk) 10:11, 6 March 2009 (UTC)

People in our office use a Vodafone 3G service (in the UK); we pay monthly (quite a bit, for unlimited), but I think they do lower plans and pay as you go. While not as bad as the service 194.221.133.226 has had, you regularly miss 3G anywhere but cities and fall back to the painfully slow GPRS, and the international roaming rates (which aren't part of the unlimited usage plan) are exorbitant. I'd recommend it for a genuinely mobile business professional who absolutely must check email and deal with attachments on the road (someone like a salesman); for someone who needs to do basic mobile email a decent mobile phone should be sufficient; but it's not cheap and it's not fast and it's certainly not a nice replacement for a wired home broadband service. Prices on different mobile carriers vary a bit, but their tariffs are fairly similar and the underlying technology is common. Bar the inconvenience of camping on public wifi connections, I don't think there's a nice, cheap way to do mobile internet. Mimetic Polyalloy (talk) 11:59, 6 March 2009 (UTC)

thank you for the answers. —Preceding unsigned comment added by 194.80.240.66 (talk) 13:31, 6 March 2009 (UTC)

serving SVG to FF and png to IE?
Hi all!

I have some nice logos that look great in SVG, but when I turn them into small png's (either by shrinking them from their original size in a program like Paint.NET, or by having the browser shrink them on the fly), they lose lots of detail. I would like to have some way of displaying the nice SVG to non-IE browsers, and the png replacements to IE, but I can't find a way of doing it. Wikipedia's solution is to create a png every time there is a svg file and display that to all browsers. Can anyone help me? --richardmtl (talk) 16:26, 5 March 2009 (UTC)


 * A simple javascript function can change the "src" of an image. I'd suggest something like:
 * use HTML to set the image to the png (works for everyone)
 * use javascript to detect non-IE and modify the "src" by switching to svg


 * This has the advantage of failing gracefully if javascript is disabled. You could also make use of CSS to show/hide alternate images, or use a hypertext preprocessor to create "customized" versions of the page based on the client's browser. –  7 4   17:09, 5 March 2009 (UTC)
 * Server-side content negotiation should be more reliable than detecting the type of browser. MTM (talk) 17:33, 5 March 2009 (UTC)


 * Well, I found a decent solution: use tag (sometimes called the "object fallback" technique). The only problem I have is that the object is not clickable in FF, still looking for a solution to that, though for my puruposes, it's not a big deal. Any clues for that?

--richardmtl (talk) 18:09, 5 March 2009 (UTC)


 * Honestly you are practically guaranteed to have something hacky that only works 1/10th of the time and looks totally wrong if not broken the rest of the time if you try to dynamically serve up SVGs to a browser. You're better off trying to find a way to export your SVGs to a raster file in a way that looks good to you. --98.217.14.211 (talk) 23:08, 5 March 2009 (UTC)

excel macro help
I've never even tried to use a macro before, so i'm stumbling quite a bit here. I'm working on a project that requires that I input 0s and 1s into thousands of lines of a spreadsheet as one phase of an audit of documents at my office. To make things visually easier to handle, I would like a macro that automatically turns the font green in a box containing a 1. I found this code, but I can't seem to make it work. I tried replacing (1, 1) with (ActiveCell), still no good. Help? 208.73.108.118 (talk) 20:35, 5 March 2009 (UTC)
 * I don't have my compiler on hand so I don't know if this will work but try:

Sub Example With ActiveSheet.Selection For i = 1 to Selection.Cells.Count If .Cells(i).Value = 1 Then .Cells(i).Font.Color = vbRed Else .Cells(i).Font.Color = vbGreen End If   Next i    End With End Sub
 * You have to select the cells you want to format before running. If it works, it will make all the 1s red and everything else green. You can also try conditional formatting. Hope this helps. Zain Ebrahim (talk) 22:16, 5 March 2009 (UTC)


 * As Zain Ebrahim briefly mentioned, conditional formatting will do this easily. (These instructions are for Excel 2002) Select the cells you want to conditionally format, then select the "Conditional Formatting..." option on the "Format" menu. Set condition 1 to "Cell Value Is | equal to | 1", then click the "Format..." button and change "color" to a green. Click "Add>>" to insert a second condition and set it to "Cell Value Is | equal to | 0", then click "Format..." and change the color to a red. Click "OK" to apply the changes. Note, however, that font color makes only a small difference; you might want to color the background shading instead ("Format..." → "Patterns" on the conditional formatting menu) for a clear indication of the value. –  7 4   02:24, 6 March 2009 (UTC)

Spam using anothers address?
I just got some junk turn up in my junk box, pretending to be from HSBC bank. It said I had a message waiting for me and to click the link. Before I deleted it I had a look at the link out of curiosity. It was www.letraset.com.ar/novedades/IBlogin.html so I went to Letraset.com out of curiosity, and as I thought it's the actual website of the company Letraset. Except this specific address shows you a page that looks just like the HSBC login page.

So is somebody using the Letraset address as a host or what? How does this work? —Preceding unsigned comment added by 91.111.64.177 (talk) 22:36, 5 March 2009 (UTC)


 * Somebody probably broke into their webserver and set up a fake login page. --Carnildo (talk) 23:08, 5 March 2009 (UTC)


 * Note that the phishing domain is letraset.com.ar (do not visit - the homepage contains a trojan) - it's a completely different domain to letraset.com. .ar is the TLD for Argentina. — Matt Eason (Talk &#149; Contribs) 23:15, 5 March 2009 (UTC)