Implementing a Min Heap with an Array: Insert and Remove Min (with duplicates)

Question: I'm trying to implement a Min Heap in Java, but I'm having issues with inserting and removing elements (inserting at the end, removing the root as min). It seems to work for the most part (I use a program to visually display the heap and have been printing out the new roots when min has been removed, things like that).
My problem is, for some reason the root won't switch with a new item when a new item is added, but I can't figure out why at all. Also, it seems this is only the problem when there are a lot of duplicates, the heap doesn't seem completely capable of staying in order (the parent is smaller than the children). For the most part, it does. Only occasionally it doesn't, and to me it seems random.
This is done with generics, and basically following most algorithms. Everything else I know for a fact works, it's definitely a problem with these two methods.
public void insert(T e)  {
    if (size == capacity)
        increaseSize(); //this works fine

    last = curr; //keeping track of the last index, for heapifying down/bubbling down when removing min
    int parent = curr/2;
    size++; //we added an element, so the size of our data set is larger

    heap[curr] = e; //put value at end of array

    //bubble up
    int temp = curr;

    while (temp > 1 && ((Comparable<T>) heap[temp]).compareTo(heap[parent]) < 0) { //if current element is less than the parent
        //integer division
        parent = temp/2;
        swap(temp, parent); //the swapping method should be correct, but I included it for clarification
        temp = parent; //just moves the index value to follow the element we added as it is bubbled up
    }

    curr++; //next element to be added will be after this one

}

public void swap(int a, int b){
    T temp = heap[a];
    heap[a] = heap[b];
    heap[b] = temp;
}

public T removeMin() {

    //root is always min
    T min = heap[1];

    //keep sure array not empty, or else size will go negative
    if (size > 0)
        size--;

    //put last element as root
    heap[1] = heap[last];
    heap[last] = null;

    //keep sure array not empty, or else last will not be an index
    if (last > 0)
        last--;

    //set for starting at root
    int right = 3;
    int left = 2;
    int curr = 1;
    int smaller = 0;

    //fix heap, heapify down
    while(left < size && right < size){ //we are in array bounds

        if (heap[left] != null && heap[right] != null){ //so no null pointer exceptions
            if (((Comparable<T>)heap[left]).compareTo(heap[right]) < 0) //left is smaller
                smaller = left;
            else if (((Comparable<T>)heap[left]).compareTo(heap[right]) > 0) //right is smaller
                smaller = right;
            else //they are equal
                smaller = left;
        }
        if (heap[left] == null || heap[right] == null)//one child is null
        {
            if (heap[left] == null && heap[right] == null)//both null, stop
                break;
            if (heap[left] == null)//right is not null
                smaller = right;
            else //left is not null
                smaller = left;
        }

        if (((Comparable<T>)heap[curr]).compareTo(heap[smaller]) > 0)//compare smaller or only child
        {
            swap(curr,smaller); //swap with child
            curr = smaller; //so loop can check new children for new placement
        }
        else //if in order, stop
            break;

        right = 2*curr + 1; //set new children
        left = 2*curr;
    }

    return min; //return root
}

Any variables not declared in the methods are global, and I know a couple of things are probably redundant, like the whole current/last/temp situation in add, so I'm sorry about that. I tried to make all names self explanatory and explain all the checks I did in removeMin. Any help would be insanely appreciated, I've gotten as far as I can looking things up and debugging. I think I'm just fundamentally missing something here.
Comment: Are you using an IDE so that you can debug your code?
Comment: Yes, I'm using eclipse, so I can debug. I also have been using GraphViz to display the heap as a tree-like structure. I'm honestly not the best at using debuggers and usually have more luck with print statements, so I might be missing things due to that ineptitude.
Answer: Just to help you debug, you should simplify the code. There is something strange going on with 'last' variable. Also in 'insert' when you do the loop, probably temp should go to 0, that is
while (temp >= 0 &&......


Is the Canon 600D Al servo autofocus up to the task of following moving subjects?

Question: Has anyone tried shooting fast moving subjects (birds, cars, running animals) with Canon EOS 600D using Al servo autofocus? I am thinking of getting this DSLR but the internet reviews are a bit confusing on this point: that the 9 points AF (center cross-type) is not up to the task. What are the facts?
Answer: These two shots were taken with a 500D using the AI servo, which should be quite similar to the 600D. So it is certainly doable.
http://www.flickr.com/photos/stroiman/6667480875/in/photostream
http://www.flickr.com/photos/stroiman/6667480109/in/photostream/
Bear in mind that these were shot with a good quality lens with ultrasonic motor. I could imagine that a lens that is fast to focus is at an advantage in these types of scenarios.
However, these two were the best two out of perhaps 200 shots. But that is mostly because I shot with a relatively slow shutter speed in order to get the impression of speed. This is just difficult and requires practice. Had I shot with a much faster shutter speed I am sure that a lot lot more would come out sharp (but not as interesting). But tracking the subject is also very difficult, particularly with only one focus point. The 7D has a much more advanced focusing system where you can select a cluster of focus points to use for tracking the subject, but I have not yet tried shooting this type of subject with the 7D.
To sum it up, if your main concern is shooting moving subjects, this might not be the right camera for you. The 7D would be a lot more suited, but of course it comes with a much higher price tag. Perhaps some of the other brands have cameras better suited for this task at a lower price, but I'm mostly just familiar with the Canon products.
If you on the other hand are going to shoot lot of different types of pictures, and occasionally are going to shoot moving subjects, then I think that this is a great entry level dSLR for you.
Comment: Nice shots! I think the main thing to remember is that the 600D is not a professional grade AF solution, but in its own right you certainly can get great shots.
Comment: The 7D really does well with moving subjects, for its price. It offers a variety of options as well, such as zone AF. Instead of just having the center point, and without needing to activate all points, you can track within a certain area around the center, either edge, top, or bottom. Thats handy, as it lets you track and compose, and not be stuck always composing in the center. You also have orientation-linked AF settings, so if you prefer to use a different AF point/expansion/zone for horizontal than vertical, the camera will switch automatically for you when you change orientation.
Answer: Yes, it will just get confused easier than a camera with a more advanced autofocus system. If the subject is moving in a relatively straight line with few obstructions you shouldn't have any problem. Add more complex movement and it may not keep up as well.
As another poster stated, the focus motor on the lens itself also plays a big part.
Answer: Usually, when one shoots a fast moving thing (race cars, or the bikes in @Pete's links) you pan the camera and try to have the subject be moving parallel to the camera. When the subject is coming straight at you, its much harder to get the focus right.
Proper panning takes practice, but can give wonderful results.
When it doubt, rent the camera/lens and try it yourself.


Is it possible to measure the working memory of a non-human animal?

Question: Is it possible to measure the working memory of a non-human animal? And if so, have there been any studies that have quantified the working memory of animals, and that have compared that to the working memory of humans? Or are the two not comparable?
Comment: Patricia Goldman-Rakic studied the role of the prefrontal cortex in working memory in a series of classical studies in non-human primates. http://www.ncbi.nlm.nih.gov/pmc/articles/PMC261878/
Comment: If an animal responds to verbal commands, you can spell out the command phonetically, similar to the way we spell out words like d-o-c-t-o-r to keep the kids from having an adverse reaction to hearing the word "doctor". But that's a literal spelling and I'm suggesting to do a phonetic spelling like duh-ah-ck-tuh-ur. If the animal strings together the syllables then it has a working memory. Try it with roll-over or something...ruh-oh-luh oh-vuh-ur.
Answer: Sure. For example, working memory can be assessed using the delayed match to sample task. Here are examples from monkeys, rats, pigeons, and bees.
The problem with comparing them is that the actual stimuli used for each species are different (e.g. odors for bees, shapes for monkeys) and this is known to affect the results.
In humans, if you run similar tasks, just with small verses large sets of possible stimuli, for example digits verses general words, you can get very different results. Even if you did try to use the same stimuli set, the result will probably not be "subjectively" equal to that of a different species. Think of yourself trying to do the odor task of the bees; it's not a fair game.
Other seemingly small changes in the paradigm can also affect the results, for example a delay between the trials, etc. So the only way to seriously compare them would be to conduct the same experiment, by the same lab, of different species. I personally don't know of any research that was directly aimed at comparing them. Maybe someone using (lesioned) animals as a model for dementia would know more.
Answer: Sure, visual working memory capacity has been assessed in humans, chimps and mac using a change-detection tasks and trail-making tasks.
For example, the chimp Ayumu at Kyoto University easily outperforms all humans on a simple number sequencing task. In the task, the numbers 1-n appear briefly on the screen in random positions and then the numbers must be touched by the participant in numerical order. Ayumu can sequence more than nine digits in less than 200 ms, according to the 2007 paper. In contrast, human performance was at chance levels at that exposure duration.
In another visual working memory task, the change-detection task, colored shapes appear on the sample screen, disappear for some brief amount of time (typically about a second) and then reappear. 50% of the time all the squares are the same, 50% of the time one square has changed. The subject indicates if a the test screen matches the sample screen. This a delayed-match-to-sample task. To measure memory capacity, the sample and test array sizes are increased, 2,4,8, etc.  Humans and rhesus perform equivalently on this task, in that both species are able to perform at or above 80% correct for array sizes of about 3~4 items.
earl miller study
io9 published a pop-sci discussion of the chimp study, "This chimp will kick your ass at memory games — but how the hell does he do it?", and links to a flash game by Lumosity Games that replicates the original study.
Answer: When classes come visit the Duke Canine Cognition Center, we ask them how they would test the memory of their pet. The kids come up with a solution pretty similar to how its done. One kid put down 5 different cups, showed the dog a treat, and placed it under one of the cups. Then the dog was either distracted, or simply restricted from approaching the cups, for a fixed amount of time. The dogs are very eager to retrieve the treat, and will often just stare at the cup until the time has elapsed, so in another version we shield the cups with a giant occluding board so the dog must keep an internal representation. This task is no problem for many dogs. We do 20 second, 40 second, and then 60 second trials with only 3 cups, and there is a lot of variability in success.
Comment: Could you cite some of the publications that have come out of this?  I think they will come in handy for future readers.


Is it true that pricing an IR swap doesn't require any stochastic model but calculation of the PFE of an IR swap would?

Question:
Pricing an IR swap doesn't require any stochastic model but calculation of the PFE for an IR swap would require the Hull White Model or any other stochastic short rate or forward rate model.

Is this statement correct and if so, why?
Answer: A swap does not require a model because its price can be derived from the yield curve without any assumptions about how the yield curve may move in the future.
The PFE however is an indication of by how much the swap's mark-to-market may move between now and a moment in the future. It is of course influenced by how volatile rates are. The more volatile rates are, the higher the PFE.
It's a bit like saying that the price of a portfolio of stocks does not require models, but the VaR does.
Answer: Fully support the prior comment.
Swaps can basically be priced off the current Yield curve in an arbitrage free manner.
The PFE as the name "potential" future exposure suggests refers to a value something (i.e. the swap) could potentially realize. Hence one needs to decide upon a simulation method to derive this potential value.
The PFE as a measure of future (mark-to-market) credit exposure is often also referred to as the "Upside VaR", which is another hint in that direction, since VaR methods are usually also parametric (in the sense that price/value changes are assumed to follow certain distributions) or simulation based.
Cheers.
Comment: Hi WD, welcome to quant.SE and thanks for posting an answer. However, if this answer doesn't get as many up-votes, please realize that generally a follow-up answer is expected to add some significant information relative to existing answers.


How do I get feedback about whether escape analysis had any affect on my code or not?

Question: One problem I have with compiler optimization is, that I actually never know what the compiler (or in this particular case the Jit) does with my code. So is there any possibility for me to know whether a particular compiler optimization took place or not? I just want to be sure about that some objects (math vectors) are created on the stack and not on the heap.
Answer: See related Q&A here which suggests you can download a debug JDK and use command line options:
-XX:+UnlockDiagnosticVMOptions -XX:+PrintEscapeAnalysis -XX:+PrintEliminateAllocations
to print out the escape analysis events as they happen.
Comment: Any idea where to find a debug JDK for java 8?
Answer: The short answer is that you cannot.
Whether or not your vectors are created on a stack or on the heap is not determined by JIT, it is a property of the JVM that is running your application.
The JVM specification has sections describing the stacks and the heap. The section on stacks says

Because the Java virtual machine stack is never manipulated directly
  except to push and pop frames, frames may be heap allocated.
Answer: With a traditional compiler you can usually look at the assembly language it emits and determine whether or not certain optimizations have taken place (not entirely, as multiple optimizations may wind up producing the same code, but what you're looking for is the effect, not the cause).  For JITs, not so much, unless you've got a "chatty" one that emits a log or trace message when it performs its optimizations.  I know that with some JVMs you can see whether specific methods have been JITted, but not when or why (although often the criteria the JIT uses are documented).


How can I query and categorize a shapefile using MS Access?

Question: Is there a way to categorize locations by lat-long in MS Access using caparisons to shapefiles?
Comment: Could you please flesh out your problem a bit more?
Answer: MS Access is not able to do spatial operations, at least not in the way those used to using OGR standard spatial databases may be familiar with.
Functions such as ST_Within, ST_Intersects and the dedicated geometry types simply don't exist.
Now, that's not to say that you can't work with co-ordinate values, but you'll have to treat them as normal decimal / float number types, and represent them in the appropriate column type for the operations your trying to perform.
Once you do this, you can work with the value as you would any other standard data type and add / insert and perform mathematical operations on it.
You won't however be able to do geographic comparisons unless you:
A) as the previous response states, export from MS-Access to the shape file you wish to use and use a GIS package.
or
B) Export your shape data into a more universal format in MS-Access then be prepared to do a huge amount of comparison's.  Now this may not be as big a job as you may think if all your shape-file polygons are rectangular, because at most you'll need 4 points for each area, and some simple "If greater than one boundary and less than the other" where statements.
now as I write this, I can think of 2 alternatives, but you'll need to be prepared to put a bit of research and work into them, there not instant solutions.
Idea 1
Use 'Geo Kettle' - geo-kettle is a geographic aware ETL & Data manipulation tool.  You write scripts using the drag and drop interface, then link these scripts together to process your data.
The application can load MS-Access files and shape files, then run processing on them as though it was one file, outputting the result in many different ways.
Idea 2
Using one of the many open source SDK's to read your shape file, and then either .NET or (if non windows - mono) to open the MS-Access file using standard data handling, you should be able to quickly put together a small application that can easily perform the operations you need to.
Answer: In the absence of any further information, try converting you MS Access points to a point shapefile and the do a spatial join.
Answer: try google fusion, it will help to load your lat.long and convert it to addresses.  Based on the address city/zip code, you can categorize the data based on locations.


How long does it take to play Le Havre with different numbers of players?

Question: BoardGameGeek says Le Havre takes about 150 minutes, but I'm curious if the time varies with the number of players as it does in Puerto Rico and Agricola. Approximately how long does it take to play Le Havre with 2, 3, 4, and 5 people?
Answer: The rules say this (for the long version.  I don't play the short version and don't know anyone who does).
<code>Players   Minutes(Rules)    My estimates
1           60               Depends on YOU (30-300)
2          120                 90
3          180                135
4          200                180
5          210                225
</code>
I've played about 20 games with at least a sampling of all player sizes.  I don't think Solo is worth considering time-wise.  You'll spend however much time you want, nobody will be uncomfortably shifting in their chairs or humming the Jeopardy theme song to hurry you up.
From experience I can tell you that a 2 person game runs 90 minutes if you are both fairly familiar with the game and have a good setup procedure.  If, when you last played you dumped all the components in the box without organizing them, add an extra 30 minutes...
Each player after that is going to add a fairly static amount.  Perhaps 45 minutes.
This assume mythical standard players of course!  :)  If anything Le Havre is going to bring out the worst in the players that like to know they are making the right move by calculating out as many possibilities as they can.
Each additional player is going to add a good amount of time to the game.  Le Havre is also difficult to plan ahead.  Your options can really shift depending on what the other players do.  Unlike say, Agricola, where you may know on certain turns what you have to do (like acquire food) or Puerto Rico (time to SHIP!), Le Havre doesn't really have forcing actions.  There are always options.
The player right in front of you can easily open up options by buying a building unexpectedly, or moving off of a crucial building.  They can also screw you up by sitting on a needed building for a third dang turn!  I find that these sorts of things happen quite often which doesn't reward folks for thinking ahead (at least in terms of reducing the time it takes to play the game).  It's likely that folks with more experience than me will see more gains here.
Comment: *Humming* the Jeopardy song? I pull it up on m.YouTube :)
Comment: @TheChaz - Linked up my reference.  Some folks I know have been known to do this :)
Answer: It's 30-60 minutes for player, very much like Agricola. This is in the Wikipedia article, but I think it says it on the box too. The rules (zipped pdf from the publisher) have a time/rounds per player table with the conservative estimate (60 minutes per player) for the full game, along with a ~30 minutes per player estimate for the shortened version (20, 45, 120, 130, 150 minutes).


Java web app, with plugin framework and ability to connect to source for updates

Question: I've searched all around for some good sources, but either have been searching for the wrong keywords, or I'm just missing something. I'm looking to redevelop a web app I've been using for some time now. Many parts are out of date, and we're constantly throwing in little hacks to attempt to give it new life.
So what I'd like to do is re-engineer it from the ground up, built on some sort of plug-in framework. Before I continue, I'm more or less an intermediate Java programmer. In some ways, I'm hoping to use this project as a big learning experience.
I've read a lot about OSGi, and it seems that's the most complete framework. Ideally, I would like an end result web app which I can run one instance as my hosting environment, and other instances can connect to it to grab new and updated plug-ins. Eventually I'll want to lock down these plug-ins based on some undecided criteria of who can get them (basically some will simply be updates, others will provide new functionality and should be "purchased" through an external system). But that will probably be handled in a later phase. There should be an administration view for managing bundles in a hot environment (looking to avoid having to restart the server for an update).
I know all these things are possible, I'm just trying to find some good resources for reference. All the OSGi tutorials I'm finding seem to be too simplistic. If anyone here can guide me in the right direction on any or all of the items I'm looking for, it would be much appreciated. Also, this is my first post, so I'll take any comments/criticisms about the content of my post. Thanks!
Comment: Hi my friend! This fits best on programmers.se - http://programmers.stackexchange.com/ ! p.se
Answer: General advice: try to do simple things first.
See how it works, how far this framework is from what you need. Evaluate time. Try different.
http://www.eclipse.org/gemini/ seems to be starting point. But it seems not so active.


Design has same structure but different inner design to an existing patent. Can I apply for patent for my design?

Question: I came to an design that has same structure to this one(US7717717 B1). That patent claimed the inner thin plastic piece with conductive traces.
My design also has same structure with the inner plastic piece, but the traces on it are designed differently and my design has additional ICs for faster speed.
Can I apply for patent without infringement?
Answer: First off, infringement refers to use of an earlier patent by a later product.  So no infringement occurs through your applying for a patent or even getting the patent.
Secondly, your product might infringe an earlier patent regardless of whether you have a patent or not.  This can happen when your patent claim is a subset of an earlier patent claim - that is, earlier claim included elements A and B, and your patent claims A+B+C - presumably an improvement!  In this case, any product (even yours!) having all elements A, B, C will infringe both patents.
Now as to your question, for your patent application you will want to find some feature T2 (hopefully your differently designed traces) that are not disclosed anywhere in the earlier patent - not in the claims, not in the written description - and put this feature T2 in your claims.  Be aware that there could be some other design for the traces - let's call it T3 - that would also work - in which case a new competitor could easily design a product with T3 that would not infringe a claim written just for T2.  Then it gets to a question whether you can assert that the product using T3 is equivalent to your invention - if it gets to court that could go either way.  Anyway, in your patent application try to cover as much ground as you can without overlapping the other patent.
Finally, keep in mind that even if your claims with T2 are different from anything disclosed in the earlier patent, the PTO may still reject your applications because (a) it would be an obvious modification, or (b) your T2 traces are used in some other prior art and would be obvious to try.  For this, try to add more features and description in your application, so you can have a fallback position to narrow your claims to something the PTO will agree to allow.  Keep in mind that the narrower the claim, the less valuable it is.  Also, the broader the claim, the easier it is to be invalidated by prior art.
Probably a longer reply than you need or want.  Hope it helps.  Good luck!


Is it possible to organize a web site based on roles for anonymous users?

Question: In my development team we're gotten a question from our stakeholders to make a navigation based on user roles (Students, Teachers, Course Administrators). I feel that is quite complicated of a task, and you never know which role the anonymous user has. If a user is logged in, it's easy - but for an anonymous user what's the best suggestion?
Answer: With anonymous users there is nothing you can do, except provide a way for them to chose whatever role the want to assume. So split the content of the site in three distinct sections and tailor it to each role's needs.
Comment: But you can always look at the site's role proportion and if the difference between one role and the others is significant, you can assume that as a default role (with limited functionality) to anonymous users with the features required to switch profiles easily if required (again, with limited functionality) until logged on.
Comment: @edgarator: yes, that would be a nice addition.
Answer: Well, what's the not-logged-in user most likely to be? For your specific use case it seems the obvious answer would be students.
Any activity that requires logging in or any form of authentication of course shouldn't be part of the logged-out view (alternately, attempting to initiate such an action would force a log in prompt). Depending on the system it's quite likely that Teachers have a special and more complicated UI, and some features teachers get shouldn't be allowed for students or anonymous users.
Anonymous users should be given whatever role has the least permissions and is the most common. This might be it's own role or it might be a read-only version of the lowest-permission logged-in account.
Giving them a way to chose whatever role sounds great in theory, but in reality a lot of those Administrator functions probably aren't/shouldn't be accessible from anonymous users. Important, high-privileged roles almost exclusively require logins, so why would anonymous users be able to see those navigation options?
Answer: I am looking at a similar problem currently. It's always dangerous to assume so I would agree with others here that it is important to provide an easy way for this anonymous user to personalise or chose whatever is important to them. I found http://www.visitcornwall.com/ (customise your visit) to be a good example.
Very different in audience but the principle could work for you. Visit cornwall is a tourist board website when all sorts of people can find info on where to go/things to do/where to stay etc and so users could be everything from single dog walkers to full families looking for a day out or a place to stay.
When the user is on the the website at the very top right of the webpage is a pink box titled 'Customize your visit' and once clicked the user is served the following options in a simple and pleasing visual style:

Who (Adult/Adults with children)
Where (listing the regions of Cornwall in map form)
When (listing the seasons)
Other considerations (Disabilities/Dog walking)

Using these selections the most appropriate content is then served to the user once they click through to their desired subject (whats on/things to do/where to stay etc).
So in this instance you could look at using a similar selection tool so the user could indicate they are a 'Student' who is a 'First year' looking for 'Exam' information for example which could then influence your navigation and what content you serve.
The downside in this is that it needs the user to be willing to interact.
Comment: That link might be a good example but you've not really explained how it works and whether or not it is suitable for this situation. Can you explain how this site works in the context of this question and describe why it is appropriate? We need answers to explicitly answer the question, whereas your post is more of a 'I've found a link that might be useful' which means that if the link goes down or changes then your answer would not be of any use, but if you can describe the situation then you would have provided a useful answer in its own right.


Where can I find web hosting reviews?

Question: I'm trying to choose a new hosting service for a WordPress blog, I've stumbled upon several services and most of them look good, so I was trying to find reviews from current user to see what they have to say, is there any website where I can find people's thoughts on the different web hosting companies / services?.
Answer: I personally wouldn't bother with any of the hosting review sites. Instead ask friends and peers which services they use and if they are any good. Also checkout the userbase and the community at the host you are considering as they will give you a good indication of whether the host is of good quality or not.
Answer: A good place to start would be Web Hosting talk forums http://www.webhostingtalk.com/ Also Host Search http://www.hostsearch.com/

Where can I find web hosting reviews?


How would I go about making an outdoor environment in dungeons and dragons?

Question: How would I go about making an outdoor environment in dungeons and dragons? I would like to know what the rooms and hallways would be. I would really appreciate it if someone would help me. I'm really interested in making a forest.
Answer: Go wander outside your house or apartment or whatever and look for a wooded area.  Write down a description of it. You've created an environment, then when you read that to your players, they are in it.
Does it have corridors or rooms?  No.  It might have paths, and clearings that might make good places to have something happen, but the outdoors largely lack the constraints of a dungeon environment.
Do you need a large scale map? If you do, You could map a wilderness area and place some encounters. The first edition DMG has a method for randomly generating type of terrain in each map hex. Consider reading it, or running one of the old 1e adventures to get an idea of how the game works in the wilderness. Or use a real wilderness map from a local national park (or from Google).
Do you need a tactical map?  Because often you don't, you know, the description and your players' imagination is more than sufficient.  You can make maps of such areas easily, here, check out this random wilderness map generator.
(Note that this question is tagged 2e, so the 4e/late 3.5e concerns about having tactical maps for everything are not very relevant - in 2e we used minis and tac-maps pretty rarely.)
Answer: First off, I'd strongly suggest you read through the Dungeon Masters Guide (DMG). Here's a bit of specific guidance for your question.
When building an adventure locale for a game of D&D, you have to remember that this is a place in your world. A collection of corridors and rooms in one sort of place you could imagine for your players to explore. Imagine others. What is is like to walk through a forest? What sort of places might they run into? Where do the paths run, what is there to find where paths cross, what is there off in the forest if the players leave the path? What sort of noises, sights, and discoveries will they notice, and which ones will make them say, "We go investigate closer!"
This is what making a wilderness adventure is about. Create interesting places, usually using a map to help you keep straight where everything is in relation to other stuff, and ask your players what they do. Describe what they're near, and find out what they do next. Creating a wilderness area is a creative exercise, and isn't just a matter of snapping together a few corridors and rooms with some monsters in it—you're creating a place that, hopefully, your players can believe in. You might find the answers to this RPG.SE question about how to start creating a setting for your game to be useful.
Especially in a wilderness, using a random encounter table (also called "wandering monster" tables) will help you decide what happens next when the players wander into a blank area of your forest map. The Monster Manual (AD&D 1st ed) and Monstrous Manual or Monstrous Compendium (AD&D 2nd ed) contains random encounter tables. The Dungeon Master's Guide has guidance on how often and how to roll for random encounters (p. 174 in the 1st edition; p. 96 in 2nd edition).
Answer: For a particular encounter outside in a forest, I just scatter trees and try to make interesting tactical locations that the monsters can use to their advantage.
When you are building an adventure, you can build it like a dungeon, even in a forest. Consider a dungeon as just a series of encounters that you can reach by traveling through passages. The same thing can happen in a forest. Don't map out the whole forest. Just describe travel through it. Think of the "dungeon" as just a series of decisions that the party can make. These decisions lead to the various encounters, just like a hallway in a dungeon leads to a room with monsters in it.
When the party hits an encounter location, then you pull out a map, arrange the party and monsters on it, and have at it.
As an example, the party may find a caravan that has been ransacked by bandits. They know that the caravan came from the north, and the bandits are rumored to be living deeper in the eastern forest. So they have a choice here (I made it directional, but it needn't be). It's like going forward or to the right in a dungeon. Either choice can lead to an encounter, just like in your dungeon.
Answer: I recommend using mind maps to design your outdoor environment.  Unlike a dungeon, the rooms are not connected by hallways and doors.  The party may need to travel a mile down a path to get from one area to another.  You can categorize your environment into rooms, doors, in-betweens, and landmarks.
Rooms
Rooms are the main areas where events take place in your adventure.  A room might be a forest clearing, a river crossing, or a fallen tree for example.  They are connected by doors.  The players take paths to get from one room to another.
Write down the name of each room and draw a circle around each.  You should place them in relation to each other, so that a room to the north is higher on the paper than a room to the south.  It doesn't need to be exact.
Write a description for each room so that every time the PCs come back to it, you can read the same description to them.  The description should include obstacles in directions you don't want the group to travel, for example a cliff or tangles of thorny vines that make travel difficult.
Doors
Doors are placed on the mind map by drawing lines between rooms to connect them.  A door may be a road, hunting trail, or a river.  When the party goes through a door, essentially they are exiting the room and traveling down the path to the next room.  Each door should have a quick description including how long it takes to travel, and what type of terrain it is.
In-betweens
Outdoor environments are obviously less restrictive than indoor.  The party may decide to go over the obstacles you place, and enter territory that isn't a room on your map.  To handle this, you create in-betweens.  In-betweens are just like rooms, except they aren't placed on the map ahead of time.  When the group travels through an obstacle to an area that isn't on your map, you grab one of your in-betweens, to use as the room they enter.  You should draw up a handful of in-betweens for the different types of areas they may encounter.  For example, you could make an in-between called "large tree" and drop it into any forest location between rooms.  When your group discovers it, mark it on the map and draw a line representing the door connecting it to the room they came from.
Landmarks
Landmarks can be seen from almost anywhere in the wilderness, like mountains off in the distance.  These should always be in the same direction, and will give your players a sense of direction in the wilderness.
For more information, check out this great article
Answer: The way it normally works is like this.  A path in the forest, is your 'hallway'. The Trees, becomes pillars, and many trees grouped together extremely tightly could become 'walls'. Very often, there will be a glade of some sort, which is the right spot for a camp site or just a 'room' to have an encounter in.
This is assuming that you are trying to convert an underground dungeon into forest. Obviously, you want to give your players as much freedom as possible, but mechanically, this is how you can do the conversion.
Comment: Be careful trying to put actual walls in a forest. A forest naturally lends itself to wandering. Paths may suggest directions, but be ready for the characters to go off in the weeds if you give them a big wilderness map. Dense trees making a "wall" on one side and glass-smooth cliffs on the other side will make the players feel railroaded.
Comment: @GMNoob having spent some time in a forest it's more likely that any tight areas should be treated as difficult terrain, not walls.  Even areas that are effectively impassible would still allow line of effect, if not line of sight.
Comment: C.Ross, I think it can go both ways. It depends on what sort of environment the DM is trying to provide. I've played many games where the DM declared a section of the forest impenetrable without first burning it all down, and we felt fine about it.
Answer: Depending on how you define "dungeon", I'd suggest a village or town which has various encounters in/around the houses.  You would have to control access to this town, so maybe put it on a small island, but then you would have to explain WHY the island is cut off from the shore.
Answer: It isn't clear to me if you are approaching this from a tactical (miniatures, etc) perspective or from a story / scenario perspective.
Lets say you are building an elven forest, one where the native elves do everything in the forest. Make a list of their needs for day to day living, ie homes, food sources, recreation, defense, and the like.
Also, ask yourself a few questions like...
-why did they settle here?
-how integrated is magic in their lives?
-what other territories does it brush up against?
Now consider what could happen if they have lived their hundreds of years, how they could scuplt the terrain, modify streams and rivers, plant/replant/transplant plants, leverage native or imported wildlife, etc.
What might be a system of rooms or corridors in a dungeon become regions of the forest, yet, these are wall-less regions and so need appropriate, protective barriers.


variation in antigen binding site of antibodies

Question: Antibodies or immunoglobulins are proteins made by the immune system in response to alien(!) molecules. Each antibody binds to its specific antigen. This great diversity and specificity is cause of diversity in Antigen Binding Site of heavy chain and light chain of antibody. Although other sections of Antibody are highly stable, Binding sites are very mutant. What is the reason for this difference in mutation rates in different parts of antibodies?
Answer: The processes are called gene rearrangement and somatic hypermutation, and are used by maturing B-cells to generate very (very) large amounts of diversity in the antibody repertoire. If your institution has access, this great article in Annual Reviews in Immunology has all the details, or you can read about it in Janeway (slightly outdated edition). Essentially, the genes encoding the B-cell Receptor, or BCR, have many fragments of several different types in them, and through the process of gene rearrangement the final Complementarity Determining Regions, or CDRs (the antigen-binding sites), are generated into one mature sequence for each individual B-cell.
A mature IgG molecule (the soluble, secreted version of the BCR) contains four chains - 2 heavy (each of which are identical to each other) and 2 light (also identical). There are Constant or C regions in each chain that essentially don't vary much, and are not really involved in the process of antigen binding. On the "business end" are three regions (or types, from above) called V, D, and J in the heavy chain, while the light chain just has V and J. Those letters are from Variable, Diversity, and Joining, if you're interested.

Figure 4.3 from Janeway shows the number of "fragments" or gene segments of each type in humans. So, when the heavy chain is being made, 1 fragment out of 65 Vs is picked, 1 of 27 Ds, and one of 6 Js, then each is joined together in a process that can also introduce an additional amount of randomness at the joins. Combine this with an only slightly less complex process in the light chain (as there is no D region), and the fact that a single insertion/deletion of a base pair can drastically effect the resulting protein sequence, and you get a protein with a huge number of possible sequences, potentially in the range of 1011.
This process of gene rearrangement typically generates immunoglobulins with relatively low affinity for their antigens. During affinity maturation, a process called somatic hypermutation randomly changes individual base pairs (translated to amino acids) in the CDR in cells that are descendents of, and bear the same base sequence as, the original. Cells expressing antigen receptors that are of higher affinity are then positively selected and clonally expanded by the immune system, allowing your body to tailor its response to an infection or other exposure to what it sees as foreign material.
Comment: I don't understand what this is referring to: "the vagaries of possible frame-shifting during transcription".
Comment: @AlanBoyd - I'll edit that. I was referring to the fact that an insertion or deletion of a single base pair can change the frame in which the downstream codons are interpreted, leading to (potentially) very different protein sequences.
Answer: Antibody molecules or immunoglobulins (Ig) consist of heavy and light chains (e.g. two of each in IgG). Both heavy and light chains have variable domains at their N termini.
During development of the immune system the pro-B cells in the bone marrow undergo gene segment rearrangements, bringing V and J segments together for Ig light chain production, and V,D and J segments together for Ig heavy chain production. The V gene segments encode the variable domains at the N-terminus of light and heavy chains. There are a few tens of V gene segments in our genome - this is the first source of variability.
The second source of variability is the "sloppy joining" of the V (D) and J segments. This results in frame shifts together with short deletions and insertions. This V(D)J junction corresponds to the third hypervariable region of the variable domain.
Each immature B cell displays its antibody at the cell surface as a membrane-bound form of IgM. If an antigen binds to this antibody the cell is stimulated to divide (clonal selection). During the proliferation of the immature B cell it undergoes somatic mutation due to error-prone replication of the Ig loci. This allows for the production of Ig variants with improved binding affinities which are in turn stimulated to proliferate more rapidly, eventually maturing into antibody-producing plasma cells. This somatic mutation is the the third source of variability in the variable domains of Ig molecules.
See any immunology textbook for details and diagrams.


Setting up ableton live as a live looper?

Question: I have seen that it is possible to set up Ableton to work as a live looper
How is it done?
Answer: I find that the best way to do it is with some kind of foot pedal switch, like the FC-50. By mapping Start, stop, undo, delete and next track to your foot switches, you can easily perform your loop in realtime, get it right, and then advance to the next scene or track when you want to record the next variation.
Looper is great for looping live audio, but is a little redundant for recording MIDI loops in realtime - since the built-in ableton live controls are a little more flexible. The challenge for me has always been seamlessly looping, overdubbing, and riffing in real-time and since I'm a keyboardist using both hands, the footpedal was the only way to go.
I just looked at the Kid Beyond video and I don't think he's using Looper - it looks like he's arming a series of different tracks, all of which he's routed his mic input to. He's got a 1-bar control sync on so he doesn't have to be 100% precise with his foot pedal punch-in/punch-out. It looks like he just has each pedal keyed to the record / play button for the same scene across different tracks. This is why he has to pause for a bar after each recording before arming the next track. At the end of the day - whatever works for you right?
Comment: IN case you go the FC-50 route, [this post](http://www.tomauger.com/setting-up-a-boss-fc-50-to-trigger-ableton-live) tells you how to set it up in Ableton
Answer: You might get on track by looking into the Realtime Looping Essential Config or Live Looping Tutorial.
Answer: Ignoring the basics and MIDI mapping for a moment; my setup for Looper in Live 8 is a bit more advanced, but very effective if you wanna get the most out of Ableton's loopers:
<code>Setup Looper in an aux channel
Set Input -> Output to Never
Any track you want to go to the looper, just turn up the aux send
</code>
This way you can send any of your tracks to the looper channel through the aux send. Which is a great way use one looper for all your sounds.
In the following example, you've got a basic one-loop setup for a microphone. Easy. Just map a key or a MIDI controller to the Multi-Button and you're looping like a king.

For a more advanced looper setup, you can group a chain of loopers together for setting up layers, which can be cut in and out by using key mappings on each Mute button in the group.

Then just add whatever sounds you wanna play with in your looper, map a button to the corresponding Arm buttons, and goof off with your killer loop setup.
Answer: Ableton's clips are useful as a live looping tool but if you want something more like a traditional guitar looping pedal, check out the Ableton Looper effect in Live 8.
Answer: I recommend sooperlooper.  You can set it up as a plug-in with live.
http://sonosaurus.com/sooperlooper/
Here's a sooperlooper forum thread about live and SL
http://sonosaurus.com/slforum/viewtopic.php?f=10&t=23&p=551&hilit=kevtrout&sid=fe4ca98e7ac8f25b219b4b9c10fe5360#p551
Answer: Just some clarifications:
How to do it depends on what version of Ableton you're using; more specifically if it includes the "Looper" effect from Ableton. I'm not sure if it was in 7 or not, but def. included in 8+
The Kid Beyond video is mentioned above- he most assuredly was not using looper as the video was made before Ableton HAD looper and is much of the reason they MADE looper.
The way Kid Beyond does it is utilizing another program called Bome's Midi Translator Pro (Midi OX is a similar prog, but Bome's is rather unique) which is kind-of like a virtual midi patch bay but FAR more. Ableton used to link to a tutorial on how to do it (how often do you see Ableton referencing any third-party software?) but they went ahead and made Looper which does some CRAZY stuff the Kid Beyond way couldn't (without Max, at least :) ) so they likely don't have the link anymore. However, Bome's site has an tut @
http://www.bome.com/forums/viewtopic.php?t=1583
While Looper does stuff the old way can't, so too are there things one can do with Bome's that Looper just can't, too. They each have their advantages but basically USING LOOPER IS WAY EASIER than setting up Bome's. (One should hope so, right?) Hope this helps.


Approximately what proportion of a stock's volatility is explained by market movement?

Question: Assume we decompose the daily (log) returns of a stock as beta times market movement plus an idiosyncratic part. If this is done ex-ante, what proportion of the variance is explained by the market component vs. the idiosyncratic part? I am looking more for rule of thumb/experience of others, based on, say, U.S. equities in the S&P 1500. Another way of putting this is "what is the (average/rule of thumb/expected/garden-variety) Pearson correlation coefficient between the return of a stock and the return of the market?"
Comment: Do you have access to any commercial equity factor model? I am asking because single-factor models underperform multi-factor models, and very few people care about market-premium only, except maybe investment bankers.
Answer: I just want to give a qualitative assessment to your question:
Volatility of a market is different than the volatility of a stock. Similarly like Copeland and Antikarov (2001) say that "...the volatility of a gold mine is different than the volatility of a gold..."
If you want to quantitatively compute the percentage of a stock's volatility affected by market's volatility, then I would do back calculation using options formula.
Answer: So my first answer was off base. For some reason I was thinking first moment (idiosyncratic returns), but he's looking for second moment (idiosyncratic volatility). There is a line of research on the returns to portfolios sorted on idiosyncratic volatility and I was hoping that there were descriptive statistics that said "fraction $\rho$ of stock/portfolio vol is market and $1 - \rho$ of stock/portfolio vol is idiosyncratic". But I couldn't find any stats. So I guess you have to run your own models and find out.
If you're thinking about implementing this, I would check out the literature. It may save you some time. Ang, Hodrick, Xing, and Zhang (Journal of Finance 2006) say that high ivol has low returns. But Bali and Cakici (Journal of Finance and Quantitative Analysis 2008) show that their results are do to sorting techniques and that there's really no return (pos or neg) to high ivol.

I may be off base here. But in terms of econometrics, when you calculate beta, you've assumed that the idiosyncratic portion is white noise. So the idiosyncratic portion is mean zero and normally distributed so it accounts for none of the return. So the ratio of market:idiosyncratic is 1:0.
By definition the idiosyncratic return should be white noise. Maybe you want to add another risk factor to your model and find the projection of stock returns on that factor to find the split between the market and that other factor?
Comment: my question is about the decomposition of variance of the stock returns. If you think about CAPM as a linear regression, I am looking for the $R^2$.
Comment: @shabbychef -- I did. My bad. That's what I get for late night answering. I don't know of any numbers off the top of my head, but let me look at some papers...
Comment: not a problem. I think I was looking less for 'the answer' (which I can figure out from the data), but for what experts _believe_, with a given amount of uncertainty on that belief.
Answer: The term 'rule of thumb' is ambiguous here. Because I don't think there are any rule of thumb, you just need to do the number crunching.
However there are some stable characteristic through time linked to correlation.
For instance it is a common fact that the hierarchy of correlation within different market  is relatively stable. US equities are less correlated than Europe. pre-crisis it was around 40 for the us, and 60 for Europe I think. Obviously it shooted up after.
Answer: An Axioma research paper from August 2011, Using Multiple Risk Models for Superior
Portfolio Management… A Practice Not Just For Quants, answers exactly your question, I believe.  Note the graphs at the top of page 8.  They compare their medium-horizon fundamental and statistical factor models from January 2008 to January 2009.  At the start of the period, they find about 30% of active risk comes from common fundamental factors (as a % of variance), with the rest accounted for by stock-specific factors.  The corresponding figure for statistical factors is 40%.  During the 2008-2009 crisis, this figure rose to as high as 50% for fundamental factors and close to 70% for statistical factors.  Other research included in this paper suggests these numbers would have been even higher for their short-horizon risk models.  I would guess that common risk proportion decreased to levels similar to early 2008 more recently, and may even be lower than that over longer horizons.
I believe that over the last 3 years or so the $R^2$ of a regression of actual returns on model returns was in the low 30s % using the medium-horizon fundamental factor model, which generally agrees with their data and implies that common risk proportion continued to decline into 2009 and 2010.
Addendum: The previous research concerned the $R^2$ for daily returns, which was the essence of your question.  However, some additional research shows that the monthly $R^2$ is much higher, currently at around 60%, and has been trending higher for some time now. In 1995 the $R^2$ was consistently under 20%.  In 2000 it was 20-30%, occasionally increasing to over 40% during crisis periods.  Even during the relatively calm mid-2000s $R^2$ was consistently between 30% and 40%.
Many people today talk about there being a "correlation bubble" in equities, but considering how long these trends have gone on, I'd be surprised to find the $R^2$ drop to anywhere near the 1990s levels any time soon.  Henceforth I think we can rely on at least 40% (30%) of monthly (daily) returns being attributable to various broad factors, possibly much higher.
BTW, besides the overall market itself, the most significant factors are industry, size, momentum, and volatility.

Approximately what proportion of a stock’s volatility is explained by market movement?


Finding $a$ and $r$ such that $\lim\limits_{n\to \infty} n^r \cdot \frac12 \cdot \frac34 \cdots \frac{2n-1}{2n}=a$

Question: Find $a,r>0$ such that
$$\lim_{n\to \infty} n^r \cdot \frac12 \cdot \frac34 \cdots \frac{2n-1}{2n}=a$$
I don't have any idea to solve it. How can I solve it?
Comment: BTW: 1. please avoid `$$` in titles. 2. When writing a title, don't make it entirely in $\LaTeX$. Add some words!
Answer: Hints: (1) Write the product of rational numbers as a single rational number, using only powers of $2$ and factorials. (2) Use Stirling's formula to compute simple equivalents of the numerator and the denominator. The ratio of these should be your $an^{-r}$.
(To help you check your computations, I mention that $r=\frac12$.)
Answer: I'll start out from a celebre limit, namely Wallis product that states that:
$$ \frac{\pi}{2} = \frac{2}{1} \cdot \frac{2}{3} \cdot \frac{4}{3} \cdot \frac{4}{5} \cdot \frac{6}{5} \cdot \frac{6}{7} \cdot \frac{8}{7} \cdot \frac{8}{9} \cdot \cdot \cdot $$
Without loss of generality, we consider an even factors number of the limit excepting ${n^r}$, and then by applying Wallis product we get that:
$$ \lim_{n\to \infty}\frac{n^r}{\sqrt{2n+1}} \frac{\sqrt{2}}{\sqrt{\pi}}$$ that obviously gives us $L =\frac{1}{\sqrt{\pi}}$ for $r=\frac{1}{2}$
The proof is complete.
Answer: Here are the details of @did's answer. Write
$$
\frac12 \cdot \frac34 \cdots \frac{2n-1}{2n} = \frac{(2n)!}{(2^n n!)^2}=\frac{1}{4^{n}}{2n \choose n}
$$
We have the following asymptotics for the central binomial coefficient:
$$
{2n \choose n} \sim \frac{4^n}{\sqrt{\pi n}}\text{ as }n\rightarrow\infty
$$
Hence
$$
\frac12 \cdot \frac34 \cdots \frac{2n-1}{2n} \sim \frac{1}{\sqrt{\pi n}}
$$
and so
$$
n^{1/2} \frac12 \cdot \frac34 \cdots \frac{2n-1}{2n} \sim \frac{1}{\sqrt{\pi}}
$$


Please explain how Conditionally Convergent can be valid?

Question: I understand the basic idea of Conditionally Convergent (some infinitely long series can be made to converge to any value by reordering the series). I just do not understand how this could possibly be true. I think it defies common sense and seems like a clear violation of the Commutative Law.
Comment: I believe, in particular, you are referring to the following theorem: http://en.wikipedia.org/wiki/Riemann_series_theorem
Comment: "it defies common sense" - You ought to read [this book](http://books.google.com/books?id=Lrv_IvATYq0C)... as mentioned by the three excellent answers you've gotten, infinite sums don't *have to* behave the same way as finite sums.
Answer: What Riemann's Rearrangement Theorem on convergent series tells you is precisely that these "infinite sums" don't behave in the same way as the "usual" sums do.
The key is to understand that just because we can add two numbers together, and from that (through the use of the associative law) we can add any finite quantity of numbers together, we do not have a way to "add an infinite quantity of numbers" together.
So series are not really sums in the usual sense, they are limits, and they are limits of sequences. So commutativity and associativity of sums are not really at play, because series are not really sums in the usual sense.
Remember, $\sum_{i=1}^{\infty}a_n = L$ does not mean that you add infinitely many numbers and you get $L$, what it means is that the sequence
$s_1,s_2,s_3,\ldots,s_n,\ldots$ converges to $L$, where $s_k = a_1+a_2+\cdots+a_k$ is the $k$th partial sum. So, for every $\epsilon\gt 0$ there exists $N\gt 0$ such that for all $n\geq N$, $|s_n-L|\lt \epsilon$. We are not adding up the infinitely  many terms, we are saying that we can get arbitrarily close to $L$ if we add enough (but still only finitely many) of the terms.
Now, we can certainly play the usual games of commutativity and associativity so long as we only modify finitely many of the terms of the sequence $s_1,s_2,s_3,\ldots$, without modifying the limit: remember that the limit of the sequence only depends on what happens "eventually", not any changes you make to the beginning of the sequence. But that means that you need to keep the sequence intact from some point on. So you can only move around your original terms $a_n$ up to some point (up to some $n_0$) without having to worry about potentially changing the limit. But if you allow yourself to move the numbers around so much that you change the values of arbitrarily large partial sums, then you no longer have any reason to expect the new sequence to have the same limit as the old one (it could, but it doesn't have to, because you are now looking at an entirely different sequence). Which means that the usual ideas of "associativity" and "commutativity" of finite sums (you can add them up in any order and still get the same answer) no longer necessarily work for "infinite sums" (because they are not really sums, they are limits).
That is how Riemann's Rearrangement Theorem works: it modifies all the terms of the sequence so that you get a new limit.
(Moron has given you the standard example of why you cannot play associative and commutative games with infinite sums the way you do with finite sums, so I don't have to)
Answer: When it comes to infinity, most common sense goes out the window. Cantor had a hard time convincing some of his peers...
For me what was surprising is that absolutely convergent series can be reordered in any fashion and still give the same result!
When begining to learn, one naturally considers the series $\displaystyle 1 - 1 + 1 - 1 \dots$
This can be written as
$\displaystyle  1 - (1-1) - (1-1) \dots = 1$
or
$\displaystyle (1-1) + (1-1) + \dots = 0$
Now it should not be a (big) surprise if we could reorder some series differently to give multiple possible values. From there it should not be a big surprise if there were some series which could give any possible value.
The proof of Riemann Rearrangement Theorem might help reduce the surprise :-)
Hope that helps.
Answer: The commutative law holds for finitely many terms.  There's no reason to expect it to hold for infinitely many terms unless the series converges absolutely.  That's what absolute convergence is for.  In mathematics, you can't assume that the infinite analogues of finite statements are always true; you have to prove it, because often they aren't.
Comment: The other more detailed answers are good, but I think this gets to the heart of the question, of why it's not "a clear violation of the commutative law": because the commutative law doesn't ever claim to cover infinite series.
Answer: It deserves to be better known that there are simple cases where one can give closed forms for some rearrangements of alternating series. Here are a couple of interesting examples based on results of Schlömilch in 1873. Many further results can be found in classical textbooks on infinite series, e.g. those by Bromwich and Knopp.
Let $\rm\ H^m_n\ $ be the rearrangement of the alternating harmonic series $\rm\ 1 - 1/2 + 1/3 - 1/4 +\: \cdots\ $ obtained by taking consecutive groups of $\rm\:m\:$ positive terms and $\rm\:n\:$ negative terms. Then
$$\rm H^m_n\ =\ log\ 2 + \frac{1}2\ \lim_{k\to\infty}\ \int^{\:mk}_{nk}\frac{1}x\ dx\ =\ \log 2 + \frac{1}2 \log\frac{m}n $$
Similarly rearranging Lebniz's sum $\rm\ L\ =\ \pi/4\ =\ 1 - 1/3 + 1/5 - 1/7 +\: \cdots\ $ yields
$$\rm L^m_n\ =\ \frac{\pi}4 + \frac{1}2\ \lim_{k\to\infty}\ \int^{\:mk}_{nk}\frac{1}{2x-1}\ dx\ =\ \frac{\pi}4 + \frac{1}4 \log\frac{m}n $$
Thus as $\rm\:m\:$ varies we obtain infinitely many rearrangements with distinct sums.
The proof of the general theorem underlying these results is quite simple - using nothing deeper than the integral test. See Beigel: Rearranging Terms in Alternating Series, Math. Mag. 1981.


Learning LaTeX properly

Question: I have never learned how to use Latex properly. Whenever writing a paper, I use hacks to override behavior of the underlying template. What would be an intermediate to advanced book on learning how to use Latex to create style files and how to use it most efficiently? The book would ideally help one to get rid of bad habits when using Latex.
Comment: I think this question may be off-topic because it is about LaTeX in a rather general way. This used to be considered as somewhat on-topic early on, but since the existence of [tex.se] is not anymore.
Comment: You can also consult this distant cousin of MathOverflow http://tex.stackexchange.com/
Answer: Preface: I think most people don't learn LaTeX "properly"; they're happy enough to be able to get their documents to look about right with a relatively small amount of effort. There is nothing wrong with that. Being a good mathematician and being a LaTeX wizard have little to do with each other. That said, I really like obsessing over typesetting.
As far as books, I would recommend is you read The TeXbook. You shouldn't be using raw TeX unless you have a good reason to do so, so you might think this book is useless to a LaTeX user, but remember that LaTeX runs on TeX. I find it extremely helpful to understand how the underlying TeX engine works. Also, Knuth is extremely pleasant and stimulating reading (for a mathematician at least). For LaTeX proper, I think The LaTeX Companion is a pretty standard reference; it's nice to read sections on things you're interested in, but I certainly wouldn't recommend reading it like a novel
More important than reading any book, you should become interested in what happens to your documents. You probably already deal with LaTeX errors to get your documents to compile, but you should also investigate LaTeX warnings. A large chunk of my LaTeX knowledge has been acquired while tracking down and eliminating warnings. The nice thing here is that you often get some insight into why something should be done a particular way. For example, if you hack something together to get the job done, you'll often get a warning from the compiler, and in tracking down that warning, you'll likely learn the right way to do it and what was wrong with your hack. For this part of your LaTeX education, this TeX FAQ is very helpful. In particular, I highly recommend learning about the \show command, which allows you to deconstruct macros and understand how they work.
Comment: It appears that the this TeX FAQ link is broken
Answer: One of my first year undergraduate professors put me onto this:
The Not So Short Introduction to LaTeX.
I haven't had the need to typeset anything serious yet (I'm only an undergraduate), but I found it was a good place to start.
Comment: That's where I first learned about it.
Answer: The book Math Into LaTex, and the newer edition More Math Into LaTeX, by George Grätzer is a good intermediate/advanced reference to LaTeX.
You can also follow his series "What's New in LaTeX" the Notices of the AMS, in the January, May and August issues of this year.
Answer: I've found l2tabu to be a very useful guide to avoiding bad habits. Yes, it's occasionally over-dramatic - one of its sections is entitled "Deadly Sins"! - but it does provide good reasons for all the taboos it lists.
But it does only cover sins of LaTeX coding, and not sins of bad typography. I tend to work on the principle that TeX and LaTeX were designed by people who know much more about typography than I ever will, so there's probably a good reason for the default settings. Thus, if in doubt, leave it alone.
That advice probably applies to the question of whether or not to create style files: unless you're creating a whole load of documents which you want to look identical in style, creating a style file only reduces the portability of your document, since you have to remember to include the extra file when you transfer it, etc., etc..
But, if you are writing style files, or class files (which are rather harder to get right!), Appendix A of the LaTeX Companion is exactly what you need, though if it gets complicated you might want to refer to the TeXbook when you need native TeX commands.
Finally, if you come to make pretty pictures and don't want to have to include EPS files and cart them around with the document, the LaTeX Graphics Companion tells you a million and one ways to get lovely diagrams with just a few lines of code; xy is particularly useful for commutative diagrams, though I mainly use pstricks for basically every kind of diagram anyone ever needs.
Answer: For graphics, the Tikz & PGF manual ( http://tug.ctan.org/tex-archive/graphics/pgf/base/doc/generic/pgf/pgfmanual.pdf ) was extremely helpful.  It's very readable and does a great job balancing useful examples with explanations of the general philosophy of the packages.
For pure examples, I like http://texample.net .
Answer: I think it was Lamport who that the three most common mistakes in using LaTeX
were:
    1.  Worrying too much about format, and not enough about content.
    2.  Worrying too much about format, and not enough about content.
    3.  Worrying too much about format, and not enough about content.
If you're just starting out, I agree strongly with the recommendation in favour
of Grätzer's "More Math in LaTeX".  I have found Grätzer more useful than Kopka and Daley, but a beginner might rank them the other way around.  Lamport's book on LaTeX is dated and Knuth's TeXbook does serve as a good example over-indexing a book.  Eventually (when you come to write a book or a thesis) you will probably need to refer to the "LaTeX Companion".
For your figures, use tikz and pgf.
If you want to try something different there is ConTeXt, this is built on
plain TeX (for which Seroul's "A Beginner's Book of TEX" provides a good introduction).  Since most publishers will insist on a LaTeX input file,
your chances to use ConTeXt might be limited. :-(
Answer: Of course it depends what those bad habits are.  Sometimes people's bad habits involve trying to do things traditional typesetters or designers would never do - for example, setting very narrow margins.  I would recommend reading a bit about the craft of typesetting in the traditional sense and reading about the ideas of traditional style design.  The TeXBook is a good source for references.
Sometimes bad habits in LaTeX involve hard-coding things like theorems instead of using environments, for example,
 \textbf{Theorem 1} {\it This is my theorem.}
However, it doesn't sound like your bad habits are of this nature.  Maybe you should give us some examples of the kind of bad habits you have in mind.
Answer: I'm surprised that no one has mentioned the American Mathematical Society's Short Math Guide for LaTeX.
Answer: The absolutely standard place to start is "LaTeX: A Document Preparation System" by Leslie Lamport, the original author of the LaTeX macros on top of TeX.
http://www.amazon.com/LaTeX-Document-Preparation-System-2nd/dp/0201529831
When I started my PhD, I asked if I could borrow my supervisors copy.  He said yes, but that I should get my own.  He was right.
It is extremely accessible and well written.  Given the higher technical nature, it is quite compact, and seriously manages to say exactly what you need, in a form that allows you to find it easily.
I've tried to use online books etc when I've been without my copy.  They aren't even nearly as useful.
Answer: I like A Guide to LaTeX by Kopka and Daly.  (Much better than Lamport's book, in my opinion.)  If you want to tweak things, then definitely read The TeXBook by Knuth.
Answer: I have found with LaTeX life is much easier if you don't fight the template.  The defaults are surprisingly sane, and trying to work around them is a headache.  Mind, I've never been a wizard with it.  You can do some amazing work once you dig deep enough.
Answer: I've learned a lot from G. Grätzer, "Math into LaTeX". The first part is a walkthrough on how to write a document the right way (from start to finish). In the appendices, more advanced techniques are explained (redefining commands). It also features the AMS packages and many more (for instance, fancyhdr).
Answer: By Grätzer there's also his First Steps in LaTeX. See also this list.
Answer: I am resurrecting this eight months old thread to post hopefully useful link to a small
write up about TeX resources I did for GSU guys
http://predrag.freeshell.org/SciCG/resources/tex.html
Comment: Actually, I posted this answer 10 months ago. I just updated the link.
Comment: More like 18+ months.  You might check for other MathOverflow questions regarding online resources, as well as one users site (MathOnLine? Andrea Feretti?  Apologies in advance for any mistakes.) for other places to publish a link.  Gerhard "Email Me About System Design" Paseman, 2011.06.24
Comment: My stupid.  Thanks for your maintenance efforts.  Gerhard "Apologize Before Saying Something Stupid" Paseman, 2011.06.29
Answer: You might try to take a look at this free ebook::
http://www.freewebs.com/profpartha/teachlatex.htm
partha

Learning LaTeX properly


EC equivalent for RSA-OAEP

Question: I have some questions regarding aforementioned subject:

Is there a EC equivalent of RSA-OAEP key transport/encryption algorithm ?
Is ECIES-KEM sufficient ?
Answer: Short answer,
 - yes
 - yes
To be honest I don't really know how to give a longer answer.
He are some pointers
http://www.secg.org/download/aid-780/sec1-v2.pdf
http://digital.csic.es/bitstream/10261/32674/1/Gayoso_A%20Comparison%20of%20the%20Standardized%20Versions%20of%20ECIES.pdf
Answer: As I understand it, there's really no RSA equivalent in EC. See, for example, Why are elliptic curve variants of RSA "chiefly of academic interest"?
Shoup's Integrated Encryption Scheme (ECIES) is an entirely different cryptosystem, and its probably closer to Abdalla, Bellare and Rogaway's DHIES: An encryption scheme
based on the Diffie-Hellman Problem in the integer world (sans the fact that ECIES is over EC).
Answer: The question is what you mean by "eqivalence".
RSA-OAEP yields to an RSA encryption scheme providing security against adaptive chosen message attacks (IND-CCA2) in the random oracle model, while plain RSA does not even provide IND-CPA security.
If you mean security (which I assume), then yes, ECIES also achieves the same formal security guarantees as RSA-OAEP in the elliptic curve setting.
If you want an encryption scheme for elliptic curves providing IND-CCA2 security without random oracles, i.e., relying only on standard assumptions, then you can take the elliptic curve version of Cramer-Shoup encryption.
Latter however, is less efficient then ECIES.
If you only require IND-CPA security, you can also use elliptic curve versions of ElGamal encryption.
Finally, while ECIES is a hybrid encryption scheme by design, the others aren't. However, you can turn them into hybrid schemes.

EC equivalent for RSA-OAEP


What do mathematicians currently do in conformal field theory (or more general field theory)

Question: I am wondering what currently our mathematicians do related to conformal field theory, (I know currently it is a central topic, but I have only a vague idea what mathematicians do in there), or more generally topological field theory, field theory... I am extremely appreicated if there is any survey paper.
Answer: CFT/QFT/TFT/etc. is a huge subject...
Here are some random references off the top of my head...
Segal, "The definition of conformal field theory".
Costello, "Topological conformal field theories and Calabi-Yau categories" -- This is (essentially) the 2d version of the (Hopkins-)Lurie/Baez-Dolan cobordism hypothesis that Lennart mentions. See also Kontsevich-Soibelman, "Notes on A-infinity...". This stuff is closely related to mirror symmetry, which is - in physics terms - a duality between certain field theories (or sigma models). Mirror symmetry by itself is already a huge enterprise...
See papers by Yi-Zhi Huang for stuff about vertex operator algebras and CFTs.
One can consider string topology from a field theory viewpoint... see for example Sullivan, "String Topology: Background and Present State" and Blumberg-Cohen-Teleman, "Open-closed field theories, string topology, and Hochschild homology". This is actually related to the work of Costello, Lurie, Kontsevich mentioned above -- see e.g. section 2.1 of Costello's paper.
An important problem is that of making rigorous some of the things that physicists do in QFT, such as path integrals. See Costello, "Renormalization and effective field theory" and also Borcherds, "Renormalization and quantum field theory".
There's also Chern-Simons theory... Gromov-Witten theory... Kapustin-Witten theory... Rozansky-Witten theory...
Related MO questions:
A reading list for topological quantum field theory?
Mathematics of path integral: state of the art
Doing geometry using Feynman Path Integral?
Answer: It is a huge topic (or more than one huge topic) and I am not an expert, but I want to offer two examples of what is currently en vogue in topological field theories:
1) Extended Field Theories: Classicly you give for every n-dimensional a vector space and for every (n+1)-dimensional bordism a morphism. Extended can mean that you replace the category of vector spaces by a suitable 2-category and give for every bordism between bordisms a 2-morphism. For more precise statements and a fancy classification result, you should have a look at: http://www.math.harvard.edu/~lurie/papers/cobordism.pdf
2) Another important topic is the connection between 2-dimensional conformal field theories and 3-dimension topological field theories - or more generally: how does one construct 3-dimensional topological field theories? A good introduction is the book of Bakalov and Kirillov - Lectures on Tensor Categories and Modular Functors.
Answer: Note that the word "conformal field theory" (indeed, "field theory" in general) has many meanings, depending on the area of mathematics of the user, and in general the relationships between the different meanings is only conjectural.  For one use of the word, with applications to the representation theory of loop groups, you might check out the notes form the recent Workshop on Operator Algebras and Conformal Field Theory at University of Oregon.
Answer: If you are interested in operator algebras, try this review by Kawahigashi From Operator Algebras to Superconformal Field Theory, where connections to subfactor theory, moonshine and noncommutative geometry are pointed out.
Answer: One direction is the attempt of Igor Kriz to make conformal field theory rigorous in terms of lax algebras and elliptic cohomology. This work also addresses the interesting problem of understanding the moduli space of rational conformal field theories, a problem that's also important in string theory, where certain types of rational conformal field theories can be related to Calabi-Yau varieties. The deformations of the CFT then are to be mapped to the deformations of the Calabi-Yau families. This raises interesting problems because of the singularities encountered in the CY moduli space. Papers in this direction can be found on his webpage at Michigan.
More generally, there is much work done by Bloch, Marcolli and others to understand the appearance of motives in perturbative quantum field theory. Papers in this direction can be found on Bloch's Chicago webpage and Marcolli's Caltech webpage. Marcolli has also recently written a book on this theme called "Feynman Motives".


Addressing bad behavior after the fact

Question: My 5 (almost 6) year old daughter has started doing things that she knows are wrong when friends are over. From what I can tell, it's not the friends who are instigating the bad behavior, it's my daughter. Unfortunately, I am not finding out about the mischief until well after the fact,  so I feel like any punishment (loss of play dates or time outs) is too removed from the action to be any sort of real lesson. Any ideas?
Answer: The reason for delivering instant punishment is that very small children need immediate feedback on their actions. For toddlers it's important to have instant feedback because they simply can't grasp the connection to what
happened hours ago -- but pre- or primary-schoolers certainly can.
In my untrained opinion (my son is still a toddler), instant feedback no longer applies to a six-year-old because at that age, she knows what she is allowed to do and she probably also knows the consequences of breaking the house rules.
Because I think she can still remember having done it when you discover her mischief a few hours later, I see nothing wrong with delivering the appropriate punishment immediately upon  discovery. She should know (or will quickly learn!) that appropriate punishment comes when she's found out, even if it's a while later. (Define "a while" any way you like; hours or days.)
You might want to add a  bonus punishment  for knowingly disobeying when you're not around, to emphasize that your house rules always apply regardless whether parents are around or not.
Comment: +1 I agree with TGB ... and would in fact second the notion that intentional disobedience must be dealt with harshly. I define "a while" as within the memory.  Also, don't be concerned about who instigates, be concerned about choices your child makes and actions your child takes. It matters little who thought of it.
Answer: Also, allow the natural consequences to be apparent.  The next time you set up a playdate with that child and they are unavailable, your child will almost invariably ask "Why can't the come over?"  My response would be somewhere along the lines of "Maybe her mother doesn't want her to come over here because she was picking up bad habits."
Answer: Your child is old enough now for delayed consequences, so if that is appropriate, I wouldn't be afraid to apply those, but it is also possible that some information is missing.
A real life consequence of her actions might be that her friends (or their parents) will stop wanting to play with her if her behavior is that disruptive.  I would talk to her about it.  "Honey, I'm concerned.  I love you and want you to have friends and I also want you to be able to make safe, respectful and loving decisions".  Talk to her about what you've heard and ask her what she thinks is going on.  You can ask her why she is making those choices without implying that it isn't her fault.  "I'm concerned about your choices and want to help you make ones that will help you keep your friends and still be respectful (or whatever adjective you want to fill in), can you tell me why you are doing these things?"
See what she says and then respond to that with a "brainstorming session" about how she can accomplish the positive things she is trying to accomplish without the negative.  If she is looking to cause trouble and says so, I would simply say, "well we'll have to see how that works for you".  Then if she does it again, the next time she wants to go to a friends house (or play and have friends over) tell her, "I'm sorry, but I don't trust you to make the right decisions with friends right now.  You'll have to figure out how to show me you want to and can have fun with friends without creating mischief."  Then give her some time to think about it and a few missed play dates.  When she does get to play again, discuss with her that this is her opportunity to win back your trust.

Addressing bad behavior after the fact


Work from home VPN not safe on home router?

Question: I'm getting set up to work from home and I have an existing cable internet connection with a router connected to the cable modem for my home computers. My work's IT dept says it's their policy not to connect work at home computers to a router; they must have their own stand alone connection and modem. I thought VPN was secure no matter if directly connected or connected to a router. They are suggesting I add a "business connection" separately for my work at home computer, but this is about 90.00 monthly and I've already heard my dept director is balking at reimbursing that amount of money a month. What gives?
Comment: If the IT department is that strict, then nobody can use a company's laptop to connect to the VPN from some hotel either?
Answer: I'm wondering if the IT fellow is confusing the types of VPN connections: station-to-station,  point-to-point and point-to-station.
Basically, if you have two VPN routers, you can connect them together with a VPN tunnel. This gives you a "station to station" VPN connection, where it is possible to have all machines in both networks visible to each other. This would not be desirable in a business-to-home situation, but most home folks don't have VPN routers, either.
Creating a VPN tunnel from a PC using it's VPN software (i.e. using Windows to create a tunnel) gives you either point-to-point (i.e. PC to PC) or point-to-station (PC to VPN router) tunnels. This allows the PC to see either the other PC or the other network. This is the most common business-to-home scenario. It is also quite secure from the business side as only the initiating (home) PC is a part of the VPN tunnel.
I've done the latter (PC to business) many times as part of my work, and the business network is quite secure - even though I may have many machnines at home connected through my own router/switch network.
Cheers,
-R
Answer: Thanks for the input.  I talked to the IT guy and told him I didn't have a separate connection yet, and could I simply unhook my router and let him hook directly up to my modem until I can get another connection.  He said that was OK.  I am wondering if I can simply hook back up thru my router when he leaves.  Not wanting to be dishonest, but I happen to know several of my co-workers who are already set up at home have done this because they only have one high speed internet connection with multiple computers.  Will that work, or can he somehow set it up to where it won't work that way?  Also, I'm guessing they may be able to tell from their end if I do that, but I have no idea what they will do about it, if anything.
Comment: Your IT guy is simply wrong.  The VPN connection is encrypted between your PC and the work network, period.  Passing through your home router makes zero difference, since all your router sees are encrypted packets.
Comment: The IT guy is nuts if he things it is safer for you, or his network, when you are directly connected to your modem.  Behind your router, only your other computers could do evil things to your computer.  Connected the modem directly means anyone in the world could use your computer to abuse the work network.
Comment: You should also tell him to look into MS's (or other vendor's) network health software. At MS, my computer is required to pass a series of checks that makes sure I am virus free, up to date on patches, have an active virus scanner and so on. I'm sure other companies (such as Cisco) have similar setups.
Comment: Actually, I'd give some points to the ideas behind what the IT chap was saying - firstly, if he connects his work PC to his home router, he's exposed to a bunch of home PCs, family, etc. Potential for infection, that can then traverse the VPN to the work network. Having said that, it's not much worse than connecting to a public Wi-Fi hotspot, but who wants to do that? It all depends on what you assume the IT guy is trying to prevent.
Answer: If you have your computer behind a router connected to the modem then the VPN traffic goes through your home network and router, then out the modem and then to the telecos dslam somewhere, then god knows where through the bowels of several ISP's networks until it gets to your work.
The point is if you eliminate that first hop inside your network, what have you really acheived?  The traffic still goes through the public internet where anything could be happening.
A VPN is a way of creating a secure encrypted "tunnel" between two trusted points, over an untrusted network.  Its your computer that does the encryption, not the router so if an attacker could somehow intercept the traffic on your home network then it wouldn't do them any good anyway.
Answer: Well, it's your house, your computer, your internet service, your home network. If they aren't happy with that, tell them that they can pay for new service, as well as provide a dedicated pc.
Seriously.
If your company is using, say, a Cisco router, then they should be providing you a Cisco VPN client that you can install on your pc. It should be configured to allow you to connect to your work network. The VPN client doesn't care if your computer is behind 1 or 1000 routers. As long as it can establish a connection, it's doing its' job.
IMO, either your IT person is misinformed or unknowledgeable, or else they have other undisclosed reasons for wanting you to directly connect to a modem. As others have stated, not being behind the router leaves you vulnerable to the whole internet.
Answer: The IT guy is sort of correct in that you definitely do not want to have all your private home internet going through their corporate system. However he is missing the point of a VPN. The idea is that it secures data between you and the corporate network when outside their offices, hotels, conferences, trains etc and home. If you hook up using a software VPN client on you PC then connect to their VPN host, it will work fine and just your PC will go though the tunnel. All other traffic, Kids, XBox, Wife/Husband's browsing will go out through normal channels.
Answer: The concern is probably the possibility of your home network affecting the corporate LAN (propagating a virus, for example) you're connecting to.  They probably want a point-to-point between your work at home computer and no connection from it to your home LAN.
It's you vs. them.  We had a similar policy at a company I used to work for and the common sense prevailed (ie. somebody they trusted explained it to them) and they lifted the silly restriction.
Answer: If the VPN is initiated from your machine, I do not see how having a different connection is any safer. Obviously it could stop man in the middle attacks / interception of VPN credentials if there is only one machine connected to the router/modem, however these are rare and I can't imagine it being a issue for many.
Answer: Another one of my coworkes says what they did is called the cable company and requested a "static IP address" for the work computer so as to satisfy requirements.  I'm thinking that this will not really matter, security wise.  I'm just wandering if they will know that I'm on a router instead of straight thru a modem.


The use of Hall algebras in physics

Question: I asked the same question in mo. I think maybe here there are more physics guys to help me.
I once read a statement (not memorized precisely) that a certain physics quantity between two states of charge $d_1$ and $d_2$ respectively could be computed by running over the states of charge $d_1+d_2$ which is the extension of the original two states. Therefore we need to consider some Hall algebras on a moduli space.
I couldn't find that literature any more, so I am not sure that this statement is correct. Could anyone help me to make clear this sort of things?
My questions are:

What is the basic physics setting of this story?
Why is this "extension" important?
If this is not correct, what is the correct statement/why do physicists care about Hall algebras?

PS: I think these questions are also related to the representations of particles, and the decomposition of particles.
Answer: The MathOverflow answer really is good:  Harvey & Moore's papers are pretty much required reading in this subject.

The use of Hall algebras in physics


Is there a minimum amount of dough to separate challah without a bracha?

Question: I saw on this website http://www.secretofchallah.com/50708/When-to-separate-challah#opinions that one should not separate challah if using less than 8.5 cups or about 2 lbs.  I know there are various opinions on how much it takes to separate with a bracha, but I've never heard of a minimum for separating without a bracha.  Any ideas of why this would be?
Comment: http://www.jerusalemkoshernews.com/2011/01/shiur-of-dough-from-which-to-take-challah/
Answer: The four opinions on the linked website differ on the exact standard of volume measurements used by halacha.
Each opinion holds the minimum amount of flour that necessitates separating chala, which is a mitzva and is accompanied by a bracha, is the volume of 43.2 Eggs. Any less than that and the requirement of chala does not apply. (324:1)
The Egg is a standard unit of volume in halacha whose exact size is a matter of debate. The larger of the two numbers listed for each opinion is that person's precise estimation of 43.2 Eggs. The smaller of the numbers is 43.2 Eggs according to another (non-preferred) method of calculation. These opinions hold that one should act stringently by performing the mitzva for the lesser calculations as well, but should not make a bracha because we do not truly hold that the minimum required volume has been reached.
See Rabbi Josh Flug's extensive detailed explanation of the topic here.
Comment: I read the question as asking whether below the minimum one *should not* separate even if one wants to. I guess that may be a separate question about the prohibition of extending mitzvot.
Answer: According to Isaac Moses' understanding of the question, the following might be a reason not to separate challah when the dough is below the minimum size:
The halachah is that even after baking, loaves can combine for purposes of challah if they're all in the same container (Yoreh De'ah 325:1). So suppose that a person makes two batches of dough, each 1-1/2 pounds, separates challah from each one, and then bakes each batch into a separate loaf of bread. So far, though, challah has not been validly taken from either batch, because 1-1/2 pounds is below the minimum size for the mitzvah of challah. Well, now, if both loaves are placed into one breadbox, they become obligated to have challah taken from them after all! But the baker won't realize that, since they think that they have already separated challah correctly.
Comment: The same concern could of course present itself if one is separating lechumra for a borderline amount (such as between 1.2 lb and 1.66 kg for R Chaim Naeh).


Magento Bulk Product Import + Modules Nightmare

Question:
Have 5,000 products in CSV file
File has been re-saved as UT8 file in google documents and exported to CSV from excel
File loads perfectly with all fields in demo of magento store manager (except we dont want to buy it:)
When trying to upload in regular Magento..keep getting error messages on column duplicates....yes we have hundreds of duplicates as the titles of products in fields correspond with different sizes, etc...no way around it
Any solutions around this or any open source software similar to store manager that can do the trick.  Ready to give up and go to paid solution such as Big Commerce
Also, Uploaded a bunch of free modules/keys...of open source bulk import products from magentocommerce  but I cant find them anywhere in the main admin panel to use...there is no menu item for them anywhere??
Answer: Bit hard to answer without seeing your csv, however the only duplicate values that Magento should care about is the SKU, so make sure these are unique.
Is your csv file formatted correctly? ie; correct headers? Did you create the csv from an export of Magento data?
Magento will also complain about any extended ascii characters in your data, such as MS Word apostrophes, quotes, elipses, etc. so make sure you replace these with ascii variants
Answer: Duplicate products can be caused when SKU from the file you import  do not match to the SKU in your store.
If the SKU not defined or path is not valid there should be wrong characters in the import file. So check your title and all fields which contain text.


Distance a curveball travels?

Question: I've seen some discussions regarding the movement of a spinning object, say a curveball.  However, all have been largely qualitative.  I was wondering if anyone has seen or worked through a calculation of how far a curveball moves laterally on its way from the mound to homeplate - even in an order-of-magnitude sense.
Answer: The two physical effects that come into play here are the Magnus effect and the drag force:
$$ \mathbf{F}_M= S \left( \mathbf{\omega} \times \mathbf{v} \right) $$
$$ \left| \mathbf{F}_D \right| =\frac{1}{2} \rho \left| \mathbf{v} \right|^2 C_D A $$
the direction of the drag force is oriented opposite to the direction of motion. $\rho$ is the density of the fluid (air in the case of a baseball), v is the velocity of the curveball relative to the fluid, A is the cross section of the baseball.
$S$ and $C_D$ are two coefficient to be determined. Typically $S$ is in the range 0.1-0.5 and $C_D$ is 0.1 for a smooth sphere, and will be a little more for a baseball which is not perfectly smooth.
Knowing the initial speed of the ball you can do the math by yourself, or refer to many articles and book written about the topic. Two references you may be interested in are:
1) "The physics of baseball" by Robert K. Adair
2) "The effect of spin on the flight of a baseball" by Alan M. Nathan, available here: http://webusers.npl.illinois.edu/~a-nathan/pob/AJPFeb08.pdf

Distance a curveball travels?