What is the difference between unconditional branch and unconditional jump (instructions in MIPS)?

Question: You may look into Wikipedia or short summary for students. Everybody says that there are two instructions for the same thing. But nobody tells why?
Comment: the first difference is the format: one is type-R and one is type-J
Answer: Branches allow for conditions. But allowing for conditions takes up more bits in the instruction. Therefore, a branch's address is only 2^16 bits and only allows you to branch 2^15 - 1 instructions backward or 2^15 instructions forward.
A jump is unconditional and the bits saved by leaving out the condition can be used for the address. A jump allows for a 26 bit address and so can jump much further in the code than a branch. At the expense of not being conditional.
Comment: This fails to address the question of if there is any difference between unconditional branch and unconditional jump.
Comment: Note this might be true for MIPS, but not for all CPU mnemonics. Z80 has relative jumps, and conditional jumps, and conditional relative jumps. A branch is a word nonexisting in Z80 assembly.
Comment: @HelloWorld Typically? Yes. But always? No. One situation I can think of is in a device with a very small memory. In that case, you wouldn't have far to go and would want to save as many bits as possible. So, an unconditional branch would be more appropriate.
Comment: @embedded.kyle I presume you meant `16 bits` instead of `2^16 bits` ?
Comment: So, if I am not interested in a condition, jump is always better?
Comment: @Atralb `0xFFFF` (16 bits) = 65,535 (plus `0x0000` for 65,536). `2^16` = 65,536. Write it however you want. A branch's address can be 1 of 65,536 combinations of bits.
Answer: Branches (b) use a PC-relative displacement while jumps (j) use absolute addresses. The distinction is important for position-independent code. Also, only jumps can be used for indirect control transfer (jr, using a register value).
Comment: To be precise, all jump and branch instructions besides `jr` use offsets in machine code.
Answer: As already mentioned, branch has fewer bits, a shorter range and is relative.  Jump has more bits and is absolute.
Take this example
b l0
nop
beq $0,$1,l1
nop
j l2
nop

l0: .word 0,0
l1: .word 0,0
l2: .word 0,0

and you get this
00000000 <l0-0x1c>:
   0:   10000006    b   1c <l0>
   4:   00000000    nop
   8:   10010006    beq zero,at,24 <l1>
   c:   00000000    nop
  10:   0800000b    j   2c <l2>
  14:   00000000    nop
  18:   00000000    nop

0000001c <l0>:
    ...

00000024 <l1>:
    ...

0000002c <l2>:
    ...

now what the other answers may not have mentioned is that the unconditional branch is encoded, at least by gnu assembler, as a branch if equal, with the same register.  There is no unconditional branch in mips, there is branch if equal and branch if not equal from what I can tell.
You see above the jump uses a 0xB which is the word address, 0xB*4 = 0x2C the address of the destination, where the conditionals use relative addressing  pc+(signed_offset*4) where the pc=instruction_address+4;   Or take instruction_address + 4 + (signed_offset*4) to get the destination address.
Using the alias b for branch instead of j for jump will create position independent code.  Jump will not, have to re-link if you move around, for near jumps probably better to use branch instead of jump even though it is an alias.  If you are a purist then you can use the real instruction  beq $0,$0,label or pick any register beq $4,$4,label.  register 0 being special and fast may be the better choice.
Comment: it could cause a stall or blocking add r1,r2,something; beq r1,r1,somewhere can execute differently because it may or may not wait for the prior instruction to complete execution and writeback, than add r1,r2,something; beq r0,r0,somewhere as r0 is never written.  Just depends on the core, etc.  isolated yes one register is as good as another for read speed purposes.
Comment: Thanks. We know that the branch is a pseudo-instruction. I like your attempt to hint when using one instruction can be preferred to the other. But, I think that the speed of access is equal for all registers (cos CPU is synchronous)
Answer: A jump and unconditional branch, in MIPS, are not the same.
Both branch and jump instructions write data to the Program Counter register so that upon the next fetch cycle, a different instruction will be fetched instead of the next instruction in line in program memory. In that sense, they carry out the same type of operation.
Where they differ is that branches are conditional, they only change the next instruction to be executed if a certain condition is met. This can be illustrated by the difference in execution code in an if statement or by calling a function.
if (a == 0) {
    a = 1
}
setAtoOne()

The if statement jumps to the instruction to set a = 1 only if a == 0. The function will jump to that instruction regardless.
In this case, we're talking about a branch where the condition is always true. It's just another way of writing
beq $zero, $zero, (int)offset

$zero is always equal to $zero, so it always branches to the specified offset. It's like this if statement
if (true) { a = 1 }

There is another difference between branch and jump instructions. Jump instructions specify an absolute address which the PC will be set to, whereas branch instructions offset the address in the program counter.
PC = 32-bit address # Jump
PC += 16-bits lower

In actuality, this is not strictly true. We write assembly with absolute addresses and offsets but in both jumps and branches it gets compiled to an offset. This is why you can't jump or branch to anywhere in memory, expect using the jump to register jr instruction. This is because of a fundamental design of MIPS, fixed length one word instructions.
All MIPS instructions are 1 word (ie 4 bytes/32-bits) long. They contain an id for instruction (called op-code) which is 6 bits along with other information needed to execute the instruction. This may be the id of registers or 'immediate' values, basically integers encoded in the instruction.
Each byte in memory in MIPS has an address in between 0x00000000 - 0xFFFFFFFF. To get to one of those bytes we need to specify the address. If were lucky to store the address in a register we would just jr and use the address already stored in register. However, we are not.
This becomes problematic, we only have 32 bits for our instructions and we would need all those bits to specify the address in that range. We also had to give up 6 bits to be used by the processor to identify the instruction. Now we are left with 26 bits.
What is worse is that when we branch, we need 10 additional bits to specify the two registers we are comparing for our condition. The solution is to use offsets.
Let's say that we are at address 0x12345678 and we are executing an unconditional jump to the next address in memory j 0x1234567c. This is the assembly code and I'll show how this gets translated into machine code and executed.
First we cheat a little. We know instructions are one word (4 bytes) and in MIPS it's specified that they must be within the word boundary. This means that all instructions have addresses that are 4 bytes apart and this means they always end in 00 in binary representation. Great, we can shave off those two meaningless bits. We also shave of the first 6, but don't worry, we'll get them back later.
jump 0001 0010 0011 0100 0101 0110 0111 1100
jump 0001 0010 0011 0100 0101 0110 0111 1100
0000 1000 1000 1101 0001 0101 1001 1111 #in machine code # jump op = 0000 10
When we execute this we take
00 1000 1101 0001 0101 1001 1111
0000 0000 1000 1101 0001 0101 1001 1111  # extend >> 6
0000 0010 0011 0100 0101 0110 0111 1100  # << 2
Then we AND the PC (where we're executing from) and 0xf0000000
0001 0010 0011 0100 0101 0110 0111 1000
1111 0000 0000 0000 0000 0000 0000 0000
AND
0001 0000 0000 0000 0000 0000 0000 0000

We know take the result of this and OR it with our instruction integer
0001 0000 0000 0000 0000 0000 0000 0000
0000 0010 0011 0100 0101 0110 0111 1100
OR
0001 0010 0011 0100 0101 0110 0111 1100

Which is 0x1234567c in Hex and where we want to go, now we jump there. This is why you can't jump further than 256MB (2^28 bits) away from your current instruction (unless you jump to the value of a register jr)
The same basic idea holds for branches, except now you also have the 2 registers being compared (which require 10 bits) so you only have 16 bits which you can use to offset, hence why you can't jump as far with branches.
Generally, this is fine because we mostly use branches within a procedure, to implement loops and carry out conditional assignments.
This is all a consequence of the design of the MIPS architecture. It would have been entirely possible to have instructions where the only difference between branches and jumps would have been the conditional aspects and where an 'unconditional' branch would have behaved the same as an unconditional jump.


Do electrons in a flash of lightning oscillate between Earth and the clouds (or between clouds)?

Question: In this video, around 2:24, one can see a flash of lightning that keeps the same form for a little time span. Does this mean that it takes a while before the discharge is complete (which I can't imagine) or that the electrons move to and fro between the Earth and cloud (or between the clouds themselves) before the discharge is complete? I can imagine that extra electrons move behind the discharge which on arrival on Earth flash back, taking extra electrons back, etc. But in this case, the flash should dim over time. So why the flash remains in a steady shape that long?
Answer: Lightning is a rapid transition from a non-conducting to a conductive state.lightning creates an ionized, electrically conductive channel through air inside the cloud,between clouds or between cloud and earth.The high electric field accelerates the electrons between the channel.When they collide with air molecules, they create additional ions and newly freed electrons which are also accelerated.So it takes some time.Electrons will only flow against the electric field.they don't oscillate.
Once the gap breaks down, current flow is limited by the available charge (for an electrostatic discharge) or by the impedance of the external power supply. If the power supply continues to supply current, the spark will evolve into a continuous discharge called an electric arc
Comment: Re, "Electrons will only flow against the electric field.they don't oscillate." The clouds and the Earth and the air gap between them constitute a giant capacitor, and the plasma channel (like any conductive path) exhibits inductance. Put a capacitor and inductor in series with each other, and you have a resonator. The current in a typical cloud-to-ground lightning stroke can change direction thirty times or more before it dies out.
Comment: @Solomon Slow I think you should expand that into a full answer. I don't have a good sense for the $L,R,C$ in this situation, so that should be very informative.
Comment: So when the path is created they only make room for more electrons to make the journey downwards instead of the electrons going all downwards in one short flash? I.e., they are getting down in almost invisible (you cán actually **see** the flash getting bright-less bright-bright-etc.) pulsed way?
Comment: Yes they collide with air molecule and make new ions thats why we can see lightning easily


What's the sound of wolf's footsteps called?

Question: I am trying to write a paragraph and I need to describe the sound that a wolf's  paws/footsteps will make whilst running.
Can anyone recommend me a word?
Comment: Give an example sentence, and you're likely to get more productive suggestions.
Comment: Running on what?
Answer: I suggest "padding" on the sand, on the gravel, or "thudding".

pad - (verb)  to walk so that one's footsteps make a dull, muffled sound.

I could hear the wolf's paws padding on the sand.
The sound of heavy paws padding on the stairs.
I could hear the wolf's paws padding across the soft ground.
or

thud - (verb) "to make a heavy, dull sound"

She heard the wolf's paws thudding against the ground and she strained herself to run faster.
I could hear the wolf's paws thudding against the ground close behind me.
Comment: @ova: No, I don't think a wolf's paws can't thud. Only a heavy object can thud. They can pad, but not if they are running fast.
Comment: Now I hope those poor people are able to escape from the wolves! :)
Comment: thank you, I think the thud makes sense!
Comment: "Pad" is good, "thud" doesn't fit well to me. Wolves are light and agile, they're not being chased by rhinos!
Answer: I'm not sure there's a word that specifically describes the sound of wolves feet colliding with the ground. Maybe you're looking for thump or thumping?
Here's a word that may be useful in describing the sound. Although this word is usually associated with horses, you can use it for other four-legged animals:
gallop

a fast gait of the horse or other quadruped in which, in the course of each stride, all four feet are off the ground at once.
source: dictionary.com

"I knew the wolves were getting closer as their galloping was getting louder and louder."
A couple of wolf-related websites say that "gallop" is an appropriate term in this context.
Alderleaf Wilderness College: Wold Tracks & Sign

Gaits: Wolves are built to travel long distances. They most often travel in a trot (equivalent to a human jog), either a side trot or a direct register trot. Wolves can also walk, lope and gallop. They will use different gaits according to their needs.

Wolf Country

Wolves walk, trot, lope, or gallop. Their legs are long, and they walk at about 4 miles (6.4 kilometers) per hour, but can reach speeds of 35 mph during a chase. Their usual mode of travel is to trot, which they do at various speeds, generally between 8 to 10 miles (12.8 to 16 kilometers) per hour.

Also see a list of potentially useful terms on this Wikipedia page: Canine gait


How to eliminate incorrect cell values after resampling discrete raster?

Question: After resampling a discrete raster I have floating point cell values at the catergory borders. Is there a tool similar to the GRASS tool r.neighbors that corrects these values to the most frequent values around this cell? NA should be ignored.
Answer: I think the problem may be that the raster is of type float.
You can call r.neighbours from QGIS using the processing toolkit, including the use of the "mode" algorithm. In QGIS 2.18.3, at least.
But looking at the documentation for r.neighbours, to quote one of the footnotes
[2] Calculating the mode of floating-point data is essentially meaningless.

You might be able to get around this by converting your raster to an integer type, or maybe quantizing the data (reclassifying values into bands of values which are close enough to be considered identical)


When/how does Python use PYTHONPATH

Question: I'm having some trouble understanding how Python uses the PYTHONPATH environment variable. According to the documentation, the import search path (sys.path) is "Initialized from the environment variable PYTHONPATH, plus an installation-dependent default."
In a Windows command box, I started Python (v.2.7.6) and printed the value of sys.path. I got a list of pathnames, the "installation-dependent default."
Then I quit Python, set PYTHONPATH to .;./lib;, restarted Python, and printed os.environ['PYTHONPATH']. I got .;./lib; as expected. Then I printed sys.path. I think it should have been the installation-dependent default with .;./lib; added to the start or the end. Instead it was the installation-dependent default alone, as if PYTHONPATH were empty. What am I missing here?
Answer: It always uses PYTHONPATH. What happened is probably that you quit python, but didn't quit your console/command shell. For that shell, the environment that was set when the shell was started still applies, and hence, there's no PYTHONPATH set.
Comment: Thank you. I didn't quit the shell because I didn't want to change PYTHONPATH permanently! I thought that if Python updated the value of PYTHONPATH it would have to update the value of sys.path as well -- where does sys.path come from, after all? But I'll settle for understanding what happened without understanding why.

When/how does Python use PYTHONPATH


Au, Ag nanoparticles plasmon peak position?

Question: Is the interaction between metallic nanoparticles (~ 20 nm) and light in the UV-Vis-NIR range governed by Mie theory or by Rayleigh scattering theory?
Where are the Au and Ag plasmonic peaks located? Does the formula depends to $\lambda/d$ ?
Comment: Neither (internal electronic effects impacts scattering), and of course the plasmon resonanace depends on size.
Answer: Sigma provides plethora of information on silver and gold nano-particles. Silver absorbs around 400nm and gold around 500nm. You can see that shapes of spectra are very complex. This figure shows dependence of peak wavelength from particle size.
It seems like Mie is used in description of metal surface plasmon resonance.
Nature review Light scattering and surface plasmons on small spherical particles also gives a lot of information.
Answer: Mie provided a strict solution of the scattering of a plane electromagnetic wave by a homogeneous sphere. It is valid for an arbitrary size of a particle. However, the calculations can be difficult in some cases.
The Rayleigh theory is the approximation of the Mie theory in the non-resonant regime (elastic scattering), in which only the electric dipole vibration is taken into account (so called dipole approximation). This holds for non-absorbing sphere if $nx\ll1$, where $n$ is the refractive index of  the particle, and $x=\frac{2\pi R}{\lambda}$ is the size parameter, in which $R$ is the radius of the particle, and $\lambda$ is the wavelength of incident light.
For example, if your particle of $R=10$nm is a water droplet ($n=1.33$) which is illuminated by green light ($\lambda=532$nm), then $nx\approx0.16$. For these particular values of $n$ and $x$ this approximation has the limit of validity below 1%. The conclusion is that you can use the Rayleigh theory in this case.
Please compare the article by Walstra for detailed explanation and the applicability of other approximations.
However, in the case of gold we have resonant scattering and Mie theory need to be used. Nevertheless, for small particles dipole (quasi-static) approximation can be applied as well. It gives the relation of scattering cross-section $\sigma_{s}\propto\frac{R^3}{\lambda^4}$ providing that the dispersion of the dielectric constant of gold is neglected. Proper formulas for both the scattering and extinction cross-sections can be found for example in: Optical Properties of Metallic Nanoparticles, F. Valee.
The Localized Surface Plasmon Resonance (LSPR) of a metal particle of $R=10$nm is around 510-570nm in the case of Au, and  355-450nm in the case of Ag. These are spectral positions in the case of particles incorporated in dielectric matrices with $n=1.0-1.8$. In general, spectral position of the LSPR depends on the size of particle (also because of dielectric and quantum confinements), material of the particle (dielectric constant of the particle), the dielectric constant of surrounding medium, distribution of size in the ensemble of particles, shape of the particle, etc.


DSL connection problem in Ubuntu 16.04

Question: Dsk connection is not working even though I use username and password for the connection. However, doing same setup in ubuntu 14.04 from bootable pendrive runs fine and have a connection. Is thi the issue in Ubuntu 16.04?
Answer: yes. the  problem in 16.04 only. some pon code allows us to connect but still by that way, ubuntu app store not finding the connection. It is serious problem for DSL connection users
Answer: I had the same issue (DSL working in 14.04 and not working in 16.04). The solution was to set ppp MTU to 1492. This can be done by editing the "DSL Connection 1" file in /etc/NetworkManager/system-connections and adding mtu=1492 after the [ppp] line like this:
[ppp]
lcp-echo-failure=5
lcp-echo-interval=30
mtu=1492

Another way to set it is through the command:
ifconfig ppp0 mtu 1492

DSL connection problem in Ubuntu 16.04


Is there any Cloud IDE where I can code and get the windows executable?

Question: Considering any programming language for Windows, is there any cloud IDE where I can supply code and receive the executable either by a mail or cloud storage?
Answer: This will sound a bit weird, but i think what you're looking for is a Cross Compiler, and a Cloud IDE that gives you the ability to install whatever tools you need (such as Cross Compilers).
The only one that i am aware of is Koding, since they give you a full Ubuntu VM with Root. You are able to install whatever tools you need, so in this case it should work.
Now, you didn't specify a specific language so it's hard to give you help in that regard, but if you're looking for a "Windows-specific" language such as C#/.NET, have a look at Mono. Mono, with a Cross Compiler, could compile the bin you need on Koding and then you would just download the exe from them.
All browser based :)


How to move only one side of a cube in object mode - equivalent of stretching the cube in that direction without moving other faces

Question: Having come from another CAD package, I am accustomed to being able to identify a cuboid and grow it in one direction i.e. stretch the 'scale' in this dimension, but on one side of the cube only.  I am sure that this can be done easily (I can see ways using extrude, but then there is a join required etc... - several commands, and cumbersome).
What am I missing?   Ideally this should be available in block mode, not edit mode, similarly to the scale, move and rotate functions.
Help!
Comment: switch the Transfom Pivot Point to 3D Cursor?
Comment: Not sure - trying to do it in one action, as I was used to in the older software.  It seems a trivial thing to ask, but I am stumped.  I really should just be able to 'grab' that face and pull, in essence.  It is a very useful thing to do to adjust an added bit in a design, I feel.
Answer: You can just move the face in Edit mode:

If you want to do it in Object mode, put the 3D cursor on the face that is supposed to be the pivot point:

go into the Transform Pivot Point panel and choose 3D Cursor (or keyboard shortcut . to get the pie menu:

then scale on the axis you want (SX here):
Comment: Great - thank you.  I am still getting to grips with the ins and outs of the package, and I appreciate your patience.  I knew that there had to be an easy way, but I am trying to learn enough to get going with the models that I wish to create for 3D printing.  I do not intend to go further into the advanced features, but the package is impressive.
Comment: My edit not intended as a crit. of this answer, it's what @VJM wants... but....
Answer: It sounds as if 'Normal' should be one of your favourite Transform Orientations?

, comma, set Transform Orientation to 'Normal'
GZ will move any selected face along its normal.

As @moonboots points out, there is a way to scale in Object Mode, if you insist, but it's not a habit I would want to get into...

You have to define a pivot
If the face is skewed to the World, and to its own object axis, you have to define a scaling orientation
Your object will be left with a non-uniform Object-level scale, which will probably have to be applied in order not to mess up modifiers, texture-spaces, etc, etc.
Comment: Thank you - I will use Edit Mode.  I have been playing with this, and am now reasonably comfortable with the processes.  It is just very different from the package I was using previously - much more powerful and with many nice features, but perhaps this makes the simple operations (that I have grown accustomed to using) require more key strokes.  I really appreciate the rapid response, and must apologise for my lack of knowledge of the package and its terminology (which, of course, is different).  I hope to gain proficiency as time progresses!
Comment: @VJM Apologise? What for? That's why BSE is here. The Blender learning curve is a bit steep, and it's been notorious for an overloaded keymap. That has been reduced in recent versions, but I wouldn't wish it away. Once learned, it's a Pretty Damn Quick way to work.
Comment: Thank you - I appreciate the balance that needs to be stuck.  With respect, I found the previous user interface that I used on another program much more intuitive, and remarkably fast (my colleagues felt the same).  Let's hope I can get up to speed quickly; I know what I want to do, and it is very limited in scope.  Only gave up on the other program because of poor shape decomposition, which caused issues in stl files.


Digital or LCD-like display class?

Question: I remember seeing a tutorial on Sun's site that had a class for a digital-like display, but I can no longer find it.
How would you make numbers appear like a digital clock, using Swing?
Comment: Where do you want to display those numbers ? console/swing app/web app/sth else ?
Answer: You mean something like this?

Or possibly more old school?

Have a look at the Harmonic Code Blog, the guy writes has provides a library called the Steel Series which does these components and many more.
This entry shows of some of his clock / round gauges components.
However its best to see his components in action - he provides 2 webstart demos of his components

Standard Steel Series (direct link to webstart app)
Extra Steel Series (direct link to webstart app)
Answer: There is no such class in Java.
That being said, if you're in Swing, you can adjust the Font settings for the text to a more digital look. On a website, you'd do it with CSS, etc.
Answer: I found this tutorial for constructing a 7 segment display component in Java. Unfortunately it's in German. Here's Google's translation.
Bah, that link doesn't show up. Here it is again: http://translate.google.de/translate?hl=en&sl=de&u=http://www.addison-wesley.de/Service/Krueger/kap23002.htm&ei=A_MOS7KuIpLesgah8qCnAw&sa=X&oi=translate&ct=result&resnum=9&ved=0CDUQ7gEwCA&prev=/search%3Fq%3Djava%2B%25227%2Bsegment%2522%2Bdisplay%2Bcomponent%26hl%3Den%26safe%3Doff%26sa%3DG
Again? translation .
('m gonna bug this in meta)

Digital or LCD-like display class?


Heater 240 wiring question

Question: I am looking to hook up my electric heater. I have a line that was used for an electric dryer and not being used.  Can I divert the wires to the heater? I would like to hook it up with 2 hot wires with the jumpers like in the pic, and not 4 wires..the box has older fuses. What size fuse would I need?
Comment: This heater looks like it was meant to heat an entire house(!).  Why are you putting this in in the first place, and what size is your main fuse?
Answer: That upside-down diagram seems to indicate you need a 60A circuit to run this heater, but a typical electric clothes dryer (in the US) only has a 30A circuit.  I say circuit because you can't just change the fuse/breaker without increasing the size of the wires.
You will have to look closer at the specifications for this heater to determine the electrical requirements and then make sure that the wire size and breaker are correct for it.
Answer: Not and have it work too
This furnace wants an enormous 120 amps of electrical power just to function. I gather you do not have enough electrical service to plug it in.
Normally a furnace like this is used on a house with at least 200A of electrical service, if not 400A.  If your house only has 125A or less electrical service, this furnace is not for you, and you really need to look at gas, or talk with the power company about upgrading your service.
As such, even if you could make it work somehow, the furnace would be "weak tea" and would not heat your house as you expect.
You can hack it, but it will be VERY weak
It would be possible for an electrical expert to modify it so the two 60A heaters are in series on one breaker instead of parallel on two.  That will cause it to draw half the current, which will put it within the limits of the 30A wires you have going to your dryer.
Doing so is beyond your ability; get help.
Reusing the old dryer circuit
You must use exactly the same fuses that are already on the dryer circuit.  Fuses and breakers protect wires.

15A fuse or breaker  ----- protects 14 AWG copper and 12 AWG aluminum
20A fuse or breaker ----- protects 12 AWG copper and 10 AWG aluminum
30A fuse or breaker ---- protects 10 AWG copper and 8 AWG aluminum

That's it. You can't bump that just because you want to.  If you do, you'll be asking your house to burn down.
If it was an electric dryer (rather large plug), it was most likely #10 copper wire, therefore a 30A fuse or breaker.  However, that does not mean you can use it.  Behind the socket there most be 2 or 3 insulated wires and a bare wire.  If there is, then you can use it - move the bare wire to the ground bar in the panel.
If there is not a bare wire, then you must install a #10 bare wire from the service panel to the old dryer location and attach it to ground on both ends.  Normally you can't just retrofit a single wire, but in this case you can because it's a ground.  From that location lay new #10/3 cable to the furnace.
Answer: Looks to me as though this heater requires two 60A breakers, your dryer would only have one and it is most likely a 30A circuit, so the wire size will be inadequate for even 1/2 of your heater. You should do it per the instructions.

Heater 240 wiring question


How to improve my cross-validation R2_score?

Question: I built a prediction model with fingerprints from 300 molecules and got an R2 of 0.9
However when I go to perform a cross-validation I get a very low R2.
How can I improve this result?
I'm using sklearn and PaDEL descriptors, maybe I'm doing something wrong though. Where can I learn how to do it correctly?
Answer: You don't give a lot of details (e.g., type of model, target property, etc.), but with only 300 molecules, it's very likely that your model is over-fit. Thus when you cross-validate, you get low $R^2$.
Consider that each descriptor you add is at least one parameter. You'll want more data than you have parameters.

You want to look for more data if possible
You'll want to use LASSO or other method to remove descriptors that don't add much information
You'll want to use cross-validation (e.g., 5-fold or 10-fold CV) from the start to minimize the chance of an over fit model

But you also should think carefully about descriptors. Consider whether the descriptors you use would be meaningful for the model you want.
Let's say I wanted a model for solubility prediction. I can think of a few properties / descriptors that might be important:

Molecular size (molecular weight or volume)
Molecular shape (like dissolves like)
Hydrogen bond donors and acceptors
Dipole moment / electrostatics
etc.

Yet for other properties (e.g., redox potential) most of these are probably less relevant.
If you want a good model, you need to be careful with what descriptors you use.
Comment: Thank you so much for your reply, it is true I gave little information.
As a first attempt I tried to build a model to predict solubility and got good results using few descriptors. As a second attempt I tried to predict pIC50 to a generic cancer cell with PaDEL descriptors but I get really poor results. Maybe I need to make more attempts until I find the ideal descriptors? I get a very high R2 for the full dataset but very low in the cross validation


Using Syngergy, I cannot use mouse buttons unless I hold the 'alt' key

Question: I hope someone can assist with this. I'm running Synergy 1.4.2. I have a Windows 7 machine that is acting as the server, and an Ubuntu 11.04 machine running as client. On the client machine, I cannot use the mouse buttons such as forward and back unless I hold the alt key down. I cannot seem to find any information on why this is, or how to change it. Is this even a Synergy issue?
Answer: This is a bug. I'm unaware of any work arounds. These links may be helpful:

Back/Forward mouse buttons leave synthetic Alt down
Extra mouse buttons
thumb mousebutton not detected


Minimizing the surface area of a rectangular prism

Question: Why is it that a rectangular prism with known sum of all side lengths that is a cube has the greatest surface area while a square based prism with known volume is a cube that has the least surface area?
Answer: Let the side-lengths of a rectangular prism be $a, b, c$.  Suppose that $a+b+c = P$.  Now we have $$(a-b)^2+(b-c)^2+(c-a)^2 \geq 0.$$ Expanding yields $$2a^2+2b^2+2c^2-2ab-2bc-2ca \geq 0 \Rightarrow a^2+b^2+c^2 \geq ab+bc+ca.$$ Now if we add $2ab+2bc+2ca$ to both sides we get $$a^2+b^2+c^2+2ab+2bc+2ca \geq 3ab+3bc+3ca,$$ which gives you $$P^2 = (a+b+c)^2 \geq 3(ab+bc+ca) \Rightarrow 2(ab+bc+ca) \leq \dfrac{2P^2}{3}.$$
The inequality is equality when $a=b=c$, or when the prism is a cube.  This is when the surface area, $2(ab+bc+ca)$ is minimized.

If the volume $V=abc$ is fixed, then by the Arithmetic Mean Geometric Mean Inequality: $$\dfrac{ab+bc+ca}{3} \geq \sqrt[3]{a^2b^2c^2} = \sqrt[3]{V^2},$$ so $$2(ab+bc+ca) \geq 6\sqrt[3]{V^2}.$$  The equality case of AM-GM is $ab=bc=ca$ which implies $a=b=c$, so again a cube minimizes the surface area.
Comment: you say that if sum of side lengths is known, then minimum possible surface area is when the rectangular prism is a cube, right? But for example, when the sum of all the edges of a rectangular prism is 72, the maximum surface area is when it is a cube, right? Please explain this as i am only in grade 8 and only somewhat understood the 1st part of your answer.
Comment: There are twelve edges of a rectangular prism, so if the sum of all of them is 72 and it is a cube then each edge should be 6.  That makes the surface area 54.  Is that what you're asking?
Comment: Wouldn't a cube with s = 6 have a surface area of 216? What I am asking is that you say that a rectangular prism with a known sum of sides has the least surface area when it is a cube. But, a cube with 6 has the maximum possible surface area. Why is it that a rectangular prism with known sum of sides has largest possible surface area when it is cube, but a square based pyramid with known volume has last possible surface area when it is a cube?
Comment: Sorry, it is indeed 216, I'm not sure what I was thinking when I wrote 54.  To answer your question of why one is an upper bound and one is a lower bound, that is simply the nature of the quantities $(a+b+c)^2$, $ab+bc+ca$, and $abc$ when compared with each other; we always have $(a+b+c)^2 \geq 3(ab+bc+ca) \geq 9\sqrt[3]{a^2b^2c^2}$.
Comment: Ooohhhhh! Thanks a lot, I understand now, it's because of the inequality. Thanks!


how do I keep font changes to the body of a document from changing the header font?

Question: In Word 2013, I've created an electronic letterhead with images and text in the header and footer.  When users paste content into the body of the document that was copied from another document (using a different body font than the letterhead template) the font for the entire document, including the text in the header and footer, changes to the pasted body font.  How do I format the electronic template template to keep this from happening?
Comment: What Style Name are you using in the Header? If you are using Body Text or Normal, then that would explain why this is happening.
Answer: Your header styles should be unlinked from your Normal styles.  Right click on, for example, "Heading 1" in the Styles group on the ribbon and select "Modify...."  Next, in the "Modify Style" dialog box, change the selection in "Style based on:" to "(no style)."  Select "OK" to close the dialog box.  Repeat this for all of your header styles that you want to be unaffected by users posting formatted text into the document.  Let us know if this works for you.
If a user posts a Heading 1 style, though, it may still change the style in your document.  Users should get in the habit of posting text as "unformatted" using the Paste options popup displayed when pasting text into a Word document.


I cant use 3D painting in Photoshop

Question: I try to use Photoshop 3D function, but I fail.
I import a simple cube.obj file, but when I try to paint to it, whatever I draw to front side, it will be added on all other 5 sides too. How can I use this 3d paint feature if I wanna paint all sides differently?
Thanks,
Mue114
Answer: You need a different cube! What you have is a cube that repears the UV coordinates on all sides. What you need is a model that does not repeat the UV coordinates. Since ohotoshop can not do anything about the model you need to redo the model in a 3D editor.

I cant use 3D painting in Photoshop


Bundle ID does not appear in iTunes Connect

Question:
created App ID - DONE
created development provision profile - DONE
when creating App in iTunes Connect I would hope to select appropriate Bundle ID, but that is not listed
Comment: There's some more suggestions what to try [here](https://stackoverflow.com/questions/17335495/bundle-id-is-not-showing-in-itunesconnect-bundle-id).
Answer: This is happening since around 14 hours so far, it's a server issue and it's not the first time to occur.
Comment: Where should the bundle id normally appear in the current version of iTunes Connect?
Comment: The question was about the creation of an app in itunesconnect so in that step the bundle id appears under the app name field and the app default language selection.
Answer: I know this is an old thread, but hopefully this will help users in the future.
If the Bundle ID is not appearing inside AppStore Connect (formerly iTunes Connect) as an option when creating a new app, it is possible that the app has previously been created and then subsequently removed.  That stops the Bundle ID from being used again. Information about this can be seen at https://help.apple.com/app-store-connect/#/dev28d17ed35.
Next:

When on the My Apps screen, towards the top right hand corner, change All Status to Removed Apps.
If the app in question exists, click into it and go to App Information on the left hand side.
Scroll to the bottom of the screen and click Restore App.

According to Apple, if the ID has already been used, it cannot be selected again, so in this scenario, the options are to either restore the app and work with that listing or create a new Bundle ID.
Hope that helps someone else.
Answer: I know this is an old question, however it's the first that shows up on google, since this issue can still happen.
Miraculously, clearing the Safari cache solved this problem for me, after I waited for almost a day.
Comment: Deleting cookies, CTRL+F5 or restarting the browser did not help in my case.


How do I get a level full of bosses?

Question: Using the Kin artifact, it should be possible to get a level where every enemy is a boss. And I do remember getting that to happen at least once, but I don't remember under what conditions. Is it not possible to do this in multiplayer? Is there a time aspect to this? Or are there other conditions I'm not aware of that need to be met, other than having Kin active?
Answer: Bosses have higher chance to spawn on higher difficulty (source):

Bosses in Risk of Rain also vary from level and area. Bosses usually spawn at a random rate which is affected by both difficulty setting and timed difficulty of the session.

It's also possible to loop through game levels instead of going to final level via Divine Teleporter:

The Divine Teleporter is a teleporter that replaces the regular teleporter at the Temple of the Elders and all levels after it. There are two options at a divine teleporter. You have the option to "Loop" back through the previous levels and farm more items, or continue to the final level

So you basically need to equip Kin, wait till difficulty rises, then loop through levels until desired boss spawns!
Comment: Do you have any idea how long this will take? Today I had a single game on medium with Kin that lasted 2 hours (some of which was AFK) and I didn't see any bosses. This beat many of my records. I looped I don't know how many times and it got boring with how much stuff I had. That's why I think I'm missing something.
Comment: @Laurel I'm afraid that's random

How do I get a level full of bosses?


ArcGIS 10.3 Feature To Polygon tool not working over dateline

Question: I am working in ArcGIS for Desktop 10.3. I have a set of closed polylines that are building several distinct areas in the Pacific. The goal is to make polygons from these lines. The Feature To Polygon tool in the Data Management Tools works fine for all closed lines not crossing the dateline. However, it is not working when lines are crossing the dateline (180 degree). I get empty outputs with the warning: 'error 000117'. I tried working in different projections (GCS WGS84, PlateCaree-centered at 180 degree) and I changed the working extent to my needs, as recommended in the ArcGIS Help to no avail. I am aware that I can edit new polygons and trace the lines to achieve my goal. Is there an automated way I can change a set of closed lines, that cross 180 degree, into a polygon using ArcGIS?
Comment: Did you reproject the data itself or simply change the data frame's coordinate system?
Comment: As @FSimardGIS implies, try reprojecting the polylines into a Pacific-centered projected coordinate system, then building the polygons. If that doesn't work, try converting polylines to points, project to PCS, build as polygons.
Answer: I reprojected the polylines to a Pacific-centered PCS and now "Feature To Poygon" works fine. Before, I didn't reproject the data itself, just changed the data frame's coordinate system as @FSimardGIS 's question implied.
Accordingly, I had to reproject the line files to different polar projections for my polygons in the arctic/antarctic regions. Thank you for the help @FSimardGIS and @mkennedy.


Landsat 8 cloud detection without band 9

Question: What is the best possible way to create a cloud mask of a Landsat 8 scene without using band 9? I think the best way will be to determine the cloud cover by thresholding in the Panchromatic band and verify the output with the Thermal band (clouds are cold...) - but I am open for any other ways.
Answer: There is actually no need to develop a cloud mask from scratch (unless you feel the absolute need of doing so). If you download the Landsat 8 surface reflectance data, there would be a quality file associated with it, which contains several cloud-related bands. If you are not happy with them, you can modify them based on your needs. It would be a much better starting point than trying to develop one completely by yourself.
Comment: Thank your for your answer! However, I need a workaround...
Answer: You can try using QA band. The leftmost 4 bits of the 16 bits indicate cloud and cirrus cloud presence.
<code>00 -> Not determined
01 -> No (0 to 33% probability)
10 -> Maybe (34 to 66% probability)
11 -> Yes (67 - 100% probability)
</code>


Buying the OS with creditcard

Question: I'd like to buy an iso, but I don't want to use a creditcard, prefer to use PayPal. How to go about that?
Comment: Maybe you will be donate to Patreon.
Answer: Just download it as free of charge (like @ourfor's said), then head to this, where you can choose PayPal as your payment. Also refer to @AlphAShOOt's answer, you can become a Patron too to support elementary OS.
In my experience, I did download it as free and pay using PayPal.
Hope it helps.
Answer: You can download it free of charge

Buying the OS with creditcard


Is there a name for the style/genre of Sci-Fi using floating, illuminated technology elements?

Question: Astral Chain, Mass Effect, Halo 4 (with the Forerunner technology and weapons) and Black Panther are all examples of Science Fiction that make use of floating, illuminated elements in their technology.  It gives the technology a futuristic, almost magical vibe.  Is their a term for this style of technology or genre of Science Fiction?
Answer: Tron Lines
From TVTropes:

When your technology isn't just bleeding-edge, but laser-edged, disruption-fielded-with-motorized-teeth high-tech. Power Glows, and now so does your tech. A common design scheme used for this glow is a series of lines along the edges or between panels of the machine. Others will have flat surfaces crossed by circuit-like lines that glow when activated, or have occasional pulses of light race down their length in tandem. Others have glowing components such as engines, weapon barrels, forcefield projectors and the like.

The examples at the bottom include Mass Effect and Halo Forerunners, which tells me that we're on the right track.
Other example IPs that I'm familiar with include: Tron (of course), Atlantis: The Lost Empire, Treasure Planet, Zone of the Enders, Metroid, and Phantasy Star.
Comment: And of course the eponymous _[Tron](https://en.wikipedia.org/wiki/Tron)_.
Comment: @Spencer Ha, guess I wasn't very clear. I just meant to point out that the OP's examples being included was a good sign. I'll edit in some examples into the actual answer in case that link ever dies.
Comment: Just want to do an extra shout out to Harabeck for absolutely nailing what was a slightly ineffable question.  Well done.


What is the point of Blenders camera sensor width?

Question: Forgive me for my lack of camera knowledge. There's an option for sensor width which zooms the camera in and out. The focal length option seems to do the exact same thing. What is difference and functional purpose of these two similar options? (Note: it's slightly confusing when attempting to match cameras and one is different from the other even when checking to make the focal lengths the same. My confusion prompted this question.)
Answer: Cameras in Blender are made to resemble cameras in real world. The size of the sensor is important when you need to match content created with a real camera with your CG, and that happens really often. Obviously, you might have a hard time to match your camera if you don't enter the correct sensor size. You should search for it online for the specific camera model your content is captured with.
You may also be used to real world cameras so it is easier to reach some desired result if you already know what to expect from some settings or parameters because they match real cameras.
If you have a look, you can see that Blender even comes with lot of presets matching real cameras:
Comment: What would you (personally) set your sensor width to if you have no need to utilize it? Having 2 zoom options seems like it could get awkward especially when trying to keep a consistent feeling throughout an animation. Is know its probably up to preference but maybe there might be customary or general rules of thumb relating to the practice. I'm new to this so I'm a little aimless.
Comment: I don't usually have the need to adjust it and just leave it alone with the default value that happens to be 36 mm. It shouldn't be a preference and you should use focal length for adjusting the zoom. This is how it is in reality as you cannot adjust the size of your sensor in a physical camera. Using sensor size for zooming would probably confuse anyone looking at your files if you need to work in a team or share your work. Unless of course you want to mess with your coworkers, then it's a great thing to do. :D
Answer: Focal length and sensor width (aperture) are highly misunderstood and abused concepts.  The property you are primarily concerned with is actually angle of view or field of view, but Blender does not provide such a camera attribute.  Angle of view is the result of combining focal length with sensor width.  Ordinarily you will want to adjust your angle of view using focal length since that is most intuitive and consistent with how a real world camera is used.  But be aware that focal length means nothing without a known sensor width.  A focal length of 50mm in front of a sensor width of 36mm does not provide the same angle of view as it does in front of a sensor width of 24mm.  First decide on your sensor size and don't touch it.  If you don't know it just accept the default.  The only time you need to care about sensor size is if you are integrating real world images with a CG render.  Find your desired angle of view using the lens focal length, but don't try to make the numbers mean anything.  Just make it look the way you want.   If someone says to you, "I want this to look like it does through a 50mm lens", you have to immediately ask them "what is your sensor size?"  Otherwise tell them to F*ck off, and ask them how much they want to see in the image (angle of view).
Comment: Is it necessary to use swear words to explain this subject?
Comment: Hello :). Not to tread on your nice answer, but Blender of course allows you to use field of view, instead of focal length.
Comment: Ok, yes there is a Field of View property, but not provided in the default interface.   It could be scripted, or displayed with an Add-on.
Comment: Oh, wait, I see, the Option menu - Lens Unit displays focal length or field of view....Nevermind.


Html 5 File upload

Question: I've been trying to get Html 5 file uploading to work. I just don't seem to "get it". So rather than tell you about all the problems I'm facing I was wondering if someone  has already nicked this in the bud and would be willing to help.
Nice to have features would be
1. File upload progress
2. Time left
3. Some sort of confirmation once upload has completed
Answer: Uploading large file is equal to grabbing maximum resources from CPU and putting the user agent in block state, so we need to avoid these two things, for that we have to upload the large file as multiple parts(chunks), so we have to slice the file and we have to upload in background.
HTML5 introduced some APIs, useful APIs for uploading large file are webworkers and File API.
These two are helpful while uploading large file, we have to upload slice the file at client side to make the file as chunks then we need to upload at background to increase the performance of CPU.
For slicing the File API has slice call
var chunk=file.webkitSlice(start,stop)||file.mozSlice(start,stop);

we have to process the uploading in background Using Webworkers to free the user agent.
var worker=new worker('worker.js');
worker.postMessage(FileList);

Comment: can you submit the code for uploading file using web worker??

Html 5 File upload


What is the ideal backend for global apps?

Question: Should our tiny team use Parse or firebase or other backend solution for a global instagram-like app we are developing ?
Speed of development is very key.
Answer: If you are looking for speed of development, the best database back-end is the one that your team has the most experience with that fits your needs.
I have experience with relational databases, so I would likely start with a relational database like MySQL. If I were more familiar with key/value stores I might say something like Riak. I think your best bet is to go with what you are familiar with to get a prototype of your app off the ground, then work on finding the best tool for the job after that. Make a list of the features you need and find the back-end that best supports those features, and has the most active community.
I think a lot of people get so hung up on implementation details when developing new apps that they never make any progress on the actual app, they instead put all of their effort into learning some new technology. Refactoring is hard, but not as hard as learning a completely new technology while still trying to iron out general design/architectural issues.


Powering three separate shaded pole axial fan motors with one 3-phase VFD

Question: I want to power and control the RPM of three 115v .47amp shaded pole axial fans each powered by a separate leg of the 3-phase coming from a VFD. Can it be done? I'd like them to run at full speed (60hz) down to possibly half of that or less if that's an option.
Comment: Two legs, not one
Answer: Most VFDs have a mode of control that is not senseless vector. That mode is often called the "V/Hz" mode. If you select that mode, it should be possible to power three shaded pole motors driving fan loads. Some VFDs may have a "load loss" or "load imbalance" protection feature, but I don't think that either of those features is common. VFDs usually have sufficient configuration adjustment ranges to allow setting up for 115V output at 60 Hz.
Answer: Given any reasonable VFD has a current regulation, no.

Reactive currents in the individual legs will differ depending on speed.
Active currents in the individual legs will differ depending on the load situation.

This will make the VFD go into failure mode, expecting the single motor it was designed for to be broken.
Answer: I have been working on a related question, so although I do not know for sure (please check on the bench before deploying) I believe the answer is maybe, depending on how the vfd is designed and other factors.
Let's look at some factors that can push the answer in one direction or another.

Are your motors and loads identical? the more unbalanced your current loads on the vfd are unbalanced the more likely the control loops in the vfd will be confused.
How coupled are your loads? The good news is that unless all your fans share a shaft, your load can tolerate unbalance (synchronization of air flow is probably not necessary). The bad news is that depending on layout the fan layout air from one fan could affect load on another (either reducing or increasing), and other airflows may affect different fans disproportionately. this may significant affect the vfd current enough to cause problems.
Where is your neutral? I have never seen a vfd  with a four wire output (not counting ground), which means that either you need to use line neutral (which probably will start a fire), find a neutral inside the vfd (which means you need to modify the vfd, which I do not recommend), or you need to wire the fans in either a delta (which does not need a neutral) or a wye (which can float it's neutral). remember that the output voltage of your vfd is a phase to phase voltage so if you are wiring a delta you use the name plate voltage, but if you are using a wye you need to multiply the nameplate voltage by the square root of three. Also not that wye configuration is probably more vulnerable to a lost phase and neutral imbalance.

If you got this to work, I would love to hear about it. ( I would also be interested in any problems you have, including HCF events. )


creating setup of a project in VB6.0

Question: i have created a application in VB6.0 which is connected to MySQL through ODBC connection,there are two dsn which connects to application.Now i want to create a setup of the application that i can install on any computer.but how? I tried using Package and Development wizard in VB but it gives me error "access denied ieframe.dll" something like that while installing it AND also after using that wizard,now all my forms are corrupt.I craeted new and i don't want this to happen again.Help me!!
tired googling now!!!
Comment: Check out the answers to the previous questions on VB6 deployment. http://stackoverflow.com/questions/1327487/how-can-i-setup-the-vb-project and http://stackoverflow.com/questions/23836/what-is-the-best-simple-install-system-for-xp-vista
Answer: I am not sure of the version of VB6 you are running, I do know that there was an InstallSheild Light version that shipped with Visual Studio 6 Professional. It was an optional install. If you have your original installation media try looking for it. There was also Visual Studio Installer 1.1 that used to be available from Microsoft. I found a link on Web.Archive.org that still works. I have used this to build msi files for VB6 in the past. You need to have Visual Interdev because it gets added as project type to it.
And since you mentioned that the Package and Deployment Wizard corrupted your project, you should make a backup of your data or use some type of source control. It will be a lot less painfull to recover when problems occur.
Comment: Thank You Sir for your reply,I am really sorry I didn't stay active on this question.
I made the setup and uploaded to softpedia.
http://www.softpedia.com/get/Internet/Other-Internet-Related/Log-Circle.shtml
Answer: First of all, I take it that the two DSNs are not relevant to this problem?
I have never seen the error "access denied ieframe.dll", but I would guess that you are trying an installation via internet explorer.  I would try creating a standard application installation.
I have to say that I am surprised to hear of "corruption" of your forms.  Do you really mean your source code?  Or this the forms in the executable.  In any case, you really should be using some form of source control.
In any case, if you want a better answer, try giving a step by step run-throught of exactly what you are doing.
Regards,
Mark
Comment: hey thanks!!.I'am really sorry I didn't stay active on this question.
But that's all rigth!!
I did R & D on this and got the setup ready.I uploaded it to softpedia.

http://www.softpedia.com/get/Internet/Other-Internet-Related/Log-Circle.shtml

creating setup of a project in VB6.0


Inkscape - Parametric curve

Question: I am trying to plot a parametric curve thanks to the the render extension. The curve is called a "trochoid". The thing I don't understand is why the curve is not "perfect", did I do something wrong in the parameters ?
Answer: Inkscape's Paramentric Curves extension converts paramentric curves into Bézier curves, which are basically an estimation of the curve. If you don't have enough samples, the curves will be generated with fewer nodes, and will therefore be less accurate and a bit more wonky. Increase the samples to something like 80, and you should see an improvement.
Answer: I would like to add a differing opinion. You can in fact sample with less points and have an ok and perfectly repeatable result. The trick is though that you must sample with a multiple of a period of your function! Offcourse this would require you to do some function analysis.
See your domain is from 0 to 10 with 30 samples. But you should probably sample from 0 to 3 * pi. This way your samples hit the same spot on every sample. Also having 5 samples per period seems like a nonoptimal solution, 4 or 6 would be better
Offcourse the sampling function could be a bit less naive than just number of samples but would be harder to control.

Inkscape - Parametric curve


C# server code for send Xtify push

Question: I cant seem to find any sample code in C# that shows how to send a simple Xtify push message to a list of registered devices.
I have my Android devices setup and registered to receive messages but how do I send the message from my webservice?
Answer: Well C# can use the REST API given here http://developer.xtify.com/display/APIs/Push+API+2.0 directly to send the push message. You can use the HTTpClient if C# create a connection to the server and send the message.

C# server code for send Xtify push


Network Size in neural network

Question: What are the limitations of having too many hidden units in the Neural Network
Does it take more memory or takes longer time to train the model
Answer: The number of hidden units is a hyperparameter which increases the model capacity. Therefore, increasing it not only increases time and memory requirements but can also lead to overfitting (also see section 11.4.1 in the Deep Learning Book).
Answer: As you increase your hidden layers in a neural network, the weights associated with the nodes are also increased. They increase memory requirements for your model. Also, as there are more weights, more time is needed to optimize them, hence,  increase the time taken for processing.
As layers are increased our model accuracy starts to degrade due to over-fitting.
ResNet is a great example , where they skip layers in an extremely deep neural networks to achieve great performance.

Network Size in neural network


Index Notation and the Minkowski Metric

Question: Given the Minkowski metric $\eta$ the Lorentz Transformation $\Lambda$ satisfies $$\eta=\Lambda^{T}\eta\Lambda$$ which in index form may be written $$\eta_{\mu\nu}=(\Lambda^{T})_{\mu}^{\,\,\alpha}\eta_{\alpha\beta}\Lambda^{\beta}_{\,\,\nu}$$$$\eta_{\mu\nu}=\eta_{\alpha\beta}\Lambda^{\alpha}_{\,\,\mu}\Lambda^{\beta}_{\,\,\nu}$$ How can I obtain an index expression for $\eta^{\mu\nu}$ starting from this expression? I have attempted to multiply through $\eta^{ab}$ using its index raising property, but this is not helping.
Comment: Sometimes, upper indices can be understood as inverse matrix, I think this might be one of those times.
Answer: Using the index-raising property
$ \eta^{\sigma \lambda} = \eta^{\sigma \mu} \eta_{\mu \nu} \eta^{\nu \lambda}$
Applying your formula
$= \eta^{\sigma \mu} \eta_{\alpha \beta} \Lambda^{\alpha}_{\,\mu} \Lambda^{\beta}_{\,\nu} \eta^{\nu \lambda}$
and using the index-raising property again
$ = \eta_{\alpha \beta} \Lambda^{\alpha \sigma} \Lambda^{\beta \lambda}.$
Is this what you had in mind? Alternatively, the $\eta_{\alpha \beta}$ of the final expression can also be exchanged for $\eta^{\alpha \beta}$ by appropriately lowering one of the indices of each of the transformation matrices:
$\eta_{\alpha \beta} \Lambda^{\alpha \sigma} \Lambda^{\beta \lambda} = \eta_{\alpha \gamma} \eta^{\gamma \delta} \eta_{\delta \beta} \Lambda^{\alpha \sigma} \Lambda^{\beta \lambda} = \eta^{\gamma \delta} \Lambda_{\gamma}^{\,\sigma} \Lambda_{\delta}^{\,\lambda}.$
Comment: This gives $\eta^{\mu\nu}=\eta^{\sigma\rho}\Lambda_{\sigma}^{\,\,\mu}\Lambda_{\rho}^{\,\,\nu}$. Is it possible to convert this into the form $\eta^{\mu\nu}=\eta^{\sigma\rho}\Lambda^{\mu}_{\,\,\rho}\Lambda^{\nu}_{\,\,\sigma}$ (I have this in my notes and am wondering it this is an error).
Comment: @Watw (sorry for the late reply, I clearly don't use SE frequently enough.) If you(r book) use(s) consistent notation, I'd read this condition as $\eta^{-1} = \Lambda \eta^{-1} \Lambda^T$. Of course, SO(1,3) matrices are invertible, so if we multiply this from left by $\Lambda^{-1}$ and from right by $(\Lambda^T)^{-1}$, we get $\eta^{-1} = \Lambda^{-1} \eta^{-1} (\Lambda^T)^{-1} = (\Lambda^T \eta \Lambda)^{-1}$, showing that the condition is equivalent (given invertibility) to the original one.

Index Notation and the Minkowski Metric


Why is the phase space a symplectic manifold rather than a manifold with a metric?

Question: Why does phase space require a symplectic geometry rather than a metric? Is there some scenario where a metric is unable to describe the notion of length in phase space, specifically in relation to the uncertainty principle?
Comment: The symplectic structure is not there to provide a notion of length, but to provide the notion of Hamiltonian flow (as is mentioned in [the answer](http://physics.stackexchange.com/a/133987/50583) to one of your other questions), and arises naturally on cotangent bundles. I am not sure what it is you are asking, and what the uncertainty principle (which is emphatically *not* a concept of Hamiltonian mechanics) has to do with it.
Comment: A [manifold](http://en.wikipedia.org/wiki/Manifold) has perfect meaning without a metric. What would your reason (physical or mathematical) be to pick your metric over all the others you could endow the manifold with? Yet, the symplectic structure on the cotangent bundle is natural/canonical and does not require the underlying "physical world"-manifold to possess a particular metric (nor the bundle itself, for that matter). The reasons why phase space is symplectic are twofold, but simple: The structure is natural, and it gives the correct results.
Comment: @ACuriousMind A manifold only has meaning when we impose upon it a geometrical structure. If we used a metric then what would be the interpretation of $(\Delta q)^2+(\Delta p)^2$? I believe the answer has to do with the symmetry or indeed asymmetry of the tensor we use in both space time and phase space? Namely the symplectic-2-form $\Omega$ and the metric tensor $g$. Forgive me if my question was misleading :)
Comment: I can see how the uncertainty principle is rather misleading but I'm just imagining it as a small shift in coordinates. That isn't the essence of my question.
Answer:
A metric structure $g$ and
a symplectic structure $\omega$

are two very different structures, although sometimes they can co-exist in a compatible way.
Unlike a symplectic structure, there are no Jacobi-like identity and no Darboux-like theorem for a metric structure.
There exists a unique torsionfree metric connection $\nabla$ on a pseudo-Riemannian manifold $(M,g)$, known as the Levi-Civita connection, while there exist infinitely many torsionfree symplectic connections $\nabla$ on a symplectic manifold $(M,\omega)$.
Unlike a pseudo-Riemannian manifold $(M,g)$, there are no scalar curvature, or local invariants on a symplectic manifold $(M,\omega)$.
The group of local symplectomorphisms on a symplectic manifold $(M,\omega)$ is infinite dimensional, while the group of local Killing symmetries on a pseudo-Riemannian manifold $(M,g)$ is typically finite dimensional.
A metric structure on spacetime is important for general relativity (GR), but irrelevant for the Hamiltonian formalism.$^1$ If we artificially assign a metric on phase space, it would typically not be preserved under symplectomorphisms.
On the other hand, note that in the Hamiltonian formalism, the cotangent bundle of the configuration space is born with a canonical symplectic structure, cf. e.g. this Phys.SE post.
--
$^1$ Note in particular that in the Hamiltonian formulation of GR, known as the ADM formulation, the pertinent phase space is different from spacetime itself, and also different from the configuration space of all possible spacetime metrics. The configuration space of all possible spacetime metrics is endowed with the DeWitt metric.
Comment: Minor stuff: (a) isn't it spelt "torsion-free"? Now for the major question: (b) I have forgotten, so this may be stupid, but isn't the lack of local invariants on a Symplectic manifold responsible for Darboux's theorem (more or less)?
Comment: @Alex Nelson: (b) At least morally _Yes,_ but I prefer to phrase it the other way around: _Due to Darboux's theorem, there are no local invariants._
Comment: Could you please explain why the ADM phase space is not the same thing as the space of all possible spacetime metrics?
Comment: For starters, the latter doesn't appear to have a symplectic structure.
Answer: So, in classical mechanics, we know nothing of this strange "spacetime" and its metric. We know only that systems are described by $n$ continuous generalized coordinates $q^i$ with a certain range, and we take the manifold $\mathcal{M}$ consisting of all possible different $\vec q$ as our starting point. Note that there is no metric, no form, nothing on this.
We now include the generalized momenta $p_i$ at any point as elements of the cotangent space at that point, and henceforth call the cotangent bundle our phase space $\mathcal{P} := T^*\mathcal{M}$.
Now, on the cotangent bundle, there is the tautological one-form $\theta : \mathcal{P} \to T^*\mathcal{P}$. It is uniquely characterized to be the form that undoes the pullback $\beta^*$ by $\beta : \mathcal{M} \to T^*\mathcal{M}$ on the coordinate manifold by $ \beta^*\theta = \beta$. It is natural in the sense that it is characterized by an universal property and always exists uniquely. In coordinates, it is $\theta = p_i \mathrm{d}q^i$.
From this, the symplectic form simply arises as $\omega := \mathrm{d}\theta$. As $\theta$ was natural, so is $\omega$, and the proof that $\omega$ is symplectic is simply that it is locally given by $\omega = \mathrm{d}p_i \wedge \mathrm{d}q^i$, which is obviously a symplectic form on $\mathbb{R}^n \times \mathbb{R}^n$
So, we do not choose a symplectic form, there is one, and only one, natural candidate. Note that there is no such candidate for a metric.
If we are now given an "energy function" - the Hamiltonian $H$ - on $\mathcal{P}$, it turns out that demanding that $\theta(X_H)$ be the action reproduces Hamilton's equations, which, by their equivalence to Lagrangian/Newtonian mechanics, are the correct equations of motions. Furthermore, the symplectic form gives the correct way to implement the Poisson bracket (which is antisymmetric, and which a metric could never do) by
$$ \{f,g\} := \omega(X_f,X_g)$$
where $X_f$ is the vector field defined by a differentiable function $f : \mathcal{P} \to \mathbb{R}$ through $\mathrm{d}f \overset{!}{=} \omega(X_f,\dot{})$.
One can also show now that this is really a Poisson bracket and derive the time evolution equation on the phase space for observables, but I believe this is sufficient to be convincing that the symplectic structure is indeed the natural setting for Hamiltonian mechanics.
Lastly, and somewhat unrelated, we note that, on Riemannian manifolds, it is quite possible to consider the geodesics as a Hamiltonian flow, where the Hamiltonian is defined by the metric, but we still use the symplectic cotangent bundle to define the flow on.
Comment: Awesome summary of the symplectic potential and form and also of the their uniqueness in reproducing Hamilton's equations. I have only one slight criticism: you might say that $\beta$ is *any* one form on $\mathcal{M}$. If I wouldn't have seen these ideas before, I think I'd be left looking around for $\beta$'s definition. Since this is such a good summary of all these ideas, you might also include the property that $X_{\{f,\,g\}} = [X_f,\,X_g]$ (well, at least I for one find that this one helps intuition for the Poisson bracket).


Firestore Rules using get returns insufficient permissions

Question: I'm making a query to firestore using:
setDoc(doc(db, "vendors", this.vendorId), {
    title: "test listing",
    vendorId: this.vendorId
}, {merge: true}).then(i => {
    console.log("i", i)
}).catch(e => {
    console.log("error", e)
})

I have 2 collections the first one has a sub collection
Collection users/${userId}
{
    "userId": "123.uuu",
    "role": "vendor"
}

Sub collection users/${userId}/vendors/${vendorId}
{
    "user": "123.uuu",
    "vendor": "123..vvv"
}

The second collection is
Collection vendors/${vendorId}
{
    "userId": "123.uuu",
    "role": "vendor"
}

I want to be able to update the second collection vendors/${vendorId} but only if the users sub collection users/${userId}/vendors/${vendorId} exists and therefore has access to it.
The below rule doesn't work - returns FirebaseError: Missing or insufficient permissions.
match /vendors/{vendorId}{
    allow update: if get(/databases/$(database)/documents/users/$(request.auth.uid)/vendors/$(vendorId)).data.user == request.auth.uid
}

Comment: Security rules don't mean anything unless paired with code that makes the query.  Please edit the question to show that code, so we can understand what exactly is failing.  We should be able to reproduce the behavior using the information you share.  Also please update the title of your post to describe the problem succinctly.
Answer: The allow update will allow update operations only i.e. the document must already exist. Since you are using using setDoc(), that means a new document is being created if it doesn't exist already. Try allowing create as well:
allow create, update: if ....;

Checkout the documentation on Security Rules and also this Firecast
Comment: Makes sense! However, it didn't fix the problem. Still getting FirebaseError: Missing or insufficient permissions.
Answer: According to @Doug Stevenson: "Security rules don't mean anything unless paired with code that makes the query.", you can try to follow the example code below that works upon replicating on my end:
// Where the user.uid is the users document id;
// and the vendorId is the value of the "user" under vendors' sub-collection
const userRef = doc(db, "users", {user.uid}, "vendors", {vendorId});
const userSnap = await getDoc(userRef);

if (userSnap.exists()){
  // Where the vendorId is the value of the user under vendors' collection
  await setDoc(doc(db, "vendors", {vendorId}), {
    title: "test listing",
    vendorId: this.vendorId
  },
    {merge: true}).catch(e => {
      console.log("error", e);
  })
}
else{
    // doc.data() will be undefined in this case
    console.log("No such document!");
}

Additionally, following the answer of @Dharmaraj, you can try this rule:
match /vendors/{vendorId} {
    // 'user' field in collection 'vendors', and users' sub-collection 'vendors', should have the same value for this rule to work
    // this will check 'vendors' and users' sub-collection 'vendors' user field if its the same or not
    allow read, create, update: if resource.data.user == request.auth.uid && request.auth.uid != null
}

For more information, you can check the guide below:
How to fix Firestore Error: PERMISSION_DENIED: Missing or insufficient permissions


What happens to my saved game if I buy a new 3ds

Question: What happens to my saved game (Retail version not eShop) when I buy a new 3DS when my old one gets broken? I a case of total destruction of a 3DS system an you don't have the chance to make data transfer... Everybody says that saved games are being stored on the game cartridge but when I put my game in a new 3DS am I only able to play as a resident?
Comment: Can you explain what happened in more detail? You broke your old 3DS, and when you put your Animal Crossing cartridge into the new system, what happens?
Answer: The save game on a physical copy of Animal Crossing: New Leaf is stored on the cartridge. If your system is destroyed but you still have the cartridge then you can resume playing on another system. I have a cartridge that I swap between two systems so I can confirm this.
Now what I can't confirm is if there is something strange going on with your New 3DS. This is something that you might want to contact Nintendo Customer Support about for further guidance.
Answer: Just go onto the Nintendo e-shop and download the Nintendo 3ds transfer app (it will look like a toaster). Then do the same on the new 3ds, and then all of the memory on your old one will be on your new one (not sure if that works for game cards though).
Comment: OP is asking about a case when the original system is broken, so a system transfer can't be made. There is also no specific app necessary for system transfer, the capability is part of the 3DS. You might be thinking of the Save Data Transfer Tool, which transfers the save data from a cartridge game to a digital copy of the same game, provided you have both available.


Client specific prices

Question: Is it possible to have client specifik prices for products in Commerce?
This should be an option with specific clients that has an agreement with the company. Everyone else will pay the ordinary prices.
Answer: Yes, it's possible. I would recommend using role based pricing. Customers who deserve the special pricing should be given a specific user role. Then on the product type, add a secondary price field used specifically for users with that role. Finally, add a product pricing rule that checks to see if the order owner (i.e. commerce-line-item:order:owner) has the user role. If so, you should swap in the price value from the secondary field using "Set the unit price to some amount" and fetching the secondary price using the appropriate token. Remember that you'll have to first run an "Entity has field" condition on the line item to find its product reference field and again on the product to find its secondary price field.
Comment: So if the prices are unique to each client I need a unique role for every client that this applies to, am I correct?
Comment: If that's the goal, then yes. That being fairly impractical, I'd suggest some alternate method of assigning individual prices to individual users. For example, perhaps each user has a unique percentage discount? You could use a hidden field on the user account that you use to modify product prices.
Comment: Yes I think that is the way to go. It could possibly be a different percentage for different product groups but anymore detailed than that would be too impractical. Thanks for your suggestons!

Client specific prices


adding 1/2" OSB over second floor single timber flooring to cover with floating floor

Question: Does adding 1/2" OSB over 5/8" timber planks in order to cover with new floating floor minimize sound to floor below?
Comment: Have you looked at any of the questions with the tags [tag:sound-proofing] or [tag:sound-deadening]? There are 280 questions that should give you a _really_ good start on an answer to this question.
Answer: There are multiple sources of noise and ways noise travels.  For example, voices are easily absorbed by soft materials like carpet, and padding helps with loud walkers and pet nails.  OSB and floating floor do none of that.  So it may help extremely minimally with voices, and if the floor squeaks a lot currently, attaching a second layer properly could minimize that, but for other sources of noise it will do nothing.  To decrease noise you need to install absorbent surfaces or decouple surfaces.
Answer: Noise mitigation is a difficult problem asking for easy but impossible solutions.
I can't overemphasize how difficult proper noise mitigation is and how much work and money is thrown at underperforming techniques that only lead to disappointment.
Underlayment & Boarding?
Often underlayment or an extra layer of boarding is proposed but they do nothing effective.
The underlayment helps prevent floor crackling noises or bounce contact of the flooring caused by deformations when weight is applied. When the marketing material describes it as "noise reduction", this is the noise that gets reduced, and everything else is left to the buyer's wishful imagination.
An extra layer of boarding helps distribute weight application, which may help a bit in some cases of deformation noise caused by foot drop. Also the extra weight of the board helps a tiny bit with foot drop thumping. Voice or pet nail (as mentioned in the other answer) will travel anyway.
This same stiffening is the reason why double sub-flooring is recommended if tiles are to be applied: to protect the tile and grouted seams from applied strain.
Don't expect much from easy answers
To properly reduce noise transfer to the room under the floor (if that is your objective), you will have to open the ceiling and apply layers of heavy drywall sheets, noise absorbant insulation in the ceiling cavities, and decoupling rails to reduce coupling to the ceiling.
To reduce noise generation in the room with the new flooring, use underpadding to reduce crackling, and apply area rugs and curtains. (I know this is not always a desired option)
Whether you are willing or needing to resolve it this way, I would not spend the money or labour on double boarding the subfloor.

adding 1/2” OSB over second floor single timber flooring to cover with floating floor


I want to hide error and throw my own message in jmeter for Non HTTP response code: java.net.URISyntaxException

Question: I am capturing URl and path from s3URL from previous response. Some time S3URL not generated then URL and Path not found. In this case i want to hide error because it is application issue not scripting issue.
Answer: I tried with Adding Beanshell PostProcessor as a child of the request which must be successful and put the following code into "Script" area:
if (prev.getResponseCode() == "Non HTTP response code:java.net.URISyntaxException"){
        prev.setResponseOK();
        }

Answer:
Add Response Assertion as a child of the request you would like to mark as passed
Tick Ignore Status box if you want to mark sampler as passed

Alternatively you can amend the message using JSR223 Assertion and the following code:
if (prev.getResponseCode().equals('Non HTTP response code: java.net.URISyntaxException')) {
    prev.setSuccessful(true)
    prev.setResponseCode('Your custom response code')
    prev.setResponseMessage('Your custom response message')
}


Reset hadoop aws keys to upload to another s3 bucket under different username

Question: Sorry for horrible question title but here is my scenario

I have a pyspark databricks notebook in which I am loading other notebooks.
One of this notebooks is setting some redshift configuration for reading data from redshift(Some temp S3 buckets). I cannot change any of this configuration.
Under this configuration, both of this returns True. This is useful in step number 5

sc._jsc.hadoopConfiguration().get("fs.s3n.awsAccessKeyId") == None
  sc._jsc.hadoopConfiguration().get("fs.s3n.awsSecretAccessKey") == None

I've a apache spark model which I need to store to my S3 bucket which is different bucket than configured for redshift
I am pickling other objects and storing into AWS using boto3 and It is working properly but I don't think we can pickle apache models like other objects. So I've to use model's save method with S3 url and for that I am setting aws credentials like this and this works (if no one in same cluster is not messing with AWS configurations).

sc._jsc.hadoopConfiguration().set("fs.s3n.awsAccessKeyId",
  AWS_ACCESS_KEY_ID)
          sc._jsc.hadoopConfiguration().set("fs.s3n.awsSecretAccessKey", AWS_SECRET_ACCESS_KEY)

After I save this model, I also need to read other data from redshift and here it is failing with following error. What I think is that redshift's configuration of S3 is changed with above code.

org.apache.spark.SparkException: Job aborted due to stage failure:
  Task 0 in stage 1844.0 failed 4 times, most recent failure: Lost task
  0.3 in stage 1844.0 (TID 63816, 10.0.63.188, executor 3): com.amazonaws.services.s3.model.AmazonS3Exception: Forbidden (Service:
  Amazon S3; Status Code: 403; Error Code: 403 Forbidden; Request ID:
  3219CD268DEE5F53; S3 Extended Request ID:
  rZ5/zi2B+AsGuKT0iW1ATUyh9xw7YAt9RULoE33WxTaHWUWqHzi1+0sRMumxnnNgTvNED30Nj4o=), S3 Extended Request ID:
  rZ5/zi2B+AsGuKT0iW1ATUyh9xw7YAt9RULoE33WxTaHWUWqHzi1+0sRMumxnnNgTvNED30Nj4o=

Now my question is why I am not able to read data again. How can I reset redshift's S3 configuration the way it was before setting explicitly after saving model into S3.
What I also don't understand is, initially aws values were None and when I try to reset with None on my own it returns an error saying
The value of property fs.s3n.awsAccessKeyId must not be null

Right now I am thinking workaround in which I will save model locally on databricks and then will make zip of it and upload it to S3 but still this is just a patch. I would like to do it in proper manner.
Sorry for using quote box for code because it was not working for multiline code for some reason
Thank you in Advance!!!
Answer: re-import the notebook that sets up the redshift connectivity.  Or find where it is set and copy that code.
If you don't have privileges to modify the notebooks you are importing then I'd guess you don't have privileges to set roles on the cluster.  If you use roles then you don't need aws keys.
Comment: Can I set roles for S3 instead of setting key and secret?
Comment: If you can create/modify clusters you can set role.  The role needs to exist with the correct privileges.  https://docs.databricks.com/administration-guide/cloud-configurations/aws/iam-roles.html


nginx as mail proxy

Question: I am trying to setup nginx as mail proxy. All i want is to let nginx receive the mail and forward it to a script. Is this set possible or should i only use sendmail for that.
Answer: The only way I can remotely imagine that working is if you would let nginx listen on the smtp port and run a smtp server web application on that port. At that point nginx would basically only connect the outside port to your locally running app.
So yeah, I think you would be much better off with a real smtp server like sendmail. Actually, I recommend you use postfix because it does the same thing arguably better.
Answer: there is a lack of documentation but from playing around with it
it looks to like the nginx mail options are for creating proxies to more easily add custom authentication to an existing MTA.
A use case might be to use a php script to authenticate existing website users using the website's existing users database without needing to create system users for them or set up extra databases.
so no, it won't forward the actual email to a script
(look for things like 'pipe_tansport' in MTA's like exim to do that)
but it will let you use a script to put authentication in front of an existing smtp server.

nginx as mail proxy


Advantages and use cases of Oracle's tablespaces

Question: I understand that a tablespace is a logical collection of tables and database objects. It could be made up of multiple data files (which are physical collections of objects). Apart from this, what are some of the advantages or use cases of tablespaces?
Comment: What other otpion do you have than storing the data in tablespaces/datafiles?
Answer: Few uses for the tablespaces:

When you no longer need the data you can drop the tablespace and delete datafiles. This is basically the only way to release space back from Oracle to the operating system.
When doing backups you can exclude tablespace from backup. E.g. if it contains non essential or easily recreatable data.
When doing restore you can skip tablespace. E.g. if you need only specific table or you need to start as soon as possible you can skip index tablespaces and rebuild indexes online.
Tablespace per user can be useful. Then when user is no longer needed you drop the user then drop tablespace and have disk space back. Also if user suddenly starts to generate lots of data only his tasks will break when tablespace becomes full. Other users will be unaffected.
Data blocks corruption usually is contained within tablespace. In such cases only one tablespace is affected.
You can store tablespaces (datafiles) on different types of disks. So you can manually manage which data goes on SSD and which on SATA.
In really rare cases you may need different block size for the tablespace.
You can choose to compress the whole tablespace content.
You can move selected data to a tablespace, unplug it from the database and attach to another database. This is transportable tablespace.
Comment: Datafiles can actually be shrunk without dropping the tablespace with "alter database datafile ... resize"
Comment: @sjk I know. But in real life the most probably you will have some of the remaining data near the end of datafile and resize command will fail.
Comment: Yes, I have noticed that. It can be fixed with "alter table ... move", but you will need a script for this if there are many segments in the tablespace. Dropping a whole tablespace is certainly easier if possible.
Comment: Resizing depends on highwater mark, if unoccupied then resizable.
Comment: This doesn't explain the need of grouping multiple datafiles into one structure and then calling it tablespace.