Cannabis Ruderalis

Content deleted Content added
47.152.93.24 (talk)
Pootersmear (talk | contribs)
Line 153: Line 153:
:Before [[high-level programming language]]s were developed, the most common situation was that ''all'' memory was statically allocated. One way in which functions in a program can communicate with each other is by passing information through parameters. But suppose that in an application there is a centrally important store of information that can be consulted and updated by various functions. In that situation, passing it around through parameters is awkward. The alternative is to use a [[global variable]], which in most languages means it is allocated statically. Depending on the instruction set of the processor, accessing static variables may be faster than accessing dynamic variables; the latter may involve some [[indirection]] and [[pointer arithmetic]].  --[[User talk:Lambiam|Lambiam]] 21:15, 22 January 2021 (UTC)
:Before [[high-level programming language]]s were developed, the most common situation was that ''all'' memory was statically allocated. One way in which functions in a program can communicate with each other is by passing information through parameters. But suppose that in an application there is a centrally important store of information that can be consulted and updated by various functions. In that situation, passing it around through parameters is awkward. The alternative is to use a [[global variable]], which in most languages means it is allocated statically. Depending on the instruction set of the processor, accessing static variables may be faster than accessing dynamic variables; the latter may involve some [[indirection]] and [[pointer arithmetic]].  --[[User talk:Lambiam|Lambiam]] 21:15, 22 January 2021 (UTC)
:Static variables will typically have storage reserved at compile-time. This means no memory needs to be allocated for them at run-time, which can be important in constricted environments such as [[embedded system]]s with strict memory limitations. This also means a given static variable has a fixed memory address, which can be necessary for low-level stuff like [[device driver]]s. --[[Special:Contributions/47.152.93.24|47.152.93.24]] ([[User talk:47.152.93.24|talk]]) 03:56, 23 January 2021 (UTC)
:Static variables will typically have storage reserved at compile-time. This means no memory needs to be allocated for them at run-time, which can be important in constricted environments such as [[embedded system]]s with strict memory limitations. This also means a given static variable has a fixed memory address, which can be necessary for low-level stuff like [[device driver]]s. --[[Special:Contributions/47.152.93.24|47.152.93.24]] ([[User talk:47.152.93.24|talk]]) 03:56, 23 January 2021 (UTC)
:It’s primarily a matter of static variables being simpler to use in most dual-processing analytic applications. Coding doesn’t generally account for dynamic variable modeling, so from an informatics engineering perspective, allocation of dynamic parameter values are limited to a pre-designated and finite virtual framework. In these situations I generally reference a self-defined iterative conversion algorithm (structured the same way as in other applications, like encryption key generation). It’s a simple method that bypasses some of the issues mentioned above. [[User:Pootersmear|Pootersmear]] ([[User talk:Pootersmear|talk]]) 04:49, 23 January 2021 (UTC)


== Change in key's meaning ==
== Change in key's meaning ==

Revision as of 04:49, 23 January 2021

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:

January 16

Google Sheets version history

Several of us are intermittently editing a shared google spreadsheet. If you go to "File | version history" you get a list of dates&times with who edited the document at that (approximate) time. Our document is a multi sheet one (around 20 sheets). How do I determine which sheets have been edited at a particular edit? Once I know the particular sheet(s), I can scroll down and find the appropriately shaded cells and look at the edit history within the cell. But at present I can do no better than trying each sheet in turn and scrolling to the bottom looking for shaded cells. This can take me over 10 minutes. Is there some option that returns something like "Joe Hill edited sheets 'This', 'That' and 'The other'."? -- SGBailey (talk) 13:32, 16 January 2021 (UTC)[reply]

January 17

Can a first place team be eliminated?

In the baseball elimination problem, it is possible for a team to be eliminated despite the fact that there are teams with worse records that have not been eliminated. This table, taken from Programming Assignment 3: Baseball Elimination, is an example:

Division standings
team wins loss left Atl Phi NY Mon
Atlanta 83 71 8 - 1 6 1
Philadelphia 80 79 3 1 - 0 2
New York 78 78 6 6 0 - 0
Montreal 77 82 3 1 2 0 -

"Montreal is mathematically eliminated since it can finish with at most 80 wins and Atlanta already has 83 wins. This is the simplest reason for elimination. However, there can be more complicated reasons. For example, Philadelphia is also mathematically eliminated. It can finish the season with as many as 83 wins, which appears to be enough to tie Atlanta. But this would require Atlanta to lose all of its remaining games, including the 6 against New York, in which case New York would finish with 84 wins. We note that New York is not yet mathematically eliminated despite the fact that it has fewer wins than Philadelphia."

With all that being said, could the same logic hold for a team in first place? Can a first place team be eliminated due to scheduling constraints in the division? It would appear that the answer is yes, but I'm curious if there is another factor here that I am missing. The method for determining which team is in first is probably relevant here. You can either consider which team has the highest win percentage, or which team has the most total wins. I have a half baked intuition that the answer to my question is no, if we use the former method, but I really don't know how to approach this problem. --PuzzledvegetableIs it teatime already? 18:33, 17 January 2021 (UTC)[reply]

I don't know about baseball, but it's possible in European football competitions. Suppose the top-ranked team A has played all its matches already, but two teams B and C who still have to face each other both have one point less than A and at least one of them has a better goal difference than A. It's guaranteed that either B or C will beat A. If the match of B vs. C leads to a winner, that winner gains 3 points, enough to beat A by 2 points, and if B vs. C leads to a draw, both get 1 point and the team with the best goal difference beats A. PiusImpavidus (talk) 16:56, 18 January 2021 (UTC)[reply]
Many European football leagues use head-to-head points and head-to-head goal difference as the first tie-breakers, and not overall goal difference. If one of B and C leads over A in head-to-head then A isn't necessarily eliminated. A draw between B and C gives a three-way tie where all matches between the three teams will be counted. Team A may be ahead there, but you can of course make scenarios where that will not be possible. If all teams have the same number of matches left then the leader cannot be eliminated already.PrimeHunter (talk) 20:37, 18 January 2021 (UTC)[reply]
This isn't strictly a question about the rules of baseball or the leagues in which individual teams are ranked; it's a question of mathematics. This is purely a question of applied mathematics in the form of directed graph flow theory. The answer might not be obvious - in fact, the explanatory page linked earlier splits the problem into a "trivial" and a "non-trivial" case; but the short answer here is "yes, it is possible." It is possible to construct a graph such that the first place team would be "mathematically eliminated" (as defined in the problem-set-up).
We can do this by starting with a directed-graph representation of a losing team; then we deform that graph representation by adding or subtracting other games (vertices) that do not change the characteristic, until we find a configuration in which the originally-losing-team is in first place.
I assert (without proof) that you will find nearly trivial cases if you explore smaller graphs - e.g. the first or second game in a league that only plays five or ten games in the season. It's more mental effort if you're looking at the 65th-game-in-the-season in an 80-game-season (even though the problem is mathematically no more or less tractable - and after all, isn't that why we use a computer for this task?)
I think the follow-on question, which becomes much less theoretical, is whether that scenario realistically represents a plausible game schedule for any real-world baseball league, and I think the answer to that is "probably not," for most of the cases that sprung to my mind.
If you want to foray out of the world of theoretical computer science, and into applied graph theory, we might further decorate graph nodes to afford ourselves additional constraints on the schedule (e.g. we might replace integer g with an object, and impart some constraint satisfaction on that object as we traverse the graph). And if we wanted to return back from applied to theoretical math, we might attempt to reduce the decoration back to a single integer by way of a coordinate rotation in high dimensional space.
Isn't graph theory so much more fun when we leave it to proper mathematicians, instead of letting it become overrun by social scientists masquerading as computer scientists?
Nimur (talk) 18:17, 18 January 2021 (UTC)[reply]
I am not seeing much pseudo-code here. How is this a computing and not mathematics problem? Elizium23 (talk) 19:57, 18 January 2021 (UTC)[reply]
If there is any difference between problems of mathematics, and problems of computing, it's chiefly a historical accident, says Prof. Dr. Dijkstra. Nimur (talk) 20:31, 18 January 2021 (UTC)[reply]
Nimur, it is not a problem of mathematics for me to install, configure and run BIND9. Mathematics problems such as this can be solved with computers, but general-purpose computers can do much more outside that realm. I'm just asking because we have a dedicated Reference Desk for mathematics questions, and the watchers there may be well-equipped to answer this question. I am not well-equipped, and I have worked in IT for 30 years and hold 3 certifications. Elizium23 (talk) 20:39, 18 January 2021 (UTC)[reply]

January 19

Run command when process dies (Linux)

Lets say I have a process running that's likely to take some time. I also have a second command that I want to run, but I know that command will require the same limited resources (network bandwidth, disk access, etc) that the already running process is already swamping. Is there a way to schedule that second command to run when the first, already running, process dies? 108.21.233.20 (talk) 02:01, 19 January 2021 (UTC)[reply]

Yes. The key is to use wait(2) which is accessible in the shell by the wait command. You do not say what language you are using, so it will be difficult for me to customize the instructions.
The concept is that a parent process (such as the shell or your program which did a fork and exec) is privileged to be notified of the status of child processes. Therefore the wait system call can be arranged to notify you of these exited processes. You can wait for 'anything' or you can wait for 'a specific process'.
Once wait returns then your process has exited, and you can do additional processing, such as start up the second command. Elizium23 (talk) 02:30, 19 January 2021 (UTC)[reply]
If you are going to execute the first command, grab its process id and give it to tail which will wait for the process to exit, and then execute your second command.
$ command1 &
$ pid=$!
$ tail --pid=$pid -f /dev/null
$ command2
If the first command has already started, find it's pid using pgrep
$ tail -f --pid=$(pgrep COMMAND1_NAME) /dev/null
$ command2
Hope this helps - manya (talk) 06:25, 20 January 2021 (UTC)[reply]
Or if you are starting both commands yourself (as opposed to the first one having already been started by someone/something else), just put the two commands in a shell script one after the other. Then run the script. 85.76.65.82 (talk) 07:13, 20 January 2021 (UTC)[reply]
It is ridiculous to use tail for this purpose. Just use wait.
#!/bin/bash
sleep 10 &
pid=$!
wait $pid
echo "Waiting done, run at will" Elizium23 (talk) 07:33, 20 January 2021 (UTC)[reply]
If your script is not the parent process, and wait does not work, then use kill -0 $pid and evaluate its exit status to see if the process still exists. You can put this in a spin loop. Elizium23 (talk) 07:36, 20 January 2021 (UTC)[reply]
Why is it better to do that than:
#!/bin/sh
sleep 10
echo "yup"
Are we overthinking this or what? 85.76.65.82 (talk) 20:53, 20 January 2021 (UTC)[reply]
...It's not "overthinking" the problem..., just making some (sort of reasonable, but not universally-true) assumptions about the system: the user is not necessarily spawning processes via the bash shell; the user may want to do other CPU work, instead of stalling; the user may wish to avoid expending power and emitting heat by making the CPU execute a busy wait; and so on. The method posted by 85.76.65.82 expressly differs from the method posted by Elizium23, because 85.76.65.82 relies on blocking bash REPL logic and expressly rules out asynchronous control or dispatch to subshell; while Elizium23's method does neither of those things. If you don't know or care what those are, "the methods are darned similar," at face value. At the same time, only one of these methods (the one proposed by Elizium23) is scalable to support multiple processes, or to take advantage of multiple CPUs, and so forth.
As a general rule, bash doesn't know anything about your CPU hardware; but the linux kernel does. So even if we're looking only at the two ways we might do this in the bash shell, using only a single-CPU system - we're still comparing two "superficially-functionally-identical" effects, implemented by two different under-the-hood behaviors: (1) scheduling a wait by depending on the shell's blocking REPL implementation; and (2) dispatching to the operating system (using the shell's builtin wait or the equivalent (wait(2)), which allows the linux kernel to schedule a wait, using the most efficient hardware-optimized scheduling logic.
Per the usual "GNU-is-not-Unix" adage, the actual way that your bash shell interprets and executes wait depends on how it builds against your kernel. The same is true of the way that its REPL logic gets scheduled. It's really easy to get lost in the weeds here, but the take-away message is that wait is almost surely always the more efficient implementation. In certain cases, the worst-case scenario, the difference in efficiency (and power expenditure) can be catastrophically huge. "We all hope" that your computer got installed with a version of linux and bash that were designed and tested and optimized by detail-oriented professionals - but ... we're talking about free software. Components like your linux kernel - and the shell that you use to communicate with it - are usually distributed under a term of service that expressly disavows any warranty of correct operation, fitness for any purpose, freeness from defects, and so forth.
So, use the wait method (or its variants). It will probably be more efficient. For most users on most computers, the efficiency difference is very small - perhaps too small to realistically characterize. For other users, the difference is huge.
Nimur (talk) 21:50, 20 January 2021 (UTC)[reply]
You just put them in a script and run the script.
#!/bin/sh
myprogram1
myprogram2
wait is a shell builtin that you use when running background jobs from your shell, using job control, and want to wait on them to terminate. If you don't start a command in the background using &, it runs in the foreground and the shell waits on it to complete. Note that this will run both commands regardless of whether the first aborts abnormally. We can add error handling if needed. For more on the general topic read this. Also, it's possible a different solution might be more useful. If the programs don't depend on each other, and you just want to avoid loading down your machine, try just running them at a high niceness. On Linux you can ionice them as well. --47.152.93.24 (talk) 04:10, 21 January 2021 (UTC)[reply]

Phone spoofing

I (in the UK) got (yet another) spam phone call today and I used the "who called me" option after the call to get a UK number. I tried phoning it to see what happened and it was answered by what sounded like a pleasant lady and not an automated robot. Is it possible to fake the "called from" number that you get using BT's 1471 "who called me" service? -- SGBailey (talk) 14:06, 19 January 2021 (UTC)[reply]

@SGBailey: Yes. See Caller_ID_spoofing. According to that article, there is a large fine for doing this in the UK, but I don't know how it is enforced. RudolfRed (talk) 15:51, 19 January 2021 (UTC)[reply]
Don't see how it could be considering many VoIP services allow you to modify your Caller ID and those accounts could easily be set up fraudulently or without any checks at all ✨ Ed talk! ✨ 17:14, 19 January 2021 (UTC)[reply]
The PSTN is built on a web of trust that is, nowadays, sorely misplaced. Back in the heyday of phone communications, interchanges and switches could trust one another not to be playing tricks or being hacked or something, but the phone system was not built to have malicious players, providers, or whole countries attached.
See STIR/SHAKEN for a modern effort to combat the spoofing. Attempts are underway. Elizium23 (talk) 17:57, 19 January 2021 (UTC)[reply]

January 20

Wireless Mouse

  • If someone uses an wireless mouse, and uses the built in keyboard on a laptop, can the hacker hijack the keystrokes using the wireless mouse receiver? --つがる Talk to つがる:) 🍁 01:12, 20 January 2021 (UTC)[reply]
    It seems highly unlikely. I am not sure what you mean by "hijack the keystrokes"; there could be exfiltration of what keys I am typing, or spoofing of keys that I did not type, things like that, in theory, but it would depend completely on the kind of hardware in play. There are different types of laptops and different types of wireless mice and endless permutations of them together.
    Let me take a common case as an example. The user has an ordinary laptop and a Logitech wireless mouse with a unifying receiver. Now, the unifying receiver is a special case. It does not use PINs or security to sync devices. It is also a general-purpose input device controller which can have more than one slave. So if the attacker is close enough!!! and manages to sync to the unifying receiver as a keyboard, then the attacker could conceivably execute keystrokes onto the laptop while I'm using the wireless mouse. The attacker would not be able to see the things I am typing on the built-in keyboard, and should not be able to see the mouse movements or button presses.
    Now if we switch the scenario to Bluetooth, that should make it somewhat resistant. If the user is careful, then no unknown devices can pair, under normal circumstances, and so theoretically the wireless mouse could be used without fear of hijack. But Bluetooth has insecurities, so if the attacker were able to pair as an input device, the attacker could be a keyboard or a mouse or both or anything she wants. And it would not be necessary for me to be using a wireless mouse, just having Bluetooth enabled would be enough.
    But all this is highly unlikely in most cases because of two things, proximity and vigilance. Your attacker will need to sidle up very close to your laptop. Sitting next to you at Starbucks. And you would need to be unaware that your keyboard is going haywire. Most people would notice right away. But then the damage could be done? Elizium23 (talk) 05:06, 20 January 2021 (UTC)[reply]

Free reminder software

I'm looking for a program where I can make a note that I need to do something on X date, and the program reminds me when I log into my PC on that date. Suggestions? Clarityfiend (talk) 08:29, 20 January 2021 (UTC)[reply]

Cannot Windows calendar application do this? Ruslik_Zero 10:55, 20 January 2021 (UTC)[reply]
Mozilla Thunderbird and its forks have calendar functionality. Alternatively if what you need to do is on the PC, you can skip the reminder phase and set it to automatically start/open on that date via Windows Task Scheduler. 93.136.149.88 (talk) 23:27, 21 January 2021 (UTC)[reply]
So, like, what OS? Elizium23 (talk) 06:23, 22 January 2021 (UTC)[reply]

Machine Learning Algorithm Tutorial

Could anyone point me toward a written or maybe video tutorial on how to construct a machine learning algorithm from scratch. Specifically I'm interested in decision tree and neural network. I watched a great tutorial on YouTube that really did cover a lot, but it basically just explained how to implement existing python libraries. I don't want to reinvent the wheel, but I do want to have as comprehensive understanding of how these algorithms actually work. TheRiseOfSkittlez (talk) 21:31, 20 January 2021 (UTC)[reply]

Personally, I'd start by reading an implementation of least squares regression in the language of your choice.
If you can't see the connection to a higher parameter-space, re-read our article on regression analysis: almost every machine learning problem is representable as a regression problem over a generalized set of variables. In the case of a neural network, the parameters you are fitting are the numbers - the numerical coefficients - that describe the connectivity of the "neural" nodes. In the case of a decision tree, the parameters you are fitting are the branch probabilities.
If you follow LSQR, you can probably conceptualize the generalization to other fitting methods; actually implementing those methods is pretty painful, but here's a zero-cost full-length textbook that guides the reader through the underpinning math.
Nimur (talk) 22:34, 20 January 2021 (UTC)[reply]

The video course at https://fast.ai is very good. 2601:648:8202:96B0:0:0:0:313A (talk) 06:21, 22 January 2021 (UTC)[reply]

January 22

Is any detailed information about Aaron Swartz's The Info Network available?

Thanks. Apokrif (talk) 03:35, 22 January 2021 (UTC)[reply]

The ArsDigita link from our Aaron Swartz article leads here, which is fairly detailed.--Shantavira|feed me 09:16, 22 January 2021 (UTC)[reply]

Would it be useful to express -why- static variables are useful?

This page is pretty clear in describing what a static variable is, but while I am trying to learn about this, it might be useful to understand -why- they exist; the rationale for them and what benefits they offer - to the compiler, speed of resulting programme etc?

Just a suggestions, I am thankful for the record that exists!

https://en.wikipedia.org/wiki/Static_variable — Preceding unsigned comment added by 92.41.228.205 (talk) 17:06, 22 January 2021 (UTC)[reply]

Before high-level programming languages were developed, the most common situation was that all memory was statically allocated. One way in which functions in a program can communicate with each other is by passing information through parameters. But suppose that in an application there is a centrally important store of information that can be consulted and updated by various functions. In that situation, passing it around through parameters is awkward. The alternative is to use a global variable, which in most languages means it is allocated statically. Depending on the instruction set of the processor, accessing static variables may be faster than accessing dynamic variables; the latter may involve some indirection and pointer arithmetic.  --Lambiam 21:15, 22 January 2021 (UTC)[reply]
Static variables will typically have storage reserved at compile-time. This means no memory needs to be allocated for them at run-time, which can be important in constricted environments such as embedded systems with strict memory limitations. This also means a given static variable has a fixed memory address, which can be necessary for low-level stuff like device drivers. --47.152.93.24 (talk) 03:56, 23 January 2021 (UTC)[reply]
It’s primarily a matter of static variables being simpler to use in most dual-processing analytic applications. Coding doesn’t generally account for dynamic variable modeling, so from an informatics engineering perspective, allocation of dynamic parameter values are limited to a pre-designated and finite virtual framework. In these situations I generally reference a self-defined iterative conversion algorithm (structured the same way as in other applications, like encryption key generation). It’s a simple method that bypasses some of the issues mentioned above. Pootersmear (talk) 04:49, 23 January 2021 (UTC)[reply]

Change in key's meaning

I use Google Chrome. Traditionally when I press F6 it takes me to the URL bar where I can edit the URL I'm at. But now when I press F6 it highlights my current tab. Any reason the F6 key's function changed?? Georgia guy (talk) 18:08, 22 January 2021 (UTC)[reply]

Oops, just after I saved my edit, F6's behavior was back to normal. Georgia guy (talk) 18:09, 22 January 2021 (UTC)[reply]
And now it changed again. Georgia guy (talk) 18:10, 22 January 2021 (UTC)[reply]
FWIW, you can also use Alt+D to access the URL bar. Elizium23 (talk) 21:36, 22 January 2021 (UTC)[reply]

January 23

Leave a Reply