PowerShell New-FSRMAction "property out of range"

Question: I am trying to build a simple variant of the "ransomware canary," where FSRM watches a directory, and if there are any changes at all, it immediately shuts down the computer.
Here is my PowerShell code:
<code># Ransomware Canary
# Kenton
# December 28, 2018
#
# Creates an FSRM file screen that watches a folder(s) for any file changes,
# immediately shuts down the server if any are detected to slow down ransomware attacks

$CanaryPath = "C:\Users\Administrator\Desktop\Acounting"  # Path to monitor, deliberately misspelled
$AnyGroup = "Any"  # Name of FSRM file group to catch all files
$ShutdownCmd = "C:\Windows\System32\shutdown.exe"  # Location of shutdown command
$ShutdownParameters = "/s /f"  # /s = shut down computer immediately; /f = force close applications

# Install File Server Resource Manager (FSRM)
Add-WindowsFeature -Name FS-Resource-Manager -IncludeManagementTools

# Define file group to catch all possible names, since any changes in this folder should be disallowed
New-FsrmFileGroup -Name $AnyGroup -IncludePattern @("*")

# Define action to shut down computer
$ShutdownAction = New-FsrmAction -Type Command -Command $ShutdownCmd -CommandParameters $ShutdownParameters -SecurityLevel LocalSystem

# Define file screen
New-FsrmFileScreen -Path $CanaryPath -IncludeGroup $AnyGroup -Notification $ShutdownAction -Active
</code>
Most everything seems to work, but when I add the $ShutdownAction to the -Notification parameter of New-FsrmFileScreen, it generates the following error:
<code>New-FsrmFileScreen : 0x8004530d, The specified property is out of range.
At C:\Users\Administrator\Desktop\add-ransomware-canary.ps1:23 char:1
+ New-FsrmFileScreen -Path $CanaryPath -IncludeGroup $AnyGroup -Notific ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (MSFT_FSRMFileScreen:Root/Microsoft/..._FSRMFileScreen) [New-FsrmFileScree
   n], CimException
    + FullyQualifiedErrorId : HRESULT 0x8004530d,New-FsrmFileScreen
</code>
I've based this pattern on another example here, but it uses the "Email" type instead of the "Command" type. I haven't found many examples with the "Command" type. I'd originally made this in the GUI, and it all seemed to work, just not in PowerShell. Is there something obviously wrong with my code?
Answer: I have found the answer here, hat tip to GradeA-Phil on TechNet. Bottom line is that you have to add a -KillTimeOut parameter to New-FsrmAction, because its default value of -1 is unacceptable to New-FsrmFileScreen.


Avoiding a lost update in Java without directly using synchronization

Question: I am wondering if it is possible to avoid the lost update problem, where multiple threads are updating the same date, while avoiding using synchronized(x) { }.
I will be doing numerous adds and increments:
val++;
ary[x] += y;
ary[z]++;

I do not know how Java will compile these into byte code and if a thread could be interrupted in the middle of one of these statements blocks of byte code. In other words are those statements thread safe?
Also, I know that the Vector class is synchronized, but I am not sure what that means. Will the following code be thread safe in that the value at position i will not change between the vec.get(i) and vec.set(...).
class myClass {
  Vector<Integer> vec = new Vector<>(Integer);

  public void someMethod() {
    for (int i=0; i < vec.size(); i++)
      vec.set(i, vec.get(i) + value);
  }
}

Thanks in advance.
Answer: For the purposes of threading, ++ and += are treated as two operations (four for double and long). So updates can clobber one another. Not just be one, but a scheduler acting at the wrong moment could wipe out milliseconds of updates.
java.util.concurrent.atomic is your friend.
Your code can be made safe, assuming you don't mind each element updating individually and you don't change the size(!), as:
for (int i=0; i < vec.size(); i++) {
    synchronized (vec) {
        vec.set(i, vec.get(i) + value);
    }
}

If you want to add resizing to the Vector you'll need to move the synchronized statement outside of the for loop, and you might as well just use plain new ArrayList. There isn't actually a great deal of use for a synchronised list.
But you could use AtomicIntegerArray:
private final AtomicIntegerArray ints = new AtomicIntegerArray(KNOWN_SIZE);
[...]
    int len = ints.length();
    for (int i=0; i<len; ++i) {
        ints.addAndGet(i, value);
    }
}

That has the advantage of no locks(!) and no boxing. The implementation is quite fun too, and you would need to understand it do more complex update (random number generators, for instance).
Comment: It's a bit on the low-level side. java.util.concurrent is at a more generally useful level.
Answer: vec.set() and vec.get() are thread safe in that they will not set and retrieve values in such a way as to lose sets and gets in other threads. It does not mean that your set and your get will happen without an interruption.
If you're really going to be writing code like in the examples above, you should probably lock on something. And synchronized(vec) { } is as good as any. You're asking here for two operations to happen in sync, not just one thread safe operation.
Even java.util.concurrent.atomic will only ensure one operation (a get or set) will happen safely. You need to get-and-increment in one operation.
Comment: Other than with getAndIncrement and similar? (Technically implemented as multiple operations but in a loop if it fails.)


Multiple subdomains on Heroku (Rails)

Question: I have staging.example.com, and want to have blog.staging.example.com (to test prior to blog.example.com).
In my Heroku settings, I added 'staging.example.com' and 'blog.staging.example.com' as site domains. On DNSimple, I added 'staging.example.com' and 'blog.staging.example.com' as CNAMEs both, pointing to 'proxy.herokuapp.com'.
staging.example.com is a separate Heroku repo than example.com. But blog.staging.example.com is part of the same Rails application as staging.example.com (hopefully that makes sense).
I have this working in development, with
constraints subdomain: 'blog' do
  root to: 'blog#index'
end

However, both staging.example.com and blog.staging.example.com point to staging.example.com.
Answer: Alright figured it out.
root to: 'blog#index', constraints: { subdomain: /^blog(\.|$)/ }

Multiple subdomains on Heroku (Rails)


Three phase power supply - what is line to line voltage

Question: Well this seems like a basic principle, yet I can't seem to get it. (We're expect to "know" this already).
In a three phase situation I'm given a source voltage of 230V. - So the waveform of each of the phases would be: \$ v_s = \sqrt2 \cdot 230 \cdot \sin(\omega t + \theta_i)\$
Where \$\theta_i\$ is \$0, \tfrac{2}{3} \pi,  \tfrac{4}{3} \pi\$  for each phase.
So now I could calculate the line to line voltage by the formula:
$$v_{ll} = 2 \cdot  \left ( \sqrt2 \cdot 230 \cdot \sin(\tfrac{2}{3} \pi) \right)$$
Is this correct?
Answer: No need for a complicated formula.
If you have balanced three-phase power, where all three phase voltages are equal in magnitude and 120° apart in phase, then:
$$
V_{L-L} = \sqrt{3} \times V_{L-N}
$$
To see why, consider the phasor diagram:

Applying some basic trig:
Answer: Line-to-line voltage is the difference between line-to-neutral voltages on two phases:
$$
v_{L-L} = v_{L-N} \cdot \left( sin(\omega t) - sin(\omega t - \frac{2 \pi}{3} )\right)
$$
Answer: Line to line voltage for a 3phase network (120deg separation) is sqrt(3)*phase voltage.
So for a 230V 3ph network the line-line is 400V
Answer: The key here is whether you have a delta or a Y configuration.  For 230V line to line it is most likely a delta.  Most (in the US at least), 3phase systems that are Y connected are 277/480 meaning 277VoltsRMS line to neutral,. and 480voltsRMS line to line.  Since 230 is a delta, does it really make sense to define line to neutral?
And, most residential is single phase with 230V line to line and 120V line to neutral to neutral of the center-tapped transformer secondary.
Comment: 230V L-N 400V L-L is *extremely* common in Europe, Australasia, and most everywhere that's not in north america.
Answer: Yes, it is correct for instantaneous difference for a 230V RMS system.
230V RMS is $$ \sqrt2 \cdot 230V$$ line-to-line, and
$$\sin(\tfrac{2}{3} \pi) = \tfrac{\sqrt3}{2}$$
so
$$ 2 \cdot  \left ( \sqrt2 \cdot 230V \cdot \sin(\tfrac{2}{3} \pi) \right) = \sqrt3 \cdot \sqrt2 \cdot 230V$$
So agrees with the simple phasor method of multiplying the voltage by \$\sqrt3\$ once you've converted RMS to line.


How do I find the kernel of the shift operator in the solution of 2D Ising model?

Question: Okay, this is a second part of my previous question. Again, I'm following Itzykson's book. The fermionic solution for the 2D Ising model is described in terms of a matrix $T = \theta \tilde{\theta}$, where:
$$\theta(\beta) = e^{-i\beta \sum_{x}\Gamma_{x,x+\frac{1}{2}}\Gamma_{x+\frac{1}{2},x}} \quad \mbox{and} \quad \tilde{\theta}(\beta) = e^{-i\tilde{\beta}\sum_{x}\Gamma_{x-\frac{1}{2},x}\Gamma_{x,x+\frac{1}{2}}}$$
The idea now is to find the kernels of each of these operators in terms of Grassmann variables. To compute the kernel, Itzykson states that we have to use the unitary operator $U$ which shifts the indices by a half factor:
$$U^{-1}\Gamma_{x,x+\frac{1}{2}}U = \Gamma_{x+\frac{1}{2},x+1} \quad \mbox{and} \quad U^{-1}\Gamma_{x-\frac{1}{2},x}U = \Gamma_{x,x+\frac{1}{2}}$$
The result should be:
$$U(\bar{\xi},\xi) = 2^{-L/2}\exp\bigg{(}{{\sum_{x\ge x'}2i\bar{\xi}_{x}\xi_{x'}-\bar{\xi}_{x'}\bar{\xi}_{x}+\xi_{x}\xi_{x'}}}\bigg{)} = 2^{-L/2}\exp \int_{-\pi}^{\pi}\frac{dp}{2\pi}\bigg{[}\frac{2i}{1-e^{-ip}}\bar{\xi}_{p}\xi_{p}+\frac{1+e^{-ip}}{2(1-e^{-ip})}(\bar{\xi}_{-p}\bar{\xi}_{p}+\xi_{-p}\xi_{p})\bigg{]} .$$
As it became clear in the answer of my previous linked question, the kernel of such operators must use some Grassmann identities. But my problem is: how can I calculate the kernel of $U$, that is, $U(\bar{\xi},\xi)$ if I don't know what $U$ is? All I know is what $U$ does: it shifts the indices by a half factor. But I don't know $U$ (and $U^{-1}$) explicitly. How is the above expression for $U(\bar{\xi},\xi)$ obtained?
Comment: What exactly do you mean by kernel?
Comment: It is the integral kernel representation of the operator in the Grassmann algebra representation. My previous question (linked in the post) have more information.
Answer: To be honest, I'm not sure the $U$ operator exists. The book does not contain its complete consideration. I expect that there may be problems with boundaries and translational invariance. Nevertheless, here is the formal derivation of formula (65a).
Transformation (63) is linear. Therefore, the operator $U$ is probably the exponential of some quadratic fermion operator, and its kernel is probably a Gaussian function of the anticommuting variables. For this reason, let's look for the kernel in the following form
$$
U(\overline{\xi},\xi) = C \exp\left(\sum_{x,x'}\ \frac12A_{x,x'}\overline{\xi}_x\overline{\xi}_{x'} +
B_{x,x'}\overline{\xi}_x \xi_{x'} + \frac12 A'_{x,x'} \xi_{x'}\xi_x\right) \tag{O}
$$
where $A$ and $A'$ are antisymmetric: $A_{x',x} = -A_{x,x'}$.
If $\langle 0|a^+_x = 0$ for any $x$, then by formulas (21) and (O) we have equality
$$
\langle newvac| \equiv \langle 0|U = C\langle 0|\exp\left(\frac12\sum_{x,x'}\ A'_{x,x'}a_{x'}a_x\right). \tag{Ia}
$$
At the same time we have another equality
$$
\langle newvac|b^+_x = \langle 0|U b^+_x = \langle 0|a^+_x U = 0 \tag{Ib}
$$
for any $x$. Substituting (63) and (Ia) into (Ib) gives the following equations for $A'$
$$
\langle newvac|\left(a_{x+1} + a_x +\sum_{x'}\ A'_{x+1,x'}a_{x'} - A'_{x,x'}a_{x'} \right) = 0, \tag{Ic}
$$
whence follows
$$
A'_{x+1,x} = -1,\quad A'_{x,x+1} = 1,\quad A'_{x+1,x'} = A'_{x,x'},\forall x'\neq x, x+1. \tag{Ic'}
$$
The solution to these equations is
$$
A'_{x,x'} = \left\{
\begin{array}{ccc}
1&\mbox{if}&x'>x\\
0&\mbox{if}&x'=x\\
-1&\mbox{if}&x'<x
\end{array}\right. . \tag{Id}
$$
The vector $|newvac\rangle$ corresponding to the function (Id) has norm $C 2^{\frac{L-1}2}$. On the other hand, its norm must be equal to $1$ due to the unitarity of $U$. Therefore we get
$$
C = 2^{-\frac{L-1}{2}}.\tag{Ie}
$$
According to formula (20), the operator with kernel (O) must satisfy the following relations
$$
a_xU = \sum_{x'}\ A_{x,x'}a_{x'}^+ U + B_{x,x'} U a_{x'}
\tag{IIa},
$$
$$
Ua^+_x = \sum_{x'}\ A'_{x,x'}Ua_{x'} + B_{x',x}a^+_{x'}U \tag{IIb}
$$
Or equivalently
$$
U^{-1}a_xU = \sum_{x'}\ A_{x,x'} U^{-1}a_{x'}^+ U + B_{x,x'} a_{x'}
\tag{IIa'},
$$
$$
a^+_x = \sum_{x'}\ A'_{x,x'}a_{x'} + B_{x',x} U^{-1} a^+_{x'}U \tag{IIb'}
$$
Substituting of transformation (63) into these equations gives the equations for $B$ and $A$. From (IIb') and (Id) it follows
$$
a^+_x = \sum_{x'>x} a_{x'} - \sum_{x'<x}a_{x'} + \sum_{x'}B_{x,x'}\frac{i}2\left( a^+_{x'+1} - a^+_{x'} + a_{x'+1} + a_{x'} \right),\forall x.\tag{IIb''}
$$
Analysis of equation (IIb'') leads to the following expression for $B$:
$$
B_{x,x'} = \left\{
\begin{array}{ccc}
i&\mbox{if}&x\geq x\\
-i&\mbox{if}&x<x
\end{array}\right. . \tag{IIc}
$$
Similarly, from (IIa') it follows
$$
\frac{i}2\left(-a^+_{x+1} - a^+_x - a_{x+1} + a_x \right) =
$$
$$
=
\sum_{x'}\ B_{x,x'}a_{x'} + A_{x,x'}\frac{i}2\left(a^+_{x'+1} - a^+_{x'} + a_{x'+1} + a_{x'} \right),\forall x. \tag{IIa''}
$$
Equation (IIa'') is consistent with (IIc) and leads to
$$
A_{x,x'} = A'_{x,x'}. \tag{Id'}
$$
Now, substituting (Id), (Ie), (IIc) and (Id') into (O) gives
$$
U(\overline{\xi},\xi) = 2^{-\frac{L-1}{2}}\exp\left(i\sum_{x\geq x'} \overline{\xi}_x \xi_{x'} - i \sum_{x < x'} \overline{\xi}_x \xi_{x'} - \sum_{x>x'} (\overline{\xi}_x \overline{\xi}_{x'} - \xi_x \xi_{x'})\right).\tag{R}
$$
This result does not coincide with the central expression in the line of equalities (65a). I consider the difference in normalization constants to be insignificant; due to boundary effects, much more significant corrections can arise. I don't know how to explain the difference in exponent arguments. But, to my surprise, substituting transformation (64) into (R) leads exactly to the final expression in (65a). To obtain this result it is necessary to use equalities like the following
$$
\sum_x e^{i(p\pm p')x} = 2\pi\delta(p \pm p'),\quad \sum_{n=1}^\infty e^{\pm ipn} = \frac{e^{\pm ip}}{1- e^{\pm ip}}, \tag{E}
$$
$$
\sum_{x>x'} \xi_x \xi_{x'} = \sum_x\sum_{n=1}^\infty \xi_x \xi_{x-n},\quad
\sum_{x<x'} \xi_x \xi_{x'} = \sum_x\sum_{n=1}^\infty \xi_x \xi_{x+n}.
\tag{E'}
$$
Due to unitarity, the kernel of the inverse operator $U^{-1}$ is conjugate to the kernel of the operator $U$.


Who do the servant and the son represent in John 8:35?

Question:
The slave does not remain in the family forever, but the son remains forever. (Jn. 8:35 NET)
Answer: The verse in the question is taken from a fairly long conversation, which covers most of the chapter, of Jesus and the Jewish leaders.

John 8:32 And ye shall know the truth, and the truth shall make you free.
8:33   They answered him, We be Abraham's seed, and were never in bondage to any man: how can you say, Ye shall be made free?
8:34   Jesus answered them, Verily, verily, I say unto you, Whosoever is committing sin is the servant (or slave) of sin.
8:35   And the servant (or slave) abides not in the house for ever: [but] the Son abides ever.
8:36   If the Son therefore shall make you free, ye shall be free indeed.

A slave is not part of the family, he just works there for awhile.  He can be sold, or hired out.  The son, on the other hand, is part of the family, he is heir of the family estate, and stays to inherit his father's property since it is his home.
It's fairly obvious in the dialogue with the Jewish leaders, that Jesus does not count them as "sons" of God.  Jesus outright tells them, they are plotting to kill Him, (a grave sin) and their father is the devil.
The Jews in turn claim Abraham as their Father, thus suggesting they are of the chosen race, therefore children of God.
Who is the "slave"  -- the unbelieving Jews clinging to their sin, and rejecting their Savior who could make them free.

Vs 8:36 If the Son therefore shall make you free, ye shall be free indeed.

They are seeking to kill him, not follow Him. They are convinced in their own minds that Jesus is a threat to them.
Jesus isn't talking about genetic relationships here.  "I know that you are seed of Abraham"  he tells them,  but that relationship won't free them from the bondage of sin nor the condemnation of sin. Jesus  is speaking of spiritual relationship, something that is on an altogether higher plain.
So who are the "sons"?

John  8:31 Then said Jesus to those Jews which believed on him, If ye continue in my word, then you are my disciples indeed;
8:32   And you shall know the truth, and the truth shall make you free.

John 1:12 But as many as received him, to them gave he power to become the sons of God, [even] to them that believe on his name:
1:13   Which were born, not of blood, nor of the will of the flesh, nor of the will of man, but of God.

Galatians 4:5  [God sent forth His Son] To redeem them that were under the law, that we might receive the adoption of sons.
4:6    And because ye are sons, God has sent forth the Spirit of his Son into your hearts, crying, Abba, Father.
4:7    Wherefore you are no more a servant, but a son; and if a son, then an heir of God through Christ.
Answer:
1Now I say, That the heir, as long as he is a child, differeth nothing from a servant, though he be lord of all; 2But is under tutors and governors until the time appointed of the father. 3Even so we, when we were children, were in bondage under the elements of the world: 4But when the fulness of the time was come, God sent forth his Son, made of a woman, made under the law, 5To redeem them that were under the law, that we might receive the adoption of sons. 6And because ye are sons, God hath sent forth the Spirit of his Son into your hearts, crying, Abba, Father. 7Wherefore thou art no more a servant, but a son; and if a son, then an heir of God through Christ. [Galatians 4:1-7 KJV]

In this passage Paul sets forth the experience of being born again in the context of experience of being freed from bondage to the law.
Receiving the Holy Spirit (after repentance towards God and after faith in the Lord Jesus Christ) the redeemed are brought into the experience of sonship by the indwelling Spirit whereby they cry Abba, Father, (see Mark 14:36 and Romans 8:15 and Galatians 4:6).
This directly relates to what Jesus expresses in John 8:35.
Answer: Genesis 16:1-2

"Now Sarai, Abram's wife, had borne him no children. And she had an Egyptian maidservant whose name was Hagar." NKJV.

A maidservant was a servant. When Sarai suggested to Abram "Please, go into my maid" this came as man's solution, or works, not faith in God's promises to provide, as in Genesis 15:4.
Genesis 21:10

"Therefore she [Sarah] said to Abraham, "Cast out this bondwoman and her son; for the son [Ishmael] of this bondwoman shall not be heir with my son, namely with Isaac". [My brackets].

The servant was cast out.
Genesis 22:20

"And He [the Angel of the LORD] said, "Do not lay your hand on the lad, or do anything to him; for now I know that you fear God, since you have not withheld your son, your only son, from Me".

Abraham passed the test [Hebrews 11:17] and
Hebrews 11:18

"In Isaac your seed shall be called".

Isaac, the true son remained.  Remained forever in that he was not cast out. "not cast out" -
Romans 4:13-22

"For the promise that he would be the heir of the world was not to Abraham or to his seed through the law,". 16"Abraham who is the father of us all".

God's promises to His family of faith remain forever.
"Servant" represents: works of law i.e. Sarah's suggestion to involve Hagar [Gen 16:2]/ being cast out.
"Son" represents: faith, not law, Abraham, the true seed remaining.


how do we find out obsolete SharePoint Groups in your site collection?

Question: I got rid of several sites in past but forgot to delete the groups within them. Now i am trying to clear up those groups that were left over when i deleted the site.
How do i go about cleaning up those orphaned groups from my site collection?
Answer: So When ever you delete the site i hope you know those configurations will also be deleted.
Comment: not if your groups were used else where. for example site A is a parent  and site b is a child. Site b had groups x,y and z. If you add group x from your child site B to your parent site A. Then when you delete site b the child site, Group X still remains in its parent site A. That is what i am trying to find out. How many of those orphaned groups do we have and how to get rid of it.
Answer: I get it now
So when ever you add the group from child site to parent site and if you want to delete that orphan groups

Open the site with SharePoint designer
if you observe the Permissions tab on the home page of share point designer there also you dont get the orphan group
Go to Site groups on the left panel of the share point designer
Delete the Orphan groups that were added from the child site

I tested it and it worked fine

Don't forget to vote the answer
Comment: we dont know where those groups exists that is the issue, if we knew we would go delete them manually and we have like 300-400 sites
Comment: Open the Parent site with share point designer and go to site groups there you find all the orphan groups with out description or if you have give a description while creating is also more easy to delete them
Comment: I am Referring to the orphaned groups only Just follow the procedure


Early 2013 Macbook Pro with 4K

Question: From what I'm reading online it sounds like 4K displays like Seiki displays will work correctly with a late 2013 MBP or later. I have an early 2013 MBP and am not finding much of any evidence that a 4K display will work with this model. Will a 4K display work at 3840x2160 with at least 30 Hz on a early 2013 MBP? Does anyone have this or a similar setup that could provide feedback or any issues that have? I'm interested in an external display with a high resolution and 4K seems like the best option.
Answer: Yes, it is possible to drive a 4k Display with an early 2013 and even 2012 Retina Macbook.
1. Download SwitchResX
here
2. Create a new custom profile for your monitor
Simplified Settings: CVT-RB
Active: 3840x2160
Scan Rate vertical: 30

Hit ok and press cmd-S to save.
3. Reboot and select custom profile

Based on this thread
Answer: I have early 2013 15" retina mbp and I can drive seiki 39 4K TV via HDMI (using supplied cable) just fine.
Comment: This does indeed work on the early 2013 over both HDMI and Thunderbolt, but the maximum refresh rate is 30/24hz
Comment: @PatrickMcMahon - nope, I disagree.  And I'm typing this on an early 2013 machine connected to a 4k monitor (specifically, an LG 27UD58-B 27" Ultra HD 4K Monitor).   No adjustments, just plugged it in with a HDMI-HDMI cable.  I'm not a gamer though, so it may be awful for that.  For text (as in writing code) and videos it's just fine.  The only thing I notice is that mouse movement isn't quite as smooth as it is on the native laptop display.
Comment: Precisely, 4K @ 30Hz just looks horrible.  Decent 4K is at least 60Hz.
Answer: Its possible with SwitchResX and this stuff. Mini DisplayPort 1.2 to HDMI 2.0a Active Adapter 4K@60Hz
I have a MBP, early 2013, and it's working with 60Hz + 4k.
There are many adapters out there, but be sure is 4k + 60hz active, otherwise will not work.
Comment: Do you have a link for "screenresx"?  It's helpful if you include references and links to the products you are reccomending.
Comment: He meant [SwitchResX](http://www.madrau.com/support/support/faq.html)
Comment: @Endre can you please share your SwitchResX settings?
Answer: I have been using 4K monitors with an Early 2013 Retina Macbook Pro since August 2014, and have an issue which is consistent across both 4k Monitors - the screen will go blank for a few seconds sporadically.  It doesn't happen often enough for it to be a big issue, but it can be annoying.  Most of the time i run at 2560 x 1440, but i can go up to 3840 x 2160, both at 30HZ.  Both of these require a good quality HDMI cable v1.3.
The monitors i have used are Samsung U28D590D and Asus PB287Q.  The Asus gives a richer picture, but the Samsung is brighter.
Comment: Hi @Baldy, could you please tell me if you can reach 3840 x 2160 60HZ via MiniDP to DP adapter? njboot says above that the machine is frozen up nearly every time at any refresh rate > 30Hz.
Comment: @biotech I have since moved to a newer 2015 MBP, which is capable of 60hz & 4K.  The 2013s were hit & miss
Answer: On my early 2013 15" rMBP and LG 27UD88-W 27" 4K UHD Monitor, and SwitchResX, I tried mDP to DP, HDMI to HDMI, all 4K compatible cables, and finally active mDP to HDMI 4k 60Hz cable. I could not get 60 Hz on any cable at 4K.
(DP = DisplayPort. mDP = mini DisplayPort. rMBP = retina macbook pro)
This LG monitor has DisplayPort 1.2 and HDMI 2.
has DisplayPort 1.1a and HDMI 1.4.
This was the last cable I tried:
https://www.bhphotovideo.com/c/product/1616926-REG/ezquest_x40085_active_mini_displayport_to.html
The cable I'm sticking with is the Startech mDP to DP, and the HDMI cable I tried was a 4K Belkin HDMI cable from the apple store.
SwitchResX did help me get more resolution options than the standard display settings would. I am now using 2304 x 1296, HiDPI, at 30Hz. I think I've tried everything.
I think it's because the early 2013 rMBP is limited to DP 1.1a, according to Dell. Also according to Dell, late 2013 rMBP has DP 1.2, which should be able to do 4K 60Hz
https://www.dell.com/support/kbdoc/en-us/000128111/4k-5k-high-resolution-display-support-by-mac-systems
And according to Wikipedia, DP 1.1a is limited to HBR, which is limited to 30 Hz at 4K / 3840 × 2160.
https://en.wikipedia.org/wiki/DisplayPort
I'm not sure how the other commenters are getting 4K 60Hz, but I think I've tried everything, and the results I've got are in line w/ the specs I could find. I knew nothing about any of this 2 weeks ago, and this was what I found trying to figure it out.
Answer: No. According to this Apple Support article, 4K Display is not supported. The highest resolution your machine can support on an external monitor is 2560x1600.
Comment: Even though Apple states this, it is not true. I own an Early 2013 MBP and it does work (over both HDMI and Thunderbolt). Also see Juan Namon's answer
Comment: It actually is possible! Check the other answers in this thread.
Comment: @SkeletonBow this answer is 3 yrs old and was accurate then based on Apple support article + available hardware. To whomever downvoted my answer - the information was accurate then and still is now. Though it may be possible now, Apple still hasn't updated that article. the consequences of driving 4K from it (kernel panics, lagging frames, overall serious performance strain) outweigh any benefit of advising its users to do so. Possible and practical should not be conflated. I own this machine and have driven 4K on it, but it's frozen up nearly every time at any refresh rate > 30Hz
Comment: Would be possible to use an external GPU capable to drive 4K 60fps?
Comment: @njboot, why do you yhink the machine is frozen up nearly every time at any refresh rate > 30Hz, it shold work as it has a NVIDIA-GeForce-GT-650M, rigth?

Early 2013 Macbook Pro with 4K


What are bulletproofs?

Question: I have heard that Monero transactions are relatively large, and that Bulletproofs will make Monero transactions smaller. Can someone give a high-level overview about what these are, and how they effect Monero?
Comment: Has BPs some similarities with zk-SNARKs from Zcash?
Answer: Most of the information below is taken from this post on the GetMonero website.
To understand bulletproofs, you need to first understand what a range proof is. According to the post:

A range proof allows anyone to verify that a commitment represents an amount within a specified range, without revealing anything else about its value.

Monero uses the range proof in RingCT to secure the amount being sent in a transaction. Without range proofs, the amount sent could be hidden, but a sender could cheat by making coins out of thin air. Thankfully, range proofs prevent this from happening.
Bulletproofs are a more efficient type of range proofs. You can view a copy of the research paper for free here. The research paper defines Bulletproofs as follows:

...a new non-interactive zero-knowledge proof protocol with very short proofs and without a trusted setup; the proof size is only logarithmic in the witness size. Bulletproofs are especially well suited for efficient range proofs on committed values...

Bulletproofs offer substantial improvements when using multiple outputs. With current Monero range proof technology, transaction sizes scale mostly linearly depending on the number of outputs (eg: 1 output = 7kB, 2 outputs = 13kB). With bulletproofs, these scale logarithmically instead (eg: 1 output = 2kB, 2 outputs = 2.5kB).
As the post notes, there are two ways bulletproofs can be implemented in Monero:

This gives us two related types of bulletproofs: single-output and multiple-output. A transaction with multiple outputs can either include several single-output proofs or one multiple-output proof (which is smaller than the separate proofs).

The former brings substantial improvements, and the latter brings a little more than the former. The post estimates the following performance improvements:

With our current range proofs, the transaction is around 13.2 kB in size. If I used single-output bulletproofs, the transaction reduces in size to only around 2.5 kB! This is, approximately, an 80% reduction in transaction size, which then translates to an 80% reduction in fees as well. The space savings are even better with multiple-output proofs. This represents a significant decrease in transaction sizes. Further, our initial testing shows that the time to verify a bulletproof is lower than for the existing range proofs, meaning speedier blockchain validation.

Bulletproofs will be deployed in the October scheduled protocol upgrade. It has been live in testnet since the beginning of 2018.
Comment: Author here. It actually turns out that with the newest results Bulletproofs are quite fast to verify. Especially if you verify many at once. BPs are roughly 25x faster than the previous range proof for a single output if you verify many at once. See Section 6.3 https://eprint.iacr.org/2017/1066.pdf
Comment: @Zigglzworth no, it will not impact that in a meaningful way. It will mean lower fees (80-90% lower) and slightly faster wallet synchronization time going forward if I understand this correctly.
Comment: Thanks for the great explanation but can you also explain what this means practically in layman terms? For example, does it mean that a kiosk selling milk for monero will be able to verify the transaction in less time?

What are bulletproofs?


Can we use probiotic medicine for bacillus subtilis culture?

Question: I am from India and we do not get Natto (Japanese dish) starter for making Natto. I found that it contains mostly Bacillus subtilis, so I was wondering: can I mix the Bacillus subtilis strains available in the pharmacy to prepare my starter from scratch?
Comment: I think there's actually multiple natto strains.  There was a segment on NHK about a company that was making many different types of natto, and I know part of it was time and temperature, but I think they used different strains as well
Comment: Give it a shot and let us know!
Answer: Bacterial are named by species, not strain. Each species has innumerable strains. For instance, Escherichia coli has over 700 major strains. Some can kill you. Most are friendly.
It is analogous to breeds of dog (over 300). All dogs are Canis familiaris  species with numerous "strains" (breeds). Some can kill you. Most are friendly.
So when you pick up a "probiotic" Bacillus subtilis in the drug store, are you buying a poodle or a Rottweiler?
Culinary micro-organisms tend to be very specialized. The lactobacillus found in yogurt is unlikely to be the same lactobacillus strain that is found (along with yeast) in sourdough starter.
I make my own yogurt, beer, malt whiskey and sourdough. I try to source my bugs from commercial food products as close as possible to the taste I am after.
I suggest you make an effort to obtain commercial Bacillus subtilis var. natto and learn a way to propagate it.
Comment: "Are you buying a poodle or a rottweiler"  -- love it.
Answer: Generally this is possible as you can also use probiotic capsules for making yogurt. The important thing is, that it has the same bacteria strains and preferably a similar quantity.
Where you have to take care, though, is that the starter substitute doesn't contain any other ingredients. For example in probiotics are often further ingredients that might cause yogurt to spoil, when using it for this matter.
Look for quality products without any other ingredients


Constant Gaussian curvature surfaces in 3-space containing lines

Question: How can one construct surfaces in $\mathbb R^3$ of constant negative Gaussian curvature containing a line in $\mathbb R^3$? (this question is inspired by this MSE post).
Comment: Did you mean a constant $<0 \, K$ surfaces containinfg a *straight* line?
Comment: The question asked above was not "inspired" by that linked MSE post, but rather is a cross post of the linked question.  MSE doesn't like simultaneous cross posting (question has since been deleted on MSE, so not all of you will be able to see anything at the other end of the linked post), but it seems MO may not mind cross-posted questions.
Comment: @amWhy, you are in error.  The question at MSE concerned the *complete* case, whereas this question concerns the *incomplete* case.
Comment: Yes, that's what "line" means. @Narasimham
Answer: Given any point $p$ on a surface $S$ of Gauss curvature -1,
there exists an open neighborhood $U\subset S$ and $p$-centered
coordinates $(x,y):U\to\mathbb{R}^2$, whose image is
a domain $R = (x,y)(U)\subset\mathbb{R}^2$
and a function $u:R\to (0,\pi/2)$ such that the first
and second fundamental forms of the surface are given by
$$
\mathrm{I} = \cos^2\!u\,\mathrm{d}x^2 + \sin^2\!u\,\mathrm{d}y^2\tag1
$$
and
$$
\mathrm{I\!I} = \cos u\,\sin u\,(\mathrm{d}x^2-\mathrm{d}y^2)
= \cos u\,\sin u\,(\mathrm{d}x-\mathrm{d}y)(\mathrm{d}x+\mathrm{d}y).\tag2
$$
The function $u$ satisfies the sine-Gordon equation
$$
u_{xx}-u_{yy} = \cos u\,\sin u.\tag3
$$
Conversely, given a function $u:R\to (0,\tfrac12\pi)$
that satisfies (3)
on a simply connected domain $R\subset\mathbb{R}^2$,
there exists an immersion $X:R\to\mathbb{E}^3$ whose first
and second fundamental forms are given
by $\mathrm{I}$ and $\mathrm{I\!I}$ above;
this immersion is unique up to rigid motion and has Gauss curvature $-1$.
The asymptotic curves of the immersion $X$
are given by holding $x+y$ or $x-y$ constant.
The angle between the asymptotic curves (appropriately
oriented) is $2u$, and the ambient curvatures in $\mathbb{E}^3$
of the asymptotic curves described by holding $x\pm y$ constant
are
$$
\kappa_{\pm} = 2 (u_x \mp u_y).\tag 4
$$
(Here, $\kappa_{\pm}$, which are the curvatures of the asymptotic curves, are not to be mistaken for the principal curvatures of the surface $X(R)$,
which are $\tan u$ and $-\cot u$.)
Thus, constructing a surface in $\mathbb{E}^3$ with Gauss curvature $-1$
that contains a straight line (which is necessarily asymptotic) is equivalent
to finding a (local) solution $u(x,y)$ of the sine-Gordon equation that
satisfies the 'characteristic' initial condition $u_x(x,x)+u_y(x,x) = 0$.
(It's called 'characteristic' because the curves $x\pm y = c$ are the
characteristic curves of the PDE (3).)
Unfortunately, characteristic initial value problems for nonlinear PDE can be delicate to study; standard techniques are generally not adequate to prove
existence or uniqueness.  However, this problem can be partially avoided by
looking for special solutions that will satisfy the desired initial
condition by virtue of other special properties being assumed.
If one seeks a solution to (3) of the form $u(x,y) = \tfrac12\,f(x^2{-}y^2)$,
one finds that $f$ must satisfy the (singular, nonlinear)
ordinary differential equation
$$
4t\,f''(t) + 4f'(t) = \sin\bigl(f(t)\bigr).\tag5
$$
Moreover, since, for such a solution, one has
$(u_x \mp u_y) = f'(x^2{-}y^2)(x \pm y)$,
it will follow that the two lines $x{\pm}y = 0$ in $R$
will be mapped by $X$ into straight lines in $\mathbb{E}^3$.

To see that there are nontrivial solutions to the singular ODE (5),
let $\theta\in(0,\pi)$ be chosen,
and write $f(t) = \theta + \tfrac14\,\sin(\theta)\,t + g(t)$.
Then (5) becomes the equation
$$
4t\,g''(t)+4g'(t)
= \sin\bigl(\theta+\tfrac14\sin\theta\,t+g(t)\bigr) -\sin\theta
= G\bigl(\theta,t,g(t)\bigr)
\tag6
$$
The left hand side of (6) is a singular linear differential operator
at $t=0$ with no resonances, while $G(\theta,t,g)$ is an analytic
function on $\mathbb{R}^3$ satisfying $G(\theta,0,0) = 0$.
Thus, there is a unique convergent power series
solution to (6) satisfying $g(0)=0$,
which implies the convergence of the corresponding formal power series for $f$:
$$
\begin{aligned}
f(t) &= \theta + \frac{\sin\theta}{4}\,t
       + \frac{\cos\theta\sin\theta}{64}\,t^2
       + \frac{(3\cos^2\theta-2)\sin\theta}{2304}\,t^3\\
  &\quad\quad + \frac{\cos\theta\,(18\cos^2\theta-17)\sin\theta}{147456}\,t^4 + \cdots,
\end{aligned}
\tag7
$$
yielding a solution to (5) satisfying $f(0) = \theta$ on an open interval around $t=0$.  It is easy to see from (5) that this local solution to (5) satisfying
the initial condition $f(0)=\theta$ extends uniquely to a solution to (5)
defined on the entire real line $\mathbb{R}$.  The range of $f$
will not be contained in the interval $(0,\pi)$, of course, but, there
will be an interval $\bigl(a(\theta),b(\theta)\bigr)\subset\mathbb{R}$
containing $0$ that $f$ maps into $(0,\pi)$.

Then the corresponding $X$ will immerse the region between the two hyperbolae $x^2-y^2 = a(\theta)<0$ and $x^2-y^2= b(\theta)>0$ into $\mathbb{E}^3$ as a surface of constant Gauss curvature $-1$ and will map the two lines $x\pm y = 0$ into two straight lines that intersect at an angle of $\theta$ in the image surface.
Added remark: (23 October 2017) After doing a literature search on examples of surfaces of constant curvature $-1$ in $\mathbb{E}^3$, I have found out that this surface was discovered by M. H. Amsler, Des surfaces à courbure négative constante dans l'espace à trois dimensions et de leurs singularités, Math. Ann. 130 (1955), 234—256.
Comment: Thanks, Robert.  This seems like a Math Monthly article.
Comment: @MikhailKatz:  Yes, what one can read off from the structure equations is that the surface normal spins around each line at unit speed as one moves at unit speed along the line.  Thus, the surface twists around the embedded line, with the surface normal coming back to be the normal to the pair of lines every $2\pi$ units.  The surface contains both lines, of course, but  the two twisting 'ribbons' get progressively thinner as you move away from the cross.
Comment: Robert Bryant : Before (in the MSE since closed thread) you said the tractricoid does not contain any straight lines and now you mention here asymptotic curved (straight) lines of Chebychev net satisfying Sine- Gordon equation as straight lines of hyperbolic geometry with vanishing $\kappa_g$ etc.,  and that to me sounds contradictory. Is it the difference between $E^3,R^3$ that I miss or is there something bigger I am still missing?
Comment: @Narasimham: Perhaps there is some confusion about what is meant by the term 'straight line'.  The tractricoid is a specific surface in $\mathbb{E}^3$ that has Gauss curvature $-1$.  It has geodesics (none of which are straight lines in $\mathbb{E}^3$), as do all sufficiently smooth surfaces in $\mathbb{E}^3$.  However, there are surfaces with Gauss curvature $-1$ have some geodesics that *are* straight lines, i.e., geodesics in $\mathbb{E}^3$.  Of course, any straight line in $\mathbb{E}^3$ that lies in a smooth surface $S\subset\mathbb{E}^3$ is both a geodesic and an asymptotic curve in $S$.
Comment: So, the 'surfaces with Gauss curvature $−1$ containing some geodesics that are straight lines, i.e., geodesics in E_3' and the 'Chebychevian asymptotics of non-Euclidean hyperbolic geometry' are they same? .. the assertion by Beltrami?
Comment: Can one say anything about the behavior of the surface as one goes to infinity along the line? The representation by the sine-Gordon equation doesn't seem to shed immediate light on the global geometric behavior of the surface.  For example, does the surface tend to "twist" around embedded line and if so can one say anything about the rate of such twisting?


How do you unlock new gear in the shop?

Question: So I've been playing a bit of online multiplayer, getting some money, and basically buying out everything I could in the shop in order to force the gear (not weapons, their unlock method is explicit) to cycle and hopefully give me some new choices. I'm not sure if leveling up is the main factor that determines getting new gear, or if it just happens when the news broadcasts rotate maps.
Comment: If you play the single player mode, you are able to get blueprints from each boss. You can then bring those blueprints to the shop and get those "Custom" weapons.
Comment: Note: I definitely did not mean weapons (I noted that above), but the clarification is appreciated. However, that leaves a concern: I'm guessing that's how I unlock 2 of each of the weapons. I've seen the "alt" weapons all the way up until level 20, though, so does that mean the blueprints work for multiple new weapons each?
Answer: The clothing shops get new gear every day. Your level will determine the availability of 2-3 star items in the shops.
Additionally, beating the single-player campaign will grant you two sets of 3-slot gear. Along the way, as you mentioned, several weapons will also be unlocked for purchase. The best resource I've found for these weapon unlocks is here. Anything without a "Single Player Scroll" entry is unlocked exclusively through multiplayer, and made available for purchase at the level indicated in the left column.

How do you unlock new gear in the shop?


Developing a Swift Salesforce1 app

Question: I'm planning to develop a native iOS app using Swift on Salesforce1. Any sample code/ guidance which shows how to fire the Salesforce REST API and render the response on UI will be helpful.
Answer: As a starting point, you can refer to this tutorial from Raja Rao (Salesforce Developer Relations Team) which explains how to integrate Swift in your existing Salesforce native iOS app. The source code is available here
Answer: Please checkout the post at http://4loopers.io/developing-ios-apps-using-swift/ for the steps involved in building an iOS app using Swift from scratch.
The basic steps are:
- Create a Swift Project in XCode

Download and set up your XCode project as outlined in https://github.com/forcedotcom/SalesforceMobileSDK-iOS-Distribution
In the Build Settings—>Header search paths add the paths for the Salesforce Mobile SDK
Add an Objective C file. It'll ask if you want to configure a objective C bridging header. Click Yes and delete the Objective C file and just keep the birding header
Import the relevant headers from the Salesforce Mobile SDK
Set up Remote App in Salesforce and get the clientid and callback URL to be added to SFDCSettings.swift
Comment: That seems relevant, but stackexchange discourages answers that are just links to other sites. Can you edit your answer to summarize some key points?
Comment: It's very relevant and it's an improvement on the tutorial mentioned in the post above. The link has the technical details on building iOS apps for Force.com using Apple's new language named Swift.
Comment: @HariKolasani, what ca_peterson was trying to say is that you should post relative content (or at least a summary) from the linked page to your answer. Links can break over time which risks making the answer worthless later down the road! I've edited your answer as an example.

Developing a Swift Salesforce1 app


When to use flash on a disposable camera?

Question: I recently bought a Kodak Funsaver Disposable Camera (800 ISO), because I am traveling to Ireland and wanted to snap some shots while up there. I am wondering if I always should use the flash or just at night/low light situations. I will be outside and it will be sunny out most of the time, should I still use the flash? (I've never had a disposable, so I need your help).
Answer: I have struggled to google-fu the specs for this particular Kodak so will assume that they are similar to Fuji's version of the camera (https://www.fujifilm.com/products/quicksnap/lineup/superia/).
The camera uses a fixed wide angle lens, f/10 or so aperture, and 1/140 shutter speed or so.
Keep in mind that you are not looking through the lens. The viewfinder is a framing aid and will work just fine unless you are very close to your subject (subject is 1 meter away). If shooting something that close, realize the camera is slightly below and to the right of what you are seeing and adjust your camera angle accordingly. Also, make sure your fingers are not covering the lens...many, many people have shot a full or partial finger with these cameras.
The focusing distance is fixed at 1 meter to infinity. Everything will be decently sharp as long as the subject is at least 1 meter away from you.
The 1/140 shutter speed is decent enough to freeze a person walking, but you'll get some motion blur if shooting fast paced action.
The flash will illuminate your subject between 1.2 and 3.5 meters. You can, of course, use flash and shoot a subject further away but they'll be underexposed.
Flash from the front of the camera is not really the best looking, so I would avoid using it unless you are in a dim environment.
Daytime outdoor and daytime cloudy shots will be fine. Shots at twilight, at night, in a bar/club/venue/building, you'll want to use the flash.
Make sure to get the camera developed at a location that gives you back your negatives. If you're in the USA, most drugstores will offer developing services, but they send the film out for development, the film is scanned and then destroyed and you get digital files. This is unacceptable, IMO.
Find yourself a lab locally or one you can ship the camera to who will develop and scan, offer prints, and who gives you your negatives back.
Comment: "You can, of course, use flash and shoot a subject further away but they'll be underexposed". That's not exactly correct. The flash has an effect over a limited distance, as you say. Subjects beyond that distance won't be lit by the flash, but that's not to say they will be underexposed. If you use the flash outdoors during the day, it is possible to have distant subjects perfectly exposed, with fill-flash affecting anything within the flash's range. The key I guess is just not to expect the flash to light anything beyond its range, if you _need_ it to be lit.
Comment: @osullic the light falloff is going to be dramatic after the end of the range but one doesn't go from perfectly lit at 3.5 meters to not lit at all at 4 meters. The question of just how much play do you have with the flash over the recommended range isn't worth the calculation - it's a disposable camera in non-professional shooting. Maybe I should have simply stated: shoot within the recommended range or take your chances.
Comment: With that sort of flash I've always had more issues with overexposing close subjects than underexposing distant(ish) ones


PSEUDO Query (jQuery extension)

Question: I just invented PSEUDO Query!
var objects = $.pquery([
    '##pquery##', // Initialize as PSEUDO Query Object
    [document.body, 'css', [{'background-color':'#f00'}], 'append',
        ['##pquery##', // Helps distinguish array needing parsing from array of arguments
        '
', 'text', 'LOL!']
    ],
    ['textarea', 'css', ['background-color', '#0f0']]
]);

...Is equivalent to:
var objects = [
    $(document.body).css({background-color: '#f00'}).append($('
').text('LOL!')),
    $('textarea').css('background-color', '#0f0')
];

Example image:

The point?
The point of this is in no way for added readability, but rather to provide a means to execute jQuery via PHP outputted JSON through Ajax. I believe this is going to make possible a nicely structured, and well defined output class for PHP, with very little code.
Ultimately, my goal is to have all clients long polling the server, to accept new Javascript and commands at any given moment. I plan to use jQuery for exactly what it is, as a framework, and extend any common commands/routines directly to it as extensions. Eventually I'll revise the structure to support $.method() calls, without having to have a selector. I might need some ideas for the best way to go about that, without causing problems.
What are some concerns with this?
I wanted to avoid it, but I think I'm going to have to eval the Ajax array, for setting callback functions. Or I'll just pass it to a new

PSEUDO Query (jQuery extension)


I have a NEMA 10-30R recept that I would like to use or convert for use with a Level 2 EV car charger. I have questions about existing wiring

Question: The NEMA 10-30R has 2 Hots and a ground (not neutral) #8 wires running to it.  There is also pair of wires (12 gauge black and white) running to the shed for a separate 120v circuit.  It appears that the #8 ground is also being used for the 120v circuit as well.  I would like to convert the 10-30 to a more common 14-30 recept for use with Level 2 car charger.  Do I have the appropriate wiring running to the shed to achieve this conversion?  (On a side note....since I have a ground on the 10-30 instead of a neutral and there are Level 2 chargers out there that are already set up to plug into a 10-30 recept, am I ok just leaving as is?)
I still want to consider the conversion, since 14-30s are more common, having a charger with this plug configuration could then be utilized at other places besides mine. My existing circuit is 240v and has a 30 amp double breaker and the Level 2 charger I want to get only requires 240v / 16 amp. Thanks!
Comment: No NEMA 10. IF you actually have Hot, Hot, Ground, use NEMA6, properly. NEMA 10 is obsolete and dangerous. NEMA6-30 or L6-30 are common as dirt. See this recent question, or a bunch of older ones. https://diy.stackexchange.com/q/236775/18078
Comment: Can you post photos of the inside of the box in question please?
Answer: NEMA 10-30 does not have ground.  That is incorrect.  It does have neutral.  You should not be using 10-30 for anything at all - it was outlawed at the same time 2-prong sockets were outlawed, when grounding went in in the 60s.  Except due to lobbying by the appliance industry, NEMA 10 got a reprieve for ranges and dryers ONLY, until it was banned for that also in 1996.
They continue to be sold at retail, but only for repair of broken receptacles.  But this is America, so there are no government jackboots restricting sales.  As such, the banning of this socket type is widely flouted by suicide jockeys. Don't be one of them. There's a right thing. Use it.

How to convert your legacy NEMA 10 outlet to modern.
Generally we see 4 styles of wiring to those dangerous NEMA 10s.
4-wire (insulated neutral + ground)
Easy peasy - slap a NEMA 6 or NEMA 14 receptacle here as you please.
Hot, Hot, Insulated neutral (/3 without ground)
Your options are limited here. This is only legal if installed before 1996 (certainly true since this wire vanished in the 70s).  If legal, you can convert this to NEMA 14, one of two ways - and again you cannot relocate this outlet.

You can retrofit a 10 AWG ground to this existing receptacle location, using the Retrofit Ground rules, chasing the ground wire back to either the panel, the Grounding Electrode, or any junction box with a valid #10 or larger ground back to the panel.  Same panel, that is!

You can fit a 2-pole GFCI breaker, convert to NEMA 14 but ignore ground altogether, and label the receptacle "GFCI Protected / No Equipment Ground".  It's a bit of a waste since an EVSE already has GFCI protection if it's not mail-order cheap Chinese.

Note that for the GFCI protection to work properly, the socket must be changed to a NEMA 14, and ground must be isolated from neutral!
NM or UF /2: Black-White w/ Bare ground wire
This was never legal for dryers or ranges.  Lots of cheaters did it anyway.
But this works out great for you.  You do want ground, so you can make it ground again, and use it with a NEMA 6-30 or 6-50 receptacle. (no NEMA 14).
You are using the white wire as a hot, so it must be marked with tape or paint (that is not white, green nor gray).
NM and UF cables are limited to 60C thermal ampacity rating (in table 310.15(B)(16).

NM/UF #8 Cu must be breaker'd at 40A with a 6-50 receptacle, allowing 32A true charge rate.
NM/UF #8 AL must breaker at 30A with a 6-30 receptacle, allowing 24A true charge rate.

SE cable: 2 black or red hots + BARE neutral web
Weird, huh?  SE cable is Service Entrance cable which is mainly used on the utility side of the main breaker, where ground isn't established yet.  It was legal for dryer/range circuits prior to 1996.
Yes, you CAN permanently re-task that bare web from neutral to ground, including moving it from the neutral to the ground bar in the panel.
This will allow you to fit a NEMA 6-50 receptacle. (no NEMA 14-50).
SE cable is allowed the higher 75C thermal ampacity, so

#8 Cu is allowed 50A breaker, allowing 40A true charge rate
#8 AL is allowed 35A breaker, allowing 28A true charge rate

EVSE's don't use neutral. NEMA 14 is wasted.
I don't understand why NEMA 14 is a fixation of people in the EV community.  EVSE's don't use neutral (unless they are cheapo and use a 120V module inside their internal GFCI, which is stupid because it makes the EVSE unsellable outside North America).
You know the charger is on the EV... the EVSE is just a GFCI and disconnect. Really. Check out this video for a full rundown on that. Don't take my word on it, look right down the barrel of your J1772 connector (or Tesla equivalent).  3 terminals - ground and 2 conductors. NO NEUTRAL.
Installing a NEMA 14 receptacle requires you bring a fourth wire all the way from the panel. This is pointless and wasteful. Come on EVSE industry, stop with the NEMA 14 already!
The only viable reason to run a 4-wire to a NEMA 14 is if that outlet will be swapped out to power other things, such as an RV, which does take neutral for its numerous 120V loads.  I suspect that versatility, or fear of old circuits, is why EVSE manufacturers is trying to "tear that decision out of your hands".  Tell them to shag off.
If the EVSE needs a NEMA 14, it's stupid. Send it back.
If the EVSE has no requirement at all for neutral, but gives a 14-30/50 plug for no reason whatsoever, change the plug to NEMA 6-30/50.
NEC 2020 requires GFCI protection for receptacles
If your location is under NEC 2020, you need to have GFCI protection on all your 240V sockets.  (which, again, is redundant for EVSEs).  So if you are under NEC 2020, eliminate the socket and plug, and hard-wire the EVSE.  If the EVSE does not support hardwiring, then send it back.
Comment: The fixation on 14-50 comes from the appliance industry where they were too cheap to retool certain American made appliances to not require the neutral.  That initial "cost savings" now costs us valuable copper for no reason.
Comment: @Bryce well that's the weird part.  The only thing on a range that needs neutral is the oven light.  And the impetus to support a 120V oven light is the pro-consumer desire to allow homeowners to use the incandescent bulbs they already keep on hand for house lighting. *Obviously, the makers of ovens didn't think like HP, Epson and Gillette, or they would have dumped the neutral in a heartbeat to make it impossible to use common bulbs, and ONLY the Model 902 Oven Light with its patented, proprietary socket, $39.99 at Office Depot*.
Comment: Dryers being another creature altogether, since any given dryer model is an entirely 120V machine for commonality with gas dryers, which differ only by style of heating element.
Comment: Thanks for the thorough response.  Regarding the line "Note that for the GFCI protection to work properly, the socket must be changed to a NEMA 14, and ground must be isolated from neutral!", I'm a bit confused because I thought the point of the GFCI option you describe is to be able to forget about ground entirely.  I appreciate your observation that neutral is overkill in receps for EV-only, but in my case I am looking to change a wonky 10-30R to 14-30 primarily so the dryer is safe, but if in the process I can also end up with a circuit that could be a backup EV charger, that's a nice plus.
Answer: It depends on what your charger requires!
If it is a 240v charger hot-hot-ground yes you can use 10-30 or 10-50 they are not obsolete I just installed one recently for a 240v air compressor. (They don't make a 40). The 50 with #8 wire is limited to a 40 amp breaker, most of us just bite the bullet and wire in #6 but since you have the 8 in place install a 10-50 and a 40 amp breaker and this is code compliant see NEC table 210.21.b.3 .
Comment: Not a 3-prong 10-30 (neutral, no ground) -- been outlawed for new circuits for ranges and dryers since '96, and longer than that for anything else. Surely you are thinking of a 6-30.
Comment: Yes its a 10-30..... two hots and a ground.  This place goes back to the mid 80s.
Comment: No ground in a NEMA 10 - that's the crux of the problem.


The menu that shows up when a new mesh is added disappears when I click on it

Question: I am not able to access the menu when we add a new mesh. It disappears when I click on it. What do I do?
Comment: Please don't use all caps in your titles - instead make them descriptive to help people understand what your question is about just by looking at it.
Comment: Did you try pressing F6 after creating an object?
Answer: Adjust Last Operation panel can be used just after some operation is performed. It does not disappear if you click on it, however it will disappear when you click somewhere else.
It is possible to bring it back by going to Edit-> Adjust Last Operation or with F9, however this is only until you perform some other operation. When you do, it becomes the new last performed operation, the previous operation then becomes completely finished and you cannot change its parameters any more.
Answer: I had the same issue as mentioned. F9 as mentioned in another anwser did also not work for me. I solved it by resetting to defaults.
File → Defaults → Load Factory Settings
I guess this problem happened using unstable builds and developers changed something, which did not work well with my configuration.
Keep in mind that doing this will reset all your Blender changes to defaults.


Flickr API upload photo from URL

Question: I have a website with photo gallery and I'd like to upload each photo (one by one) to my Flickr account. I managed to upload a photo from my local disk but is there a way to specify URL so that image is being picked from that URL and uploaded to Flickr?
Answer: Per the documentation (http://www.flickr.com/services/api/upload.api.html and http://www.flickr.com/services/api/upload.example.html), the only means to do an upload is by placing the bytes of the image on the wire.  However, depending on your implementation language (your SO question tags don't specify one), there might be a library that could turn a URL into uploadable bytes for you.
Update
Flickr links to FlickrNet, which might have code that could turn a URL into uploadable bytes.  The documentation for the project looks sparse, but it is apparently being actively maintained by Sam Judson.
Comment: Thank you for answer. My language is C#. Any suggestion how could I do this?

Flickr API upload photo from URL


Validating Date Range Produced By jQuery UI DatePicker

Question: I am using the date picker provided by jQuery UI to select a date range that ends up in a  single text input with something like 11/11/2008 - 12/05/2008. What would you recommend as far a validation (jQuery/JavaScript) on the client side as well as code for validation on the server side (ASP.NET/C#) to make sure the user enters valid dates?
Note I asked a question on Stack Overflow the other day about how to parse out the two dates using C# if your interested.
Answer: CustomValidator.  Should be fairly simple to split these into two separate dates, parse each, and compare as necessary to verify the range is correct.
Answer: You can compare Dates with javascript fairly easily, just convert inputs to Date objects, and then any comparator would work. I use Date.js, as it has an excellent parser.  On the backend, I would assume that you can do the same thing, the key is to convert all your objects to the same type, and one that can be compared to another.


Older child 11 years jealous of 2 year old?

Question: My daughter is 2 years old, she is girl. My son 11 years old is my step son, he is obviously raised by both, his mom and his dad (my partner). I have noticed recently, that he is jealous of my and his dad daughter. My daughter is my first born child and I have different approach to her, I see this too. I am more of a mom now, that I have my own child and my mom instincts than I had when my step son was her age. Have any one had any experience with this kind of situation?
Answer: Talk Openly to Your Step-Son
If your step-son is 11, I think you can have a rather direct and honest approach about this problem. It's fine to acknowledge mistakes or difficulties with an 11yo, they don't see you as an all-powerful super-hero anymore.
I'd recommend you have a 1:1 discussion with your step-son to clear the air, and highlight the positives.
Acknowledge His Feelings
Your step-son is jealous. Consequences and actions resulting of that can be bad, but feeling jealous in itself is just a symptom and a reaction. Acknowledge that you've noticed, and acknowledge that he's entitled to feel this way.
Explain Why Things Are the Way They Are
Your step-son is not your daughter.
Highlight the Differences

They are 9 years apart.
You had them at different times.

Society is different than 9 years ago.
You are different than 9 years ago. Your parenting experience is different, you're older, etc...
Your situation is different than 9 years ago. Your location might have changed, your finances, your schedule and work/life balance...

Your step-son is different. They don't recall what it was like to be 2yo, so they can't know how people treated them at 2. Clarify that what you do with the 2yo, while maybe different than with him, is normal. Make that a positive and explain that it gives your step-son a chance to see what it was like to be 2yo.

Highlight the Similarities

You have room in your heart for both of them.
They both are your top priorities.

Make Him Part of the Process
Give him a sense of ownership and responsibility. It shouldn't be all there is and be careful it doesn't put too much pressure on him. But letting him know that, as an older member of the household, he's also partly responsible to take care (and most importantly support) his sister. Careful that he doesn't then feel entitled to boss her around, though.
Sure, that also emphasizes the differences, and it may feel like taking care of his sister is a chore. But chores and responsibilities can come with reward, and make sure to quality time in your schedule to spend with him as a reward for his good brotherly behavior.


Is the ASV Bible version Public Domain in Canada? Any other Bibles Public domain in Canada?

Question: I have found on Biblegateway.com that there is a list of Bibles that are in the Public Domain for the US including the ASV, but I am not sure if that also covers Canada.
Answer: In Canada, the copyright for a work usually expires 50 years after the death of the creator, at the end of the relevant calendar year.
https://copyright.ubc.ca/public-domain/#:~:text=In%20Canada%2C%20the%20copyright%20for,Domain%20on%201%20January%202052.
The ASV was originally published in 1901 and had its copyright renewed in 1929, giving it copyright end of life as 1979.  So looks like it is in Public Domain now.


What type of person do i need to manage my life

Question: I'm looking for a person or group that can handle my financials. (for a fee or not (Fee to me means maybe 1-200 a month.)) I want to be able to give them access to the bank account and over see the bills. Paying them off and leaving me behind what i can spend. i know someone like this exists but i just cant get my hands on the name.
Comment: Why do you want somebody else to do your work ? Are you that lazy ? From your question it seems you aren't swimming around in money either. Your option is more for people who have loads of money in their accounts. Taking advice on investing your money is an option, rather then putting somebody else in control of your finances.
Comment: Find a mirror, that is the person you are looking for.
Answer: Why don't you just use automatic bill payments to cover your credit card payments for free. This way you will not have to pay anyone.
I guess you may want someone to tell you whats going on?
Comment: I suggest you spend some time to learn these basic skills.  As I mentioned, automatic payments are probably the best way. You may also want to consider something like mint.com (Warning: This is cloud based and security is to be considered) where you add your credit cards and bank accounts and mint.com will remind you for everything you need (ex. Bill reminders, fees, budgets, etc.). I personally use this but being in IT, I understand that you are keeping your data with a 3rd party.
Answer: You're probably thinking of a Personal Assistant, or perhaps a Life Coach. As LEEMAN said, it's probably overkill, but that might be the word you're looking for.


gcc vs clang common library issue

Question: I have two applications, one compiled with gcc(c++) and another compiled with clang++. I am to use common shared boost library for both the applications. My question is whether to compile boost shared library using clang compiler or gcc compiler. Can I use boost library compiled with gcc in my application that is being compiled using clang?
Comment: Possible duplicate of [Can Clang compile code with GCC compiled .a libs?](https://stackoverflow.com/questions/20875924/can-clang-compile-code-with-gcc-compiled-a-libs)
Answer: g++ and clang++ are compatible as compilers (because they both follow the Itanium ABI), but they may come with incompatible standard library implementations.
g++ comes with a standard library implementation called libstdc++. You can direct g++ to use a different implementation but this is not exactly trivial.
clang++ sometimes comes without a  standard library implementation of its own (and is configured to use implementation provided by g++), and sometimes comes with an implementation called libc++. One can easily switch clang++ to use either libc++ or libstdc++ with a single command line option.
So your question boils down to what standard library implementation(s) your applications use. If they use the same implementation, you need to build Boost with that implementation (and either compiler). If they use different implementations, you need two separate builds of Boost.
Mixing components built against different standard library implementations in the same application can sometimes be done, but is not straightforward, entails a lot of restrictions, and with things like boost is either not feasible or downright impossible.
Comment: very well explained. Thanks!
Answer: You need to use two separate builds of boost for each of your apps, unless the boost usage is limited to within a dynamic library that is then linked to by those apps and said dynamic library doesn't export types from the c++ std library within it
Answer: Short answer: maybe, maybe not.
Long answer:
The C++ standard (or any other standard) doesn't guarantee this sort of usage.
The developers of Clang do put reasonable effort into making Clang and GCC compatible, but for the most obvious (it is a different compiler!) and some less obvious reasons (subtle differences in understanding of the meaning of the C++ specification for example), they are not the same compiler and thus MAY do things differently in several aspects.
The most obvious reasons for incompatibility are:

differences in type definitions. Things like size_t, int and long may not be identically defined, so a function that is compiled with int func() may not return the same size value in both compilers.
differences in name mangling. How the compiler differentiates func(int) from func(long) for example.
differences in calling convention. How arguments are passed and returned - whether an argument is in a register or on the stack, which order the registers are picked for the first to last of register arguments, etc.
differences in exception handling. How the compiler generates the code to resolve an exception thrown in a particular place in the code, and unwinding back to the nearest catch statement.

That's by no means a complete list of
Some of the above differences may also depend on which target the code is compiled for - for example, it may work perfectly fine on x86, but compile for PowerPC, and there's some difference somewhere.
I don't believe anyone is able to conclusively say that "yes, this will work" or "no it won't". I do compile code with a mixture of clang and gcc quite regularly, and it does work almost all the time. But that doesn't mean it works ALL the time for ALL cases of everything. And that's the real issue.
If you have a good test-suite [if not, you probably ought to fix that anyways], you can verify that all of your (tested) code works as expected. That's a much better guarantee than "someone on some internet page wrote that it works", because it tests what you are using, in the way you are using it.
Comment: Absolutely nothing like that can possibly happen. Millions of lines are compiled with clang++ and linked with g++-compiled code, including the g++-provided standard library libstdc++, with no single issue. Any such issue would be a clang++ bug. Seamless compatibility with g++ is one of clang++ strongest selling points.
Comment: The things you list are actually the things that are most compatible between the two, because they are defined by the ABI (size of fundamental types, alignment, exception handling routines, calling convention, name mangling), which Clang obviously follows. The things that are different are e.g. builtin functions generated and the C++ library itself defining types like std::string differently. That last bit will be what prevents this from working of anything at all, not anything else.

gcc vs clang common library issue


What are some of the chess sites that allow Round Robin or Swiss Tournament to be organized?

Question: I have been experimenting with the Team feature and tournament features in Lichess, but I just learned that it's not possible to have swiss, round robin or manual pairing in Lichess. A couple of months ago, I organized a rapid league in my chess club and it went really well, but after a few months, we stopped it due to financial problems. There were three leagues, A, B and C with one round-robin tournament each month (For A and B) while C had a swiss tournament. After each tournament, the top and bottom two shift groups and the winners of the Swiss get a place in B group. Learned so much from running the league. Recently I checked Lichess and fell in love with the beautiful interface (but sad at the lack of features for Swiss/RR tournaments), so, I wanted to ask if there's a good place to organize such a league online? I checked chess.com but it wants me to pay. Still researching!
Comment: Have you seen this question asked previously? Does it answer your question? https://chess.stackexchange.com/questions/468/how-to-organize-a-chess-tournament
Comment: lichess has swiss, but still lacks round robin capability.  I too am looking for round robin format.  Chess.com might have it.  I read the "daily tournament" is a round robin, and you can make your own, but you have to be a paying member which I am not.
Answer: This is an online option:
https://chess.swips.eu/
But beware that the free version has the following limitations: up to 20 players in only one category, up to 5 rounds with only one tiebreak method.
Comment: this appears to be for over-the-board tournaments, not online playing sites.


Capturing Process Termination(Task Manager) in WPF

Question: I have a WPF application.when the application closes i do some update/insert action in database which is mandatory for my application.But if my application is forcibly closed by killing the process in taskmanager, i am not able to do operation in database.
I am doing the updating/insertingrecords in DB in "Exit" Event in "App.xaml.cs",this event is not fired when the application is killed in taskmanager.By searching i found that if a process is killed in Process Tab of Task Manager the application closes immediately without waiting for the application to respond.
One way we can capture the process termination is by having a service running which checks this application Process.
Is there any other way to catch the process termination within the same application i.e By not having another service running to check.?
Thanks in advance..
Answer: TerminateProcess does not give your application any chance to detect termination. You need an external application/service that monitors, or better yet you need to take away the reason your users have to kill the process using Task Manager.
Comment: What's wrong with the answer if this is the case?


How do I set XBMC as the default media player?

Question: I've recently started using xbmc and i love it. The only thing is i cant find a way of setting it as the default media player.
It just does not show up on the default list. I hope someone out there help on this.
Answer: xbmc is a media center not a media player.
You must start xbmc first to open a file with-in
I agree it is a great media center probebly the best but i would use Mplayer if you  want to just click on files to open them
Answer: This will add a new menu entry via a desktop file, XBMC-sendto, which will open XBMC or give it focus and open the media file. It works with audio, video and picture files that are local or on network shares (I've only tested with smb shares). This requires the program wmctrl to be installed and JSON-RPC (the webserver) to be enabled in XBMC/KODI.
The zip file contains two files. The kde-send-to-xbmc.sh file can be placed anywhere you like (don't forget to make it executable) and the xbmc-send2.desktop file needs to be placed in ~/.local/share/applications/. Then edit xbmc-send2.desktop and update the Exec= line to reflect where you put the sh file. If json-rpc uses a non-standard port or you want to send content to a remote xbmc host you need to edit kde-send-to-xbmc.sh. You may need to restart you desktop environment, although this was not necessary in KDE4. Now you will be able to open media files with XBMC directly from the desktop (you'll probably need to set XBMC-sendto as the default program for a particular file type).
https://dl.dropboxusercontent.com/u/22410524/xbmc/xbmc-file-associations-0.0.1.zip
I have only tested this with KDE, I would like to hear if it works (or doesnt) with other DE's. Also the file types are wholesale borrowed from VLC/GIMP's dektop files, let me know if any are missing or incorrect.
Link to XBMC/KODI forum page: http://forum.xbmc.org/showthread.php?tid=201285
EDIT: Fixed Dropbox link.


How to enable Survival Mode in Fallout 1.4 Patch?

Question: I switched the game difficulty to Survival however I still can fast travel and the ammo remains weightless. (PS4)
Comment: I'm torn on closing this or not. I'm going to vote to leave it open, since they're basically asking if a feature is in a specific patch, and that patch *has* been released, even though the feature hasn't been.
Answer: Survival mode is not out yet. You can select the difficulty, but many of the features linked to the mode are not included in the game yet.

A new patch is making its way to consoles by end of this week, and many expect that the next patch after this one will finally include the new survival mode content.

Source : Gamerant
Answer: As Isuka said, Survival Mode as you want to play it has not been released, and as of the date of my answer, no news about it's release date has been revealed.
The survival mode difficulty that came with the game and the Survival Mode update are two completely different things.
The current survival mode difficulty only reduces the amount of damage you do to enemies and also reduces the effect of AID items (stimpaks, purified water etc... I believe). Ammo is weightless as it is in lower difficulties.
By the way, Survival Mode beta is to be released on Steam for PC before it reaches consoles.


Can I tell where a leak is in a vertical water pipe based on the water pressure at the bottom?

Question: I have a buried water line with a leak in it and I want to locate approximately where it is. The line runs uphill to a storage tank. I've isolated the leak to one section of the pipe. The diameter of the pipe is 1.5" and the isolated section is about 300 feet long. If I measure the water pressure at the bottom of the pipe it is at 42 psi. This is after letting the pipe sit overnight with no water pressure coming into it from above so I assume that all the water in the pipe above the leak has drained out. Is it possible to tell roughly how many feet in elevation the leak is above the bottom?
Comment: @Skywalker answer is right. You can only get the height of the water. You can only get the height of the leak if you let the water drain down to it. So if you measure the pressure at the bottom, you need to wait until it stops falling. Actually, that will be an asymptote. It will slow down before it gets there. Actually, you might speed it up by letting some water out the bottom.
Answer: IF all of the water above the leak point has indeed completely drained away, and the water is completely stationary throughout the pipe's entire length (those are important "if"s), then your problem is quite straightforward!
With the density of water, we can easily come up with a direct relation between water height (regardless of the horizontal path taken to get there) and the corresponding pressure at the bottom.
Check out this table for a quick reference: http://www.engineeringtoolbox.com/hydrostatic-pressure-water-d_1632.html
Looks like the leak should be just under 98 feet up (vertically). Of course, you'll still have to work out how that number maps to a position on the hill!
Comment: One point to check:  is the reported pressure *gauge pressure* or *absolute pressure*.  If the latter (unlikely), subtract 14.7 from the reading and then proceed as @Skywalker indicates
Comment: Agreed! That would instead indicate an elevation just over 60 feet.
Comment: I checked the pressure again this morning and it is holding steady at 42 psi. And the reported pressure is gauge pressure. So I will next figure out how to measure up 60 feet vertical and start digging! I'll let you know the result. Thanks for the help
Comment: @Vic, it sounds like you may have misinterpreted that last bit. Since your measurement represents the gauge pressure, that means that your target is 98 feet- not 60!
Comment: Thanks for the clarification. It ends up that I was able to find the leak with just 10 minutes of digging! I had a hunch that the most likely place to find the leak would be where we transitioned from one type of pipe to another. Knowing that it was high up in the line (60 to 90 feet) was an essential clue. Thank you all for your help. Much appreciated!
Comment: Awesome! It's great to hear that you were able to find the leak so quickly.

(P.S. consider showing your appreciation by clicking "Accept" next to my answer; that will officially mark it as having helped to solve your problem!)


Variance Estimation in case of nonrespondents

Question: I saw in the book of Rubin (1987) that an increase in variance of estimation will occur due to nonresponses. But I wonder the reason behind this. Thanks for your shares!
Answer: The "increase" is relative to a fully responding sample.  So if you sample $n $ but only $ n_o< n$ units actually respond, then the variance will be higher - just like if you sampled less people.
There may also be systematic differences between those who respond and those who don't respond - this is non-response bias.  This may further inflate your variance (technically its the mean square error that is inflated due to bias).
Answer: I would say that possible bias arising out of differences in distribution of survey variables amongst respondents and non-respondents is much more dangerous situation than increase in the sampling variation.
In any case there must be some method to adjust inclusion probabilities from which you calculate weights to transform sample level statistics into population ones.


Cloudy white film spots on surface of stone sealer

Question: After sealing a stone tile surface outdoors, these white cloudy spots appeared within a day or two. They appear more frequently near the grout than the tile, but not exclusively. What caused this, and what can I do to clean it up, if anything?
Answer: From my experience, it is excess moisture. The one spot looks like water sat on the sealer before it cured. The remedy is add a bit more sealer to the area, try just enough to dampen the area first on a clean cloth. Make sure it is dry, and stays dry until it cures.
Comment: No lumps...or at least a dark speck.
Comment: You're ruling out birds?  :-)
Comment: Definitely not birds. Not obvious from this one photo, I agree, but looking at some of the other spots it's quite obvious.
Comment: I'll give this a try.
Comment: Seems to help significantly. Not perfect but much better. Thanks


Replace preg_replace() e modifier with preg_replace_callback

Question: I'm terrible with regular expressions. I'm trying to replace this:
public static function camelize($word) {
   return preg_replace('/(^|_)([a-z])/e', 'strtoupper("\\2")', $word);
}

with preg_replace_callback with an anonymous function. I don't understand what the \\2 is doing. Or for that matter exactly how preg_replace_callback works.
What would be the correct code for achieving this?
Comment: @HamZaDzCyberDeV I know. That's one of the reasons I want to replace it with preg_replace_callback
Comment: Please don't use `create_function`, it's just yet another wrapper around `eval`. You should use a proper anonymous function, unless you're stuck in PHP 5.2 for some reason.
Comment: The **e** modifier is [deprecated](http://php.net/manual/en/reference.pcre.pattern.modifiers.php) as of PHP 5.5.0
Comment: There's a manual page for [`preg_replace_callback`](http://php.net/preg_replace_callback). And `\\2` will become `$matches[2]` in said callback. Or which part are you confused about specifically?
Comment: @mario ahh The $matches[2] was all I needed. I still don't understand how it works, but it does. If you put that in an answer I'll mark it is as solving the problem.
Answer: In a regular expression, you can "capture" parts of the matched string with (brackets); in this case, you are capturing the (^|_) and ([a-z]) parts of the match. These are numbered starting at 1, so you have back-references 1 and 2. Match 0 is the whole matched string.
The /e modifier takes a replacement string, and substitutes backslash followed by a number (e.g. \1) with the appropriate back-reference - but because you're inside a string, you need to escape the backslash, so you get '\\1'. It then (effectively) runs eval to run the resulting string as though it was PHP code (which is why it's being deprecated, because it's easy to use eval in an insecure way).
The preg_replace_callback function instead takes a callback function and passes it an array containing the matched back-references. So where you would have written '\\1', you instead access element 1 of that parameter - e.g. if you have an anonymous function of the form function($matches) { ... }, the first back-reference is $matches[1] inside that function.
So a /e argument of
'do_stuff(\\1) . "and" . do_stuff(\\2)'

could become a callback of
function($m) { return do_stuff($m[1]) . "and" . do_stuff($m[2]); }

Or in your case
'strtoupper("\\2")'

could become
function($m) { return strtoupper($m[2]); }

Note that $m and $matches are not magic names, they're just the parameter name I gave when declaring my callback functions. Also, you don't have to pass an anonymous function, it could be a function name as a string, or something of the form array($object, $method), as with any callback in PHP, e.g.
function stuffy_callback($things) {
    return do_stuff($things[1]) . "and" . do_stuff($things[2]);
}
$foo = preg_replace_callback('/([a-z]+) and ([a-z]+)/', 'stuffy_callback', 'fish and chips');

As with any function, you can't access variables outside your callback (from the surrounding scope) by default. When using an anonymous function, you can use the use keyword to import the variables you need to access, as discussed in the PHP manual. e.g. if the old argument was
'do_stuff(\\1, $foo)'

then the new callback might look like
function($m) use ($foo) { return do_stuff($m[1], $foo); }

Gotchas

Use of preg_replace_callback is instead of the /e modifier on the regex, so you need to remove that flag from your "pattern" argument. So a pattern like /blah(.*)blah/mei would become /blah(.*)blah/mi.
The /e modifier used a variant of addslashes() internally on the arguments, so some replacements used stripslashes() to remove it; in most cases, you probably want to remove the call to stripslashes from your new callback.
Answer: preg_replace shim with eval support
This is very inadvisable. But if you're not a programmer, or really prefer terrible code, you could use a substitute preg_replace function to keep your /e flag working temporarily.
/**
 * Can be used as a stopgap shim for preg_replace() calls with /e flag.
 * Is likely to fail for more complex string munging expressions. And
 * very obviously won't help with local-scope variable expressions.
 *
 * @license: CC-BY-*.*-comment-must-be-retained
 * @security: Provides `eval` support for replacement patterns. Which
 *   poses troubles for user-supplied input when paired with overly
 *   generic placeholders. This variant is only slightly stricter than
 *   the C implementation, but still susceptible to varexpression, quote
 *   breakouts and mundane exploits from unquoted capture placeholders.
 * @url: https://stackoverflow.com/q/15454220
 */
function preg_replace_eval($pattern, $replacement, $subject, $limit=-1) {
    # strip /e flag
    $pattern = preg_replace('/(\W[a-df-z]*)e([a-df-z]*)$/i', '$1$2', $pattern);
    # warn about most blatant misuses at least
    if (preg_match('/\(\.[+*]/', $pattern)) {
        trigger_error("preg_replace_eval(): regex contains (.*) or (.+) placeholders, which easily causes security issues for unconstrained/user input in the replacement expression. Transform your code to use preg_replace_callback() with a sane replacement callback!");
    }
    # run preg_replace with eval-callback
    return preg_replace_callback(
        $pattern,
        function ($matches) use ($replacement) {
            # substitute $1/$2/… with literals from $matches[]
            $repl = preg_replace_callback(
                '/(?<!\\\\)(?:[$]|\\\\)(\d+)/',
                function ($m) use ($matches) {
                    if (!isset($matches[$m[1]])) { trigger_error("No capture group for '$m[0]' eval placeholder"); }
                    return addcslashes($matches[$m[1]], '\"\'\`\$\\\0'); # additionally escapes '$' and backticks
                },
                $replacement
            );
            # run the replacement expression
            return eval("return $repl;");
        },
        $subject,
        $limit
    );
}

In essence, you just include that function in your codebase, and edit  preg_replace
to preg_replace_eval wherever the /e flag was used.
Pros and cons:

Really just tested with a few samples from Stack Overflow.
Does only support the easy cases (function calls, not variable lookups).
Contains a few more restrictions and advisory notices.
Will yield dislocated and less comprehensible errors for expression failures.
However is still a usable temporary solution and doesn't complicate a proper transition to preg_replace_callback.
And the license comment is just meant to deter people from overusing or spreading this too far.

Replacement code generator
Now this is somewhat redundant. But might help those users who are still overwhelmed
with manually restructuring their code to preg_replace_callback. While this is effectively more time consuming, a code generator has less trouble to expand the /e replacement string into an expression. It's a very unremarkable conversion, but likely suffices for the most prevalent examples.
To use this function, edit any broken preg_replace call into preg_replace_eval_replacement and run it once. This will print out the according preg_replace_callback block to be used in its place.
/**
 * Use once to generate a crude preg_replace_callback() substitution. Might often
 * require additional changes in the `return …;` expression. You'll also have to
 * refit the variable names for input/output obviously.
 *
 * >>>  preg_replace_eval_replacement("/\w+/", 'strtopupper("$1")', $ignored);
 */
function preg_replace_eval_replacement($pattern, $replacement, $subjectvar="IGNORED") {
    $pattern = preg_replace('/(\W[a-df-z]*)e([a-df-z]*)$/i', '$1$2', $pattern);
    $replacement = preg_replace_callback('/[\'\"]?(?<!\\\\)(?:[$]|\\\\)(\d+)[\'\"]?/', function ($m) { return "\$m[{$m[1]}]"; }, $replacement);
    $ve = "var_export";
    $bt = debug_backtrace(0, 1)[0];
    print "

    #----------------------------------------------------
    # replace preg_*() call in '$bt[file]' line $bt[line] with:
    #----------------------------------------------------
    \$OUTPUT_VAR = preg_replace_callback(
        {$ve($pattern, TRUE)},
        function (\$m) {
            return {$replacement};
        },
        \$YOUR_INPUT_VARIABLE_GOES_HERE
    )
    #----------------------------------------------------

\n";
}

Take in mind that mere copy&pasting is not programming. You'll have to adapt the generated code back to your actual input/output variable names, or usage context.

Specificially the $OUTPUT = assignment would have to go if the previous preg_replace call was used in an if.
It's best to keep temporary variables or the multiline code block structure though.

And the replacement expression may demand more readability improvements or rework.

For instance stripslashes() often becomes redundant in literal expressions.
Variable-scope lookups require a use or global reference for/within the callback.
Unevenly quote-enclosed "-$1-$2" capture references will end up syntactically broken by the plain transformation into "-$m[1]-$m[2].

The code output is merely a starting point. And yes, this would have been more useful as an online tool. This code rewriting approach (edit, run, edit, edit) is somewhat impractical. Yet could be more approachable to those who are accustomed to task-centric coding (more steps, more uncoveries). So this alternative might curb a few more duplicate questions.
Answer: You shouldn't use flag e (or eval in general).
You can also use T-Regx library
pattern('(^|_)([a-z])')->replace($word)->by()->group(2)->callback('strtoupper');


What are *.snap files in eclipse?

Question: I have so many projects in workspace. for every one or two weeks i have to search for *.snap file delete them. otherwise my eclipse will take lot of time to come up? So curious to know what are they? are they specific to java? as i have lots of java projects in my workspace?
Comment: .snap-shot of some sort would be my guess. seriously though, first google hit: http://dev.eclipse.org/newslists/news.eclipse.newcomer/msg06614.html
Comment: thanks. i ll do that.. but i thought i ll get to the point answer here so asked.. sorry..
Answer: *.snap files represent the changes in workspace state of the IDE during the runtime. This is mostly for eclipse crash recovery plan. When a crash happens these files are used to recover the state fo eclipse workspace.
Answer: It looks like your eclipse platform is crashing quite often. Because otherwise, the snapshot files should not be there while the platform is not running. As the referenced page in roe's comment explains, they are just needed for crash recovery and are deleted during normal shutdown of the platform. Deleting them will make eclipse think, that no crash occurred but then it can't recover and you may have to refresh/rebuild your workspace (which may take the same time).
I'd not delete those files except eclipse won't recover from a crash. Have a look at the eclipse workspace and platform log files if you have troubles with some plugins and fight the problem from this side (updating plugins or sending error reports) instead of deleting those files.
Comment: Eclipse indeed crashes quite a lot and you may end  up getting errors along the lines `java.lang.StackOverflowError org.eclipse.core.internal.dtree.DeltaDataTree.reroot` during the restart. In that case Eclipse fails to start because of failing recovery. Deleting one or more of the .snap files inside `.metadata/.plugins/org.eclipse.core.resources/` will fix the workspace in that case.
Answer: A very good solution for me was to:

Cut and Paste the .snap file in a separate folder
Start and then Close Eclipse (after restarting I've noticed that some of my classes where not there)
Put back the .snap file in the original place
Start again Eclipse

What are *.snap files in eclipse?