Choosing the number of PLSR components

Question: I am trying to choose how many components to retain in my PLSR. My total variance explained for the response variable is only about 30%, and the first 2 components explain 99% of this. Intuitively I know I should just run the model with the first 2 components, but is there a more rigorous method I can apply? Does the Kaiser-Guttman or scree test apply here since the PLSR computes singular values rather than eigenvalues?
Comment: Cross-validation?
Answer: Use cross-validation.
A quick example: for each number of components(by the way they are called latent variables in PLS unlike principle component in PCA), remove the first sample from your data, and with the remaining data set construct a full PLS model. Use that model to predict the removed sample. Then put the removed sample back remove the next one and predict it and so on. This type of cross-validation is called leave-one-out cross validation.
Finally you will have a prediction for each sample and their real values. Using that information calculate an error which is basically the difference of predicted vs real value or the square of that difference.
Repeat this for each number of components. You can now draw a graph which has number of components in X axis and corresponding errors on Y axis.

As a rule of thumb you should NOT go ahead and select the component(latent variable) yielding the least error because it may overfit. You should choose where the drop in error values are not significant any more. Another common case is that: there might be a point where the error values increase. Choose a point right before that increment.
Reference for graph: Brereton, Richard G. Applied chemometrics for scientists. John Wiley & Sons, 2007.
Comment: If it's a real then it's real, it's just that for this graph one could argue that selecting all components (which is equivalent to not using PLS at all but simply using standard OLS regression) is actually beneficial...
Comment: Well, you are right once again. It is better to be clear. I have updated my answer with a new graph which explains my point better.
Comment: +1 for cross-validation advice. But is this a plot obtained with some real data or just an illustration sketch? If it's a real plot then I am surprised that there does not seem to be a minimum: the curve is decreasing all the way.
Comment: This is from a real data. You are right, the PLS models do not behave "ideally" in my case. However, this illustrates an dramatic drop until 8th LV whereas, for instance, with 12 LV there is a lower error but choosing 12 LV is not a good idea, at least in my opinion. Should I replace the graph?

Choosing the number of PLSR components


Error when zooming to layer in PyQGIS application. On-the-fly transformation the issue?

Question: I am trying to set the extent of my window to a layer on my canvas. This has worked smoothly until I started using Web Mercator maps instead of WGS84 maps. My features are getting their geolocation from an external source which feeds in decimal degrees, so I am using on-the-fly transformation to get it projected properly on Web Mercator. The problem is that in my code, when I set the extent to my layer, it appears to try to do it in decimal degrees, putting my window in the middle of the Atlantic Ocean.
My extent code is very simple:
self.mapCanvas.setExtent(self.myLayer.extent())

My canvas CRS code is straightforward as well:
self.mapCanvas = QgsMapCanvas()
self.mapCanvas.useImageToRender(False)
self.mapCanvas.setCanvasColor(Qt.white)
self.mapCanvas.setCrsTransformEnabled(True)
self.mapCanvas.setDestinationCrs(QgsCoordinateReferenceSystem(3857, QgsCoordinateReferenceSystem.EpsgCrsId))
self.mapCanvas.show()

Is anything not right?
Answer: If the CRS of the canvas and the layer are different, you must reproject the layer extent to the canvas CRS before zooming. Try this:
mapCanvas = iface.mapCanvas()
xform = QgsCoordinateTransform(myLayer.crs(), mapCanvas.mapRenderer().destinationCrs())
mapCanvas.setExtent(xform.transform(myLayer.extent()))
mapCanvas.refresh()


Differences between the OS and DB buffer pool?

Question: How does the DB manage a pool of buffers when the operating system ends up controlling what's really in memory? For example, couldn't the operating system decide to evict a page frame from a DB's buffer?
Comment: I haven't written a database, but presumably the DB requests an extremely large chunk of memory which it then runs its own memory management on. Similarly, databases may also choose to eschew the OS's logical file system and work directly with raw blocks.
Answer: Yes, absolutely, that could happen, and it makes it harder for databases to optimize their own performance.
Some databases bypass the operating system's virtual memory management and manage memory themselves.  They might request that the operating system pin a range of the address space into memory (and never page it out).  Or, they might be designed to be the only application that runs on the machine, and take care of their own memory management so they never use too much memory -- hoping that this will make it unlikely that the OS ever pages out any of their data.


When to use the Johnson-Lindenstrauss lemma over SVD?

Question: The Johnson-Lindenstrauss lemma allows one to represent points in a high dimensional space into points in lower dimension. When finding lower dimensional spaces of best fit, a standard technique is to find the singular value decomposition and then take the subspace generated by the largest singular values. When is it of interest to use Johnson-Lindenstrauss over the SVD?
Answer: The two approaches provide very different guarantees.
The JL Lemma says essentially "you give me the error you want, and I'll give you a low dimensional space that captures the distances upto that error". It's also a worst-case pairwise guarantee: for each pair of points, etc etc
The SVD essentially promises "you tell me what dimension you want to live in, and I'll give you the best possible embedding", where "best" is defined as on average: the total error of true similarity versus projected similarity is minimum.
So from a theoretical perspective they solve very different problems. In practice, which one you want depends on your model for the problem, what parameters are more important (error or dimension), and what kind of guarantees you need.
Comment: That's a whole other question. But in (very) brief, if you take a matrix $A$ and populate it with entries drawn from a standard normal, then $f(x)$ is defined as $Ax$.
Comment: You can't do dimensionality reduction this effectively for the Hamming metric. The $\ell_1$ structure is very different. In a very handwavy sense, admitting JL-style reductions is linked to living in a Hilbert space.
Comment: Could someone tell me how exactly is $f(\cdot)$ obtained in (1-eps)|u-v|^2 <= |f(u)-f(v)|^2 <= (1+eps)|u-v|^2 (from http://en.wikipedia.org/wiki/Johnson%E2%80%93Lindenstrauss_lemma)?
Comment: Is there a JL scheme for finite fields too where the distortion is in the Hamming metric? If so, then what would $f$ be here?
Answer: SVD and JL also extrapolates to future points differently as well.
That is, if you assume your data comes from some underlying distribution, in principle the SVD should remain "good" for any future points so long as they are sampled from the same distribution.  On the other hand, the target dimension of JL depends on the number of points, meaning that applying a JL transform to additional points can increase the error probability.
This becomes relevant if, for instance, if you are using dimensionality reduction as a preprocessing step for some other algorithm.  SVD bounds for training data may hold on test data, but JL's will not.
Comment: This is a very good point.
Answer: This is a follow-up to Suresh's answer - I googled a bit after reading his answer, and came up with the following understanding. I was originally going to post this as a comment to his answer, but it kept on increasing.
Please point out errors in the answer, I'm no expert in this field.
In some sense, JL and SVD are like apples and oranges.
1) The problems they solve are completely different. One is concerned with pairwise distances, the other with the best representation. One is worst case, the other is average case.
The subspace JL returns (JL isn't constructive, but lets assume it returned a best subspace) is the solution to the following optimization
$$\arg\min\limits_{P} \left\{\sup\limits_{u,v} \left(\Biggl\lvert 1- \frac{||Pu-Pv||_2}{||u-v||_2} \Biggl\rvert \right) \right\} \tag{1}$$
(This isn't precise, I'll comment more on this later)
The problem SVD is solving is (given a dimension $k$)
$$\arg\min\limits_{P\text{ of dim k}} \left\{\text{Avg}\left(||u-Pu||_2\right)\right\} $$
2) Inputs: Although both algorithms output subspaces, the inputs they need are different. JL requires a tolerance $\epsilon$ (what is the max error you are willing to tolerate between actual distances and distances in the subspace), while SVD requires number of dimensions.

3) JL is nonconstructive, SVD is constructive - this point is a bit vague, as the term constructive is not precisely defined. There are deterministic algorithms for computing the SVD, but the algorithm for finding a JL space is a randomized one - do random projections, if you fail, try again.

4) SVD is unique (the subspace may not be unique, but the objective value will be the same for all subspaces). Eqn(1) above isn't precise in the sense that JL doesn't actually talk about minimizing the discrepancy in the pairwise distances - it gives a guarantee about the existence of a smaller subspace where distances will be atmost $\epsilon$ different from their actual values. There could be many such subspaces, some better than the others.
(See comments for explanation regarding striked portions of the answer).
Edit: @john-myles-white has written a post about JL to verify its claims, and show how a projection can be constructed: http://www.johnmyleswhite.com/notebook/2014/03/24/a-note-on-the-johnson-lindenstrauss-lemma/
Comment: There are a number of errors in your answer. (1) JL is extremely constructive: there are all kinds of algorithms for constructing the mapping (2) it doesn't preserve the difference but the relative difference (the ratio) (3) the JL lemma has been derandomized (4) JL works for *any* set of vectors: the construction is independent of the actual input. the only information needed is the *number* of vectors.
Comment: That's a slightly subtle point. Once you fix the error and the number of vectors, there is a fixed *probability distribution* on maps which will work with high probability for any set of vectors. Of course there is not deterministically fixed linear map that satisfies this property.
Comment: Thanks Suresh. I've incorporated all except your final suggestion. Feel free to edit the answer further. On the last point, I'm confused. You're saying the same map will work no matter what set of vectors I give you?
Comment: It's worth checking out Olivier Grisel's [scikit-learn implementation](http://scikit-learn.org/stable/auto_examples/plot_johnson_lindenstrauss_bound.html)
Comment: I'd like to add that not only is there no deterministic algorithm for constructing a JL embedding in general, it is typically computationally prohibitive to check that a matrix randomly generated according to the JL algorithm actually has the "almost isometry" property (even though it does with very high probability).  So I think it's reasonable to say that the JL theorem is not constructive.  Compare to the algorithm "choose a random real number between $0$ and $1$"; this gives a transcendental number with probability $1$, but I wouldn't call it constructive.


How to predict unknown unknowns in machine learning

Question: I am dealing with a problem about classifying bird species through analysing MFCCs. I already built a dataset with 13 MFCCs for two kinds of birds. And I trained the data with Naive Bayes & KNN model. However, when I tried the model with prediction of third bird species, it is classified as the one of the two species. I am wondering how can I achieve to predict unknown species as unknowns? And I know my existing classification model may not work. So, what kind of model might be helpful? Does SSL useful in my case? Or treat these unknowns as outliers? But how can that be applied in MFCC?
Answer: If you want to predict wether a bird is a bird of one of your two classes or unknown you need three classes: $[bird A, bird B, unknown]$.
For the unknown class you need data from birds which are neither $bird A$ nor $bird B$. You should make sure the number of rows for each of the three classes is roughly the same.
If you don't have data of birds which are neither $bird A$ nor $bird B$ you can use anomaly detection to detect wether a bird is $unknown$ before predicting if it is $class A$ or $class B$.
Comment: Hi Tim @Tim, so is there any other way besides enlarging my training dataset? Do I have to create a new unknown class for storing the unknown data? As my prediction data is from my microphone input, so it could be the sound from any species or even human voices. And how could I deal with it?
Comment: @夏思阳 Anomaly detection works without enlarging your dataset. Besides that I don't know of any other way. If your input can be the voice of a human, you can use data from human voices in your unknown class.
Comment: @ Tim, thanks I will try that
Answer: I don't have much experience with MFCCs but you could always take inspiration from image processing and build a siamese network like model that would give you a distance metric between your sample and that if your distinct classes.
you could then pick the highest distance metric and set a lower threshold to classify it as unknown if none of the existing classes give you a high enough similarity.
After which all you got to do is analyze the unknown sample and create a jew class.


Does using an MVC approach to (PHP-based) web applications necessarily mean that it will be more scalable than other approaches?

Question: From what I understand MVC frameworks are pretty hefty (Zend,Cake,CodeIngniter), so it almost seems contrary to talk about scalability and suggest using MVC.
Answer: Zend, Cake, CodeIgniter... they all come with a bunch of stuff you don't need.  A basic MVC framework is simple, and does not need many files to work.
Also, applications built upon a MVC structure are no more or less scalable than other approaches may be, but may be more organized. It's subjective.
Answer: Although the point of MVC is simple - having data access (Model), GUI creation (View) and flow control (Controller) as separate components - it can be implemented in very different ways.
From a purely technical viewpoint, MVC has very little to do with computational scalability. It's more about the human factor and having a way to organize huge piles of code into meaningful sub-units that are much easier to understand.
Answer: I work with codeigniter every day and compared to the others mentioned it's very light weight.
You have to consider that you will likely not use a lot of the functionality provided in the largest frameworks so just because the files are there, it's not necessarily heavy unless you include lots of the files in your actual executing code.
You can help make your own code scalable in these situations by considering when and when not to use functionality provided by the framework.  Learn PHPs built in functions well as they will almost always be faster than anything in a framework (because they are written in C).
A good framework should really just help you structure you code and give you extra functionality when you ask for it, not lumber your application with a lot of extra processing.


How to retrieve data from web sites database

Question: In my project input to the project is database of any website for example an website like Ebay there are lots of user comes daily & purchase items.
The database of this website is an input to my project & then my project find the frequently coming users & purchasing items.
So anyone can help me how to take this database? Where is actual database? Where to put my project?
On the web administrate pc or on server?
Answer: Are you asking if you can "get" Ebay's database? If so - the answer is certainly no. Perhaps you'd like to use the Ebay API?
Answer: Assuming you are asking a general question about connecting to website data sources, you cannot "take" the database.  In each case, the web site's database will be hosted on a server, and you can only access the data if you are given permission and access.  Typically, this access would be in the form of connection information that would then be inserted into a connection API's (such as ODBC) connection string (e.g. hostname, username, password, etc.).
Some web site databases offer custom APIs, such as the above-mentioned Ebay API, and other sites may provide information accessible through web services.  However, the way you'd access the data will always depend on how the owners/operators of the web site choose to make the data available (if at all).


What ways can I use the Battle Skill in a Skirmish?

Question: I play a Kaiu Engineer (Battle being a School Skill for me) and I enjoy playing the strategist part a lot. So far, my GM has allowed me to use the Battle Skill for a couple other uses apart from as a strategist during a Mass Battle, like playing Go (with Battle/Intelligence) and to make a plan for the party before engaging a group of enemies (with Battle/Intelligence as well). I'm worried that as the campaign progresses, my character will be less useful in combat so I'd like to know if there are any good uses for the Battle Skill during skirmishes, like helping out my teammates to avoid attacks, or give them raises when attacking, etc.
Answer: Battle is a poorly written skill, in the entirety of the core book I can only find 3 example usages;

A generic contested roll between Generals to determine which side is winning a Mass Combat.
A Heroic opportunity involving a contested roll to track down a specific enemy within a Mass Combat.
A Battle/Intelligence roll to determine how an NPC died and what killed them.

This doesn't give you much to work with, but it does leave it open to interpretation.
Personally, I would allow it to be replace Lore(War) entirely.

Try using it to evaluate terrain for potential ambushes (either avoiding an unfavourable fight or setting up one of your own) and defensible positions where you can only be attacked by a few enemies at a time or their archers/cavalry are hindered in some way.
Determine where the bandit camp is based on reports of where they attacked from, then systematically cut off their access to supplies.
If you know who you are fighting you can gain insight on their military history and favoured tactics, allowing you to counter them.
"If it were me, I'd have the archers fire a volley right about now, take cover"

It's up to your GM what mechanical effects these have on the skirmish as there aren't any specific rules for the situations I have outlined. The existence of a Skirmish emphasis for the skill does indicate that it can be used to aid in smaller fights but finding a use for it within one is likely situational.
Perhaps ask your GM if you can create an Advantage together using Leadership (Core, p.151), Tactician (Core, p.154) or Sage of Sword and Fan (Sword and Fan, P.202) as a base. You make a battle roll and if you succeed you give a benefit or hindrance to one participant in the skirmish.
Answer: That I can confirm with RAW, I know Mastery 5 adds Battle skill to skirmish initative. And more on the assumption side than explicitly stated, emphasis in skirmish should take effect on initiative rolls in a skirmish
As for tactical applications, by having such a high initiative, your character can use that high initiative to grapple, entangle, or other ways of interfering with an opponent's action which helps your party by proxy. To directly aid your party members, you can immediately choose to Guard them, or otherwise alert your party to other opportunities.  However, a lot like a Knowledge, Battle is a good way for your GM to tell you things that your character might know, that you don't.
Examples include, but are not limited to:
Detecting enemy forces (whether they've seen you or not)

Predicting enemy movements, which beyond the obvious can include things like patrol timings, and ways to avoid/find scout parties
Assessing terrain, which if you don't play with a board can "create" things to play off of
Assessing quality of enemy training, or things you might have overlooked when planning aloud with the party.


How do I make such a page that opens different link in web (PC) and different in mobile (phones)?

Question: I am building a website that looks beautiful in Web but worst in mobiles. I want to build the same site but different designing for mobile. Whenever user opens site.com then it auto redirect to m.site.com OR site.com/mob only if on mobile.
Comment: Whatever solution you choose, please let the user explicitly switch between the mobile and desktop version of the site. It's quite frustrating when the mobile version has less functionality than the desktop site, or when resizing my desktop browser window to 200px messes up the layout. The user knows best what they need.
Comment: When they will open in mobile it will say "Please download our app", thats what i want. Because its a gaming site.
Answer: There are 3 ways to implement a mobile website:

Responsive Web Design: Serves the same HTML code on the same URL regardless of the users' device (desktop, tablet, mobile, non-visual browser), but can render the display differently (i.e., "respond") based on the screen size. Responsive design is Google's recommended design pattern.
Dynamic serving: Uses the same URL regardless of device, but generates a different version of HTML for different device types based on what the server knows about the user's browser.
Separate URLs: Serves different code to each device, and on separate URLs. This configuration tries to detect the users' device, then redirects to the appropriate page using HTTP redirects] along with the Vary HTTP header.

You can choose any method suitable to your requirements and project. There are both pros and cons of each, so I will recommend spending time on the decision.
Comment: @AhmadTaha these are the only way, not an option. You can develop the mobile website. you can make the redirect to m. or any other folder on your website using .htaccess file or global.cs file in asp.net case
Comment: Oh sorry i didnt saw the 2,3. Really sorry. And thanks for the answer
Answer: Read more about HTTP. You probably should take into account the User-Agent: header.
It would be different on mobiles and on desktops (and would vary from one browser to the next).
A clever user would probably be able to fake it, but few people do that.


why three phase induction motor draws current with spike at low frequency by using VFD?

Question: I have built Variable frequency drive (VFD) for a three-phase induction motor using V/F constant control. while I was testing 15HP three-phase induction motor without load with my VFD, the motor draws current with a spike at low frequency. Low frequency means (10 to 20 HZ), and the current value is about to 1A to 3A.  This only happens when I start the motor from 0 HZ to 20 Hz. when the motor reaches to above 20 HZ, the current value becomes low (1A) and smooth.
My question is to you what will be the factor that draws the current with variation at low speed or at low frequency. ? what should I have to notice?
is there any winding arrange of the three-phase induction motor for starting torque that is drawing current more also at low frequency?
or I should not run motor below 20HZ?
Comment: Are you using PWM to hold V/Hz constant? You may have some difficulty with the PWM programming. How may pulses per cycle are you using? Is the poles width programmed to minimize harmonic content?
Comment: Dear Charles, I am using SPWM for V/Hz constant.  Swit ching frequency is 4KHZ.
Answer: You have to understand an induction motor is basically a transformer with an odd rotating secondary. It has all the properties of the transformer.
What beats you here is magnetic saturation. The voltage you may apply to a given transformer primary depends linear on frequency (within the bounds of the used magnetic material). For your motor/transformer, as soon you go below 20Hz, you have to reduce the primary voltage to avoid saturation of the core.
Saturation does exactly this, during one half of the AC cycle the magnetic material cannot "eat" more voltage-time and so the current increases as it wasn't there. That's why you see those spikes. The lower your frequency drops, the longer the time per AC cycle in which the magnetic material is saturated.
Answer: I suspect the PWM is not behaving like is should or it is providing boosted V/Hz below 20 Hz. If you provide constant V/Hz programmed to close to zero V at zero Hz, the motor should run fine without a load from 1 or 2 Hz and above. It should also work well with a fan or centrifugal pump load. To get enough torque to start a constant torque load, you need some increase in V/Hz below 10 Hz or so. You need to find out by trial and error how much the motor will tolerate without drawing too much current.
Answer: Assuming you are using a commercially available VFD, most of them provide a "Torque Boost" function at low speeds when using V/F control, because of the reasons stated by the previous responders. Most manufacturers ship their drives with this as an optional feature that you must program to turn on, some ship with it turned on as the default setting and you must turn it off in programming. It could also be that someone else before you turned it on. Look through your programming parameters.
Comment: Thanks, @J.Raefield for your answer.  I am not using commercially available  VFD.  I understood from your answer that I have to boost the voltage for low frequency.


Battle between the Sun and the Moon forces?

Question: I remember reading about a mythic battle between the forces of the moon and the sun. Not conflicts between Sun and Moon, but a war between armies of the sun and of the moon.
One of them, the sun possibly, won.
The myth might have been from India, Persia or Babylonia.
I am interested in the origin of the myth and if there are similar myths in other cultures?
Edit/ about Lucian's True History
I would have remembered non-sense fantasy elements, seas of milk, or flying acorns.... and even more so since i grew up in the Gibraltar strait
I think it was a foundation myth to establish the right to rule by a new dynasty. I am not certain that it was Indian and I may have mixed up two myths, but I seem to recall huge battles with elephants. The armies of the sun were like the new dynasty rightly conquering the "corrupt" old dynasty of the moon king or something like that.

Further search; possibly the non-vedic kings in the Mahabharata war
Comment: Lucian's [True History](https://en.wikipedia.org/wiki/True_History) perhaps?
Comment: No,  pretty sure in Asia: India or Middle-East, but thanks, i didn't know about the antique non-sensical SF "True History "
Comment: Well, Lucian was Assyrian, so that covers the Middle Eastern origin.
Answer: I'm converting my comment to an answer, because a battle between the people of the Sun and the people of the Moon (over colonization of Venus) is the exact premise of Lucian's True History. And yes, the armies of the Sun eventually win the battle.
The satire may be written in Greek, but Lucian was Assyrian and lived in Samosata (modern day Turkey, near the border with Syria). This might explain why you thought the myth was of Middle Eastern origin.
An English translation of the story by A.M. Harmon is available on Sacred-Texts: http://www.sacred-texts.com/cla/luc/true/index.htm
Comment: +1 for Lucian's True History, but i am certain this is not it.
Comment: @Reed Could you please update your question to explain why exactly  True History isn't the tale you are looking for? It fits all your requirements, even the vague one about a Middle Eastern origin.


Where is Harvard referencing style most commonly used?

Question: Is Harvard referencing style used mostly in Europe? I ask because it seems to be less well known in USA than I had expected. If so, which is the most commonly used style in US academic institutions?
Answer: The distribution is not so much geographic as field-dependent. For instance, most of the papers I see that use the Harvard style come from the areas of geology, hydrology, and geochemistry, while most of the remainder use various numbered citation styles (RevTeX, AIP, ACS, etc.). This is true regardless of the geographic location of the authors, because the decision regarding citation style is generally made by the publisher, not the author.
Answer: It's used throughout nearly all universities in UK and would generally be regarding as the default style in UK.  I'm not sure about the rest of Europe however, but I also get the impression that it is not widely used in USA.


What is the use for emeralds?

Question: I recently found some emeralds while searching in a cave for some diamonds. Other than creating an emerald block, what other purposes do the emeralds serve?
Answer: From the Wiki:

Emerald is an item which was added in the 0.9.0 update, obtainable by mining Emerald Ore. On the PC and Console editions, it is used for trading with villagers. But, as villagers will have degraded AI, trading will not be possible as of yet, so it's only function would be to craft an emerald block and use it as a decorative item. Emeralds can also be obtained from village chests or mineshaft chests, though rarely.
Answer: Emerald can be used for trading with villagers. It's also very rare, you might be able to find it by looking in villagers' chests, or you could try mine for it (in a mine or cave) - you probably won't but it is worth a try.
Comment: Just to confirm: This question is about Minecraft **Pocket** Edition, i.e. the mobile version. Do you know if there has been an update? i.e. does your answer now apply to the Pocket Edition?

What is the use for emeralds?


jQuery: live() vs delegate()

Question: I'm using jQuery in my web application. While reading its documentation I read about live() and delegate(). Although they have explained both methods, I don't understand the exact difference between them. Also not sure about which method is ideal in which scenario.
Please help me to get clear understanding of these methods.
Thanks
Comment: In addition to the answer below, readers might want to have a look at this *unbelievably good* [article](http://www.alfajango.com/blog/the-difference-between-jquerys-bind-live-and-delegate/) explaining the difference between `bind`, `live` and `delegate`.
Comment: A concise summary: [JQuery -- live vs delegate](http://www.timacheson.com/Blog/2011/oct/jquery_live_vs_delegate).
Answer: .live() requires you run the selector immediately, unless you're using the result it's very wasteful.  The event handler here is attached to document, so all event of that type from any elements bubbling must be checked.  Here's a usage example:
$(".myClass").live("click", function() { alert("Hi"); });

Note that the statement $(".myClass") ran that selector to find all elements with that class even though we don't care about them, all we wanted was the string ".myClass" to match later when click events bubble up to document.

.delegate() actually uses .live() internally, but with a context.  The selector is not run immediately, so it's more efficient already, and it doesn't attach to document (though it can) it's much more local...and all those other events from other element trees you don't care about are never even checked when bubbled...again more efficient.  Here's a usage example:
$("#myTable").delegate("td", "click", function() { alert("Hi"); });

Now what happened here? We ran $("#myTable") to get the element to attach to (admittedly more expensive than document, but we're using the result.  Then we attach an event handler to that (or those in other cases) elements.  Only clicks from within that element are checked against the "td" selector when they happen, not from everywhere like .live() does (since everything is inside document).
Comment: Great explanation, live always smelled funny to me. It's much better to restrict your handlers just to the portion you care about.
Comment: See some performance benchmarks http://stackoverflow.com/questions/2690370/live-vs-bind/7692651#7692651
Answer: delegate() maps to live() in the jQuery code.  The main difference is that live() is called on an element for which you wish to delegate the events to a different element.  live() will delegate these events to the document object.
delegate(), on the other hand allows you to set which element events are delegated to by passing a selector.  Events that bubble up to that element are handled if the originating element matches the selector.
As @NickCraver mentioned, delegate() performs better than live because it doesn't necessarily capture events from every element on the page, and it doesn't query the selector right away.
Answer: From jQuery Documentation:

As of jQuery 1.7, the .live() method is deprecated. Use .on() to attach event handlers. Users of older versions of jQuery should use .delegate() in preference to .live().

http://api.jquery.com/live/
Answer: Live Method:
$("#mymethod").live("click", function() { alert("It checks the entire DOM"); });

Live Method Checks #mymethod in Entire DOM (Sometimes it will take time based on your DOM Contents)
Delegate Method:
$('.mycontainer').delegate('#mymethod','click',function() { alert('Checks only in mycontainer portion') });

Delagate does not search your whole DOM it searches only in your mycontainer portion.(Improve Performance)

jQuery: live() vs delegate()


How do you sync a data-base from a test server to production server

Question: If you have a test server, and a production server. How do you sync the database?
Do you add the data in the test server first, just like you code in the test server?
How is that generally handled?
Answer: That depends on how coupled you can allow the two databases to be.
One configuration might be to have the two databases replicated with the production server in master configuration and the test server as slave. I would use caution with this method, unless you absolutely need the synchronization of live data with test infrastructure, don't go down this path.
Instead, if you want to keep the two instances separated, just replicate with mysqldumps.
Answer: I version control SQL dumps (as made by mysqldump). I find it's usually a nice portable format.
Some platforms have concepts like Django's Fixtures which dumps models data to a JSON or XML file so you can version control it to/from the server and load it up where you need it. Whether you have something like this available depends on your platform.
You're talking about getting a live version in your production environment. If I were you, I'd settle for near-live. Cron up a dump script on the server and either write a little script to pull it into your production environment or just rely on version control.
Anything more than near-live will likely be two-way and risk live data.
Answer: I use Navicat to sync my development and production servers.  The Navicat product allows structure syncing (ie new fields) and data syncing (data).  The main limitation is that you can't sync any tables that don't have a primary key.  And its not always that fast if there are a lot of records to transfer.
Comment: There should never be a table with no primary key!
Answer: WE do all database devvelopment inscripts including scripts to add records to lookup tables. these scripts are in source control and are versionied just like any other code. To send changes from dev to prod, we run the scripts for that version. This would include any changes needed to lookup type tables as well as table structure changes, sps, userdefined functions, views, etc. SInce it cannot be deplyed to prod without a script (we havea configuration managment team that does the deplying not developers), we have no trouble at all with people nort using scripts or source control.
To go back from prod to dev, we refesh last prod backup and then rerun the dev scripts which have not yet been promoted to prod.


What are some good papers or resources for aspect extraction and opinion modelling from video or audio?

Question: I am quite new to deep learning. I just finished the deep learning specialization by Professor Andrew NG and Deep Learning AI. Now, my professor (instructor) has advised me to look into some classic papers for aspect extraction and opinion mining from video. Could anyone suggest me some resources where I can get started? Can anyone suggest some papers I should read? Maybe a course or a book or some links to descriptive sessions. Your help would be appreciated.
Answer: The paper A Multi-modal Approach to Fine-grained Opinion Mining on Video Reviews could be useful for your purposes, although I have read only the abstract

Despite the recent advances in opinion mining for written reviews, few works have tackled the problem on other sources of reviews. In light of this issue, we propose a multimodal approach for mining fine-grained opinions from video reviews that is able to determine the aspects of the item under review that are being discussed and the sentiment orientation towards them. Our approach works at the sentence level without the need for time annotations and uses features derived from the audio, video and language transcriptions of its contents. We evaluate our approach on two datasets and show that leveraging the video and audio modalities consistently provides increased performance over text-only baselines, providing evidence these extra modalities are key in better understanding video reviews.

and looked at some of the diagrams and figures in the paper.


"is you" or "you"

Question: I have seen an interview with Justin Bieber, and there he said, "I just love the fact that what you do so brilliantly is you create such an amazing atmosphere for me," and so I have a question. Why did he use "is you" and not just "you"
Comment: I think the "is you" is really "is that you", shortened in conversation.
Answer: What Ethan Bolker said in his comment is absolutely correct, but may not quite answer your question.
The fundamental rule in English grammar is that a clause must contain a subject and a verb. Of course, a clause may, and usually does, contain more than those two elements.
One of the basic structures in English grammar is
Subject + (some form of the verb to be) + complement
Examples

The boy is tall

The boy is a student

In both examples above, the subject is the noun phrase "the boy," and the verb is "is." The complement in the first example is an adjective, "tall," and in the second example is a noun phrase, "a student."
Clear on the basic structure?
In your sentence, the words following "the fact" form a clause introduced by "that." The subject of that clause is the noun clause "what you do so brilliantly." OK. That is the subject. Now we need a verb. The verb chosen is "is." Now we need a complement. The complement here is the noun clause "[that] you create such an amazing atmosphere for me."
In other words, this is just a complicated version of the form

The boy is a student.

It is not good English to say

The boy a student.

We need a verb to join the subject and complement.
Comment: thank you so much. as I understood "is you" just like "that you" and if we say "what you do so brilliantly THAT you create such an amazing atmosphere for me" this is also correct and means the same thing as "is you and that you" right?
Comment: No. That is not correct. "That" is not a verb. To be grammatical, a clause must contain a verb. Please reread my answer.
Answer: It's just a colloquialism. Technically, it'd be correct to say, "What you do is create..."

"is you" or "you"


Cognitive Effects of studying for the LSAT?

Question: Is this study/article scientifically valid.
http://news.berkeley.edu/2012/08/22/intense-prep-for-law-school-admissions-test-alters-brain-structure/
Comment: Can you provide some insight into why you are questioning it? And if you are questioning the original article or its presentation in the press? "Studying hard makes you think better" doesn't seem to me to be all that controversial a finding, no more than "lifting weights makes you stronger."
Comment: There have been a lot questions here about [far] transfers; see https://psychology.stackexchange.com/questions/207/does-learning-one-discipline-improve-performance-in-another-discipline which has links to quite a few others.
Comment: I just want to make it clear that if I do study for the lsat I will receive the changes according to the articles and not waste time or energy on just getting better at doing a specific task that does not translate outside of the test.
Answer: The study you refer to shows that a measure of brain white matter connectivity, called diffusion tensor imaging (DTI) shows increases in structural connectivity between brain areas that have been previously implicated in reasoning and other brain functions.
The news article goes on to make additional claims, not made in the paper, that this result means studying for the LSAT improves reasoning overall. The study itself does not make that claim, and they did not test reasoning besides measuring LSAT performance. Therefore, you cannot conclude from this work that studying for the LSAT improves performance on anything besides the LSAT, only that studying is sufficient to make detectable changes in brain structure.
I would certainly say it is plausible that studying one set of tasks, like studying for the LSAT, would cause improvement in related skills (certainly this assumption is the basis of a whole lot of pedagogy), but that certainly doesn't mean it is the best way to improve or that it is special compared to other types of study.
Note also that the participants in the study were involved in a particular training program and the results may not generalize to other forms of LSAT preparation.
As a side note, it is always important to read original research articles before taking news at face value. Even the researchers quoted in a news article may not approve of how exactly they were quoted. The news process is subject to sensationalization and the qualifying language that scientists frequently use may not reach the final edits.

Mackey, A. P., Whitaker, K. J., & Bunge, S. A. (2012). Experience-dependent plasticity in white matter microstructure: reasoning training alters structural connectivity. Frontiers in neuroanatomy, 6, 32.


What should the redlines be?

Question: It was said in the chat that there are no redlines, so I would like to ask what should the redlines be?
Answer: Extremely good question. I think in Islam.SE we should get our limits also from Islam.

Insulting the others, Muslims or non-Muslims:

وَلاَ تَسُبُّواْ الَّذِينَ يَدْعُونَ مِن دُونِ اللّهِ فَيَسُبُّواْ اللّهَ عَدْوًا بِغَيْرِ عِلْمٍ

Sectarianism and breaking the community:

وَاعْتَصِمُوا بِحَبْلِ اللَّهِ جَمِيعاً وَلا تَفَرَّقُوا

Calling a group of Muslims (who believe in Allah and prophet Muhammad - PBUH) Kafir

وَلاَ تَقُولُواْ لِمَنْ أَلْقَى إِلَيْكُمُ السَّلاَمَ لَسْتَ مُؤْمِناً

If something is beyond the redlines, it should be closed/deleted. But if some post is not violating the redlines it should be fully tolerated.
Answer: Check out etiquette, faq-content, sectarianism, islam, and in general discussion (this is a much broader set of meta posts, but you'll find everything there).
Aside from that, the faq has a lot of "red lines" which are good to know.

What should the redlines be?


Ubuntu server 14.04 crashing after while

Question: My ubuntu server 14.04 stops working after week or so. If I reboot it, it starts working again and works for a while but in a week it stops responding to pings and I cannot ssh or anything. If I try to ping it, the server responds "Destination host unreachable.". I know this isn't much information to resolve this problem but I really don't know where to start looking for. Which log file might be recording failures what causes this kind of problem. This might be a HW issue or maybe temperatures cause my server did this same thing before I reinstalled ubuntu.
Answer:
you might login locally and check if server got networking working properly
you might check /var/log/syslog ( general messages about whats going on on a server )
you check logs of applications running on a server ( maybe one of those crash and causes some damages )
Comment: This found on syslog.

Jun 13 07:10:00 Viped-server smbd[1248]:   failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL
Jun 13 07:17:01 Viped-server CRON[17244]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Jun 13 07:23:00 Viped-server smbd[17508]: [2014/06/13 07:23:00.626663,  0] ../source3/printing/print_cups.c:151(cups_connect)
Jun 13 07:23:00 Viped-server smbd[17508]:   Unable to connect to CUPS server localhost:631 - Bad file descriptor
Jun 13 07:23:00 Viped-server smbd[1248]: [2014/06/13 07:23:00.627053,  0] ../source3/printing/print_cups.c:528(cups_async_callback)
Comment: Sudo crontab -e is empty and on my own crontab there is only line that handles my domain update. And on my samba settings there is nothing about printers. I really don't know where to continue looking for this error. That line was like million times on syslog so thats probably the source of problem.


Are there decidable problems that are reducible to undecidable problems?

Question: I've seen a question asking if $A \le_m B$, then if $A$ is decidable, $B$ is also decidable. My initial intuition is that this is not the case, and that there are decidable problems that are reducible to undecidable problems. While I am not sure if this is completely correct, or even how to prove this if it is correct, I am thinking a decidable problem could be reduced to a recognizable, undecidable problem because a polynomial time verifier would work on a decidable problem. Is this a correct idea?
Comment: Every question of the form "does this program halt" is an instance of the undecidable halting problem.
Answer: Any decidable problem can be reduced to the halting problem. Take a machine $M$ that decides some language $L$. Now produce a new Turing machine $M'$ that behaves identically to $M$ except that, if $M$ rejects, $M'$ loops forever. Now, $M'$ halts on input $x$ if, and only if, $x\in L$.
More generally, every decidable problem can be reduced to every undecidable problem. Let $Z$ be some undecidable language.  We know that $Z\neq\emptyset$ and $Z\neq\Sigma^*$, since both of those languages are trivially decidable. Therefore, there are strings $z^+\in Z$ and $z^-\notin Z$.  Now take any decidable language $L$.  Since $L$ is decidable, the function
$$ f(x) = \begin{cases}z^+&\text{if }x\in L\\z^-&\text{if }x\notin L\end{cases}$$
is computable, and it is a reduction from $L$ to $Z$.

I am thinking a decidable problem could be reduced to a recognizable, undecidable problem because a polynomial time verifier would work on a decidable problem. Is this a correct idea?

I think you're confusing the set of recognizable languages with NP. A recognizable language has a computable verifier but the verifier doesn't necessarily run in polynomial time (and the time hierarchy theorem says that there are languages whose verifiers can't run in polynomial time). It's true that every decidable problem has a computable verifier (because being able to decide the problem essentially means that you can verify a given answer by just computing the correct answer and comparing) but that doesn't give you a reduction. Rather, it proves that every decidable language is itself recognizable.
Comment: is this "mapping reduction" where we transform a problem instance of A to a problem instance of B? Does it also stand for "direct reductions" where the problem A can be solved using the TM of B as a subroutine?


Creating Foreign Bank Account for Access to Foreign Currency

Question: I'm a young male who is a U.S citizen and resides within the U.S. I have investments in different areas, like stocks, bonds, etc. While I'm perfectly fine with these investments, I would like to branch off and try to hold foreign currency to invest in foreign markets. I am aware of the tax implications of owning a foreign bank account, and I 100% plan on reporting it to Uncle Sam. My plan is to open a foreign checking account in Europe, I'm thinking Switzerland due to their privacy and tax laws, and have it hold Euros where I could invest in a stock market within Europe. Should I open a bank account in the same country that I plan to invest in, or is my approach even a good idea to begin with? Would it be better to create a savings account instead to earn possible interest?
Comment: You can't invest in foreign markets in USA using US acccount?
Comment: It seems you are investing in risky assets that you don't fully understand. Be careful with foreign currency investments; in general they are poor long term investments because exchange rates are mathematically a zero-sum game, and are poor short term 'investments' because there can be a lot of volatility that leads to gambling-like activity.
Answer: Your question seems a bit vague but TransferWise is a good option for flexibility with multiple countries:

A TransferWise multi-currency account lets you keep money in more than 50 currencies, and convert between them at the real exchange rate whenever you need. It's free to sign up and there aren't any subscription fees.
You can also get bank details for GBP, EUR, AUD, NZD, USD, and SGD (with more currencies on the way). Share these details to your friends, companies or customers in order to receive money from around the world.
Answer: What you also should consider is, that in Switzerland the local currency is the Swiss franc and not the Euro. So the Euro is foreign currency there as well, that would kinda eliminate what you want to do to a certain degree. If you want to get Swiss francs that would maybe help.
Also the (total) privacy of swiss bank accounts is mostly history, especially if you have a small budget. And small meaning below multiple millions at least.
I think you can easily find an American bank that let's you hold foreign currency there, that might be a lot easier to manage it with little to no disadvantages.
I myself have a Swiss bank account while living in the EU, because i work in Switzerland and earn my wage in Swiss francs. This way I can convert whenever I want to Euros and hold the risk and the benefit of exchanging at will and not at the date of the paycheck.
Answer: Aaron, do not get scared by other answers. Obviously there are risks involved, but you can manage it if you are cautious and watchful.

Note that fairly nobody is using checks in Europe anymore. Everything's done here via SWIFT, SEPA or local domestic transfers. All banks support all three methods while the local one is usually free of charge.
I live in Poland and my local Citibank offered me a "global account" that basically meant that they would open an account for me not only in Poland, but also in US and other countries wherever I like in almost any currency - I checked PLN, USD, CHF, EUR and GBP and it was ok.
I also have a CHF account in Switzerland, however the charges and negative interest rate (yes! you pay them for keeping your money!) make me to seek for an alternative.
My local bank offered me also "multicurrency internet exchange account". Once you file the papers it is one click to get an account in the currency you like on the 0-0 basis - no interest no fees, free transfers up to certain limits, rather low spread (not the best on the market however). In the pre-covid era you'd needed however to visit a branch so they can verify your identity. Not sure how is it now. The bank earns on the active traders so you need to be prepared for occasional call proposing leverage, forwards, options, whatever. Do not follow blindly and do not use this instruments if you do not understand how they work.
An important advantage of EU banks is that by EU law each member state needs to guarantee consumers' deposits up to the certain limit that varies from country to country. Not sure however if it is applicable to non-EU persons as well may not apply to Swiss accounts, as it is not part of EU
Comment: Not sure if point 5 applies to Swiss bank accounts, since Switzerland is not in the EU.
Comment: Thanks for valuable contribution. You're perfectly right. I've just amended the answer


What is the Testament of Hezekiah? I know it exists, but I can't locate it

Question: I am currently reading up on of apocryphal and pseudopigagraphical literature, and I see on a list that the Testament of Hezekiah is enumerated as one of them. However, I cannot locate a source or any short blurb on its date, origin, and content? Do any of you know? Thanks!
Answer: After a bit more research, I found reference to the "Testament of Hezekiah." It appears, that it a component of the larger pseudegraphical text, "Ascension of Isaiah." Perhaps why I couldn't find info at first, is that it is smack in the middle of a Jewish text. "The Testament of Hezekiah" is believed to be redacted into the text by later Christians.
Theories for its dates from 1st to 3rd centuries CE. It may actually be a compilation of multiple texts that were composed at different times and later compiled together.
The overarching content of the "Ascension of Isaiah" concerns the martyrdom of Isaiah, wherein Isaiah warns King Hezekiah that Manessah (the next in line) will not continue to reign in righteousness. Once Isaiah's prophecy proves to be true, Isaiah and other prophets flee to the deserts for safety. Unfortunately, they are encountered by a false prophet, Belkira (inspired by the infaous demon, Beliar), and charges Isaiah of treason, and Manessah condemns Isaiah to death, which Belkira carries out. (Later, Isaiah ascends into the 7 heavens, etc). This is the "Ascension of Isaiah." These are the sections believed to have Jewish origins (with the parallels of the demon Beliar also being present in the Book of Jubilees, fragments found in Qumran of the Testaments of the 12 Patriarchs, and the Sibylline Books. The other proposed Jewish parallel is the method of Isaiah's death -- being sawed in half -- as accounted for in both the Jerusalem and Babylonian Talmuds).
As for "The Testament of Hezekiah" (and back to the question at hand) -- it is projected into the middle of the "Ascension of Isaiah." This is the blatantly Christian portion of the text as it concerns a vision of Christ's "future" coming, the downfall of the Christian church due to corruption, the dreadful reign of Beliar (the demon), and ultimately the Second Coming. Some scholars think there are clear codes pointing to the persecution of the Church by the Roman emperor, Nero (which early Christians thought was the antichrist).
Anyway, I'm sorry for not finding this info before I posted the question. For those interested (if any) in this Jewish-Christian hybrid text, the information was located in James H. Charlesworth's "Old Testament Pseudepigrapha" (Hendrickson Publishers, 2010).
Comment: You can always answer your own question, even if you knew the answer before asking - for example if you are looking for answers other than your own. A good answer and +1.
Answer: There has been lots of supernatural Bible changes that has taken place, during our lifetime. I am not sure if you have ever heard of the Mandela effect. This has taken place in regards to the Testament of Hezekiah. It was once in the Bible. The Testament of Hezekiah was actually after  Chronicles. It was Hezekiah, Ezra and then Nehemiah.
I know for a fact because the book of Hezekiah was my favorite book of the Bible along with Revelations. Yes the book of Revelations had a s at the end. Another Mandela effect Bible change. The last time I recall seeing it in my Bible was around 2004. I can see the bold black lettering from the heading of the title of book that was in my Bible.
A few years ago I was floored because I went to look it up and noticed it was no where to be found in any Bible. I still get emotional upon finding that it was supernaturally removed. I know that in Revelations 22:18-19 it talks about adding to or taking away from scriptures. That lets us know that this is possible. That is why the warning is given.
I was raised in a Bible reading Christian household my parents had daily Bible studies. My mom was the one who lead the daily Bible reading. We read the Testament of Hezekiah. I grew up reading from the KJV Bible, that was what my mom read from. Unfortunately, the KJV has been the most Mandela effected Bible that has been supernaturally altered, although others have been supernaturally altered as well. There are grammatical errors as well as nonsense verses etc. Most verses begin with and. This was never part of the KJV. The LORD'S prayer has been supernaturally altered. Another gem was in Revelations 18:23 the word Pharmakeia was in the KJV Bible. When I was 17 I looked that strange word up in the dictionary because it was in the Bible. The LORD bought that to my attention during the plandemic. If you look up the word sorcery it means Pharmakeia in the Greek. That was the deception upon the whole world. I could go on and on about the 1000 of changes that have now taken place.
Getting back to the Testament of Hezekiah. I have asked others do they remember this book. Unfortunately, no one remembers it. I was praying asking the LORD about why am I the only one who remembers it. I wanted to know if anyone else may have remembered this or even a platform to discuss this. I was lead to this place. I am in my 60's now, so I am older. I can definitely say I read from the book of Hezekiah numerous times. I found a few references of it on the internet. We live in a time where history is being supernaturally altered. I believe this is where Daniel 7:25 mentions about the changes given into the devil's hand as well as him changing laws and the dividing of time and times.
There is a joke in Christian circles that preachers tell their congregation about opening up the book of Hezekiah. I  do not find it funny, because it is seared in my mind. I would stake my life upon it. I read from that book often. There is also scripture stating how the word will be taken away. People will search for it and not be able to find it. I believe that is in Amos 8:11-12. I definitely believe we are the end times generation the Bible speaks about.  I know this question has been asked a few years ago. I pray that this reaches you. This is my experience concerning the Testament of Hezekiah. GOD bless and may we endure to the end.
Comment: Things are being removed from the Bible and people's memories are being wiped?
Comment: Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer).


Symmetry and Coordinate invariance

Question: How are spacetime symmetries different from simple general coordinate invariance?
Physical laws should be coordinate independent. Are Poincare invariances not simply changing coordinates?
Comment: No, spacetime symmetries in the sense you're describing are physical symmetries (i.e. moving points of the manifold around, otherwise known as *isometries*), whereas coordinate invariance (or covariance) leaves the points unchanged. Writing a theory a generally covariant way says nothing about the isometries of the spacetime.
Comment: See also: active/passive transformations.
Answer: Perhaps it would be useful to consider a system which does not exhibit Poincare invariance.  A typical relativistic action for a worldline $\gamma$ in Minkowski space $\mathcal M$ might look like this:
$$S[\gamma] = \int d\sigma \left[mc^2\sqrt{\eta_{\gamma}(\dot \gamma,\dot \gamma)} - U(\gamma) \right]$$
where $\gamma=\gamma(\sigma)$ and $\eta_\gamma$ is the flat spacetime metric at the point $\gamma(\sigma)$.  This makes no reference to any coordinates, so it is manifestly coordinate-invariant.  It is not Poincare invariant, however.
A Poincare transformation is a diffeomorphism $\phi:\mathcal M \rightarrow \mathcal M$ which preserves the flat spacetime metric, i.e.
$$ \eta_{\phi(\gamma)}(\phi_*\dot \gamma,\phi_*\dot \gamma) = \eta(\dot \gamma,\dot \gamma)$$
where $\phi_*$ is the pushforward along $\phi$.  If you aren't familiar with that terminology, it simply means that when you map spacetime points to other spacetime points via $\phi$, you also map tangent vectors to other tangent vectors via $\phi_*$. Concretely, $\phi$ might implement a spatial rotation, a boost, or a spacetime translation on spacetime points, while $\phi_*$ implements the corresponding transformation on the tangent vectors.
The new action obtained after this transformation is
$$S[\phi\circ\gamma] = \int d\sigma\left[mc^2\sqrt{\eta_{\phi(\gamma)}(\phi_*\dot \gamma,\phi_*\dot \gamma)}-U\big(\phi(\gamma)\big)\right] $$
$$=\int d\sigma\left[mc^2\sqrt{\eta_\gamma(\dot \gamma,\dot \gamma)}-U\big(\phi(\gamma)\big)\right]$$
where we've used the fact that $\phi$ is an isometry of $\eta$.  Clearly this is not the same as the original action, because the second term has become $U\big(\phi(\gamma)\big)$.  As a result, Poincare invariance for a single particle in an external potential requires that the external potential be a constant function on spacetime - but that's the same as no external potential at all.

In more down-to-Earth terms, coordinate invariance is trivial because when we change coordinates $x^\mu\mapsto x'^\mu$, we also change the form of e.g. the potential function $U_{(x)}(\mathbf x)\mapsto U_{(x')}(\mathbf x')$, where the latter transformation is defined in such a way as to preserve the physics.  In Physics 101 we say the gravitational potential is $U(x,y)=mgy$; if we were to implement a 90$^\circ$ clockwise rotation, then this function would become $U'(x',y')=-mgx'$.  This is a different function, which is specifically chosen so that solutions of the old equations of motion are mapped to solutions of the new equations of motion under our 90$^\circ$ rotation.
A physical symmetry is very different.  It contains physical content because it asserts that when we change coordinates $x^\mu \mapsto x'^\mu$, solutions to the equations of motion are preserved even when we don't change $U$.  That is, $U$ is insensitive to the transformation we performed on the coordinates.  This requires very specific conditions on $U$ (which depend on the transformation in question, of course), and so the presence of a physical symmetry is a powerful constraint on what $U$ could be.
Answer: There are two Poincare transformation that we can think about. The first is spacetime isometries and the other is change of observer. All of them is coordinate independent.

Space time isometries.
I will consider $\textbf{spacetime}$  as $(M,\eta)$ where $M$ is a four dimensional $\textbf{manifold}$ and $g$ the metric which in this coordinates
$$
\begin{align*}
  x \colon M &\longrightarrow \mathbb{R}^4\\
  p &\mapsto x(p)=(x_0,x_1,x_2,x_3).\tag 1
\end{align*}
$$
is given by
$$g^{(x)}=dx^0\otimes dx^0-dx^1\otimes dx^1-dx^2\otimes dx^2-dx^3\otimes dx^3 \tag2$$ Suppose we have the equation of motion for particle  given by $$\nabla_{v_\gamma}v_\gamma=F \tag3 $$ where $v_\gamma$ is the tangent vector associated with the curve $\gamma$ and $F$ is a force field.  Let $\phi:M\rightarrow M$ be a diffeomorphism, we define the induced metric by $$\widetilde{g}(X,Y)=g(\phi_*X,\phi_*Y) \tag 4$$.Associated with this metric we have the connection $\widetilde{\nabla}$ wich we can show that $\varphi_{*} \nabla_{X} Y=\widetilde{\nabla}_{\phi_{*} X}\left(\phi_{*} Y\right)$ and so we have $$ \widetilde{\nabla}_{\phi_*v_\gamma}\phi_*v_\gamma=\phi_*F  \tag 5 $$  So if $\gamma$ is a a solution of eq $(3)$ ,$\phi(\gamma$) is a solution of eq $(5)$ this is the meaning of the expression diffeomorphism map solution into solution. Now in special relativity the metric $g$ is not a dynamic variable that is ,it is fixed. So in $(4)$ we need that $\phi$ satisfy $$\widetilde{g}(X,Y)=g(\phi_*X,\phi_*Y)=g(X,Y) \tag 6$$ Diffeomorphism satisfying condition $(6)$  are called Poincare transformation. I hope the examples bellow illustrate the difference between coordinate transformation and diffeomorphism.

Example 1
Suppose we change from  coordinates $(1)$ to coordinates $$y_0=x_0, \quad y_1=x_1+x_2, \quad y_2=x_2, \quad y_3=x_3 \tag 7 $$ than $(2)$ becomes $$g^{(y)}=dx^0\otimes dy^0- \frac{1}{2}dy^1\otimes dy^1-\frac{1}{2}dy^2\otimes dy^2-dy^3\otimes dy^3 \tag8 $$
From $(1)$ we have that $g^{(x)}(\frac{\partial}{\partial x_1},\frac{\partial}{\partial x_1})=-1$. In coordinates $(7)$ we have $\frac{\partial}{\partial x}=\frac{\partial}{\partial y_1}+\frac{\partial}{\partial y_2}$ and so using $(8)$ we have that $g^{(y)}(\frac{\partial}{\partial y_1}+\frac{\partial}{\partial y_2},\frac{\partial}{\partial y_1}+\frac{\partial}{\partial y_2})=-1$
Now suppose that we have a diffeomorphism given in coordinates $(1)$ by   $$x_0 \rightarrow x_0, \quad x_1\rightarrow x_1+x_2, \quad x_2 \rightarrow x_2, \quad x_3\rightarrow x_3 \tag 9 $$
Under this diffeomorphism we have that $ \frac{\partial}{\partial x}\rightarrow\frac{\partial}{\partial x_1}+\frac{\partial}{\partial x_2}$ and since the metric is fixed we have from $(2)$ that
$g^{(x)}(\frac{\partial}{\partial x_1}+\frac{\partial}{\partial x_2},\frac{\partial}{\partial x_1}+\frac{\partial}{\partial x_2})=-2$
As we see in this example for coordinates transformation the result remain invariant while for diffeomorphism it changed.
Example 2. Suppose we use cylindrical coordinates $(t,r,\theta,z)$ whose coordinates transformation from $2$ are given by $$x_0=t,\quad x_1= r\cos \theta ,\quad x_2= r\sin \theta, \quad x_3=z $$Now suppose we have the  diffeomorphism  $$t \rightarrow \gamma(t-vr \cos \theta), \quad r \rightarrow \sqrt{\gamma^2(r \cos \theta -vt)^2 +r^2 \sin^2 \theta},\\ \theta \rightarrow  \tan ^{-1}(\frac{r \sin \theta}{\gamma(r \cos \theta -vt)}),  \quad  z\rightarrow z \\ \tag 9$$
In this coordinates we can show that $$ \frac{\partial}{\partial x}\rightarrow \gamma \cos \theta \frac{\partial}{\partial r}+\gamma\frac{\sin \theta }{ r}\frac{\partial}{\partial \theta} + \gamma v \frac{\partial}{\partial r}\tag 10$$
In cylindrical coordinates we can show that the metric $g$ is given by
$$g^{(c)}=dt\otimes dt-dr\otimes dr-r^2d\theta\otimes d\theta-dz\otimes dz \tag11 $$
From $(10)$ and $(11)$ we can se that the $g(\frac{\partial}{\partial x_1},\frac{\partial}{\partial x_1})$ is invariant under diffeomorphism $(9)$
Diffeomorphism $(9)$ is called Lorentz transformation

Change of observers. An $\textbf{observer}$ is a worldline $\gamma$ with together with a choice of basis
$
O=v_{\gamma,\gamma(\lambda)} \equiv e_0(\lambda) , e_1(\lambda), e_2(\lambda), e_3(\lambda)
$
of each $T_{\gamma(\lambda)}M$ where the observer worldline passes, if
$$
g(e_a(\lambda), e_b(\lambda)) = \eta_{ab} = \left[ \begin{matrix} 1 & & & \\ & -1 & & \\ & & -1 & \\ & & & -1 \end{matrix} \right]_{ab} \tag2
$$

$v_{\gamma,\gamma(\lambda)}$  is the tangent vector of the the curve $\gamma$ at the point $\gamma(\lambda)$.
Suppose we have two inertial observer $\gamma^A(\lambda)$ and $\gamma^B(\lambda)$.In coordinates $(1)$ we have $x^\mu(\gamma^A)=(\lambda,0,0,0)$ and $x^\mu(\gamma^B)=(\Lambda^0_0\lambda+q^0,\Lambda^1_0\lambda+q^1,\Lambda^2_0\lambda+q^2,\Lambda^3_0\lambda+q^3)$.Suppose also that $e^A_0=\frac{\partial}{\partial x^0},\quad e^A_1=\frac{\partial}{\partial x^1},\quad e^A_2=\frac{\partial}{\partial x^2},\quad e^A_3=\frac{\partial}{\partial x^3}$.We can show that $e^B_{\mu}=\Lambda^\nu_\mu e_{\nu}$ with $$\eta_{ab}=\Lambda^\nu_a\Lambda^\mu_b\eta_{\nu \mu}$$. Let $\phi$ be a map that take us from observer $A$ to observer $B$ that is $\phi(\gamma^A)=\gamma^B$ . Than we have $$\phi_*\Bigg(\frac{\partial}{\partial x^0}\Bigg)=\frac{\partial \phi^\nu}{\partial x^0}\frac{\partial}{\partial x^\nu}=\Lambda^\nu_0\frac{\partial}{\partial x^\nu}$$ if we impose additionally that $\frac{\partial \phi^\nu}{\partial x^\mu}=\Lambda^\nu_\mu$ we would have the solution $$\phi^\nu=\Lambda^\nu_\mu x^\mu+q^\nu$$
The last expression has this format in the coordinates $(1)$ .Of course if we choose another coordinate it would have another format.

Symmetry and Coordinate invariance


What did Takeshi fight against, exactly?

Question: I'm watching the Altered Carbon TV series. I haven't read the novels. I want to know what Takeshi fought against exactly. I might have missed something, but all I think he said is, he was against "people like you" (like Laurens) and later that now "they (whoever they are) own everything".
Comment: It's worth noting (again) that the show and the novels diverge enormously on Takeshi's personal history, the nature and purpose of the Envoys, and other things. They really can't be treated as a single work.
Comment: I'm only an episode in myself, but my impression is the woman he keeps seeing in flashbacks (Kell? the lover/trainer?) was a revolution leader (or terrorist, take your pick).  I don't know enough about the society though to say who or what exactly though.  Maybe everyone.  The city we see is pretty much "the poor stay poor and the rich get rich".  Not hard to find something to rebel against.
Answer: Non-spoiler answer:
Keep watching!  Stop being so impatient.
Spoiler answer:

 Ultimately they are fighting against the de facto immortality that humanity has acquired, which is ultimately only really accessible to the extremely rich.  Eternal life for the rich means eternal enslavement of the poor (I think that's a line from an advert for the show, even).

The human psyche is also not well-suited for such extraordinarily long lifespans.  The Meths are really, really, really fucked up and basically all have god complexes; or at the very least they're really, really, bored after having experienced everything so often, and so will do crazy shit to have some fun and then throw huge sums of money at any problems that arise to make them go away. Also that the wealth inequality between the rich (Meths) and the poor (non-Meths, basically) absolutely dwarfs anything in present day society or before.  Given arbitrarily long lifespans, the rich and powerful are able to accumulate arbitrarily large amounts of wealth and power.

 The show doesn't usually scream these things in your face, though.  Takeshi and the others don't usually sit there talking about exactly how these particular things are screwed up.  But they're not hard to pick up if you pay attention and question them on your own.

 That said, the leader of the rebellion, at least in the show, doesn't actually tell her followers that their true target is the elimination of immortality itself until she's just about ready to actually try to do that for real.  In part because even rebels and poor people usually get to live an extra life, and can at least hold out hope for more. They won't truly be dead as long as their stack is intact, and that's a comfort.  Nevertheless, they are fighting against the nature of society as a whole which is held together, at least in a military sense, by the Protectorate, and is embodied by the decadence and depredations of the Meths.


Youtube Embed: Controlos (Play/Pause and Fullscreen) does not show up in Firefox

Question: I use the following embed code to embed a youtube video on my wordpress page:

In Chrome the controls for play/pause and fullscreen show up. However, in Firefox they don't. Still, if I know where to click, I can play/pause the video and also set it to fullscreen. So the functionality is there, but not the symbols...
Can anyone tell me what I need to change, in order to show the buttons in Firefox for embedded youtube videos?
UPDATE: interestingly, when I load the page in "private mode" of firefox, the buttons show up.
UPDATE2: clearing the cache in firefox did the trick. So, obviously the issue was not the code, but my local firefox. Still, a friend of mine has the same issue, leading me to think that this is a strange issue..
Answer: It's a bug in FF44 (I read on mozilla forum). Will be fixed in v45 next month.
You should embed the YouTube video with https:// not with http:// then FF will show the controls.


How to create a fixed blocked (FB) file for IBM mainframe/FTP in VBA

Question: I've got VBA code that generates a text file with some pretty basic information included.  I then upload that file via FTP.
I got a message from the server admin of the IBM mainframe today that my file was in variable blocking (VB) format and their job process uses a fixed blocking (FB) up to a max size of 256.
How is this done?  During the file creation?  3rd party tool?
B
Answer: You can simply convert the VB file into FB in mainframe before running the actual process.VB to FB conversion JCL is a small JCL step to do your conversion
Answer: Sorry all, I have a feeling I didn't explain this correctly, because I do now have an answer which is rather simple.  These 2 commands seemed to have setup the environment correctly for the file to be fb and not vb.
ftp> quote site lr=94
ftp> quote site rec=fb

Comment: locsite also does the same thing.."Quote" bypasses the FTP and executes the command on the host. You can find all the info in the guide I had mentioned in my answer
Answer: If I rightly remember FB is in multiples of the block sizes, that is just how DASD stores the files on disk, it must fit in that multiple block size, which increases speed and throughput on the Mainframe. If the data file is not within the boundary of multiple block sizes (This has nothing to do with the actual size of the data), the DASD system just access files in blocks of 256 bytes...there will be a host of special fields inserted into the data file to describe the blocking and so on...which will get inserted when transferred to the mainframe and that data gets transferred to magnetic tape backups...
There should be a script available on the Mainframe to convert it using JCL (Job Control Language)..ask the Mainframe administrator to do it for you...
By the way it should be noted that the character set you used in your data file, just be aware that the mainframe uses EBCDIC character set...There are plenty of tools out there that can convert from ASCII data to the format to be readable by the mainframe, just something to bear in mind of...If the data gets converted that could impact the file size...Thought it would be worth mentioning and important!
There is a Unix/Linux utility that can convert the data to a fixed block size using the dd utility, although I do not think it would be the right way to do it...
Here's a useful link that will help you in understanding this. And also here on SO a similar user was asking about MVS/TSO data...
Comment: Thanks Tom.  I thought it was a reference to the line length, but it seems instead to be about the file size?  So the file might need to be padded to get to a specific size?

How would I describe the JCL to a layperson?
Answer: You can use Locsite to set the record format on the host dataset(File).
You can find all the list of FTP sub commands in the below user guide
IP User's Guide and Commands SC31-8780-05


Fet is named field effect transistor,why?

Question: FET is named Field Effect Transistor while field effect is also producing in bjt. What are the factors/reasons that FET is called field effect while bjt is not? I have read textbook but it didn't explain it.
Comment: The field effect isn't present in BJTs! Try reading a better textbook.
Comment: @ Leon Heller Is there not field present at the junctions of transistor? Is that field not affected by applying voltage at the base and Collector/Emitter
Comment: @AliKhan, there are fields present in a BJT, but they don't directly control the operation of the device. A BJT is normally considered a current-controlled or charge-controlled device.
Answer: A electric "field" is produced whenever and wherever there is a voltage difference.  Actually the field is always everywhere, but becomes non-zero when voltage differences are non-zero.  Since non-zero voltages are fundamental to how every electrical device works, all such devices can be said to work based on or somehow related to the "field".
Field effect transistors (FETs) work on a pricipal that uses the field produced by the gate in a way that makes the channel conduct more or less.  In bipolar transistors, the current that can be carried between the collector and emitter is modulated by the base current.  Of course there are electric fields inside a bipolar transistor.  The FET was named such because the of how the static field, as apposed to current, plays a central role in the operation of the device.
It's a naming scheme, which is not meant to be a detailed description of how the device works.
Comment: [BJT](http://www.youtube.com/watch?feature=player_detailpage&v=CkX8SkTgB0g)  -
[FET](http://www.youtube.com/watch?v=CLLcRRBph90)
Answer: The value of drain current from the source can be controlled by the potential applied to the gate i.e. the electric field b/w gate and source. That is why such transistor is known as F.E.T.
Comment: You should elaborate a little more. A BJT transistor is also controlled by a voltage, \$V_{BE}\$. Why it is a "field effect" in one transistor but not another.
Answer: For the FET an electric field is established by the charges present, which control the conducting path of the output circuit without the need for direct contact between the controlling & controlled quantities.
Answer: Bipolar transistors are so named because they conduct by using both majority and minority carriers.
The field-effect transistor (FET), sometimes called a unipolar transistor, uses either electrons (in N-channel FET) or holes (in P-channel FET) for conduction.
Answer: You are correct. There are fields inside of a BJT. The fields are not what is driving current. Current is actually delivered by the diffusion of minority carriers in the device. The fields in this case just ensure that the carriers go the correct direction across the junctions, and only effect how they cross junctions, nothing else. (But not always and there's some more fuzzy math to go around, taking into account tunneling and other quantum effects. However, that's way out of scope.)
Where as in FETs, the field either creates (MOSFETs) or removes (JFETs) a region with majority carriers that acts as a conducting connector. How conductive this region is, effects the current. So the current is directly dependent on the strength of the field. Thus the electric Field Effects the transistor.


Why does lighten change the color of the dark part in mix rgb?

Question:
I understand that the add is adding that color, and multiply is coloring the brightness.
But I don't understand why the lighten only colors dark areas. Unlike the name, why does the lighten add color to the dark part?
Answer: Lighten = pick the highest value color
As shown in the manual:

Blender is using the transformations as described in the Gimp specifications:

Lighten only mode compares each component of each pixel in the upper
layer with the corresponding one in the lower layer and uses the
larger value in the resulting image. Completely black layers have no
effect on the final image and completely white layers result in a
white image.

So it's basically using the highest value color, thet's why it's more probable to affect the darker areas as your shadows
https://docs.gimp.org/en/gimp-concepts-layer-modes.html
Comment: ah. white is 1. black is 0. Compare the two values and print the bright ones. shadow is 0.0.0 -> print 0.0.0.3. because blue is bigger than black
Comment: Are you saying that it affects the highhist value color and that the highmost value color is close to black? @@ sorry my english
Comment: Hmmm, no. The highest values are closer to white. It confronts the two pixel of the two images and uses the one wich has the highest value. So shadows, which are dark, are probably substitute and highlites tends to stay the same.
Comment: In your example, the shadow (black) has a value of 0, the highlite (white) is instead 1. The blue you are mixing is around 0.3, so for shadows max(0,0.3)=0.3 (blue) and for whites max(1,0.3)=1 (white).


What is the type of string literals in C and C++?

Question: What is the type of string literal in C? Is it char * or const char * or const char * const?
What about C++?
Answer: In C the type of a string literal is a char[] - it's not const according to the type, but it is undefined behavior to modify the contents. Also, 2 different string literals that have the same content (or enough of the same content) might or might not share the same array elements.
From the C99 standard 6.4.5/5 "String Literals - Semantics":

In  translation  phase  7,  a  byte  or  code  of  value  zero  is  appended  to  each  multibyte character sequence that results from a string literal or literals.  The multibyte character sequence  is  then  used  to  initialize  an  array  of  static  storage  duration  and length  just sufficient to contain the sequence.  For character string literals, the array elements have type  char,  and  are  initialized  with  the  individual  bytes  of  the  multibyte character sequence;  for  wide  string  literals,  the  array  elements  have  type  wchar_t,  and  are initialized with the sequence of wide characters...
It  is  unspecified  whether  these  arrays  are  distinct  provided  their  elements  have  the appropriate  values.  If the  program  attempts  to  modify  such  an  array, the behavior  is undefined.

In C++, "An ordinary string literal has type 'array of n const char'" (from 2.13.4/1 "String literals").  But there's a special case in the C++ standard that makes pointer to string literals convert easily to non-const-qualified pointers (4.2/2 "Array-to-pointer conversion"):

A string literal (2.13.4) that is not a wide string literal can be converted to an rvalue of type "pointer to char"; a wide string literal can be converted to an rvalue of type "pointer to wchar_t".

As a side note - because arrays in C/C++ convert so readily to pointers, a string literal can often be used in a pointer context, much as any array in C/C++.

Additional editorializing: what follows is really mostly speculation on my part about the rationale for the choices the C and C++ standards made regarding string literal types. So take it with a grain of salt (but please comment if you have corrections or additional details):
I think that the C standard chose to make string literal non-const types because there was (and is) so much code that expects to be able to use non-const-qualified char pointers that point to literals. When the const qualifier got added (which if I'm not mistaken was done around ANSI standardization time, but long after K&R C had been around to accumulate a ton of existing code) if they made pointers to string literals only able to be be assigned to char const* types without a cast nearly every program in existence would have required changing. Not a good way to get a standard accepted...
I believe the change to C++ that string literals are const qualified was done mainly to support allowing a literal string to more appropriately match an overload that takes a "char const*" argument.  I think that there was also a desire to close a perceived hole in the type system, but the hole was largely opened back up by the special case in array-to-pointer conversions.
Annex D of the standard indicates that the "implicit conversion from const to non-const qualification for string literals (4.2) is deprecated", but I think so much code would still break that it'll be a long time before compiler implementers or the standards committee are willing to actually pull the plug (unless some other clever technique can be devised - but then the hole would be back, wouldn't it?).
Answer: A C string literal has type char [n] where n equals number of characters + 1 to account for the implicit zero at the end of the string.
The array will be statically allocated; it is not const, but modifying it is undefined behaviour.
If it had pointer type char * or incomplete type char [], sizeof could not work as expected.
Making string literals const is a C++ idiom and not part of any C standard.
Answer: For various historical reasons, string literals were always of type char[] in C.
Early on (in C90), it was stated that modifying a string literal invokes undefined behavior.
They didn't ban such modifications though, nor did they make string literals const char[] which would have made more sense. This was for backwards-compatibility reasons with old code. Some old OS (most notably DOS) didn't protest if you modified string literals, so there was plenty of such code around.
C still has this defect today, even in the most recent C standard.
C++ inherited the same very same defect from C, but in later C++ standards, they have finally made string literals const (flagged obsolete in C++03, finally fixed in C++11).
Answer: They used to be of type char[]. Now they are of type const char[].
Comment: just to note, after this change a standard conversion from const char[] to char[] was introduced.  This was to avoid breaking all the existing code that had functions defined like "int foo(char*)
Comment: Used to be when? When did it change?
Comment: You don't say if you mean C, but I presume so. The standards of C99 and 2011 seem to contradict what you say: C99 6.4.5, §6 says "_If the program attempts to modify such an array, the behaviour is undefined_";   §7 of C2011 says the same. Of course sane compilers (or those that care for your sanity) will flag this for you if you want.
Comment: @JayConrod  `char x[]="abc";` is a special case which declares a variable of type `char[4]` and initializes it as specified. It's a shorthand for  `char x[4] = {0x61,0x62,0x63,0};`, and so that string literal isn't treated as others are. In particular, it won't get placed in some unnamed location by the compiler, as most string literals are.
Comment: +1 Pointer .. to what? WHERE?? Ohhh, you say the COMPILER does that magic for me.
Comment: If you declare a variable char[] and set it to a string literal, you will get a copy of that literal, which can be modified.
Comment: @PJTraill I think the answerer means C++ (see all other answers).


shared web hosting architecture in a university setting

Question: We're in the process of creating a shared webhosting infrastructure for our university. Departments within the university can host their sites on this infrastructure. We're thinking of setting up multiple, load balanced web servers attached to shared storage (for web content and Apache config files). There will also be database servers behind these web servers. Does anyone have any other suggestions about this? Any recommendations for an alternative setup? Would having cPanel/WHM/Plesk be a good idea to automate account creation/maintenance?
Comment: This question is off-topic under current topicality rules.
Answer: I work for a university with around 21,000 students. We've been providing this service for some time through fairly simple means. Historically we've had both Apache and IIS environments for departments to use as a web-host. Right now we're going through an upgrade to improve reliability, putting multiple Apache hosts using the same storage behind a hardware load-balancer that also does the SSL heavy lifting for those few sites that need it.
The big thing that changes my answer to your question is the question of scale. We already have a Web Services group that acts as the mediator between departments and the back-end work to build up a new site, and they work actively with the department to figure out whether a full site or a sub-site on the shared host is better for their needs. We get a couple of new such sites a year. This works for us.
However, a friend in a university at about the same size but significantly larger endowment is managing many more physical web-servers than I am, as departments have historically demanded physical separation and got it. Moving to an architecture like ours would be a hard political fight for them, so they're not doing it.
If you expect to be building more than, oh, 10 a year, you may see gains by automating the process. Pent up demand may make the first year much higher than later years, but you're a better judge of that than we are. Ultimately such tools will make the process easier, but if demand is low enough the effort of maintaining the cPanel/whatnot environment may outweigh the effort of hand coding a few sites.
Answer: The university I was working at recently were working towards implementing a single commercial CMS system which all the departments would be encouraged/made to use. I can see their reasoning - it centralises all the management, and it helps encourage single policies on artwork, design, security, etc.  Historically the departments had all just run their own servers, delegated through dns, and with the central web team running the main site and htsearch.  Webmail, library and online systems were all managed centrally by the IT department.
You'll want to think about the technical competencies and size of the departments in considering how much you want to hand over the control to them and how much you want to handle centrally.
If we're just talking hosting for departments then I don't see there being any need for cPanel, and indeed that'd just complicate matters.  cPanel might come in handy if you're providing separate hosting for every staff member (which is probably a good idea) or every student (which probably isn't a good idea based purely on amount of resources it'd take up).
Answer: I'd consider first determining what group(s) you want to support, surveying the the needs of those groups, and then determine what services you're willing to provide ... then you can worry about architecture.
...
When I worked for a university, our gopher server slowly grew to become the main university webserver -- in the end, we had over a thousand accounts, because any group within the university just needed a staff member to sign off on it.  This meant we had whole schools & departments, but also student groups, faculty member's pet projects, etc.  (oh -- and we had no infrastructure to identify when groups were defunct, or when staff members had changed, etc, so we had no way of cleaning up old accounts).
If you really want it, I can give you the design I proposed to meet the 'requirements' that some contractor proposed to the university, and then insisted he could build and after months of showing us nothing finally shipped us grey market hardware with empty storage arrays.
(I'm mostly bitter because we were weeks away from deploying a two machine sun cluster to replace our aging infrastructure, and I had implemented a rather messy system to deal with people logging in using their individual LDAP credentials to the system, but then having access to a group directory structure for data, while Solaris didn't have good provisions for group quotas, and even had to write connectors for ColdFusion that wouldn't fail over the CF server if it was really a webserver failure)
These days, I'd probably go with more virtualization -- 7 years ago, our contractor insisted on throwing everything on a two machine cluster (two versions of iPlanet webserver, apache, chilisoft ASP, ColdFusion, PHP, Oracle, mysql and some other databases, etc, etc. [note, I was originally building iPlanet + ColdFusion + Oracle, and that was it])
  I think my proposed replacement was a rack full of 1U and 2U boxes, but there's not so much need for separate hardware these days.
...
So, the reason for this story (besides venting) is -- you can try to provide everything available under the sun, no matter if your community needs it or not, or you can do some requirements analysis and meet the needs of the majority of the community without giving yourself something that's near impossible to maintain.
Answer:
We're in the process of creating a
  shared webhosting infrastructure for
  our university. Departments within the university can host their sites on this
  infrastructure..

I'd strongly recommend rethinking the architecture and gathering requirements before deciding on a course of action.  On the surface this sounds horrifically inefficient and difficult to manage compared to any centralized CMS system. (eg sharepoint or alfresco).  The benefits of going to a sharepoint type system (particularly in a college environment) should be an easy sell for IT
That being said lets pretend there was a legitimate reason to create multiple web sites without a need for centralized information management and site management (usually politics is the justification/reason).
For all intents and purposes you would be running a shared hosting site just any other commercial web hoster would.  Plesk is certainly a good way to go in a multiple OS environment, in addition plesk handles virtual and physical server management.


Is there any official/governmental website for cost of living in the US cities?

Question: I am looking for a website that I can find cost of living in my city in California and refrence to it in my official claim. Is there any one?
Comment: I'd push back on this being off topic - they're not asking for a product, they're asking for *official government sources*, which feels like asking for an IRS ruling or similar - neither particularly likely to be outdated nor unreasonable to ask for.
Comment: I also I agree to reopen it.
Comment: "Questions seeking product, service recommendations or **other off-site resources** are off-topic because they tend to become obsolete quickly. Instead, describe your situation and the specific problem you're trying to solve."  We specifically edited this close reason to be clear that a question that is doing little more than looking for a link to a site is off topic. Sorry, I have a PF blog, and the IRS has been know to change their link structure. I've woken up to alerts of a hundred links breaking.
Answer: You could use the  GSA adjustment map, which for example lists the Bay Area as 42.67% higher than the base pay. They have 53 rating areas. (Note: this linked map itself isn't official, but it is using the official information.)
This likely understates the true cost of living difference, but it's the best official government site I know of.
OPM's official tables are also available, though less easy to use of course.


How to monitor vlan using SNMP?

Question: I am a newbie to building a monitor system using Prometheus and SNMP exporter, I have succeeded get metric from the physical interface, but I want to monitor VLAN on a trunk port, is that possible ? and how ?
Comment: This totally depends on the availability of these counters in SNMP, which varies per vendor, device and operating system.
Comment: I am using cisco Nexus N3K-3064PQ and I am trying to find which OID can provide metric for query
Comment: Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can post and accept your own answer.
Comment: Do you have the MIBs use an snmp browser  load your MIB file and find it.
Answer: Monitoring a VLAN inside a trunk port doesn't make too much sense. Usually, you monitor the physical link (trunk) and the SVI (VLAN-IP binding). If you want to monitor VLAN connectivity across multiple switches, that's highly software dependent.
Comment: Exactly that I want, I want to monitor VLAN traffic across multiple devices, I have many servers connected to separate ports, and they can use the same VLAN (sometimes they have Internet-VLAN) so I want to monitor separate Local VLAN traffic and Internet VLAN traffic
Comment: If you want to actually monitor *traffic* you'd need something like NetFlow or sFlow. RMON could also be used but it's only on the interface level.
Comment: Does Netflow (sFlow) can monitor VLAN traffic ?
Comment: Sure. NetFlow and sFlow sample an adjustable fraction of a port's traffic and send a digest to a data collector. Then you can run any analysis you want (and that your software allows) on it, including filtering by VLAN ID.
Answer: I don't know if your N3K-3064PQ has the counters you want.  My guess is it doesn't.  However, you can check for yourself by using snmpwalk or similar.  Some relevant types of ifName values for an example VLAN 5 are below; and note you'll need to confirm they have a non-zero/incrementing ifHCInOctets or ifHCOutOctets as well:

VLAN-5 on Cisco devices is likely to be a layer-2 interface which may have counters
Vlan5 is generally a layer-3 SVI
GigabitEthernet0/1.5 may be a router interface with a sub-interface 5 that you may have configured for e.g. dot1q 5

This older thread may help as well: How to Monitor Vlan Traffic?
Comment: Thanks, I tried to use snmpwalk with ifHCOutOctets, and that only works with layer-3 SVI and can't query layer-2 VLAN. When I trying to query metric with layer-3 SVI, I have a problem that my metric usually get some random time value is null [link](https://postimg.cc/QF3sgf0Y), what happened ?

How to monitor vlan using SNMP?