How do I fix Universal Minecraft Editor's broken chunk locator?

Question: The Universal Minecraft Editor allows users to edit many different parts of their world, including the  NBT of items, entities, and blocks. It is commonly used to edit NBT data of items.
However, the 1.16.100 update of Minecraft Bedrock Edition has broken the editor's Chunk Locator. Instead, the Chunk Locator shows a blank white canvas and I am unable to select a chunk to edit:

If you still attempt to select a chunk and hit the "Open" button, no luck, the following error appears:

This seems to only happen in worlds that are 1.16.100+. Older worlds will still open properly.
Why is this happening and how do I fix it?
Answer:
Notice
Unfortunately, this method no longer works. There are currently no more workarounds, so Universal Minecraft Editor remains broken with no fixes.
I personally do not continue to use UMCE due to the developer having somewhat extreme political views, making them a developer I do not wish to support. Therefore I do not continue to provide support for UMCE.
You can edit general world data with a MCJE NBT editor such as NBTStudio, and for items, you can use structures and behaviour packs. Both methods I am familiar with, and if demand suggests they would benefit from being posted here, I will do so.

Original answer
It was only a minor change that caused the Chunk Locator to break in 1.16.100. This minor change was the moving of the ChunkVersion tag to a different location, from byte 177 to byte 44. See the Minecraft Wiki for source.
Unfortunately, after emailing Matt G (oPryzeLP), he does not plan to fix the software, due to it being unpaid for.
But, all is not lost. I am happy to inform you that after speaking with Tryashtar on the Minecraft Commands Discord server, they have come up with a solution!
They have now rigged up their Image Map editor to, in addition to reading maps of your world, it will also restore the legacy ChunkVersion tag that is required for UMCE to work.
Just click on the Bedrock World button and click on the world you want to open. This will then automatically add back the legacy chunks.
You can get the file here.
Comment: I just tried this, and it didn't seem to work. Did something change?
Comment: @Pikatchoo32 Yes, MCBE is constantly changing. This was a temporary solution that was very janky. It doesn't surprise me that this is broken, and I doubt it'll ever work again.
Comment: Too bad, hopefully the new editor that Matt's working on can pull off all the same stuff.


What is the purpose of base classes in Python if you're already referring to the implementation classes consistently

Question: I have a bunch of python classes that are responsible for validating files like so:

java file validator
html file validator
css file validator
javascript file validator

All of these classes define a validate_file(path) and validate_string(string) function.
In the client code of my application, I store all of these validators in an array and I iterate through all of them and call the methods on them in exactly the same way.
Is there a purpose in my case of defining a base "validator" class which defines these methods as abstract? How can I benefit from making these individual classes adhere to the base class? Or maybe in other words, what features would be unlocked if I had a base class with all of these validators implementing it?
Answer: If you ever write code that needs to process mixed types, some of which might define the API method, but which shouldn't be considered "validators", having a common base class for "true" validators might be helpful for checking types ahead of time and only processing the "true" validators, not just "things that look like validators". That said, the more complex the method name, the less likely you are to end up with this sort of confusion; the odds of a different type implementing a really niche method name by coincidence are pretty small.
That said, that's a really niche use case. Often, as you can see, Python's duck-typing behavior is good enough on its own; if there is no common functionality between the different types, the only meaningful advantages to having the abstract base class are for the developer, not the program itself:

Having a common point of reference for the API consumer makes it clear what methods they can expect to have access too
For actual ABCs with @abstractmethod decorated methods, it provides a definition-time check for subclasses, making it impossible for maintainers to omit a method by accident
Comment: So would you recommend that I do create one because it would make it impossible for me to create an invalid validator? For example, I might create a `ruby_file_validator` that has a typo in one of its method names or something.
Comment: @Ogen: It's mostly personal preference when both interface and implementations are under your control, and used by you. The main reason to create one would be if you were creating an API (for other developers) that required that interface, where defining the interface provides clear expectations that couldn't otherwise be expressed in a concise, checkable way.
Answer: Base classes in Python serve to share implementation details and document likenesses. We don't need to use a common base class for things that function similarly though, as we use protocols and duck typing. For these validation functions, we might not have a use for a class at all; Java is designed to force people to put everything inside classes, but if all you have in your class is one static method, the class is just noise. Having a common superclass would enable you to check dynamically for that using isinstance, but then I'd really wonder why you're handling them in a context where you don't know what they are. For a programmer, the common word in the function name is probably enough.


if $\sum_{n=1}^{\infty}a_n$ converges, then $\sum_{n=1}^{\infty} a_{2n-1}$ converges?

Question: I think this statement is wrong.
Consider $a_1=1, a_2=-1, a_3=1/2, a_4=-1/2, a_5=1/3, a_6=-1/3, \dots$
Is my logic correct?
Comment: Absolutely correct.
Comment: If all the terms are nonnegative, then of course the result is correct.
Comment: Yes, it's a wrong statement. but if we put some additional conditions, like (monotonically) increasing/decreasing, maybe the statement can be true...
Comment: Can you give a proof for if all terms are nonnegative, the statement is true?
Answer: Proof of the problem with the additional condition:

All terms are nonnegative.

If all terms are nonnegative, $S_n = \displaystyle \sum_{k=1}^{n} a_{2k} \geq 0$ and $T_n = \displaystyle \sum_{k=1}^{n} a_{2k-1} \geq 0$.
Since $R_n = \displaystyle \sum_{k=1}^{n} a_{k} = \sum_{k=1}^{n} a_{2k-1}+\sum_{k=1}^{n} a_{2k}, \ 0 \leq T_n \leq R_n.$
Thus, $T_n$ has the lower/upper bound.
Since the sequence $T_n$ is monotonously increasing and $ \displaystyle \lim_{n \to \infty} R_n = \alpha$,
$\displaystyle \sum_{k=1}^{\infty} a_{2k-1} = \lim_{n \to \infty} T_n$ converges by Monotone Convergence Theorem.
+) There is another additional condition that makes the statement correct:

$a_n$ is monotonously increasing/decreasing.

If $a_n$ is monotonously increasing, $a_{2k-2}\leq a_{2k-1}\leq a_{2k}$.
Therefore, $\displaystyle a_1+ \sum_{k=2}^{n} a_{2k-2} \leq \sum_{k=1}^{n} a_{2k-1} \leq \sum_{k=1}^{n} a_{2k}$.
Adding $\displaystyle \sum_{k=1}^{n} a_{2k-1}$, we get:
$\displaystyle a_1 + \sum_{k=1}^{2n-1} a_k \leq 2\sum_{k=1}^{n} a_{2k-1} \leq \sum_{k=1}^{2n} a_k.$
Let the three sequences above $R_n, S_n, T_n. (R_n \leq S_n \leq T_n)$
Then, $\displaystyle \lim_{n \to \infty} R_n = a_1+\alpha, \lim_{n \to \infty} T_n = \alpha$. ($\alpha = \displaystyle \sum_{n=1}^{\infty} a_n.$)
If $\exists t \text{ s.t. } a_t>0, \displaystyle \lim_{n \to \infty} a_n > a_t > 0, \text{ Diverges.}$
Therefore, $a_n \leq 0 \text{ for } \forall n$, $S_n$: monotonely decreasing.
$\therefore S_n $ converges bt Monotone Convergence Theorem.
$\\$
I recommend you to try the monotonously decreasing case, which is quite same to those above.
(Or, you can make $b_n=-a_n$ and show $b_n$'s convergence.)
Answer: Yes.
Notice that
$$
\sum_{n=1}^N a_n = \begin{cases}
0, & \text{$N$ is even} \\
1/k, & \text{$N$ is odd and $N=2k-1$} \end{cases}
$$
and so the partial sums converge to $0$ as $N\to\infty$.
Meanwhile,
$$
\sum_{n=1}^\infty a_{2n-1} = \sum_{n=1}^\infty \frac 1 n
$$
which trivially diverges.
Comment: No. The partial sums should follow that piecewise definition.
Comment: Did you mean to define $a_n$ with the piecewise and not the sum?


How do I make Jukebox music that follows a player?

Question: Believe it or not, there are still players that listen to music discs in Minecraft, including me.
I tried making a command loop that would play different discs for me every 5 minutes. Here's what command I use:
/execute at Quijibo run playsound minecraft:music_disc.stal record Quijibo

This successfully executes the command, and the music starts playing, but if I move away from the point where I was standing, the music fades away, as if there was a jukebox playing the music that I'm moving away from.
What I want to do is have the music follow me when moving. Is this possible to do through commands?
Comment: Unlikely, at least without restarting the track every time.
Comment: Yeah, but even if I would be playing the track using continuous commands, I don't know how I would keep the music going without pausing.
Answer: In theory the minimumVolume parameter should fulfil exactly this purpose, but I couldn't get it to work. Maybe that's a bug.
But the volume parameter of /playsound can in a way actually be used to specify a spatial volume instead of an audio volume! The trick, as described in the wiki (archive):

For values greater than 1.0, the sound will not actually grow louder, but its audible range (a 16-block radius at 1.0) will be multiplied by volume. There will always be a gradual falloff to silence based on distance from the center of the sphere.

That means that you can just enter the maximum value of a Float, except that it's for some reason slightly different in Minecraft. By just trying out values I found that the maximum value is:
340282356779733661637539395458142568447.99999…

So you can use this command to play a sound everywhere:
/playsound <sound> <channel> <selector> <x> <y> <z> 340282356779733661637539395458142568447.9999999999

That way it only gets 0.000000000000000000000000000024936% quieter when you go to the other end of the world.
This even works across dimensions for some reason. But when you go through a portal, the sound stops.
Comment: Dammit! Now every time I walk away 12,033,694,344,163,658,243,080,625,752,106,000,000 blocks away from the source, I won't be able to hear the music. I hate it when that happens!
Comment: But to be clear there is no way to make a playsound follow a player without expanding the distance it can be heard?
Comment: @Nik3141 No, `/playsound` always has a point of origin of the sound, just like almost all sounds in Minecraft. The exceptions (dragon death, wither summoning) actually also apply to `/playsound`, no matter the origin and radius. I didn't test what happens with the background music. But since `/playsound` lets you select who hears a sound, that doesn't matter anyway, you can just select players who are in a radius initially, if you want that.
Comment: @Fabian I was hoping I could play the sound at the location of an entity or something moving rather than fixed coords. Essentially, I didn't want to restrict who could hear it in any way other than their distance from a particular entity (player).
Comment: @Nik3141 Then just use the coordinates of that entity, `@a` and the radius you want.
Comment: But those coordinates are fixed. If I, a player, am the source of a sound, and fall off a cliff, that sound won't fade away to any observing players at the top of the cliff: it'll stay fixed in place. I was just wondering if you could somehow use a changing/moving position to be the origin point of a sound, but it appears that you can't.
Comment: Oh, you want to be the source of the sound and have that move around, audible for other players. They no, the sound system of Minecraft doesn't allow that. And they didn't even write that themselves, so it's unlikely that that changes anytime soon. Your best option would be to cut the sound up into many small pieces. Or, if the path and duration of movement is known, you can do something like Noxcrew did in the "Terra swoop force" map for their elevator, they have a video about it on their YouTube channel.


Why does bleeding radiators save energy?

Question: I wanted to bleed my radiators by myself for the first time and I was wondering what is the reason that bleeding radiators saves energy?
Most of the guides on bleeding radiators mention that this is important for saving energy but none explain the exact reason why. I understand that by bleeding you increase the surface area through which the radiator can heat the room and probably also the surface area through which the hot water heats the radiator.
Comment: It's a fair question.  A lower surface area results in lower heat transfer on a local basis, but why would the system overall be less efficient? @FreeMan, your response doesn't explain why less heating would be necessary. How does air in a radiator affect heat cycles or total heating time?
Comment: Don't you think that increasing the surface area available to heat transfer would make the transfer more efficient, therefore requiring less heating of the water and, therefore, spending less to heat the water? Where, exactly, are you lost in the process?
Comment: Just a note: you'll likely need to bleed it again.  The fresh water that comes into the system will have air in it.  It takes a few times after if it's been drained and refilled.  Also, I've learned to protect any carpet or rugs near the valve so they don't get stained.
Comment: I used to read a lot of misinformation in automotive forums regarding radiator function in performance cars. Heat cycles and energy efficiency are often oversimplified or simply described incorrectly. It's not always as intuitive as it may seem.
Comment: Wait, are we talking forced-water or steam?
Comment: I assumed it was a hot water radiator system.  A steam system always has air in it.
Comment: @JimmyJames  Yeah, but No: if you do a decent job of bleeding all radiators, then a tiny amount of air won't make a noticable difference - no need to repeat the job repeatedly
Comment: @MikeB I've to do it up to three times after refilling just so I don't have the horrible sloshing sounds waking me up in the morning.
Comment: @SteveSh Yeah, I'm more familiar with forced but that was my understanding as well.  I always ask OPs to clarify that because the way they work is fundamentally different.
Comment: For an intuition, imagine what would happen if the entire radiator was full of air.  Other than being slower, would a system with *no* radiators be less efficient?
Comment: @2e0byo  Sorry, but if you imagine a system that has zero flow, then I think we can see that the efficiency would be 100% ? (No losses...)
Comment: @MikeB and no useful output, so 0/0; but I was imprecise anyhow, I meant 'imagine what would happen if the entire radiator was *so full of air that it was effectively a pipe*---i.e. a system with flow but no radiators; or imagine replacing the radiator (large pipe) with a small pipe.  Obviously a system with flow but no radiators would be less efficient than a system with radiators, so there must be other losses (heat lost in useless places, boiler running in an inefficient regime, pumping).
Answer: For maximum efficiency, many modern heating systems (condensing gas boilers, heat pumps) are designed to output heat at a low water flow temperature.  The unit can generate heat more efficiently at (for example) 40C than at 70C.  The heat emitters (radiators etc) are sized to achieve a certain deltaT (difference from input to output water temp) at that flow temperature - ie the amount of heat supplied to the room.
Air in radiators reduces the usable surface area of the radiators.  That reduces the heat flux provided by the radiator.  It means the water is returned hotter back to the heater, reducing the deltaT.  In extremis the heating system may be unable to keep up with heat losses from the room.
If the surface area of your emitter is reduced, the unit will have to work harder to maintain the same temperature in the room.  If it can't successfully heat the room, it'll either work longer (increasing distribution losses as mentioned) and it'll extract less heat from combustion (a higher return temp means less heat is exchanged with flue gases, meaning more is wasted in the exhaust).  Or, if the unit has some kind of dynamic adjustment, it'll decide to heat the water hotter, which reduces its efficiency.
Comment: One aspect that you don't mention here is that losses in the system (e.g. heating voids in the walls or an unfinished basement) are greater when the temperature is higher.  And the pump(s) are not working as hard to move the same amount of water when the system is full.  Consider a siphon: it won't start if there's too much air at the top.
Answer: If you get less heat because of air in the radiators, the losses in the system can add up to a greater %.
Depending on where the pipes run, some heat might be lost in useless places. This is worse if it runs longer to provide the same heat. Also worse if you return warmer water through one of those useless places.
You also need energy to pump that water. If you need to pump more water, you need more energy.
Not really an answer but I suspect it gets repeated so much because most people don't understand how this works and directly equate "colder radiator" with "lost energy".
Comment: If the room is too cold, people turn the heating up.
Comment: "If you get less heat because of air in the radiators" - Isn't that the core of the question: unless the radiator is completely empty, there will still be heat transfer, but at what point does that become an issue?
Comment: @SteveSummit every water-filled-radiator-connected heating system I have ever used has had a temperature setting on the boiler that is independent of the thermostat in the room being heated (standard UK setup tbh) - thats the one which gets changed in my experience...  Has the side effect of making the next person washing their hands yell swear words...
Comment: That's a good point about "Depending on where the pipes run, some heat might be lost in useless places".  In one of my earlier houses - a 2 story Victorian (or Four Square?), all the pipes ran along the inside of a wall (not the interior of the wall).  So any heat lost by those pipes just went into heating a different room.
Comment: @SteveSummit thing is, the room being heated up is not a perfectly sealed container - energy is lost.   If the energy source in the room is less efficient at heat transfer (ie the lower amount of water in the radiator coupled with the insulating properties of the air replacing the water), less energy is imparted to the room at any given moment - the room heats up slower or not at all, resulting in people trying to add more energy by increasing the water temperature. Making the heat transfer more efficient by increasing the volume of water means you dont need to impart more energy to the water.
Comment: @user253751 Sure, but that doesn't make it less efficient.  It's like trying to save water by installing low-flow faucets.  If someone needs a gallon of water, they can get it, it'll just take twice as long.  But a gallon of water still gets used.  Same with one joule (calorie, therm, kilowatthour) of energy: if it gets from point A to point B, it gets there, it doesn't necessarily affect the efficiency.  *Unless* by changing the transfer rate, more of it gets "lost in useless places", which I think is the key to the answer.
Comment: @SteveSummit in your example, sure waiting longer means the person can get their gallon of water regardless of the flow rate of the source, but imagine if the container they are capturing the water in itself has a hole - at what rate does the flow rate into the container exceed the flow rate out of the container through the hole? At given flow rates, the container will never fill up, meaning you have to adjust the flow rate in either by increasing pressure or by making the inlet larger. In the case of radiators, increasing pressure is "make the water hotter" and a larger inlet is "more water".
Comment: @Moo Sure, and those are fine analogies, but we don't have to imagine that the container has a hole: we *know* that it does!  No room is perfectly insulated, so heat will always be lost.  Although, the loss is proportional to ΔT, so a colder room loses less heat, so if the radiator works less well at heating the room, it might end up being *more* efficient!
Comment: Also, in most heating systems, end users have no control over the water temperature.  If the room's too cold, yes, they'll turn up the thermostat, but if the heating system couldn't deliver enough heat to reach the lower setpoint, it certainly won't be able to reach the higher setpoint!
Comment: @MikeB that is indeed the core of the question: there is still heat transfer, and the heat which is not transferred remains in the water, so how is energy saved? That's what I tried to answer.
Answer: A radiator works best if the water inside it slows down and lingers to emit the heat into the room. Flow speed depends on the cross section of the pipe and the volume per time being pushed through, a radiator is equivalent to a much wider pipe section.
A massive airbubble in the radiator decreases the effective cross section of the radiator. meaning that less heat transfer happens in that radiator and that you are returning hotter water back to the boiler which means more heat loss from the return pipe.
Another factor is that you lose quite a bit of surface area that could be used to transfer the heat into the room.
Comment: **This is wrong.** At least the first point is wrong. It's the same fallacy I've heard in the automotive community regarding engine radiators. Heat transfer is proportional to temperature differential, so slowing things down _reduces_ heat transfer because the average differential will be smaller.
Comment: No. Over time heat is lost, reducing the differential. With higher flow the differential remains higher, on average. If what you're saying is true these systems would have trickle pumps. The only relevant factors are input temperature and surface area.
Comment: and it's proportional to the amount of time the heat differential is present. Things will cancel out there. Therefore keeping the water in the radiator slow will help heat transfer. The other option is to zigzag the pipe around.
Comment: @isherwood  You seem to be confused. In automotive (as well as here) there are 2 delta Ts that must be managed to produce the best efficiency, engine to water and water to air. If we maximized water to air efficiency as you suggest, then when water returned to the engine it would be very close to engine temp, and engine to water efficiency would be minimized.
Comment: In this case, furnace-to-water is not constant. It's an on-demand situation. There's nothing to maximize from the radiator. Also, in the case of the automobile, the engine expels massive amounts of heat to the air _directly_. The concept is cut-and-dried. Slowing flow in either case is detrimental.
Comment: @stonemetal Each litre of water would be cooled less by the radiator and warmed less by the engine. But it would circulate more times per second. It would also spend less time being too hot to warm up and too cold to cool down, which would improve heat transfer.
Answer: Net energy consumption won't be affected very much if some radiators have some air in them.  But if you look at the efficiency of the system's ability to heat the house, and to heat each room appropriately and quickly, THAT efficiency is reduced significantly if parts of the system are essentially disabled by being full of air.
In a ideal system each radiator is sized so that it provides the right amount of heat to the room it is in, each room has a suitably sized radiator (accounting for the particulars of the room eg north/south facing, windows, etc) and the boiler is sized to provide the correct amount of heat flow to all the radiators.  If there are zones, the boiler is capable of working efficiently with any zone or multiple zones.
There are not a lot of ideal systems.   There are lots of things that can throw the ideal out of whack.   Someone can open a window.  A room with large windows could have the curtains left open in the sun.  The occupant of a room could turn the radiator off, or there could be thermostatic valves on radiators that turn them off automatically.
If one radiator is partly or totally full of air, that's no different to the radiator being partly or totally turned off at the valve by a user or by a thermostatic valve.  It does not make the entire system more efficient or less efficient.  Except at heating the particular room it's in ... it's less efficient at that, because its capacity is reduced by up to 100%.
If ALL the radiators  have a little air in them, the entire system has less capacity to emit heat, so it will heat the house more slowly.   That isn't necessarily more or less efficient from an energy-consumption perspective but it's certainly less efficient in heating the house quickly.  On a very cold day it may not be able to keep up.
If ALL of the radiators have so much air in them that the house just can't be heated, then the boiler will cycle rapidly and may have trouble finding a stable temperature.  The problems with that are bigger than efficiency.
Answer: You've hit on some major reasons why you should bleed them so I won't repeat them. Another reason is to balance the heat in all the rooms. If the thermostat is in a room with an un bled radiator, it will take longer for that room to heat up and kick the thermostat off and the boiler will run longer and the other rooms will be hotter than the operator wanted.
Comment: Neither the question nor this answer address _efficiency_, assuming all radiators have a similar water level. You've described one possible edge case only.
Comment: As a corollary - if the radiator in the room with the thermostat is too big, the thermostat will turn OFF too soon for other rooms to warm up, so this may actually improve things!
Comment: @isherwood the goal here is a warm house, not actually heat transfer, so a system that uses more energy to make a warm house can be said to have less efficiency.
Answer: It messes up with the water circulation in general in the system. People have mentioned efficiency, but that depends then on the piping layout. If the house and piping is isolated from the outside all of the heat still ends up in the house. But the thermostat on the radiator wont work right if there is air at the top either and that could result in a hotter house overall instead of the temperature you meant the house to be at, the thermostat area of the radiator remaining cooler than the rest  - and that would cost more money.
Answer: A radiator produces heat. That's the least efficient possible use of energy. To make a radiator more thermodynamically efficient, we would have to turn it into an engine that turns some of the energy into work, so that less of it is is wasted as heat.
A radiator system full of air bubbles will not move heat where you want it, though, or not very well. If the system doesn't circulate properly, the wrong spaces will be heated. If you're heating unoccupied spaces, while people are cold in occupied species, that's a waste of energy. That's what is inefficient: low benefit for the same cost/energy.
Returning to my first point, though, it can't be the case that you're getting less total heat out of the system for a same energy input though, just because there is air in the lines.
Answer: Given all the conflicting answers here and the fact that some seem to be partially correct but not completely, I've thought about this, come up with my own answer and then had someone I know with a graduate degree in thermodynamics and an esteemed multi-decade career as an engineer in the HVAC industry confirm my understanding.
The fundamental thing to realize here is that the point of a home heating system is to move heat generated at the heating source to the living areas of the home.  In the case of a forced-water hydronic system, the water in the system is the 'carrier' of the heat which moves through the pipes of the system and delivers it to the radiators.  Efficiency in this context is basically defined as what percentage of the heat generated at the source to the radiators.
At a very simple level, the presence of air in the pipes means there is less water.  That is, the capacity of the system's ability to hold, and there more deliver heat is reduced.  In addition (as my expert explained) the "air will go into solution with the water which reduces the heat transfer properties."
The secondary issue is that if there's enough air, it can create gaps in the system which makes moving the water more difficult.  That is, instead of cycling water in a gravity-neutral way, the pump needs to work to move water from (typically) the lowest point in the home to the highest point.  If this isn't intuitive, note that a siphon can move water with only the force of gravity but only if the tube is sufficiently (i.e.: nearly completely) full.  While this extra work is undesirable from a wear and tear perspective, it's the reduction in flow that is going to really have an impact of the efficiency.
In a nutshell the air in the system means heat being produced at the source is not distributed as quickly and/or as evenly as it could be.  Here's an analogy, consider a bus-system that travels around a city and we can define efficiency as the maximum number of people that it can move each day per bus.  If we were to remove half of the seats in each bus and change nothing else, the efficiency of the system would clearly be reduced.  The hydronic system is like a bus-system for heat and air reduces the amount of heat that can be delivered over a given time span.  This means more heat loss at the source (such as an unfinished basement because it remains there longer) as well as in other non-living area such as in voids that the pipes pass through.
Answer: Two reasons:

Water has a 4x higher heat capacity than air.  If your boiler puts out 1000 units (joules, whatever), and your system is 50% air, you end up with 625 units in your system to be circulated around your house.

Water is more efficient at transferring heat than air, by like 24x.  If you have 50% air in your system, the radiator will only transfer about 52% of the energy out.

Obvs there are transfer efficiencies that aren't accounted for here, just using some numbers as examples of why you don't want air in your radiator system.
Comment: Well, if the air is trapped in the radiator (like at the top), then it does not circulate.
Comment: If 625 units go "into the system" then where do the other 375 go???
Comment: @SteveSh makes an excellent point. Typically air in a system is localized at the top of any given radiator - not traveling through the system. Every bleed valve I've seen is at the top of a radiator for that reason. So if 25% of a radiator's volume is air you're losing about 25% of heating effectiveness in that room.
Comment: @SteveSh  Precisely - which is why you have to bleed _every_ rad, not just one.
Comment: @SteveSh sounds like you just corroborated both of my points...
Comment: The air does not circulate. It does not receive heat, and does not transfer any. This answer ignores how radiators work
Comment: Water has about an 800x greater heat capacity than air, based solely on density.
Comment: People are missing the point of the answer. Water is what is heated. Its energy is transferred to the radiator and the radiator transfers it to the room. Air in the radiator is poor at transferring heat from the water to the radiator. If the radiator is completely full of water, more water is transferring heat to the radiator than if the radiator is partially filled with water and the rest is filled with air. Bleeding the radiator allows it to fill with water, so more heat is transferred to the room. (cont'd)
Comment: If the water loses less heat during its rounds because less is being transferred to the radiator, it returns to the boiler hotter. Heating under those conditions is less efficient (see user1908704's answer).
Answer: Bleeding may safe money, if you happen to live in an appartment that shares the central heating with other appartments, because the sensors that are used to distribute the heating costs assume equal efficiency. If your radiator is less efficient because of air inside it, you're billed more heat than you actually use.
Bleeding does not save energy, though - as long as you heat your room to the same temperature, it doesn't matter whether you use one radiator or two or half of one or none (use a server rack instead, perhaps :-), the energy required stays the same.
Comment: I'm not sure I follow why it wouldnt change the energy consumption.  For that to be true, I feel like you would need to have a few assumptions that dont hold here.  If the heating system converted 100% of the energy input to heat _and_ the rooms were completely thermally isolated from their surroundings maybe that would apply.  But energy is also required to move the water, and not all heat sent to the radiator will necessarily go into the room and stay there.
Comment: If we follow the logic of this to its logical conclusion, there would be no need for water in your hydronic system at all.
Comment: @JMac you're right, of course, this is an abreviated depiction. My point is - as long as the source of energy is within the house and _temperature in the room stays the same_, it doesn't really matter how the energy is transported. What matters is whether the radiator works at 50% efficiency or 100% efficiency, because at 50% efficiency the energy is effectively twice as expensive (if you have cost distributing sensors).
Comment: @JimmyJames at least, if you reach the same room temperature without any water at all... I doubt the burner will work at all without enough water... `as long as you heat your room to the same temperature` is the important limit on the way to the logical conclusion


Does your team's faction limit affect hero choice?

Question: In recent months, I've started playing Dota-2. However, when playing match-made, un-ranked games, I've been able to choose any character, even though, according to the in-game lore and the wiki page, the heroes belong to either the Radiant or Dire.

Is this intended? Does it change in other game modes? (I've been playing All Pick.)
Answer: History:
In DotA 1 in the early years the default mode (called "normal") would have limited both sides (Sentinel and Scourge in DotA 1, Radiant and Dire in DotA 2) to pick the heroes their sides are connected to. There was even a third party neutral which would be offered to both parties to pick from.

At some point the mode All Pick was introduced which allowed to pick any hero. Balancing was not done for this kind of setup at the start but since the mode became the most popular in public games DotA 1 started to get balanced around this mode until Captains Mode was the main focus of balance. Because All Pick became so famous there was no longer a need to have parties per se. I guess Sentinel and Scourge were kept to keep the theme of the game (Defense of the Ancients) and the lore (good vs evil) while the neutral party was split and added into the remaining two parties that you can see today.
Bottom Line:
In DotA 2 these sides have no effect anymore other than being part of the lore or until Valve/Icefrog decide to include the modus -normal again.
Even more detail:
In Warcraft III (the normal game) you would pick heroes depending on your race(human,orc,etc) from your own altar. Furthermore you were able to purchase neutral heroes from taverns (everyone can access those).
The concept to buy heroes from taverns and to have neutral heroes in the first place was copied into DotA 1.
Here are three pictures representing DotA 1 hero selection showing the evolution of Taverns (examples):

Upper left picture shows that back in v6.09 each faction/side had its own taverns(3).
Upper right picture shows that later in v6.60 all taverns were stored in the upper left corner of the map. Each side of the triangle has 3 taverns which stand for an attribute (strength, agility, intelligence) and within each tavern lies one faction (sentinel, neutral, scourge).
The last picture shows the modern arrangement (v6.70) of the taverns without the neutral faction. From left to right we have two sentinel and two scourge taverns. From top to bottom we have strength, intelligence and agility.
Comment: nice answer.  I never played the original so interesting to see a bit of the history of dota
Comment: thanks. i could add that in Warcraft III (the normal game) you would pick heroes from your own altar(according to race[human,orc,etc]) and could purchase neutral heroes (anyone can access) from taverns. The concept to buy heroes from taverns and to have neutral heroes in the first place was copied into DotA 1.
Comment: Those were the days..
Answer: No; you can pick any hero, regardless of your assigned faction (barring any other restrictions specific to your specific game mode, of course). Since the faction split has absolutely no effect on gameplay in Dota 2, the fact that specific heroes are categorized as "Radiant" and "Dire" currently serves basically two purposes:

For story/lore purposes.
It also serves to break up the hero selection screen in half vertically to make it a little easier to "read."

The original DotA map broke up the heroes into "Sentinel" and "Scourge" in much the same way.
Comment: Also in Warcraft 3 dota you had a mode where Sentinel could only pick Sentinel heroes and Scourge only Scourge heroes
Comment: @Panic i doubt that your second point is valid. The history of dota 1 dictates that there need to be two sides rather than valves "design" decision for dota 2. Any sources on your second point?
Comment: @Wandang Regardless of the history, the grid view *is* broken up that way. That's a current effect that the faction breakup has, regardless of the prior reasons or history involved. That's all I meant by it.
Answer: The heroes are split between Dire and Radiant only for flavour and there are no limitations for piking one depending on your team.


delta (OSS) + MERGE recreating the underlying parquet files though there is no change in the incoming data

Question: I am using delta (OSS - version 0.7.0 with pyspark 3.0.1) and the table is getting modified (merge) every 5 mins - microbatch pyspark script.
When I run for the first time it created 18 small files (numTargetRowsInserted -> 32560) and I used the same data and rerun again though there is no change in the data, table is touched and the version is updated and the number of small files increased to 400 and perviously added 18 files were marked as removed. However, except the first MERGE, subsequent merger is having the following values numTargetRowsCopied -> 32560 in the OperationMetics. Why the target rows copied again and the older files are marked as removed? Am i missing anything?
OperationMetrics data is as below,
operationMetrics                                                                                |
[numTargetRowsCopied -> 32560, numTargetRowsDeleted -> 0, numTargetFilesAdded -> 18, executionTimeMs -> 0, numTargetRowsInserted -> 0, scanTimeMs -> 68457, numTargetRowsUpdated -> 0, numOutputRows -> 32560, numSourceRows -> 32560, numTargetFilesRemoved -> 400, rewriteTimeMs -> 66410]|
[numTargetRowsCopied -> 32560, numTargetRowsDeleted -> 0, numTargetFilesAdded -> 400, executionTimeMs -> 0, numTargetRowsInserted -> 0, scanTimeMs -> 16838, numTargetRowsUpdated -> 0, numOutputRows -> 32560, numSourceRows -> 32560, numTargetFilesRemoved -> 18, rewriteTimeMs -> 48810]|
[numTargetRowsCopied -> 32560, numTargetRowsDeleted -> 0, numTargetFilesAdded -> 18, executionTimeMs -> 0, numTargetRowsInserted -> 0, scanTimeMs -> 12399, numTargetRowsUpdated -> 0, numOutputRows -> 32560, numSourceRows -> 32560, numTargetFilesRemoved -> 18, rewriteTimeMs -> 15039] |
[numTargetRowsCopied -> 32560, numTargetRowsDeleted -> 0, numTargetFilesAdded -> 18, executionTimeMs -> 0, numTargetRowsInserted -> 0, scanTimeMs -> 12244, numTargetRowsUpdated -> 0, numOutputRows -> 32560, numSourceRows -> 32560, numTargetFilesRemoved -> 18, rewriteTimeMs -> 14828] |
[numTargetRowsCopied -> 32560, numTargetRowsDeleted -> 0, numTargetFilesAdded -> 18, executionTimeMs -> 0, numTargetRowsInserted -> 0, scanTimeMs -> 67154, numTargetRowsUpdated -> 0, numOutputRows -> 32560, numSourceRows -> 32560, numTargetFilesRemoved -> 400, rewriteTimeMs -> 70194]|
[numTargetRowsCopied -> 32560, numTargetRowsDeleted -> 0, numTargetFilesAdded -> 400, executionTimeMs -> 0, numTargetRowsInserted -> 0, scanTimeMs -> 20367, numTargetRowsUpdated -> 0, numOutputRows -> 32560, numSourceRows -> 32560, numTargetFilesRemoved -> 18, rewriteTimeMs -> 80719]|
[numTargetRowsCopied -> 0, numTargetRowsDeleted -> 0, numTargetFilesAdded -> 18, executionTimeMs -> 0, numTargetRowsInserted -> 32560, scanTimeMs -> 7035, numTargetRowsUpdated -> 0, numOutputRows -> 32560, numSourceRows -> 32560, numTargetFilesRemoved -> 0, rewriteTimeMs -> 11606]   |
Merge SQL :
MERGE INTO Target_table tgt
USING Source_table src
ON src.pk_col = tgt.pk_col
WHEN MATCHED AND src.operation=="DELETE" THEN DELETE
WHEN MATCHED AND src.operation=="UPDATE" THEN UPDATE SET *
WHEN NOT MATCHED AND src.operation!="DELETE" THEN INSERT *

Answer: Hi try to see this for basic guidelines .

I recomend use partition for minimize the cost of intence merge
operations
write with coalece 1 this guarantee 1 file per partition but watch
out with the cardinaliti of columns selected for partition

my case
Comment: Thank you Cristain.!
I got the #1
Comment: For #2, how to enforce the 1 file per partition? I thought will have to do the compaction on the delta after the Merge.
Comment: only create a table with the coalace(1) and check files by partition, this depends of you spark configuration and executors , see this : https://stackoverflow.com/questions/31674530/write-single-csv-file-using-spark-csv
Answer: That's a known behavior of the Delta - it rewrites every file that has matching record in the ON clause, regardless of the condition for WHEN MATCHED / WHEN NOT MATCHED.
In your case, if you're using the same data, you still have matches with data in the table, so ON condition is executed, and then when it's going through MATCHED/NOT MATCHED it doesn't find anything. To avoid this you need to think on how you can change condition to be more specific.
Look into this talk (and slides) - it explains how MERGE works
Comment: Thank you Alex.! Will check it out.!


Setup Google cloud shell environment for Cloud ML

Question: I am trying to setup a google cloud shell environment for my google cloud project that uses Cloud ML.
I am following the instructions on their setup page itself:
Getting Setup | Google Cloud Machine Learning
I executed this command in my cloud shell:

curl
  https://raw.githubusercontent.com/GoogleCloudPlatform/cloudml-samples/master/tools/setup_cloud_shell.sh
  | bash

The last part of ouput trace for this was :

echo 'Success! Your environment has the required tools and dependencies.' Success! Your environment has the required tools and
  dependencies.

This command:

export PATH=${HOME}/.local/bin:${PATH}

Produces no ouput.
And finally the command to check the environment:

curl
  https://raw.githubusercontent.com/GoogleCloudPlatform/cloudml-samples/master/tools/check_environment.py
  | python

Produces this output:
vineetkaushik053@cloudshell:~$ curl https://raw.githubusercontent.com/GoogleCloudPlatform/cloudml-samples/master/tools/check_environment.py | python
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  3814  100  3814    0     0  17274      0 --:--:-- --:--:-- --:--:-- 17257
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
You are using pip version 8.1.1, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Your active configuration is: [cloudshell-11180]
ERROR: Unable to list Cloud ML models: {
  "error": {
    "code": 400,
    "message": "Field: parent Error: Name should be in the form of 'projects/your-project-id'",
    "status": "INVALID_ARGUMENT",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.BadRequest",
        "fieldViolations": [
          {
            "field": "parent",
            "description": "Name should be in the form of 'projects/your-project-id'"
          }
        ]
      }
    ]
  }
}

When it should be producing:
"Success! Your environment is configured correctly." when the script finishes successfully.
Please tell me how to resolve this so that I may move to the next part of the setup.
Answer: Resolved this.
Need to set the project for the environment. You can use this command:

gcloud config set project your-project-ID
Comment: Yes, from "@cloudshell" string in your original output it looks like you started Cloud Shell without having a current project in Cloud Console.  Typically the current project is set up in the shell automatically to match the current Cloud Console project.


Django: How to depend on an externally ID, which can be switched?

Question: Consider the following scenario:
Our Django database objects must rely on IDs that are provided by external service A (ESA) - this is because we use this ID to pull the information about objects that aren't created yet from the external directly. ESA might shut down soon, so we also pull information about the same objects from external service B (ESB), and save them as a fallback.
Because these IDs are relied on heavily in views and URLs, the ideal scenario would be to use a @property:
@property
dynamic_id = ESA_id

And then, if ESA shuts down, we can switch easily by changing dynamic_id to ESB_id. The problem with this though, is that properties cannot be used in queryset filters and various other scenarios, which is also a must in this case.
My current thought is to just save ESA_id, ESB_id, and dynamic_ID as regular fields separately and assign dynamic_ID = ESA_id, and then, in case ESA shuts down, simply go over the objects and do dynamic_ID = ESB_id.
But I feel there must be a better way?
Answer: Having ESA_id and ESB_id fields in the same table is a good solution, then you have some kind of setting (DEFAULT_SERVICE_ID='ESA_id'|'ESB_id') and your code change the lookup based on this option.
Here you can see an aproach to create filters dynamicly
https://stackoverflow.com/a/310785/1448667
Comment: The second part of my answwer was meant to give you a solution, wich I failed to do ;) If you change the querysets of your views to have the reference to the id you are using at the momtent it will do the trick.
Comment: Thanks. I do have them both in the database. The question is how to refer to them dynamically - meaning, if ESA went down, how can I switch to ESB with changing the references in the views.


D3 Force Graph With Arrows and Curved Edges - shorten links so arrow doesnt overlap nodes

Question: I just read through this post - Links and Arrowheads to terminate at borders of nodes in D3 - however i am struggling to map his answer (on his curved links) with my example which (i think actually) uses a simpler/different curved edge for my links.
I have been working on a reproducible example of my problem, with force graph showing, for the last 20-30 minutes however for some reason the graph is not appearing (even though the code snippet is not throwing an error). It is inevitably a bunch of code (recreating a d3 force graph), although only a small section needs to be fixed. First, here is the code snippet:

const svg = d3.select('#mySVG')
const nodesG = svg.select("g.nodes")

var graphs = {
  "nodes": [
    { "name": "Peter", "label": "Person", "id": 1 },
    { "name": "Michael", "label": "Person", "id": 2 },
    { "name": "Neo4j", "label": "Database", "id": 3 },
    { "name": "Graph Database", "label": "Database", "id": 4 }
  ],
  "links": [
    { "source": 1, "target": 2, "type": "KNOWS", "since": 2010 },
    { "source": 1, "target": 3, "type": "FOUNDED" },
    { "source": 2, "target": 3, "type": "WORKS_ON" },
    { "source": 3, "target": 4, "type": "IS_A" }
  ]
}

svg.append('defs').append('marker')
    .attr('id','arrowhead')
    .attr('viewBox','-0 -5 10 10')
    .attr('refX',13)
    .attr('refY',0)
    .attr('orient','auto')
    .attr('markerWidth',13)
    .attr('markerHeight',13)
    .attr('xoverflow','visible')
    .append('svg:path')
    .attr('d', 'M 0,-5 L 10 ,0 L 0,5')
    .attr('fill', '#999')
    .style('stroke','none');

const simulation = d3.forceSimulation()
  .force("link", d3.forceLink().id(d => d.id))
  .force("charge", d3.forceManyBody())
  .force("center", d3.forceCenter(100, 100));

let linksData = graphs.links.map(link => {
  var obj = link;
  obj.source = link.source;
  obj.target = link.target;
  return obj;
})

const links = svg.select("g.links")
  .selectAll("path")
  .data(linksData)
  .enter()
  .append("path")
  .attr('stroke', '#666666')
  .attr('fill', 'transparent')
  .attr("stroke-width", 2)
  .attr('marker-end', 'url(#arrowhead)')

const nodes = nodesG
  .selectAll("g")
  .data(graphs.nodes)
  .enter().append("g")
  .attr("cursor", "pointer")
  .call(d3.drag()
    .on("start", dragstarted)
    .on("drag", dragged)
    .on("end", dragended));

const circles = nodes.append("circle")
  .attr("r", 12)
  .attr("fill", "000000")

nodes.append("title")
  .text(function(d) { return d.id; });

simulation
  .nodes(graphs.nodes)
  .on("tick", ticked);

simulation.force("link", d3.forceLink().links(linksData)
  .id((d,i) => d.id)
  .distance(150));

function ticked() {
  links.attr("d", function(d) {
    var dx = (d.target.x - d.source.x),
        dy = (d.target.y - d.source.y),
        dr = Math.sqrt(dx * dx + dy * dy);
    return "M" + d.source.x + "," + d.source.y + "A" + dr + "," + dr + " 0 0,1 " + d.target.x + "," + d.target.y;
  });

    nodes
        .attr("transform", d => `translate(${d.x}, ${d.y})`);
}

function dragstarted(d) {
  if (!d3.event.active) simulation.alphaTarget(0.3).restart();
  d.fx = d.x;
  d.fy = d.y;
}

function dragged(d) {
  d.fx = d3.event.x;
  d.fy = d3.event.y;
}

function dragended(d) {
  if (!d3.event.active) simulation.alphaTarget(0);
  d.fx = null;
  d.fy = null;
}

    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

<svg id="mySVG" width="500" height="500">
  <g class="links" />
 <g class="nodes" />
</svg>

For starters, any help first with fixing the code snippet to show the graph would be greatly appreciated.
The main issue, however, is that the arrows go into the nodes, whereas I would prefer to not have the overlap. This jsfiddle has a gap between the arrowheads and the nodes that I think looks much better - http://jsfiddle.net/yeQS2/89/ - although i think for my example I'd prefer an even larger gap between arrow and node.
I believe it is the ticked() function that I need to update:
function ticked() {
  links.attr("d", function(d) {
    var dx = (d.target.x - d.source.x),
        dy = (d.target.y - d.source.y),
        dr = Math.sqrt(dx * dx + dy * dy);
    return "M" + d.source.x + "," + d.source.y + "A" + dr + "," + dr + " 0 0,1 " + d.target.x + "," + d.target.y;
  });

    nodes
        .attr("transform", d => `translate(${d.x}, ${d.y})`);
}

I am actively working on fixing the reproducible example. I worked really hard on this, and think this is a problem that a lot of people would run into when trying to make an aesthetically good looking d3 force layout. Any help with this is appreciated!
Edit: thanks to whoever helped get the graph working - i went in and made the fill transparent on the links, so only the strokes show!
Edit2: not sure this is allowed, but this is for a big project of mine and I'll either bounty this post in 2 days, or bounty the winner if sooner, for sure.
Comment: Tempted to close as duplicate.  See my answer [here](https://stackoverflow.com/a/41229068/16363).  Let me code up an example and see if it fits your needs.
Comment: Decided to just post it as answer since I went through the trouble of getting it running with your code.
Comment: going through your post now as well, thanks for sharing
Comment: Possible duplicate of [Align Marker on node edges D3 Force Layout](https://stackoverflow.com/questions/41226734/align-marker-on-node-edges-d3-force-layout)
Answer: Applying the same idea in my answer here.
Produces:

const svg = d3.select('#mySVG')
const nodesG = svg.select("g.nodes")

var graphs = {
  "nodes": [{
      "name": "Peter",
      "label": "Person",
      "id": 1
    },
    {
      "name": "Michael",
      "label": "Person",
      "id": 2
    },
    {
      "name": "Neo4j",
      "label": "Database",
      "id": 3
    },
    {
      "name": "Graph Database",
      "label": "Database",
      "id": 4
    }
  ],
  "links": [{
      "source": 1,
      "target": 2,
      "type": "KNOWS",
      "since": 2010
    },
    {
      "source": 1,
      "target": 3,
      "type": "FOUNDED"
    },
    {
      "source": 2,
      "target": 3,
      "type": "WORKS_ON"
    },
    {
      "source": 3,
      "target": 4,
      "type": "IS_A"
    }
  ]
}

svg.append('defs').append('marker')
  .attr('id', 'arrowhead')
  .attr('viewBox', '-0 -5 10 10')
  .attr('refX', 0)
  .attr('refY', 0)
  .attr('orient', 'auto')
  .attr('markerWidth', 13)
  .attr('markerHeight', 13)
  .attr('xoverflow', 'visible')
  .append('svg:path')
  .attr('d', 'M 0,-5 L 10 ,0 L 0,5')
  .attr('fill', '#999')
  .style('stroke', 'none');

const simulation = d3.forceSimulation()
  .force("link", d3.forceLink().id(d => d.id))
  .force("charge", d3.forceManyBody())
  .force("center", d3.forceCenter(100, 100));

let linksData = graphs.links.map(link => {
  var obj = link;
  obj.source = link.source;
  obj.target = link.target;
  return obj;
})

const links = svg.select("g.links")
  .selectAll("path")
  .data(linksData)
  .enter()
  .append("path")
  .attr('stroke', '#666666')
  .attr('fill', 'transparent')
  .attr("stroke-width", 2)
  .attr('marker-end', 'url(#arrowhead)')

const nodes = nodesG
  .selectAll("g")
  .data(graphs.nodes)
  .enter().append("g")
  .attr("cursor", "pointer")
  .call(d3.drag()
    .on("start", dragstarted)
    .on("drag", dragged)
    .on("end", dragended));

const circles = nodes.append("circle")
  .attr("r", 12)
  .attr("fill", "000000")

nodes.append("title")
  .text(function(d) {
    return d.id;
  });

simulation
  .nodes(graphs.nodes)
  .on("tick", ticked);

simulation.force("link", d3.forceLink().links(linksData)
  .id((d, i) => d.id)
  .distance(150));

function ticked() {
  links.attr("d", function(d) {
    var dx = (d.target.x - d.source.x),
      dy = (d.target.y - d.source.y),
      dr = Math.sqrt(dx * dx + dy * dy);
    return "M" + d.source.x + "," + d.source.y + "A" + dr + "," + dr + " 0 0,1 " + d.target.x + "," + d.target.y;
  });

  // recalculate and back off the distance
  links.attr("d", function(d) {

    // length of current path
    var pl = this.getTotalLength(),
      // radius of circle plus backoff
      r = (12) + 30,
      // position close to where path intercepts circle
      m = this.getPointAtLength(pl - r);

    var dx = m.x - d.source.x,
      dy = m.y - d.source.y,
      dr = Math.sqrt(dx * dx + dy * dy);

    return "M" + d.source.x + "," + d.source.y + "A" + dr + "," + dr + " 0 0,1 " + m.x + "," + m.y;
  });

  nodes
    .attr("transform", d => `translate(${d.x}, ${d.y})`);
}

function dragstarted(d) {
  if (!d3.event.active) simulation.alphaTarget(0.3).restart();
  d.fx = d.x;
  d.fy = d.y;
}

function dragged(d) {
  d.fx = d3.event.x;
  d.fy = d3.event.y;
}

function dragended(d) {
  if (!d3.event.active) simulation.alphaTarget(0);
  d.fx = null;
  d.fy = null;
}

  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">

  <svg id="mySVG" width="500" height="500">
  <g class="links" />
 <g class="nodes" />
</svg>

The key is this:
  // recalculate and back off the distance
  links.attr("d", function(d) {

    // length of current path
    var pl = this.getTotalLength(),
      // radius of circle plus backoff
      r = (12) + 30, //<-- 12 is your radius 30 is the "back-off" distance
      // position close to where path intercepts circle
      m = this.getPointAtLength(pl - r);

    var dx = m.x - d.source.x,
      dy = m.y - d.source.y,
      dr = Math.sqrt(dx * dx + dy * dy);

    return "M" + d.source.x + "," + d.source.y + "A" + dr + "," + dr + " 0 0,1 " + m.x + "," + m.y;
  });


Where are all of the secrets in the Hangar - E1M1?

Question: I have played through the Hangar level of the first episode of DOOM now several times, but have not yet been able to complete the level with 100% in Kills, Items and Secrets. I am getting outside to pick up the blue power armour, and running back through to ensure that I'm not missing any items and kills;

I am going to suspect that the missing items are in the same places as the missing secrets, so where are all of the secrets in the Hangar - E1M1?
Answer: According to the Doom wiki:

In the corridor at the end of the zig-zag room, a portion of the west wall is colored differently and has a corpse lying next to it (G). Activate the wall to gain access to the courtyard with the blue armor. (sector 68)

After having entered the dark room with the exit door, return to the zig-zag room. The platform with the Imp(s) has now been lowered, yielding access to a secret room (H) containing a shotgun. (sector 69)

[Added in version 1.2]  After opening secret #2, walk toward the north end of the zig-zag room. As you cross the shadow line (I), a lift will lower in the shotgun alcove (J), visible from where you are standing. Run and you can catch it before it goes up. At the end of the hallway is a fake see-through wall, the first such wall in the game. (sector 70)
Answer: It has been a long LONG while, but in the room where the shootable door to the blue armor is, there is an elevator where the imp was. Listen for it to lower. I think that when you move toward the exit by opening a door, it will lower. If the imp is still alive, he'll follow you.
Once that is down, if you backtrack to the entrance to that room, you can RUSH back across to this secret area and all the way in and to the left, (i think) there is a secondary secret area w/elevator. You can actually hear it triggering if you listen closely.


Form submission after dynamically adding new fields

Question: I have a form for eg.
HTML
<form id="data">

  <input id="hostname" type="text" name="hostname" value="" />

</form>

And i have some javascript that adds more fields to the no. of friends i have.
Note: i will avoid adding some of the fb api scripts to save my writing time. add a comment if you want me to re-edit and add it.
JAVASCRIPT

PHP
$hostid = $_GET['hostid'];
print_r($hostid); // returns nothing if input field is generated using jquery after

The above works perfectly fine. it retrieves the data and inserts in into the fields.
But the problem is when i'm trying to post this data to a php file via ajax using serialize array.
I cannot receive ids array in php due to dynamic generation of the input fields.
if i simply add the id field manually it works fine.
Any Suggestions or solutions ?
EDITS
Ajax save method as requested by Arun.
Regards,
Dalton.
Comment: show your ajax save method
Comment: @ArunPJohny Hi Arun, I've updated the question with the ajax save method
Comment: Pls add the code, where you are making this ajax request.
Comment: I don't think it makes a difference but try adding the index to your input so `name="hostid[]"` becomes `name="hostid[' + i + ']"`
Answer: Instead of -
data: $("#data").serializeArray(),

Use this-
data: { hostid: $("#data").serializeArray()},

Comment: Hey this worked for me. But now i'm getting a new error and it says request url too large:jquery
Comment: stackoverflow.com/questions/8542061/… could help you for that. PS. dont forget to accept the answer if helped. Cheers!
Answer: Instead of using
data: $("#data").serializeArray()

You can get the data like
// which will return a array.
var result  = $("input[name=hostid]").val();

// you can then serialize that array and pass to php

data:result.serializeArray()enter code here


Integral including two matrix integrals

Question: I'm wondering if there's an nice solution to the integral $\int_0^{a} \exp(-s\mathbf{A}) \mathbf{M} \exp(s\mathbf{C}) \: ds$ . The matrices $\mathbf{A}$ and $\mathbf{C}$ are invertible if that matters, but they do not in general commute.
When $\mathbf{A}=\mathbf{C}$, a nice solution was posted here: Derivative of Matrix Exponential as Integral
But I was not able to use to utilize that further.
Answer: I had a similar problem lately which I solved by using the "block-triangular method" which came up in a post about the matrix exponential derivative which works for analogous reasons to the calculation of simple matrix exponential integrals discussed in this post.
The solution of your integral can be computed via the upper right block of the matrix exponential:
$$\exp\Bigg(\begin{bmatrix} A & M \\ 0 & B \end{bmatrix} \cdot a \Bigg) =
\begin{bmatrix}\exp(a A) & \exp(a A) \int^a_0 \exp(-s A) M \exp(s B) ds \\ 0 & \exp(a B)\end{bmatrix}$$
Why does it work?
The setup of ODEs is slightly different from the original post on the integral of a single matrix exponential:
\begin{align}
\dot{X}(t) &= AX(t) + MU(t) \\
\dot{U}(t) &= BU(t)
\end{align}
$U(t) = \exp(tB)U_0$ is simply the solution of the homogeneous ODE in the augmented variable, which yields a inhomogeneous ODE for $X(t)$:
$$\dot{X}(t) = AX(t) + M\exp(tB)U_0$$,
solved by $X(t) = \exp(t A)X_0 + \exp(t A) \int^t_0 \exp(-\tau A) M \exp(\tau B) d\tau U_0$.
Putting it all back together, the joined variables form a homogeneous ODE:
$$
\begin{bmatrix} \dot{X}(t) \\ \dot{U}(t) \end{bmatrix} =
\begin{bmatrix}
        A & M \\
        0 & B
     \end{bmatrix}\begin{bmatrix} {X}(t) \\ {U}(t) \end{bmatrix}
$$
solved by:
$$
\begin{bmatrix} {X}(t) \\ {U}(t) \end{bmatrix} =
\exp\Bigg(\begin{bmatrix} A & M \\ 0 & B \end{bmatrix} \cdot t \Bigg)
\begin{bmatrix} X_0 \\ U_0 \end{bmatrix} =
\begin{bmatrix}\exp(t A) & \exp(t A) \int^t_0 \exp(-\tau A) M \exp(\tau B) d\tau \\ 0 & \exp(t B)\end{bmatrix}
\begin{bmatrix} X_0 \\ U_0 \end{bmatrix}
$$
In order to compute the integral in question, the final step would be to extract the upper right block of the appropriate matrix exponential and premultiply it with $\exp(-a A)$ to cancel out the unwanted factor in front of the integral.
Comment: Thanks for the rigorous derivation. For my situation, the differential equation was where the integral came from in the first place, so it kind of circles back to the starting point. I this indicates there are no simple closed form expression for that integral (other than the exponential you point to).

Integral including two matrix integrals


Planning Perk Point Allocations Throughout Skyrim

Question: Spending points on certain skills in the beginning can help you in your early game, but later on on you might wish you spent more points in other areas.
Since Skyrim has no reset skills button(that I know of), it makes sense to have a good skill build from the beginning that would make for a good balance for early/mid/late game. I don't want to start fully one-handed or two-handed and then regret I have no points to invest in magic. Any suggestions?
Comment: If you are playing on PC and don't mind adding a "Respec" feature with the console, you can do that -> [this way](http://gaming.stackexchange.com/questions/35121/ive-misplaced-a-perk-can-i-get-it-back)
Comment: Well that seems ok but as I have stated this is more like a skill build guide so that I can prevent the need of using a "respec" feature.
Answer: I was once feeling just like you feel. There seem to be so many choices and with 250 perks and a max of 80 perk points you will always feel like you are missing out on something. So, this is just a list of pointers to try and make you feel more comfortable because at the end of the day, you will find you have more than enough perk points as you can not cast a spell, shoot a bow and backstab all at once, you will generally be finding yourself doing one of those most of the time.

Gear and Crafting Perks

The best armor and weapons in the game are player crafted.
Any suit of armor, light or heavy (not robes) can be crafted up to the effective armor cap of 567 granting 80% damage reduction (Yes, even hide armor if you are patient enough).
The best weapons are Deadric, but glass is fairly close behind them. If you want the best weapons but are using light armor, you will want to go up the Heavy armor side of the tree as this will grant you access to daedric weapons but also dragon armor, the best base defense light armor in the game.
Armor perks are almost a waste Unless you are trying to cap out armors like Hide or Iron. For instance, my first attempt at making a very nice suit of Dragonscale armor left me with a suit that had 1157 armor rating, almost 600 over the cap. This caused me to restart my character and ignore armor perks this time around completely (makes it a bit more challenging until you get a nice suit of armor. I suggest joining the Thieves Guild or Dark Brotherhood to get their suits as it is fairly quick/easy to do).

Useful skill trees, that if you are going to be using them, where almost all the perks are of use.

Destruction - Especially Impact, pretty much all the skills here are worth it as you can not find one element that is equally effective against all enemies.
Archery - Just has some additional abilities that make you more effective at all ranges
Sneak - If you just want the initial damage then just go up the right side. If you are a stealth fighter however you will want both the left and the right sides of this branch.
Enchanting and Smithing - While you can do very well with just items you find in game, these skills are an excellent source of income as well as the best weapons and armor in the game that are also tailored specifically to your needs.

Partial Tree Suggestions

Alchemy - I go with the base perk and then up high enough to get the extra bonuses to potions and poisons but no higher. This will really give you the maximum effectiveness out of your potions (and worth, this is probably the easiest money maker just because of the number of merchants who will buy potions and the relatively low weight to carry them around).
Conjuration - At high levels your summons will already be permenant (These are the Thrall spells) so you will not be actively casting and recasting these spells. All you will need to do is be able to cast the spell when your summons die to bring them back.
Restoration - I just get the Novice ability here and have never had a problem using this to heal after a battle (or some times during but usually potions are much more useful). If you are going to be a magic type with out wanting to use robes, consider the Magic Regen perks as well, they are not too far down the tree.
Armor Skills - As mentioned, one point in the base skill is all you need to craft a suit of any type of armor to the effective armor level cap.

Useful skills with useless perks

Pick pocketing - I usually get this skill to 100 before any other, but the perks just do not add much to this besides novelty. The extra carrying capacity is worth noting but I tend to play high stamina characters (I can carry around 400 units regardless of character type)
Lock Picking - I pick everything but never put a point into this tree. If I get a key for a door that does not require it I usually stash the key, pick the door then get the key (as I like collecting them :))
Speech - I love raising the skill for the better bonuses but I can not justify a perk in this branch just to make selling things easier. At the end of the day its not worth a perk to stop me from fast traveling from town to town to town to sell off all that I have (And if you ever become interested in the thieves guild, you will not even have to travel that much!) NOTE: If you are playing a character that will not fast travel (I have one of these) A few points in Barter has made more effective use of the shops near by. However, once you start crafting things like Banish daggers, the price of them is enough to wipe out any merchant's reserves with just a single dagger.

So I hope that is enough generic information touching lightly or indepth on just about every skill. If you have any more specifics you want to know there is a lot of information on here about specific builds and usefulness of different perks and such.
EDIT: Below is a good comment worth putting into this answer in regards to the Dawnguard DLC.

With Dawnguard, you can now smith Dragonbone weapons. This makes speacializing in Light Armor and going up the left side of the Smithing tree a viable option, while still maintaining the ability to use the best weapons in the game. Dragonbone weapons have slightly higher base stats than Daedric, so the smithed ones should be correspondingly better too. I think the bullet point starting with "The best weapons are Deadric" should be removed from the answer. – rkagerer
Comment: @JuanManuel I read that as "I pick all the locks" rather than "I choose all the perks", since it's under "useless perks".
Comment: With Dawnguard, you can now smith Dragonbone weapons.  This makes speacializing in Light Armor and going up the left side of the Smithing tree a viable option, while still maintaining the ability to use the best weapons in the game.

Dragonbone weapons have slightly higher base stats than Daedric, so the smithed ones should be correspondingly better too.  I think the bullet point starting with "The best weapons are Deadric"  should be removed from the answer.
Comment: @Yamikuronue, I missed the title :)
Comment: @JuanManuel I get no perks.. You will honestly just get used to opening locks at the different difficulties. Like Novice are always at 9:00, 10:30, 12:00, 1:30 or 3:00. The other ones have more spots then can get to but you eventually get a feel for 'if I could move it at that spot that far, then move it that far at that spot then to open it its this spot'. I honestly think it makes lock picking more fun if you do not get perks into it.
Comment: The max is 80 perk points, not 81.  Your maximum level is 81, but you start at level 1 with zero perk points.  So, you only progress through 80 levels earning that many points.  (FTFY)
Comment: "Lock Picking - I pick everything" -- does that mean you get all the perks in this branch?
Comment: In order to get Dragon Smithing, you don't need all Light & Heavy Armor perks - you only need to go up one side of the tree (at least, on my heavy armor character, I didn't need any light armor perks to unlock Dragon armor).
Comment: @rkagerer I have actually just started a brand new game to go through the two DLCs that are out and so I am glad you posted this info so I could update the answer, helps me out as well ;) (though I am still going heavy armor because I like the looks of daedric weapons :D)
Comment: You do not need to start over. If you put too many points in one trees just max out that tree and make it legendary.
Answer: It sounds like the Skyrim Perk Calculator and Respec Tool is what you need. The respeccing part of it will only work on PC, of course, but the planning aspect of the tool should work just fine for consoles as well.
I generally do a quick once-over whenever I think about making a new character, and make sure I haven't spread myself to thinly to have a good experience by around level 50 or so.
Comment: Sweet, I just checked my current plan and I can get all the perks I want pretty easily and then some. Helps that I don't care about weapons or several schools of magic! Thanks for that tool.
Comment: so vamp/werewolf trees don't have any perks or don't cost any? or is the tool just not updated?
Answer: You can save perks for as long as you want, and those are the only things that you would ever want to "take back".  Even if you decide to switch from weapons to magic, the skill raises you have in weapons won't hurt you in any significant way (they slightly affect monster scaling, but it won't be a problem).  So if you're worried about late game, save your perks and only take ones that affect skills that you will use later on.  In practice, the game is not so difficult that you're going to get stuck later on because you "misused" a few perks early in the game, you can level up again to get the perk you want.
Answer: Another thing to remember is that you can always turn down the difficulty to do more/take less damage.
Keeping that in mind, you should go for perks that have an actual advantage to them, such as moving faster with a drawn arrow, increasing speed of attack, slowing down time, smithing enhancements etc.
Just remember: you can always use more points, you can't always use less. Make sure you know what you want before you start spending points.


Comparing Two Dictionaries Key Values and Returning the Value If Match

Question: I'm a beginner to Python, but I've been trying this syntax and I cannot figure it out -- which was been really baffling.
crucial = {'eggs': '','ham': '','cheese': ''}
dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}

if crucial.keys() in dishes.keys():
    print dishes[value]

What I want to do is -- if crucial has a key (in this case, eggs) in the dishes, it will return 2. It seems simple enough, but I believe I must be messing some type of syntax somewhere. If someone could guide me a little, that would be greatly appreciated.
The real dictionaries I'm comparing with is about 150 keys long, but I'm hoping this code is simple enough.
Comment: What version of Python are you using?
Answer: You need to iterate over the keys in crucial and compare each one against the dishes keys. So a directly modified version of your code.
for key in crucial.keys():
    if key in dishes.keys():
        print(dishes[key])

It could be better stated as (no need to specify .keys):
for key in crucial:
    if key in dishes:
        print(dishes[key])

Comment: keys() is not necessary in this case, for default, iteration in a dictionary is enough. "for key in crucial.keys()" equals to "for key in crucial"
Comment: You're correct, and a list comprehension is the best option, however I thought an explicit example would be helpful for a Python beginner.
Comment: Thank you! This was incredibly helpful! I'm reading through the list comprehension now to learn a little bit more ...
Comment: You're welcome! List comprehension is definitely the preferred way to do something like this so you can't go wrong reading up on it.
Answer: If you're using Python 3, the keys method of dictionaries follows the set interface. That means you can do an intersection of the keys of the two dictionaries using the & operator.
for key in crucial.keys() & dishes.keys():
    print(dishes[key])

Or if you need a list of the values:
result = [dishes[key] for key in crucial.keys() & dishes.keys()]

In Python 2 you could manage the same thing by explicitly creating sets (perhaps from the iterkeys generator), but probably it would be better to simply do a loop over the keys, like several of the other answer suggest.
Here's a variation on the loop that I don't think I've seen anyone else do. The outer loop gets both the keys and values from the dishes dict, so you don't need to separately look up the value by key.
for key, value in dishes.iteritems(): # use items() in Python 3
    if key in crucial:
        print value

Comment: Strange how this answer is neglected. Tried it. Works great and has changed the way I think about writing certain types of code.
Answer: using list comprehension is good
[ dishes[x] for x in crucial if dishes.has_key(x) ]

or ,as per gnibbler:
[ dishes[x] for x in crucial if x in dishes ]

this expression will iterate crucial every key in crucial, if key in dishes, it will return the value of same key in dishes , finally, return a list of all match values.
or , you can use this way, (set (crucial) & set(dishes)) return common keys of both set, then iterate this set and return the values in dishes .
[ dishes[x] for x in set (crucial) & set(dishes) ]

Comment: `has_key` is deprecated. Please use `x in dishes` instead
Comment: Or even `[dishes[x] for x in set(crucial).intersection(dishes)]` to shave off a whopping 70ns :)
Answer: has_key() has been removed in Python 3: http://docs.python.org/3.1/whatsnew/3.0.html#builtins
Instead, you can use:
[dishes[key] for key in crucial.keys() if key in dishes]

The method used here is called list comprehension. You can read about it here:
http://docs.python.org/2/tutorial/datastructures.html#list-comprehensions
Answer: If you are not already familiar with Python's REPL (Read-Evaluate-Print-Loop  --  that thing where you type in code, press enter and it immediately evaluates), that would be a good tool here.
So lets start breaking down your code.
crucial = {'eggs': '','ham': '','cheese': ''}
dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}

Simple enough.  Though I note you do not have any values in the crucials dictionary.  I am not sure if that is an abbreviation for you example or if you are simply only caring about the keys.  If you are only caring about the keys, then I assume you are using a dictionary for the sake of ensuring uniqueness.  In that case, you should check out the set data structure.
Example:
crutial = set(['cheese', 'eggs', 'ham'])

Continuing on we have
if crucial.keys() in dishes.keys():

here you are using the in comparison operator.  Example:
5 in [5, 4] #True
3 in [5, 4] #False

If we evaluate crucial.keys() and dishes.keys() we get
 >>> crucial.keys()
 ['cheese', 'eggs', 'ham']
 >>> dishes.keys()
 ['eggs', 'bacon', 'sausage', 'spam']

so during execution your code evaluates as
 ['cheese', 'eggs', 'ham'] in ['eggs', 'bacon', 'sausage', 'spam']

which returns False because the value ['eggs', 'bacon', 'sausage'] (which is a list) is not in the list ['eggs', 'bacon', 'sausage', 'spam'] (in fact there are no lists within that list, only strings).
Thus you are evaluating as
if False:
    print dishes[value] #note value is not defined.

It rather looks like you have mixed/confused the in operator which returns a boolean and the for iterator (for item in collection).  There is a syntax for this sort of thing.  It is called list comprehensions which you can find samples of in @ShawnZhang and @kmad's answers.  You can think of it as a terse way to filter and modify (map) a collection, returning a list as a result.  I do not want to get too in-depth there or I will end up in an introduction to functional programming.
Your other option is to use the for .. in iteration and in operators separately.  This is the solution @timc gave. Such solutions are probably a more familiar or easier for beginners.  It clearly separates the behavior of iterating and filtering.  It is also more like what would be written in other programming languages that do not have an equivalent to list comprehensions.  Those who work in Python a lot would probably favor the comprehension syntax.
Comment: vossad01, I appreciate the response. Your explanation I saved ... and is a bit more apparent as to why it wasn't working with my trial and error efforts!
Answer: You can use a Counter:
import operator
from collections import Counter

def mio(si, ti):
    si = Counter(s)
    ti = Counter(t)
    if operator.eq(si, ti):
        return True
    return False

Answer: crucial = {'eggs': '','ham': '','cheese': ''}
dishes = {'eggs': 2, 'sausage': 1, 'bacon': 1, 'spam': 500}
for key in set(dishes.keys()) & set(crucial.keys()):
    print dishes[key]

Similarly, you can have set(dishes.keys()) - set(crucial.keys()) , set(dishes.keys()) | set(crucial.keys()) , or set(dishes.keys()) ^ set(crucial.keys()).
Comment: in this way, you can have set(dishes.keys()) - set(crucial.keys()) , set(dishes.keys()) | set(crucial.keys()) , or set(dishes.keys()) ^ set(crucial.keys())


How to give an item with two data tags

Question: I'm not particularly sure whether or not their called "Data tags", but on with the question! I wanted to be able to give myself a tripwire hook that has a custom name AND a CanDestroy tag as well. Ideas?
Answer: The give command is not limited to 1 nbt tag.
<code> /give @p minecraft:tripwire_hook 0 1   {display:{Name:"name here",color:,Lore:["lore here", "lore here"]},CanPlaceOn:["minecraft:stone","minecraft:stonebrick"]}
</code>

How to give an item with two data tags


Django: NoReverseMatch when changing to relative url

Question: When I change the line

to

I get NoReverseMatch. What's going wrong?
URLs:
app_name="rango"
urlpatterns = [
    url(r'^$', views.index, name='index'),
    url(r'^about/', views.about, name='about'),
    url(r'^category/(?P<category_name_slug>[\w\-]+)/',
        views.show_category, name='show_category'),
    url(r'^add_category/$', views.add_category, name='add_category'),
    url(r'^category/(?P<category_name_slug>[\w\-]+)/add_page/$', views.add_page, name='add_page'),
]

Comment: Some of your patterns are missing a `$` at the end to match the end of the url path. As a result, no url will e.g. ever reach the `add_page` view as it is already matched by the `show_category` view.
Answer: You have defined the app name as rango. You need to use this when reversing the url:


PyCharm: lost ipython kernel window

Question: This is really silly, but it's driving me nuts!
Normally when I run ipython notebook through pycharm, the first time I click on the 'play' button to run a cell, PyCharm asks me if I want to start the kernel. When I say yes, it gives me a nice kernel window that shows me output from commands and errors.
I really like this feature for debugging, but somehow it went away. PyCharm no longer asks if I would like to start the kernel, and I no longer can find the kernel window. My notebook is still running just fine, so the ipython kernel must be started somewhere.
Can someone please tell me how to view the kernel window?
Thanks so much!
Answer: I spoke to JetBrains support. This is a known issue with Python 2.7.9 via Anaconda (maybe just with Anaconda in general, they did not specify). They said it will be fixed with the next release, which should be coming out in the next few days.
Comment: PyCharm EAP 5 142.5084 23.09.2015 seems still broken, Python 2.7.10
Comment: Yeah, it still has the bug. I've found that if I go into settings and delete any information under the ipython settings (such as an ip address) and restart pycharm, that resolves it temporarily.

PyCharm: lost ipython kernel window


Add event to top of event stack using jQuery

Question: I'm using jQuery to add a blur event to a text box.  I would like my event to fire before any other existing events.  Is this possible to do?
Comment: see http://stackoverflow.com/questions/2360655/jquery-event-handlers-always-execute-in-order-they-were-bound-any-way-around-th/2641047#2641047
Answer: Not trivially.
The events are executed in the order they are bound. You could unbind all events, bind yourEvent, then rebind all events though.
Answer: Do something like this:
<code>var fn = document.GetElementByID('x').clicked;
document.GetElementByID('x').clicked = function(){
  //action
  fn();
}
</code>
In Javascript the functions are function pointers.


HTML5 vs Native App : Which to choose ??

Question: This question is quite popular, and there are already lot of questions pertaining to it. But some of them are old (like 6 months back), and for the current date - May 2012 ... it will be awesome if you can type out which one is better as of now !
I am working on some apps right now, and cross-platform functionality is a major deal here. I would like to know if I can use HTML5 for the following features.

Creating a music player in my app (will need to read all playlists and play them) - HTML5 (or) Native ?
Accelerometer usage - HTML5 (or) Native ?
Camera usage - HTML5 (or) Native ?
Using gestures (swype, etc..) - HTML5 (or) Native ?
Multi-touch capabilities & gestures - HTML5 (or) Native ?
Developing 3D game (or) 2.5D with physics - HTML5 (or) Native ?   (Native might be the best deal here, but I am curios to know how HTML5 would do in multi-platform game dev)

If you can number the options with the correct answer, and give a reason as to why I would have to use native / html5, that would be awesome :)

Also, what are your thoughts on Phone-Gap for native support ?
Answer: Creating a music player in my app - Both. HTML5 might be tedious.
Accelerometer usage - Native. Html5 won't support it
Camera usage - Native. Html5 won't support it
Using gestures - Native. Html5 can support it, but you'll have to use an external library
Multi-touch capabilities & gestures - I'd say native, for the ease of development
Developing 3D game (or) 2.5D with physics - Both, some great libraries are now available for both systems. However doing what you want in HTML5 is probably not easy at the moment.
More generally, HTML5 gives you the possibility to write you code once for every system and then wonder if it'll work in the same way everywhere. Native apps require a specific development for each platform, with the costs and the problems of maintaining many softwares at different stages of maturity that it leads.
However if you don't need specific features, go for HTML5. It's still a bit tedious to write code on it so far, but the quality and the amount of available libraries is increasing every day. Use CoffeeScript, it'll save you headaches.
If your application is designed with responsive design in mind, you'll also be able to support computers, tablets and smartphones in one application.
Comment: I would choose native for all this features
Comment: Is it true that Camera usage needs to be native? I think if you use PhoneGap it works.
Comment: Good Answer - might I also add that HTML5 Audio and HTML5 Video is not supported in all devices - some devices and browsers do not support mp3 for example or other formats. Otherwise after nearly 2 years of mobile development this question fits the build.... Look at Titanium they are going Windows Mobile soon - my best advice though if your company has budget and time and developers and the project is a like a game complex - Use cocoa for Apple, Java for Android and c# for WP7 - separate platform releases like Angry Birds for example.
Comment: Great answer ! Phone gap seems to leverage on those issues - http://docs.phonegap.com/en/1.7.0/index.html . What do you think about that ?
Comment: We had performance issues with PhoneGap so as all answerers here say, it depends how complex your app is.
Answer: Unless your app is extremely simple then avoid the so-called cross-platform solutions and build native for each platform. If you do, you will be glad.
If you don't then you will be very sorry when something breaks on some devices but not others, or when you get a request to add certain capabilities that some devices won't support.
Basically using a cross-platform solution is lowest common denominator / only suitable for simple apps / false economy in my experience.
Just my humble opinion based upon 12+ years of commercial software development and experience of trying both approaches myself.
Comment: I think I would expect phoneGap docs to have a different opinion to me, they're trying to "sell" phoneGap. I also think it would be sensible to realise that cross-platform "solutions" will not support the latest and greatest features as soon as they are released either.
Comment: Phone gap seems to leverage on those issues - http://docs.phonegap.com/en/1.7.0/index.html . What do you think about that ?
Comment: I see what you mean. I was just interested to know how phoneGap was able to achieve native capability. But yes, what you say makes sense :) Thanks  !
Comment: cross-platform is not equal to none-native! many 3d games are cross-platform and native. In some frameworks and languages you can build your apps as native and you will have greet features and hardware control. for an example of this kind of cross-platform frameworks is . It uses its own C++ libraries and presents greet performance and control over hardware. I developed some android apps using Qt and yes it makes some hardness and many pros. So I think you chose a bad option for cross-platform app development. Look at other cross-platform options :)


Can't figure out how to implement threads in my client-server model

Question: I have a small server-client application that doesn't do very much (a client connects to the server, sends a number trough a pipe and receives another number).
But it only works with one connection at a time (While a client is connected, no other client has access to the server)
I want to make it possible for multiple clients to connect to the server at one time, and I plan to do this with worker threads.
Obs:
<code>#define CONNECT_NAMEDPIPE "\\\\.\\pipe\\ClientToServer"
</code>
Server:
<code>HANDLE namedPipe = CreateNamedPipe (CONNECT_NAMEDPIPE,
                                    PIPE_ACCESS_DUPLEX,
                                    PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT,
                                    2,
                                    sizeof(MinMax),
                                    sizeof(NumberList),
                                    0,                  // timeout
                                    NULL);

if (namedPipe == INVALID_HANDLE_VALUE) {
    printf("Unable to create named pipe\r\nServer closing\r\n");
    printf("CreateNamedPipe failed, GLE=%d.\r\n", GetLastError());
} // Error unable create pipe
else {
    printf("Server created\r\n");
    printf("Awaiting connection\r\n");

    ConnectNamedPipe(namedPipe, NULL);
    etc ...
}
</code>
So the server waits on ConnectNamedPipe until a client connects, then is unavailable for any other connections.
If I'd like to enable multiple connections, how should I create the worker threads ?
Should every connection attempt create a new pipe (with a new pipe name / path - CONNECT_NAMEDPIPE can't be used for all)
How do I know when someone else is trying to connect ? Where should my threads be ? I'm stuck.
Answer: I think Berkeley sockets are better suited for this. If you must go with pipes, something like this could work:

The client sends a connection request through the main named pipe to the control thread.
The server creates (or fetches from a pool) a worker thread that listens on another, unique pipe.
The control thread answers with the name of this new pipe.
The client closes the control pipe and sends real request data to the new pipe.
The worker thread reads the request, processes it, and sends back the response.
Meanwhile the control thread is ready to read another connection request from another client.
Comment: A thread pool is simply a collection of threads in some kind of waiting state. When a work unit arrives, you wake up one of the treads from the pool and instruct it to accept the unit. When it finishes, it goes to sleep again. It is faster than creating a new thread for each work unit.
Comment: "or fetches from a pool". I have heard about thread pools, but I am not sure what they mean. Could you elaborate ?


Can I do anything to improve the damage done by the demon summoned by my follower's Maximus?

Question: My enchantress uses the legendary two-handed sword Maximus, which quite frequently summons a large demon to fight with us.
It's quite a handy proc, but I'd like to know if there's any way I can make it more effective.
My enchantress' damage is quite low now, as I haven't really put much effort into gearing her (mostly I've added magic find gear) since she's primarily used for the attack speed buff.
Is the damage done by the demon in any way influenced by the gear my follower is using?  Is there any difference in the damage done by the demon if a player is wielding the weapon, instead of the enchantress?
Comment: @DiabloMonkey I'm almost certain you can get 2 demons this way.  I'm 90% positive I have 2 of these swords (on enchantress followers with 2 different characters), so I'll try to test that out for you tonight.
Comment: @DiabloMonkey I can verify that you can have 2 demons at one time by giving a Maximus to the enchantress, and using one yourself.
Comment: I like this question and am curious to see if anyone has an answer.  On a related note, I am also curious if anyone has equipped the sword to themselves and their follower and gotten 2 demons at one time.
Comment: @VaelVictus Like most summoned creatures, the demon seems pretty good as a distraction, keeping enemies occupied.  He's extremely durable, to the point where I don't know if he *can* be killed, and instead simply lasts for a fixed duration. I've really only used him on MP7, so its hard to know if the damage would be significant at lower levels (which is part of why I asked this question).
Comment: I thought that the demon does a fixed damage (~35k) no matter what?  I could be wrong since I've never tested it though.
Comment: Is the demon any good?
Answer: The demon summoned by Maximus does a maximum damage of ~35k, it doesn't matter what stats you add to the enchantress, it's just a fixed DMG value.
It's a fantastic tool to use against chain enchantments though.
Comment: The Demonic Slave will fight for 15 seconds or until he is killed. He is pretty durable but arcane damage seems to be his Achilles' Heel. The fire chain deals 1,000 - 2,000 damage every .3 seconds and can critical hit. The demon itself deals 36k damage a swing on average and doesn't crit. As @Beofett indicated, it's possible to have three demon slaves fighting for you at one time.


Why doesn't button add to scene?

Question: package application;

import java.awt.Button;

import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.StackPane;

public class Main extends Application {

    Button button;  //Declare Button

    public static void main(String[] args) {
        launch(args); //calls application
    }

    @Override
    public void start(Stage primaryStage) throws Exception {
        //comes from application pack
        primaryStage.setTitle("Title Of Window"); //Main Stage
        button = new Button (); //Creates Button
        button.setLabel("Click Me");

        StackPane layout = new StackPane();
        layout.getChildren().add(button); //Button in Scene
        Scene scene = new Scene (layout, 300, 250); //Sets Scene
        primaryStage.setScene(scene); //Stage and Scene
        primaryStage.show();

    }

Hey guys, so this is first time I am creating something in JavaFX and I was wondering why doesn't my button in Scene add in Layout.GetChildren() line,  it keeps on displaying red line underneath add. I am using Eclipse IDE.
Answer: you have imported import java.awt.Button, you must import Button class in the javafx package.
Comment: And how would I do that?
Comment: remplace `import java.awt.Button;` with import `javafx.scene.control.Button;`

Why doesn't button add to scene?


Dual Boot Ubuntu and Windows 7: BOOTMGR is missing when I tried to boot in Windows

Question: So, I don't know what exactly how I managed to delete the MBR record on windows partition. But let me explain what I did next, I ran the ubuntu boot repair tool and now Windows is not even listed in my grub loader.
So I went and booted with windows cd and choose repair. Then I ran ubuntu boot repair again via live cd.  Here is the log http://paste.ubuntu.com/1426181/. Still no luck.
Looks like osprobe can't detect windows on my /dev/sda2 partition. Any clues ?
Here is how my partitions look like:
<code>Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x525400d1

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048      206847      102400    7  HPFS/NTFS/exFAT
/dev/sda2          206848   509620669   254706911    7  HPFS/NTFS/exFAT
/dev/sda3       509622270   976773119   233575425    5  Extended
/dev/sda5       509622272   957757439   224067584   83  Linux
/dev/sda6       957759488   976773119     9506816   82  Linux swap / Solaris
</code>
Comment: Possible duplicate of [Fixing Windows7 Bootmgr](http://askubuntu.com/questions/214739/fixing-windows7-bootmgr)
Answer: Sounds like there's a good chance something is broken with Windows which is causing Ubuntu not to recognise it properly. Try following the instructions here to fix Windows and then here afterwards to reinstall Grub.
Comment: Thank you for your answer. I got it working now. The problem was that I didn't go through windows repair correctly. Did a windows repair again and didn't even have to do the grub reinstall, since I already manually added the windows partition to my grub settings.
Comment: Forgot to mention, I also put the boot flag on the sda2 partition using gparted.