Photons and electromagnetic waves

Question: If an electromagnetic wave is constituted by a continually accelerating charge, then how can a photon be neutral?
Comment: An EM wave is generated but not constituted by accelerating charge.
Comment: see https://en.wikipedia.org/wiki/Electromagnetic_radiation
Answer: A charged particle under acceleration loses energy and emits EM waves. The photon replaces waves in particle model of light. EM waves or photons are not electrically charged.
Answer: An electromagnetic wave is created by an accelerating charge, but it does not consist of an accelerating charge.
Suppose you have some antenna consisting charges that you let vibrate up and down at a certain frequency $\nu$. The oscillation of these charges will induce oscillating electric and magnetic fields. At sufficient distance from the antenna (for a car antenna, just a few millimeters) these oscillating magnetic and electric fields will take the shape of electromagnetic waves.
That does not mean that the field is charged, it means that it is generated by a charge.
Incidentally, the photons you mention then come into play, since the electromagnetic field is quantized in terms of them. But please don't take this as a proof that photons are electrically neutral, merely as evidence that they might be. Classical electrodynamics is formulated without any regard or even mentioning of photons, and works fine without reference to them.
Griffith's Introduction to Electromagnetics contains a relatively elegant derivation of the maths governing this radiation in chapter 10.
Comment: So called light waves are made from billions of photons and ignoring them does not make them go away. You couldn't have a wave without them.
Comment: I'm not talking about what is or is not true in the strictest sense of the word. I'm talking about what works and what doesn't. You can build up all of classical electrodynamics without ever touching upon photons; CED says nothing at all about whether photons exist and what they do. That makes it only confusing to discuss them when talking about CED derivations. A student should be able to understand the concept of radiation without thinking about quantized light, so for brevity I would really recommend ignoring photons.
Comment: ??Radiation is photons
Answer: Following the history,

in 1864 Scottish mathematical physicist James Clerk Maxwell, proposed a comprehensive theory of electromagnetism, now called Maxwell's equations. Maxwell's theory predicted that coupled electric and magnetic fields could travel through space as an "electromagnetic wave". Source Wikipedia

Years before it was observed, that an electric current in a coiled wire induces a magnetic field as well as a magnet, moving forth and back in a coil induces a current.
Maxwells identified the EM radiation as oscillating electric and magnetic field components, in vacuum both perpendicular oriented on each other and in addition both perpendicular to the direction of propagation:

After finding the explanation for the photoelectric effect it turned out that the EM radiation consists of quanta, later called photons.

In 1900, while studying black-body radiation, the German physicist Max Planck suggested that the energy carried by electromagnetic waves could only be released in "packets" of energy. In 1905, Albert Einstein published a paper advancing the hypothesis that light energy is carried in discrete quantized packets to explain experimental data from the photoelectric effect.

You ask what's usually asked, but the question doesn't contain the full picture:

... an electromagnetic wave is constituted by a continually accelerating charge

The charge you are asking for is the electron and electrons have two properties we should take in consideration: Electrons have an electric charge and a magnetic dipole. Both intrinsic (existing independent from outer circumstances qualities) properties are used for induction processes:

Electromagnetic induction has found many applications, including electrical components such as inductors and transformers, and devices such as electric motors and generators.

Knowing and taking this into account it is less surprisingly that the radiation from accelerated electrons contain both - an electric and a magnetic - components.
Furthermore the difference in motion of two particles can be reached by manipulating one of the particles with photons. A plausible example is the technique of laser cooling:

Laser cooling techniques rely on the fact that when an object (usually an atom) absorbs and re-emits a photon (a particle of light) its momentum changes.

So a photon acting on the electron disappears (at least for a little while) and at the same time causes a moment change. Being familiar with this fact it should be less surprising that accelerated electrons emit photons. BTW emitting photons the electron loses moment and decelerates. For example a coiled wire has a higher resistance when a wire of the same length (because now beside the Ohmic resistance an inductive resistance appears).
Long story short

then how can a photon be neutral?

It is what was observed. Furthermore electric charges or magnetic dipoles smaller the electron as freely moving particles are not observed. Never an electron loses subelectric nor submagnetic particles.
Comment: Thank you so much everyone!

Photons and electromagnetic waves


Wiring a traffic light as a brake lights

Question: I am trying to wire in a set off traffic lights as my brake lights/turn signals on a rat rod truck. My question is how would I proceed with it? IE, they are a 120v ac design led bulb and would need them to run on a 12v DC setup.
Comment: The easiest thing to do would be to replace the bulbs with LEDs that can run on 12v DC.
Comment: They are a sealed unit of 40 in a lense unit and I would be afraid of cracking the lenses apart as there is a fitment issue in the housings. I don't know if they would go back in.
Comment: Camper and Trailer parks often carry 12v. Edison base bulbs.
Comment: This question appears to be off-topic and better belongs on the Automotive Stack Exchange
Answer: Something like this would preserve the traffic lights as much as possible.

simulate this circuit – Schematic created using CircuitLab
A few comments.
The inverter can be the cheapest, crappiest you can find as long as it's reliable. You aren't driving a computer here.
The relay should be a 12-volt coil with contacts rated for 120 volts at several amps. You simply connect the coil in place of the brake light bulb.
It's entirely possible that the LED modules (one per indicator) are not actually capable of running at 120 AC. At the least, it's probably rectified in the traffic light controller box. In this case, you would need to put a full-wave rectifier somewhere between the inverter and the LEDs. It's even possible that the LED modules, in addition to being DC, are not 120 volts. But you need to determine this yourself.
Answer: As Grant suggested, stick with 12V bulbs. LEDs are neat, but it might be easier to work with regular car brake/turn signal/fog lamps, which already run off 12V.
Next, try to find one that fits the existing socket, and if that fails, find sockets for the bulbs you like that will be relatively easy to retrofit into the housing.
The main thing is to put a bulb that's easy to deal with (i.e. one that uses 12V DC) inside the housing and illuminating the lens. After that, follow the same procedures that apply to all a car's lights. Low current switch -> relay -> lamp or high current switch -> lamp.


Mean value property of harmonic functions on manifolds

Question: A well-known feature of harmonic functions on (domains of) $\mathbb{R}^n$ is the mean-value property: that is, if $\Delta u = 0$, then
$$ u(x_0) = \frac{1}{\text{Vol}(\partial B_r(x_0))}\int_{\partial B_r(x_0)}{u\,dS} = \frac{1}{\text{Vol}(B_r(x_0))}\int_{B_r(x_0)}{u\,dV}. $$
Is the same true on manifolds in general? That is, given a manifold $(M,g)$ and a smooth function $u:M\rightarrow\mathbb{R}$ satisfying
$$\Delta_gu = 0\quad\text{where}\quad\Delta_g = \frac{1}{\sqrt{\det g}}\frac{\partial}{\partial x^i}g^{ij}\sqrt{\det g}\frac{\partial}{\partial x^j},$$
is it true that
$$ u(x_0) = \frac{1}{\text{Vol}(\partial B_r(x_0))}\int_{\partial B_r(x_0)}{u\,dS}\quad\text{or}\quad u(x_0) = \frac{1}{\text{Vol}(B_r(x_0))}\int_{B_r(x_0)}{u\,dV}?$$
Here, $B_r(x_0)$ is the geodesic ball of radius $r$ around $x_0$. If the equalities do not hold, how would the average value (either over a sphere or over a ball) change with $r$? For example, on a surface the Gaussian curvature appears in the higher-order terms in the Taylor expansion of the length/area of a circle/ball of radius $r$--does a similar phenomenon occur for the mean value?
Comment: I've worked this out before for the case of submanifolds of $\mathbb{S}^2\subseteq\mathbb{R}^3$. You can obtain the following mean value property: Let $\Omega\subseteq\mathbb{S}^n$ be a smooth domain. Then $u$ is harmonic with respect to the Laplace-Beltrami operator on $\mathbb{S}^2$ (or on $\Omega$) if and only if for every $x_0\in\Omega$ and $r>0$ such that $B_r(x_0)\Subset\Omega$ (the geodesic ball is compactly contained in $\Omega$) then $u(x_0)=\frac{1}{2\pi\sqrt{r(1-r)}}\int_{\partial B_r(x_0)}u(y)~d\sigma(y)$.
Comment: I derived this formula by using an explicit representation of the Laplace-Beltrami operator in spherical coordinates. Then I fully developed the theory for the solvability of the Poisson equation on these regions; in particular, I came up with representation formulas for solutions of the Poisson equation in $\Omega$, which allowed me to derive this mean value property for sub-2-manifolds of $\mathbb{S}^2$.
Comment: I think that this mean value property will also hold for any open submanifold of $\mathbb{S}^n$, and I wouldn't be surprised if it also holds for open submanifolds of $\mathbb{H}^n$ (the hyperbolic space with constant negative curvature). On the other hand, I'm not sure if any this will hold in the more general setting where the curvature of $M$ is not constant... I'll think about this some more, and will write more here if I come up with anything.
Answer: After doing a quick Google search I came across this blog post: https://cuhkmath.wordpress.com/2015/08/14/mean-value-theorems-for-harmonic-functions-on-riemannian-manifolds/
The main points of the article are as follows:

The mean value property of harmonic functions holds on an arbitrary manifold $M$ only when for every point $p\in M$ every geodesic sphere near $p$ has constant mean curvature. Such manifolds are called harmonic manifolds. This coincides with the intuition I had in my comments above.
For any smooth function $u$ on an $n$-manifold $(M,g)$ it holds that $$\frac{1}{\mathrm{vol}(\partial B_r(p)}\int_{\partial B_r(p)}u(y)~d\sigma(y)=u(p)+\frac{\Delta u(p)}{2n}r^2 + \mathscr{O}(r^4).$$
The $\mathscr{O}(r^4)$ term is given by $B(n)r^4 + \mathscr{O}(r^6)$, where $$B(n):=\frac{1}{24(n+2)}\left(3\Delta^2u - 2\langle\nabla^2 u,\rho\rangle-3\langle\nabla u,\nabla\tau\rangle + \frac{4}{n}\tau\Delta u\right).$$
In the above $\rho(x,y)=\mathrm{tr}\left(R(\cdot,x,y,\cdot)\right)$, $R$ is the Riemann curvature tensor, and $\tau=\mathrm{tr}(\rho)$.
We have a similar mean value property for geodesic balls. For any smooth function $u$ it holds that $$\frac{1}{\mathrm{vol}(B_r(p))}\int_{B_r(p)}u(y)~d\mu(y)=u(p) + \frac{\Delta u(p)}{2(n+2)}r^2 + B(n+2)r^4 + \mathscr{O}(r^6).$$
You have similar sub-mean value properties for subharmonic functions given bounds on the Ricci and Riemann curvatures.

The blog provides plenty of references and proofs (they seem to be correct, but I haven't had the time to work through them yet).
Comment: Awesome, this is what I was looking for. Thanks!
Comment: Is the computation to see that a sphere $\mathbb S$ (in any dimension) is harmonic manifold easy? I can't seem to do it. Could someone point me in the right direction? I would boil down to showing each geodesic sphere on a sphere has constant mean curvature.


Use windows or linux to start work with Ruby On Rails?

Question: I'm new to Ruby On Rails and I want to know which is better to use for work with it. Windows or Linux. I've never worked with Linux before but I heard It's better to work with it. Is it necessary for someone like me to install linux or I can use windows and the results will be same with linux?
Answer: If your current dev machine is running Windows, and you don't have access to a Linux environment right now, don't let that stop you from getting started with Rails. Definitely, definitely, definitely install the DevKit first thing (if it's not included in RubyInstaller yet). See https://github.com/oneclick/rubyinstaller/wiki/Development-Kit for that.
If you get deep into Rails development, or even start doing it for a living, you will inevitably drift towards using Linux on your dev machine. The problem is not Rails, but the many binary gems which are difficult or impossible to install on Windows.
The most popular Ruby library for manipulating images (ie. generating thumbnails) is RMagick, but trying to install it on Windows is enough to make a strong man cry. Paperclip is very nice for dealing with images and other attachments, but it is also a problem. Then there is a popular JSON parsing library which is also problematic on Windows. Unicorn (a popular Rails server) won't run at all on Windows, and Thin (my favorite) may also give you headaches. And so on, and so on.
You can get pretty far with Rails development on Windows these days, but at times you will find yourself having to test code on a remote server, rather than locally, and it can waste a lot of time.
Comment: +1 for actually listing gems which are problematic, not just saying Windows is terrible (as many are apt to say). One note though, I have been using Thin on Windows for over a year without any issues. Also, I would recommend using RailsInstaller, which includes DevKit and everything needed for Rails (and yes, RubyInstaller does not currently include DevKit).
Comment: The problem is not Rails nor his gems, it's Windows.
Comment: @phoffer, that's very good info: please add it to the answer if you like. I also use Thin on Windows, but at least a couple times, when installing on new dev machines, I've seen the dreaded `mkmf.rb` error message. The problem is installation, not running it once you have it set up right. @Dougui, there's no purpose in pointing fingers; I'm just stating the facts as they are right now.
Comment: @Dougui I did not have that much problems with Django on Windows.
Comment: @WeaponX a lot of things changed since 2012. I think it's easier now. I know you can install Ubuntu on Windows. Maybe it's the simplest option.
Answer: Linux, without hesitation. You will find a lot of problems if you want to develop on windows with ruby on rails. I already tried with windows, at my beginning, and it's very difficult. Since I am with Linux, it works!  It's hard in the beginning but it's very powerful.

Linux is very powerful;
The majority of the documentation is on a UNIX environment;
This requires less configuration;
You will have fewer bugs;
Every tools are optimized for UNIX systems;
Comment: Rails development has come a long way on a Windows machine. Though, I agree that when I learned Rails a couple years ago on Windows, I spent more time configuring than coding, currently it is a very smooth process from blank slate to fully running Rails environment.
Comment: ...until you get deeper into Rails development and start using gems from different sources. Then you discover the hell-on-earth which is otherwise known as "installing RMagick on Windows". Then you spend nights of agony and tears trying to install `eventmachine`. Then you want to try Unicorn, but discover it is UNIX-only. Then...
Comment: ...Big sigh. I hate to say it, but it's things like RMagick which give open source a bad name. You wouldn't believe some of the crazy bugs I have had to track down in applications using RMagick...
Comment: It doesn't help that RMagick hasn't been updated since 2010. =)
Answer: Yes, this thread is an old thread but I am here to express how awfully you will encounter problems on windows platform while using Ruby on Rails. It may be 'OK' to build normal application however, as soon as you start scratching the surface of sqlite3, ASCII Characters, Internationalisation for an application, ... Your hair will start to fall off, I mean literally . Whereas if you stick with Mac or Linux (Ubuntu), You will feel invincible, take pride on projects, progress further without having to configure yourself manually with setting of (gems') native extensions library and it is horrendous.
In Summary, to make it work on windows is just nightmare. Whatever you have done it is entirely your decision. I hope everything is fine.
Answer: It mostly depends on how comfortable you are in each environment. I have been developing on both Windows and Linux for 4 years (because I can't afford a Mac) and I have found Windows to be the easiest in setup, as of late. Engineyard has released an installer for Windows that is an all in one for Ruby, Rails, Git, Bundler, SQLite, and DevKit among others.
Windows users are used to simple installers such as that Engineyard provides so if this sounds more like what you are used to, go with that.
Linux provides much more support online for installing Ruby on Rails. There are minor differences with each distro of linux for installing it so I can't provide you with any links. You will also be able to find separate tutorials for installing Git, SQLite, and DevKit.
If you are much more comfortable working in the terminal, than I would suggest taking the plunge into Linux development. It can take a little longer to set up than Windows but you will find it much more command line friendly (and fulfilling).
After you set up Rails, the differences diminish quickly. Development will depend more on what IDE or text editor you are using. Most provide both Linux and Windows versions.
If your focus will be mostly server-side programming then Linux would be the best to look into. If you are working more on client-side, then I would suggest Windows (or MacOS).
My best possible suggestion would be to download VirtualBox, or some other VM, and try Linux. It is free and will only take up a day or so of your time to install and mess around in. If you don't like it, go back to Windows.
(I personally use a combination of both thanks to the miracle that is Bundler)
Answer: Linux or Mac. This is because many helpful Gems for Ruby on Rails haven't been ported over to Windows, and never will be (at least, that was the case when I last used Rails). If you do end up doing development on Windows, you may find yourself having to reinvent the wheel many times.
Comment: Which common libraries are those?
Comment: @CharlesCaldwell, unfortunately, the Ruby community is slightly UNIX-biased, and *many* binary gems are easier to install on Linux than Windows. Ruby on Windows is *much* better than it used to be, and the DevKit helps big time (don't *think* of using Ruby on Windows without it), but there are still many gems which can be difficult to install. If someone tried to make a list of those gems, it would go on and on.


Max resolution for External Monitor that I can get from my Vaio?

Question: I am planning to get an 29" Ultrawide 21:9 monitor, running at a resolution of 2560 X 1080. My laptop is a Sony Vaio VPCEB24EN, almost 4 years old running with an ATI Mobility Radeon 5145 - 512 MB Graphics Card. Not sure if other specs matter but if you are curious - Intel i3 2.3GHz, 1 TB HDD, 6 GB Ram and 1366x768 native display resolution. It has a VGA port and an HDMI which I frequently use with a 1920x1080 display.
My question is - will my laptop be able to utilize the full screen space of the 2560 pixels of the monitor and should HDMI be good for it. The laptop will not be used for gaming, mainly for movies and browsing, slight photoshop usage with maybe 20 layers at max.
Thanks in advance for any help.
Comment: Related: [Getting 2560x1600 out of an ATI Radeon HD 4670 on Windows 7](http://superuser.com/questions/191766/)
Answer: Technical specifications
The Sony VAIO VPCEB24EN comes with a ATI Mobility Radeon 5145 graphic card with 512 MB of dedicated RAM. You can confirm that by using a program such as GPU-Z.
Here's an excerpt from the official specifications:

One integrated LVDS display output

Integrated LVDS display outputs for embedded panels
Supports 18- and 24-bit digital displays at all resolutions up to 1920x1200 (Dual-Channel LVDS)

Two integrated DVI display outputs

Supports 18-, 24-, and 30-bit digital displays at all resolutions up to 1920x1200 (single-link DVI) or 2560x1600 (dual-link DVI)2
Supports 18-, 24-, and 30-bit digital displays at all resolutions up to 1920x1200 (single-link DVI only)2
Each includes a dual-link HDCP encoder with on-chip key storage for high resolution playback of protected content3

One integrated 400 MHz 30-bit RAMDACs

Supporting analog displays connected by VGA at all resolutions up to 2048x15362

DisplayPort™ output support

Supports 24- and 30-bit displays at all resolutions up to 2560x16002
Integrated HD audio controller with up to 2 channel 48 KHz stereo or multi-channel (7.1) AC3 enabling a plug-and-play cable-less audio solution4

HDMI output support

Supports all display resolutions up to 1920x10802
Integrated HD audio controller with up to 2 channel 48 KHz stereo or multi-channel (7.1) AC3 enabling a plug-and-play cable-less audio solution4

2. Some custom resolutions require user configuration.
3. Playing HDCP content requires additional HDCP ready components, including but not limited to an HDCP ready monitor, Blu-ray or HD DVD disc drive, multimedia application and computer operating system.
4. Subject to digital rights management limitations; maximum supported audio stream bandwidth is 6.144 Mbps.
Source: ATI Mobility Radeon™ HD 5145 GPU Specifications

Additional information

The AMD ATI Mobility Radeon HD 5145 is a renamed Mobility Radeon HD 4570 with slightly higher clock rates. Therefore (despite the 5000 series name), the card supports only DirectX 10.1 and is still produced in 55nm.
Source: ATI Mobility Radeon HD 5145 - NotebookCheck.net Tech

Quoting the fine print found on the AMD website (emphasis mine):

Performance, technologies and features listed above can vary with specific notebook implementations. Please consult with Notebook vendor for a complete list of supported features.
ATI Radeon™ HD graphics chips have numerous features integrated into the processor itself (e.g., HDCP, HDMI, etc.). Third parties manufacturing products based on, or incorporating ATI Radeon HD graphics chips, may choose to enable some or all of these features.

Display output
Despite the fact that the graphic card supports resolutions up to 2560x1600 through the DVI (dual link) or DisplayPort interface, the laptop only provides a HDMI port and a legacy VGA port. It's logical to assume Sony didn't implement the other ports at all, thus the motherboard lacks the necessary hardware logic.
If you were to use a passive HDMI to DVI dual link adapter, the entire HDMI signal would transmitted through a single link of the DVI connector, and not both. A single link DVI supports resolutions up to 1920x1200; in order to get higher resolutions you would need a powered, active solution to upscale the input signal.
Answer: Your graphics card supports resolutions upto 2560x1600. However, I couldn't find a spec sheet for the product on AMD's website so I can't be sure.
Comment: Thanks a lot for the reply. I checked the link you provided but in the table it says on the memory column as 1024 MB, I am 100% sure that what I have is a 512 MB card. Suggestions?
Comment: I'm sorry I can't help you here because AMD seems to have deleted the product page for the Mobility Radeon HD 5145 and every other website I find say it has 1 GB DDR3 memory. I guess the only sure shot way to see if your graphics card can support 2560x1600 is to actually try it out with the external monitor.
Comment: [This spec sheet](http://www.gpuzoo.com/GPU-ATI/Mobility_Radeon_HD_5145_Series.html) reports that HD 5145 supports a max digital resolution of 2560 x 1600 and a VGA max resolution of 2048 x 1536
Comment: I can't say I fully understand the term "max digital resolution" but the gist of it I guess is that you can go upto 2560x1600 resolution over digital interfaces (DVI) vs. analog (VGA). Also, if your notebook doesn't have a DVI port, [cl-scott from TomsHardware](http://www.tomshardware.com/forum/81566-35-hdmi-laptop-monitor#7817415) says a HDMI to DVI cable should work. However, since DVI is video only, you might also need an audio cable to transmit audio to the monitor's speakers.
Comment: Aaah thanks a lot mate. I don't have a DVI port in my laptop. Just an HDMI and VGA. Seems I will have to use the HDMI to DVI adapter. Thanks again.


How to switch from MariaDB to MySQL in WAMP server?

Question: I installed wamp server on my PC and by default wamp server is connected to MariaDB as showed below

How can i switch to MySQL?
Thank you in advance for your help.
Answer: To pick MySQL or MariaDB, right click on the wampmanager icon in the system tray and you should see this this menu

Please Select Components like I did please check the 2nd Screenshot
Comment: at the time of setup/installation you will see the 2nd screenshot.
Answer: Follow these steps:

First right-click Wamp icon > Wamp Settings and ensure both MySQL
and MariaDB are checked.
If there is already a default DBMS, Right-click Wamp icon > Tools >
Invert default DBMS MySQL <> MariaDB. And this will do the magic.
If you do not have a default Right-click Wamp icon > Tools > Use a
port other than 330X under Ports used by MySQL, then enter 3306 to
make the MySQL the default DBMS.
To switch the default in the future, use step 2.

I hope this helps.
Answer: You must click on WAMP icon and go to MySql and from list select "Use a port other than (your port)"  and set your port To "3306".
Ok your default DB is Mysql and has green check.
Answer: The -to my knowledge- only way to solve the luck of MySQL databases in WAMP is to uninstal it and reinstall making sure to have MySQL selected when you are prompted what to instal.
Do not worry, your WAMP website/webapp files (or whatever you are developing) will not be harmed or lost in the process, unless you select them to be deleted.
Once the fresh installation is done, just move the contents from your previous wamp64\www folder in the new directory (if for example you had wamp installed in C:\wamp64 and now you installed WAMP in C:\wamp64_2 folder move the contents of www folder from C:\wamp64\www over to C:\wamp64_2\www) and you can load it all again.
One note, if you was using some databases in this your other projects you will need to move them using export and import via the phpMyAdmin or Adminer, but I find it unlikely, since the question seems like related to a luck of a specific DB type and I am guessing you are still in the first steps
Answer: I found the best way to solve this problem.
we can download the add-ons for the mysql or mariaDB based on the requirements .During  the process of installing be sure you are installing the right version of MYSQL
below is the link for downloading add-ons
https://wampserver.aviatechno.net/
After downloading just install it.
for changing to MYSQL just go to wampsettings and

check the Allow MYSQL wampp restarts

uncheck the Allow mariaDB


Publishing images

Question: I submitted a paper to a journal and just found out that I was accepted. This is my first time publishing and I wrote the paper for a class assignment. I submitted all of my citations and figures but now I am worried that I will run into copyright issues. I scanned several of my figures out of books, which the journal team knows, and I am nervous. What can I do to avoid issues? IS this something that I should contact the book's publisher over?
Answer: An image copied from a book is almost certainly under copyright unless the copyright has expired. The journal should know this and should have taken some action on your behalf to obtain permission to republish it. Any reputable journal would find a way to deal with this, either directly through the other publisher (assuming it isn't themself) or through you obtaining permission. Images are very seldom fair use for copying since they carry so much information (A picture is worth a thousand words).
Some materials might have a permissive license for reuse, such as a CC-BY license, but that would be clearly stated in the source. They might (probably will) require a citation in any case. Some images are themselves already public domain if the original is old.
You should ask the journal what provisions have been made, if any. If none, then you should withdraw the paper until you make a suitable correction. One correction might be to provide alternate images. Another might be to get permission from the original publisher.
But, publishing it as it is now will do some damage to your reputation.
Note, however, that copyright law is almost everywhere a civil matter. It might result in a lawsuit by the copyright holder against the infringer. Such a suit is more likely to be against the publisher than yourself, though you might be named. Suits are expensive, so those suing go where the money is. It is nevertheless, a stain on your reputation if it is published. Put a hold on publishing until you work out the details. If you haven't yet signed over your copyright you are perfectly able to stop publication with just a notice. If you have already signed it over, then it is a deeper problem.

Edited to add: These images seem to be art. As such, the book you copied from might have, itself, copied from public domain sources, in which case they aren't actually copyrighted by the publisher of the book. You can probably find public domain sources for most art (especially anything fairly old) with a web search. There are millions of images online.
Comment: Thank you for your advice! The journal is one through UC Berkeley's Art History department and they just started. I have sent off questions about this to them but while I wait for a response I searched for public domain versions of some of my images. Now out of my 10 figures only half are now an issue (and three of those I can cut out if need be).
Comment: You might find public domain images for most art, actually, unless they were created in the digital age. A web search for "public domain art images" will turn up a lot of possibilities. In fact, the images you copied might have been copied from public domain sources.
Comment: The only images I am having trouble finding public domain versions for are from the Theoi Project. Others are from a museum catalog and have a hefty licensing fee should I want to use them. I am reworking my writing so as to omit the images to avoid paying the fees (I am still in university and don't have the funds)
Answer: I'm an art historian. Obtaining image permissions for articles is one of the bugbears of the profession. Not only will you need to consider who took the photograph of an artwork, but you also need to consider whether you need to request permission from the artist or the artist's estate prior to publication. In some cases, you may need to request permission from the rights agent, like the Artists Rights Society, which permits licensing of artwork.
The College Art Association publishes a helpful guide on fair-use guidelines for images. It's available here: https://www.collegeart.org/pdf/fair-use/best-practices-fair-use-visual-arts.pdf
I would also suggest taking a look at articles published in one of the College Art Association's journals to get a sense of what types of credit lines are necessary for image captions.
Here are a few screenshots of image captions from the art historian Melissa Ragain's 2021 book Domesticating the Invisible: Form and Environmental Anxiety in Postwar America to give you a sense of which organizations you will need to credit. The first image is from page 111 and the second is from page 115.

Publishing images


simple web server nort working with arduino wifi shield

Question: I have recently bought an arduino wifi shield(Atmal chip 32UC3A1512-U), which I connected with
my Arduino Mega ADK R3 board)...It is getting connected to my wifi network, But when I run the
SimpleWebServer Example provided in the library to  on/off the LED is not working. The code  is given below...
#include <SPI.h>
#include <WiFi.h>

char ssid[] = "belkin.E33";      //  your network SSID (name)
char pass[] = "abc123cde456";   // your network password
int keyIndex = 0;                 // your network key Index number (needed only for WEP)

int status = WL_IDLE_STATUS;
WiFiServer server(80);

void setup() {
  Serial.begin(9600);      // initialize serial communication
  pinMode(9, OUTPUT);      // set the LED pin mode

  // check for the presence of the shield:
  if (WiFi.status() == WL_NO_SHIELD) {
  Serial.println("WiFi shield not present");
   while(true);        // don't continue
   }

   // attempt to connect to Wifi network:
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to Network named: ");
    Serial.println(ssid);                   // print the network name (SSID);

    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
     status = WiFi.begin(ssid, pass);
     // wait 10 seconds for connection:
     delay(10000);
   }
  server.begin();                           // start the web server on port 80
  printWifiStatus();        // you're connected now, so print out the        status
}

void loop() {

  WiFiClient client = server.available();   // listen for incoming clients

  if (client) {                             // if you get a client,
    Serial.println("new client");           // print a message out the serial port
    String currentLine = "";      // make a String to hold incoming data from the client
    while (client.connected()) {            // loop while the client's connected
     if (client.available()) {             // if there's bytes to read from the client,
     char c = client.read();             // read a byte, then
     Serial.write(c);                    // print it out the serial monitor
     if (c == '\n') {                    // if the byte is a newline character

      // if the current line is blank, you got two newline characters in a row.
      // that's the end of the client HTTP request, so send a response:
      if (currentLine.length() == 0) {
        // HTTP headers always start with a response code (e.g. HTTP/1.1 200 OK)
        // and a content-type so the client knows what's coming, then a blank line:
        client.println("HTTP/1.1 200 OK");
        client.println("Content-type:text/html");
        client.println();

        // the content of the HTTP response follows the header:
        client.print("Click here turn the LED on pin 9 on
");
        client.print("Click here turn the LED on pin 9 off
");

        // The HTTP response ends with another blank line:
        client.println();
        // break out of the while loop:
        break;
       }
       else {      // if you got a newline, then clear currentLine:
         currentLine = "";
       }
     }
     else if (c != '\r') {  // if you got anything else but a carriage return character,
      currentLine += c;      // add it to the end of the currentLine
    }

    // Check to see if the client request was "GET /H" or "GET /L":
    if (currentLine.endsWith("GET /H")) {
      digitalWrite(9, HIGH);               // GET /H turns the LED on
    }
    if (currentLine.endsWith("GET /L")) {
      digitalWrite(9, LOW);                // GET /L turns the LED off
     }
   }
 }
// close the connection:
client.stop();
Serial.println("client disonnected");
  }
}

void printWifiStatus() {
  // print the SSID of the network you're attached to:
  Serial.print("SSID: ");
 Serial.println(WiFi.SSID());

 // print your WiFi shield's IP address:
 IPAddress ip = WiFi.localIP();
 Serial.print("IP Address: ");
 Serial.println(ip);

 // print the received signal strength:
 long rssi = WiFi.RSSI();
 Serial.print("signal strength (RSSI):");
 Serial.print(rssi);
 Serial.println(" dBm");
// print where to go in a browser:
Serial.print("To see this page in action, open a browser to http://");
Serial.println(ip);
 }

The result that I am getting in the serial monitor is
Attempting to connect to Network named: belkin.E33
SSID: belkin.E33
IP Address: 192.168.2.5
strength (RSSI):-56 dBm
To see this page in action, open a browser to http://192.168.2.5

But When I am opening the browser with the specified IP address, It is showing
    Could not Connect to 192.168.2.5
I have tried this in mozilla and chrome from my ubuntu machine...also tried from some other machines in the same network but with the same result. But when I am pinging to 192.168.2.5 it is pinging...What went wrong??? . My friend adviced to change the firmware...Is it an issue,bcas as told earlier simple examples for establishing the connection are working...Please guide me
Answer: I've got the same problem after upgrading Arduino IDE to lastest version (v2) from v1.0.8 which is doing fine with the wifi shield tests (client and server).
Going to try the nightly build now and see if it's fixed.
Edit: Yeap, Nightly build solves this issue.
Comment: I'm not sure what versions Nuno is referring to because at the time of this writing, the latest release version is 1.0.5 and 1.5.2 is in BETA.  However, I was having the same issue as the asker and solved it by using 1.0.2. For me, the nightlies didn't work.  I assume that a firmware upgrade would also take care of this and then the later version of the IDE would work again.  I haven't confirmed though.


Connection Pooling Strategy For A JSP Site?

Question: I'm doing some work on a JSP site that was coded very badly.   For every single database call the original programmer opens and closes a database connection.   I'm adding in some new database operations and I would like to do things a little bit better( something like hibernate will come later when more of the site can be rebuilt ).   I was thinking of creating a single database connection when a session starts ( after logging in ),  storing it in the session object and then closing it in session listener end of session handling function when the session closes.     Is this a sound strategy?   Thoughts?
Comment: spring's jdbcTemplate and a connection pool like dbcp and it all happens more or less automatically.
Answer:
I was thinking of creating a single database connection when a session starts ( after logging in ), storing it in the session object and then closing it in session listener end of session handling function when the session closes. Is this a sound strategy? Thoughts?

No. Create a container managed connection pooled data source and get it by JNDI on webapp's startup.
How to create the data source depends on the container in question. In case of for example Tomcat 6.0, you can read it up here: Tomcat JNDI Resources HOW-TO - JDBC Data Sources. In case of for example Glassfish 3, you can do it in the webbased admin console on http://localhost:4848.
Here's how you can finally get it from JNDI:
DataSource dataSource = (DataSource) new InitialContext().lookup(jndiName);
// ...

You can call getConnection() on it. It's sufficient to get the data source only once during webapp's startup, for example in a static initializer block of your database connection manager or perhaps in a ServletContextListener.
The connection should always be acquired and closed in the shortest possible scope. Get it inside the try block where you're executing the query and close it in the finally of the very same try block. Do not keep the connection open longer than necessary. The connection pool will take care about keeping them open, so the performance is already greatly improved that way.
Answer: Without commenting on your idea (because I've never done it that way so I don't know for sure), I can say that I've always seen it done something like this (see accepted answer):
How to reuse the same connection with a Spring's JdbcTemplate?
Answer: For starters you use a Common DBCP's PoolingDataSource instance stored in your ServletContext (or "application scope" in JSP parlance).
Ideally I would look to migrating to Spring (or Guice or similar).


Using a String in run configurations as an argument and using it in an if-statement

Question: The code below works as long as the argument in the run configuration equals "-output". But when the arguments are empty the compiler throws and ArrayOutOfBoundsException.
The point of this piece of code would eventually be to;
- Perform an action when -output is written in the run configurations arguments
- Perform something else if the arguments are empty or different from -output
I found many problems that looked like this one. But I've been working on a solutions for far to long, so I started a new post. Help is very much appreciated.
...
public static void main(String[] args) {
        Version_5 v5 = new Version_5("Test");
        {
            if(args[0].equals("-output")){
                System.out.println("It works");
            }
        }
    }
...

Answer: You need to check if you have arguments first, that's all.
if ((args.length > 0) && (args[0].equals("-output")) {
    ...

You might also consider using an argument-parsing library, of which there are several.
What are the extra brackets for?
Comment: The extra brackets around "Test"? They're just there because this is a copy paste from my actual code and the constructor needs an argument that is a String. To be clear: it has nothing to do with my question. So don't worry. Thanks for helping out.
Comment: @Ype No, those aren't extra. The `{}` around the whole part with the commnad-line args.
Answer: As you can see String args[] is an array with a specific size. If you don't pass an argument the size is zero. Before you check what is at args[0] check if args has a size with args.length.
if (args.length>0){
   //do something
}
else if (args[0].equals("-output")){
   System.out.println("It works");
}

Comment: Same same but different. :) Thanks for helping out.


What is the difference between creating a new solidity contract with and without the `new` keyword?

Question: What is the use of the new keyword for creating new smart contracts? Why not just omit this keyword?
Answer: There are two ways you can create contracts

Using 'new' keyword
Using address of the contracts

Using new keyword you instantiate the new instance of the contract and use that newly created contract instance
While in latter option you use the address of the already deployed and instantiated contract. You can check below code for reference:
pragma solidity ^0.5.0;

contract Communication {

    string public user_message;

    function getMessage() public view returns (string memory) {
        return user_message;
    }

    function setMessage(string memory _message) public {
        user_message = _message;
    }
}

contract GreetingsUsingNew {

    function sayHelloUsingNew() public returns (string memory) {
        Communication newObj = new Communication();
        newObj.setMessage("Contract created using New!!!");

        return newObj.getMessage();
    }

}

contract GreetingsUsingAddress {

    function sayHelloUsingAddress(address _addr) public returns (string memory) {
        Communication addObj = Communication(_addr);
        addObj.setMessage("Contract created using an Address!!!");

        return addObj.getMessage();
    }
}

Answer: You cannot omit the new keyword for creating new contracts.

In the case of: token = new Token;
A new contract is created and the address is passed to token.

In the case of: token = existingToken;
existingToken has to be an existing contract (already created) and token will be passed the current address of existingToken.
Answer:
Creating a new contract with the new keyword deploys and creates a new contract instance. Deploying a contract involves checking whether the sender has provided enough gas to
complete the deployment. So you will be charged. Also, with this method, you can also send Ethereum in Wei during the creation of the contract.
 NewContract myNewContract = (new NewContract){value: 1000000000000000000}()

in the second method, you are not deploying a new contract instead, instead, you are referring to an already deployed contract. With this method, you should already know the address beforehand


clang: error: no such file or directory: ASIAuthenticationDialog.m

Question: I have this error:
clang: error: no such file or directory:
'/Users/usuario/Desktop/echonest-echoprint-ios-sample-b937c04/Classes/ASIHTTP/clang:
 error: no such file or directory:'

I want to run the "echoprint-ios-sample"  project and I import the ASIHTTP files
I don´t know what is the problem  :(
Someone can help me?
Thanks!
Answer: If you u've deleted any h or m files, go through the project navigation(command + 1) in your xcode, there may be some reference(will be in red color) in that project navigator. U can delete it. Then there'll not be such an error. Hope this would help you.
Else, have a look at this link


Is the supply for a differential op amp compulsory?

Question: Is the supply for a differential op amp compulsory or can we operate those without a supply?
I just want to amplify the difference of inputs, I'm not in need of any supply voltage.
Comment: @RussellMcMahon, a transformer is not an amplifier.
Comment: @AlfredCentauri (1.) Note that I did not make an unqualified statement to that effect at any time. I have pointed out, because it is useful to do so in this context, that in a limited but useful range of cases, a transformer is functionally identical to an amplifier. (3). Please see my added "gain block" example and diagram in my answer. If you disagree with the important technical point made would you please explain why in technical terms.
Comment: The transistors inside the op-amp needs to be biased properly for amplification. You need to provide supply for that.
Comment: The range of generally overlapping but certainly not totally equivalent answers and comments shows that the question is useful. It would be a shame if the downvotes caused it to end up being closed or discouraged the asker.
Comment: A transformer with more turns on the secondary is a voltage amplifier with a fixed gain and a loss in power available at output compared to input.
Comment: @RussellMcMahon, I quote from the 3rd edition of Sedra / Smith "Microelectronic Circuits":  **"An amplifier increases the signal power, an important feature that *distinguishes* an amplifier from a transformer"**.  Now, whether you choose to agree with this statement or not, in part or in whole, is neither interesting nor relevant to me.  I consider the quoted statement above *true* and that's *that*.
Comment: Sedra & Smith I know not (or not until now) - [5th edition 2005 free download here](http://nkonecny.com/files/ECE342/Microelectronic%20circuits%20by%20Sedra%20Smith%205th.pdf) . I'd expect a competent writer (or two) to agree wth me, so it's good to see that they do :-). ie, as I have noted several times now, in the general case a transformer can not do all the things that an ideal amplifier can. The converse of their statement would go something like "apart form power gain, a traansformer is an amplifier ...". | A trap here is that the definition of transformer is a tautology ...
Comment: ... if you define a traaaansformer as being an unpowered device (ie no energy other than signal fed into it) and an amplifier as a device which MUST have power gain then you have by definition made it that a transformer is not an amplifier. | However, there is no reason that a transformer cannot if desired be provided with a power supply. In such v=cases it can have both voltage and power gain - so much so that when this arrangement is used the term "transformer" is replaced by the term "magnetic amplifier". ...
Comment: A magnetic amplifier is a specially designed transformer with a DC power supply that can be used to provide voltage and or power gain. [Lots of examples here](https://www.google.co.nz/search?q=magnetic+amplifier&tbm=isch&tbo=u&source=univ&sa=X&ei=uFfBU4qhGcLikAXvkYCYBg&ved=0CCsQsAQ&biw=1536&bih=826). And here is a DIY example using ordinary off the shelf 12V transformers to control significant AC power with a small DC (varying) signal. [Homemade magnetic amplifiers](http://sparkbangbuzz.com/mag-amp/mag-amp.htm) . MA's MAY have a single winding but often have multiple windings and power gain.
Answer:
Is the supply for a differential op amp compulsory or
can we operate those without a supply?
  I just want to amplify the difference of inputs, I'm not in need of any supply voltage.

Generally, no, you cannot operate them without an external power supply.
In VERY special cases, yes, voltage (but not power) amplifiers that do not require an external power supply can be designed.

You ask specifically about an "op amp" = "operational amplifier".
Using the Wikipedia definition this is necessarily a powered device with high gain, and it would be difficult to build one that did not require power supply separate from the input signal. While it is conceptually possible to imagine an amplifier which derives power from its input signals and amplifies eg voltage but at reduced power level, this would be extremely unusual, would have significant limitations in what it could do and would usually be more an exercise in perversity than a useful device.
In the general case the answer is short - see below.
Most of the material below relates to special cases -  in the "special cases" section below I describe devices which break the general "rule".

GENERAL CASE
In the general case, the answer is no.
An opamp without a supply is like a car without a motor.  *
It can't do anything, it won't go anywhere and it has absolutely no power output.
So, no, you MUST power an opamp to allow it to amplify signals.
How you power it MAY be creative, although you need to know what you are doing to have any chance if success.  ie in SOME cases you may be able to obtain power for an opamp or other IC from portions of your circuit that are not formal power supplies. But, you are still supplying it with power and it is necessary to do so.

SPECIAL CASES !!!
Very specialised subsets of amplifiers exist which can be powered by their input and so do not need separate power supplies. These cannot be power amplifiers but can amplify eg voltage or current.
For example, if you want an AC amplifier and are prepared to accept certain significant limitations then you can describe eg a transformer with a step up voltage ratio as an amplifier, and it will not require any external power supplies. eg a 110 VAC to 230 VAC step up transformer can be used in the USA by visitors from eg Britain or NZ to operate 230 VAC equipment from US 110 VAC mains. This transformer IS a voltage amplifier with a gain of ABOUT 230/110 =~~ 2.091. It has a current gain of less than 1 (approximately 1/2.091 ~= 0.478 and is somewhat lossy for power as some of the input power is lost in the windings and laminations.
This is a real amplifier in that if you decreased or increased the input voltage by a limited percentage of its initial value the output voltage would decrease or increase by about the same amount. I say "about" as things like magnetisation current and 'matching' of input and load will mean that the Vout/Vin voltage ratio is somewhat dependant than more than just the transformer turns ratio. However, to a first approximation it functions as a voltage amplifier.
In the diagram below we have two "gain blocks".
In the upper block we have a transformer with a 1:3 turns ratio.
In the bottom gain block we have unknown circuitry.
In both cases, for a range of frequencies and loads and certain other conditions, Vout ~= 3 x Vin in both cases. If Vout/Vin = voltage gain is the only aspect which is of interest to us  then the transformer can be considered to be "amplifying" the voltage. The transformer is, for the parameters of interest, not functionally different to a "formal" amplifier.

As pointed out by Alfred, unpowered transformers cannot, by definition, have power gain.   Otherwise put: Where power amplification is required an unpowered transformer fed with only the input "signal" cannot deliver more power to the output than is provided to the input.
An unusual device does exist which uses"magnetics" (eg windings on a 'steel' core or cores) + external power input to provide overall power gain. The device may use multiple semi independent windings and not be a true transformer or may incorporate true transformer action as part of its operation. Such a device is commonly called a "magnetic amplifier". It works by making use of the non linear magnetic saturation aspects of the magnetic core material and uses a low power signal to change the degree of magnetic saturation in a core shared by a high power winding. The change in core saturation produces an impedance swing in the high power winding which produces changes in power level much greater that what is required to cause them.
See section at end - "Powered transformers and magnetic amplifiers".

A hybrid amplifier: Transformer voltage gain & MOSFET power gain
The website of the person who designs these amplifiers, an IEE member, makes interesting reading. Their comments and terminology leave no doubt about what they think about provision of voltage gain without powering.
[Susan Parker, MIEE, Zeus Power Amplifier - A Zero Feedback Power Amplifier, for Audio and Other Applications.
Susan's Audiophonics site.
She says  - "I use transformers by design as the primary building blocks and gain stages
and either tube or solid state devices as followers. This topology is further explained on this site."
Here is an interesting example of a high quality audio amplifier - one of a family - which uses transformers to provide voltage gain, and semiconductor voltage followers, with a voltage gain of less  than 1, to provide power gain.
Here the actual voltage amplifier is wholly unpowered and provides the voltage gain for the whole system. The amplifier as a whole could not work with only the power amplifier or only the voltage amplifier.
Zeus Power Amplifier - note that the two MOSFETs are voltage followers with a voltage gain of less than unity.

Powered Transformers & Magnetic Amplifiers:
If you define a transformer as being an unpowered device (ie no energy other than signal fed into it) and you define an amplifier as a device which MUST have power gain then you have by definition made it that a transformer is not an amplifier.
However, there is no reason that a transformer cannot if desired be provided with a power supply so that "magnetics" are used to manipulate energy flows.
In such cases the "powered magnetic device" can have both voltage and power gain - so much so that when this arrangement is used the term "transformer" is replaced by the term "magnetic amplifier".
A magnetic amplifier is a specially designed transformer (or electromagnetic device consisting of windings on a (usually) steel core, with a DC power supply that can be used to provide voltage and or power gain. There are variants on this theme with small level DC controlling higher power AC, AC signals producing AC power out (functionally essentially indistinguishable from an AC amplifier implemented by other means) and more.
Magnetic amplifiers often use a slowly varying DC signal to vary the power of an AC signal, but may be and are used as true AC in AC out "powered" amplifiers.
Lots of examples here - Magnetic amplifiers .
And here are DIY examples using ordinary off the shelf 12V transformers to control significant AC power with a small DC (varying) signal. Homemade magnetic amplifiers
Magnetic amplifiers MAY have a single winding but often have multiple windings and power gain.
Wikipedia - magnetic amplifiers
Mgnetic amplifiers 99 pages - 1960. Excellent. Thanks to Dan Stahlke's stack exchanghe answer hetre
Cute 1951 US Navy related paper  Magnetic Amplifiers - another lost technology
Same maybe ?
http://teslapress.com/magamp.pdf
From whence this image (and many like unto it)

*"All models are wrong. Some models are useful" - George Box.
Comment: The phantom downvoter strikes again. Hopefully (for his sake) it's not Alfred. I'd be rather sad for anyone who thinks this answer is "not useful".
Comment: Russell, you really should consider deleting the comment above because, honestly, I think it diminishes you.  Rest assured, I leaves feedback on those *very* rare occasions I cast a downvote and frankly, I can't quite find the interest to read your answer much less downvote it.
Comment: @AlfredCentauri NB - :-) -> That sounds like it's worth -1 for technical reasons :-) | All of us "are" the vector sum of a complex mix of things - I meant what I said and I think it's positive. I genuinely hoped it was not you and I genuinely pleased to hear it wasn't. People who downvote answers like this one are either USUALLY misguided technically or trying to convey a personal grievance, and if a downvote does not genuinely reflect the technical does state of an answer it does others harm who see a lesser score and may not spend the time learning something new and interesting. ...
Comment: ... You and I have been disagreeing over a tautology which has little to do with the technical merits of the point raised and that is a shame. **I wholly agree with you** that **an unpowered transformer cannot have power gain**.  I drew attention to the fact that a "powered transformer" solution does exist - an unusual device in this age but still much used and highly useful. The term "magnetic amplifier" reflects the powered + magnetics aspects and is the exception that proves your point. A shame we can't  just grin ruefully about the path taken to reach a mutual agreement.
Answer:
I just want to amplify the difference of inputs

From the Wikipedia article "Amplifier"

An electronic amplifier, amplifier, or (informally) amp is an
  electronic device that increases the power of a signal.

Thus, the need for a power supply to the op-amp.  The additional power of the amplified signal must come from somewhere since energy is conserved thus, power must be supplied to the op-amp in addition to the signals to be amplified.
A transformer can be used to increase the voltage of a signal (the secondary voltage can be a multiple of the primary voltage) but not the power of a signal (ideally, power in equals power out) so it isn't an amplifier and, thus, doesn't require a power supply.
Comment: Alfred - you can validly have a voltage amplifier, or a current amplifier or even unusual things like an impedance amplifier, that do not need power amplification, and which can produce far less power in the load than is dissipated in the input circuitry.
Comment: @RussellMcMahon, a voltage amplifier has very low (ideally zero) output impedance and very high (ideally infinite) input impedance and thus, can provide enormous power gain.  The fact that, if the load is an open circuit, there is no power gain does not take away from the essential fact that there is *available* power gain.  Also, see, for example:  https://van.physics.illinois.edu/qa/listing.php?id=17627
Comment: Stop now :-). An ideal voltage amplifier may have power gain by default but even a circuit using an ideal voltage amplifier can be arranged to be ideal or not overall or to have power gain or not. While it may perhaps seem pedantic to make these points its desirable to do so as otherwise "what's normally done" may obscure the basic principles being conveyed. | Motorcars have 4 road wheels and a steering wheel. Yes? Marvellous J.A.P. engined Morgan 3 wheelers are then not motor cars. Nor are various  Reliant products. Some may agree :-). Some of the early vehicles which would ...
Comment: ... usually be described as early motorcars had tiller steering. Excluding the latter may not cause too many problems but excluding 3 wheelers from the ranks of cars will bring a host of pugnacious Morgan enthusiasts down on your head. My not really whimsical point is that constraining out definitions either to 'what is usually done' or to secondary characteristics  of an ideal example is liable to 'cause problems'. || A voltage amplifier has voltage gain. Anything else is secondary and demanding inclusion of secondary characteristics obscures the point.


Was the Greek preposition "ἀνά" used in Latin?

Question: A dictionary says that "ana tres uncias" was used by the Roman doctor Celsus. I googled this and didn't find anything. Was this Greek preposition used in Latin?
Answer: I looked up the phrase and found it in the Latin-French Dictionnaire Gaffiot. Here's the entry:

(1) ănă (ἀνά), prép. acc. [à partir de Végèce] : ana tres uncias Veg. Mul. 1, 20, 2, par trois onces.

The entry notes that it is a usage "since Vegetius" (who wrote in the 4th c. AD). The reference is to one of his more obscure works on veterinary medicine: Digesta artis mulomedicinae. Vegetius does not appear to be in the Packhum corpus.
Here's the full passage from I.20 in the entry, with the relevant parts highlighted:

Alia compositio vehementior.
[1] Est et alia compositio suffimentorum ad morbos prohibendos, sumptuosior quidem sed ut putatur utilior. Sulfuris vivi libr. I, bituminis Iudaici libr. I, opopanacis unc. VI, acanthi unc. VI, galbani libr. I, castorei selib., aeris crudi unc. VI, salis Hammoniaci unc. II, salis Cappadoci unc. III, cornu cervini, lapidis gagatis masculi, lapidis gagatis feminae ana unc. III, [2] lapidis haematitis unc. II, lapidis sideritis, lapidis argyritis ana unc. I, equuleos id est caballiones marinos numero VII, caudas marinas, ungues marinos ana numero VII, uvae marinae unc III, medullae cervinae, cedriae, picis liquidae ana pondera III, ossa sepiae numero VII, auri semunciam, ballucae siliquam: [3] et haec universa commixta atque succensa odore suo morbis tam hominum quam animalium resistunt et daemones fugant, grandinem prohibere et aerem defaecare dicuntur. Sed si memoratos lapides aut invenire nequiveris aut enormitate pretii ab emptione cessaveris, reliqua efficaciter prosunt.

The one part that remains confusing to me is what this preposition (obviously borrowed from Greek) means in context. The French translation ("par trois ounces") doesn't seem terribly helpful. I'm also confused by the second occurrence ("ana numero VII"), which appears to take the ablative instead of the accusative.
The Greek adverb ἀνά can be used "distributively with numerals" to mean "at X amount each." What's strange, though, is that there seems to be a contrast between a simple ounce value ("lapidis haematitis unc. II") and an "ana" ounce value ("lapidis argyritis ana unc. I"). One possible meaning is that it can go "up to" that amount.
Comment: This looks similar to how Philumenus uses it. I wonder if it's a Graecism that only shows up with medicine. That would make sense since most doctors were Greek, not Roman. Edited: Also, that would explain the mistaken attribution to Celsus - perhaps the Portuguese dictionary thought that this Vegetius text was actually of Celsus.
Answer: Might you have the reference wrong? Either that or the dictionary is wrong. There is no ana tres uncias in Celsus.
There is, however, ac tres uncias in Suetonius. Perhaps there was a mistake with a manuscript that editions have since emended.
That said, the only time you get the Greek preposition ana used in Latin is when it's they're using Greek, such as when Varro mentions ἀνὰ λόγον. It is not otherwise a widespread or common preposition. Readers would know that it's Greek, not Latin.
There's also ana in Philumenus, but that's Greek, too.
Comment: Which dictionary was it? Might be good to note for anyone else who has it.
Comment: Unfortunately the dictionary is wrong.  What is strange.  It is the best latin-portuguese dictionary.
Comment: Dicionário latino-português
F. R. dos Santos Saraiva @Adam


Is there a command to refresh environment variables from the command prompt in Windows?

Question: If I modify or add an environment variable I have to restart the command prompt.  Is there a command I could execute that would do this without restarting CMD?
Comment: Actually, every program that needs to see them has to be restarted. The environment is copied into the process' memory on startup and therefore has no connection whatsoever to the system-defined envvars anymore.
Comment: after reading these, I realized that *there is no spoon* ;) in the real world, you just restart cmd.
Comment: WM_SETTINGCHANGE (the win32 api mentioned by @CharlesGrunwald) doesn't work for cmd.exe windows according to this thread: https://github.com/chocolatey/choco/issues/1589 -- it's the reason they wrote the refreshenv command
Comment: Not a command, so not quite an answer, but there is support for it using Win32 API if I read the following correctly: https://support.microsoft.com/en-us/help/104011/how-to-propagate-environment-variables-to-the-system Shoud be able to compile that line into a simple C program and run it following environment variable updates.
Answer: On Windows 7/8/10, you can install Chocolatey, which has a script for this built-in.
After installing Chocolatey, just type RefreshEnv.cmd.
Comment: If refreshenv prematurely exists your script (as it did for me), you can use "call RefreshEnv.cmd" instead. (see https://github.com/chocolatey/choco/issues/1461)
Comment: What am I doing wrong? $>refreshenv
'refreshenv' is not recognized as an internal or external command,
operable program or batch file.
Comment: It doesn't work out of the box. You have to have Chocolatey already installed, which installs the refreshenv script. Saying "In windows 7/8/10" is misleading
Comment: @aclokay Not sure. Please provide more detail about ur system conf to debug. Meanwhile you can refer to a similar open issue here. https://github.com/chocolatey/choco/issues/250
Comment: It doesn't work for me neither. I'm on W7 professional, maybe it only works in more complete versions.
Comment: I just installed and tested `refreshenv` via the `scoop` package manager. It works. I assume it also does when installed with `chocolatey` since they're most likely the same binaries.
Comment: It's `RefreshEnv.cmd`, your shell is not necessary going to ignore the `.cmd` depending on configuration
Comment: Note that this doesn't answer the question, it just says there's a third party application that you can install and then run.
Answer: Here is what Chocolatey uses.
https://github.com/chocolatey/choco/blob/master/src/chocolatey.resources/redirects/RefreshEnv.cmd
@echo off
::
:: RefreshEnv.cmd
::
:: Batch file to read environment variables from registry and
:: set session variables to these values.
::
:: With this batch file, there should be no need to reload command
:: environment every time you want environment changes to propagate

::echo "RefreshEnv.cmd only works from cmd.exe, please install the Chocolatey Profile to take advantage of refreshenv from PowerShell"
echo | set /p dummy="Refreshing environment variables from registry for cmd.exe. Please wait..."

goto main

:: Set one environment variable from registry key
:SetFromReg
    "%WinDir%\System32\Reg" QUERY "%~1" /v "%~2" > "%TEMP%\_envset.tmp" 2>NUL
    for /f "usebackq skip=2 tokens=2,*" %%A IN ("%TEMP%\_envset.tmp") do (
        echo/set "%~3=%%B"
    )
    goto :EOF

:: Get a list of environment variables from registry
:GetRegEnv
    "%WinDir%\System32\Reg" QUERY "%~1" > "%TEMP%\_envget.tmp"
    for /f "usebackq skip=2" %%A IN ("%TEMP%\_envget.tmp") do (
        if /I not "%%~A"=="Path" (
            call :SetFromReg "%~1" "%%~A" "%%~A"
        )
    )
    goto :EOF

:main
    echo/@echo off >"%TEMP%\_env.cmd"

    :: Slowly generating final file
    call :GetRegEnv "HKLM\System\CurrentControlSet\Control\Session Manager\Environment" >> "%TEMP%\_env.cmd"
    call :GetRegEnv "HKCU\Environment">>"%TEMP%\_env.cmd" >> "%TEMP%\_env.cmd"

    :: Special handling for PATH - mix both User and System
    call :SetFromReg "HKLM\System\CurrentControlSet\Control\Session Manager\Environment" Path Path_HKLM >> "%TEMP%\_env.cmd"
    call :SetFromReg "HKCU\Environment" Path Path_HKCU >> "%TEMP%\_env.cmd"

    :: Caution: do not insert space-chars before >> redirection sign
    echo/set "Path=%%Path_HKLM%%;%%Path_HKCU%%" >> "%TEMP%\_env.cmd"

    :: Cleanup
    del /f /q "%TEMP%\_envset.tmp" 2>nul
    del /f /q "%TEMP%\_envget.tmp" 2>nul

    :: capture user / architecture
    SET "OriginalUserName=%USERNAME%"
    SET "OriginalArchitecture=%PROCESSOR_ARCHITECTURE%"

    :: Set these variables
    call "%TEMP%\_env.cmd"

    :: Cleanup
    del /f /q "%TEMP%\_env.cmd" 2>nul

    :: reset user / architecture
    SET "USERNAME=%OriginalUserName%"
    SET "PROCESSOR_ARCHITECTURE=%OriginalArchitecture%"

    echo | set /p dummy="Finished."
    echo .

Comment: +1 If you have Chocolatey installed, you can just run `RefreshEnv` to get updated environment variables into your current session.
Comment: Note: Chocolatey has moved repos and the latest version of this script can be found here (with some bug fixes): https://github.com/chocolatey/choco/blob/master/src/chocolatey.resources/redirects/RefreshEnv.cmd
Comment: this doesn't appear to work for me at all, in cmd/gitbash/PowerShell
Comment: This is an incredibly useful piece of utility software, thanks so much for sharing.
Comment: should this work from `Powershell` too? It only seems to work from `cmd.exe` for me.
Comment: The solution is good but it modifies env variables `TEMP` and `TMP` replacing them with values stored in `HKCU\Environment`. In my case I run the script to update env variables modified by Jenkins job on a slave that's running under SYSTEM account, so TEMP and TMP get substituted by `%USERPROFILE%\AppData\Local\Temp` instead of `C:\Windows\Temp`. This breaks build because linker cannot open system profile's Temp folder.
Comment: It works for me in PowerShell, @craq . Running Windows10 x64.
Comment: Is there something like this for Git Bash? I've tried executing `refreshenv.cmd` but it did not update the env. variables
Comment: @craq depending on what version of Chocolatey you are using, you may need to add the necessary entry in your PowerShell profile to make it work there.  Have a look here: https://chocolatey.org/docs/troubleshooting#why-does-choco-intab-not-work-for-me
Comment: I saved it (the new version from GitHub mentioned in the comment above code) in a .cmd, I ran it **as admin**, it *works without closing all the cmd windows*.
Comment: @szx I am also looking for exactly the same thing, did you find a solution for Git bash? in cmd the chocolatey command works perfectly, so does the accepted response, but none of these solutions works in Git bash
Comment: Works like a charm. Looking for something like this for a long time.
Comment: @szx In Bash the `regtool` utility can access your Win user environment at `/user/Environment/`. If you do a `regtool list '/user/Environment'` you'll see one key per envvar; `regtool get '/user/Environment/'` gets the value. You can "export" Bash variables to Windows with `regtool set '/user/Environment/VARNAME' "${VARNAME}"`, and to import: `for v in $(regtool list '/user/Environment'); do declare -n _v="${v}"; export _v="\"$(regtool get "/user/Environment/$v")\""; done` will pull all Windows vars into Bash. Though you'd want to add logic to skip `Path`, `TMP`, and `TEMP`, at least.
Answer: You can capture the system environment variables with a vbs script, but you need a bat script to actually change the current environment variables, so this is a combined solution.
Create a file named resetvars.vbs containing this code, and save it on the path:
Set oShell = WScript.CreateObject("WScript.Shell")
filename = oShell.ExpandEnvironmentStrings("%TEMP%\resetvars.bat")
Set objFileSystem = CreateObject("Scripting.fileSystemObject")
Set oFile = objFileSystem.CreateTextFile(filename, TRUE)

set oEnv=oShell.Environment("System")
for each sitem in oEnv
    oFile.WriteLine("SET " & sitem)
next
path = oEnv("PATH")

set oEnv=oShell.Environment("User")
for each sitem in oEnv
    oFile.WriteLine("SET " & sitem)
next

path = path & ";" & oEnv("PATH")
oFile.WriteLine("SET PATH=" & path)
oFile.Close

create another file name resetvars.bat containing this code, same location:
@echo off
%~dp0resetvars.vbs
call "%TEMP%\resetvars.bat"

When you want to refresh the environment variables, just run resetvars.bat

Apologetics:
The two main problems I had coming up with this solution were
a. I couldn't find a straightforward way to export environment variables from a vbs script back to the command prompt, and
b. the PATH environment variable is a concatenation of the user and the system PATH variables.
I'm not sure what the general rule is for conflicting variables between user and system, so I elected to make user override system, except in the PATH variable which is handled specifically.
I use the weird vbs+bat+temporary bat mechanism to work around the problem of exporting variables from vbs.
Note: this script does not delete variables.
This can probably be improved.
ADDED
If you need to export the environment from one cmd window to another, use this script (let's call it exportvars.vbs):
Set oShell = WScript.CreateObject("WScript.Shell")
filename = oShell.ExpandEnvironmentStrings("%TEMP%\resetvars.bat")
Set objFileSystem = CreateObject("Scripting.fileSystemObject")
Set oFile = objFileSystem.CreateTextFile(filename, TRUE)

set oEnv=oShell.Environment("Process")
for each sitem in oEnv
    oFile.WriteLine("SET " & sitem)
next
oFile.Close

Run exportvars.vbs in the window you want to export from, then switch to the window you want to export to, and type:
"%TEMP%\resetvars.bat"

Comment: @itsadok - given that this is now the accepted answer, you should add a brief explaination at the start to put the script in context. i.e  point out that it isn't possible to propagate an env var change to an open cmd.exe without manually updating as above or by restarting cmd.exe.
Comment: Perhaps you can avoid the temporary file using the FOR /F "tokens=1,*" %%c IN ('resetvars.vbs') DO construct
Comment: As I did say in my answer "or, manually add using SET in the existing command prompt." which is what this is effectively doing. Good answer though.
Comment: @Keyslinger: That's not actually possible.  Any program spawned can update its own environment, but not that of the running cmd.exe instance.  A batch file CAN update the cmd.exe environment, because it runs within the same instance of cmd.exe.
Comment: Be aware that some programs also cache the environment variables too. In my case I ran this script and then had to restart Intellij.
Comment: I also replaced the `resetvars.vbs` line in the .bat with `%~dp0resetvars.vbs`. This way you can also run the .bat by its absolute path from a console which you had open before you came to this page :) And add `@echo off` before that line if you don't want all that noise in the console.
Comment: For extra jazz - create a hybrid batch file containing the vbscript - https://ss64.com/vb/syntax-hybrid.html
Comment: The script handles the use case of changing environment variables globally in "My Computer...Environment Variables", but if an environment variable is changed in one cmd.exe the script will not propagate it to another running cmd.exe which I think is probably a common scenario.
Comment: This one saved my butt with tryoing to use env vars for CI server cross-job string sharing. Hate to use files to store one-liner paramtric info :)
Comment: Has this been implemented in any software presently available for download as a binary that does the task of performing the refresh and little or nothing else?
Comment: tldr; Why not use setx? :)
Comment: While I prefer the Chocolatey code-wise for being pure batch code, overall I decided to use this one, since it's faster. (~0.3 seconds instead of ~1 second -- which is nice, since I use it frequently in my Explorer "start cmd here" entry)
Comment: should this work from `Powershell` too? It only seems to work from `cmd.exe` for me.
Comment: It does not work for Bash terminals, e.g. Git Bash.
Answer: By design there isn't a built in mechanism for Windows to propagate an environment variable add/change/remove to an already running cmd.exe, either from another cmd.exe or from "My Computer -> Properties ->Advanced Settings -> Environment Variables".
If you modify or add a new environment variable outside of the scope of an existing open command prompt you either need to restart the command prompt, or, manually add using SET in the existing command prompt.
The latest accepted answer shows a partial work-around by manually refreshing all the environment variables in a script. The script handles the use case of changing environment variables globally in "My Computer...Environment Variables", but if an environment variable is changed in one cmd.exe the script will not propagate it to another running cmd.exe.
Comment: The negative comments and down marking of this answer shows how broken stack overflow is at times. Kev has given the correct answer. Just because you don't like it is no reason to mark it down.
Comment: And annoyingly, extra instances of cmd.exe don't count. They *all* have to be killed before the change is reflected in any new cmd.exe's.
Comment: This should not be the accepted answer simply because it does not answer the question asked. this question should remain without an accepted answer until one is found.
Comment: Kev definitely does answer the question.  The question is there is no built-in solution.
Comment: Regarding @Mike F's comment, this doesn't seem to be the case in Windows 7.
Comment: If anyone has a working solution to this problem I will periodically checkin and may change the accepted answer.
Answer: I came across this answer before eventually finding an easier solution.
Simply restart explorer.exe in Task Manager.
I didn't test, but you may also need to reopen you command prompt.
Credit to Timo Huovinen's comment here: Node not recognized although successfully installed.
Comment: The question was: "Is there a command I could execute that would do this *without restarting CMD*?"
Comment: That solution helps me in Windows 10
Comment: Good solution, thank you!  To expand and address @Oscar 's comment:  Start a `cmd` window as Administrator.  Use the command `taskkill /f /im explorer.exe && explorer.exe`.  This will kill the explorer.exe process and restart it.
Comment: Ok from the task manager i was not able to restart explorer.exe, only finish him. I did it but my task bar has been broken. To start explorer;exe it's really simple. Let's "Ctrl + shift + escape" --> file --> "execute new task"  -> "explorer.exe" did the work for me. And yes, after all env var has been used in the new cmd window. Thanks for all
Comment: @S3DEV ... which is an actual answer with built-in functions.
Comment: I arrived here because I was trying to add an external tool to visual studio so I could open a command prompt at the root of my solution, as described in this blog:  http://neverindoubtnet.blogspot.com/2012/10/add-visual-studio-command-prompt-to.html  ... and I had similar issues ... I was trying to get "git" to appear in my path variable.  I added the git directories to the PATH variable but then they would not appear in the command prompt that I would open from Visual Studio.  The simple solution was to restart Visual Studio.  Then the new additions to the PATH variable were visible in cmd.
Comment: Thanks a lot! This worked for me on Windows 7. I didn't have time to analyze/run some vb script and I needed a quick and obvious way to force refresh the env vars. Thanks again a ton!
Comment: Close TaskManager if is is open and use Ctrl+Shift+Esc to open it again. After that we can start new process that includes all environment variables. But yes, that solution won't fix the environment of an active process...
Answer: This works on windows 7: SET PATH=%PATH%;C:\CmdShortcuts
tested by typing echo %PATH% and it worked, fine. also set if you open a new cmd, no need for those pesky reboots any more :)
Comment: This does not solve the question being asked, nor should it.  The original question is how to refresh an environment variable to a value that has been set outisde of that terminal.
Comment: Not working for "new cmd" for me (Win7 x64). See [screenvideo](http://www.youtube.com/watch?v=pf3U7q_Su4E)
Comment: Although this doesn't answer the question, it provides half of the best working solution.  I use this - for whatever variable I am setting - then I open up the control panel and add the environmental variable globally.  I don't like using `setx` because it inherits the current environment which may have variables that have been modified and not what I want permanently.  Doing it this way allows me to avoid restarting the console in order to use the variables, while  avoiding the problem of not having them available globally in the future.
Answer: This answer describes workarounds, but doesn't answer the question on how to do this without restarting the cmd prompt.
Which implies that there is not a real solution to this issue.
Workaround 1: use "setx" and restart cmd prompt
There is a command line tool named "setx" for this job.
It's for reading and writing env variables.
The variables persist after the command window has been closed.
It "Creates or modifies environment variables in the user or system environment, without requiring programming or scripting. The setx command also retrieves the values of registry keys and writes them to text files."
Note: variables created or modified by this tool will be available in future command windows but not in the current CMD.exe command window. So, you have to restart.
Warning: setx may truncate vars to 1024 bytes.
If setx is missing:

http://download.microsoft.com/download/win2000platform/setx/1.00.0.1/nt5/en-us/setx_setup.exe

Workaround 2: modify the registry
MSDN says:

To programmatically add or modify system environment variables, add
them to the
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session
Manager\Environment registry key, then broadcast a WM_SETTINGCHANGE
message with lParam set to the string "Environment".
This allows applications, such as the shell, to pick up your updates.
Comment: Buyer beware! If you have a particularly long `%PATH%` then `setx` may truncate this to 1024 bytes! _And just like that, his evening vanished_
Comment: setx /? says in a note: "On a local system, variables created or modified by this tool will be available in future command windows but **not in the current** CMD.exe command window." OP wanted to update the current cmd.
Comment: current system environment: `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\VARIABLE`
current user environment:
`HKEY_CURRENT_USER\Environment\VARIABLE`
Comment: setx VARIABLE -k "HKEY_LOCAL_MACHINE\Software\Microsoft\WindowsNT\CurrentVersion\CurrentVersion" echo %VARIABLE%
Comment: Could you expand on how to use setx to read an environment variable? I've been over the various documentation and I'm just not seeing it. :-/
Comment: The read var code from JAK didn't make any sense to me so I came up with this:
`for /f "tokens=3* skip=2" %%i in ('reg query "HKCU\Environment" /v MyVarName') do (set MyVarName=%%i %%j)`
which goes for User vars. See above for the System path.
Comment: **on XP** I did **not have** this in built-in `windows`, but in an installable [Windows Resource Kits\Tools](http://technet.microsoft.com/en-us/library/bb491050.aspx). I forgot how did I install it, maybe [here](https://www.microsoft.com/en-us/download/details.aspx?id=20494) (not tested)
Comment: On XP, this didn't actually update my cmd.exe's env variables. It correctly gets the values but do nothing to the environment. I was able to overwrite the registry settings with it, however. o_o
Comment: For me, when I attempt this after having this problem, I get the following: `'setx' is not recognized as an internal or external command, operable program or batch file.`.
Comment: That's odd. I've added the download link to my answer.
Comment: @FaCE lol thanks for the warning. By the way, use `set` and `setx` side by side if you want your variable to be available in current and future command windows..
Comment: Doesn't answer the OP needs. The answer is supposed to be a command and it's not supposed to close the CMD, none of which exists without 3rd party tools. SetX implicitly requires to close the CMD to be able to use the new data. The way you're using invites more garbage in the registry than it's worth it. By the same logic one can place data in a temp file and read it from there for future needs or parallel scripts, and without limitations or littering.
Comment: How is "and restart CMD" an answer to "how do I do this without restarting CMD"?
Comment: It's obviously the description of a workaround. Which implies that there is not a real solution to this issue. I will add that on top of the answer just for you :)
Answer: Calling this function has worked for me:
VOID Win32ForceSettingsChange()
{
    DWORD dwReturnValue;
    ::SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0, (LPARAM) "Environment", SMTO_ABORTIFHUNG, 5000, &dwReturnValue);
}

Comment: and not all programs listen to this message (in fact most of them probably don't)
Comment: No, it also works for non-GUI programs. As for listening programs...the issue if ensuring that a restarted program will receive the updated environment, and this gives you that.
Answer: I made a better alternative to the Chocolatey refreshenv for cmd and cygwin which solves a lot of problems like:

The Chocolatey refreshenv is so bad if the variable have some
cmd meta-characters, see this test:
add this to the path in HKCU\Environment: test & echo baaaaaaaaaad,
and run the chocolatey refreshenv you will see that it prints
baaaaaaaaaad which is very bad, and the new path is not added to
your path variable.
This script solve this and you can test it with any meta-character, even something so bad like:
; & % ' ( ) ~ + @ # $ { } [ ] , ` ! ^ | > < \ / " : ? * = . - _ & echo baaaad

refreshenv adds only system and user
environment variables, but CMD adds volatile variables too
(HKCU\Volatile Environment). This script will merge all the three and
remove any duplicates.

refreshenv reset your PATH. This script append the new path to the
old path of the parent script which called this script. It is better
than overwriting the old path, otherwise it will delete any newly
added path by the parent script.

This script solve this problem described in a comment here by @Gene
Mayevsky: refreshenv modifies env variables TEMP and TMP replacing
them with values stored in HKCU\Environment. In my case I run the
script to update env variables modified by Jenkins job on a slave
that's running under SYSTEM account, so TEMP and TMP get substituted
by %USERPROFILE%\AppData\Local\Temp instead of C:\Windows\Temp. This
breaks build because linker cannot open system profile's Temp folder.

I made one script for cmd and another for cygwin/bash,
you can found them here: https://github.com/badrelmers/RefrEnv
For cmd
This script uses vbscript so it works in all windows versions xp+
to use it save it as refrenv.bat and call it with call refrenv.bat


No file names in multi tasking view

Question: When I open multiple files using other linux operating systems if I go the the hot corner and it is set to multi tasking all the files are displayed with a name under or above each file. If I do the same in Elementary all the files are displayed but no name, does anybody know if there is a setting to add file names so that I can see which each file is in multi tasking view>
Answer: As far as I know, there isn't currently a way to add titles to multitasking view.
If you'd like, you can file a feature request on Gala, the elementary OS window manager. For more on filing bugs and feature requests, see this question.

No file names in multi tasking view


How do I backstab?

Question: As a Stealth, I cannot seem to successfully backstab anyone in the training mission.  I run behind the enemy, I attack with the blades, and he just turns around and murders me!  The tutorial says a backstab can kill any enemy in one hit, but I can't get the hang of it.  What else must I do?  Is there some cloaked/uncloaked requirement?
Comment: 1) Be a Handsome Rouge 2) Intercourse your target's maternal figure 3) Pocketwatches
Comment: @FAE He's referring to the "[Meet the Spy](http://www.youtube.com/watch?v=OR4N5OhcY9s)" video from Team Fortress 2 :)
Comment: @Bora I realize that, but he stilled spelled "rogue" incorrectly. ;)
Comment: A handsome *rouge*? Are you attractive makeup? (Sorry, I cannot pass up the opportunity to catch people on that misspelling. :P)
Comment: @FAE perhaps I'm simply a Freudian supporter of RED team
Answer: To kill them in one hit you need to be behind them and be in range, hitting too early will uncloak you and the bot will turn at once.
You can see that you are in range by your crosshair chaning looks as on the picture below.

As far as I can tell you do not need to be cloaked, but I have a hard time telling if the cloak have faded before i hit when I try to do it vs the bots in the training mission and it is definitely easier if you are cloaked.
Comment: "*hitting to early will uncloak you and the bot will turn at once.*"  That is way important.  If you miss your first attempt, you're dead.

How do I backstab?


What are the numbers / symbols to the right of my reputation counter?

Question: I'm referring to the colored circles with numbers next to them on the top of the page, to the right of my reputation counter. What do they represent?
Comment: There must be an earlier Meta Stack Overflow post about this - it is one of the things that are not at all obvious to new users.
Answer: I just accidentally hovered over them, and found out that they are my badge counters. Never mind!
Comment: For what it's worth, you can get extra information about pretty much anything on any Stack Exchange page by hovering over it.


How to classify TF motifs by family

Question: I have a FIMO output, the input sequences were putative promoter sequences of several species. I want to graph the positions of these motifs along a horizontal graph, but I want to filter the data by clustering the motifs by family, e.g. all the zinc finger motifs being represented by one color, all the helix loop helix motifs being represented by one color, etc. How would I go about clustering the raw .tsv file?
Comment: Please explain what FIMO is, and show the first few lines from your raw .tsv file. What language / tool would you like to use for clustering? Is this something you'd do directly in the FIMO tool, or externally using another program?
Comment: JohnDoe23, are you looking for an output like the one shown here: https://bioinformatics.stackexchange.com/a/20132/3967
Answer: Comment: I don't understand what you mean by "I want to graph the positions of these motifs along a horizontal graph"? Are you talking about a Manhatten plot? Or something else? And I'm not sure about "filter the data by clustering the motifs by family". What type of clustering do you want to perform?
Without further information/description it's difficult to understand what you're trying to do. If possible, please edit your question with an example of what your desired output. Also please indicate the language you're using for your visualisation, e.g. R, python, other.
Answer: I may have completely misunderstood, but perhaps this approach could be adapted to suit. Using the example FIMO output file from https://meme-suite.org/meme/doc/examples/fimo_example_output_files/fimo.html?man_type=web:
library(tidyverse)
library(qqman)
#>
#> For example usage please run: vignette('qqman')
#>
#> Citation appreciated but not required:
#> Turner, (2018). qqman: an R package for visualizing GWAS results using Q-Q and manhattan plots. Journal of Open Source Software, 3(25), 731
#>

fimo_df <- read_tsv("~/Desktop/fimo.tsv", comment = "#") %>%
  rename("SNP" = motif_id, "CHR" = sequence_name, "BP" = start,
         "P" = `p-value`, "zscore" = `q-value`) %>%
  mutate(CHR = case_when(str_detect(CHR, "X") ~ "23",
                         str_detect(CHR, "Y") ~ "24",
                         TRUE ~ CHR)) %>%
  mutate(CHR = parse_number(CHR)) %>%
  select(-c(stop, strand, matched_sequence))
#> Rows: 1494 Columns: 10
#> ── Column specification ────────────────────────────────────────────────────────
#> Delimiter: "\t"
#> chr (5): motif_id, motif_alt_id, sequence_name, strand, matched_sequence
#> dbl (5): start, stop, score, p-value, q-value
#>
#> ℹ Use `spec()` to retrieve the full column specification for this data.
#> ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

manhattan(fimo_df, p = "zscore", logp = TRUE, ylab = "q-score",
          genomewideline = FALSE, suggestiveline = FALSE,
          main = "Manhattan plot of TF motifs",
          chrlabs = c(1:19, "X", "Y"))

If you want to colour the points by TF motif (or by 'cluster'), perhaps ggplot would be appropriate, e.g.
library(gghighlight)
axis_set <- fimo_df |>
  group_by(CHR) |>
  summarize(center = mean(BP, na.rm = TRUE))

ylim <- fimo_df |>
  filter(P == min(P)) |>
  mutate(ylim = abs(floor(log10(P))) + 2) |>
  pull(ylim)

ggplot(fimo_df, aes(x = BP, y = -log10(P),
                    color = as.factor(CHR),
                    size = -log10(P))) +
  geom_point(alpha = 0.75) +
  # scale_x_continuous(label = sort(axis_set$CHR), breaks = sort(axis_set$center)) +
  scale_y_continuous(expand = c(0, 0), limits = c(3.95, ylim)) +
  scale_color_manual(values = rep(
    c("#276FBF", "#183059"),
    unique(length(axis_set$CHR))
  )) +
  scale_size_continuous(range = c(0.5, 3)) +
  theme_minimal() +
  theme(
    legend.position = "none",
    panel.grid.major.x = element_blank(),
    panel.grid.minor.x = element_blank(),
  ) +
  gghighlight(motif_alt_id == "TBP")
#> Warning: Tried to calculate with group_by(), but the calculation failed.
#> Falling back to ungrouped filter operation...

Created on 2024-02-05 with reprex v2.1.0
Does that help at all?
Answer: How do you know the "family" to which your motifs belong?  If the source for the motifs that FIMO matched is, say, JASPAR Vertebrata CORE, then you might reasonably decide to use JASPAR's "structural class" as provided by their pre-computed "Annotation table" in JASPAR CORE Vertebrates clustering.
Assuming you are using JASPAR and you do make this decision...
Your "raw .tsv file" is in FIMO Results TSV Format.  "Joining" it with a downloaded copy of the "Annotation table" serves to annotate it with additional columns, having the effect you seek of clustering the FIMO results on the "structural class" of each matched motif.  Joining can be implemented following Running queries directly against CSV or JSON using the sqlite-utils command-line utility.
How you would then plot these features and encode the class as a color requires more detailed description what the plot is supposed to represent or look like.  For instance, do you "want to graph the positions of these motifs along a horizontal graph" with coordinates taken with respect to the TSS of the transcript from which the promoter is taken?

How to classify TF motifs by family


Was a black hole formed by only one star or many stars? And can a black hole be formed by other materials (non-stars).

Question: Although I know that a black hole can be formed by gravitational collapse of a massive dead star, I'm not sure whether a black hole can be formed by collapse of many stars.
Comment: The binary system of two neutron stars can collide and create a black hole . I think that was observed also via gravitational waves . As it turns out if you have enough of mass to be a black hole then it will be a black hole wherher they can collide and go supernova and create black hole . Or by collapsing a big star into its core we can get a black hole.
Answer: Recently with the LIGO experiment  two black holes were seen to merge into  one back hole.
It seems that  LIGO also may have detected two neutron stars merging into a black hole.

The object resulting from the merger is about 2.7 times the mass of the Sun. As the object continues to be studied, evidence is mounting that what was created in the process was a low-mass black hole (if true, this would represent yet another new class of black holes discovered by LIGO). Continued observations over the next several years may confirm or refute this notion.

Future observations will show.

The black hole responsible was Sagittarius A* (pronounced "Sagittarius A-star"), the supermassive black hole at the center of our Milky Way galaxy. Astronomers think that most large galaxies like the Milky Way should have supermassive black holes in their centers, but it wasn't until the past couple decades that they had compelling evidence that Sgr A* is our supermassive black hole.

There are  black holes in the center of galaxies, but whether it is a black hole eating a star, or two stars simultaneously merging into a black hole , I think it is a matter of modelling  and trying to find confirmation for the model.


What happen when changing column type for a table with clustered index?

Question: I have a very large table (200M+ row), and it is clustered indexed. I would like to change one of the foreign key column from a bigint to smallint.
My questions are:

Does SQL need to rebuild the clustered index?
What if this table is a heap and not a clustered index?
Answer: 1: If the column you're changing is part of the clustered index definition, then yes. If not, no. Any non-clustered indexes involving that column will have to be rebuilt when you change the column type, also.
2: A heap just means no clustered index, so nothing to rebuild. Same as answer #1 for non-clustered indexes.
Answer: If your table is a heap, you will get a lot of key lookups, which are performance wise not good.
If you have so much records in the database, you also might wanna take a look at partitioning your data. Spread it over multiple files and over multiple disks/raid configurations will speed up things very much!


Xcode C++ library location

Question: I'm pretty new to Xcode and C++. I was wondering if there is a place to store custom libraries so that I don't have to drag them into each project. I'd like to be able to just say '#include "mylib.h"'
Is that possible?
Comment: isn't this what "`/usr/local/lib`" is good for?  :-)
Answer: Mac like any other system use /usr/include, /usr/lib and /usr/local/include, /usr/local/lib.
Additionaly in XCode < 4.2 you can find headers and libs in /Developer/SDKs/MacOSX10.X.sdk/usr/lib
in XCode >= 4.3 this sdk is inside /Application/Xcode.app bundle
you can assign include directory using -I parameter to specify include dir path, and -L to specify lib dir path. Both can be add in build settings in project settings

Xcode C++ library location