Kinetic Energy Evaluation Integral Evaluation Program Ostlund

Question: I'm reading Ostlund's Modern Quantum Chemistry. In Appendix B, the kinetic energy integral is evaluated using the Gaussian Basis functions as
T11=T11+T(A1(I),A1(J),0.0D0)*D1(I)*D1(J)
T12=T12+T(A1(1),A2(J),R2).D1(I).D2(J)
T22=T22+T(A2(1),A2(J).0.0D0).D2(1).D2(J)

I understand T11 to be the kinetic energy integral using the first atom orbitals so it will give the kinetic energy of the electron of the first atom, and this is why it is passing zero as the bond length parameter. The same is T22 but for the second atom.
What is T12 used for, aren't T11 and T22 enough to calculate the total kinetic energy?
Answer: The off-diagonal elements $T_{\mu\nu}, (\mu \ne \nu)$ are just as necessary as the diagonal elements $T_{\mu\mu}$ to represent the kinetic energy operator in the chosen AO basis set. Substituting a few of Szabo/Ostlund's equations into each other (in my edition, 3.147-3.154), one finds
$$
F_{\mu\nu} = T_{\mu\nu} + V_{\mu\nu}^{\text{nucl}} + \sum_{\lambda\kappa} P_{\lambda\kappa}\left[ \left( \mu\nu \vert \kappa\lambda  \right) - \frac{1}{2} \left( \mu\lambda \vert \kappa \nu\right) \right]
$$
where $F$ is the Fock matrix, $V^{\text{nucl}}$ represents the nuclear attraction term, $P$ is a density matrix and $\left( \mu\nu \vert \kappa\lambda  \right)$ are two-electron repulsion integrals over the AO basis functions (denoted greek indices). Of course, your Fock matrix may be diagonal already, if you have a very special case and basis set, but in general and to perform the SCF calculation, the off-diagonal parts cannot be ignored.
Answer: TAR86 gives the correct mathematical answer, but given how you express yourself I thought I would try and explain it at a slightly lower level.
Your problem is in the sentence "I understand T11 to be the kinetic energy integral using the first atom orbitals so it will give the kinetic energy of the electron of the first atom"
The problem is that in a molecule the electron will be partially associated with the first atom, and partially with the second - this is almost the definition of a covalent bond! Thus yes there will be a contribution to the kinetic energy due to the first electron being on the first atom, but there will also be a contribution due to the first electron being on the second atom, and it seems to me that this is what you are missing.
Let's try and make that a bit more concrete with a little maths. As we are using an orbital approximation the first electron's behaviour is described by it's wavefunction. We don't know exactly what it looks like, but we hope it will be similar to the atomic wavefunctions on the two atoms. So let's write the wavefunction for the first electron as
$$
    \psi (1)= c_1 \phi_1 + c_2 \phi_2
$$
where $\phi_1$ is the first atomic orbital (actually contracted Gaussian basis functions) and $c_1$ is the weight of this function as determined by solving the approximation to the Schrodinger equation that we are interested in. Then if $\hat T$ is the kinetic energy operator we can obtain the Kinetic Energy of the first electron from
$$
T=<\psi(1)|\hat T|\psi(1)>=c_1^2<\phi_1|\hat T|\phi_1>+2c_1c_2<\phi_1|\hat T|\phi_2>+c_2^2<\phi_2|\hat T|\phi_2>
$$
(using Hermiticity of $\hat T$ and the fact here the wavefunction is real)
In this we can see a cross term which involves electron 1 on both atom 1 and 2, and in fact even a term which is due to electron 1 being on atom 2. So using your notation we can identify
$$
T11=<\phi_1|\hat T|\phi_1> \\
T22=<\phi_2|\hat T|\phi_2> \\
T12=<\phi_1|\hat T|\phi_2>
$$
Note more generally we should talk about basis functions rather than atoms, but here as the basis functions are associated with the atomic sites (this need not be the case) and there is only 1 basis function per site (in real calculations there will be many) we can be slightly sloppy. But also understand that the general case is not really much more complicated than the above, we simply expand the orbital for the first electron using all the basis functions, and carry on similarly.


Vim plugin to open a shell in a split window

Question: Are there any vim plugins for creating a split window with a shell inside? Almost like a split window with the :sh command contained inside. I also can't use something like screen becuase this is in MacVim (gvim for Mac OS X).
Answer: I have not used it (I found it in an SO answer), but Conque is a Vim plugin that seems like it might do what you want: in a (possibly split) Vim window, interact with a spawned program over a pty with a decent amount of terminal emulation*. It requires Vim 7 with Python support and it indicates that MacVim automatically comes with it.
* Vim does not do any terminal emulation itself, which is a problem when trying to use termcap- or terminfo-based software in a :shell under GUI-based instances of Vim (see :help gui-pty).

Comment: I agree with Chris Johnsen. For simple tasks, Conque plugin (https://github.com/vim-scripts/Conque-Shell) is very nice. I use also Conque-GDB plugin (https://github.com/vim-scripts/Conque-GDB) to use gdb debugger (for C/C++) as simple IDE INSIDE Vim. Fantastic. With Conque you can open many shell / script inside every vim Window/Tab. Nevertheless if you need SPEED, let consider reverse the point of view: let use tmux (https://tmux.github.io/)...
Comment: apart slowness Conque terminal emulator seem to not work very weel with dynamic stdout printout, by example you can't do a really working "watch -n2 "ls -l" inside a Conque termnal inside a vim window... That's why the definitive solution could be using tmux... even if I repeat I love Conque plugins!
Answer: The answers given to this question may be of use to you:
https://stackoverflow.com/questions/671583/how-does-one-make-a-vim-window-a-full-on-terminal
Answer: VimShell is a shell-teminal implementation for vim. It is one of the kind with its own flavour, but definitely fits for simple tasks, and may be you will like it to use it on a regular basis.


Magento 2.4.5 For Out of stock products Breadcrumbs full path is not showing

Question: For Out of stock products Breadcrumbs full path is not showing when I visit from the category page. Help me out on this.
Answer: Ful path is only visible when you visit product from category page. If you visit product directly there is no full breadcrumbs path.
Comment: #anže-voh I visited the out of stock product from the category page to product page so the breadcrumb full path is not shown but for in-stock it is showing. @anže-voh


Windows XP shortcut key to focus a particular window

Question: Say I've got several apps open and I want to keyboard shortcut to focus, or bring to the front, a particular window. Of course I know about alt+tab to cycle through windows, but it would be great to choose a specific window with a keyboard short cut.
Comment: You should delete your post on SO.
Comment: maximize means "expand the window to fill the screen".  i think what you want is to **raise** a particular window, ie, "bring to front/focus".
Comment: sorry that's true, I'll edit question to make more sense
Answer: Autohotkey!
WinActivate, [Full Window Title]

If the window title changes, you can either use the bundled Window Spy to grab the ID, or
SetTitleMatchMode, 2

to be able to match a window with only a partial title. (There's also a regex mode, if you're comfortable with it).
The maximising would be WinMaximise rather than activate. This does not focus it, though, so you'd need to use both to maximise and focus a window.
EDIT:
Ok, real world example time.
#\::
   SetTitleMatchMode, 2
   WinActivate, is currently
return

That fire on winkey and \ (# being winkey), then focuses any window with "is currently" in the title. In this case, "User is currently status", for my IM windows.
Comment: ok cool, I'll have to install software to do this then I guess. Is Autohotkey pretty simple to configure?
Comment: Yep. It loads any script with a .ahk extension - they're just text files, editable in any text editor. I'll update my post with a better example.
Answer:
Make a shortcut to the application on the desktop
In that shortcut's properties, put your desired shortcut-key into the "Shortcut Key" field

Now with any other application focused, pressing that shortcut-key will start the shortcut.
If the application is already running, it will be given focus.
Comment: Not true for all apps.  Beyond what Phoshi mentions, some apps will start a second (or Nth) instance if their shortcut is activated again.  It may be a viable solution for some particular app, however; test to be sure.
Comment: It will SOMETIMES be given focus, this changes per-app, and even then will have half a second or so of lag for disk read.
Comment: i like this, but it's not working for me for some reason though.
Comment: Yeah it lags for me a lot too. I've tested it on Vista only. I don't think there's another solution that doesn't involve some 3rd party app though.
Comment: well there's always the "write your own" option, but this is SuperUsers, not StackOverflow... :)
Answer: This free utility does just that: MLHotKey:

MLHotKey is assigns hotkeys to
  any top level application. This means
  that once you assign a hotkey to a
  window, you can switch back to that
  window using the hokey, which is
  (usually) faster than the alt-tab
  chain.
Instructions:

Start MLHotKey
Select the window from the list to which you would like to assign a
  hotkey.
Put the cursor in the text box above the command buttons.
Type the key combination that you would like to set. (e.g.
  Ctrl+Alt+I)
Press Set and you're done!

The hotkeys will "stick" even after
  you close MLHotKey. You can also
  remove a window's hotkey by selecting
  the window and clicking "Remove". The
  refresh button refreshes the list of
  windows.
There are some windows that will not
  accept hotkeys (Outlook 98 is one),
  and not all key combinations will
  work.
Answer: I agree with Phoshi about AutohotKey. I'm not sure if you want to focus the same particular window each time, or be able to choose. If the latter, then I'd recommend iswitchw. Also made with AHK, you can assign a key (caps lock by default) to show a window picker, and type the first letter or two and hit enter to select it.


Advisory locking interface for c in windows

Question: I work on linux. Iam writing a locking interface.
In linux the default locking is advisory locking where as in windows  it is mandatory locking with LOCKFILE interface. I want a advisory locking interface in windows.
Answer: Why not look at how cygwin does it, or simply use cygwin? Another possibility would be using the creation and removal of lock files as locks.


Social Settings on the bottom of contribute pages

Question: On  the bottom of the create page there is a button to turn on social media. Where do I add the links to configure twitter, google, facebook and linkdin?
Answer: I believe key here is that what CiviCRM inserts are social media 'shares' - not social media 'links' or 'follow us'.
for social media links we add https://www.drupal.org/project/social_media_links
(I'm sure in wordpress land there are plugins that work exactly like this drupal module).
Social media links behave as you asked in your question: you must configure which icons you want and add their targets (links to them). These targets typically are your twitter feed; your linkedin page; your etc.
Comment: Where do I configure these? For me they (LinkedIN, Facebook) have been working but now There's only the twitter birdie...
Answer: Turning 'on' the social network links provides buttons so that the user can use their FB etc accounts to share the Event/Contribution Page.
I.e if you click on the Tweet it will open up twitter.com, and requires you to login in to your twitter account if the user is not already logged in.
Having said that, I thought I would confirm on demo site but even with the "allow sharing" turned on, no links show on the Event page but it would make sense for it to be suppressed on the demo sites I guess.


Can thermals or high density altitude improve fuel efficiency?

Question: Suppose a pilot is just cruising around building flight time. In order to get the most flight time for fuel, would flying on a dry cold day or on a hot thermal filled day save fuel?
Comment: I'd think there's no clear answer here. Imagine a motor glider which would be able to not use it's engine at all, the answer is obviously "thermals"; if you're flying a 747 there's no way you can center in a thermal and you'd prefer a cold day. All other aircraft fall somewhere in between these extremes.
Comment: @Sanchises I did say getting now building flight time. So what ever the minimum or ideal plane to build flight time, not a airliner.
Comment: I imagine at that point you could just get a glider, duct tape an engine to it, and go for thermals. There are gliders that meet that description iirc.
Comment: Unless you shut the engine off you are still burning fuel.  Sure, maybe you could reduce the throttle in a thermal and get a little "free" altitude, but in a typical gas powered time building Cessna or Piper the benefits are probably minimal.
Answer: For flight time and saving fuel, the density is not relevant. Density is relevant to distance covered if you need a set cross country distance rather than a set time. You would only want to set power to maximum endurance which will be very near best glide CAS, while best true airspeed and ground speeds would change with density the best endurance CAS would not.
It may also be advisable to plan relatively shallow descent angles so that the engine stays within a reasonably efficient power range. Climb with power low enough that you can keep it leaned.(after the initial takeoff and climb out, unless maybe you are at an excessively long desert runway)
Thermals could aid the flight time allowing even lower throttle settings but could also harm as they go both up and down, capturing the right current depends on the pilot's glider experience.
Now where I rent, fuel is included in the per hour price and the goal is usually to get a set distance or set of maneuvers in a minimum time. Just the opposite of what you propose.
Answer: If the goal is simply to build time, a pilot could certainly save fuel by using thermals in a light airplane.  To get an appreciable benefit, he or she will have to actually circle in the thermals, glider-style.   He or she would benefit greatly by having a variometer along-- a variometer is sensitive rate-of-climb indicator designed to have minimal lag.  Small portable electronic versions exist, generally designed for hang gliding and paragliding usage.  One strategy would be to initially do a powered climb to near the top of the thermal convection, then reduce power to a setting that gives a slow descent and start looking for thermals to circle in to re-gain altitude without changing the power setting.  However the truth is that many pilots will find circling in thermal updrafts in a light airplane to be rather fatiguing-- it involves lots of time going around in circles in bumpy air.  It's a good way to expedite a climb to altitude, but it can be a tiring way to spend an entire flight.
Other options for saving fuel would include use of ridge lift or wave lift.  If the aircraft is based near a long ridge, opportunities to soar the ridge at reduced power settings may be relatively common during certain times of the year when the wind direction and velocity is favorable.  Using mountain wave is a more exotic proposition that may often require a long transit to the wave or a high climb to contact the wave, but I'm aware of a case where a Cessna 152 was flown in wave for over an hour with the motor at idle power (or lower) at around 6000' above ground level at a location about 15 miles from the home airport.
All things considered, the most practical way to save fuel on a regular basis is simply to operate at reduced power settings.  But it certainly is technically feasible to take advantage of various forms of updrafts as well.  This will take a concerted effort on the pilot's part-- it's not something that will happen automatically when the pilot is "just cruising around" on any given day, regardless of the prevailing meteorological conditions.
If the question is meant to be essentially "is it more efficient to fly in stable air or in convective conditions", the answer is "it depends".  If a pilot is trying to maintain a constant altitude, then the fuel consumption will generally be lower in smooth air.  If the goal is to minimize fuel consumption, the worst thing a pilot can do is to push the nose down to maintain altitude whenever the aircraft encounters an updraft.  It is better to hold the airspeed constant and let the aircraft climb, and better yet to reduce the airspeed and let the aircraft climb still more.  Then if desired, the airspeed can be increased to gradually shed altitude once the aircraft is out of the updraft.  This strategy will reduce fuel burn during cross-country cruising flight at an average airspeed that is higher than the maximum endurance airspeed.  However, if the goal is really simply to minimize the fuel consumption while accumulating hours in the air, it would be better still to simply fly at the maximum endurance airspeed in smooth air, and better still to fly at the maximum endurance airspeed on a thermally day while actually making efforts to stay in the thermals as long as possible by circling.


How are Sea-Prism Stone items made

Question: Zoro couldn't cut them and they are stated to be as hard as diamond. So how are Sea-Prism Stone items made?
Comment: Note that you can sometimes abrasion cut a very hard material with its own dust. This also says nothing about whether the material may be brittle or chemically active.  Very hard materials are easy to fracture and diamonds can easily heated into CO2.
Comment: I think it will definitily be explained in the later Arcs, maybe when Dr. Vegapunk will appear in the manga.
Comment: @pap I think I read somewhere that Oda said *a New World scientist* would appear and tell us more about Devil Fruits soon. Maybe at the end of the current arc? He might also tells us more about seaprism as well.
Comment: If they were just hard as diamond, Zoro could have cut them (Alabasta arc). Note that not even the bird cage or Franky's beam did any harm to the Sea-Pism coated factory. Since they are SEA-Prisom stone, they may be formable in sea water.
Comment: How do you make diamond rings? Is the question.
Answer: In the Alabasta Arc, Smoker revealed that Seastone has "Sea Power" and therefore nullifies abilities just like salt water. In other words, vegapunk discovered its usage, this was revealed by Smoker and confirmed by Coby after Water-Seven Arc.
Vegapunk was able to coat ship bottoms with seastone, enabling them to pass through the calm belt without alerting the Sea monsters to their presence. He discovered a way which is yet unrevealed but confirmed by Coby back then to make tools, handcuffs, and weapons, out of seastone.

How are Sea-Prism Stone items made


What can go into the FAQ to help people not get confused about there being questions and answers from other sects?

Question: I propose that we put in the FAQ something saying that there will be questions and answers here from other sects, so to not be confused. What I would like to do, is to get some suggestions for the exact text to add into the faq that fulfills the purpose I described above, and after getting some suggestions we get some consensus on which one is the best by voting on them.
Comment: An excellent idea!
Answer: Islam.StackExchange welcomes all sects and groups that identify themselves as Muslim. Do expect to see answers from multiple points of view, unless a certain point of view is specifically requested in the question. Don't get into "your sect/group is wrong" debates and respect other people's beliefs.
Comment: as there seems to be no dispute on this, i have added it to [the FAQ](http://islam.stackexchange.com/faq) (with minor tweaks for clarity)


citing from a review

Question: I'm writing my first proposal for M.Sc. , meanwhile, I keep reviewing many papers and tracking sources of citation, I noticed that some authors cite from review introduction while others cite from review conclusion. Does it mean that I can cite from any part in review paper as long as the cited information is by the sound of the review author (when he/she doesn't talk about a certain research nor cite from any) wherever it can be found in the review sections ??
thanks
Comment: Cite and reference...
Comment: so its ok then .. thanks
Answer:
some authors cite from review introduction while others cite from review conclusion. Does it mean that I can cite from any part in review paper...?

Yes: You can cite any aspect of a paper. Albeit, you should avoid citing a secondary source (i.e., when a paper cites another, cite the original source,* rather than that paper). It is sometimes useful to cite a particular aspect of a paper, e.g., [Section 3, 1] or [Theorem 7, 2], so that readers can find specific aspects of papers to which you are referring.
*Do not cite the original source without sufficient consultation.
Comment: In my experience, it's like that in legal scholarship / legal rulings (at least in some countries).
Comment: In some fields it is also ethically-required that if you cited a primary source you found in a secondary source, your citation look like "XYZ-primary-source, cited in ABC-secondary-source". This both acknowledges the work of the review author, and makes it easier for future readers to have access to what you were looking at. In other fields - please consider it even if it's not a requirement.
Comment: @einpoklum Do you really mean _if you cited a primary source you found in a secondary source_? It would surely imply that almost every citation is secondary. A slightly weaker statement that adds the requirement _without looking at the secondary source_ holds across many fields.
Comment: I meant that if you read XYZ's book or paper, which cites ABC, then you shouldn't just cite ABC with no mention of XYZ.
Comment: @einpoklum Can you give some exemplar fields? It seems like a bizarre methodology (to me), since many papers are discovered via another and recording this trail seems rather burdensome (and in some cases it may become problematic, e.g., with multiple authors, over the duration of a research career, ...)

citing from a review


High Water pressure

Question: Say I had a laser drill that could cut a 2 km circle. I start it up in the deepest part of the ocean. I would then be cutting a 2 km circle straight for the earth core but just before I hit the liquid core. I shut off said drill. What would happen to the liquid ocean water at that pressure as it fall back in.
Comment: I'm voting to close this question as off-topic because it's not about chemistry.
Comment: What is the pressure at the deepest part of the ocean? What is the temperature of the "liquid core"? Now you have a temp and pressure, look up the water phase diagram and see where you are. You are either gas, liquid, solid, supercritical fluid or somewhere on the boundaries of each of these regions.
Comment: This is not really on topic here. It might be acceptable on Earth Science SE but you will have to make it more specific and science based.
Comment: If your interested only in pressure then read http://chemistry.stackexchange.com/questions/20009/hypothetical-what-happens-to-water-as-pressure-increases-to-infinity?rq=1
Comment: Sorry if put question in the wrong place
Answer: Do you mean "you can remove a cylinder of material going all the way through the Earth, letting water go down?
If so, well, the Earth should survive. There will be a mighty earthquake. Several things to consider. Earth is liquid inside. So water will not be able to get all the way in. Magma will get there first. Next you will have water overheating at the water/magma surface. Magma will be cooling down. Water is an efficient coolant, so magma will solidify and the heat exchange will slow down.
The exact yield of the explosion depends a lot on how you are going to remove this cylinder. We should wait for a sound explanation how you can do it before we start calculation.
Laser will not work. You probably think of laser as something that evaporates stuff. You don't have any way for steam to escape from the bottom of the ocean, so first, you r laser will have to evaporate all water from oceans. But then, what will be flowing in that hole?
What effects are you looking for? High static pressure? Check experiments in a diamond anvil. Loud boom?  Using a laser that can drill a hole in Earth for just that purpose is a waste. Meteorites is your best way to go. You can even use your laser to direct them at/away from Earth. Evaporating material should create enough propulsion.
Comment: The mantle is **not** liquid. This is one of the most common misconceptions about the Earth's structure. The mantle is entirely solid (apart from very local melting near the crust-mantle boundary). Also, I fail to see why this will cause an earthquake. Earthquakes are caused by brittle fracture along faults.
Comment: This is actually quite good description of what would happen if such fragment of Earth suddenly disappeared. Of course it can't be done via laser or even meteor, but is nice thought experiment. @bon It isn't liquid but the hole would fill quickly due to incredible pressure down there.
Comment: It's just I seen this in Independence Day 2 and thinking about the science and thought it might be cool to talk about it a bit

High Water pressure


CSOM content type

Question: I have an issue with CSOM and content type, I used CSOM to read some value in a sharepoint list, it works well until I try to used content type
If I create a new content type with my fields, it's worked but if I add my field in an existing content type. It doesn't work and that's return me the following error:
Error: Object reference not set to an instance of an object

the error it's comming from the first line which try to read my field so in my code here the line:
if (item[l_strUniqueKeyName].ToString() == l_strUniqueKeyValue)

I've done a lot of researches but I found nothing related to this issue
Any idea of what I'm doing wrong?
Thank you for your help
Answer: Please check if the ContentType field value is null, if it is null, then call.ToString() method, it will throw "Object reference not set to an instance of object" exception.

CSOM content type


When is it necessary to use ORM tools?

Question: I was raised in a part of web developmentland where the creation of websites is mostly synonymous with Wordpress, FTP, Joomla, and procedural code, instead of things like TDD, A/B testing, Doctrine, and design patterns. Having not traveled this area much, I'd like to know when object relational mapping and ORM tools are necessary to create and manage a site. Can you provide some generic (but real world examples) of when it should be used?
Comment: There are very few "necessary's" and "should's" in software development.
Comment: In addition to the other answers a major reason for ORM is spelling. When you get more programmers and more columns/tables we found basic typing mistakes in SQL statements where causing bugs. A nice ORM tool pulls the names from the syscatalog tables and enables the compiler to enforce the names and types.
Answer: Necessary? Never.
ORMs are an layer of abstraction over the database. They are intended as translators between object graphs and database tables/relationships. In this capacity they simplify simple data access and with a large object model/database can save a lot of time otherwise spent writing boilerplate code for data access (getting a record by ID, deleting it by ID, updating and inserting a record).
Useful? Almost always, for the points made above.
There are no rules, as such, but ORMs are best used for basic DB operations (Insert, Update, Delete, Select). When you need something more complex, it is best to use the standard API for your platform.
Comment: I'd like a concrete example of when it is very useful. Thanks
Comment: @Just Chris - They are very useful when you have a system of 100s of tables.  The ORM is really a time saving tool.  For a system I worked on, I built a mini ORM to generate C# code classes for me so I would spent weeks writing mundane SQL and mapping code.   There only some much joy in writing the same procedure or SQL over and over when all that is changing is column names.
Comment: Thanks for the clarification. All the developers in my company write a lot of boilerplate code and don't know what ORM is. Our philosophy is just "no time for research, just get 'er done" ;)
Comment: @JustChris - Yeah, just spend 3 weeks writing code that, even if you spend a _day_ learning and using an ORM would be done for you.
Comment: @Oded I don't agree with the philosophy, I wish we can turn that around. We just gotta sharpen our convincing skills for our boss that a little bit of research goes a long way. You know how some development tools are black-boxed? Well my boss likes to black-box the _entire_ dev team. He doesn't care how our development process should work.
Comment: @JustChris - I realize you don't agree with the philosophy. One way forward would be to _use_ an ORM and show the boss that you have finished the work much earlier than expected. Of course, depending on the boss that may be a bad move...
Comment: I would just like to add that not everyone thinks ORMs are great. Obviously there are tradeoffs to both sides. So pick whatever makes sense in your case. http://www.reddit.com/r/programming/comments/rp9ha/bad_orm_is_infinitely_worse_than_bad_sql/
Answer: ORM tools should be used for CRUD, that 80% of code that is so tedious to write over and over, that you want to bang your head against the wall.
Feel free to use more "old school" methods like Stored Procedures for the remaining 20% (e.g. operations that require performance optimization).
For a simple example of how ORMs can be effectively used to create an organized and effective Repository class for retrieving and updating database data CRUD style, see here:
http://nerddinnerbook.s3.amazonaws.com/Part3.htm
Comment: Heh, at most places I've been at there are no stored procedures due to lack of specialization in the IT dept. So you probably mean any trivial queries that occur frequently.
Comment: @Just: It doesn't have to be stored procedures, it can just be hand-rolled SQL.  The SQL that ORM's produce isn't always the most efficient way.
Answer: ORM's serve two worthwhile goals;
Abstracting some of the database specific dialect details; and otherwise insulating developers from the weirdness that SQL can sometimes be.
Most ORM's are an 80-20 sort of tool, where they can significantly simplify about 80% of the work of persistence, compared to using SQL directly.  For simple applications, 80% is really 100%, since the platform can often direct the design decisions.
Larger, more complex applications will always have problems that could not have been anticipated by any tool.  The difference between good and bad ORM's shows in sharp relief when this happens.
A good ORM will get out of the way of developers when they need to issue custom SQL to get at their data, or even provide simple extension or introspection mechanisms to grow into the needed use.  Poor ones just get in the way of this sort of thing; requiring developers to do these custom jobs at a lower layer.
Attaching business intelligence or other convenient behaviors to the persistent entities.
Getting the most out of the class mapping features of ORM's often requires a deep understanding on the part of the ORM's developers what role application objects play.  The model objects fulfill a very different role from the persistent state they wrap.
Specifically, the rows and columns in a database represent the set of facts believed true, but the methods and inheritance graphs of the models are the rules and formulae that the application operates on.
When an ORM conflates the two ideas, they'll obstruct developers in a number of idiomatic ways.  There will be no way to operate on relations that aren't part of a table (obvious counterexamples are the rows returned by a select containing joins or group by clauses).  Another breakdown is that they assume that every table must have a primary key; or that the primary key must be an integer or a single column.  A more subtle way ORM's can mess this up is by providing object features, like many-to-many properties, that somehow require a database connection to work properly (the entity relationship is not related to persistence).
Answer: If your application is using a relational database, your code will contain a lot of SQL (or LINQ if you are using .NET).
The ideas is to simplify interacton between application code and the database by creating Data Access Layer and business objects quickly and without coding, yet allows the developer to extend the logic by adding special business rules (if any).
Object Relational Mapping tools are many. Not all tools are the same. Some are simple whereas some are complex enough to be an entire framework.
They rely on database already built (tables) and read the table definitions from your database then:
0-Creates classes that represent objects (usually 1 to 1), such classes contain methods to read, write, update and delete data from the database. Some support LINQ (.Net) and some have their own object query language.
1-Handle primary key generation and table to table relationships automatically
2-Can read and return data related to a table automatically with one method call
3-Allow you to switch the database without coding
4-Take care of data buffering to enhance performance
5-Generate necessary SQL to get and put data to database automatically
6-Some generate web services automatically (e.g. Oxygen)
7-Some can generate auditing code for you automatically
8-Some can create stored procedures
9-Some provide authorization support
10-Some support multiple tier architecture automatically
11-Some support .NET Entity Framework
So if you need any of the above services in your project, ORM may be for you.
It may be something for you to decide whether you want to use ORM or Entity Framework if you are a .NET user.

When is it necessary to use ORM tools?


How long does it take to consume the same amount of food

Question: For a group of 32 students food lasts for 45 days. For how many days will the same food last for 72 students?
Comment: Are you considering a proportional case?
Comment: yes, I think so
Answer: Think of a student as needing (precisely) one kg of noodles a day. Since the noodles will last $45$ students for $32$ days, we must have $(32)(45)$ kg of noodles. This will last $72$ students a total of $\frac{(32)(45)}{72}$ days. Calculate.
There are many other approaches, some more algebraic than others. Whatever approach you take, note that it is obvious that (under the assumption that food need for each student is fixed) the food will last $72$ students fewer than $32$ days. So after you do a calculation, do an informal reality check: if your "answer" is greater than $32$, it must be wrong.
Comment: It is not obvious that the food will last 72 students fewer than 32 days.  Assume the first group of students were big college student-athletes and the second group of students were meek little kindergartners.  Without making assumptions this question can not be answered.
Comment: @emory: Thanks. the assumption had already mentioned in the first paragraph ($1$ kg of noodles). But it is a good idea to keep stressing underlying assumptions, so now it is also mentioned in the second paragraph.
Answer: <code>32 students ~ 1/45 days
72 students  ~ 1/x days
x=32*45/72 = 20
</code>
Inverse proportionality
Comment: @Joe:you're welcome ;)  A cartoon explanation can be found here :http://www.emathematics.net/porcentajes1.php?tp=3
Comment: you rock, thanks
Comment: The answer is correct, but the reasoning seems peculiar: Why is it $x$ students, when the question is asking for the number of days?
Comment: @dbaupp fixed it.thanks ;)
Answer: total students are $32$ and food last for $45$ days. Total quantity of food is $32\cdot 45$
Same food to be distributed to $72$ studentss (assuming rate is equal)
Therefore total food will last for 72 students for $\frac{32\cdot 45}{72}= 20$ days.


Proof that centering will yield multiple linear regression model with same slopes but different intercept

Question: When we perform multiple linear regression with centered predictors (that is, $x_{ij}^c = x_{ij} - \bar{x}_j$) we get the same coefficients as with the original predictors but a different intercept. I've seen many conceptual explanations for this result but I can't find a rigorous derivation. The derivation is easy for simple linear regression but I haven't been able to work it out for multiple regression. I've tried the derivation in matrix notation and it goes off the rails pretty quickly. Can somebody show me the derivation?
Answer: If
$$y = \alpha + \beta_1 x_{i1} + \beta_2 x_{i2} + \epsilon$$
Then
\begin{align*}
y_i &= \alpha + \beta_1 \bar x_1 - \beta_1\bar x_1 + \beta x_{i1} + \beta_2 x_{i2} + \epsilon_i \\
  &= \underbrace{\tilde\alpha}_{\alpha + \beta_1 \bar x_1}
    + \beta_1\underbrace{\tilde x_{i1}}_{x_{i1} - \bar x_1}
    + \beta_2 x_{i2} + \epsilon_i
\end{align*}
Clearly, we can do the same for $x_{i2}$ or any arbitrary number of covariates.
Now for the MLE. Suppose that the MLE exists and is unique. That is, it solves
$$
    \hat{\vec{\gamma}} = \text{argmin}_{\vec{\gamma}} \lVert\vec{y}-(\vec{1},X)\vec{\gamma}\rVert^2,
\qquad \vec{\gamma} = (\alpha, \vec{\beta}^\top)^\top$$
where $X$ the design matrix excluding the intercept and $\vec{1}$ is a vector of ones. Using the results from the The Partitioned Regression Model in this note then we have that
\begin{align}
\hat{\vec{\beta}} &= (X^\top(I-P)X)^{-1}X^\top(I - P)\vec{y}
   \qquad P = \vec{1}^\top(\vec{1}^\top\vec{1})^{-1}\vec{1} \\
&=(X^\top C_nX)^{-1}X^\top C_n\vec{y}
\end{align}
where $I$ is the identity matrix, $C_n = I - \frac{1}{n}\vec{1}\vec{1}^\top = I - P$ is the centering matrix, and we let $n$ denote the number of observations. Now, the centered design matrix excluding the intercept is
$$\tilde{X}=X - \vec{1}\bar{\vec{x}}^\top = C_n X$$
Thus, we clearly get the same $\vec{\beta}$. See also the Partitioned regression on the OLS wiki page. Surely, there is an easier way to argue that the two sets of slopes are equal.
Now that we know that the slopes are equal then the find that
\begin{align}
\hat{\tilde \alpha} &= \text{argmin}_{\alpha}
 \lVert\vec{y}-(\vec{1},X)(\alpha,\hat{\vec{\beta}}^\top)^\top\rVert^2 \\
&= \lVert\vec{y} -\vec{1}\bar{\vec{x}}^\top\hat{\vec{\beta}} -(\vec{1},\tilde X)(\alpha,\hat{\vec{\beta}}^\top)^\top\rVert^2
\end{align}
which differs from the uncentered intercept by a $\bar{\vec{x}}^\top\hat{\vec{\beta}}$ term.


Are "wonder" and "wander" etymologically related?

Question: Especially in lyric-writing, where used more figuratively than literally, e.g. (mental) wandering and wondering, the two seem often interchangeable. And I can see wondering being conceived as an analogue of wandering (only, in one's mind). However from peering at their etymologies (see: wonder and wander), it appears this isn't the case—or have I simply not dug deep enough?
Comment: Not quite far enough, but they're still unrelated. _Wander_ comes from PIE _*wendh-_ 'to turn, wind, weave'; but _wonder_ appears to be a word limited to Germanic languages. Proto-Germanic had a lot of words that didn't come from PIE; nobody knows where they came from, but they thrived in Germanic languages.
Comment: More work, is all. Plus comments force me to be succinct. I'm practicing up for Twitter.
Comment: I don't have an answer, just a related comment: Given how modern languages (or at least my native language, U.S. English) often include "typos," when I discover possibly related words like wonder and wander, I often wonder [ ;-D ] if people many generations ago also made typos.
Comment: @JohnLawler - Thank you. (If you'd copy your comment as an answer, I'd accept it immediately so as to mark this question as answered. I understand if you have your reasons for not doing so, however.)
Answer: The two words have separate origins, although they may have crossed paths along the way.
Wonder comes from Old English wundrian, the verb form of wundor "marvelous thing, marvel, the object of astonishment," from Proto-Germanic *wundran (origin unknown). In Middle English, the noun became associated with the emotion of wonder (late 1200s), and the verb had a transitive sense meaning "to inspire curiosity in."
Wander comes from Old English wandrian "move about aimlessly, wander," ultimately from Proto-Indo-European *wend- "to turn." It's related to the verbs wind and wend. This word also became associate with the mind, emotions, affections, etc., in Middle English (c.1400).
Thus, wonder comes from a uniquely Germanic noun, and wander comes from an Indo-European verb, but they both became associated with the mind in Middle English. It's quite common for similar-sounding words to influence each other through confusion and wordplay, so there may be some convergence – you certainly aren't the first person to notice a metaphorical similarity between the two.
Comment: I never thought of the idea of convergence due to similar sounds being confused in language as you describe but it makes a lot of sense. I imagined "wondering" could result and "wandering" at least metaphorically and both words have a similar indefiniteness if that makes sense.


What is the relationship between geometric center and geometric mean?

Question: It is well-known that the geometric center is found by finding the arithmetic mean of all points but how is geometric center related to geometric mean? Or is there no relation except their names?
Answer: If the geometric center of a finite collection of points in, say, ${\bf R}^2$ is their arithmetic mean, then it has no relation to the geometric mean. Indeed, it's not clear what the geometric mean means, since first you'd have to define how to multiply two points.
The geometric mean of a finite collection of positive numbers is less than or equal to the arithmetic mean.


How to refund money send to an address already used

Question: I sent money to a block chain wallet address which had once been used to receive money. Now money is not found in the account. What do I do to recover the money. Thanks
Answer:
money is not found in the account

If you sent your money to an exchange market wallet then you should ask their support about that issue.
Otherwise, please give us your transaction ID so we can look at it. You may have sent your coins without enough fees or to a wrong address.


Inject packages into Ubuntu live

Question: Is it possible to permanently inject/install packages into existing non-persistent Ubuntu live iso?
Comment: *Yes.* There are special tools to create a custom iso file, *but it is difficult.* It is much easier to install packages into a persistent live system or an installed system (installed like into an internal drive, but maybe to a USB drive or memory card).
Answer: Try LinuxRespin/Remastersys.
It can be used to create live bootable ISO from your current installation of Ubuntu/Debian.

Inject packages into Ubuntu live


Landsat images with more than 3 colored bands

Question: I'm looking for a website where I can find Landsat images (or similar to it) with more than just 3 color bands. http://glovis.usgs.gov/ only gives me 3 bands. Is there a way to obtain more band?
Comment: I suspect the problem might be in what your software is showing, not in the data. When I get Landsat from GloVis, it's had all the bands.
Comment: I once ordered data from the glovis and I had to install bulk dowwnload application and wait for a few hours for the data to be prepared. -Just a comment.
Answer: Glovis redirects you to Earth Explorer for the actual download, so I often opt to use Earth Explorer directly.  There is another very good download site you may be interested in called Reverb | Echo.  I have had issues in the past using Glovis with Google Chrome as the requisite pop-ups are blocked prior to download.  These are the correct steps to take in order to download the Level 1 data which is composed of all of the available reflectance bands:
1) Go to Glovis--enable all pop-ups.
2) Select the centroid of your area of interest

3) Choose your sensor and acquisition date

4) Add the image to the queue

5) Send to cart

6) The browser will add a new tab, redirect you to Earth Explorer, and prompt you to "Sign in using your USGS registered username and password"

7) A new screen will appear with the available products for download

8) Again a new screen will appear and you can choose the specific products for download.  Make sure to specify the Level 1 GeoTIFF Data Product

If at any point a screen fails to appear in this tutorial, try a different browser and, if necessary, temporarily reduce your security settings
Answer: Have a look at this web site, I have used this site to download the full 7 bands.


English idiom or expression for thoroughly researching something

Question: I'm trying to find an idiom to describe a field that has been "explored head-to-toe". For example, in Arabic we say "researched to death", but that's the literal translation and it doesn't carry over the original Arabic meaning. Is there an English equivalent?
Comment: If you want a neutral tone and it's in a science context: *well understood*.
Answer: The adverbial expression to death can be used with many verbs:

That topic has been researched/explored to death.

to death
Beyond endurance : EXCESSIVELY m-w

...a SASI official complained that the Kruipers were being
researched to death; why not find another set of subjects? Keyan Tomaselli; Where Global Contradictions are Sharpest (2005)

Ending Violence Association of B.C.; Researched to Death: B.C.
Aboriginal Women and Violence, Final Report (2005)

Being "researched to death" is both metaphor and reality for many
indigenous communities.... Arlene Stiffman; The Field Research
Survival Guide (2009)

All that's been explored to death, anyway. Kevin Law; Streets of
Youth (2010)

I was listening to your show on the Internet one night and I figured
there must be a variety of supernatural myths a writer can tackle that
haven't been explored to death, so I hit the library and started
researching. Alan Draven; Nocturnal Offerings (2013)

Instead of receiving medical help for these needs, communities are
literally being studied to death. U.S. Congress; The Superfund Reform_Act of 1994
Answer: The idiom that first comes to my mind is "six ways to Sunday".  In most situations it's equivalent to saying "... to death" but it I feel it's more suitable for the context in which something has been done in all possible ways, rather than simply done too many times.
There is some variation in the phrasing.  It's not uncommon to use a number other than six, and some people say "from Sunday" instead of "to Sunday", but "six ways to Sunday" is the form I've heard most often.
I couldn't find a commonly accepted, literal meaning of this idiom.  Personally, I believe one is literally saying that something has been done as many different ways as there are days in the week, not counting Sunday because that's the "day of rest" (given as the reason to stop doing the action)
Answer: That field has been researched to the N-th degree already!
Quoting collinsdictionary.com :

If something is done to the nth degree, it is done to an extreme degree.
Ned and I discussed everything to the nth degree.
You're a risk-taker to the nth degree.
Answer:
The field has been researched with no stone left unturned.
The field has been researched well and truly/in all kinds and ways/lock, stock and barrel.
The field has been dug backward and forward.
They did one hell of a research job in this field.
They went the whole hog researching this field.


What are the masses of the docking / berthing mechanisms used by the ISS?

Question: I have been unable to find any information on the masses of the docking / berthing mechanisms used by the ISS. What are the masses of the APAS-95, Active / Passive Common Berthing Mechanism, and Russian probe / drogue docking systems? The best I can find is the mass of the PMA's, the lightest one is 1183 kg, which consists of a passive CBM + permanently passive APAS + additional structure.
Comment: And it is going to get odd, since the NDS (Nasa Docking System) Dragon is bringing on SPX-7 or so is going to 'plug into' the current PMA so how do you count the mass then?  Whole system?  Each component?
Answer: Partial:
Apparently, APAS-95 had a mass of 286 kg
https://www.google.co.uk/books/edition/The_Twenty_first_Century_in_Space/BH7ZBQAAQBAJ?hl=en&gbpv=0


Building Credit

Question: I'm 19 years old and recently opened a secured credit card with my local credit union in order to build credit. I payed off my balance last month and this one in full just because I was already paying last month so why not pay off my whole balance right? Well I didn't use my card again at all and now I received my billing statement and it's 0.00 that needs to be paid. Is this bad? It shows how much I used over the month and that I already paid it off but should I have left a little bit or used my card again so I would have something to pay on the bill?
Comment: Some good answers on that similar question, paying off early helps as it keeps your usage ratio low, but likely minimal impact on credit score. Technically there is opportunity cost when paying bills early, since you could be earning interest on that money until it is due, but with saving interest rates so low it's not typically significant. It's not bad to have $0 due.
Comment: If you go too long without using a card and maintain a zero balance, it will be marked as dormant for credit purposes and will result in it not doing you any good, so put a few bucks on it every month and pay it off to keep it going active.
Answer: My advice is to not start playing the credit score game.  Here's how to build credit and use debt responsibly:

Pay your bills in full on time (do not pay a dime of interest)
Don't spend more just to use the card (e.g. get points, miles, discounts, etc.)
Only use the card on what you would otherwise spend cash for

If you do all of those things, your credit will be just fine.
So no, you should not use the card just to have a balance to pay off.
If you want to use the credit card as a tool, then you're free to do that.  But trying to game the system to get a few more points on your credit score is a dangerous game.

Building Credit


Why does my cat chatter at me when he's being bad and I yell at him?

Question: When my cat is doing something he knows is bad, such as trying to chew on flowers, I will snap my fingers and say his name and he will chatter back at me. He will stop doing it, but I'm just curious as to why he chatters at me.
Comment: What kind of cat do you have?  Are you saying that the cat uses the same sound to respond to you as when he sees a bird outside?
Comment: Could you link to a video of what you mean by "chattering"? It doesn't have to be of your cat exactly, just of the behaviour you're talking about.
Comment: My cat does that same thing its so funny. If other people are around I act as if my cat is talking back to me so I tell her "do not talk back" or "do not talk to me like that" I usually ask her questions and when she chatters it only seems she is saying no or maybe apologizing or even trying to explain herself. Either way its pretty funny and i cant be mad
Answer: You don't really describe the vocalization, so let me know if I am way off the mark.
Example of cat chattering
Cat "chattering" is a typical vocalization response when a cat sees a bird or a rodent outside a window. It is typically thought that they chatter in a state of high anticipation or possibly frustration in response to the surge of adrenaline.
A recent study suggeststhat cats may actually be trying to imitate various sounds they hear as a hunting technique.
Cats that copy and impersonate other animals
YouTube is full of videos of cats coincidentally or intentionally trying to make human-like sounds. Who knows; maybe he's trying to tell you to stop beotching at him so much <grin>.
Answer: I've heard a claim that the rapid jaw motion in the "chitter" is actually a specialized bite, which works the teeth between the prey's vertebre to sever the spinal column. I have no credible citation, alas, but I've alwsys interpreted it as "I'd bite that, but I can't." Maybe in this case it's "I'd bite that but I'd get my furry butt whipped" -- another form of feline cursing to go with hiss, yowl, and the time my siamese pointedly made burying motions in my direction.


Nash equilibria for "presidential election" game

Question:
Suppose, in a country there are $m$ different social issues, positions on which are being indexed with numbers $[-1; 1]$, with radicals on the opposing ends and moderates in the center. In this country there are also $n$ candidates running for president. Before they run, they have to choose their position on all those social issues by placing themselves into some point of this $[-1;1]^m$ «political compass». Suppose they have chosen their positions $a_1, … , a_m$ (as vectors in $\mathbb{R}^n$). Then define $Pref(x)$ as the set of the preferable candidates for voters with position $x$ (the candidates, the Euclidean distance from whose position to $x$ is minimal). Suppose, the voter positions are uniformly distributed on $[-1;1]^m$ and that each voter in the position $x$ chooses one of the candidates from $Pref(x)$ with equal probability. (So the total percentage of votes received by $k$-th candidate is $\int_{[-1;1]^m} \frac{I_{Pref(x)}(k)}{2^m|Pref(x)|}dx$). After the votes are counted, the president is chosen at random with equal probability from those candidates, that received the maximal numbest of votes. The candidates do not have their own opinion on those $m$ issues and only want to win the election (thus their final payoff is the exact probability of them winning). Is there some sort of classification of Nash equilibria in this class of games (for different $m$-s and $n$-s)?

For $n = 1$, every position is a Nash equilibrium as the only candidate will win the election no matter what they do.
For $n = 2$ both candidates should take the extremely moderate position that is $0$. That is due to the «geometric» fact, that if the positions of two candidates are distinct, then the one who is closer to the center wins. So if $a_1 \neq 0$, then the second candidate can adopt the position $\frac{a_1}{2}$ to win the election for sure, and vice versa.
However, I do not know, how to deal with the general problem.
This question on MSE. There is also a very useful partial answer by @antkam, with analysis of the particular case when $m = 1$ and $n$ is even.
Answer: This is a location game, a class of games that was well studied in game theory. Look at Exercise 4.49 in Maschler-Solan-Zamir, which contains one of the results in the link you provided. You can find other results by searching the web.
Comment: Also called Voronoi games (as any strategy profile induces a Voronoi diagram).


How do I make an already written concurrent program run on a GPU array?

Question: I have a neural network written in Erlang, and I just bought a GeForce GTX 260 card with a 240 core GPU on it. Is it trivial to use CUDA as glue to run this on the graphics card?
Comment: @none: I doubt that. The erlang concurrency model doesn't fare very well with the concurrency model languages like CUDA or OpenCL use. I have made some (yet unpublished) efforts to write openCL bindings for erlang, but the only real application I see for it as of now is doing stuff like fast matrix transformations.
Comment: awesome question, you might want to consider raising this in the erlang community, it might inspire some truly remarkable changes in erlang! :-)
Answer: No, using CUDA is not a trivial matter.
The CUDA programming model basically uses C (with some additions) but in order to get the most of the GPGPU's capabilities you would have to ensure that your algorithms follow the CUDA guidelines. (see NVidia CUDA Programming Guide)
For example in order to get the best memory performance (somewhere around 70Gbps) you need to access memory in streaming mode with coalescing, also branches are very costly on the GPUs so you should avoid conditionals as much as possible. Check out the guide and samples provided with the SDK, they'll provide an excellent starting point
Comment: Yup, thats a lot of work. To get a significant speedup you'll have to understand how to arrange the data and the concept of half-warps and coalescing as mentioned. Also I believe the target machine code changes according to the GPU series...
Answer: I wish I could tell you how to do this with Erlang... ;-), but at least, Satnam Singh at MS Research has done some very interesting work with Haskell (Lava) and F#. Perhaps this paper can give you some intuition for how it could be done:
http://research.microsoft.com/en-us/people/satnams/
Comment: Broken link. Satnam's homepage is here:

http://research.microsoft.com/en-us/people/satnams/


Is gravity included in "static pressure"?

Question: In the context of Bernoulli, does "static pressure" typically refer to $p$, or to $p + \rho gz$?
Comment: Could explain a bit more what the context actually is? Depending on the context it could "seem" that the answer is YES or NO, and actually the answer is more likely NO. Anyhow, please provide the context and we will figure it out.
Answer: $p_0$ is the static pressure
$\rho g z$ is the hydrostatic pressure
$\frac{1}{2} \rho v^2$ is the dynamic pressure
Hence
$p(z) = p_0 + \rho g z + \frac{1}{2} \rho v^2$
Answer: Without any further information on where you want to apply "Bernoulli" it is hard to answer the question. But in general the static pressure $p$ does not include $\rho g z$.
Lets recall again Bernoulli's principle which states:
Along a streamline $\frac{v^2}{2} + gz + \frac{p}{\rho}$ is constant. Here $g$ is the gravity which is the force field acting on the fluid. This equation/model is true for small fluid speeds (with respect to its speed of sound, see Mach Number for further information on compressibility effects). If one multiplies the equation with $\rho$ all parts of the equation have the dimension of a pressure and the contstant is referred to as total pressure, $p_\mathrm{t}$.
$\rho\frac{v^2}{2} + \rho gz + p = $ Total Pressure $ = p_\mathrm{t}$
And if one assumes an isentropic process, it is possible to convert one form of pressure into another form of pressure (always along the streamline).
Most of the times $\Delta \rho$ and $\Delta z$ are small along the streamline which is investigated that it can be neglected. Then Bernoulli's principle can be simplified to:
$\rho\frac{v^2}{2} + p = p_\mathrm{t}$
The static pressure, $p$, in this equation therefore does not include the gravity. A drastic change of the altitude along the streamline needs to be addressed by including an additional term in the equation.
Answer: I think there is no unique technical term to define pressures in different situations.
As a reference states here: $p_\text{static}=\rho g h$
If we consider the data computed from any incompressible CFD solver, the data of pressure term indeed includes the hydrostatic part when gravity $g$ is available.
I do prefer to think the fluid pressure (incompressible) in this way for
$p+\frac{\rho v^2}{2}+\rho g z=p_0$:

$\rho g z$ is the potential at $z_A$ not the hydrostatic pressure.
If zero is the reference position, the hydrostatic pressure or pressure due to acceleration should be $p_{hs}=\rho g (-z)=-\rho g z$, since gravity has a negative direction.
$p$ raised in the previous equation has two components: hydrodynamic pressure $p_{hd}$ and hydrostatic pressure $p_{hs}$, which is to say $p=p_{hd}+p_{hs}$.
Hence, it is quite obvious that static pressure $p_{s}=p_{hd}=p_0-\frac{\rho v^2}{2}$
Dynamic pressure $p_{d}=\frac{\rho v^2}{2}$
$p_s+p_d=p_0$(total pressure)

As for the common situation, pressure $p$ is the static pressure $p_s$ (hydrodynamic pressure $p_{hd}$) plus hydrostatic pressure $p_{hs}$ (or pressures due to inertial force). Excluding the rest balance, $p_s$ or $p_{hd}$ is the real reason to make flow move (to balance dynamic pressure $p_d$).


How to check if an IC is fried?

Question: I was using my 74173 (d-type register) today and accidentally attached the vcc pin to ground and the ground pin to 5v.  I didn't realize this and turned on the power.  A couple seconds after turning it on smoke started to come out of the IC so I turned it off.  I touched the IC a couple seconds after turning off the power and it was so hot it burned my finger a little.  What I am wondering is what is the best way to check if this IC is fried?  I could plug it in and see if it seems like it is behaving normal, but I am afraid that even if it works in my tests it may still have an edge case that it is broken for.  Basically I want to know if there is any way to check if the IC is 100% functional still instead of just making sure it still works with the cases you test it.
Comment: It smoked, how can anyone convince you it's 100% ok? Toss it and use a new one.
Comment: Magic Smoke™ escaping = dead. 100% guaranteed. What more do you want?
Comment: It is an ex-chip. It has ceased to be.
Comment: The underworld can't thank you, nor can death praise you; those who go down to the pit can't hope for your faithfulness.
Comment: A reference for the "magic smoke" referred to above:
[magic smoke](http://foldoc.org/magic%20smoke) *"(electronics, humour) A substance trapped inside integrated circuit packages that enables them to function"*
Answer: The chip is dead.
As you said yourself, it got hot enough to burn your finger and also burn the epoxy case (hence smoke), both of which mean it has quite literally fried.

In general, the answer to the question "is there a way to check if an IC with unknown condition is 100% functional?" is simply maybe.
The only way to test an IC is to try it, and if it behaves within the manufacturers specifications, then it is most likely functional - though it is not guaranteed to be.
The only way to be more sure (still not certain though) that you have a functional IC is to buy a new one. A new chip is much more likely to be functional than one of unknown condition.
Comment: @user2417339 You have 10 questions and have yet to accept any of the answers.  Please be polite and accept some.  8)
Comment: @StainlessSteelRat is this time to start ignoring questions then?
Comment: @SolarMike Just a gentle reminder.
Comment: Ok thanks, I'm just going to toss the chip then and buy a new one.
Comment: @stainlesssteelrat good catch I didn't realize I was leaving my questions open

How to check if an IC is fried?


Shutdown doesn't work in latest Linux Mint Tricia

Question: Well I´m new in linux and I´m pretty lost... My laptop is an asus with ryzen 5 and gpu RX560X, maybe is only a drivers issue, but i don't know how to get what i need. Thanks!
Comment: please provide more details, how do you trying shutdown? open terminal emulator and try `sudo shutdown -k now`(if you are not root)
Comment: I tried with shutdown command and normally with hte button of Mint, in both the OS is shutting down but the laptop still ON with the screen in black. I tried shutdown -k now but it doesn't appears to be doing anything...
Answer: Here is my personal experience:
I installed mint tricia 32-bit (xfce, kernel 5.4.0-77) on my old (OLD!) Samsung NC10 about 6 weeks ago, and it was fine.
Yesterday I switched it on for the first time in 5 weeks, did an update, and then it would not shut down through the standard shutdown button from the menu. I did shut it eventually by keeping the off-button pressed for a few seconds.
I started it again. With the menu button it did not shut down, again, and by pressing the Esc key I could see the messages scrolled on the screen --- something like the following:
After "Shutdown" there was a "kernel panic",
"not syncing: Attempted to kill init!
/shutdown: error while loading shared libraries: libpcre.so.3: cannot open shared object file: No such file ..."

So I switched it off by holding the off-button, started it again, searched for the .so library (locate libpcre.so.3); I saw that there was one in /lib/i386-linux-gnu/ directory.
I just tried and copied it into a more standard path:
sudo cp /lib/i386-linux-gnu/libpcre.so.3 /usr/lib/

and then I tried to shut down through the menu button and it worked!
I tried once again, and it booted up fine and then shut down properly via the menu button. Hope this helps.
Answer: I've got the same problem with kernel 5.3.0-53. Kernel 5.3.0-51 works fine!
Comment: Please go here: https://bugs.launchpad.net/ubuntu/+source/linux-meta-hwe/+bug/1880041 and click 'This bug affects me too' so it gets more visible.


How to override Dropbox's online file list with my local file list?

Question: Several months ago, I was using Dropbox while using Fedora as my primary OS. Then, my Internet connection was disconnected for a period of several months. In the meanwhile, I reorganized my Dropbox contents i.e. moved the contents around for better organization and also removed Fedora to install Windows 7. However, now that I have Internet access and hence install Dropbox again, it appears that Dropbox is forcing me to download the old file list from the cloud, and download several files that I deleted during the time when I had no Internet access. So, how do I override the filelist on the cloud with the file list on my laptop at present?
Comment: You may just want to move/copy the files somewhere else, let Dropbox "update" the folder, then replace it all with the files you want.
Comment: @barlop Uh, I don't believe that you're quite clear on my situation. I did the reorganization after my Internet went out. So, the copy on the Dropbox servers is the unorganized one.
Comment: so the latest version has the organization you don't want. But does dropbox perhaps offer a slightly older than latest version, that is from when you reorganized it? in which case you could download that and replace the one you have in your computer, then let dropbox take it back off your computer.
Comment: @user319810 yes I understand that.but what i'm saying is,doesn't dropbox ALSO have an archive of all ur files/folders from before you did the reorganization.One reads that "By default, Dropbox saves a history of all deleted n earlier versions of files for 30 days"So let's say  you had the Internet up to the middle of the 2nd of april.During the 2nd of april u lost Internet access.u reorganized things on dropbox on the 10th April.Dropbox had that.Then you got net access on the 13th.Sadly Dropbox got that.But maybe dropbox ALSO has a copy of how all your files were from the 10/11/12th Apr
Comment: Why not log onto dropbox.com and delete the unorganized files, then install Dropbox and copy paste the organized files into it.
Answer: I think in this case, you basically have to start from scratch.
I would move the files out of your Dropbox folder, then go to dropbox.com and delete all the files. Let the system sync and then copy your files back in.
I suspect that you probably set up Dropbox and told it that the location was your Dropbox folder rather than installing Dropbox clean and then copying the files in. I think that in a dispute Dropbox shows you it's before you show it yours so it will download all the files it has, then upload new ones from your system.
I don't know what the policy is if there is a file dispute, whether it's last modified or Dropbox becomes the source. I haven't had it happen yet.


How to (re)set CakePhp Paginator to page 1

Question: I have a table of Parts retrieved from a database and a form with a select tag listing PartTypes and a
[Refresh] button. These are used to filter the table to show only parts that match the selected type.
The table is paginated for performance.  When I start on Page 1, I can successfully filter my data table
using my select and refresh button, but if I navigate away from page 1 via the Paginator, and try to
refresh the page with a new PartType (rather than all being visible), I get the following error
Error: The requested address '/product/parts/index/page:2' was not found on this server.
I have been through the PaginatorComponent and PaginatorHelper documentation and cannot see how to
reset the page before filtering my data.  What am I missing?
/Controller/PartsController.php
public $paginate = array(
    'limit' => 12,
    'page' => 1,
    'order' => array('Part.name' => 'asc' )
);

public function index() {
//  ...
    //  array $qcond holds the query properties for filtering parts
    if (count($qcond) > 0)
        $this->paginate['conditions'] = $qcond;

    //  ...
    $this->set('parts', $this->paginate());
}

app/View/Parts/index.ctp
<?php
    echo $this->Paginator->prev(__('«'), array('tag' => 'li'), null, array('tag' => 'li','class' => 'disabled','disabledTag' => 'a'));
    echo $this->Paginator->numbers(array('separator' => '','currentTag' => 'a', 'currentClass' => 'active','tag' => 'li','first' => 1));
    echo $this->Paginator->next(__('»'), array('tag' => 'li','currentClass' => 'disabled'), null, array('tag' => 'li','class' => 'disabled','disabledTag' => 'a'));
?>

Problem solved:  Issue was not in the Paginator, but in the Form.  Had to manually set the form's url to not use /page:2, rather than let CakePhp deduce the url on it's own.
Answer: In Cakephp 2.x You can reset page by using bellow code in Controller:
$this->request->params['named']['page']=1;


Electric field strength away from a negative spherical charge

Question: I was wonder how would a graph of electrical field strength away from a spherical -ve charge graph would look. Since E= potential gradient I was guessing that since potential increases away from a negative charge , electric field strength would increase away from a negative charge also ?
Answer: The potential does increase. This means that the gradient of potential plotted against distance, r, from the charge is always positive. But the gradient, $\frac{dV}{dr},$ keeps decreasing in magnitude – just sketch the graph! The field strength in the r direction is given by$$E=\ –\frac{dV}{dr},$$so the field is in the –r direction and decreases in magnitude the further we go from the negative charge.
Comment: Would it look something like what I uploaded in op ?
Comment: Yes, but as there is radial symmetry, it would be clearer to put the centre of the sphere at $r$ = 0 and to have the $r$ axis in the positive direction only (as it represents the distance from the sphere in any direction). We'd also usually have the graph upside down, reflected about the $r$ axis, the negativity of $E$ showing that the field is directed in the –$r$ direction, that is towards the sphere.
Comment: This is not meant unkindly, but have you consulted an introductory textbook?


On Euclid's definition of similar and equal solid figures.

Question: The Euclid's definition of similar solid figures is
Similar solid figures are those contained by similar planes equal in multitude.
And the Euclid's definition of equal solid figures is
Equal and similar solid figures are those contained by similar planes equal in multitude and magnitude.
This definition was a lot criticized (see the commentary of Heath of the XI book of the Elements for a summary of the critics), because actually there exists solid figures contained by similar planes equal in multitude that are not similar: a typical example is that of a pyramid such that on its base, on opposite sides of it, are erected two equal pyramids smaller than the first. The addition and subtraction of these pyramids respectively from the first give two solid figures which satisfy the definition but are clearly not similar (the smaller having a re-entrant angle).
It was proposed to change the definition in this way:
Similar solid figures are such as have all their solid angels equal, each to each, and which are contained by the same number of similar planes.
What if Euclid had actually in mind only the CONVEX solid figures?
Well, there is a counter example for two convex solid figures with similar faces equal in moltitude:
Let's take a frustum with squared as bases, not too much flat in order to mantain the convexity of the final figure (wait a moment to have this more clear).
Now let's consider the two solids made by erecting a pyramid with equilateral faces respectively on the two bases of the frustum.
We have two convex solids made of 4 equilateral triangles, a square and 4 similar isosceles trapezoids.
Now my question is...
And if we want only EQUAL faces (not just similar) equal in moltitude?
I can't figure out any counterexample. It seem to me that the definition of similar solid figures is wrong, but that of equal solid figures may be correct (even thou is not proved that two convex solid figures contained by similar planes equal in multitude and magnitude, are equal).
Answer:
Here it is a counterexample!
It was a little hard to imagine but I made it :-)


Is it haram to have a poster of planets or rockets

Question: I am trying to get a new poster about rockets but someone told me that posters are haram?
Answer: It's fine you can get them, your friend probably thinks it's haram because of worshipping the poster, which I'm assuming you won't worship a rocket poster. If you have innocent intentions then it's fine getting a poster.


ProjectReference assemblies not copied to startup project's output dir when using msbuild command line

Question: In Visual Studio 2012, I have a solution with multiple projects in it.
Solution S
  - Project A (startup project) (references project B)
  - Project B

My main project (Project A) has a project reference to another of my projects (Project B).
My main project compiles to C:\MAIN_BIN and my other project compiles to HisProjectFolder/Bin.
Project A builds to: C:\MAIN_BIN
Project B builds to: C:\SolutionS\ProjectB\Bin

The reference to Project B on Project A is set as Copy Local = True. In the csproj file, the property <Private>True</Private> is set for the project reference to Project B.
When I Build my solution using Visual Studio 2012, ProjectB.dll is compiled to his bin folder, and then copied into C:\MAIN_BIN.
When I build using msbuild from the command line, ProjectB.dll is compiled to his bin folder, and never copied to C:\MAIN_BIN.
How can I make it so msbuild behaves the same way as Visual Studio 2012?
Answer: Set the OutDir property explicitly:
msbuild s.sln /p:OutDir=C:\MAIN_BIN\ /t:Rebuild

Comment: That did not fix the problem.


Generate Dynamic User Interface

Question: I am looking at some framework which will help me to generate the UI Dynamically. What I mean is the UI components to be displayed on the screen and the corresponding validation can be stored in some format like XML. I should be able to generate the UI based on the information in the XML.
That is I will have only one module in my application for displaying UI for various inputs screens which will fetch the data from something like XML
Can anyone suggest if some ready made framework available to achieve this. I was told about Wicket and Vaadin but I am not sure how these will help me achieve this.
Answer: From the description, it seems like you might be looking for something like http://www.swixml.org/ . This is only a suggestion, not a recommendation: I have not yet used it (although it looks quite interesting, according to the documentation and samples)

Generate Dynamic User Interface


App saves to SD card, phone has no SD card slot!

Question: I am currently using to JBTimer app to time Rubik's Cube solves on my Droid Maxx, and wanted to export the data to do some analysis. The app has a few built-in options for exporting, but every single one of them will only export to an SD card which, if you've ever used a Droid Maxx before, you'll know there isn't a slot for in the phone. The app doesn't give any errors or anything, but I can't find the data on my phone when I connect it to my computer. I would really rather not type 300-something numbers into an Excel spreadsheet manually. Any ideas?
Answer: Yes, Rob is right. Android is very well designed. You have a SD card that is the memory of your device. If you'd have a SD Slot then you'd have 2 SD Cards. Why this happens? Because it's assumed that Android needs a place where to save pictures, savegames, etc and it has a special partition for each: SD (yes, it's emulated), applications, system files, etc.
This is why when you do a full reset on the device those files are not deleted! Because it's not necessary! Only system files and folders are touched in those cases.
Answer: Android provides SD Card emulation for devices that don't have one as well as a pointer to a physical one if available. If you use ES File Explorer on your device (I highly recommend that app!), you will be able to go to /mnt/extSdCard.
No root required, it is only a pointer (you can see the black curved arrow over the folder icon). You will be able to find your saves in there.
It is possible that extSdCard has another name: Sdcard2, etc.


Which U.S. online discount broker is the best value for money?

Question: Which U.S. online discount broker is the best value for money?
Lower prices preferred, but I also like to be able to reach somebody by phone when help is needed.  24 hours not required, but after hours trading is a nice to have...
Comment: How is this not subjective?
Answer: I agree, Schwab representatives are easy to reach and very helpful. I also like Vanguard for their low mutual fund fees, so I do my retirement stuff with them, but it took forever to get in touch with a representative just to ask a simple question.
Now that they are lowering their rates to 8.95 per trade (effective January 19th), the value for your money is even better.
Comment: I too am happy with Schwab. Once got a call from a representative from them because I had a smallish chunk of money just sitting in my account, and they wanted to make sure I knew about my options for cash-based investments.
Answer: I am very happy with Charles Schwab.  I use both their investing tools and banking tool, but I don't do much investing besides buy more shares a random mutual fund I purchase 4 years ago
I did once need to call in about an IRA rollover and I got a person on the phone immediately who answered my questions and followed up as he said he would.
It is anecdotal, but I am happy with them.
Answer: If you have at least $25,000, Wells Fargo is the place to be, as you get 100 free trades per account. I have three investment accounts with them and get 100 free trades in each a year, though I only ever actually use 10-20. i can't vouch for their phone service as I've never needed it, but free is very hard to beat in the "value for money" department.
Update: Apparently in some states the requirement is $50,000. However, they count 10% of your mortgage as well as all deposit and investment accounts toward that balance.
Answer: I've never used them myself, but Scottrade might be something for you to look at. They do $7 internet trades, but also offer $27 broker assisted trades (that's for stocks, in both cases). Plus, they have brick-and-morter storefronts all over the US for that extra "I gotta have a human touch". :-)
Also, they do have after hours trading, for the same commission as regular trading.
Answer: For self-service type online customers, OptionsXpress gives me far better trading features(like technicals advanced conditions) and tools, ACH money management & scheduling, fullfillment too. $9 stock trades.
I don't know if they yet share Schwab's (their new parent company?) commission-free ETFs getting so trendy nowadays.


Ui guide lines for disabling controls?

Question: In my application I am disabling some controls depending on some checkbox state .Basically the controls consists of textboxes and labels.Currently I am disabling only the textfield so I want to know according to ui guidelines is it required to disable both the text and label .It might be a dumb question but from last 1 day I am searching for the Ui guidelines for it.Till now I am unable to find any.Any Light on this will be appreciated .
Answer: There are no hard and fast rules for this. It entirely depends on how "disabled" the control looks to the user.
In the link you provided to the bootstrap forms, it doesn't strike me as very obvious that some types of controls are disabled. The text entry and select menus are fine, but for the radio buttons and check boxes I can only be sure they are disabled by visually comparing them to the enabled versions. For these it wouldn't hurt to grey out the label a bit, to underscore the fact that it is disabled.
In windows, the label on a checkbox or radio button is considered part of the control, and gets disabled / greyed when the box / button does.
Answer: A common practice it's to disable only the field and not the label. Even if a field is disabled the user must be able to read its label. This is an example of Bootstrap UI

Bootstrap Forms
In this example, there is also a mouse indicator, when the user hovers a disabled field
Comment: Good answer, but who said it was a common/best practice?
Comment: @lineplay It is a consistent practice (which makes it common and perhaps best practice) to not disable the label since the way a user interacts with it hasn't changed unlike the input field.

Ui guide lines for disabling controls?


what best places to earn money In ORAS?

Question: I heard all of these tips 10000 times already!! but how- where, should I do it?? rich boys, give money using weak Pokemon, gentlemen, etc! its all the same. WHERE?? thats the real question, I think, if u heard this before, then, yes, it is.
Answer: Outside the safari zone in the fence maze area, there's a guy who gives you 10,000 for every win after you beat the elite four. With an Amulet Coin, Happy Hour Smeargle, and Money O-Power lvl 3 rewards 120k If you keep playing and rematching him for a hour (every 10/15 minutes IG) you should be able to get 500k+ :)
His name is Walter and you know you're challenging the right guy when he says "I've traveled the world's four corners with my Pokemon."

what best places to earn money In ORAS?


Share google document with everyone under certain domain

Question: Google Docs allows to share the document with people and groups (title of the share dialog basically). But I'm presented with separate email addresses in autocomplete dropdown. I would like to share the document with everyone having their mail addresses ending with certain domain. Is it possible?
Answer: It is only possible if you are using G Suite and not regular Google Docs.  With G Suite Docs you can share the document across your entire G Suite hosted domain  Then you can share the document with all other users in that G Suite account using the 'Share' button in the upper-right.  This will only work for users who have an active active G Suite account on that G Suite hosted domain.  Also, it's good to click the settings gear icon and make sure the shared file is searchable by other users or they will only see it if you send them the link.