I want to wire my outdoor solar motion light to my indoor led string light, (ie: inside an RV)

Question: I've seen this done however I'm not sure how to accomplish this without a little help. I would like to find a way to wire my outdoor solar motion sensor light to my indoor led light string. Ideally I was trying to figure out how to make it where on either side of my RV would be a motion light and two separate light strings inside my RV,so theoretically when activated,on whichever side the movement is on, the one set of lights would turn on as well, therefore letting me know inside as well when there is something outside. I have 1 everbrite (solar outdoor) and 1 dimirus (outdoor solar), and plenty of led light strings.
Comment: What does your size or sex have to do with anything?
Comment: You will need to supply model and/or photos of the connections on the motion sensor and details on the led string.
Answer: Your idea might work, or might not, if the PIR motion sensor light can't supply enough current for the light string.
However, you can buy 12 volt PIR motion sensors for ~US$5 or more apiece, such as some of these from Amazon. The sensors are designed to make connection simple, rather than trying to cut open an existing light with a PIR sensor and rewiring it.
BTW, if you want to put the sensors in parallel, so that both front and back sensors trigger one string of lights, put a diode in series with each sensor to prevent feeding current from one to another.
Also, consider the standby current drain of each sensor, so you don't kill the RV battery, when it's not being charged.
Comment: I can't imagine that a PIR is going to draw enough current to drain an RV battery over night or even over a week. I have multiple battery-powered PIR sensors around my house and they claim 2+ years of battery life on a CR2032(?) battery. I'm at ~1 year so far on some of them and they're still reporting > 50% battery life. TBF, that _is_ something to think about, but I can't imagine it being a _huge_ issue...
Comment: @FreeMan, agreed, mot PIR sensors have low standby power. However, the devices in the reference did *not* have detailed specs, and it might be a good idea to check... and the total drain when all are on, as well.
Comment: Good points. Not an RV expert, by far, but I think most of them have some sort of battery monitoring and standby generation. If not, they certainly should!


AC Adapter Input vs Output Power?

Question: I have a laptop AC Adapter thats rated for 19.5v/3.34A DC output for a total of 65W. The input is rated at 100-240V/1.5A AC. My question is what is limiting the output to 65W? It seems like the input can support up to 100*1.5=150W minimum. I"m assuming you lose some in the AC to DC conversion, but 65W would be more than 50% loss. So, is the adapter able to support more than 65W or is there something here I'm missing?
Comment: The input is worst-case scenario.  1.5A may be inrush current or peak draw for the 2 milliseconds it takes for the output side to catch fire and shut down.
Answer: I do power supply design for a living. When I specify that this circuit is rated for 19.5v/3.34A 65W, there could be so many reasons for this. Few arbitrary examples include:
<code>-Transformer saturates at 70 VoltAmps (VA)
-The transistors I am using start breaking down after 21V and/or 4 Amps
-My linear voltage regulators start sinking too much heat due to high voltage differentials
-Capacitors start having huge ripple currents that they cannot handle (ESR losses)
-I am unable to meet compliance in powerfactor/emissions at higher power ratings
</code>
any many more possible things...
EDIT:
As for the 1.5Amps input current, this is the maximum instantaneous current the adapter will pull from the input. It is NOT an RMS value.
Comment: So why is the input power rating so much higher? This doesn't answer that.
Comment: @Cybergibbons Answered above
Answer: The adapter clearly states that it supports only 65W. There could be many reasons for this, but in the end attempting to draw more would either fail immediately or prematurely.
The internal design of the adapter isn't made for more than 65W and shouldn't be used above this. Likely components cannot sustain the extra current required, and the input spec could be generous to be conservative for some losses (not 65W though).
Comment: "There could be many reasons for this" - Thats my exact question. Is it just to be conservative? Are there other components that limit this? I'm guessing mostly the first one. I'm not planning on using it for anything, it was more of a theory question.
Comment: @7200rpm The adapter IS made from components. As one chain is strong as it's weakest link, the adapter is powerful as it is weakest component. If the specs are correct, then 65W is maximum power that guarantee correct work of the device without failing. If you want to know what component is in this case, then probably you would have to open it and examine the specs for the internal components, including heat dissipation as it is can be limiting factor too.
Comment: @zzz Very true - So there is probably a component in the adapter that is a weaker link than simply input vs output power. And I probably shouldn't be opeining up my wife's power adapter :)
Answer: The label rating of the power supply will generally reflect the conditions under which it underwent its safety characterizations.
These not only include abnormal tests (shorting a transformer, for instance) but steady-state thermal tests at whatever condition generates the worst-case heating for the part.
It also influences the temperature rating (or "class") of the magnetic components within the power supply. Higher load can require higher temperature rating of the magnetics, which require higher-rated components (tape, magnet wire, bobbin, etc.)
Operating the adapter beyond its label rating is a 'misapplication' in the eyes of the regulatory people - i.e. don't do it.

AC Adapter Input vs Output Power?


Looking for cheap Xbox/playstation like remote controller for robots

Question: I saw some radio controllers for kids robots alike xbox/playstion game pads few months ago. But I couldn't find them by searching. I am looking for some cheap radio controllers for RC cars or other kids robots like console game pads.May you help me?
Answer: What about using an inexpensive 2.4GHz RC transmitter?
I already had one for a WLToys V222 quadcopter
If you don't already have one, you can pick one up on ebay for \$5 to \$15.
I opened up the quadcopter and Identified the chips it used

Mini54 microcontroller
MPU-6050 Motion Tracking Device
BK2423 2.4 GHz Transceiver

Based on this, I found the NRF24L01 which appeared to be compatible which I purchased on eBay for a whopping \$0.67US.  Add a \$15 Arduino Mega (or a $2 Arduino Nano clone) and you are all set to go.
After a bit of time and part in hand I hooked it up to the Arduino and I was able to control a servo using my inexpensive wireless controller.

SUCCESS!!
My guess is that the protocol varies depending manufacturer; so, a bit of reverse protocol engineering may be required.  If you would like more information on the code and config for the controller I used, Up Vote this and add a comment.

There are also 2.4GHz gamepads available for a similar price.  Their protocol might also be a bit different; so, a bit of reverse protocol engineering may be required in that case as well.
Comment: Thank you mark,
But I am looking for a game pad like controller. something like ps2 controller.
Also about voting up, I am new user and I can't do this until have 15 reps.
Comment: Can you clarify your question?  If you want a way to remote for a DIY project, using an RC transmitter is going to be cheaper and have better range than a wireless game controller.
Comment: I am trying to build warrior robot for kids and I think usual gamepads are easy and more interesting for kids to play with
Comment: There are also 2.4GHz Gamepads out there for a similar cost.  You may be able to use the same scheme.


Is there any statistically meaningful definition for object confidence in object detection?

Question: Most modern object detection algorithms rely on neural networks and output a bounding box and confidence for each object (or more accurately, a confidence for each possible object class considered, the highest of which is taken to be the true object confidence and to define the predicted class for that object). Beyond giving a relative likelihood of "objectness" (a predicted bounding box with 0.9 confidence is more likely to actually contain an object than a predicted bounding box with 0.1 confidence), is there any statistical significance to these predictions? For instance, should we be able to say that a predicted confidence of 0.1 indicates that roughly 10% of predictions at this confidence are actually objects? Is there another statistically meaningful definition?
I understand that at best this would be a loose statistical meaning because neural networks would be trained with loss functions that codify this statistical distribution into a loss, and the network would then only approximate this statistical distribution. Thus the distribution would also depend on the loss function used to train the classification portion of the neural network. These issues notwithstanding, is there or was there at some point inherent meaning to the confidence measure, or is it purely a relative quantity?
Answer: The problem you're describing is known as "model calibration". A model is well calibrated if the predicted the score corresponds to the expected probability. Simple methods like logistic regression tend to produce well calibrated models, whereas some of the tricks used in modern neural networks tend to produce poorly calibrated models. This paper suggests that Temperature Scaling is a simple and effective way to calibrate modern neural nets: https://arxiv.org/abs/1706.04599


Why exactly did Messiaen never meet the Nazi guard who helped him again, after the war?

Question: This Reddit comment quotes Wikipedia that contends:

After the war, [Karl-Albert] Brüll made a special trip to visit Messiaen, but was sent away and told the composer would not see him.

I'm curious, as I agree with Redditor eddiemon:

He [Brüll] risked his career and potentially even his life to let them go. I have a hard time imagining him as a mostly evil person. Obviously, I've never personally been a victim of the Nazis and I might feel differently if I was, but still, it seems a bit harsh to refuse to meet the man who risked so much for you.

Redditor GoatTnder then contended:

There is more to the story. I'm going from memory here, so forgive any wrong... The guard was turned away from the door by a servant because Messiaen was working that morning and normally wasn't disturbed. When he heard who came to the door, Messiaen tried to follow the guard, but couldn't find him.

So who's correct?
If eddiemon's account is correct, why didn't Messiaen and  Brüll reattempt to meet again? Messiaen played the organ at his church weekly; so Brüllcould've found him effortlessly?
Answer: An Article in the New Yorker, March 22, 2004 seems to cover why the meeting never took place later(emphasis mine):

Several decades later, Brüll came to Paris and rang at Messiaen's
  door. For reasons that remain obscure, Messiaen declined to see him.
  Perhaps he didn't remember who Brüll was; perhaps he was unable to
  confront this apparition from the past. He eventually tried to correct
  his mistake, and sent a message to the man who had made his
  masterpiece possible. But it was too late: Brüll had died, after being
  run over by a car.


Logging requests on high traffic websites

Question: I wonder how high traffic websites handle traffic logging, for example a website like myspace.com receives a lot of hits, I can imagine it would take a lot of space to log all those requests, so, do they log every single request or how do they handle this?
Answer: If you view source on a MySpace page, you get the answer:
<code><script type="text/javascript">
var pageTracker = _gat._getTracker("UA-6293770-1");
pageTracker._setDomainName(".myspace.com");
pageTracker._setSampleRate("1"); //sets sampling rate to 1 percent
pageTracker._trackPageview();
</script>
</code>
That script means they're using Google Analytics.
They can't just gauge traffic using IIS logs because they may sell ads to third parties, and third parties won't take your word for how much traffic you get.  They want independent numbers from a separate company, and that's where Google Analytics comes in.
Just for future reference - whenever you've got a question about how a web site is doing something, try viewing the source.  You'd be amazed at what you can find there in plain view.
Comment: a little homework always answers simple questions. thanks for doing the homework
Answer: We had a similar issue with out Intranet which is used by hundreds of people. The disk activity was huge and performance was being hurt.
The short answer is Asynchronous non-blocking logging.
Answer: probably like google analytics.
Use Javascript to load a page on a difference server, etc.
Answer: Don't how they track it since I don't work there. I am pretty sure that they have enough storage to record every little thing about their user if they wanted.
If I were them, I would use AwStats if I just wanted to know basic stuff about my users.
It is more likely that they have developed their own scripts for tracking their users. Stuff they would log
-ip_address
-referrer
-time
-browser
-OS
and so on. Then a script to see different data about the user varying by day, weeks, or months. As brulak said, something along the line of Analytics, but since they have access to actual database, they can learn much more about their users.
Answer: ZXTM traffic shaping and logging, speaking from experience here
Answer: I'd be extremely surprised if they didn't log every single request, yes, and operations with particularly high traffic volumes usually roll their own log-management solutions against the raw server logs, in some form or other -- sometimes as simple batch-type processes, sometimes as complete subsystems.
One company I worked for, back in the dot-com heyday, got upwards of twenty million pageviews a day; for that site (actually a set of them, running across a few dozen machines in all, as I recall), our ops team wrote a quite sophisticated, clustered solution in C that parsed, translated (into relational storage), compressed and distributed the logs daily.  Log files, especially verbose ones, pile up fast, and the commercial solutions available at the time just couldn't cut it.
Answer: If by logging you mean for collecting server related information (request and response times, db and cpu usage per request etc) I think they sample only the 10% or 1% of the traffic. That gives the same results (provide developers with auditing information) without filling in the disks or slowing the site down.


Am I wrong, or does this question ask for a tutorial?

Question: I just voted to close "How do you pull information from a datatable into a dropdownlist?" as too broad. It seemed to me that it was implicitly asking for a tutorial on data access in ASP.NET. Was I wrong about that?
Comment: This question does not have a single well-defined solution. The answer to this question could be a small book "Beginning ASP.NET Data Access, Fifth Edition"
Comment: @Coffee: I sometimes wish we could take these people by the hand and give them the "clue" they need. But there are far too many of them to help like that. This OP and the tens of thousands like him need to make better  use of local resources. And then come back here with more specific questions.
Comment: I also wish there were some resources as high quality as SO that would help people who are completely new to a technology help them choose good approaches/tools. Some of the now disallowed "lists of things" questions were great for this. Online resources are a jumble of opinions with very few places where people come together to **collectively** express their experience, as we had in "lists of things" questions.  There are things that sound great from reading articles and individual opinions(some being very strong and convincing) that in practice most people avoid for one reason or another.
Comment: You must be wrong, nobody downvoted it.
Comment: @HansPassant: "nobody downvoted it" - yet.
Comment: Somewhat borderline, in general OP seems well-intentioned. I often wonder if there were a more benign way of "closure" that simply says "hey this is incomplete, go do your HW"
Comment: @JohnSaunders I don't necessary support the accepted answer (I up-voted yours), but here's a reminder: [Is "too broad" a valid reason to close a question that doesn't show any research effort?](http://meta.stackoverflow.com/questions/283177)
Comment: @ivarni We can debate what resources are good quality and which aren't, but without a good community process that allows for open feedback the way SO does, it's hard for passer-bys to see what is and is not a good resource.  If you are inexperienced with a technology then you can't gauge the quality of a resource.  With SO I can look something up regarding a language I know little about, and see from comments on an answer whether there are pitfalls to the approach or not.  I don't have to wonder, the same way I would if I got the resource from elsewhere.
Comment: @AaronLS: I think that a "How to Access Data in ASP.NET" canonical question would not be acceptable. I really don't know what else to do besides take the time to write some blog posts.
Comment: @AaronLS [but there is!](https://github.com/vhf/free-programming-books/blob/master/free-programming-books.md)
Comment: @Braiam: there are so many books listed there that I would be surprised to find they are all good. That seems like too much of a good thing.
Comment: Well, some of them are actually wiki/git repositories that are formatted in chapters, so I think that if you find something factually wrong you can fix it rather easy. The ones that are not, the authors have emails where you can submit corrections. Granted, I didn't read every one of them, but that's my impression of the few I saw.
Comment: Although the title could be better, I think the user asked two specific questions: 1. *how to access the MyDbConn1 connection string that I created in the web.config.* 2. *when the code goes into the source area (ASP.NET) versus when it goes on the actual page in VB.NET*
Comment: @AaronLS There are sites like that, Pluralsight is one of them. Coursera is another. And most conferences I attend put videos out on youtube or vimeo. The web is **packed** with resources to help someone who are completely new to a technology. Why they can't find it is beyond me.
Comment: @ivarni You missed the point. I acknowledged that there were resources available. Very few represent **collective** experience though. Someone getting into ASP.NET will find articles on everything from classic ASP to Dynamic Data framework.  I see a lot of articles that take an approach that is way out in left field or has a lot of flaws, but because it is not in a very strong community setting(such as SO) it isn't apparent to newcomers that it is a really unconventional and/or bad approach.
Comment: @AaronLS Thing is, SO does not aim to be a site were peers discuss these kind of things. It aims to be a Q&A site. And it's been fairly succesful because it sticks to such a limited scope. If there really is demand for the kind of site you want, and there are people who want to contribute to building it then Area51 is where you want to start.
Comment: @ivarni I agree, SO is not the place for it.
Answer: I was the OP for that question.  I wasn't asking for a tutorial, but like I stated in my question I am new to programming so I couldn't clearly state what I was asking.  I watched several YouTube tutorial videos on how to do it, but none of them seemed to answer what I wanted directly.
Likewise, all the forms I read online were geared towards experienced programmers, so I couldn't understand what their instructions were. When someone is ignorant of the answer/topic they don't always realize how their question can be misinterpreted. Since asking that question, many more experienced programmers have left many comments to help me better understand the problem I was having.
Comment: Thanks for coming over here to the discussion. My concern was that you didn't seem to know _anything_ about accessing data in ASP.NET. You didn't seem to have a specific problem, only that you didn't even know where to start. If you actually _do_know something about accessing data in ASP.NET, then you should edit your question to make that clear, and then should clarify which specific problem you're having.
Comment: Not for nothing but rather than YouTube spend some time at MSDN.  There are gobs and gobs of examples there even if you cant be bothered to read the explanation.  Especially with VB there are a number of broader  step by step tutorial articles as well.
Comment: Your first sentence says that you're not asking for a tutorial, but everything after it seems to indicate that you're asking for a tutorial.  You're more or less saying, "I read a bunch of tutorials, I didn't understand them, please write me a tutorial on this subject that I can understand."  That's *asking for a tutorial* on the subject.
Comment: Okay, thank you for the advice.  Mason was already able to fix my problem, but I will keep all of your guys recommendations in mind if I ever need to ask another question.  Like I said, after knowing the answer, I can see how frustrating it can be for people trying to answer the question when you don't provide them with enough information.
Comment: On its worst day, with half the words redacted, MSDN is still better than the average *click-here-then-type-this* YouTube video
Comment: Although the quality has deteriorated over the years, [The Code Project](http://en.wikipedia.org/wiki/The_Code_Project) may be useful. It has tutorial content with actual code.
Comment: [Sample](http://www.codeproject.com/Articles/879529/What-Where-When-and-Who-to-Test-in-Your-Code)
Comment: @Plutonix I've actually been disappointed with the code quality at MSDN lately. It seems like it follows a lot of bad practices or might at least lead you to do something that we wouldn't do in production quality code. For example, the [SqlConnection](https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection(v=vs.110).aspx) documentation shows an example of a static method for database access that accepts a string for the command. It should probably accept an `SqlCommand`, allowing the command to be properly parameterized.
Answer: This could easily fall under too broad, but not because it requires too long of an answer, but because there are so many answers.
"How do I hook up my control to a database" can be done directly with ADO.NET (as in one of the answers), you can use a service layer, an ORM, etc.
I'm not sure the asker is actively looking for a tutorial (in the "resource recommendation" vein), but the question still has too broad a scope.
Comment: As I said in my question, "implicitly" asking for a tutorial. Or, at best, a survey "ways to access data in ASP.NET".
Comment: @JohnSaunders I would agree with the second version :)
Answer: I answered the question, and my answer was accepted. So I feel I should give my input. Now that I think about it, the question was probably too broad. But I'd like to share my mindset on what I was thinking at the time.
It didn't even occur to me that it was too broad. I know there are many ways of having gone about what the OP was trying to do, and quite honestly the cleanest implementation would be to create a proper data layer and pass strongly typed models back and forth. However, I don't think such approaches are necessary to have a valuable website. They just make things easier to maintain. So I approached it with the mindset of "what's the simplest and most direct way to get data from SQL Server and bind that data to a DropDownList control." For me, the way to approach it seemed straightforward.
So while I now agree it was too broad and could have used some clarification to narrow the scope, I think we should all remember that we were once new to programming as well, and that there's a lot of bad information out there on how to do things, and sometimes it's helpful to ask how to do it properly and receive a canonical answer on a well frequented site where bad implementations will likely get judged as such. Otherwise you'll end up confused and doing something unnecessary and then have to support your bad code.


What does G0Vp mean?

Question: I know that "G0V" refers to stars with spectral type G0 but some stars have spectral type G0Vp. What does the extra "p" in there mean?
Comment: p stands for "peculiar," in that the spectrum has something different from a "regular" G0V spectrum.
Answer: The p indicates some peculiarity has been noted in the spectrum of the star. For instance, some but not all lines of particular elements being strong or weak compared to stars of similar temperature. Or possibly some signs of emission lines (though an e normally indicates that) or rapid rotation. So probably a chemical peculiarity.
Answer: The "p" in "G0Vp" stands for peculiar
Basically, the star shows some strange behaviour that is uncharacteristic of a typical "G0V" star.
It could range from anything, from flaring a bit more often than other stars to violent solar winds that lift millions of tons of gas.
Really, anything, that is peculiar, or strange characteristics that don't usually occur in that particular spectral class.
Comment: You're correct about what the "p" stands for, but the peculiarity being referred to is chemical/spectral/etc. in nature -- e.g. the presence or absence of certain lines -- and not the star's behavior.

What does G0Vp mean?


Why can't the entropy of an isolated system decrease?

Question: I read that heat cannot flow from cooler body to hotter because for that entropy of the system becomes negative. Why is that so? Why we cannot have negative entropy?
Comment: Possible duplicate of [Why can the entropy of an isolated system increase?](http://physics.stackexchange.com/q/119387/)
Comment: Possible duplicates: http://physics.stackexchange.com/q/542/2451 , http://physics.stackexchange.com/q/10690/2451 , http://physics.stackexchange.com/q/19970/2451 , http://physics.stackexchange.com/q/20401/2451 , http://physics.stackexchange.com/q/79844/2451 , http://physics.stackexchange.com/q/81465/2451 and links therein.
Comment: It's not that it becomes negative: there would be a negative change in entropy.
Answer: The 2nd Law of Thermodynamics is based on an overwhelmingly extensive body of empirical evidence on how thermodynamic systems behave. There are many different statements of the 2nd Law, and all of them are equivalent to one another.  Once one of these has been specified, all the other follow.  One such statement says that heat cannot flow spontaneously from a hot body to a colder body.  Another statement, which is much more mathematically based, defines entropy, how its change should be calculated for a change in state of a closed thermodynamic system, and says that, for an isolated system experiencing a change in thermodynamic state, the entropy of the system can only increase or remain constant.  So, if you calculate the change in entropy of an isolated system consisting of a hot body and a cold body placed in contact with one another and allowed to equilibrate, you will find that the combined entropy of the hot body and cold body increases.
Comment: Thanks very much.  I'd like to think that the article helped some students overcome their thermodynamics confusion so that they could do their homework.
Comment: I could still remember your one of the first answers at chem SE that provided this intuitive link: https://www.physicsforums.com/insights/understanding-entropy-2nd-law-thermodynamics/
Answer: The reason why heat cannot flow from cold to warm is that the change in entropy will become negative, and that doesn't happen in a closed system. Negative entropy is by definition not possible. Here's why:
Alternative example: gas in a box
I think entropy gets a little more intuitive if we think of it in terms of statistical mechanics. If we imagine a box with a number of ideal gas particles, these particles can be arranged in many different ways. One way they can be arranged is to have all the particles gathered in one corner of the box, and the rest of the box being empty. There are many different permutations of the individual particles which would all give this result - the state described as all the particles being in the upper left back corner is called a macrostate (describes the system macroscopically but doesn't care about which individual particle sits where), while each distinct "seating arrangement", or permutation, of the particles which all yield the same macrostate are called its microstates. We can easily observe the macrostate, while the microstate is much harder to observe.
It should be intuitively clear that there are many microstates which yield the same macrostate; but also that there are enormously many more microstates that yield a macrostate in which the gas particles are more or less evenly distributed in the box. This is actually the statistical-mechanics definition of entropy:

The entropy of a macrostate is proportional to the logarithm to the number of microstates which yield the given macrostate.

(Under the assumption that each microstate is equally probable).
Mathematically, this is given as:
$$E = k_b \ln \Omega $$
With $k_b$ being the Boltzmann constant and $\Omega$ being the number of possible microstates of the given macrostate. This also explains why we cannot have negative values of entropy: There is no such thing as "a negative number of microstates".
We then assume that the system starts in a low-entropy state and evolves through random fluctuations, or a random walk, in configuration space - that is, the "space" made up of all possible microstates (not confined to any particular macrostate). You can imagine that each macrostate occupies a region in configuration space, the size of which is determined by the number of microstates it has - by its entropy. As the system evolves, once it has randomly walked out of its low-entropy initial configuration, it is very unlikely that its random path will ever take it back there again, simply because it is so tiny compared to the immensely larger number of microstates of a high-entropy state. In fact, once the system has settled into its maximum entropy state, it is very unlikely that it will fluctuate out of this state again, due to simple statistics.
Heat transport
Now going back to the example of the original question, we can see the analog to the gas particle example, only instead of the geometrical position of the particles, the state is defined by the distribution of their kinetic energies. Again, it is perfectly possible to have a configuration, in which all the kinetic energy is distributed over particles in the left side of the box, while all the particles on the right side are at rest. However, it should also be intuitively clear that there are immensely many more microstates in which the energy is evenly distributed over all the particles. So if our system starts in the low-entropy configuration in which one subsystem is hot and the other is cold, and is then allowed to evolve through random fluctuations through configuration space, again it will quickly leave the tiny "patch" of its initial macrostate and venture into regions of higher entropy - more microstates - from which it is very unlikely to ever return.
NOTE, though, that it actually is entirely possible for the system to randomly fluctuate back into a low-entropy state - to have a negative change in entropy. It is possible to stir your cappuccino into a configuration that separates milk and coffee, or to suddenly gather all air particles in one corner of the room - it is just extremely unlikely, and thus we never observe it in real life.


How to wipe Macintosh OS X v10.5.8 but leave software and OS?

Question: Are there any free tools to wipe the user contents of a Macintosh running OS X v10.5.8 to keep the operating system and software products installed but remove any user data for selling the computer to another party?
Comment: This won't help you solve this issue right now, but I usually take a time machine backup of any new Mac I buy, before I've done ANYTHING to it, so I can restore it back to "factory" before selling it or giving it to someone. Easier than reinstalling from scratch in most cases. Just for future reference.
Comment: +1, agree - I'd wipe it and reinstall OS X from scratch, which is probably the safest route. Takes a while though.
Answer: If you want to be completely sure that all traces of your data is removed, both of the "prep for sale" guides (here and here) that I came across recommended wiping your machine's drive and reinstalling OS X. The good news is that you can accomplish this without purchasing or installing any additional software - just back up your data and use Disk Utility to wipe the drive.
Apple Toolbox's guide recommends:

Back up your data. Using Time Machine, or another backup option, make sure your backup is current. Once you complete these steps, there
  will be no way of retrieving anything.
Boot off of your OS X disk. To do this, insert the OS X disk that came with your machine, reboot your computer, and hold down the C
  key while the machine is booting up. Open Disk Utility. Once your
  machine has booted off of the disk, and you have selected your
  preferred language, go to the Utilities menu and select Disk Utility.
  Once Disk Utility is open, proceed to the Erase tab.
Enter a name for the formatted drive. On the Erase tab, enter a name that will be used once the drive is erased. By default, a Mac's
  hard drive is named "Macintosh HD." Since you are preparing to sell
  the machine, this is a good choice.
Select the security level. Below the name field, you will see a button that says: "Security Options." Once selected, you will be
  presented with a number of different options. These include: "Do Not
  Erase Data," "Zero Out Data," "7-Pass Erase," and "35-Pass Erase." The
  first option is essentially the same as dragging a file to (and then
  emptying) the Trash…except that it does it for every single file on
  the hard drive. Ultimately, however, the data still remains. The other
  three options erase the data and write zeros over the entire hard
  drive once, 7 times, or 35 times depending on the option you choose.
  For most people, the single "Zero Out Data" will be more than sufficient. If your machine has particularly sensitive information
  on it, such as company financials, trade secrets, or the next great
  novel, you may want to go with the "7-Pass Erase." This option is
  considered secure enough to be the standard procedure for erasing US
  Department of Defense computers. You can rest easy using this option,
  while the "35-Pass Erase" is essentially overkill for all but the most
  extreme cases. Once you have selected the appropriate option, click
  the Erase button.
Install OS X and reboot.

However, the steps here will not leave your existing software in place.
If you're interested in leaving the software and OS X in place, deleting all of your data files, and use Disk Utility to wipe the free disk space. Steps from Apple Support:

Erasing free disk space does not erase the other files on your disk.

In Disk Utility, select the disk or volume in the list with the free space you want to erase.
Click Erase, then click the Erase Free Space button.
Select an option, then click Erase.

You may also want to create a new admin user, delete your old account(s), and run the Disk Utility routine to erase free space used by your account(s).
Answer: You can go a really long way by creating a new admin user account and then using it to delete all the existing user accounts, including deleting their home directories. Then I might delete any existing network "locations" in System Preferences -> Network. And use Keychain Access to clear out most of the System keychain.
I guess there could still be some traces left in /Library, especially /Library/Preferences and /Library/Logs. And maybe /var, especially /var/log.
...Hmm. The more I think about how complicated this problem is, the less I would trust any tool to do a good job of it. I think you really need to just "nuke and repave".
Comment: Not to mention all the non-standard installers that probably leave traces all over the file system, as well as user profile data.


Voyager spacecrafts life span and theory of relativity

Question: The Voyager spacecrafts are moving with an approximate constant speed of 16 to 17 km/s. As per Einstein's theory of relativity, time passes more slowly for them compared to us. Then, is it possible that these spacecrafts have a longer nominal lifetime than we actually assumed?
Comment: isn't the earth moving faster in its orbit around the sun?
Comment: From _our_ perspective, yes.
Comment: [Related](https://physics.stackexchange.com/q/185116/44126).
Answer: You can approximate the situation by treating both the Earth and Voyager as "test-bodies" moving in a spherically symmetric gravitational field of the Sun. This symmetry is described by the so called Schwarzschild solution. The Earth actually travels at about 30 km per second in this approximation where the "speed of the Sun" is zero while the Voyager is travelling at about 17 km per second.
As a simple approximation we can ignore the fact that for an observer at infinity the velocity of light in the gravitational field of the Sun will vary slightly with radial distance as well as with direction and you can write:
$$\frac{d\tau}{dt}=\frac{1}{\sqrt{1-\frac{2GM}{rc^2}-\frac{v^2}{c^2}}} $$
This expression says that you, measuring time in $\tau$, experiences less time the faster you go and the deeper in a gravitational field you are as compared to a distant observer at rest at infinity measuring time in $t$.
Voyager 1 is about 145 times as far away from the Sun then the Earth and its velocity is 17/30 times the velocity of the Earth. Both these facts contribute to time going faster for Voyager 1 then for us on Earth.
Voyager is actually carrying radioisotope thermoelectric generators to power it and those will not function as long as they would have on the Earth becasuse time goes faster for the Voyager.
Comment: Thank you so much for your support. Your answer is really helpful not only helpful to understand fact but also for improving my knowledge.
Comment: Another spacecraft question: [Parker Solar Probe passing extremely close to the Sun; what relativistic effects will it experience and how large will they be?](https://physics.stackexchange.com/q/348854/83380)


How to implement content security policy in magento 2

Question: I want to know how to implement CSP on Magento 2 with GTM.
The site has multiple stores. Tried to google but was unable to find any concrete result.
Implimenting a Content Security Policy Magento 1.9.x
Comment: have you implement this?
Comment: @kimnana not yet.
Comment: For now i have added this in .htaccess . but still finding for best solution
Answer: I was able to add CSP by modifying Magento (2.2.11) Configuration > General > Web > Upgrade Insecure Requests. I tested using https://securityheaders.com/


Adding functionality for client to change pictures and content of web site

Question: I've been building a static website and the client has suddenly stated that they would like the ability to change the content( words ) and pictures when they feel like it. What is the best way to do this? I could build something, I just want to make sure there isn't already something out there. I need this to be a simple as possible.
Answer: Use a CMS; a Content Management System.
There are plenty of open-source ones. Wikipedia has a list of many CMS's here.
You'll need to decide on a CMS, and set it up. Afterwards, it becomes a matter of styling the CMS after the theme of the static website you have designed. You probably can find many tutorials online, depending on the CMS you choose (that could be part of your criteria).
Answer: You can use one of many content-management systems.
Drupal is a very popular content-management system with years of development and a very large user base.
You could also use WordPress, not strictly a content-management system, but because of its flexibility may be suitable to your or your clients needs.
Here's an article on some content-management systems.


Can cannonballs go through water?

Question: In the recent Spielberg/Jackson Tintin movie, there is a scene where Red Rackham and Captain Haddock's ships are fighting, and cannons are fired.  The cannonball is shown at one point to go through a wave, and inflict serious damage on the other ship.  I know that bullets stop in water; do cannonballs, with their greater weight, continue with enough force to inflict damage?
Comment: It also depends on the length of water the cannonball goes through and on the projectile's shape: bullets are far more aerodynamically shaped than cannonballs.
Comment: However, keep in mind that ship cannons were originally used to break the other ship's masts or damage its hull _below_ the waterline in order to sink it.
Comment: I dont have the time to work out a complete answer, but generally, yes, the momentum of a cannonball would likely be sufficient to both pass through a wave and damage a ship.  Of course, it depends on the relative sizes, but, think of it as the wave serving as a shield; the momentum would be reduced, but the ball likely wouldn't stop.
Answer: What distance can a cannonball traverse thru water without losing too much kinetic energy? For a back-of-the-envelope calculation we start from the observation that this distance scales with the ratio of the kinetic energy of the cannonball and the drag force exerted on the cannonball.
Let's denote the ball's radius by $R$, its speed by $v$, and its mass density by $\rho_{ball}$. The kinetic energy $E_k$ equals $\frac 1 2 M v^2 = \frac{2 \pi}{3} \rho_{ball} R^3 v^2$.
The drag force $F_d$ is given by $\frac 1 2 C_d \rho_{water} v^2 A = \frac {\pi}{2} C_d \rho_{water} v^2 R^2$. Here, $C_d$ denotes the drag coefficient for a sphere.
The maximum distance $L _{max}$ that can be traversed by a cannonball $L_{max} = E_k/F_d$  is therefore $\frac 4 3 \frac {R}{C_d} \frac {\rho_{ball}}{\rho_{water}}$.  For typical values ( $\frac{\rho_{ball}}{\rho_{water}} < 8$ and $C_d > 0.1$,  see here), we find $L_{max} < 100 R$.
In other words, a cannonball loses much of its kinetic energy when it traverses a layer of water larger than about fifty times its diameter.
Answer: The accepted answer is not complete. A projectile may travel very long distances underwater if it is supercavitating.

A supercavitating object is a high speed submerged object that is
  designed to initiate a cavitation bubble at the nose which (either
  naturally or augmented with internally generated gas) extends past the
  aft end of the object, substantially reducing the skin friction drag
  that would be present if the sides of the object were in contact with
  the liquid in which the object is submerged.

A round nosed subsonic pistol bullet will travel much further than a supersonic pointed nose rifle bullet underwater because of this effect.

Can cannonballs go through water?


Relay closes without load connected across its terminals but doesn't work when it's loaded

Question:
why would something like that happen? all the relay has to do is to close its contacts, what difference would the load do?
Comment: Consider redrawing your schematic diagram.  The section driving the relay is especially problematic.  It is difficult to read, with the battery at the bottom.  A first glance says "the diode is upside down" followed by "what's driving the relay" followed by " oh, geeze, its all connected right but what mess."
Comment: What powers the load?
Comment: @jonk AC mains 220v ac
Comment: You might want to define "doesn't work" with something  more descriptive. Assuming there is no galvanic connection, I'd also be curious about what your AC powered load actually is. And also curious about the current required by your 12 V relay (though I don't expect that to be more than \$180\:\textrm{mA}\$.)
Answer: In theory it shouldn't, but perhaps your relay drive circuit is operating at the margins and is being thrown off a bit by interference of some sort when the load is present.
Looking at things, you have a PIC micro, which if the IO pin is putting 5V into R3, delivers 500 microamps into the base of Q2. The DC gain of a 2N2222, let's optimistically call it 100, would yield 50mA current through the collector. LED2, powered by the 12V battery, would want nearly 50mA of current by itself ((12V Battery - 1.8V LED voltage drop) / 220 ohms = ~48mA). Perhaps the relay is only barely getting enough juice in this setup?
Try change R3 to something lower, like 1K or something, and increase R5 to at least 1K if not more. Or even take out LED2 entirely to see what happens. And check the specs on the relay coil - how much current does it need to operate? You could just test it with the battery and a meter, too.
Comment: I agree about \$R_3\$. I'd anticipate that the total collector load on the BJT is around \$200\:\textrm{mA}\$ from what I see there and guessing about the relay. That's a lot to expect from \$400\:\mu\textrm{A}\$ base drive current.


Square background to text in Photoshop (like on movie subtitles...)

Question: Does anyone know a way of addding a square background to text in photoshop? I want something like the same effect that is on subtitles in movies.
See examples below. I can do it with adding a new layer with a black square and reduced opacity behind, but it seems so "hackish" and its difficult to get the same offset, correct position etc.
Is there a simpler way? Something like a "squared stroke" blending option?
Hmmm.. wasnt allowed to post images :\
Word calls it "Text Highlight"

Mancester city uses it on their newspage (probably not photoshop though).
Answer: Simply use the Shape tools within Photoshop to draw boxes, then move those layers below the type layers.
There's no automated method to add an encompassing shape around text that I'm aware of. You simply have to use multiple layers.
Now in Illustrator.... It is possible.
An example of the above technique in Photoshop using 50% opacity on the background:


How to debug python MapReduce programs written in mrjob from eclipse

Question: I am trying to debug mapreduce jobs written in python's mrjob library using eclipse under Ubuntu. Does anyone have an idea how this could be done?
Answer: Debugging MrJobs can be quite a challenge sometimes.
My learning curve started from using try... except clauses inside mappers and reducers yielding the exceptions produced (using the traceback module) into the results instead of breaking the job flow.
But that first approach was time consuming as many times you have to wait several minutes until the job is done, and in the end, most errors ended up undefined variables, or syntax errors.
So then I tried using small test logs to feed the jobs, that reduced significantly the amount of time spent running the jobs to see what the problem was.
Another approach was to test the mappers and reducers outside of hadoop, this can be very convenient as you can use pdb for that purpose, and figure out problems quickly.
Finally, you can also try the suggestion of using MrJob's documentation, then you will find how to run the job locally which comes very handy:
http://packages.python.org/mrjob/runners-inline.html
Answer: The key is to have as much test coverage as possible. Even if you run the the jobs locally, rerunning the jobs repeatedly can quickly eat up your day. What worked out for me was to break down the map and reduce steps into a sequence of smaller functions, and write unittests for each small step.
Also, watch out for the difference between your local Python version and the one installed on the Hadoop instances (latest EMR instances use Python 2.6).   I have listed a few debugging tips here.


Accommodation mechanism.

Question: Can anyone explain how contraction of the ciliary muscles causes relaxation of the zonules? Please explain it anatomically i.e. the attachments of ciliary muscles and its relation with the accommodation process.
Comment: I searched medical books on anatomy and physiology and different medical websites for it. I also tried to find an explanation in YouTube but found no video satisfactorily explaining it. So I posted it here.
Comment: If you explain in more detail what confuses you and why (i.e. show us you've researched this and tried to answer it on your own), I'm sure it would have a better chance at attracting an answer.
Comment: When we study the attachment  of ciliary muscle, it appears to produce more tension on the ciliary zonules (& thus also on the capsules of the lens)-thus should cause flattening of the lens(i.e lesser convexity or more redius of curvature). But according to Von Helmholtz's capsular theory on accommodation, contraction of ciliary muscle causes releases of the zonular tension on lens capsule. My point is..... Ciliary muscle surrounds and holds the lens capsule, so when it contracts it should shorten in length....thus causing more tension on lens capsule(which is clearly against the theorem)
Answer: I think the problem you're having is in the way you're thinking that all contracted muscle shortens, and all relaxed muscle lengthens. But the cilia is different. The ciliary muscle is a circular or radial muscle (like the orbicularis oris of the mouth.) Thinking of it like a sphincter muscle is much more helpful.
The ciliary muscle is attached at its periphery to the lens by suspensory ligaments (aka the zonules). Think of the the lens, the suspensory ligaments, and the ciliary muscle as a single unit with only two components whose length can change dramatically: the cilia and the lens. The length of the suspensory ligaments is more or less fixed.
This may be counterintuitive, but for seeing at a distance, the ciliary muscle relaxes, and the muscle in effect becomes "thinner" (think of the capitol letter O in a thin font, or think of a shpincter muscle; when the latter relaxes, it becomes thinner and more spread out). This means the "decreased distance" taken up by the ciliary muscle must be made up for by the suspensory ligaments and the lens: The tension on the suspensory ligaments increases, causing the lens to assume a flattened shape.
For near vision, the opposite occurs; The ciliary muscle contracts (think of the letter O now very bolded - it takes up more of the fixed distance.) This allows the ligaments to relax, allowing the lens to assume a more rounded shape.
Does that make any sense at all? I hope so, because it is essentially how it happens.
I did find a YouTube video; unfortunately it explains it pretty much like I did varying in a few details.
Morphological Study of the Accommodative Apparatus in the Monkey Eye Way way complicated; it's better to just believe me.

Accommodation mechanism.


d3d11.dll caused an Access Violation

Question: So recently i downgraded to windows 7 from 10 for better performance. the game i wanted to play (clone hero) worked perfect on windows 10. after downgrading i got these "Access Violation" errors.. i tried disabling firewall and its a fresh install of windows 7. i only have chrome and clone hero installed.. sometimes it gives me AppHangB1 errors and sometimes it crashes before it reaches the splash screen saying "d3d11.dll caused an Access Violation"
I have tried installing all windows updates (i am on Windows 7 Home Basic SP1 64 bit)
(I have also tried updating my graphics card which i did not need to do on windows 10 to play the game)
<code>Clone Hero [version: Unity 2017.3.1p2 (fd9fec26f216)]

d3d11.dll caused an Access Violation (0xc0000005)
  in module d3d11.dll at 0033:f1aa1840.

Error occurred at 2019-07-06_201656.
C:\Users\Deagan\Desktop\oldch\Clone Hero.exe, run by Deagan.
36% memory in use.
3033 MB physical memory [1918 MB free].
6063 MB paging file [4841 MB free].
8388608 MB user address space [8388300 MB free].
Read from location 00000061 caused an access violation.

Context:
RDI:    0x040083a0  RSI: 0x00000000  RAX:   0x000f0060
RBX:    0x02506fe0  RCX: 0x000f0058  RDX:   0x00000000
RIP:    0xf1aa1840  RBP: 0x04145950  SegCs: 0x00000033
EFlags: 0x00010246  RSP: 0x002ff008  SegSs: 0x0000002b
R8:    0x00000000  R9: 0x00000000  R10:   0x00000000
R11:    0x002fedd0  R12: 0x00010800  R13:   0x00000001
R14:    0x00000002  R15: 0x00000000

Bytes at CS:EIP:
48 0f be 42 61 4c 8d 0d 4c 4f 02 00 48 83 c1 a8
</code>
I expected the game to run and not give AppHang or Access Violation errors.
Answer: Access violation errors are generally due to a lack of permissions from what I've seen. Running the game specifically as administrator may solve the problem.

d3d11.dll caused an Access Violation


datetime datatype in java

Question: Which data type can I use in Java to hold the current date as well as time?. I want to store the datetime in a db as well as having a field in the java bean to hold that.
is it java.util.Date ?
Answer: java.util.Date represents an instant in time, with no reference to a particular time zone or calendar system. It does hold both date and time though - it's basically a number of milliseconds since the Unix epoch.
Alternatively you can use java.util.Calendar which does know about both of those things.
Personally I would strongly recommend you use Joda Time which is a much richer date/time API. It allows you to express your data much more clearly, with types for "just dates", "just local times", "local date/time", "instant", "date/time with time zone" etc. Most of the types are also immutable, which is a huge benefit in terms of code clarity.
Comment: My bad, got into the wrong doc.  My comment is obviously misleading, I will delete it.
Answer: import java.util.Date;
import java.text.DateFormat;
import java.text.SimpleDateFormat;

private String getDateTime() {
    DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
    Date date = new Date();
    return dateFormat.format(date);
}

Comment: can i mapp it to timestamp in db(mysql)?
Comment: yes you can map time-stamp in db.  http://www.roseindia.net/jdbc/jdbc-mysql/mapping-mysql-data-types-in-java.shtml
Answer: java.time
The java.time framework built into Java 8 and later supplants both the old date-time classes bundled with the earliest versions of Java and the Joda-Time library. The java.time classes have been back-ported to Java 6 & 7 and to Android.
The Instant class represents a moment on the timeline in UTC with a resolution of nanoseconds.
Instant instant = Instant.now();

Apply an offset-from-UTC (a number of hours and possible minutes and seconds) to get an OffsetDateTime.
ZoneOffset offset = ZoneOffset.of( "-04:00" );
OffsetDateTime odt = OffsetDateTime.ofInstant( instant , offset );

Better yet is applying a full time zone which is an offset plus a set of rules for handling anomalies such as Daylight Saving Time (DST).
ZoneId zoneId = ZoneId.of( "America/Montreal" );
ZonedDateTime zdt = ZonedDateTime.ofInstant( instant , zoneId );

Database
Hopefully the JDBC drivers will be updated to work directly with the
java.time classes. Until then we must use the java.sql classes to move date-time values to/from the database. But limit your use of the java.sql classes to the chore of database transit. Do not use them for business logic. As part of the old date-time classes they are poorly designed, confusing, and troublesome.
Use new methods added to the old classes to convert to/from java.time. Look for to… and valueOf methods.
Use the java.sql.Timestamp class for date-time values.
java.sql.Timestamp ts = java.sql.Timestamp.valueOf( instant );

And going the other direction…
Instant instant = ts.toInstant();

For date-time data you virtually always want the TIMESTAMP WITH TIME ZONE data type rather than WITHOUT when designing your table columns in your database.
Answer: +1 the recommendation for Joda-time.  If you plan on doing anything more than a simple Hello World example, I suggest reading this:
Daylight saving time and time zone best practices
Answer: Depends on the RDBMS or even the JDBC driver.
Most of the times you can use java.sql.Timestamp most of the times along with a prepared statement:
pstmt.setTimestamp( index, new Timestamp( yourJavaUtilDateInstance.getTime() );

Answer: I used this import:
import java.util.Date;

And declared my variable like this:
Date studentEnrollementDate;

Answer: Since Java 8, it seems like the java.time standard library is the way to go. From Joda time web page:

Note that from Java SE 8 onwards, users are asked to migrate to java.time (JSR-310) - a core part of the JDK which replaces this project.

Back to your question. Were you to use Java 8, I think you want LocalDateTime. Because it contains the date and time-of-the-day, but is unaware of time zone or any reference point in time such as the unix epoch.
Comment: Right about using java.time but wrong about using `LocalDateTime`. Because it has no time zone or offset-from-UTC, it has no real meaning. It is not a moment on the timeline. Rarely needed in business apps. Instant, OffsetDateTime, and ZonedDateTime are all used to represent a moment on the timeline.
Comment: @BasilBourque Yes that's a good rephrasing. Though the question at hand wasn't really specific enough to say what is right or wrong.
Comment: Agreed the Question is not clear, and rather anemic, lacking details. But it does say "current" date and time which almost certainly should be zoned.
Answer: You can use Calendar.
     Calendar rightNow = Calendar.getInstance();

Calendar
Date4j alternative to Date, Calendar, and related Java classes

datetime datatype in java


Using Collection Filter to then be used in Delete Action (flow)

Question: I'm building a Record Triggered - After Save flow.
In the flow I have a GET element that is

gathering all AccountTeamMember records with a specific Account Id. (getCurrentAccountTeamMembers)
filtering that Record Collection based on the Team Role. (Debug output below)

This is where I'm running into issues:

I have a decision to see if records exist in the filtered collection variable - however, utilizing AccountTeam from FindCurrentDataBD IS NULL = False in the decision does not accurately calculate if there are records found in the record collection - is there a way to do this? I can see whether records are found when I do a debug - but they're being presented in a way that I am not able to compare against. (See below)
It'll work if Records exist fine - but if a record does not exist it'll still evaluate to true & then the flow fails.

I then want to them delete the filtered collection list if records exist.

Collection Filter debug Output:
Source collection: getCurrentAccountTeamMembers
Create a collection, applying these filter conditions

All conditions must be true (AND)
{!currentItem_FindCurrentDataBD_0.TeamMemberRole} (null) Equals Data BD
Items in source collection: 1
Items in filtered target collection: 0
Result

None.

Decision Output:
Outcome executed: Found
Outcome conditions

{!FindCurrentDataBD} ([]) Is null false
All conditions must be true (AND)

Answer: I understand that filter works correctly for the debug example you have mentioned but you are unable to check if it is empty or not.
Checking whether filtered collection is null or not works. I say you are comparing wrong collection to null. The collection you are comparing it to is the original one.


In the webservices model are there still basically 3 tiers as the client-server model had?

Question: The basic client-server model (even when implemented using questionable interfaces) had a presentation layer, a business layer, and a data layer.  Are the directory and discovery methods using webservices models considered a entirely new layer?  I would argue that the discovery layer is actually just expanding the role of the data layer to include information on where a service can be found.  I am struggling to understand the interplay between webservices and the MVC framework and I am trying to understand the bigger picture as to where the directory and discovery components fit into that framework.
Answer: I would say that there is an additional layer -- the service layer -- that sits between your business layer and the presentation layer or your business layer and the data layer depending on whether you're doing a thin- or thick-"client" implementation.  This layer would encapsulate service discovery and delivery, including marshaling/unmarshaling data for transfer.  See Fowler's Principles of Enterprise Application Architecture Service Layer description.  In his concept the service layer sits between the business layer (domain model) and the presentation layer (UI).  This concept would apply to a thin-client or web-based client implementation.
Comment: So a thick client would be more likely to interact with the service layer and not delegate those discovery functions to the business layer?  Your answer really brings everything into focus.  You have a gift in your communication style. +1 and check
Comment: Thanks.  I do mostly web dev so I can't really give concrete advice on the thick client case.  I'd expect though that you'll find that discovery outside the BL coupled with injection of the discovered service to the appropriate factory for the BL is the way to go.
Answer: I would say there are not basically 3 tiers in the web services model.
Web services is essentially SOA (Service Oriented Architecture), which can imply a multi-tier (n-tier) model.  It refers to distributed computing and could be scaled up to a massive system with hundreds of "tiers".
I would agree with you that conceptually, getting your data from a service as compared to a database, could be similar to getting data from other data sourced like databases, etc., and that this could be conceived of as an additional function of the data access layer.
Of course it also depends on semantics.  Often "tiers" refers to discreet parts of the overall system (i.e. front-end, middle-tier, back-end data sources, other tiers such as integration with web services, etc.); while "layers" often refers to the vertical layers in the code such as presentation, controller, business logic, data access, etc.


Crypto blog project using smart contracts as payment system and NFT's as access tokens for articles - am I doing it right?

Question: I'm beginning my journey with blockchain and smart contracts. I want to create web application - blog or articles website. Each user will be able to write an article and save it. Every article will be available to other users for purchase in ethers. Each user will be authenticated via metamask. I already write signing implementation and now I want to ask if my idea is correct.
So the way that I want to achieve it is:

User creates text, set the price for it and clicks on send button.
Text is send to the server and server save it as an article to the database and create one unique NFT smart contract and deploy it automatically to the blockchain. The creator of an article is the owner of the smart contract.
Articles are being displayed on the website to anyone.
If user wants an access to any article on the website, he must pay for it - which means mint 1 NFT - which means call a mint function of an NFT smart contract and pay the price for it that the owner has set. The tokens are kept in smart contract to withdraw by the owner.
If user minted token successfully, he owns the NFT token and now he has access to the article (he will get it from the database when a server checks that he actually owns it).

So basically there will be one nft smart contract for each article. Creators will be the owners and they will be able to call withdraw function to get earned tokens. Everyone could be article creators and everyone could be article readers.
What do you think about my implementation steps? Is there any way to make if simpler or better?
Answer:
The idea sounds great
I suggest to use IPFS to hold the articles encrypted with metamask encryption (public-private keys encryption)
You don't need multiple smart contracts. Just create the logic in same smart contract using ERC1155 for articles.

Bonus ideas:

Create ratings for articles.
The "Abstract" part should be free for everyone
Let user offer tips to creators if they loved the article


I want to buy a used aria stg series guitar electric

Question: I'm considering buying a used guitar, like the one pictured. What are the things that I should test on it to see if it's a good guitar or not?
Thing like the physical shape, the strings, etc.
Comment: Answered in 'What to look out for when buying a super cheap used guitar. All points covered there. So - a dupe?
Comment: There are plenty of gear forums where you can discuss your GAS, but the point is that you come in with a general question and hopefully it's already been answered. "Is this specific used guitar worth buying?" is not going to be useful to another person unless they come asking about the exact same instrument.
Comment: Just to be prepared for future questions, do you plan to post every other guitar you find online until someone says "Yeah, get that one!" ? :P (in reference to https://music.stackexchange.com/questions/96254/what-is-the-name-of-this-guitar)
Comment: @FedericoklezCulloca no it was just these two.. But there would be a problem if i do so?
Comment: I don't know. My comment was mostly a joke :)
Comment: There are plenty of gear forums where you can discuss your GAS, but the point is that you come in with a general question and hopefully it's already been answered. "Is this specific used guitar worth buying?" is not going to be useful to another person unless they come asking about the exact same instrument.
Answer: First of all you'll want to look down the length of the neck of the guitar to see if it is warped or twisted, a little bow in the neck can be corrected but a twisted neck will need replacement. Next you'll need to examine the bridge to make sure all parts are functional there. This includes the whammy bar mechanism located under the plate on the backside of the guitar. Make sure the springs that hold this mechanism together are in good working order. Next you'll want to play something on it. Plug it in, turn on the amp and listen to see if you like the sound of it, fool with the pickup switch to make sure it is working and listen to the pickups to make sure they work and see if you like the sound of them. Next, you'll need to decide if you like the feel of the guitar when you play it. That's pretty important because if you don't like the feel of it, you probably won't want to play it very often. Aria has made some high quality guitars, and some that are also unimpressive, so you'll need to decide for yourself if this is the guitar you've always wanted to own. Best of luck!


IQ test question - 3x3 grids with some shaded cells

Question: I recently downloaded an IOS app "IQ test", and surprisingly found most of the questions pretty straightforward, but this particular one had me stumped. Can anyone help me understand the pattern here?
Answer: Here's how I would think about it

 Number the cells of each grid in the following way,

 1 2 3
 4 5 6
 7 8 9

 Now imagine there are two shaded cells beginning at cell 1 (they occupy the same space).
 On each step, one of the shaded cells moves up 1 and the other shaded cell moves up 2, with the caveat that the whole thing wraps around (so when the second shaded cell moves to 9, its next step is to cell 2).
 Then reading the images in the same order as I've numbered the cells in the grid, the shaded cells in each grid will be

 (1,1) (2,3) (3,5)
 (4,7) (5,9) (6,2)
 (7,4) (8,6) (9,8)

and so the answer is

 D
Comment: Ah I see it, thanks so much. Been bugging me all morning!
Comment: Also, rot13(Q vf nyfb gur bayl bar bs gur pubvprf juvpu unf gur fnzr pbyhzaf bpphcvrq nf gur gjb bguref va gung pbyhza.  V erpbtavmrq vg jnf gur nafjre vzzrqvngryl jvgubhg svthevat bhg gur ybtvp oruvaq vg orpnhfr bs gung.  N jryy qrfvtarq dhrfgvba jbhyq'ir unq nabgure jebat pubvpr jvgu bayl gubfr 2 pbyhzaf bpphcvrq.)
Comment: Interesting. I don't think I've seen that sort of logic in "tests" like this before. The ones I've seen usually seem to repeat a particular set of moves, not including this.
Answer: Here's another way to arrive at the same answer, assuming the question wasn't labeled a "progressive matrix" in the app.

Each small grid in the large purple grid have a single instance of three shapes:
<code>█   █   █
    █  █
</code>
This is also true for C and D.

Each small grid has its corresponding position in the large grid shaded. Following this pattern, the answer should have a shaded cell in this position:
<code>▒ ▒ ▒
▒ ▒ ▒
▒ ▒ █
</code>
This is true for B, D, E and F.

Only D fits both these patterns.
Answer: If you look at any column, one of the tiles in the top grid goes down by 1 and another by 2, so as to form the middle grid, then again to form the bottom grid. Unlike the other examples, the shifting in tiles across the 3x3 grids remains in the same column. D
Comment: This seems to be the same as the accepted answer from two years ago.
Answer: I have found another option. If you can form an "L" in addition with the first box and the other boxes, it is correct. This is true for all given boxes - and for the answer choices only for D.
@bobble and sorry for my drawing skills.
Comment: All the Xs you drew do make Ls, but where did you get them from? What is being added to what? E.g.


Testing uniformity for continuous probability distributions

Question: Suppose I can sample from a random variable $X$ which is distributed on a compact interval, say, $[0,1]$. Fix a distance measure between distributions, say total variation. Let $\epsilon\in(0,1)$. How many samples are needed (upper and lower bounds) to test whether $X$ is uniformly distributed or its distribution is $\epsilon$-far from uniform, with probability of success at least $3/4$. References are welcome. In the case of a finite support of size $n$, the minimax complexity is known to be $\Theta(\sqrt{n}/\epsilon^2)$ (cf. A coincidence-based test for uniformity given very sparsely-sampled discrete data by L. Paninski).
Comment: @MattF. typically we must guarantee (a) if $X$ is uniform, then with $n(\epsilon)$ samples we output "uniform" with prob. $\geq 3/4$; and (b) for any $X$ with $TV(X, \text{uniform}) \geq \epsilon$, with $n(\epsilon)$ samples we output "nonuniform" with prob. $\geq 3/4$.
Answer: This shouldn't be possible without assumptions on $X$. Take any algorithm drawing $m$ samples. Construct a discrete distribution $X$ by drawing $2^m$ samples indepedently and uniformly from $[0,1]$, and let $X$ be uniform on these $2^m$ distinct (w.prob. 1) points. Then $X$ has maximal total variation distance from uniform, but with high prob. you cannot distinguish an $X$ constructed in this way from the uniform distribution with only $m$ samples. We should be able to get essentially the same impossibility by making $X$ a mixture of Gaussians centered at those $2^m$ points with tiny variance, or something similar.
Comment: Great, thank you.
Answer: It seems that the situation with continuous distributions is fundamentally different than the finite support one. I believe that Section 2.3 in Random number generation and Monte Carlo methods by J. E. Gentle is a good start.
Answer: Update: I've now asked about the claim at another question, where it was proved by Anthony Quas and Iosif Pinelis. Using the number $24/121$ from Iosif's answer, the algorithm in this answer could be improved to using $1/4-\epsilon/8$ as the cutoff between outputting "uniform" and "non-uniform", and requiring only $n>16/\epsilon^2$ samples.
Suppose we restrict to concave distributions, i.e. distributions with densities $f$ for which
$$f\left(\frac{a+b}{2}\right) \ge \frac{f(a)+f(b)}{2}$$
for any $a,b\in[0,1]$.
Then there is a simple test on $n$ samples:

Let $P_1$ be the fraction of samples between $0$ and $\frac14$.
Let $P_4$ be the fraction of samples between $\frac34$ and $1$.
If $\min(P_1,P_4) > 1/4-\epsilon/12$, output "uniform"
If $\min(P_1,P_4) < 1/4-\epsilon/12$, output "non-uniform"

If $n>50/\epsilon^2$, then this test succeeds with probability at least $3/4$ on the uniform distribution, and with probability at least $3/4$ on any concave distribution at total variation distance at least $\epsilon$ from uniform.
The criterion of concavity is broad enough to cover many reasonable distributions that one might compare with the uniform distribution, including the below (illustrated with $\epsilon=1/10$)

We can bound the test's probability of failure for the uniform distribution by
\begin{align}
&2P\left[\ \ B\left(n,\ \ \ \frac{1}{4}\ \ \ \right)<\frac{1}{4}-\frac{n\epsilon}{12}\right] \\
\sim &2P\left[N\left(\frac{n}{4},\frac{\sqrt{3n}}{4}\right)<\frac{n}{4}-\frac{n\epsilon}{12}\right]\\
= &2\,\Phi\left(-\frac{\sqrt{n}\epsilon}{3\sqrt{3}} \right)\\
< &2\,\Phi\left(-\frac{\sqrt{50}}{3\sqrt{3}} \right)\\
= &0.174
\end{align}
To bound the probability of failure for non-uniform distributions, we need to know that either $[0,1/4]$ or $[3/4,1]$ will be substantially less probable than average.
Claim:
If $f(x)$ is concave and positive on $[0,1]$ with $\int_0^1 f(x)dx = 1$ and
$$\int_0^1 \max(0,1-f(x))\,dx \ge \epsilon$$
then
$$\min\!\left(\int_0^{1/4}f(x)\,dx, \int_{3/4}^1 f(x)\,dx\right) \le \frac14-\frac\epsilon8 $$
If $f$ is the pdf of a distribution, then the first integral is its total variation distance to the uniform distribution; the second and third integrals are the limits of $P_1$ and $P_4$.
I hope that someone will see a clean proof of this claim from some standard properties of concave functions. One can also verify that the examples above satisfy both the hypotheses and the conclusion of the claim.
With the claim, the probability of failure for the non-uniform distributions is bounded by
\begin{align}
&P\left[B\left(n,\frac{1}{4}-\frac{\epsilon}{8}\right)>\frac{n}{4}-\frac{n\epsilon}{12}\right]
\\
\sim &P\left[N\left(
\frac{n}{4}-\frac{n\epsilon}{8},\frac{\sqrt{n(2-\epsilon)(6+\epsilon)}}{8}\right)
>\frac{n}{4}-\frac{n\epsilon}{12}\right]
\\
< &P\left[N\left(
0,\frac{\sqrt{12n}}{8}\right)
>\frac{n\epsilon}{24}\right]
\\
=&1-\Phi\left(\frac{\sqrt{n}\epsilon}{3\sqrt{12}}\right)
\\
<&1-\Phi\left(\frac{\sqrt{50}}{3\sqrt{12}}\right)
\\
=&.248
\\
\end{align}


How do you export all Customers Data from Prestashop?

Question: How is it possible through SQL Query?
Comment: Yes it is possible :)
Answer: Through Prestashop admin panel, it's not possible to export all customers data, so you need to write custom SQL query to select all customer data in PHPMYADMIN and export CSV sheet.
Using following query you can select all customers who are having addresses.

select ps_customer.id_customer, ps_customer.email, ps_customer.firstname,
ps_customer.lastname, ps_customer.passwd, ps_customer.company,
ps_customer.birthday, ps_customer.newsletter,
ps_address.id_country, ps_address.id_state, ps_address.address1, ps_address.address2,
ps_address.postcode, ps_address.city, ps_address.phone, ps_address.vat_number
from ps_customer INNER JOIN ps_address
ON ps_customer.id_customer=ps_address.id_customer;

Using following query you can select all customers who are not having addresses.

SELECT id_customer, email, firstname, lastname, passwd, company, birthday, newsletter
FROM ps_customer WHERE id_customer NOT IN (SELECT id_customer FROM ps_address);

Customize your query based on your need of customer attributes.
Happy reading! :)


How to increase the size of a VirtualBox Disk Image

Question: I had created a Windows XP image disk. It is of 5 GB, but I would like to know if there is any simple way to increase the size to 20 GB.
Answer: As of VirtualBox 4.0.0, the VBoxManage command line tool offers a simple resize option:
<code>VBoxManage modifyhd /path/to/vdi --resize <mbytes>
</code>
After the virtual disk container resize, boot into the VM and resize the partitions to make use of the extra space.
See also: VirtualBox manual, Chapter 8. VBoxManage: modifyhd
Comment: this could be updated as the new answer, I test it and is extreme simple.
Comment: Worth noting: this can only increase the size of vdi drives (not decrease), and only of dynamically sized drives.
Answer: There is no simple way to do this that I'm aware of.  There's no app that lets you just adjust a number to increase the hard drive size.  However, there's a pretty easy tutorial on modhul.com that walks you through a process similar to what others have posted here.
Basically, you:

create new virtual disk with larger size
add that drive as a slave to your virtualbox
boot to gparted Live CD in virtual environment
use gparted to copy from old hd to new hd
mark new drive as bootable

One of the commenters on that article state that it took less than 15 minutes to go from 4GB to 10 GB, FWIW.
Comment: How do you make the drive bootable?
Comment: Ahhh!  Add the boot flag!
Comment: Not 100% related, but for anybody looking for similar instructions, but the guest os is centos/fedora/etc with a LVM partition, the instructions won't work. BUT, some nice fella posted instructions in the comments of the above mentioned page: http://www.modhul.com/2008/10/21/re-sizing-a-virtualbox-virtual-disk-image-file/#comment-1270  - the instructions worked for me
Answer: Here are alternate methods using one of the many live cds available, both commercial and open source, with a disk/machine cloning tool. (clonezilla, ghost, etc.)
Network cloning

Create a new virtual machine with a new empty disk. (20gb per your requirement)
Boot the old virtual machine to the cloning livecd iso image. Set up old virtual machine as source for cloning.
Boot the new virtual machine to the same livecd iso image. Set up new virtual machine as destination for cloning.
Clone system over virtual network. (This takes longer than disk cloning but it is practice for physical network cloning.)
Power off old virtual machine.
Reboot new/cloned virtual machine.

This method can also be used between two physical machines, each running Virtualbox. Or from physical to virtual or vice versa. Or for transferring between Virtualbox and Vmware, Virtualpc, Vmfusion, Xen, Kvm or any virtual client that can boot to a cd or iso image.
5gb is a little heavy but with a good connection even cloning over the internet is possible. I do this for linux clients often but the larger virtual disks I use are only ~700mb (used space), takes less than a hour - setup time included.
or
Disk Cloning

Create a new virtual machine with a new empty disk. (20gb per your requirement)
Add the disk created from the new virtual machine to the old virtual machine to use as the clone destination. Boot old virtual machine to livecd iso image.
Clone system on old virtual machine from the smaller disk to the larger disk.
Power off the old virtual machine. Remove the new/cloned virtual disk from the old virtual machine.
Start the new virtual machine.

These have the advantage of updating the virtual machine to the current version. (The virtual hardware and virtual machine file format may change with VM server updates.
This may cause new drivers to be "discovered" in a cloned client from an older version or from a different VM server.) Installing/Updating the VirtualBox client tools should now give you a current virtual machine with a larger drive and you'll still have your original virtual machine unchanged. Just don't run both virtuals at the same time. There may be naming collisions and license issues with windows.
In the case of windows products for virtual clients you may need to re-activate the new virtual. I haven't run into that but I'd heard from others that they had to. I think it has to do with how many things are changed at a time during the clone. (memory, cpu(s), disk, etc.)
Answer: One solution that you could probably do fairly easily is to just make a new 20GB virtual disk and then boot your VM off of a rescue disk and dd the 5G onto the 20GB and then boot off the 20G.
Answer: You can't, but you can clone it to a larger virtual disk. It's nontrivial but if you need to do it see this link
Answer:
Create a new disk at the size you want.
Connect the new disk to the original machine. You'll need to go into Windows disk manager to format the newly created disk so that windows can use it.
Use Acronis EasyMigrate to clone your original disk to the new one.
Close the Virtual Machine (once Acronis is done), detach the old drive, attach the new one (make sure you set it as IDE Master at this step).
Boot using your new bigger, cloned, drive...


What is the best way to get the latest version of R?

Question: A lot of instructions that I find on here give instructions about how to install the latest version of R that either deliver an out of date version, or are very OS-dependent.  I just bought a System76 computer using Pop_OS so I'm not sure which OS-contingent installation instructions I could adapt to my situation.
As I understanding just using the package manager, sudo apt-get install r-base delivers an out of date version that cannot install the ggplot2 package, so I can't solve my problem that way.
If I try to download from the main R site here, it has a configure and make file, but it requires a ton of dependencies and I struggle to know how to get them all.  I've already chased down three dependencies but now on X11 I don't know how to get it.  I'll start chasing that down in a minute, but with all of this "extracurricular" work, I'm wondering if maybe there is a better way to install this software.  Is there something I can do to just ... install all relevant packages?  Or is there something else I can download to try to install R in some other way, and yet still get the latest version?
Comment: Ok, the reason you are not getting much help, here, I think, is because we have trouble identifying the version of Pop! OS you are using, the version of R that you have installed and the version of ggplot2 you want. From what I see, System76 comes with Pop! OS 19.10, which should have R version 3.5.2 and https://packages.ubuntu.com/disco/all/r-cran-ggplot2/download wants 3.5.1 or higher.
Answer: Have a look at anaconda. I believe this would be very close to what you are looking
https://www.anaconda.com/distribution/
https://docs.anaconda.com/anaconda/user-guide/tasks/using-r-language/


Can you set up a monostable 555 timer so it reverses the output?

Question: I would like to make an alarm that goes off about 1 minute after it has been triggered. To do this, I want to delay the circuit using a 555 timer in monostable, but I can't do this as they turn it on for a certain amount of time and then off. Is there a way I could set up the 555 so that this is reversed? (I can't use a NOT gate as then it would be on while not being triggered) Or maybe another way this can be done?
Comment: Its's not clear what type of signal you are trying to achieve. You want it to be low by default and then high, or the inverse?
Comment: Can you draw a timing diagram of what you ae trying to do?
Comment: 1. What is your operating voltage? 2. will your trigger be momentary or continuous? 3. Will your trigger be high-going or low-going? 4. What load will the delayed output see? 5. Will you need a manual reset for the output or will power-down shut it off?
Answer: I think if you use a second 555, also connected as a monostable, but replace the timing capacitor with a short (and you don't need the timing resistor)-- triggered by the first one, that should work.
You could also use a D flip-flop such as a 4013 with the D tied high, but you'd need an inverter on the clock and a power-on reset circuit.
Or, something like this:

simulate this circuit – Schematic created using CircuitLab
C1/R3/D1 provides a semi-reliable power-on reset (100% reliable if the power turns on cleanly every time after a relatively long 'off' time where +V falls to near 0V).
C2 and R4 provide an edge trigger from the 555 output falling edge.
R1 and R2 protect the CMOS inputs
Answer: I solved it using random circuit digrams off Google Images, thanks for the answers. This is the circuit diagram I solved it with.

simulate this circuit – Schematic created using CircuitLab
The output goes to rest of the circuit, and discharge is not connected. This produces a low output for around a minute and a high output for an unlimited time. Thanks again.


Russell Lydian chromatic (again)

Question: One more question about Russell Lydian theory.
Russell uses as an example the Lydian C scale: C-D-E-F#-G-A-B-C comparing it with C maj scale, then he starts to explain his theory as if they belong to same key, otherwise why comparing C Lydian with C maj? This often happens with jazz theory, which confuses me as I was trained approaching harmony through keys (we actually use "tonality" as term - we gives key different meaning, such as bass key, baritone key, tenor key, etc). So, to me C Lydian belongs to the key of G (1 sharp). In fact, comparing the two modes, Lydian and Maj, he builds his theory on F of Cmaj and F# of Lydian (of course!).
Sometimes I also find theories in which Cmaj is related to C- as parallel and I find it quite odd, as there is not a direct relationship, as far as I know. Of course in music everything could be related, mostly depends on the sound that comes out, even more on who plays it.
Thanks to anybody who will be available to answer.
Comment: Does this answer your question? [Relationship between modes and keys](https://music.stackexchange.com/questions/72118/relationship-between-modes-and-keys)
Comment: I'm quite sure this question appeared several times in SE, perhaps someone can suggest even a better duplicate candidate.
Answer: I think historical context is important in understanding Russell's rationale here.
At that time in music theory (and even up until the present day), everything was related to the major scale. Russell comes along and makes the claim that, no, everything isn't related to the major scale, but rather to the Lydian scale.
Thus his explanations often start with the major scale because that's what he knows his readers will understand the most. Furthermore, by relating C Lydian to C major, he's able to highlight the major difference between his theory and those prior: that his main starting point includes that F♯, whereas others don't.
But you're correct: the parent scale of C Lydian is G major, and in that sense G major is "closer" to C Lydian than C major is.
Comment: What do you think about Bernsteins Fuga in the song Cool (also in the Ouverture) of Westside Story? Can we say this is written with in  the lydian concept? Would this be worth a question?
Comment: @AlbrechtHügli Russell would say everything in tonal music is written with the Lydian Chromatic Concept, whether the composers were aware of it or not. But to me using raised fourth scale degrees is not the same as the LCCOTO (how Russell abbreviates his own system).
Answer: If I understand correctly, you are asking whether C Lydian "belongs" to G major or "belongs" to C major.  I would say neither, or both, depending on what you mean by "belongs".  C Lydian uses the same notes as G major but the same tonic as C major.  Harmonically and melodically, though, it's different from both.
I think this is just a confusion about terminology.
Comment: Answers to this question require an understanding of George Russell's theory. Perhaps that can be added.
Answer: The lydian scale is built on Fa (FaSoLaTiDoReMiFa=WWWHWWH). In the key of C this is F-G-A-BC-D-EF, in the key of G this is C-D-E-F#G-A-BC.

So, to me C Lydian belongs to the key of G (1 sharp). In fact, comparing the two modes, Lydian and Maj, he builds his theory on F of Cmaj and F# of Lydian (of course!).

You are correct:
Lydian C is the IV. mode of the G major scale but quite different (melodically and harmonically) from the key of G major or C maj.
Maybe this link will help you further:
https://www.mcclimon.org/blog/reconceptualizing_the_lydian_chromatic_concept/
To complete the confusion we could say (instead of saying C lydian is the mode of the  4th degree of the  major scale=Ionian):
Each mode has its own row of halfsteps and wholesteps and its  root tone is its 1st degree. This is historical more correct! But referring all modes to the major scale - as exemple preferring C major - is for students educated in the system of the western major/minor tonality  as a pedagogical approach  probably better understandable.
So we have to differentiate whether we think and discuss within the theory of Russell (where CDEF#GABC is mode I ("major") or try to explain it to someone who comes from the traditional Western theory (where Dorian C is mode IV of the G-key.)
Comment: This answer doesn't appear to reflect knowledge of George Russell's theory.
Comment: @ Aaron: Tell me what's wrong here. I don't see any difference between my answer and the one of Richard. (except he mentiones that Russel refers to the C-key in respect of the students knowledge.  I'll add a uncommented copy of a reconceptualiazation of the LLCOT by M. Mc Climon
Answer: The connection between C major, C minor, and C lydian is they all have the same tonic of C.
C lydian and G major share the F# in their sets of tones, but they have different tonics. That matters, because relative to the two tonics you get differing chord types on the various scale tones. The big difference being the subdominant chord on the fourth scale degree. In G major you have (natural) ^4 and its triad is major IV. In lydian the subdominant is raised #^4 and its triad is diminished #ivo. So, while superficially the two sets of tones are the same, their tonal structures are different. And, of course, their tonic chords are different C major and G major. Simply put, they are not the same tonalities.
If you compare the parallel tonalities, the C major, C minor, and C lydian, the ones that all have the same tonic, we will see some similarities. All three have a perfect fifth above their tonics, and a major triad can be built in all three, so all three have the same dominant chord of V. And the tonic chords are the exact same between C major and lydian: I. The tonic chord in C minor differs only in the third being minor, but the tonic and dominant scale degrees are the same as C major and lydian. Those two scale degrees being tonal degrees means the main tonal foundation is largely the same. Not exactly the same, but there is significant overlap.
So, instead of just look at a set of tones, like E F# G A B C D E, and then saying it's G major, or C lydian, or E minor, or A dorian, etc. etc. Look at the tonic, take note of what the tonal scale degrees are, and then note the modal scale degrees. Tonic, subdominant, and dominant scale degrees separated by perfect fourths/fifths is an essential tonal concept. That makes lydian and locrian modes the odd ones out, because they don't have all three of those tonal degrees.
As far as Russell is concerned, I haven't read his book, but I understand he gave significance to the raised fourth and lydian, because of the harmonic overtone series which contains that interval up high is the overtones. But you don't need that to explain the use of augmented fourths in jazz. They were used before Russell. The French augmented sixth chord features it and that chord is in the original song I Got Rhythm. Debussy used the augmented fourth, I think especially from the whole tone scale, and his music inspired jazz harmony. An augmented fourth can be enharmonically spelled as a diminished fifth, a flat fifth, and that's famously used in Take the A Train. Russell didn't invent or discover something new. The tritone has been used for a long time in different styles.
His idea that "lydian mode" is a more natural tonality than major just adds confusion in my opinion. Most of what I see of lydian in jazz harmony is decorative, stuff like "play a lydian dominant scale over a dominant chord", meanwhile the song's chord changes may use roots of a natural subdominant, which means the song isn't actually in a lydian mode. If I actually saw songs with #ivo chords, I would think differently about Russell's idea.
Comment: ...and the _reason_ for down voting?
Answer: "Finally, I realized that because of the first four tones of the C-major scale, the
C major-scale could in no way be in unity with that C-major chord because of
the Do, Re, Mi, and Fa, Fa itself was a Do. That doesn't sound Do, a "C" Do,
that sounds the Fa Do. But what led me to play the G-major scale was that the
second tetra chord of C-major scale is G-A-B-C, and that does sound C. The
following tetra chord in G is D-E-F#-G, and that at least resolves to a tone that
is in the C-major chord. So it led me to say, "Well, let's try the G-major scale."
As I said, I began to accept the G-major scale as actually sounding closer to
the tonality of a C-major chord than the C-major scale. The problem, thinking
practically, how can I tell musicians if you see a C-major chord, play a G-major
scale? So then I began to understand that the first mode of the G-major scale,
the Ionian, playing that with the chord presented this problem of having musi-
cians playing a G-major scale. Then the Dorian, the same problem, kind of.
Then the Phrygian, finally the Lydian—C-D-E-F#-G-A-B. I said, "I don't care
what anybody says; this isn't just the Lydian mode of the G-major scale, this is
the C-Lydian scale, the closest scale to the C-major chord."
Carr, interview with G. Russell, June 1992.
Source: George Russell: The Story of an American Composer
(African American Cultural Theory and Heritage)
Series Editor: William C. Banfield
https://www.amazon.com/George-Russell-American-Composer-Cultural/dp/0810869977
The confusion comes from the point that Do means the root tone of the Ionic scale DoReMi, but he pretends (or starts from Do) and says the Fa must be a sharpened IV = Fi  ...
(mind that even some of his closest "followers" said, the LCC could be explained or described in the language of the traditional western music theory!)
What Russell wants to say is:
The root tone of his LCC is the Do of the lydian scale - in C this is C - (using the notes of "our well known" western G-major scale  but this  he explicitely denies: ths is not IV of G, it is I or Lydian C with the F#! Russell's approach is not a misconcpetion of the western theory: imho it is also a rebellish  expression of the afro-american musician and composer against the dominance of western ("white") music culture but also a "traite" of an new (old) music theory - comparable with Debussy, Ravel, Schoenberg, Stravinsky, Bartok, Messiaen and others.
One departing point is the development of the lydian scale from the circle of perfect fifths - another point is that (jazz) music is rooting in the African music.
Comment: I dig the music... not the theory. I think your point about Russell wanting to write a _rebellious_ theory, a non-Western theory, is on the mark.
Comment: It's funny that, from the quote, Russell is concerned with a leading tone up to the fifth of the tonic chord, but not with a subdominant FA resolving _downward_ to the third of the tonic chord.
Comment: That may be that he heard Fa as root note (Fa=Do),  in his concept (way of listening) Mi will be leading tone to Fa ;)
Comment: I think your making a joke. But, if one really doesn't take lydian as the principle tonality, it seriously undermines dominant harmony and the tritone TI/FA. Given the importance of dominant harmony in jazz and with the tritone substitution, lydian tonality doesn't make much sense. It's like a theory for a problem that never existed.
Comment: *seriously undermines dominant harmony and the tritone TI/FA*. I think that's exactly his intention! I'think also of Schönberg and Bartok.
Comment: Concerning *joke*: when Richard mentioned the other day, Russell said, the national anthem is lydian - because of the Fi in the semi clause in the beginning - I think this must have been a joke! ( by Russell. Otherwise he didn't understand the western music theory at all! Btw. did you listen to Russells music? e.g. Jazzworkshop? https://youtu.be/1ghDO_n3o3Q

Russell Lydian chromatic (again)


Showing the convergence of the given recursively defined sequence

Question: Let $(a_1) = 1$ and $$(a_{n+1})= \frac{4+3a_n}{3+2a_n}$$
It is required to show that the following recursively defined sequence converges. I know one way to show this converges. Define $$f(x)= \frac{4+3x}{3+2x}$$ on the set of non-negative reals(which is closed hence complete). It is easy to show that $f'$ exists and $|f'(x)|<1$ hence it is a contraction and by the fixed point theorem has a unique fixed point. Is there any easy way to show that this converges using only the basic theorems on limits. All my attempts have failed so far. Any solutions will be highly appreciated.
Comment: Replace $a_n$ and $a_{n+1} $with $l$...this is the limit. The sequence is monotone and bounded...
Comment: Can you provide a detailed solution?
Comment: I am afraid not.  I am at beach right now and it is really painful to write Mathjax with smartphone...If there is a limit it should be sqrt(2).
Answer: $$(a_{n+1})= \frac{4+3a_n}{3+2a_n}= 1+\frac{1+a_n}{3+2a_n}$$
the sequence is bounded increasing  so the limit exist and
$$l= \frac{4+3l}{3+2l} \Rightarrow 3l+2l^2=4+3l \Rightarrow  l^2=2  \Rightarrow l=\pm \sqrt{2}$$
as the limit is positive so $l=\sqrt{2}$
Comment: That the function is increasing doesn't necessarily mean the sequence is increasing.
Comment: @Bernard Thank you, i have edited it
Answer: This is a homographic sequence. The strategy is to express $a_{n+1}-a_n$ in function of $a_n-a_{n-1}$.
First rewrite $f(x)$ in canonical form (obtained by Euclidean division of $3x+4$ by $2x+3$:
$$\frac{4+3x}{3+2x}=\frac32-\frac1{2(3+2x)}.$$
We obtain
\begin{align}
a_{n+1}-a_n&=\biggl(\frac32-\frac1{2(3+2a_n)}\biggr)-\biggl(\frac32-\frac1{2(3+2a_{n-1})}\biggr)\\&=\frac1{2(3+2a_{n-1})}-\frac1{2(3+2a_n)} %\\[1ex]
=\frac{a_n-a_{n-1}}{(3+2a_{n-1})(3+2a_n)}.
\end{align}
As $a_1>0$, it is easy to see all $a_n$ are positive. from this relation, we draw two conclusions:

$a_{n+1}-a_n$ and $a_n-a_{n-1}$ have the same sign for all $n$, hence the sequence is monotonic, and ac tually increasing since $a_2>a_1$.
$0<a_{n+1}-a_n <\frac19(a_n-a_{n-1})$, so that $a_{n+1}-a_n <\frac1{9^{n-1}}(a_2-a_{1})$ and
$$a_n-a_1=\sum_{k=1}^{n-1}(a_{k+1}-a_k)<\sum_{k=1}^{n-1}\frac1{9^{k-1}}(a_2-a_1)<\frac98(a_2-a_1)=\frac9{20}$$
and finally $\; a_n=(a_n-a_1)+a_1<\frac{29}{20}$ is a bounded increasing sequence. Therefore it converges.

By continuity, the limit is a non-negative root of the equation
$$x=\frac{3x+4}{2x+3}\iff x^2=2.$$