Why does voltage remains same over Parallel Circuit

Question: Why does voltage remains same over parallel circuit. If a resistor is connected in the circuit some of the charge should be transformed into heat and make a lack of charge after the resistor (in my sense). So, what's the reason in it?
Comment: Electric *energy* is converted to heat, not electric *charge*.
Comment: Electric charge isn't transformed into heat by a resistor so your reasoning is based on a serious misunderstanding of the physics.
Comment: What about light bulb? Its a sort of resistor...n it produces heat
Answer: This kind of misconception can be cleared by the definition itself.
Voltage is the energy per free electron (which contributes to current flow in the conductor), whereas current is the rate of flow of free electrons across the conductor's cross-sectional area. In other words, current is the count of the stuff that passes through the cross-section within a given time period and voltage is what drives the stuff.
Charge is a conserved quantity. What you perceive as heat is the energy of the particles1 flowing at the drift speed (around a few millimeters per second). It's simply the voltage that's converted to heat. The free electrons can't smell around and divide accordingly based on resistance on each path of the circuit. It's just a random flow. They just go around and when the path-division is encountered, some go through one way and some go through the other.

To dig further inside, let's consider a parallel network like the one here (ABCDEFA). The battery (DC) maintains a potential difference (how much doesn't matter for now) which is far enough for the charges2 to start flowing. These charges encounter a junction B on the way. As previously told, there's no specific condition that reroutes the charges to some preferred direction. It's simply random. Hence, some follow the path BE, while the remaining go via CD to reach the battery.
Say the resistance of $R_2>R_1$. What would happen? The time taken by the charges to swim through $R_2$ is greater than it takes through $R_1$. So, a lot of charges can get out of $R_1$ within a specific time period, while the number is less in case of $R_2$. And, this happens within a few seconds once the potential difference is established and that's why we perceive that the current through $R_2$ is less than the one through $R_1$ (which is the reason why "current divides in parallel circuits).
Once the charges get out of the resistors, the electric field of the battery is enough to drive them mad (as the wire has relatively lower resistance). And, the charges get back their energy once again. This is the reason why we say voltage is the same in parallel circuits3.

1: I mentioned "particles" simply, because the free electrons aren't necessarily flowing at the drift velocity (which may lead to another misconception). They're always at relativistic speeds. The drift velocity is just a representation of their contribution to the current flow in the macro scale...
2: In a crude manner, I simply used "charges" because conventional current flow is from positive to negative, whereas the electron flow is the other way around (which is quite difficult for me to express). And by charges, I meant charged particles.
3: Also note that the voltage and current remain the same for resistors of the same resistance whether they're in parallel or series...
Answer: The reason is that charge is conserved. Even if some of the energy is lost as heat, you will still end up with the same number of charge carriers in the wire.
Charge conservation is a physical law that states that the change in the amount of electric charge in any volume of space is exactly equal to the amount of charge flowing into the volume minus the amount of charge flowing out of the volume. In essence, charge conservation is an accounting relationship between the amount of charge in a region and the flow of charge into and out of that region.
Comment: But how it's conserved when it's losing energy from the volume (in the form of heat)
Comment: The charge is not destroyed when it loses energy. It just slows down.
Answer: Two points:
1) The voltage across the two resistors is the same. The definition of a perfect conductor is that there is no voltage drop along it's course. Of course nothing is perfect but copper is a very good conductor and it would be difficult to measure the voltage drop across relative short segments. In a parallel circuit the conductors on either side of the multiple resistive elements maintain nearly identical voltages. It is the current that gets divided. As others have pointed out, the charge is a conserved quantity (since it's just the numbers of electrons) so it gets "divided" between the various resistive elements and then gets recombined back at the other side so I_out is the same as I_in at the current source.
In the diagram offered by another poster, Waffle's Crazy Peanut, there is a "wire" from the start of R1 to the start of R2. In circuit theory that section of "wire" has no resistance and it's equivalent to both resistors being connected to the same point which implies that they have the same voltage at their positive sides.
2) The heat is coming from the drop in energy as the electrons cross the resistors. Since the amount of drop is the same for each passing electron, the amount of heat is proportional to the current (or number of electrons) that pass.  Electrical engineers sometimes talk about across quantities and through quantities. Voltage is an across quantity while charge is a through quantity. You raise the issue of heat which is a measure of power generation. Heat from each resistor in a parallel circuit will be calculated as the product of the voltage (the same for each) and current (different and inversely proportional to the resistances.)
You should think of voltage as pressure and the charge as the fluid being pushed forward. If you turn off the faucet attached to a garden hose (decreasing pressure or by analogy the voltage) , the water doesn't decrease in amount; rather only the flow of charge (current) decreases.
Answer: A single resistor wired in parallel with voltage source like a battery may give confusing reasons for a novice, so a few other things need to be taken into account.
Any battery also has an internal resistance (it is like a resistor in series with the voltage source), and this resistance also varies with the state of charge of the battery, which is to say, the internal resistance gets to be a quite large value when the battery is "low".  This internal resistance of a battery can be complicated to figure out; don't try connecting an ammeter directly across the terminals of a battery!
So, when the battery is fresh and the value of the external (test) resistor in parallel with it is in a range that will not cause it to overheat (which would abruptly change its value to something much larger than marked), it is easy to understand that a voltmeter connected across the resistor will hopefully be the same as if the resistor were not there, and the voltmeter is connected directly across the battery.
By the same token, adding additional resistances in parallel to the first one should also not materially change the value of the voltage measured in the first case unless the voltage source has been overloaded.
Does this help?  Some of the other examples seemed not to take into account the idea that the question being asked seemed to involve a (single) resistor and a (single) voltage source, which should be thoroughly understood before adding more stuff in parallel, to say nothing of the characteristics of real voltage sources, particularly a battery.
Answer: As the battery forces charge through the resistor, indeed that energy is converted into heat. An ideal battery has enough power so that it can supply the current without any voltage drop.
With a real battery, you have to make allowance for the battery's internal resistance. This resistance is inseries with the resistance in the circuit. Because of that, the current effectively flows through a voltage divider, and the voltage across the resistor is reduced. If the battery voltage is $V_B$ and it's internal resistance is $R_i$ then the voltage across the resistor $R$ is
$$V=V_B*R/(R+R_i)$$
Unless $R_i=0$ the resulting voltage across the resistor is less than the battery voltage.
Comment: This doesn't answer the why question. It pushes back the question to "why or how does what we call a `voltage divider circuit` work." Furthermore the voltage across the two resistors remains the same.


Are there any other millets similar to little millet in taste?

Question: I have seen several types of millets in few ethnic stores in Texas. Few of the names are Proso Millet, Barnyard Millet, Kodo Millet, Pearl Millet, Finger Millet, Little Millet. I tried Little Millet and I liked it since it does not have a strong flavor like Finger Millet. However, Little Millet is not easily available where I live, are there other millets that have a mild taste?
Answer: You can use barnyard millet in place of little millet ,


oracle sql query requirements

Question: I have some data in oracle table abot 10,000 rows i want to genrate column which return 1 for ist row and 2 for second and so on 1 for 3rd and 2 for 4th and 1 for 5th and 2 for 6th and so on..Is there any way that i can do it using sql query or any script which can update my column like this.that it will generate 1,2 as i mentioned above i have thought much but i didn't got to do this using sql or any other scencrio for my requirements.plz help if any possibility for doing this with my table data
Answer: You can use the combination of the ROWNUM and MOD functions.
Your query would look something like this:
SELECT ROWNUM, 2 - MOD(ROWNUM, 2) FROM ...
The MOD function will return 0 for even rows and 1 for odd rows.
Answer: select mod(rownum,5)+1,fld1, fld2, fld3 from mytable;

Edit:
I did not misunderstand requirements, I worked around them. Adding a column and then  updating a table that way is a bad design idea. Tables are seldom completely static, even rule and validation tables. The only time this might make any sense is if the table is locked against delete, insert, and update.  Any change to any existing row can alter the logical order. Which was never specified. Delete means the entire sequence has to be rewritten.  Update and insert can have the same effect.
And if you wanted to do this you can use a sequence to insert a bogus counter.  A sequence that cycles over and over, assuming you know the order and can control inserts and updates in terms of that order.
Comment: You misunderstood OP's requirements.

oracle sql query requirements


jQuery Mobile panel smooth scrolling

Question: This is not a question about JQM panels scrolling independently of the page, though that is an issue I've had trouble with and almost overcome, this is about making the panel scroll smoothly and ignore the device browser's edge event (or whatever the correct term is, I'll explain below).
Basically, I'm trying to replicate the menu on Google's mobile site, which naturally isn't using JQM like us common folk. I've got it pretty close, but the scrolling animation is very rigid. I need it be momentum-based rather than fixed to your finger.
Also, when you reach the top or bottom of the menu, it's considered the extremes of the document so the browser moves the whole document up or down to indicate the edge of the page. Instead, the page should never move while the panel is open and the menu should take on this behaviour within the panel.
Since I've set the panel height to 100%, this forces the address bar on iOS Safari to come down when the menu is open. This seems to be exactly what happens on Google, but if there's a way around this I'd love to hear it.
Finally, one downside of the way I've emulated independent scrolling is to just set the content wrap as fixed when the panel is open. However, this means the page always scrolls to the top when the panel opens. Any alternatives for this would be appreciated. I suppose I could just set the page top as scrollTop or something.
To summarise:

Panel menu needs to scroll smoothly (momentum rather than direct touch)
Elastic edge on menu rather than window
iOS Safari address bar interfering with height
Page fixed at top when panel open

If any of my descriptions don't make sense, just visit google.com on your phone and check out their menu.
Answer: ScrollFix seems to have solved all my issues.

jQuery Mobile panel smooth scrolling


Embed texture in font

Question: i want each letter of EARTH DAY to have the leaf texture.. How can i do it in illustrator?
Comment: What have you tried?
Comment: earth day- create outline-ungrouping-place in front of the image-clipping mask-got error. illustrator each time saying something like this - the front shape is too complicated, still wanna proceed? i clicked 'yes' and then the whole thing disappears!..
Comment: Is there an effect applied to the Text fill ? This may be causing you the trouble- With basic Type you can just select the picture and the Type (which must be above the picture in the layers panel) and go Object> Clipping Mask> Make
Comment: nope. no effect i have applied.
Comment: See the Clipping Paths rules here: https://graphicdesign.stackexchange.com/questions/99481/how-to-use-complex-objects-as-clipping-masks-in-illustrator/99494#99494
Comment: its embedded in the font. i didn't do it. @Kyle
Comment: Thank you leonas. appreciate the help
Answer: This solution uses a combination of Photoshop and Illustrator.

In Photoshop, use the Clone Stamp tool, with a large soft edged brush, to clone pieces of the leaf until you have a kind of random leaf pattern texture.  You can set the target for the Clone Stamp by doing Alt/Option+click. You will have to do this several times as you continue cloning.

This example is speeded up, but should only take a few minutes

Copy and paste this into Illustrator.
Type some text on top of it.

Select both text and image and do Object > Clipping Mask > Make
Comment: oh billy!!! Thank you so much.
Answer: if understand your question here is the answer
write text or paste artwork.
put texture image behind the text.
select both text and texture.
right-click > make clipping mask
Done
Comment: tried it. didnt work
Answer: This is very will possible, but it's a bit tricky to it right. This is because this method requires that the text shape is a single, closed, non-grouped, compounded shape, and that's sometimes difficult to achieve.

Select your text;
Text > Create Outlines (Shift+Ctrl/Cmd+O)
Object > Ungroup, possibly a couple times;
With everything still selected, use the 'Unite' option in the Pathfinder palette;
Position your pixel image behind the text in such a way that the texture underlays the text everywhere (and doesn't run off the leaf, for example);
Select both your (single, closed, non-grouped) text shape and the pixel image;
Object > Compound Path > Make (or Ctrl/Cmd+8.

If it doesn't work, you might try to Object > Expand, ungroup and Unite (Pathfinder) a few more times until you have your single shape.
This effect is way easier to achieve in Photoshop, as in a few clicks. If you are not extremely strictly limited to Illustrator, I'd go for the easier solution myself.
Finally: do note that the kerning (letter spacing) between the A and the Y is very much out of sync with the rest of the text, they should be much, much closer. The A and the D could be a bit closer as well, considering lots of the other letters actually run into ech other.
Comment: I disagree, @joojaa. Photoshop can handle CMYK images no problem.
Comment: Thank you. illustrator actually is not the right software i think. you are right.
Comment: @SuraiyaAbedin depends on wether your aim is to make web images or print images.
Comment: my client asks for poster. so it must be for print. @joojaa
Comment: @SuraiyaAbedin then illustrator is the right tool
Comment: @Vincent That's not the problem but rtaher the nature of photoshop.
Answer: You have got suggestions to clip pieces of a leaf with letter outlines. I tried it, too. Outlined and ungrouped letters are used one by one as a clipping mask for a copy of a leaf. The leaf is actually traced to 8 colors (+ignore white) to make the texture sharper.

It's difficult to see them as leaves because surface details do not define leaf, it's the outline. These are letters which could as well be made of stone.
Using an image of a mass of leaves do not make it better:

I suggest you build the text of leaves. Have several of them to avoid too much repeating. The next is an example.

A piece of distorted text is covered by copies of two different versions of a leaf. They are separated from a photo in Photoshop and placed to Illustrator
The text would look better as 100% leaves. The underlying vector text should be unnecessary if you have say 4 different leaf photos.
Small leaves could be sprayed. The letters could be drawn if one has a brush which scatters leaves.
Dragging leaves manually from a bunch of randomly sized and rotated versions is also possible. The next image contains quite small copies of one leaf.

There was AB (Arial Bold) as a guide in the bottom.
Drop shadow here and there clearly improves the result. Without it the leaves look like they were glued together. Actually it was used also in the former example (=the LEAF) for the same reason.
One idea is still untested: Create a leaf like shape with surface, edge and veins which has got its main outline from a letter. Think it as taken from a tree where the leafs are letters. I have still no idea how to make it at least partially automatically. A competent painter of course would draw it and a competent math programmer could declare it as rules which are applied to the needed letters.
Comment: Excellent. but my client wants that ivy image in each of the letter of 'earth day'.. so in this particular case i am allowed to apply your method. but thank you any way for teaching me this <3

Embed texture in font


Will having two antennae at the receiver give better reception?

Question: I have a 300mbps router with two antennae (tp-link td-wd8968). I'm building a PC and looking for a wireless network card. I have seen seen cards with a single antenna (150mbps) and cards with two antennae (300mbps); I understand the latter is for 802.11n which has higher data rates, but does it have any affect on the signal range?
Comment: [Cross-posted to SuperUser.SE](https://superuser.com/q/850320/297822)
Answer: Not really.  Wi-fi cards that support using two antennas generally have an internal switch that will select one antenna or the other.  The card will select whichever antenna has a better signal.  This is called diversity, and it is used to counter issues with channel fading.  Newer wifi cards can use both antennas at the same time.  This is called MIMO and under certain circumstances it can allow a 2x improvement in bandwidth.  In terms of range, diversity will allow the card to counter some forms of fading and can improve reception and reliability, but it will not increase the range unless you use a higher gain (more directional) antenna.
Answer: This whitepaper has some nice graphs. Have a look at page 7, where the radiation pattern of a dipole is shown. This is the kind of radiation pattern you have with one antenna:

You can see that radiation is high in the x and y direction, but poor in the z direction. That means, if your router is in the z direction, you're going to have poor reception. To improve your reception you can position the antenna differently. You can do that on both sides: on your computer, and on your router.
Adding a second antenna in a 90 degrees corner with the first one would mean that you're going to improve reception in, say, z and x axis. That means you have fair reception in the z and y direction, and good reception in the x axis.
However, the card will normally not use both antennas at the same time, but rather select the one with the best reception, so you will have equal reception in all directions.
Newer cards will use both antennas at the same time. In that case you want to position the antennas in one line, so that you're improving both x and y, but not z. Then, again, make sure that your router is in the x or y direction, but not in z.
Having two antennas is therefore especially useful for moving transceivers (laptops, phones, etc.) or for transceivers that need to talk to many others at the same time (the router). Your router has two antennas, so make sure to position them optimally for your setup.
Answer: Having two antennas that are specifically sited as an array can make the pair of antennas more directional and this inevitably leads to higher gain. However, more likely is that the two antennas are not interactive and are used to achieve diversity
Answer: Adding multiple Antennas would help in beam steering also ,If both of your antennas are working together .Its one of the Beam forming Mechanisms :)


CSV file adding default row by using excel

Question: As you can see in the image below I'm trying to open a CSV file by using Excel but every time I tried there is a row that I don't need excel add it by default, how can I remove this option I don't need this row
Image : https://i.stack.imgur.com/E8SGy.png
Answer: I would assume this is because you did not check the Include column headers box on export, so it is assuming that the top row is just another row and not the headers for your data.

The above is from a manual UI export, You can also find it in a Data Extract Activity (in Automation Studio) as Has Column Headers in the Configuration step. Like below:

I believe also in Excel there is a way to turn on/off your headers. Might want to check this link that tells you how to toggle this.


Electrical engineering Software developed

Question: I have developed a computer program for power system FACTS And load modelling to analyse the performance of electrical power system. How can i patent it india.
Answer: In the same way as you patent anything anywhere: by preparing and filing a patent application. This should of course only be done if your invention is novel and non-obvious, and is not otherwise excluded from patentability. Since you obviously cannot provide the full details of your invention to us (since that would be a public disclosure) we cannot comment further on your particular invention.
To this end, a patent attorney would certainly be the first port of call for you to proceed.


Does a magnet lose more potential when (passivley) magnetizing another metal?

Question: Does a magnet lose more of it's magnetic potential when (passively) magnetizing a second (ferromagnetic) metal compared with simply being left alone for the same amount of time it took?
Answer: A magnet does not lose any of its magnetism when it magnetises another piece of metal. Well, it doesn't necessarily lose any of its magnetism.
The lowest energy state of a ferromagnet is to have all of its magnetic domains aligned. The reason pieces of e.g. iron generally aren't magnetised is because they are stuck in a local and the individual domains aren't free to rotate their fields into alignment with each other. So when you place your piece of unmagnetised iron near a permanent magnet it does not need to take energy from that magnet. Instead it will gradually settle into a magnetised state and release energy (i.e. get slightly hotter) as a result.
Incidentally the fact a material releases heat when it becomes magnetised can be used as a cooling method rather unoriginally called magnetic refrigeration.


How much memory do Enums take?

Question: For example if I have an Enum with two cases, does it make take more memory than a boolean? Languages: Java, C++
Answer: In Java, an enum is a full-blown class:

Java programming language enum types
  are much more powerful than their
  counterparts in other languages. The
  enum declaration defines a class
  (called an enum type). The enum class
  body can include methods and other
  fields.

In order to see the actual size of each enum, let's make an actual enum and examine the contents of the class file it creates.
Let's say we have the following Constants enum class:
public enum Constants {
  ONE,
  TWO,
  THREE;
}

Compiling the above enum and disassembling resulting class file with javap gives the following:
Compiled from "Constants.java"
public final class Constants extends java.lang.Enum{
    public static final Constants ONE;
    public static final Constants TWO;
    public static final Constants THREE;
    public static Constants[] values();
    public static Constants valueOf(java.lang.String);
    static {};
}

The disassembly shows that that each field of an enum is an instance of the Constants enum class. (Further analysis with javap will reveal that each field is initialized by creating a new object by calling the new Constants(String) constructor in the static initialization block.)
Therefore, we can tell that each enum field that we create will be at least as much as the overhead of creating an object in the JVM.
Comment: On 32-bit platforms, it'll be exactly the same size as an int - it's just a (32 bit) pointer to the enum instance. Only one instance of each enum value exists in memory.
Comment: -1 "a little bit more heavier than a plain integer"?  What does that mean, and where do you get that from the text?
Answer: In Java, there should only be one instance of each of the values of your enum in memory. A reference to the enum then requires only the storage for that reference. Checking the value of an enum is as efficient as any other reference comparison.
Answer: You would only worry about this when storing large quantities of enums. For Java, you may be able to use an EnumSet in some cases. It uses a bit vector internally which is very space efficient and fast.
http://java.sun.com/j2se/1.5.0/docs/api/java/util/EnumSet.html
Answer: bool might be implemented as a single byte, but typically in a structure it would be surrounded by other elements that have alignment requirements that would mean that the boolean would effectively be occupying at least as much space as an int.
Modern processors load data from main memory as a whole cache line, 64 bytes. The difference between loading one byte from L1 cache and loading four bytes is negligible.
If you're trying to optimise for cache lines in a very high-performance application, then you might worry about how big your enum is, but generally I'd say it's clearer to define an enum than to use a boolean.
Answer: In Java, it would take more memory. In C++, it would take no memory than required for a constant of the same type (it's evaluated at compile-time and has no residual significance at runtime). In C++, this means that the default type for an enum will occupy the same space as an int.
Answer: In ISO C++ there is no obligation for an enum to be larger than its largest enumerator requires. In particular, enum {TRUE, FALSE} may have sizeof(1) even when sizeof(bool)==sizeof(int). There is simply no requirement. Some compilers make the enums the same size as an int. That is a compiler feature, which is allowed because the standard only imposes a minimum. Other compilers use extensions to control the size of an enum.
Comment: I think most use the native size for the CPU architecture. 32-bit aligned data is fast to retrieve for most 32-bit CPUs, so most types end up as multiples of 32 bits.
Answer: printf("%d", sizeof(enum));

Answer: In C++ an enum is typically the same size as an int. That said it is not uncommon for compilers to provide a command line switch to allow the size of the enum to be set to the smallest size that fits the range of values defined.
Answer: No, an enum is generally the same size as an int, same as boolean.
Comment: It could, hence 'generally'.  If someone is asking such a question without further details, though, edge cases like that are rarely important.
Comment: The Java and C++ tags indicate that this comment contains the correct answer in this context.
Comment: OK, on further research, it appears the answer for Java is not correct. (OT: It is the same as an int in C#, though.)
Comment: In C++ enum and int same. bool and char same.
Answer: If your enum will ever have only two cases, indeed using a boolean instead might be a better idea (memory size, performance, usage/logic), even more in Java.
If you are wondering about memory cost, it might imply you plan to use lot of them. In Java you can use BitSet class, or on a smaller scale, in both languages you can manipulate bits with bitwise operations.
Answer: sizeof(enum) depends upon what you have in the enum. I was recently trying to find the size of an ArrayList() with default constructor params and no objects stored inside (which means the capacity to store is 10). It turned out that ArrayList is not too big < 100 bytes.
So, sizeof(enum) for a very simple enum should be less than 10 bytes. you can write a small program, give it a certain amount of memory and then try allocating enums. you should be able to figure it out(that's how i found out the memory of ArrayList)
BR,
~A
Answer: In C/C++ an enum will be the same size as an int.
With gcc you can add attribute((packed)) to the enum definition to make it take the minimum footprint. If the largest value in the enum is < 256 this will be one byte, two bytes if the largest value is < 65536, etc.
typedef enum {
    MY_ENUM0,
    MY_ENUM1,
    MY_ENUM2,
    MY_ENUM3,
    MY_ENUM4,
    MY_ENUM5
} __attribute__((packed)) myEnum_e;

Comment: I am fairly sure __attribute__((packed)) is a GCC-only extension.  If I remember correctly, C99 does not specify a standard pragma for "packing", so every compiler does it differently.
Comment: You're probably right. It was my recollection that packed was a C99 feature, but my memory is often cantankerous and uncooperative. I removed the C99 reference.

How much memory do Enums take?


Two columns in the second column in Word

Question: I have a Word document and the page layout is set for two columns. In the middle of the page in the second column, I want to have a section that will be again separated in two columns. How can I do this?
Answer: So I just faked it. I used tab break in the middle of the second column and also faked the bullet symbol (ALT + 7) which I needed.
Comment: You could have inserted a two-column table into that space.
Comment: I don't understand how this "answer" addresses the question.
Answer: For your requirement, I think we can insert Table as a workaround. In the middle of the second column or first column, insert a two columns table. Copy and paste the content to two cells. Then set no Border for it. For example:


plot() function causes Scilab to freeze in Ubuntu 11.10

Question: Scilab 5.3.3 freezes whenever I try to run the plot() function in Ubuntu 11.10.  Can anyone suggest a solution?
Thank You
Answer: This is due to a bug in the mesa package of Ubuntu. Ubuntu people introduced a patch which breaks mesa (Debian does not have the bug).
See:
https://bugs.launchpad.net/ubuntu/+source/mesa/+bug/965798
https://jogamp.org/bugzilla/show_bug.cgi?id=566
A fix is to update Ubuntu to the latest release.


How to analyse the source code of Blender

Question: I am a beginner of Blender, my professor asked me to read the source code of Blender 2.6 and study how blender implements the material and texture block. After i have downloaded the source code, i find it is impossible for me to read whole source code, especially without detailed comment and professional manual. Is there anybody can give me some advice or offer me some learning material? For example, i am confused by how multiple layers of texture are compounded by using different blend type, like mix, add, subtract or overlay. How does blender implement these functionality?
Answer: Take a look at the code layout diagram here.
Comment: I really appreciate your help. After i read the docs about outline of blender, i get shallow understanding. However, i want to know how blender implements material and texture block, so i search blender wiki and Google many times, but there is litter material about this. Could your recommend me some docs or books?
Answer: I'd suggest you to get the source code and import the code into an IDE like QtCreator (import make file project). From there on, you can easily browse for the details.What you are looking for is a DNA entry.So look in the file DNA_MAterial_Types.h You can find the declarations for all the material types.


Neovim Markdown toggling bold keybind

Question: I am trying to make it so I can have a keymap for toggling things like bold in a markdown file.
I used to use vscode with the markdown plugin and they offered the option to, with a simple keybind, toggle on or off the bold on a specific word by adding two asterisks on each side of the word. If the cursor wasn't on top of a word, the four asterisks would be written and the cursor placed inside ready to write what I would like in bold.
In neovim I didn't find any plugin with this capability so I just thought about writing my own keybind for that.
The problem I found was detecting if the word was already with bold active or not. I could make two different keymaps, but wouldn't be what I was looking for.
Is there a good way of doing this?
Thank you:)
Answer: I usually use surround.vim for this. You could do
nmap <buffer> <your keys> ysiw*
nmap <buffer> <more keys> ds*

In ~/.vim/after/ftplugin/markdown.vim or equivalent. Make sure to adjust b:undo_ftplugin.

Neovim Markdown toggling bold keybind


Is GNU PDF Library in active development?

Question: I've been hearing about The GNU PDF Library since 2007. Since then I've been looking forward to see this tool in the wild, but four years have passed and it seems to me that this is a painfully long time. I'm aware of the complexities of the project, but as I recall the GNU Foundation have marked it as a top priority project. What is going on?
Comment: Since you have some responses below that seem to answer your question, please consider marking one of them as 'Accepted' by clicking on the tickmark below their vote count (see [How do you accept an answer?](http://meta.tex.stackexchange.com/q/1852)). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!).
Answer: There seems to be some activity on http://lists.gnu.org/archive/html/pdf-devel/. Also, see http://gnupdf.org/manuals/gnupdf-hg-manual/html_node/Information-for-Newcomers.html#Information-for-Newcomers for information about cloning their repository. Specifically do
 $ bzr branch bzr://bzr.savannah.gnu.org/pdf/libgnupdf/trunk libgnupdf

Bazaar is a distributed version control system, and its command line client is called bzr.
Looking at the repository is a good way to determine activity. You can see the logs by changing directory into the repository libgnupdf and doing bzr log -v | less. My two cents are that 929 revisions in slightly less than 4 years isn't so bad. Such projects usually have a shortage of manpower and of course everyone is a volunteer. If you have any specific questions, I'm sure the developers would be happy to answer, as long as you ask nicely.
Comment: C is ideal for a library because bindings can be provided for just about every language. I don't think there is another reasonable choice for this, is there?
Comment: I know some people are going to crucify me for this I'm about to say: I think the choice of "plain" C as the programming language for this project has complicated things a lot. I know that everybody wants a fast library, but IMHO I prefer an _existing_ yet not-so-fast one than an inexistent fast one. I would have voted for Python. Now let the nails come!
Comment: @Sergio: Actually, I'd be inclined to agree with you, but... Were they perhaps concerned about stability? Python isn't exactly static, and they'd eventually have to worry about making their code work with Python 3. I don't know if speed is so much the issue. Could they not have written just the hot-spots in C?
Comment: This is certainly an issue, although I think Python is pretty stable right now. Many projects are perfectly OK with pre 3.0 python. I agree with you that C doesn't change a lot these days. I still stick to my previous opinion on this.
Comment: @Don: If you write for GNOME then there is also Vala.
Comment: Most of the activity on the mailing list is newbies offering help.
Answer: The FSF has recently dropped GNU PDF from their list of priority projects because libraries like poppler, podofo, MuPDF and Apache PDFBox have developed quite nicely over the last years. Given the speed of development of GNU PDF over the last years I'm tempted to call it glacial: They seem to spend all their time at building foundations and up to now don't seem to have at least a minimal parser. It seems GNU Hurd will be finished before GNU PDF.
See here for a list of PDF libraries.
Comment: Link to list of PDF libraries is broken.
Answer: In addition to Faheem answer - it is good to look on Ohloh stats (here is GNU PDF Ohloh page). It sees that project have steady growth and while it have not increasing year-to-year development it is not dieing out as well (which is good).
Ohloh of course is just visualization of bazaar but I believe that "a picture is worth a thousand words".


Triggering an LED Flash

Question: I have an LED Flash which I want to trigger on and off just before and after my camera captures an image for a Machine Vision application. Any ideas on what circuit set-up I can use for doing this?
The Flash uses a 7.4V, 2200mAh 16.3Wh Li-ion battery. This is a link for the Flash I intend on using: https://www.amazon.in/Digitek-LED-D204-Professional-Battery-Charger/dp/B01A5ZS98O/ref=pd_cp_147_2?_encoding=UTF8&psc=1&refRID=Y64HXVVGE3093911NP92
Comment: That's a floodlight rather than a flash.  So it doesn't get triggered so much as switched on and off.  Do you want to be able to use it as normal as well?  What switches does it have (the listing doesn't give much detail)
Comment: How's this : https://www.diyphotography.net/how-to-build-a-flash-with-an-optical-slave/ ? Practically you want to build a camera blitz.
Comment: @ChrisH Yeah,sorry,  more a floodlight than a Flash. It has one on-off button and a knob for light intensity. I'm not sure about the internal circuitry
Answer: I like to use solid state relays for this sort of thing.  They provide isolation (often for your safety but in this case to avoid frying your kit).  They're faster and use less current than a mechanical relay, and simple to integrate.
An Arduino can apparently deliver 40 mA on a GPIO pin.  This arbitrarily selected DC SSR wants ≤30 mA and drops around 1.5V so will only need a simple resistor to drive it off a GPIO pin. It can switch 10 A if the two internal MOSFETs are connected in parallel, and the through-hole version can be assembled on stripboard or dead bug style (glued down on its back with its legs sticking up.  The current capability is more than enough, because we don't know how much that lamp draws.
As it has a dimmer as well, there's probably an LED driver chip in there, but I assume from my experience of hacking LED lights that the on/off switch is connected to the power supply line (in contrast to bike lights, where it's often an input to the LED driver).
When it comes to making the connections inside the lamp, that depends on exactly what you want to do.  Your options are:

Replace the on-off switch with the SSR
Wire the SSR in parallel with the existing on-off switch (this allows you to turn the light on without the Arduino)
Wire the SSR in series with the switch (this allows you to force the lamp off).

The biggest problem I see is if my assumption above is wrong, and you have an on-off switch that connects to a logic pin on an LED driver chip.  The only way to find this out is to open up the lamp and trace the circuit.  You can usually replace such a switch with an opto-isolator, but the details will depend on the existing circuit.
Comment: Thanks a lot for the answer. I was wondering if I could use a simpler mechanism like replacing the battery with cables from a 12V DC supply, converted to the required 7.4V using a Buck converter and supplying the rated current of 2.2A. Would that have any significant effects on the life of the LEDs or any other negative effects?
Comment: If you supply the correct voltage and enough current, the LED and its driver won't know the difference. But you'll still need to switch it somehow, probabkly using one of the approaches I suggest. Note that the output voltage of a battery varies with charge state; the home made power supply for my old DSLR is more reliable when set to the voltage of a full battery than that of a nearly empty one

Triggering an LED Flash


What's a good technical way to come up with melodies in a certain scale?

Question: I'm planning on composing a piece for bassoon and flute. I want to use the whole tone scale mixed with lydian. What are some good practices to come up with melodies?
Answer:
spend N hours noodling around on the said instruments (where N is some large positive integer). this helps ensure that the melodies are at least playable (by you, at least). (if you collect data from this you could feed a markov engine...)
steal adapt from existing melodic materials (see: Stravinsky and the Rite of Spring) for example from folk sources. may run you into copyright troubles depending on what you steal adapt. whole tone scales notably feature in music from around the 1900s which may or may not be under the iron copyright curtain? (check with a lawyer if concerned)
use an algorithm to generate the melody (restricted ideally to what notes the instruments can actually play). markov chains or fractals are two among many ways of doing this. these may however be difficult to play


primary ring and primary module

Question: I want to know that in the commutative rings, the definition of the primary module is coincide with the definition of the primary ring? And where i can find it?
The primary ring is a ring when ab=0, so a=0 or a power of b is zero and a primary module is a module with only one associated prime.
Answer: I'm not quite sure of what you are asking. I guess that what you want to check is that if $R$ is a primary ring, then it is primary as an $R$-module. In this case $R$ being primary means that if $I$ is the ideal of nilpotent elements, then $R/I$ is an integral domain. It follows that $I$ is the only associated prime and hence you get the definition you want.
I'm using Ernst Kunz Introduction to Commutative Algebra and Algebraic Geometry to get my definitions here.

primary ring and primary module


Can we write square roots in a fraction separately? eg, $\sqrt{\frac{9-x^2}{x-2}}$ vs $\frac{\sqrt{9-x^2}}{\sqrt{x-2}}$

Question: I was doing some questions related to functions when I came across this question where they gave us two functions as
$$\sqrt{\frac{9-x^2}{x-2}}\quad\text{and}\quad\frac{\sqrt{9-x^2}}{\sqrt{x-2}}$$
I can see that those two are a little different, but I have learned that we write $$\sqrt\frac{a}{b}=\frac{\sqrt a}{\sqrt b}$$
I am a little confused: is there a specific condition in which we can apply this?
Answer: Hint: $\sqrt{\frac{-3}{-2}}$ is defined, while $\frac{\sqrt{-3}}{\sqrt{-2}}$ is not (in case we work only with real numbers).
In your case, for $\sqrt{\frac{9-x^2}{x-2}}$ to be defined, you need $\frac{9-x^2}{x-2} \geq 0 \Leftrightarrow x \in (-\infty, -3] \cup [2, 3]$ and for $\frac{\sqrt{9-x^2}}{\sqrt{x-2}}$ you need both $9 - x^2 \geq 0$ and $x-2\geq 0$, which means $x \in [2, 3]$.
So, for $x = -4$ you have $\sqrt{\frac{9-x^2}{x-2}} = \sqrt{\frac{-7}{-6}} = \sqrt{\frac{7}{6}}$ and $\frac{\sqrt{9-x^2}}{\sqrt{x-2}} = \frac{\sqrt{-7}}{\sqrt{-6}}$ which is undefined.
Comment: I would argue even when working with complex numbers it doesn't make sense. Yes, negative numbers have square roots, but $\sqrt{-3}$ is still very dubious.
Answer: For positive real numbers we have that $\sqrt{xy}= \sqrt{x}\sqrt{y}$. Now if I set $y = 1/z$ this becomes $\sqrt{x/z} = \sqrt{x}/\sqrt{z}$. The conditions here are that they be real numbers and everything is well-define, ie no square roots of negative numbers and no division by zero. Complex numbers can complicate this as well since the square root is multivalued there.


How can I find the PPPoE password configured in Airport

Question: I'm connecting to internet via PPPoE with a AirPort Express. Now I want to replace AirPort with another router, but I don't remember the password of my PPPoE account. So I'm wondering how can I extract the password from the provisioned AirPort Express.
Answer: If your PPPoE is provided by your ISP, so contact you ISP's help is short way than try to extract the account info from AE's settings.


Recommeneded method to monitor rotary position and speed of machinery shaft

Question: I am building a piece of industrial machinery that will operate between 10-200 RPM. I would like to know the rotational position and speed of the shaft (2in diameter steel crankshaft). I am currently considering building a small attachment for my shaft in order to mount on a rotary encoder as pictured below ? I also have considered mounting a trigger wheel with hall effect sens to the shaft as seen in the second picture. I am sure there is a standard procedure for monitoring shaft position in industrial equipment.
Comment: There are [large rotary encoders that a 2" shaft fits into.](https://www.directindustry.com/prod/ami-elektronik/product-167912-1822186.html).
Answer: A 360° absolute rotary encoder would be the right choice for monitoring the speed and rotary position of a crankshaft.
A standard incremental rotary encoder would require a 'homing' routine to establish zero position after every power off.
Answer: I will need an absolute position rotary encoder. There are hollow shaft options that allow the shaft to enter the encoder.
As recommended by the other users, I can use a product similar to these:


how to install Matplotlib on Cygwin?

Question: I'm trying to install Matplotlib 1.0.1 version on latest Cygwin. In the processing, there is a weird fork error cannot be solved. I googled similar questions and found that it might be solved by manually running gcc/g++ with matplotlib 0.98.5.2 : http://innuendopoly.org/arch/matplotlib-cygwin. But it doesn't work under 1.0.1 version. Does anybody encounter the same problem?
Answer: Here are instructions for how to install matplotlib 1.1.0 on Cygwin
http://berlinbrowndev.blogspot.com/2012/01/python-matplotlib-plotting-setup-for.html
Python matplotlib plotting setup for cygwin
Matplotlib is a popular python library for generating plot graphics.   It works with cygwin win32 but some non-intuitive steps are required.
Install cygwin:
CYGWIN_NT-5.1 1.7.9(0.237/5/3) 2011-03-29 10:10 i686 Cygwin

I am using cygwin with setup 2.7.3
Install python through cygwin:
This document describes installing python and matplot with cygwin.  For most windows users and cygwin users, normally you would use the external python executable.  I tend to prefer all of my script oriented applications running through cygwin including python.
Python 2.6.5 (r265:79063, Jun 12 2010, 17:07:01)
[GCC 4.3.4 20090804 (release) 1] on cygwin

In the cygwin setup.exe installer, install:

The freetype libs, python-gtk, python-tk, libpng
gcc

Download matplotlib from sourceforge:
I am using the latest version matplotlib-1.1.0 as of 1/2012.
Download and extract the matplotlib tarball
Issues with standard python install and cygwin:
The typical 'python setup.py install' will not work with cygwin.  You need to modify a configuration file and run some other additional commands.
In the root directory of the expanded matplotlib directory, copy the setup.cfg.template configuration file to setup.cfg.  Edit setup.cfg.
Around line 70 in the file is a commented line, uncomment the line such that you have:
tkagg = False

Run install and watch it fail
Try running 'python setup.py install'
It should fail with an error like the following:
2 [main] python 2796 C:\cygwin\bin\python.exe: *** fatal error - unable to remap C:\cygwin\bin\cyggfortran-3.dll to same address as parent: 0x18660000 != 0x69780000
Stack trace:

Run the rebase command OUTSIDE OF THE TYPICAL CYGWIN ENV
Exit cygwin and close all cygwin instances including the one you are working with.  You won't be using the typical  cygwin prompt for the next command.
In windows explorer, open the cmd.exe or windows command
You will need to run rebaseall.  First, shut down any long running processes like sshd, close all Cygwin prompts and so on.
Type the following commands:
cd \cygwin\bin
ash
PATH=. rebaseall -v

...

And you should get several lines of output.
Run install and watch it succeed
Try running 'python setup.py install' command again in the matplotlib directory
Running Example Program:
# python
Python 2.6.5 (r265:79063, Jun 12 2010, 17:07:01)
[GCC 4.3.4 20090804 (release) 1] on cygwin
Type "help", "copyright", "credits" or "license" for more information.
import matplotlib.pyplot as pyplot
pyplot.pie([1,2,3])
pyplot.show()
pyplot.savefig('f.png')
pyplot.savefig('x.eps')

Comment: May I ask, why should disable `tkagg`?
Comment: Thank you!

I tried it today and it worked seamlessly, it didn't even fail the first time. I guess someone fixed something since January.
Comment: The following required packages can not be built: freetype - that is what it tells me after all. Does not work. Where can I get working freetype for 64bit?
Comment: Launch the Cygwin setup (in my case setup-x86_64.exe) and in the package list search for freetype2, select all found packages to install. You also need pkg-config so that dependency packages are detected automatically. Do the same, search for pkg-config and select all found packages to install. That's it. I didn't have any errors while compiling and installing, only some warnings but that should be ok. I installed it with: python setup.py install. If you just want to check for dependency errors do just: python setup.py
Comment: Now with a recent version of cygwin it's not necessary anymore to disable tkagg.'python setup.py install' works.
Answer: These steps taken from www.scivision.co worked for me:

Run Cygwin setup: (For some reason the original command posted in the source link did not work for me)
install packages: (most of these you may already have)

pkg-config
ghostscript
libfreetype-devel
libpng-devel
libgtk2.0-devel
gcc-g++
git
openbox
python3-numpy
python3-pyqt5
python3-devel

Then from Cygwin Terminal:

 easy_install-3.6 pip
pip install --upgrade six
pip install matplotlib

Then tested from python console:

 import matplotlib
matplotlib.__version__

Comment: Thanks, still works in 2019.  See comment by @FelisKastner below too.  I did not have to upgrade `six`, just after a cygwin default update.
Comment: After a complete new Cygwin install, I also had to install libcrypt-devel, and python36-pyqty5 (there was no python3-pyqt5).  An attempt to include python3.7 (and using the corresponding easy_install) failed at `pip install matplotlib`, a gcc compile failure, with an error log over 10,000 lines so I couldn't see what started it (the rest were failures to handle the failure.)
Answer: Installation worked for me as described by Felix above.
But to use matplotlib you need to start the Xserver from Cygwin first:
startxwin

and then start your script.
Comment: Thanks!  I also had to run cygserver to avoid shmem() and other errors. https://cygwin.com/cygwin-ug-net/using-cygserver.html#start-cygserver .  And of course, set DISPLAY variable.  (And run startxwin in the background.)

how to install Matplotlib on Cygwin?


Creating a preconditioner for conjugate gradient with a known approximate solution

Question: I am working on solving Poisson's eq. $\Delta u = -f$ using conjugate gradient method. I am using scipy's linalg.cg function. In this problem, the source function $f$ changes slightly in each iteration, after which I want to solve the equation again. Given that I know that the old solution is close to the current one, how can I use the old solution to create a good preconditioner? That is if $\Delta u_{0} = -f_{0}$ and $\mid f_{0} - f_{1} \mid << 1$, how can I find a good precondition matrix for $\Delta u_{1} = -f_{1}$ for the conjugate gradient method?
Comment: Would using $u_0$ as your new starting guess when solving for $u_1$ speed up convergence?
Comment: @OmerPaz Do you have problems to store a matrix of size $A$? If not, I would rather precompute + store the LU decomposition. A preconditioner in this case would be non-sense.
Comment: @OmerPaz I am not an expert, but you may search the topic of "krylov subspace recycling". But I am not quite sure how you could use that with Scipy.
Comment: I'd try using u0 as a deflation space/preconditioner.
Comment: You can just set the initial guess to the previous solution. Just make sure that the stopping criterion for the implementation of CG that you use is independent of the initial guess so that you may stop earlier.
Comment: A preconditioner's definition does not depend on what the RHS is. A preconditioner is  such that it is as close as possible to $A^{-1}$. I think you are asking for something that is a bit different.
Comment: Could @ConvexHull elaborate on this precomputation? Will this be applicable to different systems I want to solve?
Answer: I will give a short answer considering the LU decomposition instead (see Omer Paz comment)
First of all, we want to solve the following system
$$
\mathbf{A}\vec{x}=\vec{b}.
$$
Suppose you are able to store a matrix of size $A$ and your system only changes by (many) different right hand sides $\vec{b}_1,\vec{b}_2, ...,\vec{b}_N$.
A first (naive) idea would be to precompute $\mathbf{A}^{-1}$ and store it, in order to perform (Algorithm 1)
$$
\begin{align}
\{\vec{x}_1,\vec{x}_2, ...,\vec{x}_N\}=\mathbf{A}^{-1}\{\vec{b}_1,\vec{b}_2, ...,\vec{b}_N\},\\
\end{align}
$$
which is only a matrix vector multiplication.
However, this is not done in practice, since there is an even faster method by precomputing the LU decomposition
$$
\mathbf{L},\mathbf{U},\mathbf{P},\mathbf{Q}\,=\text{lu}\left(\mathbf{A}\right).
$$
Here the matrices are defined such that $\mathbf{P}\mathbf{A}\mathbf{Q} = \mathbf{L}\mathbf{U}$, where  $\mathbf{L}$ is unit lower triangular, $\mathbf{U}$ is upper triangular, $\mathbf{P}$ is a row permutation matrix/vector and $\mathbf{Q}$ is a column permutation matrix/vector.  Now, instead of applying the inverse, you simply perform (Algorithm 2)
$$
\begin{split}
\vec{y}~~~~~~&=\text{solve}(\mathbf{L},\,\vec{b}(\mathbf{P})),\\
\vec{x}(\mathbf{Q})&=\text{solve}(\mathbf{U},\,\vec{y}~~~~~),
\end{split}
$$
which, in most cases, is faster and more accurate than the direct application of $\mathbf{A}^{-1}$ due to memory/cache issues.
The main idea of a preconditioner is to reduce the condition number of a system for iterative solvers with, e.g.
$$
\begin{align}
\text{right preconditioner}&&\mathbf{P}&\mathbf{A}&\hspace{-1.7cm}\vec{x}&&=&\hspace{-0.8cm}&\vec{r},\\
\text{left preconditioner}&&&\mathbf{A}\mathbf{P}&\hspace{-1.7cm}\vec{l}&&=&\hspace{-0.8cm}&\vec{b}.
\end{align}
$$
Now, the best preconditioner you may choose is $\mathbf{P}=\mathbf{A}^{-1}$, since $\mathbf{A}\mathbf{A}^{-1}=\mathbf{A}^{-1}\mathbf{A}=\mathbf{I}$, which would result in an iterative method with only one iteration step (for convergence), since it is equivalent to Algorithm 1. However, as previously stated, there is a even faster Algorithm 2. $\square
$
The LU decomposition has to be applied and stored for each system.
Comment: I agree that this specific answer over-focuses on LU. But I think the sentiment is correct, that if you have an invariant LHS and many RHS, investing in better preconditioners is a great idea and is practically guaranteed to pay dividends (in that it is expected to improve performance regardless of similarity between RHS's).
Comment: I think the question was not on that subject, but rather whether there exist methods to iteratively improve the convergence of krylov methods for consecutive linear system solutions when the matrix is unchanged and it is assumed that the consecutive solutions are close to each other. Even though, of course, LU-decomposion may be an even better solution for sufficiently small systems.
Comment: The answer was motivated by @OmerPaz comment. The answer is not directly related to the original question.


mobile vs responsive sites

Question: A web company for a medical clinic in the US is telling me that it is cheaper for them to build  regular WP site and a separate WP mobile site than a single WP responsive site. What is the conventional wisdom which is better. Is responsive just for those who can't afford a regular and a mobile site or does it handle more devices than a mobile site?
Comment: Responsive wordpress templates are a dime a dozen, I don't know why anyone would opt to maintain two separate sites instead of working from a good responsive theme. Any web developer should be able to produce simple responsive layouts from scratch too, maybe they just don't know what they're doing.
Comment: How is that a WordPress question?
Answer: Mobile website :
Mobile website is a separate site, designed for mobile phones and mobile browsers.
The main benefit of having a mobile site is that you can target your mobile audience very well.
The drawbacks are several.  Since your desktop site and mobile site are two separate entities, when you update your website, you will need to update your mobile site as well.
Responsive website:
Responsive website is a single website that scales based on what device was used by the visitor – desktop or laptop, mobile phone, or tablet.
There are many benefits to responsive website.you only have one single site, It requires little maintenance once implemented and is a good long term solution.  A responsive website benefits from exposure to all visitors – mobile or desktop – and steadily gains popularity on the website because of links and sharing.
There are still some drawbacks in it. it will take a lot of resources to design and implement the new website layout. The website content then needs to be reviewed and edited to accommodate both desktop and mobile viewers.
Some Useful Links :
http://www.slideshare.net/bradfrostweb/responsive-design-vs-separate-mobile-sites-presidential-smackdown-edition
https://ux.stackexchange.com/questions/13273/responsive-web-design-vs-separate-website-for-mobile
http://noldorweb.com/blog/responsive-web-design-vs-separate-mobile-website-design/
http://www.smartz.com/web-development/mobile/mobile-vs-responsive-design/
Answer: In my opinion, a responsive site is a better choice in the long term as it's easy to maintain and update. Mobile browsers are getting better day by day, so it's only safe to have a mobile website if you target specific low end mobile devices or wish to provide a different experience to your mobile visitors.
In terms of cost, I personally would recommend a responsive website for my clients, as it's easier and faster for me to make one, plus, it's future proof.
Check out this interesting case study http://mobile.smashingmagazine.com/2012/08/22/separate-mobile-responsive-website-presidential-smackdown/

mobile vs responsive sites


How to export Blender model into Adobe After Effects?

Question: I have a model in Blender, which I have tried to export into Adobe After Effects as .obj and adobe after effects file (.jsx). None of these open in After effects. Does anyone know how to export it?
Comment: Hi there. I do not use any adobe products but recently I sent a friend a link to a video, who seemed to have the same problem. You might want to give it a try: https://www.youtube.com/watch?v=eEQUba16V5o
Answer: After Effects is not a 3D program, therefore it can not import 3D objects by itself. There are 3rd party programs that can help import an OBJ file. One of the best is Element 3D by Video Copilot ($200). After Effects also comes with Cinema 4D lite which has built in pipeline for working with 3D. You could always export from Blender into Cinema 4D and then use the built in pipeline to get it into After Effects.
Hope this helps.
Answer: The .jsx file can, in fact, be "opened" by After Effects, and can give you camera and null (empty) data from after effects.
The thing to realise is it's not a file to import in the conventional sense - rather, it's an automatically-generated script that, when run, will recreate the animation data. So you need to create a new After Effects project, then run the .jsx file via File > Scripts > Run Script File. That'll give you the animation data.
However, After Effects cannot natively display 3D models - it's a purely 2D compositor, so a common practise is to render multilayer .exr files and load them as image sequence.
You can also export an FBX (which contains fully animated 3D data) and use Cinema 4D Lite (which is a integrated with After Effects and included in Adobe Creative Suite) to load and display it with After Effects.
Of course, the cleanest solution is not to bother with After Effects at all and just use Blender's built in node-based compositor, which can handle many of the same functions and is often much faster.
Answer: You Better Export Your Animation as Image Sequences and use EXtractoR Plugin...
you can check this video too for further instructions
https://www.youtube.com/watch?v=thc0-1ze8po


Removing the splash screen on shutdown an startup. I want to be able to see the processes

Question: I know this has been asked but on slightly different terms. I would like to remove it so that I can see the code behind. Not one off but every time it is shutdown and started.
Thaknk you in advance.
Answer: I recommend just editing your /etc/default/grub.
Change
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

to
GRUB_CMDLINE_LINUX_DEFAULT=""

Remember to update grub afterward with sudo update-grub at the command line.
Comment:  Originally, I put GRUB_CMDLINE_LINUX_DEFAULT="text".  Note this will end your boot process at the command line.  After (possibly) having to login with username and password, startx at the prompt will start up your usual GUI.
Comment: This made my Ubuntu loose all the x GUI not the splash.
Comment: @Luke I'm glad it helped.  I hope you didn't run into a problem like the others.  See my revised answer.
Comment: @erdemkeren See my edited answer if you need to get back into the GUI.  Alternatively, you can edit your grub again using the `nano` editor, which is a friendly console-based editor.
Comment: No problem about recovering. Just wanted to inform others. Thanks for reply.
Answer: For a single boot process, you can interrupt Grub e (edit), move the cursor to the kernel you want to start, e edit the line with the kernel and remove the
splash quiet

or change them to
nosplash noquiet

A persistent solution would be to modify your /boot/grub/menu.lst file from:
kernel      /boot/vmlinuz-2.6.32-39-generic root=UUID=01-cafe ro quiet splash locale=de_DE

to:
kernel      /boot/vmlinuz-2.6.32-39-generic root=UUID=01-cafe ro locale=de_DE

(your locale might vary). After installing a new kernel, the new one will again have the default settings. Modify in /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

to
GRUB_CMDLINE_LINUX_DEFAULT="noquiet nosplash"

if you have such a file. See
info grub

on how to change your grub settings in general. There is a graphical customize for grub: https://launchpad.net/grub-customizer but I haven't tested it.
Comment: `menu.lst` is gone a very long time ago...
Comment: @enzotib: menu.lst is present in 10.04, the current LTS version of (X/K)ubuntu. It isn't gone, and it isn't gone long ago.
Comment: @userunknown: from [Grub2](https://help.ubuntu.com/community/Grub2): "GRUB 2 is the default boot loader and manager for Ubuntu since version 9.10 (Karmic Koala)". Maybe *you* have chosen to stay with grub legacy.
Comment: @enzotib: Afaik, with Grub2 the way the menu.lst file is modified has changed, but the file is still in use. I'm always updating my Linux installation and my /etc/grub.d dir is from 4.2010. The `20_memtest86+` file therein contains the note: `older versions of grub2 do not have this yet (LP: #459080)` so my impression is, that I'm using a kind of grub2. /etc/grub.d wasn't there with the former grub.


How can i convert binary codes to png image in qml?

Question: In qml, i am using xml file to get some information from server. In this xml file there is a field as
< image>iVBORw0KGgoAAAANSUhEUgAAA2AAAALKCAYAAABUYjK........< /image>.
 I am using XmlListModel and ListView for other field but how can i convert this code to png image.
Answer: I didn't try myself, but if QML supports the data URI scheme (http://en.wikipedia.org/wiki/Data_URI_scheme), try
Image {
    source: "data:image/png;base64," + model.imageData
}

Comment: I tried, it works. This might be the best and shortest solution!
Answer: I would implement a custom QDeclarativeImageProvider, which creates an image from the encoded data.
Then you can do something like this in your delegate:
// ...

Image {
    source: "image://encodedimage/" + model.imageData
}

// ...

Have a look at this example, it might be a starting point for your implementation.
If the image is base64 encoded, then you can create an image like that (not tested):
QByteArray ba = QByteArray::fromBase64(imageDataString.toAscii());
QImage image = QImage::fromData(ba, "PNG");


Comparing Doctor Who footage before/after 2005 by total airtime

Question: In terms of minutes of total airtime, is there now more Doctor Who since the 2005 revival, compared to episodes (and films) made before 2005?
Comment: If spin-offs don't count for you, I'm not sure you'd consider the *Dr. Who* films to count either; I'm not using "Dr." as shorthand, look them up. My point is that "airtime" is hard to define: simply counting the episode minutes will get you a lot of duplicate footage, and will ignore a *wealth* of footage that is definitely *Doctor Who* but not necessarily episodes or canon, while saying things like "all films" will get you hours of definitively *non*-canon footage. This franchise is... messy.
Comment: These numbers would be easy to approximate, but nearly impossible to get truly accurately. Also, there are a lot of edge cases; do you include the 1960s *Dr. Who* films? *The Scream of the Shalka*? *Torchwood*? The original *Shada* never aired, but was later released at least twice on video, DVD, webisode, and audio dramas of varying length. Modern webisodes, mini-episode intros, *Red Nose Day* productions? *The Curse of Fatal Death*? What about "Previously on" recaps? Both old and new Who make use of them, and in Old Who it was often gratuitous when they needed to pad the episodes...
Comment: I'd like to include films - I suspect spin-offs don't count....
Answer: No, not even close. By my calculation (using the list on Wikipedia) there were 695 episodes of the original incarnation, all but 13 of which were 25 minutes long (those 13 were 45 minutes long). This makes 17050+585=17,635 minutes of original.
By contrast, the new series has 102 episodes of between 45-70 minutes, which makes about (I can't be bothered to work it out exactly) 5,000 minutes: less than a third as much.
Comment: @BESW I don't see how you could do it other than re-watching every episode armed with a sonic stopwatch...
Comment: @PhilPursglove: two months have gone by, and no-one's done this yet!? I know some old episodes are still lost, but *come on people*. Work for those rep points!
Comment: Wibbly Wobbly Timey Wimey...Stuff :-)
Comment: Beat me to it - using the same list I had an approximation of 347½ hours vs 103¾ hours.
Comment: There isn't a way to calculate *original* airtime, is there? That is, ignoring the repeat footage from the (often several minutes long) "previously on" recaps?
Comment: @PaulD.Waite ;-)


Main Service Panel - Outdoor/200 amps

Question: I am trying to do is pick out a service panel. MY requirements are. Meter on the Left, 4 jaw Ring, no bypass, outdoor, surface mount, 200 amp, Main Breaker, 8 breaker spaces Underground feed and Lower Right Side knockout. What are the requirement I should be looking for in a unit. Is breaker type just preference or is one better then the other. Is Bolt on better for outside use, versus Plug on. I will install a 100amp breaker and feed to an RV panel on same board. It has it's own breakers for 50/30/20amp plugs.
Thank you in advance
Comment: Product recommendations are off topic. If outside the panel will need a 3R rating or better.
Comment: Thanks Ed, I updated the question.
Comment: Who is your utility?
Comment: Pud3 Hoodsport wa
Answer: It's up to you whether to get a combo meter-main-panel it get them as separates.  I prefer a separate meter from panel, so You can change the panel without having the PoCo come out and remove the service drop (and all the permits and inspections they will require for that).
A "farm panel" is a popular product that contains 8 breaker spaces and thru-lugs for carrying the full 200A onward to another panel.  That seems to meet your requirements.
Comment: If I need ever need to change the panel, i would be because I have built a house and it would have to be changed anyway, baring it failing. But it's a nice easy simple installation with the combo. I don't want to have to pay an electrician to wire up the whole setup. Just the service wires to the meter and from my 100 amp breaker in service panel to RV panel 6inches away. So, as long as it's rated for outdoors it does not matter which one?
Comment: @Dean it's an outdoor panel, What we see a lot of is either those rusting out, or going obsolete and you find yourself in a pinch to find breakers. "This is all I'll ever need" are 'famous last words': we see a lot of people needing to add circuits to full panels.  Any of the Big Four (Square D, Eaton, Siemens, GE) make perfectly competent panels.  Of course CH and QO are "industrial grade" with better support and copper bus bars. HOMeline is the shoemaker's son, with the worst support.  Not even a 60A GFCI, give me a break. Siemens handles generator interlocks particularly well.
Comment: And actually with a farm panel, you wouldn't need to *change* the panel, just grab the "thru lugs" on the bottom and carry them onward to the new house.  That's what farm panels are designed to do.
Answer: I'd use an all-in-one pedestal unit
As it turns out, you can get everything you need (200A 4-jaw ringstyle meter socket, support for underground service), 50/30/20A RV receptacles, and room for an onwards feed or branch breaker spaces) in a single piece of hardware: the Midwest Electric M275CP6010.  While it doesn't stake a claim to having an EUSERC standard pull section, it shouldn't pose too much trouble for your utility, and has 4 spaces left over that can be used to feed other things.  (If you wanted to feed a panel, you could rearrange things and use a Midwest CB2200B or GE THLK2200 in the freed-up slots; for smaller panels or branch circuits, you can just use a THQL as a feeder breaker instead.)

Main Service Panel - Outdoor/200 amps


When we are inside a plane and look outside the window why does everything (outside) appear to be at rest?

Question: When we are inside a train and we look outside the roadside trees appear to be moving in the opposite direction but when we are inside a plane and look outside the window everything seems to be at rest. Why is that so? The plane is moving so to the passengers inside the plane the outside things (clouds etc) should appear to be moving, but why don't they?
Comment: hi Sagnic. When you are in a train and you look at a distant mountain, does it move? It is a matter of distance and relative velocity
Comment: When you see movies about flying, they try to make it exciting by zipping in and out between clouds, so you get a sense of speed. In real flying, you want it to be as boring as possible. You stay far away from clouds, and everything else, if you have a choice. Clouds are bumpy, they block your vision, and other planes can be hiding in them.
Comment: ^ this. Clouds = lack of fun for flying (except with IFR, which doesn't care about clouds (unless they are storm clouds)).
Comment: Possible duplicates: http://physics.stackexchange.com/q/116425/2451 , http://physics.stackexchange.com/q/130999/2451 , http://physics.stackexchange.com/q/114748/2451 and links therein.
Comment: I've never thought objects outside of an airplane appear to be at rest when the plane is moving. They seem to appear at the front edge of the window and move across the field of view in the opposite direction from the direction the plane is going in, and then they disappear from view at the rear edge of the window. Hopefully my experience in this regard is not unique.
Answer: You must have watched only the uniform blue sky, otherwise we do can see things passing by. :)


Alert assigned user when predecessors completed

Question: I have an out of the box SharePoint 2010 Tasks List setup using predecessors (a lookup column back to same task list, allows multiple selections) and I have a requirement to send an email alert to the person assigned to the task as soon as all predecessors have a status of complete. I've been searching for a few days and keep hitting dead-ends. I do not have access to Visual Studio and I am not allowed to deploy Visual Studio solutions to our farm. Any suggestions on how to accomplish this task would be greatly appreciated.
Answer: Since you cannot use a Visual Studio solution, your only other option would be to use SharePoint Designer workflows.  You can make you predecessor column only accept a single value and then in your workflow update list items that match the current item.
Comment: Thanks John, unfortunately multiple predecessors is also a requirement.
Comment: Unfortunately, SPD doesn't have a good way to update multiple list items based on what a field contains (meaning it works great when it is looking for an exact value, not when a field "contains" something).  And without being able to create a custom solution in VS, there aren't any options left.
Comment: It looks like I am able to deploy sandboxed solutions. Any direction on how to accomplish this in 2010 with a sandboxed solution?
Comment: In a sandboxed solution you can create a code-based workflow action.  You can then use that workflow action in a SharePoint Designer workflow.  See http://msdn.microsoft.com/en-us/library/ff798499.aspx
Answer: I have the same problem in front of me. It looks like the Sandbox solution requires Visual Studio, so here is an alternative that truly doesn't require VS.
The problem in a nutshell is that for whatever reason, SharePoint cannot handle multiple values being returned in a lookup. Therefore, the solution is to ensure that each lookup only returns a single value. Rather than perform 1 lookup that returns 3 values, you'll have to perform 3 separate lookups, each returning 1 value.
In short - my proposed solution simply involves creating 3 different "Predecessor" columns (Predecessor1, Pred2, Pred3). This is exactly the opposite of an "elegant" solution, but until SharePoint accommodates multiple values being returned by a lookup, I think it's the only option that would allow multiple predecessors without requiring custom programming.
if it would help, I could outline my workflow steps. Here they are in a nutshell:

workflow is initiated by updating any task status to "Complete".
Identify the CurrentList item that has the CurrentItem.ID as either Predecessor1, Pred2, or Pred3. Once you find that task, you'll probably want to store the Predecessor values into separate workflow variables (var1, var2, var3).
evaluate the status of each task where ID in (var1, var2, var3)
If every task evaluated has a status of "Complete" then [open next task].

Hope this helps! It's not a great solution, but again, is probably the only solution available to those of us that can't program or don't have access to VS.


Letter of recommendation repeat

Question: I asked my thesis advisor to write me a letter of recommendation, giving her a copy of the letter of recommendation written by another professor for me the last time I applied to colleges. Turns out, she has submitted the same copy I sent her, with a few minor changes. While, this is not problematic per se, I am applying to a few colleges that I had also applied to last time. Will the admissions office view this negatively, considering pretty much the same letter has been sent by two different individuals in consecutive years?
Comment: So, really, you should not have given her the copy of your other referees letter....
Answer: No, that's not a big issue for you. I'd be very surprised if anyone sees that the letters are similar (who would compare letters of recommendations between two different years?). And if they do notice and are interested in you, they can always contact your thesis advisor (it does reflect a bit strange on her tbh).

Letter of recommendation repeat


Vertex slide a specific distance instead of a percentage?

Question: I have a vertex on a 45 degree edge. I want to slide that vertex exactly $0.1m$ on the $x$-axis, but maintain a $y$ and $z$ position along the edge. I can slide the vertex along the edge using GG for vertex slide, but I do not know the percentage of the length of the edge that corresponds to  $0.1m$. How can I do this?
Answer: Set Transformation Orientation to View. In Edit Mode, select your Edge and press Shift+NumPad7 to align to your viewport. Now you can manipulate the vertex location by using the View's Y perspective. Select the vertex and press GY-0.1mEnter

You can also use Shift+NumPad3 to view from the side and use the View's X perspective then press GX-0.1mEnter but it's not so visually appealing for this example.
Comment: Beware that contrary to vertex slide, this method stretches the UV's.
Answer: Try pressing the x axis to slide on that axis, then press 0.1 on your keyboard. Your units I think should also be in the same unit (in this case meters) that you want to vertex slide in. You could also do -0.1 or when you vertex slide, a pop up should appear on your bottom left corner of your screen. You can type 0.1 in the slot to make the vertex the way you want.
Comment: see my answer on how to do it properly :D


Integral over cosine weighted sphere cap/cone

Question: I'm not sure I have the right terminology, but in rendering it can be useful to draw cosine weighted samples from a hemisphere. In this case the integral (over the weights) is Pi.
Now I don´t want to sample the complete hemisphere, but rather a cone, centered around the polar axis. But not in a uniformly like e.g. the function UniformSampleCone() in pbrt, but rather also in a cosine weighted manner. In other words a subset of the cosine weighted hemisphere. Is there a formula compute the integral of weights for this? I was thinking something like (1 - cos(cone_angle)) * Pi, but it is not quite right.
Comment: $\int_{0}^{\theta_{\max}}\int_{0}^{2\pi}C\cos t \sin t \,dt \, d\phi = 1$ then $C = \frac{1}{\pi(1-\cos^2(\theta_{\max}))}$. One way to sample it is $\phi = 2\pi u$ and $\cos\theta = \sqrt{1-v\sin^2(\theta_{\max})}$.
Answer: As I was referencing PBRT, here are the functions I ended up with:
fn coneCosine(uv: Vec2f, cos_theta_max: f32) Vec4f {
    const xy = @splat(2, @sqrt(1.0 - cos_theta_max * cos_theta_max)) * diskConcentric(uv);
    const z = @sqrt(std.math.max(0.0, 1.0 - xy[0] * xy[0] - xy[1] * xy[1]));

    return .{ xy[0], xy[1], z, 0.0 };
}

fn conePdfCosine(cos_theta_max: f32) f32 {
    return 1.0 / ((1.0 - (cos_theta_max * cos_theta_max)) * std.math.pi);
}


Working in Germany for U.S Company with German subsidiary

Question: I work for a U.S based company. It has a German subsidiary. I am asked to re-locate to Germany to help support the company. What are the possible work permit options? I am still employed and paid by the U.S entity. I have been doing a lot of research, but this is not a German employment visa situation, it would seem.
Comment: why not? You're going to be employed while living in Germany
Comment: How long are you going to be in Germany?  The use of "relocate" implies that you will be there long enough that they should transfer you to the German payroll.  If they think you will be living in Germany and remaining on the US payroll, they need to talk to a lawyer in Germany, who will set them straight.
Comment: You need a visa to work, I'd imagine you qualify to apply as an imtra-corporate transferee. What did your US company HR team advise?
Answer: I am assuming be "relocate" you mean you will stay in Germany a long time, not just a month or two. Your only legit option is to transfer to the German branch and be employed and paid by them.
A few general pitsfalls and explanations:

The US makes all citizens pay taxes, Germany in contrast makes all residents pay taxes. So yes, as a US citizen residing in Germany,  working in the US you will pay taxes twice. First to the IRS and then to the German equivalent, the Finanzamt. And while Germany and the US have double taxation treaties to lessen the burden, that only means your US taxes paid can be used as deductables against your German taxes. But that still means you will pay full US taxes, and about half (due to deducting your US taxes on the German tax declaration) the German taxes. Make sure your company compensates you accordingly, otherwise, you lose money compared to working in the US (or being a German and working for the German branch in Germany).

Health insurance is mandatory no matter which model you pick. If you are employed by a German employer, the employer is bound by law to pay half your health insurance fees each month. So if you see that they pay lets say 5000€ per month, they actually pay you 5000€, and your health insurance around 400€. If you decide to stay with your US employer or become self-employer in some kind of s(h/c)am, you would need to pay both halfs of health insurance, for 5000€ a month that is probably around 800€.

Technically speaking, residing in Germany and working and being paid by a US company is perfectly legal. Assuming you pay your mandatory health insurance by yourself and you pay taxes in Germany on the money you make. My wife did that, and I have never seen a German form filled out so quickly. You pay maximum insurance rate and a lot of taxes? Never seen buerocrats being that helpful before. However, that is not a reason for any Visum. While being in Germany doing that is perfectly okay, coming to Germany for that reason is not a valid Visa reason. You would need to find a different visum for Germany. It would work for example if you married a German and applied for family reunion.

Technically, I think you could claim you are self-employed, and do the above. Self-employment and a means to support oneself is a valid reason for a visa, but the intention is that you are actually self-employed in Germany and making money through your self employment, not another source. So... while technically possible, I would not do that without a lawyer, to not be in any danger to be accused of fraud.

Maybe your corporation has other options. Ask them, you never know which wheels big corp can move or grease or dodge to make things happen.

To summarize: the easy and legal way is to switch employment to the German branch, have a German income, get half your health insurance paid, and get a transfer visum. Anything else... is dodgy. You may want professional help.
Whether you decide to transfer or not, make very sure you know all costs associated with working here and living here, like health insurance and double taxation. You don't want to find out your move makes you less money than just staying in the US.
Comment: The FEIE depends on where you are when you do the work, not on the location of the entity that is paying you.  See https://www.irs.gov/individuals/international-taxpayers/foreign-earned-income-exclusion-what-is-foreign-earned-income "The source of your earned income is the place where you perform the services for which you receive the income. Foreign earned income is income you receive for performing personal services in a foreign country. Where or how you are paid has no effect on the source of the income." If you live in Germany, you're working in Germany.
Comment: But then there's the US foreign earned income exemption and the ability to deduct foreign tax from US income, so the US income tax liability will likely be zero except in the first and last years if the taxpayer moves midyear.
Comment: I clarified that I meant taxes when keeping the US job.
Comment: "And while Germany and the US have double taxation treaties to lessen the burden, that only means your US taxes paid can be used as deductables against your German taxes." That doesn't seem like much use, because even without any tax treaty, you can use foreign taxes paid on doubly-taxed income, as a tax credit on your US taxes.
Comment: Since the earned income is earned in Germany, it has the dibs. So the OP will first pay taxes in Germany and then claim credit on their US taxes, not the other way around.


Is it possible to add new target type in drupal content type?

Question: Is it possible to add new target type in drupal content type?
Answer: So it looks like you are using the Entity Reference field.  The target types, are Drupal Entity types. You can definitely create your own custom entities.
The Drupal Examples module has an entity example:
https://api.drupal.org/api/examples/entity_example%21entity_example.module/group/entity_example/7.x-1.x
Although this doesn't leverage the additional tooling provided by the Entity API module...
If you are wanting to reference CiviCRM data from Drupal node, install the CiviCRM Entity module. CiviCRM Entity exposes CiviCRM API entities as Drupal entity types
With that enabled you can reference CiviCRM memberships, contacts etc...Or create new ones, using Inline Entity Form widget


RefineryCMS consuming too many resources?

Question: I've developed a RefineryCMS-based app, and I'm hosting it at Site5, with the plan HOSTPRO + TURBO.
A couple of weeks ago I've got the folder disabled because the support people told me it was consuming too many computer resources. Below is what they told me:

After some recent problems with the
  server
  riverthames.accountservergroup.com we
  found that your site is causing those
  problems due to your site's resource
  usage. Your site is using too many
  system resources (CPU and Memory) for
  shared hosting. With shared hosting
  you are sharing the hardware resources
  with other people and unfortunately
  your site is using more than it's fair
  share. Unfortunately this means that
  your site is going to need dedicated
  hardware resources.
Here is a summary of your CPU and
  memory usage on your account over the
  past 24 hours:
CPU: 11.17 % MEM: 2.18 %
We believe the processes shown below
  are responsible for this level of
  resource usage, please keep in mind if
  you run a dynamic site off WordPress
  or another script it might just show
  index.php which is the primary file
  that runs the entire site:
--------------- Top Process %CPU 99.3 Rack: /home/usr/app/current Top
  Process %CPU 71.7 Rack:
  /home/usr/app/current  Top Process
%CPU 71.5 Rack: /home/usr/app/current

Any ideas about what could be causing it?
Comment: How much traffic are you getting?
Comment: It's not a traffic issue I guess, because it was happening even before making it public.
Comment: There was an issue with performance in a recent release. This was fixed soon after. Is your code base up-to-date?
Answer: I had to move my Rails apps (some Refinery) away from site5 because of the same problems. They simply aren't setup to run Rails apps well imho. Slow Ruby 1.8.7, no ability to tweak passenger (main problem was the amount of app instances spinning up was eating up memory fast).
I'd also recommend setting up New Relic to get some more details on where the memory is going.


Calculating the class number

Question: for calculating class number of a number field $K$, first we can calculate Minkowski bound ( Let's call it B). I know that every class in class group has one integral ideal whose norm is less than B. Now we factorize the ideal into product of prime ideals. We get that every such prime ideal has norm less than B. Now, when $K=\mathbb Q(\sqrt d)$ for some $d \in \mathbb Z$ then every prime ideal has norm of the form $ p$  or $p^2$. After this I can't find a way to calculate the class number of the number field.
Comment: There's no hard-and-fast rule or definite, terminating process:  there are tons of fields we don't know class numbers for.
Answer: I will try and give you a few ideas in the quadratic case, but this won't be a complete algorithm.
If the norm of the ideal is $p^2$ then this means $(p)$ is still prime and clearly principal so we can forget about it.
Otherwise we can use Kummer-Dedekind to write $(p)=(p,\sqrt{d}-a)(p,\sqrt{d}-b) = \mathfrak{p}_p\mathfrak{q}_p$, (the suubscript denotes the norm) where $x^2-d = (x-a)(x-b) \mod{p}$. (If it didn't factorise modulo $p$, then its norm would be $p^2$.)
Now if $\mathfrak{p}_p=\mathfrak{q}_p$ (i.e. $a=b \mod{p}$), then we can see that $\mathfrak{q}_p^2=(p)$ is principal so it has order dividing two in the class group. We can check which one it is by determining if there exists an element of norm $p$ in $K$ or not. (This is only a finite check if $d<0$).
Otherwise, $\mathfrak{p}_p\mathfrak{q}_p$ is principal so $[\mathfrak{p}_p]+[\mathfrak{q}_p]=0$ in the class group so we only need to consider one of them, but we don't have any bounds on the order. You can also try to check if this is principal again.
Doing this for all primes up to the Minkowski bound, and then you need we now need to check for relations between the primes of different norms. For this note, that the norm of a principal ideal is equal to the norm of its generator and $N(n-\alpha)=|n^2-d|$ for any integer $n$.
So for example if you had a prime with norm $3$ and one of norm $5$, then you should search for an $n$ such that $|n^2-d|$ is only divisible by $3$ and $5$ (you can just try computing the first few values of $n$ and hope for relations). Say the norm was $15$, then $(n-\alpha)=\mathfrak{p}_3\mathfrak{p}_5$ for some suitable primes (but we can force them into the ones we want by the relations we already have), which tells us that $[\mathfrak{p}_3]+[\mathfrak{p}_5]=0$ so we can remove one of these. (If say we know the order of $[\mathfrak{p}_3]$ but not $[\mathfrak{p}_5]$, then this also tells us the order of the other in this case).
By this point, if you can show that there are no more relations (e.g. by showing no element of norm $3^a5^b$ exists) and have found the order of each non-principal ideal you have left, then you have sucessfully found the class group.
If not, there are a few more things you can try but I can't completely remember what.

Calculating the class number


What is the biblical basis for the position that embryonic stem cell research is immoral/sinful?

Question: Many churches teach that embryonic stem cell research is strictly wrong, while adult stem cell research is alright.  What is the biblical basis for this teaching and why are the two distinguished?
Comment: Related, but by no means a dupe: http://christianity.stackexchange.com/questions/3085/what-is-the-catholic-stance-against-in-vitro-fertilization and http://christianity.stackexchange.com/questions/3086/what-is-the-catholic-stance-on-embryo-screening
Answer: This article gives a pretty good summary of the foundations, though I'm not going to endorse the argument it makes.

"Embryonic stem-cell studies are controversial because they involve the destruction of human embryos," the New York Times explained in a May 6 article reporting on the shifting politics of stem-cell research.
It's not complicated. An embryo used in stem-cell research (and fertility treatments) is three to five days past conception. It consists of a few dozen cells that together are too small to be seen without a microscope.

Those Christians who believe that life begins at the moment of conception, and that a cell cluster five days past conception is the equivalent of a human being, equate the use of embryonic stem cells with murder. Use of adult stem cells does not kill the donor.
There are other questions that address the biblical foundation for "life begins at conception".