Wikipedia:Reference desk/Archives/Computing/2012 December 12

From Wikipedia, the free encyclopedia
Computing desk
< December 11 << Nov | December | Jan >> December 13 >
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.


December 12[edit]

How do I get Windows 7 to show me file extensions ?[edit]

That is, I want to see ".exe", or whatever, as part of the file name. StuRat (talk) 05:41, 12 December 2012 (UTC)[reply]

Ah yes, Windows being 'helpful' as usual, by making you do it the MS way... open the 'Folder Options' dialog from 'organize' for the relevant folder, click on the 'view' tab, then clear the 'Hide extensions for known file types' check box, and click 'OK'. Confused? You will be... AndyTheGrump (talk) 06:06, 12 December 2012 (UTC)[reply]
Nice to see someone fixing the setting that made the ILOVEYOU computer worm such a success. Very sensible and often one of the first settings I change on a new Windows installation. Astronaut (talk) 18:26, 12 December 2012 (UTC)[reply]
Thanks, that did the trick. StuRat (talk) 18:51, 12 December 2012 (UTC)[reply]
Resolved
Yup, one of the worst "user-friendly" settings in history. What's so user-friendly about showing me 5 files named "Setup"? It started in 95. The remedy hasn't changed except the "organize" bit.
Back on topic, you might want to uncheck "hide system files" too, and click the radio button "Show all files and folders". — Preceding unsigned comment added by One.Ouch.Zero (talkcontribs) 09:34, 14 December 2012 (UTC)[reply]
Heck, I wished the wiki software would just auto-sign messages. - ¡Ouch! (hurt me / more pain) 09:35, 14 December 2012 (UTC)[reply]

A Big Thank you to the Wikipedia Computing Reference Desk[edit]

(And a completely unrelated question, because I don't want this to get deleted.)

I have left a great many questions on this reference desk for the past few months about C and JQuery/Javascript. I am a complete newcomer jumping into coding, and had absolutely no base other than the books I was reading. I attempted to complete a CS project from my college in one quarter, and honestly I wasn't sure if I could do it.

You guys were one of my primary sources of help, and I cannot thank you collective lot enough. I could find no other site in the internet which offered exactly what I needed. You were:

1) fast (replies within minutes) 2) knowledgeable (your advice was sound and used language I could understand) 3) varied (many different people replied, corrected each other, linked to useful sites), and 4) patient. You dealt with my personal shortcomings in the field, and kept replying to me for days after the initial topic was posted. StuRat in particular I'd like to thank, but you all were great help and I could not have accomplished the project in the alloted time without you all. Thank you!

And now, so that this is still a computing question...

You're welcome ! StuRat (talk) 18:10, 14 December 2012 (UTC)[reply]

Preventing the background image of a forum from showing up[edit]

I like to visit forums. Sometimes, I visit forums in public places. Sometimes those forums have backgrounds I'd rather not have people see (this is the forum in question.) Is there a way to get the giant background picture of Littlefoot from showing up? 169.231.126.85 (talk) 08:28, 12 December 2012 (UTC)[reply]

If you're running an ad blocker, you could just add the URL of the background image to the block list. Greasemonkey could also be used to remove it - you would just have to write a simple script to remove the background image. 209.131.76.183 (talk) 12:56, 12 December 2012 (UTC)[reply]
You could also just disable images completely in the browser settings if you don't mind. You can always right-click and load individual images if there is something in a post that you want to see. 209.131.76.183 (talk) 15:57, 12 December 2012 (UTC)[reply]
I have this bookmarklet in my browser; it changes the background to solid grey on the current page. It worked for me on your link. I broke it up so as not to break formatting on the page, but for your bookmarklet this should all be one line, no spaces:
javascript:styles='BODY%20{background-image:%20none%20!%20important;%20background-color:%20grey%20!%20important}';
%20newSS%20=%20document.createElement('link');
%20newSS.rel%20=%20'stylesheet';%20newSS.href%20=%20'data:text/css,'%20+%20escape(styles);
%20document.documentElement.childNodes[0].appendChild(newSS);%20void%200

Chowbok 18:23, 12 December 2012 (UTC)[reply]

Can you specify which browser it is you use? ¦ Reisio (talk) 05:39, 13 December 2012 (UTC)[reply]

I'm using Firefox, but I just tested that bookmarklet in Google Chrome and Internet Explorer on the page linked to above, and worked in both of those as well.—Chowbok 17:51, 13 December 2012 (UTC)[reply]
Sorry I meant that to be addressed by the OP. For example a lot of browsers allow simple local CSS files to override specific sites, like… @-moz-document domain("gangoffive.net") { body { background: none !important; } } (or something like that) added to userContent.css ¦ Reisio (talk) 00:17, 14 December 2012 (UTC)[reply]
And now for a completely different approach to the problem...
I moved my PC in my work cubicle so the back of the PC was facing the aisle, rather than the front. If your office/cubicle is arranged so this is possible, and they have no policy against this, that's what I would suggest. In my case it was because I was testing using customer proprietary data, and we're not supposed to let people outside the project see it. However, this also had the advantage of having me facing the aisle, so I could see if somebody I needed to talk to walked by, and get their attention. StuRat (talk) 18:20, 14 December 2012 (UTC)[reply]

Ooh, Chowbot, your bookmarklet worked! Just to make sure I'm not stealing, I couldn't find a way to use the bookmark without publishing it on bookmarklet here, though I did credit you. (I also changed the color to black because grey is a bit of an eyesore on the forum in question.) If you want me to remove it, I need to know a new way to use your bookmarklet. And Stu, that had been my go-to strategy for years now, but recently I was in a cafe with tables to every side of me, so I thought it might be time to upgrade to a new solution. 169.231.52.28 (talk) 09:07, 15 December 2012 (UTC)[reply]

The Web Developer extension has a shortcut for disabling all images, too, for a less rigid / more broad preemptive approach to userContent.css. ¦ Reisio (talk) 17:48, 15 December 2012 (UTC)[reply]

Difference between VPS and dedicated server[edit]

I am trying to understand what the difference between hosting on VPS and a dedicated server is. Looking at prices for instance on [1], the cost seems comparable. Do I understand correctly that with the dedicated server I'd basically get an empty system with root access and can do with it whatever I like, while with the VPS I am limited to whatever the hosting provider decides to give me? bamse (talk) 09:22, 12 December 2012 (UTC)[reply]

In both cases you're limited by the hosting provider :). A dedicated server is physical hardware whose resources you can use as much as you want. A VPS is sort of a simulated physical server: you get root, you get your own IP address, you can set it up any way you want, but the simulation is running in a real server that's shared with others, so you get a smaller share of the hardware resources (particularly CPU) and if you hog too much, depending on the setup you either get slowed down or suspended by the host. VPS's range from good to crap, and decent ones are fine for small sites while being much cheaper than dedicateds. webhostingtalk.com and lowendbox.com are good places to look for deals and discussions about specific hosts (lowendbox concentrates on budget hosting). 66.127.54.40 (talk) 04:33, 13 December 2012 (UTC)[reply]
One advantadge of a VPS (if the host does it) is the ability to back up the whole system in case of failure. If you're running a dedicated server, you need to make sure you set up everything you need to back up your system in case the server fails. I would expect a hosting provider to back up their VPS images regularly, so if the server running it fails they can bring up all the VPSes on another server very quickly. Of course, you would want to confirm with a hosting provider that they do back up VPS images before relying on it. 209.131.76.183 (talk) 18:20, 13 December 2012 (UTC)[reply]
You indicated in an earlier question that you're looking into e-commerce. A lower level of hosting than a VPS will give you access to a space where you can host PHP or ASP pages and an account on a database server. You won't have root access or be able to reconfigure the server, but it is enough for most types of websites. You can't run cron jobs or background batch processing types of scripts on that sort of setup, but if all you need is the ability to host a website, then you can save a lot of money that way. It also saves the frustration of getting everything installed and playing nice, and lets the hosting provider worry about OS/server updates so you don't have to. 209.131.76.183 (talk) 18:24, 13 December 2012 (UTC)[reply]

new way doubt on synchronized block[edit]

Do not think I am asking a doubt repeatedly.In previous times i could not express my doubt clearly.so once again i am sending in clear manner.
Part1:


   Class table  
   {  
   Synchronized(this)  
   {  
   ……………………  
   }  
   }  

Here we got lock on object of table class.



Part2:

   Class table  
   {  
   Customer cust=new Customer();  
   Synchronized(cust)  
   {  
   ……………………  
   }  
   }  

Here we got lock on object of customer.i.e on cust
- table class.In part1 we got lock on object of
We get lock on table class because object of table class may try to access the synchronized block from different places simultaneously.To
prevent it we got lock on object of table class in part1.
-Now come to part2:
Here we got lock on object of customer class



My doubts:
1)why should we lock an object in table class other than table class in part2?
2)2)If we do not get lock on cust in part 2 then we can access synchronized block using table class
If we lock cust then also we need object of table class to access synchronized block.
Object of table class only needed to access synchronized block.
Due to synchronization we prevented object of table class to access synchronized block simultaneously from different threads.
Then why should we lock object other than table class in table class?
3)Will object of customer class try to access the synchronized block simultaneously from different places?
4).In part2 we got lock on object other than table class.
In What situations getting lock in table class on an object of a class other than table is benefit of getting lock on object of customer class in part2?
5)What is the need to lock object of customer class i.e other than table class?
6)What damage will happen if we do not get lock on object of customer class in part2?



I think meaning of all questions is same.But I expressed doubts as I got.
I hope you answer
— Preceding unsigned comment added by Phanihup (talkcontribs) 10:05, 12 December 2012 (UTC)[reply]

>>>>Java forum

190.60.93.218 (talk) 12:29, 12 December 2012 (UTC)[reply]

This kind of code:
{
  Customer cust = new Customer();
  synchronized (cust)
  {
    // ...
  }
}
is basically useless for synchronisation. You're creating a new object every time you call the code, which means that the synchronized block is guaranteed to have only one thread locking on the object, because no other thread can even see it. So the code will go happily through the synchronized block every time, regardless of how many threads are concurrently executing the code. You must instead use some object that stays the same between threads, such as this like you have done before, or the class object, or some object created outside the class and given to it as a parameter, like I showed you earlier. JIP | Talk 17:52, 12 December 2012 (UTC)[reply]


If English is not your first language, you should look for advice elsewhere, like "your" wikipedia. Maybe they can give you an answer which is easier to understand for you, or point you to a community where programming topics like yours are discussed in your language.
You should do that, as your repeated topics here start to look like WP:TROLLing, for example you should read our replies rather than writing an "I hope you answer" when some of us did, you should make clearer what you don't understand, and you should sign your messages. - ¡Ouch! (hurt me / more pain) 09:32, 14 December 2012 (UTC)[reply]
These replies are probably intended for User:Phanihup, not for me, despite the confusing indentation? JIP | Talk 07:55, 15 December 2012 (UTC)[reply]
Sorry JIP, I scrolled to the end of the topic without even noticing that the final paragraph (i.e. your reply) was a reply at all. Bummer. - ¡Ouch! (hurt me / more pain) 07:47, 17 December 2012 (UTC)[reply]
p.s. indentation should be correct now.

Was the transatlantic cable really built without repeaters?[edit]

I'm in a computer networking class and am learning about repeaters and hubs. I have a rough understanding of why they are necessary -- the signal dissipates electrically over distance, or something, so it needs strengthening at intervals. But the article transatlantic cable claims that that cable did not originally have repeaters. If so, how could it work, given the extremely long distance? ± Lenoxus (" *** ") 14:32, 12 December 2012 (UTC)[reply]

Honestly? It only just barely did. The mirror galvanometer (and later the syphon recorder) had to be invented to produce a perceptible signal out of such a tiny dribble of current. The bandwidth also wasn't exactly stellar. The 1858 cable, while it lasted, was only good for about 0.1 words per minute. The 1866 cable (with improved manufacture) squeezed out about 8 words per minute—maybe a couple of bits per second. TenOfAllTrades(talk) 14:52, 12 December 2012 (UTC)[reply]
(ec)It did indeed not have a repeater, and the first cable really barely worked at all. The dissipation that you speak of means that a nice clean square on/off sent into the cable gets blurred across the time domain so that when it's received, in addition to being much much lower in amplitude, it's not a square any more, but a vast shallow undulation. As Transatlantic telegraph cable#Communication speeds notes, it was taking them 2 minutes to send one word - which means that a single "instantaneous" change from on to off might manifest at the other end as a change over 5 or 10 seconds, where they needed a very sensitive mirror galvanometer to distinguish the supposedly high and low signals from one another. To fix this they decided to up the voltage (on the theory that voltage is "oomph", and that more voltage would push the signal through); this just blew the cable out. -- Finlay McWalterTalk 14:53, 12 December 2012 (UTC)[reply]
Incidentally, there's a wonderful essay that Neal Stephenson wrote for Wired back in the mid-90s, when there was a flurry of transoceanic fiber-optic cable construction. "Mother Earth Mother Board" is a delightful history of the development of undersea cables. In the same vein is Arthur C. Clarke's 1992 book How The World Was One, a similarly-accessible treatment of the development of communications technology. TenOfAllTrades(talk) 15:07, 12 December 2012 (UTC)[reply]
I believe that loading coils were an earlier attempt at reducing distortion on such cables. 31.54.246.112 (talk) 13:49, 18 December 2012 (UTC)[reply]

Syllable-based hyphenation software for HTML[edit]

I'm looking for something that will go through HTML documents and insert soft-hyphen characters ("&shy;") in words where they should break at ends of lines. Ideally, it'd be a command-line application, but I'll accept anything at this point--GUI app on any OS, web page, etc.

So far, the closest thing I've found is this web page. It mostly does what I want (it's a pain to have to paste my code back and forth, but I can live with that), but it's using some kind of algorithm that misses some very common words (for instance, "everything", "however", and "happened"), and at least once it's hyphenated something for me that it shouldn't have ("Stearns", as in "Bear Stearns").

I did manage to find (after a lot of searching) a plaintext list of hyphenated English words. If I was better with perl, it would probably be pretty simple to write a script that checked every word against this list and replaced it. Sadly, that's beyond my abilities. So... if anyone has some advice for me, I'd appreciate it. Also please let me know if I haven't been clear about what I'm after.—Chowbok 18:02, 12 December 2012 (UTC)[reply]

I don't know about HTML-specific advice, but the TeX language has very good hyphenation routines. Our article hyphenation algorithm says that several ports are available, and gives a link to a perl implementation on CPAN here [2]. Hope that helps, SemanticMantis (talk) 21:24, 12 December 2012 (UTC)[reply]

Powershell/command prompt fonts in Windows 7[edit]

I want to use the font Source Code Pro in Powershell and Command Prompt. The standard method to do this is add a new value in the registry HKLM\Software\Microsoft\WindowsNT\CurrentVersion\Console\TrueTypeFont, name it as many zeroes as necessary to create a new value name, set the data to the font's name as it appears in \CurrentVersion\Fonts, and restart the computer. But that doesn't work for me, even though I am logged in as administrator. The font does not appear when I restart. In fact, I accidentally deleted Lucida Consola and Consolas's values from the registry and am left only with the awful "raster fonts". Pokajanje|Talk 18:13, 12 December 2012 (UTC)[reply]

Caching of javascript and css[edit]

Are js and css cached? For instance if I have a website and each page of it loads the same js/css in its header. Can I get any performance improvement if I just load the js/css which is relevant for the respective page? bamse (talk) 21:25, 12 December 2012 (UTC)[reply]

.js and .css resources can be cached in the same way that .html or .jpg resources are (depending on the server's cache-control headers and the browser's preferences). Whether to collect all your site's JavaScript into one .js, or to have separate ones, or to embed the JavaScript into the HTML pages, is a complex performance tradeoff depending on how the JavaScript will be used and how many pages you anticipate visitors will view. Deferred loading of JavaScript might be a wise idea, in that it allows the page to appear as quickly as possible, without waiting for JavaScript that will perform animations and validation that won't be needed the very instant the page displays. It's tempting to segregate the javascript out into separate files and only load those as they are needed - but bear in mind that for some connections loading a few small files may take much longer than loading one aggregated one (due to round-trip delays). Testing your pages with something like Firebug or PageSpeed can be instructive. -- Finlay McWalterTalk 21:37, 12 December 2012 (UTC)[reply]
Thanks a lot for this comprehensive reply. Yes, I am using firebug/pagespeed but am still in the process of trying to understand its output. bamse (talk) 22:21, 12 December 2012 (UTC)[reply]

How do I name an unnamed disk in iTunes or otherwise[edit]

I have various disk from libraries and my own that I've burnt previously. When i try to copy them into iTunes, even though they are from store-sold disks in many cases, iTunes only offers me the option to copy them to my hard drive as nameless disks with numbers assigned to the songs. How can I either (1) assign the disk a name in iTunes or (2) download it with media player and either avoid the problem or name it in media player if I have to? Thanks! μηδείς (talk) 22:21, 12 December 2012 (UTC)[reply]

You cannot really name an album in iTunes, although it looks like it. What you probably want to do is provide information about the name of the album in the "album" field of all the songs - iTunes then handles them as you would expect of an album. To do that, mark all songs, then select File->Get Info and type away at the prompt. You should be able to do that even before you import the disk. You probably also want to tick "Automatically retrieve CD track names from the internet" in Preferences->General. This will match the CD against a version of CDDB and automatically fill in the meta-information if the disk is known. --Stephan Schulz (talk) 08:15, 13 December 2012 (UTC)[reply]
Yes! Thanks. That is exactly what I wanted. I knew it was possible, but searching "name album" wasn't getting me anywhere. μηδείς (talk) 18:28, 13 December 2012 (UTC)[reply]

mixed up networking graph labels in task manager (win7)[edit]

so, you know how the windows task manager networking tab has a graph for local area connection and one for wireless network connection? I'm working on my employer's laptop on my home wireless network. I'm pretty darn sure there is not a network cable plugged into this laptop. Anyway, I opened up task manager on this thing, and the wireless network connection graph is flat, and all the action is on the local area connection graph. ?? The only possibility I can think of is that has something to do with VPN (Cisco AnyConnect). Could that be it? I can't check out what it looks like without VPN because this thing is dedicated, no direct connecting to anything except our VPN, access to the web etc. is routed through the VPN and the business' proxy servers, firewalls, etc. Thanks in advance. Gzuckier (talk) 22:59, 12 December 2012 (UTC)[reply]

Performance of auto serialization of a HashSet<String> in Java[edit]

Hello! In Java, I need to write multiple HashSets of Strings to a file. Is there an appreciable* performance difference on the loading side if I manually implement a "foreach String in HashSet, writeToFile(String)" and corresponding "loadHashSet(File)" code, over simply using the built-in serialization of HashSet? I'm particular concerned about the performance of reconstituting the HashSets from file on an Android device. I realize *appreciable is an extremely vague term; just wanted to get your guidance. Thank you.--el Aprel (facta-facienda) 23:57, 12 December 2012 (UTC)[reply]

The only thing that occurs to me is to make sure to construct the new HashSet with a capacity >= the actual size of the Set you're going to dump into it. Otherwise, if you create it with the default and the actual size is much bigger than the default, it has to resize and copy its internal array. At least the OpenJDK implementation would do: it starts with 16 entries, and when you exceed that it doubles it (a fresh allocation) and has to copy the contents. So if you were to naively dribble 600 entries into it, one at a time, it would do 6 such realloc-and-copy operations, and you'd be left with 1024-600 extra spaces in the array (each space is only a NULL reference, but that's a bit to worry about on an embedded device, and the garbage collector has to walk the whole array even though you know it's nulls). The OpenJDK serialise/deserialise naturally is smart, so it sends the capacity so the deserialised array is allocated all in one go. I'd imagine the Android library (which was developed cleanroom) should be much the same, but I haven't looked. If serialisation performance were an issue (which it sounds like isn't the case for you) I'd remind you of good practice regarding efficient iteration. -- Finlay McWalterTalk 00:47, 13 December 2012 (UTC)[reply]
On thinking about your problem further, you might wish to ponder whether exchanging serialised java objects is the best solution for your problem. Serialisation is neat for RMI and for a lot of persistence tasks, but its ease of use comes with some additional concerns, especially over the network to code of a different codebase. Using it securely can require a bit of extra care (and it's really not safe to use on an insecure connection), its format obscures its contents from easy view (so it's a bit harder to debug), and it greatly limits your ability to refactor the classes at either end in the future. Moreover it ties you to Java technology on both ends. If all you're doing is exchanging simple datastructures that can be represented in something like JSON, switching to that gives you lots of future flexibility. That would allow you to implement an Objective C client on iOS, a native Windows client in C#, and an AJAX client in the browser in JavaScript; and you'd have comparable flexibility on the server end. Android already comes with the json.org library, so there's no additional dependency there. As to verbosity: I did an experiment encoding a HashSet<String> with 1373 strings extracted from Macbeth and serialising it both with Java's serialisation and with JSON. Both encode to essentially the same size (and happily the JSON gzips down a few percent smaller than the java serialised image). Let me know if you want a copy of my test code. -- Finlay McWalterTalk 19:32, 14 December 2012 (UTC)[reply]
Thank you very much, Finlay! Yes, I think I need to get away from the VM-default serialization and switch to something like JSON. If you have time, please see my related question below--el Aprel (facta-facienda) 22:11, 14 December 2012 (UTC)[reply]