Sustainable and ethical business resources?

Question: Are there any resources or databases that catalog how companies perform along ethical or sustainable lines? I'm particularly interested in things like workers rights and pay, affect on the environment, etc.
Answer: There are several databases like this online. Just google on 'sustainability OR csr database companies' and you'll find a lot of hits. However, I have found that very few are easy to use.
For example, the Sustainability Disclosure Database lists data on thousands of companies on sustainability and environmental and social and governance transparency. I did try to use it once, but I quickly gave up because I didn't really understand how it works and what everything means. The site is too complicated for me (a non-professional) to use.
Another example that seems easier to use is CSRHUB but it requires a subscription to access in-depth information.
A site I am familiar with and often use is rankabrand.org. It ranks brands (so not companies) according to information found on a company website and in their annual reports. Rankabrand assesses brands on

their environmental performances, climate change efforts and labour conditions.

If no information is present on a particular topic, the brand gets 0 points so it is indirectly ranking transparency as well.
Answer: The Better World Shopper is a good source.  I got the book from my mother for Christmas one year and found it amazingly enlightening (and at the same time shocking).  It's small enough to keep with you as well.
BETTER WORLD SHOPPER is a site dedicated to providing people with a comprehensive, up-to-date, reliable account of the social and environmental responsibility of every company on the planet AND making it available in practical forms that individuals can use in their everyday lives. Coming out of more than 5 years of intensive research, this work is based on a comprehensive database of over 1000 companies and utilizes 25+ reliable sources of data to cover everything from the environment to human rights, community development to animal protection.
5 key issues
HUMAN RIGHTS: sweatshops, 3rd world community exploitation, international health issues, divestment, child labor, code of conduct.
THE ENVIRONMENT: global warming, rainforest destruction, pollution, recycling, renewable energy, greenwashing, toxic waste, eco-innovations, illegal dumping, sustainable farming.
ANIMAL PROTECTION: factory farming, animal testing, humane treatment, wild animal habitat.
COMMUNITY INVOLVEMENT: family farms, local business support, volunteer efforts, sustainable growth, philanthropic donations, nonprofit alliances, establishing foundations.
SOCIAL JUSTICE : fair wages, fatalities, union busting efforts, health & safety records, discrimination based on: race, gender, age, ability, religion, sexuality, ethnicity.
A second resource would be Green America's Responsible Shopper "Your Guide To Promoting a Responsible Economy"
Best of Luck. In our consumer based society every dollar is a vote!


color code in X/HTML , CSS

Question: In how many ways we can give color info in X/HTML, css?
I know some

Hex
color name
rgba

is there any other method?
and which method is preferred to use and which not? Please give explanation.
Answer: The three ways you mention are the only three.
I don't think a specific method is generally preferred, but as a developer, I like to see hex numbers.
I would avoid color names simply because if you want to know the true value of a color you have to look it up which is an annoyance in my workflow.
Also, hex numbers are the most compact way to describe a color (for most colors), so you might be saying a couple bytes of bandwidth by using hex. This doesn't really matter, but it's one of the only differences I can think of.
Answer: There is one more method: the one you're missing is old RGB. RGBa includes opacity (that's the 'a', for alpha)--it's not the same as RGB. RGB is supported by a wide array of browsers, old and new; RGBa is supported by a narrower but significant set of browsers: http://css-tricks.com/rgba-browser-support/ (IE being the main holdout, as usual).
Which method you use really doesn't matter. I prefer hex from habit, but am starting to use RGB more so that I can start getting used to extending it to RGBa.
Comment: Yep. Part of CSS3 (next big thing and all that). Good article: http://24ways.org/2009/working-with-rgba-colour Specification: http://www.w3.org/TR/css3-color/#rgba-color
Comment: so should we use RFBa over hex?
Comment: No, only use RGBa when you need a partially transparent color. You *might* want to start using RGB so you are familiar with it, but you can't rely on RGBa in older browsers, so always define a fallback color--in RGB or hex (your choice).

color code in X/HTML , CSS


Why can't Mirajane use magic for long periods of time?

Question: So, later on in the series, during the fight against Zeref, we see Mirajane use Satan-Soul but she also used souls that she had collected during the Tartaros arc. My question is: why can't she fight for long and how did she collect so many souls if she can't fight?
Comment: she stated "the stronger demon from she uses, the more energy it costs"
Answer: because you see multiple people run out of magic power throughout the show and she won't want to overdo it and be so exhausted not to move like Erza in the edolas arc and she might have finished the tartaros people off fast or with help
Comment: Please include relevant sources/references to support your answer.
Answer: My theory is mirajane's personal preference/Personality is as such!
In the starting episodes of Fairly Tale, we only saw her as a simple girl. During the episodes about Lisanna story, we also learn that she used to be aggresive but after the Lisanna death she changed completely.
As I understand, Natsu though trainings improved his strength and stamina but mirajane did not improve as much.
(During the initial episodes) For me the shocker was when we learn that she too has magic and that too very power stuff (S class level). But, I see that most of the time, she preferred being a sweet girl, who enjoyed modelling and take cares of her friends.
(Also the story is about Natsu, if mirajane is too powerful it would overshadow lots of stuff :)


Using VirtualBox on Mac HighSierra - installing Windows 10 via external hard drive, not working!

Question: Installed VirtualBox on my Mac (HighSierra), my version 2014, doesn't have a CD-ROM/DVD drive so I'm using a portable drive to install Windows 10 64-bit. VB isn't recognizing the external drive. Frustrating, not sure what to do? Any help? TIA
Answer: VirtualBox can emulate a DVD (optical) drive. To insert a DVD into an emulated drive, you must first convert the physical DVD to an iso file. You can select this iso file under Settings, as shown below. By the way, if Virtual Box did recognized your external DVD drive, then this external DVD drive could also be selected here. In the image below, my internal DVD drive is listed as Host Drive 'HL-DT-STDVDRW  GA32N'.

Note: You can click on an image to get a better view.

The instructions below were copied from this Apple website.
Create your own ISO
Use these steps to make an ISO copy of your Windows DVD:

While your Mac is started from OS X (or macOS), insert the Windows installation DVD in an external optical USB drive.
After the installation media mounts in the Finder, open Disk Utility from the Utilities folder (choose Go > Utilities).
Select the USB optical drive so it's highlighted in the Disk Utility window.
Choose File > New Image, and then select your Windows DVD from the submenu.
Choose DVD/CD master from the Image Format menu, then choose none from the Encryption menu.
Give the new file a name, then click Save. If prompted, enter an administrator user name and password. A progress bar appears while the image file is created (it might take some time to create the image file).
After imaging is done, eject your Windows installation disc. Disconnect the external optical drive from the USB port after the disc ejects.
From the Finder, locate the disk image file you created earlier. Single click on it to select it, then press the Enter or Return key on your keyboard to rename the file. Change the disk image file extension from .cdr to .iso. When prompted, click "Use .iso" to verify this change.

Note: Another possibility would be to download the Windows iso from this Microsoft website.


Theory on tangential acceleration

Question:
b) I dont understand how to take the integration like its integral of ft from 0 to 2 pi = integral of velocity, and the integral of the first is the area under the graph= 8j and then I dont know how to get the answer fron there cause  dont get what to plug in ?
Any help is greatly appresiated.
Comment: Welcome to Engineering! This looks like a [homework question](http://meta.engineering.stackexchange.com/q/121/1832). In order for such questions to be answered in this site, we need you to add details describing the precise problem you're having. What have you tried to solve this yourself? Please [edit] your question to include this information.
Comment: ask your ta ..?
Comment: Are you really thinking, that you copy-paste your homework here and the answering machine here will solve it for you?
Comment: If it is not homework or an exam question, then why is it worth 6 marks?
Answer: For the first question, you can split up the equations of motion into normal and tangential direction:
$$ma_n=F_n$$
$$ma_t=F_t.$$
The tangential force $F_t=12/\pi \text{ N}$. Hence, $a_t=\frac{12}{10\pi} \frac{\text{m}}{\text{s}^2}$. For the normal force (centripetal force) you have to remember that $F_n=m\frac{v^2}{r}$. Hence, $a_n=\frac{v^2}{r}=1\frac{\text{m}}{\text{s}^2}$. The total acceleration is given by $a=\sqrt{a_t^2+a_n^2}=1.07\frac{\text{m}}{\text{s}^2}$.
So, now it's up to you. Try the other questions and tell us what you have tried or where you got stuck.
Edit:
For b) we note that $$ma_t=F_t\implies \frac{F_t}{m}=a_t=\dfrac{dv}{dt}.$$
This can be rewritten by the chain rule (Note, that $ds/dt=v$) as:
$$\frac{F_t}{m}=\dfrac{dv}{ds}\dfrac{ds}{dt}=v\dfrac{dv}{ds}\implies \int_{s=0}^{2\pi}F_t ds=m\int_{v_0}^{v_{2\pi}}vdv.$$
The integral of on the right-hand side is just the area in your $s-F_t$-diagram. It turns out to be $8 \text{ J}$. Can you continue from here?
Comment: what I did for part b was make an equation for the graph and replace a with dv*v/ds and integrated to get velocity but that was not correct. Am I not on the right track ?
Comment: The integral on the right with velocity is the area of s-Ft. How I thought we had to find velocity from the integration? and for Ft I made the equation 36/pi^2(s-5pi/3) and integrated is this correct.
Comment: I dont think your integral is right. You should get 8 J. Remember that $F_t$ is piecewise defined. It is very unpracticable to express it as one function. Simply calculate the area by positve rectangle, positive triangle, negative triangle and negative rectangle.
Comment: root((8/10)*2-1)=v  Is this how I plug in the 8 ?
Comment: no,  I got 0.77. and thats not correct
Comment: Now, I see your mistake. You should have used $v=\sqrt{(8/10)^2+1}\text{ m/s}$.

Theory on tangential acceleration


Can General Relativity be "translated" to a language of forces in the analogous way that Newtonian gravity can be formulated in geometric terms?

Question: I know from "Gravitation" of Misner, Thorne and Wheeler(MTW) that Newtonian gravity can be formulated in a geometric language. Can we do the reverse for General Relativity? That is, could General Relativity be formulated or translated to a language of forces?
Comment: insofar as I'm aware, it really can't be done without dropping the equivalence principle to some extent. check out this paper, he does a good job discussing just this (I'd just come across it the other day): http://arxiv.org/abs/0809.2323
Comment: I don't know enough to make an answer, but proponents of teleparallel gravity claim that it can be made fully equivalent to GR: [link](http://arxiv.org/abs/gr-qc/0011087). In teleparallel gravity, a flat, but "torsionful" connection is used instead of a curved but torsionless. The information regarding gravity is contained in the torsion, and particle-field interactions are described by a Lorentz-force like term involving torsion instead of $F_{\mu\nu}$. This might be of interest to you.
Comment: @Uldreth How well-accepted is this theory among scientists?
Comment: @TheQuantumMan I don't know! I have no doubt the proof that it is equivalent is sound, (though feel free to check for yourself) whether there is any benefit to using this formalism over the standard one, I don't know.
Answer: In some special cases like the Schwarzschild-case it can, the equation of motion for a massless test particle then becomes:
$$\ddot{r}(t) = -\frac{G\cdot M}{r(t)^2} + r(t)\cdot \dot{{\theta}}(t)^2 {\color{red} {- \frac{3\cdot G\cdot M\cdot \dot{{\theta}}(t)^2}{c^2}}}$$
for the radial acceleration,
$$\ddot{{\theta}}(t) = -2\cdot \dot{r}(t)/r(t)\cdot \dot{{\theta}}(t)$$
for the angular acceleration and
$${\color{red} {\dot{{\tau}}(t) = \frac{\sqrt{c^2\cdot r(t)-c^2\cdot  r_s +r(t)\cdot r \dot{(t)}^2- r_s\cdot  r(t)^2\cdot \dot{\theta}(t)^2+r(t)^3\cdot \dot{\theta}(t)^2}}{c\cdot \sqrt{r(t)- r_s } \cdot\sqrt{1-\frac{ r_s }{r(t)}}}}}$$
for the time dilation.
The newtonian equation of motion is the same, but without the red terms.
The transformation from the local velocity to the local coordinate speed is
$$\dot{r} = \frac{v_{\parallel}\color{green}{\cdot \sqrt{1-r_s/r}}}{\color{blue}{ \sqrt{ 1-v^2/c^2}}}$$
with an extra term in the numerator for the gravitational length contraction for the radial, and
$$\dot{\theta} = \frac{ v_{\perp}}{\color{blue}{ \sqrt{ 1-v^2/c^2}}\cdot r}$$
for the angular component (with newton the blue and green terms vanish) where $\perp$ stands for the transversal and $\parallel$ for the radial component, so by Pythagoras $v^2=v_{\perp}^2+v_{\parallel}^2$ .
To get the shapiro-delayed velocity as observed by a field-free observer you multiply $v_{\parallel}$ with $1-r_s/r$ and $v_{\perp}$ with $\sqrt{1-r_s/r}$.
In other cases where you have more than 2 bodies of which one's mass is neglible it might be a different story, but if you have only one significant mass and almost massless test particles you can describe it in an almost newtonian way, like in the Schwarzschild oder Kerr case.
But I have no idea how you would deal with a full relativistic n-body simulation, that might be a little more complicated than with Newton.
Answer: This is like asking whether Statistical mechanics can be reformulated in terms of Thermodynamics. Statistical mechanics is the microscopic description that puts Thermodynamics on a firmer ground. In the same fashion what Newton called a force is what you get when curvatures in space-time are low and change very slowly and velocities are well below the speed of light.
One of the major lessons of GR is that even gravity is a fictitious force. It is on the same grounds as Coriolis force and centrifugal force. What you are asking for is a reformulation of a fundamental theory of space-time in terms of fictitious forces.


Dispersion-less media

Question: As far as I know, vacuum is the only dispersion free medium for electromagnetic waves. This makes me wonder if there are any other dispersion free media for these waves? (Experimentally established or theoreticaly predicted) If there are none for electromagnetic waves, are there any for other kinds of waves?
Answer: Dispersion can be locally nought and effectively nought over quite wide bands in engineered devices.
In an optical fiber, for example, the phase delays of the modal fields depends on two things:

The dispersion of the material making up the fiber and
The frequency dependence of the modal eigenvalue equation, which depends on the refractive index profile and is there even if the fiber could be made out of dispersionless materials.

The second order term in the phase as function of wavelength Taylor series determines, to first order, the total dispersion. In optical fibers, the two mechanisms above contribute exactly mutually cancelling dispersions from effects 1 and 2 in certain wavelength bands. For example, a step index profile fiber typically has quite a wide, low dispersion band at 1300nm wavelength. This band can be shifted by engineering the refractive index profile (the so called depressed cladding index profile) into the 1550nm communications band.
Grating devices can hold a system dispersionless over stunningly wide wavelength bands. For instance, carefully designed "chirped " fiber Bragg gratings are used to exactly oppose the dispersion of optical systems over hundreds of nanometers bandwidth, and thus are useful in setting up femtosecond long pulses.
Answer: The Alfven wave, an ion oscillation with a frequency less than the ion cyclotron frequency, found in plasma oscillation is dispersion less. So, plasma can be said to be dispersionless for this wave.
Comment: This is a highly idealized approximation of what actually occurs.  Alfvén waves are often dispersive (e.g., shear and/or kinetic Alfvén waves).  The electrostatic ion acoustic wave can be non-dispersive in the linear limit (which is observed too) but like all plasma waves, it can be dispersive.
Answer: Vacuum with EM field present is also dispersion-less, since EM fields of different sources do not interact directly. So if you pass an EM wave through charged capacitor, the only influence on the wave is due to the matter of capacitor; no influence due to electrified space should occur.

Dispersion-less media


FlxG.overlap() won't work

Question: I need a collision detection that has no physics and it's FlxG.overlap(), right? But why it doesn't work? FlxG.collide() works for me but.. how can I remove the physics when I hit the monster with a bullet?
Comment: Please share a bit of your code as a sample.
Answer: when FlxG.collide runs, it also moves the colliding bodies apart, so an overlap check right after, will return false. So make sure that the overlap check runs before the collide function kicks in
Answer: It is slightly difficult to understand exactly how you are trying to implement it, assuming it is a basic, if overlapping, then do A, this is how it should work.
you will need an object/group:
private var ObjectGroup:FlxGroup;
private var ObjectInGroup:FlxSprite;
private var Object2:FlxSprite;

In your update function or wherever you want to detect the overlap:
FlxG.overlap(Object2, ObjectsGroup, OverlappingObjects);

Then the function that is called:
   private function OverlappingObjects(FirstObject:FlxSprite, SecondObject:FlxSprite){

   }

Now you can do this with two sprites, or two groups, but this is basically how the it should turn out.
 I have not used the ProcessCallback yet, but I assume you would have a function with a return as a boolean, based upon the description. I could be wrong though.

FlxG.overlap() won't work


How to automatically disable customer account after payment failures?

Question: Is there a plug-in to automatically disable a customer's account after a certain number of payment failures? My store is undergoing a carding attack. The attacker is using different IP addresses and is using email addresses from gmail, so this seems like the only way to stop it. The attacker is doing this by calling my site's API so captcha is useless here.
Answer: You can enable the CAPTCHA for the checkout so it will prevent carding via the API. Depending on the Magento version you are on, if it is available I would enable reCAPTCHA v3 as it it basically invisible to the end user unless Google needs to verify they are human.


Which number is bigger: $\sqrt[10]{2}$ or $1.2$?

Question: What is the general method for finding such inequalities? I have some more problems of this kind in the text I am using.
Answer: Using the binomial theorem,
$$1.2^{10}=\left(1+\frac 15\right)^{10}\gt 1+\binom{10}{1}\frac 15=3\gt 2\Rightarrow 1.2\gt \sqrt[10]2.$$
Comment: Fair point. And maybe it helped OP--which is, after all, the point. Kudos.
Comment: I think part of the beauty of it at first was in *not* showing that the binomial theorem was being used. This made people think for a moment. :)
Comment: @MagicMan: I thought so. But later, I began to think adding the link might be better:) (partly because I got several downvotes...)
Comment: Using the Bernoulli inequality is easier (but equivalent, in this case).
Comment: @egreg: I agree with you. Didn't notice it.
Answer: By the AM-GM Inequality,
$$\frac{2+1+1+1+1+1+1+1+1+1}{10} \geq \sqrt[10] 2$$
$$\frac{11}{10} \geq \sqrt[10] 2 \Rightarrow 1.2 \geq \sqrt[10] 2$$
The AM-GM inequality sometimes works when you have an n-th root but it depends on the problem.
Answer: There is no general method. There have been numerous books written on just inequalities. For example, see Inequalities: Theorems, Techniques and Selected Problems. However, oftentimes, simple inequalities like yours may be approached by applying some subtle manipulations, much as mathlove's excellent answer has done. Consider the following example.
Example: Compare $6^{1/4}$ and $4^{1/3}$ without using a calculator. Is one greater than the other?
Answer. Observe that
$$
6^{\frac{1}{4}}=6^{\frac{3}{12}}=(6^3)^{\frac{1}{12}}=216^{\frac{1}{12}}
$$
and
$$
4^{\frac{1}{3}}=4^{\frac{4}{12}}=(4^4)^{\frac{1}{12}}=256^{\frac{1}{12}}.
$$
Since $256$ and $216$ are both being raised to the same power, and $256>216$, we can clearly see that $4^{1/3} > 6^{1/4}$ since
$$
4^{\frac{1}{3}} = 256^{\frac{1}{12}} > 216^{\frac{1}{12}} = 6^{\frac{1}{4}}.
$$

Knowing that it helps to make such manipulations comes with time and practice. Notice that it would otherwise be quite difficult to compare the values in the example as $4^{1/3}\approx 1.5874$ and $6^{1/4}\approx 1.5651$.
Answer: Try raising $1.2$ to higher and higher powers:
$$
(1.2)^2=1.44 > 1.4,
$$
$$
(1.2)^4 > (1.4)^2 = 1.96 > 1.9,
$$
$$
(1.2)^5 > (1.2)(1.9)=2.28 > 2.
$$
So already $(1.2)^5 > 2$, hence $1.2 > \sqrt[5]{2} > \sqrt[10]{2}$.
Answer: $\sqrt[10]2\lt\sqrt[8]2$. $\sqrt[8]2$ is easy to compute by $\sqrt{\sqrt{\sqrt2}}$, which is certainly $\lt 1.2$.
Answer: Think of an investment that returns $20\%$ per year (and let me know if you can find one...).  Simple interest would return $100\%$ -- i.e. double -- in five years, hence quadruple in ten.  Compound interest, which is what $1.2^{10}$ represents, necessarily does better, so $1.2$ is quite a bit larger than $\sqrt[10]2$.
Comment: I don't understand the downvote.  This is another way of taking the tenth power and saying $1.2^{10} \gt 1+10(1^9)0.2=3 \gt 2$


How to express an increase in percentage unambiguously?

Question: So I have a metric, say, accuracy, which is originally 70% and then raised to 80%. I want to say the accuracy increases by 10%. But it is ambiguous, as some may interpret it as the current accuracy is 70%·110%. How can I say it so that people will undoubtedly understand the increased result as 70% + 10%?
Answer: This is a very relevant question to ask.So often it is unclear what people mean.
For my own part I only say "it has increased by 10%", if I mean exactly that i.e, in your example, from 70% to 77%.
Otherwise I would say "it has risen by ten percentage points" - meaning from 70% to 80%.
Comment: Very good, "ten percentage points" is just right. However many retail promotions seem to use the confusion deliberately by wording adverts such as "Our 50% sale items now have another 10% off" actually meaning that the items are now on sale at 45% of their pre sale price but leading people to think that they on sale at 40% of that price.
Comment: @BoldBen Another instance of confusion is over opinion-poll voting shares. Sometimes you will hear commentators say "The Conservatives share of the vote has increased by 4%". (i.e. from 37% to 41%). The better quality newspapers will say "has increased by four percentage points" as does *The Times* in a front-page article today.
Comment: I'll agree with that, it seems that advertising copy and newspaper copy suffer from the same type of mathematical imprescision.
Answer: The original accuracy was increased/has increased/increased from 70% to 80%.
Comment: It is clear in this context. In other context, people may interpret it as all metrics rise to 1.1 times their original value.
Comment: It doesn't work when I want to say three metrics all rise by 10%.
Comment: Sorry, I don't see what the problem is. You have just said "all three metrics rise by 10%", which seems perfectly clear...


How to use ext4 inline_data to store empty directories?

Question: How can I use ext4's inline_data feature to store empty directories?
It seems like inline_data works only with small files, or the directories store a lot of data.
Answer: You need e2fsprogs 1.43 or later, and you need to create a file system with the inline_data feature enabled, and inodes with at least 256 bytes:
mke2fs -t ext4 -O inline_data ...

(if mke2fs complains about the inodes being too small, add -I 256).
Directories will then use inline data transparently, as long as the data they need to store fits inside their inode. debugfs's stat command will show inode data which looks like
Inode: 12   Type: directory    Mode:  0755   Flags: 0x10000000
Generation: 3089239889    Version: 0x00000000:00000002
User:     0   Group:     0   Size: 60
File ACL: 0    Directory ACL: 0
Links: 3   Blockcount: 0
Fragment:  Address: 0    Number: 0    Size: 0
 ctime: 0x5bcb759e:a9872534 -- Sat Oct 20 20:36:14 2018
 atime: 0x5bcb759e:a9872534 -- Sat Oct 20 20:36:14 2018
 mtime: 0x5bcb759e:a9872534 -- Sat Oct 20 20:36:14 2018
crtime: 0x5bcb759e:a9872534 -- Sat Oct 20 20:36:14 2018
Size of extra inode fields: 32
Extended attributes:
  system.data (0)
Inode checksum: 0x68fa51fe
Size of inline data: 60

This is for a directory containing one other directory; as you can see, it stores 60 bytes of inline data and has no extent.
Comment: Note that ext4 does not shrink directories, so inline_data is only used for small files and dies until they grow larger than will fit into the inode.


Is longest-path with a specific source and destination impossible in polynomial time?

Question: The problem of finding the longest path in a graph is known to be not be possible in polynomial time, that I am aware of. I am also aware that using DFS or BFS can give the shortest distance between a given origin and destination in a graph. Is it possible to find a longest
path from a source vertex to a destination vertex in polynomial time?
Comment: Note to any readers: it is important that the longest path problem asks for the longest **simple** path, i.e. the path does not repeat vertices. If the question is to find the longest path which may repeat vertices, then the problem can be solved in polynomial time with dynamic programming.
Answer: The longest-path problem is $\mathsf{NP}$-hard even when a source vertex $s$ and a target vertex $t$ are specified. To see this, you can reduce an instance of (the decision version of) longest path on a graph $G =(V,E)$ with no source/destination specified to (the decision version of) this variant by:

Adding to $G$ a new path $\langle u_0, \dots, u_n \rangle$ of length $n = |V|$, and connecting $u_n$ to each of the vertices $v \in V$ via the edge $(u_n, v)$; and
Adding to $G$ a new path $\langle z_0, \dots, z_n \rangle$ length $n$, and connecting each of the vertices $v \in V$ to $z_0$ via the edge $(v, z_0)$.

Call the resulting graph $G'$. It is easy to see that there is path of length $k$ in $G$ if and only if there is path from $u_0$ to $z_n$ of length $2n + k$ in $G'$.
This shows that, if $\mathsf{P} \neq \mathsf{NP}$ your variant does not admit any polynomial-time algorithm.
If $\mathsf{P} = \mathsf{NP}$, then there is a polynomial time algorithm for the decision version of longest path (given a graph $G$,  two vertices $s$ and $t$, and an integer $k$, decide whether there is a path from $s$ to $t$ in $G$ of length at least $k$), which is $\mathsf{NP}$-Complete.
Your version of longest path can then solved in polynomial time by first finding the length $k$ of a longest path $P$ and then recursively guessing the next vertex of $P$: delete $s$ from $G$ and check, for every neighbor $u$ of $s$, whether there exists a path $P'$ from $u$ to $t$ in $G-s$. When you find a $u$ for which the answer is affirmative, solve the problem recursively on $G-s$ to find $P'$ and construct $P$ as $s \circ P'$, where $\circ$ denotes concatenation.


can't create .htaccess in Apache2

Question: I've got a problem with Apache2 on my Linux Debian server. When I try to create .htaccess file, it does not appear. In apache2.conf I've got the .htaaccess configuration.
Answer: I can think of 2 possibilities - you do not have permissions to create the file or you are trying to view the file and unable to as it is hidden.
Use sudo or su to switch to root
sudo nano .htaccess
OR most likely
A file proceeded by a . (dot) in linux will not be seen unless you enable view hidden files in a file manager or run ls -a from a terminal
If using FTP the viewing will depend on your FTP client. For a GUI option such as filezilla will display hidden files automatically
Answer: How do you create it? What if you ls -a? Maybe it's just hidden (as all files starting with dot)
Comment: Yes, you're right. But how can I set it to appear on FTP? Excuse me, I'm new in Linux.
Comment: It depends on your ftp client. What client are you using?
Comment: I'm using TotalCommander and PSPad editor but it works now ;)
Answer: Although the answer seems to be solved, for starters, this depends on how the file is created. As said by @alleyoopster, if you do not have the permission to create the file, it would definitely show an error message like Permission denied or something so that you could understand the file was not created.
Now the next possibility would be that .htaccess file would be hidden. Any filename starting with a "." in front would be hidden. Actually, .htaccess is a file with an 8 letter file extension of htaccess just like abc.mp4. I have not used TotalCommander, but if you are using FileZilla, you have the ability to check/uncheck hidden files according to your wish. Instead if you are using terminal, you can type ls -la to view the files in that directory and their permission.  Hope this helps someone!!

can't create .htaccess in Apache2


Using Keras for real-time training and predicting

Question: I want to use Keras for a real-time training and prediction setting. In my scenario I get real-time data via MQTT that should be used to train a (LSTM) Neural Network and/or to apply them to the to get a prediction.
I am using the Tensorflow backend with GPU support and fairly potent GPU capacity but in my scenario Keras does not really profit from GPU acceleration. (I did some performance tests by using the examples in the keras repository to make sure that the GPU acceleration works in general). In my first approach, I used the model.train_on_batch(...) method to train the network with each item coming via MQTT:
model = load_model()

def on_message(msg):
    """
    Method called by MQTT client each time new data comes in
    """

    if msg.topic == 'my/topic':
        X, Y = prepare_data(msg.payload)

        prediction = model.predict(X)
        loss = model.train_on_batch(X, Y)

        send_to_visualization_tool(prediction, loss)

One training step in this setting takes about 200ms. However, when I introduce a buffer e.g. buffering 100 data points, the training time for the whole batch only increases slightly. This suggests that the setup time for batch training has a huge overhead. I also noticed that when using size 1 batches, the CPU consumption is quite high, while the GPU is hardly used at all.
As an alternative I now introduced a synchronized Queue, where the MQTT client pushes data, whenever data comes in and the Neural Network then consumes all data as a batch, that came in while processing the previous batch:
train_data_queue = Queue.Queue()

# MQTT client running in separate thread
def on_message(msg):
    train_data_queue.put(msg.payload)

model = load_model()

while True:
    train_data_batch = dequeue_all(train_data_queue)  # dequeue all items from queue
                                                      # or block until at least one
                                                      # item is present
    X, Y = prepare_data(train_data_batch)

    predictions = model.predict_on_batch(X)
    losses = model.train_on_batch(X, Y)

    send_to_visualization_tool(predictions, losses)

This approach works okay but it would be nice if I could get rid of the additional complexity of synchronized Queues and multi threading. I.e. get first approach work.
My question therefore is: Is there a way to reduce the overhead of one batch trainings? E.g. by reimplementing the model in pure tensorflow?
Or can you think of a better way to do real-time training with Keras?
Answer: The performance of keras should be broadly similar to the performance of raw tensorflow, so I do not recommend rewriting your model.
Indeed modern hardware usually takes about the same time to train with a single example as it does with a batch of examples, which is why we spend so much effort batching things up. You can get rid of the complexity of synchronized queues if you want to use tf.contrib.batching.batch_function but you'll still need to feed it from many threads if you want to get the extra throughput.


Constructing a Corporate Bond portfolio?

Question: Is it possible to create a corporate bond portfolio such that its yield is 100bps higher that its benchmark, while still outperforming the benchmark (BBG Corporate bond Index)? I guess my question is if I am looking at constructing a higher yielding portfolio and still trying to beat my benchmark, what are some factors, constraints etc I should consider and how would I adjust them. Assuming I am starting with a 100M AUM and implementing from scratch without the use of ETFs.
Answer: The best thing you should do is to download returns of a corporate bond portfolio, and then create a diversified bond portfolio whose beta against the benchmark is such that it yields an expected return that is 100bps higher.
One way of doing this is just to run a Mean-Variance problem, to choose weights of corporate bonds such that the average return you achieve is 100bps higher than the average return of the benchmark. This return could come from either alpha or beta against the benchmark, but if it is truly a well diversified bond portfolio, most of it should be beta risk.


Suppose that someone has only fast twitch muscles, what are somethings that he can't do

Question: I am not sure if it is possible. But assuming it is, what would be somethings that this person would not be able to do?
Answer: I can't find any instance where a species or individual only had fast or slow muscle fibers, so I am unsure if it exists even with diseases. Something as simple as sitting or standing is an activity that is dominated by slow muscle fibers. Other activities like regaining balance, or moving quickly in any way are dominated by fast twitch muscles, so I don't believe it is possible to even survive on one or the other. Perhaps at one point some species had this mutation, but I can't find reference to one.
Fast VS Slow Muscle Fibers
Understanding what composes each type of muscle will be helpful, this previous answer does that well. The important part to take away from that answer is that fast twitch are ideal for short bursts of power where slow twitch are better for activities that require sustained use.
Can Fast Fibers do Everything Slow Fibers do?
Hypothetically fast twitch muscles can perform any activity that slow twitch muscles can, with the caveat that it can only do it for a short amount of time.

Perhaps you can jog on fast twitch muscles, but you wouldn't get very far before it starts getting painful.

You might be able to swim, but it is unlikely you could make it across an entire lake.

You can likely stand up, but you likely wouldn't be able to balance very long.
Answer: It is not possible. The heart is also a muscle and so are the lungs (diaphragm). Such a person would not live long. Even when standing or sitting you are using muscles (besides the heart and lungs). These deep muscles surround the spine are called postural muscles and are slow twitch.


How can I test my LAN speed between Mac and Apple TV?

Question: How can I test my LAN speed when I do not have two computers? I have a Mac, an iPhone, and Apple TV.
I want to see the strength of my home network. I don't care about testing my internet connection, just the LAN.
What tools are available?
Answer: How to Measure
The place to monitor the speeds of course is your Mac. The easy built-in network speeds monitor is in Activity Monitor at the bottom of the main window. Alternatives include MenuMeters or iStat Menus which put the speeds right up in the menu bar.
How to test
This depends on which version of the Apple TV you have. With version three and earlier (the common black one), there's no local storage so you won't have much luck testing the upper limits. With the Apple TV 4, you'd need to jailbreak it to be able to directly copy media onto the drive (very strange). Just streaming won't test the limits of your network as most streaming will be in easy territory of 500 kb/sec, although you could try streaming an original MP4 from a DSLR to see if that chokes your network (and at what speed watching the transfer rates in either Activity Monitor, MenuMeters or iStat Menus).
It's fairly easy to figure out what your speeds will be. Any recent Mac (last six years) has 1000 BaseT (aka gigabit) ethernet (if it has ethernet at all, the USB to Ethernet adapter is just 100 BaseT). Hence the bottleneck will be your router. Real world speeds of 100 BaseT are 4.5 to 6 MB/sec. I recently upgraded my own router from 100 BaseT to 1000 BaseT (my old gigabit router had failed about a year ago) and had my internal transfer speeds jump from 6 MB/sec to 30 MB/sec. On the other hand, my computers on the powerline technology I use in part of the house to cut down on the ethernet cables along walls only tested at 4 MB/sec (even though it's theoretical maximum should have been closer to 40 MB/sec).
You won't be able test your wired internal network speeds with your iPhone as the connection is wireless. If you only want to check wireless connection, you can try copying some large files into your Saved Photos folder on your iPhone.
For your wired ethernet testing, I'd suggest having a friend bring over a 1000 BaseT laptop to do your wired ethernet testing. His laptop, a second short ethernet cable and some simple file transfers will do the trick. Testing with network storage devices (NAS) is not recommended as most of them are considerably slower than listed (there are exceptions).
Comment: I will try copying files to the iPhone and observe the network strength. Thanks for the tip.


Why RSA signatures based on the hash of the message?

Question: Why RSA signatures based on the hash of the message rather than the message itself?
Comment: Please tell us what you have researched so far. Looks like an exam question.
Comment: You mean the digital signature?
Comment: yeah RSA signatures
Answer: Technically, the signature works over the message; it so happens that the first step of the signature generation algorithm is to hash the message with a hash function, and the hash value is used afterwards.
Using a hash function is necessary because the RSA algorithm relies on integers modulo a given integer (which is part of the public key), so it cannot work with values which do not fit in that limited range. The hash function is also needed to ensure non-malleability (a rather technical internal characteristic). Using a hash function is sufficient because of the properties of cryptographic hash functions; namely, the resistance of hash functions to collisions and preimages really means that signing a hash is "as good" as signing the original message.
Answer: The hash acts as a measure to determine if the message has been changed since it was signed. That way the recipient knows that the message is the same as when it was signed (integrity).

Message is composed
Message is hashed
Hash is encrypted with sender's private key
The resulting signature accompanies the message

The recipient can use the sender's public key to check the hash, thereby confirming the integrity of the message and that the sender was the one who signed it (non-repudiation). A digital signature means that the message is as intended and sent by a confirmed source.
Applying the private key to the hash is more computationally efficient (smaller thing to encrypt), and encrypting the message may not be necessary if confidentiality is not required/desired.


Print Transfer Distortion

Question: I am creating artwork for a screen printing application that transfers the design to a pyramid shape using a silicone pad. How can I anticipate the distortion or better yet template the distortion so it will look correct on the piece even with new artwork designs? I print to a flat surface and pad print to the pyramid shape surface.
Comment: Why wouldn't the side of the pyramid not be flat?
Comment: can't you simply place the pyramid at such angle that the printing surface is flat perpendicular to the printer?
Answer: Placing artwork on a pyramid is simple, if nothing continues over the seam. The content on all sides can be placed and positioned separately.
Let's have a pyramid. It's of the common type (=the sides are equilateral triangles). Place your artwork slices A, B, C and D onto the triangles:

The angles of an equilateral triangle are all 60 degrees => Rotate them with 60 degrees differences and align side by side. Here are 2 possible ready-to-print arrangements:

If your artwork happens to be designed for placing onto a pyramid or you do not care of straightness, fitting and symmetry, you can place the artwork directly on aligned triangles.
Designing a shape which fits on a pyramid and continues over seams is discussed here:
Designing repeating pattern for top section pyramid
Things start to be tricky, if your drawing (which can also contain some texts) isn't designed for pyramid and you want to print it over a seam to have enough room. How to map the image without losing the continuity on the seam? In addition the texts must be well readable over the seam and all graphic shapes must be recognizable, preferably like there's no seam at all.
We try few different methods with a random drawing. It should be placed to cover a good part of 2 triangles The red line shows the wanted place of the seam.

The texts have intentionally letter spaces on the seam. This is optional, but it reduces the needed accuracy and there's no need to split individual characters.
The simplest approach is to place the drawing as is, Here it's as flat and as seen on a pyramid. The 3D view is "perpendicularly towards the seam" It's nearly the isometric projection, but seen from a little higher angle, just about to reveal the back side => 3D "renderig" is made simply by squeezing horizontally to 82% (checked in a 3D CAD program) and adding some shading

If the drawing is stretched horizontally to 121% before placing, the 3D view would be undistorted:

Unfortunately the view is perfect from that one direction. From elsewhere it seems tilted and distorted. Here are 3 different views of the same arrangement as a screenshot from a freeware 3D CAD program (the drawing is stretched to max size):

The texts are tilted and they have a sharp reading direction bend on the seam, when the watching direction is not the optimal one. You must radically distort the drawing to make the reading direction continuous or at least natural looking (=horizontal). Unfortunately that really means heavy distortion.  There are infinitely different possiblities, but we discuss 2 of them. See the flat images:

In the left there are drawn (=blended in Illustrator) parallel lines which are horizontal after the triangles are bent to pyramid.If text are forced to follow these lines, their reading direction is natural altough there's an angle at the seam.
In the right there are circular arcs. Texts will continue smoothly over the seam, if they are forced to follow the arcs.
NOTE: Actually the texts must be curved only at the seam. They can be horizontal to the left from the red line and to the right from the green line. We skip the mixed version
Forcing texts along circular curves without splitting the drawing to parts is possible with Illustrator's Envelope distort. Preset warp pattern "Arc" works for this:

the drawing is placed in and grouped with a rectangle. Its midpoint is on the wanted place of the seam.
the drawing is placed on 2 adjacent triangles. The drawing is squeezed horizontally about 50% because warping will make it wider
Envelope distort > Make with warp > Arc > Horizontal -66,7% is applied to generate 120 degrees arc
Envelope distortion is expanded, everything is ungrouped, all extra parts are deleted.  The simplest 3D view is formed by shading the triangles and squeezing all horizontally to 82%.

We see the bottom of the drawing is bloated. It would be useful to redraw it. Just in this case it would be easy, because it's a curve with a pattern brush. But that's actually like the drawing was redesigned to fit on a pyramid.
Forcing the text lines horizontal is possible by applying Illustrator's transforms. Left and right halves need opposite deformations. Most easily this is done as follows:

split the drawing to separate parts along the wanted seam line. Group both halves with an equal rectangle
apply every distortion step mirrored to both halves.

An example:

The drawing is splitted and the halves are temporarily shifted apart.Both halves have got a grouped rectangle to make the sizes equal. Splitting is actually made by duplicating and inserting opposite clipping masks.
The halves are skewed. It's Object > Transform > Shear > Vertical, angles are +30 and -30 degrees.
Both halves are selected at the same time. With the free transform tool bottom corners are dragged apart and top corners are pushed closer each other

Step 3 is optional, skewing can be enough. NOTE: The free transform tool is tricky. To drag a corner you must

select the object or objects
hover the mouse over the corner until the drag arrow appears and the rotation arrow goes away
press and hold left mouse button without moving the mouse
press and hold the Ctrl key
drag the corner

To drag 2 adjacent corners symmetrically holding Ctrl isn't enough, you must at the same time hold Ctrl, Alt and Shift keys. If you stop dragging and want to continue, you must start from the hovering.
Here are the results as simplest 3D rednerings (= extra parts removed,shaded, squeezed horizontally to 82%):

If you make these as physical printed pyramids, they would not look right (tested) because there's a conflict. The drawing is printed on the tilted surface of the pyramid, but it's like a vertical folded poster. Eyes do not find the right interpretation. It can be helped by adding some detail which make the lie "they are folded vertical posters" stronger:

I tried this in practice (=printed a non-squeezed version, clipped the extras off and folded it to 90 degrees). Watching it only one eye open (=no stereo) the eye suddenly accepted the lie. It took about ten seconds to forget the stereo view. => When watched both eyes open, the distance must be several meters
Done.
Answer: I do not understand what is the distortion, because I asume a pyramid has flat faces.
If you are looking for a specific projection, for example seeing the image from a top view, a cenital view, I would use a 3D program like Blender, project the image and unwrap the texture.
Answer: The first option that you have would be to create a grid on the flat transfer surface large enough to encompass the pyramid. Use lines of sufficiently small spacing and as thin as possible, to get best resolution.
Cover your pyramid with removable printable material (paper?) and perform a transfer print.
When you unwrap the paper, you'll have a clear outline of the printable surface. That's one step accomplished for your template.
The grid pattern you've now printed will be distorted to match the contours of the pyramid. If your pyramid consists of only flat surfaces, you should have a clean grid on the paper. If there are contours/curved surfaces, the grid will be distorted an appropriate amount.
It would be necessary to scan in the paper to transfer the grid pattern to an image editor such as Photoshop or Paint Shop Pro. I use PSP and occasionally "un-distort" an image. In the case of your grid, you would use a similar method and create a template for that tool that would duplicate the distortion in the opposite direction for your art work.
Alternatively, less easily accomplished and dependent on one's skill with 3d modeling programs (Blender comes to mind), you could model the pyramid to scale, create a grid to represent the texture of the model and impose it on the model. Once placed, you would then "unwrap" the grid to create your template.
Texture in the above context refers to assigning colors, gradients and images to surfaces of a 3D model.
I see Rafael has provided for this same option in his answer, posted while I composed mine.
Answer: I have worked with pad printing many years ago, and we did print on many irregular surfaces.
To reduce problems we always fabricated a special cradle for the object to be printed on, to make the surface as horizontal as possible (our printers had a vertical axis).
You don't need to worry about distortion due to the shape of the pad, because if the pad applies the same amount of pressure to the image plate (the one with the ink) and the printing surface the print should transfer without distortions.
Answer: The true answer to the distortion replies is this is a square bowl that is upside down to print the out side. The bowl comes in 3 sizes. I expect that a flat screen print transferring  to an upside down square bowl will distort.
Other bowls will also be in the mix that are round and steep sided. All new kinds of process challenges we are not currently versed in. 3D modeling is possible.  Solidworks can output in photoshop or illustrator formats but I do not know if the are still 3D when opened. Heard of Blender but not familiar with it.

Print Transfer Distortion


pasting a folder through an sftp connection in notepad++

Question: I want to paste a folder through notepad++ to a repository I connect to through sftp. Notepad++ only allows me to upload one file at a time which is not very practical. Any ideas other that winSCP (it has too many bugs and I cannot run it from my laptop...). I am running windows.
Answer: Have you looked at other tools that let you "mount" the remote server as a local drive-letter?  Something like  expandrive.   or perhaps you could use rsync or unison to make a mirror of the remote repository through ssh & update the remote after you've made changes... or you can try & hack something together like tunneling a samba session through ssh .


240 volt 20amp outlet

Question: I have a NEMA 6-20 240 volt 20amp single outlet.  It has three wire connections on it.  Two hot and one ground. There is a four conductor (including ground) romex cable coming out of the box. What is done with the neutral white wire?  I don't think it is used.  Should it be disconnected at the service panel?
Answer: A NEMA 6-20 does not require a neutral. The devil is in the details. A NAMA 6-20 configuration is for a 240V, single voltage connection. If it were to have a neutral the configuration would be a dual voltage NEMA 14-20, 20A 120/240V.
If you don't need the neutral you can simply wire nut it off and leave it in the box.
Answer: Don't cut off the neutral wire at either end.  You never know when you may need it.  Just cap it off on both ends, then roll it up back toward where it enters the box.
NEMA 6-20 is a legit, modern connector.
 src:HD
The NEMA 6-20 is exactly what it looks like: a slight rearrangement of the common duplex receptacle.  It fits in the same junction boxes, uses the same cover plates, etc.  It is typically used on 240V-only loads, which are loads generally too large to be powered by the limited 1440 watts continuous available from a common receptacle.  The 6-20 can handle up to 3840W continuous, or 4800W intermittent.
If for Code reasons you need a 1-socket 6-20 receptacle, that's not a problem.

 src:GALCO
If you need the same power, but your machine also needs 120V power for some reason, the NEMA 14-20 will do the job.  You can change to that at any time, just by connecting neutral at both ends.  This is a bulky receptacle, and it won't come in duplex, and will struggle to fit in a 1-gang box.
Comment: @JimStewart the charger's instructions called for a dedicated circuit. It's conduit and we could throw in 2 more #12 circuits in there, 9 wires is *just* within the fill and derate limit for 1/2" conduit.  If I was doing an electric car charger kiosk outdoors with 3-4 fast chargers, I would have preferred the heavier wire and chargers rated to share a circuit.
Comment: @JimStewart Cars don't, chargers do.  You can get chargers of almost any size (i.e. designed to make the most out of whichever circuit capacity you are able to provision, 120/15, 20, 240/15, 20, 30, 40, 50 ++ even 3-phase.  Nothing like provisioning 16kw on three #12 wires!  Many chargers are switchable so they can pull dial-a-load.
Comment: Thanks for all responses. The single NEMA 6-20 outlet is for an electric car charging cord in the garage. It will not be used for anything else.
Comment: What model of car uses this receptacle?
Comment: How did you decide on 12 AWG cable, why not 10 or even 8 just in case you later want to ungrade to a higher current charging system? Or would this be just over providing?
Answer: First - terminology - romex does not include the ground wire in it's count.  Thus if your romex has 4 wires, and they are 2 hot, one neutral, then technically it's a 3+g wire and would be listed as something like 10/3 (assuming 10 awg)
That said, my understanding is that for new 220A installations, 4 wire outlets are now mandatory and 3 wire is only allowed for replacements.
If your box is feeding a 3+g to the outlet then you should install a 3+g plug.  Your 2+g plug would be against code as leaving wires partially connected is not permissible, as I understand it.
Comment: NEMA 6 (hot-hot-ground) is perfectly allowed.  It's *NEMA 10* (hot-hot-neutral) that is disallowed except where grandfathered.
Comment: can a 2+G wire be used from the service panel to outlet for this outlet?
Comment: It could be that wiring with 12/3  + gnd would make this more flexible if later you would want to put in a receptacle with  2 hots and a neutral.
Answer: I don't think it is either a code violation or a safety hazard to have an unused neutral conductor capped off in the box with a connection to any NEMA receptacle which uses only the two hot legs. You could disconnect the neutral in the panel, but some expert in the code could tell you whether that is required or advisable. I wouldn't do unless told that it should be done.
Changing to a receptacle with a ground presumably would not work because the appliances that would be powered with the NEMA 6-20 would have a plug which would not fit a receptacle with a neutral, I would think.

240 volt 20amp outlet


What does "./" mean in linux shell?

Question: What does the command ./ mean? For example, sometimes we call a file with ./config, sometimes ../config, thanks
Comment: `./some_file` means run some_file in the current directory. `../some_file` means run some file in the parent directory.  Perhaps this question explains it better: [Why do I need to type `./` before executing a program in the current directory?](http://askubuntu.com/q/320632/107450)
Comment: There almost certainly is a duplicate out there @Joren but in this case, that isn't a good one as it doesn't really explain anything about why it's required for executing things. Edit: Hmm maybe I'm making a bad assumption about it being executable.
Answer: ./config means you're calling something in the current working directory. In this case config is an executable. You have to specify the path for executables if they're outside your $PATH variable and that's why config isn't enough.
../config would be used if the config executable were in the parent of the current working directory.

What does "./" mean in linux shell?


Bathroom mirror fogging up even when bathtub is not in use

Question: What could possibly cause a bathroom mirror to fog up? Not the shower or bath, though, I'm sure about that. Because neither has been used for a month. So, what could cause that? And how should I fix that?
Answer: If it's fogging up without a local source of high humidity there are a few other things that could cause it (probably in combination):

The mirror being mounted on a cold/badly insulated outside wall.
An extractor fan in the bathroom drawing in steam from other sources (cooking, another bathroom etc.) which should be ventilated locally.
Damp, for example from leaking plumbing or weather getting in
Drying washing or towels over a heater in there
Answer: Well, a bathtub or shower stall are not the only sources of humidity. And humidity is the real reason anyways. But, concerning your problem, the answer could be... it could be anything, really. Even your basement could be the reason, unlikely as it is.  What I'm trying to say, perhaps, you should not be looking the source of humidity in the bathroom. Maybe, something else causes your mirror to fog up. In fact, it is entirely possible that the source is not in your home. If you live in an old apartment block, it can be just bad ventilation. It could even be the toilet.
Anyway, if you cannot locate or isolate the source of humidity, there is very little you can do. Perhaps, shaving cream could help. But it would be hard to not leave any stains, although that depends on the cream, I suppose. Anti-fog mirrors are another possibility. They all have different principles of work. Some of them resist fogging because they come with a hot water tank behind the glass. That sounds like it would work, only, such a mirror would be quite unwieldy. And you'd have to get a new mirror. Which makes it a no, I think. Some mirrors have anti-fog coating[1], but you'd still have to get a new mirror. But that also means there is a type of anti-fog coating specifically designed for mirrors.
What does it mean? Well, there might be other ways to treat the surface of a mirror, other than home remedies, at least. I've tried googling it, but other than a Wikipedia article, there was nothing useful on the first page.


Understanding "Hardware error from APEI Generic Hardware Error Source" error message

Question: Summary: I'm trying to understand exactly what the following error message means:
[17016.923750] {4}[Hardware Error]: Hardware error from APEI Generic Hardware Error Source: 1
[17016.923758] {4}[Hardware Error]: It has been corrected by h/w and requires no further action
[17016.923759] {4}[Hardware Error]: event severity: corrected
[17016.923761] {4}[Hardware Error]:  Error 0, type: corrected
[17016.923762] {4}[Hardware Error]:  fru_text: CorrectedErr
[17016.923764] {4}[Hardware Error]:   section_type: memory error

Details:
I have a server with an Intel(R) Xeon(R) CPU E3-1275 v3 @ 3.50GHz CPU that is running Arch Linux (3.18.6-1-ARCH #1 SMP PREEMPT Sat Feb 7 08:44:05 CET 2015 x86_64 GNU/Linux).
When I run dmesg I see the error that I posted above.  The errors are not that frequent, but they do seem to keep happening.  For instance the server has been up for 1 day now since the last reboot, and there are 9 instance of this error listed in the log.
I saw another question that asked about this error and there was an answer that suggested the problem was that the ECC memory is failing.
My questions are:
1) Is there any reference to support the idea that this error message is associated with ECC memory?
2) If I do have a failing DIMM is there a suggested way to figure out which one it is?  I tried running memtest86+, but it did not report any memory errors.
3) If the OS reports ECC errors have been corrected does that really mean the DIMM is failing?
I wouldn't be so concerned if the only problem was a few messages in my log file.  But I have also noticed that sometimes the server hangs unexpectedly.  The machine is being used for research and it's not as important for it to be stable as it would be if it were a production system.  Still having the machine hang can be problematic.  So I would like to know exactly what this error message means, and if I need to replace a component it would be nice if there were a way to figure out which component needs replacement.
Edit
Currently the server has been up for 8 days without hanging and I see 148 instances of this error message in the logs.  In addition I see one instance of the following message:
[671211.188084] EDAC MC0: INTERNAL ERROR: csrow value is out of range (6 >= 4)
[671211.188333] EDAC MC0: 1 CE ie31200 CE on unknown memory (channel:1 page:0x0 offset:0x0 grain:0 syndrome:0xc8)

I guess it is likely that one of the DIMMs has a problem.  Still I would be interested to know in case anyone had any information about how to interpret these messages, in particular in order to figure out which DIMM is possibly failing.
Comment: Perhaps you could try upgrading the kernel to see if the error persists.
Comment: I'm on kernel version 4.2.5 now and still have the error message.
Comment: [Related](https://unix.stackexchange.com/questions/150451/apei-generic-hardware-error), possibly duplicate.
Answer: FYI I appeared to have a similar issue as this. It was on a Xeon with a Debian recently upgraded from Wheezy to Jessie.
As it turned out the solution was taking the memory out, and reseating it, and everything was back to normal.
Answer: From what I have read this error is normal.  Has to do with UEFI.  Needs a kernel change to get rid of the error but apparently it's harmless.


After my PhD how much salary should I expect as a professor of computer science?

Question: It's easy for me to find out salaries for tech-jobs but it seems Professor salaries are quite hush-hush. I really love to teach and would be more than willing to join academia. However, I may choose to work for a few years in the industry before doing so. But even for information sake it's really really hard to figure out a tenure and tenure track professor's salary. It's rude to just ask my professors/colleagues directly :P
I'm interested in knowing an 'expected' range for the following countries - preferably both state and private universities (Computer Science). I'm not sure if there is a difference between the MS/PhD faculty and BS/B.Tech/BE though, but it'd be great to highlight the same.

United States
Europe (Switzerland, Germany more preferable)
Australia/New Zealand
India/China

Intent of information - awareness to take a better decision on the 'money dimension'. Please don't get me wrong, I am not intending to take a job with the most money but if a faculty position pays USD $50,000 per annum after 5 years of intensive effort, I'd like to hold off for a while. If "it depends" then on what does it depend and after I satisfy those dependencies, what can/should I expect?
UPDATE: Just for clarification, I am on the verge of completing my PhD thus piquing my curiosity about the remuneration since it's difficult to ask your advisor or other faculty members. I have and mostly been asked to wait for infinity for the response, hence the question :) I just wanted to know so that I can take an informed decision when I'm at the crossroads of applying for academia vs industry. Please don't get me wrong. I DO NOT wish to undermine the value of a PhD. I'm genuinely curious and I personally enjoy every bit of my work and it's NOT ABOUT THE MONEY :)
Comment: The framing of the question is weird.  _Before_ getting a PhD, you have no hope of a professor position at all.  The number of years you take to finish your PhD has no significant effect on your expected salary.  There is absolutely no guarantee of a faculty job after completing a PhD, even in computer science; quite the opposite.  And finally, CS professors make *significantly* less than their peers in the computing industry; if you're really that worried about money, **DON'T GET A PHD**.
Comment: @JeffE - noted and updated accordingly. Apologies for that. I'm NOT worried about the money, just curious :P
Comment: Slightly related: http://academia.stackexchange.com/questions/718/business-school-professors-how-different-are-they
Comment: Take a look at http://www.fin.gov.on.ca/en/publications/salarydisclosure/2012/univer12g.html for Canada.
Answer: For the United State, see http://cra.org/resources/taulbee/ for salary survey data in computer science.  Of course, as Suresh points out there's enormous variation.  The median salary for a tenure-track assistant professor in computer science at a US research university is about $90k, but some make quite a bit less.
Comment: Note that the $90k figure is out of date - check the survey itself. Median in 2015 is up to $99K. They survey will be a few years behind, too, so it's worth extrapolating based on growth over the past few years (seeks like ~$3K growth per year).
Answer: First of all, you assume that after finishing a PhD, your chances for a professor position are good. As far as I can say (a CS post-doc@EU university), this is generally not straightforward unless you deliver a star PhD. Otherwise, expect at least one  post-doc appointment. After a return from industry, unless you were very active in the research community during your time with a company, again post-doc is what you should expect.
Now to the answers, a European perspective. Generally in the EU, probably except for the UK, the academic salaries are governed by tables subject to annual change. In many countries these would be fixed without a variable component based on performance.
Germany:
The positions of research assistants underlie TVoeD regulation (BAT in the past). There is no special category for a post-doc, all research assistants are treated equally. The salary scale reflects the individual's experience, that is, officially years of employment. Generally that should include also academic experience abroad too. Find the current tables also here - note the scales differ for West Germany, East Germany, Berlin and Hessen. You are interested in the class E13.
Professorships are remunerated according to the W scale. Again the salary differs from state to state, but according to this, we speak a baseline of about EUR 47k, EUR 53k and EUR 65k a year for W1, W2 and W3 professorship positions. W1 is for a Juniorprofessor, roughly equivalent to an assistant professor. W2 and W3 are two different levels of full professorship, the particular difference is mainly an experience/salary issue. The salaries are again graded in steps according to the number of years of experience at the particular position. You start at 0 and from there your grades increase.
Note however, at least in CS and generally in STEM, Germany does not fare very well in terms of foreigners on senior academic positions. It's relatively rare to encounter a non-German (or Swiss/Austrian) holding a professorship at a German public university.
Netherlands:
The system is slightly simpler than in Germany, the salaries are fixed according to CAO (Collective Labour Agreement) regulation and subject to annual/bi-annual negotiation and modification. You can find the information on CAO here. Salary-wise you are interested in the salary table, columns H1 and H2 (Professor 1 and Professor 2). These are full professorships. Here we speak about EUR 65k and EUR 58k respectively as a baseline from which the annual grading increase starts. For a assistant professor, the columns of interest are 11-13, so the variance is big. E.g., 11 is also for post-docs, though sometimes assistant professors get that as well. Depends on the particular position.
Now considering positions in the Netherlands taken by foreigners, you are eligible for a so called 30% rule which basically states that you do not have to pay taxes for 30% of your income. That leads to a significant salary increase for foreigners in the first years of their employment in the Netherlands so even the assistant professor salary grades might not look extremely interesting, considering the 30% rule, they turn out to be fine.
All the quotes should be understood brutto before taxation and social system/healthcare/++ deductions.
Comment: In Germany, you can (and usually will) get *Zulagen* on top of your W salary, which are a matter of negotiations. Having a job offer from a different university helps in these negotiations, as does having a good paper output or getting a lot of grants. *Zulagen* start at 250 EUR per month, but can go up to 50% or even more of your base salary. In addition, you get *Familienzuschläge* for having a spouse/kids, and subsidized health insurance (*Beihilfe*). It's an arcane system, but the W base salary definitely is not the full story.
Comment: Regarding the salaries in Germany, do these numbers include the taxes? or is this what the professor ends up receiving in cash?
Comment: @MohamedKhamis: see my comment at the end of the answer. All numbers are pre-tax, i.e., subject to taxation.
Answer: While it is a good question which people naturally would like to know before committing for a PhD, a definitive answer is next to impossible.
Your question on Indian public sector is best answered by Prof Giridhar Madras's blog. In this post, for example, he talks about a new professor getting Rs 52000 per month plus accommodation. Then there are scholarships, consulting work for many small companies (whose numbers are bound to be high in a rising economy), vacation period of 3 months when you "get paid in international currency" (ref:GM's blog), paid conference trips, travel allowances within India, etc.
You cannot directly compare this with any private sector company: you are obviously going to get paid more, but you are stuck inside those cubicles with monotonous work and you are likely to lack intellectual freedom.
Regarding Indian private sector, things are hush-hush, and depend on your personality, education, job offers, negotiations, etc. But I would say deemed universities in India are particularly wealthy given India's population and the general affordability to pay high fees. On the flip-side, your colleagues and students are unlikely to be intelligent or sharp, as most of India's intellectual wealth generally lie within the IITs (and at times, the NITs, CEG, etc).
Answer: There are many factors that go into figuring out the answer.

location - different countries/systems have different ways of paying
area: salaries vary HUGELY across areas. You didn't mention your area, but you can expect that salaries in the humanities are less than those in engineering which might in turn be less than those in law/business/medicine
private/public: in the US salaries of profs at public universities are public knowledge - if you look up the university of Utah you can get my salary and that of all my colleagues. Public universities usually have public scales - private universities are - well - private.
level: I assume you're starting at the lowest level, but based on experience/demand things can vary a lot.

To get information, best to lookup surveys that are usually run by professional organizations in your area - they'll give you good ballpark estimates.
Ultimately you have to remember that a faculty salary, like any other salary, is a market-driven quantity with value set by the market. So it's very important to understand the local economy that drives the numbers - the above factors are some of the main drivers.
Answer: There's enormous variation in both field and university. I would however suggest that professorial salaries are not entirely "hush-hush". For example, the University of North Carolina system has all their salary information available to the public:
http://www.newsobserver.com/2011/02/24/1011452/university-employee-salaries.html
Look up the department you're interested in, get some names of their lower ranked faculty, and look them up to give yourself a ballpark estimate.
They also break down State and Non-State funding so you can get an idea of how much of the salary is hard money and how much of it is based on grant support.
Comment: You can search for faculty salaries at about 50 different public US universities here: http://www.collegiatetimes.com/databases/salaries
Comment: Similarly for Illinois: http://data.illinimedia.com/salaries/index
Answer: Australian discussion
Pay scales are available on most university web sites:

Deakin
Monash
UNSW

The first challenge is to get a job.  You may need a year or two post doc experience before you can get a level B lecturer position. For reasonable performance you'll typically go up one increment each year (i.e., B1, B2, etc. to B6). To go to C (Senior Lecturer), D (Associate Professor), or E (Professor), it is not automatic. You need to meet more criteria.
Comment: Isn't there any difference in pay across dept.s? Does an asst. prof. in a business school earn the same as one in an engg. dept.?
Comment: The general rule is that the pay is the same for equivalent rank in a given public university. However, there are a few exceptions; some business schools pay more. I have also heard people say that in domains where external job opportunities are greater that less is required in order to achieve a given rank (but this is open to debate). I'm sure there are other exceptions also.
Answer: Your expectation should depend on both the potential salary (which the other answers are provided reasonable estimates of) and the probably of the outcome (which most of the other answers have not touched on). If you have not started a PhD program yet, your expectation about how much you will make as a professor should be $0 since the probability of becoming a professor is essentially zero. Even using generous numbers 0.5 get into PhD programs, of those 0.5 finish PhD (0.25 of those who apply). Of those only 0.5 will get a post doc position (0.125 of those who apply for a PhD). Then you have TT position (0.06) and tenure (0.03).
Answer: Australian starting salary with a PhD is around 70-80K USD. Up to 100K after 5 or so years, ++ if you are a super academic/head the faculty etc.
Cost of living is quite a bit higher than the US.
Tenure doesnt exist in Aus, you will be an academic as long as you can bring in research dollars/you teach important subjects that bring in students. There are no private universities here.
Comment: There *are* private universities in Australia, they are just relatively uncommon. http://en.wikipedia.org/wiki/Private_university#Australia
Comment: Australian  computer developer salary is about 120K-160K Australian USD
Answer: Following this question: What's the net income of a W1/W2 german professor?, and according to this link, in Germany and in 2008, the monthly gross salary could go from 3500 euros per month up to 7000 euros per month.
Answer: in Spain you can max out some 35k€ / year
Some details to complete the answer:
I am "Profesor Titular" (senior lecturer with a tenure position, like a second class Professorship). I have 15 years experience
My total income last year was EUR 45ooo. That included 2ooo for an extra course, 27oo for a positive evaluation of research and 86oo for the 15 years. That gives a basic salary of about EUR 31ooo when you start. But when you start you have a lower category, so the first salary is lower. There are also variations depending on the region.
I pay about 12ooo for taxes and insurance. That leaved some 33ooo as true income.
With the cutbacks, I expect some 30ooo this year.
Comment: Any references to support that?


Clotted cream broke in the fridge

Question: Yesterday, I purchased a package of Kaymak (the Turkish version of Devonshire clotted cream). Normally, it would act just like clotted cream. It was in the fridge when I purchased it and looked fine. I put it in the fridge at home, and it broke. Now, it's just a container of thick cream.
Why would that have happened? Can I rescue it? (Maybe use the cream and try to heat again?)
Comment: ah, what do you mean by "broke"?  Because "it broke" and "just cream now" are pretty opposite.  Clotted cream is, unless I misremember, thick, partially dehydrated and fermented cream.  I can imagine no transformation that would lead this to convert back into cream (there isn't enough *liquid*, and unfermenting is...not *likely*).  If you mean the product looks like it tried to crack and weep - as long as it smells good I would try just mixing it back together, like with yogurt, and see if that fixes it.  If it just looks liquid check the flavor, maybe this style or brand is just thinner.
Answer: I believe you're talking about the breaking of emulsion. The solution is to simply whip it again, a food processor should also be fine for Kaymak.
Comment: I would wonder if pH went down to cause the break. Give it a smell and a taste before proceding.

Clotted cream broke in the fridge


Make the dots the color of your logo

Question: The grid shown below is what i have right now but it just overlays. I want the white dots to be using the image texture color.
I have this method i have seen with simon tommes.
Where he uses a image texture and 'projects' it over the material set up by some math nodes. The image texture does clip to the knittr (in simon tommes shader) i put a picture here.
I have this setup, also with math nodes. made a grid of dots

This is my set up of nodes
Comment: so what is it you want to achieve? Make the dots the color of your logo?
Comment: yes! and when the image texture 'overlays' even just half... then the dot still has to be filled full.
Answer: You need to pixelate your UV coordinates which you can do as so:
<code>x - (x modulo pixelSize)
</code>
You can then use the same modulo nodes by normalizing their outputs to get the coordinates for your discs:
<code>(x modulo pixelSize) / pixelSize
</code>
Create your discs the same way you have already done and use them to mix between your image texture output and a background color.

I hope this helps.
Comment: I always split vectors if I'm only using two components. It saves unnecessary calculations. Force of habit.
Comment: Nicely done, I was being too hasty.
Comment: .. and nowadays, you could save yourself a few nodes by using Vector Math on whole vectors, which provides, e.g., Vector Modulo, and Length.. but that wouldn't match @Mik's original tree.
Comment: Ahh.. I see! That makes sense.
Comment: @FrederikSteinmetz Thank you, and don't worry, we all can only answer with what we know at the time and pixelation and modulo just happen to be something I've been working with a lot recently. At least you tried to help the OP, I hope he appreciates the help despite not showing it.
Answer: There is another method though [EDIT: the method below is more efficient].  Create a plane and subdivide it a lot.  Create a disc or sphere, parent it to the plane. (in the screenshot it was a cube).
Parent the sphere to the plane.
Go to object properties and where it says instancing, check faces.
Give the sphere a material, add a texture coordinates node, check from instancer and connect the UV out to vector of your logo texture. It's probably easiest to put the logo on a white background.
Comment: U want to think that its not possible. U see in the example shown above mine (which is from Simon Tommes) He has created the exact same thing. The image texture mapped to the mathematical shader (using math nodes). The way ur describing it uses a lot of vertices... thats not what i'm after. actually, Ian Hubert has a tutorial on that.
Comment: You can absolutely do that in a shader, in fact you're halfway there! You just have to pixelate the UV coordinates fed to the Image Texture. To do this you should Separate the coordinates, then for each axis use a Modulo node (the second value will affect the size of the pixel) and subtract the result from the original axis:
eg. X - (X mod 0.1) will give you ten pixels horizontally.
I would use these coordinates to create your discs as well so they match the pixels of your image.

Make the dots the color of your logo


Jodatime groovy/grails daterange search with TimeZone conversion

Question: I am currently storing Joda DateTime (Datetime+TimeZone) values into a database.
What I want to do grab 24 hours of records based on the timezone of the user, rather than UTC time. I.E. I want to grab the records between 00:00GMT-24:00GMT for people whose timezone is GMT, and 00:00PST-24:00PST for people whose timezone is PST.
Now I dont think I can do this in a HQL query, as obviously HQL is not going to perform a DateTime.toDateTime(toZone) conversion for me. So is it possible to perform this kind of range search in groovy/grails?
Answer: I thought about this a little more, and the solution might be to attack it another way. Instead of trying to perform the toDateTime(zone) at the hibernate level, do it at a higher level - i.e. on the creation of the start->end search criteria;
<code>    DateTimeZone toZone = DateTimeZone.forID("Europe/London");
    DateTime now = new DateTime()
    DateTime today = new DateTime(now.year, now.monthOfYear, now.dayOfMonth, 0, 0, 0, 0)
    DateTime yesterday = today.minusDays(1)

    def queryStr = "from JODATesting j where j.thedate > :date1 and j.thedate < :date2"
    for (JODATesting joda: JODATesting.executeQuery(queryStr, [date1: yesterday, date2: today]) ) {
        println("##### Joda"+joda.id +"=" +joda.thedate.toDateTime(toZone));
    }
</code>
Comment: This isnt an ideal solution however - some feel free (please!) to offer something better - preferably using a Criteria.


Why do DC motor drivers (eg MAX14870) brake during the low part of the PWM signal?

Question: The 2nd line of the MAX14870 Function Table in its datasheet shows when PWM is low the outputs M1 and M2 are connected to GND and the Operating Mode is "Brake". My experience of DC motors indicates that there is a lot of drag when their terminals are shorted together so I agree that the motor will be braked under these conditions. I would expect PWM to alternatively power the motor through two quarters of the bridge in one direction or the other (set by the DIR pin) then allow it to freewheel with M1 and M2 at high impedance.
I have considered feeding EN with a PWM signal however there are significant turn-on and turn-off delays so that is not an option.  I am left wondering how drivers like this work?
Comment: What happens if you remove the diode to GND in a buck convertor?
Answer: There are two devices in the data sheet: -
The MAX14870's main application is for PWM control of a DC motor and, under these circumstances, the lower MOSFETs are used as a synchronous diode as per any synchronous switching regulator.
The MAX14872's main application is as a DC motor controller and, instead of taking a PWM input, it uses a forward/reverse control input. For this device, the truth table shows that it can be used in free-wheel mode (no braking): -

And, it can also be used to brake, depending how you drive the FWD and REV pins. If you bought the wrong one then I suggest you buy the other and take care reading the data sheet.
Comment: Thank you @andy-aka for your answer. I interpret it to imply that the MAX14870 should be used to control the current through a DC motor which would make it suitable for torque control, such as a tensioner system. Whereas I am wanting to control speed (and position in the bigger picture).
Hence the MAX14872 is more suitable. Is that in fact the case?
Comment: @KenMercer I'm not making a recommendation; I'm only pointing out that you can use the 14872 in free-run mode because that appears to be what it is designed for. I'm also recommending that you read the data sheet to double-check everything. There is neither enough room nor time nor site-allowance to permit a full analysis of your requirements. This is a Q and A site and not a product recommendation site. Here are some rules and guidelines: https://electronics.stackexchange.com/help/on-topic - they can be found by clicking on the top right "?" icon.
Comment: Fair point - this is morphing into a different question. I'm accepting your answer.


Where do I connect a C wire in a Rheem Furnace REAB 1415J?

Question: I'm upgrading the thermostat with a Honeywell wifi one. I found all cables at the thermostat end, but can't figure out where to connect the C wire to the furnace (Rheem REAB 1415J).
Comment: Can you identify the 24VAC transformer?  One wire coming from it will go to the same place the "red" wire on the thermostat, and the other will be what you need for the C wire.  There are plenty of C-wire questions to help once you find the transformer and associated connections.
Comment: Can you get us a better photo of the schematic?
Comment: Do any of the other questions on the site regarding the C-wire help (there are quite a few)? If not, how is your problem different? A photograph of the wiring and the wiring diagram would also help.
Comment: Is there a schematic printed inside the unit? If so, can you post a clear photo of it?
Answer: In thermostat wiring, C stands for Common. Look for a terminal labeled Com, which is another abbreviation for common.
I did not look up your thermostat, however it is likely that it needs the common wire to work properly. Many thermostats don't really need a common wire but it is almost always recommended to have one especially with these "smarter" thermostats. More information about the common terminal can be found here and here. Some thermostats have a couple of batteries that they can run off of instead of using the common but that would likely not include a wifi enabled one because it uses more power than a simple programmable model.
I hope this helps.
Answer: C is the unswitched line from the transformer. 2 wires come from the transformer, look for the one that connects direcctly to one side of every load and find its terminal. The switched line is the other line from the transformer and goes to all the controls. Most systems use C. Trane/ American Std use B.


Use Power Automate to Send Email with Link to Created Item in Datasheet View

Question: I have created a SharePoint list to automate and track PO requests. Once the request has been approved, I have a Power Automate flow that sends an email to the team so they can create the PO as well as a confirmation email to the requestor. In the confirmation email I have a link that takes them directly to their form so they can modify if necessary. In SharePoint, I have a Datasheet view that has 3 fields (columns) the PO creator needs to update once they have created the PO. These fields are not visible in the form. I have inserted the URL to the Datasheet view as well as the ID of the item in the email. It will go to the Datasheet view but I cannot seem to get it to go to the specific record that needs updating.
Answer: For refering to Item via URL you can choose:
1) Filtered View
Use  ?FilterField1=ID&FilterValue1=2 query string URL to filter item with ID = 2.
(IMPORTANT NOTE: "ID" column must be visible in the view, otherwise it will not work, maybe thats the issue you are experiencing.)
Example:
https://tenant.sharepoint.com/sites/Site123/Lists/CustomList/AllItems.aspx?FilterField1=ID&FilterValue1=2
2) Direct link to the Edit form
For link directly to edit form of item ID = 2 use this URL parameter /EditForm.aspx?ID=2 or /DispForm.aspx?ID=2 for Display form.
Example:
https://tenant.sharepoint.com/sites/Site123/Lists/CustomList/EditForm.aspx?ID=2
You can refer to Microsoft Learn article for more tricks here:
Query String URL Tricks for SharePoint and Microsoft 365
Comment: Popkornak,

Thank you so much for your help. I did have the ID field visible but the FilterField and FilterValue solved my problem.


I wanted to make homemade pickles, does it matter what type of salt I use?

Question: I've got the spices, jars, etc. I was wondering if there is a special salt, or can I just use table salt?
Answer: "Pickling salt" is sold, the main difference being the absence of iodine and anti-caking agents. The anti-caking agents can cloud the pickling liquid, but shouldn't effect the flavor. Iodine can impart a bit of a bitter aftertaste, and some sources say can "react adversely with some foods".
I've never noticed a difference between the taste of table salt and that of kosher/pickling salt, but apparently others can. In any case, the differences are fairly minor. I would recommend investing in some kosher salt (its cheap) and using that in place of normal table salt. See Why do some recipes recommend Kosher salt?
Comment: True. I neglected this because when I've made pickles, I mix the brine and boil to incorporate the spices. This dissolves the salt before it contacts the thing to be pickled, so shape isn't a problem.
Comment: it isn't all about differences but how they act in given situations.  Just as Kosher salt is named so for its use in the koshering process because it is better at absorbing the blood from the meat, Pickling salt is named for the reason @JustRightMenus describes. It is a "use the correct tool for the job" situation.  Sea salt on the other hand, you can have a lot of taste variation, even between different sea salts, as they have differing mineral compositions.
Answer: Pickling salt is very fine-grained, so that it will dissolve easily. It is important to have an even salt solution when pickling. You can use a more coarse salt; just take care it's dissolved completely.
Iodized salt can also turn the pickled items a darker color.
Answer: In addition to the things other answers have mentioned, its important that you use the same amount of salt, by weight, not volume.
All of the following are actually different amounts of salt, despite being the same volume:

1 cup Diamond Crystal kosher salt (~135 g)
1 cup Morton Kosher salt (~250 g)
1 cup table salt (~300 g)
1 cup Morton's canning and pickling salt (~220 g)

Those weights come from:

New York Times Diner's Journal, Warning: Measure Your Salt
University of Washington Cooperative Extension, Homemade Pickles & Relishes (note: PDF).
Answer: One thing you also might want to consider when making pickles is the process of heating versus not.  I recently learned that the crispy store bought pickles are pickled at low temps (my preferred method), where as softer pickles were most likely heated first.  Not sure which method you are using, but this may help as you move forward.  My step-mother recently made some awesome pickles with chilies and dill and garlic but heated them first in the canning process and they turned out a bit too soft for my liking.
Regarding salt...  I happen to agree with Adam's comment on the brine.  I usually confirm salt is dissolved before it goes into the pickling solution, so it's not a problem.  In that respect, a good quality salt, regardless of shape and size should be used (feel free to grind it in a mortar with a pestle if you think it should be finer).  I happen to use coarse Kosher from Morton for most things...


What is an easy way to put an element in the middle of a PHP array?

Question: Say you have a 10 element indexed array and you want to place an element somewhere in the middle (say index 3). Then I want to have the rest of the array shift and thus be 11 elements long. Is there an easy way to do this?
I am surprised there is no put() function or something.
I know it would be easy enough to do this with a combination of array_splice and array_merge but I was just wondering if there an easier way.
Answer: array_splice() does this
$input = array("red", "green", "blue", "yellow");
array_splice($input, 3, 0, "purple");
// $input is now array("red", "green", "blue", "purple", "yellow");

Comment: thanks..this is why i asked...(not too obvious from reading the docs)
Comment: I agree, i missed this though: "If length is specified and is zero, no elements will be removed. "
Answer: Unfortunately your best bet is what you described in your post.
Answer: If you use array_splice(), PHP will still have to copy half the array to do the insert, which will be a performance hit for large array sizes.   Maybe you should be using a list or tree datastructure instead?
The only time I've ever needed to insert into the middle of an array was when I was doing some operation that's substantially similar to insertion sort.  Maybe you want to store the items unsorted in an array, and then sort them once you've added them all?
Answer: No PHP function can currently handle this. It is not too difficult to whip up your own, however:
function array_insert(&$array, $insert, $position) {
    $c = count($array);
    $slice = array_merge($insert, array_slice($array, $position));
    array_splice($array, $position, $c, $slice);
}

$array = array('a','b','d','e');
print_r($array);
array_insert($array, array('c'), 2);
print_r($array);

Will result in:
Array
(
    [0] => a
    [1] => b
    [2] => d
    [3] => e
)
Array
(
    [0] => a
    [1] => b
    [2] => c
    [3] => d
    [4] => e
)

You can probably add checks if the position is bigger than the array, the insert is not an array, etc.


How to turn an MBA on when the power button is not functioning?

Question: My MBA power button is not functioning (on or off). I would like to know how to turn it on, in case the MBA is accidentally shut down. I have seen the technician do something inside but it's not open knowledge. Can anyone share their technical experience pls. I am confident I can, given specific steps. Thanks!
Comment: Are you still under warranty?
Comment: Unsure if it still works on current machines, but old Apple (USB) keyboards had a power button on top right.
Comment: out of warranty. thanks for the reply.appreciate it.
Answer: Since you think it is a permanet damage the best option is to replace the keyboard.
If you are not sure it is a permanent damage and before you replace the keyboard consider this:
There is a tiny spring loaded contact under the key cap.
Sometimes (rarely) a food or dirt get stuck in there.
1- Use a air can and blow around it, hoping to blow out the dirt.
or
2- Use a Alcohol (with Computer in OFF mode) soak it, wait for 10-20 minutes.
Use Hair blower and warm it up to evaporate the alcohol (not to hot)
or
3- Buy new and replace the keyboard, it is not a walk in the park but doable. It might cost you aprox $60 for keyboard, and you will need a special screwdriver. Estimated TTC about 2 hours.
Comment: thank you so much for the several options. This gives me more options in getting this issue resolved. I am unsure if it is a permanent damage. So 1 and 2 is worth a try. Before I shed some bucks. God bless you!
Comment: How do you remove key cap? Don't want to experiment. Might damage the delicate key cap, especially the power button. thanks.
Comment: gently :) (sorry it is Greek, but clear what to do) https://www.youtube.com/watch?v=yZfD1yTBCX4
Comment: Thank you! The video is self-explanatory. Now, after I remove the key cap, is there anything else I should be looking for that may be causing the non-function?
Comment: That depends! but since you checked the other answer as completed, I guess you have all your answers.
Answer: You can take a look at this video but be sure it's the same model!
Comment: this is great and just what I needed. Thank you so much! Very helpful. God bless you.


Show/hide posts and categories based on user meta

Question: I've added additional input fields to the user profiles with Advanced Custom Fields (for example "type of customer"). How is it possible to hide posts and categories for users with specific values within the custom fields? For example if a user has the customer type is set to "Cloud" they should only be able to see FAQ entries of the category "Cloud" and be permitted to access other categories.
I only found plugins to hide posts based on the user role, but I am searching for a more flexible way, because type of customer won't be the only additional field.
Answer: You should check the pre_get_posts() filter hook.
Comment: Thank you for your suggestion. I'm still wondering, if this approach will completely lock out the user from certain categories or if they will still be accessible by their URLs and will still pop up in the search?
Comment: @Mario they will be hidden. Feel free to check one of my posts to see it in action:

https://kayart.dev/how-to-hide-products-for-non-authorized-users-in-woocommerce/