Wikipedia:Reference desk/Archives/Computing/2010 June 27

From Wikipedia, the free encyclopedia
Computing desk
< June 26 << May | June | Jul >> June 28 >
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.


June 27[edit]

Location of Wikipedia section edit links ?[edit]

Take a look at articles on German or French Wikipedias - they have links for editing section right after section title, not on the right side of page as here. Another user told me that this placement is less likely to pile up (which somtimes happens in short articles with infoox and several sections). I wonder if this is true and how did they get the links there in the first place (I checked around but couldn't find any sign of explanation) ? ~~Xil (talk) 00:47, 27 June 2010 (UTC)[reply]

It is done with some JavaScript; see User:Drilnoth/lefteditlinks.js. You can enable it at Special:Preferences → Gadgets → Moves edit links next to the section headers; see the documentation for previous discussion. ---— Gadget850 (Ed) talk 00:56, 27 June 2010 (UTC)[reply]
Great, thanks ~~Xil (talk) 10:13, 27 June 2010 (UTC)[reply]

AJAX question.[edit]

As a simple learning exercise, I'm designing an interactive web-based game which runs in an HTML5 browser and is multi-player. Sadly, I'm a relative newb at AJAX programming.

If I have a JavaScript application running in the client - I can easily have it request data from the server using something like:

function updateToNetwork ( sendme )
{
  xmlhttp.onreadystatechange = updateFromNetwork ;
  xmlhttp.open            ( "POST", "responder.php", true ) ;
  xmlhttp.setRequestHeader( "Content-type","application/x-www-form-urlencoded");
  xmlhttp.setRequestHeader( "Content-length", sendme.length + 3 ) ;
  xmlhttp.setRequestHeader( "Connection", "close" ) ;
  xmlhttp.send            ( "TAG=" + sendme ) ;
}

...collect that message on the server using some PHP code that sends a response:

 <?php
 $incoming=$_POST["TAG"];
 ...do some thinking, then...
 $outgoing="...whatever..."
 echo $outgoing ;
 ?>

...then pick that up in the client using:

 function updateFromNetwork ()
 {
   if ( xmlhttp.readyState != 4 ||
        xmlhttp.status != 200 )
     return ;
   var result = xmlhttp.responseText;
   ...do something with the result...
 }

...I have this working - but what I'd REALLY like would be for the server to send out updates to the client-side JavaScript code without being asked for it. Is there a way to do that?

I can have the JavaScript poll the server on a timer - but that's really inefficient.

SteveBaker (talk) 02:33, 27 June 2010 (UTC)[reply]

There are some kludgy ways to do it; see server push. Actually that article looks a little bit outdated, so maybe there are better methods now. 75.57.243.88 (talk) 04:29, 27 June 2010 (UTC)[reply]
[ec] I may not be credentialed to comment, but isn't this by definition impossible in the context of the Web browsing model (AJAX or not)? I would be curious to know if any mainstream sites/web apps employ such a technique. Riggr Mortis (talk) 04:39, 27 June 2010 (UTC)[reply]
Well, that's the question. Is it impossible? The main reason it's generally undesirable (and therefore a reason it wouldn't be used much) is that the server has no way to know whether the end user is still there. They could have exited the browser or turned off their computer and the server would have no way to know and hence would continue to uselessly send out data. However, in this application, I'll be getting data from the application and I can easily time-out if I don't see any input within a few seconds. I don't mind requiring the client to send out "I'm still here" messages (say) once a second - but I need to avoid doing it (say) 30 times a second! The unnecessary load on the server from dozens to hundreds of applications just sending a "please update me" message 30 times a second is what I'm trying to avoid. SteveBaker (talk) 15:31, 27 June 2010 (UTC)[reply]
Apparently if you want to do this with pure AJAX (that is, not with an applet), it is known as a "Comet". The article gives some common implementations. My reading of the article (having never tried to implement it) is that the techniques look a little cludgey, either forcing the browser to send a million requests for updates, or requiring a solution that only works in certain browsers. (Or an applet, which should work fine, I would think, though it would require user approval, etc.) --Mr.98 (talk) 18:12, 27 June 2010 (UTC)[reply]

What software helps recover laptops better than LoJack for Laptops?[edit]

I read on some brochure/magazine/ad for new computers that it's protected by a software like LoJack for Laptops, but has more features and overall does a better job than LoJack. However, this was a long time ago and I forgot that software's name. Whatever it is, I ought to replace LoJack with it, so I can feel more secure about it.

What was that anti-theft software called? --Let Us Update Wikipedia: Dusty Articles 05:31, 27 June 2010 (UTC)[reply]

AS usual, we have an article— see Laptop theft. ---— Gadget850 (Ed) talk 13:21, 27 June 2010 (UTC)[reply]

A way around "geographical restrictions"?[edit]

I tried to buy (i.e. download) this song from amazon.co.uk:

http://www.amazon.co.uk/Keine-Langeweile/dp/B001I4GOB6/ref=sr_1_1?ie=UTF8&s=dmusic&qid=1277616729&sr=8-1

Being in America, I got this notice:

We're sorry. We could not process your order because of geographical restrictions on the product which you were attempting to purchase. Please refer to the terms of use for this product to determine the geographical restrictions. We apologize for the inconvenience.

Similarly at amazon.de: http://www.amazon.de/Keine-Langeweile/dp/B001SO36SA/ref=sr_1_1?ie=UTF8&s=dmusic&qid=1277616876&sr=8-1

Tut uns leid. Ihre Bestellung konnte nicht verarbeitet werden, da das gewünschte Produkt geografischen Einschränkungen unterliegt. Weitere Informationen zu den geografischen Einschränkungen finden Sie in den Nutzungsbedingungen zu diesem Produkt. Wir entschuldigen uns für Unannehmlichkeiten, die Ihnen möglicherweise hieraus entstanden sind.

Apparently you need to be in Germany, Austria, or Switzerland to make this purchase, and for the UK site, you need to be in some region that I presume includes the UK, and clearly excludes the building I live in in Minneapolis.

Is there some way around this? Michael Hardy (talk) 05:38, 27 June 2010 (UTC)[reply]

Download Tor (link). Once it's running, check what your IP is (link) and copy/paste the number over to to a whois lookup server to see what country it's from (example link). Your IP will change every 10 to 15 minutes using this method, so if you are little off, just wait and try again. Also note that your Internet speeds may slow down a bit while doing this, as you are hopping from PC to PC across a very big network.
On the other hand, you could check iTunes. :) Disclaimer: I'm not sure how legality plays into this (if at all) but I hold no responsibility for any actions. Avicennasis @ 08:24, 27 June 2010 (UTC)[reply]
I ran into the same problem with iTunes. Since Tor is described as a way to do things anonymously, and since I need to provide billing information, I wonder about this suggestion. The geographic restrictions could be based on billing information rather than on IP numbers. Michael Hardy (talk) 15:34, 27 June 2010 (UTC)[reply]
The easiest way is to find a friend or relative in the region and have them purchase it for you and forward it on. I assume this will work for an MP3; I do exactly this for DVDs, CDs and books for my friends in Australia. This works for ebay too, when vendors will only ship locally. The vendor makes a sale, and my friends get what they want and everyone's happy!--TrogWoolley (talk) 08:26, 27 June 2010 (UTC)[reply]
That is probably the best strategy. Since Amazon MP3s are DRM-free, once they're purchased you can copy, edit and burn them as much as you would like.
Another strategy is to find the song on YouTube, and find a website that will download the audio track. Trust me, they exist, but I'm not linking to any of them, and you can find and use them at your own (legal) risk.
Using Tor to make a purchase is rather like going up to a stranger and handing them your credit card. Proxies and Tor have their uses -- I'm watching Germany v. England right now on ARD, and I'm in America -- but you should never even think about using them for anything remotely important, especially not if it requires you to login or give sensitive information. You're trusting a strange computer to relay information back and forth, and you have no idea who could be watching. Xenon54 (talk) 15:45, 27 June 2010 (UTC)[reply]
OK, scanning the DRM disambiguation page, I'm guessing that you meant digital rights management and wondering why you didn't link to that.
Both of the songs I'm interested in got taken down from youtube because of terms-of-use violations. They were put there by a reader who's often had that problem.
More later.... Michael Hardy (talk) 23:05, 27 June 2010 (UTC)[reply]
If you do a purchase through Tor, I haven't tried it but I'd expect the sensitive info to be encrypted through the Tor network by the SSL at the distant server, and therefore not readable by the intermediate Tor nodes. Check the server SSL certificate carefully, of course. 75.57.243.88 (talk) 10:32, 28 June 2010 (UTC)[reply]
Indeed if the information isn't encrypted end to end or the certificates aren't right, I wouldn't recommend you use your credit card with or without Tor. Ditto with most logins and other sensitive information. Don't be sure you can trust whoever is between you and the server even if it's via your ISP (while it's true you have a contractual relationship with them and a better idea of what servers are in between then Tor that doesn't mean you should trust them). Note that even if there is nothing malicious, misconfigurations etc are easily possible, for example here in NZ my ISP and I think others have screwed up while configuring their cache allowing people to see pages they shouldn't have.
You could argue Tor is a greater risk but both are risks and you should always avoid taking that risk and particularly with extremely sensitive things like credit cards and bank logins, I would never, ever try it without end to end encryption no matter whether I work for the CIA and using their connection or I'm using Tor. In other words, the solution is always end to end encyption and checking the certificates not the fallacy of thinking you can rely on whatever servers are between you and the destination server.
In terms of this specific question, I agree this is pointless anyway, they will rely either on the billing info or on the credit card number itself. In fact I think this has been discussed before. Really the only simple solutions are either 1) Get someone in a country that can buy it to buy it for you 2) Look for some other website that has the rights to wherever you live 3) Do something dodgy (really if you're willing to use Youtube I see no reason to not just go the whole shebang and get it from some P2P network).
Nil Einne (talk) 10:40, 28 June 2010 (UTC)[reply]

MP3 compression[edit]

Can anybody recommend a good program for lossy compression of MP3's? I want to be able to adjust the level of compression. Ideally, I should get arbitrarily small file sizes in exchange for arbitrarily higher losses in quality. --Bowlhover (talk) 09:44, 27 June 2010 (UTC)[reply]

[1] 82.43.90.93 (talk) 13:42, 27 June 2010 (UTC)[reply]
That program appears to use LAME - a standard, open-source MP3 codec. Bowlhover asked for "arbitrarily small file size" in exchange for "arbitrarily higher losses in quality" - but while that might be conceivable in general, the output will not be an MP3 file. In addition to file format overhead, MP3 files must have a minimum of 8 kbps and 16.0 kHz sample-rate. You can read about this in our bit-rate section of the MP3 article; you can also find technical documentation at this source cited in the article or The Anatomy of an MP3 File available in MP3: The Definitive Guide book. If you want lossier compression than these formats, you no longer have an MP3 file - you will have "something else" that will not play in a standard device or software media player. You might be interested in PCM audio. While not a true lossless-compression, you can specify arbitrarily low sampling frequency and still end up with a decode-able, playable sound file. Reducing sampling-rate will proportionally reduce file size (at the expense of degraded quality). However, the relationship between the degradation in "audio quality" versus "file size" will be pretty non-linear. Nimur (talk) 20:22, 27 June 2010 (UTC)[reply]
I highly recommend you do not recompress already compressed MP3's just to adjust the file size. You should be compressing the CD, not an existing lossy file. --mboverload@ 23:26, 27 June 2010 (UTC)[reply]
mp3 is sort of listenable at 64kbps mono, and some people compress even further than that, but it sounds just awful. I think it really can't go lower than 32k or so. If you're compressing speech rather than music, use Speex which is comparable to a mobile phone codec in intelligibility and bit rates. It sounds pretty good (by mobile telephony standards, not music reproduction standards) at 12 or 16 kilobits and can get as low as 2 kilobits (but sounds robotic at that speed). 75.57.243.88 (talk) 10:36, 28 June 2010 (UTC)[reply]

Excel conditional formatting[edit]

I am working in planning of facilities.I put the position of each facility as a geographical coordinates(latitude and longitudes).I want the excel to color it red whenever a new position I enter is less than 100m distance from the existing positions of the facilities which alredy exist.Is there any way for that? —Preceding unsigned comment added by 113.199.218.23 (talk) 15:58, 27 June 2010 (UTC)[reply]

My first attempt at doing this was really unwieldy, unclever, and probably unmanageable. Hopefully another editor knows a much smarter way. I put X and Y coordinates for 25 locations in two columns (E and F); I used random numbers from 1 to 100, but these are similar to your latitude and longitude numbers. Then in column H, I used the good old Pythagorean Theorem to measure the distance from the first row's coordinates to that row's coordinates, with =SQRT((ABS($E$3-E3)^2)+(ABS($F$3-F3)^2)). Then in column I, I measured the distance from the second row's coordinates to that row's coordinates with =SQRT((ABS($E$4-E3)^2)+(ABS($F$4-F3)^2)). Then, painfully, you could continue, so there's one column of calculated data for each of your facilities locations. Then finally you could use conditional formatting to color the row red if any number in that row from column H through column AI (or whatever) happens to be under 100.0. This is awful but may serve if you have a low number of facilities. Comet Tuttle (talk) 22:54, 27 June 2010 (UTC)[reply]
This should work for short distances, but remember to multiply the result by the Earth's radius R (6,371,009m), like so: =R * SQRT( (lat2-lat1)^2 + (COS ((lat2+lat1)/2) * (lon2-lon1))^2 ). The factor in bold is for improved accuracy (see geographical distance for details). There is no need for ABS, as n^2 is always positive. I do not think there is a simpler way that does not involve writing a VBA function, because you need some mechanism for comparing every position against every other position, and that is not so simple to achieve using only formulae. decltype (talk) 12:48, 28 June 2010 (UTC)[reply]
Here's a usable hack -- hardly production-worthy, but might work for your purposes :-)
  • Add two columns to your dataset. Add your conditional formatting to them, e.g. "Red if cell value < 100".
  • Using the formulas already given, compute the distance to the site from row R-1 (the row immediately above the current row) into the first new column, likewise from row R+1 (row below current row) into second added column.
  • Sort the data on latitudes, and check the computed distances; then Undo.
  • Sort the data on longitudes, and recheck; then Undo.
You could easily expand to R-2 and R+2 if the density of your facilities warrants. HTH, DaHorsesMouth (talk) 22:23, 28 June 2010 (UTC)[reply]

HTML viewer for Symbian phones[edit]

Does anyone know of an offline HTML renderer for Symbian OS phones (specifically S60v5), as the in-built browser asks you to make an internet connection like 5 times before finally opening the page (Opera Mobile doesn't work either). I'm looking for something like Plucker; I've tried Mobipocket but that doesn't work for S60v5, nor does it allow opening of saved .html files. --Mark PEA (talk) 21:24, 27 June 2010 (UTC)[reply]

Oh, and if one isn't available, how difficult would it be to create a Symbian app from one of the source codes provided by Plucker? I have decent coding experience, is it a large effort creating ports from one OS to another? --Mark PEA (talk) 21:26, 27 June 2010 (UTC)[reply]

Freeware = Communism[edit]

How come American people work on making freeware for no charge, yet America hates communism? 92.28.242.168 (talk) 21:52, 27 June 2010 (UTC)[reply]

Freeware isn't the same as communism. In some cases, it is a loss leader of some form (companies give away personal anti-virus software in the hope that it will attract people to buy commercial AV software or a premium version of their personal software with more features, or someone contributes to a FOSS project in order to prove themselves so they can get a good job), or it can be simple charity, or it can just be for fun and for the satisfaction of seeing your software used. Communism is a way of structuring an economy. Freeware is personal choice. --Tango (talk) 22:14, 27 June 2010 (UTC)[reply]
First, freeware is not at all the same as free software or open source software. Freeware is very often part of a very commercialized system - it can be thought of as "advertising." However, I think the OP intended to ask about free software - software that is typically developed by the community without any restrictions or requirement that the original authors profit from it. This is a whole different animal - somebody does work ("conducts economic activity") by programming something useful; and then they release it to the community with legally enforceable licenses, with the intent of helping the community at large. This is "free software" - and as it can sometimes displace commercial software that performs an equivalent function, it has been oft-criticized for its negative impact on commercial software. Without doubt, free and open software has changed the economics of the software and technology market (e.g., Copyleft—the economics of Linux and other open source software). However, it's not even clear whether free and open-source software has the effect of deflating or inflating the value (price) of commercial software. In some cases, the presence of free software encourages economic growth by making new technology development cheaper and opening technology markets to a broader audience. The economics of technology are very complicated. Some flavors of the free- and open-source software are inspired by leftist, socialist philosophies; the GNU General Public License has been likened to communism in scholarly analysis (e.g., The institutionalization of Open Source; The Open Source Definition, Open Sources). Bruce Perens writes: "The reason for the success of this somewhat communist-sounding strategy, while the failure of communism itself is visible around the world, is that the economics of information are fundamentally different from those of other products. There is very little cost associated with copying a piece of information like a computer program. The electricity involved costs less than a penny, and the use of the equipment not much more. In comparison, you can't copy a loaf of bread without a pound of flour." So: free and open-source software is not the same as communism; but many of the great thinkers and leaders of free-software have been communists or communist-inspired; so it is no surprise that there are similarities in the philosophical foundations. Nimur (talk) 22:50, 27 June 2010 (UTC)[reply]
Out of curiosity, which of the "great thinkers and leaders" are communist or communist-inspired? Stallman is not; he's a Green (even that surprised me a bit; my guess would have been Libertarian). --Trovatore (talk) 19:18, 28 June 2010 (UTC)[reply]
Eric Raymond (does he count as a "great thinker and leader"?) identifies himself as a libertarian and gun nut. Linus Torvalds says "I'm absolutely uninterested in politics". -- Finlay McWalterTalk 20:37, 28 June 2010 (UTC)[reply]
Huey Newton said, "We are not Marxists, though we are inspired by Marx..." because, as he elaborated, Marx was only an individual, and an individual can have flaws. The "movement" is bigger than the particular political leanings of any one individual; and when one individual's beliefs are flawed, it does not need to discredit the entire ideology. I think this was in the opening chapter of his Ph.D. thesis, but I'm unable to find it via a web search for attribution at the moment. As for whether Eric Raymond is a great thinker, I can't say I'm particularly influenced by him; his beliefs regarding firearm policy might have nothing to do with his beliefs about free software, but I haven't read anything by him to determine whether the two ideas are part of a continuous and coherent philosophy. Regarding Stallman, I guess only he can speak for his own political leanings, and if he prefers to call himself a "Green" rather than a socialist, that's his prerogative; but I've read enough of his writings to draw my own conclusions about his political leanings; this entire discussion suffers from a lack of clear definition of "communism" anyway. Nimur (talk) 18:27, 29 June 2010 (UTC)[reply]
I haven't read a lot of Stallman's work, but from what I have read, he would strike me as a very peculiar socialist. Socialism (at least, the non-anarchist varieties of it) tends to be a centralist, bureaucratic kind of thing; Stallman seems to me the exact opposite. --Trovatore (talk) 08:47, 30 June 2010 (UTC)[reply]
FWIW while I'm not a major FLOSS proponent I looked into Eric Raymond once for largely unrelated reasons and I would say his philosophy is fairly continous even if fairly controversial in quite a number of ways (the gun thing is only a minor point really). I won't go into details for WP:BLP reasons but a search should find some discussion if anyone is interested, rationalwiki for example has a half-decent write up. In relation to the his FLOSS influence, I found discussions of fetchmail I read of interest given it was part of the inspiration for The Cathedral and the Bazaar. My impression BTW is whatever his influence and importance may have been, the controversial surrounding him nowadays has reduced his influence and the likelihood of him being seen a 'great leader and thinker'. (While the same can be said of Stallman to some extent, I suspect more FLOSS proponents are closer to him then ESR and perhaps more importantly Stallman's controversy comes largely from whether his views on FLOSS go too far unlike ESR where the controversy largely comes from other things.) Nil Einne (talk) 16:21, 30 June 2010 (UTC)[reply]
Same reason Wikipedia editors write a free encyclopedia to give away. You might like the book The Hacker Ethic. 75.57.243.88 (talk) 07:49, 28 June 2010 (UTC)[reply]
Another difference is that in communism, every person is expected go give a share back to the community. With free/opensource software (and Wikipedia for that matter), you can download every single OpenSource program available, and not be legally expected to give anything in return. Then rather than being communism, it's just charity. Of course, the hope is that you'll see something that needs to be done and do it, thereby making the choice (again, no obligation, so not communism) to contribute, be it with a review/feedback, programming, bug-reporting, etc. So it is mutually beneficial to everybody involved, otherwise it would not be out there, but it is completely optional. Falconusp t c 16:20, 28 June 2010 (UTC)[reply]
I'm not so sure about that. "From each according to their ability, to each according to their need" is the communist motto. 92.24.188.76 (talk) 18:53, 28 June 2010 (UTC)[reply]

I would expect people to equate contributing to a free software project with communism, but in reality they're different things. Communism redesigns the entire economy, leaving people no choice but to work for no compensation, and in return get services for no pay. Free software projects don't work that way. They're all about choice. If you want to work for no compensation, it's fine. If you don't, then that's also fine. You can get access to everything other people have contributed without having to contribute anything yourself. I think the best way to look at it is as a hobby or a pastime. I'm sure most of you like to do something in your free time, even though you don't get paid for it. People do sports, draw, sing, dance, or do other things just because they like to do it. They don't refuse to even lift a finger unless they get compensation. I'd guess that the implied contrary system - where people couldn't do anything without being compensated - would actually be more restrictive. JIP | Talk 19:32, 28 June 2010 (UTC)[reply]

Connecting free software to communism is a ludicrous insult. How many millions of people have been murdered, imprisoned in labour camps, or had their life ruined in other ways by free software?—Emil J. 11:36, 30 June 2010 (UTC)[reply]

Well, if you want to get technical, the IP protocol was designed for military purposes; Unix and its free software derivatives now power much of the military computer and communication infrastructure; and I think it's a fair bet to say that many destructive devices like bomber avionics or missile guidance systems ran software compiled with gcc. These things were made possible (or cheaper) because of free software; but they are not the fault of free software. Analogously, your statement arbitrarily assigns responsibility and blame for a generic set of atrocities to a vaguely-defined concept. Which specific atrocity or atrocities were caused "because Communism" ? Violence is not committed by ideologies. Nimur (talk) 17:47, 30 June 2010 (UTC)[reply]