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

From Wikipedia, the free encyclopedia
Computing desk
< December 13 << Nov | December | Jan >> December 15 >
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 14[edit]

Conflict with YouTube?[edit]

I have noticed a problem lately. When I play a video on YouTube, and -- at the same time -- try to scroll a Wikipedia page (using my mouse wheel), it makes the video skip until I stop scrolling. I haven't tried any other site. How can I get this to stop. Allen (Morriswa) (talk) 01:00, 14 December 2012 (UTC)[reply]

Can you try scrolling in another way, perhaps with the scrollbar ? StuRat (talk) 05:24, 14 December 2012 (UTC)[reply]
Also, which OS and which browser do you use? --Stephan Schulz (talk) 08:04, 14 December 2012 (UTC)[reply]
I haven't tried the scroll bar. I use Windows XP, Service Pack 3 & Mozilla Firefox 17.0.1. I hope that helps. Also, I'm now noticing the issue with other websites, like Google, for example. Allen (Morriswa) (talk) 02:45, 15 December 2012 (UTC)[reply]
Well, some OSes, especually older ones without compositing window managers (which Windows only got with WIndows 7) will stop screen updates during some operation like e.g. scrolling. If that is the reason, the sound would normally continue. And the same thing should happen with other Web browsers, at least if all use the Flash plugin to play YouTube. --Stephan Schulz (talk) 09:14, 16 December 2012 (UTC)[reply]
I have this problem with my parents laptop, its so incredibly slow and full of horribel software (Norton etc) that even youtube slows it to a crawl. I've found that it is so slow it can't process the video and scrolling a densely populated webpage at the same time, sometimes even crashing IE/Firefox. If yours is similarly slow, you might want to think about reinstalling the OS. 80.254.147.164 (talk) 12:06, 17 December 2012 (UTC)[reply]
Both Vista and Windows 7 (and now Windows 8) have the Desktop Window Manager. Nil Einne (talk) 07:03, 18 December 2012 (UTC)[reply]
Make sure your video drivers are the latest available from the manufacturer's website. Windows will work with built-in drivers, but often won't take advantadge of the card's capabilities to accelerate things like scrolling. 209.131.76.183 (talk) 15:19, 17 December 2012 (UTC)[reply]

Firewire 400 power clash?[edit]

I want to connect an old iMac to a DVR using a Firewire 400 cable with 6-conductor alpha connectors on both ends. I believe that both devices are prepared to provide power to the other via the Firewire cable. Does the IEEE 1394 standard protect against this, perhaps with blocking diodes to prevent the device with lower supply voltage from suffering a reverse current driven through the cable by the other device having a higher supply voltage?50.4.23.161 (talk) 05:11, 14 December 2012 (UTC)[reply]

Firewire can be used to directly connect two computers, which strongly implies that this shouldn't be an issue. However, I haven't found a reference specifically addressing your concern. Generally (but not always), user-accessible ports on a computer are pretty well protected against excessive current drain, short circuits, improperly applied power and other common problems, simply to avoid accidental damage to internal components due to a failure in a peripheral. (I know this from working with this sort of protection circuitry.) 209.131.76.183 (talk) 16:41, 14 December 2012 (UTC)[reply]

Citroen website and javascript causing reboots[edit]

Hi, last week i could go to Citroen.co.uk or any other international Citroen site to look around or waste some time. This week i've noticed that my computer reboots when these pages are loading, yet doesn't do it on other sites. Google sources suggest this may be a javascript issue, but i am unsure how to fix it without disabling javascript in Firefox 17.0.1 on Windows XP, or why the issue has appeared since last week. Any recommendations? Thanks Jenova20 (email) 10:41, 14 December 2012 (UTC)[reply]

Changing Directory by command line[edit]

On a Unix system, I can type

cd <pathname>

and my current directory is immediately set to that path, even if I was previously in a different file system.
However on Windows, to change to a different drive, I have to set the drive letter explicitly as well, and (as far as I can tell) the cd command has no effect until I have done so. Has Microsoft ever commented on why they did it this way, and does a two-stage process present any advantages over doing it in one? Rojomoke (talk) 11:15, 14 December 2012 (UTC)[reply]

You're mistaken on cd having no effect if you're in a different drive. In fact for most/all? Microsoft non POSIX NT command shells it will change directory for that drive. If you later change drive, it will be in the directory you changed to. And if you do something to a relative path of the drive, it will be to the directory you changed to. (E.g. if you are initially in D:\Temp2, you change to drive C: and then cd D:\Temp and then copy something to the directory D:Files, it will be copied to D:\Temp\Files\ not D:\Temp2\Files\ or D:\Files\.) I believe this was the same for MS DOS command shells (including Windows ones), but I can't recall off hand. Nil Einne (talk) 11:23, 14 December 2012 (UTC)[reply]
BTW, this behaviour is discussed at cd (command) which confirms it originated in DOS and is preserved for backwards compatibility in NT command shells like cmd.exe, although it doesn't give a reason for the origin of this behaviour. (I suspect it at least partially has to do with the fact Drive letter assignment exists in DOS as well as the fact independent working directories can be useful when your storage and file systems are organised in such a manner and so changing working directory without changing drive can also be useful.) Nil Einne (talk) 11:32, 14 December 2012 (UTC)[reply]
This in fact a very useful feature now. It was quite frowned upon when RAM was scarce (640k) because it used one directory string per drive letter. Thus you needed to limit the number of drive letters via LASTDRIVE=F - saved space which would have gone to twenty unused drive letters otherwise.
Now it is useful. Say you have utilities on floppy (A:), you can type c: then cd \MyDocuments\images\holiday\2012\summer and still call an exe which is on A:\. What if it is in A:\UTIL? No prob. cd A:\UTIL Now say pkzip is what you want and make an archive on your external HDD which happens to be E:, and you want it in the folder E:\backups\other. cd E:\backups\other Now you can pkzip the images:
a:pkzip e:h2012s.zip *.*
If you had no working directories on a per-drive basis, you would have needed
A:\UTIL\pkzip E:\backups\other\h2012s.zip *.* instead.
Oh no! There's no more free space on E: Let's say it happens during photo 60 of 60, so a tighter compression method is what you want. What would you prefer,
a:pkzip -ex e:h2012s.zip *.* or
A:\UTIL\pkzip -ex E:\backups\other\h2012s.zip *.*  ?
In a nutshell, it is as Nil said. You can specify directories via drive letters only. x:file.ext will be the file in the working directory, while x:\file.ext will be in root. - ¡Ouch! (hurt me / more pain) 13:08, 14 December 2012 (UTC)[reply]
Thanks to you both. I see that for my purposes (only ever referring to one drive at a time), I need to use "cd \d". Rojomoke (talk) 16:08, 14 December 2012 (UTC)[reply]

Who really made Instagram unusable (directly) over Twitter?[edit]

I've read on news sites that Twitter made the change to their systems so that Instagram photos cannot be seen directly in Tweets, but only links to the pictures. But when updating the iPhone Twitter app, the "what's new" section included "Instagram has decided to disable its integration with Twitter and as a result, photos are no longer appearing in Tweets or user photo galleries." 67.163.109.173 (talk) 11:57, 14 December 2012 (UTC)[reply]

I don't know what "news" sites you're reading, but most sites seem to confirm Instagram is the one which disabled the integration [1] [2] [3] [4]. Since even the Instagram CEO agrees, [5], [6], [7] (well I didn't check what he said myself), I guess those news sites didn't know what they were talking about. As the earlier links mentioned, Twitter have responded in various ways (as have other companies). Nil Einne (talk) 17:47, 14 December 2012 (UTC)[reply]

Variable substitution not working with delayed expansion variable (Windows XP)[edit]

Hi,

I'm under Windows XP and I'm encountering the problem described here: in a .bat file, I don't manage to extract a substring from a delayed expansion variable: in the .bat file, I wrote:

setlocal enabledelayedexpansion
FOR /F "delims=" %%n IN (%1) DO (
md "z:\blah\%%n"
set y=%%n
set a=!y:~0,2!
[...]
)
endlocal

and on my screen (with ECHO ON), I get:

C:\temp>FOR /F "delims=" %n IN (toto.txt) DO (
md "z:\blah\%%n"
set y=jzocbz
set a=!y:~0,2!

(whereas "a" should be set to a substring of "jzocbz").

Any ideas?

Thanks. Apokrif (talk) 17:30, 14 December 2012 (UTC)[reply]

-> bottom of [8]. Apokrif (talk) 10:20, 8 January 2020 (UTC)[reply]

mobile internet abroad[edit]

I live in Britain and have a smartphone on contract with 3. I'm travelling to Germany (and briefly to Luxembourg) very soon and would really like to still be able to use the internet on my phone - emails, maps, travel information, etc. I've noticed that the prices I'll be charged by 3 for doing this abroad are horrendously expensive. What are my other options? Would it be simple to get a German card and put it on my phone, pay as you go? (My phone is unlocked.) I think I've seen some kind of International card in airport shops before. How do they work? Are they expensive? 92.13.65.59 (talk) 18:22, 14 December 2012 (UTC)[reply]

It would be helpful if provided information about the mobile operator that you user and what is your current tariff plan. Ruslik_Zero 19:33, 14 December 2012 (UTC)[reply]
Well, as I said, I'm with 3. On the contract I get a number of free minutes, texts, and GB of data per month for a fixed price. I'm not sure why it's necessary to know that though - I want to know what I can get in Germany or at the airport which will allow me to operate more like someone who lives there - paying a resident's prices (instead of being fleeced by my network for travelling). 92.13.65.59 (talk) 19:43, 14 December 2012 (UTC)[reply]
Generally speaking in most countries there's no such thing as a 'resident's prices'. If you mobile phone is with a foreign provider and you roaming in that country, you will pay for the service (although my impression is the rates aren't quite that bad in the EU but I think internet is still an area the regulatory agencies are working on). The alternative is to buy a local SIM and pay whatever domestic rates associated with the account you are on rather then roaming although remember if you charging SIM you are charging your account, you will have a new phone number and everything. In most countries this will have to be a prepaid SIM, since it will be difficult or impossible for a non resident to start a contract in a foreign country (but these still aren't resident prices, they are simply on account or post paid prices). I would avoid buying a SIM card at an airport particularly a foreign one, you will likely pay for the service. It will almost definitely be far better to buy a SIM card from within more normal shops in Germany. Even if you don't speak German it shouldn't be that hard to find a shop where someone has a sufficient command of English to help. Since you're primarily interested in mobile internet, bear in mind prepaid mobile internet prices can sometimes be a fair amount dearer then on account/postpaid ones. You may want to look out for bundles and do a fair amount of investigation beforehand to find the best deals. Nil Einne (talk) 07:51, 15 December 2012 (UTC)[reply]
(OP) Thank you very much for all of this information. It's very helpful! 62.159.40.248 (talk) 15:41, 15 December 2012 (UTC)[reply]
this site has a list of different prepaid carriers in Germany and instructions for how to activate data packages. As Nil Einne said, prepaid SIM cards are available in many different retail stores; they all seem to have a pretty high basic cost per MB but also offer daily/monthly data packages that are much better value. 59.108.42.46 (talk) 09:57, 17 December 2012 (UTC)[reply]

Official North Korean Instagram?[edit]

A former coworker's photo on Instagram was liked by North Korea... @northkorea_dprk_officialsite (http://web.stagram.com/n/northkorea_dprk_officialsite/) which calls themselves "Official Site of the DPRK (North Korea)". Is this true? They liked her image of a gingerbread cookie. -- Zanimum (talk) 18:46, 14 December 2012 (UTC)[reply]

I doubt if that site is run by the North Korean government. They seem to be as incompetent at web technology as they are in feeding their own people. A decade ago, I viewed their English web site, which was translated into English far worse than a machine translation, including listing the name of their nation as "Koran". :-) StuRat (talk) 19:09, 14 December 2012 (UTC)[reply]
Thanks! I presume everyone else agrees with this assessment? -- Zanimum (talk) 16:07, 15 December 2012 (UTC)[reply]

Installing Firefox 17 without administrator rights[edit]

I'm trying to install Firefox 17 on my Windows 7 system. When I run the setup .exe file, it says I have to log on as an administrator. I'm the only person who uses this PC and have never set up an administrator account for it and there is no password. If I click the radio button to install it as a regular user, it stops installing. If I click the radio button to install it as an admin but leave the password blank it says I can't leave the password blank. If I click the radio button to install it as an admin and type some madeup password as the password it says the password is wrong. Is there anything I can do short of continuing to use Firefox 16? This never happened when I upgraded Firefox in the past. Angr (talk) 19:33, 14 December 2012 (UTC)[reply]

That's weird, but why are you running an installer instead of just letting Firefox update itself? ¦ Reisio (talk) 20:55, 14 December 2012 (UTC)[reply]
It tried and said that didn't work. Didn't say why not, though. Angr (talk) 23:15, 14 December 2012 (UTC)[reply]
Well now this time it did work. So it's updated now. Thanks for your help! But it still sucks that it wouldn't work with the installer. What will I do next time I buy a new computer and want to install Firefox for the first time? Angr (talk) 23:22, 14 December 2012 (UTC)[reply]
I doubt you'd run into this bug on an entirely new OS install, but if that does happen, come on back we aren't going anywhere. (Or even try http://webchat.freenode.net/?nick=Angr&channels=##windows) ¦ Reisio (talk) 00:41, 15 December 2012 (UTC)[reply]
Your account normally is the administrator account, so it should work if you enter your account's password. If that doesn't work, try going into the Control Panel and changing your account type to Administrator (if it isn't set to that already). Or, as a last resort, you could try right-clicking on the setup file and choosing "run as administrator". I hope this helps. WikiPuppies bark dig 03:15, 15 December 2012 (UTC)[reply]
To clarify WikiPuppies point somewhat, starting from Windows Vista, User Account Control means programs will generally not have full administrative access even if you are running from an administrator account, which in most installations will be the default account. You need to specifically grant permission when the UAC panel comes up. However the panel will only come up if the program either says it needs administrative permission or Windows decides it does (which it does for all things with install or setup in the name IIRC). Since UAC has been out for a while, most programs which need it should ask but in the event you are having problems, it's always helpful to choose 'run as administrator' to see if that's the problem. While you can turn of UAC, I strongly discourage it if you are going to be running as an administrator by default, particularly if your knowledge of using computers and Windows is not very high which from this discussion it probably isn't. If you want to check what your account type is and see what accounts are present, one of the simplest ways is to open the Control Panel, click on 'Add or remove user accounts', grant permission if asked and see what it says. Nil Einne (talk) 08:08, 15 December 2012 (UTC)[reply]
Whooops um it just occurred to me the final recommendation probably won't work if you aren't actual an administrator. Nil Einne (talk) 09:17, 15 December 2012 (UTC)[reply]
As the only user of this computer, I ought to be an administrator, since no one else is. And when I open User accounts on my control panel, it even says my account is named "Administrator". I don't have a password for my account, because as the only user of this computer I never saw the point of having one. I could create one, but it would be just one more damn thing for me to have to remember, and I worry that then I would have to sign in every time I start up my computer, which is a pain in the ass on a computer in my own apartment that no one has access to but me. Angr (talk) 17:14, 15 December 2012 (UTC)[reply]
I've also seen this behavior, where a Windows computer that formerly logged directly in, without asking for any password, suddenly starts asking for one. It's not the result of an update or user change. It's a bit of a mystery how or why this happens, but I've seen it occur. StuRat (talk) 17:30, 15 December 2012 (UTC)[reply]
Well it's probably best to just make the computer auto-login again rather then worrying too much about why or how it happened. Anyway there's probably no need to create a password for your account in the setup described by Angr however you will still have as I mentioned UAC does mean you will still have to run programs as administrator if they don't request elevation but need it. I'm a bit surprised Angr's account is named Administrator, that isn't recommended by Microsoft any more and in most normal set-ups the account named Administrator is hidden and disabled but perhaps OEMs ignore Microsoft's recommendations. Nil Einne (talk) 08:42, 16 December 2012 (UTC)[reply]

Loading values of a Java HashMap as needed from file[edit]

Hello! In Java, I need to create a dictionary of String-List<MyObject> pairs, write it to a VM-independent file, and then load that dictionary in an Android application. The Android application just needs to read from the dictionary, never add values to it. For the moment, I'm only concerned about the Java (Oracle JVM) side. To attempt this, I've tried using HashMap<String, List<MyObject>> and serializing it to JSON with Google's GSON. I've run into the following problems:

  1. I have several String keys that map to the same List<MyObject> value, but GSON insists on re-writing the List<MyObject> for every key. This isn't a problem with respect to filesize, since the file will be compressed, but it will probably cause the same object to be redundantly loaded into memory for each key, since it doesn't seem GSON knows they're equal.
  2. The Lists contain instances of MyObject as well as instances of MyObjectSubclassA, MyObjectSubclassB..., but while GSON supports serializing generics, it deserializes them all as the superclass MyObject, discarding any functionality (e.g. method overrides) provided by the subclasses (even though examination of .json file shows the additional fields of the subclass are being written, there is no CLASSTYPE marker in the .json file that tells GSON what subclass to instatiate. This possibly can be corrected with some setting in GSON...).
  3. With this implementation, the whole HashMap has to be loaded into memory from the file. It would be nice if there was some Java implementation of a dictionary that loads all the keys and then loads the values from the file as needed.
  4. I guess the serialization problem isn't a problem if I just run the dictionary-creating code with the Dalvik-VM default serialization and extract the created file from Android device image. However, the Android API gives very little guarantee that serialized objects will be future compatible, so it would be best if the dictionary is serialized to a standardized format like Json, or have the dictionary explicitly handle its own serialization.

I appreciate your advice on how to handle any of these points. I'd also greatly appreciate any advice on an alternative implementation to solve the original problem I laid out. Thank you!--el Aprel (facta-facienda) 22:06, 14 December 2012 (UTC)[reply]

It would help us understand if you can give us examples. If the data is proprietary, please make up some data to show us what you mean. StuRat (talk) 22:47, 14 December 2012 (UTC)[reply]
(e/c with Finlay, about to read what he wrote...)Here's an example: Say I want a dictionary of Employees by department, listed by seniority. So I use a HashMap<String, List<Employee>> dict. I initialize it and add all the keys and values, so if I call dict.get("IT"), I get a List of all Employees in the IT department. I also put that same list under the keys "technical" and "computer people", so dict.get("technical") returns the same exact List as dict.get("IT"). (Problem #1: If I write this HashMap using Google's open-source json-file writer, GSON, the same List of Employees gets rewritten under "technical", "computer people" and "IT".)
Subclasses of Employee have additional contact information that needs to be displayed, like LegalEmployee and HumanResourcesEmployee. (Problem #2: GSON doesn't know List<Employee> contains subclasses of Employee, such that, after deserializing from the Json file, employee.displayContactInformation() always calls Employee.displayContactInformation(), never LegalEmployee.displayContactInformation().)
Rather than include the code that initializes that HashMap from scratch in my application, I want to include the HashMap in a file in an Android application, so that people can type in a department as see who works there. If someone just wants to look up who works in IT, the application shouldn't have to load all the Employee objects in the HashMap, just the List of those returned by dict.get("IT"). (Problem #3)
Hope this helps illustrate what I need to do and the problems I'm having. Thanks!--el Aprel (facta-facienda) 23:16, 14 December 2012 (UTC)[reply]
Thanks. It really sounds you need a relational database to do what you want properly. You may be able to get by with a non-DB approach, with a small enough amount of data, but it won't scale up well. StuRat (talk) 23:34, 14 December 2012 (UTC)[reply]
Thank you, StuRat. Yes, this problem is probably suited for a database, but it's actually overkill for what I'm working on, which, in terms of this example, has a fixed number of employee that, once created, never needs to be altered or updated, so scalability isn't a problem.--el Aprel (facta-facienda) 23:52, 14 December 2012 (UTC)[reply]
I don't know much about GSON specifically (and you're sure to get better answers than mine on the GSON google group), but in general:
  1. It seems you're trying to render a cyclic object graph into the acyclic JSONformat: specifically it sounds like GSON is just doing a basic iteration over the map, and (because JSON doesn't have a concept of a "reference") it just generates a new entry for each entry it finds. You could take control yourself, and instead emit a JSON array for the keys, another for the values, and a third for the mapping between the two (where the mapping is an array of integer pairs, [k,v], where these are indices into their respective tables. Then you have to manually build the structure back yourself on deserialisation.
  2. dunno
  3. In the worst case, you can write a little class (that implements java.util.Map) that keeps the string data in a java.io.RandomAccessFile and that only loads into memory a HashMap that associates the key to a (int position, int length) tuple. When someone does a get(), it effectively fseeks(position) and read(length) to generate a new object on the heap. That's a horrid thing to do on a spinning media file, but perhaps not on the flash devices you'll see on Android. Or you could do something similar with java.nio.MappedByteBuffer; whether its RAM usage strategy works better for your application, I don't know.
  4. My concerns regarding the fragility and non-interoperability of using the language's serialize functionality, which I added earlier today to your previous question, apply here just as much. If you do decide to use this approach, I'd recommend you read all of the serialization chapter of Josh Bloch's Effective Java (it's chapter 10 of the first ed.); Bloch's rather stentorian warning at the start of that chapter would still the ardour of many the serialize fan.
-- Finlay McWalterTalk 22:54, 14 December 2012 (UTC)[reply]
Very helpful, Finlay, thank you. Your advice in #1 for making the HashMap Json-friendly is a stellar idea. I'm going to start implementing that and check back here for anything else you or others might want to add.--el Aprel (facta-facienda) 23:52, 14 December 2012 (UTC)[reply]

Lithium-ion cell phone battery[edit]

I have an old cell phone that works just fine, except that the 6 year old battery doesn't hold much of a charge (I have to recharge it every night). I ordered a "new" cell phone battery, and they sent me one which is 7 years old. I am displeased. However, is it possible, that if this battery has been on a shelf all this time, it will hold a charge better than the newer battery I'm using now, which has been in continuous service for 6 years ? I'm wondering if I should test it out first, or send it back right away. StuRat (talk) 22:28, 14 December 2012 (UTC)[reply]

We don't seem to have any experts on Li-on here (you might try the Science Desk). My understanding, which is probably no better than yours, is that it depends a lot on how the 7-year-old battery has been maintained and stored. Some batteries being manufactured now could well be in good condition if treated carefully for the next seven years, but this is less likely to be true of one manufactured seven years ago. I'd be inclined to contact the seller and ask what percentage of original specification capacity they guarantee. Dbfirs 23:27, 16 December 2012 (UTC)[reply]
OK, I will repost there. StuRat (talk) 00:09, 18 December 2012 (UTC)[reply]