Can a planet hit by a meteor shatter into two pieces? Alternately, if not a meteor, an advanced interstellar weapon?

Question: First, is it possible for a planet hit be a meteor to shatter into two pieces?. Then, can the two pieces remain in orbit? Especially, can they develop a sort of co-orbit around each other?
Comment: Sorry a meteor you say that's impossible as it is smaller than typical asteroid but superweapon maybe.
Comment: Sure why not you might even get 2 ring planets.
Answer: I like TimB's answer discussing the Giant Impact Hypothesis. I see that in a comment on his answer, you wrote

Thank you! I actually had this Moon origin theory in mind. But I'm actually wondering about an inhabited planet, in the immediate run. Is there any possibility of survivors, say, after the shattering? For a while, at least? Any idea?

The answer is most certainly no. I'd like to go in-depth as to why that won't be happening.
In an answer to one of my questions, Serban Tanasa discussed the conditions of impacts. He cited Stewart et al. (2015) (which cites an earlier work by the three, Stewart et al. (2014), giving the formula for the energy released in an impact, $Q_S$, as
$$Q_S=Q_R(1+M_p/M_t)(1-b) \tag{1}$$
$Q_R$ is calculated as
$$Q_R=\frac{0.5 \mu V^2}{M_p+M_t} \tag{2}$$
In this latter paper, they mention that for grazing impacts, $b>\frac{R_t}{R_t+R_p}$, so we'll assume here that $b<\frac{R_t}{R_t+R_p}$.
You mentioned a meteor. A meteor will do next to no damage to a planet. In this case, $R_p \ll R_t$, so we're left with $b<1$. To do some real damage - enough to do what you want - we need $R_t \approx R_p$. So $b<\frac{1}{2}$. We can, though, say that the projectile isn't too massive. We'll toe the line and have $b=\frac{1}{2}$.
Assuming the densities are the same, $R_p \approx R_t \to M_p \approx M_t$. We now have
$$Q_S=Q_R(1+1)\left(1-\frac{1}{2}\right) \to Q_S=Q_R$$
This means that
$$Q_S=\frac{1}{4} \mu V^2 \tag{3}$$
$\mu$, the reduced mass, is
$$\mu=\frac{M_pM_t}{M_p+M_t}$$
Assuming both bodies are Earth-like, this means that
$$\mu=2.985 \times 10^{24}$$
It doesn't matter what $V$ is. Looking at one of the graphs, I see that whatever $V$ is, $Q_S$ is going to be off the charts:

We're all going to die.
Answer: Yes, in fact that is one theory of how the Earth and our Moon came into being. A large body hit the earth, ripped off a section of it, the smaller section ended up in orbit around the larger.
Note that gravity of the chunks will always try and pull them back into a spherical shape though, so you will end up with two smaller spherical bodies orbiting each other. You won't end up with "shattered chunks".
Comment: Actually, Tim B is wrong if your question refers to splitting the planet into two pieces (immediately after the collision). The collision produced a massive debris field in orbit around the earth, and the debris fairly quickly coalesced to form the moon. The short explanation is that the collision would act like an enormous bomb, and the strength of the planet is not high enough to produce two pieces which go their separate ways. Instead, you get shrapnel on a planetary scale. As with the Moon, stuff can solidify into a body, but it doesn't start out as two pieces.
Comment: @Sykik No survivors.  The Theia event would turn both bodies to magma.
Comment: Thank you! I actually had this Moon origin theory in mind. But I'm actually wondering about an inhabited planet, in the immediate run. Is there any possibility of survivors, say, after the shattering? For a while, at least? Any idea?
Comment: Agreed, the Theia event *liquified* both bodies which then took a long time to both coalesce and cool.  I'm not disagreeing with @WhatRoughBeast said - he meant quickly on a geologic or astronomical time scale.
Comment: See [this presentation](https://m.youtube.com/watch?v=PmhmWs71EMk) for current models. It is gas, not (just) magma.  An extended body that behaved as an atmosphere.
Answer: Given the amount of energy needed to destroy a planet, even sending another planet on an impact orbit will not do what you want (as a BTW, the impactor that smashed into Earth and created the Moon is estimated to have been the size of Mars).
For the amount of energy you will need, a futuristic super weapon is the tool required. Cribbed from another website we get the amount of energy needed:

The gravitational binding energy of a planet of mass M and radius R is given by the formula $$E=\frac{3}{5} \frac{GM^2}{R}$$. For Earth, that works out to roughly 224,000,000,000,000,000,000,000,000,000,000 Joules. The Sun takes nearly a WEEK to output that much energy.

So a relativistic hyperweapon approaching the Earth at a very high fraction of the speed of light is probably the best way of going about planet "cracking", but you need to calibrate the impact rather carefully. Too "slow" and you get a ball of molten magma that gradually collapses back into a planet sized ball (or maybe a planet and one or two moons). Too "fast" and you end up with a cloud of gravel forming a new asteroid belt around the Sun. Even more energy and the pieces reach Solar escape velocity and exit the Solar System for a lengthy tour of the Galaxy.
An entertaining synopsis can also be found here: https://what-if.xkcd.com/20/
You will see according to his calculations, you need to impact the Earth at 0.9999999*c* to get to the effects that you are looking for, and far beyond any sort of engineering that a Type I civilization would be able to unleash on its unwary interstellar adversaries.
Comment: Sorry, slip of the mouse: http://www.livescience.com/17875-destroy-earth-doomsday.html
Comment: Can you add a source for the italicized part (I presume it's a quote)?
Comment: I had found that, but wasn't sure if it was the right place. Thanks.
Answer: No
You could not split a planet in the manner you described as several answers here pointed out.
Maybe
However, there is a special case which might result in a split body.
Consider all bodies in the Solar System are split into two groups: 1) the roughly spherical ones and 2) the non-spherical ones.

Spherical
Spherical bodies are in a state called isostatic equilibrium, which is a fancy way of stating that their shape is governed by their own self-gravitation.  These bodies could NOT be split by a meteor / asteroid / weapon impact.  If you supply enough energy to split them, you will instead disrupt them.
In the case of the Theia event, the Earth and Moon formed out of the debris produced by the disruption.
Non-spherical
Non-spherical bodies are shaped by things in addition to their own gravitation or at least gravity isn't the biggest factor in their shape.  Instead the strength of the material is sufficiently great to resist the gravity of the asteroid and maintain its non-spherical shape.
If you struck a rock asteroid with enough force to cleave it and impart enough momentum, you might get the two halves of the body rotating around each other.
Given some of the odd, peanut, shaped asteroids out there; it's possible this has already happened many times and we're just now learning about it.
Asteroid Itokawa may have started as one of these.
Comment: The bar or peanut shaped asteroids are *contact binaries*.  I suppose if you hit one lobe you could make it come apart again.
Comment: I didn't make it clear...  I meant some contact binaries could have started as a cleaved asteroid.  Others (like the one depicted), the different masses indicate different origins.
Comment: What would make it cleve and then come back together,  and how could each piece be round if it was produced by chopping a round object?
Comment: Anytime you get two objects orbiting each other (other than an impact), it takes 3 bodies and a transfer of momentum.  For objects in the inner solar system, one of those bodies can be the sun.  To cleave an asteroid and get them orbiting would require time and a chance interaction with the gravity of some other object.  Objects become round through abrasion (microscopic meteor impacts) over geologically long periods of time.
Comment: So the contact binary was an object that was cleanly cleaved while leaving them in mutual orbit, then the pieces became rounded, then came back together carefully?  What's wrong with just having two unrelated asteroids end up in similar orbits and then come together?
Comment: That's possible too.  Just remember that anytime you get two objects in orbit it takes a delicate dance of momentum transfer to get them into orbit.  This usually takes 3 bodies to do.  For the Earth - Moon system, it started with two bodies and ended with what we can consider 3 bodies: Earth, Moon, and all the material that escaped.  It was the material that escaped that carried away enough momentum to allow the Earth and Moon to orbit each other.  This sort of interaction plays out for every object in orbit around another (unless they formed from the same protoplanetary disk).
Comment: I know about orbits, and not asking about momemtum transfer in any respect.  I'm commenting on your idea that some peanut shaped object is created by cleaving a rock asteroid (and then coming back together). I expect that's not what you meant or have an editing error.   *How* is the existance of contact binaries suggestive of past cleaving? (Item 2 paragraph 3)
Answer: No, it's not possible.  You can have something like Tim B's answer regarding the Theia impact but that is not a case of a planet shattering into two pieces, but rather a grazing impact where the impactor broke up but went into orbit rather than merging with the planet.  (Yes, there was substantial mass exchange, but the moon is mostly impactor, the Earth is mostly Earth.)
To actually split a planet is another matter--the basic problem here is that the heat of vaporization of the planet is less than the gravitational binding energy of the planet.  A simple application of brute force can't break it without destroying it.
Even if you have some sort of gravity generator to pull it apart without smashing it in the process you'll have the problem that the pulled-apart pieces are massive enough that they're going to turn into spheres.  That will be cataclysmic for anyone on them.  Not to mention that the atmosphere is more mobile than the rock, it's going to fall off the edge of the world.  Everyone suffocates.
Comment: Got a reference on "but the moon is mostly impactor, the Earth is mostly Earth"? I thought the lithosphere was pretty well mixed and the cores coalesced.  [Here's mine](https://m.youtube.com/watch?v=PmhmWs71EMk) current as I write this.
Comment: I just gotta say, I loved your reference @JDlugosz!  It takes an hour, but I thought it was well worth the time.
Answer: An "advanced interstellar weapon" would need to carefully cut the globe in half without heating past the edge, while simultaneously shoring up the exposed inside half so it doesn't pull itself back into a ball.
Digging a trench allmthe way through, in and of itself, is just an engineering problem.  Self-reproducing machines could dignand build more with the removed material. One could calculate the energy needed to move a half-mile wide curf out of Earth's gravity.
Sealing the cut end, and building a wall to hold the air, probably involves materials stronger than what is physically possible.  However, it does not have to be a ultra-thin covering. The half of the world does the job now, passively.  Make an extended slab that is dome shaped but much smaller than the original half it's replacing, so it has bulk (hundreds of miles) especially towards the center.  It allows for active cooling too, so it doesn't need to withstand the temperature like a passive material.
That would cause the half-world to cool much more rapidly, and the gravity woukd be all messed up so even with the cap (with a lip) the oceans and air would fall towards the middle of the hemisphere, as the thin lens edges don't have enough attraction.  The rocks would do likewise: even with a strong cap over the cut, it would collapse in the other direction.  The cap needa to be made with ultradense material to provide gravity, matching the original missing half. It would be less massive than the original because it is smaller, so not 4000 miles away in places.
I think you should try it with an airless world first. If you slice the moon, you could get away with hollowing it out too.


water drainage WHEN IT RAINS

Question: what is the best way to raise,my cement sidewalks level a couple of inches for better water drainage 2 1/2 feet W  X 20  ft length
Comment: Hello, and welcome to Home Improvement. There are various concrete raising services that inject material under a slab, but service recommendations are off-topic here.
Comment: Google concrete leveling, concrete raising, mud jacking, foam jacking. It might be cheaper in your case to demo the sidewalk, fill, and pour a new one.
Answer: The best way to raise a side walk of the type you describe is to remove the old one by breaking up the old one and hauling away the old material.
Then you prepare the base area with new fill to build up to the level needed. Note that it may be required to even replace some of the old base material if it was not properly prepared under the original sidewalk. One thing to look for is organics in the soil that can decompose over time leading to voids in the fill.
Finally the time comes to build the forms for the new sidewalk to define the size and top level of the replacement sidewalk. Before filling the forms with new concrete make sure to think about adding suitable wire mesh and/or rebar.
Try to avoid the short cut of just adding a few inches of concrete on top of the old sidewalk. The problem with doing this is that it does not last a long time, especially in areas with freezing weather. Water can seep into the joint area between the two layers. When it freezes it expands and can push the layers apart and even cause the relatively thin top layer to crack.

water drainage WHEN IT RAINS


Is Nikon ADL helping to increase the vividness of reflection in this picture?

Question: This photo is one of the first I took with an N5100. I was surprised by the level of detail in the reflection; it was much less bright in person, at least as far as I recalled. The camera was set to store JPG, so it would have run the ADL algorithm. Is that why the reflection is so vivid?
Comment: Note that reflections off the water would have been significantly polarized.  If you were using a polarizing filter, it could have in effect accentuated the reflections by dimming everything else.  Rotate 90 deg it would have done the opposite.  Even without a polarizer, the polarizing effect of the water-mirror would have selected parts of the sky.  Which parts depends on the sun angle and therefore the polarization angle of the sky haze and the blue part.
Answer: No. Active D-Lighting would have helped retain a little more detail in the bright highlights on the tree bark everywhere in the picture, but it wouldn't have affected the bulk of the reflection, which hovers around the midtones.
The unexpected effect can probably be put down to the difference between your eye seeing changes in the reflection averaged over time as the surface of the water moves and the camera's 1/60s shutter speed. A fraction of a second earlier or later, and you probably would have seen more distortion and scattering, giving something a little more like, say, Monet's Water Lilies series. A longer shutter speed would probably have given you something considerably less sharp and distinct.
In any case, getting used to the difference between ordinary visual perception and the several different "realities" the camera can provide depending on aperture, shutter speed and overall exposure is one of the keys to successful photography. It's always a bit of an experimental crapshoot unless you're in control of everything in a studio, but knowing what will change and why will help you plan your pictures. And give you an idea when squinting, winking and blinking to look for those changes might be a good idea.
Comment: thanks. I've been an on-and-off photographer for a very long time, and this is by far the most extreme example I've ever seen, which led me to wonder about a deus ex machine.


Reading from serial port in a Ruby on Rails application hangs

Question: I'm using the serialport gem to read from the serial port in my Ruby on Rails 3.2 application. The serial port itself is used to write data from an Arduino board.
The gem is added to Gemfile. The port is initialized in application.rb:
config.serial_port = SerialPort.new "/devttyACM0", 9600
config.serial_port.read_timeout = 100

The problem appears when I try to read from this port.
@sp = ProjectName::Application::config.serial_port
@sp.read

The application hangs deadly. I've tried to perform reading from a pry session and everything was OK. If I set read_timeout to 0, reading from pry also hangs. I already tried to set read_timeout to bigger values with no result. What should I do to make it work?
Update:
I've tried to perform the same actions using sinatra framework. It hangs too.
require "sinatra"
require "serialport"

get '/' do
  read_data
end

helpers do
  def read_data
    sp = SerialPort.new "/dev/ttyACM0", 9600
    sp.read_timeout = 1500
    t = sp.read.match(/\d+(\n|\r)+/)[0].gsub!(/(\n|\r)*/,"") rescue nil
    sp.close
    t
  end
end

Answer: Had the same problem. The fix was actually easy, the problem is that your rails app is constantly reading new values from the serial port and as long its reading those inputs, it doesn't do anything else, so your site will never be actually built.
Try if it works if for example you simply let it read from the serial port a fixed number of times.
Answer: Can you intereact with the device using a simple script, like this:
require 'rubygems'
require 'serialport'
sp = SerialPort.new "/dev/ttyUSB0"
sp.write "AT\r"
while true do
   printf("%c", sp.getc)
 end

In this case I was using an GSM modem. Maybe your device is waiting for some command first.


Display several 2d image as a stack in R

Question: How to display stack of several  2d images to form as 3d image in R ? If anyone can share the code with the example it would be very helpful.enter link description here
Answer: See the vignette for the magick package.
https://github.com/ropensci/magick/blob/master/vignettes/intro.Rmd
Under Image Vectors - Combining, it shows how to combine multiple layers with an offset. It sounds like you'd do something like:
library(magick)
combo <- image_composite(layer1, layer2, offset = "+0+50")
combo <- image_composite(combo , layer3, offset = "+0+50")
combo <- image_composite(combo , layer4, offset = "+0+50")

Comment: Hi Jon,                                                                                Thanks for your kind reply.


Do I need an Add-in or a Stand-Alone Application for a custom form?

Question: The type of application I want to build for ArcMap is to be run from inside of ArcMap and on a click of a button a custom form appears in front of User in which User enters certain parameters and then by some processing, the application returns resulting image to user in the same ArcMap Document...
So will this application be an Add-in or Stand-Alone Application..??
Comment: In terms of returning an image to your user, would this image be a raster added to the Table of Contents? Or would it be an image that is just for information and to add something to your print out?
Comment: Sorry for the misunderstanding...
actually I want to return a new dataframe into the same ArcMap document with new shape files to user...
Comment: Which version of ArcGIS are you developing for?
Comment: Sorry for this late reply...

@blah238 I am developing for ArcMap 10.0
Comment: Do you want to add a new shape file in the current map?
Answer: Custom forms can only be created with ESRI Add-ins. I believe you can also create custom forms in 10.1 with Python (ArcPy) Add-Ins
Although if all your user needs to do is select certain parameters, you can probably accomplish this with a python script. You can then add that script to a toolbox and set the parameters there: ArcGIS Documentation
As for having a button that launches the form, you can accomplish this by customizing your interface and selecting your newly created python script.
The last part specifies that you want an image to return to the user, I'll edit this once you specify if the image is a raster (which would be added to the TOC) or an image that will be added to your layout.
Comment: actually I am doing the programming with C# and I don't have any Python knowledge...

as for output is considered...
Sorry for the misunderstanding...
actually I want to return a new dataframe into the same ArcMap document with new shape files to user...
Comment: No problem, I don't know C#, so hopefully someone will come along with a C# answer for you soon!
Comment: "Custom forms can only be created with ESRI Add-in's" this isn't exactly true. Add-ins were introduced at 10.0 and people were definitely creating forms before that. :) See [What you can do: Developing against ArcGIS Desktop (9.3)](http://resources.esri.com/help/9.3/arcgisdesktop/com/shared/desktop/get_started/what_develop_dtop.htm)


what is the purpose of the Buddhist marriage ceremony?

Question: A fundamental tenet of Buddhism is freedom from attachments. If that is so, what is the purpose of the Buddhist marriage ceremony? It seems to be a contradiction, a celebration of attachment within a philosophy that avoids attachment.
Comment: Why do you think Buddhism should not celebrate marriage?
Answer: Buddhism has teachings for both monks & laypeople. If there were no lay people with worldly attachments, the monks could not be supported with food & other requisites.
Marriage is praised for laypeople, as follows:

In five ways, young householder, the parents thus ministered to as the
  East by their children, show their compassion:
(i) they restrain them from evil, (ii) they encourage them to do good,
  (iii) they train them for a profession, (iv) they arrange a suitable
  marriage, (v) at the proper time they hand over their inheritance to
  them.
Sigalovada Sutta

~~~

Husband & wife, both of them  having conviction,  being responsive,
    being restrained,   living by the Dhamma,   addressing each other   with
  loving words: they benefit in manifold ways.  To them comes bliss.
  Their enemies are dejected    when both are in tune in virtue. Having
  followed the Dhamma here in this world,   both in tune in precepts &
  practices, they delight in the world of the devas, enjoying the
  pleasures they desire.
Samajivina Sutta
Answer: They are just secular affairs in Buddhist countries, and nothing what-so-ever to do with the Teachings.  The newly wedded couple and the assembly may recite the Buddha, Dhamma, and Sangha Vandana, the Tisarana and Pancasila at such an occasion. They may obtain the blessing a from monk at the local temple. There are similar Buddhist funeral rites too, but they are all cultural, and nothing to do with the Doctrine or practice.
There are no instructions anywhere in the Vinaya or the Suttas (The Doctrine) as to what one should do at such an event. Whether to marry or to stay a bachelor are personal and individual concerns. You are not duty-bound to do one way or the other. But there are a set of fundamental rituals that have been accepted and followed in a Buddhist marriage.


Making caramel on glass top stoves

Question: Why can't I make caramel or toffee on my glass topped stove?  I have tried different pans, different thermometers, stirring, not stirring, different recipes, different temperatures.  It turns out scorched, rock hard, or, in the case of toffee, it separates.  I used to make good caramel on my old electric stove.
Comment: What's the actual heating process? You can get glass topped induction, halogen, resistive etc. I suspect it's resistive and responds more slowly than your previous cooker.  Was that the coiled glowing sort?
Comment: I have one halogen burner, the rest are resistive.  I've tried it on both.
Answer: How are you trying to make the caramel?  Using only sugar, put it in the pan over a high heat and stir continuously.  It will start to crystallize, and even form crystals up the side of the pan, but be patient, it will caramelize. There really shouldn't be an issue, I use a glass topped stove, normally with a heavy based stainless pan.

Making caramel on glass top stoves


Using the chain rule to find second order partial derivatives

Question: Given the application $u(r,\phi):=v(r\cos\phi, r\sin \phi)$ I need to find by the chain rule an expression for $\frac{\partial^2 v}{\partial x^2} + \frac{\partial^2 v}{\partial y^2}$ in terms of second partial derivatives of $u.$ I found first the Jacobian matrix based on the transformation function $(r,\phi)\rightarrow (x,y)=(r\cos \phi, r \sin \phi).$ Since this application is not a function, I do not know if one has to go through the Hessian matrix to find the second partial derivatives. Can you provide me some support or a solution proposal ? Thanks.
Comment: You will confuse yourself and everyone else unless you write  something sensible like "$u(r,\phi)=v(x,y)$ where $x=r\cos\phi$, $y=r\sin\phi$". The result  is in every book: what is the problem?
Comment: Where do $x,y$ feature in all this?
Comment: $(x,y)$ is represented by polar coordinates. I need to thus represent the two second order partial derivatives in terms of partial derivatives of $u$ and the polar coordinates.
Comment: @user996159  Have you made any progress?
Answer: Hint: Since you want an expression of the second order partial derivatives of $u$, begin by finding what they are in terms of the p.d. of $v$ and the derivatives of $x$ and $y$.
Reason: the first and second order partial derivatives of $x, y$ with respect to $r, \phi$ are much easier to find than the inverse, and trigonometric identities may be useable.$$\dfrac{\partial x}{\partial r}=\cos\phi~, \dfrac{\partial x}{\partial \phi}=-r\sin\phi~, \dfrac{\partial^2 x}{\partial r~^2}=0~,\textit{et cetera}\ldots$$


Problem downgrading from high sierra to original (shipped) OS

Question: I recently got a broken MacBook Pro mid 2010 model from an acquaintance. The hard drive was broken so I switched it out for an SSD. I installed high sierra using an installer usb created by a friend of mine. High sierra is quite heavy for this older laptop so I want to downgrade to an older version of osx. I tried using shift + alt/opt + cmd + r, which is supposed to give the user access to the installer of an osx version as close as possible to the original shipped os. I only get the option to install high sierra. Is there anything I'm not doing correctly?
Comment: that keyboard shortcut is for Reinstall OSX, not for choosing antoher
Answer: Go to Apple Store and Download OS X
Click on Purchased to see what is available to you
create bootable disk with that OSX
Plug the new bootable installer into your Mac.

Restart your Mac, holding the Alt key and, when you see the option, choose the bootable install disk.
Launch Disk Utility, click on the disk with High Sierra on it (the disk, not just the volume) and click the Erase tab.
Choose Mac OS Extended from the Format menu, then give the disk a name. `Click Erase`.

When the disk has been erased, restart by holding down Command-R and wait for the macOS Utilities window to appear.
Choose Reinstall macOS and select the disk you just erased – your Mac's regular startup disk. Follow the onscreen instructions and wait for your Mac to restart.

When it restarts, ignore the option to migrate data from a backup.

Optionally --Re-install the backup tool you used to backup your Mac before you upgraded to High Sierra and then use that to restore data from that backup.


Detecting touch area on Android

Question: Is it possible to detect every pixel being touched? More specifically, when the user touches the screen, is it possible to track all the x-y coordinates of the cluster of points touched by the user? How can I tell the difference between when users are drawing with their thumb and when they are drawing with the tip of a finger? I would like to reflect the brush difference depending on how users touch the screen, and would also like to track x-y coordinates of all the pixels being touched over time. Thanks so much in advance for any help.
Answer: This would be very tricky primarily because every android phone is going to behave differently.  There are some touch screen devices that are very, very sensitive and some that are basically "dull" by comparison.
It also sounds more like you are wanting to track pressure - how hard is the user pushing on the screen - which is actually supported on  android devices.
I think some of your answer may be found by monitoring all of the touch events - in practice, most applications ignore a great number of events or perform some kind of "smoothing" of the events since there is literally a deluge of touch events when the user is manipulating the screen. Doing this may negatively impact your applications performance though.
I would recommend that you look into pressure sensitivity and calculate a circular region around the primary touch point based on pressure, then build your brush around that.
Another idea would be to incorporate more of a gesture approach to what you are trying to do - for example, visualize touching the screen with the tip of two fingers together (index and middle) and rolling the middle finger around the index finger or simply moving the middle finger up and down in relation to the index finger.  Both fingers would be moved together for painting.  This could be used to manipulate drawing angle on the fly or perhaps even toggle between a set of pre-selected brushes or could change brush size on the fly as you are painting.
Some of the above ideas I would love to see implemented - let me know when you have your app ready.
Good luck!
Rodney
Answer: If you have a listener on your image it will respond that there was a touch within that bounding box, basically.
So, to get what you want, you could, but, I would never do this, create a box around every pixel, or small group of pixels, and listen for a touch.
Wherever you get a touch, it may fire off an event, then you can react accordingly.
I can't think of any other solution that will give you each pixel that a person touched, at one time.
You may want to read up on multitouch though, as there are some suggestions in here that my help you:
http://android-developers.blogspot.com/2010/06/making-sense-of-multitouch.html
Answer: If you're looking for a way to get your content view as a View after Activity#setContentView(int), then you can set an id on the outer-most element of your layout:
android:id="@+id/entire_view" and reference it in your onCreate() method after setContentView:
View view = getViewById(R.id.entire_view);
view.setOnTouchListener( ... );

Detecting touch area on Android


What measures of the dielectric constant mark whether the solution is ionic, polar and nonpolar?

Question: At what numerical values of ε, then what organic compounds if any mark these thresholds.  How is that only for a vacuum has ε=1?  This is absolute lowest limit?
Comment: This looks like two separate questions. What does the value of the vacuum have to do with ionic, polar, and non-polar compounds? Any limits on the dielectric constant aren't necessarily related to the classification of a molecule. (I'm not saying this because I know the answer.)
Comment: Related answer: https://chemistry.stackexchange.com/a/32862/7951
Answer: Just compare the dielectric constant of known substances to non-polar, polar, metallic designations. For example, the dielectric constant of water is around 80.0 and water is polar. H2 has a very low constant value near 2 I believe and it is very non-polar. Metals have very large epsilon values moreover.  Rule of thumb, the larger the dielectric constant, the more polar the substance or material. In math terms, the potential felt between 2 charges is V= (q1 q2) / (4pi epsilon r) where q1 and q2 are different charges separated by r. The higher epsilon, the smaller V becomes. How charges interact with each other hence depends on the dielectric constant of the medium or material.


Why will Ubuntu no longer measure file size unit as byte, megabyte, gigabyte, etc?

Question: I read on somewhere that Ubuntu will no longer use the familiar file size units we all know by now (kB, MB, GB, TB) and switch to a different IEC standard (KiB, MiB, GiB, TiB). If this is true, I would like to know what's the reasoning behind this change, and the impact (if any) this change has, especially with multiplatform applications or applications run with Wine.
Comment: To my knowledge, using KiB, MiB...etc is already in place in Ubuntu. So "Ubuntu will no longer.." should be "Ubuntu is no longer.."
Comment: Reasoning: https://stackoverflow.com/a/69679309/217867
Answer: Short answer is yes, the prefixes change. But it doesn't really make a difference.
Reasoning
There has always been confusion because decimal-style units like KB, MB, GB were used with binary data - KB meant 1024 bytes, not 1000 bytes as might be expected. And of course many people throughout the world use the actual decimal prefixes in their daily lives under the metric system.
Network engineers and long-time computer users of course are trained to understand the difference, but the ongoing confusion meant applications were inconsistent in their usage; one application might use MB to mean 1,000,000 bytes (using the decimal prefix), while another might mean 1,048,576 bytes (using the binary interpretation).
This led to Ubuntu eventually adopting a new units policy.
Impact
The impact is really just a display issue. File sizes and network bandwidth will be displayed using the decimal prefixes, so a 5kB file will actually be 5000 bytes. This is actually in line with what many (most?) people expect.
Memory usage and some low-level utilities will display sizes using the binary prefixes (KiB, MiB, GiB, TiB). This may cause some initial confusion but is actually better than the status quo where we have one prefix meaning two different things.
Since Windows still uses the old, ad-hoc system a Wine application might display slightly different file sizes for the same file. However I at least often see different sizes displayed anyway due to rounding methods, so I'm not convinced it's a major issue.
See also:

What file size units do applications on Ubuntu use?
Comment: I was never confused as long as 1kB was 1024 Byte.
Comment: @mlissner: actually, using MB to mean 1024×1024 bytes has always been wrong, even if it was in common use, and that's why new, binary-based prefixes were standardised 11(!) years ago.

So Ubuntu is just implementing an 11 year old IEC standard and 2 year old ISO standard (now known as ISO/IEC 80000).
Comment: Huh. Why not make the policy just use 1MB to mean 1024 in all cases? If people buy a "2GB" drive (which is actually a 2GiB drive), and then open it in Ubuntu, it will be reported as 2.2GB, or so.

It was my understanding that ever using MB to mean 1,000 was always wrong, ditto for KB, GB, etc.
Comment: A 200GB drive is action 200GB not 200GiB
Answer: IT IS SOOOO... SIMPLE!!!
A few years ago there was very little confusion about this. Because the notation

1 KB = 1024 bytes
1 MB = 1024 KB

was taught, learned and used in all universities and almost all the industry (software and hardware) around the world, during many years.
The stupid idea of counting in base 1000 (not even base 10) is only another symptom of the stupidity of our times and modern life.
What makes things much much worse is the more stupid idea of trying to establish (and continue to do it) the old notation for the unpractical 1000-base units. THAT HAS CREATED ALL THE CONFUSION. If they had only adopted the convention that

1 KiB = 1000 bytes
1 MiB = 1000 bytes

then there would be much less confusion and the problem would be much smaller.
They should have tried to establish that
<code>1KB = 1024 bytes
1MB = 1024 KB

and

1 Ikb or ikb or Kib = 1000 bytes
1 IMb or imb or Mib  = 10^6 bytes
</code>
There is absolutely no need to use base-1000 units. Probably the idea started in a stubborn mind that said "oh, no, if kilo is 1000 and mega is 1,000,000, we are going to use kilo and mega in base-1000 for information units (base 2!)". All that just because one day, but that was much longer time ago, someone had the unfortunate idea (not so bad, though) of calling kilobytes (kb) a bunch of 1024 bytes. If he had chosen k2b and m2b, and call them  kitwo bytes and mitwo bytes (or kookie bytes, mookie bytes and gookie bytes), for example, all this retarded idea  of using base-1000 for all the applications and a whole operating system, and imposing it as the normal way of talking about measures in HW and SW to the peolpe, wouldn't be happening, which makes things much worse.
Comment: Actually, we're making it more logical. See, for example we use *km* when we mean 1000 meters. Why should that be different? The reason for k=1024 is performance and simplicity. It's really fast to just shift those bits instead of doing real divisions. Today however, by getting bigger and bigger numbers the discrepancy between *1024^n* and *1000^n*. While that wasn't a problem because they were virtually the same, it's starting to be really confusing.
Comment: *was taught, learned and used in all universities and almost all the industry (software and hardware) around the world, during many years.* No it wasn't. This is a myth propagated by programmers to justify their laziness. "megabyte" meant "1,000,000 bytes" in the 1960s and "kilobyte" meant "1000 bytes". Microsoft is chiefly to blame for the nonsensical and impractical 1024-based units.
Comment: @Everyone Memory naturally occurs in sizes that are powers of two, and so the binary prefixes should be used: KiB, MiB, GiB.
Comment: @endolith that's just not true. In all my degrees, KB = 2^10, MB = 2^20 and GB = 2^30. That's by definition as what the answer says. It's also what the industry uses in most instances. Storage devices are marketed with GB representing 2^30 and not 10^9. Computers work in binary, MAIN MEMORY works in BINARY and uses base-2, cache works in base-2. His answer is correct, there is no myth about any of it.
Comment: @Everyone No, it's a myth that kilo- has always meant 1024 in computing contexts. It has been used for both 1024 and 1000 since the beginning. Early computers were decimal and used "40K" for a 40,000 character core array, for instance.  Binary computers like IBM 7090 had core storage measured as "65K", not "64K". Hard drives do not occur in base-2 sizes, and accordingly have been measured in decimal multiples since they were invented. In 1968, UNIVAC specs used "megabyte" to mean "1,000,000 bytes storage", for instance. Using kilo- to mean 1024 has been deprecated since the 1990s.
Comment: @endolith fair enough, but it is still widely used in the academic world for various things. KB, MB and GB in main memory all refer to 1024 and not 1000. Storage has both used (Windows vs Linux).
Comment: @Jimmy This is the dumbest thing I've ever read.
Answer: It is indeed confusing what happened regarding the changes of designation of sizes back in 1998 and would have been much simpler if they had simply added a new set in powers of 10 as a new designation but sadly they did not do so because the reasoning at the time was centered around correcting the etymology of the word used "Kilo" so all the original sizes based on powers of 2 (1024) were all given new names and new designations and then the new power of 10 numbers assumed the pre-1998 original label names.
So let the confusion begin:
Prior to 1998, a Kilobyte meant 1024 bytes and was designated as K or KB.
After 1998, the original pre-1998 Kilobyte was renamed to Kibibyte and
given the new designation K or KiB and a brand new post 1998 Kilobyte
was created which is 1000 bytes and has the shorthand designation KB
so that today we have the following:
1 KB =  1000 Bytes   (KB cannot be shortened to K)
1 KiB = 1000 Bytes   (KiB may be shortened to K)
The designations were all amended so that KB is the official shorthand that refers to the current Kilobyte (1000) while K and KiB officially are the official shorthand designations for Kibibyte (1024).
It gets especially confusing because most of us who were around the early days long before 1998 grew up used to calling Kilobytes as 1024 bytes and writing either KB or K as the shorthand designation but today that is wrong and all of us doing this are actually referring to "Kibibytes" when we say "Kilobytes" and often using the wrong designation per officially inacted world standards set forth by the IEC back in 1998 which is confusing a bit but would not be so bad except that there is now even 18 years later many people who still do not realize that K and KB are NOT the same and are totally different.
So there really is actually a difference between "K" (1024) and "KB" (1000)!
This incidentally is also the very reason why hard drives always seem to have much less space than they advertised but the hard drive manufacturers are the ones who are correct and are using the present day proper standards when they write "Terabyte" on the packaging when the person buying the drive is actually however thinking in terms of Tebibytes and expecting space as such.
Incidentally, the difference between a 2 TB (Terabyte) and a 2 T or 2 TiB drive (Tebibyte) is a very sizable huge 199,023,255,552 bytes smaller than what a 2 T or 2 TiB drive would be and is the difference smaller of the magnitude of a little over 185 G or GiB (Gibibytes) which is what most people ironically actually think of most often when they say "Gigabyte" albeit mistakenly.
This is one of the weird side lessor known FYI's in the computer world that is a good footnote to know and explains a few of the odd discrepancies that many people today are often completely unaware.
Many people are thinking of and saying the name "Kilobyte" (1000) when they actually are thinking of the unit "Kibibyte" (1024) and it gets more confusing as people write the shorthand interchangably but this is incorrect, the modern Kilobyte should be marked "KB" and should not be "K" or "KiB" anywhere in any documentation or program which as just explained would actually refers to Kibibyte (1024).
The shorthand designations K (1024) and KB (1000) are no longer the same thing and in the case of Kibibyte, either K or KiB may be used but not KB.
This is your brain, this is your brain on Kibibytes -- fried yet?
LOL
Comment: "Prior to 1998, a Kilobyte meant 1024 bytes and was designated as K or KB."  That's a myth.  For example, the Shugart SA 400 held 109,375 bytes and [was marketed as "109.4 Kbytes" in 1976](http://www.swtpc.com/mholley/SA400/SA400_Index.htm). The CDC 9746 held 60,000,000 bytes and [was marketed as "60 M bytes"](http://bitsavers.trailing-edge.com/pdf/cdc/discs/brochures/ProductLine_Oct74.pdf) in 1974.


How can similar lightning strikes produce thunder with different time durations?

Question: Here in Florida, lightning happens quite often. On occasion, I have noticed that one bolt will discharge and its resultant boom will be very very short, and then a second later another bolt will discharge, but this time the boom will be rolling, lasting several seconds. Both bolts discharged only seconds apart, apparently from the same cloud, the same distance, same atmospheric conditions. Why? Did the first discharge somehow change the conditions through which the second discharge occurred?
Answer: Instead of a short lighten stroke, the stroke traveled through several clouds for several miles, unseen by you. This is how you might get a long rolling thunder. There could also be several unseen strokes which the thunder overlaps to sound as one.


Discrete cosine transform library in Java

Question: Is there a DCT library in Java which computes DCT in logarithmic time? I read that DCT can be computed with FFT algorithms, so there should also be a logarithmic time algorithm for dct.
Answer: You can compute a DCT by mirroring the data to double its length and doing an FFT on that double length vector.
Only the cosine terms of an FFT will be non-zero (except for numerical/rounding noise) for mirror symmetric (an even function about the center of the window) data.


List of surviving Uchiha

Question: I originally thought that the only surviving members after the Uchiha massacre were Sasuke and Itachi, but more and more seem to be revealed.  Is there a canonical list of surviving members of the Uchiha clan after the massacre?
Comment: Now it's only sasuke. But soon there will be sarada..
Answer: The following:

Uchiha Itachi - Who performed the massacre. Was killed later by Sasuke (according to his plan), then reanimated, eventually to die again (permanently, this time).
Uchiha Sasuke - Who was spared by Itachi in hopes of making him strong. Still alive.

That's about it from the traditional ones.

Madara Uchiha - Who was dead during the massacre, was also later reanimated.
Uchiha Obito also survived the massacre, in fact, he helped Itachi execute it (as Tobi).

And also

 Sarada Uchiha, Sasuke's and Sakura's daughter, also counts for the purposes of this list.
Comment: Must... not... hover... spoiler.
Comment: OK, phew.  So all this uchiha survivor stuff I'm seeing on google is just fanfic.  I thought I missed something.
Comment: I won't. :D Even if I have a (kind of defined) feeling of what it says.
Comment: itachi! is no more ! (with waterfall of tears) :(
Comment: @Alenanno: Don't, seriously, if you aren't up-to-date with the manga, don't.
Comment: try hovering in the wrong places and you will understand :P
Comment: @Sai: True, but the question is regarding who survived the massacre. Itachi did in fact survive the massacre.
Comment: oh yah yah! my bad.. I jumped to answer directly :D
Answer: Itachi Uchiha
Sasuke Uchiha
Spoiler:

 Madara Uchiha - he was alive during the obito flashback but not sure if he was still alive after the clan massacre.
 Obito Uchiha - Tobi turned out to really be Obito.
Comment: Also, sadly, I wasn't alive during the Uchiha Massacre. Tobi was already masked when he helped Itachi with his job, so it's very likely I already passed away.
Comment: I downvoted because you didn't have a spoiler mark on one of the characters you referred. If the first one had, the second one should have it to. Actually, we should assume that an answer should be readable by someone who has just seen few episodes/read few chapters, and not be spoiled. (After editing, I removed my downvote...)
Comment: You're having unexposed spoilers!
Comment: downvote reason?
Comment: i understand...
Answer: Disclaimer: most of the Uchihas mentioned below are alive currently. In the Naruto series, only Sasuke, Itachi, and Obito were still alive. In the Boruto, Sasuke and Shin, another introduced Uchiha. The other ones are Uchihas that were introduced (as alive, duh) in the Naruto and Boruto series.
Yes, all of the above answers are correct:

Sasuke Uchiha
Itachi Uchiha (dies in the fight against Sasuke)

and (SPOILER):

 3. Madara Uchiha (saved Obito who was under the tree in the 3rd Shinobi World War, probably died soon afterwards)
 4. Obito Uchiha (unintentionally fakes his death, dies in 4th Shinobi World War)

But there are still a few more that weren't introduced properly:

Shisui Uchiha (Danzo took one of his eyes, Shisui entrusted his other eye to Itachi, then suicided)
Fugaku Uchiha (Sasuke and Itachi's father)
Mikoto Uchiha (Sasuke and Itachi's mother)
Indra Otsusuki (not really an Uchiha, but the ancestor of all Uchihas)
Izuna Uchiha (Madara's brother, Madara took both of Izuna's eyes out)
Shin Uchiha (unknown until Boruto, experimented on by Orochimaru)
Other people like Baru, Naka, Naori, Rai, etc. Uchiha (important characters in the Uchiha Clan's war history).

Look, there are many Uchihas but most are irrelevant or not important to how the history of Naruto and others were affected.

List of surviving Uchiha


Experiences in Meditation: Am I stucked?

Question: I meditate (Shamata) since a few years now. According to my meditation time I have 430 hours meditated. (Just for context related to my question). I stopped smoking weed a few months ago. Practicing now daily. Around 1 hour. My concentration is far better. I realize bodily experiences – mainly feeling "light", sometimes "happy". Body / muscles are sometimes twitching mainly in spine area and nape of the neck. All in all I feel fine and realize that this is a huge motivation in meditating now. It also happens that in ordinary life I can switch (a bit) into this body mode. Fine. But I am a bit anxious, that it will stop here and I do not make further progress – except for maybe feeling better. How do I not get distracted from the ultimate goal? Should I switch now for a time into analytical meditation? But I've once read, that you should switch to this, when you have mastered Shamata for far more than an hour. I have no teacher, no meditation group or whatever. So I am asking here. What are your experiences on your path related to this feeling of "bliss" (light, in my case) I also asked, because I read, that you can be a good meditation practitioner, but it will not help you for your rebirth, if you are distracted / dwelling in this "bliss" moments. Thank you for your time. All the best
Answer:
anxious, that ... I do not make further progress... ultimate goal.

This idea of progress to the ultimate goal is a fetter. Your meditation has to be free from petty concerns like this.
Recognize this for what it is: the monkey of samsaric mind looking for a next branch to grab onto. Your meditation has to stop grasping at ideas of future existence, whether positive/desirable or frightening/undesirable.
Do not worry about the bliss that comes from meditation, in fact that's the kind of bliss that works like the soap to wash the mind, that's what the Buddha said. Enjoy it and use it.
At some point the bliss will start wearing off, so at that point do not cling to it. That's it, do not attach to the bliss when it ends. No need to worry about it when it's here. Do not cling to it nor chase it nor go against it.
The idea of Buddhist meditation is to arrive at this very open, boundlessly open mind, with no conceptual ground and no boundary conditions.
In this mind, vast and open like the open ocean, there's no ultimate goal and no attachment to any condition, including bliss. It is attained by letting go. It is much much bigger than smallish things like the ultimate goal, experiences of bliss and  suffering, concepts of birth and death.
Answer: Practicing now daily. Around 1 hour. My concentration is far better. I realize bodily experiences – mainly feeling "light", sometimes "happy".
With developing momentum in the practice, concentration is readily available. With the lightness, the first thing you're noticing here is the perception of the body begins to change. It moves from a state of solidity to one of fluidity. In my personal understanding, this could be the beginning of breaking into the first arupa ayatana where the perception of space is undermined by its potential non-perception of space, resulting in lightness of the body and eventually free-floating in boundless space, which is the opposite of your 'limited' understanding of space. The happiness is a symptom of letting go of these solid-like perceptions, which are elaborate illusions. It's not actually fully arupa, you're just knocking on the door, so to speak. When you get to the last arupa ayatana - neither perception or non-perception - and penetrate that, all ideas about space, whether limited, boundless or otherwise disappears. It took me 18 months to work through that particular phase. I then found myself at the doorstep of the 8th fetter.
The other possibility is that first jhana may be opening up for you, so bare that in mind, too. In any case, one does not need to have worked through an experiential understanding of the 4 jhanas in order to get to the arupas (formless spheres). The arupa ayatanas are all about our perception, the way we see ourselves and the world, the way the mind brings into form whatever the senses are exposed to (perceptions).
The 4 jhanas are largely about developing a familiarity with hightened rapture and pleasure - which sometimes might seem other-worldly and fascinating - such that one breaks into equanimity, the last two jhana states. My first and second jhana exploration sometimes caused my muscles to tremor, the rapture was so intense!
How do I not get distracted from the ultimate goal?
Distraction is part of the exploration. In fact, it is the disturbances that are produced by these distractions that motivate us to find answers to the human condition. Distractions won't go away, but the way in which you think about them will. In essence, all mental resistance resistance will stop.
Answer: As a starting reference, we can all consult MN10 as taught by the Buddha:

MN10:2.1: "Mendicants, the four kinds of mindfulness meditation are the path to convergence. They are in order to purify sentient beings, to get past sorrow and crying, to make an end of pain and sadness, to end the cycle of suffering, and to realize extinguishment.

There are four kinds of mindfulness meditation:

MN10:3.1: What four?
MN10:3.2: It's when a mendicant meditates by observing an aspect of the body—keen, aware, and mindful, rid of desire and aversion for the world.
MN10:3.3: They meditate observing an aspect of feelings—keen, aware, and mindful, rid of desire and aversion for the world.
MN10:3.4: They meditate observing an aspect of the mind—keen, aware, and mindful, rid of desire and aversion for the world.
MN10:3.5: They meditate observing an aspect of principles—keen, aware, and mindful, rid of desire and aversion for the world.

Finding feeling unsatisfactory (i.e., "feeling stucked"), perhaps it might be worth studying mind and principles. MN10 is a good source for study and discussion.
Answer: You need to stop doing samatha meditation and do cultivation instead. Samatha meditation is difficult. Unless you are working closely with an excellent teacher, you won't be ready for samatha until stream entry.
Cultivation is bringing up wholesome qualities. Examples are: loving-kindness, compassion, empathetic joy, equanimity, and the nine virtues of the Buddha.
Comment: @S.H  By shamata, I mean the four jhanas, which are defined as Right Concentration. You can become a sotapanna never having meditated. A sotapanna has Right View. They don't necessarily have the meditation parts of the path. Being skilled in meditation is necessary for anagamis and arahants. It's easy to misunderstand the jhanas and do them incorrectly. You either need Right View or you need a good teacher. Ajahn Nyanamoli has a similar opinion and recommends not meditating until after stream entry.
Comment: hmm, thank you very much for your answer. But I don't understand, why one could only do Shamata when reached Stream entry. because "Right concentration" is part of the 8-sold path – and I tought, that Shamata trains  "Right concentration". Best,
Comment: Anālayo cites SN 47.10 in which the Buddha states that if one is distracted and sluggish while practicing satipaṭṭhāna, one should switch one's meditation towards a calm (samatha) meditation, in order to cultivate joy and serenity.  Once the mind has been calmed, one can then return to satipaṭṭhāna.


Hide Event confirmation

Question: Under online registration tab of event setting there is a option 'Use a confirmation screen?' to show or hide confirmation page. This option is only available for free events. For paid events the option doesn't show up on screen and if you set to skip via sql or api  for the event it still show confirmation page. How can we have this option visible for paid event as well? Are there any drawbacks of not having it?
Answer: Yes you are right, the option is only available for free events. I believe some payment processor will need confirmation page(incase of paypal express) hence the option is always hidden for paid events.
You can try installing skip confirmation page extension, this should show the  Use a confirmation screen? option for you for paid and free events.
Comment: Thank you for the extension! Could you add it to the extension directory? https://civicrm.org/extensions
Comment: @bgm Sure I will

Hide Event confirmation


Block communication between hosts in the same VLAN

Question: I've a pfsense firewall with a  managed switch, and i created a VLAN: all works fine, but what i want to do is to block the communication between the hosts in my VLAN.
For example, i want that an host can't able to ping another host and an nmap scan show only the localhost and the virtual gateway.
How can i do that?
I try in this way (the first rule), but doesn't works.
Comment: Traffic between hosts on the same VLAN goes directly from host to host, not through a router. A switch is a transparent device that simply switches frames based on the destination MAC address, and it floods unknown destinations to all interfaces. There are layer-2 firewalls, but how do you place one between every device on the VLAN if the switch send the traffic direct to the destination host? Some switch vendors offer what may be called Private VLANs, but that will block all traffic between devices in the same VLAN.
Comment: Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can provide and accept your own answer.
Comment: Private Vlan configuration can help to block the traffic between same Vlan .
Answer: As has already been stated, communication between devices on the same VLAN (or layer-2 segment) does not cross a router but only the switch(es) in between the devices.
Depending on the switches' capabilities, there are several methods to control traffic within a VLAN.

VLAN-based ACLs: packets are filtered when entering a certain VLAN from a port or by layer-3 switching
port-based ACLs: packets are filtered when they are received on a certain port
port-based filtering: packet flows are limited to certain ingress/egress port combinations

ACLs work by permiting or denying certain source/destination IPs, or TCP or UDP ports. E.g. you can permit all devices within the 10.1.2.0/24 to communicate with a server at 10.1.2.10 while denying all other inter-VLAN traffic:
<code>1000 permit ip 10.1.2.0/24 10.1.2.10/32
1010 permit ip 10.1.2.10/32 10.1.2.0/24
1010 deny ip 10.1.2.0/24 10.1.2.0/24
9999 permit ip any any
</code>
Port-based filtering works by limiting the client ports to communication with the server and router ports and filtering all else. This is sometimes also called protected ports or source-port filtering where these ports are not allowed to communicate with each other. Port-based filtering doesn't work well across up and downlinks as they cannot distinguish between wanted server and unwanted peer traffic across multiple switches.
Answer: Aside from what Ron Maupin said (Private VLANs), another (sometimes better) option is to apply what is called a VACL (VLAN ACL). A VACL is different from a RACL (a router ACL), in that a RACL filters layer-3 traffic while a VACL filters layer-2 traffic, allowing you to filter traffic between hosts on the same VLAN.
Here is an example of how to use a VACL. This document is for a Cisco 6500 switch but you can adapt it to pretty much any other model.
Here is a similar document for Cisco 3850 switches if it makes it closer to what you have.
Answer: As far as your current network design goes - you can't do this with your existing pfsense box.
To do this with your current environment, you have to add something between your two clients, either by segmenting them into different VLANS, or adding some kind of extra security device.

Your network design needs to group things together that are logically the same.
For example, all accounting PCs could be in one VLAN along with their local server, and dev PCs are in another VLAN, and dirty untrusted devices in a third.
Phones are often in their own network too, as are management interfaces of switches, and security cameras.
Each VLAN has its own firewall rules in pfsense, showing where traffic may go.
There are probably nuances of your network that we don't know, so consider a whole rethink.
Short answer is to put one or other device on its own vlan and route between vlans using your pfsense box or a layer3 core switch if you have one.

Another possible option is to use subnetting.
Client A could be in the lower half of a /24 block, and client B could be in the upper half.  If each host is configured to use /25 (or 255.255.255.128) as their netmask, AND the default gateway is configured with a /24 then each client will talk to the other via the gateway.  Whether your pfsense box runs this through the interface's firewall rule or not, that needs testing.
Comment: @JesseP. Fair point - clarified that this is what OP needs to do to achieve their goals.  Have also added some thoughts about IPv4 subnetting as a possible half-arse way to do it, but this needs testing.
Comment: This answer has nothing to do with the OPs question. They asked about filtering traffic between hosts on the same VLAN (layer 2). What you wrote about would only be valid for hosts on DIFFERENT VLANs (layer 3).


How to cut a counterbore for chainring bolts with simple tools

Question: There are some 5-bolt 110mm BCD double cranks out there (FSA Tempo Adventure) that put the large ring on the inside of the spider tabs. I want to figure out a way to use whatever 110mm rings I want with them so I'm not tied to a specific, hard to get, iffy quality replacement FSA ring. What's the simplest way to cut a serviceable chainring bolt counterbore into a ring with an existing hole and counterbore on the other side?
Comment: Do you have access to a drill press aka pillar drill ?
Comment: @Criggie I do have a drill press.
Comment: I'm having trouble visualizing what what you want to do, specifically why do you need to cut a counterbore into a ring that has an existing hole and counterbore?
Comment: Because there are 110 cranks now that need the counterbore on the same side as the ramping, not the opposite side.
Comment: @Argentiapparatus I mentioned the existing counterbore in case someone had a trick to use the existing hole as a pilot.
Comment: @NathanKnutson not sure anyone will be able to answer this. When you figure it out, I will be exciting to read your answer.
Answer: What I did in the end was this:

The new chainring was a black Dimension with a pretty generously thick tab section. I actually went with an unramped one, but running it flipped wouldn't work because of its offset. Running it without a counterbore for the nut caused the chain to get stuck on the nuts when in the inner ring.
I used a countersink drill bit in a hand drill to cut away at the holes on the non-factory-counterbored side until the hole on the top surface was enlarged to the diameter needed to clear the nuts.
For grins, I tried stopping there and mounting the ring that way to see if force from the nut/bolt would be enough to squish down the material sufficiently to give the chain clearance. It didn't work.
To create the counterbore, I decided to get risky, and used my Dremel freehand with the baby endmill looking bit that came with it, which I think is a Dremel 196 bit. I carefully cut from the inside of each hole out to the major diameter, then went in a circle from there. The countersink bit took away half of the material that was in the way of me making this circle, whereas the bit going off course into where I didn't want to cut would require a lot more force, as would driving the bit deeper, so I was able to use tactile feedback to stay pretty much on course.
After getting it most of the way there, I cleaned it all up with alcohol, and colored the cut areas with a Sharpie. Having it all black again let me observe any irregularities and touch up those spots to better keep the surface for the nuts to bear against flat. I also tested that the nuts were sitting neatly just below the surface of the ring.
I mounted it all up and the counterbores worked perfectly. Because the crank in question is strange, I had to play with spacers under the small ring to work out issues with chain rub on the new large ring in more gear combos than I liked.
Comment: Great work - did you get any photos on the way through?   Or a photo of the finished item ?
Answer: First, note that there are three different bolt holes on a 110 mm circle.  There's a 5 hole pattern which is symmetric, and there are different Shimano and SRAM 4 bolt hole patterns  (...because Standards!)
Fortunately you want a 5 hole, and there's only one common 5 hole format.  (But as OJS points out, there's a 5 hole Campagnolo standard that is not symmetrical. It's likely the price of a campy part will make that obvious at purchase time!)
I would look for a countersink bit to fit your drill press, that is the correct side slope, and wide enough to make the hole at the widest end.  Ideally it will have a hex shank, not a round shank because they tend to turn in the chuck and lack concentricity.

Set a depth stop, by putting the old chainring loosely on a square of flat wood like plywood or MDF or customwood.  Its going to get holes in it so nothing special.  You may need to pre-drill a pocket or through hole under where the bolt hole ends up, for clearance.
With the countersink bit in the chuck but not spinning, lower the quill till it presses on the chainrings hole where you want to bore.  Move the chainring till it sits evenly under the bit.
At this point, set a hard stop on your quill so the drill can't go deeper.  If your machine hasn't got a stop mechanism, perhaps try to remember the angle of the handle, or even change the height of the stage so your handle is exactly level at the required depth, or cut a length of wood to stop the handle at exactly the right height.  (this is getting to the point where accuracy is going to suffer.)

Now, onto the real chainring.

Position the bare chainring under the drill press.  Use the same trick as above to locate the chainring under your bit, and clamp down the chainring to the board and clamp that to the stage of your pillar drill.  At this point, the handle won't come down as far, and that difference represents the metal to remove.
Start drilling.  You may need to play with RPM and hand pressure on the handle.  Depending on the quality of the countersink bit, you may need to go slow or fast, or with less cutting pressure.  Perhaps you may even need some coolant, a slow dribble of water or emulsified oil in water.
Also the metal of your chainring will affect things.  Aluminium will cut faster, steel will heat up which is to be avoided.   You are aiming for a smooth-sided hole, not a ribbed one.
As you drill, take frequent breaks and try a test-fit of a bolt into the hole.  It should fit as flush in the hole as it does into your original chainring.

I suggest you get a couple of cheap used chainrings from your local ebay, or community bike fixup group, and have a go at drilling them for practice.
Other options:
A center finder might help, but they tend to be for milling machines with moveable tables and are overkill here.
You may choose to make a jig, perhaps two pins that just fit through the two adjacent bolt holes.  The first lining-up would be no faster, but the remaining 4 should be quicker.

Some other thoughts:
Keep your existing original chainring as a template.  Never ever throw it out.
Another handy resource for chainring shenanigans is the Wolf Tooth BCD PDF.  Just print it at 100% no scaling, and check that the 1cm and 1inch test lines are exactly that long.  A printout can be stuck to almost anything with spray glue in a can for ease of working.
If you can't find a good chainring candidate with the right 110 BCD hole shape, you may get away with drilling 5 holes around a 4 hole chainring,  However you need enough metal to do the job, which might be hard to find.
Finally, if all this sounds too much, there's absolutely no shame in taking the job to a machine shop and explaining what you need.  They would probably use a fancy endmill with the same side slope, and run it in a milling machine, perhaps even on a rotary table.  It would take longer to explain to them, than it would for them to do the set up.  I bet the drilling would be done in a couple minutes tops and won't cost the earth.
What NOT to do - this:
Comment: You say "countersink bit" but the chainring bolts I'm used to expect a flat-bottomed counterbore with vertical sides, so you'd *need* an end mill (if you can get the right diameter you could use it in a drill press) rather than an angled countersink bit.  On alloy you might get away with grinding the end off a drill if you can get it square enough, but that's nasty.
Comment: Very good. For completeness' sake, Campagnolo has some 110mm 5-bolt cranks where one bolt is slightly offset.
Comment: I've only seen a bolted chainrings, so don't know if they're all the sane, but as they're thin it makes sense for the holes to be flat-bottomed. The one I changed the other day wouldn't have had any metal in the right place to drill new holes big enough, but others would
Comment: I love the ghetto solution in the photo!  No problemo if nasaman got them concentric.
Comment: Nathan, the counterbore is so shallow it may not even be necessary for your chainring bolts to work just fine. Consider the downside of strength loss due to having the counterbore on both sides. Also, if you're using a new chainring the teeth are symmetrical so why not just flip the whole ring back to front?
Comment: @ojs thanks - have included that info now too.  I wasn't aware, prob cos I can't afford to ride Campag parts, and they're super rare here, never showing up in the donation stream.
Comment: @ChrisH sorry I made the assumption it was sloped.  On that basis, perhaps it would be better to drill 5 new holes and then use the flat-bottomed endmill to "route" the shelf.  If the same hole had steps on both sides, it might start to get a bit thin at the bottom.
Comment: @HenryS shifting ramps and pins will only be on the "inside"   Excellent point about not bothering the bore - some longer chainring bolts may be perfectly sufficient.  I think that point is worthy of its own answer, cos it addresses the desired end result.  Feel free to add it as a new answer.


Write File to Sharepoint Online WinRT

Question: I have recently been working on developing a winRT app that will allow someone to enter information on to a form. I am trying to then upload that form to SharePoint online as part of the Office 365 suite. I have been unable to find any examples or real documentation on how to do this. Has anyone found anything close to this online? Any help would be much appreciated.
Answer: You should be able to do an HTTP put from your WinRT app to your SharePoint online web services.  Here is a list of the Web Services and interfaces.  Here is a sample of how to call RESTful web services from a Windows Store style app.

Write File to Sharepoint Online WinRT


Flex a square into a circle, and prove...

Question: Let points $A$, $B$, $C$, and $D$ be the vertices on a square. Let $\overline{CD}$'s midpoint be $E$. Flex the square into a circle (so they'll have equal perimeter/circumference), and translate the circle so it touches point $E$ (i.e. if $\overline{CD}$ is the bottom line, then translate the circle up). Prove or disprove whether the points $A$ and $B$ will lie inside the circle or not. Using graphing tools I've determined that points $A$ and $B$ do lie inside the circle, but not by much. Need a nice, simple proof though. Thanks.
Comment: By flex the square do you mean construct a circle tangent to the side at E with circumference equal to the perimeter of the square?  You might as well let the square be a unit square.  Can you compute the radius of the circle?
Answer: Suppose for computational convenience that we begin with the square centered at $(0,0)$. Since a circle is all points a certain distance (the radius, which I'll call $r$) from its center, you want to show that $(x_A-x_{newcenter})^2 + (y_A-y_{newcenter})^2 \le r^2$. Since the circle and square are symmetric, A and B really present the same problem and I'll only do the one in the first quadrant.
If the square has sides of length $s$, then the coordinates of A are $(s/2,s/2)$ and the perimeter is $4s$. The circumference of the square is $2\pi r$, so $r=\frac{2s}{\pi}$. Then we have to find the new center. The new center is at $(0,r+y_E)=(0,\frac{2s}{\pi}-\frac{s}{2})$ since it's a distance of $r$ directly above E. Now just plug everything back into the inequality and divide through by $s^2$ - we're trying to show that $1/4+(1-2/\pi)^2\le 4/\pi^2$. That's just a matter of calculation.
In fact, I end up with $5\pi \le 16$ at the very end. Yep, just barely.


Moneyness, implied volatility and option greeks

Question: I know that the more an option is ITM, the more is the implied volatility. I would like to deep dive into the concept, what is the logic that drives this statement? Also comparing an option with a higher delta to one with a lower delta, why the one with higher delta will have a lower vega? The explanation that I found is that options  that  are  deeper  ITM  have  a  lower  vega  exposure,  because  with  higher volatility, a large stock price move in both directions is more likely. Since a deep ITM option is likely to be exercised, the payoff may increase or decrease. In contrast, an ATM option (lower delta) needs volatility to have any chance of ending in the money. Due to the asymmetric payoff of the option, an increase in volatility is very beneficial for such options. Hence, they have higher vega. What I do not get is "hence they have a higher vega", why is this 100% true?
Comment: "the more an option is ITM, the more is the implied volatility." Implied vols are a function of prices, which are driven by the market; there is no fundamental reason for IVs to be different across strikes other than reality not lining up with a constant-vol pricing model. So your question should be "why do people pay more for options that are ITM"
Answer: For the first question:
The differences in IV across strikes is largely due to the market having a different view on potential movements than a constant-volatility model (like Black-Scholes) would imply. For example, the market may think that large downward movements are more likely that large upward movements, so they may be willing to pay more (relative to intrinsic value) for lower strikes than higher strikes, which would mean a higher implied volatility for lower-strike options. Or, they may be willing to pay more for ITM options as a way to create leverage - they pay less than the spot price for an option that has a very small chance of not paying off. There are just theories; since the differences in IV are market-driven, they depend on motivations that cannot be definitively quantified.
For the second question:
Vega is the sensitivity to volatility, meaning how much does an extra 1% of volatility affect my option price.
Option values have two components. The intrinsic value (how much the option would be worth if exercised now) and time value (how much extra you pay for the benefit of optionality between now and expiry).
With deep TIM (high delta) options, the time value of the option is very small, because the probability of the spot crossing the strike and making the option worthless is much smaller. Therefore, the volatility has a much smaller impact on the value. For example, if a stock price must double to cross the strike, it doesn't matter much if the volatility is 20% or 30%, the probability of that big of a move is very small.  On the other hand, an ATM option (delta=50) with a higher volatility has roughly the same probability of crossing the strike (50/50). but the possible positive outcomes are better, meaning that there the probability of a larger increase is higher with higher volatility.
Put short, with deep ITM options, the fate of the option is largely decided, so volatility is less of a factor. For ATM options, the probability of better results is higher as volatility increases (the "bell curve" of future prices flattens).
Comment: Thank you very much, this has huge explanatory power. Essentially it is important to understand that both gamma and vega are normally high for ATM options.


A characterisation of Hamiltonian vector fields.

Question: Let $(M,\omega)$ be a symplectic manifold and let $X\colon M\rightarrow TM$ be a vector field on $M$.

Theorem. The vector field $X$ is Hamiltonian if and only if the following two conditions are fulfilled:

If $(\phi_t)_t$ is the flow of $X$, one has ${\phi_t}^*\omega=\omega$,

For all loop $c\colon]-1,1[\rightarrow M$, one has $\displaystyle\int_ci_X\omega=0$.

Proof. Let us proceed by double implication.

Assume $X$ is Hamiltonian, then there exists a smooth map $H\colon M\rightarrow\mathbb{R}$ such that:
$$i_X\omega=\mathrm{d}H.$$
Therefore, the differential form $i_x\omega$ of degree $1$ is exact and its integral vanish on all loops drawn on $M$. Furthermore, using Cartan's formula for the Lie derivative and since $\omega$ is closed, one gets:
$$\frac{\mathrm{d}}{\mathrm{d}t}({\phi_t}^*\omega)_{\vert t=0}=0.$$
I do not know how to deduce that ${\phi_t}^*\omega=\omega$. If I use directly the definition of the pullback, I get:
$$({\phi_t}^*\omega)_x(v,w)=\omega_{\phi_t(x)}(\mathrm{d}_x\phi_t\cdot v,\mathrm{d}_x\phi_t\cdot w),$$
which does not look to promising.

I will assume that $M$ is connected (is it necessary?). Assume that $X$ fulfils the two given conditions, let $m\in M$, for all $x\in M$, I would like to define:
$$H(x):=\int_{c_x}i_X\omega,$$
where $c_x$ is any path from $m$ to $x$. According to the second condition, the result will not depend on $c_x$. Therefore, the only difficulty is to choose it so that $H$ is smooth and I don't know how to proceed.

Whence the result. $\Box$
Any enlightenment will be greatly appreciated.
Answer: $$\frac{\mathrm{d}}{\mathrm{d}t}({\phi_t}^*\omega)_{\vert t=t_0}=\phi_{t_0}^*(\frac{\mathrm{d}}{\mathrm{d}t}({\phi_t}^*\omega)_{\vert t=0}).$$
 implies that $\phi_t^*(\omega)$ is constant and is equal to $\phi_{0}^*(\omega)=\omega$ since $\phi_0^*$ is the identity.


Prove that if a rectangle's sides are all odd, then it's diagonal is irrational?

Question: In trying to write an alternate and simple proof that at least one leg of a right triangle is a multiple of 4 using Dickson's method of generating triples, I came across quite an interesting observation that ifall the sides of a rectangle is odd, then it's diagonal is irrational. For example, consider a rectangle of length 5 units and breadth 3 units. It's diagonal,by the Pythagorean theorem is 34^0.5, which is irrational. This is the same for lots of rectangles. Is there a general proof for this, or can this whole thing be disproved?
Comment: Basically speaking, I am asking whether the sum of 2 odd perfect squares is an even perfect square...
Answer: $$(2a+1)^2+(2b+1)^2=4a^2+4a+4b^2+4b+2=2(2c+1).$$
This number cannot be a perfect square as its prime factorization includes $2^1$.
Answer: If the sides of the rectangle are integers, then the square of the length of the diagonal is also an integer since
$d^2 = l^2 + w^2$
and the integers are closed under multiplication and addition.
The only integers that have rational square square roots are perfect squares.  Since
$d = \sqrt{l^2 + w^2}$
the length of the diagonal is irrational unless $d^2 = l^2 + w^2$ is a perfect square.
If an integer is a perfect square, then it is either the square of an even number or an odd number.
If the diagonal is an even number, then $d = 2k$ for some $k \in \mathbb{N}$, so $d^2 = (2k)^2 = 4k^2$.
If the diagonal is an odd number, then $d = 2k - 1$ for some $k \in \mathbb{N}$, so $d^2 = (2k - 1)^2 = 4k^2 - 4k + 1 = 4(k^2 - k) + 1$.
Hence, the square of any integer will have remainder $0$ or $1$ when divided by $4$.
If both the length and width are odd numbers, then $l^2 + w^2$ has remainder $2$ when divided by $4$.  To see this, suppose that $l = 2m - 1$ and $w = 2n - 1$, where $m$ and $n$ are positive integers.  Then
\begin{align*}
d^2 & = l^2 + w^2\\
    & = (2m - 1)^2 + (2n - 1)^2\\
    & = 4m^2 - 4m + 1 + 4n^2 - 4n + 1\\
    & = 4(m^2 - m + n^2 - n) + 2
\end{align*}
Since $d^2 = l^2 + w^2$ has remainder $2$ when divided by $4$, it is not a perfect square.  Thus, $d = \sqrt{l^2 + w^2}$ is irrational.
What I have not shown is why the only integers that have rational square roots are perfect squares.  It hinges on unique factorization.  You can show that $n$ is a perfect square if and only if each prime in its prime factorization appears an even number of times.  For example, $$144 = 2^4 \cdot 3^2 = (2^2 \cdot 3)^2 = 12^2$$ while $12 = 2^2 \cdot 3$ is not a perfect square.  If $n$ is not a perfect square, then some prime in its factorization must appear an odd number of times.  Suppose $n$ is not a perfect square and $$\sqrt{n} = \frac{r}{s}$$ where $r, s$ are integers with $s \neq 0$.  Then
\begin{align*}
n & = \frac{r^2}{s^2}\\
ns^2 & = r^2
\end{align*}
If $p$ is a prime that appears in the prime factorization of $n$ an odd number of times, then its appears in the prime factorization of $ns^2$ an odd number of times, while it appears in the prime factorization of $r^2$ an even number of times, a contradiction of unique factorization.
Comment: Could you please elucidate this answer? I feel its right, but simpler things are always understood better...
Comment: I have edited my answer.  Since I do not know your mathematics background, I left the hardest material to the end.  In the final paragraph, I outlined a proof of why $\sqrt{n}$ is irrational if $n$ is not a perfect square.  To give a complete proof, I would have to employ a number of results from elementary number theory that depend on unique factorization.
Answer: If a and b is odd then $a^2= 1(mod 4)$. Thus, if a,b are odd, $a^2 +b^2 =2 (mod 4)$. If c is even,then $ c^2=0 (mod4)$. If c is odd, $c=1 (mod4)$. Therefore, $a^2 +b^2$ cannot be a perfect square, which implies that its square root is irrational.
Answer: Suppose $c^2 = (2a+1)^2+(2b+1)^2=4a^2+4a+1+4b^2+4b+1=4(\ldots)+2$. So it's an even number not divisible by $4$.
But if $c^2$ is divisible by $2$, then $c$ has to be even and therefore $c^2$ is divisible by $4$. This proves it can't be a square of an integer.
If $c$ were rational, but not an integer, then $c^2$ is also a rational number which isn't an integer, so we don't need to worry about that.
Answer: I Think there is an answer to this here, since I posted a comment which explains the question in a line: prove that the sum of two odd perfect squares can never be a perfect square.
This one is similar to the one that Yves Daoust posted.
We will obtain a result: 2 * [odd number]. Even if we assume the odd number to be a perfect square, we have a 2 over there.
Thanks,
S Sandeep.


Automatically turn bluetooth on or off depending on current network (MBP running Lion)

Question: Is there any way to automatically turn Bluetooth on or off when my MacBook Pro (mid-2010, running Lion) joins specific networks? I typically want Bluetooth off except when I am connected to my home wireless or wired network. It would be really handy if I could configure Bluetooth to turn on whenever I join my home network(s), and likewise, turn it off when I join a non-home network.
Answer: ControlPlane is a supported development based on Marco Polo.
Comment: Developer has stopped working on it, see https://www.controlplaneapp.com/2017/11/03/the-state-of-controlplane/
Answer: Once upon a time I was using the free app Macro Polo to do location-aware configuration changes on my MBPro. Sadly, it's not been supported or developed since Snow Leopard. It's still available to try though and it might work well enough on Snow Leopard or Lion to meet your needs. Worth a shot, costs you nothing but time really.
Locations 3 in the MAS purports to do all of the same things as Marco Polo. Included in the list of things it can change is enabling and disabling your BlueTooth radio. I haven't used it though so I can't speak to how well it works. If it's half as good as Marco Polo, it should be pretty useful.


Running Multiple Full Nodes on 1 Machine

Question: When the potentially incentivized CarrIOTA Field nodes become a reality, is it possible (or does it make sense) to run multiple nodes on 1 machine? For example, spinning up a large cloud VM and then running as many nodes as possible on it.
Answer: Yes, it is possible. But you need to expose other ports on the same host. But I think it's not really useful. (If you don't have different IP addresses) I would recommend to have them on separated hosts and running other services on the same node. It just makes you way more fault-tolerant if you use separated hosts and racks.
It seems like I/O is a issue on full-nodes. So, smaller nodes with their own SSD/HDD should give you a better overall performance. I'm currently working on IRI/Nelson on Kubernetes with IPv6 only and ARM processors.
Comment: if there are no bandwidth issues, then doesn't running multiple nodes on the same machine help the tangle in the same way as separate full nodes?
Answer: I tried running both Shimmer and Shimmer Testnet on the same server and failed. Separately, each worked, but both did not. I had different ports on each Node, that was not the problem. Docker was reporting a duplicate image name when running the second Node. Later, I had little time to delve deeper into the problem.


Optics of thick soap bubbles

Question: There was some discussion in a previous thread ( Why are thin soap bubbles colorless? ) that talked about thin soap bubbles. My question is, what if we go the opposite way? Why are thick bubbles colorless (or less colorful than thin/ "normal" bubbles)? What physical principles come into play in this case?
Comment: If so I think this is a duplicate of [Is manufacturing roughness really the only reason we don't see optical interference in thick dielectrics like windows?](https://physics.stackexchange.com/q/141530/)
Comment: Do you mean why don't we see interference fringes from thick walled bubbles?
Answer: Thes question has to be the other way: Why are thin bubbles colorful? A thick material like a window glass is colorless too.
A thin bubble acts the same was like a thin layer of oil at water. If the thickness comes in the range of the wavelength of light, there are intereference effects. There are two reflections from the bubble from both sides. If the thickness is a multiple of half the wavelength, both waves are superimposed and reinforced.
Answer: Here is an image of a soap film which is thinner at the top than at the bottom due to the soap solution moving downwards under the influence of gravity.
The film is viewed using white light as the water drains down and the film gets thinner and thinner at the top.

At the top the film is "black" because there is no reflected light or rather the reflected light from the two surfaces which are very close together differ in phase by $\pi$ and so interfere destructively.
Lower down the path length between the two surfaces is such that constructive interference can occur.
You will note that the colour of a fringe at the top is blue and it is red at the bottom because when going down the thickness of the film is getting larger and blue light which has a shorter wavelength than red light needs a thinner thickness of film to exhibit constructive interference.
However, the fringes lower down become less distinct because the thickness for the constructive interference for one wavelength is such that destructive interference occurs for another wavelength - there is no evidence of destructive interference after two fringes.
This overlap of fringes for different wavelength becomes greater and greater as the thickness of the film gets larger and larger until eventually no fringe pattern is seen and the light which is reflected is "white".
Here is an image to show what would happen if only three wavelengths were present.

The other parameter which comes into play is the "flatness" of the surfaces of the object which is doing the reflecting.
Even a small deviation from flatness of a few wavelengths will affect the interference pattern that is observed.

Optics of thick soap bubbles


2 videos out of sync

Question: I recorded myself using my camera (canon ixus 117hs, 23.98fps) and also recorded my LG G3 using AZrecorder (records the screen at 55.58fps). I tried to sync both videos (using premiere pro cc) and at some point they go out of sync, maybe because of the difference in the fps? and if so, what can I do with it? Thank you.
Comment: If they drift gradually out of sync after you sync the beginning, probably your camera and computer have a different idea of how long a second is.  You need to stretch one or the other of the videos.  (stretching the one without audio is going to be simpler.)  Why 55.58fps, though?  Your monitor refresh isn't really that far off 60Hz, is it?  Mine are both about 59.9Hz.
Comment: I had this problem recently with premiere and spent an entire day trying to sync my videos. Were your videos variable frame rate? Adobe Premiere doesn't support variable frame rate videos. When you try to use them, they eventually go out of sync.
Answer: 55.58 is not a standard frame rate so it's the one that should be changed. Using the 23.98 video as a reference, pick a point late into the video where you can determine how many frames (at 23.98 fps) it's out of sync with the 56 fps video. Compute the ratio of the length in frames up to that point, to the number of frames out of sync. Then time stretch the entire 56 fps video --  either shorter of longer as needed -- using that ratio.
Comment: I didn't understand what to do, by the way, I tried to change the speed of the video and it fit well but after a while it goes out of sync again
Comment: Do you mean that the total lengths match, but it goes in and out of sync, or what exactly? If the 56 fps isn't a constant rate, then you might end up applying a different speed change for each section that's out of sync.
Comment: I don't know because the video from the smartphone is really long and the video from the camera is divided to 10 minute parts

2 videos out of sync


Computer going to sleep/hibernation when not wanted win 10 1909

Question: My Desktop computer keeps sleeping/hibernating when ALL settings are set to never and standby (53) is all that is enabled. I have updated my display driver, monitor drivers and any others I can find.
It goes to sleep (I believe) then if left too long the monitor goes into standby and I have to reset the computer to get it to restart and continue.
Motherboard = Gigabyte H55N
Processor = Intel i5 760 @ 2.80ghz 4 core
System = x64- based PC
OS win 10 home 64bit ver 1909
Answer: Windows 10 64-bit
How to keep Windows 10 from going to sleep when all power management settings are set to never sleep:
Sleep and hibernation are not the same thing. You've taken the wrong approach.  You've assumed there is a defect instead of giving your OS a reason the stay awake.  Give your OS a reason to stay awake.
One task I do writes to memory for two hours. That activity does not prevent Windows 10 power management from applying "inactivity" rules.  If I include a periodic ping request in the task inactivity rules are not applied and the PC is not put to sleep.
Answer: You can use Wakeful, It keeps you PC active. It's free and portable.
https://www.loopandkey.com/wakeful


Why do NES sprites flicker when there are a lot of them?

Question: Sometimes, NES sprites flicker when there are a lot of them, like at 1:19 in this video of Super Mario Bros.  Why did they do this?
Answer: The Picture Processing Unit (PPU) in the NES can only draw 64 sprites per frame and 8 sprites per horizontal line (scanline).  If the game tries to draw more than that, some of them will be invisible.
It could ruin the game if enemies became invisible because there were too many of them, so the developers programmed the games to change the order of sprites in the sprite list.  Instead of some sprites always being invisible, the invisible sprites change every frame, causing the flicker effect.

The PPU stores the list of sprites in a a 256-byte area of memory called the Object Attribute Memory (OAM).  Usually, games keep the sprite data in the program RAM and DMA it to OAM every frame.
The PPU also has Secondary OAM, a 32-byte memory area where it stores OAM entries for sprites that will be visible on the next horizontal line of the picture (scanline) and eight internal registers that store bitmaps, positions, and attributes for sprites that are visible on the current scanline.
Because primary OAM is 256 bytes, and each sprite takes 4 bytes, the PPU can only draw 64 sprites per frame.  Because secondary OAM is only 32 bytes and there are only 8 sprite registers, the PPU can only draw 8 sprites per scanline.  If there are more than eight sprites per scanline in OAM, only the first 8 will be drawn -- the rest will be invisible.
Comment: I remember that this would get really bad in the original Legend of Zelda game.
Comment: NobodyNada, It seemed to me that this doesn't happen in newer NES games. Maybe I'm wrong. Did they eventually find a way past this sprite limitation?
Comment: @LateralTerminal No, there's not really a way to work around the sprite limitations.  Later games might have improved sprite management by, for example, using less sprites in general, placing them on the screen so as to prevent too many sprites from being in the same scanline, or combining background and sprites like the lasers in Quick Man's level in Mega Man 2.  Do you have an example of a specific game?
Comment: @NobodyNada: Some games may also use "background tiles" to mimic the appearance of sprites in cases where many objects on a horizontal line are moving in the same speed and direction, and there isn't any other background.
Answer: There are a fixed amount of memory cycles for the PPU to read the sprite data on each scanline; once those are exhausted, no more sprite data will be fetched.
As NobodyNada said, programmers would rotate the order in the list to make sure that the user would see all the sprites.
The technique was also used on other systems that didn't work the same way, but sprites were rotated to give the illusion of having more objects on screen. The Atari 2600 did that a lot (Joust is a perfect example of this where the birds constantly flicker). On the Intellivision, it was forbidden by Mattel since they wanted the Intellivision to showcase a better visual quality than the competition.
Comment: Ah, that's why they put 8 sprite registers in there.  I knew there was a constant amount of time for sprite fetches, but somehow I never realized that it's just enough time for 8 sprites.
Comment: yes, essentially as soon as the hblank is triggered, there is a fixed amount of cycle until the display starts again; during that time the bus was used to fetch data and then it stops when video scanning restarts; quite a few video chips have a similar system
Comment: @NobodyNada-ReinstateMonica: There are enough fetches from display memory to process eight sixteen-pixel-wide sprites, but the data registers and shifters are only 8 pixels wide.  A bit of a shame in retrospect, given how many games use doubled-up horizontal pairs of sprites.  The cost of expanding the data registers and shifters would have been cheap compared to the cost of doubling everything for the sprites, but the benefits would have been almost as great.
Comment: @supercat It's true there's enough H-blank cycles to read 32+1 bytes (2 bytes per 8px), and the sprite shift-registers could've been 16px, but this would've added a lot of transitors. It's because Nintendo simplified the VRAM controller by hardcoding it as a 4-step tile fetcher. The only way to access VRAM is to let it read a tile index, then the palette, then 2 pattern bytes which go into a buffer. To read sprites the PPU allows an undefined part of the tilemap to be read, then uses a tiny escape hatch to overwrite the calculated address so that it fetches the desired sprite instead.


Modeling problem with edgings

Question: How to make such edgings? I have tried to just adding additional loops but I got bad result
Answer: Simple answer: model them.
There are many different kinds of seams on various furniture so it is essential to have good reference photos and see clearly how they look so you can then decide what will be the most appropriate method for modelling them. The ones in the picture seem to be simple piping seams. If you Google 'piping seam', you can find pictures and even videos how they are actually made and see that it is basically exactly what is sounds like - just a pipe going around, that is sewed into the seam to hide it.
I would recommend to model furniture with correct peaces of fabric so there will be seams on your models in the places there would be seams in reality. This helps with texturing and if you have UV seams already marked it is very easy to select them in edit mode with shift+g > Seams. Once selected you can duplicate them with shift+d and separate them with p > Selection. Then you can hit alt+c and convert the edges to curves. Once you have curves it is very easy to make pipes out of them just adding some bevel and adjusting it's resolution in the curve tab in the Properties Editor:

You could also use another curve as a bevel object if you needed a more complex form. Also because you now have them as curves, you can use more complex geometry and deform it with Curve modifier to follow the shapes of these curves. This way you can model various complex patterns for classical furniture:
Answer: I guess it depends on the degree of detail you want, if you need something simple you could do it this way:

Duplicate the edges, separate them from the object with P and convert them to Curve with alt C.
Create a new Curve > Circle.
Select your edge curve and in the Properties panel > Data > Geometry, choose the circle as Bevel Object.
Change the circle dimension or shape until you're satisfied.
If needed, convert your edge curve to Mesh

If your profile is more complexe than a simple circle, create a segment, give it an Array modifier and a Curve modifier with your edge curve as the Object so that your segment will follow this curve.
Comment: If it's a simple circle you are using for a bevel, a separate bevel object is not needed. The default curve bevel makes a circle. Saves a few clicks and then you don't need to have circle floating somewhere.
Comment: sure, but if you want to slightly change the shape  ;)  + this is not the main point of this solution
Comment: + you need to choose Fill > Full, Bevel > Depth, Bevel > Resolution
Comment: Good point. Who would use a bevel with half fill and 0 resolution?.. It would be nice to have defaults that make more sense...

Modeling problem with edgings