Wikipedia:Reference desk/Archives/Computing/2019 April 22

= April 22 =

WHOIS creation date
Imagine that I registered four domain names on 1 January 2001, and they all originally expired on 1 January 2002: In 2019, what will a WHOIS list as the "creation date" for each of them? Obviously #1 will be 1 January 2001, but I'm not clear whether #3 and #4 will be 2001 or 2003 (or whether it would distinguish between re-registered by original owner and re-registered by someone else), and I don't know whether #2 would even appear. WHOIS doesn't address the subject, and says The creation date is when this domain was originally registered, but I'm not clear whether this is the beginning of the current "streak" of registrations (i.e. one day earlier is the last time this domain wasn't registered) or the very first time it was registered, period. Nyttend (talk) 22:25, 21 April 2019 (UTC)
 * example1.com — I've re-registered it every year
 * example2.com — I never re-registered it, and nobody's registered it since then
 * example3.com — I didn't re-register it, but someone else picked it up on 1 January 2003 and has re-registered it since then
 * example4.com — I let it expire and then re-registered it on 1 January 2003, and have since re-registered it every year


 * For your example #3, that begs the question, are there any websites that actually keep track of who all the prior domain owners are? If they did, the most likely would have to say, from what year to what year, etc. 67.175.224.138 (talk) 11:10, 25 April 2019 (UTC).

SMB file servers keep asking for credentials
I have both Windows 10 SMB and Linux Samba file servers. The share permissions are: Most of the time, using a Windows 10 client to connect to the shared folder is straight forward, just \\my-server and it is fine. But sometimes, it keep asking for credentials for unknown reason. See here.
 * browsable (Linux) / turn on file and printer sharing (Windows)
 * guest ok (Linux) / turn off password protected sharing (Windows)
 * Appropriate file system level permissions on both servers (not really matters here)

It won't connect if I leave all fields blank. Sometimes I need to type a random user account with a blank password, and sometimes both a random account plus a random password to pass that stupid prompt. Linux clients do not suffer from that issue, at least by using smb://my-server on Ubuntu's Nautilus and select Connect anonymously. To make the problem worse, let's say I have a shared printer on the server. After a client provides a random user + password, he can connect to the server and use the shared printer. After a few days, he suddenly cannot print using the previously added printer, until he tries to connect and provides a random user + password again (the printer does not need to be re-added). Looks like the junk user + password time out after a few days (even if you do check Remember my credentials).

The issue occurs randomly. What could be the cause of the problem? -- Livy (talk)

Regarding scope in programming
I understand that basically there are global and local scopes and if I put a variable in a local scope (say, inside a function) I cannot access it from outside this this local scope unless I declare this variable as exceptional so that it would indeed be accessible from that local scope unlike its siblings in that local scope that aren't accessible,

If this general description is correct, please share an example on why to do such exception. Thanks, — Preceding unsigned comment added by 49.230.14.59 (talk) 11:15, 22 April 2019 (UTC)


 * A simple example: I write a function that connects to a database and creates a handler variable for the connection. I want that handler variable to be in scope for any other function that requires access to the database. I *could* have my initial function return the handle and then pass that handle as a parameter to any function that needs it. My alternative is to push the variable into global scope from inside the function so all functions can see it.
 * Also, there is a slight nuance to global vs local scope. In some programming languages, global scope means that it was created outside of any class or function, but that doesn't mean that it exists inside the class/function without being explicitly included in some form of "give me access to global variable X inside here" statement. If I don't import the global variable, I can create a local variable of the same name. In those languages, you will often find some sort of super or mega global, which is a global that is automatically included in all classes and functions and you can't create a local variable of the same name. 68.115.219.139 (talk) 13:41, 22 April 2019 (UTC)

Your question seems too general. What language are you using? Do you want something like a C++ friend specification? It is also sometimes possible to control such things with a package system. Otherwise you'd just use arg passing. Encapsulation (computer programming) discusses the general issues somewhat. 67.164.113.165 (talk) 17:33, 22 April 2019 (UTC)


 * Fashions come and go in programming, but for a long time there has been an ongoing single-direction to avoiding global scope. So if you possibly can, avoid globals. And that means for everything. Even if the code "looks complicated" or "becomes long-winded". Overall, the advantages favour avoiding that global scope.
 * The general technique would be to return a "Connection" object and to pass that around. This, like any object, allows techniques like abstraction and data-hiding. You can write your code from the outset around this Connection object and even if (as is likely) the management of that connection becomes more complicated, then you can hide that new complexity inside that object and the client code using it either doesn't need to know about that new complexity (it's all handled internally by the Connection object) or at least only those parts of the client which need to need to be updated. If you use one global though, before long that grows into two. Even making the connection object global (which gives a few advantages) is a bad idea, because it's then a fundamental limitation that there is only one Connection possible.
 * A recent development (and a good one) is functional programming (which is not merely the use of functions). In this, there is a vehement avoidance of globals, or any form of persistent state outside the narrowest possible scope. Everything passed in is parameterised, everything returned is immutable. The advantage of this is in both reliability (and provable reliability) but also (and mostly) flexibility for future change without the code collapsing. The departed globals will not be missed. Andy Dingley (talk) 20:18, 22 April 2019 (UTC)


 * When someone asks a question about "programming" they usually mean "the only kind of programming that I personally know about". In this case, the person asking the question doesn't seem to know about Assembly, where everything is global (can you imagine me trying to implement something resembling scope when my microcontroller has 128 Bytes of RAM?). They also don't seem to know about FORTH, where data is typically stored on a stack and not in variables. So the "what language" question (and the implied "may I assume that you are using something like a PC with an operating system and not programming a toaster or thermostat?") is key to giving a correct answer. --Guy Macon (talk) 15:15, 24 April 2019 (UTC)


 * A global maxRecords, to tell everyone that we're just testing and 5 records are enough is OK. Many things are global anyway, the space left on C: is no different for class X or class Y. But if there's not a very good reason to tell everyone about your counter i, it's best to keep it a secret. If some other code wants to know, there's a polite way which is by asking a property, which cleans the house before you enter it. Joepnl (talk) 00:47, 28 April 2019 (UTC)
 * AFAIK there is no such thing like C: in my car's ABS controller. Also the XSLT converter I played with recently doesn't know anything like C: (let alone any 'space left' on it). --CiaPan (talk) 18:30, 1 May 2019 (UTC)