Words in Sequence Sharing the Same Root

Question: I am trying to figure out what to call these phenomena. For example, a sentence containing the words "specific specifications" or "participants participate", etc. Is there a word to describe this in English?
Comment: I think it's probably something along the lines of a "false tautology", in one sense.  But there may be a term for the actual duplication you see.
Comment: Parenthetically, "...Sharing the Same..." Can you share something different?
Answer: This is known as
Figura Etymologica
Examples

Gift of giving
Living life
Welcoming welcome

and there is a very lengthy study on the phenomena here: Rhetoric And Repetition: The Figura Etymologica In Homeric Epic
Answer: The expressions you wrote are instances of Adj Noun and Noun Verb, respectively. Each expression contains words derived and inflected from a given root. For instance, the lexical morpheme for your first expression is specify (or possibly spec) and for the second, part.  With these base words, we can construct a class of words, known as a word word family  by attaching to them derivational morphemes, which modify the word's part of speech or meaning OR inflectional morphemes, which modify tense and number. So for instance the word family of spec(-ify) would be specification, specifier, specified, etc. Because a word family contains different parts of speech, a single word family can generate grammatically structured expressions like the ones you wrote. As far I know, there is no term for such expressions in English, but since roots encode semantic information, it's not surprising that the grammatical expressions derived from a word family are often tautological.
Answer: Sounds like tautology to me, though let's wait for 100% sure answer.
Comment: why downvote I wonder?....

Words in Sequence Sharing the Same Root


Has the Federation ever kicked a planet or civilization out of the Federation?

Question: I've seen several episodes where planets have petitioned the Federation for membership, and still others where the Federation is watching a planet's development in anticipation for future membership; but I can't remember if any planet has been kicked out of the Federation. Have there been any?
Comment: **SPOILER ALERT** Andoria withdrew from the Federation in a recent series of novels. I haven't read them, but have looked at the blurbs on the back, so I can't name them, unfortunately. **SPOILER FINISHED** There was also a proposed *DS9* storyline where Vulcan would leave the Federation. The Federation would be convinced that Vulcan had been taken over by the Founders, leading to a story-arc where it would be revealed that Vulcan just wanted out due to increasing paranoia about the Changelings. This was rewritten as *Homefront* and *Paradise Lost*. Tasha Yar's homeworld may be an example.
Comment: @James, that sounds like an answer...
Comment: I don't feel comfortable making it an answer when I don't even know the name of the book I'm talking about.
Comment: [Turkana IV](http://en.memory-alpha.org/wiki/Turkana_IV) withdrew but that's not quite the same as being kicked out.
Answer: Within the TV series and films, there are no instances of existing UFP members being ejected due to their actions although there is a mention of Turkana IV withdrawing their membership after a bitter civil war.
Additionally, certain planets were annexed during the Dominion War (such as Betazed) but their status as members remained and they operated with "governments in exile".

In order to find situations where planetary systems have left the UFP you need to start looking at the weird and wonderful EU book canon;

Star Trek: Final Frontier - Vulcan has left the federation in order to explore the idea of reunification with the Romulan Empire.
Stone and Anvil - Selelvia was effectively ejected from the Federation after it became apparent that their delegates were using mind-control at Federation Council meetings.
Star Trek: Voyager: The Eternal Tide - Andoria 'left' the Federation for an unspecified reason.
Star Trek: Typhon Pact #4: Paths of Disharmony - Another scenario where Andor leaves the UFP, this time after a global referendum on whether to remain (prompted by the UFP's stance on Genetic Engineering).
Star Trek: The Original Series: Devil's Bargain - Vesbius is ejected from the UFP for refusing to give up Eugenics and Genetic Engineering.
Star Trek : New Frontier : Restoration - Danter is temporarily(?) ejected after it becomes apparent that their government is under external control..
Star Trek: The Next Generation – Survivors - New Paris leaves the Federation as they feel that they've been 'abandoned' after a series of disasters.
Answer: In the original plot for Deep Space 9's 'Homefront/Paradise Lost', back when it was going to be the season 3 finale, Vulcan was going to pull out of the Federation. http://en.memory-alpha.org/wiki/Homefront_(episode)#Background_Information
(Just as I finished writing this, I just realised James Sheridan wrote this as a comment long before me, but to be honest, I think it will be every respondent's first thought on this question)
I could be mistaken but I think something like this happened with the Danteri from Star Trek: New Frontier. http://memory-beta.wikia.com/wiki/Danteri I remember them being a member of the Federation in the first book but apparently that is no longer the case, though I'm not sure if that was a retcon or such.
Comment: Thanks for the reply Sumbuddyyx, but I was looking for any members who had gotten kicked to the curb, got the boot, sent packing, ditched by the Federation.
Answer: The Andorians were placed under an embargo by Baras Rodirya (posing as Ishan Anjar) during his term as Federation President. They withdrew from the Federation but rejoined after his involvement in a conspiracy to deny them a cure for a reproductive crisis was exposed. (The Fall, Peaceable Kingdoms)
Some worlds were denied membership in The Next Generation until they presumably improved.


Can Alexander III of Macedon's success be attributed to good logistics management?

Question: A friend of mine who majored in Classical History at Berkeley mentioned that we focus too much on Alexander's battles which are interesting studies in set pieces but not enough on how skilled he was in logistics management.  How integral was operational management during his campaigns and can someone provide examples over the course of his Persian campaign?
Comment: There are entire [books](https://www.amazon.com/Alexander-Great-Logistics-Macedonian-Army/dp/0520042727) on the [subject](https://www.google.com/search?q=alexander+the+great+logistics&oq=alexander+the+great+logistics&aqs=chrome..69i57.8200j0j7&sourceid=chrome&ie=UTF-8). Perhaps the question needs some previous research to narrow it down to something that can be answered with *less* than a book.
Comment: Arguably all great conquest was based on excellent logistics, as this is the bottleneck to move and maintain large armies on field
Comment: @user2448131 That's exactly the book my buddy Ryan mentioned and I'm just looking for some of the more interesting points from that book.  Its on my to read list but always curious to hear from members who have already read it and have particular examples they want to highlight.
Answer: The Macedonian army was indeed relying on a well-established logistics organization.
The following book, as already mentioned in the comments, is probably the most well-known one about the subject and quite possibly the best too.
Engels, Donald W. Alexander the Great and the Logistics of the Macedonian Army. Univ of California Press, 1980.
According to the author your friend was quite correct in his statement that the Macedonian logistics were quite formidable, but often overlooked.
To prove this point, he points to the fact that while Alexander the Great is foremost remembered as a great military commander during battle, he was also wise to the necessity of having a reliable supply line and the intelligence services needed to keep it secure. He points to a story from Alexander's childhood for this.
Plutarch's Life of Alexander 5.1.

He once entertained the envoys from the Persian king who came during
  Philip's absence, and associated with them freely. He won upon them by
  his friendliness, and by asking no childish or trivial questions, but
  by enquiring about the length of the roads and the character of the
  journey into the interior, about the king himself, what sort of a
  warrior he was, and what the prowess and might of the Persians. The
  envoys were therefore astonished and regarded the much-talked-of
  ability of Philip as nothing compared with his son's eager disposition
  to do great things.

Translation from Plutarch. Plutarch's Lives. with an English Translation by. Bernadotte Perrin. Cambridge, MA. Harvard University Press. London. William Heinemann Ltd. 1919. 7.
The story of Plutarch might very well be somewhat embellished, but Alexander's later attention to his logistics during the campaign in Persia suggests that there was a core of truth to it.
Let me paraphrase some examples from the rest of the book
From p12 onwards:
In general Alexander kept his armies' numbers at a minimum.

The army inherited by Alexander had been transformed by Philip into
  the most effective fighting force in Europe or Asia, and Alexander not
  only retained many of Philip's veterans but also the disciplinary
  measures and logistical organization he imposed on the army.

1) Soldiers had to carry their own weapons and there was one servant for every 4 soldiers. This lower number of servants decreased the size of the army significantly.
For this also see Polyaenus Strat. 4.2.10 (Translation from http://www.attalus.org/translate/polyaenus4A.html)

Philippus accustomed the Macedonians to constant exercise, before they
  went to war: so that he would frequently make them march three hundred
  stades, carrying with them their helmets, shields, greaves, and
  spears; and, besides those arms, their provisions likewise, and
  utensils for common use.

2) The number of women was kept to a minimum. In earlier times wives and children were often taken on campaign. With the Macedonian army this was no longer allowed as to make the army more manageable. Alexander's soldiers could visit their family in Macedonia from time to time to make the separation more doable. This made the army as light as possible and capable of surprisingly fast marches.
3) Alexander also kept into account the beasts of burden and the slower vehicles.
Carts were generally forbidden. Even those pulled by oxes. Their top speed was too low for keeping up with the rest of the army.
This measures made the Macedonian army far more efficient than before, but the army still required several tonnes of food and water each day.
Alexander took several precautions to ensure a secure food source.
For a better look at this see: Ashley, James R. The Macedonian empire: the era of warfare under Philip II and Alexander the Great, 359-323 BC. McFarland, 2004.
Even with fewer extra carriers and camp followers to maintain food was an issue. The Macedonian army was still several ten thousands strong with a great deal of warhorses.
Ashley calculates that this would consume at least 750 tonnes of dry provisions. He mentions that Alexander took the following precautions.
1) He tried to spend as much time as possible next to a river or the sea during winter. This made perfect sense as this would make close access to water possible. There was also the Macedonian navy which could deliver food if needed. Alexander's navy was not large by any means, but it still existed.
2) He split up the army when a river or the sea was not accessible.
A smaller group of soldiers is more vulnerable, but it is also more nimble and can gather food more easily.
3) He stayed close to populated centers. Populated centers needed a decent food supply, Alexander could also benefit from this.
4) The soldier's rations consisted of wheat, barley or millet which are not going bad in hot weather and are easy to transport. All these products can be moved without harming them and stayed eatable for far longer than items like fruit would.
Note by Ashley: During a march through harder terrain, like a desert or the Hindu Kush, the demand for food would become much higher often resulting in temporary starvation like during the march in the desert of Gedrosia.
In general, logistics were well taken care of. According to Ashley the techniques of Alexander made his army twice as fast as the Persian one.
My recommendation
For further reading I would really suggest Alexander the Great and the Logistics of the Macedonian Army. The answer I written down here is but a pale shadow of its depth.
I would expect most universities that have a department for Ancient History to carry a copy.
You could also check Lonsdale, David J. Alexander the Great: lessons in strategy. Routledge, 2007.
It makes quite a lot of good points about the importance of a decent cashflow, a reliable navy and the importance of weather conditions. I mostly left those out in my answer to keep the answer contained.
Short anwer: Alexander understood that taking care of logistics was of the greatest importance and took great precautions to make sure they were reliable.
Comment: A splendid answer.
Comment: Exactly what I was looking for!  Thanks @TheSardaukarKnight.  I'll make sure to check out the Lonsdale text that you mentioned too.
Answer: Simply; no.
In war one must do a multitude of things well to win: logistics, command, morale, training, and battle tactics just for a start. Getting any one of these things seriously wrong is sufficient to ensure likely defeat.
That Alexander was able to string together victory after victory virtually guarantees that he was performing all of these skills well. To claim that any one of them was sufficient, of itself, for his string of victories is naive in the extreme.
Comment: I agree with your point PG.  Question doesn't purport that logistics were all that mattered......it asks did the operational organization of the Macedonians have a bearing on Alexander's success or failures.  Think the Sardaukar (Dune baddies? haha) answered how the Macedonians and Alexander in particular's proficiency and recognition of the importance of logistics played a role in his stellar campaigns.
Comment: @mallin24: Yes, I caught the reference - I probably first read Dune  before you got long pants. ;-)  Just look at Douglas MacArthur, who was severely embarrassed **twice** for massive logistical failures (Bataan and then Korea at the Yalu River) . The only time MacArthur actually looks good in independent command is when Nimitz provides logistics for him *gratis*.
Comment: Check out all the preparations Davout was making in Bavaria, March and early April 1809, for an example of how the Napoleon's *Grande Armee* **really** managed logistics. **Saski**'s *Campagne de 1809 en Allemagne et en Autriche* is the best source I expect.


Can you tell me what species of insect this is?

Question: I live in Verona, Italy.
Today I found this black insect and I don't know what species it is. My mom claims it's a kind of mint but I don't think so.
Comment: Hello and welcome to Biology.SE! Take the [tour](https://biology.stackexchange.com/tour) to learn about the site and earn your first badge. Also, what do you mean by "mint"? How's that called in Italian?
Answer: This looks like a horsefly (family Tabanidae, in Italian "tafani"), maybe Tabanus bromius but I'm not sure. If it's so, be careful: they bite and their bite is painful. Here you can find some quick suggestions about horseflies and their bite.
However, as you live in a city, don't worry too much: as the female horseflies feed on horse and cattle blood, they are normally present in the countryside, so those that you saw are exceptions more than the norm!
Comment: The eyes are a bit far apart to be a horsefly; I'm leaning toward Robber Fly (Asilidae) or Stiletto Fly (Therevidae), but can't be sure from the photo (and given how old the question is, I suspect that the model is no longer available for additional photos).
Comment: It's obviously not a horsefly


Need help to understand the log-likelihood annotation?

Question: Trying to know the steps to find the maximum likelihood estimate for the covariance matrix, assuming normal probability distribution, I want to differentiate log-likelihood function but what confuses me is that in the equation, shouldn't $l(\mu, \Sigma^{-1})$ be written as $l(\mu, \Sigma)$? How come $ \Sigma $ can be written as $ \Sigma^{-1} $ below in the red circle? For what reason, can I write like that? It is from an online lecture on YouTube.
Answer: What confuses you is the invariance of the maximum likelihood estimators. In particular, for any function $g(\theta)$ of your parameter $\theta$, not necessarily one-to-one, it can be shown that $\widehat{g(\theta)} = g \left(\widehat{\theta} \right)$. Maybe that was mentioned in one of the previous lectures?
Comment: The lecture is the first one. There is no precious one I guess. The lecturer just said that $$|\Sigma|=\frac{1}{|\Sigma^{-1}|}$$


Ways to observe clock signal of an STM32 MCU

Question: Is there a nice way to be able to observe the clock signal in an oscilloscope to validate my settings for clock speed? After setting it to 168 MHz with PLL for an STM32F407VGT6 MCU let's say.
Comment: Most MCUs feature some sort of "clock out" feature for this purpose. Though you could just implement something like a simple periodic timer based on ARM CMSIS "SysTick", then have that one toggle a GPIO periodically, and measure the GPIO with your scope.
Comment: @Lundin in such case, I won't divide frequency for timer right? I mean Prescaler will be 0 for example
Answer: Directly from the reference manual, pay attention to the last line.

Without oscilloscope you can use TIM5 to perform a comparison between two clocks.
Since TIM5 can input capture from LSI or LSE, you can compare the SYSCLK (the one TIM5 is running on) with any of those. TIM11 can do HSE.
Which is described in detail in chapter: 6.2.11 Internal/external clock measurement using TIM5/TIM11
I'd recommend to do this before using a crystal to check whether it is the expected freqeuncy.
Comment: @muyustan each clockout *pin* has a configurable prescaler. This means you can look at internal clocks up to 500 MHz.
Comment: Ok, so if I configure my clock speed to 84 MHz by PLL instead of 168 MHz, then I should be able to observe 84 MHz clock signal directly from MCO1 pin, if I configure it to output PLL clock, of course. Right?
Answer: Some ideas

Configure SysTick timer to tick after 1680000 clocks (10ms) and toggle a LED/GPIO each 100 interrupts to get 1s update rate (the signal will have frequency of 0.5Hz). The interrupt and SW processing will introduce some jitter to the signal, so it is not good for clock calibration, but it is still good to recognize wrong PLL settings.
Configure one of the timers as PWM output. This will have less jitter, but some timers are not running at AHB speed or even APB1/2 speeds, so it's not very reliable to detect doubled/halved speed etc. However if you're after reading the exact oscillator speed, you may use this with combination with the previous step.
Reading the value with RCC_GetClocksFreq, but it is NOT always reliable, as the library will usually tell you the value you asked for, especially if it thinks your crystal frequency is of a different value than in thinks.
Comment: why did you do "frequency of 0.5 Hz" edit? Isn't it 1 Hz ?
Comment: If the led *toggles* each second, the signal will not be really 1Hz but half the speed. In other words, the toggle changes the phase of the signal by 180° so it takes two interrupts to complete the cycle. The scope would show 0.5Hz. I've made this error before, so I think it is good to mention on this topic. I've accidentally overclocked my STM32F103 to 144Mhz :-)
Comment: ok, so the toggle you are talking about is as follows: LED ON for 1 second and OFF for 1 second and keeps going, right?
Comment: Yes, that was what I meant. I've edited the response to be more clear.


Is it haram to have friends of opposite gender of neighbours and in school?

Question: Assalamualaikum, i am actually student in school, i actually have some female classmates of mine who i usually go for study related stuff and i also give them my work if they need it, i don't have any kind of haram intention about them and we only talk in school snd never any other place only except if they need my notes and i also have a friend of opposite gender who is my neighbour, she's been my friend since we were 3 years old because we were neighbour, is this friendship haram
Answer: I write my interpretation of the rules of religion.
Most rulings of religion have a preventive aspect. That is, most of them are set for prevention and personal health or family and social relationships. That is, if we examine them carefully, behaviors that may lead to crime and damage to important relationships (family or social) are prohibited.
Relationships and friendships with the opposite sex are the same. There may be no bad intentions at first. But there are points. You are aware of your own intentions, not the intentions of the other person. The situation is likely to change over time as emotions and circumstances change. And you may incline to sin. This is how most unpleasant events start.
So a wise man avoids walking on the edge of the abyss. Taqwa requires that you observe all aspects of caution in relations with the opposite sex.


Can I travel to any Schengen country with my EUSS family permit issued by the UK?

Question: My wife is Latvian and she works in the UK and I have my EU Settlement Scheme family permit, my question is do I need a Schengen visa to enter the Schengen area countries or I should apply for one ? Thank u so much
Comment: For completeness, what is your citizenship?
Answer: This answer assumes that you are not a citizen of a visa-exempt country (an Annex II country).  If you were, you would not need a visa.
Under the assumption that you are not, you do need a Schengen visa.
The only document that exempts you from the visa requirement is a residence card issued under Directive 2004/38/EC.  A family permit is analogous to a visa, not a residence card, whether it is an EU Settlement Scheme family permit or an EEA family permit.  To qualify as an Article 10 residence card, the document must say "Residence card of a family member of a Union citizen."
Article 5(2) of the directive says in part:

Family members who are not nationals of a Member State shall only be required to have an entry visa in accordance with Regulation (EC) No 539/2001 or, where appropriate, with national law. For the purposes of this Directive, possession of the valid residence card referred to in Article 10 shall exempt such family members from the visa requirement.

Article 10(1) of the directive says:

The right of residence of family members of a Union citizen who are not nationals of a Member State shall be evidenced by the issuing of a document called 'Residence card of a family member of a Union citizen' no later than six months from the date on which they submit the application. A certificate of application for the residence card shall be issued immediately.
Answer: When traveling with, or to join, your EU-Citizen spouse you will not need a visa. Otherwise you will need a visa for the Schengen Area.
When you and your EU-Citizen Spouse reside in the United Kingdom, this rule only applies (presently) until 2020-12-31.
When you and your EU-Citizen Spouse reside outside the European Union (including countries where the freedom of movement applies), you will need a visa for the Schengen Area.
Comment: This answer is incorrect. An EUSS family permit is not an article 10 residence card. It therefore does not exempt its bearer from the visa requirement.  See my answer for references.


cross-debugging using VS2008?

Question: I have a function that is supposed to work the same when launched from some part of my program or from some other part, but it doesn't.
Is there a method of debugging to see the difference in the execution?
What I am doing right now is launch 2 instances of VS2008 and launch the debugger on 2 instances of  my program, and execute each function from different method. I have the same breakpoints so I can compare "step by step" what is different but this is very long and tedious...
Is there a better/automated way to do this? thanks
(this is unmanaged C++)
Comment: If you want to trace the execution of both programs from within the same debugger go to the "Debug" menu and select "attach to process"
Answer: The answer of this question should help you:
How to debug in visual studio 2008 express c# this senario There is a C# tag, but the same thing can be done in C++. Only the algorithm is explained with no code. That's my personal favourite algorithm for debugging.

cross-debugging using VS2008?


What is the definition of Taxiway Incursion?

Question: I can't find any ICAO document that defines a Taxiway Incursion, but I can find some online presentations which were presented at ICAO workshops or seminars that loosely refer to Runway/Taxiway Incursions!
Runway Incursion is well defined and there is no doubt about its meaning or significance, but the question is: is every wrong turn during taxiing considered a taxiway incursion? If so, according to what official definition?
ICAO Annual Safety Report Group
Answer: I haven't seen it explicitly defined, but the meaning can be inferred by comparison to the definition of a runway incursion. ICAO defines a runway incursion as "any occurrence at an aerodrome involving the incorrect presence of an aircraft, vehicle or person on the protected area of a surface designated for the landing and take off of aircraft." Thus a taxiway incursion would be "any occurrence at an aerodrome involving the incorrect presence of an aircraft, vehicle or person on a taxiway.
There doesn't need to be an official definition to use it in a presentation. If you say "Runway/Taxiway incursion," everyone who knows what a runway incursion is can pretty much guess what you mean by a taxiway incursion.
A wrong turn while taxiing is only a runway incursion if it takes you across the hold short line for a runway. Presumably it's a taxiway incursion if it takes you onto a taxiway that you are not supposed to be on.


Makes sense build a library for an entire feature?

Question: We have a small complete application where it will be used by another applications. It is composed by Routes, Services, Utils and etc. Was asked to transform this application into a component npm. Makes sense build a npm module of entire project to share it?  What alternatives could I suggest?
Comment: I think an NPM package makes sense. So long as it's more or less just a copy of the shared code. The only other thing I can think of is having a shared repository that all the different teams and devs can pull from. Regardless though, I'd keep an emphasis on them being able to dig into the guts of the 'library' because eventually somebody IS going to want to customize it or change it to suit their style and needs.
Answer: Strip out all the shared and commonly used functions and externalize them to be imported into the view.
If you are expected to do the same business logic over and over again, you can move it into the library as well, but I wouldn't advise just sticking the entire application inside an node module and installing that.
If you want to do it right, look up inversion of control and design your library to accept functions and parameters to make things as modular and generic as possible.
What you don't want to have happen is every time you want to add a feature to a view or change something, you have to rebuild and redeploy the module just to import it back, so try and design the library to the lowest common denominator.
The angular modules should have some level of portability, so you could find features that are complete enough and find a way to have some sort of configuration object to pass in.
Comment: I think it's generally inadvisable to have any business logic implemented in a library since it's subject to immense change more often than not. But that's a good point about rebuilding and redeploying, especially if there are a lot of applications that are dependant on it, the process for getting everyone up to date could be a pain (*points at tremendous tech debt in literally every piece of software*).


Are VISA gift cards untraceable?

Question: I was in a retail store today, and these people were discussing how easy it is for people to use stolen credit cards, and buy those visa gift cards without being traced after they purchase the gift cards.
I find this very hard to believe because
A) when you purchase a visa gift card they send the gift card number to the server to the company that owns those gift cards to have it activate it, and I am sure they log which store that happened at, too.
B) I am sure they can monitor that gift card and it will leave a paper trail just like a credit card.
Am I wrong?
Comment: Where I live, these "gift credit cards" can be purchased in grocery stores. As long as you pay with cash, I doubt it can be traced, like pre-paid sim card (if proper precaution is taken)
Comment: Gift cards are purchased online to make it harder to trace, then traded or sold at a discount to a 3rd party.
Comment: My debit card was used over the weekend to purchase several of these. I know for sure because I called the Walgreens stores where it was used and they could see exactly what the perp had bought. So, are these prepaid cards somehow linked to my debit card? If the person uses the prepaid card will the police be able to trace and link purchases made with that card back to my debit card to try to find this person?
Answer: A) Yes, they do keep track of purchases. Almost all prepaid gift cards require some form of registration where they collect different data about you: name, address, zip code, phone number, etc.
B) It will. The gift card becomes an account, and you can review your purchase history just like a regular credit card.
However, you can be a liar when you activate the card, and put in fake information. You can go to a store reasonably far away, or to a very busy store (my local pharmacy is always stuffed). You can also pay with cash, which means you don't have records from a credit card company to link your identity with. And, if you're smart with your purchases (don't attempt to order drugs to your house) they can't get any information from the merchant.
tl;dr: If you have cash, you avoid most of the tracking. If you lie to the company, it's very easy to dodge identification.
Comment: @ott-- Considering that the lions share of retailers do not take stock of the serial numbers on the bank notes as they arrive and depart, I imagine tying a serial # on bank note to an individual would be a monolithic task at best.
Comment: With cash this is true only for coins. Banknotes have an unique number (unless they're faked). Try Bitcoins, diamonds, gold nuggets.
Comment: @ott: all bitcoins transactions are recorded in a public ledger (the block chain), and it is fairly easy to trace. There are lots of caveats to use Bitcoin in an untraceable way, unless you take care of these caveats, it is usually easier to be untraceable with cash than with Bitcoin.
Comment: @DKNUCKLES When the store submits its cash earnings to the bank(daily, for any medium-size store), all serialnumbers are scanned.
Answer: A) Personally, I have purchased several VISA gift cards. While no registration is required to activate the card itself, if you wish to purchase items online, you may need to register a ZIP code. You could enter your local ZIP or even a ZIP from across the country, as long as it lines up with the billing information you give the online merchant (the one the transaction will go through provided there are funds).
B) Every transaction made with the card is tracked and reviewable through Go Wallet or vanilla VISA, but the paper trail is null because there is no name or contact information linked to the card.
The conversation you overheard could also be related to the purchasing of gift cards online with already stolen card data, in which case it would be much more difficult for law enforcement agencies to track the criminal.

Are VISA gift cards untraceable?


Is the so called kTC noise, that is inherent in an RC filter, dependent on bandwidth?

Question: An RC filter has intrinsic noise called the kTC noise which is given by the equation
$$
v_\text{noise} = \sqrt{\frac{kT}{C}}.
$$ Does this equation calculate a noise density with units of volts per root hertz? Or does this equation calculate an RMS noise voltage that is not bandwidth dependent?
Answer: The KTC noise is actually the total RMS noise power at the output of the low pass RC filter. The noise power is the product of the noise power spectral density (PSD) and the bandwidth (more accurately "effective bandwidth") of the system. So, actually the total noise power does depend on the bandwidth.
Interestingly, for the case of RC filter although the resistor is the only noise source present in the system, the total noise power is independent of the resistor value, as seen from the noise power expression,
$$v_n^2 = \frac{kT}{C}$$
This is because although increasing the resistor value increases its noise PSD (= 4kTR) but the effective bandwidth (\$\frac{1}{4RC}\$) goes down proportionally.
$$v_{n}^2 = 4kTR \cdot \frac{1}{4RC}$$
This can also be understood from the principles of thermodynamics. Since the origin of Johnson noise is due to random motions of electrons inside the resistor, the kinetic theory of gases is applicable for it. And the equipartition theorem says that in thermal equilibrium, energy is shared equally between each state of the system and the shared energy is given by \$E = \frac{1}{2}kT\$.
For the RC system, the only energy state is the energy stored in the capacitor which is given by:
$$E = \frac{1}{2}CV^2$$
Equating the two terms gives:
$$\frac{1}{2}CV^2 = \frac{1}{2}kT$$
$$\implies V^2 = \frac{kT}{C}$$
This is exactly the noise power derived from circuit equations but is derived much easily from laws of thermodynamics.
Answer: the ktC noise formula simply happens when you insert the noise bandwidth of an RC filter, B=1/(4RC), into the formula for voltage square over a resistor. The R cancels out.
So, no, there's correctly no bandwidth in that formula, because the bandwidth is "hidden" in the C.
The wikipedia article on Johnson-Nyquist Noise actually containst this explanation, and a lot more stuff that you might want to know about kTC noise, considering you seem to be coming at this from a non-intuitive, formularistic side. It's usually easier to understand what's happening than to have all the right formulas exactly right :)
Comment: Thanks Marcus for referring me to the wikipedia article. It does say that the units of Vnoise calculated in the equation given in my original question are Volts RMS. I mostly wanted to confirm that the units of the calculated Vnoise were NOT Volts per root hertz. I finally convinced myself that Vnoise is measured in Volts RMS when I calculated the equivalent noise BW of an example RC filter and plugged that ENBW into the thermal noise formula for the resistor and got the same result for Vnoise as when using the kTC noise equation given in my original question. Your answer was most helpful.
Answer: Ultimately it is because the noise (and signal) is counted in electrons, and the electrons jiggle about a bit (technical term) and their speed of jiggling depends on temperature. So the count of the number of electrons in the capacitor changes constantly.
The noise (rms) on the number counted is simply the square root of the number (same as a repeated random coin toss).
The magic value 'k' is the conversion factor. The bandwidth is in cycles (in & out) per second, and the Temperature gives the 'how far/how many' move in and out of the capacitance.
The square root part annoys every one because it doesn't follow the normal electrical rules. Rather its because electrons are quanta (quantum mechanics).
As explained by others the formulas can be swapped around to pretend that the resistors are noisy, while I find it easier to simply count the electrons in the capacitor. The answer is the same. The Physics is the same. Very useful to know if you do photonics.
Comment: +1 for counting electrons


Gender neutral word for house cleaner in french

Question: When I use the term "house cleaner" in a translator (deepl, google) it will translate house cleaner with "femme de ménage". I'm looking for a cleaner, be it male or female or otherwise, and I don't want to use such sexist language. What is the gender neutral way to say this?
Comment: https://www.renaud-bray.com/Livres_Produit.aspx?id=1502942 :)
Comment: Perhaps "agent d'entretien", but it refers more to office than home.
Answer: You can use the generic personne :

Je cherche une personne pour s'occuper du ménage chez moi.
Answer: I remember this being a point of discussion already during my first years in France, in the 1990s, and the consensus back then was that no term existed for men who did this job. Since then, however, femmes de ménage no longer work predominantly either as independent contractors or for small cleaning outfits, but are instead very often employed by large home services companies. From what I have seen, such businesses tend to use either or both of the following terms for their cleaning staff:

assistant(e) ménager(ère)
intervenant(e) à domicile

In other words, I haven't been able to find any single, neutral, term to refer to this profession. This is therefore one of those cases where the only realistic option is to use what is called écriture inclusive, namely to write the gender options out in formats such as étudiant·e or avocat(e).
Unfortunately, the first of the two terms above becomes more than a little awkward in écriture inclusive. The other one is more manageable, but also the one that is used less.
Comment: Although *assistant ménager*  exists, and  sometimes used by employment agencies, it seems to me that *aide ménager(ère)* is more common.
Comment: Thanks. It is not clear to me what "écriture inclusive" means here, perhaps you could expand on it?
Comment: Yes, will edit.
Comment: @Kvothe "écriture inclusive" would be worth its own question. There is too much about it to fit in comments.
Answer: You could use "agent d'entretien à domicile".
"Agent d'entretien" is the usual label for companies (for whom it isn't politically correct to use a sexist label, even if most of the population is still using it), and that use made it so that this gender-neutral term got progressively associated with "people who do cleaning for companies".
By adding "à domicile", you clarify that you are not a big corporation and just want someone to come at your home to do some cleaning.


Can entangled photons create entanglement in material particles?

Question: Is it possible that two entangled photons when absorbed by two material particles, say two atoms, lead to the entanglement of these atoms? Is there any published research on this topic?
Comment: For sure. For example, if the polarization states of the photons are entangled, the angular momenta of the atoms will become entangled, because the angular momentum delivered to each atom depends on that of the photon.
Comment: Exactly....Could you share some references?
Answer: Not quite what you are asking, but (van Enk 2005) is a nice short paper arguing that (certain) single-photon states ought to be considered entangled even if there is a single "particle" involved, based on precisely the fact that the correlation in single-photon states can be transferred into more "standard" entanglement between atoms or other systems. It's a thought experiment though, not really an implementation.
More on point, one example that comes to mind is one of the experimental demonstrations of loophole-free Bell inequality violation that were done a few years ago. E.g. (Hensen et al. 2015, arXiv:1508.05949) showed experimentally nonlocality from measurements of entangled spins. To entangle spatially separated spins, they first generate entangled photons in the usual way, to then send the photons to different "far" laboratories, and transfer their states (and thus their shared entanglement) into spin systems.
I'm sure one can find countless other examples of this sort of thing.
Comment: I took the question as regarding specifically entanglement transfer between photons' and atomic degrees of freedom. I agree that this probably happens in some form or another in any natural interaction of light with something else, but in the vast majority of the cases it's not controlled enough to be directly measurable, so I gave an example of a paper doing it explicitly. Regarding "heterogeneous entanglement", one should define what it means first. Talking about "entanglement with the observer" gets into interpretations territory though, so I wouldn't go there for this discussion


Mixin vs inheritance

Question: What is the difference between a mixin and inheritance?
Comment: https://csswizardry.com/2014/11/when-to-use-extend-when-to-use-a-mixin/
Answer: A mixin is typically used with multiple inheritance. So, in that sense, there's "no difference".
The detail is that a mixin is rarely useful as a standalone object.
For example, say you have a mixin named "ColorAndDimension", which adds a color property and width and height.
Now, you could add ColorAndDimension to a, say, Shape class, a Sprite class, a Car class, etc. And they will all have the same interface (say get/setColor, get/setHeight/Width, etc.)
So, in the generic case a mixin IS inheritance. But you can argue it's a matter of the role of the class in the overall domain as to whether a mixin is a "primary" class or simply a mixin.

Edit -- just to clarify.
Yes, a mixin can be considered, in today's modern lingo, an Interface with an associated Implementation. It really is just plain, old, everyday multiple inheritance using a plain, old, everyday class. It just happens to be a specific application of MI. Most languages don't give a mixin any special status; it's just a class that was designed to be "mixed in", rather than used standalone.
Answer:
What is the difference between a mixin and inheritance?

A mix-in is a base class you can inherit from to provide additional functionality. Pseudocode example:
class Mixin:
    def complex_method(self):
        return complex_functionality(self)

The name "mix-in" indicates it is intended to be mixed in with other code. As such, the inference is that you would not instantiate the mix-in class on its own. The following object has no data, and it makes no sense to instantiate it to call complex_method. (You may as well just define a function instead of a class in that case.)
>>> obj = Mixin()

Frequently the mix-in is used with other base classes.
Therefore mixins are a subset, or special case, of inheritance.
The advantages of using a mix-in over single inheritance are that you can write code for the functionality one time, and then use the same functionality in multiple different classes. The disadvantage is that you may need to look for that functionality in other places than where it is used, so it is good to mitigate that disadvantage by keeping it close by.
I have personally found a mix-in necessary to use over single inheritance where we are unittesting a lot of similar code, but the test-cases are instantiated based on their inheritance of a base case, and the only way to keep the code close at hand (and in the same module), without messing with coverage numbers, is to inherit from object, and have the child cases inherit from  both the universal test-case base and the custom base that only applies to them.
Mixins in Comparison and Contrast with Abstract Base Classes
Both are a form of parent class that is not intended to be instantiated.
A mixin provides functionality, but is unable to directly use it. A user is intended to use it through a (sub)class.
An abstract base class provides an interface, but without usable functionality. A user is intended to create the functionality called by the interface.
class Abstraction(metaclass=abc.ABCMeta):
    @abc.abstractmethod
    def complex_method(self):
        return complex_functionality(self)

Here you are prevented from instantiating this object because it requires a subclass to implement functionality with a concrete method (though you could access the functionality within from super()):
>>> obj = Abstraction()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Can't instantiate abstract class Abstraction with
abstract methods complex_method

In Python, some classes in the abc module are examples of parent classes that both provide functionality through inheritance and abstract interfaces that must be implemented by the subclass. These ideas are not mutually exclusive.
Summary
Put simply, a mix-in is just a base class you wouldn't instantiate on its own, and typically used as a secondary base class in multiple inheritance.
Answer: mix-in is a specific, restricted case of (multiple) inheritance used for implementation purposes; some languages (e.g. Ruby) support it without supporting generalized multiple inheritance.
Answer: Mixin is an abstract concept and anything that meets its requirement can be considered as a mixin.
Here is a definition from Wikipedia.
In object-oriented programming languages, a mixin is a class that contains methods for use by other classes without having to be the parent class of those other classes. How those other classes gain access to the mixin's methods depends on the language. Mixins are sometimes described as being "included" rather than "inherited".
In short, the key difference from an inheritance is that mix-ins does NOT need to have a "is-a" relationship like in inheritance.
From the implementation point of view, you can think it as an interface with implementations. For example, an abstract class in Java could be considered as a mixin if Java supported multiple inheritance.
Comment: Java implements mix-in by offering the default method in an interface. In this way, all class mix-in this functionality will is-a the implemented interface. Is this a little strange?
Comment: I'm having a hard time to understand the bold sentence. It sounds like "the difference (of B?) from A is that it (B?) does need something like in A". Are you talking about difference or similarity?
Comment: @RayLuo Whoops... I made some typo. Sorry to confuse you. Mix-ins does NOT need to have an "is-a" relationship
Answer: "A mixin is a fragment of a class in the sense that it is intended to be composed with other classes or mixins." -DDJ
A mixin is a class or code fragment which is not intended for stand-alone use, but instead you're supposed to use it inside of another class. Either composing it as a member field/variable or as a code segment. I have the most exposure to the later. It's a little better than copy-pasting boilerplate code.
Here's a great DDJ article that introduces the subject.
The Half-Life 2 / "Source" SDK is a great example of C++ mixins. In that environment macros define sizable blocks of code which can be added to give the class a specific "flavor" or feature.
Look at the Source wiki example: Authoring a Logical Entity. In the example code the DECLARE_CLASS macro can be considered a mixin. Source SDK uses mixins extensively to standardize the data-access code and ascribe behaviors to entities.
Answer: Mixins are vastly used in a more "plugin" like manner.
They are the same but in a different context each one of them. Usually when we talk about inheritance we are talking about SINGLE inheritance, and a mixin is a construct that allows MULTIPLE inheritance.
This is a language construct that is highly controversial in the OOP world because of:

The ambiguity that it must be resolved
A lot of the time "mixin" classes don't work on its own, and may conflict with other mixins
It can result in a "diamond inheritance problem", where two super classes can inherit from the same class

But that aside, is a powerful construct that's used in various languages and frameworks, some examples are:

Django

https://github.com/django/django/blob/98126cdfaf632abc8f0b5e65910e46a4eedc4641/django/views/generic/list.py#L194

https://docs.djangoproject.com/en/3.1/topics/class-based-views/mixins/

Typescript

https://www.typescriptlang.org/docs/handbook/mixins.html
https://vincit.github.io/objection.js/guide/plugins.html#_3rd-party-plugins
Answer: I think its important to note, that mixin doesn't imply inheritance.  According to wikipedia, a Mixin is:

In object-oriented programming languages, a mixin is a class that
  contains methods for use by other classes without having to be the
  parent class of those other classes. How those other classes gain
  access to the mixin's methods depends on the language. Mixins are
  sometimes described as being "included" rather than "inherited".

Specifically, in a language like perl, mixins can be added using the Exporter module:
package Mixins;

use Exporter qw(import);
our @EXPORT_OK = qw(pity);

# assumes it will be mixed-in to a class with a _who_do_i_pity method
sub pity {
    my ($self) = @_;
    printf("I pity %s\n", $self->_who_do_i_pity('da foo'));
}

Which can be mixed-in to any module containing one, or more, method(s) at a time:
package MrT

use Mixins qw(pity);

sub new {
    return bless({}, shift);
}

sub _who_do_i_pity {
    return 'da foo!'
}

Then in your MrT module can be used thusly:
use MrT;

MrT->new()->pity();

I know its an absurd example, but, it gets the point across...
Answer: With multiple inheritance, new class may be composed from multiple superclasses. You can call only methods defined in any of superclasses.
On the other hand, mixin is an abstract subclass that may be used to specialize the beavior of a variety of parent classes. Mixins may call a method (for example sayHello(): String) even though they do not define such a method.
mixin M {
    name: String
    defmethod greetings() { print sayHello() + " " + name}
}

As you see, you can call sayHello() even though it is not defined anywhere. If you add the mixin M to class C, the C should provide the sayHello() method.
Comment: not sure about the correctness of your first statement - classes can define their own methods
Answer: tl;dr
mixin and multiple inheritance have the same form. But have different semantics: mixin has the basic classes provide the function implementation. For inheritance, base classes provide interface and subclass has the implementation.
But anyway, composition is preferred over mixin IMO
Answer: A mixin is a class with methods(functionality) only and no attributes(data), while a parent class in inheritance has both attributes(data) and methods(functionality).
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).

Mixin vs inheritance


Connect to connected OpenVPN client from different subnet

Question: I have a machine running Xubuntu 17.04 that is connected as a client to a VPN via OpenVPN (2.3.11). When I have the client connected, I can access the machine remotely via SSH and VNC if I am on the same subnet (my LAN subnet, 192.168.1.0/24). I can not access it from my wireless subnet, 192.168.2.1/24. If I disconnect from OpenVPN I can connect from the wireless subnet. I do not have access to the server to make config changes as this is a paid VPN service. Is there a way to allow the incoming connection from multiple subnets while OpenVPN is running?
Answer: Specific steps to answer this question for my case:
Stop OpenVPN if running
sudo service openvpn stop

Create a script file. I'll use up-route.sh
sudo nano /etc/openvpn/up-route.sh

Add the following:
#!/bin/bash
route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.1.1

Edit your OpenVPN config file. In my case it is /etc/openvpn/vpn.conf
sudo nano /etc/openvon/vpn.conf

Add the following lines to the bottom:
script-security 2
up up-route.sh

Save and Exit. Start OpenVPN again:
sudo service openvpn start

Answer: There are a lot of missing information in you questions:
1) When you say "I can not access it from my wireless subnet", it sounds like you have access problems to connect to this OpenVPN client, on your local LAN, from your local WiFi network: In this case you might be having access troubles on the WiFi router.
2) If you want the WiFi network to connect through the OpenVPN connection, then you would need to
a) add the WiFi network to the network that is routed down the OpenVPN link, and also confirm the OpenVPN client have the needed route(s) to the WiFi Network, and that the WiFi router have the needed rules, routes and access settings to point the right network via the OpenVPN client.
Pictures on the setup and what needs to achieve would really help to answer your question correctly
Comment: I don't know how I could have made it more clear. I am not trying to connect through the host in question. Only trying to connect to it directly while it is connected to the VPN. Is isn't a router issue. It connects fine when it isn't connected. The issue only arises when the host in question is connected to the VPN.
Answer: OpenVPN and others, have a setting like "Sent all traffic through VPN" or "Default Gateway VPN"
This goal of this setting, is to (1) override the "actual" default gateway where you want to bypass local firewall filtering, and (2) for corporate type access where you have more than jsut the VPN "local" net behind the VPN.
This is the setting that you most probably want to have active, but this now interferes with your WiFi connectivity.
The way Around this:
Add a separate route to the wifi router on your host:
ip route add 192.168.1.0/24 via
IF the above fails, or you don't know the IPs:
give an output (while the VPN is connected) of:
ip route show
and  also when the VPN is NOT conencted:
traceroute -n <ip-of-device-on-wif>


Cold Temperature Glue

Question: The plastic piece that holds together the 2 ice crusher blades in my ice dispenser broke. Is there a glue that could withstand the freezer temperature I can use?
Comment: I would think that any CAA "super glue" should work.
Comment: are the metal blades for crushing ice pushing on the plastic? I first thought of JB weld metal filled  epoxy but a [2 part  non metal epoxy might work better](http://www.homedepot.com/p/Gorilla-7-8-fl-oz-General-Purpose-Epoxy-42001/100670610) I have had good luck with Gorilla brand glues.
Answer: I had to test this myself when 'gluing' an aluminum mounting plate to a stainless steel door. No 'glue' or epoxy that I tried worked under a repeated freeze / heat cycle test. What did work was RTV silicone rubber. Your chioce of colors. If the stress is too much for this application, 2-part epoxies designed for wide temperature range might work. Over-build the RTV or epoxy at the break so it will have a better grip. Give them 2 days to fully set before use I might add that if the torque at this location is very high (it did break there after all) and neither epoxy or RTV will hold then you may need to surf the web based on the make and model of freezer and try to order just the broken part.

Cold Temperature Glue


Probability of SHA1 collisions

Question: Given a set of 100 different strings of equal length, how can you quantify the probability that a SHA1 digest collision for the strings is unlikely... ?
Comment: @kevindtimm "a", "b", "c" are equal length but different strings
Comment: @anthony, why is that obvious? I don't know if that's true
Comment: doh, upon re-reading, it's perfectly clear.
Comment: This is relevant to this question: https://sites.google.com/site/itstheshappening/ At least one collision has been found.
Comment: clarify, how can you have 'different but equal length' strings?
Comment: I'm assuming the strings are at least 20 bytes long. Otherwise, obviously the chances would be higher of a collision. :)
Answer:

Are the 160 bit hash values generated
  by SHA-1 large enough to ensure the
  fingerprint of every block is unique?
  Assuming random hash values with a
  uniform distribution, a collection of
  n different data blocks and a hash
  function that generates b bits, the
  probability p that there will be one
  or more collisions is bounded by the
  number of pairs of blocks multiplied
  by the probability that a given pair
  will collide.

(source : http://bitcache.org/faq/hash-collision-probabilities)
Comment: In conclusion, the likelihood of a collision is in the order of 10^-45. That is very, *very* unlikely.
Comment: @Djarid It's important not to confound accidental hash collision and adversarial collision hunting. The former is the probability that the hash of two items will collide, and follows the formula above (although, as noted by Kamel, the distribution is not perfectly uniform and thus the probability is likely higher).  The latter is used to intentionally try to find collisions, and relies on discovering and exploiting weaknesses in the hash.  Cryptographic hashes attempt to be robust against such attacks, but often they are overkill for simpler hashing applications (not transmitting secrets).
Comment: But SHA-1 is not uniform distribution, it could be bigger than this upper bound. I doubt that this equation is not correct. AS least the EQUAL.
Comment: This answer doesn't take into account the chinese discovery in 2005 where they are able to produce collisions in 2^69 iterations rather than the 2^80 projected by brute force
https://www.schneier.com/blog/archives/2005/02/sha1_broken.html
Comment: that formula is accurate when 2^b >> n^2 (and when 2^b very big). I know it is the mayority (if not all) the cases for sha1... but for the record!
Answer: Well, the probability of a collision would be:
1 - ((2^160 - 1) / 2^160) * ((2^160 - 2) / 2^160) * ... * ((2^160 - 99) / 2^160)
Think of the probability of a collision of 2 items in a space of 10. The first item is unique with probability 100%. The second is unique with probability 9/10. So the probability of both being unique is 100% * 90%, and the probability of a collision is:
1 - (100% * 90%), or 1 - ((10 - 0) / 10) * ((10 - 1) / 10), or 1 - ((10 - 1) / 10)
It's pretty unlikely. You'd have to have many more strings for it to be a remote possibility.
Take a look at the table on this page on Wikipedia; just interpolate between the rows for 128 bits and 256 bits.
Answer: That's Birthday Problem - the article provides nice approximations that make it quite easy to estimate the probability. Actual probability will be very very very low - see this question for an example.

Probability of SHA1 collisions


ECL connector(Widen DAM system) on Sites9.6 not working on new UI(Experience space), but working on classic UI

Question: We have upgraded Sites from 9.1 to 9.6 and the Widen ECL add-on is working fine on classic UI. That means we are able to access the folders, images etc. But when we switch to new UI, the parent level folder(Widen folder) opens, but next-level folders wont open and throw some errors on the cme. Can somebody help to make it work on experience space as well?
I have attached the errors snapshot displayed on cme.
Answer: In general, you want to obtain more information (e.g. Stack Trace) from the ECL log file, but in this particular case, it seems the error message presented to the end user is already quite explicit: the ECL Provider (Widen ECL V2 Provider) returned null for a GetItem request for a given Widen ECL Folder.
ECL Providers (or Connectors) should never return null when ECL wants to get an item which they put in some list themselves. However, in releases before Sites 9.6 you may get quite far without noticing this bug in the ECL Provider.
Sites 9.6 does retrieve ECL Folders (in order to build full paths) from the ECL Providers and therefore, you will quickly get such error if the ECL Provider return null for its own ECL Folders.
See also Custom ECL Provider GetItem method behaving differently in 9.6 environment
Comment: Just wondering to ask this - the same widen is working totally fine on 9.6 classic UI, but fails to load the folders when switched to experience space. Is this still expected?
Comment: Yes, that is expected. The new CM/ECL integration is mostly used for the Core Service REST integration (used by Experience Space).


Entity Framework Core 2.x default value

Question: In the official documentation I can see to set the default value on a property of my model it is only by Fluent API (no data annotation).
modelBuilder.Entity<Blog>()
            .Property(b => b.Rating)
            .HasDefaultValue(3);

In the other hands I saw in a video tutorial the author set the default value in the same property:
public int Rating { get; set; } = 3;

I tested both with same result. It's correct to use the second approach?
What is better?
Thanks in advance
Answer: When you use HasDefaultValue API, you are configuring your database to generate value when none is provided during INSERT statement. This will generate the value, regardless of you use EF or raw SQL or directly write insert statement in SSMS.
When you set default value in CLR type, your database won't be configured. So instead of server generating values, you are essentially generating values on client. When you initialize new Blog without setting rating, it will have value of 3 which EF will save to database unless set otherwise. This client side generation means that you need to have Rating column in your insert statement and provide a value from client when inserting the record.
What is better?
It entirely depend on use case and the value generation. If you are not inserting data outside of EF then it would only change internal processing of insert in EF. Server-side generation mean EF will skip the column in insert but read back value from server after saved. Client-side generation mean that EF will send the column in insert statement. Also the value of 3 is not complex enough to differentiate the usefulness. If you want to generate values which only server can determine, e.g. CreationTime or some server function over other columns or rows, then you cannot write client equivalent.
At the end, if you have both options available, its upto you how you want to configure your database. You can pick any, it wouldn't make huge difference while using with EF Core.
Answer: These are totally unrelated. The first is the default column value that will be used when you create a new record in a table and don't explicitly assign a value to that column. The second is the default value of the class' property.

Entity Framework Core 2.x default value


Field settings are not being exported with Features

Question: I have a product content type that has a product reference field. Under the Product types that can be referenced section there is a list of product types that can be referenced. I have selected one of these.
When exporting/importing this content type, the field settings (eg. the selected referenced product) are not exported. How could i export this without selecting the referenced product manually.
Comment: I don't understand properly your entire problem but if the setting could not be exported by Features module, you can try to install Strongarm that allows you to export with the rest of the Feature all the settings saved in DB in code.
Comment: I have installed Strongarm but that doesn't help my problem. The settings are not being exported.
Comment: You don't find this setting in Strongarm section when you update your Features? Neither in your content-type's?
Answer: The setting got exported but could not be set, because it was referencing an nonexistent product type.
On the old site i had a Recurring Product type w. a "recurring_product" machine name. I wanted to export the display for this. On the new site only a "recurring" product type existed and therefore could not match the setting.


Software that monitor and summarize power consumption of the computer

Question: I'm looking for software that monitor power consumption of the computer (desktop). I can't find with features like summarize power consumption in watt in an hour/day/week/month. By the way, I'm running Windows 8.1, every recommendation will be appreciated!
Comment: If you want the power consumption from the computer as a whole (and not its separet parts), I suggest you use one of these devices that you plug in between the power socket and the device you want to measure. That will give you the most reliable measurement over the measuring period you want.
Comment: The computer is not able to monitor is own power consumption! Not unless you connect it to various meters which has a computer interface.  In other words you need hardware, not software, to measure power consumption
Comment: I would recommend something like the kasa kp115, because the accuracy of any software version in questionable without testing.
Answer: One may use LocalCooling (gratis, non-portable)  (mirror) to view the current power consumption:

Note that it doesn't see some Nvidia GPUs (e.g., it doesn't see my 3080 RTX attached to my MSI GS76 laptop running Win10).
Also, I don't know whether they log the consumption over the day/week/etc. and how accurate it is.
To view the Nvidia GPUs power consumption, one may use HWInfo (gratis, portable)  (mirror):

HWInfo also gives the CPU power consumption:


Add two expressions to create a predicate in Entity Framework Core 3 does not work

Question: I am trying to build an "And" predicate method using C# with Entity Framework Core 3 in a .NET Core application.
The function adds two expressions to each other and passes it to an IQueryable code:
public Expression<Func<T, bool>> AndExpression<T>
                    (Expression<Func<T, bool>> left, Expression<Func<T, bool>> right)
{
      var andExpression = Expression.AndAlso(
           left.Body, Expression.Invoke(right,
           left.Parameters.Single()));

      return Expression.Lambda<Func<T, bool>>(andExpression, left.Parameters);
}

The call for of the function
Expression<Func<Entity, bool>> left = t => t.Id == "id1";
Expression<Func<Entity, bool>> right = t => t.Id == "id2";
var exp = AndExpression(left, right);
this.dbContext.Set<Entity>().source.Where(exp).ToList();

My code works fine in version EF Core 2, but after I updated the version to version 3 it throws the following exception

The LINQ expression 'Where(
          source: DbSet,
          predicate: (s) => (t => t.Id == "id1") && Invoke(t => t.Id == "id2")
      )' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by
  inserting a call to either AsEnumerable(), AsAsyncEnumerable(),
  ToList(), or ToListAsync().

I cannot translate the query to Enumerable due to memory issues.
I understand the problem but I don't know if there is a way to avoid it.
If anyone has a tip for me, I would appreciate that. Thanks a lot!
Answer: You need to unwrap the bodies of your lambdas, rather than using Expression.Invoke. You'll also have to rewrite at least one of the lambdas, so they both use the same parameters.
We'll use an ExpressionVisitor to replace right's parameter with the corresponding parameter from left. Then we'll construct the AndExpression using left's body and the rewritten body from right, and finally create a new lambda.
public class ParameterReplaceVisitor : ExpressionVisitor
{
    public ParameterExpression Target { get; set; }
    public ParameterExpression Replacement { get; set; }

    protected override Expression VisitParameter(ParameterExpression node)
    {
        return node == Target ? Replacement : base.VisitParameter(node);
    }
}

public static Expression<Func<T, bool>> AndExpression<T>(
    Expression<Func<T, bool>> left, Expression<Func<T, bool>> right)
{
    var visitor = new ParameterReplaceVisitor()
    {
        Target = right.Parameters[0],
        Replacement = left.Parameters[0],
    };

    var rewrittenRight = visitor.Visit(right.Body);
    var andExpression = Expression.AndAlso(left.Body, rewrittenRight);
    return Expression.Lambda<Func<T, bool>>(andExpression, left.Parameters);
}

This results in a lambda with the following DebugView:
.Lambda #Lambda1<System.Func`2[System.String,System.Boolean]>(Entity $t) {
    $t.Id == "id1" && $t.Id == "id2"
}

Whereas your code results in a lambda with the following DebugView:
.Lambda #Lambda1<System.Func`2[System.String,System.Boolean]>(System.String $t) {
    $t == "id1" && .Invoke (.Lambda #Lambda2<System.Func`2[System.String,System.Boolean]>)($t)
}

.Lambda #Lambda2<System.Func`2[System.String,System.Boolean]>(System.String $t) {
    $t == "id2"
}

See how yours is calling a lambda from within a lambda (something that EF can't handle), whereas mine just has a single lambda.
Comment: Canton7, your solution has solved my problem. It would've been a challenge to solve this myself. Many hours saved. Tnx!
Comment: ReplacingExpressionVisitor class from Microsoft.EntityFrameworkCore.Query can be useful here. https://learn.microsoft.com/en-us/dotnet/api/microsoft.entityframeworkcore.query.replacingexpressionvisitor?view=efcore-3.1
Comment: Nice! So, the problem was with the invoke method as it is not being correctly translated. It worked! Thanks a lot
Comment: The expression debug view can be misleading. I'm using a programmatically-built expression using parameter name 'x' and then I'm passing in a hard-coded expression, which also uses 'x'. I 'AndAlso' them. The debug view then shows "someList.Contains($x.PublicPackageID)
&& !$x.Expired". Same parameter names. Seemingly correct. However, the EF "can't translate" exception then reads "d => List> { 1, 2, 3 }.Contains(d.PublicPackageID) && !(x.Expired))". Different parameter names. Obviously incorrect. I'll see if your proposed solution can't help me solve my problem.
Comment: To make matters worse, if I replace my hardcoded lambda expression's 'x' param with a 'd' param, then the query shows *seemingly* correct in both debug view as well as the generated EF exception, in the sense that they both use a single param name consistently. Had EF coincidentally chosen the same param name as I had, or vice versa, then I might've been looking for days to even find the cause of this problem.
Answer: The issue here is that your query didn't work, or at least not how you intended in EF Core 2 either - In EF3 it will throw an exception for things like this due to a behavioural change, within EF Core 2 this would have silently pulled into memory and done the operation there, so in essence your query would have always been pulling the data into memory and performing the operation there. However now its telling you that it would do that and wanting you to explicitly set it to, or modify your expression to something that it can translate into a sql statement correctly.
This is actually a pretty good example case of why the team did this, seemingly you were unaware that this was previously pulling all of the data into memory and performing the operation there - now that you are aware you can work on a fix to get it performing the operation on the sql server
For more info feel free to read up Here
A modification to your code to be somewhere along the lines of
public static Expression<Func<T, bool>> AndExpression
                    (this Expression<Func<T, bool>> left, Expression<Func<T, bool>> right)
{
      var invoked = var invokedExpr = Expression.Invoke (right, left.Parameters.Cast<Expression> ());
      return Expression.Lambda<Func<T, bool>>
      (Expression.AndAlso (left.Body, invoked), left.Parameters);
}

working from memory so code above may not be perfect - at work so I cant fully test
Answer: I took canton7's solution and made it into an extension that checks for null values:
    private static Expression<Func<T, bool>> _AndExpression<T>(Expression<Func<T, bool>> left, Expression<Func<T, bool>> right)
    {
        ParameterReplaceVisitor visitor = new ParameterReplaceVisitor()
        {
            Target      = right.Parameters[0],
            Replacement = left.Parameters[0],
        };

        Expression rewrittenRight = visitor.Visit(right.Body);
        Expression andExpression  = Expression.AndAlso(left.Body, rewrittenRight);
        return Expression.Lambda<Func<T, bool>>(andExpression, left.Parameters);
    }

    public static Expression<Func<T, bool>> AndExpression<T>(this Expression<Func<T, bool>> left, Expression<Func<T, bool>> right)
    {
        bool leftNotNull  = (left != null);
        bool rightNotNull = (right != null);

        return (leftNotNull && rightNotNull)
            ? _AndExpression(left, right)
            : left;
    }

Usage:
expression1 = expression1.AndExpression<T>(expression2);


Eigenvalues of Laplacian

Question: What's the most natural way to establish the asymptotics of $\Delta$  on a compact Riemannian manifold $M$ of dimension $N$? The asymptotics should be
$$ \#\{v < A^2\} = \mathrm{const}\ast\mathrm{vol}(M)\ast A^n + o(\mathrm{something}) $$
(Perhaps one could consider first the case of a Kähler manifold? The Laplacian is particularly simple there.)
Comment: FYI, the most covariant "Laplacian" when the metric is not constant is the Laplace-Beltrami operator |g|^{-1/2} \partial_i |g|^{1/2} g^{ij} \partial_j (see http://en.wikipedia.org/wiki/Laplace%E2%80%93Beltrami_operator).  I think that this agrees with yours, which depends on your choice of coordinates (but is the one I actually use) up to a first-order differential operator, and so the asymptotics should agree on compact manifolds.  Oh, also, I don't think you should have a wedge?  g^{ij} is symmetric in i,j, whereas \partial_i \wedge \partial_j looks antisymmetric?
Comment: Ah, yes, it looks like the one I wrote in many, but not all, metrics. And I've written a corresponding symplectic form. My bad.
Answer: The most natural way is to study the short-time asymptotics of the heat or wave kernel on M.  For example, you can use the heat kernel $p_t(x,y) = \sum_i e^{-\lambda_i t} f_i(x) \overline{f_i(y)}$ where $f_i$ are the eigenfunctions with eigenvalues $\lambda_i$.  This is a fundamental solution to the heat equation.
When $t$ is small then you can construct a good approximation to $p_t$ near any particular $x$ by hand, using Fourier analysis in local co-ordinates.  The end result is that that $p_t(x,x) \approx C t^{-n/2}$.  Now integrate this estimate $dx$, noting that $\int_M p_t(x,x)dx$ basically counts eigenvalues with $\lambda_i \leq 1/t$.
Comment: For this proof a good reference (which is somewhat more general) is Chapter 2 of Heat Kernels and Dirac Operators by Berline, Getzler and Verne. See thm 2.41, which is a consequence of the asympotics of the heat kernel, thm. 2.30.
Answer: Wener Müler - Weyl laws...
http://www.math.uni-bonn.de/people/mueller/papers/weyllaw.pdf
has a pretty good introduction.
Edit: I see now that only the second section addresses you specific question and not the intro:(

Eigenvalues of Laplacian


pending payment

Question: Three days ago I sent a payment via my MultiBit wallet but it is still marked as unconfirmed, only 4 confirmations. How long it will take this transaction to become fully confirmed? Thanks.
Comment: It appears from your comment below that your tx was seen by 4 peers. Just to clarify the proper terminology, it has received 0 confirmations, not 4. You only say 4 confirmations if your tx has been included in a block already and three more blocks have been mined.
Comment: Exactly. "Seen by four peers" != "four confirmations."
Comment: MultiBit wallet says: "seen by four peers, not yet confirmed"
Answer: Bitcoin transactions are almost instant. Average confirmation time is around 8 minutes, but first confirmation may take an hour and eight confirmations even more. Thing is there is no such thing as fully confirmed transaction. The receiver of bitcoin transaction may decide not accept the transaction before certain amount of confirmations are done to prevent double spending. Bigger transaction fee will increase the transaction confirmation priority, so if you did not pay any transaction fee the confirmations may take quite a while.
Comment: Thanks for the answer. There is no way the receiver to accept/decline the transaction because it is still pending. I paid the fee myself. Here is what the MultiBit says: d94f529838c4d38e30b6b80f97acc9140ab4fcef883b36124d78099ef85d237d: Seen by 4 peers. Pending/unconfirmed. It is very strange for me that i paid too high fee - 0.01BTC
Comment: Will it help if I reset the blockchain/transactions?
Answer: Just reset blockchain in the multibit menu. If it doesn't help, you can export private key from the address the tx has been made from, import it on blockchain.info and doublespend it to your own address.

pending payment


singular and collective noun for included computer source code

Question: In software development, one often has multiple individual files that are referenced or "included" by others. What is the noun for each one of those individual files, and what would you call the collection of them?
Comment: This question appears to be off-topic because it is about computing/programming terminology - not about the English language.
Comment: I call them includes - one include, all includes
Comment: What do you mean by *included by each other*? Are these separate files that are called upon by a master file? Do each of the files somehow reference or access every other file? Is there some other relationship?
Comment: I vote on-topic since this is specifically a discussion which pops up occasionally when talking about code with non-technical testers or associated staff, like the boss. I'm a coder and systems designer
Answer: For simplicity's sake

The program's source is a collection of source files

This is suitable for all programming languages in all use-cases, whereas dependencies or includes are generally applicable to only a single language or language-group, or to specify the purpose of files, without enough data to be able to specify which is intended.
Source files are not dependencies unless the program specifically depends upon that source code to function, and are not includes unless they are actually included in the program; in which case it wouldn't necessarily cover manifests, remote loaded source (like jQuery for example) or resource assets.
Comment: This does of course raise the question of where a program's source was sourced, though this is resolved by the context of the statement/question: "I sourced the software" is clear that you didn't necessarily obtain the source code, and "I sourced the source" would suggest you purchased or provisioned the source from a software developer/agency.
Answer: This may not be in a dictionary anywhere yet, but programmers call them 'includes'.
Eg:

I have written an include for the application controller.
The main file has twenty includes.

If you are looking for a collective noun, it probably depends on context, but a 'set' or a 'collection' would be words that would usually make sense.

A set of ten includes are required for the application to work.
Answer:
What is the noun for each one of those individual files, and what would you call the collection of them?

The name of "files that play the role of being included elsewhere" might be called dependencies (single or collective) (or header files, if your programming language uses those).  Yes, dependencies can be other things as well, but usually you don't need to distinguish.  If so, you can say "source code dependencies."
The name of the declaration that declares the dependency might best be called an 'include', but to use it for the files thereby included bears the potential for confusion.
Answer: Source Code is a mass/collective noun.  The file inclusions are objects or any number of names depending on the terminology for the programming language you are using.
For example C Source Code can include applets and classes.
This is not really an English language question as you will most likely describe what you are referring to when talking with another programmer.
Comment: True, but applets and classes are not necessarily in separate files (albeit they usually are). I interpreted the OP as referring to the more specific matter of one source code file that is loaded into another file via something like an include function.
Comment: Yeah, that makes sense, but my point is you are using terms like set or collection which imply a mass of individual objects.  So apart from naming the individual "includes" I do not feel this question can be objectively answered unless a congress of computer programmers decides to create a word for a collection of include function objects.
Answer: Library is one option. Remember .lib files?
The library consists of individual modules.

In computer science, a library is a collection of implementations of behavior, written in terms of a language, that has a well-defined interface by which the behavior is invoked.[clarification needed] In addition, the behavior is provided for reuse by multiple independent programs. A program invokes the library-provided behavior via a mechanism of the language. For example, in a simple imperative language such as C, the behavior in a library is invoked by using C's normal function-call. What distinguishes the call as being to a library, versus being to another function in the same program, is the way that the code is organized in the system.
Library code is organized in such a way that it can be used by multiple programs that have no connection to each other, while code that is part of a program is organized to only be used within that one program.


If miners pay income tax, could a change in tax laws affect network security?

Question: Assuming that more than half of the Bitcoin miners pay taxes on revenue gained, could a increase in income tax laws (or similar) cause those ethical miners to go out of business? ... and the Bitcoin network to be more vulnerable to attack?
Comment: @StephenGornick: OP's point was that some miners would have to quit, thus the overall hashrate will be lower.
Comment: Bitcoin mining doesn't need miners who comply regulations.  The hashes from a Bitcoin miner that does not report any income are no different from the hashes produced by a Bitcoin miner that is fully compliant.
Answer: Taxes are paid on profits, not revenues. If their mining operation was profitable before, it will remain so even after the tax increase. Also, depending on the kind of tax it could increase equally to any alternative occupation they might have, so there would be no reason it should make any miner operation go out of business; definitely not enough to warrant concerns about the network security.
Comment: Taxes aren't only paid on profits. For example, in NZ, Goods and Services Tax adds 15% to the cost of computer equipment. Tax paid in that way can only be recovered if GST is collected on sale of goods or services through the same business. With mining, it's likely that little or no GST would be collected.
Comment: @HighlyIrregular: Is that anything like a VAT? I know that in Israel, you pay 17% VAT on everything, but you can cancel the VAT you paid against the VAT you need to collect for revenues, so in the end you still effectively only pay it for profits.
Comment: Yes, it sounds essentially the same. My understanding is that, depending on the tax law, in some cases it's still possible to make a loss and have a substantial tax bill. I can't see it being bad enough to affect network security though.
Answer: Bitcoin mining flows the path of least resistance.
So if taxes on mining proceeds are high in one area, mining operators that are fully compliant with the tax laws (reporting as income all of their profits -- a big if), then those miners may not be able to compete against a mining operator that isn't burdened with the high taxes or those who don't report the income.
Thus mining capacity will always grow to the level afforded by the block reward subsidy plus the transaction fees.  If that capacity is forced to leave one jurisdiction it will pop up in another, less-restrictive jurisdiction.
Even if the mining pools were to start reporting mining income to the state, there are options such as solo mining, or P2Pool which generate mining revenues directly to the miner.
So even in highly taxed jurisdictions it is unlikely tax laws targeting bitcoin mining revenues would have much of an effect.
Comment: Taxes are paid on profits, not revenues. If a miner can compete (that is, turn a profit) without taxes, he can compete with taxes - he'll just have less net income to spend on consumer goods. It's not like, say, power costs which could take someone from the black to the red. To a 1st order approximation, anyway - there could be tactical considerations relating to the specific tax structure.


What's the difference between GLSL and c?

Question: I have three questions here:

Is the Qt/3D API implemented by GLSL code?
Is GLSL code compiled and linked as normal c/c++ code, and can it run on CPU (not GPU)?
Why GLSL is better at rendering than normal c/c++?
Answer: You seem to have a fundamental misunderstanding of what GLSL is. It's not a programming language for graphics. It is a shader language.
In the OpenGL rendering pipeline, there are certain stages in the rendering of an object that are designed to be implemented by a program. These stages are called "shader stages". A shader is a program, written in GLSL (for OpenGL at least) which is executed at one of these shader stages.
GLSL is used as part of the process of rendering. GLSL defines how things get rendered, not what gets rendered.
Therefore:

Is the Qt/3D API implemented by GLSL code?

Not in the way you mean. Some of the rendering pipeline for the drawing functions may be. But it may not. It's not really relevant to you, since you're using it from the outside.

Is GLSL code compiled and linked as normal c/c++ code, and can it run on CPU (not GPU)?

No, per above. Shaders affect rendering, and rendering takes place on the GPU. GLSL is the shading language for OpenGL, therefore GLSL code is executed on the GPU.

Why GLSL is better at rendering than normal c/c++?

It's not better or worse; you cannot use one for the other. You cannot just throw random C-code at a GPU as part of the rendering pipeline. And you cannot compile GLSL for CPUs.
GLSL is what we call a domain specific language. It is a language designed to facilitate a particular purpose. It has language constructs that most languages simply don't have. It knows what a "texture" is. It has the concept of values which are invariant across multiple executions of a shader within a single rendering call (uniforms). It has many other concepts that are unique to the problem of hardware-based shaders and rendering.
Not only can you not throw C or C++ at a GPU, you wouldn't want to. Not for shaders.
Comment: As far as the OpenGL spec is concerned, there is no mention of any `emulation mode`, but that's because it's an API spec; similarly, the spec doesn't mention GPUs and certainly doesn't mandate that `rendering takes place on the GPU` as you claim. That said, various drivers (MesaGL included as you point out) provide a software-only implementation which runs solely on the CPU. Indeed, the **Introduction** on MesaGL's home page explicitly mentions that Mesa can `be used in many different environments ranging from SOFTWARE EMULATION to complete hardware acceleration for modern GPUs.`
Comment: @SchighSchagh: There is no "emulation mode" in OpenGL. The best you'll get is running MesaGL.
Comment: `Is GLSL code compiled and linked as normal c/c++ code, and can it run on CPU (not GPU)?`

`No, per above. Shaders affect rendering, and rendering takes place on the GPU. GLSL is the shading language for OpenGL, therefore GLSL code is executed on the GPU.`

This is not, strictly speaking, quite true. If you are running OpenGL in [emulation mode](http://stackoverflow.com/questions/7364871/how-to-start-opengl-in-software-emulation-mode), everything will be done on the CPU.
Answer:
Does the Qt/3D API is implemented by GLSL code?

Not really. It may use some internally, but that's all hidden from the user. The API itself is C++.
OpenGL's API is in C, although it (drivers) uses assembly internally.

Does the GLSL code compiled and linked as normal c/c++ code

No, of course not. It's compiled by the video card driver and ran on the GPU. It's a fairly limited language, not much use other than shaders.

Why GLSL is more gift at painting than normal c/c++ ?

It contains features that the GPU is good at, while lacking features it is bad at.


Correlation Coefficient vs Coefficient of Determination

Question: I am doing regression analysis on two stocks. The correlation coefficient is -0.7190 and the coefficient of determination is 0.5170. I am confused on how to interpret this. Is this correct...when stock A goes up 1%, 50% of the time stock B will go down 0.72%?
Comment: not directly related to the question so a mere remark; beware, from a practitioner point of view, using Pearson correlation is usually not a good idea to measure association between two stocks
Answer: The usual way of interpreting the coefficient of determination $R^{2}$ is as the percentage of the variation of the dependent variable $y$ $(Var(y))$ that one is able to explain with the explanatory variables. You can find the exact interpretation and derivation of the coefficient of determination $R^{2}$ on this Economic Theory Blog website.
However, a less known interpretation of the coefficient of determination $R^{2}$ is to interpret it as the Squared Pearson Correlation Coefficient between the observed values $y_{i}$ and the fitted values $\hat{y}_{i}$. You can find the proof that the coefficient of determination is the equivalent of the Squared Pearson Correlation Coefficient between the observed values $y_{i}$ and the fitted values $\hat{y}_{i}$ on this Economic Theory Blog website.
Comment: This is helpful but dependent on an external site. If that blog site were to disappear, the answer would lose much of its value. I don't know about "less known". I'd regard it as standard to explain up front that they are one and the same in plain regression. Many people are taught regression after correlation, so emphasis on the link is then natural. (Whether that's a good thing can be set on one side.)
Comment: +1: It's worth mentioning that $R$ is referred as the multiple correlation coefficient.
Answer: If you do a regression $y=\beta_1 x + \beta_2$ (so with one independent variable), then the squared of the correlation coefficient is equal to the coefficient of determination.  So (-0.7190)^2 is around 0.5170 (rounding errors).
The coeffcient of determination tells you that 51.7% of the variance in the dependent variable $y$ is explained by the regression.
if $x$ goes up by one unit, then $y$ goes up by $\beta_1$ units. $\beta_1$ can be estimated using ordinary least squares and can be found in the output of R function
summary(lm(y~x))

So e.g.
reg <- lm(mpg ~ hp, data = mtcars)
summary (reg)

yields
Call:
lm(formula = mpg ~ hp, data = mtcars)

Residuals:
    Min      1Q  Median      3Q     Max
-5.7121 -2.1122 -0.8854  1.5819  8.2360

Coefficients:
            Estimate Std. Error t value Pr(>|t|)
(Intercept) 30.09886    1.63392  18.421  < 2e-16 ***
hp          -0.06823    0.01012  -6.742 1.79e-07 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 3.863 on 30 degrees of freedom
Multiple R-squared:  0.6024,    Adjusted R-squared:  0.5892
F-statistic: 45.46 on 1 and 30 DF,  p-value: 1.788e-07

So if $hp$ increases by one unit, then $mpg$ decreases (decrease because negative sign) by 0.06823.
The coefficient of determination is $R^2=0.6024$ and (there is only one independent variable) the correlation is -0.776 (square root of 0.6024 and the sign is negative because the coefficient of hp is negative (-0.06823) ).
Comment: The psychology of this terminology is interesting--I frequently make the same mistake.  I have taken to using the term "response variable" instead of "dependent variable" in order to avoid confusing myself and others by the similarity of "dependent" and "independent" (although I worry about implying a causal relationship). I also like "explanatory" instead of "independent," but a client recently objected to that terminology (even in the form "potential explanatory variable") because the coefficients were insignificant--and so the variables were considered not "explanatory"!
Comment: +1. I suspect you meant to write "one *independent* variable" every place that "one *dependent* variable" appears.
Comment: Further objections to "dependent" and "Independent" are that the terms are overloaded and in any case are so close that beginning students (and indeed others) can easily get confused between them. Since 2015 when @whuber wrote I think "response" has held up well as good terminology in several fields, but is also being challenged by "outcome".  Either term seems excellent to me.
Comment: @whuber: you are right, it must be 'independent variable' of course, I changed it in the text and give (+1) for correcting the error
Comment: @Nick Many times after initially writing "outcome" I withdraw that term in favor of "response" out of concern it could (validly) be considered to be the entire vector of observed values in any observational setting.  In effect, "outcome" does not adequately distinguish the explanatory from the response variables.
Comment: There is no contradiction here. You prefer to avoid the term but it's still very popular. I hate, for example, DV and IV as abbreviations and would never, ever use them (except like this) but that's had no detectable effect on their use by others, nor would I expect to have any leverage there. I've had tiny success in persuading people in my circles to avoid "dummy variable", which is all too likely to be misinterpreted.