Transformation from Geocentric Coordinates into Equatorial Coordinates?

Question: I have the moon's position in equatorial coordinates (RA and Dec) and now I want to calculate same moon's position in terms of earth centered coordinates i.e. Geocentric (latitude & longitude). My main goal is to establish a c++-code that gives me this transformation from RA,Dec to Lat,Lon and vice versa.
EDIT: More precisely, I have moon's position in equatorial geocentric coordinates with following details:
Origin: Center of Earth
Lat   : Declination With fundamental Plane: Celestial Equator
Lon   : R.A.        With Primary direction: Vernal Equinox
And I am able to obtain the moon's position corresponding to a specific Modified Julian Date (MJD). I am also able to calculate moon's position in xyz-coordinates by following calculations
$X= EarthMoon*sin(PI/2.-dec_moon*deg2rad)*cos(ra_moon*deg2rad);$
$Y= EarthMoon*sin(PI/2.-dec_moon*deg2rad)*sin(ra_moon*deg2rad);$
$Z= EarthMoon*cos(PI/2.-dec_moon*deg2rad);$
where EarthMoon is the distance between Earth and Moon. Further, I am converting them into Horizon Coordinates (topocentric) w.r.t to an observer at a specific location by using my subroutine and this part done.
Further, I am initiating my simulated CR-particles from observer site. E.g. vCR[3]= {R,lat,lon}
vCR[3]={Rearth+2300, 31.30, 55.74} //Geocentric CS (earth-based)
And converting them into Geocentric Cartesian coordinates(x,y,z). Finally, I have
vM[3]={X,Y,Z}; in Equatorial geocentric coordinate system
vCR[3]={x,y,z}; in Geocentric Coordinate System i.e. Earth based
That is my particular question in which I want to make vM[moon position] and vCR[CR position] to lie in same coordinates to get my final result. i.e. transformation from Geocentric (R,lat,lon) into Equatorial Geocentric (h,R.A,Dec).
Note: For vCR[3]: zero-longitude is the Prime Meridian, Greenwich whereas for vM[3] it's vernal equinox in celestial sphere there is the difference.
Comment: See C CSPICE at http://naif.jpl.nasa.gov/naif/tutorials.html which include source code.
Answer: If I understand your question correctly than your problem is that the primary direction of vCR[3] is the intersection between the prime meridian and the Earth's equator, instead of the vernal equinox. The geographical latitude is the same as the declination, but to get the right ascension you will need to rotate your coordinates around the z-axis by an amount that is equal to the sidereal time at Greenwich ($\theta_G$). This is done, simply by replacing the the longitude (lon) with the sidereal time at your location $\theta = \theta_G-lon$.
x =  R* cos(lat) * cos(theta);
y=   R* cos(lat) * sin(theta);
z =  R* sin(lat);

vCR[3]={x,y,z};

where theta is the sidereal time $\theta$.
The sidereal time is not a time but actually an angle that gives the right ascension of objects that are at that moment crossing the local meridian (i.e. the line between South and the Celestial north pole, for observers on the northern hemisphere). It is in a sense the longitude of your position on Earth if the geographical coordinate system were to rotate along with the celestial sphere.
EDIT: To calculate the Sidereal time, you can use the method explained in Astronomical Algorithms by Jean Meeus:
$$T = \frac{JD-2451545.0}{3625}$$
$$\theta_0 = 100.46061837 + 36000.770053608 T + 0.000387933 T^2 - \frac{T^3}{38710000}$$
The sidereal time is expressed in degrees.
Then express the UTC time as an angle:
$$t = 15h+0.25m+\frac{0.25}{60}s$$
where $h$ is the number of hours, $m$, the number of minutes, and $s$ the number of seconds.
The sidereal time at Greenwich at the specified time is then:
$$\theta_G = \theta + 1.00273790935*t $$
and the local sidereal time is:
$$\theta = \theta_G - L$$
Where $L$ is the geographical longitude (positive west from Greenwich).
Comment: Yes this time you understand my problem quite well and the only difference is in longitude and Right ascension (R.A).

According to my knowledge, sidereal time is the time taken by earth to spin with respect to the STARS not Sun. Further,

Hour Angle = Sidereal time -  R.A

and if I am not wrong then here you mention theta is basically Hour angle which is actually an angle. If this is the situation so I need to calculate first sidereal time w.r.t Greenwich. i.e. GST. So may you further guide me to how to calculate this? What I already have is modified Julian date (mjd) only.
Comment: No, the hour angle is the angle between the meridian (the line from south through zenith to the celestial north pole) and the longitudinal component of the position of the object. If RA = sidereal time then the hour angle is 0, i.e. the object is on the meridian. The sidereal time is, therefore, the RA of the objects that at that moment pass through the meridian. The sidereal time is NOT a time (which would also imply a date), it is an angle.
Comment: I am working on it and i hope it will work ..... thanks for all this
Comment: One more relevant question: If we want to convert geocentric (alt,lat,lon) into geocentric cartesian coordinates (x,y,z), we simply need to use spherical to cartesian transformation formulas i.e.
x= R+h*sin(lat)*cos(lon), y= R+h*sin(lat)*cos(lon), z=R+h*cos(lat)  Or Same formulas with these modifications  lat= lat-90, lon = lon+180.
Comment: I'm not sure I understand your question correctly. If you have geocentric coordinates you have longitude and latitude **and distance** ($d$), I'm not sure what you mean by alt. To get the cartesian coordinates: $x=d\cos(lon)\cos(lat)$, $y=d\sin(lon)\cos(lat)$ and $z=d\sin(lat)$.
Comment: Exactly, I was just expressing *d* as **alt** here and these are the right relations, I just want to re-confirm. Thanks.
Comment: I got some results for local sidereal time by following formulation mentioned above but I have doubt either they are correct or not. Can you suggest me a way to re-check my results for further use.
Comment: You can use an online calculator such as [Skywatch](http://www.wwu.edu/skywise/skymobile/skywatch.html) from Western Washington University Planetarium
Answer: I think, you are mixing two different concepts. Equatorial coordinates are coordinates in the equatorial coordinate system (as opposed to the ecliptical, galactic, super galactic, or horizontal coordinate systems). The coordinates also refer to a specific origin. This origin might be heliocentric (centre of the Sun), baryocentric (centre of mass of the Solar System), geocentric (centre of the Earth), or topocentric (a specific location on the Earth's ellipsoid).
So you may have heliocentric equatorial coordinates, geocentric equatorial coordinates, or topocentric equatorial coordinates.
From your question I infer that you have geocentric coordinates of the Moon and you want to convert them to topocentric (not geocentric!) coordinates for an observer at a specific location (latitude and longitude) on the Earth.
The best way to go about this would be to:

First, convert you geocentric equatorial coordinates to its rectangular equivalent (i.e. find the $X_M$, $Y_M$, and $Z_M$ equatorial coordinates).
Second calculate the $X_o$, $Y_o$, and $Z_o$ coordinates of the observer on Earth in the equatorial system.
Third, subtract the $X_o$, $Y_o$, and $Z_o$ coordinates of the observer from the $X_M$, $Y_M$, and $Z_M$ coordinates of the Moon.
Finally, convert the coordinates back to spherical coordinates, i.e. the $X$, $Y$, and $Z$ coordinates back to right ascension, declination, and distance.

If you have the geocentric right ascension $\alpha_M$, declination $\delta_M$, and distance $d_M$, then you can get the rectangular coordinates from:
$$ X_M = d_M \cos(\alpha_M) \cos(\delta_M) $$
$$ Y_M = d_M \sin(\alpha_M) \cos(\delta_M) $$
$$ Z_M = d_M \sin(\delta_M)  $$
The $X$-axis is pointed towards the vernal equinox, and the $Z$-axis is pointed towards the celestial north pole (i.e. parallel with the Earth's rotation axis).
For the rectangular equatorial coordinates of the observer, you need the geographical latitude ($\phi$) and longitude ($L$), the elevation ($H$) and the sidereal time ($\theta$).
To calculate the rectangular coordinates of the observer is a bit more difficult as the Earth's surface is (approximately) an ellipsoid. The following is taken from Jean Meeus book, Astronomical Algorithms:
$$b' = 0.99664719$$
which is a measure of the ellipsoid.
$$ u = \arctan(b' \tan(\phi)) $$
$$ \rho\sin(\phi) = R_E b' \sin(u) + H \sin(\phi)) $$
$$ \rho\cos(\phi) = R_E \cos(u) + H \cos(\phi) $$
where $R_E = 6378140.0 \textrm{m}$ is the Earth's radius.
We can then calculate the rectangular geocentric equatorial coordinates of the observer:
$$ X_o =  \rho \cos(\phi) \cos(\theta)$$
$$ Y_o =  \rho \cos(\phi) \sin(\theta)$$
$$ Z_o =  \rho \sin(\phi) $$
The topocentric rectangular equatorial coordinates of the Moon are then:
$$ X = X_M - X_o $$
$$ Y = Y_M - Y_o $$
$$ Z = Z_M - Z_o $$
Then convert back to spherical coordinates:
$$ d' = \sqrt{X^2 + Y^2 + Z^2} $$
$$ \alpha' = \arctan \left(\frac{Y}{X} \right) $$
$$ \delta' = \arcsin \left(\frac{Z}{d'} \right) $$
You then have the topocentric equatorial coordinates of the Moon: right ascension $\alpha'$, declination $\delta'$ and the distance $d'$.
You will have to make sure that $\alpha'$ is in the correct quadrant. Programmatically this can be easily achieved with the atan2 function, i.e. alpha = atan2(y,x).
I haven't tested these formulae so I hope that they are correct.
Comment: First of all, thanks for your kind reply. Now directly come to my point. Actually, I am dealing with two things simultaneously. More precisely, I have moon's position (yes) in equatorial geocentric coordinates with following details:
 Origin: Center of Earth
 Lat      : Declination With fundamental Plane: Celestial Equator
 Lon     : R.A.  With Primary direction: Vernal Equinox
And I am able to obtain the moon's position corresponding to a specific Modified Julian Date (MJD) by recalling a subroutine like
 moon_pos(mjd, &ra_moon, &dec_moon);
Comment: Then `ra_moon` will contain the right ascension of the moon ($\alpha_M$) and `dec_moon` will contain the declination of the moon ($\delta_M$), which you can use in the formulae above. You will, however, also need the distance to the moon, otherwise you will never be able to determine topocentric coordinates. You can only find the parallax if you know the distance.
Comment: the previous comment was not complete because of limitation of words here so i wrote it down again so sorry for this inconvenience.


What kinds of documentation does a US citizen need to enter the UK on a tourist visa?

Question: I am a US citizen travelling to the UK for tourism. What kinds of documentation do I need to make sure that I have have with me when I get to passport control to make sure I get a visa on arrival?
Comment: or the other way round ????
Answer: You won't get a visa on arrival in the UK but as US citizen you generally don't need a visa. In all likelihood, you won't be asked to show anything but in theory you are supposed to bring the same things that you would need to apply for visa (bank statement, itinerary, etc.).
Details are available on gov.uk
Comment: @Jason A visa is a little more than that and the difference does typically matter legally speaking. The exact terminology and consequences will depend on the country but for example the Schengen area makes a clear distinction between a visa-on-arrival (only issued in exceptional cases) and visa-free visits. However, it's true that there is a limit on the allowed duration of stay in both cases.
Comment: Don't you technically get a visa no matter where you travel, it is just "transparent" when you arrive in a country that has visa-on-arriva? In other words you still have a limit on the amount of time you can spend in the country (which is the visa) but you do not need to apply for it in advance?
Comment: @Jason Forgot to mention: Technically, I think that what you would get when entering the UK is called a "leave to enter".


What are my chances of getting into a top PhD program in the US when coming from a no-name university?

Question: I have a 4.0 GPA in computer science from a no name university (1001-1200 in THE) and I have 3 months worth of research experience at a good university in Europe plus one semester of a research project. Can universities like CMU, Yale, Prineton consider my application? Has anyone seen other cases like this?
Comment: Many people I know went to top universities for postgraduate study after graduating from low-ranking universities.
Comment: The essential problem is that no one, including you, really knows what the 4.0 GPA at your university means.  Generally speaking, because your university is likely to have lower standards than Stanford (because otherwise almost all students would fail), the minimum quality work sufficient to earn a 4.0 at your university might only earn a 2.5 at Stanford.  Your recommenders might have perspective about how your work compares and be able to share that in their letters (and with you), or they might not.
Comment: In the old days, a good score on the GRE subject test in Computer Science would help.  But that test was discontinued as of 2013.
Comment: @AlexanderWoo I don't think it works like that. Universities with higher rankings have more research output and much harder admission process, but once you are in they do not necessarily require more work to graduate or to get a good grade. Rankings do not evaluate the difficulty of the material, and often not even the quality of teaching.
Answer: While the name of your undergrad university certainly plays a role, your personal excellence is much more important. You need to show this in your CV and in your application. For example, if you are 1st author on a really good paper in your field (e.g. originating from your bachelor or master thesis) this certainly counts a lot. Glowing reference letters might also help (good is not enough).
Answer: You will be considered by any university you apply to, but for those top few places, the competition is fierce with lots of top applicants. For that reason alone, I'd say your chances are small.
While it is worth applying to such places if you have a good record and (US centric) very good letters of recommendation, you should make a broader search if you want to assure success overall. Spread some applications over interesting top fifty or so US institutions.
Answer: I know the US system is very different but what I have experienced and seen in Europe is this: you can try to get funding/apply and complete a one- or two-year master's degree at a "top" university. After that, the "top" university or a university of similar "rank" is much more likely to offer you a PhD position (assuming you did well, of course).
This is likely not directly applicable to the US, but perhaps there are options to get your foot in the door: e.g., summer course, internship, RA/TA jobs, etc.? I think your research internship is already a big plus, too.
Answer: The first year you are looking for a PhD, I would apply mostly to the programmers you are most invested in getting accepted to, but also to some research positions or masters degrees where you might get a chance to better prove yourself if you fail to get into the PhD programme you want. As others have said, publishing great papers, or having a letter of reference from someone known to the people in the department you are applying to both significantly increase your chances.
But keep in mind that competitive PhDs are competitive. It isn't just about you, it's about who else happens to apply the same year. There will always be an enormous chance element about whether the best supervisor matching your interests is even taking any PhDs the year you apply, or whether they happen to have just gotten a big grant and be taking a lot of students.
If you don't get into a PhD programme you had hoped to your first try, then you can put more time into the next tier down, or if you do get a good research position, you can put a lot of time into trying to get papers out and wind up in a stronger position for your application, or of course both.
Personally I only got accepted at the MOST competitive of the four places I applied to my first year trying. I got lucky! The professor I wanted to work with there took 8 students that year. If I'd applied the year before, he wouldn't have taken any, as he was going on sabbatical.
But having said that, I had a poor GPA from a decently-known undergraduate programme, so I didn't even apply to a PhD until I had already done a Masters and got good letters of recommendation -- in that case from references who weren't particularly well known, but from a known MSc programme.
Answer: Based on your description I'd say your odds are not good. You can tell how competitive you'll be by going to the website of your target university and searching for some PhD students' CVs.
Here is an example CV of a current student at Yale. Ignore everything from after 2019, because he enrolled at Yale in 2019. He had one publication (which won a first place prize too), several academic honours, some undergraduate teaching experience, some internship experience at Apple, and four different projects.
I don't know the specifics of course, but as you can see the competition at top universities is strong, and your competitors will be armed to the teeth.


How to use padStart in a JS loop to output a triangle of Xs?

Question: I am supposed to create a triangle of Xs as depicted in the link by using padString image of 20 lines of Xs starting with one X and incrementing by one X for each additional line
The hint they gave was that I am supposed to use something like...
let str = "";
str = str.padStart(i,"x"); // i is the loop counter

What I have so far is this...

let xShape = "x";
for (let counter = 0; counter <= 20; counter = counter + 1) {
  xShape = xShape + "x"
}
document.getElementById("demo").innerHTML =
  xShape.padStart(xShape, "x");

But that doesn't write out 20 lines of Xs starting with the first line having only one X with each new line having an additional X. It only writes the last line of 20 Xs. How do I get it to write all 20 lines? I am a beginner, and am doing this to learn. Thank you so much for your help.
Answer: padStart takes the string passed to it, and pads the beginning with the first argument as many times as the second argument.
So you can add it to a loop and just pass it an empty string so it will always have an empty starting point.

let xShape = "";
for (let counter = 0; counter <= 20; counter++) {
  xShape += "".padStart(counter, "x") + "
";
}
document.getElementById("demo").innerHTML = xShape;

Answer: You'll have to collect output lines in the loop somehow. But your use of padStart is also wrong: the first argument should not be a string, but a number. It should actually be your loop counter.

let lines = [];
for (let counter = 1; counter <= 20; counter = counter + 1) {
  lines.push("".padStart(counter, "x"));
}
document.getElementById("demo").innerHTML = lines.join("
");

Note that the method repeat is more natural here:

let lines = [];
for (let counter = 1; counter <= 20; counter = counter + 1) {
  lines.push("x".repeat(counter));
}
document.getElementById("demo").innerHTML = lines.join("
");

In a more functional approach:

document.getElementById("demo").innerHTML =
    Array.from({length:20}, (_, counter) => "x".repeat(counter+1))
         .join("
");


Traffic Allocation UI

Question: I am working on a UI for an A/B testing web-app. One of the features is traffic allocation, where you can set the percentage of the visitors that will see every variation of the test. For example, 20% will see version A, 30% will see version 2 and 50% - version C.
What are good example of tackling this feature? I want people to easily reach exactly 100% and not think as less as possible if the value they gave each variation is getting them exactly to 100%...
Comment: The simpliest way is to use two inputs for A and B versions and auto-calculated non-editable field for C version. Standard HTML inputs and a little javascript.
Comment: Agreed with Alexey. apart from you can also have some presets (20-20-60, 30-30-40 etc...)
Answer: I like Alexey's solution.
Alternatively to humble bundle sliders, you can implement multiple handlers in same slider.
Some sample
http://jsfiddle.net/q5WEe/1/
Answer: You could use a series of sliders, where moving one automatically adjusts the others so that they add up to a total of 100%. This has been implemented well on the Humble Bundle donation page:

Traffic Allocation UI


How to 'move' sygic maps to sd card

Question: I've a new Lollipop smartphone (LG Spirit), i've Sygic Gps, but when i download maps, Android save it to internal memory.
I've moved them to sd card (cut and paste), but when i start sygic it asks again which maps i would like to download.
Is there an hack i can do to make it work ?
Answer: I guess you might have been doing it wrong or maybe  the feature to switch to sd card storage was not yet introduced yet in the Sygic version.
According to instructions given on Sygic help, try the the following:

Depending on your device specifications and settings, Sygic files will
  install either to your SD card, or in your device's internal memory.
  If you want the Sygic files to be installed specifically to your SD
  card, please follow these steps:

before installing Sygic on your device, select the option Store new apps on SD card

or

If you already have Sygic installed on your device, you can change the storage location at any time, via the settings in the application.
Just go to Menu → Settings and tap on "Maps and Data storage" then choose the removable sd card option

How to 'move' sygic maps to sd card


Do Pals need to be released in order for their passive abilities to be in effect?

Question: Say I have a Pal with both Logging Foreman and Mine Foreman. Do I need to have to released and following me around to get the bonus logging/mining efficiency, or is simply having the Pal in my party enough for the passive to be active?
Answer: I did some science! For each of the below scenarios, I recorded the highest hit I observed, not the average, as there's a good bit of variance.
Short answer is -- you don't need the pal out; having them on you is good enough.

No Pals in Party: ~158 / hit with a metal axe
Gumoss in party: ~178 / hit with a metal axe
Logging Foreman Pal in party: ~206 / hit with a metal axe
Lucky Logging Foreman Gumoss in party: ~222 / hit with a metal axe


Alternate to hashtag or tagging a post?

Question: What is the best possible way to integrate user post (text/media) without using hashtag (ex: Twitter) or tagging (ex: Quora/SE).
I am building a social network site and I am confused with the integration of use generated post; it becomes comparatively easy to bring worldwide content searchable using hashtag or tagging but is there any other alternate?
Answer: Unless you manage to create a new way of accomplishing this that materially improves some aspect of tagging and searching user generated content, I would advise you not to try and reinvent the wheel.
And, if I managed to create this new pattern, I certainly wouldn't be giving it away on StackExchange ;).
Comment: Last line of your answer makes complete sense to me. (+1) :) If there is any other alternate & better way then that would be the selling point of the website. I have got another way but I think I need to see how it can beat the existing systems.
Comment: Definitely test the new interaction with real users. Find a way to discover whether it improves on the existing experiences and what new usability issues it creates, if any.
Answer: Other than placing posts into categories and/or searching for keywords in posts, there do not seem to be any (in)famous options left. The hashtag is a very powerful way to index specific data strings and simply suffices in its job.
Answer: Natural Language Processing comes to mind. I read this primer article on Medium. Hope it is useful. https://medium.com/@mattkiser/getting-started-with-natural-language-processing-54c7c90170e0

Alternate to hashtag or tagging a post?


Are creatures under the effect of the Minimus Containment version of the Imprisonment spell frozen in place?

Question: The spell says nothing can pass through the gem except light. Does that include the imprisoned creature moving around the inside of the gem?
Answer: The creature can move within the gem
The spell does not mention anything about the creature being frozen or being unable to move, so it does not do that to the creature, as presented in detail in Darth Pseudonym's answer here.
As additional evidence, see this Magic: the Gathering Card, created in consultation with the D&D creative team by the same company that publishes D&D, Wizards of the Coast (from the Adventures in the Forgotten Realms set):

The creature clearly is distressed by its unhappy circumstances, and it pounding and pressing against the prison wall to get out, so it is moving and not frozen in space.
Comment: My take here is that this is a "for what it's worth..." piece of *secondary* evidence, and Darth Pseudonym's answer provides a good, detailed analysis of the primary evidence we would be looking for with this question. My recommendation would be to link to Darth's answer specifically, rather than to the generic "spells do what they say they do" Q&A, acknowledging that Darth has provided the primary evidence in their answer, and that this answer is supplemental to that. I'm not downvoting because this *is* useful info, but reframing as I've described would be worth my upvote. Up to you.
Comment: Yeah, I'm not saying it's not good evidence; I'm not going to make a judgement on that, even on whether it convinces me. I'm only saying that I believe most people won't think this is evidence.
Comment: I'm not sure most people will count that as evidence (for one, that's totally a pose the creature could be caught in). MTG cards are probably quite non-canonical, though I should check if that's true.
Comment: Hi @Phoenices. You're likely right. You can make the plain "Spell does not mention it so, no." argument, I added that. Do only the core rules count as evdidence of how things are supposed to work? I'd think evidence from other sources can help too. This is after all by the same guys that print D&D. Its also a rare opportunity to have visual answer for the question, rather than a purely rule-mechanical one.
Comment: Hi @ThomasMarkov, yes totally right, I updated to refer to Darth (who anyways is the top rated answer). I find it confusing to have a link to the answer, as if it went somewhere else, so I rather kept the link on explaining the principle, but mentioned his answer explicitly.
Comment: @GroodytheHobgoblin In [this meta answer](https://rpg.meta.stackexchange.com/a/11277/62294) I talk about evidence and how it is viewed by the reader. TL;DR, there is no "official" hierarchy of evidence on the stack, rather readers vote according to their own standards of evidence. Generally, official sources, meaning published sourcebooks, are viewed as the "most authoritative" evidence, but there is still value in other sources, but your mileage may vary with such sources much more than it would with reference to published sourcebook material.
Comment: @GroodytheHobgoblin The advantage of linking to another answer here is that I can click it and go straight there instead of scrolling around looking for the user card with Darth's name in it.
Answer: Spells only do what they say they do.
While that general concept can be applied too harshly, the spell text is usually pretty specific about any game effects.
The containment options given for imprisonment are pretty clear about what they do. In general, "the creature doesn't need to breathe, eat, or drink, and it doesn't age", but nothing there says the spell generally keeps the target unconscious or paralyzed.
Burial has the target "entombed" (which is not a game term) but otherwise makes no claim about the target being unconscious or paralyzed. Chaining causes the restrained condition and prevents escape, but that's all. Slumber causes the target to fall asleep, which is the unconscious condition.
Since Minimus Containment doesn't say the target is restrained, paralyzed, unconscious, asleep, petrified, or otherwise incapacitated, there's no reason to think they are. The target is just tiny and trapped inside a gemstone. In this context, "nothing can pass through the gem" should probably be read as meaning the surface of the gemstone, not saying the person inside is embedded in the gem like a fly in amber. If that were the case, I would expect it to say so.
Comment: If it were entombing the target in solid crystal, it would say so, just like the Burial option does. That reading is what I meant by applying the concept too harshly. The spell doesn't need to specify every minute detail of its function, but if it were inflicting anything on the target, it would need to say so.
Comment: The spell also doesn't say that the interior of the gemstone becomes anything other than the solid rock that it previously was.
Comment: It says the target is imprisoned in a crystal, and nowhere does it says the crystal is no longer solid.
Answer: Yes, same as Forcecage
Yep, it can! Other spells reference passing through. For instance, Forcecage:

A prison in the shape of a box can be up to 10 feet on a side, creating a solid barrier that prevents any matter from passing through it and blocking any spells cast into or out from the area.

The fact that Forcecage stops people from passing through doesn't mean they can't move inside it! In the same way, Antilife Shell says

The barrier prevents an affected creature from passing or reaching through. An affected creature can cast spells or make attacks with ranged or reach weapons through the barrier.

And yet, a living creature can easily move around inside and out of it, it just can't go through. Tiny hut, too, that most essential of protections, says creatures can't pass through but doesn't restrict the creatures inside it.
But, it's also a gem
It looks like it's intended for the creature to be able to move, because it's cool for a princess imprisoned by an evil wizard to be screaming for help and banging on the gem's walls (see Groody's answer). On the other hand, it's your DM's call. It's a solid gem; the spell doesn't explain how you end up inside the gem, and it doesn't explicitly say that the inside of the gem is hollowed out. If your DM says the spell makes the target trapped in there, only able to see, stuck in an expression of fear and horror for all time... that's fine and plausible.
Comment: The problem with your analogy is that forcecage is hollow inside, while gems usually aren't. If the entire inside of the forcecage was composed of the same solid barrier as the exterior is than you would probably be stuck motionless inside it. Such is the case with the gemstone.
Comment: @Cellheim I'd say your argument proves too much: at least _some_ part of the gem must be hollowed out by the spell to make room for the creature's body. The spell doesn't say the creature itself turns into gem material. Because the spell is entirely silent as to how any of this happens, it's necessarily a DM call as to whether the spell hollows out only enough for the body (leaving the creature frozen in place) or more than enough (leaving the creature able to move).


Injection from computable numbers into natural numbers

Question: Each Turing machine which writes an infinite sequence of 1 and 0 can be regarded as
representing a (computable) real number (and of course each Turing machine represents a natural number by its machine table, or program).
The question is, how many Turing jumps do we need to construct an injection from such
computable numbers into natural numbers.
Since there are an infinite number of Turing machines that compute one and the same computable real number, it seems we need at least one Turing jump. Is only once is enough?
If not, how many? Even transfinite times?
Comment: I recommend that you show here why one jump suffices.
Answer: I believe one Turing jump suffices. Each computable real could be represented by a {0,1}-Turing machine therefore they are no more than the total number of computer programs.
Consider the map $f: \omega-K \mapsto \omega$ where $K$ is the halting set, that is set of the indices of all programs that halt. Then $f(x)=least \ e\in \omega$ such that $\exists z \varphi_e(z)\neq \varphi_i(z) \forall i<e$. This is a $\Sigma_1^0$ question thus can be answer in $\emptyset'$. Then it is easy to see the construction of f is recursive in $K$ and it is injective also.
Comment: Thanks for this! But then, can I also say that here we already have bijection too?
Comment: It is not necessarily a bijection. Since we could choose the numberings of programs in whatever way we want, we could let $\varphi_0=\varphi_1$, then 1 is never likely to be in the range since it does not satisfy the requirement of f. For one program of the same functionality we could have infinitely many indices (since we could just add some redundant words into the body of the program), therefore, f is not surjective.
Comment: Sorry for not being clear enough, but what I'm asking is whether we can construct a bijection once we have the injection, without any further jump. At the first jump, having the bijection we have the least natural number that is uniquely associated with a computable real, and we can find the "next" natural number uniquely associated with anther computable real, and so on. Don't we then effectively have a bijection? Or in short, only one jump is enough for obtaining a bijection?


Diclofenac patch before or after the effort?

Question: Is it best to place a Diclofenac patch before or after the effort, in order to avoid to mitigate the impact of the effort on a tendinopathy? (if placed before, the patch would be be kept during and after effort as well)
Comment: Are you treating an elbow epicondylitis? The anatomical location makes a difference
Comment: @arkiaamu correct, tendinopathy at the lateral  epicondyle of the humerus.
Answer: I am quite sure that there is no valid study to address your question per se.
First of all it seems that topical NSAID is pretty much the only some way effective treatment for lateral epicondylitis. Many other treatment modalities show no real effect. A recent meta-analysis in CORR (1) pooled all treatments from valid RCTs and the combined net effect was sad.

A recent Cochrane analysis (2) analyzed the treatment effect separately for each modality. The results were slightly more encouraging although the authors pointed out some methodological concerns.

I would also refer to earlier question in health.SE which I have provided an answer. It was about NSAIDs and tissue healing: Do anti-inflammatory painkillers speed up healing?.
As so, I would conclude that diclofenac patch indeed has some benefits. But from pragmatic approach I would not recommend using those patches before and during an effort. The pain in your elbow is an indicator for microscopic damage, mostly tears, and swelling. If you apply the patch before an effort the signal is suppressed and you might strain your tendon more than it would be physiological or reasonable. This leads to even more severe tendinopathy and I would consider that a vicious circle. Suppressing pain when it is indicating tissue damage is not advisable in my opinion.

(1) Sayegh, Eli T., and Robert J. Strauch. "Does Nonsurgical Treatment Improve Longitudinal Outcomes of Lateral Epicondylitis Over No Treatment? A Meta-analysis." Clinical Orthopaedics and Related Research® 473.3 (2015): 1093-1107.
(2) Pattanittum, Porjai, et al. "Non‐steroidal anti‐inflammatory drugs (NSAIDs) for treating lateral elbow pain in adults." The Cochrane Library (2013).
Comment: Thanks for the great answer! I agree regarding the usefulness of thet indicator for microscopic damage, such as tears. The reasoning I was given by a few physicians is that 1. Diclofenac patches help avoid inflammations 2. it's best to treat the inflammation as early as possible 3. subsequently having Diclofenac patches during the effort is better inflammation-wise, while still being as careful as possible not to do too much effort. Is that reasoning valid?


Eagle routing (manual routing)

Question: I am new to eagle and I need to practice routing. I've read many general tips (about using jumpers for example) to use while routing, however I want a precise step by step procedure I can follow to manually do the routing for any circuit. Should i for example start by one part of the schematic and look at his corresponding part in the board? Any ideas?
Comment: Start with layout - nothing helps routing as much as good placement of components.
Comment: On that note, if the number of components is reasonable, you can drag them far apart in the boardview, roughly in the pattern you think they should be in, and I find that lets you unravel the spiderweb of air wires a bit easier.  If there was a concrete step by step process, it would be used by the autorouter.  I think people here could provide things more in lines of strategy or order of operation.  Once my component placement is OK, I like to autoroute over and over to try to get general solutions with few vias, and then hand route for nice looking swoopy traces and sich.
Answer: This is usually the procedure I use:

Create your desired board outline. If not defined by an enclosure, you may need to tweak it later on, but start with what you think you'll need. This would also be the time to determine how many layers you need and configure accordingly.
In the PCB layout editor, begin by placing your connectors and other human-interface items (buttons, switches, LEDs, etc). Usually you want to place these in a specific location on the board, to make it neat and clean (in a logical manner for human interface).
Mentally group together different parts of the schematic - Power, Microcontroller, Communication, Logic, etc. Pick which one you want to start with.
In the PCB layout editor, drag the components which are a part of the section you chose to start with and group them together (outside the board but separate from the other parts). You may have to break the larger section up into smaller groups, depending on the size. For example, the Power section of the schematic may have several voltage regulators, so do one regulator with its requisite circuitry as one group.
Within the single small group you just moved, start positioning the components in a logical manner that promotes the easiest routing (shortest, straightest airwires).
Within that single group, you may start routing the connections. Don't worry about the connections that go to different sections yet, just route what will be self-contained within that group.
Move the group onto the board and find a logical place for it.
Repeat steps 4-7 with the next group of components in the section, and then with the remaining sections.
Once all groups have been moved to the board and positioned where you want them (make sure to group parts within the Power section together, and parts within the microcontroller section together, and so on), you can start routing between the sections and do the human interface parts.
During the routing process you may find it much easier to place copper pours instead of individual traces, usually for power and ground connections. I normally do this right after I place all component sections on the board. This will minimize the airwires for ground or power that are visible and make it easier to identify which connections go group-to-group.

Sometimes you may need to do some of these steps out of order, but you'll get a better feel for it the more you practice. However, the process mentioned above should help you get started with routing just about any board.
Answer: Add a Polygon to both layers and Name then GND. Place them  outside of the board Dimension lines.  Do to not run Gnd traces all over the board.  Add a few Vias and Name them GND also, that connect the top & bottom if you don't have thru hole parts connecting them.
Go into View:Grid and change the Grid 1 mil, that will let you place traces and parts pretty finely.
10 mil wide signal traces. 12 mil vias for signals.
20, 24mil wide for power, 24 or 32mil vias.

Eagle routing (manual routing)


Can I generate two similar ECDSA public keys?

Question: I am using a system that relies on base64 encoded ECDSA public keys.
I have managed to brute-force a public key that when encoded starts with a word I like.
Is it possible for me, given the private key, generate similar public keys?
Comment: Think in this direction: if one keeps doing what they have done when they "managed to brute-force a public key that when encoded starts with a word (they) like", will they succeed again? And if so, what are the odds that they generate the same public key?
Comment: Are you asking in the context of cryptocurrency?
Comment: No, I guess that for most cryptocurrency people want their hashed public key to look cool which seems like a different problem as similar public keys would result in different hashes.
Answer: It's possible to generate one extremely similar public key. If your private key is $s$ and your public key is the point $(x,y)$ then another valid private/public key pairs is $\ell-s$ and $(x,p-y)$. Here $\ell$ is the curve order and $p$ is the characterstic of the field. If you write your public key in compressed form, the representations will differ only in a single bit (the compression bit)!
Some elliptic curves also permit other simple endomorphisms due to their complex multiplication structure e.g. curves of the form $Y^2=X^3-aX$ allow one to generate the additional private/public pair $js$ and $(-x,\pm iy)$ where $i$ is a square root of -1 mod $p$ and $j$ is a square root of -1 mod $\ell$.
For more general similarities, the ability to produce private keys from small perturbations of public keys would allow an attacker to solve discrete logarithms by hillclimbing, which is not thought to be possible due to hard-core predicates on discrete logarithms.


Why do we Route url using JRoute or Route namespace? What is the purpose of routing urls?

Question: I want to know the purpose of routing the urls. Can anyone explain me why do we route urls?
Comment: Welcome to JSE.  Please take the [tour] to familiarise yourself with this community and, ideally, read our help pages about how to ask a good question.  Your question has been flagged as Low Quality by the system because of how short it is.  If you have conducted research already (this is an expectation of question posters), please include in your question what you DO already understand so that volunteers don't bother to tell you what you already know.  Making your question less broad makes your question more attractive to answer by volunteers who may have limited time to help here.
Comment: The question is answered at tons of websites, but you have to simply think about a big and continually growing stadium with always added new seats where you have to sit every visitor with different (or same) tickets to their correct place. That is what the router does basically repeatedly in a dynamic web application, and that is why it was developed with dynamic web frameworks. It could be explained of course many many different ways...
Comment: Routing the URL is pretty much making the URL a friendly URL  (especially for custom components) as Joomla cannot figure out which part of the url is what. So the route identifies pieces of your URL to make them friendly. Example: `index.php?view=content&id=3`with the routing it becomes 'content/3`
Answer: Hard to give a precise answer without more detail, so this will be oversimplified, perhaps too much so, but I'll try.
Joomla URLs natively look like someone dumped part of a can of alphabet soup on the screen. Joomla uses those numbers to find the content being requested, but why should a site visitor have to put up with such a jumble? And what is a search engine to make of that URL? (/sensible/human/readable/link as opposed to index.php?option=com_whizzbang&Id=23&morearcaneitems=toomany even makes more sense to a search engine trying to classify the page it's indexing.)
The routing system in Joomla provides a mechanism so that when that content item's name changes, or category, or pretty much anything else, the original link can still be used by the router to find the modified page. Without a routing system none of the items in the query string could ever change without having to change the URL. What if a visitor bookmarked a page? Or you emailed someone a link to your site. When you made that little change, that item got lost and none of those links work any more. With a routing system in place, Joomla can use it to figure out whether this received query string fits this modified page, instead of just giving your visitor a 404.
We use the routing system to output links for much the same reason; it's a quick and simple way to create a consistently-formatted URL that Joomla will be able to use to find the page again, and if the page changes, the call through the routing system will pick up the changes automatically, so every navigation link in the site will now use the current real URL.
It's a chunk of a larger practice known as "encapsulation" where you hide the details part of the system needs to know away from the other parts of the system that don't need to know them. That makes the code easier to maintain because if those hidden details change only that one part of the code needs to change.
In the case of the routing system, this hides the details of the Joomla internals from the rest of the world, giving you the ability to change them as you need without impacting the ability of the rest of the world to find your page. Without the router any time you decided to move an article to another menu or category, the query string would be different and anyone with the old query string couldn't get to the page.
Hope that helps.


How can the Dhamma help internet admins be fair?

Question: Admins behave inappropriately at times. This leads to suffering for the admins and everyone. They make mistakes because they are human. It's hard to turn anger into compassion and admins can make a lot of people angry. So that's why I'm asking the above question.
Comment: As for the OP question: Dhamma can not possible help a currupted heart, such is not possible.

>The Lord Buddha taught that his Dhamma, when placed in the heart of an ordinary run-of-the-mill person, is bound to be thoroughly corrupted, but if placed in the heart of a Noble One, it is bound to be genuinely pure & authentic, something that at the same time can be neither effaced nor obscured.
Comment: >So as long as we are devoting ourselves merely to the theoretical study of the Dhamma, it can't serve us well. Only when we have trained our hearts to eliminate their 'chameleons' — their defilements — will it benefit us in full measure. And only then will the true Dhamma be kept pure, free from distortions & deviations from its original principles.

>— Phra Ajān Mun Bhūridatto
Comment: For those more interested what has to be developed before one can practice metta, look here: [Karaṇīya Metta-Sutta](http://zugangzureinsicht.org/html/lib/authors/nanadassana/metta_en.html)

How ever, for you Uuu, and all others still capable to hate: [Aghata Sutta: Hatred](http://zugangzureinsicht.org/html/tipitaka/an/an10/an10.080.than_en.html)
Answer:
How can the Dhamma help internet admins be fair?

It is fair to users and other readers of Buddhism SE to allow an off-topic / primarily opinion-based question with a score of -4 to remain on the front page?
I don't think that's fair to anyone. I don't think that's inappropriate.
 Actually I think it would have been inappropriate to let the question stay open.
We have chat rooms for such questions. Please use them:)

They make mistakes because they are human.

As mentioned before I don't think this was a mistake. It would have been a mistake to let the question stay open. I guess we have different opinions on that matter. I'll leave it at that.

It's hard to turn anger into compassion and admins can make a lot of people angry.

Loving-kindness meditation is a great practice for over-coming anger.
Comment: >Lanka: Loving-kindness meditation is a great practice for over-coming anger.

Metta-bhavan without being first upright and secound serious in keeping precepts is more than just hypocratic. Killing, stealing, harming and then do ones "metta", is like the reaction of a snake facing the shadow of the eagle.


Does it make any difference when salting database passwords with Random vs SecureRandom?

Question: I want to salt database passwords and then compute the hash but I wonder if I should use Random or SecureRandom? From an attacker perspective would it be easy to break if Random is used or SecureRandom is used or does it make no difference? if yes why? if not, why not?
Answer: I am telepathically inferring you're talking about Java here, in which:

Random is a linear congruential generator with a 48-bit seed and no security properties whatsoever, and
SecureRandom is some cryptographic algorithm whose documentation (archived 2019-03-23) is unclear about its security properties, with broken links and archaic references, but of which one might reasonably expect the following two standard properties:

indistinguishability from uniform random (or prediction resistance, next bit test): to anyone who does not know the seed, the output is indistinguishable from a uniform random string of bits; i.e., prior outputs do not help to predict subsequent outputs
key erasure (or backtracking resistance, or forward secrecy): even if the state is compromised, it does not help to recover past outputs

[edit: I just looked closer (archived 2019-02-22) and discovered that the one algorithm supported by SecureRandom does not, in fact, do key erasure at all—it just uses SHA-1 in 'CTR mode'.  Nice, Java.]

In general, you should use SecureRandom by default unless you have measured an overwhelming performance concern arising from it. In general, you might get in cryptographic trouble just from the use of Random.  In general, you will never get in as much cryptographic trouble just from the use of SecureRandom, unless loads of other people are in much deeper trouble already.  If you find yourself spending time wondering which one to use, but you haven't measured a performance impact, you are wasting time wondering and you should just use SecureRandom.

OK, you measured a performance impact?  If not, stop reading and go back to the previous paragraph.
What are the security requirements for salts in password hashes?
The purpose of the salt is to thwart multi-target attacks like rainbow tables that save effort by attacking many instances of the same hash simultaneously—that is, the same unsalted hash.  For example, if an adversary is trying to find one password $p_i$ given $\operatorname{MD5}(p_1), \operatorname{MD5}(p_2), \dots, \operatorname{MD5}(p_n)$, they can use a multi-target attack which costs only $2^{128}/n$ and which can run in time $2^{128}/n^3$ if parallelized $n^2$ ways, even though as a 128-bit hash function you might naively expect the cost of an attack to be about $2^{128}$ in the best case that the $p_i$ were chosen by processes with 128 bits of min-entropy themselves.
Using an independent function for each password, as in $(s_i, \operatorname{MD5}(s_i \mathbin\| p_i))$ where each $s_i$ is a distinct salt, thwarts this attack.*  Of course, it thwarts the attack only if everyone on the planet is using an independent function for every password; in other words, if anyone else uses the same salt, then a multi-target attack can still save costs for an adversary.
According to the documentation (archived 2019-04-01), Random is a linear congruential generator with a 48-bit seed.  This seed is so small that even if it were chosen uniformly at random, collisions would be expected after a few million choices, leading to identical salts produced for every output.  It is unclear how the seeds are chosen; it would not be surprising if it were chosen from the time of day and/or the process id, in which case similar applications run at similar times might choose the same seed.
There are cryptosystems where public values like initialization vectors absolutely must be unpredictable in advance, like AES-CBC.  Is it the end of the world to use Random for password hash salts?  No, but it would suggest that you're a too-cool-for-crypto hipster with reckless disregard for user security and/or your auditors' time, but with ample free time of your own to spend dying on hills on the internet.  You're not that hipster, are you?
N.B.:  You should not use MD5 for anything.  For password hashes, you should use argon2, which has exactly the same considerations for salts, but unlike MD5 can use your available resources—time before user expects a response, available RAM, and additional CPU cores—to raise the attacker's costs.

* Using a secret function like $\operatorname{HMAC-MD5}_k$ for a secret key $k$ instead of $\operatorname{MD5}$ can also help—here we sometimes affectionately call $k$ a pepper—but only if there is a meaningful security boundary between the password hash storage and the password hash verification; that's a story for another day.
Comment: yes your inference is correct. what you are saying here makes sense! is there a "best" secure random algorithm that can be used across languages like say both in Java and Golang? By best I mean it will have the properties you described here such as indistinguishability, key erasure and performs reasonably fast?
Comment: @user1870400 There are two separate issues here:  1. Where do you get system entropy?  2. How do you reproducibly turn a seed, obtained from system entropy, into keys for multiple cryptosystems, or otherwise reproducibly derive many outputs?  The answer to (1) for Java is generally `SecureRandom`, and for Go is generally `crypto/rand`.  There are many answers to (2), independent of language, but one popular one with purpose-labeled outputs is HKDF; other options include AES-CTR, HMAC-SHA256 in 'CTR mode'.  There are also many PRNGs with fast key erasure for (2), depending on your needs.
Comment: @user1870400 But, for choosing password hash salts, you will be adequately served by Java `SecureRandom` or Go `crypto/rand`.
Comment: Got it! We have a service written in two different languages Golang and Java and when a seed is set in one of the language the other language should be able to verify the sequence and provide both indistinguishability and Key erasure properties. This is one of the requirement I have thats why I am looking for language independent secure random algo. so the best is to go with HKDF then?
Comment: Sure the seed can be set by reading /dev/urandom or /dev/random (I hear thats what secure random does) but my goal again that that when a seed is set in one of the language the other language should be able to verify the sequence and provide both indistinguishability and Key erasure properties.
Comment: @user1870400 If you want to do something like `prng.setseed(new SecureRandom().generateSeed(32)); ...; prng.uniform32(); ...; prng.uniform64(); ...` nested in a big computation with state, then you should pick a convenient PRNG algorithm.  Maybe it'll be convenient to use a NIST SP800-90A scheme like AES-CTR_DRBG; maybe it'll be convenient to use a [simpler system](https://blog.cr.yp.to/20170723-random.html).  HKDF is good for using one key for many cryptosystems with labeled purposes by deriving labeled subkeys, like 'encryption key' and 'authentication key'.
Comment: I hear that the `new SecureRandom().generateSeed(32)` in not advisable. But what I am trying to is that if I make repetitive calls to `new SecureRandom().nextLong()` in java and Golang the sequence must be same when the seed is set the same. Not too woried about setting the seed. Sure I understand there are many ways to set seed but I am more concerned about finding a secure random algorithm that can generate the same sequence(same long sequence) across languages when seed is set the same. And the secure random algo must have the indistinguishability and key erasure properties.
Answer: A salt is required to be unique. While it wouldn't be a major issue to not use a cryptographic random number generator for creating a salt, it is still good practice to do so. I would recommend you use SecureRandom or an equivalent function for this task, if for some reason you are unable to use an existing, secure library to abstract all of this away and deal with password hashing on its own.
Comment: If the only constraint for the salt is to be unique then I am not sure the "value add" does salt bring in? What if my salt is say a short or int but unique. Then I could just do the same dictionary attack that I normally do without salt because the max int is only 2 billion. I somehow feel salt also need to have a much stronger requirement than being unique.
Comment: @user1870400,usually in case of database compromise, we can assume that the attacker has access to the salt used. So for a dictionary attack, we would not necessarily try the dictionary against all possible salt value; only checking the obtained salt against the dictionary should be enough, so doesn't make much difference if the salt is "big" or not. But yes if the salts is unknown then having a large search space helps against dictionary attacks.
Comment: @MarcIlunga Yeah I am looking for that salt is the unknown case and that the attacker is trying to obtain the salt information.  if you agree that a large search space helps against dictionary attacks then salt being unique is not enough right.
Comment: Now the question what if the salt is long(64 bit)? how easy or hard is to do the dictionary type of attack or any other attack(please name it if you know of one)?
Comment: @user1870400 A short salt is very unlikely to be globally unique, even if it is random. A long salt that starts with zero on every person's computer is not good either. Using long (32 byte) salts and a "true" RNG is a really good way to ensure you don't generate a salt already used by yourself or anyone one else.
Comment: "salt that starts with zero" should have said "salt equal to some counter initialized to zero"


Rules Which Govern the Excommunication of Catholic Bishops

Question: Are there rules in place that a pope must follow when he wishes to excommunicate a bishop? If so, what are they; or where may they be found?
Answer: In general, such matters are governed by canon law. You can find that in the Vatican's Code of Canon Law
Book VI, Part I deals with penalties in general while Part II delves into individual delicts.
In Canon 1331, you can find what an excommunication actually is:

Can. 1331 §1. An excommunicated person is forbidden:
1/ to have any ministerial participation in celebrating the sacrifice of the Eucharist or any other ceremonies of worship whatsoever;
2/ to celebrate the sacraments or sacramentals and to receive the sacraments;
3/ to exercise any ecclesiastical offices, ministries, or functions whatsoever or to place acts of governance.
§2. If the excommunication has been imposed or declared, the offender:
1/ who wishes to act against the prescript of §1, n. 1 must be prevented from doing so, or the liturgical action must be stopped unless a grave cause precludes this;
2/ invalidly places acts of governance which are illicit according to the norm of §1, n. 3;
3/ is forbidden to benefit from privileges previously granted;
4/ cannot acquire validly a dignity, office, or other function in the Church;
5/ does not appropriate the benefits of a dignity, office, any function, or pension, which the offender has in the Church.

Bishops do not have a special arrangement under the law, but they could be regarded as a bit more "high risk" for a specific delict that automatically results in excommunication; you can find in Canon 1364:

Can. 1364 §1. Without prejudice to the prescript of can. 194, §1, n. 2, an apostate from the faith, a heretic, or a schismatic incurs a latae sententiae excommunication; in addition, a cleric can be punished with the penalties mentioned in can. 1336, §1, nn. 1, 2, and 3.

Bishops have a position to teach their flock. This teaching may in some cases (not too often, luckily) become heretic or schismatic, with the mentioned result. The term "latae sententiae" means that the punishment is inflicted ipso facto, by the act itself. So as soon as you act as described in Canon 1364 you are excommunicated. No pope is needed to impose the penalty.


Where is the newsletter 'general subscription' field stored in the database

Question: I'm working on a customer database export, but can't find where the 'general subscription' newsletter subscription field is stored in the database.  I imagine it is some EAV value, but in what table and with what attribute_id?
Answer: I figured it out. The table 'newsletter_subscriber' contains several fields, the ones most meaningful for my purpose are:

store_id
customer_id

the customer entity_id

subscriber_email

perhaps someone can subscribe with a different email than their customer email?

subscribe_status

0 = Default ( can be seen in the table structure in database )
1 = Subscribed
2 = Not Active
3 = Unsubscribed
4 = Unconfirmed

Status 1 to 4 can be seen at /app/code/core/Mage/Newsletter/Model/Subscriber.php
Note: This is not a topical or 'typed' subscription, but a global opt-in newsletter field for a Magento customer record.
Answer: Just to clarify, there is no admin functionality that lets you add new subscription list in Magento out of the box. Thus there is no subscription type field stored anywhere.
If you check the app/design/frontend/base/default/template/customer/form/newsletter.phtml you can see that 'General Subscription' is only a label for the is_subscribed field:

<input type="checkbox" name="is_subscribed" id="subscription" value="1" title="<?php echo $this->__('General Subscription') ?>"<?php if($this->getIsSubscribed()): ?> checked="checked"<?php endif; ?> class="checkbox" /><?php echo $this->__('General Subscription') ?>

Then the controller only checks if is_subscribed is set to true and subscribes the customer to the newsletter if it is.
Comment: I don't think it is accurate that there is "no subscription type field stored anywhere."

It is correct that the field isn't exposed on the admin side, but it is exposed to the customer so they can opt-in (or out) of newsletter communication.

The field is populated in my implementation, and I know there weren't any special customization for newsletter subscription.  The 'my account' template just has a 'newsletters' tab which only exposes the 'general subscription' field.
Comment: @MarkE there is definitely no "subscription type" stored anywhere. What could look like a type is actually a yes no flag for the `is_subscribed` field it has nothing to do with a type of subscription
Comment: Correct, no "subscription type" but there is a global opt-in field that is not a particular 'type' of subscription.  That still has value to add people to a 3rd party permissions-based mailing service and send them an invite to select their subscription preferences.  I will edit my answer to clarify.


X displays instead of image

Question: My organization utilizes SharePoint 2013.  Some users see an "X" instead of the image.  As an admin, I can see the image.  We use Windows 10.  SP only displays in IE 11.
Comment: Make sure the images are checked in and published
Comment: If the files are not reflecting for non admin users but appear correct for admin users, then always make sure to check if it is published.
Answer: Where does the image come from? Make sure the user have permission to see the image.
To check if the issue is related to your web browser. For those who cannot see the images, use another browser and see if the issue persists.
SharePoint 2013 – Images Showing up as a Red or Black X for your reference:
http://www.andrewjbillings.com/sharepoint-2013-images-showing-up-as-a-red-or-black-x/

X displays instead of image


Is it possible that marginally independent random variables are conditionally dependent?

Question: Suppose that $X,Y$ and $Z$ are random variables. If $X$ is independent of $Z$ and $Y$ is independent of $Z$, is it possible that $X$ is dependent on $Z$ given $Y$ and $Y$ is dependent on $Z$ given $X$? If so, what are some examples?
Answer: Here a simple example with three Bernoulli random variables $X,Y,Z$ with the properties that

$X$ and $Z$ are independent, $Y$ and $Z$ are independent and

$X$ and $Z$ are conditionally dependent random variables given the value of $Y$,
$Y$ and $Z$ are conditionally dependent random variables given the value of $X$,

Suppose that $(X,Y,Z)$ takes on the $4$ values $(0,0,0), (0,1,1), (1,0,1), (1,1,0)$ with equal probability $\frac 14$. It is easily verified that $X, Y$, and $Z$  are indeed Bernoulli random variables with parameter $\frac 12$, and that $X, Y$, and $Z$  are indeed pairwise independent random variables. (Those too lazy to carry out this verification for themselves can read some details here.)  But notice that

given that $Y=0$, $X$ equals $Z$, while given that $Y=1$, $X$ equals $1-Z$ and thus $X$ and $Z$ are conditionally dependent given $Y$.

Similarly,

given that $X=0$, $Y$ equals $Z$ while given that $X=1$, $Y$ equals $1-Z$ and thus $Y$ and $Z$ are conditionally dependent given $X$.

For these specific random variables, it is also true that $X$ and $Y$ are independent random variables; in fact, $X,Y,Z$ are pairwise independent but not mutually independent random variables. In fact, for these specific random variables, it is also true that

given that $Z=0$, $X$ equals $Y$ while given that $Z=1$, $X$ equals $1-Y$ and thus $X$ and $Y$ are  conditionally dependent given $Z$,

which  has a pleasing symmetry with the two previous bulleted points. These extra properties might not hold for other sets of random variables that satisfy the requirements laid out in the problem posed by the OP (which don't include the requirement of conditional dependence of $X$ and $Y$ given $Z$).
Comment: Thank you for this detailed answer. Is the statement "*...and in fact $X$ and $Y$ are independent too...*" true in general when $X$ is independent of $Z$ and $Y$ is independent of $Z$, or is it only true for this example?
Comment: @mhdadk Not true in general. Take $Y=X$.
Comment: @Dilip thanks for editing the answer to clarify!
Answer: @Dilip Sarwate: have already given a good answer, the purpose of this is to show the connection with Simpson's paradox. If such examples did not exist, Simpson's paradox would have been eliminated. The easy way to see is with a simple example with artificial data. Let $X, Y, Z$ have the possible values $-1, +1$. In the two strata defined by $Z$ we have the following tables, with $X$ in rows, $Y$ in columns:
<code> dist[, , 1]  # Table for Z=-1:
    Y
X    -1 1
  -1  2 4
  1   4 2
 dist[, , 2]  # Table for Z=+1:
    Y
X    -1 1
  -1  4 2
  1   2 4
</code>
Observe that $X$ and $Y$ are dependent in both these conditional distributions.  But all the three bivariate marginals are uniform, so we have pairwise independence:
<code> apply(dist, c(1, 2), sum)
    Y
X    -1 1
  -1  6 6
  1   6 6
 apply(dist, c(1, 3), sum)
    Z
X    -1 1
  -1  6 6
  1   6 6
 apply(dist, c(2, 3), sum)
    Z
Y    -1 1
  -1  6 6
  1   6 6
</code>
So we have an instance of Simpson's paradox: Conditioning shows an effect which cannot be seen in the marginal distribution. Compare with examples here:  How to resolve Simpson's paradox?
Construction of example data in R:
<code>dist <- array(c(2, 4, 4, 2, 4, 2, 2, 4),
              dim=c(2, 2, 2),
              dimnames=list(c(-1, 1),  c(-1, 1), c(-1, 1)))

names(dimnames(dist)) <- c("X",  "Y",  "Z")
```
</code>
Comment: Thanks for the explanation!


importing MySQL dump to SQL Server 2012

Question: I have a database schema from MySQL which I want to import to SQL SERVER, I have tried dumping from MySQL with compatibility for SQL Server, but with no success. Tried dumping as Excel still no dice. Does anyone know another way to import this database with no records from MySQL to SQL SERVER 2012? Thanks for your time.
Comment: What problems did you encounter with the dump (sqlserver compatibility)? How does the dump file look like once opened with an editor?
Comment: Within sql server when I try to run the file as a query, troggers and all, I get several syntax errors. From the `CREATE TABLE DROP IF EXISTS` commands to the `int data type` declarations. After dumping the file to `.sql` I could just open it with sql server and that is how I tried to run the query.
Answer: I tried Microsoft SQL Server Migration Assistant v6.0 for MySQL which did most of the work for converting the schema and migrating the data from MySQL to SQL Server.

SSMA download page (New version v8.19: download page)
SSMA team blog (SSMA documentation)
Comment: It worked flawlessly for me, when all other options has failed. Thanks for this tip!
Comment: These links no longer work.
Answer: I recently had to do essentially the same thing, except that I wanted to migrate MySQL tables and data to SQL Server. I tried:

using phpMyAdmin to Export the table definitions with "MSSQL" compatibility: The resulting SQL script would not execute in SQL Server Management Studio (SSMS) due to syntax errors.
using HeidiSQL to export the MySQL database directly to SQL Server: HeidiSQL also generated SQL statements that SQL Server would not accept.
using MySQL Workbench: I could not find a way to migrate a database from MySQL to SQL Server.
using MySQL ODBC and the SQL Server Import and Export Wizard: The wizard crashed (i.e., the Windows "[Application name] has stopped working..." error) when trying to access the MySQL database.

The only method that didn't fail outright was to pull the tables from MySQL into a Microsoft Access .mdb file (!) via MySQL ODBC, then import that into SQL Server.
However, even that was an incomplete solution because the transfer from MySQL to Access omitted all of the primary keys, indexes, and AUTO_INCREMENT attributes. Still, it did transfer the tables and data, which was my main objective. I just had to write some T-SQL to re-create the indexes and whatnot.
Since you don't need to transfer any data you might want to consider just hacking the mysqldump SQL code (good old Find & Replace...) to the point where SQL Server will execute it.
Comment: Thanks for the advice, this has been giving me a bit of trouble as it seems we tried similar solutions.
Answer: The easiest way could be:

Export your MySql database as a csv file with the name of the columns as headers.
Create an empty database in SQL (I did it on SQL Server 2012)
Import the csv file into the empty database. You might need an ODBC component depending on which version of SQL and Framework you are working on (Microsoft.ACE.OLEDB.12.0). I noticed The Keys were missing, but I just added them manually.

importing MySQL dump to SQL Server 2012


Using Magic Portals to make Artificial, Localized Seasons

Question: Basically, in my world there are no seasons on any of the relevant planets due to no axial tilt or orbital eccentricity. However, there are two portals which allow for travel between a fairly hot planet and a relatively cold planet. I was wondering, if both of these portals were placed near the poles of the cold planet and the equator of the warm planet, could you place these portals (atleast partially) in coastal waters and occasionally open or close them to produce artificial seasons in the local area? The portals would allow around 4-5 million gallons of water to move between the worlds each second. Would this movement of water allow for the ability to somewhat control the climate of the local regions, maybe as far as 20 miles away from each portal? How would it affect the climate on either side of the portal?
Answer: This (and the subsequent installment) might be a good place to start, if you're wondering about the mechanical consequences of inter-planetary ocean portals.
Done reading (/ archive binging the rest of the webcomic)?  Good.  Moving on.
I don't know how big the portals are, but over a million litres of water per second is a lot of water. If your portals are too small, you might accidentally kill any White Witches unfortunate enough to be in range. If your portals are really too small, you would briefly create a superluminal water laser and then a cloud of very excited particles where the planets used to be.
In the interests of avoiding catastrophic flooding, and of not having Newton, Bernoulli, and Einstein stomp-circle your setting into oblivion, I'll assume that these portals are at the surface and somehow fixed so that they don't run into water level problems.  I'll also assume that the two planets, in addition to having no axial tilt, have exactly the right masses, radii, total amounts of water and atmosphere, etc. to cancel out the effect of the different temperatures on water pressure.  This are basically impossible without presupposing some kind of alien solar-system-architects, but we're already talking about two planets with exactly zero axial tilt that are connected by a portal, so it was probably inevitable.
In this case, yes, you could significantly affect the local climate by adjusting how big the portals were - though not to any terribly precise degree, and you might have some issues if the two sides disagreed on what that size should be at any given moment.  The warm side would get cooler and the cool side would get warmer.  The size of the portal would affect not just the magnitude of the temperature change, but also the area affected, because the temperature change would drop off as you got further away.  If you were on the warm planet and you opened the portal enough to noticeably cool down something 10 km away, the space near the portal would probably be very chilly.
However, it would also cause a whole pile of problems, probably the least of which is that you've created what is basically a continuous, interplanetary version of ballast pollution.  The ecological consequences of container ships moving ballast around on our own single planet are bad enough - you'd be swapping invasive species from two different planets continuously.
You could solve ballast pollution by putting some sort of filter over the portals - I'm going to assume they're magical in nature - to block anything larger than a water molecule.  If you want people (the only invasive species that invades on purpose) to be travelling through these portals, you can say they have some way to let individual things through the filter. The bigger problem is the climate change caused by the portals - it would be slower and smaller than what we're doing to Earth, but it would happen.  IRL, warming seas have caused hurricanes and tropical storms to get much worse and more frequent, and severely damaged coral reefs and other sea life.  There's some concern that it could disrupt the vertical currents between different levels of the ocean, which would also be catastrophic.  There's also the matter of different ocean pH levels, but you could easily solve that with the magic filter or the ancient aliens.
This isn't to say that people wouldn't do it anyway regardless of the consequences - we've certainly caused bigger problems by accident - but it's something you would need to consider.  Alternatively, you could bypass the issue and say that the portals have been up for so long (i.e., hundreds of thousands if not millions of years) that all the ecological/environmental consequences have already shaken out (though if the planets were still different temperatures, you'd still have the "temperature differential causing/worsening storms" problem).
I'm going to make a tangent from the portals to mention some other consequences of planets with no axial tilt or seasons.  No seasons means no seasonal migrations, probably no synchronized mating cycles (smaller organisms could use lunar cycles, but basically anything larger than an insect takes too long to grow up for that), very different agriculture, and probably a delayed understanding of planetary mechanics.  The main reason we have an annual calendar is because Europe's climate changes drastically over the course of a year, with the best results of agriculture being locked to a yearly schedule of planting and harvesting that we needed to track (and because Europe conquered the rest of the world and brought the calendar with it).  Much of the mathematical basis for modern astronomy was originally developed to calculate what time of year it was so that farmers in various temperate climates knew when to plant and harvest your crops.  Contrast that with cultures like the Maya, whose calendar (despite being quite advanced for a stone age civilization) was a straightforward day-counter, with none of its many cycles corresponding to the Earth's orbit around the sun - the Maya lived in a tropical jungle that was basically the same temperature all year round.
The last thing to consider is why anyone would want to do this in the first place.  You have two planets with no axial tilt, where the average temperature at any location will be constant year-round and a direct function of latitude - if you want to live somewhere with a different temperature, find the right latitude on the right planet and go there.
Comment: I'll have to reread this question later, but suffice it to say, there are magical solar-system architects, three of which are still living in the solar system. The portals are controlled, on both ends, by a benevolent theocratic civilization that uses the portals to occasionally assist the good guys on the warm world. The warm world is also a little *to* hot, and I am thinking some polar water may be needed to cool it down to keep it from being unliveable in the long term. The cool planet is quite abit colder than earth.
Answer: Ocean currents affect climate on earth
On earth, ocean currents moderate the climate. Hot currents bring enormous amount of heat from equator to the poles. Similarly cold currents change the climate of hot regions.
Movement of water through portals
Water through one portal will move from cold planet to hot planet and through other portal from hot planet to cold planet. This will affect the climate of both planets at the points where water is coming out.
Consider following points while regulating the water flow through the portals.

The total volume of water moved from a planet should remain zero otherwise one
planet will be flooded and other dehydrated.
On any one of the planets, when you suck water from one point and
dump water at another point, keep the flow rate such that overall
ocean level is not disturbed much. Very fast movement can cause huge waves and tides.
Open and close the portals simultaneously, so that amount of water on
each planet remains the same.
The sucking and dumping points on any planet should be far enough
from each other so that the temperature at two points is very
different from each other.
Comment: We're not talking about two one-way portals, but two two-way portals.
Comment: Even then you should consider first 2 points  written in the answer.


What kinds of grape vines will grow in northeastern Turkey's cold climate?

Question: What kind of grape vines could grow in a cold climate, 4 months winter, temperatures of -20 °C, altitude 1000m. In Northeast Turkey climate is not compatible with grape vines that we know.
Comment: Should be plenty - that's only -4F and we regularly get -20F here and grow grapes of various sorts. You might start with New York State as one information source where grapes are grown in similar temperatures, but should ultimately seek out information sources closer to where you are trying to grow them... http://www.fruit.cornell.edu/grape/  And for much colder, Minnesota: http://www.grapes.umn.edu
Answer: For native species, some of your best bets will be Cabernet Sauvignon, Cabernet Franc, and Limberger. I'm not sure if you can legally grow American/American-European cross grapes in Turkey, but if you can, just about all of those will be hardy in your area. Especially the American ones. They also have a faster ripening time.
Comment: +1 for the suggestion to check out North American varieties. user145278, a bonus may be that if you are interested in using the leaves for stuffed vine leaves, the North American varieties have shallower lobes, and make for much easier rolling than the standard ME varieties!


Why do the Muslims lose when God is supposed to be on their side?

Question: Asking about the Battle of Tours (or Poitiers), isn't God supposed to be on the side of the Muslims so how did they lose?
Comment: War is not just allowed in self defense, rather initiating war is also permissible. It is quite possible for a Muslim army to lose a battle and that has happened in many other battles.
Comment: Questions should be focused and you should not ask multiple questions in one post. I've focused it to one, i.e. why the Muslims lost when God is supposed to be on their side. Please ask the other one separately.
Answer: Victory in battle is dependent on Allah's will.
It is not obligatory that He grant it only to the Muslims, rather His sunnah is that He rotates it, granting it at times to the Muslims and at times to the disbelievers.
Among the reasons that He does the latter include:

to test the patience of the believers
to punish them for their sins
to take martyrs from them and otherwise increase their ranks
to establish evidence against the disbelievers and hypocrites and in favor of the believers

إن يمسسكم قرح فقد مس القوم قرح مثله وتلك الأيام نداولها بين الناس وليعلم الله الذين آمنوا ويتخذ منكم شهداء والله لا يحب الظالمين
وليمحص الله الذين آمنوا ويمحق الكافرين
أم حسبتم أن تدخلوا الجنة ولما يعلم الله الذين جاهدوا منكم ويعلم الصابرين
If a wound should touch you - there has already touched the [opposing] people a wound similar to it. And these days [of varying conditions] We alternate among the people so that Allah may make evident those who believe and [may] take to Himself from among you martyrs - and Allah does not like the wrongdoers - And that Allah may purify the believers [through trials] and destroy the disbelievers. Or do you think that you will enter Paradise while Allah has not yet made evident those of you who fight in His cause and made evident those who are steadfast?
— Quran 3:140


HTML in docblock comments?

Question: In the PEAR standards there is no reference to HTML, if its allowed or not.
http://pear.php.net/manual/en/standards.sample.php
But I see some people use HTML tags like  and stuff..
So is HTML allowed?
Will it break some doc parsers?
Answer: See http://en.wikipedia.org/wiki/PHPDoc#DocBlock_Description_Details
HTML is supported in the Long Description:

The Long Description continues for as many lines as desired and may contain HTML markup for display formatting.

There is a specific list of tags that PHPDoc supports:

Here is a list of tags supported by phpDocumentor:

 -- emphasize/bold text
 -- Use this to surround php code, some converters will highlight it

 -- hard line break, may be ignored by some converters
 -- italicize/mark as important
 -- denote keyboard input/screen display

 -- list item

 -- ordered list

 -- If used to enclose all paragraphs, otherwise it will be considered text

 -- Preserve line breaks and spacing, and assume all tags are text (like XML's CDATA)
<samp> -- denote sample or examples (non-php)

 -- unordered list
<var> -- denote a variable name

Also of note, it looks like a blank line between paragraphs is interpreted as a paragraph break even without
 tags.
Answer: According to this other page they follow the phpDoc standard.  You should follow that standard strictly, although some common extensions can sometimes be assumed.  For publicly available code (on other projects) I do not put HTML into my phpDoc compatible comments.

HTML in docblock comments?


How to change colors of clothes file

Question: Trying to edit this singlets main color to black and making the bands at bottom of thigh yellow as well as the bands around shoulder yellow. I am able to change the shoulder bands to yellow but not the lower bands and not the main color of the singlet. How can I edit the colors of the singlet? Thank you.
Comment: Provided the image is not copyrighted, please post it (or a smaller version of it) in your question. Links have a tendency to break, and when it does, your question loses a lot of necessary context. Thanks!
Answer: Maybe due something that I didn't know the downloaded file was a PDF. But finally it was opened in Illustrator and became editable after removing the usual multiple clipping masks and groupings that PDFs seem always contain. Illustrator seems to be able parse off most of them (see NOTE1).
At first: There's no plain strokes, all lines are expanded i.e. closed filled areas with no stroke. This is common if the image is a traced bitmap image:

A little too faint lines are splintered in tracing to separate islands and that prevents you to fill the areas with the wanted colors. Elsewhere the black lines are a single complex closed path, actually a compound path, because the white areas are holes.
I guess you used the Shape Builder when trying to fill the areas, but the gaps are too wide. Fill them by drawing a curve (the red one in the next image) with the pen:

You can well delete the splinters. Or use wide enough line which covers them.
Change the stroke color = Black and apply Object > Path > Outline stroke to get a filled black area. Now you can easily fill areas with the shape builder:

The main outline of the cloth can be too wide (no idea how wide it should be) when there's colored bands. There's one easy way to make it look thinner: Make the colored areas wider by inserting colored strokes to them.
An example:

The blue and yellow strokes are as wide and they fully cover the faint lines between theblue and yellow areas. Unfortunately the irregularity of the traced faint lines forces you probably to redraw them if the image is shown in a big size.
I stop excessive guessing here. Insert to the question if you want some special treatment to the lines. Someone may well know something useful.
NOTE1: In Inkscape the result of opening a PDF is generally an impenetrable mess except in case function "Deep Ungroup" succeeds to work without tilting the machine. Just this PDF happens to be simple enough also for Inkscape.
Inkscape would be more flexible tool for manual editing the edges of the black areas of this image because there deleting a node keeps the path as unchanged as possible. Illustrator doesn't try to adjust surrounding nodes to keep the edge as it was.
Answer:
Select all
Grab the Live Paint Bucket Tool
Pick a color
Start clicking...

Option B

Draw a rectangle behind the singlets
Fill the rectangle with any color so it's not black or white
Select all
Hit the Merge button on the Pathfinder Panel
Click the rectangle that is outside the singlets using the Direct Selection Tool (White arrow)
Hit Delete to remove extra parts of the rectangle
You can now click the other colored areas and change their fill like you normally would.

Disclosure: I did open the .ai file in a legacy version were "data loss may occur". The file appeared fine to me though. There was a clipping mask on the exterior of the singlets which essentially made the background white and the singlets themselves transparent. I removed this clipping mask. I assume the mask was due to opening with a legacy version. Either way the options above should still work.
Comment: I followed the instructions for option B but hitting the delete button gets rid of both the rectangle and the singlets. Option A also did not work. I'm using version 2022.
Comment: Well, both methods work fine here.. as seen in the screenshots above.

How to change colors of clothes file


Public Knowledge base for force.com site

Question: A public Knowledge base to be created so that forec.com site visitors can view
Knowledge Articles without any authentication as anonymous users and also vote for the articles. Is there any easiest way to do it for both desktop/mobile.
Answer:
Public Knowledge for Mobile, Web and Facebook

This is a unmanaged package.  The look and feel can be customise by editing the VF page code provided with the package.
AppExchange URL : https://appexchange.salesforce.com/appxListingDetail?listingId=a0N300000059QxXEAU
Implementation Guide URL : https://appexchange.salesforce.com/servlet/servlet.FileDownload?file=00P3000000P3UNSEA3


If a website has no backlinks, would it ever get listed in Google?

Question: If I create a site and do not built any of the backlinks would it get crawled by Google?
Answer: Off page SEO is not required
Google does not base indexation based on off page SEO but rather than discovery, Google has many ways of discovering new sites such as: Sitemap Submission to Google and can even find new registrations of domains via the name servers they use.
Many old domains will already have back links and even if you register a new domain your domain name will appear over the internet in a newly registered domain list such as this one.
Sitemaps are not needed for indexing
Many people believe that Google requires a sitemap for the site to be crawled and indexed, this is far from the truth.. You don't need a sitemap at all, some people believe it makes Google crawl the page quicker, in effect it can but its all done on a queue system, often a back link can trigger a crawl quicker than a sitemap submission.
Other sites that back link without you knowing
There are many other websites that will crawl your site and collect data, and list statistics on their website such as page rank, alexa rank, and so on... These sites are very common and they back link. Again, they don't always use Google to find your site and many other methods can be used.
Prevention
I'm not completely sure why your asking this question, maybe its out of pure interest if that's the case then ignore this part, if you want to stop Google crawling your site period then us noindex paired with a robots.txt denied.
Comment: I actually meant that if I do not share any information with Google about it then how would it index?
Comment: Yes, eventually Google will discover the site even without a sitemap. Your URL will appear on other sites that collect data such as name servers, dns settings and so forth. Even a text that mentions your site is a TEXT based link. So it's pretty hard to stop it indexing without using robots.txt
Comment: Added some more detail.
Answer: There is one way for Google to know your site exists without any back links and that is to submit them a sitemap. You do this by registering for Google Webmaster Tools which lets you supply a text of XML sitemap for your site. The sitemap does not even have to be complete since Google crawls URLs from there.
Without any back-links, built by you or anyone else, there is little chance to rank for  common words in most languages because so many other sites will do better. However, if you have something unique, be it your own name or an invented name for a product, Google will list your site for relevant queries.
Comment: Having the site in webmaster tools works too


Prevent: 'are you sure' popup on exit when closing the gVim window

Question: Is there a setting that will allow you to just close the window without bothering with the save changes dialog when you exit?
Do you have to attach it to an event that answers for you?
Answer: I would not generally recommend it, because the risk to lose data is way too high, but since you ask for it:
:au QuitPre * :bw!

This will basically abort the current buffer when using :q and if this is the last window it will automatically quit. An even more radical solution would be to wipe all buffers, which would then quit Vim even when there are several windows/tabpages open. But I won't spell it out explicitly, because I think this is too risky in my opinion.
Answer: This is standard behavior, shared by all the document-oriented GUI apps on your Desktop. The feature is provided by the GUI toolkit used to build GVim so I don't think there is a GVim-specific way to really change that behavior except, maybe, digging through the code and compiling it the way you like.
However, Vim, as a modal editor, kind of encourages explicitness and precision with all its commands. In this case, the proper Ex command for forcibly closing the current GUI window would be :qa!.
That said, you can try to map <C-w> to :qa!<CR>, but I just tried it with <D-w> in MacVim and it didn't work at all.
If I were you, I would go with :qa!.
Answer: Let's look at this from a different angle: Vim asks to save if there are changes to a buffer. You can make sure there are none by automatically writing all changes to file.
There's the (currently unmaintained) plugin vim-auto-save
and an old SO question how to save a file every 1 second in vim? to that effect.
There's also an autosave option on vim's todo list.
Obvious side effect: whatever you type ends up in the file.


Topology: Example of a compact set but its closure not compact

Question: Can anyone gives me an example of a compact subset such that its closure is not compact please? Thank you.
Comment: A compact set is closed in a Hausdorff space - so you are looking for a non-Hausdorff space?
Comment: you should look up ``generic points"
Comment: Dear @Elden, the only difficulty is to find a non quasi-compact space with a dense point.
Comment: As @EldenElmanto points out, any irreducible non-quasicompact scheme satisfies this.
Comment: Try with a space with a dense point...
Comment: @GeorgesElencwajg - you are right. They are not so easy to produce /:
Comment: Dear @Elden: since I like your idea I have written an answer in the style of schemes illustrating it.
Answer: Write $\tau$ for the standard topology on $\Bbb R$. Consider now $\tau_0=\{U\cup\{0\}\mid U\in\tau\}\cup\{\varnothing\}$.
It's not hard to verify that $\tau_0$ is a topology on $\Bbb R$. It's also not hard to see that $\overline{\{0\}}=\Bbb R$. However one can easily engineer an open cover without a finite subcover.
Answer: I think the simplest example would probably be the "particular point topology" on an infinite set.

Let $X = \{p\} \cup \mathbb{N}$, topologized so that the nonempty open sets are the sets containing $p$.

The singleton $\{p\}$ is compact (finite sets are always are). However, $\overline{ \{p\}} =X$, and $X$ is not compact because the open cover $X = \bigcup_{n\in \mathbb{N} } \{p , n\}$ has no finite subcover.
Answer: Here is an example (using the formalism of affine schemes) illustrating Elden's excellent idea.
Let $k$ be a field and $\mathbb A^\infty_k$ be the affine scheme associated to the polynomial ring over $k$ in infinitely many variables: $$\mathbb A^\infty_k=\operatorname {Spec} (k[T_n|n\in \mathbb N])$$
For our  example we will consider the open subspace  $$X=\mathbb A^\infty_k\setminus \{\mathfrak m\}$$ where $\mathfrak m$ is the maximal ideal $\mathfrak m=(T_0 ,...,T_n,..)\subset k[T_n|n\in \mathbb N]$
That subspace $X$  has the  point $\eta=(0)$ corresponding to the zero ideal as its generic point, meaning that  the singleton set $\{\eta\}$ is  dense in $X$ : $\overline{ \{\eta\}}=X$ .
Now  $\{\eta\}$ is certainly compact but its closure $X$ is not quasi-compact:
Indeed, $X$ is covered by the family of principal open subsets $(D(T_n))_{n\in \mathbb N}$ but a finite union $\bigcup^N_{n=0} D(T_n)$ can never  cover $X$ because for the prime ideal $(T_0,...,T_N)\in X$ we have  $(T_0,...,T_N)\notin \bigcup^N_{n=0} D(T_n)$.
Comment: All the other answers are beautiful and much more elementary  but, believe it or not, I find mine quite natural. Just to warn you how twisted and perverted the mind of an algebraic geometer can be...
Comment: Thanks @Elden, but it is your idea! (Are you one of us twisted algebraic geometers?)
Comment: Hi @Georges, I have mostly looked at homotopy theory, so maybe you could say that I've bluffed through algebraic geometry. But I've been paying my dues through the mandatory "seminar of pain" called Harthshorne and quickly falling in love with it! It's such a rich subject and, as you might agree, the examples are the best part!
Comment: One can also consider $\operatorname{Proj}k[T_n:n\in\mathbb N]$ and note that $\operatorname{Proj}k[T_n:n\in\mathbb N]=\bigcup_n D_+(T_n)$.
Answer: There are no Hausdorff examples; T$_0$ examples are trivial; the following T$_1$ example is only slightly less trivial.
Let $A,B$ be disjoint infinite sets, and let $X=A\cup B$ with the topology $$\tau=\{\emptyset\}\cup\{U\subseteq X:A\setminus U\text{ is finite}\}.$$ Then $X$ is a T$_1$-space, $A$ is a compact subspace of $X$, and $\overline A=X$ is not compact.
Answer: The other answers are fantastic. I present mine since I find it to be a useful "test case" to keep in mind in other situations, especially for statements about limits.
Consider $\mathbb{R}$ with the following topology: $U\in\tau$ if and only if $$U = (a,\infty),\hspace{2ex}a\in[-\infty,\infty],$$
where $(\infty,\infty)$ is understood to be the empty set and $(-\infty,\infty) = \mathbb{R}$.
Any singleton $\{x\}\subset \mathbb{R}$ is compact: given an open cover $\{U_\alpha\}_{\alpha\in A}$, take any one element of the cover; by definition it contains $\{x\}$, so there is a finite subcover consisting of just one set.
The closure of $\{x\}$ is $(-\infty, x]$. This set is not compact: the open cover consisting of all sets of the form $(a,\infty)$ for $a>-\infty$ has no finite subcover.
Answer: Consider $\Bbb R$ with topology generated by basis $B=\{(-\infty,a):a \in\Bbb R\}$ then the set $K=\{1/n : n \in\Bbb N\}$ is compact in this topology but its closure $[0, \infty)$ is not compact. Is this answer correct?


Why is there a difference between Fermi levels in metals and metal-oxide semiconductors (MOS)?

Question: Why are Fermi levels in metals lower than the Fermi level of $\text{p}$-substrates in metal-oxide semiconductors (MOS)?  Specifically, why is there a difference of $qV$?
$\hspace{50px}$
Answer: The metal gate and the semiconductor, separated by an insulator in the MOS structure, can be each be considered to be a system in thermodynamic equilibrium und thus have a separate electrochemical potential, i.e. Fermi level. When you apply a voltage $V$ between the systems the Fermi levels will be separated energetically by $qV$. When the metal gate and the semiconductor of a MOS structure are short circuited, they constitute a single system with one Fermi level. This corresponds to the Fermi levels being aligned for an applied zero voltage $V=0$.
Comment: @NailTosun - When there is a potential  difference between two thermodynamic systems, of which each is in equilibrium (here the gate and the semiconductor bulk), the chemical potentials (Fermi levels) of these systems will differ by $qV$.
Comment: Firstly thank you. i did't understand the part that when bi apply bias. Electric field can bend the band but it doesn't change fermi level (as far as i know.). But the metal side fermi level below dropped by qV. Bias voltage can change metal fermi level?