How to check if four points form a rectangle

Question: I am working on a shape recognition app. At this moment a set of points (x,y) is determined by corner detector (red points, img. 2.). Four of these points (in red frames, img. 2.) are vertices of a rectangle (sometimes a little deformed rectangle). What would be the best way to find them among others?
Here is an example of an input image:

And it looks like this after corner detection:
Answer: This is not an answer to your question - it's just suggestion.
In my opinion corner detector is a bad way to detect rectangles - it will take much time to calculate all point distances as mathematician1975 suggested. You have to use another technique in this situation:

That stamp is violet color, so first thing you should do is color segmentation.
After you've done with step 1 you can use Houhg transform to detect lines on binary image. Or find all contours in image.
And the final step is to detect rectangle.

Update:
Here's another solution that should also work in gray images.

Do a threshold to convert image to 1bit (I used 200 from 255 as threshold).
Find all contours in new image which have area bigger than some constant (I took 1000).
Find bounding rectangle for each contour and do a check:

ContourArea / BoundingReactangleArea > constant

I take this constant as 0.9.
And this algorithm gave me next result:

Here's OpenCV code:
Mat src = imread("input.jpg"), gray, result;
vector<vector<Point> > contours;
vector<Vec4i> hierarchy;

result = Mat(src.size(), CV_8UC1);

cvtColor(src, src, CV_BGR2GRAY);
threshold(src, gray, 200, 255, THRESH_BINARY_INV);
findContours(gray, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0));

result = Scalar::all(0);
for (size_t i=0; i<contours.size(); i++)
{
    Rect rect = boundingRect(contours[i]);
    if (rect.area() > 1000)
    {
        double area = contourArea(contours[i]);
        if (area/rect.area() > 0.9)
        {
            drawContours(result, contours, i, Scalar(255), -1);
        }
    }
}

Comment: Yeah, as you pointed out calculating all distances consumes a lot of time even for _small_ input image. I have already checked that solution.

Color segmentation would not be useful with grayscale images (examples are a bit confusing, sorry) but I used it for RGB ones.

As for the Hough transform I did some tests and it works pretty well, but the detected lines **do not** intersects with each other as shown here: [hough](http://i.imgur.com/NP8HT.jpg).
Comment: This work pretty well in most cases so I am going to mark it as answer. However in some situations it fails because there is no closed area. Morphological operations come in handy then, but for almost each case they need different parameters, which makes them not so useful. Any ideas how to solve that problem? Here is an example of such situation: [click](http://i.imgur.com/mY27w.jpg)
Comment: @HighPerformanceMark you can use [minAreaRect](http://opencv.willowgarage.com/documentation/cpp/structural_analysis_and_shape_descriptors.html#cv-minarearect).
Comment: Indeed, but that's not what your solution does.
Comment: @sowizz what about changing threshold to 210? Or threshold can also be different in different situations?
Comment: @HighPerformanceMark Yes, but if you take extreme points of contour area you can draw lines  on image and then fill created holes inside of that area.
Comment: @Astor, threshold level takes values from 80 to 230 in other documents.
Comment: @sowizz so you use Otsu threshold? Or some constant every time?
Comment: I just got 10 images for testing, so I change it manually until it gives any results.
Comment: @sowizz I mean do you set it for each image manually or you set one constant for all? If you set manually than use needed threshold (in that case 210 is acceptable).
Comment: I set it manually for each image, it can't be done with one constant value for all, because in same cases there won't be any data to process (too high/low thresh).
Comment: So setting correct value will fix that issue with [this image](http://i.imgur.com/mY27w.jpg), isn't it?
Comment: Yes it will, the problem is that the app should work without user input, so I will need to find three most common values for thresh and change it if there is no output area. This means additional computations, but should be alright. Thanks for help.
Answer: Calculate the set of 6 lengths that you will have between each pair of 4 distinct points. Within that set of 6 lengths if there are more than 3 distinct values, you do not have a rectangle (2 equal side lengths plus equal diagonal lengths)
Comment: WAIT A SECOND. You said you have FOUR points, not 2500. This answer tells you if FOUR points form a rectangle, and seems a valid solution for that task. If your problem is not as you describe, then you need to be more specific.
Comment: You can reduce the complexity a bit. First you could consider just 3 points - which need to be an right triangle (maybe use Pythagoras). Second for the fourth point in many cases it will be enough to calculate just one distance to exclude it.
Comment: Good solution, but not really useful in this exact problem. Calculating all distances takes a lot of time even if there is 100 points and I usually get around 2500.
Comment: Yeah, but also said that these four points are not the only ones and I need to find proper points first.
Comment: @sowizz I see - perhaps you could clarify the question a little as the question title itself asks for a way to detect rectangle from 4 points, not 4 out of an arbitrary number.
Answer: You are aware that by visually inspecting the point cloud you can already distinguish a multitude of rectangles? In other words, you will likely find many rectangles if you don't do a sort of pre-selection routine...
Anyway, aside from the method already given by @mathematician1975, you can also just check if the sides are (more or less) parallel.
Let's call @mathematician1975's method method 1 and parallel-check method 2.
Then:
%# method 1:
n1 = |u1-u2|    %#  3 sub., 3 mult, 2 add. per distance
n2 = |u3-u2|    %#  total of 6 distances to compute.
n3 = |u4-u3|    %#  then max 5+4+3+2+1 = 15 comp. to find unique distances
n4 = |u1-u4|
n5 = |u4-u2|    %#  Total:
n6 = |u3-u1|    %#  12 sub., 18 mult., 12 add, 15 comp

%# method 2:
w1 = u1-u2       %#  3 subtractions per vector
w2 = u3-u2       %#  total of 4 vectors to compute
w3 = u3-u2
w4 = u1-u4
                        %#  12 sub.
abs(w1-w3) == [0 0 0]   %#  3 sub., 3 comp., 1 sign.
abs(w2-w4) == [0 0 0]   %#  3 sub., 3 comp., 1 sign.

                        %# Total: 18 sub., 6 comp. 2 sign.

Note that these are both worst-case; with a bit of bookkeeping you can drastically reduce the cost of both.
Note also that method 2 needs to know beforehand that the vertices are already in the right order. If this is not the case, it'll increase the cost by a factor of 4, which is more that method 1..
May I ask how you are computing the distances?
Comment: @sowizz Try `norm` -- it should be a lot faster. Or, if you want, just leave out the square root -- comparing distance squared or distance doesn't matter. Or, use city-block distances: `abs(x2-x1) + abs(y2-y1)`. This will give a very rough but *way faster* approximation to the distance, that, in case of a rectangle, will also have to be equal.
Comment: Yes I know that having that amount of points will form a lot of rectangles, but I am not sure if there is anything I can do about it at this stage (later on I will calculate some statistics that would allow me to choose only proper rectangles).

The distance between two points is computed as Euclidean distance:
`distance = sqrt( (x2-x1)^2 + (y2-y1)^2 );` and I'm not sure if it is 2500x4, because you have to choose one point, then another 3, compute distances, then for the same fist point you choose another 3 points (different than the previous ones) that is way beyond 2500x4 combinations.
Answer: Consider you should have got number 8 but you got number 7, then you are going to add number 1 (called delta or error correction) to correct it.
In a similar manner have a delta rectangle coordinates to correct the rectangle. Check that point(coordinate) falls inside delta rectangle.
The rectangle coordinates are as mentioned below:
x+delta,y+delta
x-delta,y+delta
x+delta,y-delta
x-delta,y-delta

Let me know if this works fine for you or if you find a better solution


How will we invite the Shekhinah?

Question: Is there a tradition brought down about what we will do to invite the Shekhinah to rest once we have completed and inaugurate the Bayt Hamikdash?
Comment: (1) What did we do to invite the Shekhinah to rest once we completed and inaugurated the previous Batei Mikdash? (2) Why wouldn't we be able to do any of those for the next Bayt Mikdash? (3) Will we need to [do anything to] invite the Shekhinah to rest once we have completed and inaugurate the Bayt Hamikdash?
Answer: If I'm understanding your question correctly, there's at least one tradition that the Shechina is still with the various communities of Jews in exile, and just returns along with them. Megillah 29a, Yerushalmi Taanit 1:1. Shemot Rabbah 2:2 contains a dispute between R' Shmuel bar Nachman and R' Eliezer about whether the Shechina departed to heaven after the destruction of the temple or whether it stayed there: the Midrash seems to decide against the first opinion and say that it is still present at the Western Wall today.
The Tanya Iggeret Hakodesh 25 explains that exile involved drawing down the innermost parts of holiness (which Israel is attached to), into the lower parts by which the Shechina always sustains the nations, thereby strengthening them further. In Likkutei Torah, Re'eh 19c, the effect of this is that, although the Shechina is now hidden in the form of exile, we can still unveil it when we withstand the trials of this exile. These trials are described in Gevurot Hashem 40.2. See also Derekh Mitzvotecha, Maamar 16:2. Earlier, the Maharal says, this is reflected in the fourth parshah of tefillin/kriat shema "Vhaya im".
Instead of the idea that "we will do" something to bring the Shechina, the Zohar Emor III:90b explains that, because the Shechina, the presence of Hashem, moves out of exile with us, the redemption is both dependent on and belongs to Hashem, not Israel.

How will we invite the Shekhinah?


How to install powershell as a prerequisite?

Question: I am using Visual Studio 2010 setup project
Answer: I don't think you are allowed to redistribute PowerShell.  And at any rate, it is built in to Windows 7 and Server 2008 R2.  All the other platforms have separate installers as well.  I think it would be best to just notify your customers that they need PowerShell 2.0.
Answer: I had a similar problem in the StudioShell installer - wanted to make sure PoSh 2.0 is installed.  I did a cursory check for the executable with a minimum version number, and  added a launch condition that notified the user of the missing prerequisite and offered to open a web page to the PowerShell download.  Seemed like the most legally helpful approach.
Answer: There is a way, albiet requiring you to build some MSI thing manually that will get it from MS and install it for you. I know the exchange install used that technique. You can also get a license/permission from MS to redistribute the official installers.


From where to learn the basics of Sql Server 2005

Question: I am new to SQL Server 2005 and want to start from the basics with examples.
Could anyone guide me how can I proceed. As my target is to learn Businness Intelligence[BI], what I need to concentrate to get the sufficient knowledge to walk into BI?
Answer: Why do you not use sql server 2008? I think there are more options in sql 2008 then in the 2005 version.
Check this link for more information.
http://msdn.microsoft.com/en-us/library/ms167593.aspx
Answer: Try SqlZoo to get up to speed on sql.


Should a non-significant adjustment variable be kept in a regression model?

Question: I'm working with a structural equation model to study influenza infection risk. As age is a known risk factor to explain infection, I therefore adjusted my infection outcome on the subjects age class. After regressing my outcome on several latent variables, the age class is not significant anymore. My question is : should a non-significant adjustment variable be kept in a (structural) regression model or removed ?
Answer: Beyond considering the SEM discussion in comment from @NickCox, I'd test different codings of your age variable before ruling out its inclusion.  I'm assuming you've transformed to categorical since the age relationship will be non-linear (very young and old people are more likely to be infected, everyone in between less so).  If you have enough data perhaps you could test as a continuous covariate with a quadratic age variable model; otherwise explore how you bin the ages into different sub groups to make sure that's not confounding the variable's influence.
Comment: I'm not clear on how this would shed light about inclusion since it should be included anyway.  But it is good to model continuous variables continuously and flexibly.
Comment: Sorry, I didn't mean to implicitly comment on whether it should or shouldn't be included. Just that the OP first consider whether the age variable's representation in the model (or any potential re-coding) might have been causing the significance issues.


In S. M. Stirling's Emberverse series, is it ever revealed what actually caused "The Change"?

Question: I have only read the first book in S. M. Stirling's Emberverse series, Dies the Fire, but found myself frustrated that the underlying cause of "The Change" was not revealed and thus did not continue with the series. Is the cause ever revealed? If so, in which book?
Answer: This answer is really only half-satisfying, but here is what I've found so far:

An enormous electrical storm of unknown properties encompasses the island of Nantucket and transports it back to the bronze age. The resultant time shock causes everyone on Earth to suffer an intense migraine at the exact same moment. The far more important consequence is that any device run off of electricity, gunpowder, explosives, internal combustion or steam power ceases to function. Permanently. In a single instant, humanity has been ''literally'' bombed back to the Stone Age.

Someone on the Emberverse Wikia seems to feel that:

The effect appears to be caused by an alien intelligence in an effort to minimize the ability of a competing civilization to wage war in their universe. These aliens apparently have the ability to affect matter and energy at the quantum level and have access to multiple universes and timelines. There is no evidence that the Change is reversible.

I haven't read the books, and since there are no cited sources to be found there, I can't vouch for any of that information. So I can't tell you when this information is revealed. But a Google search of medium-depth reveals that there isn't a whole lot of verifiable information out there on what this is, which makes me think that it's never really explained.
Besides - without technology, how would people on Earth be able to research the event and figure out what happened?
Answer: Part of the explanation would spoil stuff that comes later in the series, particularly the 2nd set of stories involving the next generation of characters.  Suffice it to say that Stirling goes into more detail in "The Protector's War" as to the nature of the changes involved, in which Ken Larrsen metaphorically bangs his head on the wall as he discovers that what has occurred is specific to only certain things, ensuring that humanity can't have its 'toys' any longer.
Love the series and how it evolves from straight "post apocalypse" yarn to a more fantasy based series as it moves along.
Comment: If you have info that's not available in the previous answer, feel free to answer it in a spoiler tag (prefix the text with >! - that is, "close-angle-bracket" followed by "exclamation mark").
Answer: It's implied that aliens may have been involved, but in the latest book it is confirmed that an outside force stopped technology from working so that humans would not destroy themselves and would have much more respect for their technology when and if they get it back.
Comment: Would "the latest book" be Lord of Mountains?
Answer: The story is seemingly about the "Old Gods" returning to our universe to protect mankind from destroying ourselves. It kind of postulates that there was once a time in our history where supernatural beings were a part of our reality, the Gods intervened from time to time, etc. This period ended and we developed modern technology and science, but we so abused that knowledge in many ways that we threatened the continued existence of life on earth, so those old powers stepped back in and caused the Change. There is more to it than that of course, there are powers from outside of our universe that are seeking to enslave mankind and must be battled to prevent their success. Of course the form those external powers take in our reality depends a lot on your point of view, so the Christian Monk in the story has a vision of Mary Magdalene, the Wiccans encounter their God and Goddess, those of Norse heritage meet Odin etc.
The reference to aliens comes from an explanation for the Change made by one of the characters where he says we have no idea what caused it and its completely fruitless to try to figure it out given the circumstances, he then makes a casual reference to "Alien Space-Bats", but this is not the real cause of the Change just a spurious statement to say it was caused by something beyond our ken.
This is my all time favourite SF/Fantasy series, and I highly recommend everyone try it to see if it suits their needs. Its a great tale with a lot of great characters in it.
Answer: Eventually what emerges is that there is a battle among the gods. In order to prevent one side, which wants to completely reorder man as a sterile, perfect creation (which requires first annihilating us using our own technology) the universe was subtly altered so that this technology was no longer able to work. Thus the battle between one set of gods and the other is carried out on earth through intermediaries using fire and sword instead of nuclear weapons and biological warfare. This is actually an outstanding series and I highly recommend it.
Comment: Can you edit your answer to say which book revealed this specifically? And a quote would be helpful if you have the book handy...
Answer: In The Sword of the Lady Juniper and Mike's son, Rudi, meets "someone" when he gets given a magic sword and all is explained, kind of, basically the "powers that be" stole Nantucket Island and sent it back in time (as detailed in Island in the Sea of Time) to change the outcome of humanity's technological progress from "absolutely going to destroy all life on Earth" to "might destroy all life on Earth" because life on Earth is important because... reasons. The whole thing is about two thirds of Chapter 21 and not much of it makes sense without getting there the hard way anyway so I'm not going to quote you from it; the gist is that ideas eventually take on a mind of their own, to the extent that they outlive their creators, and they seek to reinforce themselves, or at least to guarantee their continued existence.
Comment: TVTropes calls it The Mind, but is that actually a term from the books?


Did I have USB debugging on or off?

Question: my phone got stolen a month ago and I Don't know if I had usb debugging on or off(I had enabled developer options in the past and messed around with it a little bit that's why I'm not sure) but I remember,everytime I connected my phone to the computer I had to unlock the phone using my pin and select files or photos in the notification bar to access the files on the phone,otherwise you couldn't Mount phone as a storage device.i never had anything on the notification bar that said USB debugging is enabled when my phone was connected to the Computer. Did I have USB debugging on or off? and if I had USB debugging on could they simply remove the PIN and use the phone as is? I'm worried about my chrome data not about videos photos... Thanks alot
Answer: Having USB debugging (adb) enabled on a device is not a security problem anymore since Google introduced the adb authentication using public keys with Android 4.2 (or was it 4.4?).
Since that time adb does not work when you connect it to a PC it has never been connected before.
The device does not allow adb access unless the user has authorized the PC as allowed using the dialog that appears on the phone when connected via adb. This dialog can only be seen and answered when the device is unlocked.
Thus a lost or stolen device that is locked can not be accessed via adb.

Did I have USB debugging on or off?


Do you read C or C++ compile errors after the first one?

Question: I never understood why C and C++ compilers try to recover from errors and continue parsing. Almost always, the first error generates a stream of bogus errors that will disappear as soon as the first one is fixed. After several years of experience, I simply stopped looking at any error except the first one of every file. I rerun the compiler and then do that again until there is no more errors. Is it a common practice?
Comment: I guess I only read the first ones, but I don't work with thousand million source file solutions, so that helps.
Answer: Sometimes the errors are unrelated. I find it easier to look at a list of errors and fix the root cause of a series of related errors, then fix the next un-related error. If the project is large and takes a while to build, I find working in this manner less frustrating than fix first error, recompile, repeat...
Comment: +1: Mind you, if the project is large and takes a while to build, it's wise to not change too much between compiles so that you can find any problems you introduced relatively easily.
Comment: I agree that in the case your compilation time is very long, it may be useful to look for other unrelated errors, but I would prefer to fix the dependency problems that cause those long incremental builds...
Answer: It depends on the compilation time. For example, if I know that I just changed a master header that will trigger a rebuild of the entire project, I'll certainly take a closer look at the rest of the error stack and see if I can fix some of them. That gives me a better feeling when I stand up to make coffee while the compiler runs.
Answer: Yes I do the same, unless I am using the compiler to help me refactor in which case I like the full list of errors :)
Comment: Yes but my primary work IDE VS has none for C++ :( When there is no tool I will find a way!
Comment: Visual Assist X from Whole Tomato adds refactoring to VS for C++.
Comment: Many modern IDEs have refactoring tools available at the click of a button, so refactor-by-compiler-error is not necessary if you have access and abilities with such tools. Unless you prefer it...
Answer: If there is a gap in the line numbers, the compiler probably did recover and then found another error.
Usually only try to fix one error in each bunch though.
Answer: Better compilers will produce better results and give you more useful errors after the first one, often through some kind of automatic correction of the errors so that presumably good code can at least be checked. But then, I'm used to working in Java, in Eclipse, where syntax typos are instantly detected and easily corrected, and other compiler errors tend to be more diverse and easier for the compiler to recover from. I can only assume that it's similar when working in Microsoft's IDEs and others in C++ or C#.
Answer: Yes - or at least I skim them. It is pretty easy to figure out if the errors are related (usually a look at the line number is enough) and I like fixing them all in one pass and then recompiling.
Answer: I do this (to read the errors past the first one) only if the 1 cpp compilation is very long. Or not available. Then I prefer to make sure I fixed everything I could identify in the compiler errors as unrelated to the first error.
When your cpp file can be compiled alone and does in less than a second (or you have an "intellisense" pointing errors before the compilation even started) you don't have to do this most of the time.
I currently work on a project where I can't compile one cpp alone (and I don't have the hand on the build system so I can't change that O__o) and some cpp files can take more than ten minutes to compile (even after a lot of effort to reduce that, we only cut it by to 50% of the original compilation time...).
In this kind of very long compilation setup, you tend to think a lot first before hiting "build"... and even think a lot after, to maybe find bugs before the compiler as you're certainly faster to get them mentally than it.
Answer: It's quite common to do as you do. I usually tell interns or novice programmers overwhelmed by the number of errors to ignore almost all of the errors except for the first one. It's most likely a real error that needs to be fixed, and not a misleading phantom error caused by a previous one. Some (most?) compilers have the option to stop compiling after the first error for this reason. Build systems usually can be configured to stop after the first file that has errors as well.
However, there are reasons for continuing to compile after detecting errors too. For example, you may want to count how many files have errors, or to see if an included header file causes errors in more than one file.


QGIS Bookmarks not transfering with files

Question: My students send me QGIS map files that when I open them have been stripped of the bookmarks.  Is there a setting I'm missing or is the normal case.
Comment: What version of QGIS?
Answer: The geospatial bookmarks are stored globally in the user's database at ~/.qgis2/qgis.db. None of the bookmarks are stored with the .qgs project file. There are two feature requests concerning this:

#1635: Add option for bookmarks: "this project only" (5 years old)
#7715: Import/export functionality for geospatial bookmarks

Storing some of the bookmarks in the current project file is a very good idea, but is unimplemented at this time (up to and including next QGIS release, 2.2).
As a workaround, the qgis.db file is a simple SQLite database, which can be opened and the tbl_bookmarks rows exported, via a Python script. The project's name is included in the table's fields, so an import into a master qgis.db would retain this; useful if the project names unique, painstaking, if not.
Alternatively, it would be a fairly good introductory coding exercise to create a PyQGIS plugin that mimics the geospatial bookmarks at the project level, storing/reading/displaying and editing/deleting them from project properties via Python. Such a plugin could be rolled out to all of your students, providing exactly what you are looking for, without having to wait for the core functionality in QGIS to be implemented.
Comment: Note this feature has been merged for 2.16 release
Answer: update (as of QGIS 2.16 I believe, as per NathanW comment), there's an export function to make the bookmarks shareable as an XML file.
This can also be useful for backing up bookmarks, as once you delete them they're gone

.. also it's possible to store the bookmark in the project by checking the 'In project' box (see changelog). You may need to use the scrollbar to see this column.


Atmospheric Density

Question: As I was reading my textbook, I noted that it stated that the atmosphere becomes less dense as height increases. I am unable to understand this. I understand that pressure decreases as height increases, but shouldn't the density remain constant?
Comment: What does the ideal gas law predict about how the pressure affects the density?
Comment: I'm sorry, I don't understand how that relates to the question (I think I'm misreading your comment btw)
Comment: What I am describing is how you would derive the ideal gas law from first principles instead of taking it as simply empirical.
Comment: Do you know the interpretation of temperature in terms of probability of finding a particle in low energy states? Low temperature means almost surely in the lowest energy state
Comment: Consider a single molecule. If you assume a uniform temperature, then low to the ground is lower energy so higher probability of being there. Do this for all the molecules and you get a statement about density. But temperature is not uniform, but the qualitative result remains.
Comment: Think of it this way: If density remained constant the mass of a planet with an atmosphere would be infinite, and space travel would be impossible. This obviously is not the case.
Answer: From the ideal gas law, the density of a gas is described by the equation:  $$\rho=\frac{PM}{RT}$$where $\rho$ is the density, P is the pressure, M is the molar mass, R is the universal gas constant, and T is the absolute temperature.  So, at constant temperature, the density varies in direct proportion to the pressure.  In the lower atmoephere, the temperature decreases somewhat with elevation, but the pressure variation easily wins out.
Answer: The barometric formula predicts the atmospheric density with Newtonian gravity and fluid dynamics.
So basically you need three things:

gravity
pressure
temperature

You are asking the right question, because for example water does not behave like that, as you go deeper in the ocean, the density of the water only slightly increases. Whereas in the atmosphere, this effect, that the density decreases as you go higher is more dominant.
Once you figure out what the difference is between the ocean and the atmosphere, and why one has a big density change with altitude and why the other does not, you will understand why the atmosphere is less dense at high altitude.
The incompressibility of fluids is caused by a rather small distance between water molecules, and when you are trying to compress them, they react with a rather big force (Van der Vaals and EM) that's not letting them closer.
This is not the case with the atmosphere. This gas is rather compressible, since the molecules are farther away, and they are not in constant contact with each other.
So now you would think it is only gravity that causes higher density closer to Earth. But the reality is that gravity (and curvature) directly only plays a little role here, because the difference in the strength of gravity almost the same at the surface as at the top of the atmosphere.
So why is the atmosphere less dense at the top? To understand this, imagine compression springs instead of gas molecules. If you look at the molecules at the top, they are not really compressed. As you go lower closer to the surface, those springs are really compressed. Why? Because of pressure from the other springs weight from above.
So although gravity does not significantly change with the altitude inside the atmosphere, the compression of the springs will linearly change, become more compressed as you go down. It is pressure.
Same thing happens with water in the ocean. The deeper you go, the more pressure. But why does water not get really denser? Because it is rather incompressible. The atmosphere is rather compressible and that is why it gets denser at the bottom.
See this question of mine:
Ocean density vs atmosphere density
Answer: As Chester Miller said in the first comment you have that the Law of Ideal Gases holds true, hence you can write (where $R_d$ is the gas constant for dry air)
\begin{equation}
\rho=\frac{p}{R_dT}
\label{eq:idealgas}
\end{equation}
But since it's the Atmosphere what we're dealing with, it's also true that the Barometric Equation holds, which states (verify it yourself)
\begin{equation}
p(z)=p_0e^{-\frac{z-z_0}{H}}
\end{equation}
Where with the subscript $\square_0$ I indicate the starting height and pressure, and with $H$ I indicated the $e$-folding height $$H=\frac{R_dT_0}{g_0}$$. Plugging it inside the Ideal Gas Law we get
\begin{equation}
\rho(z)=\frac{p_0}{R_dT}e^{-\frac{z-z_0}{H}}
\end{equation}
Which, without much doubt, is a monotonically decreasing function of height, q.e.d. $\square$

Atmospheric Density


How to increase width of the walls?

Question: So I am beginner to blender. I want to make an object like swimming pool.
I made a cube and deleted one face. Now I have no idea how to increase width of the walls. I tried to extrude each face, but now I have a hole in connections between walls. I could not find other opportunities to make such changes
Answer: There are many different ways. This is one of them (maybe not the best, but should be easy to follow):

Create a cube
Resize the cube to match the size of the pool ( s )
Apply your object's scale( Ctrl-a > Scale)
Go to edit mode (TAB)
Press 3 to switch to "face selection"
Select top face
Inset the face i
Select the inner face and extrude vertically with e + z (so you can create the "hole" in the swimming pool
If you want to change the width of the walls you can select inner faces (check screenshot) and resize them in both X and Y to get your result ( S-x and S-y)
Comment: Thank you very much, i feel myself so stupid now, that I did not try in other direction :D But If I am going to follow your suggestion, is it possible to get rid of the holes in connection, so that it looks solid, without any separations?
Comment: You should have no holes in connection.
Can you post a screenshot of your actual situation?
Comment: thank you, I understood what I did wrongly

How to increase width of the walls?


How to create speckles in a sponge surface

Question: How to achieve this shiny effect on the sponge surface in Cycles?
The sponge shows tiny speckles reflecting light.
Comment: What you've tried so far? Can you provide a sponge to test?
Comment: I'd say this is the opposite of shiny, or are you talking about the few very bright spots on the bottom of the image ?
Comment: I have tried hair particles with roughness but not working.
Comment: Yes, how to get that spots.
Answer: You can use this simple node setup :

First add a Noise Texture and set its Scale pretty high. Use a Bright/Contrast to emphasis the effect, you should get something like that :

Add an RGB Curve to gain more control. The right of the curve will control the roughness of the tiny spots : I set it to 0.0 so they will be really shiny. The left of the curve will control the roughness of the base material ; If you set it to 1.0, it will be totally diffuse ; I recommend some intermediate value, around 0.75 or higher, but it's your move.

Finally, connect this into the Roughness slot of a principled BSDF and tweak the other values to fit your needs (some Transmission should look good, maybe even some Subsurface). Once it's done, you'll probably want to adjust the RGB Curve a bit.
Answer: I would recommend making the Brillo pad out of a refractive material, then displacing it with a high-scale noise texture using a Displacement node: this would be very close to what the pad is like in real life.


Is this a superharmonic function?

Question: Hi everyone: Let $ \Omega $ be a bounded open set of $ \mathbb{R}^{N} $, $ N\geq2 $, and $ F\subset \Omega $ with empty interior. Suppose there exists a superharmonic function $ u $ on $ \Omega\setminus F $ such that
$$ \lim_{x\rightarrow y}u(x)=+\infty $$
for all $ y\in F $. Now, we define $ w(x) $ to be equal to $ u(x) $ for $ x\in \Omega\setminus F $, and $ +\infty $ for $ x\in F $. Is $ w $ a superharmonic function on $ \Omega $?
Answer: First you have to assume that $F$ has measure zero, since a superharmonic function is locally integrable.
Under this assumption, setting $u=\infty$ on $F$ results in a superharmonic function. To see this, note that by the limit assumption
$$\lim_{x\to y}u(x)=\infty$$
for all $y\in F$, the resulting function is still lower semi-continuous.
Also, the mean value property
$$u(x)\geq \frac{1}{|B(x,r)|} \int_{B(x,r)} u$$
remains valid if $F$ has measure zero.
These imply that $u$ is superharmonic.
Comment: @Rahmat: The answer to your question in comment is no. If $F$ has positive measure than it has positive capacity. And a superharmonic function can be infinite only on a set of zero capacity.
Comment: Thanks for your answer. All I know is that the harmonic  measure of $F$ with respect to $\Omega\setminus F$ is zero. But  Inerrability is not a part of the definition of a superharmonic function.
Comment: You are right, it is not part of the definition but it follows from the mean value property. The proof is essentially a connectedness argument that uses the fact that superharmonic functions attain a minimum on compact sets.
Comment: I agree with what you have proved: if $F$ is a null set, then for sure $u$ is superharmonic. What I want to make sure is this: is it possible that $F$ have only empty interior without $u$ being superharmonic?
Comment: I was just thinking that the continuity of the function near $F$ makes it impossible that the measure of $F$ be positive.

Is this a superharmonic function?


How do you use the express framework but store a users data in a SQL Server database?

Question: How do you use the express framework but store a users data with a built in a SQL Server database?
Answer: You can easily do this with ExpressJS. You were just a google search away. It is clearly mentioned in the ExpressJS Documentation.
Check out this link for integration with MySQL, PostgreSQL etc.


Is there a black list of applications that drain battery fast?

Question: Many people complain about some applications draining batteries fast because of bugs or misconfiguration. Is there a black list of such applications that are not energy-friendly?
Comment: I've not seen such a list, but you can easily see on your own device the apps and processes that are draining your battery.
Comment: NB: if such a list exists, this question is a good place to link to it. If such a list does not exist, this question is NOT a good place to create it. Just sayin'.
Answer: It's tricky to know which ones drain battery life fast.
Before installing you can check comments to see if there are many complaining of that.
After installing, either if you know your phone well enough and see a clear decrease in battery life then it could be the new software if nothing else change, or you can try and check the battery usage statistics.
Answer: I suggest you try this App Greenify , If you got rooted phone that is.
Anyway for general purpose you should check battery usage to find the culprit. And Have them removed perhaps.
https://play.google.com/store/apps/details?id=com.oasisfeng.greenify&feature=search_result#?t=W251bGwsMSwxLDEsImNvbS5vYXNpc2ZlbmcuZ3JlZW5pZnkiXQ..


How do I remove the pattern lock?

Question: I have my brothers old HTC & was playing with the Location & Security settings. I added the pattern lock to my phone, but it's now just an extra thing to get through before being able to use my phone. How can I remove this? I'm rather clueless with the terminology too & don't grasp the concept of APN's & VPN's or know what a corporate administrator is.
Comment: When the "none" option in key lock settings is greyed out: Fail the pattern on purpose multiple times, wait out the time-lock, use your PIN to log in and the pattern lock will have been removed automatically.
Answer: In your phone go to the settings options and check for Security settings and find key lock settings.

You will have Some options like PIN, Pattern, None.
Pin is for the phone will ask you for a 4-digit number to unlock
your phone.
Pattern is for the phone will ask you to draw the pattern for the
phone to unlock the phone. The  pattern should be the same as the pattern you
had set.
Choose none for the phone will not ask for any pattern or pin to
unlock your phone.In this way you will be free of any hassles to unlock your phone.
Comment: @bouncy72 did the above work for you
Answer: Every Phone Have option to remove the pattern lock.
Go to the

1.Setting
2.Security
3.Screen lock
4.click
5.Option Coming(none, Pattern, PIN, Password).
6.Choose NONE option.

Then you have remove the pattern lock.
In android every phone have same process.
Above answer is also correct. I have updated only how to remove pattern lock specifically.

How do I remove the pattern lock?


How to access a file in downloads from root?

Question: I'm a root user sudo -i, now i want to execute the Downloads/my.sh from root. how do i do that?
Comment: try: bash ~/Downloads/my.sh,   if it is under a different username Download folder, then try: bash ~username/Downloads/my.sh make sure you specify the right username.
Answer: Using sudo -i starts a new shell as root.  Use sudo su, or sudo -s, which lets you switch users, so you are logged in as root.  Then, you can just enter the Downloads directory with cd Downloads and run your script.
Comment: ... or `sudo -s`
Answer: First you should know there are 2 ways:
First make your file executable just right click it, under permission tab check allow executing file as program
The Graphical way
A.1) Open your file manager as root(Assuming you are using Ubuntu gnome version if not, change nautilus for your file manager)
$ sudo nautilus

A.2) With your file manager is open as root, you should navigate to the folder containing your executable file
A.3) Now you just double click it, if didn't work you right click it and then click "open with" and in the new window select "list all" and now you can search for "execute program" or something similar
The Terminal Way
B.1) You open your Terminal Window and the you type(just to be sure you are at your home directory)
$ sudo cd

B.2) Now you type this
$ sudo ./Downloads/my.sh

alternate way is
$ cd the/route/to/the/folder/containing/the/file

and now you execute
$ sudo ./file.sh

if you want to execute something as root user, not just asking for permission try this
$ sudo su

and now you locate the file and execute it
$ ./usr/arghadip/downloads/file.sh

edited it for your needs as you commented it
Comment: but i want to call it as `root /usr/arghadip/downloads/file.sh`
Comment: could use {sudo su} and then type the route with cd,
Comment: can i copy the parent dir to the root? it's a 4 GB folder containing a lot of other files. So i could execute it directly inside `root /Desktop/myfolder/myfile.sh` if it's possible write me the copy command
Comment: I edited it with your last comment's needs
and you just type cp -R /etc /home/Downloads/    <---- this will copy etc folder recursively with all the files and folders inside it to Downloads inside home
Comment: nevermind i got what i want
Answer:
You need to use absolute path:

Ex:
/home/username/Download/my.sh

When you write command root -i you are the root user. So that, If you write command Download/my.sh it will be take as /root/Download/my.sh.
If your are simple user Download/my.sh is like /home/username/Download/my.sh.
So, when you are the root user you need to give command form where you are (absolute path).
Comment: `Download/my.sh` will only behave like `/Download/my.sh` when the current directory is `/`. This is independent of what user account one is logged in as, and no more likely to occur when logged in as root. By simulating a full login, `sudo -i` causes the current directory to be root's home directory; but root's home directory is `/root`, not `/`.
Answer: I was a real noob back then.
~/Downloads/my.sh

Thanks @NiteRain for your comment.


Horizontal scrolling between dynamic number of pages with tabs in Polymer

Question: Is there a Polymer WebComponent that allows horizontal scrolling between dynamic number of pages with tabs?
To those familiar with Android im looking for something like PagerTabStrip
Answer: The swipe-pages custom element allows horizontal scrolling with tabs. You can check the demo here: http://theseamau5.github.io/swipe-pages/components/swipe-pages/demo.html.
But this has not been updated for a long time.


Specifying algebraic numbers over $\mathbb{Q}$ using GAP

Question: When trying to have GAP compute the minimal polynomial of some algebraic irrational over $\mathbb{Q}$ I ran into problems. How do I specify root expressions other than square roots? For instance it works to say MinimalPolynomial(Rationals,Sqrt(2)). This gives the expected result x_1^2-2. However when using MinimalPolynomial(Rationals,2^(1/2)) I get an error. In fact 2^(1/2)) per se is an error whereas (2.0)^(1/2)) is not. I realized that Sqrt(2) is actually translated to E(8)-E(8)^3. So how can I find the minimal polynomial of say $a=\sqrt[3]{2}$? The answer is of course $X^3-2$ but how can I make GAP tell me that? If I knew how to express $a$ as a linear combination of roots of unity I probably wouldn't be asking in the first place.
Answer: The only way to represent (e.g.) $\sqrt[3]{2}$ in GAP is as formal AlgebraicExtension from the minimal polynomial $x^3-2$. The reason that such roots cannot be represented from roots of unity is that cyclotomic numbers (linear combinations of roots of unity) have an abelian Galois group, while the Galois group of the splitting field of $\sqrt[3]{2}$ is nonabelian.
Since finding the minimal polynomial of $\sqrt[a]{b}$ is not hard, you probably want to do something else, e.g. find a minimal polynomial for a more complicated expresssion. If that is the case, ask so!
Comment: Thank you. But does that mean I already have to know the minimal polynomial of an algebraic number in order to use it? In particular I wanted to play around with splitting fields of minimal polynomials of numbers like $\sqrt{2}+\sqrt[3]{2}$ or even $\sqrt{2+\sqrt[3]{2}}$. In principle I know how to calculate the minimal polynomial by hand but that gets tedious very fast which is why I wanted GAP to do that for me.
Comment: Yes and no. You can do arithmetic with minimal polynomials. I'll give another anwer focussing on this.
Answer: If you want to construct minimal polynomials of numbers that are sums (or iterated) expressions of roots, one can do arithmetic with minimal polynomials. The key is a construct called a resultant, which takes two univariate polynomials, and returns an element -- the determinant of the Sylvester matrix -- in the base ring. (Alas, resultants have dropped ouyt of the standard abstract algebra curriculum a while ago.)
Often this is used on multivariate polynomials, eliminating one variable.
A crucial property (see, e.g. Cohen, A course in computational algebraic number theory) is that
$\mbox{res}_x(f(x),g(y-x))$ will be a polynomial in $y$ whose roots are of the form $\alpha+\beta$, where $\alpha$ are roots of $f$ and $\beta$ roots of $g$.
So, for example, to find a polynomial that has root $\sqrt{2}+\sqrt[3]{2}$, you could use:
gap> x:=X(Rationals,"x");;y:=X(Rationals,"y");;
gap> f:=x^2-2;
x^2-2
gap> g:=x^3-2;
x^3-2
gap> r:=Resultant(f,Value(g,y-x),x);
y^6-6*y^4-4*y^3+12*y^2-24*y-4
gap> Factors(r);
[ y^6-6*y^4-4*y^3+12*y^2-24*y-4 ]

This polynomial has root $\sqrt{2}+\sqrt[3]{2}$ and is irreducible, thus is its minimal polynomial.
For iterated expressions one can compose polynomials. So $x^3-2$ has root $\sqrt[3]{2}$. $(x-2)^3-2=x^3-6x^2+12x-10$ has root $2+\sqrt[3]{2}$ and (replacing $x$ by $x^2$) the polynomial $x^6-6x^4+12x^2-10$ has root $\sqrt{2+\sqrt[3]{2}}$.


Why can I cat /dev?

Question: I can cat /dev, I can ls /dev, I can't less /dev. Why does cat let me cat this directory but no other directories?
Comment: @KamilMaciorowski, here's the output and `neofetch` for your information :)
https://i.imgur.com/3azpnDt.png
Answer: Historically (up to V7 UNIX, or around 1979) the read system call worked on both files and directories. read on a directory would return a simple data structure which a user program would parse to obtain the directory entries. Indeed, the V7 ls tool did exactly this - read on a directory, parse the resulting data structure, output in a structured list format.
As filesystems got more complex, this "simple" data structure got more complicated, to the point where a readdir library function was added to help programs parse the output of read(directory). Different systems and filesystems might have different on-disk formats, which was getting complicated.
When Sun introduced the Network File System (NFS), they wanted to fully abstract away the on-disk directory structure. Instead of making their read(directory) return a platform-independent representation of the directory, however, they added a new system call - getdirents - and banned read on network-mounted directories. This system call was rapidly adapted to work on all directories in various UNIX flavours, making it the default way to get the contents of the directories. (History abstracted from https://utcc.utoronto.ca/~cks/space/blog/unix/ReaddirHistory)
Because readdir is now the default way to read directories, read(directory) is usually not implemented (returning -EISDIR) on most modern OSes (QNX, for example, is a notable exception which implements readdir as read(directory)). However, with the "virtual filesystem" design in most modern kernels, it's actually up to the individual filesystem whether reading a directory works or not.
And indeed, on macOS, the devfs filesystem underlying the /dev mountpoint really does support reading (https://github.com/apple/darwin-xnu/blob/xnu-4570.1.46/bsd/miscfs/devfs/devfs_vnops.c#L629):
static int
devfs_read(struct vnop_read_args *ap)
{
        devnode_t * dn_p = VTODN(ap->a_vp);

    switch (ap->a_vp->v_type) {
      case VDIR: {
          dn_p->dn_access = 1;

          return VNOP_READDIR(ap->a_vp, ap->a_uio, 0, NULL, NULL, ap->a_context);

This explicitly calls READDIR if you try to read /dev (reading files under /dev is handled by a separate function - devfsspec_read). So, if a program calls the read system call on /dev, it'll succeed and obtain a directory listing!
This is effectively a feature that is a holdover from the very early days of UNIX, and which hasn't been touched in a very long time. Part of me suspects that this is being kept around for some backwards compatibility reason, but it could just as easily be the fact that nobody cares enough to remove the feature since it isn't really hurting anything.
Comment: Probably the latter, seeing as it has been removed from most directories.
Answer: Less is a text file viewer, cat is a tool for copying arbitrary data. So less performs its own checking to make sure you're not opening something that will have massive amounts of data or behave very strangely. On the other hand, cat has no such checking at all – if the kernel lets you open something (even if it's a pipe or a device or something worse), cat will read it.
So why does the OS allow cat to open directories? Traditionally in BSD-style systems all directories could be read as files, and that was how programs would list a directory in the first place: by just interpreting dirent structures stored on disk.
Later on, those on-disk structures began to diverge from the dirent used by the kernel: where previously a directory was a linear list, later filesystems began using hashtables, B-trees, and so on. So reading directories directly wasn't straightforward anymore – the kernel grew dedicated functions for this. (I'm not sure if that was the main reason, or if they were primarily added for other reasons such as caching.)
Some BSD systems continue to let you open all directories for reading; I don't know whether they give you the raw data from disk, or whether they return an emulated dirent list instead, or whether they let the filesystem driver decide.
So perhaps macOS is one of those operating systems where the kernel allows it as long as the filesystem provides the data. And the difference is that /dev is on a devfs filesystem that was written to allow this in the early days, while / is on an APFS filesystem that omitted this feature as unnecessary in modern times.
Disclaimer: I haven't actually done any research on BSDs or macOS. I'm just winging it.
Comment: @haboutnnah Your screenshot confirms that `/dev` is a virtual file system using the `devfs` driver whereas `/etc` is part of the `/` file system using the `apfs` driver. So the reason `cat` will read one and not the other is a difference between the `apfs` and `devfs` drivers.
Comment: On the contrary, generally /etc is just a regular folder containing regular files. There _may_ be other virtual filesystems though – run `mount` or `/sbin/mount` to see what's currently mounted where.
Comment: This seems to make sense. Are there any other sections of storage that differ from the standard OS filesystem? I assumed `/etc` would, so I used that as my benchmark.
Comment: You're right!
See this: https://i.imgur.com/pcVpo1o.png
Comment: This is really neat @grawity, https://i.imgur.com/8QuR0FK.png
Comment: Well, directly reading a _disk_ is fairly normal operation because disks just have a flat structure anyway (this is how you can make an .iso image of a CD).
Comment: @grawity: I wonder what's something worse :) than opening a device, any malicious examples? ^^

Why can I cat /dev?


Is there any way to send Outlook meeting requests from a non-default calendar?

Question:
We have a user with two Outlook accounts. firstname.lastname@example.com is of type Exchange; firstname.lastname@example.com is of type IMAP/SMTP. Both are actually on our Exchange server; but since an Outlook profile can only have one Exchange account, the second one is set up as IMAP.
The user would like to send a meeting request from her xyz.com account, so the "from" address appears as email@example.com. Unfortunately that doesn't work. If she creates the meeting in her xyz.com calendar, the meeting request still goes out through her Exchange account, firstname.lastname@example.com. The meeting request "compose message" window has an Account dropdown below the Send button, but this has no effect.
Before she sends the invitation, a warning appears:
"Responses to this meeting request will not be tallied because this meeting is not in your main Calendar folder. Is this OK?"
Is there any workaround for this? We're using Outlook 2007 and Exchange 2003 SP2.

Thanks,
Richard
Answer: First of all, note that while you cannot have a "full" MAPI connection to more than one Exchange mailbox via a single Outlook profile, you can get awfully close by making one mailbox a delegate. Many users find this works better than what you're currently doing. Instructions on how to do this are located here.
Once you have this setup, when the user wishes to send a message (email, meeting invitation, etc) from the secondary mailbox, she must fill in that user in the From field in Outlook which is also explained in the link above. Note that if follow this technique when she sends as the other account those messages will say "From Userabc on behalf of userxyz". If you wish to change that so they just say "From userxyz", you'll need to give userabc Send As permission on the userxyz mailbox. Instructions for doing this are here.
Comment: Thanks! I'll definitely try this out. We'd need full "send as" permissions, since the recipient shouldn't see abc.com at all - but it sounds like this will do what we want.


error MSB6006: "svnversion.exe" exited with code 1

Question: I am trying to get revision number from svn to put on my AssemblyInfo.cs file. I already made that on my computer and works fine. But when I use hudson to build and deploy my application automatically on server then this error appears. Anyone knows why?
Thanks!
Answer: This is because you are using a old version of svnversion.
Try to open the Command Line Prompt, navigate to the svnversion directory and do the same job as the MSBuild.
CMD:

cd C:\ProgramFiles\TortoiseSVN\bin
[ENTER]
svnversion C:\VisualStudio\Projects\YourDirectory
[ENTER]

SVNVERSION should answer why its not working, in my case was by E155021: This client is too old to work with thew working copy at...
Comment: In my case the SlikSVN was never, a rollback to a previous version fixed everything.


How does ArcGIS determine which transformation to use when projecting on the fly?

Question: How does ArcGIS determine which transformation to use when projecting on the fly? Where this would come in would be going from NAD 83 to WGS 84. Multiple transformations could be considered so how is one picked?
Answer: Note/Disclaimer: I work for Esri.
Prior to ArcGIS for Desktop 10.1 service pack 1 (10.1.1), we loaded one geographic/datum transformation in ArcMap: NAD_1927_To_NAD_1983_NADCON (using the conus grid files). For 10.1.1, that was removed. All other transformations must be user-selected using the Transformations dialog. You can launch this dialog from the data frame properties, coordinate system tab or from the geographic coordinate system warning dialog.
The transformations dialog will show all unique geographic coordinate reference systems. Starting at version 10.1, the list of transformations is sorted by comparing the map's area of use and the transformations' areas of use plus their accuracies. It's still very easy to 'fool' the tool though! If you define a custom transformation, it is sorted to the top of the list because we don't have any area of use/accuracy information for it.
Transformations are stored in a look-up table (SDK: GeoTransformationOperationSet) per pair of geographic coordinate systems. It's not possible to have a transformation active for the US and a different one for Canada, for instance.
There are some 'default' transformations occurring with web service layers IF you don't specify something else.
Comment: No real change for 10.3, although a set of default transformations (user-customizable to any predefined tfm!) are available in Server and...runtime, I think. The file's in the pedata folder of the installation.
Comment: I just realized I never check marked an answer! Thank you for explaining it so thoroughly. I am tempted to create a custom transformation now. Are you enhancing on the fly projections for 10.3?
Comment: Ok great. I'll look for that when we finally upgrade. I can't wait to join the rest of the planet and move our tools to Python 3. We want to do the migration all at once. One last question, what is a pedata folder?
Answer: According to this

(ArcMap automatically loads one geographic transformation. It's designed for the lower 48 states of the United States and converts between NAD 1927 and NAD 1983.)

For datum transformations, you need to pick the transform yourself.  This article goes into NAD83 <-> WGS84 choices. Projection changes can be done on the fly automatically because the projection doesn't need a transformation.
Answer: Look here and here.

The first layer added defines the data frame's coordinate system.
  This is true whether the data is projected or geographic. For example,
  if the first layer added contains a Lambert Conformal Conic projected
  coordinate system, all other layers will project on the fly to match
  this. Similarly, if the first layer added to the data frame contains
  data that uses a WGS84 geographic coordinate system, all other layers
  will adjust to match this. Even data that uses a projected coordinate
  system will unproject on the fly.
Comment: This help primarily talks about how ArcMap determines which _coordinate system_ to choose during project-on-the-fly, not _datum transformations_, which I think the OP is really after.


Modulate Time in Logic Pro X?

Question: Before I started using Logic Pro, I was using Fruity Loops, and in that program you can very easily modulate time (I hope that is the correct term for this).  By this I mean it acts like the sound is on a record and you can push and pull the record while it spins.  This sound is like what you hear in most dubstep songs.  A very easy way to do this in Fruity Loops was using the Gross Beat plugin.
I have looked up how to do this, but all I can find is the Flex Time option for sound files, this only speeds up and slows down the clip linearly.  I would like to be able to do an ease automation, and I am using MIDI, not actual sound.
In Logic Pro I have found a few things that produce a similar sound.

Glide I can make the MIDI instrument have a glide, and I can make it glide from the note that was played before to the one I want it to play.  But this is very inconvenient because it makes me have to create a note that I do not want before the note I want the effect done to (which will create unwanted sounds that can break the flow of the song.
Cutoff Changing the cutoff value through automations can create a similar noise, but this does not effect the time at all, and will create more work than I would like.
BPM I can automate the BPM, but this does the opposite of changing the cutoff value, it only slows it down and doesn't create any sounds.  It does, due to me using the Tape Delay, create an annoying high pitched click because of the dramatic speed up after the automation.  Changing the BPM also, obviously, messes up the BPM of the song, by this I mean it makes the song slower in that part but doesn't make it faster when its done to catch back up to where it is supposed to be.  This also effects the entire song, and not one specific instrument.

What I want, specifically, is a way to change the speed and pitch of the instrument for a short time, through automation, and when it is set back to normal it will speed the audio back up (or slows it down) so that the instrument catches up to where it should be.
Is there a built in way to do this in Logic Pro X? If there isn't, is there a plugin I can get to accomplish this?
Answer: You can use the fade tool for this and use the automation curve tool to adjust to your requirements.
By default the fade tool is set for volume fade in/fade out, but you can change this to speed to get the same effect. It's not like a DJ spin back, but a stop/start.
Hope that helps.

Modulate Time in Logic Pro X?


Removing leading dots from find command output when used with -exec echo {} option

Question: find . -type f -exec  echo {} \;

Using the above command, I want to get file names without leading "./" characters. So basically, I want to get:
filename

Instead of:
./filename

Any way to do this?
Comment: For files in sub-directories, do you just want `filename` or `path/to/sub/dir/filename` (without the leading `./`)?
Answer: Use * instead of . and the leading ./ disappears.
find * -type f

Note that it's the shell that first expands that * to the sorted list of non-hidden (by default) files in the current working directory and passes them instead of . as separate arguments to find.  That has several implications  that should be noted:

hidden files are omitted at the top level but not at deeper  levels (the ones  traversed by find).
the list is sorted at the top level (generally a plus)
you may run into the limit on the number of arguments that can be passed to command if the current working directory has a lot of file.
That won't work if there are files named !, (, ) or with a name starting with -, with possible nasty consequences if there's a file called -delete for instance.
Comment: @Hannes Don't use `.*` but `.[^.]* *`, else find will explore `..` See my answer for the full command. BTW, this is quite depressing to notice that this answer only repeats one of the commands I posted 3 years before, and yet this answer has twice more votes than mine despite it is incomplete (hidden files are omitted) and despite I warned such a construct should be avoided. Go figure... clearly, people prefer short answers, even if such answers fail in certain situations.
Comment: This is neat. It's worth mentioning that `*` is expanded by the shell to a list of all files that is then passed to `find`. Depending on the shell and its settings that listing may or may not contain files whose names start in a dot. That may be different from what `find` would do if it were given `.`. For bash you can use `find * .* -type f` to list all files.
Comment: With this I get shellcheck issue [SC2012](https://github.com/koalaman/shellcheck/wiki/SC2012) - just imagine one of the files is named `-name`.
Comment: works on macOS Catalina zsh
Comment: You are right. I upvoted your answer.
Comment: Lovely answer. Thank you!
Comment: This command fails if there are files beginning with - in the folder.
Comment: It fails if there are too many files for the shell to expand
Answer: Assuming that you don't want the filename alone, but also the full relative path without the leading ./, if you have GNU find you can use:
find . -type f -printf '%P\n'

From find(1) man page:

%P -  File's name with the name of the starting-point under which it was found removed.

Else, you can try one of these:
find . -type f -print | cut -d/ -f2-

find .[!.]* * -type f -print

You should avoid this last one (think of the excessively long command line if you have a lot of entries in your directory).
-print does the same thing as your -exec echo {} \; but is much better: no external process call so lower overhead and no undesirable side-effects with filenames beginning with a dash.
Comment: Using the `.[^.]*` syntax does not work in any (posix) shell that I am aware of.
Comment: @Juan From what I read, you know at least one shell that does not understand the `.[^.]*` syntax or that includes `.` and `..` in the resulting pathname expansion. Would you be kind enough to name it and explain what does not work? I do agree this is not strictly POSIX compliant and one should use `.[!.]*` instead, but I have used this syntax on many platforms for more than 30 years and never had a problem with it.
Comment: some shells where the `.[^.]*` syntax does not match strings that start with a dot followed by a non-dot: mksh r59, dash 0.5.10.2, ksh 2020.0.0, pdksh 5.2.14 - some cause the error: "find: .[^.]*: No such file or directory". However, it looks liks POSIX currently *does* specify bracket expressions as valid (and not optional) for pattern matching (see the 'Shell and Utilities' document, 'Pattern Matching Notation': https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_13). So the shells where it does not work appear to be deficient as far as POSIX is concerned.
Comment: Regarding the previous comment.  Interestingly, in the posix doc specified in the previous comment, section 2.13.1 explains that '!' can be used for the character class negation. And using '^' unquoted can produce "unspecified results".  If you do `ls -d .[^.]*` with dash, it only lists `..`, but `ls -d .[!.]*` lists dot files and not `.` nor `..`.  So dash does support bracket expressions, albeit a bit differently than bash.  It looks like dash doesn't support the ^ negation at all (which is not what posix is specifying as I read it).
Comment: It looks like using `.[!.]*` works with more shells than `.[^.]*` does.  The ksh flavors and dash seem to only accept ! for character class negation and not ^ - unless there is some way to properly quote the ^ for dash & ksh and get it working (but I didn't figure out a way to do that in some quick quoting / escaping attempts).  Maybe an edit to this answer that describes this would be helpful.
Comment: Thank you a lot @Juan for all your useful comments. Answer corrected (finally!)
Answer: find . -type f -exec  echo {} \;
Default action of find is to print results. When not explicitly told, find defaults to searching current directory. Your command can be simplified to find -type f.
Why/when does this matter? Only when you run this command on a sufficiently large directory, you will start to see the performance difference. -exec echo {} \; will make your computer work needlessly more because it has to start an external process like /bin/echo to print the filenames. One instance of echo executable is run per file found by find.
To answer your question about removing ./, a more efficient method would be to use cut. You know that the first two characters are always ./. cut -c3- will only retain characters from position 3 and beyond.
> cd /etc/fonts/conf.d
> find -type f | cut -c3-
99pdftoopvp.conf
00kde.conf
65-khmer.conf
README

This fails to work as expected if your filenames contain new line character, but that is another whole new story.
Comment: The form that omits specifying a search path/paths (`find -type f`) is not currently POSIX compatible behavior. This fails with variants of find(1) that are not GNU find.
Comment: `cut`  cuts each line but there's nothing stopping a file path from containing newline characters.
Comment: The cut option is the only one that works on my Linux machine for multilevel outputs. Thanks!
Answer: The GNU version of find provides the builtin action -printf format which allows you to format the output of your query.
So to answer your question
find . -type f -printf '%f\n'

Will output only the filenames with no leading characters (or pathnames) with a newline so each filename is on it's own line
Comment: @grenix Try: `find . -type f -printf '%P\n'`
Comment: the question was to eliminate leading "./" and not pathnames, but thanks for the trigger to read into find's printf capabilities. BTW: '%h/%f' does not help either.
Comment: From man page
> %f     File's name with any leading directories removed (only the last element).
Answer: The answers with printf are missing the point for the case where I want to run a command via -exec on the params and echo is just an example. In reality I may want to run my-command on the found files instead of echo
Here's a maybe not efficient but working solution:
find . -type f -exec sh -c 'echo ${0#./}' "{}" \;

Explanation:

We rely on the fact that sh -c 'echo $0' foobar runs a subshell which prints $0, and foobar is passed as $0, so it prints foobar
instead of $0, we actually use ${0#./}, which means "use $0, but strip leading ./ (#./) - this is parameter expansion
we pass {} from exec (the found filename from find with leading slash) as $0 to sh -c

So in the end to run my-command on found files without leading ./, you'd do:
find . -type f -exec sh -c 'my-command ${0#./}' "{}" \;

Answer: In:
find path/to/dir some/file other-file other/dir <criteria> -print

Or:
find path/to/dir some/file other-file other/dir <criteria> -exec cmd -- {} ';'

We tell find to find files matching the <criterial> starting with the list of file paths given as initial arguments.
If path/to/dir above matches the <criteria>, it will be printed or cmd will be called with -- and path/to/dir as arguments. Same for some/file or other/dir.
If path/to/dir is a file of type directory, and -prune has not been called for it, then find will carry on processing files within it, with path/to/dir/file-within as the path being processed.
. in that regard is just like any other path.  It's a path to the current working directory, so if . matches the criteria, that will print ., and if the file-within also does, it will print ./file-within.
As others have said, the GNU implementation of find has a -printf predicate which can be used in place of -print to print other attributes of the matching files than the file path. -print is the equivalent of -printf '%p\n', but in place of %p, you can also use:

%f: the file's name without any leading path component (the basename or tail)
%h: the directory containing the file or . for /-less path (the  dirname or head).
%P: the file path relative to the initial dir/file it was found under, or the empty string for that file itself.
%H: the initial dir/file it was found under
and many other metadata of the file.

So except for /-less files, %p is the same as %h/%f and except for the initial dir/file themselves, the same as %H/%P.
For example:
$ find path/to/dir other-file -printf '%%p="%p" %%h="%h" %%f="%f" %%H="%H" %%P="%P"\n'
%p="path/to/dir" %h="path/to" %f="dir" %H="path/to/dir" %P=""
%p="path/to/dir/file-within" %h="path/to/dir" %f="file-within" %H="path/to/dir" %P="file-within"
%p="other-file" %h="." %f="other-file" %H="other-file" %P=""

$ cd path/to/dir
$ find . -printf '%%p="%p" %%h="%h" %%f="%f" %%H="%H" %%P="%P"\n'
%p="." %h="." %f="." %H="." %P=""
%p="./file-within" %h="." %f="file-within" %H="." %P="file-within"

find . <criteria> -printf '%P\n'

Will report the paths of matching files relative to the current working directory but not for . itself, so in the general case, you rather need:
find . <criteria> '(' -name . -print -o -printf '%P\n' ')'

(. wouldn't match a -type f criteria though, so we do not need to special case it in that case or any other case where we can guarantee . won't match the criteria).
Now, assuming your echo was just an example standing in for any another command, -printf alone won't help.
With the GNU implementation of xargs, and a shell with ksh-style process substitution, you can do though:
xargs -0I {} -a <(
  find . <criterial> '(' -name . -print0 -o -printf '%P\0' ')'
) cmd -- {}

Where find prints those relative paths NUL-delimited, which xargs retrieves and passes as argument to cmd.
Or even:
xargs -r0 -a <(
  find . <criterial> '(' -name . -printf '.\0' -o -printf '%P\0' ')'
) cmd --

If cmd can take more than one file path as argument (similar to what you can do with -exec cmd {} +).
Now, that won't help if -exec cmd {} ';' was intended to be used as a condition, like in:
find . -type f -exec grep -l needle {} ';' \
  -exec cmd-for-files-with-needle {} ';'

Where the cmd-for-files-with-needle is executed for files for which grep succeeds (after having printed the path of the matching files with -l).
Then, you could do instead (and that does not require GNU find nor xargs):
find . <criteria> -exec sh -c '
  for file do
    file=${file#./} # strip the leading ./ if any. It leaves . as is,
                    # so we do not need to special-case it
    grep -l -- needle "$file" &&
      cmd-for-files-with-needle -- "$file"
  done' sh {} +

Note the need for --, now that the file paths are not guaranteed to start with . and therefore may start with -.
Or you could use zsh where globs can do most of what find can do. For instance:
for file in **/*(ND.m-1); do
  grep -l -- needle $file &&
    cmd-for-files-with-needle -- $file
done

Where the . glob qualifier is the equivalent of find's -type f, m-1 of -mtime -1, N for nullglob, D for dotglob.
Here, a ./ prefix is not included (you could do ./**/* if you wanted it), . is not included (like -mindepth 1 in GNU find), and the list is sorted (and the sorting order can be changed with the o/O/n glob qualifiers)


Not given the option for kids to move

Question: I just built the lake view manor and it is fully furnished. I have 2 children's beds and chests. My husband gave me the option to move to the new location, but my kids don't have that option. Is there something else I need?
Comment: I *think* your kids will move along with your hubby and you don't need to ask them specifically.
Answer: When you tell your spouse to move, they will automatically move the kids as well.  I've done this in game many times.
Comment: Thanks...yea my game had a glitch but it fixed itself. I asked my husband to go and he went, but my kids remained in whiterun...but when I restarted the game and fast traveled to the Lakeview Manor they were there...so the glitch worked itself out. Thanks everyone.
Answer: Try to download the Unofficial Hearthfire Patch to fix the bug. Sometimes you can tell your spouse to move to another place and the kid go with them, but as you said the kids were staying in Whiterun while your spouse was in Lakeview Manor.

Not given the option for kids to move


repeating words such as 俺は

Question: In animes only, I have heard repeating words like 俺は. For example: 「俺は、俺は」. Question is, what does this try to achieve? If memory serve me right, I recall it only being used by someone in a very bad state of mind. For example: 死んだら、俺は俺は, and the sentence never complete. Literal translation gives "if you die, I, I", which in english at least doesn't makes sense. So what does that sentence mean in japanese?
Answer: It's merely an incomplete sentence. It's indeed "If [I/you] die, I, I, ..." and nothing more. Maybe you missed the the remaining part of this sentence in the next page. Or maybe he was simply too upset or weak to finish this sentence. Or maybe he wanted to continue this sentence but was interrupted by another character. Usually something like 悲しいよ, 困るぞ or どうしたらいいか分からない would follow, but it entirely depends on the context.
Answer: The person is hesitant to finish the sentence. I have heard this in English my whole life. Books, movies; for dramatic effect. I've even done it myself. Maybe not say "I" twice but at least once and then not finish the sentence. What's strange about it?
Comment: "I don't know what to say/do" <-- that's what I call hesitance... @Newbie
Comment: It really depends. From the example sentence, it really isn't hesitance at all. It's more like "I don't know what to say/do"
Comment: @Sweeper Hesitance = I know what to do but I am hesitant to do it. I wouldn't be so called "hesitant" if I don't know what to do. Then again, it;s all jargon

repeating words such as 俺は


How to get this data sent to from index.js to script.js using express (Node JS)?

Question: Beginner here...so bear with me :)
I'm getting this dataset in the console, but I can't wrap my head around getting it sent to the client side...
const { response } = require('express');
const express = require('express');
const app = express();
const port = 3000;

app.use(express.static('public'));

app.listen(port, () => console.log(`Example app listening at http://localhost:${port}`));

const translate = require('sdapi').default.translate;
translate('hablar').then(console.log);

This is the result I get:
[
  {
    word: 'hablar',
    lang: 'es',
    gender: undefined,
    context: 'to articulate words',
    meaning: 'to speak',
    part: 'intransitive verb',
    examples: [ [Object] ],
    regions: []
  }]

I've tried wraping it into a app.get('/translation', async (req, res) => {}) but it doesn't work.
Appreciate your time/attention.
Answer: app.get('/translate/:word', async (req, res) => {
  const {
    params: { word },
  } = req; // same as const word = req.params.word
  const translatedWord = await translate(word); // same as .then

  return res.status(200).json({ translatedResponse: translatedWord });
});

To activate this you have to send http get request to whateverip:port/translate/<WORD_TO_TRANSLATE_INPUT>
You can send http requests with axios, curl, or fetch and your browser's terminal thouhg the last one isn't always optimal solution.
Answer: I think you want to check your controller and sed data to it
so the first step that u must do to install body-parser with npm i body-parser
then use it like
const bodyParser = require('body-parser');
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json());

now u can receive and store your data on request.
then learn about the request  (https://expressjs.com/en/guide/routing.html)
then u can send a request to your server with postman or Axios or curl and something else .
I hope to solve your question.


When starting gameplay at a level higher than level one, how much gold/magic items do you start with?

Question: For a campaign that I have upcoming I am planning on having the characters start on level 3 or 4. I know for a fact that when starting a campaign from level 1 all PCs start with 100 gold, and as there are rules for making stats while starting at a higher level I'm assuming that somewhere there are rules for how much money those characters start with that's higher than 100, or they're entitled to some amount of magic items, but I am unsure of what that is.
Answer: When starting at a level higher than 1 players should each have the folloing:

One magic item of their level
  One magic item of their level -1
  One magic item of their level +1
  Gold to buy other items equal to an item of their level -1

(DMG p143)
Comment: **If** you're using the rarity rules, the items the players start with can be common or uncommon, but they can only use the gold to buy common items.


How do symbolic math software work?

Question: As the answer to a question of mine I was referred to a website (see here please)
How can WolframAlpha do it like humans?
Comment: http://en.wikipedia.org/wiki/Computer_algebra_system
Comment: @Amzoti. Relatively new means almost 55 years !
Comment: Thank you. I got so comfortable in this website even forgot to ask Google :)
Comment: You are welcome. This is a relatively new science in its own right. Very fascinating pointers to some of the methods on the site. I would venture to say that most times a CAS arrives at a result is not how we do it. Regards
Comment: @ClaudeLeibovici: Wow, has it been that long! Time flies when you are having fun!
Answer: For the specific system (Mathematica) that you mentioned, there are  descriptions of its internals on these web pages and these. But Mathematica is a commercial system, so its internal workings are proprietary, which is why the descriptions don't provide much detail.
While these systems might appear to work "the same way as a human", they really don't. Human beings often use clever creative tricks to solve problems. Computers in general (and computer algebra systems in particular) typically use brute-force systematic methods, as described in the referenced materials. See the description of how Mathematica finds indefinite integrals, for example.
The best results are obtained by a combination of a powerful brute-force computing and intelligent guidance provided by a human being. Computer algebra systems are enormously useful, but they only do what you tell them to do  :-)
Answer: A symbolic calculator basically is a fancy calculator, pretty much in line with any other calculator.  You can find a whole string of calculators that basically go from your old 4-function right to mathematica and kindred programs.
For example, some of the more recent calculators allow fraction-input, like 5.1.3 for $5\frac 13$.  Some allow complex numbers and matrices to be put in, by moving the cursor around the field, or whatever.  A polynomial is a array of numbers.
As long at the programmer can implement some function, and communicate this to the user, you can do all sorts of fancy things by programming.  Not all mathematical algorithms work here, though.
There is some fancy maths out there, that variously do and do not work in real time.  A recent project i did was to seek out for which prime $p$ exists, if $p \mid F_n$, then so does $p^2$.  Such ought exist, but the program found none under $20\cdot 120^4$.  The trick was to see if $L_{2p}=3 \pmod{p^2}$, where $L_n$ is the nth lucas number.
It did find the Heron number $103$, where a triangle $n-1, n, n+1$ is a triangle with integer area, then if $103$ divides any of these numbers, so does $103^2$.
Answer: The internal implementation of symbolic systems are closely related to how compilers work and you can find a lot of the internal implementation details in this Wikipedia article: https://en.wikipedia.org/wiki/Computer_algebra but to really understand it or implement a simplified version of something of that caliber you will probably need to get experience with some functional programming language like Haskell and then gain a lot of knowledge of how compilers in general(and specifically for functional languages) work.

How do symbolic math software work?


Can I get Minecraft Pocket Edition for free if I've already bought the game?

Question: Minecraft Pocket Edition has just been released and since I've already bought the game for PC I was hoping I could get the pocket edition for free. Does it do any account verification to check if you've already paid, perhaps?
Comment: Possible duplicate of [Can you get Minecraft Java for free if you have purchased Minecraft Bedrock?](https://gaming.stackexchange.com/questions/389361/can-you-get-minecraft-java-for-free-if-you-have-purchased-minecraft-bedrock) (per galacticninja's answer to that question that applies both ways)
Answer: No you cannot. The game is only available from the Play Store, for Android, or iTunes for iOS, and you must purchase it from there.
It is a separate product, so it is exempt from the Alpha/Beta All/until release future editions free promise.
Comment: The way the Android Market is set up doesn't really allow for that, anyway.
Comment: @Matthew I can attest to this from experience, having an Alpha Minecraft account and still having to buy Pocket Edition from the Android Market.
Comment: I would assume this is right, but: Reference?
Comment: @Keaanu I'm more looking for an official statement of some sort, that would rule out any kind of arrangement to get the app that you might be unaware of.
Comment: Not a massive revelation, but since this was answer was posted, Minecraft Pocket Edition is available for iOS as well. Just thought it would make the answer more complete.
Answer: They are completely separate products, so having one does not mean you can get the other for free, unless of course you were talking about Minecraft PE Free Version. :)
Answer: Minecraft PE is £5.00 (pounds) £7.00 (dollars)
They are separate games so you cannot get Minecraft PE for free.


Manual car engine rpm dropped below idle rpm while in neutral

Question: My car is 2007 Toyota Prado GX manual with the D-4D engine. I was waiting for green light so I put my gear in neutral. After about 1 minute the engine rev dropped below the idle rpm by a lot so it immediately stopped. I had no problem restarting the car. And on my way home the car did the same thing twice. After that when I put the gear into 1 and pushed the accelerator the car received no power and the engine died again. (This problem only happened this once since that day.) The rpm dropping problem occurs basically every 2 minutes while in neutral. Besides problems listed above the car starts and runs fine. I doubt it might be the injectors, so I quoted a mechanic and he said to replace the injectors it will cost me AUD$2k or more. Is it normal? What else could be the possible reasons for that to happen? Thanks a lot.
Answer: You may have water in your diesel fuel. Drain some fuel from your water separator and collect it into a clear container. If the fuel separates into two layers, that indicates water.
I don't know your particular engine, but most diesels have their water separator under the fuel filter housing, or integral with the fuel filter.
If you find water, continue draining fuel from the separator until you get only 1 layer in your clear container.
Comment: Thanks for your reply! I went to a mechanic today and he said the water separator is fine. And he said I need a new solenoid valve, and some pipe is broken under my engine. He said if I got these replaced it might fix the issue.


Colimits of short exact sequences of C*-algebras

Question: Assume I have an inductive system of short exact sequences of $C^{\ast}$-algebras (i.e., short exact sequences $0 \to A_n \to B_n \to C_n \to 0$ together with transformations from the $n$-th to the $(n+1)$-st short exact sequence so that all squares commute). If I form now the colimit of the $C^{\ast}$-algebras, is the resulting sequence $$0 \to \varinjlim A_n \to \varinjlim B_n \to \varinjlim C_n \to 0$$ still exact? Note that I do not want to assume here that the connecting maps in the colimits I form are injective.
Answer: My notation
$$
  i_n:A_n\to B_n,
  $$
$$
  p_n:B_n\to C_n,
  $$
$$
  i:\displaystyle \lim_\to A_n\to \displaystyle \lim_\to B_n,
  $$
$$
  p:\displaystyle \lim_\to B_n\to \displaystyle \lim_\to C_n,
  $$
$$
  \beta _n:B_n\to\displaystyle \lim_\to B_n.
  $$
I suppose the only contentious  point is to prove that $\text{Ker}(p) \subseteq  \text{Im}(i)$, so suppose that this fails.  For
each $\varepsilon >0$ we may then choose some $b\in  \displaystyle \lim_\to B_n$, such that

$\|p(b)\|<\varepsilon $,

$\text{dist}(b,\text{Im}(i)) > 1-\varepsilon $.

Since the union of the images of the $B_n$ is dense in $\displaystyle \lim_\to B_n$, we may assume that $b=\beta_n(b_n)$, for some $b_n\in B_n$.
Increasing $n$, if necessary, we may assume that moreover $\|p_n(b_n)\|<\varepsilon $.  But this is a contradiction since
$$
  \varepsilon >\|p_n(b_n)\| = \text{dist}(b_n,\text{Im}(i_n))\geq $$ $$ \geq\text{dist}(\beta _n(b_n),\text{Im}(i))=
  \text{dist}(b,\text{Im}(i)) >1-\varepsilon .
  $$
Comment: Alex, you are correct on both of your claims.  Indeed what makes life so much easier when dealing with $^*$-homomomorphisms on C*-algebras is that every such map is isometric when the kernel is modded out, so, as you say, must have a closed range.   I figure Banach space people must be very envious of us for this!
Comment: Looks good, thanks! I think that we need to use that images of ${}^*$-homomorphisms between $C^*$-algebras are closed, otherwise you might not be able to find the element $b$ in the first step. Actually, that the map $i$ is injective is also not completely trivial: I had to use that each of the maps $i_n$ is isometric since they are injective.


do I have to explicity dispose the transaction once I've already disposed the session?

Question: I think that it's not necessary in this case (although I know we can use using for the transaction as well as for the session). Here is the code I'm wondering about:
using(var session = _sessionFactory.OpenSession()){
     session.BeginTransaction();
     try {
        //some code
        session.Transaction.Commit();
     } catch(Exception ex){
        session.Transaction.Rollback();
     }
}

Is there any leakage for the code above? I know it would seem to be better to write it like this:
using(var session = _sessionFactory.OpenSession()){
     using(var t = session.BeginTransaction()){
       try {
          //some code
          t.Commit();
       } catch(Exception ex){
          t.Rollback();
       }
     }
}

However as I said, I wonder about the necessity to dispose the transaction explicitly as well. Please advise. Btw do the above code is safe enough (using/closing right away) to use for polling data such as every second? Can it bombard with increasing opened connections to the target database? I don't think keeping a long-opening connection is good in any case.
Answer: Check the documentation here microsoft docs

Calling this method marks the end of the transaction scope. If the TransactionScope object created the transaction and Complete was
  called on the scope, the TransactionScope object attempts to commit
  the transaction when this method is called. In this case, this method
  blocks until the first phase of transaction processing is complete.
  The first phase ends after all resource managers and enlistments in
  the transaction have voted on the transaction outcome and the
  TransactionManager has durably decided to commit or abort the
  transaction. The second phase of processing is always asynchronous.
  Therefore, there is no guarantee that data just committed from within
  a given transaction will be immediately available afterwards when not
  using another transaction to view this data.
The use of the C# using construction ensures that this method is
  called even if an exception occurs. Exceptions that occur after
  calling this method may not affect the transaction. This method also
  restores the ambient transaction to it original state. A
  TransactionAbortedException is thrown if the transaction is not
  actually committed.

In truth, this would be the exact same thing with having a finally clause with dispose command in it only. But you can never be sure that the next developer will not do something like this:
using(var session = _sessionFactory.OpenSession()){
     using(var t = session.BeginTransaction()){
       try {
          //some code
          t.Commit();
       } catch(Exception ex){
          // Code the throws exception
          t.Rollback();
       } finally {
          // Some other code that throws exception
          // And then dispose
       }
     }
}

So instead of syntactic sugar, this also helps make sure that whatever happens everything is disposed correctly.
You can check the code here
https://github.com/nhibernate/nhibernate-core/blob/master/src/NHibernate/Impl/
In SessionImpl.cs you will find that the code does nothing to close and/or dispose the transaction.
Comment: I'm not asking for the meaning and usage of 'using'. I meant if session is disposed will the transaction be disposed as well? So that I don't have to explicitly use 'using' on the transaction as in the second code snippet in my question. I think it's very clear about what I wonder about here
Comment: The question doesn't ask about TransactionScope though. However, I agree that there is probably not much to gain from skipping the using-statement regardless of if it is required or not.
Comment: Point in case,  both need to call the dispose implementation. Session has its own and so does transaction scope


Architecture: MVC based web-apps around a REST interface

Question: I'm not sure how to phrase my question....
From different sources I pick up the idea that it makes sense to build web applications around a REST interface.  A REST service could execute some controller logic (validations, database-access, etc) and then return a (static) *.xhtml resource.  Combined with a decent javascript framework, this html page could complete itself by issuing the approriate AJAX calls.
Intuitively I see value in this (it feels more lightweight than a server-side document model like in JSF), but I also feel like I'm missing the complete picture here.  What 'they' are referring to, is that simply Struts or Spring MVC with a REST sauce?
Do you see what I mean?  Can somebody put these idea's in perspective?  Point to a resource that explains the approach I'm trying to grasp?  What are the roots?
Thank you for helping me to clarify all this! J.
Answer: Names coined in this context are SOFEA and SOUI.


Is there a way to align desktop icons to (a vertical and horizontal) grid?

Question: Is there a way to align desktop icons to (a vertical AND horizontal) grid.
like in Windows for example.
Answer: Right click on desktop, and check 'keep aligned'. This automatically snaps the icons to grid.
Comment: o. i see. Are there any settings that align icons automatically?
Answer: I wrote iconic to let you define a grid size to suit your needs. Additionally it will:

Allow you to move icons to any of three monitors
Not suffer the "lost icon syndrome" that occurs when monitors of multiple resolutions are used
Sort icons alphabetically, alphabetically with "Link to" prefix ignored, sort by modified date ascending or date descending
Allow different grid size (columns x rows) depending on monitor, EG more on 4K monitor than 2K monitor
Instant Test button for quick experimentation on column x row changes or reserved space changes for monitor left, top, right or bottom areas
Test button will last for x seconds defined by you, clear all windows before test and restore them after test
Bash script for easy modifications

You can get the script on github.
Here's the main screen:

Visit the github page for iconic to see all the other screens, explanations and a copy of the script.


webservice callout without future

Question: I have a trigger on the user object which calls an external web service to assign some values to every newly inserted user but now client want to insert the user's via batch(which we don't have access to) so I want to know if we can call web service without future or any way to solve this problem.
Answer: You can use a callout in batch Apex, to do that you must specify Database.AllowsCallouts in the class definition as explained in this link.
For example the syntax will be:
global class SearchAndReplace implements Database.Batchable<sObject>,
   Database.AllowsCallouts{
              //Business logic you want by implementing Batchable interface methods
}

Also, you can refer to this link for implementation.
Comment: You can write a utility class which handles the call out and ask the client to implement the interface and invokes your utility class method to perform the action.
Comment: The problem here is we don't have access to batch that inserts user's as it is handled by client

webservice callout without future