What coordinate systems allows the magnitude of the basis vectors to change with position?

Question: I'm familiar with coordinate systems where the direction of the basis vectors changes with position, but I haven't come across any where the relative magnitude of the basis vectors themselves are allowed to change also.
Answer: The only orthonormal coordinate basis is the Cartesian coordinate basis.  The basis vectors for the, e.g., polar coordinate basis are orthogonal but not normalized.
That doesn't mean that one can't normalize the polar basic vectors to get the polar unit basis  but such a basis isn't a coordinate basis.
For the Cartesian coordinate basis, the basis vectors are orthonormal:
$$\vec e_x \cdot \vec e_x = g_{xx} = 1 $$
$$\vec e_y \cdot \vec e_y  = g_{yy} =1$$
$$\vec e_x \cdot \vec e_y = g_{xy} = g_{yx}= 0 $$
and the line element is
$$dl^2 = g_{xx}dx^2 + g_{yy}dy^2 + 2g_{xy}dxdy = dx^2 + dy^2$$
Now, polar coordinates are defined by
$$r = \sqrt{x^2 + y^2}$$
$$\theta = \tan^{-1}\left(\frac{y}{x}\right)$$
thus
$$x = r \cos \theta$$
$$y = r \sin \theta$$
and the polar coordinate basis vectors are then
$$\vec e_r = \frac{\partial x}{\partial r}\vec e_x + \frac{\partial y}{\partial r}\vec e_y = \cos \theta \; \vec e_x + \sin \theta \; \vec e_y $$
$$\vec e_\theta = \frac{\partial x}{\partial \theta}\vec e_x + \frac{\partial y}{\partial \theta}\vec e_y = -r \sin \theta \; \vec e_x + r \cos \theta \; \vec e_y$$
so
$$\vec e_r \cdot \vec e_r = g_{rr}=1$$
$$\vec e_\theta \cdot \vec e_\theta = g_{\theta \theta}= r^2$$
$$\vec e_r \cdot \vec e_\theta = g_{r\theta} = g_{\theta r} = 0$$
and the line element is
$$ds^2 = g_{rr}dr^2 + g_{\theta \theta}d\theta^2 + 2g_{r\theta}drd\theta = dr^2 + r^2d\theta^2$$
Finally, we ask if coordinates $\{\hat r, \hat \theta\}$ can be found for the unit polar basis such that
$$\vec e_{\hat r} = \vec e_r = \frac{\partial x}{\partial \hat r}\vec e_x + \frac{\partial y}{\partial \hat r}\vec e_y = \cos \theta \; \vec e_x + \sin \theta \; \vec e_y $$
$$\vec e_\hat \theta = \frac{1}{r}\vec e_\theta = \frac{\partial x}{\partial \hat \theta}\vec e_x + \frac{\partial y}{\partial \hat \theta}\vec e_y = -\sin \theta \; \vec e_x + \cos \theta \; \vec e_y$$
If there are coordinates $\{\hat r, \hat \theta\}$, then
$$\frac{\partial^2 x}{\partial \hat r \partial \hat \theta} = \frac{\partial^2 x}{\partial \hat \theta \partial \hat r }$$
$$\frac{\partial^2 y}{\partial \hat r \partial \hat \theta} = \frac{\partial^2 y}{\partial \hat \theta \partial \hat r }$$
but
$$\frac{\partial^2 x}{\partial \hat r \partial \hat \theta} = \frac{\partial}{\partial \hat r} (-\sin \theta) = \frac{\partial}{\partial \hat r}\left(-\frac{y}{r}\right) = \frac{\partial}{\partial r}\left(-\frac{y}{r}\right) = \frac{y}{r^2}$$
$$\frac{\partial^2 x}{\partial \hat \theta \partial \hat r} = \frac{\partial}{\partial \hat \theta} (\cos \theta) \ne \frac{y}{r^2}$$
and thus coordinates ${\hat r, \hat \theta}$ do not exist; the unit polar basis is not a coordinate basis.

To better see this, consider the level curves of the polar coordinate system:

The concentric circles represent the basis one-form $\tilde dr$ dual to the $r$ basis vector $\vec e_r$.  Note that the spacing of the circles is constant which means that magnitude of $\tilde dr$ is constant.
The radial lines represent the basis one-form $\tilde d\theta$ dual to the  $\theta$ basis vector $\vec e_\theta$.  Note that as the $r$ coordinate increases, the spacing between the radial lines increases or, put another way, the density goes as $\frac{1}{r}$ thus the magnitude of $\tilde d\theta$ is not constant and, in fact, is just $\frac{1}{r}$
$$\tilde d\theta \cdot \tilde d\theta = \frac{1}{r^2}$$
But since
$$\langle\tilde d\theta, \vec e_\theta\rangle = 1$$
it follows that
$$\vec e_\theta \cdot \vec e_\theta = r^2$$
Now it's easy to 'see' why the unit polar basis is not a coordinate basis; if
$$\vec e_\hat \theta \cdot \vec e_\hat \theta = 1$$
then the radial lines (lines of constant $\hat \theta$) must have constant density but radial lines cannot have constant density.
Answer: If you have a coordinate system you could move along a coordinate, which indicates some vectors you could use for a basis.
These vectors might be orthogonal, that depends on your coordinates (think, does the metric look diagonal in those coordinates)?
But even if your coordinates are orthogonal then you still have to pick a magnitude for these vectors. There are a couple of natural choices.
One choice is to make them orthonormal vectors. That choice plays out exactly like you expect.
Another choice is to have a coordinate basis.
If your coordinates are Cartesian, it turns out you can do both. And most introductory courses do not make a big deal about how an orthonormal basis is generally not a coordinate basis. And they do that because they don't want to distinguish between covectors and vectors.
So what is a coordinate basis? If you represent the gradient as a covector then a coordinate basis element can be acted on by the gradient to give the partial derivative in the direction of that coordinate. This doesn't hold in a non coordinate basis.
An example is the basis $\hat \theta$ and $\hat r$ that are unit vectors pointing in the counter clockwise and radial outwards directions respectively. That is an example of a non coordinate basis. A coordinate basis would have vectors that point in the same direction but would have different lengths.
What magic lengths make them a coordinate basis?
If vectors are like column vectors (nx1 matrices), then a covector is like a row vector (1xn matrices). Why? Because there is a natural linear action of covectors on vectors and that notation will remind us of exactly that.
So when you use a coordinate basis it is as simple as saying the gradient of f is $[ \partial f /\partial r \quad \partial f /\partial \theta].$ You can think of it as like a bunch of level curves, it is trying to tell you the rate f changes if you know the rate your position changes. So if you had a coordinate basis you could imagine $r(t)$ and $\theta(t)$ as parameterized coordinates and then for a small interval of parameters $\Delta t$ you get a corresponding $\Delta r$ and $\Delta \theta$ then you can compute $\Delta f$ from $(\partial f /\partial r )\Delta r+ (\partial f /\partial \theta)\Delta\theta.$ So for a coordinate basis you want vectors that point in the right direction so that the coefficients in front of the difference vector are $\Delta r$ and $\Delta \theta.$ And since the actual displacement is $(\Delta r )\hat r+ (r\Delta \theta)\hat\theta.$ Thus the coordinate vectors are $\hat r$ and $r\hat\theta.$
So you can have the orthonormal basis $\{\hat r,\theta\}$ or the coordinate basis $\{\hat r,(1/r)\hat \theta\}.$ The second one interacts naturally with the gradient.
With a coordinate basis you can move around on parameterized paths that have the coordinate basis as tangents and it is like moving around on graph paper that is warped by the coordinates. Over a certain parameter means over a certain coordinate, so over one over the other back the one and back the other ends up where you started. If you parallel transport along that path you can find the curvature by seeing how the vector changed, but to end up back where you started requires that you move a coordinate amount over not a distance amount over.


RaspberryPi 4 64 bit: root is neither allowed to ssh out to another box nor rsync

Question: When I load a new machine (PI), I allow root login, then login and rsync to root@xxxx:/*.sh . to bring in my auto update and daily status scripts.  Just loaded this RaspberryPi 4 with 64 bit and it appears that root is neither allowed to ssh out to another box nor rsync.  Is there a way around this?  Note I have edited the sshd.config to allow root login.  That works fine.  Ater a day of logging in and out it now works??!
Comment: the title of your post does not describe the question ... please change it
Answer: Whether or not SSH allows root
in is a matter of one line in /etc/ssh/sshd_config:
PermitRootLogin [yes|no|prohibit-password|forced-commands-only]

The default when there is no explicit setting is prohibit-password (and I think on RpiOS that is explicitly set), meaning you could use a key, which also means you don't need a normal login password either (not positive, but pretty sure).
This is all documented in man sshd_config.  However, your issue with ssh'ing out:

it appears that root is neither allowed to ssh out to another box nor rsync

Requires an explanation of what you mean by "it appears that".  Is there some error?
Answer: Raspberry Pi OS (like all Debian based OS) does not have root login (although it is possible to enable it) as it unnecessary for normal use.
ssh does not (by default) allow root access (again no need) and is a security risk.
You are unlikely to find anyone who does this.
I suggest you ask about what you are actually trying to do for suggestions on the normal process.
Answer: Don't know why but today it works like all my 32 bit pi's.  Don't know why.
Note: I did say what I was trying to do.  Root has backup scripts etc for crontab to run and rather that recreate them, I enable root login (This is my 10 Pi network of UPS monitors and fileserver) and I rsync to the main pi to retrieve for the new one.  When I started this, a rsync or ssh would just hang.  Much later it started working. And yes I rebooted several times.  Never had this happen when adding a 32 bit pi. I marked it solved because it is working now, and the 64 bit unit is installed in the network.


Using the continuity equation against gravity

Question: Studying Fluid Mechanics right now and in my textbook there is an example of getting water up to a bathroom in a house. We're given the diameter of the inlet pipe and bathroom pipe, but only the velocity at the inlet pipe. Why does the continuity equation apply if gravity is accelerating the water down? The pipe is getting smaller so velocity increases, but then velocity also decreases because gravity is acting against the water flow.
Comment: Continuity equation is the conservation of mass -- why would mass be created or destroyed just because there is gravity?
Comment: I think my answer addresses it -- $\partial V /\partial t$ is not changing (assuming you mean $V$ is volume) because water is typically assumed to be incompressible. Even if they didn't say that outright, that is probably what they are assuming.
Comment: @tpg2114 My thought process was that because the velocity decreases, dV/dt is also decreasing, which is what the continuity equation is. Where am I wrong?
Answer: This started as a comment but I will flesh it out some. The continuity equation is:
$$ \frac{\partial \rho}{\partial t} + \frac{\partial \rho u_i}{\partial x_i} = 0$$
and is an expression of the conservation of mass. Effectively it is saying "What comes in, must go out, or density must increase/decrease accordingly."
The example your book gives is using water. It is probably (without telling you as much) assuming that the water is incompressible. This is a good assumption, but nothing is truly incompressible.
Anyway, if it is incompressible then the density cannot increase nor can it decrease. So you are left with "What comes in, must go out." That is why you can still use the 1D simplification of $A_1 u_1 = A_2 u_2$ which is likely what your book is doing.
Comment: Ok, so if there is a pipe of constant radius, standing vertical, the mass of water going in is the mass of water going out. That would mean pressure is being converted into gravitational potential energy? This is due to A and v being equal at the top and the bottom of the pipe. Am I right?
Comment: Pressure is not an energy so it can't be converted to energy. But the work the pressure is doing is becoming potential energy, yes. Pressure is a force (per unit area) and shows up in the momentum equation as $-\partial P/\partial x_i$ so for fluid to move, you need a gradient in pressure. This gradient in pressure can be a pump at the bottom of a pipe increasing the pressure and atmospheric at the top of the pipe so the water flows up. It could also be due to the weight of water at the top of a pipe and atmospheric at the bottom, which is how water towers work.
Comment: None of which, by the way, has anything to do with the continuity equation. The only terms relating to pressure and gravity show up in the momentum and energy equations (and the energy equation may not have it, if you lump potential energy in with internal energy).
Comment: @malabeh And also, because I remember when I was just starting in fluids and got all confused, velocity happens because of pressure gradients, not the other way around! Low pressure isn't because the flow decided to move faster -- the flow decided to move faster because the pressure is lower. If there are no pressure gradients, there is also no velocity.


What is the windshield Heating Element (Thin Cable) for Aircraft or Rotorcraft?

Question: My question is related with the heated windshield employing the some type of heating elements. Very very thin metalic cables are in use between two glasses of windshield. I have searched but noting found about its material. Do you know any cable supplier provides/gives the below graph. I need a wire to use as a temperature sensor. The needed TCR coefficient temperature in °C is 0.0048-0.0050. Diameter can be between 0.02 – 0.03 mm. Would you have any suggestion to us about material / alloy?
Comment: Are you seeking a generic wire of these properties for a non aviation application, or is this to repair an aircraft? If you are after the part the electronics stack exchange may give you a better answer.
Answer: You can get generic, thin film style heating elements ready to go from various suppliers. If you are replacing an existing windshield on a current aircraft you will need to source a proper, certified, windshield for that airframe which should have the wire already embedded in it.
It seems that at least some of the elements are made of NiChrome


How do you say "taupe" in Esperanto?

Question: I've searched through several dictionaries but the closest I've gotten is taupo, and I'm not sure if that's a real Esperanto word.
Comment: Please [edit] the question to specify, whether this is about the [(group of) color(s) called "taupe"](https://en.wikipedia.org/wiki/Taupe) or about some other meaning of the English word.
Answer: If you mean the color, you could use talpa, since it comes from the animal. That's what Italian does, for example.
Depending on the needs of the context, you might want to use another adjective, such as helbruna, bruneca aŭ eĉ bruna for the light taupe, or grizeca for taupe grey. Taupe by itself does not longer refer to a single color.
If you need to stick to taupe, then you can go for heltalpa, griztalpa, ...
Comment: To add to this: Wells gives _talp(kolor)a_.

How do you say "taupe" in Esperanto?


Restore colors from an infrared frame in Gimp

Question: I have some frames of a security IR camera. The images are black and white.
Is there any way to represent these images with colors.
I use GIMP in Ubuntu operating system.
Thank you!
Answer: Nope - sorry!
All colour information is lost (unrecorded), it cannot be recovered, no matter what software you use.
Answer: There are no colours to restore; the image was recorded in black and white. You could create a false colour image by switching the image to a paletted image (256 colours), then assigning a different colour palette. I'm not familiar enough with the GIMP (and, people, the "the" is not optional; the name of the program is "the GIMP") to know whether it has a split-toning option in the current(ish) releases or add-ins, but you can use that to false-colour a black-and-white image as well. If you're interested in recovering the original colours in the scene, though, you're out of luck—you'd need to hand-tint the image.
Comment: So, on [gimp.org](http://www.gimp.org/), it says "_GIMP is the GNU Image Manipulation Program._" — no _the_.
Comment: One of the programmers at work once asked me if i knew how to make a Mask in GIMP..... much LOLz were had once he realised what hed asked for :-)
Comment: "**the** GNU Image Manipulation Program"...
Comment: Yes, but not (necessarily) "the GIMP".
Comment: Can you migrate a comments thread to "English" ??!!


How to gather *prompt* window from secondary screen no longer attached (using Windows 7)

Question: I use a Windows 7dell laptop sometimes connected to a docking station with dual monitors attached (to the dock). It's not uncommon for me to sleep the computer, undock, and resume elsewhere.
Occasionally, an app (best example is uTorrent) will leave a prompt window on the "ghost" monitor no longer attached. I have tried the alt+space method suggested here, and also tried using win+tab function... the rub comes from the fact that this prompt window doesn't show up in the alt+tab stack, nor in the win+tab stack. (In uTorrent, the window I'm talking about is the window that appears after downloading via "Open with" or clicking a .torrent link, prompting for the location of the file to be saved and other options for use while downloading.) I've also tried the win+P method of
On a mac I would just use "Gather windows" in the system preferences under displays, but there seems to be no option for this (that I can find) in Win7.
How can I gain focus on the prompt window, or more helpful: How can I force all windows to a certain display on Windows 7?
Also, I tried to add the "gather-windows" Tag, since it seems there are several users trying to address similar questions, but alas, not enough reputation...
Comment: It might be simple, but have you tried right clicking on the task bar and selecting `Cascade windows` or `Show windows stacked`?
Comment: Yes, however, this doesn't succeed either; my guess is that since the window isn't in the "zstack" it doesn't respond when the cascade command is given. However, I'll make sure to try it again the next time the problem appears and report back.
Answer: Use win +left arrow or right arrow.


Exclude Preservation Hold Library from Search Results

Question: I am trying to exclude documents that are in a preservation hold library from Search Results. At the moment my users are seeing duplicated documents that are in their original place and the PHL. From my research this is by design, but it is very unfriendly for the standard user who is seeing documents with ID's appended and repeated.
Answer: Although I see this question was asked 9 months ago, I'll answer in case someone is interested in doing this for a single SharePoint library. I'm looking for a script that will loop through ALL sites and set this setting for all sites in my tenant.
In the Advanced Settings for the Preservation Hold Library you set the Allow items from this document library to appear in search results? to No


My new iPad Air language

Question: My iPad Air language is correctly set up in English UK. Whenever I write (such as right now) it wants to change the words to French. Also the keyboard Go and Search keys are in French. I am nowhere near France! Help!
Answer: You have a French keyboard activated.
Go to Settings > General > Keyboards > Keyboards and select the edit button on top right. Delete the keyboards you don't want.

Alternatively, tap the globe symbol on the left side of the keyboard to rotate between active keyboards.
If you keep it pressed you can select from a list
Comment: You are welcome @Stan. If the answer solved your problem, please [accept](http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) it.

My new iPad Air language


Plotting more than two layers on cartodb map visualization

Question: I have a country table that I am using to plot 3 layers using the visualization wizard. I am using CATEGORY for the first layer and BUBBLE for the second. However when I add the third layer with the options available, it can not be distinctly represented. I am using a basic free license. I would like to know if the third layer can be represented distinctly say by using a patter for example.
Answer: Your issue doesn't sound like it's related to your account, but your data. Every data layer you bring into the editor, regardless of what your account size is, should be stylable just like any other in your visualization.
If you're not getting the option to style in the editor, take a look at your data. 'the_geom' should represent either a point, line, or polygon and not 'null' or another non lon/lat input. Try going into your tables from the dashboard and only open that data table to see if you can visualize the data there. Most likely, the issue is with a lack of spatial data, or an issue with formatting in the table that's not allowing CartoDB to pick up the lon/lat.


Android 4.0 and HTML5 History API

Question: Android 3.0 and 4.0 does not support the HTML5 History API (http://caniuse.com/#search=history).
Is there any reason for dropping the support since Android 2.2 and 2.3 supported it?
Answer: My guess is that they missed updating the URL when webkit internally changes it. The 3.0 browser seems to be a complete (mostly at least) rewrite of the 2.3.3 browser.
I reported this to Androids bug tracker at least: http://code.google.com/p/android/issues/detail?id=23979

Android 4.0 and HTML5 History API


map vs. hash_map in C++

Question: I have a question with hash_map and map in C++. I understand that map is in STL, but hash_map is not a standard. What's the difference between the two?
Answer: They are implemented in very different ways.
hash_map (unordered_map in TR1 and Boost; use those instead) use a hash table where the key is hashed to a slot in the table and the value is stored in a list tied to that key.
map is implemented as a balanced binary search tree (usually a red/black tree).
An unordered_map should give slightly better performance for accessing known elements of the collection, but a map will have additional useful characteristics (e.g. it is stored in sorted order, which allows traversal from start to finish).  unordered_map will be faster on insert and delete than a map.
Comment: Well, yes, it helps if you understand your problem.  Up to certain orders of magnitude it is probably a wash performance-wise, but it is important to understand the performance characteristics of both containers as they do deviate in different ways as data volumes get larger.
Comment: I don't fully agree with you regarding the performance. The performance is influenced by a number of parameters and I would scold any programmer using an unordered_map for a mere 10 entries because "It's faster". Worry about interface / functionality first, performance later.
Comment: Interestingly, I just swapped a std::map with a boost::unordered_map in an application in which I do a lot of random lookups, but also iterate over all the keys in the map.  I saved a large amount of time in lookup, but gained it back via the iterations, so I switched back to map and am looking for other ways to improve application performance.
Comment: @ErikGarrison If you use random access and iteration a lot more than you insert and delete elements, you could have your objects in both a tree and a hash_map (by storing a pointer, or better yet a shared_ptr, to the same objects in both in case you were using actual instances).  You will then have O(1) time access time through the hash_map and O(n) iteration time through the map.  Of course, you have to remember to add and remove the pointers from both every time.  You could easily write a custom container class that (probably template it as well) that would encapsulate this behavior for you.
Comment: @ErikGarrison Of course, if you try this method, you would be paying with a minor additional space.  However, since you'd be using pointers, that shouldn't be too much.  If you really want to, you can go overboard, and write your own implementation of an AVL and use the node pointer as your data type in the hash_map, this will give you O(1) time access to a node in the tree from which you'll be able to iterate linearly to wherever you need. Of course this would involve quite a bit of coding and I'm not sure it would pay off unless you need to iterate a lot from and to random access locations.
Answer: hash_map was a common extension provided by many library implementations.  That is exactly why it was renamed to unordered_map when it was added to the C++ standard as part of TR1.  map is generally implemented with a balanced binary tree like a red-black tree (implementations vary of course).  hash_map and unordered_map are generally implemented with hash tables.  Thus the order is not maintained.  unordered_map insert/delete/query will be O(1) (constant time) where map will be O(log n) where n is the number of items in the data structure.  So unordered_map is faster, and if you don't care about the order of the items should be preferred over map.  Sometimes you want to maintain order (ordered by the key) and for that map would be the choice.
Comment: I would point out that hashmap has a worst case access of O(N) when collisions are likely (bad hash fcn, loading factor too high, etc)
Comment: A good hashmap has an expected cost of O(1), it is not guaranteed to be so. Bad hashmaps might have an expected cost that's not O(1).
Answer: Some of the key differences are in the complexity requirements.

A map requires O(log(N)) time for inserts and finds operations, as it's implemented as a Red-Black Tree data structure.
An unordered_map requires an 'average' time of O(1) for inserts and finds, but is allowed to have a worst-case time of O(N). This is because it's implemented using Hash Table data structure.

So, usually, unordered_map will be faster, but depending on the keys and the hash function you store, can become much worse.
Answer: The C++ spec doesn't say exactly what algorithm you must use for the STL containers.  It does, however, put certain constraints on their performance, which rules out the use of hash tables for map and other associative containers.  (They're most commonly implemented with red/black trees.)  These constraints require better worst-case performance for these containers than hash tables can deliver.
Many people really do want hash tables, however, so hash-based STL associative containers have been a common extension for years.  Consequently, they added unordered_map and such to later versions of the C++ standard.
Comment: It was actually added in TR1 (std::tr1::unordered_map), not C++0x
Comment: I thought that the reason `map` is generally a balanced btree was due to using `operator<()` as the means of determining location.
Comment: @kts: Do any STL implementations actually use a B-tree?
Comment: Technically all binary search trees are b-trees (a 1-2 tree). That being said, I don't know of any STL that uses anything other than red/black
Comment: @bk1e "Proper" B-trees are exceptionally useful in databases, where you want "fat" tree nodes that align well with disk pages. OTOH, this is not so useful in the "flat" memory model used in "normal" programs - all STL implementations I know of use red-black trees.
Answer: map is implemented from balanced binary search tree(usually a rb_tree), since all the member in balanced binary search tree is sorted so is map;
hash_map is implemented from hashtable.Since all the member in hashtable is unsorted so the members in hash_map(unordered_map) is not sorted.
hash_map is not a c++  standard library, but now it renamed to unordered_map(you can think of it renamed) and becomes c++  standard library since c++11 see this question Difference between hash_map and unordered_map? for more detail.
Below i will give some core interface from source code of how the two type map is implemented.
map:
The below code is just to show that, map is just a wrapper of an balanced binary search tree, almost all it's function is just invoke the balanced binary search tree function.
template <typename Key, typename Value, class Compare = std::less<Key>>
class map{
    // used for rb_tree to sort
    typedef Key    key_type;

    // rb_tree node value
    typedef std::pair<key_type, value_type> value_type;

    typedef Compare key_compare;

    // as to map, Key is used for sort, Value used for store value
    typedef rb_tree<key_type, value_type, key_compare> rep_type;

    // the only member value of map (it's  rb_tree)
    rep_type t;
};

// one construct function
template<typename InputIterator>
map(InputIterator first, InputIterator last):t(Compare()){
        // use rb_tree to insert value(just insert unique value)
        t.insert_unique(first, last);
}

// insert function, just use tb_tree insert_unique function
//and only insert unique value
//rb_tree insertion time is : log(n)+rebalance
// so map's  insertion time is also : log(n)+rebalance
typedef typename rep_type::const_iterator iterator;
std::pair<iterator, bool> insert(const value_type& v){
    return t.insert_unique(v);
};

hash_map:
hash_map is implemented from hashtable whose structure is somewhat like this:

In the below code, i will give the main part of hashtable, and then gives hash_map.
// used for node list
template<typename T>
struct __hashtable_node{
    T val;
    __hashtable_node* next;
};

template<typename Key, typename Value, typename HashFun>
class hashtable{
    public:
        typedef size_t   size_type;
        typedef HashFun  hasher;
        typedef Value    value_type;
        typedef Key      key_type;
    public:
        typedef __hashtable_node<value_type> node;

        // member data is buckets array(node* array)
        std::vector<node*> buckets;
        size_type num_elements;

        public:
            // insert only unique value
            std::pair<iterator, bool> insert_unique(const value_type& obj);

};

Like map's only member is rb_tree, the hash_map's only member is hashtable. It's main code as below:
template<typename Key, typename Value, class HashFun = std::hash<Key>>
class hash_map{
    private:
        typedef hashtable<Key, Value, HashFun> ht;

        // member data is hash_table
        ht rep;

    public:
        // 100 buckets by default
        // it may not be 100(in this just for simplify)
        hash_map():rep(100){};

        // like the above map's insert function just invoke rb_tree unique function
        // hash_map, insert function just invoke hashtable's unique insert function
        std::pair<iterator, bool> insert(const Value& v){
                return t.insert_unique(v);
        };

};

Below image shows when a hash_map have 53 buckets, and insert some values, it's internal structure.

The below image shows  some difference between map and hash_map(unordered_map), the image comes from How to choose between map and unordered_map?:
Answer: I don't know what gives, but, hash_map takes more than 20 seconds to clear() 150K unsigned integer keys and float values. I am just running and reading someone else's code.
This is how it includes hash_map.
#include "StdAfx.h"
#include <hash_map>

I read this here
https://bytes.com/topic/c/answers/570079-perfomance-clear-vs-swap
saying that clear() is order of O(N). That to me, is very strange, but, that's the way it is.

map vs. hash_map in C++


SubGit error when svn users commit

Question: I just installed SubGit and test it. When one of svn user commited a file, he got the following error message:
Commit failed (details follow):
'pre-commit' hook failed with error output:
SubGit ERROR REPORT (SubGit version 1.0.2 ('Miai') build #1764):
You've received this message because SubGit (http://subgit.com/) is installed
 in your repository
and an error that needs to be dealt with has occured in SubGit translation
 engine.
UNRECOVERABLE ERROR:
    svn: Cannot rename file 'F:\svn\testsubgit\db\node-origins\0.tmp' to
 'F:\svn\testsubgit\db\node-origins\0'
CURRENT STATE:
    Subversion: READ ONLY
    Git       : READ AND WRITE
TO RECOVER:
    Follow Error Recovery procedure described at
       http://subgit.com/book/#recovery
TO REPORT:
    1) Get error log from the server at
       'F:\svn\testsubgit\subgit\subgit-sync-20121108-180124.zip'
<code>2) Report an issue at http://issues.tmatesoft.com/
</code>
Is there any way to solve it? Or do I need to change some setting of SubGit?
Answer: I'm SubGit developer and would be glad to help you to resolve this issue. First, please send SubGit logs from 'F:\svn\testsubgit\subgit\subgit-sync-20121108-180124.zip to firstname.lastname@example.com
Also, please provide more details on your environment, in particular:
a) where your Subversion repositories are (could it be network drive)?
b) do you use Apache server (http protocol) to access Subversion repositories?
c) do you use the same service (Apache) to access Git repositories?
First thing to check are users (accounts) on whose behalf Subversion and Git services run. In case these are different users (e.g. System Administrator and Network Service), then there might be a permissions problem - files created by one services would become unavailable for another. When you run "subgit configure" and "subgit install" also make sure these commands are ran on behalf of the same user that runs Apache server (or another service).
In case you're using network drive to store Subversion repositories on, then network drive configuration might be the reason of the problem and I would advise you to move your repositories to the ordinary drive on the server.
Also, some software antiviral installed on the server might potentially interfer with SubGit - try disabling it.
To recover from this error follow instructions at http://subgit.com/book/#recovery - the most easy way would be to run "subgit install --rebuild repos" - but this way you may loose some of the commits on the Git side.

SubGit error when svn users commit


If a person touched an electric eel, would they sustain electrical burns as if they touched a high tension power line?

Question: I've been wondering this, if an eel was continuously shocking someone, would they sustain electrical burns as if they touched a high tension power line due to the high voltage and amps?
Answer: Electric Eel
In the electric eel, some 5,000 to 6,000 stacked electroplaques can generate a shock of up to 860 volts and up to 1 ampere of current (1). They can also concentrate the discharge by curling up and making contact at two points along its body. When agitated, they can produce these intermittent electric shocks over at least an hour without tiring.  Eels have been known to jump out of the water to shock prey or dissuade threats in the air (2).
A shock from an electric eel is like the brief, numbing jolt from a stun gun. Normally, the shock can't kill a person. However, the eels can cause heart failure or respiratory failure from multiple shocks or in persons with underlying heart disease. More often, deaths from electric eels shocks occur when the jolt knocks a person in the water and they drown.
Electrical Burn
Electrical injury is the physiological reaction caused by electric current passing through the body, electrical burn is a specific subset of that. For high voltage (above 500V) damage can be very severe but most of the damage occurs bellow the skin. If the voltage is less than 200 V, then the human skin, more precisely the stratum corneum, is the main contributor to the impedance of the body in the case of a macroshock—the passing of current between two contact points on the skin. The characteristics of the skin are non-linear however. If the voltage is above 450–600 V, then dielectric breakdown of the skin occurs.(3) Whether an electrical burn occurs is not always clear cut in the case of electrical injury and will depend on the conditions of the skin (perspiration etc).
Conclusion
It is possible for an electric eel to harm a human even when out of the water. The extent of the harm will depend on the exact voltage, current, hertz, pulse duration, and number of contact points between the eel and human. Whether this harm will included electrical burns depends on further factors and is particularly difficult to answer if you limit 'burn' to injury with a visible skin defect.


OMXplayer pexpect loop screen blacks out

Question: I Run omxplayer in a loop with pexpect via python. After a period of time, the screen blacks out and the pi is unresponsive to keyboard input. I have hostapd running and it responds by sending me back replies from local server, but the display is completely blacked out.  The power light is still on.  I checked the /var/log directory for errors, and I have nothing. Any help or debugging considerations are greatly appreciated. Thanks.
Answer: It is possible that your GPU is running out of RAM. This is more likely if you are running an old model with only 250 MB of RAM. You should allocate more RAM to your graphics card. You can just run the raspi-config script to access the split menu. You probably want a half and half split of 128 CPU and 128 GPU. This will increase the graphics performance substantially.

How can I change the RAM split?

If you are still having problems, you can try setting up a swap on either a USB drive or a small partition on your SD card:

How to set up swap space?

I would recommend setting up a swap on a USB drive because it will shorten the lifespan of your SD card.
Answer: Try disabling the console blanking.  I put the following in /etc/rc.local to turn off the automatic blanking that is on by default:
setterm -blank 0

The command has to be run so it outputs to tty1, and you can't do that (easily) from a remote connection.  I use a small script to send setterm commands to tty1:
#!/bin/bash
#
# send 'setterm' commands to /dev/tty1 (physical console)
setterm $* | sudo tee /dev/tty1 > /dev/null

Drop this into /usr/local/bin (mine's named 'tty1'), make it executable, then:
tty1 -blank 0

will turn off blanking anytime you desire, and another useful command is:
tty1 -cursor off

to turn off the blinky cursor.
If you're connecting via wireless and are having connectivity issues, I'd recommend disabling the wireless power saving options, which turn off the wireless dongle if nothing's happening for a bit.   Annoyed me greatly.
(I've posted a longer answer explicitly for this here somewhere, but I'll paraphrase here)
Create a file '8192cu.conf' in /etc/modprobe.d:
# prevent power down of wireless when idle
options 8192cu rtw_power_mgnt=0 rtw_enusbss=0

Next reboot, it'll turn off the power saving for the wireless.  I've had rock steady connections since this.
Um, if it means anything, this is for a generic edimax wireless micro-dongle, the teeny-tiny one. lsusb output:
Bus 001 Device 004: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]


What is the mechanism by which corona discharge damages wire insulation?

Question: I understand that corona discharge can damage wire insulation over time. How? What exactly is happening to the insulation that it ceases to become so insulative?
Answer: Insulation is often made from organic polymers. Corona discharge usually signifies ionization of the local gases as well as the ozonation of oxygen. Both of these elements have excess electrons waiting to oxidize the surroundings. Oxidation of polymers causes long-chain polymers to split resulting in cracks in insulation over time.
For the beginning of further reading:
http://en.wikipedia.org/wiki/Polymer_degradation#Ozonolysis
Really this is a physics/chemistry question. I question whether it really belongs in this forum...


Adhesion issues using AmazonBasics PLA

Question: I am a neophyte at 3D printing. My Ender 3 is now 4 days old and I modified it out of the box with a glass bed.  My first print was a fairly complex item, but a mere 90 x 160 x 3.5 mm. Used the sample filament that was included with the 3, first print was a keeper.
Today I was trying to use the AmazonBasics PLA 3D printer filament.  I am not amused. I'm using the identical setup and glass bed as before but poor adhesion prevented a print.
I cleaned the glass with acetone followed with 90 % IPA...  No joy.  Another cleaning using a dishwashing detergent and IPA, boo hiss!
The glass bed is a Creality for the Ender, purchased separately For the first print, no adhesive was used, just the glass (cleaned the glass prior to the first print as described).
Your suggestions are solicited.
Comment: Coat the bed with sevaral layers of Elmers white glue, or gluestick.
Comment: More information is found [here](/a/7840/), [here](/a/6049/), [here](/a/8344/), [here](/a/8034/) and [here](/a/6861/).
Comment: Out of the box ender-3 does not have a glass bed. at least mine doesn't have one. Did you swap it? Do you use some adhesive?
Comment: If you fixed it, post an answer, the fix should not be in the question, this is not a forum. Besides, printing on a raft is not really a solution when you have such a great upgrade like a glass slate. An adhesive on the glass is usually the way to go, but if you are happy, we are happy :) p.s. I did not know you could clean with beer
Comment: @R.Ogburn The fact that you have modified the machine is relevant. It opens a huge can of worms, starting with an unleveled bed (very common) and no adhesive (somewhat needed on glass for PLA, very common) to electrical problems (like bad connection, somewhat uncommon). in my experience, the rough buildTak-clone surface is easier to start out with as a neophyte. Glass beds can get flatter bottoms though. Raft is not commonly needed for PLA.
Comment: I used AmazonBasics PLA filament for a print and wasn't too impressed with it. I was able to get it to print, but the quality of the print wasn't up to par with other PLA filaments I'd used in the past. I realize different colors of filament have different print qualities and you have to tune your printer each time you change a color or manufacturer, but really, the print was mediocre at best. Previous prints were of much better quality. The only reason I used the AmazonBasics PLA was because it was a specific color. I doubt I'll go back to it unless absolutely necessary.
Answer: Answer taken from OP's question

****Fixed it!****
Reset bed height to clear nozzle by 0.04 mm. Printed on raft.  I appreciate the answers.
Comment: @R.Ogburn - If you care to submit your own actual answer, I will delete this Wiki answer, thanks.

Adhesion issues using AmazonBasics PLA


Why does Sasuke have only one Rinnegan?

Question: In the latest chapters of the Naruto manga (673 and 674), why does Sasuke possess only one Rinnegan and not both?
Comment: I don't watch Naruto, so I don't know if the edit I made to the title is a spoiler. If it is, please feel free to change it to something else.
Comment: Please do not close my question again Mr. @JNat. (˘‿˘ʃƪ)
Comment: It's as much of a spoiler as it was. Either way, it is what it is.
Comment: @V-Moy I won't be closing this one, no :P This is a perfectly acceptable question here. It's spoiler-y by nature, so there's not much we can do about it.
Comment: This is an acceptable question but the answers are merely speculations/theories. The manga did not reveal when or how sasuke obtained the rinnegan. Nevertheless, still a good question.
Comment: probably because he is left dominate or that he only gets half the power of the hermit of six paths so that means one eye
Comment: Would it have been wrong to make this question more generic, e.g., "Why does this character have only one rinnegan?" or "Why does character x* have only one rinnegan?" to improve spoiler security? The x* could signal this is the most spoilery part.
Comment: Kishimoto loves Sasuke and giving him an already known power-up would make him less unique. It's a similar point as to why Sasuke has like 20 costume changes whereas Naruto only has one.
Answer: For starters: Sasuke's Rinnegan is not the same as Kaguya's/Madara's Rinne Sharingan (not to be confused with Madara's Rinnegan, I'm talking about the one in the middle of the forehead of both of them).

Sasuke's Rinnegan has 6 tomoe, Rinne Sharingan has (at least) 9.
Sasuke's Rinnegan is blue, Rinne Sharingan is red.

The reason Sasuke only has the Rinnegan in one eye was not mentioned or explained in either the series or the data book. So we can only speculate.
In no particular order, here are my speculations:

Hagoromo only gave Sasuke enough chakra to awaken the Rinnegan in one eye.
That's the best Sasuke can do without fusing Asura's chakra.
It's the cool factor.
Answer: My opinion is that he chose not to use the other one. With the Rinnegan not able to use Sharingan's abilities, it's probably better to use both at the same time. Madara was seen switching back and forth between the Rinnegan and Sharingan, so it should be something that Sasuke can do as well.
Comment: The switching you mentioned happened only in Anime. Not in manga.
Comment: Madara was able to use all of the Sharingan's abilities with the rinnegan active. So that point is almost surely false.
Answer: Maybe the other eye is only for Sharingan, or he can't have two Rinnegans because it might replace his Sharingan permanently. However, one thing is for sure: he might use Sharingan and Rinnegan at the same time in the future.
Comment: I guess it's only your speculation. Try to support your answer by providing some facts or cite some sources. Thanks!
Answer: Sasuke's Rinnegan is exactly the same Rinnegan of Kaguya's 3rd eye and Madara's 3rd eye. Since, Madara's 3rd eye and Kaguya's 3rd eye are one and the same, this means that there is only one such eye.
This Rinnegan with Sharingan tomoe has always been a one eye case from the beginning. It is very different from Madara's Rinnegan, which is same as Hagoromo's pair of eyes.
Comment: Can you give a source or link for your 'claim' about "*Sasuke's rinnegan is exact same rinnegan of Kaguya's 3rd eye and Madara's 3rd eye it awoke*"? Thanks

Why does Sasuke have only one Rinnegan?


Running resistors above power rating, but with temperature within spec

Question: I am building a circuit to heat a very small area to a relatively high (~100C) temperature. To achieve this, I'm using an SMD resistor controlled by a MOSFET, with an adjacent thermistor for temperature monitoring and control. To achieve faster heating I'm considering running a higher power through the resistors than what they are rated for, at least until they reach the needed temperature. As long as I control the temperature (via PWM control) of the resistors and maintain their temperature within what they are rated for (typically around 125C) are there any issues that would result from doing this?
Comment: Are you sure that the temperature inside them is what they are rated for too?
Answer: I'd suggest that small SMD resistors would be questionable, but you certainly could use very small power resistors to achieve your goal.
This type of power resistor might suit your need: http://www.vishay.com/docs/51055/d2to20.pdf
You have not been specific about your needs in terms of volume, but resistors like this have an SOA out to 140 degC. It would seem possible to drive this sort of device with a PWM to provide the temperature increase needed.
I've also used two TO-220 power transistors clamped around a crystal to make a crystal oven at 80 degC...worked well.
Depending on your application (and since you are already using a FET to drive the resistors) you could simply use the FET as the heat source. By holding VDD constant for an N-Channel FET at some voltage level you can dissipate all the heat required directly in the FET. All the same rules apply in terms of temperature, but most power FETs have an SOA out to at least 125 degC so 100 degC sounds pratical. You could sense the current through the FET using a small value resistor.
You could even use a linear power regulator in anything from TO-92 to TO-220 or even SMD D2PAK to provide the heat. Just configure in a constant current circuit and modulate it from the feedback pin divider.
Answer: Probably not. However keep in mind that the temperature on the surface of the resistor (or at the sensing resistor) may not be an accurate reflection of the core temperature of the resistor. For large, fast increases in voltage or current the resistor temperature gradient (difference between core inner and outer temperature) may be substantial. I suspect that this gradient wouldn't be relevant for an smd part.
Comment: Actually this gradient can be very significant for typical thin-film SMT resistors. Most are laser-trimmed to achieve the specified tolerance. This results in part of the current path being extra skinny, effectively forming a fuse, and they can certainly fail at moderate overloads even of short duration.  OP should use a wire wound resistor (which are available in smallish SMT packages if that's desired)
Comment: Good point! I hadn't considered the trimming 'channel'. Wirewound sounds like a winner...
Comment: Does this apply to thick film resistors as well?
Comment: Would not be possible to "increase the power of the resistors" for example filling the PCB with thermal pads and vias?
Answer: Lets talk about time constants of components.
Ceramic substrates for resistors include silicon atoms.
Silicon cubes, 1cm cube, has thermal tau of 1.14 seconds.
Silicon cubes, 1mm cube, has thermal tau 100X faster, or 11.4 milliSeconds.
Silicon cubes, 100micron cube, has thermal tau again 100X faster, or 114 microseconds.
Point being: your thermistor will not report the correct temperature, because there is substantial "thermal distance" between the heat source and monitor.
You can model the heat flow between the Thermistor and the Heat Source, using Rth of copper foil {1 ounce/foot^2} as 70 degree C per watt per square --- any size square: 1cm, 1 foot, 1 mm.
[ before edit, the numbers were for copper: 0.9sec, 9.0mS, 90uS]


ScrollablePositionedList initial scroll offset

Question: I'm working with ScrollablePositionedList in flutter for a while. From the document I found, it said ScrollablePositionedList works slightly the same with ListView. My problem is that I want to set the initial index of the ScrollablePositionedList in the position around 70% of screen height from the top of the screen, and I intend to do with by setting the pixel for that initial index. However, I'm struggling to find how to set initial scroll offset for the ScrollablePositionedList with ItemScrollController. Please help me
Answer: You can set the initial index when building the widget with initialScrollIndex and initialAlignment property. The alignment is a bit more complicated to use so I wrote a little function for you.
int initialIndex = 1;

@override
Widget build(BuildContext context) {
   return LayoutBuilder(builder: (context, constraints) {
       return ScrollablePositionedList.builder(
           initialScrollIndex: initialIndex,
           initialAlignment: getAlignment(
              index: initialIndex,
              itemHeight: list[initialIndex].height,
              viewPortHeight: constraints.maxHeight,
              alignmentOnItem: 0.5, //middle of item
           ),

And here is the calculation for the alignment. You can configure in what position the item should be shown with alignmentOnItem.
double getAlignment({
    required int index,
    required double viewPortHeight,

    ///The item height at the [index]. If all your items have the same height this
    ///can be a static value
    required double itemHeight,

    ///A double value between |0, 1| is expected, where percentage of the item
    ///should be positioned based on the center of the screen.
    ///(0 is top of the item, 1 is bottom if the item)
    double alignmentOnItem = 0.5,
  }) {
    assert(alignmentOnItem >= 0 && alignmentOnItem <= 1,
        "Alignment on item is expected to be within 0 and 1");
    final relativePageHeight = 1 / viewPortHeight * itemHeight;
    return 0.5 - relativePageHeight * alignmentOnItem;
  }

Note that if you set the alignmentOnItem to something that cannot be reached (so that an overscroll happens) the desired position obviously cannot be reached. See alignment at index 0.


Is there an out-of-universe explanation for why Delenn began looking more human?

Question: Early on in the series, Delenn (played by Mira Furlan) put herself into a kind of cocoon and came out looking significantly more human than Minbari. The in-universe explanation was that she wanted to be closer to the humans, or something like that. I'm wondering if there's an out-of-universe explanation for why the writers would put that in - maybe the actress disliked all of the makeup or something like that.
Before:
After:
Answer: She certainly hated the makeup, describing it in interviews and on her blog as very masculine and unpleasant to wear:

During the pilot when the last remnants of my vanity were crushed by
  the masculine alien make up I had to wear, it was Andreas who urged me
  to remember that all acting began with masks in ancient Greece. When I
  was complaining of being hot under the blazing California sun, it was
  Andreas who told me to remember the old peasant women in "the old
  country", covered from head to toe by loads of thick black cloth in
  the middle of the summer. "The sweat cools you down", he would say and
  take a long drag from his cigarette between his rubbery G-Kar lips.

She also (according to the show's senior prosthetic and makeup designer; Greg Aronowitz) pushed, right from the start to be able to play her character with substantially less makeup, with increasing success each successive season:

She could not believe that the production would fly her all the way
  to America, completely cover her face in an androgynous make-up, give
  her a male voice, and hide her eyes behind black lenses. We were asked
  to leave the trailer, and when they let us back in, Delenn was to be a
  flesh colored female alien with eyes that looked like Mira Furlan's!
I have to give her credit, there are very few actors that can take a
  stand like that and have so much be changed to accommodate their view
  of the character! True fans of the show will recognize Mira's
  continuous push to have Delenn be more human, as with each passing
  season, there was less make up, more hair, and my alien antler design
  merely became a tiara!

Purely as a matter of interest, although her original makeup was rather more dramatic (and her new makeup hardly any better) the reality is that her post-human makeup actually took rather longer to put on, due to the need to interweave the bone-spur into her long hair.
Comment: @Jake Actually, [JMS' earliest outlines of Babylon 5](http://www.trekbbs.com/threads/synopsis-of-jmss-synopsis-of-the-original-arc-for-b5-spoilers.53739/) (long before Mira Furlan was cast) still had Delenn becoming Human, and at about the same place in the 5-year arc. Back then, Delenn actually started out as a Minbari *man*. JMS kept this as such a secret that Mira Furlan didn't know she was playing a man until she was costumed for the pilot, which she wasn't comfortable with. JMS relented and made Delenn a Minbari woman, and continued with his plans to have her transform into a Human.
Comment: Very very interesting. I assumed it was something along these lines - although I love the show, the writing for her change left a little to be desired. I assumed the actress simply wanted it, so they made up an in-show reason. Thanks so much for your research!
Comment: @Richard. I think the quote about the makeup being masculine only refers to her original design in *The Gathering*, when she was originally going to be a Minbari man, which Mira Furlan didn't like. To my knowledge, she has never said a similar statement after they redid her makeup for Season 1 to match the fact that Delenn was now a woman.
Comment: @Thunderforge - I gather she was most displeased with her makeup for the first season. I've seen multiple accounts from people who've met her at con's who say that she hated it and found it "mannish" as well as darned uncomfortable.


Sharing QGIS projects with Geopackage connections

Question: I've built a QGIS template project that I'm using for repetitive municipal projects that I'm sharing with other users on the local network, the layers are organized and stylized within geopackage files.  I've just learned that when other users open the QGIS project, they don't see the layers because they're not connected to the geopackage files - not a hard problem to solve since they can just make the connection and move on, but I feel like there must be a way to have the qgis project automatically make that connection so it doesn't have to be done manually for each user?
Comment: It is not recommended to use SQLite databases from network drives https://www.sqlite.org/whentouse.html but if your users connect read-only it should be at least safe.
Comment: What do you mean they aren't connected to the geopackag files? Is their path to the file different from yours? Also you could create a script to fix the connections on startup if needed.
Comment: Thanks for that link about sqlite.... good info there.
Comment: Agreed. Thanks for the sqlite info, very helpful.  Setting up a client/server rdbms definitely sounds like the best situation, but a bit out of my skill level at the moment, I'll have to look into it more.  In the meantime, yes, all users have the same path to the gpkg files, I'll also look into writing a script for startup.
Answer: If this is your preferred approach to distributing QGIS projects, then it might be worthwhile embedding a startup python script inside of the project, which will check if connected and then if not, make the connection.
Nice introductory article here
https://madmanwoo.gitlab.io/foss4g-python-workshop/startup/
Comment: I'm just getting into scripting so I'll have to do some research, but this sounds like a great solution - thanks!


What is the mechanism by which magnetic fields do work?

Question: I've seen some conflicted answers to this question in texts and on the web, in the case of a dipole, for example.
Do magnetic fields do work directly, or is it their induced electric fields that do work?
Comment: Related: http://physics.stackexchange.com/q/10565/2451 , http://physics.stackexchange.com/q/67826/2451 and links therein.
Answer: Magnetic fields never do work directly on electric charges. This is because the magnetic force on any charged particle,
$$\mathbf{F}=q\mathbf{v}\times \mathbf{B,}$$
is always orthogonal to the velocity, and therefore the power transferred, $\mathbf{F}\cdot\mathbf{v}$, is zero.
On the other hand, this seems to contradict much of our intuition about how magnets behave. If you take two magnets and put them close to each other, they will snap together, accelerating in the process, so there's definitely something that's doing work. What that something is will usually depend on what frame of reference you're working in.
The standard example is a loop of wire moving relative to a magnet, which induces a current in it. If you consider the situation in the frame where the loop is stationary, then what you see is a changing magnetic field; by Faraday's law this means there's an induced electric field that accelerates charges around the loop. On the other hand, in the magnet's frame of reference there are only magnetic fields, so it must be something else, which turns out to be the motion of the loop.
Assume for simplicity that the loop is travelling along its normal $\mathbf{n}$. Then the charges have a velocity $\mathbf{v}\propto\mathbf{n}$, and the magnetic force will give them an impulse perpendicular to that and thus along the loop. Once you have such a current going, though, the velocity of the charges has a component that's orthogonal to $\mathbf{n}$, and this will also incur in a magnetic force, which will now be along $\mathbf{n}$ and tending to slow the loop down. You will therefore create a current at the expense of the loop's kinetic energy or out of the work performed by some extra force that's keeping the velocity constant. There is a nice in-depth explanation of this example in Griffith's Introduction to electrodynamics (example 5.3, section 5.1; p. 209 in the 3rd edition).
The attracting magnets can be treated in a somewhat similar fashion. For one, you can swap the permanent magnets for loops of current without loss of generality, because the magnetic fields they produce are actually produced by magnetization currents on their surface. Put them close enough, and you get to the core of the problem, the magnetic force between two current-carrying wires.
Consider, then, two parallel wires carrying currents in the same direction, so that they attract and move towards each other. Again, in the frame of reference of each moving wire there's an electric field induced by a changing magnetic field, and this can perform work. In the lab frame, on the other hand, you have each wire moving in the magnetic field of the other. Once they're moving towards each other, the charges in each wire have a velocity component along the wire and one along the separation vector. The second component will incur a magnetic force on the charge carriers that's against the current direction; this means that you need a current source to keep it steady (with the associated energy cost) or the current in the wires will decrease.
For the magnets, then, this means that the magnetization of two magnets that snap together will actually decrease slightly in the process, by a specific mechanism which depends on where that magnetization comes from. This is, by the way, in principle, a temporary thing: the work you perform on the magnets when you prize them apart goes, essentially, into re-establishing the magnetization.

One should note, on the other hand, that strictly speaking this applies only to charged particles and, by extension, to systems that are made up of charged particles. It does not, however, cover the case of point dipoles, such as electrons, for which the fundamental force (and torque) exerted by a magnetic field are different, and given by
$$
\mathbf F=\nabla(\boldsymbol \mu·\mathbf B)
\quad\text{and}\quad
\boldsymbol\tau=\boldsymbol \mu\times\mathbf B
.$$
This leaves permanent magnets in a bit of a funny position, because they are fundamentally made up of aligned electron spins so one should in principle apply to that description.
However, in a useful description of a permanent magnet you take a macroscopic average of the local magnetic dipole density to obtain its magnetization $\mathbf M$, and in the process you cease to care where the magnetization comes from. As far as classical electrodynamics is concerned (and unless you want to meddle with individual atoms inside it), a permanent magnet is simply a material with a permanent magnetization $\mathbf M$, all of whose interactions with other charges and currents occur via its bulk and surface magnetization currents,
$$
\mathbf J=\nabla\times\mathbf M
\quad\text{and}\quad
\mathbf K=\mathbf M \times\hat{\mathbf n}
.$$
If the magnetization is uniform then there is no bulk current density (each bulk dipole 'cancels out' with its neighbours) and the magnetization current is confined to the surface. Thus, a uniformly-magnetized bar of iron is well modelled by magnetization currents on its surface, and the magnetic-work paradox can also be resolved as above - by the action of an induced electric field, or by magnetic forces slowing down those currents once there is motion along the loop normal.
In the end, the difference between the two is a bit of a personal-choice thing. It is generally somewhat harder to handle point dipoles and there are in general few situations that cannot be modelled by using electric currents, so it is a good thing to keep those models, and their counter-intuitive properties, well in mind. On the other hand, it is probably true that physics could do a bit of a better job remembering to emphasize that magnetic fields never do work directly on electric charges.
Comment: F=∇(μ⋅B) is not a term in the Lorentz Force, which only describes charges and not magnetic-moments-that-are-not-really-moving-charges. Yet I've never seen such force in any of the postulates of electrodynamics. Can you tell me the name of this force?
Comment: @JuanPerez I'm unaware of any formal or informal name associated with this force. This is an unfortunate and rarely-noticed gap in the nomenclature of electrodynamics, I would say.
Answer: As Emilio Pisanty asserts, the magnetic Lorentz force $\boldsymbol{F_m}= q \boldsymbol{v \times B }$ does not do work, since $\boldsymbol{F_m \cdot v} = 0$.  I don't have access to Griffith, but I find Feynman's discussion (in v. II, ch 15) confusing, since he has magnetic forces doing work on the current while also asserting those same forces do no work.
To see what's going on (classically, at least) consider an ideal, zero-resistance, wire driven by a current source $I$ in a magnetic field $\boldsymbol{B}$.  The current $I$ is carried by mobile electrons whose negative charge $q_e<0$ is balanced by a fixed lattice of (much more massive) positively charged wire ions $q_w>0$, with $q_w=-q_e$ for simplicity.
The wire's moving current-carrying electrons (average velocity $\boldsymbol{v_e}$) will be deflected by the Lorentz force $\boldsymbol{F_e} = q_e (\boldsymbol{v_e \times B})$. Consequently, the electrons will tend to "pile-up" on one side of the wire.  The wire's net charge density is now no longer zero, so an electric field $\boldsymbol{E}$ is produced that opposes the deflection.  In steady-state, the electric force must just balance the Lorentz force, so the net force on the electrons vanishes:
$$ \boldsymbol{E} = - (\boldsymbol{v_e \times B}) $$
(This is just the Hall effect.)
Now this electric field will accelerate the wire's ions, since there is no counteracting magnetic force on them.  In fact, the electric force on the wire ions $\boldsymbol{F_w}$ is exactly equal to the magnetic force $\boldsymbol{F_e}$ on the electrons:
$$ \boldsymbol{F_w} = q_w \boldsymbol{E} = - q_e \boldsymbol{E} = q_e (\boldsymbol{v_e \times B}) = \boldsymbol{F_e} $$
The key difference is that this electric force can and will do work on the lattice.

If the wire is initially motionless ($\boldsymbol{v_w}=0$), the average electron velocity $\boldsymbol{v_e}=\boldsymbol{v_c}$, where $\boldsymbol{v_c}$ is parallel to the wire (increment $ \boldsymbol{dl}$) and
$$|q_e| \, n A_c \, |v_c|=I$$
(with $n$ the electron density and $A_c$ the wire cross-sectional area),
Then $\boldsymbol{E=-v_e \times B}$ is perpendicular to $d \boldsymbol{l}$, and the line integral of $\boldsymbol{E}$ around the wire is 0, so the applied voltage is 0 and the current source provides no power to the wire.  But that's not surprising, since the rate of mechanical work being done on each lattice ion is $\boldsymbol{F_w \cdot v_w}=0$ also.

For a non-zero wire velocity $\boldsymbol{v_w}$, the electron velocity $\boldsymbol{v_e}=\boldsymbol{v_c}+\boldsymbol{v_w}$, and there will be a non-zero component of $\boldsymbol{E}$ along $ \boldsymbol{dl}$:
$$\boldsymbol{E} \cdot \boldsymbol{dl} = - (\boldsymbol{v_e \times B}) \boldsymbol{\cdot} \boldsymbol{dl} = - (\boldsymbol{v_w \times B}) \boldsymbol{\cdot} \boldsymbol{dl} $$
so the electrical power $P_e$ supplied by the current source is:
$$ P_e = VI = I \int -\boldsymbol{E \cdot dl} = I \int \boldsymbol{( v_w \times B ) \cdot dl} $$
The mechanical power $P_m$ applied to the wire is the sum of the individual ion powers:
$$ P_m = \sum  \boldsymbol{F_w \cdot v_w} = q_m n \int \boldsymbol{E \cdot v_w} \, dV = - q_m n \int \boldsymbol{(v_e \times B) \cdot v_w} \, dV $$
By a vector identity, and since $ \boldsymbol{v_e = v_c + v_w} $ and $q_m = -q_e$,
$$ P_m = - q_m n \int \boldsymbol{( B \times v_w) \cdot v_e} \, dV = q_m n \int \boldsymbol{( v_w \times B ) \cdot v_c} \, dV =  I \int \boldsymbol{( v_w \times B ) \cdot dl}$$
for a thin wire, and $ P_m =  P_e $.
Answer: It depends. The general rule is that:

(non-uniform) Magnetic fields can do work on intrinsic dipoles, such as the spin of an electron. Indeed in the Stern-Gerlach experiment particles are being accelerated by a non-uniform magnetic field. In such cases the force is $\textbf{F}=\nabla (\textbf{m} \cdot \textbf{B})$ where $\textbf{m}$ is the magnetic dipole moment of the intrinsic dipole, and $\textbf{B}$ is the field it is immersed it. Note that this is clearly a conservative force field, and hence we may define a potential energy $U=-\textbf{m}\cdot \textbf{B}$.

Magnetic fields in general however cannot do work on systems comprising of currents. In such cases the force on the currents is always the Lorentz force, which coincidentally for a "physical" dipole, one with an associated current, turns out to still be $\textbf{F}=\nabla(\textbf{m}\cdot \textbf{B})$. In this case however the force is perpendicular to the velocity of the particles, hence no work is being done. Intrinsic dipoles are exempted from this because they do not, by definition, have an associated physical current to them.

Hence when two magnets attract, because most of their "magnetism" comes from the intrinsic dipole moment (spin) of electrons, the magnetic field is doing work indeed. This nice paper shows that the decrease in the magnetic field energy when two magnets snap together is paid back by an increase in kinetic energy https://www.physics.princeton.edu/~mcdonald/examples/mag_energy.pdf.
However, when two electromagnets attract, then the magnetic field is doing no work. Let us model the two electromagnets as two loops carrying current $I_a$ and $I_b$, with self-inductances $L_a$ and $L_b$, and mutual inductance $M$. Assume that the upper loop with current $I_b$ is fixed, and that only the lower loop with current $I_a$ moves.
As the diagram below shows, the initial magnetic force will be upwards, perpendicular to the current. No work is being done. Since the charge carriers are constrained to move in the wire, they will exert a force (not magnetic in nature) on the wire. Hence the wire will start moving upwards.

Now the instant the wire starts moving upwards, the charges will also gain a velocity component $\textbf{v}^\perp$ perpendicular to their original motion. This component will produce a horizontal component $\textbf{F}_{mag}^\perp$ of the magnetic force opposing the flow of current. In the absence of a source then, the currents will decrease, and the work done by the magnetic field in doing so will precisely balance out the work done by the horizontal component in raising the ring. Hence the magnetic field will have done no work, and of course we see this visually because the total force $\textbf{F}_{mag}$ is indeed perpendicular to the total velocity $\textbf{v}$.

Let's prove this result. The magnetic fluxes through the two loops are:
\begin{align}
    &\Phi_a = L_a I_a + MI_b\\
    &\Phi_b = L_b I_b + MI_a
\end{align}
which induce emfs in the loops opposing flow of current:
\begin{align}
    &\varepsilon_a = -L_a \frac{dI_a}{dt} - \frac{dM}{dt}I_b - M\frac{dI_b}{dt}\\
    &\varepsilon_b = -L_b \frac{dI_b}{dt} - \frac{dM}{dt}I_a - M\frac{dI_a}{dt}
\end{align}
So in the absence of an external supply of energy we will find that the currents decrease. The rate at which work is done by these emfs is then:
\begin{align}
    &\frac{dW_a}{dt} = -L_a\frac{dI_a}{dt}I_a - \frac{dM}{dt}I_bI_a - M\frac{dI_b}{dt}I_a\\
    &\frac{dW_b}{dt} = -L_b\frac{dI_b}{dt}I_b - \frac{dM}{dt}I_bI_a - M\frac{dI_a}{dt}I_b
\end{align}
Note that the work $dW_b$ is totally due to induced electric fields, the emf comes from Faraday's law. Instead, the work $dW_a$ is partly a faraday emf due to the changing magnetic fields of the two loops (the term $-L_a\frac{dI_a}{dt}I_a- M\frac{dI_b}{dt}I_a$) and partly a motional emf $-\frac{dM}{dt}I_bI_a$ which is done by the horizontal component of the magnetic force. The total work done by the emfs is:
\begin{equation}
    \frac{dW_a}{dt}+\frac{dW_b}{dt} = -L_a\frac{dI_a}{dt}I_a-L_b\frac{dI_b}{dt}I_b-2\frac{dM}{dt} I_a I_b - MI_b \frac{dI_a}{dt} + MI_a \frac{dI_b}{dt}
\end{equation}
Meanwhile, the change in the field energy is:
\begin{align}
    &U = \frac{1}{2}L_aI_a^2 + \frac{1}{2}L_bI_b^2 + MI_aI_b\\
    &\frac{dU}{dt} = L_a I_a \frac{dI_a}{dt} + L_a I_b \frac{dI_b}{dt} + MI_b \frac{dI_a}{dt} + MI_a \frac{dI_b}{dt} + \frac{dM}{dt} I_a I_b
\end{align}
Hence we may write that
\begin{equation}\tag{*}\label{energy cons}
    \frac{dU}{dt} + I_aI_b\frac{dM}{dt} = -\bigg(\frac{dW_a}{dt}+\frac{dW_b}{dt}\bigg)
\end{equation}
We now recognise the work $W_g$ done in lifting the loop in $\eqref{energy cons}$:
\begin{equation}
    \frac{dW_g}{dt} = I_aI_b \frac{dM}{dt}
\end{equation}
so that:
\begin{equation}\tag{**}\label{energy cons2}
    \frac{dU}{dt} + \frac{dW_g}{dt} = -\bigg(\frac{dW_a}{dt}+\frac{dW_b}{dt}\bigg)
\end{equation}
We may also rewrite $\eqref{energy cons2}$ in the energy conservation form:
\begin{equation}
    U + W_g + W_a + W_b = \text{cnst.}
\end{equation}
So in the absence of a source the work done by the emfs (be it faraday or motional) in reducing the currents is paid back by a change in potential energy and translational kinetic energy (given by $W_g$ using the work-energy theorem).
Note that the work done by the magnetic field's vertical component on the loop is only the $-I_aI_b\frac{dM}{dt}$ term in $dW_a$ which is incidentally the negative of the work done by the horizontal component $dW_g$. Hence, as required, the magnetic field does no work. The faraday emfs in $W_a$ and $W_b$ instead are responsible for the change in field energy $U$. What force was responsible for the loop being lifted? The vertical component $\textbf{F}_{mag}^\parallel$ of the magnetic force, of course, but did the magnetic force do work overall? Of course not.
The magnetic field also does no work on loop b, as the emf there is purely faraday. Hence the work is done by an induced electric field rather than a magnetic field.
Comment: I think the correct treatment for intrinsic dipoles lies in quantum mechanics.
Comment: "Intrinsic dipoles are exempted from this because they do not, by definition, have an associated physical current to them." What force governs them, then? Clearly not Lorentz'...


Line number (linum, nlinum) grow margin with increase in font size

Question: When I turn on linum-mode or nlinum-modeand increase the font size via C-x C-+ it does not increase the size of the "margin" where the line number is displayed, so only part of the line number is visible. Is there a way to configure either of these modes so that the entire line number is always visible regardless of font size? Tested using emacs 24.5 on OS X and emacs 24.3.1 on ubuntu 14.04
Comment: Even if you get an acceptable answer here, please consider filing an enhancement request with Emacs Dev: `M-x report-emacs-bug`. This behavior should probably be optional (e.g., add a user option), as some users might depend on or prefer the current behavior.
Comment: Try adding this to your init.el: `(eval-after-load "linum"
  '(set-face-attribute 'linum nil :height 125))`.
Answer: This is what I put in my init.el file to fix the problem. It's a hack, at some sizes the left margin is a bit off but so far this is the best solution I've found to this problem.
(defun adjust-left-margin-hook ()
  (let ((new-margin (+ 1 text-scale-mode-amount)))
    (setq left-margin-width (if (< new-margin 0) 0 new-margin))
    (set-window-buffer nil (current-buffer))))

(add-hook 'linum-before-numbering-hook 'adjust-left-margin-hook)
(add-hook 'text-scale-mode-hook 'adjust-left-margin-hook)

The function adjust-left-margin-hook performs the following commands:

sets new-margin to 1 more than the current text-scale-mode-amount
sets left-margin-width to new-margin (or 0 if it's below the minimum). You can play around with this variable to adjust based on your preferences but take note, that left-margin-width must be a positive integer
redisplays the buffer so the margin width changes are applied

Then the two hooks are there for the function to be called whenever the left margin needs to be adjusted. That is, before the linum or nlinum packages start numbering the lines or whenever you change the scale of the text manually.
My Emacs version is 27.0.50, but it should work on earlier versions starting from 23 as well.
Comment: n.b. In Emacs 26+ it's highly recommended to use `display-line-numbers-mode` if possible, as it's *dramatically* more efficient than other line-numbering libraries.
Comment: I neither understand why this works for you (it doesn't seem to pay attention to the width of the line-numbers themselves) nor why you need it (linum should obey the scaling automatically in recent Emacsen).
Comment: @Stefan the line numbers _are_ scaling on their own. Better to show than tell.

This is what the line numbers looked like before I applied my fix:
Comment: @Stefan couldn't edit my comment. Here are the images I wanted to include: https://imgur.com/a/2dG0FYI
Comment: @Nikaoto: By "obey the scaling" I mean that the margin should grow automatically to accomodate the numbers.  So, if that doesn't work for you, I suggest you `M-x report-emacs-bug`.


Cyclic Subgroup of $GL_2(\mathbb{F}_p)$ of order $p^2-1$

Question: I am trying to show that all cyclic subgroups of order $p^2-1$ are conjugate to one another in $GL_2(\mathbb{F}_p)$ but I am having a lot of difficulty. I have seen claims that each element in such a subgroup is uniquely determined by their characteristic polynomial, but given two cyclic groups of order $p^2-1$, how do I know the same conjugation will work for all elements?
Answer: The eigenvalues of $A\in G=\text{GL}_2(\Bbb F_p)$ satisfy a quadratic, so
lie in the cyclic group $\Bbb F_{p^2}^\times$. If $A$ has order $p^2-1$
its eigenvalues are outside $\Bbb F_p$ and so are $\alpha$ and $\alpha^p$
for some $\alpha$ which must generate $\Bbb F_{p^2}^\times$. If we have another $B$ of order $p^2-1$ its eigenvalues are $\beta$ and $\beta^p$
for some $\beta$. Then $\beta=\alpha^r$ for some $r$, and then $B$ and $A^r$ have the same distinct eigenvalues. Then $A^r$ and $B$ have the
same rational canonical form, so are conjugate in $G$. Thus the
groups they generate are conjugate.
Answer: Since you are working with cyclic groups. You only need a conjugation on generators. Say, if $gxg^{-1} = y$ for some $g$, then for all $n\in \mathbb{Z}$
$$gx^{n} g^{-1} = (gxg^{-1})^n = y^n.$$
Thus $g\langle x \rangle g^{-1} = \langle y \rangle.$
Comment: This is the way to address the last sentence of the question. But then you need to show that each such cyclic subgroup contains a generator with the same characteristic polynomial?
Comment: Yes, this is what I want to show. I want to do a pigeonhole argument where I argue the number of generators exceed the number of conjugacy classes. A generator necessarily has two eigenvalues in a field extension $\mathbb{F}_{p^2}$, and so there are $(p^2-p)/2$ possibly conjugacy classes for a generator and $\varphi(p^2-1)$ generators, but I cannot show that $\varphi(p^2-1) > (p^2-p)/2$.


Recovering and casting indium

Question: I bought some scrap indium online, and I melted it down into an ingot on my kitchen stove, but my losses were very high as molten indium has a surprising ability to stick to things.
I have a lot of indium stuck to a stainless steel pot, and, unfortunately, I dropped a glass dish that had indium in it into the steel pot and it broke. So now I have broken glass that is covered in indium, and it really likes to stick to glass as well.
Is there a good way to recover the indium? Perhaps increase its surface tension so that it beads up and coalesces? I've seen something similar with sodium metal in hot oil; adding a few drops of isopropanol makes it coalesce. Is there a similar method for indium?
Also, is there a good material to cast indium in? I see that teflon melts at a higher temperature than indium, so maybe a teflon coated muffin tray? Any thoughts on that? Recommendations?
Comment: So I had time last night to try out a better way to cast indium. I thought about it and decided a teflon coated tray was a bad idea because you still might have to use a tool to pry the ingot from the mold, and over time you would scratch the teflon and create a more adhesive surface. I decided to try one of those silicone rubber molds used for baking. I found two of them at a thrift store for 4 or 5 dollars each, and they worked perfectly! So that's one question down, but the question of how to recover indium from surfaces that it is well adhered to remains unanswered at this time.
Comment: A much more straight forward way uses oxalic acid. For the paper on this:
https://pubs.acs.org/doi/full/10.1021/acssuschemeng.8b04756
For a YouTube demo of how to do it in practice see:
https://www.youtube.com/watch?v=AvXTnvT8WNo
(relevant part starts about 11 mins in)
Answer: Through experimentation, I've come up with satisfactory answers to my problems.
1) What is the best material to cast indium in? Silicone rubber (the kind used for cookware).
2) How can I recovery indium that has "wetted" a stainless steel pot? Put the pot on the stove and heat until the indium is molten. Use a silicone rubber spatula to scrape the indium off, let it harden on the spatula, then pick it off. You can also use a wet sponge as long as it's the kind used for cleaning solder irons (make sure it's a new clean sponge!). I folded it in half and held it with a large clamp. That gave me something to hold onto.
3) How can I recover indium that has "wetted" glass, broken glass, or is contaminated with other odd bits of material?
Number 3 is more involved, and I will break it down into steps:
1) Go through the material with a pair of forceps and discard any bits of glass that have no indium on them.
2) Place the material in Pyrex beaker.
3) Fill the beaker with mineral oil until the material is fully submerged (water may also work, but the oil will probably help keep the indium from re-wetting the glass bits).
4) Place the beaker on a hot plate and slowly heat up to about 160 degrees C (320 F). Periodically stir while heating (a screwdriver worked fine for me; I didn't use a magnetic stir rod because the broken glass might chew it up). Also, make sure your area is well ventilated; the oil will produce vapor.
5) Once you have reached 160 C, poke the indium and make sure it is molten. Increase temperature if it is not molten. Stir for about 30 seconds to break up the indium. Keep on heat; try to maintain ideal temperature.
6) Use a glass dropper to drop in 31.45% Hydrochloric acid (I used 4 drops total when the oil and material together was about 100mL). Add one drop at a time, and let the drops run down the inside of the beaker into the oil. (WARNING: This can result in splashing! Don't over heat the oil, add the acid drop-wise, and use proper safety gear: gloves, long sleeves/pants, face shield, and respirator with acid vapor cartridges). Adding the acid will react with the indium oxide layers and help break the indium free from other materials.
7) Stir vigorously with your implement of choice. The oil will become a nearly opaque brown with all the oxides. The stirring should also free up most of the indium from the glass bits.
8) When the oil seems saturated, thoroughly decant the oil into a waste receptacle (I used a mason jar). Save as much solid material as you can.
9) Fill the beaker with clean oil; do NOT begin stirring yet. Keep on heat.
10) Use your forceps to pick out the larger pieces of glass that seem mostly clean. Use another implement to scrape off little bits of indium from the glass bits as you are pulling them out of the oil.
11) Once most of the glass is removed, use strong stirring once again until the oil is mostly brown.
12) Using your stirring implement, try to push a good amount of the molten indium together into one blob on one side of the beaker. Now decant the oil into a waste receptacle.
13) Place beaker back on heat for a short time just to ensure the indium is molten. Make sure most of the material is in one corner of the beaker.
14) Use a broad-shaped implement (I used the flat head of a long "elevator bolt") to hold back most of the scrap material and pour off the indium from the beaker into a silicone rubber mold. The poured off indium should be MOSTLY clean. Repeat this step until you feel you cannot get anymore. Put the scrap material off to the side.
15) Once the clean blobs have hardened, dab them with a paper towel and cut them into tiny chunks with a pair of wire snips.
16) Take each individual chunk and crush it paper-thin using a flat metal implement and a flat metal surface (I used an elevator bolt and a piece of sheet metal). This step is to find any tiny bits of glass. Glass has quite a different "crunch" than the typical "crackling" of the indium's crystal structure. You will know when you find one. Fine tweezers and some sort of magnifying glass helps.
17) You can now re-melt the clean indium into one chunk. I use a stainless steel shot glass and pour it off into a silicone rubber mold. If it's still oily, wash it with Ronsonol/Zippo lighter fluid, then rinse it with water. I actually chose to keep this piece of indium separate from my other indium pieces that I KNOW are clean. You never know, there might be one last sand-grain sized piece of glass in there.
18) As for the scrap material, there's still a bit of dirty indium in it. You can decide how hard you want to work and continue salvaging it. Use tweezers to pick out as much "clean" glass as possible. Wash it with lighter fluid and rinse it with water. Perhaps re-melt it in a steel shot glass and try to pour a little bit more out of it. Try putting a blob of solder flux in with the molten material and get it to stick to a copper wire. It's all going to be loss anyway, so you may as well try different things.
DISCLAIMER: I am not a professional! This procedure is not advisory. It is an account of my experiment and what worked for me.
If anyone has suggestions or constructive criticism, please feel free to comment. I know there are probably better ways to do this.

Recovering and casting indium


Search neglects quoted square-bracketed terms

Question: If you search for something within square brackets, within quotes, the search seems to ignore the bracketed part. For example, searching for <code>"[something] query"</code>, seems to display results for just " query", as shown below:
Comment: Normally searching for `[something]` would only include results with the `something` tag (which is nothing, since that tag doesn't exist), but that probably shouldn't happen if the bracketed string is in quotes. In this case it does seem to just ignore the bracketed string completely; it doesn't show up in the right bar and doesn't filter the results correctly
Comment: Indeed, and I agree, I don't think that it should consider that a tag. I actually don't even mind too much if it intentionally ignores it because it *is* bracketed, so long as the UI makes that a bit more apparent.
Comment: I'd advocate the Google method -- searching "[thing] stuff" becomes "thing stuff".
Answer: This was an artifact of a tag cleanup parsing step that's no longer relevant (that I can think of, else I've broken that now).
Starting with the next build, that aggressive excess-tag stripper won't interfere here.


Do extended & director's cut versions get released in theatres?

Question: Do extended & director's cut versions get released in theatres?
Comment: I would think this depends too much on the film and even on the theater.... We have a local theater that screens them occasionally.
Comment: Sometimes (typically for budetary reasons) these extended editions are created on video, such that a high-res version simply doesn't exist. This precludes a theatrical release, or even an HD broadcast. Off the top of my head, the extended edition of *Independence Day* and the director's cuts of *Scream* and *Star Trek:  The Motion Picture* were created this way, and that's at least part of the reason why the Blu-ray releases of those movies contain only the theatrical versions. The extended edition would have to be re-created from scratch for a higher-quality release.
Answer: Sometimes yes but they tend to be short or single runs in more 'art-house' cinemas or as part of a collection of director/actor movies ran together. I saw a 'Blade Runner' thing like this as part of a Ridley Scott appreciation thing a few years ago.
Comment: We also saw the redone Star Wars Ep 4/5/6 re-released in theaters as well.
Comment: Yeah, we got all 12 or whatever hours of the Lord of the Rings director's cuts.
Answer: The only sensible answer is "sometimes".
Where movies are particularly popular or well received then studios sometimes release special versions to extend the cinema run (knowing that the extra expense is worth it).
For example, David Fincher's dark nightmare Seven which is particularly notable for its very dark (or chiaroscuro) cinematography proved popular enough to sustain a special edition release for cinemas on a contrast-enhancing film process that emphasised the effect of the dark scenes.
The Lord of the Rings trilogy also released the (even better) longer versions of the movies in cinemas but only after the success of the (already very long) originals had been established.
And various Blade Runner special editions were eventually released in cinemas but long after the original, not very successful, cinema release and only when the movie had proved a cult hit on video demonstrating that there was an audience for Ridley Scott's original version (the original release to cinemas was somewhat altered by the studio).


Why does Mac OS X come with ruby/rails?

Question: Why does Mac OS X come with ruby and ruby on rails pre-installed? Does the OS actually use it at all? Can I update my Ruby, Rails or Gem versions safely without something spitting the dummy?
Comment: It also comes with python installed.
Comment: You can update those things, but, because there are no regression or integration tests, you have no way of knowing whether you screwed up something that the system relies on. Try my command listed in the comment below your selected answer and you'll see Apple relies on the languages; They're not there for our pleasure solely. @Ned Deily recommends being careful and suggests alternative ways of dealing with it. I'll also recommend using [RVM](http://rvm.beginrescueend.com/) for the chore.
Answer: As others have noted, OS X comes with various open source packages pre-installed.  While this can be a nice convenience, the packages often are only updated to new versions as part of a major OS X release (like 10.5 to 10.6).  Also, some packages are used elsewhere by other parts of OS X and there is no easy way to know which.  In general, Apple assumes (and you should, too) that everything under /System/Library and /usr/, except for /usr/local/, is part of OS X and is administered by Apple.  You should not attempt to remove or modify files in those hierarchies.  That includes just about all of the open source packages, including Ruby.
Instead, to upgrade an existing package, the right approach is to install a new version in a separate location (say, /usr/local/) and invoke the new version by an absolute path reference (/usr/local/bin/ruby) or manipulating the shell PATH environment variable, if necessary.  /usr/local/ is often used if installing directly from source.  Many people prefer to use one of the 3rd-party open source package distributors, such as MacPorts, Fink, or Homebrew, each of which has its own package manager and installation locations.
Answer: No the OS does not use, it is just that Apple wants to make her products a bit more appealing to developers. (there is also Python preinstalled along with some other packets).
You can safely update your Ruby, Rails, Gems but the default Ruby version is a bit outdated. Check RVM so that you can install different Rubies in your system
Comment: How do you know that Apple doesn't use Ruby, Python, Perl or TCL? According to my checks there is system use of all four languages: Try `locate *.py | grep ^/usr | grep -v /System` with their standard extensions.
Answer: Consider Rubystack if you want to play with more up-to-date environments without interfering with the existing versions. Disclaimer, I am one of the developers of RubyStack. It is freely available under the open source Apache 2.0 License.
Comment: You should disclose your affiliation with the company each time you mention your product. Otherwise, it is considered as spam here.
Comment: I did not downvote. The spam flag works like that. It will go away after a while now that you updated your answer. Note however that you really should specify your affiliation in each of your answers, it is not enough to have it on your profile, so you should check that all your answers recommending your products include a disclaimer
Comment: I have done so in most other questions and is clearly specified in my profile as well. BitNami is not a company, and we do not make any money with the stacks (though it is sponsored by one and we provide support and services to some other open source companies such as Sugar, Alfresco, etc.). In any case, I have now updated my response. Also, I believe there was no need to downvote the answer as it is directly related to the topic.

Why does Mac OS X come with ruby/rails?


Is headvoice (or "lighter" chest) considered light singing needed for singing riff n runs?

Question: I am learning to sing riff and runs and I don't know but my research in google and youtube says that riff and run singing has to be light singing, looking riff and runs as up and down instead of forward and back, so I'm confused if it has to be light singing, then do people use something like a falsetto for the riff and runs? Can I use headvoice for the light singing? I don't know but some people say headvoice is "lighter" chest. Since I feel like I like to sing in headvoice more than falsetto, so I thought like maybe I can switch from chest to headvoice as I started singing the vocal runs and riffs? Am I correct?
Answer: Nope, not correct! Riffs and runs are purely about accurate pitches very fast. Any sense of "lightness", falsetto vs chest, front vs back, etc, are fundamentally not about that agility.
Different singers may have different skill levels at singing riffs and runs at different parts of their voice (for me, my pitch accuracy is highest in head voice so that helps my runs). So there may be some degree of ease or comfort that comes from lightness or whatever.
But a singer who is really good at riffs and runs will be able to do them in all parts of their voice!
Comment: If it's not front vs back, then how do singers separate the riff and runs notes, is it staccato?
Comment: Unfortunately in singing, words aren't super precise, because it's largely about feeling in the body, and that can't always be communicated well. "front vs back" in my vocabulary is referring to the sensation of resonance being more prominent in the front or the back, which is related to tongue root position (low tongue is back, high tongue (i.e. nasal) is font).

It might be you're referring to something else by front v back. Either, nope not stoccato! Stoccato can be used, but it typically has a sound that's not as good. The separation is just accurate pitch control at high speed.


Does Sharepoint 2010 Enterprise work on SQL Standard version?

Question: We are planning to get a backup server at Amazon EC2. As per my finding, Amazon supports only SQL Standard version. Can someone please help me with the above question. And, will any services be affected in SharePoint on SQL Standard version?
Answer: Minimal is SQL Server 2008 Express with SP1.
The main difference with Standard is you can have a larger than 4gb database.
So the answer is yes.
Comparisons here
Comment: No, it is a less restricted version of the minimum.
Comment: Yes it works just fine, Enterprise would be for large deployments that use a database cluster over of larger than 2 servers, and some quality of life things like "Hot add Memory and CPU". Read here: http://msdn.microsoft.com/en-us/library/cc645993.aspx
Comment: As Hugh mentioned, the Enterprise edition allows you to scale up the SQL Server, allowing you to add more memory and CPU core to the SQL Server and do more enterprise level stuff. Unless you are deploying a large scale SP farm then you do not need the Enterprise edition. Enterprise edition is a lot more expensive; and it gets really expensive as you add more processor core. In your case, I would go with the Standard edition of SQL Server 2008 (or 2008 R2 or 2012). Avoid the Express edition if you can because sooner or later you will hit the express edition limitations.
Comment: Are any SharePoint services affected when I use SQL Standard?
Comment: Thanks... So basically, the Standard version is trimmed down version of Enterprise... Rest all should work perfectly...


"big cheers" and "a big cheer"

Question: Can I say "Please give your children big cheers at the playing field?  Or should I say "Please give your children a big cheer?"  Do these mean different things?
Comment: I've *only* heard 'a big cheer'. *Never* heard anyone say give them 'big cheers'.
Answer: "A big cheer" is correct in British English, meaning one applause (of course there is usually not only one clapping of hands in an audience - except at a concert, when somebody thinks the piece is over, when there is only a pause - , "applause" being a singular for a general approbation), or one (general) shout of encouragement.
Answer: There are a number of expressions in use: 'Please give a big cheer for ...';'cheer loudly for...'; 'let your cheers ring out for...'. The other one you mention 'Please give big cheers for...' is not normally used, though it is perfectly correct grammatically, and everyone would know what you meant. These things simply boil down to a question of usage. Some things are used others are not, and the only way to find out is through long experience. I know people who have lived in Britain for decades but still say things in a way which everyone understands but which reveals that English is not their first language. That particular expression would fit into that category.

"big cheers" and "a big cheer"