Wikipedia:Reference desk/Computing
of the Wikipedia reference desk.
Main page: Help searching Wikipedia
How can I get my question answered?
- Select the section of the desk that best fits the general topic of your question (see the navigation column to the right).
- Post your question to only one section, providing a short header that gives the topic of your question.
- Type '~~~~' (that is, four tilde characters) at the end – this signs and dates your contribution so we know who wrote what and when.
- Don't post personal contact information – it will be removed. Any answers will be provided here.
- Please be as specific as possible, and include all relevant context – the usefulness of answers may depend on the context.
- Note:
- We don't answer (and may remove) questions that require medical diagnosis or legal advice.
- We don't answer requests for opinions, predictions or debate.
- We don't do your homework for you, though we'll help you past the stuck point.
- We don't conduct original research or provide a free source of ideas, but we'll help you find information you need.
How do I answer a question?
Main page: Wikipedia:Reference desk/Guidelines
- The best answers address the question directly, and back up facts with wikilinks and links to sources. Do not edit others' comments and do not give any medical or legal advice.
September 14
Can Samsung (or its North Korean fans) explode all the cell phones at once?
I just found this article [1] that says that Samsung can try to prevent its cell phones from exploding by limiting battery life to 60%. Can they do the opposite and set every battery to overcharge? Also, how vulnerable are they to other software options that would overload them and make them blow up at a specific time, such as when they are on the highway? What percentage of them would go off? And is there anyone official whose role actually allows them to reverse engineer the software, test for such threats and stop them before a million buildings are on fire and all the roads are blocked with burned drivers? Wnt (talk) 12:19, 14 September 2016 (UTC)
- Consumer products, including software, are subject to regulation. Even if the software update is delivered wirelessly, it is still probably subject to regulation.
- I've rephrased some of your questions:
- Could a company intentionally or accidentally release software that causes harm to consumers who own some hypothetical product? Sure - but there would be legal and financial consequences.
- Could an external black hat hacker release software that causes harm to consumers who own some hypothetical product? It isn't impossible.
- In the specific case of this particular product, the Galaxy Note 7:
- How severe is the threat of malicious software with respect to its impact on the fire-hazard of the device's built- batteries?
- The threat is severe enough that the manufacturer has offered to exchange every single device that escaped out into the world via all of its retail suppliers, and has issued this statement stopping all retail sale of the device. In addition, they have released a software patch to reduce the risk. If you're a law-student, this is a fascinating real-world case study in the nature of tort defense as pertains to consumer electronics products.
- The scientific and engineering details - the real factual meat of the case - have not really been made available to the public. If you're the type of person who likes unfounded speculation, there are many rumor-sites and even more self-declared experts who will analyze the device, estimate its battery performance, and so on. I don't think we - in the outside world - are going to ever know all the engineering details unless a public investigation is conducted - so I would refrain from estimating anything about "percentages." I would also refrain from speculating about whether any software could cause a battery-fire "on command." In a hypothetical different device, sure: software can trigger an electrical switch that can unleash full battery current and cause heat, completing the fire triangle, and causing flame to emanate from the device. I used to play with those devices when I was a kid: we called them electrical launch controllers for toy rockets. Devices exist that contain software- and batteries- and that are designed to cause fires on command. Whether the Samsung device represents an instance of such a contraption is an entirely different question, and depends on engineering details that we - in the outside world - probably will never have permission to know. We have to trust that the engineers at least tried to design the product to be safe.
- How severe is the threat of malicious software with respect to its impact on the fire-hazard of the device's built- batteries?
- Does anybody "reverse-engineer" the device?
- Sure - both inside a company, and outside a company, there are people who exist who perform "black-box testing" for the purposes of assessing regulatory compliance, reducing liability, assuring reliability, and so on. I wouldn't even be surprised if the manufacturer pays people - in controlled environments - to try to cause harm using the device (or its software), so that the engineers can study those types of failure. One hopes that any major device flaw is fixed before it hits the mass-market. But today's devices are immensely complex. Mistakes happen. Even high-mark retail brands are sometimes attached to massive scandals.
- Don't let the ill-informed "tech journalism" press-corps sway your opinion too far. The actual facts, as confirmed by the manufacturer, are more important than all the rumors:
- The manufacturer confirmed "35 incidents" in their official statement. Exactly what constitutes an incident? Those pesky tech-journalists don't seem to be all that keen on digging in to that definition!
- The manufacturer asked owners of the device to participate in the replacement program "as soon as possible," expressing a sense of urgency. They did not actually describe what engineering details are known, nor have they actually stated that the devices are a fire hazard or "unsafe." This is, in some sense, a pretty smart way to phrase all your public statements. But in the spirit of respect for the company, let's not indiscriminately repeat every rumor we hear on the internet as if it is gospel truth. You and I do not actually know the magnitude of any safety hazard.
- It is a near-certainty that if the company actually committed a foul, they will be held accountable by way of litigation - and if that happens, more facts will become known to the public, and a procedure will exist to assess the truth of each fact. Until then, every story you read about this event - including my writing here - is just some random person's opinion.
- Nimur (talk) 15:47, 14 September 2016 (UTC)
- Note that while denying all responsibility may be the smart thing to do legally, it's a definite turn-off to consumers, and Samsung may see a decline in sales due to such behavior. Also; regulators, attorney generals, consumer protection agencies, etc., may feel the need to step in, where they wouldn't have, had the company taken full responsibility. So, denying all responsibility is not always the smart thing to do, for the overall bottom line. StuRat (talk) 15:55, 14 September 2016 (UTC)
- There is an immense difference, both legally and linguistically, between "denying responsibility" and "choosing one's words carefully."
- To help illustrate this difference: I am not aware of any public statement by Samsung that denies the existence of a fire hazard. I am also not aware of any public statement by Samsung that says that they created a fire hazard. I am aware of a statement that says they are recalling their product and have stopped new sales "(because) customers’ safety is an absolute priority at Samsung". See the difference?
- Nimur (talk) 16:09, 14 September 2016 (UTC)
- Let's say "not admitting responsibility" rather than "denying responsibility" then. It still triggers all those negative consequences I mentioned. Also, reality has to play a role. If only one battery caught fire, they could reasonably hope to blame it on the user, but when they have dozens all catching fire the same way, they have to know they will need to take responsibility for it sooner or later, because courts and regulatory agencies will force them to, if nothing else. So, taking responsibility up front, then getting the recall over with and out of the news, is the best action for the company in such cases. StuRat (talk) 15:37, 16 September 2016 (UTC)
- An update - demonstrating that our knowledge of this situation does change with time:
- As of today (September 15, 2016), the recall is now being announced in an official statement by the United States Consumer Product Safety Commission, and new documented information reveals "26 reports of burns and 55 reports of property damage, including fires in cars and a garage."
- Nimur (talk) 20:54, 15 September 2016 (UTC)
September 15
Compiling file information
I'm not sure of the proper term for this, so it's difficult for me to search this out. I have a large collection of files in nested folders. Those files obviously have various attributes (file size, created date, etc.) What I would like to do is to capture that information directly into a file rather than just seeing it on the Windows Explorer screen. What would that operation be called and is there a Windows 10 compatible program that does this? I would eventually want to put all this into an Excel file, but a dump to a CSV or whatever would be fine. Ideally, it would be capable of grabbing the display resolution of video files (a feat W10 doesn't seem to be able to perform). Matt Deres (talk) 00:37, 15 September 2016 (UTC)
- I would call that metadata. Much of it is in the file directory, but perhaps not all, such as video file resolutions. It would be easier to gather the directory info in Linux, just requiring a script, but still possible in Windows. StuRat (talk) 01:42, 15 September 2016 (UTC)
- The command line tool dir will probably do what you need. Here is online documentation for that tool. You might want to use the /s option, for recursion into subdirectories; you might wish to use > to output directly into a file. Examples are provided in the documentation.
- Excel should be able to import that text file, and you can use "Text to Columns" to parse it into columns.
- Surely there are hundreds of other ways to do what you want, but this approach uses tools that are built into Windows by default.
- Nimur (talk) 02:43, 15 September 2016 (UTC)
- Thank you; I will give dir a try when I'm back on my home computer. The links provided show examples of parameters on including or excluding file types and so on, but don't say much on what file attributes get returned. If I'm reading this correctly, it looks like I will only get filename, extension, and file size. Matt Deres (talk) 15:19, 16 September 2016 (UTC)
- The flag /T controls how timestamps are displayed. You can show:
- /Ta for last-access time
- /Tc for file-creation time
- /Tw for file-modification (write) time.
- The documentation and "dir" help-text might not be the most user-friendly in the world, if you haven't got 30 years of experience with Microsoft's command-line interface; so if I'm glossing over a technical detail that isn't self-explanatory, just let me know. Nimur (talk) 16:01, 16 September 2016 (UTC)
- The flag /T controls how timestamps are displayed. You can show:
- Thank you; I will give dir a try when I'm back on my home computer. The links provided show examples of parameters on including or excluding file types and so on, but don't say much on what file attributes get returned. If I'm reading this correctly, it looks like I will only get filename, extension, and file size. Matt Deres (talk) 15:19, 16 September 2016 (UTC)
- Karen's Directory Printer may be interesting. (((The Quixotic Potato))) (talk) 14:50, 18 September 2016 (UTC)
Maximum subarray problem index tracking
From Maximum subarray problem:
The algorithm can also be easily modified to keep track of the starting and ending indices of the maximum subarray.
I'm trying to work out exactly how to do that. So far I managed to figure out how to track the ending index. Here's what I have so far:
def max_subarray(A):
max_ending_here = max_so_far = A[0]
start = end = 0
for i, val in enumerate(A, 1):
max_ending_here = max(val, max_ending_here + val)
if max_ending_here > max_so_far:
end = i
max_so_far = max(max_so_far, max_ending_here)
print start, end, A[start: end]
return max_so_far
I'm at a loss as how to figure out how to track the start index. Pizza Margherita (talk) 02:59, 15 September 2016 (UTC)
- Hey Pizza Margherita,
- The maximum subarray problem article (in the External Links section) links to many implementations of the algorithm, some of which track the start index and end index.
- In particular, the "maxsumseq" and "maxsumit" implementations in the "Python" section of the "Greatest subsequential sum" page on the Rosetta Code website track the start index and end index.
- I agree that the modification to do this is not be as obvious or as "easy" as the article says.
- --DavidCary (talk) 14:29, 16 September 2016 (UTC)
- Sorry for my late response. Thank you so much! Pizza Margherita (talk) 18:58, 17 September 2016 (UTC)
RegEx
So, I'm kinda learning RegEx. I'm trying to use AWB to run a bot, and I have this:
..WikiProject Belgrade..........................
which finds {{WikiProject Belgrade|class=Start|importance=}} However, if I do one more dot it stops working, as it is more than the string on the current page. I have also disabled the "singleline" mode. Any ideas? Dat GuyTalkContribs 15:00, 15 September 2016 (UTC)
- What exactly are you trying to match? If you want to match any text within double braces that starts with the words "WikiProject Belgrade", you could use
\{\{WikiProject Belgrade[^}]*\}\}
CodeTalker (talk) 17:01, 15 September 2016 (UTC)
- Fixed already, thanks for the help anyways. Dat GuyTalkContribs 17:52, 15 September 2016 (UTC)
Problem in Android memory management
I have a phone running on Android 5.0. Since it has option to use a memory card I do, and I have set all new data like pictures etc to be directly set to memory card and not phone memory, but still reverse seems to happen - all the things I wanna go to memory card make it to phone memory, causing it to be clogged up, especially for apps etc which don't like to be sent anywhere but phone memory (BTW, can one somehow sent apps etc to memory card instead? ) But, mainly how to use memory card for things that can be sent there ? Please help. Jon Ascton (talk) 22:16, 15 September 2016 (UTC)
P.S. I have also heard of something called rooting, which is said to be a total problem-ender, how about some guidance in "rooting", if someone good soul can ?
- We have an article on rooting. Basically it means getting the equivalent of administrator rights in Windows: the ability to modify programs, system files, etc.. Before doing so, you may want to check; it might invalidate any support guarantee you had when purchasing the phone. Since phone manufacturers try to make their devices unrootable, you usually need a bit of tinkering and looking at various tech forums for your particular hardware. Of course, cynics will say it is not really "your" hardware if you cannot change its operating system.
- As for the memory card problem, without more precisions we cannot help. What steps did you take to "set all new data to be directly set to memory card"? TigraanClick here to contact me 11:51, 16 September 2016 (UTC)
- One possibility is that the memory card isn't properly seated, so it makes intermittent contact. When the memory card isn't detected, it would then revert to storing data on the phone. Try turning off the phone, removing the memory card, ensuring that the contacts on both sides are clean (wiping them with an alcohol soaked Q-tip, and allowing to dry, if needed), then reseat it. If this isn't the problem, it shouldn't hurt anything. StuRat (talk) 15:10, 16 September 2016 (UTC)
September 16
Java IDE?
My daughter is taking a class in Java programming. They are entering the source in Notepad+ (or Notepad++) and then compiling it from the command line. This way of writing programs has been obsolete for 30 years. Don't they have integrated environments for Java? If so, why is the teacher using the obsolete method? Bubba73 You talkin' to me? 04:51, 16 September 2016 (UTC)
- Well, you'd have to ask them wouldn't you? The most we can do is speculate, which I'm sure you could do yourself? Maybe as a skill it's more transferable than learning any one particular IDE? Maybe they think learning to compile from the command line is useful? Maybe they are lazy? Maybe they are stupid? Maybe there are IDE licensing fees the institution doesn't want to pay? Vespine (talk) 05:43, 16 September 2016 (UTC)
- My daughter doesn't want me to embarrass her by asking the teacher while she is in the class. Bubba73 You talkin' to me? 06:17, 16 September 2016 (UTC)
- The are a number of very good free IDEs. For example, Netbeans. Ruslik_Zero 08:56, 16 September 2016 (UTC)
- Or Eclipse and IntelliJ IDEA. In my experience, these three are the most commonly used Java IDEs. When I was in college, we used DrJava and were encouraged to avoid full-featured IDEs until we were comfortable hand-coding and compiling. clpo13(talk) 15:55, 16 September 2016 (UTC)
- The are a number of very good free IDEs. For example, Netbeans. Ruslik_Zero 08:56, 16 September 2016 (UTC)
- My daughter doesn't want me to embarrass her by asking the teacher while she is in the class. Bubba73 You talkin' to me? 06:17, 16 September 2016 (UTC)
- Many programmers, in particular on Unix/Linux, prefer separate command line tools and sophisticated text editors instead of IDEs. Apparently this is less common on Windows: Integrated development environment#Attitudes across different computing platforms. It seems that Notepad++ is quite sophisticated too. PiusImpavidus (talk) 09:58, 16 September 2016 (UTC)
- For a first learning experience it is probably better to start with simple command line compilation and separate text editors, as the concepts will then become clear in the students minds, rather than some do-it-all gui. Graeme Bartlett (talk) 11:53, 16 September 2016 (UTC)
- Agreed. Also, command line compilers and linkers often have options that are not available from menu-based systems. Of course, typing all that in manually is a pain, so having a compile and link script, which you can edit when changes are needed, is the way to go there. You can then add comments like "Comment out this module and uncomment the next module to...". StuRat (talk) 15:45, 16 September 2016 (UTC)
- (1) Yes, several integrated development environments (IDEs) exist for Java, as Ruslik mentioned, many of them listed on the Category:Java development tools page.
- (2) "This way of writing programs has been obsolete for 30 years." Really? Does any WP:RELIABLE source support this statement, or is this simply an appeal to novelty?
- (3) Why? Many teachers claim that it is better for students to start to program with a simple text editor and a command-line compiler (rather than an IDE), even teachers who think IDEs are awesome and should be used all the time (except when initially learning programming). [2][3][4][5][6][7][8][9][10][11][12][13]. --DavidCary (talk) 15:49, 16 September 2016 (UTC)
- For (2) I went to an IDE slightly more than 30 years ago and I never went back; and I don't know anyone who did. Bubba73 You talkin' to me? 20:04, 16 September 2016 (UTC)
- I understand (and I'm not an expert) that this has been called "hipster" software development. Blythwood (talk) 03:35, 17 September 2016 (UTC)
- For (2) I went to an IDE slightly more than 30 years ago and I never went back; and I don't know anyone who did. Bubba73 You talkin' to me? 20:04, 16 September 2016 (UTC)
Unlocking LG-C395 over USB
Somebody bought the entitled model number mobile phone from America, it needs to be unlocked. A USB wire came with it, so I wonder, if I could unlock it myself, with some of wikipedians assistance. What do I do?; a step by step guide is beneficial… 103.230.106.1 (talk) 11:38, 16 September 2016 (UTC)
- Some repairers say that if a blocked 'phone is brought to them they will hand it in to the police. It may be that this is an illegal operation, in which case we wouldn't be able to help. 78.146.219.18 (talk) 11:54, 16 September 2016 (UTC)
- Unblocking a phone is fairly different from unlocking. Unlocking normally refers to remove restrictions the supplier of the phone has place on what network SIMs can be used in the generally subsidised phone. In many countries it's not illegal (although this isn't legal advice) and in fact suppliers may be required to provide you unlock codes either for free after a certain time or for a resonable cost. If the subsidised phone came with a contract, you'd generally have to keep the terms of that contract, but that generally just means staying on the network for a certain time with some phone, or no phone, the main thing the network wants is for you to pay your bill. Unblocking generally refers to trying to prevent a phone that's been blocked on the network, probably because it was reported stolen. (Although I think some networks also block phones which they believe are fakes etc.) This normally requires changing the IMEI and is obviously more legally dubious. However it isn't normally needed when you've taken a phone to another country anyway as most blocks at most only apply within one country although I believe there is a EU wide blacklist. (Getting international agreements on blacklists are complicated since you have to figure out what happens for example when someone in Malaysia finds their phone was falsely reported as stolen in Brazil.) With modern smartphones in particular, they may have a "kill switch" which when activated which can happen remotely, will try to brick the phone. Trying to fix this device will probably simply be referred to as unbricking. Nil Einne (talk) 13:02, 16 September 2016 (UTC)
- Copied from WT:RD. Nil Einne (talk) 12:39, 16 September 2016 (UTC)
September 17
Nuisance in windows
I have been forced to use Windows 10 after buying an HP Pavilion, but I had this problem also in Windows 7. It concerns the IE browser (Microsoft Edge?). Almost every time I open it and begin to read news a strange geometric figure appears It consists of two black triangle one pointing up, the other down with a dot between them. Sometimes they are encircled with a ring. After that the text begins to float up and won and it is hard to control it and the whole thing forces me often to close the browser. I cannot find a place in Control Panel to get rid of this "innovation." How to remove it? Thanks, - --AboutFace 22 (talk) 18:30, 17 September 2016 (UTC)
- Did you by any chance press the mouse wheel ? This puts the mouse into a mode where it scrolls the screen based on how you move the mouse relative the the position of the symbol. To turn it off, just press the mouse wheel again. Not sure how to disable it permanently, but something in the mouse settings might do that. Of course, now that you know how to turn it off, it may not be such a problem anymore. I sometimes find it useful. For example, you can set it to scroll the text window slowly enough that you can read the text as it scrolls. StuRat (talk) 18:57, 17 September 2016 (UTC)
Thank you Stu. You are always on top of the game :-) --AboutFace 22 (talk) 22:27, 17 September 2016 (UTC)
September 18
Create an exact copy of an object in JavaScript
Stack Overflow's answers to the question "How do I clone an object in JavaScript?" are unsatisfactory. All posts asking that are marked as duplicates of these two questions and the top answers for them do not come close to creating full copies of objects (the JSON solution drops functions or use jQuery which also drops parts and is unacceptable for other reasons). All I'm looking for is a way to create an exact copy of an object in a way that is used like
var CopyObject = Clone(OriginalObject);
. The code doesn't have to be short, but it shouldn't use jQuery or require including external JavaScript code. Can anyone solve this? — Melab±1 ☎ 16:49, 18 September 2016 (UTC)