Finding a non-quadratic residue mod $p$

Question: Let $p$ be an arbitrary big prime. Is there any fast algorithm to find a non-quadratic residue mod $p$? If $p\equiv 3(\,\mathrm{mod}\, 4)$, then $-1\equiv p-1$ is always a non-quadratic residue. However, if $p\equiv 1(\,\mathrm{mod}\, 4)$, then we can't just choose $p-1$. For $p\equiv 5(\,\mathrm{mod}\, 8)$, it is also known that $2$ is a non-quadratic residue, but we have to deal with the case when $p\equiv 1(\,\mathrm{mod}\, 8)$.
Is there any easier way to do this?
Comment: The legendre-symbol can be calculated efficiently and decides whether a given integer is a quadratic residue mod $p$
Comment: @Peter I know that quadratic reciprocity makes the computation of Legendre symbol very easy (maybe $O(\log n)$?), but I hope there's much simple way to do this.
Comment: If you are interested in the practical aspect, the fastest way is simply to choose randomly in $\{2,p-2\}$ and test whether it is non-quadratic residue. On average only two tries are required and since the test is fast you find it very easily. (Say via Euler's criterion.)

For example this is what is commonly done for the [Tonelli–Shanks algorithm](https://en.wikipedia.org/wiki/Tonelli%E2%80%93Shanks_algorithm) does. One of the substeps requires finding a non-quadratic residue.
Answer: One method, which works for all odd primes $p$ (no need to check the residue modulo 4 or modulo 8) is to seek an odd prime $q$ for which $p$ itself is (congruent to) a nonquadratic residue modulo $p$.  Then by quadratic reciprocity you choose $q$ or $-q$ such that the choice has residue $1 \bmod 4$, and this choice is a nonquadratic residue mod $p$.
Example:  $p=23$.  Then $p=23\equiv 2 \bmod 3$, and $2$ is a nonquadratic residue modulo $3$.  Since $-3 \equiv 1 \bmod 4$ we infer that $-3$ will be a nonquadratic residue modulo $23$.
Addendum
How many trials should we expect before hitting on a nomquadratic residue?  For $q=3$, half of all larger primes give a nomquadratic residue modulo $3$ (meaning $2 \bmod 3$ instead of $1 \bmod 3$).  We get the same 50% probability for each additional prime $q$, so on average two trials is usually enough.  But what if, metaphorically, the coin keeps coming up tails?
Define $f(q)$ as follows:

$q$ and $f(q)$ are both odd primes with $f(q)>q$.
For every odd prime $p$ less than $f(q)$, a nonquadratic residue is found using a smaller trial prime than $q$, but $p=f(q)$ requires testing up to the prescribed value of $q$.

For instance, all odd primes $3<p<19$ give a nonquadratic residue using $q=3$ or $q=5$, but $p=19$ requires $q=7$.  Then $f(7)=19$.  We find that
$f(3)=5$
$f(5)=7$
$f(7)=19$
$f(11)=79$
$f(13)=151$
Based on probability arguments, it is expected that $2^n<f(q)<2^q$ where $q$ is the $n$-th odd prime in ascending order.  For instance $q=7$ implies $n=3$, and $f(7)=19$ lies between $2^3=8$ and $2^7=128$.  This is a wide range for the value of $f(q)$, but if the proposed range is true it guarantees that the maximum number of trials required for a large prime $p$ will be $O((\log p)^{1+\epsilon})$ for arbitrarily small positive $\epsilon$.  The maximum drops to  $O(\log p)$ if a list of primes is known or (nowadays) efficiently generated.
Comment: Is finding $q$ easy in general? If it is, then this will be a good way.
Comment: Basically I would use trial and error.  You could also find a primitive root and you're good with that, but this is not straightforward, either.

Finding a non-quadratic residue mod $p$


What is the concept of pruning a tree in Machine Learning regression problems?

Question: What is the concept of pruning a tree in Machine Learning regression problems? I am confused and a simple explanation would be great.
Answer: The concept of pruning a tree is mainly to avoid overfitting in either decision tree (DT) classifier or regressor learning when there is noise in the data or the number of training samples is too small to produce a representative sample of the true target function.
Furthermore DT regressor usually needs to transform possibly many features' continuous ranges to dynamically created possibly multiple ad hoc Boolean test attributes based on their information gains without firm theoretical basis, and each of its leaf nodes contains a constant value that serves as the predicted value which is typically the mean or median of the target values of the training data in each leaf node partition, therefore this effectively creates a noisy training dataset even the untransformed raw dataset is noise free. Thus for regression problem DT learning is very prone to overfitting and the concept of pruning becomes extremely important to reduce its inherent high variance and MSE/R-squared of its performance metrics.
Of course the learning algo can stop growing the tree earlier before it reaches the point where it perfectly regresses all the training data, but it's difficult to estimate precisely the minimum tree depth or leaf nodes.

Prepruning methods share a common problem, the horizon effect. This is to be understood as the undesired premature termination of the induction by the stop () criterion.

Thus post-pruning (or just pruning) is the most common way of simplifying trees. For DT regressors you just replace below classification accuracy confusions of validation data with MSE or R-squared

Here, nodes and subtrees are replaced with leaves to reduce complexity. Pruning can not only significantly reduce the size but also improve the classification accuracy of unseen objects... The procedures are differentiated on the basis of their approach in the tree (top-down or bottom-up)... One of the simplest forms of pruning is reduced error pruning. Starting at the leaves, each node is replaced with its most popular class. If the prediction accuracy is not affected then the change is kept. While somewhat naive, reduced error pruning has the advantage of simplicity and speed.

For a detailed pioneering example of the popular reduced error pruning see Quinlan, J. R. (1987), 'Simplifying decision trees', International Journal of Man-Machine Studies 27, 221-234.


Is there any resource for UI patterns of web applications?

Question: I've recently started designing a web application for a project and at times, I realize there is a better solution but don't know where to look or how to do it myself easily. Is there any resource that collates best use-cases with design samples in web application user interfaces?
Comment: Is material design what you are talking about?
Comment: Material design is great for individual components but how they come together and work in real-world applications would be incredibly helpful.
Comment: All of google's stuff is material, android, chrome, google drive, docs, etc. and there's also examples in the material design doc
Answer: Not sure if you are looking for design patterns (i.e. technology and implementation agnostic design solutions to common user tasks and problems) such as those documented in UI Patterns or something more specific that has CSS and HTML like CodePen or just concepts like those in Dribbble or Behance (when you search for specific keywords).
I actually wish there was a site that collected good design patterns rather than the Dark Patterns website that has all the bad examples.
The one that I can think of which specifically relates to map based applications that has the type of detail you are looking for is Map UI Patterns.
But there are plenty of design systems that you can actually look up for inspirations or ideas like Atomic Design, Google Material Design, Microsoft Fluent UI, Carbon Design System by IBM, etc. Or ones specifically related to web applications like Bootstrap or Ant Design System.
Answer: I found a great resource for UI patterns which also provides some ideas as well.
https://www.uxlibrary.org/explore/ui-design/ui-patterns-and-inspiration
There are many references on that site but the ones that I found most useful are:
Checklist Design
ReallyGood UX
UI Patterns
Answer: Good resources I discovered some time ago are:
https://www.pageflows.com/
https://saaswebsites.com/pro/


Relating 2 proofs of: If there are $m$ linearly independent vectors in $\mathbb{R}^n$, then $m\leq n$

Question: I know of a proof using the exchange lemma, but I am trying to relate this approach to the approach using row reduction. The proof from my text (Linear Algebra Done Wrong) goes something like: since the vectors are linearly independent, the echelon form of the matrix with the $n$ vectors as columns has $n$ pivots. But there are only $m$ rows, so the number of pivots cannot exceed $m$. Hence $m\leq n$. However, I feel uneasy about the step, because it seems so much easier than the proof the exchange lemma. Where is the difficulty hidden in the proof using row reduction?
Answer: The proof uses the fact that every matrix can be transformed to echelon form. The transformation to echelon form is done via row operations, and it requires a proof that it actually works. You may regard this as the "hidden" part. In fact, the procedure of row reduction is closely related to the exchange process in the Steinitz exchange lemma.
Comment: Could you elaborate on what you mean by 'closely related'?
Comment: The rows $r_1,..., r_n$ of a $n \times m$-matrix can be regarded as vectors in $\mathbb{R}^m$. They generate a subspace $V \subset \mathbb{R}^m$. In a row operation a row $r_k$ is replaced by a linear combination $\Sigma_{i=1}^n a_i r_i$ with $a_k \ne 0$ (a row exchange of $r_k$ and $r_l$ is the combinaton of three such operations: $r'_l = r_l + r_k$, $r'_k = -r_k + r'_l = r_l$, $r''_l = r'_l - r'_k = r_k$). Via row operations $\{ r_1,..., r_n \}$ is transformed into a certain basis $\{ b_1,...,b_k \}$ of $V$.
Comment: The same idea (replacement of a vector $v_k$ by a linear combination $\Sigma_{i=1}^n a_i v_i$ with $a_k \ne 0$ ) is used in the exchange lemma.


Are there any Pokemon cards banned in unlimited format?

Question: The Pokemon website says that no cards are banned in unlimited format. Is this true? Are cards such as _____'s Pikachu or Ancient Mew banned? What about jumbo cards?
Answer: Unlimited format has no official tournaments, so it doesn't get much attention from Pokémon.  However, the general statement that no cards are banned is correct, though with some caveats as below.
Jumbo cards are banned in tournaments per a ruling in the Compendium:

No, you cannot. You may only use cards that have been released for TCG play in the standard size. Jumbo cards are artistic representations of the legal card's art.

___'s Pikachu is legal to play in the Unlimited format.
Ancient Mew would be illegal due to the different card back.
Comment: Where the ruling about a different card back being illegal? [Bulbagarden](https://bulbapedia.bulbagarden.net/wiki/Ancient_Mew_(The_Power_of_One_promo)) says Ancient Mew is banned because of the unreadable Runic, and also says that _____'s Pikachu is banned, and [says](https://bulbapedia.bulbagarden.net/wiki/%27s_Pikachu_(Wizards_Promo_24)): "Both Japanese prints have the clause '(This card cannot be used at official tournaments)' to the right of the illustrator name". I would post an answer, but I don't have more official references.
Comment: Are the only banned cards ones with different backs or different sizes?
Comment: Same back is more of a common sense thing - it is referenced in some rulings, but not explicitly in the rules.  (Again, this is really a "tournament" ruling, which ... may or may not make sense for the context of this question, but there's nothing *better* really.) ___'s Pikachu doesn't have that text in English, and so I don't see why it wouldn't be legal in Unlimited formats here (but again there are no official Unlimited tournaments).
Comment: I'd also note that Bulbapedia seems to be referencing Wizards rulings, which are not necessarily valid any longer (Wizards hasn't controlled the game for twenty years now.). In fact, Ancient Mew was legal in *Standard* in Japan for a while (but never in the TPCi regions.)
Comment: @Joe For what it's worth, and it's probably not worth much, since what applies to one game obviously doesn't say much about what applies to others, but Magic The Gathering has tournament-legal double-faced and meld cards that don't have card "backs" (requiring sleeves or helper cards if you want to play with them). Although they haven't otherwise changed their card backs (apart from contraptions and attractions, which don't go in your regular deck and are part of non-tournament-legal sets in any case).
Comment: Yeah, this actually changes when TPC took over Pokémon TCG from Wizards, the first publisher of the Pokémon TCG!


SATA Connector for GTP transceivers

Question: i have a Artix7 board with 4 SATA connector on it, i want to use these connectors for GTP transceiver, just connectors and i don't want to use SATA protocol, actually i do not know how to write XDC file for my SATA connectors, should i change the default xdc file? or the default xdc connects one tx to rx of other port? do i have to connect tx and rx myself?
Comment: External or internal transceivers? If they are internal, then look at the datasheet for the FGPA and it will tell you what your options are. If external, look at the schematic for the transievers and which pins they are connected to
Answer: The transceiver pinout is fixed, so if you want to use them, you are responsible for the physical layer wiring.
Your board documentation should show the pinout but you will probably find yourself needing to make a "Sata" crossover cable of some kind.

SATA Connector for GTP transceivers


C# Encrypting string in DES 3 CBC mode

Question: Is it normal that when I use Double DES secret key to encrypt a string in DES3 CBC mode then I always get the same cipher text? For testing I'm using IVC=0.
Comment: Are you using a standard .NET library, or something you picked up online?  Got a code snippet?
Answer: If you encrypt the same thing it is normal, if you encrypt something different it is not normal. In that case you have probably an error in your implementation.
A common error is to translate the encrypted result to string for transport, all non-readable bytes are then changed to "?" by .net.
Comment: Yes, im encrypting exactly the same thing. I,m not translating the result to string, im just comparing the bytes what il get back from the Encrypt function.
Comment: That's why a good encryption algorithms like AES takes an IV (initialization vector). The IV has many similarities with the salt when hashing passwords. It makes sure that even though you encrypt the same text, the cipher text becomes different (as long as you use a different IV of course)
Comment: IV has nothing to do with DES nor AES. IV's are used in some modes of blockciphers (CBC for example).
Comment: Thanks, i had an error in my solution (The IV wasn't passed to the mechanism properly)
Answer: Yes, if the IV is the same and the message is the same, then you should expect the ciphertext to be the same.
I hope you are aware that using a fixed IV (like IV=0) is insecure.  (The reference to double DES is also puzzling.  Double DES is insecure.  Of course, you also mention DES3, so if you meant triple DES, then this comment can be ignored.)  In addition, if you are using encryption without authentication, that is also likely to be insecure.
Instead of putting together your own encryption, I suggest you use a standard scheme, such as the OpenPGP data encryption format (for data at rest) or SSL/TLS (for communication channels).

C# Encrypting string in DES 3 CBC mode


Stolen Remote Desktop Protocol (RDP) credentials

Question: I would like to know how to guard against RDP-renting services such as dedicateexpress.com which rents out stolen corporate laptops credentials. Are there IDS for such events?
Answer: Truthfully the best way would to protect yourself from having your credentials stolen is to protect them.

If you are building a login script make sure the password is not hardcoded into the script.
Have a strong password against bruteforce
Change your password every 30 days or so (Windows has a built in reminder that can be turned on)
Do not share the password with anyone you do not trust
Keep your system up to date so all vulnerabilities are patched

Are there IDS for such events?

I was not able to find one but you could use the RDP log file to make sure there is no intrusions (Depending on your windows machine the log system is in different locations. A quick Google search will find you the location)
Comment: One method of NIDS checks for unusual locations of the stolen corporate laptop and/or repeated login attempts or evidences of DoS attacks. However, the transition period between the actual alarm of system intrusions or network intrusion is unknown.


Ubuntu 18.04 does not wake up from suspend on ASUS Zenbook

Question: I installed Ubuntu 18.04 on a new ASUS Zenbook recently and virtually everything works almost perfectly. With one exception: Suspend/Resume is broken. Ubuntu seems to be aware of that and by default, selects s2idle:
$ cat /sys/power/mem_sleep
[s2idle] deep

Of course, this means that the laptop's battery is down by about 30% after a day of sleep and it means that the laptop really isn't useful as the mobile device it's supposed to be. I can activate deep sleep by
$ echo deep > /sys/power/mem_sleep

And then the computer does suspend properly (for example via pm-suspend). I can see this because the power indicator LEDs on the side and in the power button start blinking slowly, in the same way as they do on my four-year-old Zenbook. If I wake the laptop up by pressing the power button briefly (or by opening the lid), the computer seems to start waking up (the power indicator LEDs go from blinking to steady light), but neither does the screen turn on, nor does the computer react to the keyboard in any way, nor can I ssh into it.
There are a couple of posts online that seem to find similar behavior with the nouveau driver for NVIDIA graphics cards. But neither does my computer have an NVIDIA card (it has a built-in Intel), nor does the nouveau driver accidentally get loaded.
Another set of online advice recommends using older/new kernels. I've tried kernel versions down to 4.14.41 and up to some 4.18 versions, both none of them changed this behavior.
I'm a little stumped here. I don't even know where to start diagnosing this. Any help would be greatly appreciated.
p.s. Hibernate doesn't work either, but I'm not overly eager to get it to work.
Comment: [This post](https://askubuntu.com/questions/1217974/why-would-a-suspend-issue-exist-on-an-installed-os-but-not-its-live-disk) and [this post](https://askubuntu.com/questions/1198969/how-to-find-acpi-drivers-for-specific-acpi-device-solving-kernel-suspend-bug) might help to troubleshoot and understand.
Answer: I had the same issue - here are some things I've come across in different posts on the topic that you may consider:

Update your graphics driver;
Check your Swap partition size. As answered here, you'd need at least 1.5x the size of your RAM for allocated to your swap partition for hibernation to work. You can check your active swap with swapon -s. I found this page to be very useful on how to manage swap;
Finally what really solved it for me - I switched from Xorg to Wayland. On your log in screen choose Ubuntu on Wayland from the options menu next to the Sign In button.

Hope this helps.
Comment: Those are about hibernation. I'm trying to get s2ram to work.


USB type-C ports max power supply from MacBook Pro?

Question: What are the max power supplied by Apple's touch bar MacBook Pro from its USB type-C ports?
Answer: USB-C alone allows 4.5 Watts ( 900 mA @ 5 V ) and thunderbolt 3 improves on that greatly.
According to Apple:

MacBook Pro (15-inch, Late 2016) and MacBook (13-inch, Late 2016, Four
  Thunderbolt 3 Ports) can power two devices that use up to 15 watts,
  and two more devices that use up to 7.5 watts. It doesn't matter which
  side of your MacBook Pro that they're connected to—power is delivered
  on a first-come, first-served basis.
MacBook Pro (13-inch, 2016, Two Thunderbolt 3 Ports) can power one
  device that uses up to 15 watts and one device that uses up to 7.5
  watts.

Thunderbolt Source: https://support.apple.com/en-us/HT207256
USB Source: https://support.apple.com/en-us/HT201163
The above specs are the same for the 2017 MacBook Pro models. The MacBook models only have USB levels of power and data available.
Comment: "USB-C alone allows 4.5 Watts". This seems to imply that power delivery above 4.5 Watts is part of the Thunderbolt 3 spec and is not part of any USB specs. I think this is incorrect, as USB-PD defines power delivery schemes for up to 100 W. The question is which of those schemes the MacBook Pro etc support for power in and power out.
Comment: " The question is which of those schemes the MacBook Pro etc support for power in and power out. "  MacBook Pro laptops with USB-C ports support power in up to 100 W by USB-PD, and power out up to 15 W by USB 3.x.  USB-A ports will provide between 4.5 W and 12 W depending on the maximum power allowed by the USB spec in effect at the time the laptop was designed.  Power out on USB-A will be negotiated by USB 2.0 or USB 3.x.  I do not recall any evidence of Apple using USB-BC or USB-PD for power out on USB-A ports.


When to dry hop a barley wine

Question: I was planning on aging my barley wine in a carboy. Is it appropriate to dry hop upon transfer to the secondary for aging.  Or would it be better to dry hop after I consider the aging process to be done, i.e. prior to bottling?
Answer: Leaving dry hops in there for more than a 3-4 weeks usually isn't a good idea, you start to get more vegetal hop notes. I'd do it closer to bottling -- perhaps do several small dry hop additions over the course of the 3 weeks leading up to bottling.
Comment: I find that things like "vegetal" character from dry hopping are more related to the variety of hops you use than time.  When I keg hop, the hops are in there for months and don't get vegetal.
Answer: I routinely leave dry hops in beers for months and get no vegetal flavors.  When to dry hop it up to you.  I generally do it in xfer to secondary just because I'm lazy...err, pragmatic....and want to get everything done in one step.  From that point, the hops will be in there anywhere from 2-6 months.
Comment: Do you think that hop aroma diminishes over that period of time?  Or can you compensate for that by using more hops in the first place.
Comment: I haven't actually studied this, but my gut feeling is that no, it doesn't diminish.  I base that solely on taste results.

When to dry hop a barley wine


When a consonant and a vowel meet together, from where the sound start?

Question: By IPA chart in Wikipedia,
[m] is made, up in front of the mouth, and [ɑ] down at the back.
In this case, where do you say [ma] is made? I mean, is [ma] made in the middle of the both positions of [m] and [ɑ]? If yes, I wonder [ɑ] could be changed into variety of sounds dependent upon with what it combines: [m] or [l] or [h] or etc. Because it needs to be started at various places.
Comment: Better on linguisticsSE.
Comment: @Kris, yes, I thought that and posted the same one on the website. But it was not active as much as this. So I deleted the question and re-tried here.
Answer: [m] is a nasal consonant, meaning, before the air escapes from the mouth creating the [ɑ] sound, it first escapes through the nose.
The articulation of [mɑ] has two steps, and therefore two places of articulation.
The consonant is created by putting the lips together and opening the nasal passage-way, and along with vibrations in the vocal folds (this is a voiced consonant) creates the consonant [m].
The vowel requires open articulators, so the lips have to open. The vowel is shaped by lowering the root of the tongue to create the [ɑ] sound.
This can also be seen in a spectrogram (a visual representation of the spectrum of frequencies in a sound). You can see the differences in the sound waves (top half) and the concentration of the formants (bottom half) between the two segments, indicating two places of articulation.

This is the spectrogram of [ama], the two shorter red lines are the [a] vowel and the longer lower one is the [m].
As to [ɑ] changing into a variety of sounds, that could definitely happen. As vowels and consonants are rarely pronounced in "vacuum", and are usually very close to other segments, strange and magical things happen to them. For example the word "prince" can sound like the word "prints" if you don't pay attention and look at the the speaker. Or in the example above, pronouncing [mɑ] in rapid speech can cause the [ɑ] to become nasalized, which makes you sound like Fran Drescher.
Comment: +1 And it takes a finite amount of time to move the physical organs; and movements may not be perfectly synchronized.
Comment: +1 And, on a different note, do you happen to be on linguisticsSE or another related SE Q&A? I would like to ask a more technical kind of related question.


Is it grammatically correct to write restrictive clauses (of the form: which ... ) in this way?

Question:
The darkness, which had felt like it would last forever, gives way to dawn.
The heavens open and light, which had seemed never to return, flows down.
I could not help be overcome by wonder as I watched all creation, which had been swallowed by the darkness, come back to life.
Comment: What exactly puzzles you about them?
Comment: I'm not sure if the sentences are grammatically/idiomatically correct. Something feels off to me but I can't figure it out.
Comment: That should be *could not help **being** overcome* in #3. Personally, I think it's a rather odd thing to say. Partly because being *unable to help* experiencing some feeling, and being *overcome* effectively mean the same thing. Partly because you normally say you *couldn't help doing something* in contexts where if you *could* avoid it, you *would*. That wish to avoid the experience seems unlikely in OP's context.
Answer: Yes, there's no grammatical problem writing them, but the sequence of tenses is not correct: you can't use past perfect and simple present in the same sentence, as you do in sentences 1 and 2; neither makes grammatical sense.
Even though the sequence of tenses is correct in sentence 3, it clashes with the simple present in sentences 1 and 2. You must be consistent about tense. That's not style, it's grammar.
In sentence 2, you need a comma after "The heavens open". If it's not there, you lead the reader down the garden path to believing that "open" is a verb rather than a noun which is the subject of the conjoined clause.
Comment: Thank you. So will they work, if I rewrite them in the following manner?

1. The darkness, which felt to last forever, gives way to dawn.

2. The heavens open, and light, which seemed never to return, flows down.

3. I could not help be overcome by wonder as I looked on as all creation, swallowed by the darkness, came back to life.
Comment: @Soulz: No, your rewrite doesn't work either. This one is **grammatical** and stylistically consistent: "1. The darkness, which felt as if it would last forever, gave way to dawn. 2. The heavens opened, and light, which {seemed as if it / , it seemed, } would never return, flowed down. 3. I could not help {being / but be} overcome by wonder as I looked on and saw all creation, which had been swallowed by the darkness, come back to life." I make no claims about the quality of the prose, however. That's a personal judgment not mine to make. Just consider the grammar. I'm not a literary stylist.
Comment: So the biggest problem with the sentences was the mixing of the past perfect and present tenses within the same sentence.

Thank you for the excellent answer.


Asalamoalikum! Brother can you tell me about mu'allaq Hadith

Question: Asalamoalikum! Brother can you tell me about mu'allaq hadith
Comment: What research effort have you done? Searching on google yields useful results like: https://islamqa.info/en/answers/83754/ ...
Answer: Simply speaking if an author of a hadith compilation, doesn't mention the narrator chain of a hadith or hadith quote (part of a longer hadith) he's quoting and initiates the quote by words like:

The messenger of Allah said:...

then this hadith can be regarded as "Mu'allaq".
The term "المعلق" "al-Mu'allaq" in Arabic literally means "hanging" or "suspended", in other words it means for example if we are referring to a statement then we may call it a commentary of an unknown source.
As a matter of fact such ahadith are very common in Sahih al-Bukhari. In many cases, the author only compiled them in this form to remain brief since he'd be mentioning it elsewhere in his book or in other books with the complete chain of transmission.
If this was the case the hadith properly speaking is no more mu'allaq since its source or chain of transmission is known. And in that case its authenticity can rather be easily qualified.
If on the other hand, the hadith or hadith quote remains without a reference to a source it would rather be rejected. Scholars however would regard the Mu'allaq hadith of the two Sahihs as rather authentic, but as stated these are mostly compiled in other sources.
For example in Sahih al-Bukhari in the book §6 Menstrual Periods you may find him quoting right after the heading:

وَقَوْلِ النَّبِيِّ صلى الله عليه وسلم " هَذَا شَىْءٌ كَتَبَهُ اللَّهُ عَلَى بَنَاتِ آدَمَ "
And the prophet may Allah's prayers and blessings be upon him said: "That is something that Allah, has decreed for the daughters of Adam."

This is a part of a sahih hadith and it was compiled by imam an-Nasa'i in his Sunan, imam Muslim in his Sahih and by imam al-Bukhari himself in his Sahih several times in the same chapter see for example here and in the context of the sacrifice of hajj see for example here just to show some incidents of this hadith quote.
Definitions
More accurate definitions may be found in the fatwa from islamqa #83754 which was linked in @UmH's comment:

A mu'aallaq (lit. suspended) hadeeth is one in which one or more narrators are omitted from the beginning of its isnaad by the muhaddith who compiled the book.

And a definition from ibn Hajar al-'Asqalani in his Nuzhat al-Nazar:

Among the forms of mu'allaq hadeeths are:

Where the entire isnaad is omitted, so it says for example: The Messenger of Allaah (peace and blessings of Allaah be upon him) said…
Where the entire isnaad is omitted and only the name of the Sahaabi or the names of the Sahaabi and Taabi'i are left.
Where the name of the one who narrated it is omitted and it is attributed to someone who came above him (in the isnaad).

Here's another definition that I'd like to add to those above found in an article in alukah.net:
In the following I'm translating from Arabic, since these translations are of my own with some support of google-translate take them with the necessary care!

الحديث المعلق هو ما حُذِف مِنْ مبدأ إسناده راوٍ فأكثر على التوالي، سواء كان الحذف لجميع السند ثم يقول: قال رسول الله - صلى الله عليه وسلم - كذا، أو فعل كذا، وسواء حذف كل الإسناد إلاَّ الصحابي أم إلاَّ الصحابي والتابعي.
A mu'allaq (suspended) hadith is one of which the beginning of its chain of transmission one or more narrators in succession have been deleted (omitted), whether the deletion is for all of the chain of transmission and then he (the author) says: The Messenger of Allah - may Allah's prayers and blessings be upon him - said such-and-such, or did such-and-such, or whether all of the chain of transmission is deleted except for the companion (Sahabi) or except for the companion and the follower (Tabi'y).

This last definition distinguishes Mu'allaq hadith from Marfoo' or Mursal hadith clearly,


GTA 5 Rank 10 and I still cannot unlock crew Spray?

Question: I am currently Rank 10 in GTA 5 and I still cannot unlock crew sprays. Is it an in-game bug, or should I do something specific?
Answer: If you are referring to the crew paint job color for cars, you need to be level 20.
From IGN's Wiki on Crews:

Level 20 - Able to set crew emblem decal, and color on cars

I believe that this is your Crew level, and not your character level.
Comment: Just to add a little more information to the post: You can check your active crew level by navigating to the Rockstar Socialclub website, click on your active crew and when you're on the crew's page select 'GTA Online'.


Resident getting married to tourist

Question: I'm a permanent resident of the USA and my fiancé came as a tourist with her son for 3 months. After been together here, I don't want her to go back to Chile and have her wait another year for her to come back. Her son just started school here, we are planning to get married so she doesn't have to go back. Will this prevent her from having to go back so we can stay together as a family?
Comment: If your wife entered in the visa waiver program, she will have to leave the US.  VWP visitors are ineligible to adjust or change their immigration status.
Comment: You are seeking "Adjustment of Status". I suggest searching for and reading about that.
Comment: "VWP visitors are ineligible to adjust or change their immigration status." Except for Adjustment of Status as an Immediate Relative (spouse, unmarried under-21 child, or parent of US citizen), which is allowed.
Answer: The process for getting permanent residency inside the US is Adjustment of Status; the process for getting permanent residency at a US consulate abroad is Consular Processing. Both of those processes require a visa number to be available first. The spouse of a permanent resident is in the F2A category, which has a wait for visa numbers of around 2 years. That means you have to wait until about that long after filing the I-130 petition (which can only be filed after the marriage) before she can proceed to either AOS or CP if she qualifies. (For AOS, in some months, it is possible to file a little earlier, but it doesn't make a significant difference in your case.)
Since she is not in the Immediate Relative category (spouse, unmarried under-21 child, or parent of US citizen), she is required to be in status at the time of applying for Adjustment of Status. If she is on B2 visitor status, that is usually for no more than 6 months, far shorter than the 1-2 year wait for visa numbers before she can file. If she is a visitor on the Visa Waiver Program, she is not allowed to do Adjustment of Status at all since she is not in the Immediate Relative category.
The proper way would be for her to leave on time and wait to do Consular Processing abroad when a visa number becomes available. If she stays illegally in the US, there is no way for her to get permanent residency no matter how long she waits, unless you become a US citizen.
Comment: I think OP's best option (assuming he is on the path to citizenship already) is to petition in the F2A category and later on [upgrade the petition](https://www.immihelp.com/greencard/familybasedimmigration/petition-upgrade.html) if he becomes a citizen before things have been approved - you don't lose your place in line this way, and things move a lot faster for citizen petitions vs. LPR petitions. Waiting sucks, but anyone who wants to do this legally has to wait.

Resident getting married to tourist


Voltage Drop and Current Flow

Question: Assume we have a source @100 DC volts in series with a 200 ohm resistor. According to Ohm's Law, current flow in 0.5 amps. Voltage drop across this resistor is 100 volts and equal to the source voltage. If voltage drop is 100 volts(meaning none is left on the "outflow" or  neg. side of the resistor), then how can current continue to flow to the neg. term ? There is no electrical pressure(voltage) left to push the electrons.
Comment: I think in your description occurs a common misconception. The voltage-difference is between the two terminals of the battery. Since the terminals are connected via the wires this voltage difference is applied across the whole circuit. This voltage difference does not simply vanish after the resistance. Therefore, I also think that it is very misleading of teachers and textbooks to talk about a voltage drop.
Answer: This problem is an idealization; real batteries have an internal resistance, and so do the wires.
In this idealized circuit the wires have no resistance, nor do the connections.  You can logically collapse them to points -- and this brings the battery terminal into contact with the resistor; the current has obeyed Kirchoff's rules, and has arrived at the battery.
Answer: You say 'no pressure (voltage) to push the electrons', but
doesn't that mean there's no acceleration of the electrons?  They're
already in motion, and they stay in motion.
Were the current to drop, there would no longer be an equal I*R to
the applied V.   That would break Kirchoff's rule for voltage.
Comment: Are you talking about a perpetual motion machine? Just saying...

Voltage Drop and Current Flow


Onkeypress doesn't detect first character

Question: I am trying to remove watermark of text box on enter of first character
I have written event of key press, after enter of key it returns length of zero on first character. I tried key up, problem with key up is when some one holds continuously the key the
water mark doesn't hide:
<input type="text" autocomplete="off" id="txtHomeSearch"  onkeyup="javascript:CheckInputLength(this,'lblwatermark')"/>

function CheckInputLength(e,labelid) {
    if (e.value.length != 0) {
        $(labelid).className = 'NewHP_LabelSearch';
        $(labelid).hide();
    }
}

The water mark doesn't hide on onkeypress event.
Please help me out
Is there any event detects the on change of text box for first character and copy paste..
Answer: The keypress event happens before the key is accepted by the <input>. (People use this to prevent the <input> from accepting the event.) You want to use the input event, which fires after the value has changed.
Answer: change this onkeyup="javascript:CheckInputLength(this,'lblwatermark')" to this onchange="CheckInputLength(this,'#lblwatermark')"
You needed to add in a # character in the beginning to make it a valid id selector. Also the javascript: thing is not needed so took it out.
Edit:  reread question.  It looks like poster wants the onchange event for the input


What is the cheapest Macro lens I could get for my Canon 600 D?

Question: I have Canon 600D and want to buy the cheapest and best Macro Lens. Which would be the best and cheapest lens for Macro photography? Please help!
Thanks!
Answer: The best macro lens in terms of usability, versatility, and image quality, will be a lens specifically designed as a macro lens for your system.  In your case, the best macro lenses for a Canon 600D would be the Canon 60mm f/2.8 Macro EF-S, which is currently US$470, or the Canon 100mm f/2.8 Macro EF which is currently US$550.
If you are just starting out with macro photography, the cheapest way to get to true macro photography (1:1 or higher reproduction ratios) would be to use extension tubes or close-up lenses.
Extension tubes allow an existing lens to focus closer, but eliminate the ability to focus far away, reduce the light reaching the sensor, and often reduce you to manual focus and manual exposure.
Close-up lenses (sometimes called diopters) screw onto the front of your lens like a filter and act like a magnifying glass for the image.  They also eliminate the ability the focus far away.  But they tend to degrade the image by adding extra chromatic aberrations and more glass/air surfaces that can cause flare and unwanted reflections.  Higher-quality close up lenses like the Canon 500D and 250D use Achromatic lenses to reduce chromatic aberration, but are much more expensive than the the typical close-up lenses.
Comment: Unfortunately, Canon has used the model number "500D" for both a close-up filter *and* an APS-C DSLR. The confusion is understandable, but not Icycle's fault.
Comment: @StanRogers now it all make sense.
Comment: I think you need to review your answer, seems like there are something that is not correct in your last paragraph. Since i'm not sure what you meant there, I will not try to edit it.
Comment: And it's a huge pain when you try to search for info about the 500D close-up lens, since you tend to get results about the DSLR instead. Thanks Canon.
Answer:
want to buy the cheapest and best Macro Lens

Seem a little bit difficult to satisfies both properties in one lens.
Personally I can recommend you the Canon EF-S 60mm 2.8. I own this lens by my self and I'm very happy about image quality. Disadvantage of the glass is that is sometimes hard to take a picture form small animals (bug, spiders, ...), because with this 60mm lens you have only very little minimum focusing distance when you want a 1:1 shot.
Canon offers at the moment (at least in some European countries) a cash back promotion. If you consider to buy this lens you should have a look for this.
Answer: look also at sigma 105mm 2.8 EX if you agree on non canon lens (or 50 mm)
the 105mm give a good ratio (like the 100mm from canon) between deep of field / weight / distance to subject (especially without tripod where the canon with the IS have a big advantage if price was not considered like here)
EX version of sigma lens give a good quality (generally just under the L serie of canon with some flag lens, this 105 is not a flag lens but give excelent result with few aberation and an excelent 'piqué')
I often use it even without macro photo because it give a very interesting bocket ("blured background") compare to my 70/200 L serie.
Auto focus is not the fastest but help enough for macro shoot on "static" subject. On non macro photo, is is too slow and i often use the manual option when speedy focus is needed.
Until now, no specific problem or bad picture (due to lens :-D)
The 50 mm (I don't test) seems to be of the same kind cheaper
Comment: Could you expand your answer to explain why this is a good alternative? We prefer detailed answers here rather than one-liners.


Proof of a series having infinitely many zeros in the unit disc

Question: I have read an interesting question recently. This is about a series having infinitely many zeros inside the unit disc $U$. The series is
\begin{equation*}
   f(z)=\sum_{k=1}^\infty 5^k z^{n_k},
\end{equation*} where $\{n_k\}$ is a sequence of integers such that $n_1 \ge 2$ and $n_{k+1}>2kn_k$. I have shown that $f \in H(U)$ and it does not have radial limit at any point of the unit circle $\partial U$. However, I can't show that it has infinitely many zeros inside $U$. The tools that I can apply are graduate level complex analysis such as Rouche's theorem, the open mapping theorem, the maximum modulus theorem, Schwarz lemma, Runge's theorem, the Mittag-Leffler theorem and etc. Anyone can help?
Comment: Maybe you can turn it into an infinite product and see the zeros directly. See https://math.stackexchange.com/a/2477308/289217
Answer: This function has the property that on the circle $|z|=1-\frac{1}{n_k}, k \ge 10$, $|h(z)|>C5^k$, where we can take for example $C=\frac{1}{100}$
(note that $(1-\frac{1}{n_k})^{n_k} \ge \frac{1}{3}$ as that sequence converges increasingly to $\frac{1}{e}$ with the inequality already happening for $k \ge 10$ and $n_k>k$, while for $m>k,(1-\frac{1}{n_k})^{n_m} \le (\frac{1}{e})^{2^{m-k}(m-1)...k} < 6^{-m}$ so the corresponding terms form a geometric sum that converges to a small finite number, while the smaller terms sum in absolute value to obviously less than $\frac{1}{4}5^{k}$ by the trivial estimate and the corresponding geometric series)
Assume now that $h$ has finitely many zeroes only (could be none here of course). Let $B$ a finite Blaschke product with the same zeroes (including multiplicities etc, where we take $B=1$ if $h$ has no zeroes). Then $g=\frac{h}{B}$ has no zeroes in the unit disc and is analytic and still satisfying $|g(z)| > C5^k, |z|=1-\frac{1}{n_k}$, since $|B(z)| <1, |z| <1$.
But then $\frac{1}{g}$ is analytic in the unit disc and by maximum modulus, $|\frac{1}{g}| < \frac{1}{C5^k}, |z| \le 1-\frac{1}{n_k}$. If we let $k \to \infty$ we get $\frac{1}{g}=0$ in the unit disc and that is a contradiction.
Note that $h(z)-w$ has the same properties as $h$ (taking all $k$ large enough so $5^k > 200|w|$ say, so we can use $C=\frac{1}{200}$ say, so the same proof applies to show that $h$ takes every complex value infinitely many times in the unit disc!
Comment: This is a very nice solution.
Answer: Here is another solution to the problem following the hint in Rudin, W., Real and Complex analysis, McGrawHill, Third edition,  for problem 6, chapter 13.
The key, as also pointed put in the OP and by others is to show that there is $c>0$ such that along any circle of radius $r_m:=1-\tfrac{1}{n_m}$
$$\begin{align}
|f(z)|\geq |5^mz^{n_m}|-|f(z) - 5^mz^{n_m}|\geq 5^m(r_m)^{n_m} -\sum_{\substack{k\geq1\\ k\neq m}}5^k(r_m)^{n_k}> 5^mc\tag{1}\label{one}
\end{align}
$$

Zeroes of $f$: Once this is proven, one can appeal to Rouché's theorem. Let $p_m(z):=5^m z^{n_m}$. The polynomial $p_m$ has only one zero $z=0$ of multiplicity $n_m$ in $\mathcal{C}$. From \eqref{one},
$$
|f(z)-p_m(z)|<|p_m(z)|,\qquad |z|=r_m
$$
By Rouché's theorem $f$ has the same number of zeroes, $n_m$, as $g$ counted according to their multiplicities inside the disk $D(0;r_m)$. This implies that the number of zeroes of $f$ in $U$ us countably infinite ($r_m\xrightarrow{m\rightarrow\infty}1$ and $n_m>m$).

Proof of \eqref{one}: Here is a rather pedestrian approach. Notice that from
$n_1>1$ and $n_{k+1}>2k n_k$, it follows that
$$
\begin{align}
n_{k+m}> 2^k\Big((k-1+m)\cdot\ldots\cdot m \Big) n_m >2kmn_m \tag{2}\label{two}
\end{align}
$$
for all $k,\, m\geq1$. Along the circle  $|z|=r_m$
$$
\begin{align}
\Big|\sum^{m-1}_{k=1}5^kz^{n_k}\Big|\leq \sum^{m-1}_{k=1}5^k(r_m)^{n_k}\leq \frac{5^m}{4}\tag{3}\label{three}
\end{align}
$$
Since $g(x)=\big(1-\tfrac{1}{x}\Big)^x$ is strictly monotone increasing in $[1,\infty)$ and $\lim_{x\rightarrow1-}g(x)=e^{-1}$,
$$
\begin{align}
\Big|\sum^\infty_{k=m+1}5^kz^{n_k}\Big|&\leq 5^m\sum^\infty_{k=1}5^k(r_m)^{n_{k+m}}< 5^m\sum^\infty_{k=1} 5^k(r_m)^{2mkn_m}\\
&< 5^m\sum^\infty_{k=1} 5^k e^{-2mk}= 5^m\frac{5e^{-2m}}{1-5e^{-2m}}<5^m\frac{5e^{-6}}{1-5e^{-6}}\tag{4}\label{four}
\end{align}
$$
for $m\geq3$. Combining  \eqref{three} and \eqref{four} we obtain
$$
5^m(r_m)^{n_m}-\sum_{\substack{k\geq1\\ k\neq m}}5^k(r_m)^{n_k}>5^m\Big((r_m)^{n_m}-\frac{1}{4}-\frac{5e^{-6}}{1-5e^{-6}}\Big)\geq 5^m\Big((r_3)^{n_3}-\frac{1}{4}-\frac{5e^{-6}}{1-5e^{-6}}\Big)
$$
for all $n\geq 3$. $n_3>8n_1>16$. A numeric calculation gives
$$
(r_3)^{n_3}-\frac{1}{4}-\frac{5e^{-6}}{1-5e^{-6}}>\big(1-\frac{1}{17}\big)^{17} -\frac14-\frac{5e^{-6}}{1-5e^{-6}}>0.09
$$
Inequality \eqref{one} follows from this.

Final comments:

From \eqref{two} we habe that the the radius of convergcen of $f$ is $\lim_{k\rightarrow\infty}\sqrt[n_k]{5^k}=1$. That $\limsup_{r\rightarrow1-}|f(re^{i\theta}|=\infty$ for all $\theta$ shows that $f$ cannot be extended analytically to any region containing $U$.

As pointed out by others, one can also show that for any $w\in\mathbb{C}$, there are infinitely many solutions to the equation $f(z)=w$, $z\in U$. Indeed, along $|z|=r_m$
$$|f(z)-w|\geq |p_m(z)|-|f(z)-w-p_m(z)|\geq |p_m(z)|-|f(z)-p_n(z)|-|w|> 5^mc-|w|>0
$$
for all sufficiently large $m$. Another application of Rouche's theorem shows that $f-w$ has $n_m$ solutions (counted according to their multiplicities) inside the disk $D(0;r_m)$ (for each $m$ large enough).


Me and my mom and dad moved to a older house since we have moved in we have had health problems

Question: Me and my mom and dad have been having health problems since we have moved in our house in October , have brain fog and anxiety and my alleges and ashms and rashes and my mom and dad have been having heart problems and ever body has anxiety and moody , my mom and I have talk fast, and feel like we have ran a race, please let me know if you think our house is making us sick, we had to leave one over black mold, please if know what this please let me know
Comment: Do you have gas appliances or heat? Do you have a carbon monoxide detector?
Comment: there is no way to guess what is actually causing your problems ... it may be the house or not be the house ... it could be stress caused by the new surroundings ... it could be something in the air in the neighborhood ... it could be low frequency sound from a factory ... the choices are endless
Comment: I would suggest visiting a doctor to have your conditions diagnosed and asking about potential causes. Once you know what it is and what could be causing it, you can make a much more thorough investigation of your environment - home, work, school, etc. to determine which, if any, are contributing. While the house move is a major event common to all 3 of you, that may not be the only thing that's changed in your lives. TBH, even though the folks here are caring, they're not the ones to turn to for medical issues.
Comment: Have your house tested for methamphetamine, you might of moved into an old meth cook house.
Answer: You need to have your new home inspected for excess dust, mold, CO, CO2 and any other pathogens. Most of these items would have been found with a good home inspection. Also, the heating system, exhaust vents, chimneys, any air filters, water lines and sewers need to be inspected. Areas of excess humidity and wet spots need to be addressed. There may be other problems but these should be looked at first.


What do I need for this to connect to the water line it's for my refrigerator water/ice maker

Question:  I just bought a new refrigerator and they installed it but wouldn't hook up the ice maker to my water line. I'm not sure what I need to hook it up. Blue hose comes from the refrigerator and the other end is the water line.
Answer: I can't quite tell for sure from the picture, which is a bit small and poorly lit, but it appears that simply removing the male-to-male coupling on the end of the refrigerator line might allow it to connect. Or it might be slightly different sizes and you'll need an adapter. I brightened it up a bit, and they look close to the same size. You could also use a female to female coupling there, but given the choice of no extra joints or two extra joints, I'll pick none, as there are fewer places to leak.

What do I need for this to connect to the water line it’s for my refrigerator water/ice maker


Do you hear words as sequences of smaller components?

Question: This is the question of how to hear language sound. I think most of Japanese people hear Japanese words as a sequence of sound units which are the most fundamental. And, I guessed that this was true in English too at first, but started to doubt it recently because weak sounds in English can easily fall off and this means the sound is not necessary so that the sequence of components can easily be changed into another form.  What do you think of this matter?
Comment: https://en.wikipedia.org/wiki/Phonology and https://en.wikipedia.org/wiki/Phoneme
Answer: I think what you're hearing is the difference between a mora-timed language (Japanese) and a stress-timed language (English). These are different forms of isochrony, or methods of dividing language into (apparently) equal intervals of time.
According to Wikipedia, Japanese is mora-timed, meaning that each mora, which Wikipedia defines as either a vowel or vowel-plus-consonant, takes the same amount of time to say (and double vowels take twice as long). This is why you perceive Japanese as a sequence of every "fundamental" sound unit.
English, in contrast, is stress-timed, meaning that the (apparently) regular interval is between stressed syllables only. In order to make that happen, any unstressed syllables need to be compressed to fit within the interval. When we have a regular pattern of stressed-unstressed syllables, this sounds fairly distinct (and we call it iambic stress). For example:

The only one I want is you.

is stressed

the ON-ly ONE i WANT is YOU.

With this kind of pattern, you probably will be able to hear all of the syllables, even the unstressed ones. However, not all English follows this exact 1-1 pattern. When we start to have additional unstressed syllables in between stressed syllables, they need to be said in a way that we can still perceive the unstressed "gaps" as being the same length. So

Long sentences can sound like they're running together.
LONG  SEN-ten-ces-can SOUND like-they're RUN-ing-to-GE-ther.

The particular stress pattern might vary a bit depending on the speaker, but the main idea is the same: some of those unstressed syllables will be connected or dropped in various ways (e.g. going to becomes gonna, probably becomes prolly or prob'ly, to the becomes t'th, etc.).
Incidentally, native English speakers are generally not aware of this effect, so to us English does seem like a series of distinct sounds, and other timing systems seem a little bit odd somehow. My own surname is a four-syllable Japanese name; in English, it is pronounced as two iambs, with strong stress on the third syllable and nearly-as-strong secondary stress on the first syllable. The first time I heard a native-Japanese-speaker say it, I almost didn't realize he was talking to me, and it sounded like the final syllable (a vowel) was almost entirely swallowed.
Comment: 1006a: Thanks for your interesting answer.  English rhythm and Japanese rhythm is very different.  You also wrote that English does seem like a series of distinct sounds.  Are this primary units of distinct sounds composed of just timbres? Or, do they include other phonetic features too, such as pitch, loudness, or duration? I think the most fundamental units in Japanese sounds are concerned with just timbres on the condition that they are pronounced with the same weight and I wonder if this is true of English or not.  How you hear and treat with timbres in your mind.
Answer: It is said (don't hold me to it, I can't remember where I read it) folks take in about 25% of all the information they receive verbally - including, I would imagine, the Japanese. The rest is either ignored or assumed.
This is in part because everyday conversation is composed chiefly of oft-repeated trivialities. The ear seeks out and focuses on key words, and the brain supplies the rest before the rest is spoken. Thus, certain parts of sentences (and, yes, vowels, consonants, and certain parts of words) can be dropped (and often are dropped) by the speaker without the listener's losing the thread of the conversation.
This is true of all European languages, and I'm nearly 100% certain that in one form or another it is also true of all others.
Comment: @undercat: Humans will be humans no matter where they live. A "smooth and regular stream of syllables" is just as impossible as a so-called "phonetic alphabet" or a language that thoroughly adheres to grammar and usage rules. The abundance of Japanese dialects should be a good indicator of this, wouldn't you agree.
Comment: May I ask how familiar you are with Japanese to make that statement? The pronunciation in it is much more regular, almost a complete opposite of English. I'm not a native speaker of neither of these two languages so my experience may differ, but I often perceive Japanese speech as a smooth and regular stream of syllables. English, on the other hand, feels much trickier and often makes me rely on my language "experience" and the context in figuring out what the speaker could be saying, based on a number of disjoint sounds, syllables, diphthongs and blends that I hear.
Comment: I'm sorry, but that does not answer my question. Also, I did not provide such a polarised opinion that you seem to attribute to me. Humans are humans and nothing is perfect, there is no big news in that statement, but that does not necessarily mean you can generalise all languages so easily unless you have solid evidence backing up your claim. Especially when the question is about comparing one particular property of two specific languages.
Comment: @undercat I kind of think it does, but that's probably a matter of interpretation. I speak a few, and they're all the same in that aspect.


Under-power a peltier TEC1-12706

Question: Is it possible to power a peltier with 12 V and 1 or 2 A?
Comment: Read the datasheet? http://www.hebeiltd.com.cn/peltier.datasheet/TEC1-12706.pdf
Look at the graphs, refine your question. The possibilities are endless Benjj!.
To answer your question - NO .. not with the type you refer to.
The resistance is "fixed" .. so on average you will run 5-6 amps at 12V for this type
Answer:
Here's the relevant graph from the datasheet. This is a 40mm x 40mm x 3.9mm Thermoelectric Cooler (TEC). I added yellow highlight on the 1.5A curve. assuming that you're driving the TEC from a constant-current 1.5A source, with available compliance voltage of at least 6V. This typical operating characteristic curve shows that under all of these conditions:

the hot side has a temperature of 50°C
and the current through the junction is 1.5A

the resulting performance is

up to a maximum of about 55°C delta C (so cold side might get to about 0°C)
burden voltage across the junction is about 5, maybe 6 volts

Note that the line stops between 50°C and 60°C for the 1.5A drive current, this implies that is the condition where the TEC can't achieve any further heat removal. At higher currents the delta-T endpoints increase, but with diminishing returns. The TEC has to move not only the hot-side heat but also its own internal heat.
If the TEC is instead powered with a constant voltage 12V supply that was capable of delivering at least 4.5A, then the drive current would be somewhere around 4.0A to 4.5A, depending on the temperature difference.
If the power supply is rated 12V at 2A maximum, something has to happen when the load tries to draw 4.5A. Either the supply will shut itself down (because it thinks the load is a short circuit), or the output voltage will reduce until the load only demands 2A. Or worse, the supply might oscillate, repeatedly shutting down and trying to restart. I don't think the 12V 2A power supply is a good match for this particular TEC.
Just a couple of general words of advice about TEC and heat removing applications:

The hot side needs a heat sink and a fan
There needs to be good thermal contact between the TEC hot side and the heatsink
There needs to be good thermal contact between the TEC cold side and the cooling target
There needs to be good thermal insulation between the cooling target and the heatsink
The power supply that drives the TEC will also be generating some waste heat, so that needs a path to ambient as well
For an application like this, the design of the thermal contacting, thermal isolating, and airflow  parts of the system are just as important as the electrical parts
Don't cut the TEC or drill any holes into it. Mount it using a thermal conducting epoxy or adhesive.

After the TEC has been running for awhile and the heatsink is warm, and then the TEC drive current is shut down, heat will flow back from the (now very warm) heatsink through the TEC back into the cold side. The cold side is now cooler than ambient, and the hot side is much warmer than ambient. So unless the cold chamber has a great deal more thermal mass than the heatsink, then as soon as you switch off the power, your homemade refrigerator becomes an oven. Surprise! Eventually the heat sink and cold chamber reach thermal equilibrium at ambient temperature. For a CPU cooler that's probably acceptable, but if it's cooling some food or medicine that would be spoiled by high temperature, that could be an issue to watch out for. Adding some thermal mass (like water bottles) to the cold side would help avoid this issue, but the tradeoff is that it will also take longer for the system to cool down.
Answer: It's possible to pass 1 or 2 amps from a constant current source through a 12706, at which point the voltage across it will be somewhat less than 12v. Many easily obtainable buck converters have a constant current output mode that's settable to do this.
Alternatively, you can supply a lower voltage, such that it draws 1 or 2 amps, again using a buck converter to set the lower voltage.
At the low current, the 12706 will run at a much better COP (coefficient of performance, aka efficiency), but will not achieve as high a temperature difference or pump as much heat as it would at the higher voltage.
Comment: How much temperature differance would it achieve?
Comment: Max temperature difference (at zero heat pumped) scales roughly with applied voltage.
Comment: How much would that be at 1 A and 12 V?
Comment: @Benjj:  It wouldn't be 1A and 12V.  To get lower current through the device, you have to lower the voltage.
Comment: Read my answer, you only get lower current at lower voltage, or vice versa. To a good approximation (because TECs are so incredibly inefficient), a TEC is more or less a resistive load. To get decreased current, decrease the volts.

Under-power a peltier TEC1-12706


Calculating number of points within 400 meters along network route

Question: I have a layer with (several thousand) addresses, for every one I need to find the number of shops (155 total) within a 400 meter road network. Because of the large number I need to find a tool to use here but I can only find ones where it gives me the closest one, but not the distance from all the addresses to all the shops (or at least the ones within 400 meters). How do I solve this?
Answer: I guess your points (addresses as well as shops) are snapped to the network - otherwise see at the bottom of this solution how to do this. Be sure both your shop and address layer contain a unique id for identification.

Use Menu Processing / Toolbox / Network Analysis / Service area (from layer), set the line used as network layer and the address layer as Vector layer with start points, select shortest for Path type to calculate and for Travel cost (distance for "Shortest", time for "Fastest") set 400.

You get a line-layer with a line for each point that represents that part of the network reachable within max. 400m. Apply a buffer (very small like 0.1 m) around these lines (Menu Vector / Geoprocessing tools / Buffer) so that the shops for sure foll inside the buffer.

Use Field calculator to create a new field shops_within_400m on the buffer layer using text field format that is long enough with this expression: array_to_string (overlay_intersects( 'shop', shop_id)) (change shop and shop_id to the names of your layer and it's id field). For overlay_intersects() you need QGIS 3.16 or higher. Now each buffer has assigned a list of shops that is reachable in max. 400m over the network form the respective address.

If you want, join the attribute created to the address layer. Use Field calculator to create a new field with this expression, where you replace buffer with the name of your buffer-layer and id with the name of the unique id of the address-layer: attribute (get_feature_by_id ('buffer',id),'shop_within_400m')

Screenshot, showing the result: network (black lines), shops (red dots, labeled with their shop_id) and addresses (blue dots), labeled with the field created in step 4 that shows the id's of the shop within 200 m (the value I used here - see the scale at the top of how long 200 m is on this canvas). One example is highlighted  with red ellipses (blue address plus corresponding shops within 200m), with the orange service area showing the part of the network reachable in max. 200m:
Comment: Sometimes I am wondering how many templates you have to create for each different question. You probably have plenty of them now, do not you :)
Comment: Hahaha, not yet. Even if problems are similar, details of the answers are too different to be able to cover all that by a template.
Answer: To get only the distance from each address to each shop, you can use QNEAT3-Plugin with the algorithm OD Matrix from Layers as Table (m:n) (see documentation). You can select it from Menu Processing / Toolbar when the plugin is installed. Select Network layer, From-Point layer (addresses) with unique point ID field as well as To-Point layer (shops), again with unique point ID field. For optimization criteria, use Shortest path (distance optimization).
When you run the tool, you get a table with the distance from each address-point to each shop-point, see screenshot. By the way: entry-cost and exit-cost is the bee-line distance from the point to the network (thus the distance to the nearest point of the network, if the point do not lie on the network).
Comment: thanks for the explaination of entry- and exit-cost, I found nothing in plugin-doku


What aspects of Money Creation in the Modern Economy are no longer correct

Question: It has been suggested in some comments of another question that the well known paper Money Creation in the Modern Economy is no longer fully correct. What aspects of the paper would need to be modified in the light of regulatory changes made since it was published in 2014.
Comment: I think it's still very relevant. It states that "reserve requirements are not an important
aspect of monetary policy frameworks in most advanced economies today" and that "Bank of England currently has no formal reserve requirements".
Comment: It doesn't mention a bunch of important details like the LCR, which became a minimum requirement for BCBS member countries on 1 January 2015. In Europe, you would need to know what [TLTROs](https://www.ecb.europa.eu/mopo/implement/omo/tltro/html/index.en.html) are to properly understand how the current banking system operates. Ultimately, that's all details that don't change the big picture though.
Answer: Sections that would have to be modified significant (I ignored all small changes) way are:

Section: Money creation in reality. To be more specific paragraphs 3-5 (which is 60% of that sub-chapter). Also, the figure 2  and related explanation is now not accurate.

Reason why: Reserve requirements were abolished (see Fed). So those figures and explanation there is quite inaccurate nowadays (note although UK did not had official reserve requirement at that time the paper does not write about UK solely but about the system in general making repeated references to US). As a consequence the explanations there simply don't hold up anymore.

Section: Managing the risks associated with making loans. This section would need substantial rewriting as now the way how liquidity risk has to be managed was more institutionalized and reworked e.g. see Fed for some list of changes, more emphasis was put on liquidity requirements than before (At least in US and EU UK perhaps has the same system as it used to have).

In addition, the paper is missing some serious and quite fundamental changes:

In EU we now have so called 'floor system' adopted in 2015 and use of TLTROs. Now of course nobody can blame authors not to be prescient but any paper that does not discuss this is simply seriously outdated as it was quite significant change. You can read more about this in this ECB report (in fact in a comment OP asked me if I have better paper than McLeay - I do not have a general one but for EU specifically this paper is much much better).

Increased use of liquidity coverage ratio to create and manage demand for reserves (again you can have look at the Åberg et al 2021 paper which is Eurocentric but applies to US as well).

This are pretty serious omissions. Again by no fault of McLeay and coauthors, but it is simply impossible to claim that the paper still provides accurate representation of modern monetary system, same way as 1989 political map would no longer accurately describe reality as borders changed significantly in multiple places.
Of course, the paper still has some value:

Point about multiplier model not being good approximation for post 2009 banking is  valid

whole chapter about QE is still more or less fine (even though even the way how QE is done changed, but not that substantively).

the point about central banks controlling lending through monetary policy is still valid

same about the point about interest rate targeting

the (implicit) arguments for endogenous money supply

So the paper has still some valid points (in fact I teach macroeconomics class and I use this paper as required reading for my students). However, claiming that the paper offers accurate or 99% accurate description of how current monetary system works is indefensible.  It makes some good broad points, but it simply no longer accurately describes how banking system operates, especially in lieu of the recent strong shift toward focus on liquidity. The paper can be useful as a stepping stone in understanding current monetary system, provided that person who uses it actually lets people/students know about significant changes, but on its own it is no longer sufficient.
Comment: Perhaps I am misreading the article, but it was written at a time when there were no reserve requirements in the UK and when commercial banks in the USA had far more reserves held at the Fed than they were obliged to hold.  So in both cases the issue about reserves was not that they were a constraint on money creation, but instead a transfer between commercial banks (neither increasing nor decreasing in aggregate) when one of their customers sent money to another.  I thought that was still the case. Europe had issues with negative interest rates which needed other arrangements.
Comment: @Henry the problem is that now not only there are excess reserves but there are no reserve requirements at all, so it is all done through managing banks liquidity. However, since banks are forced to have certain level liquidity (either cash, or bonds) this constraints the money creation. This is biding constraint since there isnt infinite liquidity in the market. The problem is that the figures in the paper that still use reserves (even if UK did not had RR, again the paper meant to be general) no loner make sense in this system. Of course without reserves its trivially true reserves are not
Comment: constraint, but that is completely moot point because there are other mechanisms that do constrain the system in different way completely ignored by the paper


Calculus/Rate of Change

Question: A circular oil slick spreads in such a way that its radius is increasing at a rate of 10 m/h. How fast is the area of the slick changing when the radius is 40 m? (In decimals)
Comment: Welcome to math.stackexchange! The quality of your question can be greatly improved by letting other users know what you have tried so far and where you are getting stuck
Answer: The trick for all such problems is to first write down a formula that relates the two given variables, in this case the radius and the area of a circle.  We have $A = \pi r^2$.  If we differentiate this with respect to time (bearing in mind the chain rule), we get $\displaystyle \frac{dA}{dt} = 2 \pi r \left( \frac{dr}{dt} \right)$.
Now it's just a matter of plugging in known quantities.

Calculus/Rate of Change


Unknown WiFi Network

Question: For background, I am being sued by unethical people who would do anything. I live in a rural area and in the network list on my phone and laptop, no neighboring networks appear. Only our own plus our Guest. Recently, a network appeared named Test. Sometimes late at night my phone will be logged on to this network though I didn't do it. When I try to log on to it, a password is required and I can't do so. How can I find out what is going on? I have an iPhone and MacBook. It does not appear that my laptop has ever connected to this network. Here is what I see on my phone. (Centurylink and Russell both belong to me)
Comment: Many peripherals (e.g. printers, scanners, etc.) now include built-in wifi access points nowadays.  The same is true for many appliances with 'IoT' functionality (e.g. refrigerators, thermostats, etc.).  It's possible that the access point that you are seeing could be built-in to one of these devices.  Did you buy any new peripherals or appliances recently?
Answer: There are wifi AP locator apps that allow you to use your phone to physically locate wifi access points. You can use one of these to hunt down the physical location of the network to determine if it is a local device (your fridge) or if someone added a new wifi network AP around your house.
It is most likely a new device you have purchased with a poor network name.

Unknown WiFi Network


Why is Google not letting me make the choice of what version of Google Calendar I want?

Question: Why is Google calendar making it impossible to revert back to the legacy view? Why do they feel it's necessary to take away my choice and make the choice for me?
Answer: To answer your first question - you can't revert because they are not supporting the old version anymore. They've been saying for a while that they will be phasing out the old calendar UI.
I'm assuming they don't want to support two versions, which makes a lot of sense. There's no reason to support the old and the new, especially when the new version was probably programmed in a way to make future updates easier.
Google has also been working on rebuilding all of their applications to match their "flat" design. This can be seen with the new calendar app, but also Drive, inbox (compared to Gmail), Google sites, Android apps, the new fuschia OS (which is really just in the very early stages and nothing may come off it), and others.
As for your "why do they make the choice for me" question - this is just how the web works. Things get outdated quickly and apps change. When you're not paying for an app that's being provided to you for free, they do what they think is best. If you don't want the app to change, you've got the option of going for a paid alternative, or trying to find a free app that you can control the versioning of.


How is a gallery associated with some post in database?

Question: I see galleries are represented as separate post records with post_type = 'gallery' in the database.
How is this record (gallery) associated with a basic post (type = 'post') in the terms of database records?
Comment: Does the `gallery` post type have its `post_parent` set?  I believe that's how the `attachment` post type (ie, media attachments like PDFs, JPGs, etc) are "attached" to posts. (I don't have a WP database to hand, or I'd check it myself.)
Answer: WordPress galleries are implemented as shortcodes: the [gallery] shortcode should appear in the post_content of your "basic" post (whose post_type = 'post'). The shortcode's parameters specify the images to be included in the gallery by giving the post ID of the attachment-type post containing each image. So if you see two posts in wp_posts like this:
id | post_title                   | post_type  | post_parent
 1 | This post contains a gallery | post       | 0
 2 | IMG_0954                     | attachment | 1

If the first post contains the second in a gallery, its post_content will contain something like this: [gallery ids="2"]
You'll notice that the attachment post's post_parent is set to the ID of the post containing it, but this doesn't necessarily matter to the gallery: it will include whatever attachment post IDs are given in the ids="" parameter to the shortcode.
So there is no direct database relationship between a post with a gallery and that gallery's contents; it's all determined by the shortcode present in the post's content.
For a more thorough understanding of how the gallery gets generated, including the fact that you can override its output with your own using the post_gallery filter hook, see the source for the gallery_shortcode function in media.php
Answer: If you have a custom post type called 'gallery', you should be able to find it fairly easy if you can browse the database directly with phpMyAdmin. You will see your database tables on the left side of phpMyAdmin. Click on your posts tables which will probably look like "wp_posts". This will display a list of tables. Click the search icon at the top. Scroll down to the post_type field and enter "gallery". Press enter or click the "Go" button below. This should result in a list of every custom post_type in your database. Click "edit" for any table you wish to view. There you will see all of the details such as the ID for this post or the post_parent, which may be what you are looking for.
I do not have a gallery post_type, but if I want to know which post and image is related to I can search for the image within the post_type 'attachment' and even refine my search by using the specific image ID if I know it. Then I can "edit" the image and find the post parent.
By the way, you can get the ID of an image, post or anything else by going to its edit page in the admin panel and looking at the url. You will see something like "post=xxx" where xxx is the post ID.
Comment: I know all of this, I am coder :) I asked where is in DB connection between post and connected gallery, I see 2 record in wp_posts, one with type post 2nd one with type gellery, but I can't find where are they connected.
Comment: Why are you expecting two different post types to be associated within the database? Can you give an example of a way that a gallery post and a regular post are used together?


can all concepts really explained by a language,for example,English?

Question: suppose we have to explain what is the word "grandmother" mean,we can say that means mother's mother.then you asked what "mother" means,we can say you born from you mother.then you ask what "born" means,we say......,it seems you can ask forever.but all language,including English,have only finitely many words,so you cannot ask forever,one day all words are finished,it goes back to the first word.so we can't know what a word really means.but how can we study and understand a language?
Comment: As long as you describe the *language* you are concerned about as from an open set ("for example, English") the answer must certainly be No.
Comment: Your subject doesn't match your question IMO. What is "all" subjects? From the time you were born to the time you first developed language, you had experiences but no words for them. Those experiences are still part of you. Many concepts have no words ... namely the concepts you experienced before you had words. Words come long after concepts. Collectively we were human long before we had words. Are you specifically meaning to exclude all such pre-verbal concepts?
Comment: @user4894 Hmm ... there are philosophers that would argue that without language (i.e. words) there are no concepts.
Answer:

how can we study and understand a language?

We do not learn the language "by definition", i.e. through a dictionary.
In order to understand the language learning process we may assume (see the theory about "innatism" of Noam Chomsky) the existence of some sort of "mental software" that drive the "bootstrap" process of language aquisition.
We "know" what "mother" is far in advance of being able to read or to "understand" a definition.

all language,including English,have only finitely many words,so you cannot ask forever,one day all words are finished,it goes back to the first word.

Exactly so: if you pick up a word i the dictionary and "build up" a tree (in the mathematical sense) using the definitions, surely you will find , well before having finished reading the dictionary, a word that you have already met.
The "process" is circular : there is no set of "initial" words (known by "ostension" ?) such that all other words can be defined/explained in terms of them.
Comment: So what's your answer: Yes or No? Also, FWIK Chomsky's theory is not the only show in town.
Answer: While I think there are some concepts that can't necessarily be described properly in every language, I think your reasoning is flawed.
When we learn what a "dog" is, we don't have to say "It's a four-legged mammal with these characteristics..." - we say "That." - and point at one.  When words are labels for things in the real world, it doesn't necessarily follow that there has to be a word (or words) to describe it, and it certainly doesn't follow that no other words can be re-used in any of those definitions in order to form the tree-like definition structure you describe that leads to one root word.


"No protocol specified" when running vim with sudo

Question: Recently I start to get "No protocol specified" when using sudo vim. It's just a warning I guess, because everything was working normally (I can open, edit and save files). The message doesn't appear if I use sudo -E vim so I think I did something wrong when editing /etc/profile recently, but I'm not sure. How can I fix this?
Comment: Not everything is working normally. Mouse support isn't working, it needs a protocol such as gpm or the xterm mouse protocol.
Answer: A recent upgrade changed default settings for sudo. If anyone have this problem check your sudoer configuration. From an example in the man page:
# Run X applications through sudo; HOME is used to find the
# .Xauthority file.  Note that other programs use HOME to find
# configuration files and this may lead to privilege escalation!
Defaults env_keep += "DISPLAY HOME"

Make sure you have something like that in /etc/sudoers (use visudo to edit the file if you need to).
EDIT:
I don't know exactly since when, but at least xauth 1.0.9 supports the environment variable XAUTHORITY. Setting that and leaving HOME untouched, also fixes the protocol warning and is the better solution, as no world-writeable IPC resources (sockets/pipes) are created pointing to root resources (one avenue for privilege escalation). xauth doesn't automatically export the variable to the environment, so the best way is to set it in your shell's initialization.
Answer: According to this thread, there are two possible solutions to your problem:

Put the following line in my root users .bashrc script
export XAUTHORITY=/home/<user>/.Xauthority

then I copied .Xauthority to root also, i.e.
sudo cp ~/.Xauthority /root

and now the warning is gone.

You could also try running via gksudo.
Anyway, both are worth a try...
Comment: As far as I remember the contents of a .Xauthority file changes, so you should symlink it instead of copying.
Comment: I copied `.Xauthority` to `/root` and that's it!
Comment: No I was wrong, after rebooting I got "invalid key" error.
Answer: Although the question already has some answers, none worked for me completely. I solved it through a combination of above few suggestions and some bits of mine for my Debian distro.
I made a symlink to .Xauthority file for root and all other users. The problem got resolved for root user, because root has access permissions to that file, but not for other users. I added read-only permission for all other users for .Xauthority file.
#do this for all other users who do not have .Xauthority file
ln -s /home/userwithxauth/.Xauthority .Xauthority

#run the following command to give read only access permission to .Xauthority file
chmod 644 /home/userwithxauth/.Xauthority


Normals acting weird

Question:
I've been modeling these buttons, and the middle one keeps having this weird shading, like there was something wrong with its normals.

I've checked them and they seem to be ok, but the shading problem persists, unless I purposefully flip the normals of the faces framing the 3 buttons.

Once they face in the wrong direction, the shading issue goes away, but the flipped polygons would cause problems down the road, so I really want to fix them.
I've tried smoothing, recalculating, and setting them from the faces, to no avail. I have no modifiers or anything on the mesh.
Does anyone have any idea what's at play here? Many thanks!
Answer: You need to Clear Custom Split Normals Data, hard to guess how you messed up the split normals though:

Normals acting weird


Do I need multiple Power Plants?

Question: I'm just getting into this game and I've built a basic coal to power plant train delivery system. I'm curious, since power plants can accept an unlimited amount of coal, is there any reason to deliver coal to multiple plants instead of delivering all the coal to one?
Answer: While there are mods available that add mechanics regulating the demand side (that means, adding limits to the amount of coal for example, that a power plant can process in a certain timespan), in vanilla OpenTTD any processing plant can process unlimited amounts of goods.
However, delivering the goods to the most distant plant will yield the maximum amount of profits, so you might need to supply more than a single one. There is an in-game chart that shows the profit per good by (days in transit vs. distance travelled), and you can see that especially coal profits a lot from large distances.
Normally, you would start building around a single plant, and connect multiple mines to that, in order to reuse existing infrastructure. Then later re-route trains to go to different power plants that have a larger distance.
As Private Pansy correctly mentions, in the late game you need to optimize your track layout in order to get it more efficient. That means removing any "wait until fully loaded" orders and usually packing your tracks with the maximum amount of trains affordable. This is less important for coal, but highly important for other goods (say, fruits in the desert setting).
Comment: "delivering the goods to the most distant plant will yield the maximum amount of profits" this is not necessarily true - if you look at the chart you yourself referred to, many goods have cutoff time where the price paid would start declining sharply, so it is not necessarily in your best interest to deliver to the furthest destination. Also, not all distances are equal in terms of cost of building and maintaining the infrastructure. **Efficiency** in terms of cost per distance is usually far more important goal to reach for than purely distance.
Comment: I kind of agree with that, but unless your network is _really_ clogged, distance is the primary goal to be achieved.

You may have a super efficient economy going across say 20 tiles but it will not outperform yield coming from a single train travelling across the map. When you get to the point of having 10+ trains on one track, then the efficiency takes over.

Usually a stupid two-way track with a secondary resource delivery network (usualy cars) will do a splendid job.

Then again, I hardly ever win the goal, so bear with me.
Comment: Also I was referring to the coal part of the chart (as the question implied) and that really has a very slooooow cutoff.
Answer: There's one additional reason to use two power plants, and that is making more money with each train, to increase their effective ROI ratio. With the default trainset, refits are typically expensive or not possible, so you would have trains hauling empty loads back in a simple setup. With two plants, you can haul coal 'both ways'.
Suppose you identify two pairs of power plant and coal mine, close together, with both pairs far apart. You could build two small train lines, but since you're paid 'by the square', it can be far more lucrative to have your train line go:
<code>Coal mine #1 ----> Plant #1 -> Coal mine #2 ----> Plant #2 ->
</code>
where longer arrows represent greater distances. You can get (almost) twice the income over a simple one-way empty, one-way full connection. Almost, since you will probably need a small distance between the Plant and the next Mine, and since full trains are heavier and accellerate slower.
By the way, this is a great way to jumpstart your company in openTTD, and typically regarded as the optimal opening move on most maps/settings. Here's a link to a more in-depth tutorial.

Do I need multiple Power Plants?


two-sided moving average?

Question: how to get two sided "moving average" that is a function that averages n numbers from right and left of a vector and gives them weights according to their distance from center value ?
I tried to use TTR but its moving averages works only from left to right and set leftmost values as NA. So I cannot use that smoothed vector as a input to smooth.spline
Answer: In the zoo package rollmean and rollapply have arguments that allow numerous variations.
library(zoo)
x <- seq(10)^2

# no NAs at end
rollmean(x, 3)

# NAs at ends
rollmean(x, 3, na.pad = TRUE)

# weighted mean
rollapply(zoo(x), 3, function(x) c(1, 2, 1) %*% x / 4)

# at ends take means of less than 3 points - needs devel version
# partial= is in development and at this point must use na.rm = TRUE to use partial
source("http://r-forge.r-project.org/scm/viewvc.php/*checkout*/pkg/zoo/R/rollapply.R?revision=802&root=zoo")
rollapply(zoo(x), 3, mean, partial = TRUE, na.rm = TRUE)

EDIT:
Note that since this was written the development version of zoo was changed so that instead of writing partial = TRUE one writes rule = "partial" or rule = 3.  The problem was that as new end rules were added to the development version (there are now 3 and a 4th will be added before its released) having a separate argument for each one clutters the user interface.  Also rule is more consistent with approx in the core of R.  In fact, rule=1 and rule=2 will have the same meaning in rollapply and in approx (from the core of R) for better consistency and ease of use.  The parentheses around mean in the example below are currently required in the development version to prevent it from calling rollmean, where rule="partial" has not yet been implemented, but the need to do that will be eliminated by the time its officially released.
source("http://r-forge.r-project.org/scm/viewvc.php/*checkout*/pkg/zoo/R/rollapply.R?revision=815&root=zoo")
rollapply(zoo(x), 3, (mean), rule = "partial")

Comment: But why output of rollmean is always one element shorter than itput ?
Answer: Look at the filter() function, and particularly the sides argument:

filter                  package:stats             R Documentation

Linear Filtering on a Time Series

Description:

     Applies linear filtering to a univariate time series or to each
     series separately of a multivariate time series.

Usage:

     filter(x, filter, method = c("convolution", "recursive"),
            sides = 2, circular = FALSE, init)

Arguments:
[...]
   sides: for convolution filters only. If 'sides=1' the filter
          coefficients are for past values only; if 'sides=2' they are
          centred around lag 0. In this case the length of the filter
          should be odd, but if it is even, more of the filter is
          forward in time than backward.

Answer: You could try kernel together with kernapply (there are some examples towards the end of the first page).

two-sided moving average?


For which kind of nuclear reactions is the nuclear binding energy per nucleon appropriate?

Question: The nuclear binding energy curve is often presented as a reason why iron is abundant in planet cores. However, to me it is not entirely evident why binding energy per nucleon, E/A, is chosen to assess the possibility of a nuclear reaction. Alpha decay is a counterexample where the E/A value results in ambiguity. One of the two decay products, the alpha particle, has a smaller E/A. So in general E/A is not a suitable predictor. For simple decay, ΔE = Emother-Edaughter is better than E/A.
Comment: Can you clarify what you mean by "appropriate" and "the best parameter"?  Are you asking when the binding energy per nucleon is a good indicator of whether or not a nucleus will decay?
Comment: @jkien: When people ask for clarification on a question, it's best to provide that clarification by editing the question rather than by replying in comments.
Comment: By  "appropriate" and "the best parameter" I mean that the (E/A)-A graph is apparently preferred in physics books, for unspecified reasons. My question is why it is preferred over the E-A graph. It seems to me that nuclear reactions depend on the total energy, not specifically on the energy per nucleon. Maybe it is just for graphical reasons?
Comment: Preferred *for what*?  Based on the wording of your question I assume you're interested judging the stability of a nucleus, is that right?
Comment: @jkien The stability of a nucleus against things like fusion and fission is related more to its binding energy per nucleon than the total binding energy.
Comment: Ok, I edited the question to clarify the ambiguity of E/A in alpha decay.
Answer: The BE/A curve presents a visual qualitative average behavior for how tightly bound a nucleus of a given A might be. A-values which are lower on the BE/A axis have more mass energy per nucleon so that it's possible to move them, through some reaction, to a higher point and have a net gain of kinetic or radiative energy.
Alpha decay is a process which moves heavy nuclides to a lower A and generally higher BE/A value. Beta decays don't change A, so, due to the average qualitative nature or the curve, BE/A doesn't mean much.
Two main types of reactions which reflect the nature of the curve are fission of large A nuclides and fusion of small A nuclides. If fission of a large A (>234) nuclide can be induced (or if it happens spontaneously), the result will usually be two large fragments centered roughly around 2/5A (~94) and 3/5A (~140). Looking at the BE/A curve one will see that the BE/A values at those smaller nucleon counts are higher, indicating less mass energy in the system, and hence more kinetic or EM energy.
Fusion of light nuclides (A=1, 2, or 3), require the input of large kinetic energies, aided by QM tunneling usually, to create nuclides of A=4, 5, or 6, but the very large changes in the BE/A curve at the low A end of the curve results in a net output of energy.  A=4 or A=12 can be fused in the extreme conditions of hot stars to move even further up the BE/A curve.
Comment: @jkien It's not "meant" for those things in particular. It is "meant" to show the general relationship of binding and mass.  It can be used to justify the general behaviors of light mass fusion and heavy mass fission. It can also be used to explain stellar energy limits.  And there is no "silent" assumption. Technically, anything above the vertical axis starting point could be a product from an energy point of view. There may be other factors that influence the actual products.
Comment: Ok, so the graph is meant for fission, where it is silently assumed that the fragments are heavier than iron, and for fusion, where it is assumed that the fusion product is lighter than iron.