Linear complexity of real and complex sequences

Question: In cryptography output sequences of stream ciphers are binary valued (or more generally finite field valued). However mathematically sequences over real and complex variables can also be generated by stream ciphers utilising feedback shift registers. We can also convert a binary output sequence $w(k)$ of a stream cipher to real interval $[-1,1]$ by defining the sequence $z(k)=(-1)^{w(k)}$. I don't find literature on linear complexity theory of real and complex sequences in my searches. Why is such a theory not useful or interesting?
Answer: Generally speaking, the finite field theory is cleaner, being based on exact arithmetic. Since we require exact arithmetic in cryptography (otherwise things like uniform distribution are either impossible or very hard to prove and we need finite processes to actually implement cryptography) the theory over finite fields suffices.
A few notes:

One can define the theory of linear complexity over an arbitrary infinite fields, such as $\mathbb{C}$ or $\mathbb{R}.$  For example linear recurrences over the reals are taught/used in undergraduate math and engineering classes. From a crypto point of view this linear complexity will be very unstable [if you have a small error in the value of the terms it will fluctuate wildly]
There is a related question and answer about codes over complex fields where the issue of berlekamp massey over such fields is addressed at the link here.
There is a theory of sequence complexity over $p-$adic fields, which represent feedback shift registers with carry, pioneered by Klapper and Goresky. See Wikipedia here.
Finally if you perform the map $s_t=(-1)^{u_t}$ for a binary sequence you directly obtain a multiplicative recurrence for $s_t$ corresponding to the linear recurrence for $u_t$ such as
$$
u_{t+3}=u_{t+1}\oplus u_{t} \Longleftrightarrow s_{t+3}=s_{t+1}s_{t}
$$
Comment: Thanks Kodlu for your comments. Point 1 is interesting and I have been thinking on existence of stable minimal polynomials of real matrices and sequences. One thought arises from the multiplicative recurrence. Clearly s_t will have analogous multiplicative recurrence, as stable as additive rec of u_t. What can be said about relationship of additive linear rec of s_t with the sequence u_t?
Comment: I am not sure how much one can say beyond the fact that they are the same recurrence (one multiplicative one additive) in the absence of errors.
Answer: Such transformations are quite common in linear cryptanalysis, the process turns additive combinations of bits into multiplicative combinations of characters under the Hadamard transform. Calculations on the transform can then be informative about the input bits essentially using what is Fourier analysis in characteristic 2. The expected value of the transform is sometimes referred to as the bulge.
An example of the use of this transform is in the piling-up lemma in its expected value form. For a more modern usage see for example the proof of Theorem 6 of Cryptanalysis of stream ciphers with linear masking by Coppersmith et al


Can 'area' be called 'plot'?

Question: Can area from mathematics be called plot?
Answer: The terms are really not synonymous. They are similar in one sense only.

plot 3 a small piece of ground marked out for a purpose such as building or gardening : a vegetable plot.
area 1b • [with adj. ] a space allocated for a specific purpose : the dining area.

Note I said they are similar — I would not call these entries synonymous at all. I would just say this is possibly the source of your confusion.
In mathematics, a plot is

plot 4 a graph showing the relation between two variables.
• a diagram, chart, or map.

This is definitely not the same thing as mathematical area.
[NOAD]
Answer: No, "area" cannot be replaced by "plot" in mathematics. There are two reasons:

"Area" in mathematics refers to the specific surface within a specific boundary. Plot, in common usage, refers to an indeterminate amount (abstract and without bound) of area i.e. plot of garden bed.
"Plot" in Mathematics refers to a graph of several coordinates

So, to sum up, Plotting cannot be used in place of Area, in mathematics because it causes confusion.
Notice I keep on emphasising in mathematics. This is because, in normal usage, "area" and "plot" are sometimes interchangeable. But absolutely not in mathematics.
Comment: They are not interchangeable. Would you speak of a dining "plot" off the living room, or a vegetable "area" in your garden, or a burial "area" in a cemetery? And I'll note that you just regurgitated most of my answer while getting a major point wrong.
Comment: I think to say that in normal usage they are sometimes interchangeable is a bit confusing. Also, they are not interchangeable in normal usage, but in specific usage (when using "plot in the sense of a piece of land; and when using "area" in a sense of location, not measurement; and even then, in normal usage, there would, normally, still be difference and you would choose more appropriate word)
Comment: @Ham: Next time when your answer turns out to be wrong and you get corrected --and somebody else (In this case @Robusto) has posted a correct answer-- don't just regurgitate their correct answer. Back off and let it go. Just delete instead of editing to say something totally different, especially when that something different came from someone else's knowledgeable answer to the same question. I've seen you do this several times and it is a form of plagiarism that is really bothering folks here.
Comment: I've edited it, I hope that clarifies matters.
Comment: @Caleb, got you.
Comment: @Robusto Those both actually make a lot of sense, since a plot is a piece of land as well. However, in a mathematical sense, they are not interchangeable
Answer: If it could than a "plot area" would be pleonasm.
Plot, in several meanings of the word, see here, can have an area.

Can 'area' be called 'plot'?


MLA parenthetical citation of a character in a novel

Question: If I am writing my essay on only one novel, and I have made it clear in the previous sentence that the quote is from a character in said novel, do I still have to include the authors name in the parenthesis, or just the page number?
Answer: When a subsequent quotation is from the same work as the previous one, a page number is enough:

In Bob Foo's novel Living the Internet Life, the protagonist is posting comments on websites. His first comment is met with enthusiastic upvoting (34). The protagonist is happy and decides to post more comments (38).


Azure worker role + number of message queue consumer

Question: I am trying to understand the best practice when hosting a message queue consumer in a azure worker role. I have many different type of message consumers that subscribe to different azure service bus subscriptions (or queue if you like to call it). I am wondering if I should instantiate multiple threads for each consumer in one Worker Role or should I deploy to multiple Worker Role for each consumer.
Answer: This is really dependent on your app and workload. If you have tasks that are I/O-blocked, then you should be running several threads; otherwise, you'll have a virtual machine instance which isn't being used efficiently. If it's primarily CPU-based, you may find that you can run efficiently with a lower number of threads.
You should only scale out your worker instances if you can't handle the capacity in a single instance (or if you need high-availability, in which you'd need at least two instances). Just remember that a worker role instance is a full VM, so adding one VM per queue consumer scales in cost, and you still might not see great throughput in an I/O-bound app (or one that blocks on other things such as a Web Service call).
You'll need to do a bit of experimenting to see how many threads to work with on the worker side.
Comment: thanks, is there any library which allow me to manage thread and control how many thread are running at runtime (or by configuration) ?


What kind of Rear derailleur do i have and what RD should I buy as a replacement?

Question: I have an old mountain bike (21 speed) and I'm not sure what kind of rear derailleur i have. So far the performance is still okay but I was planning to replace it with my spare RD (SunRun Index) but according to the mechanic it's not compatible. Is there a way that I could still use my spare RD on my bike? if not then, what rear derailleur should i look for? (preferably shimano)
Still a newbie when it comes to bike parts
Comment: I find it best to have improvement goals in mind and work back to what parts/adjustments might be needed rather than the opposite.  Traction, shifting and braking performance are usually pretty clear -- do you have any issues with those or improvements you'd like to see?  Brake pads and tires can make a big difference and are relatively inexpensive to change.  A lot of times, just having an experienced person spend a few minutes with the bike can identify trouble spots or easy improvements that you wouldn't notice. Also, it would help us if you could post photos of all parts of your bike.
Comment: Lightly cleaning up the derailleur would reveal it's brand as stamped on the face.  The style looks like a Falcon, but the lettering doesn't suggest that.
Answer: I think you will need a claw hanger adapter.  The old derailleur has one that appears to be non-removable, and the new one has a 10mm bolt that expects to find a matching hole in the frame, which yours won't have.
You probably want something that looks like this:

There is a sunrace branded one, but it looks the same in the critical dimensions as a generic pictured above.
Comment: @njzk2 pretty much yes - 7 speed was long enough ago that inter-brand proprietary settings weren't a thing.
Comment: do all 7-speed derailleurs have the same cable pull ratio?
Comment: good to know, thanks!
Answer: Your derailleur looks deceptively similar to Shimano RD-TY20-GS and Shimano RD-TY15, but after taking a closer look at the embossed letters on the side, it turns out that it was manufactured by Lingxiang. It's probably model LXA-01
In case of Shimano derailleurs, the actual model name is stamped on the back [example]. Perhaps it's also true for this one.
Comment: @Criggie You are right. I have taken a closer look and it seems like the emboss says "LXIANG". That turns out to be an actual Chinese bike equipment manufacturer, with an [identical rear derailleur](https://image.ec21.com/image/thq674717/oimg_GC05512506_CA05512551/Non-index-Rear-Derailleur.jpg) on offer
Comment: They're all very similar-looking, but OP's one has something embossed on the side, that doesn't appear to say Shimano.  I'd expect it to be another brand.


How do I delete a Goerli testnet token?

Question: I am testing an NFT on Goerli and all looks good. However my tutorial says that I need to delete the testnet token before deploying to mainnet, IF I had done any editing while on testnet. I did indeed edit, and am now stuck trying to delete the testnet token on Goerli, since the tutorial did not explain how to do that. Thx
Comment: Provide the code of your contract or link to your testnet deployment. Otherwise, the question is incomplete, and it will be impossible to answer.
Answer: Generally speaking, you don't have to do that. All you need to do is find a new address and deploy your mainnet token on the new address because:

You are probably deploying a standard token like ERC-20.
There is prob no verified code on the testnet.
When you delete something on the Blockchain, you don't really delete it because it is always traceable.

But in case you want to overwrite/delete the smart contract, here are a few resources that may come in handy:

Upgradable smart contract
With selfdestruct method

Otherwise, it is impossible to modify/delete a smart contract.
Hope this helps, happy coding.
Comment: My personal practice is to add extension to the contract name like V1, V2, etc to distinguish deployed contract besides address on chain.

How do I delete a Goerli testnet token?


Torrent client on Windows 10 IoT

Question: Are there any torrent client applications which work on a Raspberry Pi 2 running  Windows 10 IoT?
Comment: did you install windows 10 IoT?  it's extremely limited.
Comment: It not limited.. it just hasn't got binaries made up for it, yet. Like saying a brand new house isnt fit for purpose cause it dont got carpets or a fridge... luckily they made all things eventually.
Answer: Simply put, no.
But there is an app that allows you to remotely drive a torrent box.
more info here: https://www.microsoft.com/en-us/p/remotorr/9nblggh42q62
Hope it'll help...
Answer: no, there aren't :( but i have found https://github.com/mono/monotorrent
but for raspbian wheezy there are avaliable clients with webui, eg deluge, qbittorrent, rtorrent+frontends, transmission!

Torrent client on Windows 10 IoT


Workflow of shared / language-independent fields

Question: Sitecore workflow will only apply to versioned fields, since it works by preventing publishing of unapproved item versions. However what if I have a language-independent field (such as an image, number, or price) which I need to workflow? Are there approaches which allow for approval of changes to such a field, without allowing it to be edited/changed in each language version of the item?
Comment: As far as I know, no.
Comment: Pavel Veller blogged about this problem earlier this year.  http://www.pveller.com/missing-field-type-part-1/  and http://www.pveller.com/missing-field-type-part-2/
Answer: I have not attempted this and have no idea how well this would work in practice.  It's just an idea.
One way to handle it might be to just use a versioned field with language fallback and then add a customization that restricted editing to the "master language".  You could use an item:saving handler to intercept an edit, use the language fallback settings to determine which language the value is coming from and then, create a new numbered version in that language and update the value there.
Answer: Let's start off by imagining how such a feature would work if it existed. Let's say you edited a shared field—would you like all language versions of the item to go to the "Awaiting Approval" state? This doesn't seem practical, which is why, I believe, Sitecore decided that shared fields will not be subjected to workflows.
Another solution would be to have workflow states (and publishing) on field level, which Sitecore does not support. Adding such a feature would be a core change in how Sitecore works.
The only thing you can do is enable workflow for you media items. This is the closest thing to a solution available at the moment.


is_search called incorrectly

Question: I just noticed a new error message on one of my websites' pages that lists posts,
http://clubcorvettect.com/category/events/ :

Notice: is_search was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.) in /home/wp_gmz28r/clubcorvettect.com/wp-includes/functions.php on line 4138

This site has been running properly for several months. I tried adding code that was suggested in this forum
<code>dd_action('pre_get_posts', function( \WP_Query $q ) {
    if ( ! is_admin() // Only target the front-end
         && $q->is_main_query() // Target the main query
         && $q->is_search() // Target a search query
    ) {
        // do stuff
    }
})
</code>
but it didn't help. Any ideas?
Comment: Hi, Welcome to WPSE. Please add the code to your question, without knowing the code it's not really possible to help.
Comment: I was trying to eliminate the error message and I saw that code was applied in a similar situation. Today, I disabled the WP plug-ins, one at a time, and found that disabling the custom 404 plug-in eliminated the error message. So I applied a simpler 404 page strategy.  Problem solved. Thanks for your response, Jack.
Comment: You are welcome. You can add your own answer and accept it, to help future visitors.
Comment: Here's the code that I tried, but it had no effect:    add_action('pre_get_posts', function( \WP_Query $q ) {
    if (
            ! is_admin()         // Only target the front-end
         && $q->is_main_query()  // Target the main query
         && $q->is_search()      // Target a search query
    ) {
        // do stuff
    }
});
Comment: You are trying to get the query before it's run. What are you trying to achieve? There is always an alternative. Add whatever you are trying to do to your question (using this [edit](https://wordpress.stackexchange.com/posts/267743/edit) link) and i will write a solution for you if possible.
Answer: Hey Mike and welcome to the WordPress Stack Exchange!
First, it's good form to always include the code you use (or a link to where you found it) if you mention it in your post.
This error comes up when you use it prior to the search being run. The WordPress Codex doesn't have a ton of detail, but the basic gist is this: the function is very light weight and only returns a boolean. The reason it must be after the query is because it will always return false as it is checking wp_query() which doesn't exist until a query is run.
Unless your installation is aged and was recently updated, this error has probably been there for a while.
If the site is functioning the way you want, you can find the offending code and remove it since it's not in the right place anyways.

is_search called incorrectly


What was Newton's idea of absolute space and time?

Question: When one says that Newton believed in the concept of "absolute space" and "absolute time" does it simply mean that the length interval between two points in space and time interval between two events is independent of the state of motion of the observer? If there is something more to it or if I am incorrect please disabuse my misconception.
Comment: Yes, this is what he believed. It is easy to prove using Galilean transformations.
Answer: Newton does not reference intervals in his work.  Quoting from the Scholium (appendix) to Philosophiae Naturalis:

...And thence arise certain prejudices, for the removing of which it will be convenient to distinguish them into absolute and relative, true and apparent, mathematical and common.

Absolute, true, and mathematical time, of itself and from its own nature, flows equably without relation to anything external, and by another name is called duration; relative, apparent, and common time is some sensible and external ... measure of duration by the means of motion, which is commonly used instead of true time, such as an hour, a day, a month, a year.
Absolute space, in its own nature, without relation to anything external, remains always similar and immovable. Relative space is some movable dimension or measure of the absolute spaces, which our senses determine by its position to bodies and which is commonly taken for immovable space; such is the dimension of a subterraneous, an aerial, or celestial space, determined by its position in respect of the earth. Absolute and relative space are the same in figure and magnitude, but they do not remain always numerically the same...

I've edited out some bits to avoid burdening the quote, but the key points are that absolute time refers to time measured by some imaginary ideal "absolute" clock, whereas absolute space refers to some position measured by some imaginary ideal "absolute" coordinate system, which are postulated as ipso facto existing on their own, without relation  to anything external.
It is Galilei who discussed what we now called invariants of the state of motion, in the "Second Day" of his Dialogue Concerting the Two Chief World Systems, between Savatius and Sagredius.
Source: The translation of Newton's is by Andrew Motte (1729) as revised by Florian Cajori (Berkeley: University of California Press, 1934).]


Why is Dumbledore afraid of Greyback?

Question: I saw this answer. It makes me curious that why Dumbledore is afraid of Greyback, considering that Dumbledore is more powerful than Greyback.
Comment: *"You alone know whether it will harm your soul to help an old man avoid pain and humiliation," said Dumbledore. "I ask this one, great favour to you, Severus, because death is coming for me as surely as the Chudley Cannons will finish bottom of this year's league. I confess I should prefer a quick, painless exit to the protracted and messy affair it will be if, for instance, Greyback is involved - I hear Voldemort has recruited him? Or dear Bellatrix, who likes to play with her food before she eats it*
Comment: Does that quote really imply fear?  I rather thought it was just an expression of a preference for a painless death over a painful one.  And: *"Shocks you, that, doesn't it, Dumbledore? Frightens you?"
"Well, I cannot pretend it does not **disgust** me a little," said Dumbledore.*  I see nothing implying fear -- just a desire to not undergo "pain and humiliation" if there is an alternative... a desire I can fully understand.
Comment: Sure the quote is directly addressed. He's afraid of a long, painful or humiliating death
Comment: @K-H-W Would you not find the prospect of your throat being ripped out by a werewolf terrifying? A werewolf who's going to eek out your death to make it as painful as possible? Dumbledore, dignified to the last, would never betray that fear to his enemies, or give them the satisfaction of knowing his true unease. But he also knew that Greyback murdering him would be "protracted and messy". Avoiding it was more than just expressing a preference. It was dodging a fate that would terrify anyone.
Comment: Or at least prefers a quick, painless one over the other kind, and feels the slow, messy, painful can't otherwise be avoided.
Comment: @TheDarkLord - Well, that's one interpretation. But, at his age, facing certain death already, and havinggone thru various forms of torture in his life (and, for all we know, he was still suffering from the effects of the ring), I don't know that it did terrify him.  Especially since, seeing it coming, he could have preemptively taken steps to minimize his suffering if he so chose.  He was a man who felt his death had a purpose, and that can have a strange effect of people.  Perhaps he was scared, but I don't see it and can accept possible self delusion keeping him from being scared.
Answer: It really isn't that surprising - Dumbledore is no longer (or not for much longer) more powerful than Greyback.  He has been cursed, and the curse is slowly killing him.  It is also weakening him significantly, as his health deteriorates.
Even if that weren't the case, Dumbledore fears being at the 'mercy' of the Death Eaters.  He specifically names Greyback and Bellatrix because they are known for favoring slow, painful deaths for their victims.
Dumbledore knows he is not long for life, and prefers that his life end at Snape's want instead of (after hours or days of torture) Greyback's teeth/claws/wand or Bellatrix's wand.
The killing curse is a quick death, and Dumbledore knows he won't suffer.  He also believes that having Snape kill him will help preserve the life of Draco.
In short, he knows that he will die, he simply chooses the way that will cause him the least amount of suffering while accomplishing the greatest good (in this case, solidifying Snape's reputation as a vetted Death Eater and saving Draco's life).
Answer: Because Dumbledore knows Greyback will kill him painfully.
Dumbledore tells Snape that it's better that Snape kill him since he knows Snape won't make him suffer, unlike some of the others who could kill him instead of Draco. He's not scared of dying, and in fact he fully intends to die, but he'd rather his death be a quick one than a slow and painful death at the hands of someone less merciful.

"You alone know whether it will harm your soul to help an old man avoid pain and humiliation,' said Dumbledore. 'I ask this one, great favour of you, Severus, because death is coming for me as surely as the Chudley Cannons will finish bottom of this year's league. I confess I should prefer a quick, painless exit to the protracted and messy affair it will be if, for instance, Greyback is involved – I hear Voldemort has recruited him? Or dear Bellatrix, who likes to play with her food before she eats it." - Harry Potter and the Deathly Hallows, Chapter 33 (The Prince's Tale<)

He explains this to Snape when trying to remind him why he should be the one to kill him, so he'd understand that it's indeed an act of mercy since Dumbledore's death is inevitable, but it being painful can be avoided. For that, it doesn't matter that he's more powerful than Greyback - he knows he's going to die, but doesn't want it to be at the hands of a Death Eater who would torture him, or at the curse which will kill him slowly. In addition, he wants to remind Snape of all this so Snape would feel more at ease with having to do it,
Answer: He's not.
The important point is that Dumbledore needs Snape to be the one to take his life, for the good of The Plan. It will cement Snape's position in Voldemort's organization, winning him (hopefully) a level of trust he might not be able to achieve otherwise. It's also possible he was planning for Snape to become the master of the Elder Wand by doing so.
Remember, at this point, Snape absolutely did not want to carry out this part of The Plan...what Dumbledore is doing here is to try and cajole Snape into following through by rationalizing it, framing it as a favor he would be doing for Dumbledore.
Dumbledore isn't necessarily doing this avoid Greyback or Bellatrix (though that is admittedly a strong bonus), but rather to overcome Snape's resistance to doing what needs to be done for The Plan to work.

Why is Dumbledore afraid of Greyback?


Why is f natural used in m. 8 of J.S. Bach's Sinfonia in C Major (BWV 787)?

Question: This is an excerpt of the Sinfonia Nr. 1 in C major by J.S. Bach.
I thought this were a "clean" modulation to G major, but to my surprise, Bach uses an f natural in the lower voice of m. 8.
Is there a harmonic meaning/justification behind this? I experimented a little and found that the passage does not sound much differently if the f is sharpened.
Comment: Did anyone check if this was also F in Bach's hand, or if it was possibly an editorial decision later?
Answer: The beginning of m. 8 is briefly back in (i.e., tonicizing) C major. Note the C major chord (C G E from lowest to highest) at the beginning of beat two. The three sixteenth notes leading into beat two constitute a G7 chord.
Comment: @AGuyCalledGerald Note the difference between "tonicization" and "modulation." Yes, the surrounding context is "in G," for at least these several measures. But tonicization means "we're treating this C chord as if it's a tonic, but not for long enough for us to talk about a whole new tonal area."
Comment: You could add the return to a C major chord in root position at the beginning of the second beat. That might lead to the question of why back to F# for the third beat, but that's there to make a D7 chord before coming back to a G major chord in the fourth beat.
Comment: @Aaron Thank you, this makes sense. Could you also explain what the use of this tonicization is? Is it just for variation or to emphasize the function of the c as subdominant?
Answer: In my opinion, the compositional reason is rather complex but explainable, and this doesn't affect Bach's genius; quite the opposite.
From a melodic point of view, what he is writing here is an upper neighboring tone or an upper auxiliary note but changing register E-(F-E).
Also pay attention to the choice of F natural to match the mirroring lines interval-wise: F-E-D-C (bass) vs B-C-D-E (soprano), in both cases we have 1/2-1-1 tone sequence.
Please also note that F-E(bass) vs B-C (soprano) makes a harmonic progression well established in the practice: augmented 4th (F-B) resolving by contrary movement on to (E-C) by half-tones.
This is congruent with other more harmonically-oriented answers given so far: from a harmonic point of view, F natural belongs to C Major, which here is the subdominant of G Major, the tone in which the main theme of the piece is going to (re)appear, namely at the beginning of the second half of the second bar. Bear in mind that this D-C scale, the beginning of the main theme, belongs to the dominant function, here the D Major chord, so we have a IV(C Maj)-V (D Maj) progression leading to I (G Maj), not shown in the excerpt.
Even more, from an structural point of view, we could note the harmonic repetition (here creating tension) of the pattern IV(C Maj)-V(D Maj). The second time (2nd bar here), we have the first inversion in both chords, which melodically produces, in rhythmically accented places (half-note wise), the tetrachord C-D-E-F#-(G). In fact, regarding tension, in this harmonic sequence, the 2nd-3rd chords ---that is, V-IV from IV-[V-IV]-V--- are a (variation of the) deceptive cadence (usually V-VI, but note how the first beat of the second bar can be seen as a mixture of VI/IV from a melodic-harmonic point of view). Choosing F natural is coherent with/reinforces the violence of the contrast (delaying resolution, stepping back from the expected musical progression), which finally ends as expected ---this is typical from Bach's style; he is able to tease the listener as long as he wishes, but he never "disappoints" you in the end.
Nothing weird or mysterious, but truly the work of a master. The Master.
Answer: Nice melodic handover from C, B, A, G in the alto to the continuation F, E, D, C etc. in the bass.   Yes, he chose to re-establish C major at that point.   I think we just accept it as an artistic decision.
Answer: Well, we don't know why Bach wrote it that way. It make sense to believe that he simply wanted it to sound that way.
When the F natural is introduced in the first beat of that bar, the resulting harmony on that beat becomes a G7 chord which turns it into a dominant to C Major. but since we stay in the key of G Major at this point the C major is actually the subdominant in which case the G7 chord is a secondary dominant to the subdominant C Major.
It is impossible to answer why Bach wrote it that way, since we can't ask him.
¤¤¤
An elaboration. @AGuyCalledGerald wrote:

Is there a harmonic meaning/justification behind this? I experimented a little and found that the passage does not sound much differently if the f is sharpened.

Hmm the harmonic meaning is the choise Bach made. When adding a natural sign he emphasized a dominant type of feeling making the chord into a G7.
You could also say that by adding the natural sign he created an expressive feeling that is different from having an F sharp.
But since your experience is that the passage does not sound much differently it is just a little detail. But then you can say that Bach often has small details that kind of works like tasty spice on a great meal.
Comment: You're correct that it's impossible to know his thought process. At the same time, I see these questions about being more about "how do we analyze and understand Bach's choices in this case?" and not literally "what exactly was he thinking in his mind?"
Comment: @ToddWilcox You have a point. I decided to add an elaboration in the answer.


Does using dark corn syrup instead of light affect the white color I usually get making fondant?

Question: The recipe calls for light corn syrup but I couldn't find light corn syrup and would like to use dark instead. Does it affect the color I get at the end (before adding icing colors)?
Answer: Yes, it will make it darker and more brown than white. It may also affect any colours you add, adding a slight brown tinge to them.


IIS7 problem with IIS_IUSRS permission. Cannot play a mp3 file

Question: I have an asp.net application on IIS 7 and Windows Server 2008. I have a folder where the administrator can upload mp3s through a asp.net form. The folder that the mp3s are stored has permissions under IIS_IUSRS (IIS USERS) to write, read, etc. When he upload a file, automatically the new file loses all the permissions and consequently this mp3 cannot be played by the website either from an authenticated user nor from an anonymous user. If I change the permissions manually the problem is fixed, but it starts again in a new uploading. Any ideas?
Answer: Either the upload script is changing the permissions when it saves the file, or the NTFS permissions aren't setting to inherit the permissions correctly.
To rule out (or in) the upload script, try dropping a file in that folder manually (copy, not move) and make sure that it obtains the correct permissions.  If it does, then the issue is most likely with the asp.net form.
If the issue happens manually from Windows Explorer too, then check the Advanced NTFS permissions.  It's possible that the permissions for the IIS_IUSERS user are set for 'this folder only' and aren't inheriting for new files.
Comment: I want to thank you for your answer. I tried your test (copy a file and check what were the permissions) and there wasn't any problem with copy the file manually. However, the same technique I used to upload files with other sites and this does not happen in any other site. I noticed that it does not only lose the permissions for the IIS_IUSERS but it reports fewer users in the permission list. The manual copy reported these users "SYSTEM
NETWORK SERVICE
Administrators
Users
IIS_IUSRS
TrustedInstaller" and the uploading reported these "SYSTEM
NETWORK SERVICE
Administrators
IIS_IUSRS".
Comment: Based on your findings, it sounds like the asp.net form updates the permissions when it saves the file.  I would review that form if you have access to the source and see what it's attempting to do.


Installing New Light Fixture - wires not matching up

Question: I'm trying to put a new light fixture in place of old one and the old one was connected only by a white wire (w/ black electrical tape) and the grounding wire to green grounding screw. The new light calls for connecting black, white and ground with wire nut. Inside outlet box, it has 4 black wires connected with wire nut, another 2 white wires connected with wire nut and the single white wire (w/ black tape) . I tried connecting new light the way the other one was but that did not work. Any ideas?
Answer: The white with the black should be the hot going to the switch, but in this case it might be the switch hot coming from the switch.
The use of the ground for neutral is bad/a hack use when the neutral is broken.
Test the white with black tape.  It should read ~120 volts to ground when the switch is on.  If so okay.
Connect the white with black tape to the black of the light. The white of the switch should go to the white connected together, and ground to ground only.
Comment: Better yet, identify the black associated with the white with black tape (in same cable with it) and switch the two to make this a correct outdated switch loop as opposed to an incorrect outdated switch loop.
Comment: Thanks! I will try and get back to this thread when I can try later on. Much appreciated


how to play a sound in wp7 when user clicks a icon

Question: I've many 'words' in my project. There is a listen icon next to each words. I want to know how i can play a sound when user clicks on the icon. All my sound clippings are only of 1 second.
Answer: Use the XNA SoundEffect class.
You find a code sample here, where a similar question has already been asked.


Tags: "patterns" & "pattern-matching"

Question: What is the intended distinction in use between the tags patterns and pattern-matching?
Answer: There's not much difference. Pattern is the object, pattern-matching is the process that uses it. I can imagine the former is used to tag questions about how to construct patterns, string patterns etc. while the latter is used in questions about how to use them (level specification, Cases vs Select etc).
The difference is subtle and I'm not sure the average user will pick up that difference. I wouldn't object against merging them.
Comment: I was wondering about this one for some time, and would recommend merging too.
Comment: I agree with merging them too. I would suggest [tag:patterns] be the master tag.
Answer: I'm not certain these should be merged.  If they are, I feel that pattern-matching should be the master.

It is used preferentially: 54 versus 15 questions at this time
It is not easily confused with design patterns
pattern-matching is at the heart of Mathematica; not having such a tag seems wrong.

Since there are fewer questions tagged patterns it will be easier to re-tag those questions should we keep both; it would be impractical to re-tag the majority of the pattern-matching questions, now and in the future.
I propose that we clear out the patterns tag and try using it only for questions predominately about patterns.  This can be a vague distinction and if it proves to be a useless one we can merge the tags.  Some candidates for patterns:
How can I ensure that I am constructing patterns in the most efficient way possible?
Why doesn't PatternTest work with Composition?
How to use subscript in pattern names?
How to generally match, unify and merge patterns?
Why can't NumberQ be used as the head of a pattern?
What's wrong with this pattern of the form Except[Repeated[....]]?
Pattern issues weird warning
Questions like this might be tagged with both:
How to Combine Pattern Constraints and Default Values for Function Arguments
Comment: I would prefer [tag:pattern-matching] over [tag:patterns] (same reasons), though I'm still not sure that a separate [tag:patterns] would be that different. As I see it, every pattern involves the patternmatcher in some form, so they are really closely related. A pattern in itself (i.e. without the patternmatcher) functionally speaking is not a pattern. It is like distinguishing between object and process, though one cannot be defined without the other.
Comment: So, that is a +1/-1.

Tags: "patterns" & "pattern-matching"


Why computers and books aren't square

Question: Wondering why they are rectangular rather than square.
Answer: Well, books are in "portrait" mode since it is easier to read a 7-11 words long lines. Monitors are in "landscape" mode since we have two eyes that are side by side and not stacked, and so it is easier to scan horizontally than it is vertically.
Comment: But we also scan printed books and we read lines of words on monitors, and smaller computer monitors tend to be portrait.
Answer: Square seems logical. But logic is only a tiny part of the reason things are designed the way they are designed.
Books

As already noted, there is an optimal length, within certain constraints, for lines of text. Maybe 7 - 11 words. Perhaps 4" - 8". I am sure plenty of people have done research on this. But the end result is that even in the days of big horizontal scrolls (I am thinking of Torah scrolls which go back thousands of years, and I am sure there are other examples), even though the scroll might be hundreds of feet long, each column was (and still is) comparable to a page of a modern book. Related to this, if you have a very wide page - e.g., newspapers - and/or small print, the page is broken up into columns.

Length is based on other parameters. One is materials. Since width is set based on reading ability, length is set based a little on reading (hard to read if the page is too long) but more based on handling (easier to carry if less than a foot or so long) and on manufacturing materials. That sets an absolute maximum of width x height (turning the parchment whichever way works best) based on the size of animals for parchment and based on manufacturing capabilities for paper. Paper can now be made really, really big without a problem, but before the industrial revolution that was not the case.

So without a clear reason to make books square, they typically (in Western society as I'm familiar with it) were - and still are - made 5" - 10" wide and 8" - 12" tall. But there is plenty of variance and you can make books square today if you want to.
Computer Monitors
Computer monitors are to some degree based on books. A "page" on the screen is comparable to a page on a book. However, technological issues get in the way - or at least they used to. The first generation of computer monitors used CRTs. These were originally circular. Logically, a square in the middle makes sense. There are two different ways of using a monitor - vector and raster scan. Vector monitors are relatively limited when it comes to text display and virtually all monitors today are raster based.
With a raster scan monitor, you have a series of lines and each line contains dots (pixels). There are different design considerations for the number of lines vs. the number of pixels, with the end result that "close to square" is good for manufacturing reasons (a CRT is effectively a section of a giant sphere, so a circle --> square is easiest to manufacture but it can and does vary quite a bit). That resulted in the 4:3 aspect ratio of most CRT TV screens (despite the different aspect ratio for film-based movies) and the same - or close to it - ratio was used for most CRT monitors.
Then we get to the LCD screen revolution. Technically plasma and other types of screens have the same flexibility, but from a practical standpoint LCD has been the dominant monitor type for many years now and most users went from CRT to LCD. (FYI, what are commonly advertised as LED screens are actually LCD screens using an LED for the backlight instead of a fluorescent tube. There are true LED screens in sports arenas and billboards.) An LCD is a grid of pixels that can be built to any shape desired. A lot of the earlier LCD monitors followed the 4:3 aspect ratio for compatibility. But as the technology got cheaper - and the monitors got larger - there were a few good reasons to shift towards a 16:9 (or 16:10 or similar) aspect ratio:

High Definition TV, which includes compatibility with the aspect ratio of traditional film movies
Laptops - A laptop can be made smaller and lighter by having a smaller screen. But that means less stuff on the screen AND a smaller keyboard to match. By using a 16:9 aspect ratio, you can have a screen that has a decent capacity and a width to match the traditional keyboard design but a little shorter - and lighter.
Two-page displays - Instead of trying to match one page of text, a wide monitor can match two pages of text - good for reading but also for editing.
Multitasking - One window for a browser, another for a word processor, etc. all on one monitor is much easier with a larger monitor, and because of the way the eyes work, this is better side-by-side than in a giant square (think about papers spread across your desk).
For those who have a preference for extra-tall vs. extra-wide, many monitors (as well as most smartphones and tablets) can easily change orientation.
Answer: This is an excellent question.
First observe that whereas computer monitors are almost always oblong, the larger ones are usually landscape and the smaller ones are usually portrait. (Note the meaning of the word oblong: it means rectangular but not square.)
Why is this? Well on the larger monitors there is space to show, in the normal course of things, more than just a single window that contains lines of a nice reasonable length, which as others have pointed out is about 7-11 words long. In principle we could have the other items on our screen arranged in a column, below and above what we're reading at a given time. But

because our eyes are horizontally aligned it's easier to scan from side to side and therefore to position the other items horizontally; and

another reason is physical stability: wide and low is more stable than narrow and tall.

So monitor screens large enough to have two or more windows open most of the time are almost always landscape.
With smaller screens you tend only to have one window open and the main UX constraint is line length. So since you're not going to have anything to each side of the window, you might as well have as many lines on your screen as possible, hence the use of portrait.
There are also medium-size screens, and sometimes these have existed on a middle ground and been fairly squarish, for example the early computers made by Apple.
As for why books are usually portrait, the same kind of consideration has applied as for smaller computer monitors. You may find it interesting to have a look at traditional canons of page construction.
There is of course some leeway in design and it is not true that a book printed landscape is totally unreadable. Some books are printed landscape. But these tend to have a lot of pictures.
When there is only or mainly text, then given the constraint on line length and given also that you want as many lines on the page so long as you don't get so many that the book becomes unwieldy, it follows that the format to choose is portrait.
As for the specific question as to why more books haven't been square, further consider wieldiness. Books are bound along one edge and made to be opened flat. If they were square they would when opened be twice as wide as they were long, which may make them a little more unwieldy to deal with than if they were produced portrait. However, this would also suggest that books shouldn't be landscape, whereas in fact some books are landscape. Other parts of the reason for the rarity of square books may well be to do with printing technology and paper production. Thus it may be possibly be more economical to cut page sizes with the same dimensions as for portrait and then bind along a short edge, getting landscape, than to cut the pages square.
Comment: also for very small screens (mobile phones) it's _harder_ to hold the device in a horizontal position instead of portrait.

Why computers and books aren't square


Random Walk Probability Including Drift

Question: What is the equation for the probability of a random walk with drift being equal to a specific value after n steps, given a specific standard deviation?
Answer: I assume that you expect motion to be gaussian at each step with 0 mean and $\sigma$ standard deviation and each step is i.i.d. (leave comment if this assumption is incorrect).
In such case the probability distribution is simply the convolution of $n$ gaussians with these moments and can be evaluated for any given point using the normal probability density function.
e.g.: After 3 steps $\phi(x) = \frac{1}{\sqrt{2\pi}\hat\sigma} \exp(-\frac{x^{2}}{2\hat\sigma^2})$, where $\hat\sigma = \sigma\sqrt{3}$.

Random Walk Probability Including Drift


Getting the IP of the interface that received a recvfrom() UDP packet (Microsoft)

Question: Using recvfrom() on a socket bound to INADDR_ANY on a Microsoft multihomed PC.
when recvfrom() gets an UDP packet: how can I find the Interface (IP) that received the packet?
Comment: Microsoft PC? That's a pretty wide range of possibilities, I'm assuming Windows - but still, what version? Win 3.11 and Win 7 are *slightly* different. Also, what have you tried? What results did you expect? What did you get instead?
Comment: --for some reason I cannot edit the original post--
using recvfrom() from win2000 (I cannot use WSARecvMsg()) to Win7
so far I couldn't find anything to do this
Answer: There is no way to know the receiving IP when a single listening socket is bound to multiple IPs.  Instead of binding a single socket to INADDR_ANY, you can query the machine's list of local IPs using GetAdaptersInfo() and/or GetAdapterAddresses(), then create a separate listening socket for each IP.  You can use getsockname() to know which IP a given socket is bound to, but only when that socket is bound to a specific IP, not multiple IPs.


gcc --- __attribute__((interrupt( irq )))

Question: i started with device driver for arm ... there i saw for each handler mention --- __attribute__((interrupt( irq ))) -.I am confused how this attribute will place a call to our driver routine ..??
IRQ of arm have following Vector address--- 0x00000018 (or 0xFFFF0018)
As there can be many interrupt handler on same line. Suppose if we have 4 device driver each with its own IRQ to be reistered.
Means some startup code will be provided by the GCC compiler for the IRQ handler & compiler will place call to our routine in that startup code for interrupt handler ..... Am i right ...?
Comment: If you want to ask if gcc somehow generates code to automagically install you interrupt routine - no, this is not the case.
Answer: From GCC docs for interrupt attribute:

The compiler generates function entry and exit sequences suitable for use in an interrupt handler when this attribute is present.

You can use objdump easily to see how this attribute changes your binary which should clarify the situation for you much better.
Answer: The attribute should ONLY be used by interrupt handler of the OS and NOT by interrupt handler of a specific driver. The OS will read the IRQ vector/number and call the appropriate driver function to service the IRQ. You only need to register your driver/ISR with the OS.


MSFvenom format specifier

Question: In msfvenom, what does it mean exactly when I specify the format to C or Python? And what is the format 'raw' for? I know, when the format is psh-cmd it runs in the command prompt, and when it is exe it runs as a normal executable, but what about the others?
Comment: If you run those formats, you will see that `C` and `python` will produce code in those formats...
Answer: There are 2 formats in msfvenom. Executable formats and transform formats (see Metasploit unleashed).
The first one will create an executable of some sort. exe will create a Windows executable. Elf will create a Linux executable. Psh will create a powershell script you can execute right away. And so on.
The transform formats format the payload in the given format so that you can include it in a program of the same format. if you provide "C" here you will get an array of unsigned char. Up to you to use it in your C source code. You will most probably use the transform-format when writing an exploit and sending the payload over the network. If the exploit is written in ruby you'll want the payload as ruby array.
I just tried format "raw": It seems to output the payload as pure binary executable code. Don't know what one would use that for, didn't happen to me yet.
Comment: Thank you, for what I understood the raw format is when I want to pipe the output to encode it again with a different encoder, that is the only use I found for it. But thank you for the explanation, I understand now
Comment: The `raw` format is also useful payload types that are already ascii text by their nature, like `python/meterpreter/reverse_tcp` which is python code.

MSFvenom format specifier


16 bit DAC microcontroller

Question: I'm currently working on a audio project where I need to play a 16 bit depth signal with a speaker.
Right now I'm using an atmega328 for prototyping, two 8 bit shift registers (controlled by the MCU) and an R-2R DAC (and an LM386).
Given that the setup is not so simple, I was wondering if an MCU with a 16 bit DAC exists. Searching on Google, 12 bit is the maximum DAC resolution that I can find for an MCU so far.
So my question is: does such a device exist? Or is there a simpler alternative?
Thanks
Comment: The LM386 is a budget audio amplifier. Check its noise specification but I suspect that you're wasting your time with 16 bits.
Comment: There is [a guy](https://hackaday.io/project/3649-build-your-own-wave-player-with-cd-audio-quality) who has made a .wav player using just an AVR uC and its PWM.
Comment: @Transistor Yeah, I think you are right. 16 bit is way too much.
Comment: @LongPham Well, a really cool idea. Thank you for pointing it out.
Answer: It's possible that what you want is made, but most DACs you will find built into an MCU would not have more than 12-bit resolution.
In fact simple static DACs of 16 bit resolution are not all the commonly built or used, and are unnecessary for audio.  Instead, more complex technique such as Sigma Delta modulation are typically used.
The classic solution of your problem would be an MCU with an I2S interface (or generic synchronous serial implementation able to interoperate with I2S) feeding an external sigma delta audio DAC.  Many the STM32 series (and likely other lines as well) have such an interface, and its typically something you can select for when using a distributor's online catalog matrix tool.  You may also want to consider making sure you can find code examples for a chip which are adaptable to your need, as figuring out how to operate a peripheral (especially one you would probably want to feed via DMA) from scratch can be a bit of a project.
If your needs are not particularly strict, you might also simply be able to use a PWM output from an MCU timer and an analog lowpass filter.
And yes, there are some parts with 12-bit DACs that you might be able to time modulate to squeeze out another bit or two.
Something you will discover is that it is by no means trivial to design the power and surrounding circuitry in a way that is quiet and linear enough for the limitations of a 16-bit representation to become apparent - it can be done, but a first attempt is unlikely to result in that performance.
A request to identify specific chips would be an off-topic "shopping question" not permitted here.
Comment: Thanks for this info, I misread the question, so I deleted mine.
Answer: Why not just daisy chain two DACs with a resistor in between? You can in theory create a 16 bit DAC with two 8 bit ones if you put in just the right resistor in front of one of them. More realistically two 8 bit ones will make a 12 or 14 bit DAC. But why not daisy chain three or four? That way you can get whatever resolution you want.
Comment: Not sure how this would work in practice because you have to sum the signals and have the higher signal very exact. Cannot see how this would work.
Answer: Microchip's DSPIC33FJ128GP has an integrated 16 bit audio DAC.
I use it often. Its fairly easy to use and I find it pretty good.
Answer: Yes, they exist. Do a parametric search at a distributor and then go check out datasheets and you will find. Microchip (nee Atmel) parts are one lead.
Or use an external DAC and get more freedom for the MCU core choice and perhaps lower costs. I2S is a common interface for audio.

16 bit DAC microcontroller


What is a wavelength of an EM wave physically?

Question: This might be a silly question given I am a physics undergrad, but I was suddenly confused.
Usually when EM hit a gap they diffract through the gap. But if the gap is too small, diffraction can't take place. But what is actually happening to prevent the diffraction. I know the definition of a wavelength is the distance from one crest to another (or trough). But isn't that description just because of how we deal with waves mathematically, I mean EM radiation is not actually a sine wave.
So what is happening at the gap to prevent the diffraction physically.
I hope I made sense, I literally typed this in a few minutes because I just had this question, so I appreciate my points will be over the place. Let me know where you might need clarification.
Comment: There is absolutely nothing happening to prevent diffraction even for small gaps, the resulting amplitudes are just very small, so you might get the impression that the wave can't get trough, but that's not the case. Better observation shows that it can and does and that's quite important for a number of areas e.g. for electronics systems with small antennas (especially in the case of EMC) and optics (scattering on sub-wavelength particles).
Comment: A gap is usually not resonant, although it can be, in which case one can get a strongly enhanced transmission of waves trough it, but I think that's rather tangential to your question. I think your problem relates more to the question to what "wavelength" means for structures that are smaller than a wavelength? I think the easy answer is "not much". Wavelength is only well defined for nice parallel wavefronts far away from the near field of point emitters. Look at the near field solution for the dipole emitter: https://www.youtube.com/watch?v=F3SXmgm2uxM
Comment: Ah okay so is it like a resonance type thing, where the most energy diffracted through at gaps roughly same to the wavelength?
But what is a wavelength, how do I visualise what is happening at the gap why there is dependency on wavelength?
Comment: Even for gaps whose size is well below the wavelength of the incident light, there is some diffraction/transmission. This problem has been delt by Arnold Sommerfeld in its book "lectures on Optics". The transmission at the gap depends on the polarization of the wave which by the way explains how polarizers actually works.
Answer: Actually, this is a nice question $-$ why do the dimensions of the slit or a hole (which are transverse to the direction of your incident plane waves) limit possible range of wavelengths (which are longitudinal, between two EM planes) of the transmitted wave.
Without deriving the behavior from wave equations which would do the job, one may say that it's due to the Huygens principle $-$ every point of space which is excited by a disturbance (i.e. excitation, a coherent electro-magnetic (EM) wave in our case) becomes a retarded (in time) spherical wave source of that disturbance. In the article, it is clearly shown that a slit or hole of the size comparable to or greater than the wavelength of the incident coherent plane wave may become a source of spherical or half-plane/half-spherical waves in Huygens' manner, respectfully, so these waves will be transmitted through the slit/hole. If the size of the slit/hole and the thickness of the screening barrier are less than the wavelength, the transmitted wave will be purely spherical, but its intensity will be proportionally lower due to the reduced size of the slit/hole. But, in case that the hole (not slit) is longer (i.e. thicker barrier), it will behave like a waveguide and some EM transmission modes are not allowed here (see the cut-off wavelength/frequency from Waveguides), hence they will quickly vanish. You can imagine that the wavefront in the slit/hole is not wide enough to constructively fully reconstruct the next wavefront at the wavelength distance, so the wave will be progressively attenuated with the distance.
Furthermore, this has not to be a massive object with a hole $-$ even a single conductive wire (thin compared to the wavelength) will scatter an EM wave. Electrical current is induced within the wire due to the electrical field (E) parallel to the wires and it generates EM components with their E also parallel to the wires which destructively or somewhere constructively interfere with the incident wave. The resulting wave looks like as if the incident wave was scattered from the wire and there is no restriction on its wavelength. Then, a discrete set of equally distanced thin wires also scatters the incident wave, but now these scattered components constructively interfere among themselves which may intensify the final effect depending on the wavelength, distance between the wires and the distance at which we observe the effect. In case that the distance among the wires is comparable to or less than the wavelength, the propagated field with the E component parallel to the wires won't go far from them, i.e. it will be defined mostly as a complex near field, whilst the far field will quickly vanish due to the formed scattered EM wave plane (approximately $-$ becoming more ideal plane as the number of wires increases) which destructively cancels out the incident wave. Notice that the incident waves with the E components normal to the wires generally won't be affected, i.e. the wires are mostly invisible to them. And this is the mechanism behind polarizers.


What would the effect of having effective birth control have on European medieval/renaissance marriage?

Question: I'm writing about a world where there is magic and one of the basic uses is as birth control, it is relatively cheap to obtain. I want to know the effect birth control would have on the concept of marriage during the time period
Comment: Medieval people were not *stupid*, and family planning is not a modern invention. Of course, not everybody practiced family planning; pesants, workers and so on *depended* on the labor of children and had no wealth to conserve, so they went for the maximum number of children. But then, even today such families don't use birth control. (And I don't fully see what's the link between the availability of methods for avoiding conception and *"the concept of marriage"*.) (P.S. In western Europe, the Middle Ages plus the Renaissance cover almost 1,200 years. That is a loooong time.)
Comment: Welcome to worldbuilding. As a general rule, "what is the effect of X on society?" is always too broad of a question for our standards. Please take the [tour], read the [help] and then edit your question to make it compliant with them. Then it might be reopened and answered.
Comment: I would say that 12 eggs is pretty cheap birth control. Anticoncepction was known and used since ancient time. Also severe malnoutrishion and hard work in medieval time meant that women didn't had monthly periods.
Comment: This was also a period where, at times, clergy pressed the idea of families pretty hard - but that depends specifically on what 10-year period you're talking about. @AlexP is right, it was a 1,200 year period. Can you narrow it down to a 10-year period? Can you tell us exactly where in Europe our test-family lives? Laws, culture, and mores varied considerably between locations. It would also be good to know what their political leanings are, their affluence, and their religion.
Comment: I think you might be inserting modern American leftist political ideals & worldview a wee bit too much into your "medieval / renaissance" world. You might consider studying the (Western) medieval / renaissance worldview first.
Answer: Very little
As the comments have pointed out, birth control wasn't unknown nor unacceptable to medieval European peasants, though their version of abortion was to induce a miscarriage. That said, peasants didn't really use birth control because children were a resource for a peasant family - free labor to work the fields, for instance. The expression appropriate to the time period is 'Children are a poor man's riches'.
Among the nobility, birth control would have been more useful (don't want to get caught having an affair with an unmarried woman, for instance), but since they had access to a rudimentary form of it at the time, it probably wouldn't have that much of an impact.
Comment: They used multiple methods for family planning; inducing a miscarriage (aka an abortion) was only one of them. They used primitive diaphragms, they used spermicides and / or irrigation, they used the rhythm method, and so on. And the most ruthless planners were not the rich nobles: it was the relatively well-to-do farmers and burghers, who were really really interested in avoiding the dissipation of the limited family wealth. For a farmer who owned just enough land to be able to be independent it was crucial not to split it into multiple small pieces.
Comment: @AlexP That's why they would only give their land to the firstborn and apprentice the rest of their children off.
Comment: That depends very much on the legal and judicial framework, and on the availability of apprenticeship positions. In most cities there were barely enough apprenticeship positions for the sons of the members of the guild; and most people didn't even live in cities... It was actually quite a feat of intrigueship to get an apprenticeship for the son of a non-member. Life was tough in the Middle Ages.


What's the + in find /path/ -exec command '{}' + do?

Question: What's the + in find /path/ -exec command '{}' + do? as opposed to find /path/ -exec command '{}' \;
Answer: The '+' makes one big command line out of all found files to minimize the number of commands to be run.
Given the case that a find command finds four files.
find . -type f -exec command '{}' \;

would produce
command file1
command file2
command file3
command file4

On the other hand
find . -type f -exec command '{}' \+

produces
command file1 file2 file3 file4

Comment: If you know `xargs`, `-exec … {} +` does the same as `-print | xargs …`, but without the quoting issues (`-print0 | xargs -0` is another way, but it's less portable).
Answer: From the man page:

-exec command {} +
This  variant  of the -exec action runs the specified command on
                the selected files, but the command line is built  by  appending
                each  selected file name at the end; the total number of invocations of the command will  be  much  less  than  the  number  of
                matched  files.   The command line is built in much the same way
                that xargs builds its command lines.  Only one instance of  `{}'
                is  allowed  within the command.  The command is executed in the
                starting directory.
Comment: man that's very... terse? I find it to be lacking in depth, and clarity.
Comment: The idea is not to blindly spawn one process for each file, but to gather the filenames together and call the command fewer times. An example:
instead of creating 3 different "rm FILENAME" processes, it gathers the filenames and does "rm FILE1 FILE2 FILE3".
Comment: IIRC some versions of xargs have an option to batch these names together up to a specified limit, so you can benefit from this but also avoid overflowing when you have a large list, too.
Comment: (Find, itself, is a scary little language all its own!)
Comment: `find` gives me a semi.


Dimensional consistency of an equation

Question: We know that if an equation has to be physically correct then it must be dimensionally consistent i.e. If an equation is not dimensionally correct then it can never be physically correct. Now in the equation of distance travelled by a particle in nth second, we see distance at LHS and the sum of $u$ and $a/2(2n-1)$ on the RHS. Now how can this equation be dimensionally consistent as it doesn't seem to obey principle of homogeneity (the dimensions of distance and velocity $u$ are not the same). And if this equation is dimensionally incorrect so it shouldn't be correct physically.
Comment: what is "a/2(2n-1)" ?  please show explicitely the full equation that you think is dimensionally inconsistent.
Comment: Your question is pretty confusing; you might want to take another pass at expressing what you're asking. For instance, what's $u$? And, are you doing this in discrete time rather than continuous time? You might look up [MathJAX](http://meta.math.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference) formatting as well.
Answer: You're correct: whatever your teacher has shown you is dimensionally incorrect, and comes from the assumption of breaking the world into one-second "time steps."
The correct equation for the position of a particle undergoing constant acceleration $a$ with position $x_0$ and velocity $v_0$ at time $t=0$ is $$x(t) = x_0 + v_0~t + \frac12~a~t^2.$$Your formula appears to come from substituting $u = v_0,$ with $x_n = x(t_n)$ and $t_n = n~\delta t$ for some time step $\delta t$ (probably $\delta t = 1\text{ s}$). Then the change in position over one time step is: $$x_n - x_{n-1} =\left(x_0 + u~n~\delta t + \frac12~a~n^2~\delta t^2\right) - \left(x_0 + u~(n - 1)~\delta t + \frac12~a~(n^2 - 2n + 1)~\delta t^2\right),$$and the leading terms all cancel to give $$x_n - x_{n-1} = v_0~\delta t + \frac12~a~(2n - 1)~\delta t^2.$$
First, a caveat: this is not necessarily "the distance traveled" during that timestep; even $|x_n - x_{n-1}|,$ which properly accounts for the possible minus sign(!), still fails to truly be this distance during any timestep where $t_{n-1} < (-u/a) < t_n,$ when the velocity changes sign. Only if this happens to be on a timestep boundary or outside the time bounds that you are interested in, can we use $|x_n - x_{n-1}|$ as the true distance covered in the $n^\text{th}$ time step; and even then, only if $x_n - x_{n-1}|$ is positive will your expression be totally correct.
The reason that you see something "dimensionally inconsistent" is because the units from the $\delta t$ have been absorbed into the corresponding other constants -- in other words the equation that you're looking at has redefined $a~\delta t^2\mapsto a$ and $u~\delta t\mapsto u.$ It has probably done this because $\delta t = 1\text{ s}$ and therefore if you work entirely in SI units then the numbers that you punch into the calculator are the same either way.
This is a tedious problem which also, after a fashion, affects very high-end physics work: it is very common to see authors in high-end papers say "using units where $\hbar = c = 1,$ this equation is...". This sloppiness about the dimensionality of things makes it really easy to write theory papers but very hard for experimentalists to follow up and say "okay, here's what we are trying to measure, here's what our results should look like," etc. So please regard this as good training for a career in theoretical physics, not a sloppy slip-up by your teacher!
Answer: The equation is perfectly correct . Lets see its derivation .
The equation for the position of a particle undergoing constant acceleration $a$ with position $x_0$ and velocity $v_0$ at time instant $t$ is $$x(t) = x_0 + v_0~t + \frac12~a~t^2.$$The formula comes from substracting the position at time (t-1) seconds. Then : $$x_t - x_{t-1} =\left(x_0 + ut + \frac12~a~t^2\right) - \left(x_0 + u( t-1 s) + \frac12~a~(t^2 - 2t + 1)\right),$$and the terms cancel to give $$x_t - x_{t-1} = v_0( 1 s ) + \frac12~a~(2t - 1  s)~( 1 s).$$
As you can see we generally skip writing the units. So dont do it. Additionally the equation is now dimensionally correct.

Dimensional consistency of an equation


Use SDK 10.5 in Xcode 4.1 on Lion

Question: I just upgraded my machine to Lion to see if the project works on the new OS, but I else need to support users using the program on machines running OS X 10.5, but Xcode 4.1 doesn't come with the 10.5 SDK, where can I get the SDK & how do I install it on my system?
Comment: Read this, some good info. You can install Xcode 3.2.6 on Lion it seems. http://www.cocoabuilder.com/archive/xcode/305884-xcode-3-2-6-on-lion.html
Comment: I thought there was an option to install the 10.5 SDK when installing Xcode, but perhaps I'm wrong...
Comment: @jtbandes there was an option to install previous SDKs when installing Xcode....that feature was dropped in Xcode 4.1 TT.TT
Answer: That SDK isn't "supported" by Apple on that version of Xcode. You can still try Xcode 3.2.6 on Lion http://www.cocoabuilder.com/archive/xcode/305884-xcode-3-2-6-on-lion.html to avoid keeping around Snow Leopard for the "supported" version.
Answer: Download the disk image of xcode 3 (latest version) & found MacOSX10.5.pkg under packages & installed it in the Developer folder, it works great for the majority of stuff (had some problems with a C++ Library but managed to work around it)

Use SDK 10.5 in Xcode 4.1 on Lion


How to Initialize a Struct?

Question: I have a struct like so :
struct fooStruct {
  uint foo;
  uint figther;
}

I would like to initialize that struct but it won't be stored in a mapping but inside an array.
Is there a way to initialize the struct like
fooStruct myStruct = fooStruct.new(par1,2,3)
Comment: good question.  Not covered well in the solidity docs.  This saved me a goo dchunk of time today.
Answer: Yes, just use
fooStruct myStruct = fooStruct(1,2);

Or
fooStruct myStruct = fooStruct({foo:1, fighter:2});

Or
fooStruct memory myStruct; // for temporary data
myStruct.figther = 2; // will only write to memory

fooStruct storage myStruct = ...; // for persistent data, has to be initialized from a state variable. `storage` is the default and a warning will be thrown by Solidity compiler versions starting with 4.17
myStruct.fighter = 2; // will write directly to storage

See the docs for more examples
Comment: Great! can you do `fooStruct myStruct = fooStruct();`
`myStruct.figther = 2;` ?
Comment: The value of each member will default to the `0` value for that type (`0` for ints, `false` for bools, etc.). If you want to have a "default" value that is different from the "0" value, you can either have a bool that indicates a value was set to "0", as opposed to defaulting to 0. You can also use a trick where you use the most significant bit of each value as the "set" bit, then just use the rest as for the actual value.
Comment: Added an example
Comment: `@Tjaden`, What if one of the members is optional. How should defining the struct or assigning change? Eg: if I want the fighter to have a predefined value or `NULL` value.
Comment: Does solidity array has a `filter`/`first` functions which accept a lambda predicate?
Comment: How to initialize it from outside of the contract scope? E.g. from a test file?

How to Initialize a Struct?


wordpress website crash on https

Question: I have this wordpress website: Hevaweb.ir and I recently bought a ssl certificate. The problem is when the site is on http protocol, it works correctly and without any problem, but when I access it via https, all of the pictures and menus will crash!!!
I have to refresh the website 3 or 4 times to shows the full contents correctly... (and it will crash again after cleaning the chrome caches and also use ctrl+f5 keys) I've already tried these methods:
I installed the plugins to force Https on every pages (really-simple-ssl, wordpress HTTPS (ssl))
I tried to redirect all URLs from https to http manually
I checked that if the wordpress url and theme is set on Https in setting section
I manually defined Https protocol for my website on wp-config and just in case to .htaccess file
I checked the host to see if there is not problem
By the way, cloudflare is not installed either!
Comment: This is not an issue with Wordpress, but an issue either with your SSL setup or your hosting environment, and therefore not appropriate for this forum unfortunately. I would recommend contacting your host directly to see if they have any ideas for you.
Answer: This is likely caused by insecure content. WordPress is serving resources (images, stylesheets or scripts) over http instead of https.
To resolve this try the following plugins:
Basic SSL setup for WordPress:
https://en-ca.wordpress.org/plugins/really-simple-ssl/
This one will find any internal link/resource request over http and change to https.
https://en-ca.wordpress.org/plugins/ssl-insecure-content-fixer/

wordpress website crash on https


How to quantify or locate command timeouts in Azure SQL

Question: I am trying to if confirm query timeout in Azure.
Our frontdoor is reporting a 503 response at 30 Seconds response, as its the SQL server default value, I am  trying to confirm if these are indeed query command timeouts.
I've searched for "Timeout" in the Logs section of the portal monitoring (not sure this how they would be represented)
Is there an method to locate query timeouts in Azure?
Answers or links with a decent resource would be highly appreciated as my searches are not proving fruitful at the moment
Answer:
Is there an method to locate query timeouts in Azure?

Here are some links:
Monitor Azure SQL Database using Azure SQL Analytics (Preview)
https://learn.microsoft.com/en-us/azure/azure-monitor/insights/azure-sql
Monitoring performance by using the Query Store
https://learn.microsoft.com/en-us/sql/relational-databases/performance/monitoring-performance-by-using-the-query-store?view=sql-server-ver15
Extended Events in Azure SQL Database https://learn.microsoft.com/en-us/azure/sql-database/sql-database-xevent-db-diff-from-svr
Answer: You can try using Extended Events as shown below:
CREATE EVENT SESSION ssEventoTimeout
 ON DATABASE
 ADD EVENT sqlserver.sql_batch_completed (
 ACTION  (sqlserver.client_app_name,sqlserver.client_connection_id,sqlserver.client_hostname,sqlserver.client_pid,sqlserver.database_id,sqlserver.database_name,sqlserver.session_id,sqlserver.sql_text,sqlserver.username)
 WHERE ([result] <> (0)))
 ADD TARGET package0.asynchronous_file_target(
 SET filename='https://azureblobcontainer.blob.core.windows.net/xe-container/DemoPersistedTimeout.xel')

Answer: Taken from a comment:

This type of information isn't usually collected by SQL Server (or Azure SQL Database). If you don't have some sort of monitoring software then it will be hard to confirm. I would like to point you to using Extended Events, learn.microsoft.com/en-us/archive/blogs/docast/… – Jonathan Fite
Answer: This is a screenshot of Azure SQL Analytics.
You set up a Log Analytics Workspace and attach your databases to it. Note it takes a few minutes for them to show up but you can then see timeouts.
It's still in preview and definitely a bit klunky, but I'm hoping to get some useful information from it.

One thing to note is if you drill down to a query that timed out you'll see a query hash which you can locate in your Azure SQL Query Store with:
select sys.query_store_plan.query_id, query_hash, plan_id,
sys.query_store_query.initial_compile_start_time, sys.query_store_plan.initial_compile_start_time,
query_sql_text
from sys.query_store_plan
join sys.query_store_query on sys.query_store_plan.query_id = sys.query_store_query.query_id
join sys.query_store_query_text on sys.query_store_query.query_text_id = sys.query_store_query_text.query_text_id
where
query_hash = 0x7FF00FC6FDBC40C5
order by plan_id desc

(note: no quotes around query hash!)
Oddly the query hash it's telling me has timed out isn't showing as timed out in query store. So I guess that means the timeout wasn't due to an inefficient query plan, but general resources - or maybe a table lock - something like that.


What did King David do to the people of Ammon after he captures the city in Shmuel 2 at the end of Chapter 12

Question: What does this actually mean?
Was it that King David put them to work or he literally tortured them?
where it says:
31.
And the people that were therein he brought forth and he put them under saws, and under harrows of iron, and under axes of iron, and he made them pass through the brick kiln; and so he did to all the cities of the children of Ammon. And David and all the people returned to Jerusalem.        לאוְאֶת הָעָם אֲשֶׁר בָּהּ הוֹצִיא וַיָּשֶׂם בַּמְּגֵרָה וּבַחֲרִצֵי הַבַּרְזֶל וּבְמַגְזְרֹת הַבַּרְזֶל וְהֶעֱבִיר אוֹתָם בַּמַּלְבֵּן (כתיב בַּמַּלְכֵּן) וְכֵן יַעֲשֶֹה לְכֹל עָרֵי בְנֵי עַמּוֹן וַיָּשָׁב דָּוִד וְכָל הָעָם יְרוּשָׁלָםִ:
Answer: Rashi and other commentators say it means he tortured them. Ralbag explains that this was to dissuade other peoples from fighting the Jews. (See the context starting at, say, 10:1.)


SharePoint not populating columns

Question: My company is using the 3.0 version of sharepoint. I designed a form on InfoPath Designer 2010 and published as a form library on SharePoint. When I published the form I set all the cloumns needed for the SharePoint view in the Publishing Wizard. The People/Group pickers would populate correctly on the view and a few days later would lose the info. I republished the form and double checked that the People/Group field selected from InfoPath was correct, named correctly, set as  (None: Create newcolumn in this library) like before and set to merge because we use mulitple contacts in the field.
When I run a test form after republishing all the columns populate but when I click on a form that was already submitted and resubmit the People/Group pickers will not repopulate even when I manually reenter the information. What would cause this problem and how do I fix it?
I am not writing this form using code
Answer: Where have you found People/Group Picker? In Infopath 2010 I manage to see only Person/Group Picker.
What do you mean under "When I published the form I set all the cloumns needed for the SharePoint view in the Publishing Wizard"? I do not understand what (how and why) are "all columns" needed and how did you set them in Publishing Wizard.   Why do you tag a question on Infopath 2010 by "2007"?
Also, merging forms has nothing to do with necessity to have multiple contacts in the field. Which forms, how and why did you merge?
So, if you need to insert multiple contacts, then republish the form without choosing merge options and insert multiple contacts

SharePoint not populating columns


Where does crop biomass come from?

Question: Each year, large volumes of crop are harvested from fields.

Where does this biomass get replenished from?
Comment: @user137 - It is easy to write a specific answer when you edit the question to your answer...
Comment: That's why my answer seems a bit off now :)
Comment: Since this is now the second thread where editing the question is not liked by the original author, I will open a thread on meta on this.
Comment: @Chris let me know when you do - I don't see anything yet.
Comment: There is already an old question about it. I think this can be used as well, it is [here](http://meta.biology.stackexchange.com/questions/248/on-editing-posts).
Answer: The matter in plants is mostly carbon, hydrogen, oxygen, and nitrogen, with various metal ions and some sulfur and phosphorus. The carbon, hydrogen, and oxygen are taken from carbon dioxide in the air and water from the soil through photosynthesis. Nitrogen is taken up from the soil as ammonia or nitrates, or fixed from nitrogen gas, but this only happens in legumes. Phosphorus is also part of a nutrient cycle. Metal ions such as sodium, potassium, magnesium, and calcium are taken up through the roots with water.
If you're asking about how this material is replenished, fertilizer is an important answer. For centuries, nitrogen was a limiting nutrient in farms because it would get removed faster than it was replaced, especially if crop rotation was not used or legumes weren't grown. Thanks to the Haber Process we can produce humongous amounts of ammonia from nitrogen gas, this has greatly increased the amount of nitrogen available for plants, but has also resulted in nitrate pollution in waterways and algal blooms and eutrophication. Phosphate and potassium are also used in fertilizer and are usually mined, however phosphorus reserves are limited.
Answer: There are biogeochemical cycles for the building stones of the biomass (e.g. hydrogen, carbon, nitrogen, oxygen, etc...), so all of these atoms are recycled. To recycle them the organisms need energy, which they get from sunlight, from chemical materials, etc... (check microbial metabolism for further details).
Plants use sunlight as energy source, CO2 from air as carbon source, water and O2 from air as oxygen source, and so on... You can find more info about plant metabolism on wikipedia.
Answer: The biomass of crops is definitely mostly carbon (from the air in the form of CO2) and water. However, in terms of how it affects the environment: Crops use up trace elements that make up a tiny fraction of the biomass, but it is these trace elements that are not ubiquitously available. Most notably phosphorus and to a lesser extent nitrogen. The impact on the environment is that farming, and especially monocultures, deplete the environment of these essential trace elements. It is often these elements that restrict growth due to competition. Therefore, it may inhibit growth of native species. However, a far more devastating effect is that farmers will re-supply these trace elements in excessive amounts through artificial fertilizers, leading to surplus and run-off phosphates (phosphates are the main form in which phosphorus is applied in fertilizers) (Hart et al, 2004). This in turn dramatically shifts the natural competition for this normally restricting element, in turn promoting growth of non-native plants and promoting the growth of P and N-tolerant plants while suppressing the growth of plants that are intolerant. As most plants are actually intolerant it will eventually lead to species loss and imbalance in the ecosystem (popular link).

Where does crop biomass come from?


Get the caller class name in apex without passing parameter

Question: I have three class namely A,B,C and each calls other class methods. Now my problem is getting the caller class name in called method without passing parameters to the called method. Is there any way similar to Class.Type used in apex to get the caller class name?
Comment: You want to get the class name of the class that called the function, or the class of the function being called?
Comment: I hope I can get the class name of the current class. But how to get the class name of the caller class?
Answer: eh, Here's a potential way to do it, but it's ugly. Like troll under a bridge ugly. Like troll under a bridge picking it's nose ugly.
Some languages provide methods on Exception to see the stack frame trace, and through it -- or by parsing it, you can see the calling class. Some (awesome) languages even provide this without executing an exception (cf: Ruby's "caller" method). Apex however, I think, is probably limited to accessing this information via an Exception. What's below is pseudo-code, and I make no guarantees as to it's viability or syntactical correctness. It is, however, of admittedly dubious usefulness and I don't know if one should do it, even if one can.
<code>String stackTrace;
try {
  Integer i = 3/0;
} catch (Exception e) {
  stackTrace = e.getStackTraceString();
}
String[] trace = stackTrace.split('\n');
</code>
you can then search for your class name and act on it.
Should you really be doing this?
Comment: I know this is a really old answer, but I was reminded by a comment, and saw your answer, which is what prompted me to look for a better way, because handling div by zero is relatively expensive to do each time. Check out this beauty: `String[] trace = new HandledException().getStackTraceString().split('\n')`
Comment: Ugly but never thought this eventhough I was using integer.valueOf('x'); to get code flow when the debug log is big
Comment: I wanted to get the name of the calling class to help in creating unique key names in a caching class. But I don't need a troll picking his nose under a bridge in my code so I'm going to find another way. Nifty trick though. :-)
Comment: Nice idea, but my trigger that called from page or from dml `update` at `trace` show only one line with current trigger :(
Comment: Apex has very little reflection capability.  The stack trace is one of your only ways to get around the inherent limitations.
Answer: Scope rules prohibit any means of any piece of code seeing any variable or object declared outside its scope, so it is impossible for a callee to know whom the caller is, unless the caller identifies itself with a parameter. This is true in virtually any language, and especially true in most object-oriented languages. The purpose of the object-oriented design is that each individual class should not need to know about the details of any other class that depends on it, but should provide a known API that dependent classes can use.
In real-world terms, the transmission shouldn't need to know about what kind of car it is installed in, but the car can only use transmissions that conform to certain physical dimensions and properties. Similarly, code should generally not rely on knowing anything about the implementations that use that code. This leads to fragile code because of the two-way relationship that develops.
Of course, sometimes this design is necessary because of the intimate relationship of the two classes. In those cases, each class must still identify itself to the other, because Apex Code's dynamic language constructs do not include inspection of the stack or learning whom the caller is, as opposed to JavaScript, which did have a callee parameter for this purpose. This problem has existed basically since the dawn of modern programming, including C++.
Finally, as a side note, you should also realize that a caller might not be a class at all. Triggers are not classes, yet can also call classes. You wouldn't be able to determine the caller in that case, because they aren't normal classes.
Comment: For logging classes and the like its pretty relevant to know the caller or even the entire call tree.  Grabbing the stack trace is a good tool in lieu of native reflection, or doing something like passing "this" as a parameter.  This is something other languages most certainly DO have: https://stackoverflow.com/questions/171970/how-can-i-find-the-method-that-called-the-current-method
Comment: @Shanerk My problem with exceptions is that they are really expensive compared to what reflection would offer. Also, I think as of a few years ago, stack traces in a trigger only go to the trigger level, not any further. That said, throwing an exception can at least get a stack string that can be parsed.
Comment: @Shanerk Actually, I just tested another solution that's actually significantly fast. It's similar to the other answer, but with a major improvement. Thanks for bringing my attention to this decade-old answer.
Comment: Thanks, any new reflection capabilities, tricks or workarounds in Apex are always of interest to me and relevant to my daily work.
Answer: Incorporating the latest ideas from @sfdcfox, here is a complete solution you can drop into any class, such as a logging class:
<code>  public final String CLASS_NAME = String.valueOf(this).substring(0, String.valueOf(this).indexOf(':'));

  public String getCallingClassName() {
    String[] trace = new HandledException().getStackTraceString().split('\n');
    for (String s : trace) {
      // Skip lines that correspond to this class
      if (s.contains('Class.' + CLASS_NAME + '.')) continue;
      try {
        // Return the class name from the first line NOT corresponding to this class, ignore the rest of the trace
        return s.split(':')[0].split('\\.')[1];
      } catch (Exception ex) {}
    }
    return 'Unknown';
  }
</code>


Facebook app for Windows phone 7

Question: I have just started learning windows phone 7 programming and working on a project. I just wanted to know any useful guides,websites,links to learn about creating facebook app (normal app to check and update statuses,photos etc.) for windows phone 7.
Can anyone point me to the right direction please ?
Answer: Here's an SDK for integrating Facebook in C#.NET based applications: URL.

Facebook app for Windows phone 7


How to calculate Cronbach's alpha

Question: For my dissertation I am observing horse race videos to see if horses are right or left handed. In flat races where the horse comes out of the starting stalls I observe which leg (right or left) they first use as they emerge. My tutor suggested that I have another person re-score 5% of my observations and use Cronbach's Alpha as a test of 'reproducibility' for my observations. I have no idea how to use the test, so would anyone be able to help with this please? If you should know of an on-line tool to do this that would be great too.
Answer: Here, the Cronbach Alpha would be a measure of whether the observations are reproducible in the sense that your observations are consistent with the other person's. It is a normalized coefficient, larger values indicate better reliability of observations.  See for example https://www.statsoft.com/Textbook/Reliability-and-Item-Analysis for more details. The Statistica software allows you to easily compute Cronbach Alpha, if you don't have a regular access at your uni, you can download a trial version from the mentioned website.

How to calculate Cronbach's alpha


Neo4j connection error as more concurrent users connect

Question:
Neo4j 3.5.12 Community
Python 3.6.9
neo4j-driver==1.7.6
neobolt==1.7.17
Ubuntu Server 18.04
Flask 1.1.2

A web server I run has suddenly experienced a 2000% increase in traffic.  Everything was working fine before this increase.  However, now I'm seeing the following error after a few hours (unsure how long, but within 5 hours) of heavy traffic and then fail constantly after that.  Like connections are not being closed or something.
     db = GraphDatabase.driver("bolt://localhost:MYPORTNO", auth=basic_auth(DATABASE_USERNAME, DATABASE_PASSWORD, encrypted=False)
   File "/home/ubuntu/api/env/lib/python3.6/site-packages/neo4j/__init__.py", line 120, in driver
     return Driver(uri, **config)
   File "/home/ubuntu/api/env/lib/python3.6/site-packages/neo4j/__init__.py", line 161, in __new__
     return subclass(uri, **config)
   File "/home/ubuntu/api/env/lib/python3.6/site-packages/neo4j/__init__.py", line 235, in __new__
     pool.release(pool.acquire())
   File "/home/ubuntu/api/env/lib/python3.6/site-packages/neobolt/direct.py", line 715, in acquire
     return self.acquire_direct(self.address)
   File "/home/ubuntu/api/env/lib/python3.6/site-packages/neobolt/direct.py", line 608, in acquire_direct
     connection = self.connector(address, error_handler=self.connection_error_handler)
   File "/home/ubuntu/api/env/lib/python3.6/site-packages/neo4j/__init__.py", line 232, in connector
     return connect(address, **dict(config, **kwargs))
   File "/home/ubuntu/api/env/lib/python3.6/site-packages/neobolt/direct.py", line 972, in connect
     raise last_error
   File "/home/ubuntu/api/env/lib/python3.6/site-packages/neobolt/direct.py", line 962, in connect
     s = _connect(resolved_address, **config)
   File "/home/ubuntu/api/env/lib/python3.6/site-packages/neobolt/direct.py", line 843, in _connect
     raise ServiceUnavailable("Failed to establish connection to {!r} (reason {})".format(resolved_address, error))
neobolt.exceptions.ServiceUnavailable: Failed to establish connection to ('127.0.0.1', MYPORTNO) (reason [Errno 111] Connection refused)

If I restart apache it works again, so currently as a bandaid, I'm doing that on a cron job every few hours, but that only seems to partially work.
I increased the page cache and heap calculating according to this article.
I increased the Open Files Limit from the default 1024 to 50000.
I doubled the server spec.
Structurally I create a database driver instance in a config file:
Config file:
db = None
def getDB():
    global db
    if not db:
        db = GraphDatabase.driver("bolt://localhost:XXXXXX", auth=basic_auth(DATABASE_USERNAME, DATABASE_PASSWORD), encrypted=False)

    return db

I can then make queries in my module files as follows. I believe the following syntax properly manages connections being opened and closed due to the with statement, and so shouldn't leave open connections:
Module file:
db = config.getDB()

with db.session() as s:
        with s.begin_transaction() as tx:
            tx.run("the cypher", {the params})

I am also seeing the following error in the logs, although I'm not sure they are directly related.
ValueError: filedescriptor out of range in select()

Does anyone know what is causing this or how to fix it please?  Thanks!
Answer: Turns out that I had a cron job that was running every 10 minutes and was leaving the driver instance open each time.  Schoolboy error.


Imported .FBX file from fusion opens with multiple dotted lines and empties, I can't remove them without changing the objects' allignments

Question: After adding joints on my model, I imported it as an .fbx file into Blender 2.8 to create an assembly animation.
But when Blender opens the file, there are multiple dotted lines which are centered in point, also there are lines (I found out they are called "empty") that I can not remove without messing up the positions of the objects.
I removed the joint in Fusion and tried again, but they're still there.
Do you know how can I fix this problem?
Answer: The dotted lines are relationship lines. They mean that one of the object is the parent of the other, which in turns means that if you transform (move, rotate, scale) the parent object, all its child objects will have the same transformation applied.
You can "unparent" objects by selecting them and then using either :

The shorcut ALT + P then choosing "Clear and keep transformations"
Object (top or bottom bar of you 3d view) > Parent > "Clear and keep transformations"

Then, the relation lines should disappear and you can freely delete your empties.
I would advise selecting ALL your objects in the scene and unparenting them all at once while keeping their transform.
Comment: thanks! doted lines dissepared but the lines (right side of the image) are still there, do you know the reason?      thanks again
Comment: Do you mean the crosses ? They are the empties. They are a conceptual object which can serve as parent for example or to transform other objects with certain tools in blender. If they are unparented you can simply select them and delete them with the "x" or "del" key
Comment: when ı select and delete them all the objects move somewhere else, but ı unparented them just as you said, i don't get why it doesn't seem to effects it
Comment: Could you upload your file on https://blend-exchange.giantcowfilms.com/ and paste the link in your question so I can look at it ?
Comment: I'm doing an internship in a firm now so unfortunately i can't share the files :(
Answer: Could they be relationship lines? Removing dotted assist lines? Problem only occurs when Appending!
If you're using 2.8, the option is on the top right of your 3D window with a drop down arrow next to a symbol with two circles interlaced.
Good luck OP :)
Comment: thank you very much!
Comment: No worries :) I literally searched for that yesterday haha. First time I'm using 2.8 and hadn't used blender in years, feels good to be modelling again. Remember to pick one of the answers as accepted so that people know this thread has been resolved (;