Jump to content

Wikipedia:Reference desk/Computing

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by 2606:a000:1126:28d:8095:bb24:f64a:e5fc (talk) at 03:21, 26 February 2020 (Problems using the wikipedia dump bz2 file: new section). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Welcome to the computing section
of the Wikipedia reference desk.
Select a section:
Want a faster answer?

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.
See also:


February 18

What is the problem with this tic-tac-toe game code?

Here is the relevant code:


#!/usr/bin/env python3

if __name__ == '__main__':

    def check_board_fullness(board):
        for item in board:
            if board[item] == ' ':
                return False
            return True
    
    #Creates the board
    board = {'top-L': ' ', 'top-M': ' ', 'top-R': ' ',
                'mid-L': ' ', 'mid-M': ' ', 'mid-R': ' ',
                'low-L': ' ', 'low-M': ' ', 'low-R': ' '}
    def print_board(board):
        print(board['top-L'] + '|' + board['top-M'] + '|' + board['top-R'])
        print('-+-+-')
        print(board['mid-L'] + '|' + board['mid-M'] + '|' + board['mid-R'])
        print('-+-+-')
        print(board['low-L'] + '|' + board['low-M'] + '|' + board['low-R'])
        
    #Function to quit
    def end(move):
        if move == 'quit':
            raise SystemExit
        
    #Function to check if any player has won
    def check_winner(board):
        win_conditions = [
             ['top-L', 'mid-L', 'low-L'],
             ['top-M', 'mid-M', 'low-M'],
             ['top-R', 'mid-R', 'low-R'],
             ['top-L', 'top-M', 'top-R'],
             ['mid-L', 'mid-M', 'mid-R'],
             ['low-L', 'low-M', 'low-R'],
             ['top-L', 'mid-M', 'low-R'],
             ['top-R', 'mid-M', 'low-L']]
        for condition in win_conditions:
            if condition[0] == 'X' and condition[0] == condition[1] == condition[2]:
                return 'X'
            if condition[0] == 'O' and condition[0] == condition[1] == condition[2]:
                return 'O'
            else:
                return False

    turn = 'O'
    while check_board_fullness(board) == False:
        while check_winner(board) == False:
            print_board(board)
            print("It is now",turn,"'s turn to make a move. What is your move?: ")
            inp = input()
            if inp in board and board[inp] == ' ':
                board[inp] = turn
                if turn == 'O':
                    turn = 'X'
                if turn == 'X':
                    turn = 'O'
            else:
                print("That's not a valid move!\n")
                inp = input("Please make another move: ")
                if turn == 'X':
                    turn = 'O'
                if turn == 'O':
                    turn = 'X'
    if check_winner == 'X':
        print("X wins!")
    if check_winner == 'O':
        print("O wins!")
    if check_board_fullness(board) == True and check_winner(board) == False:
        print("It's a tie!")

The main problem with this code that I can see is that it doesn't actually switch the turn from 'O' to 'X' once 'O' actually makes a move. Why exactly is this the case? 68.96.93.207 (talk) 03:06, 18 February 2020 (UTC)[reply]

I think the problem is here:

if turn == 'O':

 turn = 'X'

if turn == 'X':

  turn = 'O'

if turn is O it changes it to X, but the next statement turns X back to O. Bubba73 You talkin' to me? 03:24, 18 February 2020 (UTC)[reply]

I got it; basically, I wrote "if" the second time whereas I was actually supposed to write "elif" (short for "else if") the second time. Thank you! Futurist110 (talk) 22:25, 21 February 2020 (UTC)[reply]

It's slightly controversial but I favor using interactive debuggers to analyze this type of problem. Python comes with a semi-useful one called "pdb", and if you use an interactive development environment (IDE), it might have a debugger of its own. There are various ways you can simplify (refactor) that code as well and it's worth spending some time on that. 2601:648:8202:96B0:0:0:0:7AC0 (talk) 05:50, 18 February 2020 (UTC)[reply]

You're mixing code with your functions and functions should be placed before if __name__ == '__main__': line.
Sleigh (talk) 08:39, 18 February 2020 (UTC)[reply]

I'm pretty sure that condition[0] == condition[1] == condition[2] is not going to do what you expect. It's not going to compare three things and evaluate to "true" if they're all the same. Rather, it's going to evaluate the equality of [0] and [1], and the compare "true" or "false" to [2]. (Or maybe the other way around, compare [1] to [2] first; I don't know how the precedence will go here.) Or is Perl unusual in this regard? Anyway, it's safer and easier and faster simply to say condition[0]=='X' and condition[1]=='X' and condition[2]=='X'. --jpgordon𝄢𝄆 𝄐𝄇 23:39, 18 February 2020 (UTC)[reply]

Regarding the chained comparison (is not going to do what you expect), Python has special handling for chained comparisons: "Comparisons can be chained arbitrarily, e.g., x < y <= z is equivalent to x < y and y <= z". So
>>> 3 == 3 == 3
True
but
>>> 3 == (3 == 3)
False
-- Finlay McWalter··–·Talk 10:51, 19 February 2020 (UTC)[reply]
Wow. Didn't know that one. Still, morally unsafe...I'll shut up now. --jpgordon𝄢𝄆 𝄐𝄇 15:29, 19 February 2020 (UTC)[reply]
The behaviour you describe comes from C, and many post-C languages (including C++, Java, and it would seem Perl) inherited that thinking, I suspect without really considering there's much of an alternative. Haskell works (parses) similarly, but at least has the good grace to fail (because it refuses to silently coerce an integer to a boolean oops, a boolean to an integer). But mathematicians have been doing it the other way for centuries, so it's not obviously wrong. Python has traditionally been quite a bit more agressive about deciding to do things its way, rather than aping C syntax in a decidedly non-C language (and in general, learning Python from a C-ish background, one has to break onesself of a range of C-ish mindsets to write clear, ideomatic Python). So really, for the Python programmer, it's something of a shibboleth - if a < b <= c makes one's brain itchy, one is still thinking in C. -- Finlay McWalter··–·Talk 17:47, 19 February 2020 (UTC)[reply]

Skype's cloud storage

It seems that the inability to delete own Skype conversation persists since 2017, as I still get "some selected messages cannot be removed" on my laptop, Windows 10. I also have some privacy concerns since the calls are stored on a cloud server for 30 days. Is there anything to do about it? Brandmeistertalk 10:45, 18 February 2020 (UTC)[reply]

If you want to delete it locally, you can close Skype, find where it stores its data and open up the database. Every line of conversation is a row in one of the tables. Might also be in multiple tables, I don't remember. No idea how to delete it in the cloud. I suspect it's possible that it will come back if the other conversation member doesn't do the same thing in his Skype db. 89.172.57.225 (talk) 22:21, 18 February 2020 (UTC)[reply]

Snapchat filters

The Snapchat article describes the concept of a "filter" as something different than what I have heard it is. It seems the article should mention putting cat ears on people and that sort of thing. However, I'm not sure what to use as a source or how it would be described.— Vchimpanzee • talk • contributions • 21:45, 18 February 2020‎ (UTC)[reply]

You can always keep it in scare quotes. That's what I usually do when dealing with "social" "media". 89.172.57.225 (talk) 22:22, 18 February 2020 (UTC)[reply]
@Vchimpanzee: I think that is covered by "Snaps can be personalized with various forms of visual effects", but you should start a discussion on the article's talk page if you have ideas for improvement. RudolfRed (talk) 22:23, 18 February 2020 (UTC)[reply]
I'm not convinced those words are enough to communicate the idea.— Vchimpanzee • talk • contributions • 23:00, 18 February 2020 (UTC)[reply]
What's wrong with filter? In image processing (and for that matter in data processing in general), a filter can do pretty much anything to its data, including adding cat ears. --jpgordon𝄢𝄆 𝄐𝄇 03:49, 19 February 2020 (UTC)[reply]
Jpgordon, that is an overly liberal definition of the word. By analogy from real-world items, such as a water filter or a camera lens filter, these are items which take a certain input and remove or add some elements to the output, for an overall subtle change, in most cases. A filter operates on the whole input by default. So, no, if I wanted to add cat ears to someone in a film camera, I would not attach a "cat ears filter" to the lens, I would draw them on in the darkroom. A "visual effect" is a very good description of such a process, and drawn from the film industry where visual effects can consist of scale models, background matte paintings, or CGI animations. (None of those are filters.) — Preceding unsigned comment added by Elizium23 (talkcontribs) 05:09, 19 February 2020 (UTC)[reply]

As an interesting aside, for Snapchat filters refers to things which apply a static effect to an image. E.g. text, colour effects etc [1]. Lenses refers to the AR style effects which operate on elements of the image [2]. However, as can be seen from this e.g. [3], Snapchat lenses are still called filters, as are AR style effects for other companies [4] [5].

@Elizium23: It's not overly liberal since it's the way the word is used in modern times. See for example Filter (software), Filter (video), Email filtering, or [6] [7]. As always, it's a Etymological fallacy to assume just because a word means something in some older contexts, it must mean the same thing in other newer contexts. Languages evolves and adapts.

BTW Snapchat and other such images filters do operate on the whole input. They just selectively detect and modify certain components. Many such filters are able to detect multiple faces, and will apply the same effects to all human faces detected. Some can even detect cat and dog faces.

While it's true it's not really possible to do such things with traditional filters, the idea that their change is subtle or affects the whole image isn't true anyway. For example, the effects of filters on these images is clearly not 'subtle' [8]. Meanwhile, if you imagine a darkened room with two lights, one with a very wide spectrum including in the infrared or UV and one with a narrow spectrum, if you apply a UV or IR selective filter when photographing those lights one light could very well look very similar with or without the filter (depending on the film and how you process it), one light may disappear. Then of course there is significant interest in developing selective filters for various liquid separation and processing e.g. [9] [10]/[11].

Note also I used both words earlier. The result can reasonably be called a visual effect, but it's a visual effect applied by a filter.

Nil Einne (talk) 11:16, 19 February 2020 (UTC)[reply]

February 19

Best peripherals for osu!

I have heard a graphics tablet is the best peripheral for the music software osu! but they are really expensive so is there a cheaper alternative for osu! that works just as well or better then a graphics tablet — Preceding unsigned comment added by 71.241.214.63 (talk) 01:00, 19 February 2020 (UTC)[reply]

I found graphics tablets for $60-$120.00 so, no, get a graphics tablet. Elizium23 (talk) 05:03, 19 February 2020 (UTC)[reply]

How does Windows 10 Quick Access work?

Specifically, how does it decide what files and folders to list in the "recent files" and "recent folders" lists? It regularly fails to list files that I've opened recently (and need to open again), while listing others that I accessed less recently. Iapetus (talk) 09:55, 19 February 2020 (UTC)[reply]

I can open and/or save a file in a given program (e.g. Excel), and it still won't be listed in Quick Access "recent files". Iapetus (talk) 09:47, 20 February 2020 (UTC)[reply]

Single quotes in filenames and bash

In bash, what's the proper way to get for file in *.webm; do echo "ffmpeg -i '$file' -c:a copy '${file%.webm}.ogg'"; done | xjobs -j 64 to stop choking on filenames that contain a single quote? 100.2.177.74 (talk) 16:59, 19 February 2020 (UTC)[reply]

I don't know if there is a proper way, but you could try this:
for file in *.webm; do ffile=`echo $file | sed 's/./\\\&/g'`; echo "ffmpeg -i $ffile -c:a copy '${file%.webm}.ogg'"; done | xjobs -j 64
I can't try this out myself; I don't know what xjobs does. Note that I have left out the single quotes surrounding $ffile.  --Lambiam 21:30, 19 February 2020 (UTC)[reply]
Maybe the occurrence of '${file%.webm}.ogg' also needs to be replaced by ${ffile%.webm}.ogg.  --Lambiam 21:44, 19 February 2020 (UTC)[reply]
First of all, we can simplify this by stripping some of the quotes. for file in *.webm; do echo ffmpeg -i "$file" -c:a copy "${file%.webm}.ogg"; done | xjobs -j 64
However, this does not work for all filenames (particularly those with a space), because the echo gets in your way. I think the way to perfectly solve this is to have the shell open the files and pass them using /dev/fd. Because it's clear that you are trying to build some command lines to be evaluated ultimately by xjobs and honestly, that's a quoting nightmare that you can't get right when you're relying on the shell and echo like this. The other thing would be to bring this into perl or python where you'd make short work of the regexps and string massaging. Elizium23 (talk) 22:24, 19 February 2020 (UTC)[reply]
Here we go, I knew there should be a way to do it in modern bash.
for file in *.webm; do ogg="${file%.webm}.ogg"; echo ffmpeg -i "${file@Q}" -c:a copy "${ogg@Q}"; done | xjobs -j 64
I tested this on files with spaces, files with single quotes, and various other things. The "@Q" parameter tells bash to quote the argument with proper escaping so that it can be re-used somewhere else. (You may be able to dispense with most of the double quotes.) Elizium23 (talk) 23:49, 19 February 2020 (UTC)[reply]
Yes thanks! That's exactly what I was looking for. Also, xjobs is a SMP-focused fork of xargs, I'd forgotten it's not standard, sorry. 100.2.177.74 (talk) 21:26, 20 February 2020 (UTC)[reply]

Office 2019 PowerView in Excel, use Microsoft example database - OlympicMedals

Hi, We are trying to get the image source linked into our example database for Educational purpose.

We tried to use other image source and it is working no problem. With wikimedia.org images it still don't show up.

The database as been done by Microsoft (https://support.office.com/en-us/article/tutorial-import-data-into-excel-and-create-a-data-model-4b4e5ab4-60ee-465e-8195-09ebba060bf0) a while ago for education. They have linked images like those list here:

/media/wikipedia/commons/thumb/e/eb/Ice_hockey_pictogram.svg/200px-Ice_hockey_pictogram.svg.png

/media/wikipedia/commons/thumb/1/12/Jeu_de_paume_pictogram.svg/200px-Jeu_de_paume_pictogram.svg.png

/media/wikipedia/commons/thumb/f/fa/Judo_pictogram.svg/200px-Judo_pictogram.svg.png

/media/wikipedia/commons/thumb/2/24/Equestrian_pictogram.svg/200px-Equestrian_pictogram.svg.png


The Excel Software is connecting to wikimedia server to dynamicaly download the thumbnail to show it in the PowerView Report.

Do you have any ideas if Wikimedia is bloking the image download for other client except Web Browser?. — Preceding unsigned comment added by Pouellette2 (talkcontribs) 17:20, 19 February 2020 (UTC)[reply]

February 20

Geek Squad Protection/Dell Warranty

Do any of these warranties cover missing keyboard keys? --Thegooduser Life Begins With a Smile :) 🍁 02:38, 20 February 2020 (UTC)[reply]

I don't know, but I have a funny story. When my daughter was a child, she pulled the arrow keys off my keyboard. Why? She said that she didn't need them! Bubba73 You talkin' to me? 02:43, 20 February 2020 (UTC)[reply]
Bubba73 For some reasons the backspace and ctrl key on my keyboard are "loose" Thegooduser Life Begins With a Smile :) 🍁 02:46, 20 February 2020 (UTC)[reply]
I don't see why not. Keys fall off / break off sometimes, or they get stuck or whatever. I've had to replace keyboards now and then, though they are usually old enough to be out of warranty by the time they are worn out or broken. 2601:648:8202:96B0:0:0:0:7AC0 (talk) 07:57, 20 February 2020 (UTC)[reply]
I don't know what kind of Dell keyboard you have, but I can usually find them for $1 apiece at the thrift store. Elizium23 (talk) 11:30, 20 February 2020 (UTC)[reply]

Digitized speech on the Commodore 64

The article Impossible Mission says:

The Commodore 64 version features early use of digitized speech: "Another visitor. Stay a while... stay forever!" and "Destroy him, my robots!" The digitized speech was provided by the company Electronic Speech Systems, who drastically raised their prices after Impossible Mission became a successful test case. Epyx did not deal with ESS again as a result. Caswell recounted:

I never met the performer but, when I supplied the script to the representative from ESS, I told him I had in mind a "50-ish English guy", thinking of the sort of arch-villain James Bond might encounter. I was told that they happened to have just such a person on their staff. When I was given the initial recordings, the ESS guy was apologetic about them being a touch hammy, but I thought the over-acting was amusing and appropriate, and they were left as is ...

Now, playing sounds on the Commodore 64 requires controlling the sound chip directly in machine code. There is no ready-made sample player. So how did Epyx incorporate the digitized speech into the program? Did they receive a recording which they scanned in as a sequence of sound values, and then wrote their own code which sort of looped through the values, playing each sound in sequence? JIP | Talk 11:26, 20 February 2020 (UTC)[reply]

I think they pretty much bit banged samples out to the SID with the CPU in a tight loop - that is, they set the SID to play a nominal tone, but then wobbled the volume level up and down to regenerate the sampled audio. When both Impossible Mission and Way of the Exploding Fist (which played a Kiai when it started) played their digitised audio, the rest of the action was stopped, suggesting the CPU was pegged out. -- Finlay McWalter··–·Talk 12:30, 20 February 2020 (UTC)[reply]
Yes, but where did they get the bits from? The secret sauce at ESS wasn't just the bitrate, it was the speech-specific compression algorithm, and an efficient algorithm for unpacking this. The Commodore 64 didn't have the space to go storing lots of sound, simply as sound-encoded and compressed bits, the speech was encoded as something more like phonemes, and ESS had an efficient decompressor which worked for sounds-like-speech much more efficiently than it could for sounds-in-general. Andy Dingley (talk) 14:29, 20 February 2020 (UTC)[reply]
Seeing as Impossible Mission can play the speech samples straight out of the box, does this mean that the code for Impossible Mission actually incorporates this ESS decompressor? Seeing as the Commodore 64 has only 65536 bytes of addressable memory, Epyx must have co-operated with ESS about exactly where to place the code. JIP | Talk 14:32, 20 February 2020 (UTC)[reply]
Yes, space is certainly an issue. Listening to the playback, there's a warbly wobble to it, which is reminiscent of a linear predictive coding scheme at a very low bitrate. Plus both games have very little sampled content - IM has maybe 3 pieces totalling perhaps 10 seconds, and WotEF had a single sample, which I'm pretty sure played only during loading (meaning they could then load over it), and some punch and kick noises that may have been sampled. -- Finlay McWalter··–·Talk 14:40, 20 February 2020 (UTC)[reply]
  • AIUI, ESS charged for two services: encoding the speech (which was done by witchcraft and hand-whittling the bytes to sound best), and then licensing some code to be embedded in the game. After the first games sold more volume than expected, ESS changed their pricing model. Again, AIUI from no basis, this meant that future games became very expensive to license this, unless they also sold in similar volumes. So the game developers get scared at having a modest success, then making nothing from it. Andy Dingley (talk) 17:59, 20 February 2020 (UTC)[reply]

I don't know anything about this ESS company but I doubt that they had anything really secret. There is/was a vast literature about low-complexity speech coding and synthesis and plenty of known techniques to choose from. "Complexity" in this context refers to how much CPU power the algorithm consumes. Linear predictive coding (LPC) at low bit rates characteristic warble that Finlay McWalter refers to, so if the ESS sample had that sound, LPC is probably what they were doing. E.g. LPC-10 is an old standard that already used intricate bit patterns to save bandwidth and maybe they used something like it, adjusting by ear to get particular clips to sound acceptable. 2601:648:8202:96B0:C8B1:B369:A439:9657 (talk) 20:56, 22 February 2020 (UTC)[reply]

According to Forrest S. Mozer and ESS Technology, ESS's work at the time often relied on part on Mozer's patents. (This may also be of interest. [12]) While I gather quite a few of these e.g. US4214125A [13] and US4458110 [14] are more about speech synthesis, it does seem not all of them are just about speech synthesis e.g. US4433434A [15] and US4435831A [16] and US4314105A [17]. And from what I understand given the techniques of the time, the distinction between synthesis and a compressed recording were not always that clear cut.

While I don't know that any of ESS's work for games relied on these patents, and software patents even Software patents under United States patent law at the time were less clear cut, it seems easily possible that while ESS's work did not really rely on anything secret, it did rely on stuff others could not legally do without licencing these patents. Which unless they did before the foundation of ESS, may not be possible if it was felt they would be competing with ESS, without paying a substantial amount.

This [18] claims all the speech including the software was 6 kilobytes. From [19], I gather that the total amount of speech was about 20 seconds with 6 different sounds (not the 3 suggested above), so about 300 bytes per second which doesn't seem any better than LPC of the time, although it did include the software. Our article suggests 2 kB of RAM for LPC-10 so I assume the software can't be larger than that, and I assume this is also for software which can encode. So bit rate was maybe nothing spectacular.

But our article also claims 20 MIPS, which seems very high compared to the 0.43 MIPS for the MOS Technology 6502 (used in the Commodore 64). Again I assume this is the requirement for encoding and decoding will be significantly less. It's also possible that the instruction speed for LPC-10 is a lot higher although I somewhat doubt it on non specialised hardware. So while I don't know how much decoding costs with LPC-10 but especially as I doubt that the whole CPU was dedicated the the speech during playback (even with the action stopping, I assume some CPU was still needed for other stuff), I wonder if LPC-10 is significantly too complex. Or to put it a different way, there are different levels of "low complexity", especially when we're talking about non-specialised hardware of that era. Mind you the 20 MIPS is uncited, and it does seem very high given systems at the time, even considering specialised hardware but then again, it was for military applications.

BTW, I came across [20], but I have no idea if the person actually knows what they're writing about.

Nil Einne (talk) 02:07, 23 February 2020 (UTC)[reply]

Should add that besides the processing cost of decoding LPC, you'd also need to consider the cost of generating the output. My understanding of the subject matter is way too limited to be able to estimate, but I'd guess the processing cost of bit banging the output using the SID is not so tiny to be irrelevant. Nil Einne (talk) 06:10, 23 February 2020 (UTC)[reply]
Decoding LPC10 shouldn't need anywhere near 20 mips, though encoding it might use that much. See also formant synthesis which is generally LPC based. You play a pulse train through a digital filter that approximates the frequency response of the vocal tract during the phoneme you are synthesizing, and change filter parameters 20x or so per second, IIRC. I don't know if the cpu requirements are in reach of a 6502 though. I'm sure there were lots of optimizations and tricks in use in that era. Various speech-synthesizing toys like the TI Speak and Spell were being made at the time under severe cost constraints. The Speak and Spell in particular was supposed to have been quite a technological feat for the time. It may have used one of those newfangled DSP's though. 2602:24A:DE47:B270:A096:24F4:F986:C62A (talk) 05:57, 24 February 2020 (UTC)[reply]

Laptop battery does not charge - fault of battery or AC adapter?

I been recently getting a new popup msg whenever I turn my computer on, at least from stand-by, that says "The AC power adapter type cannot be determined. Your system will operate slower and battery will not charge. This problem might be solved by: Connect a Dell 65W AC adapter or higher." Dell laptop Windows 7. Thanks. 67.175.224.138 (talk) 11:37, 20 February 2020 (UTC).[reply]

Have you... inspected the AC adapter and cables for damage? cleaned the contacts? tried to use another AC outlet on a different circuit? removed the battery if possible, inspected it for damage and dirt? tried operating without the battery? considered upgrading from Windows 7 (being end-of-life)? Elizium23 (talk) 12:45, 20 February 2020 (UTC)[reply]
  • Dell Inspiron? There's one model of these that's infamous for this fault. Poor quality (brittle) plastic in the case made the cases crumble, particularly around the sockets. The power socket comes loose and no longer connects. It connects well enough to give a power connection, but not for the additional data connection needed to identify the computer and charger to each other, so that they start charging (rather than just powering the computer). It may be repairable by dismantling and hot glue, or just by very careful insertion of the plug. Andy Dingley (talk) 12:48, 20 February 2020 (UTC)[reply]
Yep Dell Inspiron. Would the battery not charging also cause the laptop to heat up quickly? And then I hear a loud motor sound, then put my laptop on stand-by to let it cool a little. 67.175.224.138 (talk) 18:59, 20 February 2020 (UTC).[reply]
  • The loud motor is probably the fan, reacting to high temperature on the CPU or motherboard. I would suggest installing a simple hardwaare viewer like Speccy[21] which will show you the temperature.
High temperature is often caused by dust buildup around the air vents, or using it resting on a cushion. Laptops do need internal cleaning sometimes. Andy Dingley (talk) 19:43, 20 February 2020 (UTC)[reply]
I feel like there is a fan noise and a motor noise separate from the fan. Uh oh, I downloaded Speccy:
CPU 52-55 C
Motherboard 54 C
Storage 38 C. 67.175.224.138 (talk) 20:03, 20 February 2020 (UTC).[reply]
The other motor noise would be the hard drive, if your laptop has one. And if the drive has gotten noisier over time, it may be heading towards failure. Replace it with a solid state disk. You'll like the SSD a lot better than the HDD since besides being silent, it makes a night and day difference in the laptop's responsiveness. I'm quite happy using laptops that would mostly be considered obsolete, since SSD's still make them pleasant to use. 2601:648:8202:96B0:0:0:0:7AC0 (talk) 21:50, 20 February 2020 (UTC)[reply]
Also, those temperatures are warm, but if the cpu is busy they are not really excessive. Stuff does get heated up, and laptops are limited in airflow etc. Figuring that laptops aren't really built for heavy computation, I generally prefer to use remote servers when I have compute-intensive things to do. 2601:648:8202:96B0:0:0:0:7AC0 (talk) 06:38, 21 February 2020 (UTC)[reply]

Yeah these motor noises are bothering. I kept my laptop in a freezer last night, and turned them on this morning, the coldest the motherboard is 45 C. Then rebooted my computer, it started the mother noise when it is 54 C again but only after a few minutes... The only difference now is the motor noise is not as long, and is often softer in sound. Somehow I think the thermometer is off. 67.175.224.138 (talk) 13:53, 21 February 2020 (UTC).[reply]

  • " I kept my laptop in a freezer"
Great way to kill it (in a few ways, condensation being the first). 55 degrees isn't bad. Andy Dingley (talk) 14:16, 21 February 2020 (UTC)[reply]
Since no one mentioned this, clean the air vents with gas duster, which is good to do periodically. Dust builds up over time. Ensure that you have backed up any data you care about. As long as you have data backed up, you don't need to worry. As others have suggested, if you want to be proactive, you could replace the hard drive with a SSD, except if the charging port is messed up, you might just want to get a new laptop that comes with a SSD. --47.146.63.87 (talk) 21:07, 22 February 2020 (UTC)[reply]

I notice now if I tilt my laptop a certain way, it prevents the motor-sound from even starting. Sigh. 67.175.224.138 (talk) 14:16, 25 February 2020 (UTC).[reply]

I hate to bring it up every time, but it is important to remember that Windows 7 is at end-of-life and gradually becoming unsafe to run as an Internet-connected device. Now is a good time to consider upgrading to a supported operating system on modern hardware. Elizium23 (talk) 14:20, 25 February 2020 (UTC)[reply]
Indeed, but you can upgrade an existing Windows 7/8 computer to Windows 10 for free. --47.146.63.87 (talk) 19:20, 25 February 2020 (UTC)[reply]
There isn't any problem unless the fan is not spinning up and causing the laptop to overheat. You can monitor fan speed and system temperature with lots of free tools. The temperatures you posted above are not concerning, and modern computers shut off automatically if the temperature gets dangerously high. The noise might be from the fan being loose, or it could have dust buildup, or the bearing has lost lubrication. You might want to open up the laptop and give it a good inspection and cleaning. Dust does build up over time. The fan can be replaced if absolutely necessary. As annoying as it can be, anything with moving parts does experience wear and tear. --47.146.63.87 (talk) 19:20, 25 February 2020 (UTC)[reply]

Smash the NANP?

Well not really. And not seeking legal advice-- this is a theoretical question. If I had the resources to attempt it in practice I'd also obviously hire lawyers as part of it.

I'm wondering what it would take for a US phone carrier (or consortium of them) to introduce new phone number ranges outside the North American Numbering Plan, i.e. something like ipv6 for phones. There would obviously be technical, regulatory, political, and other hurdles but maybe it is time for someone to pursue this. NANP numbers are in short enough supply (especially in crowded area codes) that they are re-used all the time, leading to misdirected calls; and there are few enough of them for spammers to war dial them. Meanwhile, nobody really manually dials a given phone number more than once (after that, the phone remembers it) That makes long phone numbers less of a problem than they might once have seemed.

So I'd like something like a 20 digit phone number or range of them. Working numbers of such size would be sparse enough that it would be hard for spammers to find them by scanning. It would have to be callable from normal POTS phones without incurring extra costs, but it's ok if it had to be prefixed with 011 and a new country code, or something like that. Any idea what this would take? NANP (like ipv4) is heading for exhaustion anyway, and going "big" seems better than adding another digit. It would allow people wanting NANP numbers to still have them if they preferred and were willing to pay for them (they are around $1/month each from VOIP carriers, though I don't know how much of that is for the number itself). Thanks. 2601:648:8202:96B0:0:0:0:7AC0 (talk) 14:33, 20 February 2020 (UTC)[reply]

Is it really heading for exhaustion, or can more area codes be added where needed? Elizium23 (talk) 00:09, 22 February 2020 (UTC)[reply]
North American Numbering Plan expansion says "An April 2019 analysis estimated that the current numbering plan would not be exhausted until after the year 2049". -- Finlay McWalter··–·Talk 00:18, 22 February 2020 (UTC)[reply]
In terms of the technical capability of the telephone system, it's doable. It's all computers now; there are no more mechanical telephone switches. Some time and effort would be needed to prepare and ensure everything works as intended, of course. The main friction point will be stuff out there in the world that assumes all phone numbers are five digits plus three-digit area code. This has never been a good assumption, because calls outside of the NANP area will vary, but I'm sure there is equipment, software, etc. that does it anyway. As noted, doing this has actually been proposed for the NANP. With that said, the way the Internet has become "the network", we could just as well move to giving people their own IPv6 addresses. There's no fundamental reason why people can't have personal IPv6 addresses and associate them with personal domain names, so that I could just punch in your name and initiate a voice conversation with you. Technological, political, and social factors are what impede this. In cell phones, 4G and later is all IP-based already. And of course there's the question of what we want to do with the existing POTS. --47.146.63.87 (talk) 21:28, 24 February 2020 (UTC)[reply]

Windows 10 emptying recycle bin

When emptying the recycle bin, I typically right click and select the "empty recycle bin" option from the menu. It's muscle memory at this point. All good. However, I recently installed Jasc PaintShop Pro on my machine. It's more than a decade old at this point, but I needed a graphics program that I could use immediately with no learning curve and PSP is actually a fairly robust program and I'm familiar with it. Again, all good, apart from the help files not working correctly in W10. What I need help with is that the option to browse my recycle bin folder within PSP is now part of the right-click context menu and it's sitting in the position where the "Empty..." function used to sit so I keep on hitting it. Even weirder, I don't think the option to browse via PSP shows up anywhere else, though I haven't done an exhaustive search. Is there a way to remove this functionality? I'm assuming this is a registry hack, but I haven't attempted that since the days of XP so I'm not going to just muck around in there without direction. Matt Deres (talk) 16:06, 20 February 2020 (UTC)[reply]

Tried this? https://www.online-tech-tips.com/computer-tips/windows-right-click-context-menu/ 2003:F5:6F09:F300:4DD9:B04C:12A:4FB0 (talk) 17:30, 21 February 2020 (UTC) MPB[reply]
That would seem ideal, but I tried changing each of the entries (except the ones I could easily identify as not PSP) and none of them removed the line from the context menu. In fact, I'm not sure any of them made any difference at all, even though I followed the directions closely. Matt Deres (talk) 20:01, 22 February 2020 (UTC)[reply]

Whatsapp problem

Hi everyone, having a problem with Whatsapp and I am hoping someone can help, I've done a bit of googling and had a look at the FAQ section of whatsapp website but I am still stuck.

I would like to transfer my chats from my old mobile phone to a new one. Both phones are android and I am in the UK. The old phone is some old type of samsung which I have had for about 5 years. I have used WhatsApp on the old phone without any issue. The new phone is a moto G7. I have backed up conversations to google drive on my old phone. I have put my SIM from old phone into the new phone as I want to keep the same number. I have logged in with my old google account email address on the new phone. When I downloaded whatsapp to the new phone, none of my old conversations came up. Messages that people send me only go through to my old phone, which now doesn't have a SIM.

Not sure what the issue is as there is no change in number or google email address, merely a change in phone handsets.

Any help would be much appreciated! RichYPE (talk) 21:14, 20 February 2020 (UTC)[reply]

If you did not back up your Whatsap messages then your new phone won't receive the old ones. They are encrypted and this encryption is coupled to the hardware AFAIK. If the old phone still works you can use that phone to back up and then load these per https://faq.whatsapp.com/en/android/28030001/ and https://faq.whatsapp.com/en/android/20887921. Your new messages should arrive on your new phone, which is coupled to the phone number. If it does not, the system might not have updated yet, you could force this to happen by shutting down your old phone and sending a message using the new one. Rmvandijk (talk) 13:52, 21 February 2020 (UTC)[reply]

Thank you for your response. I have an update. The phone numbers on the 2 phones were different. However, the number of my account is no longer correct, it has a very old phone number from a previous SIM card. I uninstalled Whatsapp on the old phone and I am now no longer able to change my account's number as it sends a verification code to a phone number that I no longer have. Is there anything I can do to resolve this? Thank you!RichYPE (talk) 16:42, 23 February 2020 (UTC)[reply]

If you don't have access to your old phone number, you are out of luck. As the FAQ mentioned before says, you need to have access to both new and old phone for a number change and your backup can only be synced to the number they were made on (not sure how this combination works, but it probably says what to do on the FAQ's). Not sure how you managed to have a different number with the same sim-card though? Rmvandijk (talk) 07:58, 25 February 2020 (UTC)[reply]

February 21

How to sign up for a Weixin account as a Foreigner?

I need to ask technical questions to developpers of Chineese software who don t know me (200000 different users but not well known outside borders).
And of course, the rule is no email, no GitHub, no Stack Exchange, but Weixin QR codes on the project s website which by the way isn t translated.

I read that in order to talk to mainland Chineese users, I need Weixin as WeChat is a version preventing to talk to mainland.

The problem is I don t know any Chineese user, and as I don t live in Asia, I ve no idea on how to get a Chineese mobile phone number (even temporary). 193.55.65.121 (talk) 14:33, 21 February 2020 (UTC)[reply]

You might ask on WP:RDL (more Chinese speakers there) if you don't get a useful response here reasonably soon. Could you use a Hong Kong VPN? I think those are easy to get. 2601:648:8202:96B0:0:0:0:7AC0 (talk) 22:03, 21 February 2020 (UTC)[reply]
Location is based on mobile phone number not ip address. Do you have an idea for a Chineese mobile phone number? 37.171.180.227 (talk) 09:58, 23 February 2020 (UTC)[reply]
No, no, no, no, Weixin is WeChat if you're a foreigner. It's the same program except it's in English. The userbase is identical between the two programs. You guys are making this more complicated than you need to. My copy of WeChat doesn't prevent me from talking with any of my students or friends in the mainland because neither my nor their account has been suspended. Ian.thomson (talk) 22:42, 21 February 2020 (UTC)[reply]
Thank you. Can you help me to enroll then? [[22]] 37.171.180.227 (talk) 09:58, 23 February 2020 (UTC)[reply]
I just went to their website, downloaded the app, and followed the instructions in it. That's it. I registered my account on a US phone and have had to change the number three times since but it still works. Just talked with some friends in Hangzhou earlier today. Ian.thomson (talk) 10:39, 23 February 2020 (UTC)[reply]
But as you can see on this picture from the app https://i.stack.imgur.com/ZEfG3.jpg, I need an other WeChat user to authorize me signing up. But while I want to ask questions to WeChat users. They are strangers who don t know me. So I don t know anyone who can help me.
Are you a mainland national? 193.55.65.121 (talk) 13:05, 24 February 2020 (UTC)[reply]

What is the problem with this code now?

Here is the relevant code:


#!/usr/bin/env python3

if __name__ == '__main__':

    def check_board_fullness(board):
        for item in board:
            if board[item] == ' ':
                return False
            return True
    
    #Creates the board
    board = {'top-L': ' ', 'top-M': ' ', 'top-R': ' ',
                'mid-L': ' ', 'mid-M': ' ', 'mid-R': ' ',
                'low-L': ' ', 'low-M': ' ', 'low-R': ' '}
    def print_board(board):
        print(board['top-L'] + '|' + board['top-M'] + '|' + board['top-R'])
        print('-+-+-')
        print(board['mid-L'] + '|' + board['mid-M'] + '|' + board['mid-R'])
        print('-+-+-')
        print(board['low-L'] + '|' + board['low-M'] + '|' + board['low-R'])
        
    #Function to quit
    def end(move):
        if move == 'quit':
            raise SystemExit
        
    #Function to check if any player has won
    def check_winner(board):
        if board['top-L'] == board['top-M'] == board['top-R']:
            if board['top-L'] == 'O':
                return 'O'
            elif board['top-L'] == 'X':
                return 'X'
            else:
                return False
        elif board['top-L'] == board['mid-M'] == board['low-R']:
            if board['top-L'] == 'O':
                return 'O'
            elif board['top-L'] == 'X':
                return 'X'
            else:
                return False
        elif board['top-L'] == board['mid-L'] == board['low-L']:
            if board['top-L'] == 'O':
                return 'O'
            elif board['top-L'] == 'X':
                return 'X'
            else:
                return False
        elif board['top-R'] == board['mid-M'] == board['low-L']:
            if board['top-R'] == 'O':
                return 'O'
            elif board['top-R'] == 'X':
                return 'X'
            else:
                return False
        elif board['top-M'] == board['mid-M'] == board['low-M']:
            if board['top-M'] == 'O':
                return 'O'
            elif board['top-M'] == 'X':
                return 'X'
            else:
                return False
        elif board['top-L'] == board['mid-L'] == board['low-L']:
            if board['top-L'] == 'O':
                return 'O'
            elif board['top-L'] == 'X':
                return 'X'
            else:
                return False
        elif board['mid-L'] == board['mid-M'] == board['mid-R']:
            if board['mid-L'] == 'O':
                return 'O'
            elif board['mid-L'] == 'X':
                return 'X'
            else:
                return False
        elif board['low-L'] == board['low-M'] == board['low-R']:
            if board['low-L'] == 'O':
                return 'O'
            elif board['low-L'] == 'X':
                return 'X'
            else:
                return False
        else:
            return False

    turn = 'O'
    while check_board_fullness(board) == False:
        while check_winner(board) == False:
            print_board(board)
            print("It is now",turn,"'s turn to make a move. What is your move?: ")
            inp = input()
            if inp in board and board[inp] == ' ':
                board[inp] = turn
                if turn == 'O':
                    turn = 'X'
                elif turn == 'X':
                    turn = 'O'
            else:
                print("That's not a valid move!\n")
                inp = input("Please make another move: ")
                if turn == 'X':
                    turn = 'O'
                elif turn == 'O':
                    turn = 'X'
    if check_winner(board) == 'X':
        print("X wins!")
    if check_winner(board) == 'O':
        print("O wins!")
    if check_board_fullness(board) == True and check_winner(board) == False:
        print("It's a tie!")

Basically, I run the program. First, it's O's turn to make a move, so I say top-R. Then I do mid-R for X. Then I do mid-M for O and then low-R for X. Finally, I do low-L for O, but then the program stops or freezes for some reason.

This is what the final part of the computer terminal looks like when this program stops or freezes:

 | |O
-+-+-
 |O|X
-+-+-
 | |X
It is now O 's turn to make a move. What is your move?: 
low-L

Why exactly is this happening and what exactly can I do to fix this? Basically, I'm having O win this game, but the program fails to actually register this victory and this final move for whatever reason.

Anyway, any thoughts on this? Futurist110 (talk) 22:30, 21 February 2020 (UTC)[reply]

You have two nested while loops. Once there is a win, the condition of the inner loop fails, so it becomes equivalent to a null statement. But since the condition of the outer loop is still true, it goes on looping. What you should do is combine the two into a single while loop, joining their conditions with and. I also notice that the program will not print the final board. What you can do is put one call of print_board(board) just before the while loop, and another just after the program has made the (validated) move on the board by executing board[inp] = turn.  --Lambiam 00:03, 22 February 2020 (UTC)[reply]
You will learn faster if you step through your program with a debugger, because then you will see exactly what your code is doing. Using a debugger just to step through code is very simple, though you could speed up the process by learning to set breakpoints. https://docs.python.org/3/library/pdb.html is the documentation for pdb, and https://stackoverflow.com/questions/4929251/how-to-step-through-python-code-to-help-debug-issues also gives useful advice. Best of all, once you've learned how to use one debugger, the concepts will apply to any others, so if you move on to a different programming language you'll find using its debugger easy.-gadfium 01:39, 22 February 2020 (UTC)[reply]
The main alternative to a debugger is putting in print statements to show what it is doing as it runs. Add them strategically to make sure things are as you expect around where the program goes wrong. That usually helps you figure out the problem. Most of your program development time will be spent debugging rather than writing new code, so debugging is an essential skill. Newly written code almost never works, so you have to get used to finding the errors. It might help to sit down with an experienced programmer and have them guide you through debugging this code, and maybe refactoring it to some extent. 2601:648:8202:96B0:C8B1:B369:A439:9657 (talk) 05:19, 22 February 2020 (UTC)[reply]
I too would advise this alternative. Python being as interactive as it is, it is really easy to add some print statements that are tailored to helping you figure out what is how going wrong, and also to comment them out when they seem no longer needed. (Wait with deleting until you are sure everything is fine – you may need them again.) Here is another, more general remark about coding practice. Often there are different program entities that represent or determine the same conceptual entity. If the program modifies one representing entity, then usually the other needs to be adjusted too in order to maintain their proper relationship. A very simple example is a list of numbers (entity 1) together with their total (entity 2). If a number in the list is changed, or one is added to or removed from the list, the total needs to be updated. It is good to be explicitly aware of such relationships that must be kept invariant, so that the code for the necessary updates is properly added. In this case the state of the game has both an internal representation (the variable named board) and an external one (the printout). The invariant to be maintained is that they represent the same state of the game. Each change to the value of variable board (first its initialization; next each move by a player) should be accompanied by an update of the board's printout.  --Lambiam 09:56, 22 February 2020 (UTC)[reply]

February 22

Intel TSX Vs TSX-NI

According to Intel:

  • The Intel Xeon Gold 6234 Processor has TSX-NI.[23]
  • The Intel Xeon Gold 6244 Processor has TSX.[24]

Clicking on the little question marks on the Intel website displays:

  • Intel Transactional Synchronization Extensions (Intel TSX) are a set of instructions that add hardware transactional memory support to improve performance of multi-threaded software.
  • Intel Transactional Synchronization Extensions New Instructions (Intel TSX-NI) are a set of instructions focused on multi-threaded performance scaling. This technology helps make parallel operations more efficient via improved control of locks in software.

Unlike pretty much every other feature, where the Bronze and Silver processors lack the feature while the Gold and Platinum processors have it, whether a processor is listed as having TSX or TSX-NI seems random.

Could it be that these are the exact same thing but two people at Intel added two slightly different names and descriptions? If not, what is the difference? Either way, the Wikipedia page at Transactional Synchronization Extensions should document it the difference or lack thereof. --Guy Macon (talk) 03:26, 22 February 2020 (UTC)[reply]

See here for example. I think the original version of TSX (in Haswell) was buggy and maybe misdesigned. They disabled it, re-enabled it and found more problems, etc. TSX-NI might be a redesign. I've never used it but if you want to understand what it is for, look at pages about software transactional memory (STM) (our article and web searches). I remember a good article about the STM implementation in GHC (Glasgow Haskell Compiler) here. STM is a very convenient way to avoid the standard lock hazards in multi-threaded programming, but its standard implementation technique requires several locked instructions, so it can be slow. TSX is a special hardware feature to speed it up. 2601:648:8202:96B0:C8B1:B369:A439:9657 (talk) 05:23, 22 February 2020 (UTC)[reply]

I believe that I have an answer, and unless anyone objects I will update the page.

My citation is Intel Transactional Synchronization Extensions (Intel TSX) Overview

I believe that the lead of the Transactional Synchronization Extensions page should be changed to:

Transactional Synchronization Extensions (TSX), also called Transactional Synchronization Extensions New Instructions (TSX-NI), is an...

and

...According to different benchmarks, TSX/TSX-NI can provide...

Here is what the citation says about it:

Intel TSX provide two software interfaces to specify regions of code for transactional execution.
Hardware Lock Elision (HLE) is a legacy-compatible instruction set extension (comprising the XACQUIRE and XRELEASE prefixes) to specify transactional regions. HLE is for programmers who prefer the backward compatibility of the conventional mutual-exclusion programming model and would like to run HLE-enabled software on legacy hardware, but would like to take advantage of new lock elision capabilities on hardware with HLE support.
Restricted Transactional Memory (RTM) is a new instruction set interface (comprising the XBEGIN, XEND, and XABORT instructions) for programmers to define transactional regions in a more flexible manner than that possible with HLE.
RTM is for programmers who prefer a flexible interface to the transactional execution hardware.

This and similar pages saying the same thing are the only references that talk about new instructions. There appears to be no such thing as "TSX" outside of "TSX-NI" --Guy Macon (talk) 09:44, 22 February 2020 (UTC)[reply]

Yes please do update the page. But, I think it was originally just called TSX and it didn't work and they had to revamp it. So I figured TSX-NI was the revamp. -NI is a standard Intel acronym for New Instructions. 2601:648:8202:96B0:C8B1:B369:A439:9657 (talk) 20:13, 22 February 2020 (UTC)[reply]
Done. --Guy Macon (talk) 18:00, 23 February 2020 (UTC)[reply]

Variable in c++ program passed by value to procedures changes its value

I'm debugging a program, and because I'm new to C++ I've difficulties finding the problem. So far I've diagnosed the fundamental issue to be caused by the value of a variable that is read from a file that should stay constant, to change during the evaluation of the problem. Nowhere in the program is that variable assigned a new value. But the variable is passed to procedures and functions. It's never changed, and I made sure it's passed by value, not by reference to make sure it shouldn't change even if I made an error somewhere inside the procedures.

So, what can cause the value of a variable in a c++ program to change its value if no new assignment to that variable is made? Count Iblis (talk) 17:20, 22 February 2020 (UTC)[reply]

@Count Iblis: Try using a debugger, it should be able to set a breakpoint for modification of the variable. When you catch it, you'll see what instruction modifies the variable. --CiaPan (talk) 18:27, 22 February 2020 (UTC)[reply]
As an alternative, you can copy the variable into some safe place (that is, another static variable) and insert some tests around different parts of code to verify whether the variable is still equal to its copy. This way you can iteratively narrow down the area of possible error (but that may be misleading, as there may be different circumstances triggering the erratic behavior). --CiaPan (talk) 18:38, 22 February 2020 (UTC)[reply]
The variable could be getting clobbered through a pointer error of some sort. Try declaring it const and seeing if you get any compile-time errors. If you have to debug it dynamically and your debugger supports watchpoints (they trigger when the contents of a memory location changes, using hardware assistance on some processors), that can be more convenient than using a normal breakpoint. See here for more info about watchpoints as the Wikipedia link doesn't explain them much. 2601:648:8202:96B0:C8B1:B369:A439:9657 (talk) 20:17, 22 February 2020 (UTC)[reply]

Added: note that you can't assign to a const symbol at all: you can only initialize it where it is declared. So if you want to read it from a file, you have to say something like

const int myvar(read_value_from_file());

Fwiw it is considered good style these days to use const and immutable values in preference to mutable variables whenever you can, a la functional programming. So it's a useful change to make either way. 2601:648:8202:96B0:C8B1:B369:A439:9657 (talk) 20:27, 22 February 2020 (UTC)[reply]

Just a "duh" check for a quite common mistake (I have done this myself): double-check to make sure the program doesn't use "=" when it should be "==", like in a loop condition. Complimentary regex for checking: myvar[ ]*=[^=]. To be extra-thorough you can check for other whitespace characters as well but the syntax varies: \s for Perl/Perl-like, [:space:] for POSIX. --47.146.63.87 (talk) 23:35, 22 February 2020 (UTC)[reply]

As the OP said, the variable should have always been passed by value. If it indeed were passed by value, then even assigning a new value to it would not affect the calling function. So not only is it an accidental assignment of some kind, but an accidental pass-by-reference on top of it. I don't know enough about C++ to know if such situations would be automatically generated despite the wishes of the programmer. Elizium23 (talk) 06:31, 23 February 2020 (UTC)[reply]
I've now found that the problem was caused by the fact that in C++ arrays are always passed by reference (my variable read from a file is an array). I then don't understand why in some C++ tutorials they make all that fuss about how to pass an array by reference so as to avoid the contents of the array being duplicated. So, this is then the fuss about the expression int & Ar[20] not allowed as this is going to be interpreted as an array of pointers and therefore having to write int (& Ar)[20], what is the point about all that id arrays are always passed by reference anyway???? Count Iblis (talk) 16:46, 23 February 2020 (UTC)[reply]
Count Iblis, unfortunately, that is legacy baggage from C. Any C programmer would intuitively understand that arrays are passed by reference (pointer) due to function calling conventions. But should it be expected of a C++ programmer to know C first? Elizium23 (talk) 16:54, 23 February 2020 (UTC)[reply]
If you mean a C-style array, declared like "int x[23];", then yes it is always passed by reference. Generally in modern C++, you should treat that type of array as a legacy feature and avoid using it if you can. Instead use std::array or std::vector which you do have to explicitly pass by reference to avoid copying. Also, use x.at(i) for std::arrays and vectors, instead of x[i]. .at() does a range check on the subscript which catches a lot of errors. In my measurements I've found has almost overall performance cost. The book "Effective Modern C++" by Scott Myers, about stuff like this, is very good. 2602:24A:DE47:B270:A096:24F4:F986:C62A (talk) 17:54, 23 February 2020 (UTC)[reply]
Yep, common pitfall for people new to C. (C++ just copies all this from C.) C arrays are just pointers in disguise. Now, I echo the above reply: modern, idiomatic C++ basically avoids all the "legacy" C stuff unless it's absolutely necessary. It sounds like you're self-teaching and going off online tutorials of dubious quality: I then don't understand why in some C++ tutorials they make all that fuss about how to pass an array by reference so as to avoid the contents of the array being duplicated. Are you sure they're talking about C arrays and not C++'s std::array? As I said, C arrays are just pointers; passing a C array by reference merely avoids copying the pointer. Anyway, if you want good resources for learning C++, go here. --47.146.63.87 (talk) 00:08, 24 February 2020 (UTC)[reply]

February 24

Download all images on webpage

I'm using a long, long webpage containing around 300 images, each one on a new line. They're the pages of a book so the order is important. Is there a tool I can use to download them all at once but keep them in order (eg by naming them 'image1', 'image2' etc) so I can then form them into a PDF that reads like the book? Most of the 'download all images' add-ons I've found just give arbitrary names which isn't helpful. Amisom (talk) 07:40, 24 February 2020 (UTC)[reply]

If it's someone else's site, this is called web scraping and there's no one-size-fits-all method or tool. You often end up developing a custom script, though that is pretty quick once you've done a few. It is harder for some sites than others. Can you say what site it is? 2602:24A:DE47:B270:A096:24F4:F986:C62A (talk) 09:09, 24 February 2020 (UTC)[reply]
It seems odd that a scraper would rename the files, though. It's very likely that the pages are already named in the correct order, even if the names themselves might seem a little weird, so it seems the easiest solution would be to find the option that's causing the renaming and uncheck it. Matt Deres (talk) 14:33, 24 February 2020 (UTC)[reply]
As the IP said, it's certainly doable - if the web browser can display them in order, then they can be retrieved in order. It might be worth to take a look at the web sites source code or just at the URLs of some of the images. Often one can then guess the pattern and just use wget or cURL to grab everything. Of course, with modern web pages importing about a billion frameworks to display "Hellp World", it may be more difficult... --Stephan Schulz (talk) 14:53, 24 February 2020 (UTC)[reply]
"Hellp World" indeed! (:  --Lambiam 16:57, 24 February 2020 (UTC)[reply]
Is there such a thing as a Freudian typo? ;-). --Stephan Schulz (talk) 17:20, 24 February 2020 (UTC)[reply]
  • This is a programming task, and not a difficult one (It's the sort of thing I'd teach as an example in a 'Learning Python' course for older schoolkids). There are three broad approaches:
  1. Find a gadget that already does it, as a command-line utility, such as wget.
  2. Find a browser extension that does it. Often more convenient. There are many of these and they're hard to keep up with. "DownThemAll" [25] is one I've used for FireFox.
  3. Write some code. In a modern language (like Python) there are many pre-existing modules to do the hard work of this, even things like Beautiful Soup which will handle awful markup. There are also many examples of how to do this, pre-written for almost exactly what you need. This will be the most flexible way, especially for a repeated task, and may not require as much effort as you think. Andy Dingley (talk) 17:29, 24 February 2020 (UTC)[reply]
When you say they give "arbitrary names", I suspect those are the actual file names the Web page uses, meaning the downloaders aren't renaming them. Many Web sites, especially ones that are dynamically generated, can use things like Base16 encoding for filenames; if the file names are some alphanumeric gibberish, that's why. To find out, try right-clicking on one of the images in your browser and looking for something like "View Image Info" (that's what it's called in Firefox). Or, you can look at the HTML for the page with the "View Source" option. If this is the case, then you actually want the files renamed. Some download managers can do things like name each file in sequential order ("1.png, 2.png, 3.png"). You have to look at the documentation for whatever tool you use to figure out how. Also, not important, but making a PDF will just give a PDF with the image files embedded. This seems kind of pointless to me, although I suppose it could be useful in some cases, like if you have reader software you like using and it only supports formats like PDF. --47.146.63.87 (talk) 20:29, 24 February 2020 (UTC)[reply]

Registry entry

I consider Kasperskiy a Russian spy malware. At one point I helped a friend of mine to get rid of it by expunging the registry, but he installed it previously since it was offered for free. Spyware is always free as we know. Today, much time later I decided to check if my registry might have a trace of it. My OS is Win 10 Pro. This is what I found:

HKEY_CURRENT_USER\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\Kasperskiy-antivirus HKEY_CURRENT_USER\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\EscDomains\Kasperskiy-antivirus

Is there any harm of having it there? That Domain section has hundreds of domain names, including variations of my favorite SpyBot Search and Destroy, like spybotcom.com, etc.

Thanks, - AboutFace 22 (talk) 18:29, 24 February 2020 (UTC)[reply]

For the allegations against Kaspersky Lab, see Kaspersky bans and allegations of Russian government ties. As long as not more specific information is supplied, I am far from convinced by the spyware allegations. The registry entry looks suspect to me insofar as it uses the spelling "Kasperskiy" while the company itself uses the spelling .  --Lambiam 19:50, 24 February 2020 (UTC)[reply]
including variations of my favorite SpyBot Search and Destroy, like spybotcom.com… Looks like you have or had malware on your computer. Those entries are Internet Explorer/Microsoft Edge's list of "Trusted Sites", which are allowed to bypass the browser's security controls. Those domains are "fake" domain names meant to look like legitimate ones (hence also the "Kasperskiy" misspelling). Malware would have put them in that list as part of hijacking the browser. If you're confident they're from a past infection that was removed, just delete the entries. It's always good practice to make a backup before editing the Registry; you can do this from within Registry Editor. --47.146.63.87 (talk) 22:52, 24 February 2020 (UTC)[reply]

Then why to remove only Kaspersky. Look at the small part of my registry:

Registry Entries

What shall I do? There are hundreds of them. AboutFace 22 (talk) 23:11, 24 February 2020 (UTC)[reply]

Yes I also have the kasperskiy-antivir.com entry. It's not Kaspersky's real domain, it's a fake download page to trick people who don't know which spelling is used by the company. The registry key containing all these malware domains is a list of stuff that goes in IE's trusted and untrusted zones. These are standard untrusted zone entries and contain a 0x04 value meaning that the domain in the subkey belongs to the untrusted zone. To put it in clearer's terms, it's something between an ad blocker and a hosts file for IE's internal use, and it's been in Windows since at least XP. Removing these entries might leave you open to malware but if you don't use IE then it doesn't really matter if you remove it or not. Lastly a disclaimer: if you consider Kaspersky Russian government spyware, it shouldn't come to you as a huge surprise that many consider Windows 10 commercial spyware and adware (which I think is in terms of dollars at least, a lot worse than getting spied on by a country you'll probably never even visit). 93.136.117.148 (talk) 00:01, 25 February 2020 (UTC)[reply]
Ugh, okay, I jumped to a conclusion. I assumed IE/Edge did something similar to other browsers for malware protection, downloading an internal list. Thanks for correcting. --47.146.63.87 (talk) 06:27, 25 February 2020 (UTC)[reply]

Registering and maintaining a domain name costs money, sometimes a lot of money. Who is paying for all those untrusted domains? AboutFace 22 (talk) 16:15, 25 February 2020 (UTC)[reply]

February 25

Putting an App Icon on the Home Screen

I have a Samsung Galaxy J7, running Android version 8.1.0. What I want to do is to add another application icon to the home screen. The icon for it is currently in the Applications window that I can open by clicking on the Applications window icon, but I want to display it on a page of the home screen. At this time the application is Spotify, and I want to be able to launch Spotify and Maps conveniently at the same time. However, I think that my question is more general, and is how to put an icon for an application on the home screen that is installed but isn't on the home screen. Robert McClenon (talk) 01:15, 25 February 2020 (UTC)[reply]

You should be able to move the app to your home screen by dragging it. Long-press if necessary or tap, hold, and move your finger; the home screen(s) should appear and allow you to release your finger and drop the app onto it. Elizium23 (talk) 01:18, 25 February 2020 (UTC)[reply]
Yep, long press and hold the icon in the start menu (I guess that's what's called the Applications window). After a second or two the home screens should appear in the background, then you can drag the icon where you want it. You can also long press an empty space on the home screen and you'll get a popup menu allowing you to add stuff like app shortcuts. 93.136.117.148 (talk) 02:29, 25 February 2020 (UTC)[reply]

Brother DCP-7030 driver for ubuntu

After following the installation instructions over and over again, I can't seem to install it Thegooduser Life Begins With a Smile :) 🍁 00:51, 26 February 2020 (UTC)[reply]

Problems using the wikipedia dump bz2 file

Please see this post on the Miscellaneous desk. 2606:A000:1126:28D:8095:BB24:F64A:E5FC (talk) 03:21, 26 February 2020 (UTC)[reply]