Jump to content

Wikipedia:Reference desk/Archives/Computing/2017 December 20

From Wikipedia, the free encyclopedia
Computing desk
< December 19 << Nov | December | Jan >> December 21 >
Welcome to the Wikipedia Computing Reference Desk Archives
The page you are currently viewing is an archive page. While you can leave answers for any questions shown below, please ask new questions on one of the current reference desk pages.


December 20

[edit]

Do I need to worry about this?

[edit]

When I close down Windows 10, it tells me that an app with an icon I don't recognize is still running. It doesn't show as an app running in Task Manager. Is there another way I can find out more about it? Is there anything to worry about? --Halcatalyst (talk) 05:23, 20 December 2017 (UTC)[reply]

Usually that is nothing to worry about. Windows 10 will ask the program to stop, and force it to quit if it doesn't. If you make a photo of the icon, upload it to an image hosting site (e.g. imgur.com) and post the link here then someone will probably be able to identify it. (((The Quixotic Potato))) (talk) 05:24, 20 December 2017 (UTC)[reply]
Or if it gives a name (perhaps in Task Manager), do a Google search to see what it is. Bubba73 You talkin' to me? 19:21, 20 December 2017 (UTC)[reply]

Placeholder text to use in Python function that will receive a list as the argument

[edit]

Coding noob here. How do I write a function in Python that receives a list as its argument when it is called? I don't know what to use as a placeholder (within the brackets on the first line) for the argument, and when I leave it blank, I get "not defined" errors in the body of my code. If I hard code a list with some values in it, I do get a correct answer, but that isn't flexible. 129.67.118.132 (talk) 12:39, 20 December 2017 (UTC)[reply]

Do you mean like this?
def printlist(s):
    for x in s:
        print(x)

printlist([4,3,2,1])
-- Finlay McWalter··–·Talk 13:26, 20 December 2017 (UTC)[reply]
  • (edit conflict) Disclaimer: I have not tested the following code snippets, though I would be really surprised if I managed to screw them up.
That's not really about a list, is it? It is actually about passing arguments (of any kind) around. I suspect our articles Scope (computer science) or local variable are extremely relevant here, unfortunately I doubt they are really accessible to non-experts. If the following does not help you solve your problem, please post here a snippet of the code you have tried.
Python code snippets, demonstrating variable scope

The syntax of a function definition, in Python, goes along those lines:

# Lines starting with a '#' in Python are comments. The interpreter (the thing that reads the code and executes the commands you gave it) will ignore them.
def name_of_your_function(argument1,argument2):
    # You could of course use more or less than two arguments. There are tricks to accept a variable number of arguments, to set up optional arguments with default values, etc.
    # The function body runs as long as the same level of indentation (i.e. number of white spaces at the start of the line) is kept (this is a Python-specific thing, most languages use a magic word to indicate the end of the function declaration, or enclose the declaration in brackets of some sort)

    # In the function body (defined in Python by the indentation), you can do some stuff using the values given to 'argument1' and 'argument2', for instance:
    result = argument1 + argument2 # adds the two arguments, and stores the result in a variable named 'result'
    return result # 'return' tells Python to exit the function (ignoring following statements, if any). The result of the function is the argument you 'return'ed (if any). There are tricks to return multiple variables as output, or none at all.

The important thing to realize is that the variables within the function block are in general independent of the ones outside it; both of them are out of scope of the environments in which the others live. This means in particular that within a function, you have to reuse the names you use within the parentheses in the definition statement. For instance, here's a working snippet

# The following function does exactly the same as the "name_of_your_function" example above, we just changed the function and arguments names
def addition(a,b):
    result = a+b
    return result
answer = addition(1,1)
print(answer) # prints the number 2

However, either of the following will not work:

# The following function does exactly the same as the "name_of_your_function" example above, we just changed the function and arguments names
def addition(a,b):
    result = a+b
    return result
answer = addition(1,1)
print(result) # the interpreter will fail on this line with an "undefined variable" error

'result' is not defined on the last line, because the variable 'result' is defined within the function definition, and it does not "live" within the main statement block. You would get similar results if you asked to print 'a' or 'b' instead (the label 'a' or 'b' lives only within the function definition). Conversely:

# The following function does exactly the same as the "name_of_your_function" example above, we just changed the function and arguments names
a = 5
def add_five(b):
    result = a+b # this line is incorrect because 'a' is not defined within that scope, hence the interpreter will fail
    return result
answer = add_five(1)
print(answer)

'a' is not defined within the function definition for the reverse reason: everything that is not passed as arguments as the function does not exist in the function's eyes. You may cross scope boundaries by using global variables, but that is strongly discouraged in practically every programming language, and for good reason. (I have yet to see any real problem where using a global variable is a decent solution (let alone the best) in years of semi-amateur coding.)

TigraanClick here to contact me 14:04, 20 December 2017 (UTC)[reply]

3D printer

[edit]

Which opensource and paid 3D printer software functions in wood, metal and plastic cutting 3D printers? 119.30.32.138 (talk) 16:39, 20 December 2017 (UTC)[reply]

Wikipedia has a sortable Comparison of 3D printers. Nimur (talk) 17:33, 20 December 2017 (UTC)[reply]
"3d Printer" usually refers to additive manufacturing. If you're looking for "cutting", you may be looking for a CNC machine. Possibly a Laser cutter.
ApLundell (talk) 18:01, 20 December 2017 (UTC)[reply]
Numerical control (((The Quixotic Potato))) (talk) 08:42, 21 December 2017 (UTC)[reply]
What do you think is best and cost effective, creating your own product at home, or in a production place? 119.30.45.169 (talk) 17:43, 21 December 2017 (UTC)[reply]
oddly familiar Q, and same type of confusion between 3D printing and machining. 78.53.109.60 (talk) 17:03, 22 December 2017 (UTC)[reply]

kanjis

[edit]

I have two Kanji strings that look identical, but somehow the computer thinks they're different. Which is one is the "correct" one?

1. 背德漢

2. 背徳漢

Mũeller (talk) 22:11, 20 December 2017 (UTC)[reply]

Not sure which is the correct one, but the second characters of those strings are clearly different. https://r12a.github.io/uniview/#title
80CC [CJK Unified Ideographs]
5FB7 [CJK Unified Ideographs]
6F22 [CJK Unified Ideographs]
80CC [CJK Unified Ideographs]
5FB3 [CJK Unified Ideographs]
6F22 [CJK Unified Ideographs]
(((The Quixotic Potato))) (talk) 22:27, 20 December 2017 (UTC)[reply]
The second is a term of respect. The first is nonsense. So, the second is correct. Note the extra line in the second character. That shouldn't be there. 71.85.51.150 (talk) 08:00, 21 December 2017 (UTC)[reply]
What does the second one mean? Mũeller (talk) 10:19, 21 December 2017 (UTC)[reply]
Google Translate says: Honorable man. According to Google translate the first one means "Back German". (((The Quixotic Potato))) (talk) 10:29, 21 December 2017 (UTC)[reply]
I got honorable man and backstage from Google translate. Hofhof (talk) 16:46, 21 December 2017 (UTC)[reply]
A name? Translating names is dodgy; I might be a 'Robert', but I would object to that being translated as "Famed, bright; shining" (which is apparently the 'meaning' behind Robert). c/f Pulp Fiction; I cannot directly link here but it's on youtu.be/WO2q1iQX2UA?t=120 86.20.193.222 (talk) 20:50, 26 December 2017 (UTC)[reply]