Is it ok to add users to the 'apache' group?

Question: Are there any significant security concerns about adding users to the apache group?  I am a programmer and I need access to all the files/directories in httpdocs - is there anything wrong with adding my user to that group?
Answer: In your situation you do not want to do this as your intentions pose a significant security risk.
The Apache user/group should only have read access to the files in the web root. If your apache user has write access then you are open to having your application exploited and since it is running under a user that has write access, the attacker now has write access to your system.
I assume when you say that you need 'access' you mean that you want to write to the files. If you were going to achieve this by making yourself a member of the apache group, that would not meet your goal because (assuming you're running good permissions to begin with) your apache group does not have write access to the web files. You would also have to allow the group to write to the files in order to achieve what you want and then you're open to the type of attack I described in the second paragraph.
You should create a new group (www-admins or something) that has write access to those files and then add yourself to that group instead.
Comment: complete, 100% agreement ... Apache *should* *not* have write access to the document root.  If you're running PHP or similar CGIs that allow uploads that are then served, you might have a limited directory they can write to, but you need to make sure that PHP won't interpret files in there, unless you really like your server being compromised and having to blank it and reinstall.  (and you're still at risk for being used as a dropbox for online drugstore ads, PDFs with exploit code, etc.)
Comment: I'm with you so far, please help me understand a little more: The files in question are primarily extensions to the Joomla CMS, so a PHP page is unpacking a .zip file and copying the contents throughout the web directory. So I guess it must be the Apache user that executes the PHP scripts, right?  This ends up making it hard for a developer (Yours Truly) to edit these files.  Should the PHP page run under a different user or should the developer have different permissions?
Comment: What are you using to connect? If SCP/SSH then you need to be either the owner of the files or you need to be in the group that owns the files AND the files have to writable by the group. If you're using FTP, then things are a little harder to explain because various FTP clients elevate their users privileges in a variety of ways.
Comment: Using SSH primarily.
Answer: If you add apache user to your group - this is bad.
If you add you to apache group  - where is a problem ?
Comment: Because he's not only intending to add himself to the Apache group but he's also going to have to give the Apache group write access to the files order to achieve what he wants. Therefore Apache itself will have write access which is a security issue for the reasons I described.
Comment: This seems spot on. My user was added to the Apache group, but is still not able to edit the files belonging to Apache.  Which, I gather, is how things should be - I promise not to change that.
Comment: @KorjavinIvan - Would you mind explaining why it's bad to add the apache user to your user's default group? (I don't disagree with you; I just don't know, and I'd like to learn.)


Why do I have to define methods of reference classes inside of reference classes?

Question: Reference classes definitions can pile up quite some lines of code in R. When methods are defined inside a reference class a couple of methods plus the field definitions gives you a quite confusing class definition – at least it's hard to read at 300+ lines. And I have other issues:

roxygen2 documentation does not really work as out-of-the-box as for functions.
auto-suggest using the $ operator works for functions and lists of functions, but not for methods in RC, just for field names
I don't know you I could possible split method definitions to several files. All code of my package resides in 2 or 3 files that contain the classes defintions

So speaking in code, why should I not do something like this?
someDummy <- setRefClass("someDummy", fields = list(df = "matrix",
                                   multiplier = "numeric"))

test <- someDummy()

thingsYouCanDo <- function(){
 rc <- NULL
 mtrx <- NULL
 multi <- NULL
populate <- function(rc,mtrx,multi){
rc$df <- mtrx
rc$multiplier <- multi
}
multiply <- function(rc){
out <- rc$df * rc$multiplier
out
}
return(list(populate = populate,
         multiply = multiply))
}

te <- thingsYouCanDo()
te$populate(test,matrix(1:12,4,3),5)
test
te$multiply(test)

Are there any well written packages on CRAN that make use of RC and are documented well? Speaking of documentation, I do not mean a neat website, but .Rd based documentation.
What I have seen a lot lately in other people's source code is function that contain function or list of functions. Should I rather use that?
Answer: I have found part of an answer to my own question: the lme4 packages uses quite some RC classes and also documents them using .Rd


How do I get a Yongnuo YN-685 to wirelessly fire in MULTI with the YN622N-TX?

Question: I would like to use this setup so that two flashes both fire multiple times until the shutter closes. I can get the flashes to do this individually when attached to the camera, and I can get both to fire once, triggered by the YN622-TX transmitter, but cannot find a way to combine these functions. If any member has an answer, I would be very grateful.
Comment: Are you talking about High Speed Sync (HSS) or 'Multi' flash?
Comment: I'm not sure you can do it wirelessly with Nikon, which doesn't have the in-camera flash settings menu the way Canon does, unless there's been a firmware update for the YN622N-TX recently.
Comment: What camera are you using?
Comment: I am using a Nikon D500. The flash setting is Multi Mode (p13 in manual) which has a setting for the numbers of flashes as "---" which keeps it flashing until the shutter closes.
Comment: Have you tried setting the 'Multi' mode up on the flash *before* you put it into '622 Remote - Slave' mode? My Canon version lets me do that, and 'Multi' continues to show on the display, along with '622 Remote -Slave' after I press and hold the mode button. But the settings in my camera override that when I half press the shutter. Since Nikon bodies do not have internal flash control settings, if it doesn't send anything to override it, that might work with a Nikon camera.
Answer: Read the manual, it is all there although not super easy to understand. I have YN685 lights, this is how I get them to work in Stoboscopic mode remotely with a YN622C-TX. Put the lights into 622 slave mode. On the 622-TX press and hold the Mode/EM button (note: press AND HOLD not just press). It will display "TTL" in the top middle of the display. Press and hold this button again, it will then display "Multi". When in this Multi mode, short press the GR/* button to scroll through to the flash power, the HZ or the total number of flashes and use the four buttons up/down and left/right to change these settings once selected. Press your camera shutter release to test. Have fun!
Answer: The only way I've been able to get 'Multi (Stroboscopic) Flash' to work wirelessly via a YN622-TX is to set the multi settings via the in-camera flash menu of my Canon camera with the YN622C-TX set to 'Manual' for the group(s) I'm using in 'Multi' mode.

The flash should be set to '622 Remote - Slave'. The initial settings on the flash should be the "neutral" values: Power to 1/1, FEC to '0', and zoom to 'Auto'.
The YN622C-TX should be set to 'M' (manual) mode.
If you want to set the power level of each flash to a different level, then use the control panel on each flash to assign each flash to a different group.
You can set the power level via the YN622C-TX or via the camera's internal menu.
Use the camera's flash menu [External Speedlite control] → [Flash function settings] to bring up the flash function settings screen.
Set the cursor over the upper left corner, press the 'Set' button, and change the mode to 'Multi' and press 'Set' again.
Once 'Multi is selected, use the 'Quick Control Wheel' or the 'Joystick' to navigate directly below 'Multi'.
Set the cursor over the number for 'Flash count' on the far left and press 'Set'. Use the 'Quick Control Wheel' or the 'Joystick' up or down to select how many flash pulses you want to fire. Setting the value to [--] will cause the flash to fire at the set frequency for as long as the shutter is open. Once the value is at the desired setting, press 'Set'.
Navigate to the immediate right, set the cursor over 'Flash frequency', press 'Set', and use the 'Quick Control Wheel' or the 'Joystick' up or down to select the number of pulses per second. (Selecting '1' will fire one pulse per second. Selecting '2' will fire two per second/one every half second. Selecting '3' will fire three per second/one every one-third second, and so on.) The lowest value that can be set is '1', so pulses more than one second apart are not possible. The highest setting is '500'.
Be sure your set shutter time/speed is long enough to allow the number of pulses you have selected to fire at the intervals you have selected.

As long as I don't change the power level setting via the YN622C-TX, the flash will pulse per my settings each time I take a photo. If the power level (or any other setting) is changed everything will revert from "multi' to 'Manual' (with one pulse per picture). I'll then have to go back into the camera's menu to change it back to 'Multi'.
Since we now know you are using a Nikon camera, you can't use the camera's internal flash menu that Nikons don't offer. But that may actually be a way around why I have to do it that way with my Canon cameras. If the camera has no internal settings to override the settings on the flash, what you set on the flash before you put it in '622 Remote - Slave' mode may be preserved and allow you to set the 'Multi (Scroposcopic) flash' in the flash directly before pressing the mode button for a few seconds to put it into '622 Remote - Slave' mode.
Have you tried setting the 'Multi' mode up on the flash before you put it into '622 Remote - Slave' mode? My Canon version lets me do that, and 'Multi' continues to show on the display, along with '622 Remote -Slave' after I press and hold the mode button. But the internal flash settings in my camera override that when I half press the shutter. Since Nikon bodies do not have internal flash control menus, if it doesn't send anything to override it, that might work with a Nikon camera.
Comment: Michael Thanks for all the input. Unfortunately as soon as the flash is set to Slave mode, the settings revert back to a single flash.
Comment: Hmm. With my Canon version of the YN685. It still displays 'Multi' until it receives the signal from a shutter button half press. If you've got a version of the YN622N-TX with a USB port, there might be a firmware update that allows you to use 'Multi' wirelessly. MY YN622C-TX is late 2014 vintage and had a mini-USB port.


transmitting data to serial port using comm api in java

Question: I have a serial plotter (MP2300 GRAPHTEC..very old), that I am writing a java program with the Comm API  to communicate with it. I am using XON/XOFF (in the plotter setting) and in my java program.
I know for sure that there is a flow control issue between the computer and the plotter. After a while of plotting, the plotter draws erratic patterns in the middle of the drawing. If I introduce a delay after sending a chunk of the file (I am delaying 1 seconds every 10 commands sent to the plotter), the drawing is perfect.
My question:
Do I have to read data from the plotter to find out if there is a XOFF issued by the device, or that is already taken care for within the API?
Answer: If you are using a OS driver, then it is already taken care of. The application don't need to worry about.


How to turn off Cursor Blinking in Lubuntu?

Question: I have a small netbook and the writing cursor pretty much disappears when i move it around with the arrows in docs. I switched from Ubuntu where I had the Cursor Blinking off in Universal Access. That use to solve the problem.
Comment: What release of Lubuntu?   An old one using LXDE or a modern one with LXQt?
Comment: Have you tried changing the cursor to a different one, in my play just now I've found some have very thin text cursors, whilst others have much thicker (and easier to spot).  Refer https://manual.lubuntu.me/3/3.2/3.2.2/appearance.html?highlight=cursor
Comment: I have lubuntu 18.04 with LXDE
Answer: There's a short answer and a long answer to this.
Short answer
Lubuntu 18.04/LXDE
Sorry, there is no easily accessible option.
However, there is a hidden feature in LXSession that can help. You can change the config like so:
~/.config/lxsession/Lubuntu/desktop.conf
[GTK]
iNet/CursorBlink=no

and log out and log back in again to make the change.
Lubuntu >18.04/LXQt
lxqt-config-input offers an option to adjust the blink rate. To set it to non-blinking:

Navigate to Menu » Preferences » LXQt Settings » Keyboard and Mouse » Keyboard.
Set the Cursor flash time to 0ms.
Click Apply.
Click Close.

The Lubuntu Manual covers lxqt-config-input in greater detail.
Long answer
Technically, both solutions are only changing the settings for the underlying toolkit— GTK and Qt, respectively. In ≤18.04/LXDE, Lubuntu used mostly GTK apps, while after it was mostly Qt apps. That doesn't mean you couldn't install Qt apps in the mainly GTK system and vice versa. The changes above would not affect those "foreign" apps. The more general solution for the two respective toolkits follows.
GTK
Change the config for both current GTK versions:
~/.config/gtk-2.0/settings.ini and ~/.config/gtk-3.0/settings.ini
[Settings]
gtk-cursor-blink = false

Qt
This should be a simple matter of changing the Qt config with the likes of the following:
~/.qt/qtrc
[General]
cursorFlashTime=0

~/.config/Trolltech.conf and ~/.config/QtProject.conf
[Qt]
cursorFlashTime=0

or through the qtconfig application (see the qt-qt4config package in 18.04) via Interface » Cursor Flash Time » No Blinking but I could not get this to work in 18.04.
There is a page that covers this topic more generally for a variety of different applications, toolkits, and desktop environments that would be good to consult for any edge cases.


vibrational motion in gases

Question: In a debate, I argued that vibrational atomic movement as cause of internal energy is prominent in solids (due to their crystal structure) and it is not prominent in gases. I think this also applies to heated solids/gases, ie. heated gases will have more translational or rotational kinetic energy and not vibrational, while in solids it's the opposite. Is this true? And how can I find data to support it?
Answer: Generally speaking you are right.
Vibrational motion in solids is represented by phonons which can have energy very close to zero (See wiki). In molecular gases (atoms don't vibrate on their own) there is a minimum energy required to initiate vibration. It is also true that there is a minimum energy for rotation but that one is smaller.
Thus at low temperatures you will have no vibration in gasses and some vibrations in solid. At high T (above Debye T) it will not matter anymore.
Comment: Thanks but my point is to have vibrational motion you have to have the atom/molecule inside such a forcefield that will make it vibrate, which is not possible in gases in most cases (I can't comment on extreme temperatures where the molecules go crazy). At the same time, I believe only a microstructure of strong intermolecular/interatomic forces is necessary for the atoms/molecules to vibrate. Is this true?
Comment: I am not sure I understand you. The strength of the bond between atoms is  not much different in crystal and in molecules. And vibrations which I am talking about are thermal, so the thermal energy kT which "makes them vibrate" is the same as long as temperature is the same. It  is only the question of the type of vibration which can exist. In crystals, low energy vibrations have with extremely large period. These you simply cannot have in molecules (i.e. gaseous state).
Comment: So if you have a single gas atom/molecule (depends on the gas) and you heat it up, it will vibrate? What is the mechanism of its vibration, given that it does not experience any force from other molecules around
Comment: atom will not vibrate. Molecules you can consider as atoms on the spring (in a very rough approximation). They are bound by chemical bond but close to equilibrium this bond behaves very much like a spring.
You can initiate vibration by collision with another energetic molecule. But the vibration itself is like a vibration of the spring - it is internal property of the spring. You need only initial kink and then the vibration will go on. So for molecules this kink has to have minimum energy, otherwise vibration will not start.
Comment: I see, it's like what I had in mind: it is different the inner vibration between the atoms of a molecule and different vibration of the molecules themselves as a whole
Answer: The Equipartition Theorem states that for every energy term depending on a $n^{th}$ power of a coordinate on phase space (positions and momenta), a system will have, at temperatura $T$, avarage energy $\frac{1}{n}k_bT$.
For exemple, in a monoatomic gas we may write the energy of an atom in terms of it's momenta $$E=\frac{p_x^2}{2m}+\frac{p_y^2}{2m}+\frac{p_z^2}{2m}$$ Since we have 3 squared terms of phase space coordinates, we have an avarage energy per atom of $3\times\frac{1}{2}k_bT$, or a total energy of the gas with $N$ atoms of $\frac{3}{2}Nk_bT=\frac{3}{2}RT$. The energy here is dependent only on the molecules translation.
In a gas in which there is also vibration and rotation, new terms will show up on the energy expression above, and each squared term will add $\frac{1}{2}RT$ to the energy of the gas, which will be $$E=\frac{3}{2}RT+E_{vibration}+E_{rotation}$$
In a solid, however, the situation reverses itself. Since the atoms do not have translational or rotational dgrees of freedom, the energy equation will only include coordinates associated with vibration. And the energy will depend only on the solid's vibrational modes.
Answer: translational motion is caused due to UV radiations which are of less energy,also rotational motion is caused due to microwave which too is of less energy but  vibrational energy is caused due to infrared which has high energy and is not possible to have at room temp. that is why we do not consider vibrational motion in degree of freedom of gases.
Comment: You are confused about energies associated with various spectral regions.  And your conclusion I'd not quite right.
Answer: This animation shows the kinematics of an ideal gas.

This is a classical statistical mechanics framework.
At most single atoms may , by the scatters, acquire a rotational energy, there is no possibility of vibration. If the little dots are molecules, there exists a bond that gives a vibrational degree of freedom.
Here is a discussion of quantum statistics , which is another story.

In this section we will discuss situations where quantum effects are important. We'll still restrict attention to gases — meaning a bunch of particles moving around and barely interacting — but one of the first things we'll see is how versatile the idea of a gas can be in the quantum world.
Answer: Heat capacity of gases
Let's consider a usual gaz, ie. a diatomic gas, we will use the equipartition theorem to find its heat capacity. Its energy is
$$ E = E_{translation} + E_{rotation} + E_{vibration} $$
However, $E_{translation}$ depends on $v_x^2$, $v_y^2$, $v_z^2$, so
$$C_{translation} = \frac{3}{2}RT$$
Rotation of a diatomic molecule has two degrees of freedom, each of those depending on the rotation speed squared, so
$$C_{rotation} = RT$$
Finally, if the molecule hasn't too much energy, it acts like two harmonic oscilators, whose energy depends on the distance to the center of mass of the molecule squared, so
$$C_{vibration} = RT$$
Finally, since rotation is activated at lower temperature than vibration, if $C \in \{\frac{3}{2},\,\frac{5}{2}\}RT$, then vibration isn't activated. Else if $C = \frac{7}{2}RT$, it is prominent.

According to this diagram (from Wikipedia), it seems that vibration is prominent for heavy molecules, at high temperature, but we can neglect it for small molecules, or at low temperature (you could say that this diagram can't help us distinguish between rotation and vibration, yet a quantum model would confirms this).
However, there is clearly a problem in our model: we must use quantum mechanics to have better results. See for example the quantum harmonic oscillator.

Heat capacity of solids
For a solid, the Dulong-Petit experimental law states that
$$C = 3RT $$
so, according to the equipartition theorem, the internal energy of a solid depends on 6 quadratic terms. All directions are equivalent for a molecule in a solid (it can move and rotate in the three directions), so translation, rotation and vibration would contribute by a factor of $\frac{3}{2}RT$ to the heat capacity. Then, we can say that only two of these three contributions are prominent.
However, we can't say which one of them is, only based on the Dulong-Petit law: it could be vibration-rotation, vibration-translation or rotation-translation. However, using Debye or Einstein quantum model, we can confirm the hypothesis saying that the internal energy of a solid is due to translation and vibration.
Conclusion
Finally, you were right: in most solids, vibration and translation are prominent in internal energy, while in common gases, translation and rotation are prominent while vibration is negligible. Yet, in both cases, relatively complex models are needed to explain what is measured experimentaly.

vibrational motion in gases


Zero and Megaman Zero? What is the difference?

Question: I am so confused, in Zero's ending on Marvel vs Capcom 3, Silver Surfer takes Zero to the wrong world. Zero says that he is NOT Megaman Zero. What is the difference I thought there was only one Zero.
Comment: What exactly is "the wrong world" in this scenario? Which world did he take him to?
Comment: he took him to "Neo-Arcadia", which I thought was the right place, (and it is) but Zero says that it wasn't his world cause he was not "Megaman Zero".
Comment: @JustinCoolestnerdRobinson, he says "yes.. this is indeed Neo Arc.. wait.. something is wrong". Though the discussion that follows, I interpret that it is the right world, in the wrong dimension. Like SS had taken him to an alternate reality of his true world.
Answer: There is only one Zero. The Zero featured in the Megaman X and Megaman Zero series are the same, although Zero is 100 years older in the Megaman Zero series.  The Marvel Vs Capcom 3 cut scenes are non-canon, and play no role in the storylines of the respective franchises.
The Mega Man wiki contains the full history of the character if you are interested.
Comment: @JustinCoolestnerdRobinson it doesn't mean anything, it's just a joke. The Marvel vs Capcom 3 cut scenes are only intended for entertainment purposes. They are in no way canon.
Comment: So what he is saying is that he is not Megaman Zero BUT Zero meant only for the purposeses MvC3?
Comment: Oh ok gotcha ... I thought they at least tried to make them make sense in the universe I guess the Zero one is just a bad joke. would have been cool if they made it make sense.
Answer: The difference is that megaman zero is Zero`s soul in his new body from the zero series. Zero, x, and the sage reploids are all called megamen.
Answer: Zero and Megaman Zero are not the same, that was what Capcom was trying to clear up. Think about it, why would Capcom even say that at all. Because they knew people would ask what happened to Megaman Zero. People let me tell you this, video games never go from home console to handheld's, the home console is Megaman X's universe and the GBA was Megaman Zero's universe.
Story wise the two run side by side but the outcome was not the same. Yes Megaman x6 x7 x8 was cannon whether you like it or not. And things don't match up from the Zero universe to the X so yes Capcom was right to show this.
Comment: And what is the difference between the two?
Answer: From a Yahoo! Answers post by user, Quinn:

Mega Man X is Dr.Light's final and finest creation, the most advanced robot in the world, a robot capable of human emotions and self thought. X was found by the leading autority of robotics of his time Dr.Cain. Copying X's complex curcuitry, Dr.Cain and X created the reploids, replicated androids, and ushered in a new age of advanced robots. X joined the Maverick Hunters, a reploid police force that protects the innocent from rampaging reploids who become irregular, or maverick.
X is blue like his predecessor Mega man and uses an X-buster, an advanced arm cannon with upgradable systems that not only allows weapon copying, but also weapon charging with the right upgrade
Zero is the final creation and greatest masterpiece of Dr.Wily, the rival and enemy of Dr.Light. Zero was created to be the strongest robot in the world, and its greatest destroyer. Zero was created with the Zero Virus, a deadly program that corrupts and changes a robot into a mindless destructive machine.
Zero was discovered by a unit of Maverick Hunters who cornered him in an old laboratory and was considered a deadly maverick that destroyed many reploids and corrupted more with his virus. Eventually, Zero was subdued by the most advanced and strongest Hunter, Sigma, and couldn't recall his past or his destructive behavior. He has since joined the Maverick Hunters and under Sigma's training quickly rose to high rank and leader of his own unit.
Zero is red-orange robot with long flowing blonde hair who specializes in hand to hand combat with a beam sabre, he also possesses his own Z-Buster arm cannon. Rather than given the ability to copy and integrate the weapon of an opponent, he instead has the ability to learn its skill
The Megaman X series is a moderately challenging series geared toward mature players.
  Megaman Zero is a game series starring Zero, which is definitely geared toward advanced players. It is set 100 years after the X series.


Why doesn't the light get out?

Question: You're standing on a gedanken planet holding a laser pointer straight up. The light doesn't curve round, or slow down as it ascends, or fall down. It goes straight up. Now I wave my magic gedanken wand and make the planet denser and more massive. The light still doesn't curve round, or slow down as it ascends, or fall down. I make the planet even denser and more massive. The light still doesn't curve round, or slow down as it ascends, or fall down. I make the planet even denser and more massive, and take it to the limit such that it's a black hole. At no point did the light ever curve round, or slow down as it ascends, or fall down. So why doesn't the light get out?
Comment: I thinm this is a duplicate of [Speed of light in a gravitational field?](http://physics.stackexchange.com/q/77227/). I won't flag it as such because that would immediately close your question, but I thnk you should have a read through my answer to the question I've linked.
Comment: You might also want to have look at [If you shoot a light beam behind the event horizon of a black hole, what happens to the light?](http://physics.stackexchange.com/questions/106484/if-you-shoot-a-light-beam-behind-the-event-horizon-of-a-black-hole-what-happens) and for a more technical discussion [Would the inside of a black hole be like a giant mirror?](http://physics.stackexchange.com/questions/111924/would-the-inside-of-a-black-hole-be-like-a-giant-mirror).
Answer: The problem with you argument is that you are standing on the planet! When you make it denser and denser and eventually turn it into a black hole, you would still be standing on it, ie be outside the event horizon, so as you are saying correctly the light will escape.
If you would like to think about being inside the event horizon then it's wrong to imagine yourself standing on anything, because there can be no static observer inside an event horizon. You would be falling instead.
The correct analogy would then be this: Imagine falling from a very high mountain and also imagine throwing a heavy rock upwards on your way down. To you, it might look like the rock is moving upwards and the distance between you and the rock will be increasing, but to an observer on the ground the rock is also moving downwards, just at a smaller initial velocity (because of your initial push) and even though you are both moving in same direction, the distance between the two of you is increasing because you are moving at different speeds.
In the same way, light that you think you have emitted outwards when you have crossed a black hole horizon, is in reality also falling in right behind you.
Comment: Thanks for responding Heterotic, but see this in John Rennie's answer to a related question:
Comment: _The obvious example of this is a black hole, where the speed of light falls as it approaches the event horizon and indeed slows to zero at the event horizon_. When I ask this question, responses appear to be contradictory, so much so that some people prefer not to answer, and we can't thrash it out.
Answer: That's just strong equivalence principle. Standing still on a planet is getting accelerated upward. Light is going at the speed $c$ only for inertial observers, that is, for the ones free falling. It is a big misconception to claim that light doesn't "slow down" as it ascends, for you standing still on the planet. Where do you think that red shift comes from ? It comes from this effect, nothing else. So your ray of light will eventually become darker and darker, and even if by ascending it won't "slow down" (the more it climbs into the sky, the less it feels gravitation, so the less it is falling downward, that is the quickest it escapes from you on the ground), it can happen that at some point it just doesn't ascend at all into the sky after it goes out of your laser beam and fall! (obviously, with you before)
edit: for you to understand better what I mean, you have to understand that if you're stationary ahead of a planet (that is, at a constant radius) without rotation, then you're actually getting accelerated a lot upward, otherwise you would simply fall. This is the same on the ground. The ground is accelerating you a lot upward unless it cannot resist to turn into a black hole. Hence, to answer your comment, inside a black hole there is no stationary point, because it would mean that it is possible to get accelerated more than you physically can, so even light has to fall. This in some sense means that there is some maximum acceleration (actually, a maximum gravitational field)

Why doesn't the light get out?


What is the difference between %f and %lf in C?

Question: I have seen these two parameters in a C example in a C book, but the author didn't elaborate what the difference between the two is. I know that %f specifies that a float should take its place. I have tried looking this up but have had a hard time finding an explanation. What about %lf?
Comment: Rather than looking up `%f` and `%lf`, did you try looking up `printf` or `fprintf`?
Comment: You might find [this `printf` (and family) reference](http://en.cppreference.com/w/c/io/fprintf) handy. Of course there's also [a reference for `scanf` (and family)](http://en.cppreference.com/w/c/io/fscanf).
Comment: In the C standard look up "The fprintf function" , it covers everything
Comment: Read the documentation of [printf(3)](http://man7.org/linux/man-pages/man3/printf.3.html) and of [scanf(3)](http://man7.org/linux/man-pages/man3/scanf.3.html)
Answer: The short answer is that it has no impact on printf, and denotes use of float or double in scanf.
For printf, arguments of type float are promoted to double so both %f and %lf are used for double. For scanf, you should use %f for float and %lf for double.
More detail for the language lawyers among us below:

There is no difference between %f and %lf in the printf family. The ISO C standard (all references within are from C11), section 184.108.40.206 The fprintf function, paragraph /7 states, for the l modifier (my emphasis):

Specifies that a following d, i, o, u, x, or X conversion specifier applies to a long int or unsigned long int argument; that a following n conversion specifier applies to a pointer to a long int argument; that a following c conversion specifier applies to a wint_t argument; that a following s conversion specifier applies to a pointer to a wchar_t argument; or has no effect on a following a, A, e, E, f, F, g, or G conversion specifier.

The reason it doesn't need to modify the f specifier is because that specifier already denotes a double, from paragraph /8 of that same section where it lists the type for the %f specifier:

A double argument representing a floating-point number is converted to decimal notation

That has to do with the fact that arguments following the ellipse in the function prototype are subject to default argument promotions as per section 22.214.171.124 Function calls, paragraph /7:

The ellipsis notation in a function prototype declarator causes argument type conversion to stop after the last declared parameter. The default argument promotions are performed on trailing arguments.

Since printf (and the entire family of printf-like functions) is declared as int printf(const char * restrict format, ...); with the ellipsis notation, that rule applies here. The default argument promotions are covered in section 22.214.171.124 Function calls, paragraph /6:

If the expression that denotes the called function has a type that does not include a prototype, the integer promotions are performed on each argument, and arguments that have type float are promoted to double. These are called the default argument promotions.

For the scanf family, it mandates the use of a double rather than a float. Section 126.96.36.199 The fscanf function /11:

Specifies that a following d, i, o, u, x, X, or n conversion specifier applies to an argument with type pointer to long int or unsigned long int; that a following a, A, e, E, f, F, g, or G conversion specifier applies to an argument with type pointer to double; or that a following c, s, or [ conversion specifier applies to an argument with type pointer to wchar_t.

This modifies the /12 paragraph of that section that states, for %f:

Matches an optionally signed floating-point number, infinity, or NaN, whose format is the same as expected for the subject sequence of the strtod function. The corresponding argument shall be a pointer to floating.
Answer: For scanf, %f reads into a float, and %lf reads into a double.
For printf: In C99 and later, they both are identical, and they print either a float or a double. In C89, %lf caused undefined behaviour although it was a common extension to treat it as %f.
The reason that one specifier can be used for two different types in printf is because of the default argument promotions; arguments of type float are promoted to double when used to call a function and not matching a parameter in a function prototype. So printf just sees a double in either case.
Answer: For output using the printf family of functions, the %f and %lf specifiers mean the same thing; the l is ignored. Both require a corresponding argument of type double — but an argument of type float is promoted to double, which is why there's no separate specifier for type float. (This promotion applies only to variadic functions like printf and to functions declared without a prototype, not to function calls in general.) For type long double, the correct format specifier is %Lf.
For input using the scanf family of functions, the floating-point format specifiers are %f, %lf, and %Lf. These require pointers to objects of type float, double, and long double, respectively. (There's no float-to-double promotion because the arguments are pointers. A float value can be promoted to double, but a float* pointer can't be promoted to a double* because the pointer has to point to an actual float object.)
But be careful using the scanf functions with numeric input. There is no defined overflow checking, and if the input is outside the range of the type your program's behavior is undefined. For safety, read input into a string and then use something like strtod to convert it to a numeric value. (See the documentation to find out how to detect errors.)
Answer: The width modifier in %lf is gracefully ignored by printf().  Or, to be more accurate, %f takes a double - varargs will always promote float arguments to double.


Resistance of car battery

Question: In my textbook, it is given that internal resistance of a car battery increases with decreasing temperature. But car batteries contain lead, which is a metal, and hence the resistance should decrease. Where am I wrong?
Comment: Batteries also contain an electrolyte containing ions whose mobility decreases with decreasing temperature.
Answer: If the battery only contained lead, you might be on to something. However, batteries are made with both metals AND something to transport the charges, called an "electrolyte". This is normally a liquid, and liquids have less motility as they get colder. This motility refers to the speed with which something can move through the liquid.
Comment: Less motility would mean more relaxation time for each ion, then shouldn't resistivity (and hence resistance) decrease (as it happens in metals)?
Answer: Chemomechanics is right. Inside a battery, the dominant contribution to the internal resistance is not the lead plates but the powerful acid solution the lead plates are immersed in, and the boundary layer between the acid and the lead surfaces. Those resistivity effects are driven by chemical kinetics, most of which are slowed by lowering the ambient temperature and speeded up by raising the temperature.

Resistance of car battery


PIP by your subordinate

Question: I am the GM of a Plant and have been there for 9 years. Last year my HR Manager became upset at me over her salary negotiation. She happens to be my Payroll Manager also and complained because of what I made compared to her. She started to have people resist every direction I gave and refused to participate in areas I was working on to improve our training because she did not agree. She then went to all the employees and asked them to write any complaints they had against me and to keep a log so she could turn them into our corporate office. After a few month's she had a solid band of supporters and sent all the letters
to Corporate.
I still do not know anything that was written, but our Corporate President and HR wanted to put me on a PIP and let our local HR and another of my reports administer it with weekly meetings. I could not manage them anymore since if I said anything negative it would be considered retaliation. They continually sent inaccurate PIP meeting notes to our Corporate HR. She told me as long as I just left everyone alone we could "move on". Other areas were needing help and when I did step in and insist on actions, she let our Corporate know I was intolerable to work with and her band of supporters backed her up. I am now losing my job because I couldn't "manage the situation".
I guess my question is, has anyone ever heard of them letting direct reports administer their bosses PIP?
Comment: Why does it matter if anyone has ever heard of this? You're not going to get your job back either way. Sorry if that seems harsh, but you're asking the wrong question here.
Answer: Yes! That's the only way a remote corporate HQ will know about management that is ineffective.
However if another employee is rallying the troops then I'm sure there is a policy against that. Check your HR hand book and consult an attorney to see if you can keep your job and if there is any legal ground to fire you.
Even if you win, you should probably seek a new position elsewhere.
Comment: Unless some kind of coercion is involved in the rallying, it's probably not a bad thing. Everyone seems to have decided on who the leader is there.

PIP by your subordinate


Drawing a prism with CoreAnimation

Question: I'm trying to draw a prism and animate it with CoreAnimation. But I can't find a good solution to draw the fan of rainbow colors.

There a a couple of ways to do that, each of them has disadvantages:

I could simply use an image. But I allow the user to zoom into the scene and I'd like to avoid any artefacts.
Using a CAGradientLayer produces a nice rainbow. Unfortunately there is now skew (or squeeze) transformation available to transform the rectangular rainbow into a triangle.
A simple skew effect of the layer can be obtained by modifying the m34 matrix element of the layer's transform matrix. But I wasn't able to obtain a triangle shape (because the layer would have to be of infinite size).
OpenGL. That'll work, but maybe there's a simpler way.

Any suggestions?
Answer: You can achieve any kind of quadrilateral by modifying transform property of CALayer. AGGeometryKit has some nice tools to make CATransform3D for a quad.

Drawing a prism with CoreAnimation


Forms Authentication, allow / to be seen by all

Question: I am using forms authentication to secure my application.
I have the following in web.config:
<authentication mode="Forms">
 <forms loginUrl="Login.aspx" name="ProjectName" defaultUrl="Users.aspx" slidingExpiration="true" timeout="2000" path="/" />
</authentication>

<location path="default.aspx">
 <system.web>
  <authorization>
   <allow users="*"/>
  </authorization>
 </system.web>
</location>

This is allowing me to get to www.mysite.com/default.aspx, but I would like to be able to get to www.mysite.com, but when I try to navigate to that URL it redirects me to the login page.
Answer: <location path="/">
 <system.web>
  <authorization>
   <allow users="*"/>
  </authorization>
 </system.web>
</location>

Comment: I get a 500 when I add this to web.config
Answer: Pay attention to allow/deny elements: http://msdn.microsoft.com/en-us/library/8d82143t
<deny users="?" /> -- will deny access to all anonymous users, and redirect them to login page
<allow users="*" /> -- will allow access to all users, even anonymous, without redirect to login page.

And <location>:
<location path="/">

Where path could be:
"/" - is for root dir(and inner)
"file_or_dir" - restricts only the specified file or directory


Axis of an object change direction with camera

Question: I'm new to Blender and recently on my first creation. However, I encountered a  problem - the axis of an object flips (changes its direction) as I move the camera around the object. For example, whenever you start a new design, you will only be able to move the cube in six directions - up, down, left, right, back, forward. In my case, the directions of arrows will change. Is there any way to return the setting back to normal so that the axis won't flip?
Comment: Welcome to Blender.SE! First thing I would check is the transformation orientation of the gizmo. What is it set on? Probably a screenshot of your screen would help in understanding your situation.
Answer: I am not too sure but I think I know how to fix it. Change the objects  transformation orientation from view to local/global.
First you need to select the object and then there should be an option at the bottom toolbar

Choose global or local, I am not sure which one you want but global is probably what you are asking for. The difference between local and global is that if you rotate the object in local the arrows would also rotate, while in global the arrows would always point in the same direction. Hope this help
Note: I assumed that by camera you meant view as there is a camera object in blender.
Comment: @alexander aganfonov  No problem


What coordinate system is used in space for navigation?

Question: On Earth is possible to define the position of something using WGS, and the same system is used for navigation. What is used in space instead? Are different systems used for Earth-orbiting objects (the ISS for example) as opposed to objects beyond LEO (Voyager 1/2) due to practical reasons?
Comment: This is a very broad question. To solve practical problems in space exploration, it is necessary to use **many** reference frames: fixed and rotating, with many points as origin - Earth, other bodies, Solar System Barycenter (or other barycenters), the spacecraft, ground station, etc. Coordinates may be expressed as spherical, geodetical, cartesian. You may start reading from [this article](https://en.wikipedia.org/wiki/International_Celestial_Reference_Frame).
Answer: While coordinate systems are used for all sorts of things in space flight, from your position in the solar system down to individual instruments, I'll assume for the purposes of this question that you're talking specifically about coordinate systems used for determining satellite position relative to something.
Also, I'm going to assume you're really interested in reference frames, instead of coordinate systems. For the reference frames I'll talk about, Cartesian coordinates are typically used (Keplerian elements are, of course, another popular alternative).
Earth-orbiting satellites
There are two main types of reference frames: inertial and rotating. Specifically, when they're Earth-centered (origin at the center of the Earth, as they nearly always are, except when dealing with measurements from the Earth's surface), the two main classes are Earth-centered inertial (ECI), and Earth-centered, Earth-fixed (ECEF). ECI frames have axes defined by some inertial reference, such as pointing one of the axes at a specific star or constellation. The Earth rotates in these axes (i.e. the ECI axes do not correspond to any fixed location on Earth's surface). Alternatively, ECEF frames rotate with the Earth.
There are many variations on these two frames, and most of them have to do with how they account for the precession and nutation of the Earth.
Other
This is a much more broad category, but generally they tend to be barycentric frames. You could define a reference frame with the origin at the barycenter, or center of mass, of several bodies (usually two, e.g. Earth-Sun or Earth-Moon).
The International Celestial Reference Frame (ICRF) is valid throughout the solar system, and has its origin at the barycenter of the solar system.
Of course, if you have a mission to, say, Mars, you would define a Mars-centric reference frame to work in.
Comment: What distinction are you drawing between reference frame and coordinate system?
Comment: @Acccumulation Coordinate system transforms cannot change the magnitude or direction of a vector, only the numbers assigned to it.  Frame transforms can, for they can change equations of motion.  For example, they can add rotating-frame effects to velocities and accelerations.  Coordinate systems are really just nothing more than bookkeeping, but picking the wrong frame for your problem can be quite the pain!
Comment: @CortAmmon What do you mean by "magnitude" and "direction"? Frame transformations can't change proper time.
Comment: @Acccumulation Consider an object in geosynchronous orbit around the Earth.  Its velocity vector in the ECEF frame is 0.  Its velocity vector in an ECI frame is a non-zero vector, whose speed is the orbital speed of the craft.  Its acceleration vector in the ECEF frame is 0, while its acceleration vector in an ECI frame is a vector pointing at the center of the Earth, with a magnitude that is the acceleration of gravity.
Comment: These are not simply scaling and/or offsetting of numbers in a coordinate vector (an [x, y, z] triple).  The vectors themselves actually change when one does a frame transformation on them.  If it were merely a coordinate transform, all I would need to know about a vector is its value as a coordinate vector [x, y, z] and a function which transforms [x', y', z'] = f([x, y, z]).  In a frame transform, however, I also need to know what the vector was describing, as velocities may transform differently than accelerations.


When can I remove directory validation script?

Question: When I apply to add my website to a directory, it asks to add some script to my homepage or index page to validate the website. At what point can I remove this script? I want to add my site to various directories, but don't want to add lines of script to be there permanently.
I'm assuming it is just for the initial validation and can be removed after submitting the site..?
Answer: That's going to depend from site-to-site. Some only want to initially validate your site to make sure it is legitimate at the time of submission. Others will require it as they periodically check to maker sure your site is still there as they try to keep their directory fresh and prevent dead links.
Considering how little traffic and SEO value these directories offer, I wouldn't be concerned with removing them. I'd rather have a tidy site then a mess just to keep them happy.
Comment: Directories have little SEO value. Really...?
Comment: Yes Really, Google and other search engines have nuked the hell out of user generated content. What this is means is web directories, articles, profiles on forums etc are generated by the user and therefor can use used to manipulate search results, Google doesn't want Webmasters making links, it wants webmasters to focus on page SEO. The only web directories you should ever consider are niche directories, these still pass some authority if the site is well administrated with a no BS policy on who they link too.
Comment: Also, most web directories have duplicate content because the businesses or site owners use the same description on ever directory, so again.. Only ever consider a web directory that is a) Good, B) Specializes in your Niche with no other Niches C) Looks well administrated. D) No return link, a two way link is weakened because your returning the flow, enough 2 way links and your feel the wrath of Google, as they do no favor mass link exchanges.


Where can I get an up-to-date list of countries that are under US sanctions?

Question: I am a regular freelancer in a company. I like to travel during work and vacation.
But at my new job, they told me that I can't visit countries that are under US sanctions.
Where can I get this list ? A list of places where from the point of view of the United States it is impossible to go ?
Answer: The US has sanctions against the following countries:

Iran
North Korea
Syria
Cuba
Venezuela
Turkey

And combined, the Treasury Department, the Commerce Department and the State Department list embargoes against the following 30 countries or territories:

Afghanistan, Belarus, Burundi, Central African Republic, China (PR),
Côte d'Ivoire, Crimea Region, Cuba, Cyprus, Democratic Republic of the
Congo, Eritrea, Fiji, Haiti, Iran, Iraq, Kyrgyzstan, Laos, Lebanon,
Liberia, Libya, Myanmar, North Korea, Palestinian Territories, Russia,
Rwanda, Somalia, South Sudan, Sri Lanka, Sudan, Syria, Venezuela,
Yemen, Zimbabwe.

However, a sanction or embargo does not necessarily mean travel to that country is prohibited - each will have its own particular set of rules.
For example, notwithstanding any specific Covid restrictions, an American citizen may travel to freely to the Republic of Cyprus but will require State Department permission  to visit North Korea which is available only in exceptional circumstances.
Answer: U.S. Department Of The Treasury Sanctions Programs and Country Information page has the list of countries and the sanctions programs active towards them.


What is the best way to print columns from different tables on the same row using the Axapta reporting tool?

Question: It seems like each body section in an axapta report can only print columns from a single table(consistantly).  For instance:
I have a report that has the following tables: SalesLine, InventTable and CustTable.  Then I would like to print columns from each of this tables on the same row.  It seems like I can do this when placing the fields in programmable sections but not when I place them in body sections.
I have found a few workaround that are either ugly or non-performant.  There has to be a nice clean way to do this?
Comment: Which version of AX are you using?
Answer: It should be possible to do this, there are several reports in the base system that work this way. Look at the SalesContractShipment report in 4.0 as an example.
On your report, create a datasource for SalesLine, and under that create datasource each for InventTable and CustTable. On InventTable and CustTable, make sure the FetchMode is set to 1:1. If you create a custom fetch method, make sure you call send() in the correct order.  You should send CustTable first, then InventTable, then SalesLine last. On the report design, create a single body for SalesLine. You should then be able to use fields from any of the three tables in that body.
If you are still having trouble, I can think of two work arounds. One is to create a view based on those three tables, and create a report based on that view. The other is to create the report based on SalesLine and use displayMethods to lookup any fields you need from InventTable or CustTable.
Answer: You should be able to add multiple data sources to a report then create one body for the first data source that you added. Right-click the body and select New Control -> Field From AnyTableThatIsADataSource. You can then add any field that you want and it will print columns for all of those fields.
Answer: Put all the fields in the last SourceTable_Body and it'll show all the fields, because the QueryRun table by table and fill the body with each corresponding Body, so the last body will have all fields' data.
Answer: Consider using temporary tables. Fill it with your data first, than use in the report.


Why did the Borg ignore the rest of the Enterprise-D?

Question: I understand why they kidnapped Picard, but why did the Borg ignore the rest of the Enterprise-D in the Star Trek TNG episode "The Best of Both Worlds"? Why not assimilate all on the ship? They only assimilate Picard.
Comment: If Picard is the ambassador then the Enterprise is the embassy. Neither is wanting to destroy the other ship at that point. Riker's job doesn't change; he's still subordinate to Picard (because humans are trite, so... this is better than perfect). They want all of humanity, not just this crew, whom follow them home to 001 anyway, presumably to await their turn to be assimilated in an orderly fashion because a guy with a British accent says to queue up.
Comment: "Why not [transport *eleven hundred people* all at the same time?]" - The whole reason we're doing this is so that we don't have to screw around doing it piecemeal.
Answer: There isn't a specific trope for something like this besides maybe "The Show must go on", So I will call it,
The Plot Must go on!
If the Borg just blew up/killed/assimilated everyone on board, there wouldn't be a show.
The reasoning for the Borg to take Picard was to use him as a spokesperson when dealing with humanity and the Federation and getting valuable data from him. The rest of the crew was irrelevant.
They had a specific goal and ignored the rest. Which is typical Borg.
Comment: I would say Picard was a 'spokesborg' rather than a spokesperson. After all, his identity was borgified.


Very weird directory when editing a function in Fish

Question: I am just curious what the meaning is of this bizarre directory from which atom is launched to edit a function from the Fish shell. Anyone have any idea?
Answer: /var/folders can be thought of as macOS's modern way of doing /tmp. It's a place for apps to write temporary files, so that your data is safe/recoverable even if you haven't explicitly saved your edits/changes yet. The random-ish names avoid name collisions.
If you do a…
sudo find /var/folders | more

…you'll see that lots of apps and services write stuff there.
Answer: When you use the funced fish command it writes the function definition to a temporary file then launches your editor with the name of that file. As @Spiff points out in his answer the specifics of the temporary file name depends on the OS. It is also affected by environment variables such as $TMPDIR. The reason such "bizarre" path names are created is to avoid collisions with temporary files created by other processes.
Comment: Thanks. Does any of you know why when I launch atom that way, it doesn't work? The window comes up empty, and when I type into it and save, it doesn't update the function. Doing the exact same thing with nano does work...
Comment: Probably because atom is detaching itself from the foreground. Many graphical editors (i.e., those that run in their own window) do so. You need to run it with an option that keeps it from detaching from the foreground. For example, if you want to use Vim in GUI mode for this purpose you would use "vim -g -f". Note the "-f" to keep it in the foreground. If you don't do that fish thinks the editor exited immediately and assumes you're done editing the function.


Does Unity 2d use fewer system resources than Unity 3d?

Question: Does Unity 2d use fewer system resources than Unity 3d? If it requires less in terms of system resources, would switching to Unity 2d increase the battery life of my Laptop?
Comment: The major reason for battery life loss could be [power regression](http://www.phoronix.com/scan.php?page=article&item=linux_mobile_uffda#=1) in recent versions of Linux kernel. When you look at the charts, keep in mind that Lucid Lynx uses Linux 2.6.32, while Natty uses 2.6.38.
Comment: My main concern was battery life. I've progressively upgraded from 10.04 to 11.04 on my laptop and netbook and have lost close to 2 hours of battery life on both.
Comment: You can "sudo apt-get install powertop" and then run "sudo powertop" to monitor CPU power (Watts) usage per process.  It's a great way to see what's eating up your power.  For me, it was BlueTooth, but compiz showed up as #3 behind X & Chrome.
Answer: The battery life issue is due to a regression in the linux kernel.  It doesn't have anything to do with unity.
I'm sure unity 3d's effects have some small negative effect compared to unity2d, but the best thing to do at this point is wait for a kernel version that solves the problem.
A basic overview of the regression
AFAIK kernel 3.0 still has this problem, but to a lesser degree.
Answer: Definitely. Apps that are resource-hungry increase load on the hardware side (processor, bus activities, memory allocation, etcetera) and these lead to increased power consumption. If you want to optimize you battery life, I would suggest these things:

Use a minimal GUI without as many fancy effects. In 11.04 you can select Ubuntu(Classic) during log-on.
Turn off your wireless adapter and bluetooth adapter. Surprisingly, these adapters can suck out most of your battery life. Only turn them on when you are using them.
Dim the screen to the lowest level that's practical and comfortable.
Don't work in such a way that multitasking of processes in necessary, unless you need to do so.
Turn off sound or use earphones.  Using built-in speakers requires more power.

Try this out and you will be surprised at how long your laptop battery can last (provided the battery is not dying).
Hope this helps.
Comment: Why is Unity *definitely* more resource-hungry than Unity 2D? As other posts have discussed, this is the sort of thing that one would expect to be hardware-dependent; on a machine with a good graphics card and an at least minimally OK CPU, the 3D acceleration used by Unity (via nux/compiz) should be expected to leave more resources available for use than the CPU-based ("software mode") rendering of Unity 2D (via qt4/metacity).
Comment: From my understanding, even if you have good 3D acceleration, the drawing is still going to be done thru the graphic card, therefore, by default, drawing 2D is less complex than 3D, logically. Therefore still, even if u have good graphic rendering system, using less computational unity 2D definitely generate less computations, thus less cpu cycles, and eventually less power consumption.
Comment: Video cards are commonly used today for even non-graphical computational purposes because they solve many problems faster than CPU's. This is even though the CPU must be used to tell the video card what problems to solve. (For graphical computational problems, they have been faster for a very long time--that's why it's called 3D *acceleration*.) There are other problems with your reasoning as well, relating to ambiguities in defining *complexity*, and the implicit (incorrect) assumption that if A1 is less complex than A2 then for arbitrary machines M1 and M2, M1 runs A1 faster than M2 runs A2.
Comment: It uses qt-quick, instead of full-blown OpenGL stuff.
Comment: Downvote? qt-quick is a very top-notch GUI toolkit, it actually is moving to OpenGL in qt 5.0, but in my experience qt quick runs much better than unity-3D, even with good 3D hardware and drivers.
Answer: I think this really depends on your hardware, and the way you look at "less resources".  If we are just talking about resources such as overall hardware, Memory and CPU utilization, leaving the question of battery aside, then your hardware needs to be considered.
If you don't have an external (to CPU) graphics card, then the statement Unity 2D uses less resources makes sense.
However, when you do have a pretty decent external graphics card, why let those resources chill at the side?  Using Compiz (Unity 3D) utilizes resources available to you that otherwise would just sit there and be wasted.  While in one point of view it's using more resources, but on the other hand it moves some burdens to your GPU, so it actually uses less resources on a purely CPU and memory point of view.
Just look at
Phoronix's Desktop Manager Analysis
Same computer running Compiz and Metacity, and they perform about the same.  So why not get the fancy effect?
in the end, it's how you look at it.  And there's probably no way to know for sure which one is better on your setup until you do a test on it.
Comment: I have the resources to run all of it. It's just that battery life has steadily dropped in my Laptop and Netbook from 10.04 up to 11.04!
Comment: Why do you call a video card with good graphics acceleration an "external" card? These are virtually always internal cards, and many laptops have them too (and they work fine with a laptop's built-in monitor).
Comment: by external or internal i am referring to the CPU, not the laptop itself.
Answer: Actually, I used powertop to measure the number of wakeups, which is an indicator of power usage. Unity 3d, classic with effects, classic without effects are more or less the same as far as wakeups are concerned. Unity 2d seems to be less efficient - may be due to early stage of development. KWORKER, whatever this process is produces the most wakeups and is a process I haven't seen before.
Answer: You should check out the jupiter power management applet, it had given me a couple extra hours on my battery.
http://www.omgubuntu.co.uk/2010/02/jupiter-awesome-netbook-powerconfig-applet/


write a batch to change the path for Mapped drive

Question: I having server folder as a mapped network drive  in workstation .
Now the that folder is shifting to to another server so Ineed to change the path this activity I need to do at 400 workstations. so can you help me with script.
Answer: If your old drive mapping is in O: you use this to delete it:
net use /d O:

And this to create the new one:
net use O: \\newserver\\newpath /PERSISTENT:YES

If you have to specify a username \ password:
net use O: \\newserver\\newpath password /USER:domain\user /PERSISTENT:YES

Answer: Given drive Letter g:
net use g: /delete
net use g: "\\server\share"

It's important to use the quotes around the path, otherwise paths with spaces will not map correctly.


How to recover deleted photos on Nexus 4?

Question: I accidentally deleted photos on my Nexus 4. There was no auto backup. I searched and found some software to recover photos, but none of them seem to work. Is there a way to get them back?
Answer: Please note: It is advised to follow this method only if you know what is ROOT and agree that you are doing this at your own risk. I do not hold credit for this technique as this method has been taken from here and 100% credit goes to the respective author.
Requirements:

A Rooted Android phone.
BusyBox installed on your device.
Cygwin installed to [c:\cygwin] with pv and util-linux from the repo. Make sure to open Cygwin once to make sure that the /bin folder is created. Also, I made a folder at [c:\cygwin\nexus] to put the exported .RAW file.
Netcat (download the ZIP file and extract nc.exe to [c:\cygwin\bin]).
ADB (make sure adb.exe is in your path).
Enable USB debugging in your device.
For Android 4.0 and above do it from: Settings > Developer Options > USB debugging.
For Android 2.3 and below do it from: Settings > Application > Development > USB debugging.
VHD tool Put the VhdTool.exe file in [c:\cygwin\nexus].
Piriform Recuva or your favorite data recovery tool, (it appears Recuva only finds the more common file types like images, videos, etc. Those were the file types in which I was interested. If you are after more exotic file types perhaps you might share the software you used).

The process in short:

This has been tested on Samsung Galaxy Nexus though this should work for ANY phone with Internal Memory.
We will be using a Windows 7 machine to:
back up the entire internal memory partition to your computer as a single, massive .RAW file, convert the .RAW file output to a VHD, mount the VHD as a disk in Disk Manager,
scan the attached VHD volume for files that have been deleted and recover them.

Actual Work to do:

It is recommended that you choose to recover your entire memory block instead of just the data partition. In this case that is mmcblk0. For our purpose here we are seeking to recover the userdata partition: /dev/block/mmcblk0p12
Turn on your phone.
Connect the phone in ADB mode.
Unlock the screen.
Open a Cygwin terminal and enter (This assumes your BusyBox installation is at [/system/bin/busybox]. It may be at [/system/xbin/busybox]):

adb forward tcp:5555 tcp:5555
adb shell
/system/bin/busybox nc -l -p 5555 -e /system/bin/busybox dd if=/dev/block/mmcblk0p12

Open another Cygwin terminal and enter:

adb forward tcp:5555 tcp:5555
cd /nexus
nc 127.0.0.1 5555 | pv -i 0.5 > mmcblk0p12.raw

For 16GB or 32GB internal memory this process is going to take 2 to 3+ hours respectively.
We need to convert the .RAW file to a virtual hard drive. VhdTool.exe basically just puts a VHD footer on the end of the .RAW file. Open a Windows command prompt, go to [c:\cygwin\nexus], and type:

VhdTool.exe /convert mmcblk0p12.raw

Now we need to mount the VHD in Windows. Select the Start button-->right-click Computer-->select Manage.
Select Storage-->Disk Management.
In the menu select Action-->Attach VHD.
For Location enter [c:\cygwin\nexus\mmcblk0p12.raw] and select the OK button.
Right-click on the name (e.g. "Disk 1") to the left of the Unallocated space and select Initialize Disk.
Select the GPT (GUID Partition Table) radio button and select the OK button.
Right-click on the Unallocated space and select New Simple Volume...
In the Wizard select Next>, leave the default for the volume size, select Next>, select a drive letter (e.g. K), select Next>, MAKE SURE to select the 'Do not format this volume' radio button, select Next>, select Finish.
A box will pop up asking you to format the drive. You DO NOT want to format the drive at this time.
Right-click on the RAW space and select Format... MAKE SURE to change the File system to FAT32. Set the Allocation unit size dropdown to 'Default.' MAKE SURE that the Perform a quick format checkbox is CHECKED. You do not want to overwrite the entire new drive with all zeroes (0's) and destroy your data. Quick Format means that it will only attempt to destroy the index for the drive by establishing a new index. Without this box checked the Windows operating system will write zeroes (0's) across the entire volume, potentially destroying your data. Select the OK button.
A box will pop up saying that Formatting this volume will erase all data on it. That would be doubly true if you actually didn't check the 'Perform a quick format' checkbox. Double check that you actually did check the box and select the OK button. (Don't worry. This essentially leaves the volume in the exact same state that your phone's internal memory is living in right now: there is data on the drive...you just can't see it. It's coming back, I promise!)
Open the Recuva application. In the wizard select the 'Next >' button. Select the 'Other' radio button and select Next >. Select the 'In a specific location' radio button and enter: k:\ (assuming K is the drive letter you chose...) Select the Next > button. Select the Enable Deep Scan checkbox. This is the magical setting that finds files that have been deleted...but not really deleted. Select the Start button.
Finally the application may take about an hour to do the 'Deep Scan.' It's time for more laps around the house! Once the application has returned its results you can choose which files to recover using the checkboxes. Select the 'Recover...' button and choose the location to which you wish to output your files.

OLD ANSWER:
It was about restoring files via Yodot Android Data Recovery software.
This DOES NOT WORK for Nexus 4 or any such devices which use MTP for managing files on PC.


what are the applications scenarios for prefix decoder LMs

Question: Motivated by this post wherein one of the comments mentioned the use-case for encoder-decoder LM. I wanted to know when to use prefix-decoder LM? vis a vis encoder-decoder or causal decoder only architectures?
Comment: Can you please briefly describe (1-2 sentences) this "prefix decoder" and what the context is?
Answer: Large-scale language models can be classified into three main types: encoder-decoder, causal decoder and prefix decoder. Each has its advantages and is used in different LLMs for specific purposes.

Encoder-Decoder: Based on the vanilla Transformer model, the encoder-decoder architecture consists of two stacks of Transformer blocks - an encoder and a decoder. The encoder uses stacked multi-headed self-attention layers to encode the input sequence and generate latent representations. The decoder performs cross-attention on these representations and generates the target sequence. This architecture is used in translation software such as Google Translate.

Causal Decoder: The causal decoder architecture incorporates a one-way attention mask, allowing each input token to pay attention only to past tokens and to itself. Input and output tokens are treated in the same way in the decoder. The GPT series, including GPT-1, GPT-2 and GPT-3, are representative language models built on this architecture.

Prefix Decoder : The prefix decoder architecture, also known as the non-causal decoder, modifies the masking mechanism of causal decoders to allow bidirectional attention on prefix tokens and unidirectional attention on generated tokens.

The choice between these architectures depends on the specific task you want to accomplish. For example, if you want to translate text, you can use the encoder-decoder architecture. If you want to generate text autonomously, you can use the causal decoder architecture. Finally, if you want a combination of both, you can use the prefix decoder architecture.
Comment: To the best of my knowledge, i think causal decoders models are also called [decoder-only transformers](https://ai.stackexchange.com/questions/40179/how-does-the-decoder-only-transformer-architecture-work) and prefix decoder models are often referred to as encoder-only models. [Nomenclature is not yet completely static on this](https://twitter.com/ylecun/status/1651762787373428736).


Changing default zoom in Google embedded map?

Question: I am having difficulties to change the default zoom level when I open the iframe below in my site. Can anyone please help me to set zoom level when following iframe is opened?

This is the newest version of Google Maps.
Comment: Have you tried to save the map in Maps Engine with the desired zoom level?
Comment: This FIX not working, but the old google maps is not aviabile. How embedded the new google maps???? thank you.
Answer: it seems you can use a &zoom=nn parameter now
Try this:

Comment: This did it for me. Note: if you then embed a map, you have to then add the z parameter on the end of the iFrame src even if its in the address bar when you click embed because it does not add this parameter to the embed src automatically. .
Comment: Quick update for 2021...the syntax for the URL parameter is &z=nn rather than &zoom=nn.
Comment: `&zoom=__` doesn't work for me, but `&z=__` does.
Comment: @Rich @Nat July 2021: `&z` doesn't work too. Other solutions?
Answer: The map lite doesn't have a zoom, but I did find that if you go to the map, zoom in to the level you want it at and then set up the embed settings, you will get the zoom level you want.
Comment: It works, nice:)
Comment: Commenting from the future of 2024! This still works perfecty! Thanks @eladrin201!
Answer: Try this iframe src:
http://mapsengine.google.com/map/u/0/embed?mid=zYk_BmXXTdxw.k83snDbX5SJc&z=15

z=15 "GET" parameter for zoom level. Edit as your need.
Comment: &z=15
it is working . take it to end of the href
Comment: Dec 2019 this works
Answer: As Chryss said, setting default zoom level doesn't yet seem to be possible in the Lite version of Google Maps Engine.
It is, however, possible with a free account at full Maps Engine (Google Maps for Business), but that's a whole other animal to work with and takes a bit getting used to.
If you don't want to dive into that quite yet…
New Google Maps still lets you "Return to Classic Maps", so if you want to go that direction with a simple map, you don't need to export, open etc. Just switch back temporarily, create your map there, and get the "classic" embed code, with zoom levels and everything.
However, I didn't much like the solution of going back to the old maps, so I chose another inelegant workaround:

Add another layer to your map.
Add some points of interest in a radius that roughly corresponds to the zoom level you want. (E.g. for the B&B site I was making, I added a layer of Major Airports)
Uncheck the new layer, to make it invisible.
Embed the map.

The embedded map should then be zoomed out to get all locations in the map, even if the layer they're on is turned off by default.
Of course, the user can simply check the box to show the hidden layer, but if you make that layer useful or relevant, that doesn't have to be a big problem.
Answer: Adding another layer with some markers and making invisible worked perfectly for me. You can keep the new map style too with custom markers etc!
Answer: This doesn't appear to be a feature of Map Engine Lite (the new embed API for one's own maps).
However, there seems to be a workaround for the time being, though I imagine they may do away with it at one point:

Create your map in Map Engine Lite
Choose "Export to KML", checking the box "Keep data up to date with  network link KML", and download the resulting KML file
Open the KML file in a text editor and retrieve the KML live URL, which looks something like http://mapsengine.google.com/map/u/0/kml?mid=z6Uzj8KqhwOk.khdrFbiM_Bstf
Go back to Google Maps > My places and paste this URL in the search box  . At this stage, right now, you have the old embed controls still available, so:
Click on the chain-link "Share" icon, clicking back and forth between "Customize and preview embedded map" and your map itself until the result is to your liking, including zoom factor.
Copy the resulting HTML code (iframe).

The main limitation of this, maybe a dealbreaker, is that the embedded map will be using the old embedded map style.
Comment: Sorry, it's done
Comment: I couldn't find the URL from mapsengine.google.com.....you posted on the reply. I opened the KML file with text editor but there are no links at all.
Comment: Did you check "Keep data up to date with network link KML" when you exported the KML?


Is there a way to lessen the unpleasant smell of steamed broccoli?

Question: I really enjoy snacking on steamed vegetables lightly sprinkled with some salt and pepper, especially broccoli. However I find that steamed fresh broccoli has a slightly sulfuric smell that smells a little bit like fart. I was wondering if there is anything I can do to lessen that smell.
Comment: Holy moly! I love the smell of broccoli. It DOES NOT smell like fart. I live for the smell of lightly steamed broccoli. I'll eliminate anyone from my trusted friendship who tries to serve me broccoli neutered of its greenish scent.
Comment: Eat them raw! Wash thoroughly, slice thinly, and make a spicy dip with yoghurt and a spoon of Tom Yum soup paste, extra Yum!
Comment: @BlessedGeek: Vegetables in the cabbage family produce trisulfides (not H2S), and it doesn't mean they're broken. It happens when they're cooked. Different broccoli may have different amounts of it, but it's going to happen, and Jay may just be a bit more sensitive to it than you.
Comment: @Blessed Geek: broccoli naturally releases H2S not only when they're "broken" (whatever that means). Cooking just speeds up the process as H2S is volatile.
Comment: You can always use a hood! :)
Comment: @nico a hood? What do you mean?
Comment: @Jay: I mean turn on the kitchen hood while cooking, so you will avoid having your house stink for the next week :)
Comment: @Blessed Geek: you're the first person I hear saying that he likes the smell of hydrogen sulfide...
Comment: I get fresh broccoli. We even plant it ourselves. Why are you buying broken vegetables that has started to emit H2S?
Comment: Most vegetables emit H2S - cabbage family not excluded. Especially when you leave it out for long periods of time and let them deteriorate, cooked/uncooked/over-cooked.
Comment: Cook it less and/or quicker!
Answer: Cook it less, if you can. The more you cook it, the more you get that smell. Perhaps you are just more sensitive to it than most; I don't generally notice it until it's overcooked by my standards.
Along with this, cook it as fast as you can. The flavor you don't like is produced by enzymes converting precursor molecules into those with the flavor. From On Food and Cooking:

Heating cabbages and their friends has two different effects. Initially the temperature rise...speeds the enzyme activity and flavor generation, with maximum activity around 140F/60C. The enzymes stop working altogether somewhere short of the boiling point. If the enzymes are quickly inactivated by plunging the vegetables into abundant boiling water, then many of the flavor precursor molecules will be left intact. ... If the cooking period is prolonged, then the constant heat gradually transforms the flavor molecules. Eventually the sulfur compounds end up forming trisulfides, which accumulate and are mainly responsible for the strong and lingering smell of overcooked cabbage.

So as suggested by others, boiling instead of steaming to reduce cooking time helps. So does cooling quickly, with cold or ice water. Boiling in excess water will also leach some out, but you might also lose flavor you like.
A couple other thoughts, also from On Food and Cooking. Cabbage family vegetables grown in the summer, and under drought stress, produce more of the flavor precursors, and those grown in the autumn and winter with less light and more water have less. They're also more concentrated in the core of the vegetables. And for cabbage, you can remove a lot of them by chopping and soaking in cold water; conceivably the same could work for broccoli, but again perhaps at the cost of desirable flavor.
Comment: Overcooking is definitely the culprit when it come to sulphur smells from cruciferous vegetables.  One other tip is to add a couple of unshelled walnuts to the water you are cooking the veggies in... the shells will absorb some of the excess sulphur.
Answer: This does not happen if you boil it for 30-60 seconds, drain, then ice water shock the broccoli instead of steaming.
In steaming, the usual way to prevent this is to eat it quickly and to steam for a very short time. However, steaming to the same point of moderate tenderness takes at least 6 minutes at high pressure, and the cooking doesn't stop after you remove it.
In my experience, blanching provides superior results for broccoli's flavor compared to steaming, even if you end up recooking the broccoli (like you might in a casserole), because the halting of the cooking process from the rapid cooling.
It's possible that ice water shocking steamed broccoli may have the same effect, but I prefer the shorter cooking time that blanching enables so I've never tried it. It may be worth experimenting with, if you're committed to steaming.
Comment: I wouldn't say quick cooking and eating is the only way to prevent it; I'd expect cold water to work on steamed broccoli just fine too.
Answer: I've never had a problem, but I also don't do a 100% steam cooking method ... you may want to try it and see if it sets off your nose, as we're all sensitive to smells to a different degree:

Heat a skillet with a little bit of oil in it.  (you can use non-stick, but you still want a little bit of oil)
Cut up the flourets, but set them aside.
Slice up the stem
Sauté the stems for a minute or two.
Add the flourets, and saute for another 30-60 seconds.
Add a bit of water, and slap on a lid.
Let steam to your desired doneness.
Drain off the water (tilt pan over sink while holding lid slightly askew)
Serve

I left out the seasoning step ... I typically season when sautéing, but if you're used to steaming, it might be more similar to season after cooking.
Answer: We love all things broccoli ;  soup included.  I always add a pinch of baking soda, and that's the end of the odour.   Good luck.
Comment: I'm with Loretta (actually it could have been me a coupla years ago. NOW things have changed and like MILLIONS of other people I don't (can't) eat raw stuff like a rabbit, as the colon is almost non existent, and doesn't like this new world. So now I HAVE to broil that vege to hell and back, to make it edible. I know for sure there are the other millions who will shout: whatever: Hallelujah ! or use your own joyful swirl. Good luck.
Answer: I have always had good results with adding a stalk of celery when steaming broccoli, and then discarding it after cooking. Don't know why it works, but my mom had done this for years after reading it in some cookbook, and it does seem to change the odor that permeates the kitchen.


What's the limit on entry views tracking?

Question: Does entry views tracking allow you for 4 instances all together or 4 instances per channel?
Answer: I know we talked about this on Twitter yesterday, but looking at the EE docs again it says:

"Up to four different instances of the view counter can be used (each
  on a different page), enabling you to track different aspects of an
  entry independently"

Which isn't immediately clear (at least in a pre-coffee state). So I did a quick test on my local site, implemented a view_count variable, and looked at the query to see where the data was getting stored.  Turns out the view counts are stored in the exp_channel_titles table where there are 4 columns for tracking views.
So my answer is neither four instances total, or four instances per channel, but rather 4 instances per entry.
Answer: Be careful on using entry tracking on extremely busy web sites. exp_channel_titles is a generally heavy read table, add a lot of entry tracking on a busy site and you turn that into a heavy read/write table. Using InnoDB or similar replacement engines will help, but stock MyISAM table type and heavy read/write contention on that table will cause performance issues.
Answer: 4 instances all together, but you can of course limit your results by channel(s):
<code>{exp:channel:entries channel='news' orderby='view_count_one'}
</code>
or
<code>{exp:channel:entries channel='news|portfolio' orderby='view_count_one'}
</code>


Block cipher does not provide security by itself

Question: What is this statement all about? When I look at a block cipher it seems pretty hard to break it and the mathematics behind insure a good complexity. It may refer to key generation, initialization vector (IV), padding scheme ?
Comment: A block cipher is a discrete tool, like a hammer. A hammer does not build a house by itself
Comment: Where does the statement come from? It's meaningless with context.
Answer: That statement is ambiguous, so I'll list a couple of limitation of block ciphers and cryptography in general:

A raw blockcipher by itself only permutes a fixed size block (128 bits for AES). You need to add a mode of operation (together with IVs and possibly padding) to make it flexible enough for practical use. There are many modes to choose from, including CBC, CTR, OCB, SIV, GCM and XTS. Each one has different properties and strength, so which one is best depends on the the situation.
Encryption without integrity checks (e.g. using AES in CBC mode) is often vulnerable to active attacks, so you need to add a MAC. A modern trend is to use a mode-of-operation that provides both integrity and confidentiality (authenticated encryption, AEAD).
Encryption reduces a confidentiality problem to a key management problem. You still need to solve the key management problem.
Cryptography doesn't provide security by itself. You always need to consider the larger system. This includes endpoint security, threat models, key and identity management and much more.
Comment: Put succinctly by Bruce Schneier, cryptography is not magic dust you can sprinkle on your software to confer the property of "security".
Comment: As an extension to point #1, [block ciphers by themselves don't hide large-scale patterns in the data](https://filippo.io/images/Tux-ECB.png)
Answer: The way i see it, given no context, is that indeed a block cipher is deterministic, i.e. the same message will always be mapped to the same ciphertext. Therefore block ciphers itself are semantically insecure, as ciphertext indistinguishability isn't met. You might want to check http://en.wikipedia.org/wiki/Ciphertext_indistinguishability for further information.
In order to archive said indistinguishability, it is necessary to add a source of randomness. This is often done by using a randomly selected initialization vector with the block modes. Note, however, that this might not suffice to satisfy certain definitions of security.
Answer: Without context i would say the following:
It is true, if you have a message bigger than the block cipher every same block will be encrypted to the same ciphertext making it quite insecure.
I simply think this statement is used for the promotion of modes of operation


Is it alright to list more than three things in a sentence?

Question: My teacher says when I have to give examples or list things, I can only give three, which is A, B, and C. But what if I've to list quite a number of things like minerals that is present in...the cauliflower for example? What sentence structure should I use to do it or is it alright to list them accordingly?
Comment: This is a rule of thumb. If you list six or seven, say, it becomes a lot harder for the reader to follow. Perhaps your teacher is advising you to make a formatted list. I wonder how you could find out what he (or she) means?
Comment: PS (OD): Is it acceptable to write alright as one word, rather than two separate ones? For example:

She calls them whenever she is travelling to assure them she is alright.

Similar 'merged' words such as altogether and already have been accepted in standard English for a very long time, so there is no logical reason to object to the one-word form alright. Nevertheless, many people dislike it and regard it as incorrect, so it's best to avoid using alright in formal writing. Write it as two separate words instead:

She calls them whenever she is travelling to assure them she is all right.
Comment: There's certainly no hard-and-fast rule.  Beyond about 3 the reader can get confused, if the items being listed are not all of the same type.  But even there, most memory experts will tell you that 5 is a better cutoff point.
Answer: There is no limit to the number of things you can list in a single sentence in English, or in French, or in Belorussian, or in Japanese, or in Arabic, or in Nahuatl, or in Malayalam, or indeed in any language, dialect, idiolect, slang or jargon, natural or constructed, living or dead.
Comment: Right.  So maybe (OP) ask your teacher whether s?he is prescribing a rule for correct English usage (e.g. a grammar rule) or a rule of style for better communication, or something else. IOW, ask what this rule amounts to, what it is intended to accomplish.