Why is my single test image much brighter than our Stackshot image output?

Question: I'm working on taking stacked photos of small insect specimens for a university. I am using a Canon EOS 6D body camera. We are using a StackShot macro rail to image these specimens. An issue that has come up is that the images taken in Stackshot look different than the images on the Canon EOS Utility software test shot. They are much darker and look as if the flash is not firing on the StackShot photos, but the flash is firing. I'm wondering if this is a mismatch between the flash firing and the shutter going off within StackShot or if there are other troubleshooting methods I should go through. I've changed the batteries of both the camera and the flash, as well as turning everything on and off again. Any help would be greatly appreciated. Some photos of the issue are attached below:
Canon EOS test shot:

StackShot photo:
Comment: What were your exposure and flash settings (aperture, ISO, shutter speed, flash power)?
Answer: Not an answer but a few things to check:
Are you moving toward or away?  If the flash is being set at the same level, then as you move toward, you get more light reflected.  If moving away, less light.  It doesn't take a lot of move to make a significant difference.
You can check this as a cause by mounting the flash off camera.
Are you using automatic exposure/automatic flash?  Find the right flash level manually, and use that.
The white background may be fooling the light meter.  I generally find that viewing macro level objects on white on screen has a lot of glare.  Consider using a neutral grey or a black background.  (Art stores have an amazing variety of coloured cardboard.
If this is the case, you may have the opposite problem on a dark background:  The stacked image is overexposed.
Have you inquired with the makers of the software?


How do I amplify a dc voltage that is too weak to trigger the base in a transistor?

Question: I'm trying to take the voltage output from a 3.5mm audio jack and have it light up an LED according to it's voltage.  I was going to attach the left audio cable to the base of a 2222n transistor which would act as my amplifier to trigger the LED to light.  Unfortunately, the voltage reading off the wire is like .2 or .02 and isn't high enough to trigger the flow.  Is there any way to increase the voltage to trigger the transistor or would I have to use a transformer of some sort (or an op amp??)
Comment: You will need an external power source like a battery... you can't amplify a voltage unless it has a lot of current to back it up, which 3.5mm audio does not. Take a look at this question: http://electronics.stackexchange.com/questions/54980/simplest-circuit-that-flashes-and-fades-color-leds-synchronized-to-music
Comment: Is it an audio signal that you want to trigger the LED?
Answer: The problem which you have correctly identified (good for you!) is that the incoming signal has small voltage swings around 0V, but the transistor requires around 0.6V to begin to turn on. The solution is to bias the transistor to a given operating point: providing a base voltage which causes a degree of turn-on that exists when there is no signal. Then the signal is shifted to that same voltage level, so that is swings around that voltage rather than zero (or whatever is its original DC offset).
For AC signals, this level shifting is easily accomplished. We simply connect the AC signal source to the transistor's base not via a wire, but through a capacitor. The capacitor blocks DC current, put passes through the AC voltage swings, superimposing them onto the voltage of the target node.

simulate this circuit – Schematic created using CircuitLab
In this circuit, the sine wave generator is configured to generate a sine wave with an amplitude of only 0.1 mV. Yet, the positive peaks of this wave cause peaks of 1.5mA of current to flow through the LED. This is because of the bias set up by R1 and D1 creates a voltage which, conveyed via R2 to the base of Q1, sets up sets up that transistor's operating point so that it is slightly turned on, just on the verge of being much more turned on. In fact, according to the simulator, about 50 microamperes already flow through the LED when there is no incoming signal.  So from this operating point, any voltage swings in the signal cause a response in the transistor. (Why a diode? Because a diode has a similar voltage drop to the base-emitter junction of a transistor of the same type, e.g. silicon.)
Negative swings in the input are ignored, and the flashes of peak current dumped through the LED are proportional to the amplitude of the positive swings, so it should vary in brightness with the signal level. The resistor values have to be adjusted based on your LED.
The responsiveness to small signals is quite sensitive to R1, R2 and R3.  If R1 is too small, for instance, then VBIAS will turn on the transistor more; small signal swings cause more LED current than before.   R4 needs to be adjusted based on the supply voltage, the type of LED, and the desired maximum current that is to be supplied to it.
R3 is only 0.22 \$\Omega\$ which is deliberate: that is to provide only small feedback to stabilize the operating point of the transistor against thermal runaway, without sacrificing a lot of current gain that would make the circuit less sensitive. In a pure on/off LED switching circuit, we would not have R3, but here we are keeping the transistor slightly turned on all the time, with a slight quiescent current, which brings in the risk of thermal runaway.
R5 protects the base-emitter diode of Q1 against current driven by the input, because the emitter resistor R3 is insufficient.
One problem with the above circuit is the small input impedance, essentially dictated by R3. This is fine for being driven by a speaker or headphone output, but it's too small for line level outputs which expect something in the neighborhood of 10K. The behavior is also very nonlinear. A doubling of the input peak from 0.1V to 0.2V much more than doubles the LED current. The behavior follows the nonlinear VBE versus collector current curve of the transistor. We can address both issues with these changes:

simulate this circuit
The first notable difference is a much larger emitter resistor R3 which provides a lot more negative feedback to stabilize the bias point. By itself, that costs us a lot of gain, but we can recover some of that by bypassing R3 with a capacitor to ground. R5 is no longer necessary. R2 increases because the original 2.7K would detract from the newly increased impedance of the base. R1 is slightly decreased to boost VBIAS a little bit to compensate for some loss of sensitivity.
According to the simulation, the input impedance is about 8.3K at 1 kHz, which is reasonable for line level, when we are not actually trying to preserve the frequency response of the audio but only lighting a LED. It drops to around 6.4K at 10 kHz.

Calculating the input impedance from simulation: obtain a plot of the current flowing into C1. Check that this is in phase with the input voltage. Then divide the peak-to-peak input voltage by the peak-to-peak current.)
Comment: Thank you, this was perfect!  I need to study the circuit some more to understand every detail but I know what the end goal is which is to provide a voltage that will basically be sitting just below 0.7v so that the signal will bump it up over the "on" point.  Kind of like an offset voltage so to speak.
Comment: @SonicD007  It's not that perfect! The circuit has a low impedance: basically that of R5. It should be okay with an output that can drive headphones, but it's low for a line out output that expects a "line level" type input.  The way to improve this is a larger R3, where we recover lost gain by bypassing R3 with a capacitor to ground.
Answer: Looks like Kurt sees it the same as me. AC / audio trigger circuit: -

V2 is the audio input.
It can be made to run off a smaller supply but I think about 3V3 will be the limit and also it'll have to be a normal LED that drops about 1.8V.
Higher supply voltage (no more than 12V) means you can trigger a higher power LED.
Comment: I don't quite understand the circuit you posted.  I'm still a novice so I don't fully understand what the capacitor and resistor do to the audio signal there.  This is the circuit I had built which doesn't trigger the npn transistor. http://i.imgur.com/ivmsWAR.png?1

Any advice on how to change the circuit I have now to get this working would be very much appreciated.
Comment: Your circuit should be posted in your question, and it is useless unless you show some component values. Possibly all you have to do is reduce the emitter resistor, but it's anyone's guess at the moment.
Answer: You are thinking of the transistor as a digital switch. You think that .2 volts isn't enough to turn on a transistor that needs .6 volts to do so.  But a transistor was also meant to operate as an analog device. Such circuits "bias" the transistor by setting the base voltage up into the "turning on" region, and they do this through a high resistance.  Then your "small" signal can coupled in and it will cause the transistor output to vary.  The output will be amplified, and if that's not enough, you can do this again with another stage until the signal is large enough to do the job you set out to do.
An op is just a (large) bunch of transistors again, doing things much like I just described.
The circuit posted by Andy uses a somewhat fancier current source, which in turn is like the voltage and high resistance I described, only it works better (higher resistance and self-adjusting).


Problem about a simple division

Question: My little sister wants me to divide $135628$ by $339$. I can not make her understand that quotient is $400$ and remainder is $28$. She does not understand how one last $0$ comes after $40$. She knows the relation among divisor ,dividend,quotient and remainder. So she can understand it by applying backward method ,that is by taking  quotient ($400$) and then put other respective values to get back the dividend. But She can not realize it in a straight forward way. And so I am here to get some valuable advice about how I can make the division crystal clear to her. With regards...
Answer: $$\begin{align}
\color{green}{1356}:339 &= \mathbf 4&\text{ remainder }&\color{red}0\\
{\color{red}0}\color{green}2:339 &= \mathbf 0&\text{ remainder }&{\color{red}2}\\
{\color{red}2}\color{green}8:339 &= \mathbf 0&\text{ remainder }&\mathbf {28}\\
\therefore \color{green}{135602}:339& = \mathbf{400}&\text{ remainder }&\mathbf{28}\end{align}$$
Comment: Thanks a lot sir for the lucid explanation.

Problem about a simple division


How do I copy files from one system to another on the same computer

Question: I have three systems on my computer, 16.04, broken 17.10, new gnome 17.10.
I want to move all my files to one system namely the gnome 17.10 then get
rid of the other two systems.
Comment: one benefit from @George's suggestion is that it provides a backup if things go wrong.  If it was me; I'd go to the one you want to keep; mount another in a directory (/mnt if not used; but can be anywhere) and just `cp -p` the files to their new home.  repeat for second partition. my approach assumes term (where i'd do it) but it can be done with gui if necessary too.  ( i use `cp` allowing me to `diff` before I `rm`, but you could `mv` them too)
Comment: Why not use an external drive to copy the needed folders then drop them in 17.10!
Comment: What files? Just the Home directories? Are the three installs within their own disk partitions?
Comment: @George Exactly, the life can be much easier if we don't think so complicated.  The best solutions is are almost always the simplest and most straightforward ones. The OP should provide more details, otherwise a proper answer isn't possible, since there is a lot of room for (mis)interpretation.
Comment: @chrisguiver, I think your comment can be developed into a good answer.
Comment: The systems are all in their own  partition. I will try Chris's sugestion.
Answer: Boot the system you plan to keep.
For each of your partitions (16.04 & other-17.10) do the following

Mount your partition to a directory. A common mount point in /mnt but you can mount to any directory you want, but check you have nothing already mounted to /mnt, or subdirectories inside there. If you need help here look at Detect and mount devices
Copy the files to wherever you want them (I'd suggest cp -p or -p to preserve file attributes, but it's up to you). You could also just use mv to move which means the subsequent [diff] step needs to be skipped
eg. cp -prnv /mnt/username/* /home/username/ which will copy everything from your old username-dir to your new username-dir preserving file info, recursively doing subdirectories but only copying 'new' files only (I included this to avoid clobbering any config files in your 'new' directory; but its up to you!). if you don't want all your old-home directory; adjust as appropriate.
Diff the original with your new home-directory.  this is optional, and if you did the whole /home/username directory new 'config' files will of course show as errors. this step is easiest if you do subdirectories within /home/username, and not the whole user directory
unmount when you're happy, sudo umount /mnt (adjusting /mnt to whatever directory you used)

you can of course use your GUI if you prefer. mounting can be done with disks or other tools, and copying with a file manager (files etc).


What's the best way to account for saw blade width (kerf) when cutting boards?

Question: In theory, to cut a 350mm piece out of a longer board, I would have to mark the line at 350mm + half of blade width. So if I have a 2mm hand saw, the line would be drawn at 351mm. How does that work in practice? Should blade wiggle be taken into account? Is it even reasonable to expect such precision in home conditions?
Answer: Yes, you might want the highest precision possible - for example when you build furniture which benefits greatly from precise cuts. The most convenient way would be to draw the line that will signify the edge of the piece you want cut so that the blade cuts the line and whatever material is on the far side of the raw board. Something like this:
<code> |the detail you want|line|remaining material|
 |                   |blade cuts here|
</code>
This is quite easily achieved with power saws even without a guide and will be more of a challenge with hand saws.
Comment: Another tip: if you're cutting multiple pieces from one board, and want to be precise, measure, mark and cut them one-by-one. Don't measure and put the marks down at the start, because you'll lose the width of the kerf for each cut (and if you're ever off even a bit on one cut, the rest are instantly wrong).
Comment: Perfect. Always cut on the waste side of the line. +1
Comment: My mitre saw has a laser on it, and it is set up so the left edge of the laser is exactly where the left edge of the blade will cut, so it's very easy to cut where the piece is on the left. If I need to cut from the right, I usually just bring the blade down (not spinning) and make sure the widest part of the tooth lines up with my cut line on the right edge, then cut there. Shirlock has it though: cut on the waste side.
Answer: You're looking for a precision cut, with a non-precision tool.
It's better to cut the piece slightly larger than what you need, and sand/plane to the final dimensions.  This will allow you to compensate for blade wiggle, blade bevel, human error, chip out, etc.
The old adage should go Measure twice, cut once, sand to fit.
Comment: This is just simply not true. A hand saw can be one of the most accurate tools with proper tuning and SKILL. Tenons were cut with hand saws for hundreds of years with less than 1mm accuracy. 1mm off for a tenon can be the difference between a good fitting tenon and a sloppy tenon. It is a skill that not many have these days though.
Comment: +1. You're not going to get <1mm precision with a hand saw unless you are some kind of a wizard. The better solution is to cut proud/long and use another tool to adjust the fit.
Comment: @Moshanator, not even with a finely honed block plane, then minimal hand sanding? Honestly, doesn't take anytime with a properly sharpened block plane (a few fine shavings & you're basically done). IMHO.
Comment: @Cody C: You are correct, however, not many folks can cut tenons by hand these days without some minor adjustment.  I would say even master woodworkers have to make slight adjustments from time to time. It's safer to cut long and adjust, then cut short.
Comment: hand-cut tenons and dovetails would nearly always need fine-tuning with chisels, even with an expert hand saw cut.
Comment: A good answer, but not applicable to me, since I don't have a machine for sanding. Doing it by hand is not reasonable.
Answer: I would mark the line at 350mm and cut with the edge of the saw against the line, away from the edge you measured from. That way you're not trying to keep the middle of the blade on that line, you just keep the edge on the line, and you don't need to know the width of your saws.
With a circular saw the leading edge of the cut from directly above is obscured by the saw guard anyway, so you have to watch the cut from the right hand side, which would make keeping the cut in the middle of the mark very difficult.
Comment: 3mm is likely your blade width, so the notch is showing you exactly where the blade is. Use the edges of the notch to line up, don't try to keep the cut line in the middle of the notch (which is what people tend to do).
Comment: Most power saws have marks/notches on them, so you don't have to look at the blade while cutting.
Comment: @Tester101 true, although on my saw the notches are about 3 mm wide and I can't get it straight to start with. Although that's still probably more accurate than my measuring ;-)
Answer: I always take saw blade thickness (and pencil mark thickness, for that matter) out of the equation entirely by thinking of each as having a single reference edge.
The blade, in this mental model, doesn't "take out" a blade width, it cuts an edge and leaves "slop" on the other side (doesn't matter if the blade is 1/16" wide or, in theory, 3/4" wide... what's chewed is slop and all that matters is the reference edge).  Similarly, the pencil line doesn't have a width, it's merely there to locate an edge, the other side of which is slop.
When I'm using a chop saw, for instance, I'll draw my line on the material (one edge of which is my reference), then I'll sight down the edge of the blade (accounting for the actual "bite" edge of the teeth, which are often alternated right/left slightly).  Depending on what I'm cutting, I might even take a tiny nip to be sure the blade is biting where I thought it would, then I'll commit with the full chop.
When you're marking and cutting, think about edges--not centers or widths.  Both your marking and your cutting will be much more precise.
Answer: As previously mentioned, it is best to cut so your blade chews into the left-over side of the wood.  Sometime it is awkward to do this, but some tools (like my mitre saw), include ruler lines that account for the default blade width.
Answer: i wanted to clock in and put a scenario into play.
this utilizes what others have said and puts it into a clear practical example.
conventional wisdom and practice cannot be circumvented. measure TWICE and cut ONCE  then SAND to form.
in the mathematics, we can take things a little further. but in practice this information is almost useless.
Given:
I want a 8- piece circle to be constructed out of blocks who have been cut to a repeating angle. and if these are to be glued together without touching up and shimming the edges, accuracy is necessary. each cut has to count.
so I take 1" block stock wood and use a mitre saw.
I determine the desired circumference and measure the thickness of my blade.
Lets call it a 12" diameter circle and thus a 6" radius. this results in a 37.74" circumference.
this means we need at least 37.74" of material
But!
then lets say the blade is 1/16" thick. Then we must account for half of the thickness. so for each cut we mark a line where the block ends and then one more mark that is 1/32" further away. then we must multiply 1/32" by the number of cuts which is 8.
 that results in 8/32 of margin we must have added to our wood stock length in order to accomodate the blade error.
meaning that you need atleast 37.74 ~ 38" plus 8/32 ~ 1/4":
It would be good to have 38 and 1/4" of wood for a 37.74 circumference circle under these conditions.
BUTTTTT!
if you were cutting with the precision of an accurate mitre. and lets say 360 divided into 8 pieces accounts for 45 degrees per block, because 360/8=45; then each side of each block has HALF of that. which means each cut will be made at 22.5 degrees.
BUTTTTTTTTTTTTTT!
you have to do some geometry to re-account for that error since there will be an accumulation if these are cut repeatedly and have the intention of fitting together.
the geometry is as follows:
the 22.5 degree angle is going to lose some accuracy because the blade thickness that we account for on each cut of 1/32 of an inch is, lets say 1/32" of a 1- inch side of one block-- 1/32 is roughly ~ 0.03125 or 3.125% of that side assuming 1- inch. but it is actually not 1- inch per side, the exterior and interior sides are wider and shorter respectively and have dimensions of about 4.75" Exterior and 3.75 interior respectively. under the existing condition of a 12" diameter and/ or 37.74 circumference circle.
so we take that percentage and apply it to the real inside and outside and we draw a tertiary line through the two that we've already put.
looks like: 3.125% x 4.75
and 3.125% x 3.75
it would look like 1 line, then 1 more parallel line and then 1 more slightly tangental line emitting from the short ("interior side") corner diagonally past the long side ("exterior" side).
It is tangental because 3.125% of a small number versus 3.125% of a large number has a different sloping relationship.
Then you add a fourth and final line parallel to that third line, 1/32 of an inch outside of that.
And finally, to accept and average these lines correctly, you must find the midpoint between parallel lines, and mark it with a 5th line in RED then and another 6th line in BLUE and then measure their slopes and average them and cut, you may find that the truest angle to cut at is not 22.5 but actually something like 22.6 depending on the circumstance.
sorry if the numbers are fuzzy but this is the rough idea. This helps me to think of it. but being a control freak over tiny numbers isnt going to get you the correct cut, in the end, it takes time and skill and practice. once you've found a successful means of cutting and shaping your parts, work backward and apply that method to what tools you have and reconcile it.
In the end you just have wood and a saw, so consider that you must compensate by a fraction of a degree and also compensate by a fractional distance in order to achieve the result you're looking for. blade thickness effects both.
Comment: Hello, and welcome to Stack Exchange. This is interesting, but doesn't really answer the question.
Answer: The simple rule is to always keep your saw kerf on the WASTE side of a cut.


Reason behind the creation of distortion inside space craft in 'Interstellar'

Question: How is the hand shaking significant to the main plot of the story? Why should aliens or the bulk beings create a distortion to have them a hand shake? The bulk beings were not doing anything for anybody's personal emotion. They were doing all of those in greater aspect for the whole mankind, "to save the world". After the quantum data was sent, they were done and they closed the tesseract. Why they would even think that "okay, great job. Let them have a hand shake"? There is no reason for them to create such a distortion. Is there? Then, why to put such a thing in story which has no significance in the plot but has inconsistency with physics while the entire movie team was trying to be "as accurate as possible" with the real physics?
Answer: I think you have misunderstood what happened. The handshake was in fact

Cooper, who when in that weird inter-dimensional behind-the-bookcase space, located the moment when they were traveling to the wormhole and attempted to communicate.

So, it was not the aliens (though they weren't actually aliens) at all. Given who it was that instigated the handshake, it seems to make perfect sense from the plot's perspective. You can watch the relevant scene (that explains both the handshake and the likely origin of the wormhole) here:
Comment: @VikramadityaMondal comments are not for extended discussion, that's what [chat] is for. You asked why the handshake occurred and I gave you the canon answer. That said, Cooper was using a tool specifically created to produce such distortions. I don't know how the tool works, that's not explained in the movie. We're dealing with a civilization that can create tools like the artifact in _Interstellar_, don't assume they are bound by the same limitations we are. They probably have a unified field theory that allows them to play with gravity at will.
Comment: I am told in my previous question "Mysterious space-time distortion in 'Interstellar'" that the reason was "aliens" (or actually future civilization). Please read the comments on that question and answer that why the distortion did not exert any gravitation? and how was it moving with space craft?
Comment: @VikramadityaMondal aliens!=future civilization. How do you know it exerted no gravitational pull? And why should it have a gravitational effect anyway? The whole movie is based on the premise of the existence of a technology that can manipulate gravity. Remember that gravity is used for communication, even from the very beginning. Since you know that the creators of the wormhole can manipulate gravity, why would you assume that dampening the gravitational effect of a mini-wormhole is beyond them? Anyway, that's not the question you asked here.
Comment: Cooper as a dweller of 4D space-time cannot create any space-time distortion, he can only exert the force of gravity through the tesseract as gravity can pass through any dimension. And as a human being he can not surely exert such a huge gravitational force to distort in space-time. Then it was also possible for him to create a distortion on the earth to hand shake with his daughter. So I don't really understand how Cooper could have created the distortion himself?
Comment: Ok fine. But my this question was not actually how the civilization made the tool for work. Rather my question was how this hand shake helps the plot, which I did not understand from your very short answer. please elaborate. And one more thing at first you told "So, it was not the aliens (though they weren't actually aliens) at all" and then said dampening mini wormhole will not be impossible for the "creators of the wormhole"; then actually who it was? I am really confused. please elaborate that also.
Comment: @VikramadityaMondal I'm trying to avoid spoilers. The movie's explanation for who built the wormhole is right there in the youtube clip I posted. Cooper explains it. The handshake is also explained in that scene, it had nothing to do with the creators of the wormhole. As for how it helps the plot, well it looks cool and is explained within the movie (in that scene in my answer), what more do you need?
Answer: This is explained in a lot more detail in the film's official novelisation; in short, the "handshake" was in fact caused by Coop as he was sent back through the wormhole by the 'bulk aliens' after having accomplished his main mission...

...to send the secrets of gravity manipulation to his daughter and the coordinates of NASA to his former self.

...

He wondered where Brand was, how she was doing. He wished he could
  explain to her why he'd had to leave her alone. Ahead he saw a glassy,
  golden distortion, and in it the Endurance, and for a split second he
  thought his wish had brought him to her—but then he saw that this
  Endurance was like new, undamaged, just entering the wormhole. He
  drifted through the bulkhead and saw Brand and Romilly there, both
  strapped in.
Brand, he thought, reaching toward her. In a way, he had gotten his
  wish. Could he communicate with her? Probably not, or at least nothing
  important, since this was the past, and she hadn't known that any of
  this was going to happen.
To his surprise, she saw him. She reached her hand up to his, and he
  realized there was something he could communicate. Something that
  maybe was important. So he reached back, hoping to feel the warmth of
  her hand, give it an affectionate squeeze. But when their fingers came
  together they mingled, distorting each other but not really touching.
  A quiet moment in the chaos.

There's no specific indication that the handshake was intended or desired by the aliens.  The likelihood seems to be that it was merely an unintended artifact of the wormhole's function as a (time-travel capable) travel conduit.

You can see this same scene played out in the film itself

And in the scene's description in the final draft screenplay

Cooper FLIES through the EXPANDING COSMOS, past PLANETS ORBITING
  STARS, WHICH BECOME ATOMIC PARTICLES, WHICH BECOME MATTER, BECOMING
  STARS ...
Cooper APPROACHES A GLASSY TUBE. Inside is the OLD, UNDAMAGED
  ENDURANCE. As Cooper looks in from the bulk he sees: Brand, strapped
  in, Doyle opposite, traversing the wormhole for the first time ...
Cooper REACHES for Brand ... She sees something, reaches up
  - their hands would touch if they weren't in different dimensions, her fingers distorting the space of his fingers
-
WHAM! She, and the Endurance, are SWEPT PAST - Cooper is SMASHED into
  the spacetime of the wormhole - he SCREAMS AND
  WE -


how to implement login functionality on cd site by using custom sql database?

Question: We have common user database table for different applications. So we need to implement login functionality only on CD site using external common sql db and for CMS we are using default sitecore user membership. So can one please guide me how it can be implemented in sitecore?
Answer: As you mentioned that you're using a custom SQL database for User database, you can implement the Login/Registration backend functionalities similar to a plain .NET application. You can create (if not available) tables like User, UserRole etc. to maintain User information (such as User First Name, Last Name, Password etc.) and you need to implement your own Login/Registration Controller to handle the Registration/Login flow on your CD website.
In terms of Sitecore, you can take advantage of keeping and managing content for your Registration & Login screens in CMS (e.g. Field name, Field type, header, body, validation messages, button text etc. - similar to WFFM module). This gives you benefit of utilizing Sitecore platform and can be further extended to use even out-of-the-box Personalization - if you follow the component based approach while displaying these Login/Registration screens). We use this approach & architecture in many of our projects and it works as expected. Note: If you're using latest Sitecore version (>= 9.0), you may also consider using Sitecore Forms for Login/Registration forms with customized Submit button action.
Future Use-case: Based on my experience with this approach, if you really want to utilize both Sitecore XP & XM powers (which we should ideally), you should also keep in mind extending it and keeping a contact in xDB as well (a xDB contact should not be complete duplicate of User record but only what is required). You may need to write Subscribers, background jobs to keep this xDB contact in sync with User record whenever there's update occurs on User data. You may use this xDB known Contact further for any of your XM need (EXM, Personalization, Marketing Automation etc.)
Hope it helps!


Write formula in html

Question: How to write formula in html page?
For example I need to write square root of x power 2 minus y. I know only one way, LaTex. But I need easier way. I'm writing quiz testing system. Students should write answer, that contains formula. How could I do this?
Answer: Check out MathJax, which is used on math.stackexchange.com.
Comment: Combined with AsciiMath Input it seems to cover pretty much everything -> http://math.chapman.edu/~jipsen/mathml/asciimathjax.html
Answer: The only two answers I know of for that are using images:
http://www.cs.tut.fi/~jkorpela/math/
...or using HTML math notation for that (although it is not that simple to use)
http://www.unics.uni-hannover.de/nhtcapri/mathematics.html
You also have this alternative, but it seems rather experimental...
http://www.w3.org/MarkUp/HTMLPlus/htmlplus_45.html
http://meta.wikimedia.org/wiki/Help:Displaying_a_formula
Still, I hope it helps...
Answer: This is a utility to write math (using LaTeX syntax) in HTML, but you also need to have LaTeX installed on your machine to generate the images of the formulas.
Comment: Links is not available anymore. Please tell me the name of technology.
Answer: If you do not need to render the answer, just make it is correct, then  the best way to go is probably to allow them to use something like sqrt(), ^ for power, etc..
I find this is the easiest way of writing if the input is for a machine.
You could just provide a small list of allowed functions with examples.
The bonus here would be that you can probably look around for a lib and use it to evaluate the answer.
So your example would be written like: sqrt(x^2)-y
Of course this can get very messy if you need to write complex equations but for the level you presented it should work fine.

Write formula in html


How to deal with Hunters as a Paladin?

Question: My paladin deck is having a bit of trouble against Hunter Zoo as they almost always run  Unleash the Hounds, which limits my hero ability's usefulness since I like to spam 1/1 minions on my side.  They are also quite adept at stripping divine shields with explosive traps and tiny minions.  What are some strategies I can use to counter hunter decks.  The only reliable board clear I have is consecrate and its not guarenteed I'll have one on hand when I need it.
Comment: have you tried using equality and wild pyromancers in your deck?
pyro+quality is one of the best clears ingame, while you can clear unleash the hounds boards with pyromancers + holy light.

also do you use argus?
Comment: @Werdli that clears my side too though, and usually by my turn after unleash the hounds the damage has been done. regarding Argus, I use sejins instead since its hard to have a good target(much less 2) on the board by turn 4 for it to buff.
Comment: what 2/3/4 drops do you use? could you maybe screenshot your deck?
Comment: @Werdli I'm at work, but I'll ss my deck once I get home. My 2 drops are argent protector, ooze, faerie dragon. 3 drops are acolyte of pain blood knight. 4 drops, too many to list. sejin, spellbreaker, truesilver, chillwind, blessing of kings, etc etc.
Comment: Post your deck here and we can help you out with it.
Answer: In a deck built around flooding the board with minions, I've noticed Hunters tend to be by far the largest issue, because in addition to having access to easy and cheap board clear, they also have unleash the hounds, one of the most insane 2 drops in the game. I personally have two decks, paladin and shaman, that are built around having a large number of small minions on the field.
Firstly a word of advice based on your commented deck list. If your do really enjoy flooding the board using your power, I would highly recommend you consider cutting down some on your four drops and increasing your number of three drops and maybe even two drops. The advantage of this is that, it makes you more likely to be able to use all your mana in a turn for maximum efficiency. For Instance:

Turn 2: Use Power or play relevant 2 drop, depending on board state and opponent power.
Turn 3: Play 3 drop
Turn 4: Use Power and play relevant 2 drop, OR play 4 drop.
Turn 5: Use Power and play relevant 3 drop.

Alright, regarding your specific issues against hunters, one of the best counters to unleash the hounds is high toughness taunt creatures, or having a number of taunt creatures. The big issue is that most hunter decks will be running 2 silence owls, so oftentimes they'll simply silence your large taunt creature, and then attack past it. Some possibilities to fill this role include:

Sen'jin Shieldmasta: Hands down one of the best taunt minions in the game, Sen'jin can usually eat up anywhere from 3-5 hounds from unleash the hounds, depending on how much support your opponent has for the unleash. In addition, Sen'jin is relevant against a large number of other decks unlike some other large taunt creatures. I would definitely consider running 2 of these if you tend to have issues against aggro decks. The big downside of him against hunter decks, as is the case with most bigger creatures, is he dies to a kill command.
Tirion Fordring: A very powerful legendary creature, if you have him, I would highly recommend running him, as he's hard to kill and still impactful upon dying. The big issue with him is that he is one of the biggest blowouts if he's silenced, just becoming a measly 6/6 for 8 if he is.
Abomination: Abomination is, in my opinion, a very underrated minion. He is amazing against Unleash the Hounds specifically, almost always clearing all the hounds on his own, in addition to any potential support your opponent might play, such as timber wolf and starving buzzard. The big downside of him for you is that he basically acts like an exploding trap, most likely killing all your token minions.
Defender of Argus: Defender of Argus is an amazing creature, especially for a paladin, who is easily capable of making sure he has the creatures to use it with. The big downside of him in this case is that if your opponent has Timber Wolf, their hounds will just trade for your 2/2 soldiers. I would still recommend at least running one of him in your deck, if not two, because there are many times that he is relevant.
Sunwalker: One of the hardest to straight out kill taunt creatures, sunwalker can be very impactful upon the board. The big downside of him is that he's highly susceptible to silencing, and is somewhat high costing, especially if he gets silenced.
Fen Creeper: Generally considered to just be a worse version of Sen'jin, he is still not a bad consideration to put in to the deck if you're having that much difficulty against hunters. The benefit that Fen Creeper has over Sen'jin is that he won't die to a single kill command, taking both a kill command and a hound to kill, and still eating up between 3 and 6 hounds if they don't have kill command.
Sunfury Protector: A tiny version of Defender of Argus, I would be hesitant to run this in your deck, since you're most likely going to have only small minions to use her with. Still, her ability can be very relevant, as she'll force your opponent to clear two of your minions before they can attack you.
Mogu'shan Warden: As a last ditch effort, if Unleash the Hounds is absolutely the bane of your deck, I would run Mogu'shan. He is often very irrelevant against opponents, but against Unleash the Hounds specifically, he is one of the best minions out there. Again though, he's not very good against most other decks.

Worrying about clearing the board of an unleash the hounds after their turn is less of a big deal, as you should probably be saving your consecrations for just such an occasion if possible. If that is a concern though, you can also add Avenging Wrath to your deck, as it's an excellent board clear against Unleash the Hounds, and in general, is just a rather good spell, at worst being 8 damage to the opposing hero for 6 mana.
Regarding the other aspects of the hunter, having big taunt creatures also helps to avoid your creatures' divine shields from being removed, by protecting the smaller divine shielded minions. In addition, divine shielding a Sen'jin Shieldmaster or Abomination can be pretty powerful.
In respect to the explosive trap, unfortunately, there's not many counters to it in a paladin deck besides playing around it, or using divine shields. If you're truly worried about it, consider doing little other than using your power until your opponent uses their first explosive trap. If you bait out an explosive trap, you can much more confidently attempt to establish board control by playing a number of cards from your hand after it explodes. Divine shields though do suffer from the issue of being easy to trade a small minion in to remove it. It is why I would probably not run Hand of Protection, but would definitely still run Argent Protector, as a 2/2 with 'Give a friendly minion divine shield' is pretty good.
Comment: oh I have more than just the 2/3 drops I listed, those were just what I recall at the time.  I will tweak my deck a bit with your advice and play a few hands when I get home.
Comment: @z- Honestly, the things that make unleash the hounds so powerful is cards like scavenging hyena and starving buzzard played before hand in the same, which there really is no counter in paladin decks, due to the paladin's secrets being unable to kill creatures that aren't attacking. And still, if you have that many 4 drops, I would consider taking out some if possible.
Comment: here's my deck after some modifications, seems to work better.  I might still not have enough taunts: http://imgur.com/yWWp3rN
Comment: @z- Personally, I would recommend taking out 'Stampeding Kodo', 'Humility', and 'Holy Light', potentially in favor of the other cards I recommended. Stampeding Kodo is only good situationally, and is rather pricey for it's effect. Humility is useless a large amount of the time, especially when you're already running 2 Equalitys. If you still want a low drop in it's place, consider running Ironbeak Owl or another Acidic Swamp Ooze. Holy Light is usually considered not very good, as most pure healing spells tend to be, except as a  Priest. It has absolutely zero potential for card advantage.
Comment: @z- Imo, an excellent similar replacement for Stampeding Kodo would be another Avenging Wrath if you have one, as most minions with 2 or less attack will die to it. If you don't have one, other considerations are Noble Sacrifice and another Hammer of Wrath. Hammer of Wrath for obvious reasons, and Noble Sacrifice because it's a secret that's not bad to play even starting turn 1. Downside is your opponent will likely know exactly what the secret is and play around it. Although, that can sometimes be a good thing.
Comment: @z- In addition, I would consider adding your deck list to your original question still, in case some one has better ideas than I.
Comment: I'd also consider removing Humility; it's a dead card against most hunter creatures and you have Peacekeepers and spellbreakers for hyenas. Playing my hunter the most annoying thing is one or two minions on the board; don't play more than that if you can help it. High-efficiency minions are the way to go. Maybe some Ogres, Yetis, and a Defender of Argus would help. If you really like summoning bumpkins, I'd run Light's Justice.
Comment: @bombcar Why the light's justice if you don't mind me asking?
Comment: Oops not a light's justice; that's the worst weapon in the game. I meant a sword of justice. Play it turn 3 against his turn 4 release, and you've nothing much on the board and start producing 2/2s the next turn.
Comment: I'd rather not post my deck up there so the question doesn't become too specific for just me.  Anyway, here's my updated deck: http://i.stack.imgur.com/Enj2N.png  I don't have 2 of most of those rares you mentioned.  I'm doing a bit better vs hunter zoo now, about 50/50 win rate, but I still take quite a bit of early game damage and I have a tough time keeping taunts down on the board late game via silences, kill commands, and hunter's marks.  I'm thinking of throwing in 2 sunfury protectors for 1 ooze 1 argent, what do you think?

How to deal with Hunters as a Paladin?


MariaDB vs Postgres (POSTGIS) perfomance difference?

Question: Has anyone used mariaDB for storing spatial data?
I am using postgis now.
My queries are mostly "finding peope within certain radius".
Happn app an app which shows you "the people you crossed path with in real life"  seems to be using MariaDB in their stack.Should I move to MariaDB for perfomance?
Comment: In theory the most reliable test is to try both PostGIS and MariaDB with your own data, hardware, and queries. Unfortunately the test is useless if you do not know how to use the both databases in a right way. But your usage seems to be mostly ST_DWithin that is to large extent a direct search from spatial index followed by some filtering and it should not require any tuning.
Answer: MariaDB/MySQL have about 160 spatial operators:
https://mariadb.com/kb/en/mysqlmariadb-spatial-support-matrix/
Whereas PostGIS adds about 600 to PostgreSQL:
https://postgis.net/docs/PostGIS_Special_Functions_Index.html
PostgreSQL/PostGIS is extremely feature complete from a spatial perspective, so it allows you to do a lot. But PostgreSQL is also a very large enterprise level database engine.
MySQL/MariaDB are much more lean, more simple and lightweight.
As for performance, I imagine if the function can be done with both, the speed will be pretty comparable.
If you are already using MariaDB and just need a few spatial operators, no point switching over the PostgreSQL. But if you are doing full GIS operations in the database, PostgreSQL/PostGIS is the best choice.
Comment: Question was about the opposite, moving from PostGIS into MariaDB. That is rather uncommon. If PostGIS (ST_DWithin) feels slow I would first study if something is done in a suboptimal way. In this case if the table is huge clustered index might help https://postgis.net/docs/performance_tips.html.


I saddle-soaped my leather cowboy boots, and now instead of being a darker brown one of them is tan. How do I fix this?

Question:
The right one is what they are both supposed to look like. I treated both boots the same, and one turned lighter in color while one stayed almost exactly the same.
Comment: This is important information to answer your question and you should [edit] your question so people can see it at once without having to read the comments.
Comment: Just to be clear: did you treat both boots the same or just one of them? If you treated both, did one actually darken? Did the other one become lighter in color or just not as dark as the other one?
Comment: I did treat both of the boots the same. One didn't darken a whole lot but it did darken a little bit. The other one became lighter in color, the darker one is almost the same color as how I got it from the store. @Elmy
Comment: I'm speculating here, but as these are genuine leather it's possible the two pieces of leather started off as somewhat different colors, and wear and cleaning has revealed this through the removal of some applied pigment/dye.
Answer: I never had cowboy boots. But I wore (and still wear) leather shoes, and wore leather jackets. Eventually, some of them got damaged, due to wear usually, especially the jackets.
I applied the following procedure every time, and every time I was extremely satisfied with the results.

Clean the dirt / dust / whatever from the area. I used some wet cloth, eventually with a bit of normal soap (soap only if I was not satisfied with the cleaning).
Wait for the area to dry completely.
Rub the area with some alcohol, to remove eventual grease.
Apply some coloring agent, suitable for leather. For me, shoe polish worked like a charm every time. You may need to be creative, if you really want a special shade. Apply it with a shoe brush. Remove the excess and polish, using the polishing shoe brush. Repeat until satisfied.
Let it "rest" for maybe 1-2 days - if you think it is needed.
Remove all excess of shoe polish.
Apply a grease for leather. I was always satisfied with what I call "paraffin oil" - it was cheap and available for purchase at pharmacies. Remove excess.
Let it rest for at least 1 day to understand the results. If needed, repeat 7.
Carefully remove any excess of grease. You do not want all your clothes oiled.
Happily wear your new old boots.

Note: For the "painting" part: I fixed some shoes, and the shoe cream was a totally different shade of brown. To make things worse, the leather was not suede, but still strongly absorbent. For the moment I thought I ruined the shoes, until I decided that the new color was not bad, but only the difference of colors.
Since I was in a hurry, I used different shoes. Later, I applied enough shoe creme on both shoes, until they looked OK again. I was happy afterwards wearing them.

I plan to apply the same treatment to my car's steering wheel (covered with natural leather).
Answer: Isn't saddle "soap" primarily meant to clean leather? Regardless, there are many different formulas sold as such. Maybe the kind that you used cleaned off the dirt or even the dye in the polish.
Neatsfoot oil darkens everything leather that I have ever used it on.


Maxwell-Boltzmann Statistics is equivalent to a uniform distribution among acessible states?

Question: Both Fermi-Dirac and Bose-Einstein statistics reduce to the Maxwell-Boltzmann statistics in the classical limit of very high temperatures or very low concentration. In the case of very high temperatures, I suppose that the particles should be distributed uniformly among it's accessible states, so is Maxwell-Boltzmann distribution a uniform distribution?
Comment: I'm supposing you don't mean "uniform" in the sense of $P(x,a,b)=1/(b-a)$ sense of the PDF?
Comment: That was my confusion at start: uniform in the sense of having equal number of particles in each state.
Answer: The Maxwell-Boltzmann distribution at high temperatures is a uniform distribution. Each energy level with energy $E_i$ comes with a weight (neglecting normalization) $e^{-E_i/k_B T}$. If $T$ is very large, we can expand this in orders of $1/T$. The leading term, as with any exponential, is just $1$. Of course, you can do this expansion for any temperature, but it only makes sense to focus on the first term at large $T$.


How to customize the quick settings drop-down menu in android 4.2?

Question: As of title, is there any way to customize the quick settings grid available in Android 4.2 ? This feature has potential, but in most cases it does not take advantage of the screen size.
Answer: Currently I can only find customization options through mods or other updates to the ROM. For example: http://forum.xda-developers.com/showthread.php?t=1999125
It would really be great if stock Android 4.2 would provide functionality to add tiles, re-order tiles or change the function of long/short taps on tiles. This issue has some of those feature enhancement requests: http://code.google.com/p/android/issues/detail?id=40285
Comment: Basically meaning no you can not customize it through stock Android itself.
Answer: This can be done in Android 4.1.2 especially in Samsung Galaxy Note 2. Settings-> Display-> Notification Panel. Then drag and adjust required combinations.
Comment: I believe this is a Samsung only feature, it's not available on stock Android.
Answer: If there's still anyone interested in getting the answer, the best I know is by using Notification Toggle by j4velin. It can be customized to display toggles(Wi-Fi, Bluetooth, etc) or to launch apps.
Comment: Looks like a useful app! But it also looks like it just adds a notification with its own buttons rather than customizing the system quick settings menu. Is that right?
Answer: My stock Android 4.2 and 4.4 devices doesn't allow Quick Settings customization. To customize it, I had to settle with Gravitybox [JB] which needs Xposed Framework and root access.
My initial stock Quick Settings were more or less similar to the one you posted. After my favorite tweaks it looks like (see an app's icon too):

The usage is simple. You install, activate, launch this app → Statusbar tweaks → QuickSettings management and do the tweaks as per your needs.
And don't worry regarding it's description related to Mediatek devices only. It works on Qualcomm ones as well.


What is the advantage of changing from 7 tax brackets to 3?

Question: The US administration seems to be suggesting that that the personal income tax code would be "better" with three tax brackets rather than the current seven. So what are the advantages?
Answer: I don't think the breakpoints for the new brackets have been released yet, but given that the standard deduction is being doubled and that the current highest bracket of 39.6% is being eliminated, the effect is probably a tax cut.  This in line with the other policies listed like eliminating the estate tax or the 15% corporate rate proposed.  But since your question seemed to be about tax brackets in the first place, and why 3 brackets would hypothetical be better, I'll talk about that instead.
This lists the current brackets and their rates.  So for example, if someone earns $20,000 they would be taxed at 0.1($9,325)+0.15($10,675)=$2533.75 (ignoring any possible deductions).  This means that the leading portions of income are taxed at a lower rate that the trailing portions of income.  The theory behind tax brackets, in which different portions of income are taxed at different rates is based on the idea of money having marginal utility.  That is to say, the more money that an individual accumulates, the less value an additional unit of money will have to that individual.  This is intuitively obvious when looking at any number of examples; a billionaire gaining another million dollars would not experience an appreciable change in his or her life, while $1000 might make a huge difference to someone in poverty.  If you accept the marginal utility of money as a premise, then tax brackets are obviously a good thing so long as the value of governmental goods and services exceed the value of the money being taxed.  In that case, even having something like a logarithmic tax curve would be better since it could track marginal utility more closely.
Having 3 brackets instead of 7 would make any attempted tracking of marginal utility harder.  More brackets that apply to all income (including capital gains), would be better than less.  Given how the Trump plan has been presented so far, its probably just a tax cut under the guise of making things "simpler".  The reduction of number of brackets wouldn't even do that though since the calculation of personal taxes is pretty much all about deductions, which aren't even complicated for the vast majority of people.
Comment: Agree that tax brackets aren't the reason tax preparation is complicated. What I fear is that the average citizen hears "reduction in number of tax brackets" , focuses on the word reduction and concludes that the number of tax brackets will lower his tax burden.
Comment: @Brythan The subject question relates only to Federal Income Tax, SS tax and Medicare Tax are outside the scope of the original question on reducing the number of brackets.
Comment: If someone earns $20,000 after deductions of $10,000, their employer (since employers actually withhold taxes) would actually pay $7123.75 in tax (assuming your calculations are correct), as the employer would pay $3720 in Social Security tax plus $870 in Medicare tax in addition to the income tax withholding.
Comment: It was an example meant to removed all extraneous variables so I can explain tax brackets since most people have no idea what they are at all (hence the assumption of only income taxes, no deductions and selecting a simple number only crossing two different rates).  Taxes are complicated, I'm just saying that tax brackets aren't why they are complicated.
Answer:
It's easier to say what the tax rates are:  12, 25, 35.  Can you tell me what they are now?  I had to look (because I only remembered six):

 10, 15, 25, 28, 33, 35, 39.6

Perhaps that's a trivial advantage, but it feeds into the next advantage.
It makes it easier to predict what your marginal tax rate is before you'll make it.  Because along with the fewer rates, there are fewer points where the rate switches.  Remembering where they switch is even more difficult than remembering the rates, as it looks more random and changes annually.
Of course, predicting your rate only matters in budgeting and planning, when you can't just fill out the forms and calculate your actual tax.  You need to understand how the rates work to make the budget.  For small decisions, this isn't a big deal.  Your next $100 will likely have just one marginal rate.  For bigger decisions, this matters more.
For example, you might be choosing between working on Wall Street in a high stress, high pay job or working in the rural or suburban South at a much more moderate pay and lower stress.  That decision could cross multiple tax brackets, say from 39.6% down to 15%.  Of course, most people don't make such extreme changes, so it will be of limited use.
In particular, it avoids the current idiocy of a tax rate that applies only to people in the range $416,700 to $418,400 (single filer; same source).  So there are three different tax rates in an income range covering just $1700.  Why bother?
It's $78.20 less than starting the next bracket early or $34 more than keeping the previous bracket.  Extending the 33% bracket by $1100 (-$22) and starting the 39.6% bracket $600 early (+$27.60) would roughly even out.  An extra $5.60 from each of the people above that range.  Everyone more than $120 below $418,280 and above $417,700 would pay less.  The government would come out slightly ahead without making anyone more than $5.60 worse off.
More brackets means more ways to make mistakes and more difficult to see the mistakes.
In order to calculate tax, you either need to do a bunch of multiplications to get the tax for each bracket, or you use a bracket table where the multiplications were already done for you.  If you use a bracket table, then it is not that hard to copy the number wrong with seven rates.  Your rate will be somewhere in the middle.  Do you grab the fifth number?  Or the fourth?  Or was it the sixth?  Make a mistake, and the IRS can charge you interest and penalties when they get around to noticing it.
With three brackets, that's much more difficult.  If you're in the last bracket, that's easy to see.  Or if you're in the first bracket.  If you're in the second bracket, then you know you aren't first or last.  It's harder to make a mistake, because the numbers will be more distinct, e.g. from something like $0 to $15,000 to $80,000.  If you use the wrong number, it will look wrong immediately.
Comment: Tax payments for the vast majority of people being paid a wage as their primary or only income is already known by the IRS.  Pretty sure your 1040 doesn't care whether there are 7 or 3 brackets, it doesn't make things simpler for most people because refunds are from deductions.
Comment: @not store bought dirt - or you can look it up - no calculations needed until your line 43 exceeds $100,000 then you have to do 1 multiplication and one subtraction - easy peezy.
Comment: @Algid It removes terms from your simple tax calculation: Instead of (a * x) + (b * y) + (c * z) + (d * w) + (e * v) + (f * u) + (g * t) you will have (a * x) + (c * z) + (f * u). It is certainly a simplification. Whether it is enough of a simplification to be worth bothering with, or whether this is the best place to make a simplification is opinion.
Comment: @BobE  No.  My point is that if the next $100 is taxed at 15%, then you're really only getting paid $85.  If it's taxed at 35%, you're only getting paid $65.  If it costs $75 in extra childcare costs to work, that makes the difference between making money or losing money.  Even without the childcare, someone who would work for $85, might not for $65.  I am explicitly not claiming that there is any transition that would cause someone to lose money in the modern tax code (there still are in welfare programs but that has nothing to do with income tax brackets).
Comment: I'm saying that it makes it easier to know what your tax will be before you earn the money, not that it will be easier to fill out tax forms.
Comment: @Brythan Not understanding your point of knowing 'your tax before you earn'.  I've heard coworkers refuse overtime that would add another $100 to their gross because it would push them into the "next tax bracket". The impression that they have is that the next tax bracket is something to be avoided because their tax burden suddenly shifts. Is this (part) of your argument?
Comment: @Brythan - let's use your example where the next $100 transitions the worker from 10% to 15% bracket.  In the previous $100 increment the worker is "only getting paid"  $90. In the next $100 increment he is only getting paid $85, So his net change for having worked for an additional $100 is only $5..... having said that, yes, I agree that workers need to be mindful that their post-tax earnings cover the costs (childcare, transportation etc, etc) incurred to enable to earn additional income.
Comment: @not store bought dirt - regardless of how many brackets or what the taxpayers taxable income is, there are the only three of operations to calculate tax: 1 subtraction, 1 multiplication and 1 addition.  I don't understand why you are saying that it (potentially) takes 7 multiplications and 6 addition operations.  can you explain?
Comment: I'm still not getting how that's supposed to help.  Are you saying that with a coarser grading of brackets, people can decide to work less hard or something?  I'm not seeing how a finer grading is a bad thing, you might not know what you're taxed at, but the effective rate on your total income being stable across small changes in income means it doesn't really matter when it comes to personal decision making.
Comment: @BobE There are lots of cases where knowing how your money will be taxed can help. One that most people will experience is deciding whether they should save for retirement in pre-tax or post-tax (traditional or Roth).


How to use the eclipse for creating servlets

Question: Usally i create the servlet class in the notepad and compile it using javac tool and then put the .class file in the classes directory inside WEB-INF folder.
and then create the war file of my web application and deployed it in the web logic server.
Now i want to deploy my web application inside eclipse. i have also read some of the similiar links How to run servlets in eclipse.
But i have created a servlet class in the src directory in eclipse and also mapped my  the web.xml file in the WEB-INF folder. but i did not see any .class file in the classes folder when i run my application in the eclipse . please help me how to run the servlet using eclipse?
May you please guide me with steps to run the servlet code in eclipse?
Answer: You have to define a server - Window > Show View > Servers. There is a wizard for defining a new server. Once you define a server you right click on it and you add the project to the server - then right click on the project and Run as > Run on server. Comment for details


How do you read/write to the handle returned by hci_le_create_conn?

Question: Using BlueZ-5.43, Nordic nRF52832 and Raspberry Pi Raspbian.
I can create an l2cap socket and perform service discovery and attribute read and write operations on characteristics. However, this solution by-passes creating a connection via the HCI and subsequently uses defaults for parameters such as supervision timeout and slave latency.
Going through hci.c using hci_le_create_conn allows me to override these defaults, but I get a handle number 64 with no obvious means to use this handle for service discovery or characteristic interaction. The utility lsof does not indicate an open file with the new connection as it does when I open an l2cap socket directly.
How do you read/write to the handle returned by hci_le_create_conn?
Answer: The solution is to use ACL packets.


Magsafe 87w detected as 94w

Question: I bought a 87W MagSafe charger for my 15-inch 2018 MacBook Pro from online marketplace (I'm not sure if it's genuine; the seller mentioned it's OEM). However, upon testing, the AC Charger Information in the system report indicates a wattage of 94W. Is it safe for my MacBook Pro and its battery if I use this charger regularly?
Comment: The rated wattage is a maximum; it does not 'push' that much energy into your laptop at all times. The laptop draws the power that it needs. It should have the Apple logo recessed into it, if it's genuine.
Comment: As Allan says: it's likely the seller just got the wrong description. Is there perhaps a model number somewhere that you could check?
Comment: @benwiggy thanks for comment, but in my case, the wattage exceeds the maximum stated wattage. Is it normal?
Comment: @benwiggy  '87w' is printed on the body of the MagSafe btw, so the seller didn't misdescribe the product. It doesn't display a serial number when using system_profiler so I think it's not genuine. The seller said this MagSafe is an OEM product supposedly made by the same factory that produces MagSafe in China, but it's sold without going through Apple's distribution. So, is it still safe to continue using this magsafe?
Comment: Factories in China are well known for 'running-on' -- so if Apple order 1 million units, they actually produce 200,000 more, which they sell themselves. It's illegal, of course. But you don't know whether these have been through the same Quality Control (or if they passed it). It could be identical to an Apple unit; it could not.
Answer:
I bought a 87W MagSafe charger for my 15-inch 2018 MacBook Pro… a wattage of 94W. Is it safe for my MacBook Pro and its battery if I use this charger regularly?

First, it's always safe to use a charger with a higher wattage rating.  The device draws the power from the charger, it's not pushed into the device.  The wattage rating is the maximum amount of power it can supply.
Now, while it's safe to use a charger with a higher wattage rating that what's required, you always want to use quality chargers from brands you know and trust or ideally, direct from the manufacturer (Apple).
Check that your Charger is Genuine
Using System Report
Go to  → About this Mac → More Info → System Report.  Once it's generated (should only take a second or two at most), go down to Power section and you should see the AC Charger Information section.
If the item is genuine, it will say that it was manufactured by Apple and have a SN# that can be verified.

Using Terminal
You can obtain the same info provided by System Report by using the system_profiler command.
system_profiler SPPowerDataType | awk '/AC Charger/,/Power Events/ { print }'

This command will extract the following block from the output.
AC Charger Information:

  Connected: Yes
  ID: 0x701c
  Wattage (W): 68
  Family: 0xe000400a
  Serial Number: ******************
  Name: 70W USB-C Power Adapter
  Manufacturer: Apple Inc.
  Hardware Version: 1.0
  Firmware Version: 1030030
  Charging: Yes

Secondly, it sounds like the seller sent you a higher rated charger (by mistake) provided it's not counterfeit. Given that there's no 94W charger, but there is a 96W and the chargers designed to work with your particular Mac are USB-C based meaning power delivery is negotiated,  it's most likely only drawing 94W From the charger at that moment.
In my example here, I purchased the 70W charger and I am currently drawing 68W.  This is perfectly normal.
Comment: Thanks for the answer Allan. It seems that the MagSafe is indeed not genuine. It doesn't display a serial number when using system_profiler. '87w' is printed on the body of the MagSafe btw, so the seller didn't misdescribe the product. When I contacted the seller, they said this MagSafe is an OEM product supposedly made by the same factory that produces MagSafe in China, but it's sold without going through Apple's distribution that's why it's cheaper. So, is it still safe to use this MagSafe?
Comment: I wouldn't use it.  What they are doing is illegal and Apple can have customs easily block this because it's blatant IP theft.  This is counterfeit and I wouldn't attach my expensive MacBook to this. Always spend the few extra dollars to get from a known good brand like Anker or buy genuine.
Comment: Also, I wrote [an answer](https://apple.stackexchange.com/a/337452/119271) about the charger and one thing to note is that the power adapter is *optically* isolated.  The DC  (computer) side is not connected whatsoever from the mains side.  Cheap power adapters don't do this.
Comment: Thanks Allan!

Magsafe 87w detected as 94w


Bind  in Vim

Question: Is it possible to map  to save in vim in a standard terminal? I know how to set it in my vimrc but am not sure if it is possible to pass it from terminal to vim instead of attempting to save the terminal.
Comment: Would [MacVim](http://code.google.com/p/macvim/) be an option ? It uses cmd+s for saving. And you can start it from terminal with `mvim`.
Comment: I am using vim with tmux so macvim wouldn't work.
Answer: Yes you should be able to set up a key mapping in your .vimrc file so that when you press command - S it maps to :w  Also here is something else to go on that you can modify as well Map Ctrl-S to save current or new files

First thing is to reassign the the Command - S functionality for the Application. Do this in the Keyboard > Keyboard Shortcuts System Preference Pane.

For example, you will want to add in a new Application Short cut for the Terminal app, then map to the Menu title "Export Text As..." to another keyboard command something that you don't use, e.g. control - s or etc. should be fine.

Next stop mac terminal from trying to interpret Cmd-s by ... (still working on this I asked a separate question for a solution Allow the Terminal.app to pass command key  based keystrokes to terminal programs )
Set up the mapping in the .vimrc file to map the command or meta and s  keys to the :write function.

Something such as this noted below* you can add to you .vimrc:
:map <M-s> :w<kEnter>  "Works in normal mode, must press Esc first"
:imap <M-s> <Esc>:w<kEnter>i "Works in insert mode, saves and puts back in insert mode"

*This was verified working on the X11 terminal on OS X Lion.
Comment: Thanks, will keep an eye on that thread to see if there is a way to get cmd-s passed to the app.
Answer: For people still coming across this, I've written up an inverse of MrDaniel's solution (that is, mapping any MacVim / system-wide ⌘-sequence to command-line vim), and posted it to his other question. It's more complex than his solution, but then allows you to (with some effort) remap any ⌘-sequence into any command-line program.
It works well for me, and I hope it can help you too. <3

Bind  in Vim


what's the meaning of "to be in a pretty trim"?

Question: The sentence is in a letter by Thomas Jefferson, where he describes the agonies of love. I don't understand the meaning: is he fine or not?
Comment: Can you post the entire sentence, please?
Answer: Context is everything here. Usually, "in a pretty trim" would mean in a good condition, well-balanced, a boat that's all ready for sailing; but in this case, it means just the opposite. The surrounding lines are:

Seated by my fire side, solitary and sad, the following dialogue took place between my Head and my Heart.
Head. Well, friend, you seem to be in a pretty trim.
Heart. I am indeed the most wretched of all earthly beings. Overwhelmed with grief, every fibre of my frame distended beyond it's natural powers to bear, I would willingly meet whatever catastrophe should leave me no more to feel or to fear.

The Heart's reply shows us exactly what the Head meant  - that the Heart is in an awful condition. You could think of "you're in a pretty trim" in this case as being equivalent to "you're in quite the state".
Comment: @FumbleFingers - yes, we can say satirically 'this is a pretty kettle of fish' about a notably  muddled or awkward state of affairs.
Comment: More so a few centuries ago, perhaps, but ***pretty***, like ***fine,*** is still closely associated with satirical negative assessments. *This is a fine state of affairs - we're in a pretty pickle now!*
Answer: Without the full context of Jefferson's letter being in "pretty (or good or fine) trim" usually means being clean, well maintained and / or smart. It is mostly applied to vehicles in good condition. For example ships, cars, trains and aircraft. Often use by used car salesmen to describe their wares.


How will two raters score videos?

Question: I have 260 teacher conferences to score using a rubric. How do two raters need to score these for rater agreement? Do we need three raters?
Answer: The use of a rubric is there to try to control for inter-rater variability. You can further decrease inter-rater variability by 'training' the raters (e.g. show all the raters the same video and tell them what they should score the video). Of course, in terms of getting a more precise estimate of the true rating, the more raters the better
Answer: With 2 raters only you have no way of knowing which rater is more accurate. With 3 raters or more you can use factor analysis to account for raters precision.
Comment: He could't know which is more accurate, but he could still measure their concordance to some extent, could he not?

How will two raters score videos?


How to seperate info fired from multiple instances of same component in a parent component?

Question: Can we dynamically add a component  multiple times and still retrieve information fired by these similar components uniquely in the parent component? I need to create a filter that shows fields, operator and value to be selected by the user. I will be creating a component for just a row of this kind and user can add / remove multiple filters. Can I collect data from these components uniquely when all these components will be firing the same event?
Answer: For a filtering mechanism, you probably want to apply all the filters, so you'll likely want to read all of them anyways. In addition, you'll probably want to bind the filter data to an attribute anyways. As such, your design would probably look like this:
<aura:attribute name="filters" type="Object[]" default="[]" />

<aura:iteration items="{!v.filters}" var="filter">
  <c:filterRow value="{!filter}" onupdate="{!c.applyFilters}" />
</aura:iteration>

({
  applyFilters: function(component, event, helper) {
    var filters = component.get("v.filters");
    // process filter information
  }
})

This isn't the only way to do this, but it's probably the easiest. Using component.find will only complicate your logic slightly, and other methods are probably less intuitive than this.
Comment: Hi @sfdcfox, I dont have any items to show in the iteration cmp! The user will be adding / removing the filters as he pleases. This is similar to creating a list view (adding fields in the list view filter). Do you mean that on click of "add" I should add a row of the new component in the list?
Comment: @AdityaSagam Yes, that would be the idea.
Comment: Thats cool! I'll let you know how it goes.. Thanks :)


iPhone Device UUID - PhoneGap

Question: I'm trying to get the UUID on iPhone 4.x simulator, however device.uuid stops my app from running. I've also tried DeviceInfo.uuid but this returns undefined despite being able to see the uuid in the DeviceInfo object in the debugger console.
Any ideas what I should be using?
I'm using PhoneGap 1.0.0
Thanks!
Answer: I experienced the same problem, not just with device.uui, but with other events. In my case the problem was that XCode 4 put a reference in the html file to phonegap.js instead of phonegap.{ver}.js.
Answer: Its important to note the difference between a UDID and a UUID.
UDID "unique device id" is hardware specific. It never changes for a particular device. For this reason, it has become a privacy concern and Apple is blocking apps that try to use this. As a result, Apple has generated an opt-out-able "device id" hash, particularly for advertisement usage. This new ID hash is called IFA and is available in iOS 6.0+.
UUID "universally unique id" is not hardware specific. It is a hash used to identify a device; but not particularly an absolute value. PhoneGap generates a UUID based on device properties; this is what you get when you do device.uuid. If you delete the app and reinstall, you will get a new id hash. UUID is not being blocked by Apple.
Comment: Do you have a source?
Answer: It is a vague idea but: I think you actually cannot get an UUID from the simulator?
It could be that the simulator does not offer the same underlying architecture as a real device does.
And because a UUID is UNIQUE abd considering the fact that there are thousands of people using the simulator with Xcode I highly doubt apple would ship a unique UUID with every simulator, too.
Have you tried using a actual device?
HTH
Comment: Thanks, I thought this might the case. However the debugger console shows a UUID being generated. I've not got access to a device today to test it on.

iPhone Device UUID - PhoneGap


Is there a line homomorphism to a disk?

Question: This is a question from an interview. I am confused about this problem. I said yes in that interview because I remember something about Hilbert curve(I mean, is there a line that can fill a square completely?), but I am not sure. Is it right?
Comment: It was the second best answer that could be given.
Comment: You probably mean a Peano curve? Those are not 1-1, only onto, so no homeomorphism.
Answer: An homeomorphism between a line and a disk can't exist as a line minus a point is disconnected while a disk minus a point is connected.
However it exists surjective continuous maps between a line an a disk.
For an example of a curve filling a square, you can have a look at Lebesgue's curve. Hilbert curve is indeed another example.
Answer: Did you mean homeomorphism? Homomorphism doesn't make sense here.
There is no homeomorphism from a line onto a disk because the line becomes disconnected when you remove one point and that doesn't happen in  disk.
Answer: No.
Let a line $L$ be homeomorphic to a disk $B(x,R)$
Then excluding a point $y \in L$  we will have that $B(x,R) \setminus \{point\} $ will be homeomorphic to $L\setminus \{y\}$.
This cannot be true because then line minus a point is disconnected and the disk minus a point is still connected.

Is there a line homomorphism to a disk?


HttpWebRequest Send File with multipart/form-data for Windows Phone

Question: I have create an Csv File in my phone ( I have this content and this path ) and, url to post this csv...
string path = csv.path;
string content = csv.content;
string urlPost = csv.urlPost;

I want to post my File ( just one csv file )  with the HttpWebRequest, for windows phone, I saw lot of post for HttpWebRequest in C# , and never specific to windows Phone ( HttpWebRequest for windows phone doesn't have all method of "normal" HttpWebRequest) .
I have already saw the msdn page => http://msdn.microsoft.com/en-us/library/debx8sh9.aspx
and this post for HttpWebRequest in c# Upload files with HTTPWebrequest (multipart/form-data) But I don't arrived to translate examples for windows phone.
I arrived to called my server ( with my Url) but, the file are never transmitted...
Also, I don't want use the RestSharp library.
My actually code =>
public void SentPostReport()
    {

        Uri uri = new Uri(csv.urlPost); //Url is string url

        string boundary = "----------------------------" + DateTime.Now.Ticks.ToString("x");

        HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uri);
        request.ContentType = "multipart/form-data; boundary=" + boundary;
        request.Method = "POST";

        request.BeginGetRequestStream(new AsyncCallback(GetRequestStreamCallback), request);

    }

    private void GetRequestStreamCallback(IAsyncResult asynchronousResult)
    {
        HttpWebRequest request = (HttpWebRequest)asynchronousResult.AsyncState;

        // End the operation
        Stream postStream = request.EndGetRequestStream(asynchronousResult);

        // My File content and path.
        string pathReportFile = csv.path;
        string CsvContent = csv.content;

        // Transmitted The File ????

        postStream.Close();

        // Start the asynchronous operation to get the response
        request.BeginGetResponse(new AsyncCallback(GetResponseCallback), request);
    }

    private static void GetResponseCallback(IAsyncResult asynchronousResult)
    {
        HttpWebRequest request = (HttpWebRequest)asynchronousResult.AsyncState;

        // End the operation
        HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(asynchronousResult);
        Stream streamResponse = response.GetResponseStream();
        StreamReader streamRead = new StreamReader(streamResponse);
        string responseString = streamRead.ReadLine();
            //DEBUG => affiche le résultat de la requête.
            Debug.WriteLine(responseString);
        // Close the stream object
        streamResponse.Close();
        streamRead.Close();

        // Release the HttpWebResponse
        response.Close();
    }

I have delete my code in the GetRequestStreamCallback's function , and replace by "// transmitted file ? "
I think it's the places where I have to send my file, but I don't find the solution to transmitted this.
I have testing with this code :
byte[] byteArray = Encoding.UTF8.GetBytes(CsvContent);
postStream.Write(byteArray, 0, byteArray.Length);

and other found in different forum, and I every times, teh call with my server is good, but file isn't transmitted...
Have you a solution for use HttpWebRequest and Stream for send my file in my server?
In advance : thanks!!
Answer: Well, I just found this project, is just a single helper class, is very simple and helpful.
MultipartHttpClient
Hope this helps


Kaparot on Erev Yom Kipur

Question: What's the reason of kaparot?
Why with a chicken?
Why do we shecht it?
And why on Erev Yom Kipur (can I do it every other time of the year)?
Is it halacha or a minhag?
Thanks
Comment: "What is the origin of the minhag of kapparot?"
 https://judaism.stackexchange.com/questions/117659/what-is-the-origin-of-the-minhag-of-kapparot/117662#117662
Comment: The Mishna Berurah says it represents the same notion as a *korban*, you should imagine that the chicken etc. has gone in your place.
Answer: There is a comprehensive article which addresses each of your questions here:

The custom of performing kaparot with a chicken dates back to late
Talmudic times. The earliest extant record specifically discussing the
use of a chicken is a responsum from Rav Sheshna Gaon who lived in the
early Geonic (post-Talmudic) period (approx. 660 C.E.). Rav Sheshna
takes it for granted that his reader knows about the custom, a clear
indication that it was widespread at the time. Some commentaries point
to passages in the Talmud itself that allude to this custom.
Several reasons have been suggested for the choice of a chicken to
perform the kaparot rite:

In Aramaic, a rooster is known as a gever. In Hebrew, a gever is a man. Thus we take a gever to atone for a gever.

A chicken is a commonly found fowl and relatively inexpensive.

It is not a species that was eligible to be offered as a sacrifice in the Holy Temple. This precludes the possibility that someone might
erroneously conclude that the kaparot is an offering.

...We ask of G‑d that if we were destined to be the recipients of harsh
decrees in the new year, may they be transferred to this chicken in
the merit of this mitzvah of charity.
It is important to keep in mind that the chicken is not an offering.
Neither does performance of the ceremony alone atone for one's sins.
However, the ceremony does shake one up a little.
Comment: This answer was already brought here - https://judaism.stackexchange.com/a/117662/22152

Kaparot on Erev Yom Kipur


geometric interpretation of Taylor's theorem

Question: Deriving Taylor's theorem is not a problem. But I am curious if there is any nice
geometric interpretation of the theorem.
Comment: Projecting the series expansion on the terms of $x^j$ with $j \equiv m \pmod{n}$ extract rotational symmetries of order n from the function.  For instance, the $0 \pmod{2}$ terms extract even components and the $1 \pmod{2}$ terms extract the odd symmetries.
Comment: The following link might be useful http://math.stackexchange.com/questions/9422/intuition-explanation-of-taylor-expansion
Answer: You're approximating the given function by a polynomial. The polynomial approximation is constructed so that its derivatives agree with the given function at one particular point.
Geometrically, a Taylor series with two terms is a straight-line approximation; the straight line is the tangent at the given point. One with three terms is a parabola approximation, whose tangent and curvature agree with the given function at the given point. And so on.
Given their myopic focus on a single point, the approximations produced this way are often less than ideal -- you often need an approximation that's good throughout some interval. But at least they're easy to construct.
Comment: Dear bubba, I agree with your first part of the answer. But the 2nd part of the answer "The approximations produced this way are not very useful in practice,....." is not fully correct (sorry),. In physics, the truncated Taylor's series (mostly up to the 2nd order correction), under right circumstances, is routinely used to get approximate answers which are quite useful.
Comment: @abi -- yes, maybe "not very useful" was too strong. I edited.
Answer: I think the answers in the link I added in the comment are really useful. But my own interpretation, possibly not so refined would be two fold.
1) If you consider a "reasonably good-mannered" geometric object, say a curve or a surface, then depending on where you truncate your Taylor series, you can compare it with other well behaved, reference objects locally at least. That is, say for a curve, you can see as to how far it is not a straight line or a parabola/circle and so on.
2) Another possible thread not much different from the first one would be using analyticity, in that the geometric counterparts of such functions(which have a valid Taylor series expansion) are "predictably smooth", in that the smoothness is as you would expect it.
I guess there are a bit too many loose/cheesy words in this answer, but I do hope it helps a little.
Answer: If a function is differentiable in a given domain, then, the functional value of the function at each point is the sum of the functional values of several polynomials at that point.
Visualise several graphs in the $R$ plane, then, their functional values all add up.


How to design a page created using Views

Question: I have created a page with help of the Views module, and it is perfectly doing the job.
I need to design the page on my own.
How can I do this?
Answer: The easiest way to style a page generated by views is to simply edit the CSS.
If you need more control over the markup generated you can use Semantic Views to clean up and improve the generated HTML.
Another simple solution is to manually add a template: there's a "Theme" section in the Views UI (just above where you set the Path and Menu Item). There you can select the best template to use (views-view--YOURVIEWNAME--page-1.tpl.php or something similar) and copy & paste the default template code.
Then, create a file with the same name in your Templates directory (views-view--YOURVIEWNAME--page-1.tpl.php or something similar) and past the code there.  You can now edit the template as if it were any other!
If it isn't getting recognized by the View, don't forget to go back to the "Theme" section in Views UI and click "Rescan template files" to make sure it's found!
Answer: A simple way is to style view fields with CSS.
Another way is to click on "Theme information" in the style setting block of the edit view page. You can use the listed names create your own theme, and copy the created file to your theme folder. Click on "Rescan template files" in the theme Information menu. Now your theme is applied for the view.
Check also How to quickly theme a view?
Answer: Make sure you check out modules like Display suite & Node display. With these modules you can layout a node for all standard build modes (full, teaser, etc) and create your custom build mode; then, you can drag and drop node fields into node regions. In your views, choose display suite when selecting your row style. Each node in your view will be rendered according to the layout you've created in Display suite.
Answer: We can able to design the page by following doings:

Administer->Site Building->Views
Choose Theme:Information from Basic Settings.
Click on Row Style output.
A set of code will generate. Copy the code and paste with the file name generated at the first line of the code and have the file in your current theme folder.
Now design the page as you like.


Reject all malicious URL requests functions.php

Question: this might not be the right place as it's a question about a function snippet that relates also to the server and log files.
I have been trying to block access to my site from bad query attempts which show up on my server logs attempting to access pages that don't exist. I found a snippet online with claims that it may stop these kinds of requests, but with very little explanation as to what it exactly does.
So can anyone advise me as to what this snippet would do and if it should be placed (as is) into the function.php or if it should have a function before hand:
global $user_ID;
  if($user_ID) {
      if(!current_user_can('administrator')) {
          if (strlen($_SERVER['REQUEST_URI']) > 255 ||
              stripos($_SERVER['REQUEST_URI'], "eval(") ||
              stripos($_SERVER['REQUEST_URI'], "CONCAT") ||
              stripos($_SERVER['REQUEST_URI'], "UNION+SELECT") ||
              stripos($_SERVER['REQUEST_URI'], "base64")) {
                  @header("HTTP/1.1 414 Request-URI Too Long");
                  @header("Status: 414 Request-URI Too Long");
                  @header("Connection: Close");
                  @exit;
          }
      }
  }

Answer: All publicly visible sites on the internet get hit with ridiculous URL requests fairly often. These come from script kiddies (low-rent cybercriminals, the kind of children who think they're l33t or something) trying to get your site to misbehave and give them access using (mostly) old tricks that exploit long-fixed bugs. Some of the tricks they try are decades old.
Trying to stay ahead of these ridiculous URLs on your own site isn't worth your trouble: you'll just be playing whack-a-mole. There's already lots of stuff in WordPress, php, and web servers (like Apache and litespeed) to repel these attempted invasions. You're much better off doing these things:

Regularly updating WordPress, your themes, and your plugins to the latest versions. These updates often fix security issues and plug new holes, and often (not always) before the kiddies figure out how to exploit them.

Making it really hard to guess your administrative username / password combinations.  Use a hard to guess username rather than admin. And use a hard to guess password.

Installing a security plugin to slow down the kiddies.

Not keeping data on about visitors to your site unless you have good reasons. Sites with less data are less interesting to kiddies.

That being said, pretty much all WordPress add-on code, like yours, must be registered as a Hook : an Action or a Filter so WordPress knows when to run it and what to do with the result. Often a big challenge when writing code to add in to WordPress is figuring out which hook to use.  Did the code snippet in your question mention which hook should invoke it?
The first hook on an ordinary WordPress page is do_parse_request. If you return false from this filter WordPress goes on to completely ignore the incoming web request.
So you might try

add_filter('do_parse_request', my_parse_request_filter, 10, 3 );
function my_parse_request_filter ($continue, $wp, $extra_query_vars) {
  if ( something is wrong with $_SERVER['REQUEST_URI'] ) {
    $wp->query_vars['error'] = 414;
    $return false;
  }
  return $continue;
}

but any administrator or other logged-in user isn't yet known in that filter.
Comment: Thanks for the reply, i had pretty much given up on it but i will give it try when i get a moment.


How to list namespaces in Linux?

Question: Is there any method in Linux to list all namespaces on the running host? I need to check namespaces for particular processes (e.g. processes running in LXC-container and all other processes on the host) and then find out cgroups of them.
Comment: Related: [how to find out namespace of a particular process?](//unix.stackexchange.com/q/113530)
Answer: Utilities for working with namespaces have improved since this question was asked in 2013.
lsns from the util-linux package can list all of the different types of namespaces, in various useful formats.
# lsns --help

Usage:
 lsns [options] [<namespace>]

List system namespaces.

Options:
 -J, --json             use JSON output format
 -l, --list             use list format output
 -n, --noheadings       don't print headings
 -o, --output <list>    define which output columns to use
 -p, --task <pid>       print process namespaces
 -r, --raw              use the raw output format
 -u, --notruncate       don't truncate text in columns
 -t, --type <name>      namespace type (mnt, net, ipc, user, pid, uts, cgroup)

 -h, --help     display this help and exit
 -V, --version  output version information and exit

Available columns (for --output):
          NS  namespace identifier (inode number)
        TYPE  kind of namespace
        PATH  path to the namespace
      NPROCS  number of processes in the namespace
         PID  lowest PID in the namespace
        PPID  PPID of the PID
     COMMAND  command line of the PID
         UID  UID of the PID
        USER  username of the PID

For more details see lsns(8).

lsns only lists the lowest PID for each process - but you can use that PID with pgrep if you want to list all processes belonging to a namespace.
e.g. if I'm running gitlab in docker and want to find all the processes running in that namespace, I can:
# lsns  -t pid -o ns,pid,command  | grep gitlab
  4026532661   459 /opt/gitlab/embedded/bin/redis-server 127.0.0.1:0

and, then use that pid (459) with pgrep:
# pgrep --ns 459 -a
459 /opt/gitlab/embedded/bin/redis-server 127.0.0.1:0
623 postgres: gitlab gitlabhq_production [local] idle
[...around 50 lines deleted...]
30172 nginx: worker process

I could also use the namespace id (4026532661) with ps, e.g.:
ps -o pidns,pid,cmd | awk '$1==4026532661'
[...output deleted...]

Answer: From ip man page for network name space
ip netns - process network namespace management
       A  network  namespace  is  logically another copy of the network stack,
       with it's own routes, firewall rules, and network devices.
   By  convention  a   named   network   namespace   is   an   object   at
   /var/run/netns/NAME  that can be opened.  The file descriptor resulting
   from opening /var/run/netns/NAME refers to the specified network names-
   pace.   Holding  that  file descriptor open keeps the network namespace
   alive.  The file descriptor can be used with the setns(2)  system  call
   to change the network namespace associated with a task.

   The  convention for network namespace aware applications is to look for
   global network configuration files first in  /etc/netns/NAME/  then  in
   /etc/.    For   example,   if   you   want   a   different  version  of
   /etc/resolv.conf for a network namespace used to isolate your  vpn  you
   would name it /etc/netns/myvpn/resolv.conf.

For name spaces of other types, maybe there is other ways
Answer: Namespace-Lister:
You can use listns.py
Usage: ./listns.py or python2 listns.py
Exploring the system
In the basic/default setup Ubuntu 12.04 and higher provide namespaces for (These namespaces are shown for every process in the system. if you execute as root)

ipc for IPC objects and POSIX message queues
mnt for filesystem mountpoints
net for network abstraction (VRF)
pid to provide a separated, isolated process ID number space
uts to isolate two system identifiers — nodename and domainname – to be used by uname

The python code
The python code below is listing all non default namespaces in a system. The program flow is

Get the reference namespaces from the init process (PID=1). Assumption: PID=1 is assigned to the default namespaces supported by the system
Loop through /var/run/netns/ and add the entries to the list
Loop through /proc/ over all PIDs and look for entries in /proc//ns/ which are not the same as for PID=1 and add then to the list
Print the result

Example:
Example of python2 listns.py output... you can pipe it with sort or edit the script to match your needs
       PID  Namespace             Thread/Command
        --  net:[4026533172]      created by ip netns add qrouter-c33ffc14-dbc2-4730-b787-4747
        --  net:[4026533112]      created by ip netns add qrouter-5a691ed3-f6d3-4346-891a-3b59
       297  mnt:[4026531856]      kdevtmpfs
      3429  net:[4026533050]**    dnsmasq --no-hosts --no-resolv --strict-order --bind-interfa
      3429  mnt:[4026533108]      dnsmasq --no-hosts --no-resolv --strict-order --bind-interfa
      3486  net:[4026533050]**    /usr/bin/python /usr/bin/neutron-ns-metadata-proxy --pid_fil
      3486  mnt:[4026533107]      /usr/bin/python /usr/bin/neutron-ns-metadata-proxy --pid_fil

Source: github-mirror and article; all credit to Ralf Trezeciak
Comment: If this is your script, you should state that. (And in your other answers spamming this script as well).
Comment: i already linked the source, now i added the name of the developer, i updated the 2 other answers as well, i posted different answer to different questions even if it is linking the same tool, please let me know if i have to update something or delete an answer.
Answer: Nsutils
Nsutils can list used namespace with nslist, it also does not require root to see user namespaces
Network namespaces:
For network namespace created with ip netns, they can be listed with ip netns list

How to list namespaces in Linux?