Wikipedia:Reference desk/Archives/Computing/2020 May 31

= May 31 =

Opening laptop for cleaning and warranty
One of my fans started to do some noise when the comp is idle, it's possibly dust since I once had to service the machine for such an issue in the past. I was planning to bring it to a local computer shop, however isn't this against the warranty not having ASUS specifically repair the machine? It's an Asus Zephyrus 701. Don't really feel not having the machine for three weeks if I go the RMA route... Thank you for your input! Yes I know a layman could open and dust, but I'd rather have someone qualified. Me and manual labor... :o Raskssinger (talk) 01:19, 31 May 2020 (UTC)
 * Without having access to the warranty documentation that came with your specific laptop, we really couldn't say definitively. This global warranty card for most of their machines suggests that the warranty is only good for up to a year but maybe yours is different.  The warranty doesn't provide an allowance for third-party repair and specifically says they won't fix any trouble caused by third-parties.  "This Warranty does not include failure caused by improper installation, operation, cleaning or maintenance, accident, damage, misuse, abuse, non-ASUS modifications to the product, any third party software programs, normal wear and tear or any other event, act, default or omission outside ASUS’ control."
 * This owner's manual (do you have the GX701? Because that's what I'm finding results for) includes directions on how to clean it. Do NOT vacuum it.  Ian.thomson (talk) 01:45, 31 May 2020 (UTC)
 * In the US, the Magnuson–Moss Warranty Act specifies that they cannot void your warranty for opening your case, but that anything you break is on you. Manufacturers often add "warranty void if removed" strikers on items, but that doesn't change the law. (BTW, does anyone know whether there are similar laws for the UK, EU, and/or AU/NZ)? --Guy Macon (talk) 06:17, 31 May 2020 (UTC)
 * To be clear none of this is legal advice. But there isn't any requirement that manufacturers can't void your warranty in silly ways in NZ AFAIK. However the Consumer Guarantees Act provides rights for purchases of goods in a number of circumstances (e.g. pretty much any good purchased from a company in NZ except for commercial products) that cannot be contracted out of or excluded except in certain cases for transactions between businesses. This includes the requirement that goods be of "acceptable quality" and "fit for purpose". [//www.consumerprotection.govt.nz/general-help/consumer-laws/consumer-guarantees-act/] [//www.legislation.govt.nz/act/public/1993/0091/latest/DLM311053.html] [//communitylaw.org.nz/community-law-manual/chapter-24-consumer-protection/automatic-guarantees-when-buying-from-a-business/buying-goods-automatic-guarantees/]  The general interpretation of the CGA is it covers pretty much any situation where a standard warranty applies, and more. Therefore even if your warranty is technically "void" because of some modification or whatever, your are still entitled to the same or actually greater, protections than you were offered by the warranty. Of course this doesn't stop companies trying, and many feel enforcement action against retailers is often weak [//www.geekzone.co.nz/forums.asp?forumid=50&topicid=201354] [//www.geekzone.co.nz/forums.asp?forumid=95&topicid=198179] [//www.geekzone.co.nz/forums.asp?forumid=50&topicid=210345] [//www.stuff.co.nz/business/109375130/noel-leeming-fined-200000-for-misleading-customers] [//www.odt.co.nz/business/retailers-face-big-fines-over-extended-warranty-sales] [//www.mcveaghfleming.co.nz/articles/heavy-fines-given-to-retailers-for-misleading-consumers]  It's my understanding that the Australian Consumer Law was partly modeled on the law in NZ and other jurisdictions with similar laws and therefore has similar protections. [//www.accc.gov.au/consumers/consumer-rights-guarantees] [//www.choice.com.au/shopping/consumer-rights-and-advice/your-rights/buying-guides/know-your-consumer-rights] So at a minimum, the situation there is similar i.e. even if your warranty is "void" you are likely still entitled to the same protections.  Nil Einne (talk) 14:23, 31 May 2020 (UTC)
 * It had better not be legal advice, as the header on this page states: Do not edit others' comments and do not give any medical or legal advice.
 * I live in AU, which has similar protections. I was thinking of writing about them, but the issue here (dust) doesn’t sound like it would be covered. Unless it turns out it’s not dust? Brianjd (talk) 14:28, 31 May 2020 (UTC)
 * I'm aware of that, I'm a strong advocate against providing legal advice on Wikipedia and have removed responses for violation the guidelines. But this and other history has shown a large number of people do not read it. Therefore I always make personal disclaimers to try and prevent misinterpretation by any readers. I don't think anyone is suggesting that an accumulation of dust will generally be something that a manufacturer has to repair. (In some circumstances it's possible they may need to, but this wasn't the point of the discussion as I understood it.) The question is whether manufacturer can void your warranty if you open the device or bring it to a third party to clean the dust for you. Based on reading a lot on this in various sources in the past, like those I linked, my understanding is that in NZ maybe they can void your warranty in such circumstances. However they will still have to offer you pretty much the same protections even without you warranty.  Therefore if you device later develops a fault, they cannot claim that because you opened it, or got a third party to clean the dust or whatever, they don't have to repair or replace it; unless they can pinpoint how you or the third party damaged the device when doing so causing it to develop this fault. (I believe the situation in Australia is similar although this is mostly based on some very minor reading in the past, combined with the fact it's my understanding that it's similar to the CGA.)  It may not even be "later developed". If your fan is making noise, or your device is overheating, cleaning the dust yourself to try and fix the issue may very well be a reasonable first step. If it turns out this doesn't fix the problem, it may very well be an issue the manufacturer or retailer is required to remedy. If they're going to turn around and claim they don't have to because you opened it even though you didn't contribute to the problem, this is likely to be very annoying to say the least.  Nil Einne (talk) 15:13, 31 May 2020 (UTC)

Because, once again, someone posted "It had better not be legal advice, as the header on this page states: Do not give any medical or legal advice", I am, once again. posting medical and legal advice. Please note that I did not bring up the topic, but that I am allowed to respond when someone posts incorrect information to the refdesks.

There are some who believe that Wikipedia has a policy against giving medical, legal, and business advice, but no such policy or guideline exists. (If you are about to cite the reference desk guidelines, or anything in an infobox at the top of a page, please read WP:LOCALCON and then show me where the Wikipedia community approved them).

Here is some medical advice: Don't do crystal meth. It will screw up your health. Don't bother asking a doctor if crystal meth is good for you. It isn't. (medical disclaimer.)

Here is some legal advice: Don't do crystal meth. It is likely to get you arrested. Don't bother asking a lawyer if crystal meth is illegal. It is. (legal disclaimer.)

Here is some professional advice: Don't do crystal meth. It will use up all of your money and is likely to get you fired. Don't bother asking a certified financial planner if becoming a meth addict is good for your finances. It isn't. (general disclaimer.)

There. I just provided medical, legal, and professional advice, and while I did make a point, I did so without being disruptive.

Feel free to report my behavior at WP:ANI if you believe that I have violated any Wikipedia policy or guideline.

The actual rule is that context matters. If you are about to advise someone to drink bleach, that is medical advice that isn't allowed on Wikipedia. If you want to tell people not to drink bleach or to say that crystal meth is bad for your health, that is medical advice that is allowed on Wikipedia.

BTW, here is some more free advice: In my opinion food poisoning, terminal cancer and AIDS are even more effective methods of weight loss than doing crystal meth, so if you really want to shed those pounds why not try all four at the same time?(In case anyone missed it, that was a joke.) More advice: don't get your medical advice from an electronics engineer. --Guy Macon (talk) 16:25, 31 May 2020 (UTC)

There is really nothing much to "dusting out" a computer. Get some gas duster (often inaccurately called "canned air") and blow it around inside. Free tip: wear gloves or wrap a towel around the can, as it will get cold due to the expanding gas. You don`t want to use a vacuum, feather duster, etc., because this can cause static electricity build-up, which can damage components. If the noise persists, it's probably just the fan bearing wearing out. The fan may be user-replaceable, depending on what kind of fan it is. You will need to refer to the manual for that. (It's probably available on the ASUS website.) --47.146.63.87 (talk) 22:49, 31 May 2020 (UTC)
 * Oh, a tip to possibly avoid wasted time: if you haven't, assuming you're on Windows, when the noise is present, open Resource Monitor and ensure the system is actually idle (nothing churning CPU cycles in the background). Make sure you're viewing processes from all users, which requires administrator access. You could also install system monitoring software to view the internal temperatures. It's a good idea to double-check that it's not actually the system running hot before going off on a wild goose chase about fans. You should still dust out your computer periodically in any case. --47.146.63.87 (talk) 10:10, 2 June 2020 (UTC)

Perl array variable loop index
In Perl, is it possible to use an array element as the index of a for loop? NOT Can I use a variable to index an array.

Having created @ary, I have tried for ${ary[2]} ( 1..5 ) { ... } but it won't compile.

What I actually want is for ${ary[$ix]} ( 1..5 ) { ... } Can it be done? — Preceding unsigned comment added by SGBailey (talk • contribs) 10:42, 31 May 2020 (UTC)
 * I’m not familiar with Perl, but I just had a quick look at some documentation, and it looks like the answer is no. In fact, as far as I can remember, no language that I have used (C, BASIC, MATLAB, Pascal, JavaScript, Bash) allows you to do this. Brianjd (talk) 11:56, 31 May 2020 (UTC)
 * My brain is obviously not working properly today. Brianjd (talk) 13:19, 31 May 2020 (UTC)
 * Of course you can use the  form for C and JavaScript, at least, but that’s different to the Perl example above. So let’s look at the for...in form in JavaScript. I don’t ever remember ever seeing a loop like:
 * I really expected it to fail. And the visual editor I used to type this reply didn’t like it. But it ran fine in my browser console. So perhaps it is possible in Perl too. We’ll need to investigate further. Maybe it’s time for someone else to take over. Brianjd (talk) 13:39, 31 May 2020 (UTC)
 * Just had a quick play with Perl and it looks like OP is right: you can’t do that. But you can use a so-called “C-style” loop:
 * Brianjd (talk) 13:58, 31 May 2020 (UTC)
 * Alternatively, you can use another variable:
 * Hopefully that answers your question. Brianjd (talk) 14:02, 31 May 2020 (UTC)
 * I put the curly braces in because for $ary[2] ( 1..5 ) { failed and It was a wild stab to see if I could persuade perl to use an array element as the index. -- SGBailey (talk)

Thanks - I'll probably go with the extra my variable. -- SGBailey (talk) 15:09, 31 May 2020 (UTC)

As always we should keep the XY problem in mind. What are you trying to accomplish? Typically in Perl you just loop through an array directly:  If you want a subset of the array elements, the phrase people usually refer to this by is "array slice" or "slicing an array". For instance, to grab the zeroth through fourth elements (remember, numbering starts at zero):    is the range operator. C-style loops with an index variable are possible but usually not necessary. If you're doing more complicated things, you can manually hack up a bunch of fancy stuff using arrayrefs and all that, but typically you just want to use a CPAN module that does what you want. Not knowing your level of Perl experience, I'll remind you to always. If you're new to Perl this is a great tutorial. --47.146.63.87 (talk) 23:20, 31 May 2020 (UTC)
 * You’ll probably want to check this reply too; it sounds like it was written by someone who actually knows Perl. Brianjd (talk) 01:41, 1 June 2020 (UTC)
 * This IS NOT what I was trying to do. THIS indexes through an array. I want to use an array element to index through something ELSE. Thanks anyway. -- SGBailey (talk) 09:18, 1 June 2020 (UTC)
 * Everyone understands this already. That’s exactly the point. You are trying to do something weird, and we want to know why. Perhaps you don’t need to use an array element to index through another array to begin with. Brianjd (talk) 11:55, 1 June 2020 (UTC)
 * Yeah, I'm scratching my head as to why you'd want to do this. Why do you need to index into an array to begin with, and why is the index inside another array? I mean, in a sense it's not wrong as long as it works, but I suspect there's a better way to do what you want to do. What's in these arrays? One guess I have is you're trying to duct-tape together a more complex data structure, like a multidimensional array. If you can show code context, we can probably give better suggestions. I'm not sure I'd quite call myself a Perl expert, but I have some experience. --47.146.63.87 (talk) 15:04, 1 June 2020 (UTC)


 * XY problem question aside, I'd love to hear from a perl guru about the precise mechanics which prevent an array element from being used as the variable of a foreach loop. My hunch is that it is due to scoping issues.  See https://perldoc.perl.org/perlsyn.html#Foreach-Loops :
 * If the variable is preceded with the keyword my, then it is lexically scoped, and is therefore visible only within the loop. Otherwise, the variable is implicitly local to the loop and regains its former value upon exiting the loop.
 * I suspect either scoping mechanism breaks (at least as it is applied in a foreach loop) when applied to a specific array element, much as how  works, but   generates a syntax error.  Arguing against this is that the explicitly local   does work, hence my parenthetical. -- ToE 20:13, 1 June 2020 (UTC)
 * It's because it's a syntax error. In,   has to be a scalar variable. It says that somewhere on that page but I don't blame you for not seeing it; the official Perl docs are a bit of a hot mess. In  ,   is an array variable even though you're telling Perl to evaluate it in scalar context; if you use that as an l-value (which is what's done in  ) it assigns to the zeroth element of  . This is why   is legal. Scalar and array variables "live separately" and don't collide, and the scalarness/arrayness of a variable is permanent. (That's why you have to specify that with $/@ when declaring.)  --47.146.63.87 (talk) 22:21, 1 June 2020 (UTC)
 * Oh also, want to know why  in your example works? Unless you're familiar with Perl I guarantee it's not doing what you think. Deep breath: it declares a new global array   and assigns 5 to the zeroth element. Yes, global. Look at the doc for the   function.   takes any expression as argument. It evaluates to just  . This is a syntax error under , which is why you want to always use it for "serious" code unless you're insane. (Add   and see. It will give a compile error.) Compare this (no  ):  . Within the block, a new   is declared with local scope, which shadows the global  .   is illegal because   has different syntax:   where stuff in  is optional. So it tries to declare a scalar   but then assign to it as an array, which is illegal. --47.146.63.87 (talk) 01:43, 2 June 2020 (UTC)
 * Self-correction on re-reading:  actually doesn't declare. It just assigns. Without , variables are auto-instantiated when first referred to if they haven't been instantiated. That's why it works; Perl goes to assign to  , sees that the array   doesn't exist, creates it silently, and then assigns to the zeroth element. A VARLIST only allows assignment-on-instantiation, which is why it errors. Sorry, that would have confused you if you closely followed my wording. --47.146.63.87 (talk) 04:18, 2 June 2020 (UTC)


 * While on wording, I'd nitpick your earlier "array ... in scalar context", as that is not the proper terminology to describe an array element, but is instead used to describe exactly what it says. An array in a scalar context returns the number of elements in the array whether the scalar context is forced, as in , or natural, as in.


 * Yes, the  syntax error is largely a red herring.  Thanks.


 * And yes, as perldoc local says, You really probably want to be using my instead, because local isn't what most people think of as "local". Though I am confused as to why local's syntax is   an not   in parallel with , but I don't recall ever needing to use   in the limited Perl I've coded.


 * And I do agree that the simplest answer to SGB's question is: No, it is not permitted because it violates the syntax which calls for:
 * where  is a scalar variable.
 * where  is a scalar variable.


 * But more can be said about why the foreach syntax requires a scalar variable instead of also permitting scalar l-values such as array and hash elements. That wouldn't be a particularly useful feature, but it isn't as if the perl compiler was written to exclude the possibility of doing things in unusual and sometimes bizarre ways.  And I think a clue lies in the scoping of  .  This:


 * prints 7, and no amount of expressed scoping via braces or  or   is going to get it to print 3.  The foreach   is always local to the foreach itself, so if somehow an array element could be used for that purpose, it would have no relation to an identically named array instantiated outside the foreach, and the foreach's block couldn't access that earlier array.  My suspicion is that the foreach   may not even be instantiated in the stanadard way a scalar variable is, but I've never looked under the hood. -- ToE 15:25, 2 June 2020 (UTC)
 * You're correct; I worded that wrong. The Perl tutorial I linked earlier explains it well: the value stored in the array element is a scalar.  was added in Perl 5. I suspect that's why the syntax differs, since I believe   was added to facilitate more sane and structured programming. (There are a lot of horrors in circa-'90s Perl code from before "always use strict" became widely accepted in the Perl community.) One common neat little trick is using something like   in a block to temporarily change the input field separator, which lets you easily do things like slurp a whole file into a variable. See perlvar for examples. I think you're probably right about how the interpreter handles loop variables. My guess is it's simpler and more efficient to just decree that only scalars are allowed. That means Perl can just verify that at compile time and the interpreter code for loop constructs can just assume it's assigning to a scalar. --47.146.63.87 (talk) 03:22, 3 June 2020 (UTC)
 * Thanks, and thanks for your above linking of "Learn Perl in about 2 hours 30 minutes". -- ToE 10:19, 3 June 2020 (UTC)
 * No problem. #perl on Freenode is a good place for Perl beginners. The qntm tutorial is one linked from their associated list of tutorials. --47.146.63.87 (talk) 23:58, 3 June 2020 (UTC)

Video editing
Hi! What software can be used to make a video with moving pictures like this: https://www.youtube.com/watch?v=305OOQGc2yY. Thanks! 1.55.250.61 (talk) 19:33, 31 May 2020 (UTC)
 * Note: I have repaired the broken link. You could not post it here because of our "shortener blacklist" which denies the youtu.be domain name. youtube.com works fine. Elizium23 (talk) 23:02, 31 May 2020 (UTC)