Should an XML Schema be specified in a software specification?

Question: Would you include an XML schema for a new file format in a software specification document or would you consider this too specific? Or would it be already too specific to require XML at this point?
Answer: If it's a high-level specification which just says "System X will do task Y with file Z", then yes, it's too specific. If it's a detailed spec that says "System X will implement a web service to perform task Y using XML file Z that is sent from client system A", then yes, you should include the schema. It does not have to be in the main document, but make sure it's in an appendix somewhere so readers can get the right idea.
Comment: +1: especially if the XML defines an interface to a legacy system.
Answer: If the schema already exists, then I don't see why you wouldn't want to specify that your system must use a particular schema (and version of that schema) for data storage or transfer. This sounds like a non-functional requirement to me, specifically what Karl Wiegers refers to as either a Software Interface Requirement or a Communications Interface Requirement.
However, if the schema is to be constructed, then the requirement itself should not even specify that XML is used to store and transfer data, but the constraints should be documented elsewhere in the requirements document(s). In this case, the requirement should be written to inform the developers of what must be accomplished, giving them as much room to make design decisions as possible. Again, the SRS template provided by Karl Wiegers has sections titled Operating Environment and Design and Implementation Constraints where you can specify various considerations that developers must be aware of when making the system.
Answer: XML schema is part of the design because the way schema is designed affects the algorithms of reading, writing and searching which have impact on performance.

If by specification you mean Requirement specification then the answer is No it should not be there. Requirements specifications should not refer to file formats unless they are constraints from the environment like when they are needed for data interchange with another system in this case it should be included.
If you mean Design specification then Yes it must be included. However if the system is complex or large and design is split into "High Level" (Architecture) and "Detailed Level" then it should be included in the Detailed Level Design only. High Level design should only mention that XML technology should be used for storage.

If the system is simple and the schema design will have no great impact on performance or in case the schema is straight forward generated by a software component you may just skip it.
Answer: Well like anything else, "it depends". If the interface is essential to your product/project and the details of the specification will influence a lot of work that needs to be done within or outside your team then absolutely I'd specify it up front.
Answer: If the XML Schema constrains data/documents on the boundary of your system then they can be referenced by the document that defines the system interfaces. Some projects refer to this as the Interface Control Document (ICD).
The ICD distinguishes between supplied and provided interfaces and acts as a kind of contract between your system and one or more other systems.


According to game theory, are people trustworthy?

Question: According to philosophical presumptions of game theory, are people trustworthy if there are incentives (profit and less loss) involved in lying? And if this question isn't entirely accurate as a philosophical question, where are the faulty assumptions?
Comment: Edited to emphasize the request for philosophical clarification.
Answer: People have incentives to tell the truth, and to lie. Agents within a system will use different strategies, and face different consequences. The whole point of game theory is different Nash equilibria might emerge, depending what strategies predominate.
If total trust is assumed, but violation of trust has few consequences, that incentivises lying, and could allow catastrophic consequences from one liar. On average, higher levels of trust will allow for more cooperation, and we would expect cultural systems that help ensure that to spread - eg the 'panopticon' quality of believing we will be judged at death will spread (& is close to a cultural universal).
Trustworthiness is a strategy. Agents will have a mix of strategies.
Comment: Thanks! Do you think we should apply as a default Pr(Lying | Human who has incentives to lie) < 0.5?
Comment: @Philosophy101: It depends entirely on context. Surely use Bayesian inference, &  factor in costs or problems if you get it wrong.
Answer: Game theory models how people behave in terms of incentives. That's useful in a wide variety of contexts, whether talking about ecological systems, individuals, corporations, or nations. "Game theory" doesn't have any opinion on whether people are trustworthy anymore than it has an opinion on what color cars should be.
However, if you use game theory for something, then you are taking the stance that it's useful to model or predict people's behavior in terms of their incentives. If their incentives don't include anything that you would consider "trustworthiness", then you probably don't consider them that trustworthy. Of course, you could also model trustworthiness as an incentive.
From here, you can ask more philosophical questions. If you define a system in which cheating is punished, and people behave, does that count as trustworthy? Maybe as the rules designer, you need to earn the people's trust for them to follow the rules. Tough questions!
I'll give you a short, opinionated answer: people are more selfish than trustworthy but they are capable of coordinating broadly according to their relationships, laws, culture and religious beliefs, which makes them somewhat trustworthy.
Answer: Short Answer
First, this is not a question of human nature and people, but a model of modeling human behavior with the mathematical models of game theory. So while it may seem pedantic, it is important to distinguish between actual human people and the fictional agents that model people. However, like real life which it attempts to model, generally game-theoretic agents (fictional people) are not trustworthy in the face of a preponderance of incentives to lie (like actual people are known to do).
Long Answer
According to the WP article on game theory:

Game theory is the study of mathematical models of strategic interaction among rational decision-makers.

Again, there's an important philosophical distinction to be made between models and reality. It is a plain fact that the map is not the territory. The question, therefore, is 'Is it rational for a decision-maker to lie if there are adequate incentives?' The answer to this is a simple 'yes' with the caveat that one properly defines what it means to be a rational decision-maker. This is yet another important philsophical distinction, because it hinges upon the philosophical question 'What is reason?' This is no small ask since human reason is defeasible and somewhat difficut to characterize. The most widely used term I am familiar with to model an actual person with a fictional model in this context of modeling human behavior is the pseudo-Latin *Homo economicus*. From the article:

The term homo economicus, or economic man, is the portrayal of humans as agents who are consistently rational, narrowly self-interested, and who pursue their subjectively-defined ends optimally. It is a word play on Homo sapiens, used in some economic theories and in pedagogy.3... The rationality implied in homo economicus does not restrict what sort of preferences are admissible. Only naïve applications of the homo economicus model assume that agents know what is best for their long-term physical and mental health. For example, an agent's utility function could be linked to the perceived utility of other agents (such as one's husband or children), making homo economicus compatible with other models such as homo reciprocans, which emphasizes human cooperation.

Thus, the answer to your question is generalized because if one addresses the nature of preference, one can model altruism and have a rational decision-maker embody Homo reciprocans. In fact, there are entire theories devoted to forms of altruism like the biological altruism of sociobiology. The fact that human beings are not actually well-modeled by Homo economicus is a major thesis of Daniel Kahneman and Amos Tversky and is discussed at length in Thinking, Fast and Slow.
Comment: Thanks a lot! I really wonder how Gullibility is applied in game theory?
Comment: 'Gullibility' specifically is subject to any discussion within the context of the game about how knowledge and truth work. Game theory broadly speaking is concerned about modeling decisions mathematically that agents make pursuing their goals. The discipline that is often employed in preventing gullability is known as [intelligence analysis](https://en.wikipedia.org/wiki/Intelligence_analysis). While Hollywood often portrays intelligence analysis as spycraft as if it were the work of James Bond, most people employed to make decisions are simple analysts who sit behind the desk...
Comment: they get paid not to be gullible. The world's largest employer of mathematicians, for instance, is the NSA. So, if one applies game theory to competition between nation states, one winds up creating positions like the [Director of Intelligence](https://en.wikipedia.org/wiki/Central_Intelligence_Agency#Directorate_of_Analysis). Why? To root out gullibility!
Comment: oh, and my boilerplate: Welcome to SE Philosophy! Thanks for your contribution. Please take a quick moment to take the [tour](https://philosophy.stackexchange.com/tour) or find [help](https://philosophy.stackexchange.com/help). You can perform [searches here](https://philosophy.stackexchange.com/search) or seek additional clarification at the [meta site](https://philosophy.meta.stackexchange.com/). Don't forget, when someone has answered your question, you can click on the arrow to reward the contributor and the checkmark to select what you feel is the best answer.
Comment: Good luck in your intellectual travels.
Comment: Many thanks J D!


Is it possible to change the text font in Marketing Cloud?

Question: Is it possible to move the Media image from bottom-right to the left of the Push notification.
and is it  possible to change the text font in Marketing Cloud?
Answer: In Android, you can take full control of the notification displayed on your device.  If Google allows for the customizations you seek, then you can do whatever you like.  (ref. https://salesforce-marketingcloud.github.io/MarketingCloudSDK-Android/notifications/customize-notifications.html)


Getting list of startup application in linux

Question: I want to get list of applications which run at start up using terminal. In windows we can use msconfig.
is there any command i can use to show startup applications?
Answer: You did not specify your distro; however, in Ubuntu and Debian you can find these applications by running:
ls /etc/init.d

All the files in this directory are actually links to the applications and on boot the OS goes through this directory and starts them all.
Answer: sudo systemctl list-unit-files --type=service --state=enabled --all
Comment: It would be nice to see some explanation to this commant.
Answer:
/etc/init.d/

Includes Linux init scripts only.
To list all AutoStart Applications in gnome, list all files under "autostart" directories. e.g.:
find / -name "*autostart*"

ls -1 "/etc/xdg/autostart" "/home/$USER/.config/autostart" "/usr/share/gdm/autostart"  "/usr/share/gnome/autostart"

To list all systemd services:
ls -1 /lib/systemd/system/*.service /etc/systemd/system/*.service

Answer: The systemctl is the init system used by Ubuntu and other Linux distributions and it only lists systemd units. On Linux machine not all services are managed by systemd, neither they are listed under service units. Therefore, it is among other means to check for a specific task or a daemon.
Other applications are started by a desktop environment or a window manager after logging in. The autostart configuration files are located in different places depending on your display manager and desktop environment. Please refer to their documentation. The common locations are,
~/.config/autostart/
/etc/xdg/autostart/

This would be the case if the application is started as a parent process, otherwise, you should ps aux | auto_starting_application where auto_starting_application is the application you are looking for, then note its PID and pstree -p PID_of_auto_starting__application to find out which parent application started this application.
Answer: Startup-Watcher
Cap list and watch startup applications, scripts and servies


In Record Triggered Flows, how do I get created records only (not updated records)?

Question: I set up a master record-triggered flow and the trigger is when a record is updated or created. I have two subflows. In one subflow I want to pass updated records, and in the other subflow I want to pass newly created records. For the first subflow, I can easily check any Record_Prior's field and compare it to Record's field and know that the record was updated. However for the second subflow, how do I filter for only newly created records? I tried to add a Decision element to check if Record_Prior.Id is null, but that did not work. What is one way to filter for created records only (NOT updated records)?
Comment: Did you try using the `ISNEW()` formula?
Comment: @kris goncalves that didn't work in my case. The createddate 'is changed' check did not work in a Decision element. The solution referenced instructs to put the 'is changed' check in the entry (Start) condition, but I need to have no conditions in the Start element.
Comment: @diego YES it worked! Here's what I did - I created a new formula resource (boolean). The body of this formula is just ISNEW(). Then in a Decision element I evaluated if this resource equals true and Voilà!
Answer: You could potentially use an input variable in the subflow that you set from the main flow to store the id's of any new records identified in the main flow, then check for matching id's in the subflow.
Comment: How would I make the main flow identify new records? Currently any record that is either created or updated enters the main flow since the trigger criteria is when a record is updated or created.
Comment: I have not used this myself yet, but I believe record triggered flow support ISNEW() - https://help.salesforce.com/s/articleView?id=release-notes.rn_automate_flow_builder_record_triggered_flow_formula_functions.htm&type=5&release=232


Why can we always define the Lagrangian Density this way?

Question: Learning some field theory, and many authors just claim "it is nice to express the Lagrangian as an integral $L = \int\mathcal{L}\,\mathrm{d}^3x$." Now I understand when dealing with fields, the sum's over all the particles turn into integrals and hence $L$ is an integral over space, but is that ALWAYS the case? Could I possibly have a Lagrangian who wasn't the integral of anything?
Comment: A single-particle Lagrangian is not typically the integral of anything. I'm not sure I understand the question.
Comment: does the OP maybe mean that you always define the action $S$ as an integral over time / integral over time and space of a lagrangian density?
Answer: In fundamental physics, we traditionally assume that the action functional is local, cf. e.g. this Phys.SE post.
However, there exist ideas that a local Lagrangian formulation is not always the most efficient description, cf. e.g. the amplituhedron formulation of planar pure ${\cal N}=4$ SYM by Arkani-Hamed et al.
Other theories are bi-local, see e.g. this Phys.SE post, or even more non-local.
Answer: Ultimately, we want to work with relativistic field theories. To achieve that, the usual Lagrangian $L=L(\mathbf{q}(t), \dot{\mathbf{q}} (t), t) $ is not good enough. The Euler-Lagrange equations are:
$$ \frac{\partial L}{\partial q_j} - \frac{d}{dt} \left( \frac{\partial L}{\partial \dot{q}_j} \right) = 0$$
You could also write it as
$$ \frac{\partial L}{\partial \mathbf{q}} - \frac{d}{dt} \left( \frac{\partial L}{\partial \left( \frac{d\mathbf{q}}{dt} \right) } \right) = 0 $$
This is obviously not Lorentz invariant. We need some Lorentz-scalar $\mathcal{L} = \mathcal{L} (\phi (x), \partial_\mu \phi (x))$ which satisfies:
$$ \frac{\partial \mathcal{L}}{\partial \phi} - \partial_\mu \left( \frac{\partial \mathcal{L}}{\partial (\partial_\mu \phi)} \right) = 0$$
This $\mathcal{L}$ is usually called the Lagrangian density and it satisfies:
$$L = \int d^3 x \mathcal{L} $$
That's basically it, in simple terms.


Ubuntu 16.04 with MATE desktop - task bar graphical corruption

Question: I'm using Ubuntu 16.04 with the MATE desktop (Mate Desktop 1.8.2).  (I use Ubuntu 16.04 for work since it's the version running on our server).
This problem only started happening in the last month or so, and now it happens a few times a week:  the taskbar at the bottom starts to become graphically corrupted.  At first it all appears fine, but doesn't update when I click on a different application.  Often it has a sort of wide grey triangle on it, and then usually turns full gray except for the time, which is still accurate, and a desktop icon on the left, which no longer works.  I can always fix it by rebooting but i'd prefer to not have to do this.

Despite the graphical problems, it still seems to work - i can click in various different places and it does switch to the different apps.
I've tried this, following this post: https://askubuntu.com/questions/125662/how-to-reset-gnome-panel
dconf reset -f /org/gnome/gnome-panel/
killall gnome-panel

but there is no gnome-panel process running (I tried kde-panel but that's not running either).
I was able to reset the panel, by doing this:
mate-panel --reset

This didn't fix the problem, it just meant that after I rebooted all of my customisation (just app launcher shortcuts next to the Start button) was gone and I had to set it all up again.
Any ideas anyone, as to what might be causing this and how to address it?
Answer: After some googling, and trying lots of things, I found this, which did work:
killall mate-panel


Library seach boxes not showing for some users

Question: I have a sharepoint library which includes a filter/search box for each field. The search boxes were built by a 3rd party so I'm not sure how they are programmed. They are view specific.
These boxes don't show up for a few of my staff, one of who (accounts officer) really need them to make her job less frustrating.
Myself and the IT manager are at a loss.
We use vmware vm's and the vm's I use and the accounts officers vm are provisioned from the same image so we can discount software issues.
We reset internet explorers settings on both my vm and hers which made no difference, I can still see and use the search boxes but she cannot.
We tried chrome, in chrome I can see these boxes but she cannot.
The search boxes appear at the top of each field in the library but under the field name.
I'm just looking for somewhere to look to try and solve this, any help or ideas would be greatly appreciated.
Answer: Given these search boxes are from a third party, it's possible they may require some permissions she's lacking. Try elevating her permissions to site admin temporarily and see if that makes a difference. If it does, you just need to hunt down what she needs additional access to.
Comment: Thanks for that, I checked and she's site owner already which is the same level as myself. Other staff who have lower permissions have access.
I've been trying to find the coding for the search boxes through sharepoint designer but I haven't had any luck so far.


Doubts related to speed of sound in different mediums

Question: since childhood we have been taught that sound travels faster in solid (most dense) as compared to liquids (less dense). and speed of sound is greater in liquids as compared to gases (least dense), sound can't travel in vacuum (0 density). and we were knowing the fact that speed of sound in moist air is more than dry air. and the reason we built was that more dense more speed.
but recently i came to know that dry air is more dense than moist air .. why is this breaking the logic?
pls help
Answer: It's to do with the fact that the dryness (humidity) of the air depends on temperature and the speed of sound in air also depends on temperature, see
https://www.nde-ed.org/Physics/Sound/tempandspeed.xhtml
which has this equation
$v=331+0.6T$
Dry air is typically at a lower temperature than humid air.  So even though it may be more dense, the overall effect is that the speed of sound can be lower in dry air.
To imagine why warm air can hold more moisture than cold air -  imagine a tray of water on a table in a cold room, not much water evaporates and is held by the air.  In a warm room the water would quickly evaporate and be held by the air.
Comment: The speed of sound in an ideal gas depends on its molecular weight. The MWs of oxygen (32) and nitrogen (28) are both significantly higher than water vapour (18) so the "MW of air" depends on the moisture content.
Comment: thats right but i am taking temp. to be same .. as @alephzero said this is the reason given in my textbooks . so according to this more dense less speed and vice versa(indirectly related) ,.. so why is this not applicable in solids. solids are significantly denser than gas but velocity in solids travel faster (directly related since more density more speed of sound) i am confused
Comment: i am studying speed of sound formula which was given by newton and corrected by laplace.. and i take temo to be same
Comment: https://imgur.com/a/tM7sIoI (<--- see this) why is this fact in contrary ti the fact that speed of sound is most in solids(even though density is very high)
Answer: The speed of sound in an ideal gas is $$c = \sqrt{\frac{\gamma k T\strut}{m}}$$
where $k$ is Boltzmann's constant, $T$ is the absolute temperature, $m$ is the mass of one molecule of the gas, and $\gamma$ is the "adiabatic index" which depends on the number of internal modes of vibration of the molecule.
Dry air is mostly a mixture of oxygen ($m = 32$) and nitrogen ($m = 28$) using atomic weight units for $m$. Oxygen and nitrogen are both diatomic molecules, and $\gamma = 1.4$.
Water vapor has $m = 18$ and is triatomic, with the three atoms in the molecule not arranged in a straight line, and $\gamma = 1.333$.
At the same temperature, the speed of sound in each gas is therefore proportional to

Gas
$\sqrt{\gamma/m}$

Oxygen
0.21

Nitrogen
0.22

Water vapor
0.27

so the speed of sound in a mixture of the three gases (i.e. "air") is higher as the water vapor content increases.
Answer: The speed of sound is given by : $\sqrt{\dfrac{B}{\rho}} $.
$\rho$ is the density and B is the bulk modulus of elasticity.
The speed of sound is higher for moist air since its density is lower.
This is because the speed does depend inversely on the square root of the density.
The speed of sound for liquids in general is higher than it is for gases because
the elasticity of liquids (Bulk Modulus) is higher.
A liquid has a higher elasticity since it is difficult to compress compared to
a gas.
To get a comparison of the numbers involved,
The bulk modulus of air ranges from about $\sim$ 1-1.5 $\times 10^5 $ Pascal,
and the bulk modulus of water is $\sim$ 2 $\times10^9 $Pascal
so the ratio of the bulk modulus of water to that of air $\dfrac{B_{water}}{B_{air}}$is atleast 10000.
The density of water is $\sim$ 1000 kg/m^3 and the density of air is $\sim$ 1 $kg/m^3$ and so the density of air (dry/moist) is about 1000 times smaller than the density of water. i.e $\dfrac{\rho_{water}}{\rho_{air}}$ $\sim$ 1000.
Since the ratio $\dfrac{B_{water}}{B_{air}} > \dfrac{\rho_{water}}{\rho_{air}} $,
the speed of sound in water is greater than that in air.
Answer: It's actually a common myth that density is responsible for the speed of sound in a medium. The belief is that the speed of sound is higher in more dense mediums, and slower in less dense mediums. If this is the case, why is the speed of sound faster in less dense helium gas than it is in air?
Popular science YouTuber Cody'sLab explained how the speed of sound works in his video Thunderground 2: Artificial Thunder
(explanation starts at 4:56). To summarize his points, he explained that the speed of sound actually depends on the strength of the intermolecular bonds of the material. For a sound wave to propagate, the atoms must be displaced, and then return to their original position. If they don't return, the energy is absorbed and the wave stops. The faster and more efficiently they return (via the pull of stronger intermolecular bonds), the faster the propagation of energy and therefore speed of sound is.
It's generally true that solids have stronger intermolecular bonds than liquids which have stronger ones than gases, which is why the speed of sound approximately correlates with density. It's not a direct causation though, as the helium example demonstrates.


Primitive roots of $25$

Question: I'm kind of struggling with the concept of primitive roots with non primes, specifically for $25$ in this case. I was calculating the sequences $2^x \pmod {25}$ and $3^x \pmod{ 25}$ for each $x$ up to $25$ but at $x = 20$ it starts repeating and I see that the numbers that can't be obtained are those that aren't coprime with $25$, but then I don't see how $2$, $3$ and the others can be primitive roots since there are some numbers in the residue class that you just can't obtain from the roots. What I would have concluded is that non primes simply do not have primitive roots. Am I missing something in the definition of roots here?
Comment: Oh, so that's the full definition I was lacking. I do understand the ring terminology as well so that's good. Thanks!
Comment: I think it is common to refer to a number $a$ as a primitive root modulo a prime power $p^n$ exactly when you get all the residue classes coprime to $p$ as powers of $a$. In other words $a$ is a generator of the group of units $\Bbb{Z}_{p^n}^*$ of the residue class ring. That last sentence may contain terms you have not yet heard - I just wanted to make this precise in a different language. Anyway, you don't appear to be missing anything. It is impossible to get residue classes divisible by $p$ as powers of those that aren't. For this reason the definition of *primitive* is modified.
Comment: A primitive root (if there is one) is a primitive element of $\mathbb{Z_n^{*}},\;$ and the order of this group is $\varphi(n)$.
Answer: Powers of odd primes do have primitive roots. Moreover, if $g$ is a primitive root mod $ p$, then $g$ or $g+p$ is a primitive root mod $p^n$.
$2$ and $3$ are primitive roots mod $5$ and so one of $2,3,7,8$ is a primitive root mod $25$. It turns out that $2,3,8$ work but $7$ does not.
Comment: Actually, 7 is not a primitive root mod 25.
Comment: @wendy.krieger, I said "one of"...
Answer: Prime powers do have primitive roots.  Simply adding $p$ to a known primitive root does not always guarantee a primitive root.
For example, 2 is a primitive root of 25, since it cycles through all of the twenty possible answers before returning to 1.  On the other hand, 7 is not, because it only cycles through just four values (7, 24, 18, 1).
There are a smattering of primes where the smallest primitive root of p is not a primitive root of p^2, but they're pretty rare.
Answer: Using  Number of consecutive zeros at the end of $11^{100} - 1$.
Multiplicative order ord$\displaystyle_{p^s}a=d\implies $ord$\displaystyle_{p^{s+1}}a=d$ or $p\cdot d$ where $p$ is an odd prime, integer $s\ge1$
ord$_5(2)=4\implies$ ord $_{25}(2)=5$ or $5\cdot4$
Now, $2^4\not\equiv1\pmod{25}\implies$ ord $_{25}(2)=5\cdot4=\phi(25)$
In fact from Order of numbers modulo $p^2$,
ord $_{25}(2+5r)=5\cdot4$  for $0\le r<5,r\ne1$
as $7^2\equiv-1\pmod{25}\implies7^4\equiv1\iff$ord$_{25}7=4$

Primitive roots of $25$


Book for Machine Learning

Question: Is there a book analogous to Introduction to Algorithms (CLRS) for Machine Learning, that covers all the models and explanations comprehensively?
Comment: I don't think such a book exists.  I certainly don't know it.  Deep learning is an area of active ongoing research, so there can't be an encyclopedic reference on that.  If you search amazon "deep learning' in books, the 3 top (actual) deep learning books are yet to be released.  For topics other than deep learning 2 standard and (imho) very good references are Elements of Statistical Learning by Hastie, Tibsharani, and Friedman and Machine Learning a Probabilistic Perspective by Murphy.
Comment: Just to clarify, when you say "all the models" do you just mean all types of neural nets?
Comment: No, everything from rudimentary logistic regression to deep learning.
Comment: @aginensky +1 for Hastie
Answer: My recommendation is Applied Predictive Modeling by Max Kuhn. This book covers all the major regression and classification models, as well as some lesser known models, such as Cubist and C5.0. While the text does not cover deep learning, it does cover caret, which is Kuhn's R package. The caret package contains several deep learning models (e.g. stacked autoencoders) as well as many other classification and regression models.
Comment: This is a great book (I have even bought a copy of it) but I do not think it is good for what the OP wants. It is far too applied to be assumed that it "*covers all the models and explanations comprehensively*".

Book for Machine Learning


Orthogonal Factorization Systems and functoriality

Question: In definition 1.1 of these notes on factorization systems, (III) calls the factorization functorial if given the solid diagram described, there's a unique horizontal arrow making both squares commute. Why does this deserve the name 'functorial'?
Answer: Let $[n]$ denote the category $0\to 1\to\cdots\to n$. Given a factorization system $(L, R)$ in a category $\mathcal{C}$, we can choose a map $F_0\colon\operatorname{Ob}\mathcal{C}^{[1]}\to\operatorname{Ob}\mathcal{C}^{[2]}$ which maps an object $x\xrightarrow{f} y$ in $\operatorname{Ob}\mathcal{C}^{[1]}$ to an object $x\xrightarrow{e} E\xrightarrow{m} y$ in $\mathcal{C}^{[2]}$ such that $e\in L$, $m\in R$ and $f=me$.
If your factorization system is functorial, this extends to a functor $F\colon\mathcal{C}^{[1]}\to\mathcal{C}^{[2]}$ mapping a morphism $(u,v)$ in $\mathcal{C}^{[1]}$ to a morphism $(u,\omega,v)$ in $\mathcal{C}^{[2]}$ where $\omega$ is the unique morphism required in (III), making the respective diagram commutative. The uniqueness guaranties that $F$ is indeed a functor, i.e. that given two morphism $(u,v),(u',v')\in\mathcal{C}^{[1]}$, we have
$$
F((u,v))\circ F(u',v') = (u,\omega,v)\circ (u',\omega',v') = (u\circ v',\omega\circ\omega',v\circ v') = F((u\circ u',v\circ v'))$$
Also note that even though the choice of $F_0$ is not unique, (III) guarantees that it is unique up to isomorphisms. To prove this, take two factorizations $(e, m)$ and $(e',m')$ of the same morphism $f$ and consider the diagrams
$$
\require{AMScd}
\begin{CD}
 x@>\operatorname{id}>> x @>\operatorname{id}>> x\\
@V{e}VV @V{e'}VV @V{e}VV \\
E@>\omega>>E' @>\omega'>> E \\
@V{m}VV @V{m'}VV @V{m}VV\\
 y@>\operatorname{id}>> y @>\operatorname{id}>> y
\end{CD}
$$
and
$$
\begin{CD}
 x@>\operatorname{id}>> x\\
@V{e}VV  @V{e}VV \\
E@>\omega'\circ\omega>> E \\
@V{m}VV @V{m}VV\\
 y@>\operatorname{id}>> y
\end{CD}
$$
By (III): $\omega'\circ\omega$ is unique, hence $\omega'\circ\omega = \operatorname{id}$. Thus our factorization functor $F$ is determined up to isomorphisms, and it makes sense to talk about the associated factorization functor.
Comment: Quick question - in the last sentence you say $F$ is determined up to isomorphism, but it seems $F$ is only determined up to isomorphism object-wise, i.e $F(u,v)$ is determined up to iso for each object $(u,v)$. Why is it true that all extensions are naturally isomorphic as functors?
Comment: @Arrow I thin you mixed something up here. $F_0$ is uniquely determined up to isomorphisms and only defined on objects $x\xrightarrow{f} y$ in $\mathcal{C}^{[1]}$. The extension to a functor $F$ is then given by mapping *morphisms* $(u,v)$ in $\mathcal{C}^{[1]}$ to morphisms $(u,\omega, v)$. I'm not sure right now if this extension is unique, or if you could do something weird like sending all morphisms in $\mathbf{Grp}^{[1]}$ to those mapping everything to the neutral element. But it's at least the unique natural extension. Where uniqueness is guaranteed by (III).


How to get list of subscribers whose subscriber status had changed in Salesforce Marketing Cloud?

Question: Use case is to update the subscriber status from SFMC to Sales Cloud.
Answer: Did you check the documentation for Marketing Cloud Connect?
There are multiple ways to unsubscribe a subscriber from receiving communications.

A subscriber opts out by clicking the link to the profile center included in each email. The user is unsubscribed in the Marketing Cloud and the Email Opt Out flag is checked in the CRM.
A subscriber can click a link to a custom profile center and opt in or out of specific communications.
A Salesforce user can unsubscribe or opt out a subscriber manually within the CRM.
A Marketing Cloud user can unsubscribe or opt out a subscriber manually in Marketing Cloud.

The first point above tells you, that using the connector and standard preference center in Marketing Cloud, while relying on Email Opt Out field on your leads and contacts, this should be a straightforward case to solve (if it isn't already so, without you knowing).
Basically it all comes down to, how you define your consent data model in Sales Cloud, and whether you use standard subscription center in Marketing Cloud. Then you of course also need to use the Contact/Lead ID as Subscriber Key in Marketing Cloud.


how to add group into people or group column using jsom/rest

Question: I want to insert group into list column .how to add share point group into people or group list column using JavaScript or Rest API .
Answer: Let's do the REST-approach:
First: Query the group, you want to add:

URL: https://yoursite/_api/web/sitegroups?$select=Id&$filter=Title -eq 'yourGroupName'
METHOD: GET
HEADERS: accept: application/json

I assume, that you have an existing list item, which you want to update with the Group-Id, which you can extract from the previous query:

URL: https://yoursite/_api/web/lists/getbytitle('myList')/items(listItemId)
METHOD: POST
HEADERS: accept: application/json, content-type: application/json;odata=verbose, IF-MATCH: *, X-Http-Method: MERGE, X-RequestDigest: theRequestDigestValue
Data: {"__metadata":{"type":"SP.Data.MyListListItem"},"PersonFieldInternalNameId":groupId}

Please replace yoursite, myList, listItemId, theRequestDigestValue and groupId through the appropriate values.
If you want to update a multiple person field, you have to replace groupId in the last query through {"results":[groupId1,groupId2]}


How to update Mac OS X 10.6.8 to 10.7

Question: I have Cienega on my Mac and did a recent update.  Since the update I'm not able to open in Applications Cienega.  I'm receiving a error message that says  I have Mac OS X 10.6.8. The application requires Mac OS X 10.7 or later.  How do I upgrade?
Comment: Is your Mac capable of running Mountain Lion (10.8)?
Comment: Or can your Mac use 10.9 which will be  free upgrade
Answer: Apple has started selling OS X Lion redemption codes,  for £14 (in the UK) so you can still buy the old OS if you need to.
See also: Is It Possible to Still Upgrade to OS X 10.8 Mountain Lion.
Answer: Mac OS X Lion (10.7) was removed from the Mac App Store with the release of Mountain Lion in the summer of 2012. Therefore, your only legit option for purchasing a copy would be to look for someone selling a new USB version of the OS (instead of releasing Lion on a DVD, as they had with previous updates, Apple released it on a small USB flash drive). You can try eBay, they seem to have a few up for grabs. You could find somewhere else to download it, or find a friend who has the USB version and borrow it from them, but that would be illegitimate.
Answer: Go to the App Store and find OS X Mountain Lion over there. Click download and run it.
Comment: This won't install 10.7 though...

How to update Mac OS X 10.6.8 to 10.7


How to scan barcode using Appium?

Question: I'm looking for approach/solution on how to scan a bar code using Appium. Is it possible through emulators? or do I need real device for this use case?
Answer: Barcode scan using Appium :

This is one of the limitation of Automation I would say to automate scenarios with scanner or camera

Simply because it has some infrastructure & application related challenges

Possible work around [but not best practice] :

If performing tap on button [on mobile + from targeted app i.e. app which we are automating using appium] leads to open camera instead of redirecting user on diff application then we can think about some work around

We can automate barcode scanner if we have provision in targeted application to fetch barcode from gallery/mobile images instead of actual scan. This might be a relative close match

If we have only option to open inapp camera into targeted application, then we should give a rough try by keeping phone in such a way that when camera gets open and functional then barcode should have placed in front & in ideal position of scan

Go for those work around when you do not have any other option & this is blocking you

How to scan barcode using Appium?


Is it plausible to make a decentralized rendering farm by creating a new cryptocurrency?

Question: I had this idea to create a new cryptocurrency that uses rendering as mining, using it to create a decentralized render farm. is it possible, and if yes, then how? Sorry the question is not in depth. I'll edit this as I go along. Thanks!
Comment: Related: http://bitcoin.stackexchange.com/questions/331/is-there-a-way-to-set-up-proof-of-work-systems-so-they-would-be-even-more-useful
Answer: No.
A proof of work is a piece of data which is difficult (costly, time-consuming) to produce but easy for others to verify. You might be able to squeeze a render job into those constraints (remember, easy to verify also means it needs to be easy (small) to download, otherwise it's already a DOS opportunity right there).
However, another PoW requirement is that the work must be progress-free, which means every iteration of the work is completely independent of all other iterations (like rolling dice). This is because if you have 10% of the capacity, you'll win 10% of the time. As soon as there is progress in the work (20% done, 50% done, 99% done ... 100% done) then the fastest render farm will win 100% of the time (defeating the whole purpose of PoW). That situation also opens up all kinds of exploits where a fast farm can work ahead on the next block and gain an even bigger advantage.
There are many aspects to being progress-free. Even the current bitcoin PoW has a little bit of progress in practice (the block propagation itself) and even a little bit causes centralization pressure: bigger farms have a slight advantage over smaller farms.
Comment: Additionally, there's nothing tying a piece of work to a block or its previous. Without this detail, work can be torn off a block and re-applied to any other and present that as canonical.


Analyzing only modified classes in Sonar

Question: I would like to know if it's possible to focus a sonar analysis in the classes you have modified.
Imagine you have a huge project, analyzed with a SonarQube Ant Task that can spend a lot of time analyzing all its code and generating the results in the server.
If you only modified 3 classes in this huge project... would be possible to make a shorter analysis with only that 3 classes and update the results?
I'm looking the 'sonar.sources' and 'sonar.exclusions' properties, but I cant find a solution.
My idea is to have the complete proyect analyzed in sonar server. If you use the Sonar Eclipse Plugin you can see all the info displayed, and if you use the sonar ant task you can update the information, but only analyzing the source you have modified.
Answer: This feature will be implemented in next version of SonarQube (4.0).
You can vote and watch the following ticket: SONAR-3677


Does a Defendant LLC that is getting sued under two business names get named and served as Defendant once or twice?

Question: Let's say "CompanyName" LLC is being sued for its business activities under the business names "FirstAssumedName" and "SecondAssumedName". Does a Plaintiff name and serve the "CompanyName" LLC once or twice for each business name?
Comment: Why would you not just name "CompanyName LLC dba FirstAssumedName, dba SecondAssumedName"? You should only really serve the "CompanyName LLC", but you can clarify the DBA in the paperwork.
Comment: It is only one entity. Like a person  - Michael, AKA Big Mike. Two names isn't  two people.
Answer: You sue the legal person
One of the things that distinguishes legal personhood from other structures is the ability to sue and be sued. You can't sue a business name or a trust for example but you can sue a company.
I have in fact been required to make adjudication decisions that I know will be unenforceable in court because the applicant named a trust rather than the trustee.


JSON vs. Serialized Array in database

Question: What are the advantages and disadvantages of storing JSON data in MySQL database vs. serialized array?
Comment: This question should be re-opened.  Although there is some risk of it being "opinion based", the question does not ask for opinion, it clearly asks for advantages and disadvantages.  The top answers are also not opinion based, they clearly support the facts with evidence.
Answer:
JSON encode() & decode()

PHP Version >= 5.0.0

Nesting Limit of 20.

PHP Version >= 5.2.3

Nesting Limit of 128.

PHP Version >= 5.3.0

Nesting Limit of 512.

Small footprint vs PHP's serialize'd string.

serialize() & unserialize()

PHP Version >= 4.0.0

Methods are not lost on PHP Datatype Object.
__wakeup() magic method called on any object being unserialize. (VERY POWERFUL)
It has been noted that it is some times best the base64 encode strings put into the database, and base64 decode strings taken out of the database with this function, as there are some issues with the handling of some white space characters.

The choice is yours.
Comment: Upvoted for __wakeup() .
Comment: I am storing Twitter-returned JSON so I needed the base64_encode to get around the escaping of funky characters.
Comment: Quite important thing about `serialize` - that it preserves correct serialized Object type https://wordpress.stackexchange.com/a/61094/91844
Answer: Pro JSON:

The JSON data can be used by many different languages, not just PHP
JSON data is human readable and writable.
It takes up less space
It is faster to encode JSON than to serialize

Pro Serialized Array:

It is faster do unserialize than to JSON decode

As the comments indicate, JSON takes up less space than a serialize array. I also checked whether JSON or Serializing is faster, and surprisingly, it is faster to JSON encode than to Serialize. It is faster to unserialize than to JSON decode though.
This is the script I used to test:
<?php
function runTime(){
      $mtime = microtime();
      $mtime = explode(' ', $mtime);
      $mtime = $mtime[1] + $mtime[0];
      return $mtime;
}
?>

<?php
$start = runTime();

$ser;

for($i=0; $i<1000; $i++){
    $a = array(a => 1, x => 10);
    $ser = serialize($a);
}
$total = runTime() - $start;
echo "Serializing 1000 times took \t$total seconds";
?>

<?php
$start = runTime();

$json;

for($i=0; $i<1000; $i++){
    $a = array(a => 1, x => 10);
    $json = json_encode($a);
}
$total = runTime() - $start;
echo "JSON encoding 1000 times took \t$total seconds";
?>

<?php
$start = runTime();

$ser;

for($i=0; $i<1000; $i++){
    $a = unserialize($ser);
}
$total = runTime() - $start;
echo "Unserializing 1000 times took \t$total seconds";
?>

<?php
$start = runTime();

$json;

for($i=0; $i<1000; $i++){
    $a = json_decode($json);
}
$total = runTime() - $start;
echo "JSON decoding 1000 times took \t$total seconds";
?>

Comment: PHP serialized format includes the lengh of the elements (strings and arrays), so that's why it's slower than json to write (json does not store that) but quicker to read (when you know what you expect when reading a file, there are less conditional logic to implement, for example to import a string of 2000 chars it's enough to read the next 2000 chars without checking each time if the current char indicates the end of the string like it's done for json_decode)
Comment: +6 for wrong answer?

JSON: {"x":1,"b":"e"}

Serliaze: a:2:{s:1:"x";i:1;s:1:"b";s:1:"e";}

So JSON takes up less space...
Comment: Thank you Thinker, I thought the PHP serializer serialize it to some kind of bytecode, definitely not a string. I'm rather disappointed now.
Comment: **Note:** MySQL 5.7.8+ Includes native support for JSON
Answer: Portability: Winner JSON.  JSON is supported on a wider variety of platforms, while PHP de-serialization is only supported (as far as I know) by PHP.  While it's possible to parse either format in any language, JSON has more pre-built libraries.
Future Proof: Winner JSON. JSON is a "standard", in the sense that Javascript is a standard, and isn't likely to change anytime in the future.  The PHP group has made no promises about the future of the serialization format, and while it's unlikely to change in the future, the fact that a single group controls the format means you may end up with future data that's unreadable.
Fidelity: Winner PHP. PHP serialization will allow you to store data with native PHP data types, including objects defined by custom classes. JSON will only allow you to store generic primitive types, lists of primitive types ("arrays") and key/value pair Objects.  PHP Serialization may provide some advantages here if you're developing a PHP application.
File Size: JSON has a slight win here, as PHP's current serialization format is more verbose (as it's storing more information).
Performance: Who knows, it depends, profile.
Conclusion: Go with JSON unless you have a compelling reason to use PHP Serialization .
Answer: JSON is more portable, i.e. you can more easily read/write to it from different languages etc. If you used PHP serialized arrays you would only be able to easily use PHP to access it.
Comment: disagree,  when using  as a microservice, this would not be a problem
Comment: @Yoosuf what do you disagree with? I never said it was a problem.
Answer: Are you using your datas only with PHP ? If yes : arrays, if no : JSON.
Pro Array

sessions used serialization : I think it's faster than json_encode/decode (not quite sure)
many functions on arrays in PHP (sorting/merging/...)

Pro JSON

JSON is know in other languages and web languages
less verbose in database
many tools, like XML : JSON SChema
Answer: There was a lot of such questions on SO.
Preferred method to store PHP arrays (json_encode vs serialize)
In short:
JSON is better for simple data, but it doesn't distinguish difference between object and associative array. Serialized data are bigger.
Comment: LithMaster, you should learn, what an associative array is. It's not an array as in your example.
Comment: JSON does distinguish between objects and arrays, {"member1":"value", "member2":["member1", "member2"]}
Answer: Use json for for arrays and communication with Javascript or other language. Use serialize for object or any internal PHP work for the current running script.
Answer: if youre trying to get around quotes and special characters in your JSON.stringify(obj) ,you can do so in PHP using it's database-specific escaping methods.
<?php
mysql_real_escape_string(htmlspecialchars($value))
?>

you can now store this safely and decode it when you read it back out
Answer: I just had this big problem with php serialize. I stored a lot of data in a single field  in which i used unserialize to read.
What happened is that I got some corrupt data in that field. Serialize map the data with codes like 'a','s' and 'N'. If there is corrupt data, the map failed. It will show a php error that the unserialize function is unable to work because of byte code error.
So my point is to avoid serialize. Go with JSON, way safer and you won't bang your head on future majors problems.
For me, no more serialize.
Answer: JSON beats serialization as most answers already pointed out. I think the biggest advantage is its platform independency. You might have other applications communicate with you database and they might not have anything to do with php.
But both solutions violate database normalization. You database will not even be in first normal form so you cannot take advantage of any database feature like, say, searching. A better approach is to use object relational mapping. There are good libraries out there - consider for example doctrine ORM.
Answer: atm, json_encode() works only with UTF-8 encoded data.. therefore, it cannot encode characters such as "ñ", else it returns NULL
Comment: UTF-8 encoded data can easily represent ñ.

JSON vs. Serialized Array in database


What is the fastest way to level up without killing many people?

Question: After finishing the game for every possible faction, I'm thinking about playing again from the start, maybe even in hardcore mode. What missions are the best to level-up quickly? By this I mean, what are some easy missions which give out a lot of experience? I don't want to kill a lot of people; I might even try not to kill anybody. Any ideas? I think I will also ignore locks and computers since I've done them all before. In my original playthrough, I made the mistake of doing a lot of side missions, so I lost the ability to level-up quickly.
Comment: Being ["Well Rested"](http://fallout.wikia.com/wiki/Well_rested) infers a +10% bonus to all experience gained, so is probably handy to try and keep active.
Answer: I'm going through a similar action myself right now -- I'm trying to kill as few humans as possible. (I made an exception for Benny, and raiders who attack on sight.)
Skills: I know you said you don't want to do locks and computers, but you'll have to for some things, so keep lockpicking and science high. Prioritize speech -- you can get out of a lot of fights, and even better, get XP for it. Maybe go for survival and/or repair, and go after the challenges for crafting.
So some early-game missions to help you out? Skip Primm entirely, head straight to Mojave Outpost. You'll get Ghost's quest there, which just requires you to go to Nipton. In Nipton, you'll get "Cold, Cold Heart," which just requires you to go to Mojave. Easy, non-violent 250 XP. Not much, but it'll get you started.
From there, make a beeline to New Vegas, by way of Novac. In Novac, do Boone's side quest, because it's quick and easy and non-violent. In Freeside, take the peaceful route through G.I. Blues, hook up the Followers and the Garretts, and do the Wang Dang Atomic Tango. Once in New Vegas, go talk to Mr. House and deal with Ring-a-Ding-Ding. After that, you should be able to take down Talent Pool pretty quickly and peacefully.
By the time you get through all this, with perhaps a little bit of minor side adventurism, and you should be at least level 10 or 12.
Comment: Boone's quest requires you to lead somebody to their death, hardly non-violent.
Comment: thanks for sharing some cool ideas, I think I might just try to tour the whole map(if im able to get the animal friend perk I wont have to fight animals :) My goals are to see find some new and cool quests and to get uber luck for achievements.
Comment: @kotekzot: I have a loose definition of non-violent. See also: http://gaming.stackexchange.com/q/6518/58 (I've forgotten, apparently, how to write in Markdown.)
Answer: I'm not too sure what the fastest way is to level up without killing people. I provided a link below with all the quests possible in fallout:NV. As you can imagine there is an enormous amount of side quests, you may want to read through them and determine which ones involve no killing.
http://fallout.wikia.com/wiki/Fallout:_New_Vegas_quests
Comment: Note that this link contains spoilers
Answer: There is a way where you need only kill about seven people and you may reach level 30 before even leaving Goodsprings.

Do the tutorial mission, then go see Trudy
Talk to Cobb and ask if he needs help taking over the town. Go and kill Ringo in the gas station
Go to Cobb and tell him Ringo is dead
Cobb will ask you to shake down Chet... DON'T!
Kill Cobb and his friends and then go to Chet
Tell him the Powder Gangers need supplies and with a speech or barter check of 25 or higher you can keep asking him and reaching level 30 before leaving Goodsprings
Comment: Step 6 is an exploit, I don't think that's what he meant.
Comment: @Ragnar better to have options ;) its boring to do the same missions again :(
Answer: First, do all tutorials and Run, Goodsprings Run.
Carry on with the Powder Ganger storyline and when the time comes defect to the NCR. In the Primm Sheriff thing, get it run by NCR and stick to the roads. Wipe out the gas station in the middle. Then do all of the NCR missions at the outpost and get ED-E with spare supplies.
Go to do Cold, Cold Heart but quickly kill the group. Clear out the town hall and proceed to Old World Blues. I came out a level 17 with a stealth suit and a HUGE gun.
After getting Boone, completing the Sierra Madre and finishing Saving Camp Forlorn Hope (On the coast)
Go to Zion. Then hit New Vegas and go NCR. I skipped about 30-50 missions through NCR Support but finished level 29. Do the Divide too.
A less violent option is to try and use stealth; then you'll get into nearly no fights and still have a lot of quests to do. A good tip (if you get to the Vegas Strip) is to take up the White Glove Society quest line and go non-cannibalism; a few thousand XP for only 3 kills minimum, I believe, and they're already hostile. Get a good gun first, though; one enemy has good armor.
Comment: So your advice for leveling up without killing many people is to kill many people. Interesting.
Comment: Be careful going into Old World Blues early (hardcore on/level hard). I did and ended up being so overwhelmed I had to revert to an early save. After going back in at level 17 I'm still having trouble, but it's better than last time.
Answer: Just go to New Vegas and do all the quests there. The only problem is getting there, because there are Deathclaws on the way and you need 2000 caps to get in (or a fake ID at Mick and Ralphs in Freeside for 500 caps and a speech check).

To bypass the Deathclaws, stick to the right side scaling the mountains all the way.
To get the money easily try:

Taking (not stealing) all the items in every place you go to.
Placing a bet in a custom Deathclaw vs 3 giant radscorpions battle - it costs 500 but you get 620 if you win, and if you lose you can just re-load the game.
Go find The Thorn and fight in it.

I managed to get into New Vegas in about an hour from the game start and still in level 1, and the New Vegas quests give thousands of XP.
Answer: I have a simple and easy way for you to make some easy xp. Go to Cottonwood Cove, but only if you are on good terms with the legion and look for the a tall building right before the shore. Go upstairs and look for the centurion and talk to him. You will need barter 35 for the speech option. Just keep doing it without killing him. Make sure you don't take Boone with you.


Is it correct to say that something is "claustrophobic" if it makes someone feel claustrophobic?

Question: For example, people often refer to an elevator as claustrophobic, but I'm curious whether it is more accurate to say that an elevator causes its occupants to feel claustrophobic.
Comment: Although in this case "claustrophobic" is OK in both senses, this question reminds me of one of my pet peeves: "I feel nauseous."  I should probably get over it, but every time I hear someone say that I want to say "You're right!  Now I know why I'm feeling nauseated - you make me sick!"
Answer: claustrophobic can mean both:

pertaining to or suffering from claustrophobia.
tending to induce claustrophobia: a small, airless, claustrophobic room.
Answer: Let's start here.

claustrophobia: Extreme or irrational fear of confined places.

So, with that definition in mind. It's not grammatically correct to say that an elevator is claustrophobic.
But, I had heard it used that way, so I looked it up.

Causing anxiety; disquieting.

So, in light of that definition, yes, you can use it that way.


Installing Ubuntu on HP Envy4-1030us

Question: I am having an issue I can't quite get around. I just got a new HP Envy4-1030us with Windows 7 on it, and the first thing I did was upgrade to Windows 8. So now I'm trying to partition the 500GB drive and install Ubuntu, but when I get into the installer there are no drives to install it to. Also, palimpsest thinks the drive is formatted in FAT, when Windows is telling me that it's NTFS. Any ideas? There are only two partitions, the Windows 8 one, and the "system reserved".
Answer: Found out that the live image lacks the required RAID drivers that are required to see the drives on a system using the Intel Rapid Storage Technology. In order for me to actually get this installed, I had to wipe all the drives, including the 32GB ssd, reinstall Windows, then Ubuntu, then install the Intel Rapid Storage Technology in Windows to get that working again. Quite a pain...

Installing Ubuntu on HP Envy4-1030us


How would I reverse-geocode coordinate locations to a county (Python)?

Question: I currently am working on a piece of code in Python that takes in a csv file of latitude and longitude coordinates and returns a new csv file with the corresponding county codes. How would I go about linking each coordinate with a county code? I am aware of the reverse_geocoder python package, but this only returns the name of each county. Is there any tool that returns county code?
Comment: County, not country? From your use name, it might be that you are looking for American counties? Over here in Englandshire we reckon we invented counties & don't automatically  assume colonial counties :-) Seriously, dude, welcome aboard, but please read [ask]. Garbage In, Garbage Out & all that. The more detailed info you give us, the better that we can help you. While this does seem to be the best site to ask, you might want to be aware of our [G.I.S sister site](https://gis.stackexchange.com/). I also find[open data](https://opendata.stackexchange.com/) useful for map mashups, if U wan that
Answer: you don't mention which country you are reverse geocoding in. In some countries there are common codes for each county, in the US there is something called a FIPS code, which usually (but not always) corresponds to a county.
The OpenCage Geocoder returns county_codes in countries where those are normal and FIPS codes in the US.
Here is part of an example response for coordinates 41.3976108, 2.1311837 in Barcelona, Spain, note the field county_code
    "city_district": "Sarrià - Sant Gervasi",
    "continent": "Europe",
    "country": "Spain",
    "country_code": "es",
    "county": "Barcelonès",
    "county_code": "B",
    "neighbourhood": "les Tres Torres",

Here is part of the response for a request for 38.2544472, -104.609141 in Pueblo, Colorado, USA.
"FIPS": {
    "county": "08101",
    "state": "08"
}

Answer: If you have the shape definitions for the counties, you can do your own search using a simple point-in-polygon search.
This would be greatly speeded up by using a spatial index, searching the spatial extents (ie. n/s/w/e extents) and then only performing the point-in-polygon when there is an overlap in extents.
Assuming you're in the US and not working with the Aleutians, then you can probably assume Euclidean coordinates for the point-in-polygon. True point-in-polygon on a sphere is more complicated...


x equals puzzle

Question: I'm looking for a 2-word phrase, (6) (5). Try to figure out which phrase it is given the image below.
Answer: The answer here is:

 TENNIS COURT

The first thing to notice is that...

 ...the letters and shapes can be overlaid, equating each point to a letter:

Now, if we try to...

 ...position each of the small shapes so that these points line up (i.e. so that all points labelled 'A' overlay each other, then all the points labelled 'B', etc.), we form an image that looks something like this (approximated in MS Excel):

What is this? Well...

 Let's shade everything green and make the lines white. This is now recognisably the markings of a TENNIS COURT. In fact, let's make the centre line grey, since it, in fact, represents the net (hence why I suspect the vertical line at the top of the original image was included as a 'piece' in its own right):

As for the title...

 In Roman numerals, 'x equals' can be read as 'ten is', i.e. Tennis!
Comment: @Prim3numbah Argh! Yes it makes sense!
Comment: You got the correct image! But what would happen if you painted each rectangle green (which I initially wanted to do, but changed my mind), will the title make sense then?
Comment: That's it! Well done :)

x equals puzzle


A closed set contains all its limit points

Question: I'm constructing a proof regarding a closed set $Y$. In it, I make the assumption that $Y$ is not closed. This means that $Y$ does not contain all its limit points $k_0$. Does this then mean, that one of these points $k_0$ must instead be a isolated point? Since, If I have understood this correctly, the opposite of a limit point is an isolated point. In general, what does it mean when a set does not contain all its limit points?
Comment: Not at all.  Consider for example $(0,1)$.  Both $0$ and $1$ are limit points of this set.  But they are not isolated points.
Comment: Indeed every limit point is a point of closure but the converse does not hold always, a point of closure which is not a limit point is called an isolated point, and the set containing all of such isolated points is called **derived set** which is closed itself
Answer: You idea of "opposite" here is a bit confused.
Say we have a set $S$.  A point $p$ could be

In $S$, or not in $S$
A limit point of $S$, or not a limit point of $S$

All four combinations are possible.  Consider the set $$S = [0, 1) \cup \{2\}.$$  Then examples of each of the four combinations of properties are:
$$
\begin{array}{c|cc}
& \text{in $S$} & \text{not in $S$} \\ \hline
\text{limit point} & 0 & 1 \\
\text{not limit point} & 2 & 3 \\
\end{array}
$$
Every point in the line is one of these four types.   The points $0$ and $2$ are in $S$, but $0$ is a limit point and $2$ is not.  The points $1$ and $3$ are not in $S$, but $1$ is a limit point and $3$ is not.
Points of type $2$ are called isolated points.  They are exactly those points that are in $S$ but are not limit points of $S$.
You can see in the chart that "limit point" is not really the "opposite" of "isolated point".  That is true for points of $S$ (types $0$ and $2$).  But a point of type $3$ is neither a limit point of $S$ nor an isolated point of $S$.
When there are no points of type $1$, we say that $S$ is closed.  If $S$ is not closed, then that means there is a point of type $1$.  But that has no bearing on whether there is an isolated point, which is about whether there are any points of type $2$.  There could be points of both types, or neither, or points of one type but not the other.
Answer: No, it does not imply there exists at least one isolated point.
The assumption that a set does not contain all its limit points implies there exist a limit point of the set not in the set, not "not all points in the set are limit points".


How to revert the last migration?

Question: I've made a migration that added a new table and want to revert it and delete the migration, without creating a new migration.
How do I do it? Is there a command to revert last migration and then I can simply delete the migration file?
Answer: You can revert by migrating to the previous migration.
For example, if your last two migrations are:

0010_previous_migration
0011_migration_to_revert

Then you would do:
./manage.py migrate my_app 0010_previous_migration

You don't actually need to use the full migration name, the number is enough, i.e.
./manage.py migrate my_app 0010

You can then delete migration 0011_migration_to_revert.
If you're using Django 1.8+, you can show the names of all the migrations with
./manage.py showmigrations my_app

To reverse all migrations for an app, you can run:
./manage.py migrate my_app zero

Comment: I've seen many answers on SO to this problem that are old and simply don't work anymore. +1 because this works with Django 1.8.
Comment: Using django 2.1, this works for me: `/manage.py migrate my_app 0010`,  only `0010`, not the full file name.  After that, manually delete the local files appname/migrations/0011+, then manually delete row(s) from django_migrations db table for 0011+.
Comment: As long as you are using your actual migration name, and not `'0010_previous_migration'`, I do not know why you would see that behaviour.
Comment: @Ness this only "de-migrates". If you don't wanna do that migration anymore you also need to delete the migration file.
Comment: Don't users typically also want to delete the migration file? I often find myself making a migration then rethinking it and recreating it before committing something clean, so I usually need to remember 'rm path/to/0011_migration_to_revert.py'
Comment: When removing migration files from app/migrations/ be sure to delete both the 00nn_xxxx.pyc as well as the .py file.
Comment: This answer helped me so many times I wish I could upvote multiple times
Comment: for some reason this didn't work. but since I had a migrations mess I'm not sure this answer is not valid. anyway ended up solving this manually with sql editor, deleted the migration file, and re-created migrations. thanks anyway :)
Comment: Here's an article explaining this too: https://www.techiediaries.com/how-to-reset-migrations-in-django-17-18-19-and-110/
Comment: This did revert the last migration however it did not remove it from django_migrations table.
Comment: Maybe there was a space in your migration name? Then you'd have to enclose it with quotation marks.
Comment: THat's so dumb that it's `zero` and not `0000`.
Comment: @DevangHingu please ask a new question I can't help in the comments
Answer: Don't delete the migration file until after the reversion. I made this mistake and without the migration file, the database didn't know what things to remove.
python manage.py showmigrations
python manage.py migrate {app name from show migrations} {00##_migration file.py}

If you want to revert all migrations, use zero as the name of the migration:
python manage.py migrate app_name_here zero

Delete the migration file.  Once the desired migration is in your models...
python manage.py makemigrations
python manage.py migrate

Answer: The answer by Alasdair covers the basics

Identify the migrations you want by ./manage.py showmigrations
migrate using the app name and the migration name

But it should be pointed out that not all migrations can be reversed. This happens if Django doesn't have a rule to do the reversal. For most changes that you automatically made migrations by ./manage.py makemigrations, the reversal will be possible. However, custom scripts will need to have both a forward and reverse written, as described in the example here:
https://docs.djangoproject.com/en/1.9/ref/migration-operations/
How to do a no-op reversal
If you had a RunPython operation, then maybe you just want to back out the migration without writing a logically rigorous reversal script. The following quick hack to the example from the docs (above link) allows this, leaving the database in the same state that it was after the migration was applied, even after reversing it.
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models

def forwards_func(apps, schema_editor):
    # We get the model from the versioned app registry;
    # if we directly import it, it'll be the wrong version
    Country = apps.get_model("myapp", "Country")
    db_alias = schema_editor.connection.alias
    Country.objects.using(db_alias).bulk_create([
        Country(name="USA", code="us"),
        Country(name="France", code="fr"),
    ])

class Migration(migrations.Migration):

    dependencies = []

    operations = [
        migrations.RunPython(forwards_func, lambda apps, schema_editor: None),
    ]

This works for Django 1.8, 1.9

Update: A better way of writing this would be to replace lambda apps, schema_editor: None with migrations.RunPython.noop in the snippet above. These are both functionally the same thing. (credit to the comments)
Comment: From Django 1.8 onwards, you should use `RunPython.noop` instead of an inline lambda or equivelent: https://docs.djangoproject.com/en/1.8/ref/migration-operations/#django.db.migrations.operations.RunPython.noop
Comment: @SpoonMeiser In the syntax of the example, I think that looks like `migrations.RunPython(forwards_func, migrations.RunPython.noop)`. Need to check that functionally. That should get added as an answer or an edit to this one sometime.
Answer: Here is my solution, since the above solution do not really cover the use-case, when you use RunPython.
You can access the table via the ORM with
from django.db.migrations.recorder import MigrationRecorder

>>> MigrationRecorder.Migration.objects.all()
>>> MigrationRecorder.Migration.objects.latest('id')
Out[5]: <Migration: Migration 0050_auto_20170603_1814 for model>
>>> MigrationRecorder.Migration.objects.latest('id').delete()
Out[4]: (1, {u'migrations.Migration': 1})

So you can query the tables and delete those entries that are relevant for you. This way you can modify in detail. With RynPython migrations you also need to take care of the data that was added/changed/removed. The above example only displays, how you access the table via Djang ORM.
Comment: When creating new models with ForeignKeys, with multiple migrations, then realising all is wrong, and restarting 2-3 migrations backward, with new models but sometimes same model names or same relationship names... this solution is clearly the winner. I had error message like `django.db.utils.ProgrammingError: relation "" already exists` thus I made a `migrate --fake` which is wrong, so I tried to go back, then I got `psycopg2.ProgrammingError: relation "" does not exist` THANKS
Answer: To revert a migration:
python manage.py migrate <APP_NAME> <MIGRATION_NUMBER_PREFIX>

MIGRATION_NUMBER_PREFIX is the number prefix of the migration you want to revert to, for instance 0001 to go to 0001_initial.py migration. then you can delete that migration.

You can use zero as your migration number to revert all migrations of an app.
Answer: I did this in 1.9.1 (to delete the last or latest migration created):

rm <appname>/migrations/<migration #>*
example: rm myapp/migrations/0011*
logged into database and ran this SQL (postgres in this example)
delete from django_migrations where name like '0011%';

I was then able to create new migrations that started with the migration number that I had just deleted (in this case, 11).
Comment: +1 Though this will work, You need to save this way as a last resort. Also you have to remember to edit/drop column/tables of which the problematic migration contributed.
Comment: Absolutely dangerous and should not be at all. You can do it on your local machine, but that's a hack not a solution.
Comment: good point - I used this when I created a migration but did not run "./manage.py migrate " yet
Answer: First: find the previous migrations of your app,
python manage.py showmigrations
eg:
bz
 [X] 0001_initial
 [ ] 0002_bazifff

If you want rollback 0002_bazifff migrations,
python manage.py migrate bz 0001_initial

If you want rollback 0001_initial Or all
python manage.py migrate bz zero

It seems can't rollback 0001 only
Answer: The other thing that you can do is delete the table created manually.
Along with that, you will have to delete that particular migration file. Also, you will have to delete that particular entry in the django-migrations table(probably the last one in your case) which correlates to that particular migration.
Comment: I would add VERY careful.  You could break a lot of things in Postgres, for example constraints.
Comment: be carefull in this case - you are obligated to verify db to be adequate.
Comment: this work if the table does not have foreign keys,
it's not recommended way
Answer: You can revert by migrating to the previous migration.
For example use below command:
./manage.py migrate example_app one_left_to_the_last_migration

then delete last_migration file.
Answer: If you are facing trouble while reverting back the migration, and somehow have messed it, you can perform fake migrations.
./manage.py migrate <name> --ignore-ghost-migrations --merge --fake

For django version < 1.7 this will create entry in south_migrationhistory table, you need to delete that entry.
Now you'll be able to revert back the migration easily.
PS: I was stuck for a lot of time and performing fake migration and then reverting back helped me out.
Comment: This answer is for Django < 1.7.
Answer: This answer is for similar cases if the top answer by Alasdair does not help. (E.g. if the unwanted migration is created soon again with every new migration or if it is in a bigger migration that can not be reverted or the table has been removed manually.)

...delete the migration, without creating a new migration?

TL;DR: You can delete a few last reverted (confused) migrations and make a new one after fixing models. You can also use other methods to configure it to not create a table by migrate command. The last migration must be created so that it match the current models.

Cases why anyone do not want to create a table for a Model that must exist:
A) No such table should exist in no database on no machine and no conditions

When: It is a base model created only for model inheritance of other model.
Solution: Set class Meta: abstract = True

B) The table is created rarely, by something else or manually in a special way.

Solution: Use class Meta: managed = False
The migration is created, but never used, only in tests. Migration file is important, otherwise database tests can't run, starting from reproducible initial state.

C) The table is used only on some machine (e.g. in development).

Solution: Move the model to a new application that is added to INSTALLED_APPS only under special conditions or use a conditional class Meta: managed = some_switch.

D) The project uses multiple databases in settings.DATABASES

Solution: Write a Database router with method allow_migrate in order to differentiate the databases where the table should be created and where not.

The migration is created in all cases A), B), C), D) with Django 1.9+ (and  only in cases B, C, D with Django 1.8), but applied to the database only in appropriate cases or maybe never if required so. Migrations have been necessary for running tests since Django 1.8. The complete relevant current state is recorded by migrations even for models with managed=False in Django 1.9+ to be possible to create a ForeignKey between managed/unmanaged models or to can make the model managed=True later. (This question has been written at the time of Django 1.8. Everything here should be valid for versions between 1.8 to the current 2.2.)
If the last migration is (are) not easily revertible then it is possible to cautiously (after database backup) do a fake revert ./manage.py migrate --fake my_app 0010_previous_migration, delete the table manually.
If necessary, create a fixed migration from the fixed model and apply it without changing the database structure ./manage.py migrate --fake my_app 0011_fixed_migration.
Answer: there is a good library to use its called djagno-nomad, although not directly related to the question asked, thought of sharing this,
scenario:  most of the time when switching to project, we feel like it should revert our changes that we did on this current branch, that's what exactly this library does, checkout below
https://pypi.org/project/django-nomad/
Answer: All the other answers work great for rolling back linear migrations. However, when the migration is non-linear i.e has multiple leaf nodes and we wish to rollback only one path, then we can do in following way:
    X
  /   \
 A      B      [A and B can represent any number of linear migrations.]
  \   /
    Y (merge migration)

If we need to rollback A,B and Y. Then we can do the way other answer states.
i.e python manage.py migrate app X.
However, if need to only unapply one path i.e, rollback B and Y, perform following steps:

Unapply only Y. By doing python manage.py migrate app B (or A; both works).
Remove the migration files A and Y for time being from the project location.
Now unapply B, by doing python manage.py migrate app X.

Bring the migration files A and Y to the original location. Now, you can safely delete the unapplied migrations B and Y, if you wish to.
The gist is django can only rollback migrations if the files are present in the location. If you do not want to rollback a migration path (i.e A here), remove it from the project location while performing rollback.
More on this. https://stackoverflow.com/a/71231925/8663277
Answer: Yes there is a Reverse migration command in Django,
To remove th migrations changes from database directly,
for example if you have 4 migrations files in django app named (student)
enter image description here
python manage.py showmigrations

Total 04 migrations Applied on Student Application.

file structure : migrations file

file structure showing the migrations file list.

remove migrations command

want to remove last 2 migrations from database,
fire the command ( python manage.py migrate student 0002 )

[Show final migration list in database][5]

final showmigrations list in database,
successfully removed the last two migrations changes from databse.
Answer: This is how I manually revert Django migration:
Backup everything (DB, code) before you doing this. Be extra cautious if you are doing this on Production db/environment.
Steps are as below:

Delete the corresponding row in django_migrations table.
Revert/delete tables and/or any other changes made by the migration. Be careful with this step and make sure after this, your Django system state (db/files) is the same as before migration.
Remove the migration file (in app/migrations/00xx_) if you need to.

Notes:

Try to do this on a Test Django app to see that this is simple.
Learn more about Django migration (backward/forward/zero)
Comment: Generally Django is able to reverse migrations it created on its own. Even if you create custom migrations, you can provide the reverse code / sql to Django to perform the reverse migration. This manual process should generally be avoided.
Comment: Agree. But its still needed when you get error running revert migration the normal way. This may happen, for example, when you accidentally remove your migration source file.

How to revert the last migration?


At what speed does a magnetic field form from the flow of current?

Question: When an electrical current flows through a conductor and produces a magnetic field, does the magnetic field in the conductor form at the drift speed of the electrons in its structure or the velocity factor of the current?
Answer: The model of a magnetic field induced by current that one generally sees in a textbook is based on an equilibrium, steady-state condition. In a dynamic situation, the magnetic field will be more complicated. Once one part of the wire has current flowing through it, all of the wire can have some magnetic field around it; the magnetic field doesn't stay just where there is current, but flows out into space. If there isn't anything to stop it, the magnetic field will expand at $c$. So if the current is moving slower than $c$, some of the magnetic field will overtake it.
However, the magnetic field attenuates as it expands, decreasing with the square of the distance. The normal formula you see in a textbook, with the field strength being inversely proportional to the distance, rather than the square, comes from a model of the wire being infinitely long, and the magnetic field from parts of the wire next to a particular point reinforcing the magnetic field from that point.
So to reach that level of magnetic field, the electric field has to had flowed to that part of the wire. It's the current, not any particular charges, that causes the magnetic field, so drift velocity is irrelevant.
Comment: As it is the field of the current that causes it, then I imagine that the magnetic field originating within a material will move at the velocity factor, correct?


TLS Error 70 issues

Question: I have a web application (IIS 8) on one server (Windows Server 2012) connecting to SQL Server Reporting Services 2012 on another server (Windows Server 2008) that until recently was working fine.  About a week ago, it stopped working, and since then, I have not been able to get the system working again.  The premise is that my code calls to SSRS to retrieve a report, then serves it to the user (so that the user never has view or access to the report directly for security reasons).
The error message in my logs states "The request was aborted: Could not create SSL/TLS secure channel."
The web server is reporting "A fatal alert was generated and sent to the remote endpoint. This may result in termination of the connection. The TLS protocol defined fatal error code is 70. The Windows SChannel error state is 105." which says that it's trying to negotiate an unsupported protocol.
Fixes tried (and failed):
Updated code to force TLS 1.2
Fully patched both servers, and software that doesn't automatically get patched
Checked firewall on both servers (it is disabled)
Examined and updated the allowed protocols, etc. with IIS Crypto to disable insecure options on both servers.
And out of desperation (because it came up in search results and Windows Update notes):
Added the LdapEnforceChannelBinding registry entry per MS at https://support.microsoft.com/en-us/help/4034879/how-to-add-the-ldapenforcechannelbinding-registry-entry.
Followed the directions at https://community.spiceworks.com/topic/1794963-schannel-event-id-36888-microsoft-no-help-at-all re security check exemptions
Removed the last set of patches from Windows Update

So far nothing has worked, and the only other ideas that I have (but am not sure I want to try except at last resort) are

Remove the most recent set of Windows patches
Disable or delete encryption ciphers (MS recommended this a few years ago per http://searchsecurity.techtarget.com/news/2240234856/Microsofts-Schannel-security-patch-affecting-TLS-connections
Disable Data Execution Prevention (it has been working for years this way)

Before I take any of these steps, does anyone have any ideas on anything else I can try to get these two servers talking again?
Comment: still a valid question 4 years later. Your solution would be appreciated if you can remember!
Answer: Tom, I'm sure you're past this. Did you ensure the "Use TLS 1.0" and "Use TLS 1.1" settings are disabled in Internet Options for both Machines (Control Panel --> Internet Options --> Advanced Tab --> Security)?
Caveat to this is that communication to any websites or services that still use TLS 1.0 /1.1 will not be possible.
If you got past this, please share your workflow.

TLS Error 70 issues


Google cloud SQL instance is under "maintenance mode" for an exceedingly long time

Question: I have encountered an issue on a managed/cloud SQL where an instance has unexpectedly (also, outside the maintenance window set) entered maintenance mode and has remained unavailable for more than 10 hours.
Some details follow:

Second generation MySQL with the size of database around 180 gigs;
CPU usage is low, connection count low too;
connections seem to be accepted but then rejected immediately with:
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 2
It is not possible to stop/restart nor edit the instance (as it is in maintenance mode). Most of the controls on google cloud console page for this SQL instance are disabled.
Seems like the nightly backup which has been skipped the night it went to maintenance mode
Mysql logs don't show anything suspicious, i.e. page_cleaner runs (but I am not an expert in parsing mysql logs)

Another thing that is suspicious is the size of the database "did not get a cut", which it seems to get regularly every night, -- probably because of a skipped cleanup of binary logs?
This serverfault post could be related to my issue but I am not sure. What I don't like is that the solution there is to drop the database and create it a-new. That is not an option for us as we have production data and a backup was skipped due to this issue for a backlog of one day already.
 -  https://stackoverflow.com/questions/49424706/google-cloud-sql-instance-always-in-maintenance-status-binary-logs-issue
Comment: The issue has been resolved by google tech support. Basically there has been an unscheduled (outside of maintenance window) update that for some reason has crashed/disabled our database instance. Took a really long time and stress (as this was a production database) to resolve.
Answer: The issue has been resolved by google tech support. Basically there has been an unscheduled (outside of maintenance window) update that for some reason has crashed/disabled our database instance. Took a really long time and stress (as this was a production database) to resolve.
Posted as answer the OP comment, to prevent community bumping as it's resolved.


Cavy home question

Question: Hi  I've a 16 sq ft cage for my 2 cavies and I've an old tin dollhouse (22 inches wide x 11 inches deep) that I'd like to sit inside the cage, along with other toys and chews, as a hidey hut. I'm using a felt playmat with a road map design. Will this be harmful in any way to my cavies? or will they enjoy it?
Answer: Tin will be tricky: They  WILL bite into it, and the edges will be sharp. So, keep the tin-house away from them.
Also, as a side-note, keep in mind that ALL houses you have in the cage will need 2 exits at least.
The felt-mat is to be the floor for your cage? The mat itself should not be hurtful, but it will need a LOT of cleaning. That's what kept me from going felt-based for mine.  With no bedding on top, expect a full washing about every 2 or 3 days.
If it is an outside play-mat, just clean as needed, depending on their playmat-time.
Oh, and: Congratulations, on actually having an actually decently sized cage!!! All too rare, sadly.

Cavy home question


Calculate half-life from decay

Question: I need to calculate the half-life in hours and I got the decay constant in min, how do I do? Which formula do I use? Is it just ln2/decay constant in minutes?
Comment: Don't you think converting from minutes to hours is not "chemistry"?
Comment: Ať what age are children taught how many minutes is 1 hour ?
Comment: Thank you for the kind answers :)))) my question was more about which formula to use.
Comment: The formula is always the same, just units of halftime and time constant differ. Or, if you insist to use mixed units, you have to involve explicit unit conversion factors. It is similar if you use mixed units for relation of distance, speed and time.
Answer: If you know the decay constant ($\lambda$), you use:
$$t_{1/2} = \frac{\ln 2}{\lambda}$$
The unit of $\lambda$ is $\pu{s-1}, \pu{min-1}, \pu{h-1}, \pu{d-1},$ or $\pu{a-1}$, while that of $\ln 2$ is unitless. Consequently, $t_{1/2}$ can be calculated as $\pu{s}, \pu{min}, \pu{h}, \pu{d},$ or $\pu{a}$, respectively. Since you have $\lambda$ in $\pu{min-1}$, what you have to do is converted it to $\pu{h-1}$ and calculate $t_{1/2}$ in $\pu{h}$ or calculate $t_{1/2}$ in $\pu{min}$ and converted the answer to $\pu{h}$.
For example, suppose your $\lambda = \pu{0.005 min-1}$.
$$t_{1/2} = \frac{\ln 2}{\lambda} =  \frac{\ln 2}{\pu{0.005 min-1}} =  \frac{0.693}{\pu{0.005 min-1}}= \pu{139 min} = \pu{2.31 h}$$
Or,
$$\lambda = \pu{0.005 min} = \pu{0.005 min-1} \times \frac{\pu{60 min}}{\pu{1 h}} = \pu{0.30 h-1}$$
Thus, $$t_{1/2} = \frac{\ln 2}{\lambda} =  \frac{\ln 2}{\pu{0.30 h-1}} =  \frac{0.693}{\pu{0.30 h-1}}=  \pu{2.31 h}$$

Calculate half-life from decay


Is it possible to integrate htmx in Magento 2

Question: Does anybody try to use htmx in magento context ?
As I know it's need to connect external js lib in order to use htmx, does any conflicts appears in magento when you will use this lib ?
Advantages and disadvantages ?
Answer: If you just want to sprinkle htmx to magento Luma theme, all you need is to include this external JS lib and you will instantly get the hx directives available working with your custom APIs that renders incremental document updates.
If you swap out the whole Luma stack (knockout, requirejs, ui compoments, local storage etc) with HTMX, then it will be a very challenging task (which I am thinking about) and probably requires a team, but the advantage will be obvious:
faster site rendering
faster development
much better developer experience


Switchable graphics Intel + AMD Venus Pro

Question: I'm using Manjaro Linux on my laptop with switchable graphic cards:
00:02.0 VGA compatible controller: Intel Corporation Haswell-ULT Integrated Graphics Controller (rev 0b)

03:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Venus PRO [Radeon HD 8850M / R9 M265X] (rev ff)

Here's a screenshot of the drivers section of Manjaro Settings Manager:

The above shows that bumblebee's drivers are installed, but the daemon fails:
[luke@manjaro ~]$ sudo systemctl status bumblebeed
● bumblebeed.service - Bumblebee C Daemon
   Loaded: loaded (/usr/lib/systemd/system/bumblebeed.service; enabled; vendor preset: disabled)
   Active: activating (auto-restart) (Result: exit-code) since pią 2015-09-18 16:22:55 CEST; 29s ago
  Process: 1192 ExecStart=/usr/bin/bumblebeed (code=exited, status=1/FAILURE)
 Main PID: 1192 (code=exited, status=1/FAILURE)

wrz 18 16:22:55 manjaro systemd[1]: bumblebeed.service: Unit entered failed state.
wrz 18 16:22:55 manjaro systemd[1]: bumblebeed.service: Failed with result 'exit-code'.

During my trial-and-error I also tried to install video-catalyst driver (in window shown above). It ended miserably - after the initial startup the screen was full white. I switched to another TTY and deleted video-catalyst using mhwd.
My goal is to be able to play games on Steam. What can you recommend?
Comment: Bumblebee is for NVIDIA cards. It does not support ATI Radeon cards.
Comment: I've heard that. But how to explain that driver named "video-hybrid-intel-ati-bumblebee"?
Answer: have you considered/tried primus?
https://github.com/amonakov/primus

I'm not too familiar with the whole thing, but it seems like it has replaced bumblebee in most use cases.
Looks like it is known to compile on arch so you should be able to get it functioning on manjaro


Hold Up for Power loss of 10ms

Question: I'm using ATMEGA644 in a measurement circuit.
I'm providing the primary supply from a battery + boost regulator and if/when the voltage (the one that I have to measure) is available I want the supply to switch to that voltage. Switching will be done using a relay. So I figured I need to hold 5V till the release time of the relay which is nearly 15ms.
I know I'll have to hold 5V at the supply pin of ATMEGA644. I think I can use a capacitor to hold 5V for 15ms but I'm not sure.
My questions are:

Can I use a capacitor to hold 5V for a current flow of 50mA? If yes, then what will be the circuit and how will I be able to calculate the capacitance?
If not then what circuit should I consider following? or what other option should I be looking into?
Comment: "Switching will be done using a relay." I'm *really* curious to know why you need to use a relay in this application.
Comment: No special reason. I figured I only need a few amps at 5V
Comment: So then why not use one of the several power switching schemes that *don't* have a cutover delay?
Comment: Um. Is using relay a bad option? I have some in spare I don't want to spend more
Comment: When the secondary vltage is available why not use it to charge the primary battery then you don't need to switch.
Answer: .If you must use a 15ms relay then you need a cap just like you said .The tolerable voltage drop which occurs while the cap discharges slightly during the 15ms        outage,so I will assume that 250mV drop is OK .Then to the nearest preferred Value we get 3300 microfarad .
Comment: Could you please tell me how you calculated that value ?
Comment: Could you please explain to me how you calculated this value?

Hold Up for Power loss of 10ms


Autonomous evalution

Question: Do you think it is possible to learn the app, how to autonomous evaluate good or bad parking of the bikes? The thing is you need to take a picture with your phone and app need to decide according to this pictures. The parking will be in the streets.
Deciding will be based on the huge database with the pictures of the bikes which parked good/bad.
Answer: It is definitely possible!
You just need thousands of labeled pictures, a team of ML engineers, a few months, and some tens of thousands dollars to invest.
Jokes aside, it is not a simple task. Also, the labeling of the images will be a pain if they are not already labeled. You will need a team for that.
Answer: It would be a nice idea to ensure that your image dataset also has parking signs as a part of it, along with few other parameters that you can focus on. That shall help app in concluding whether a spot is available for public vehicle parking or not. I believe there is already an app available (Can I Park Here) on AppStore for this purpose. You may also like to take advantage of Google Maps API (collects info about parking spots, which are very well categorized), if publicly available. So the answer is YES, this is possible

Autonomous evalution


How to configure the battery percentage at which the mac will hibernate

Question: I've replaced my macbook pro battery with a non-official one and since the battery lasts a few hours less that the original one did at first (6h < 9h) when my battery starts running out at 1% there's not enough battery power to perform the hibernate to disk, so I always end up with a forced shutdown. Is there anyway to tell the mac to force the hibernation at a 5% of battery or something like that? I've tried pmset but that only work if you have an attached UPS.
Answer: I had a similar problm, and found that there was no ready-made solution to force the computer to sleep at a different battery percentage (eg. go into "Safe Sleep" at 5% instead of 1%).
The (lame) workaround I ended up using was using SlimBattery Monitor to issue a pop-up warning at a custom battery percentage (for me it was 20%), at which point I must close my laptop/manually tell it to sleep, until I can get it on AC power.
It seems you would have to write your own applescript to make the computer sleep if the battery is too low, and add a LaunchAgent to have it repeatedly run the script to check the battery power.  Annoying enough that I didn't venture down that path.  I was surprised none of the many battery-monitoring programs had this funcitonality (I may have just missed the one that does).