Cancel a Hotel Room After Checking in Online

Question: I'm asking specifically about Hilton properties, but you can answer generally too. Once I check in to a hotel room online or in the hotel app, can I still cancel my reservation, for instance, if my flight is delayed as long as I'm within the hotel's cancellation window (often 6PM same day)?
Comment: I don't know the actual answer (for Hilton) hence a comment. I would wonder that you would even think it possible to _cancel_ your reservation, once you've checked in. I see no difference whether you check in to your room virtually or in person, you've accepted the room as is and agreed to pay for it, at least for a single day rate. The hotel has accepted your check in, and now flags the room unavailable and occupied.
Comment: @CGCampbell Hilton allows you to check-in the day before arriving, so the act of checking in online doesn't directly flag the room as occupied.
Comment: This depends on many factors, including when you made the reservation and when you are wanting to cancel it. It may also depend on how you paid, which room (or rooms) you reserved, preferred customer status, whether you booked directly, through an OTA, or through a traditional travel agency, and other factors. When you consider other chains, too, the possibilities are literally endless. The only possible general answer is "check your reservation cancellation policy."
Comment: The accepted answer is the one I was looking for. I booked a hotel the most general way: through the Hilton website with a refundable rate (6pm cancellation date). The question was about whether checking in invalidates the 6pm cutoff.
Answer: Firstly, note that most Hilton properties now have a "day before arrival" cancellation policy on most reservations.  Some corporate rates override this and still have a 4pm/6pm/etc policy.
However if you are still before the cancellation time on your reservation then you can still cancel even if you have checked in online - however you will need to contact the hotel directly to do so.
The Digital Check-in FAQ covers this to some extent where it says "Should you need to cancel a reservation, please call the hotel directly. We plan to enable in-app cancellation in the near future."
Answer: To answer generally, there is the official policy, and
then there is what the hotel chain or individual hotels do in practice.  If it is before the cancellation deadline, then officially you are permitted to cancel.  If it is past the cancellation deadline, then you need to contact the hotel chain guest assistance desk or the individual hotel directly, and plead your case.  If you have a pre-paid, non-refundable rate, it's more difficult, but sometimes an exception is made.  If you need to cancel because your flight is delayed or a similar circumstance out of your control, you may be permitted to do so.  If you ask to have your reservation shifted to be a day later instead of cancelled, that's often easier for a hotel to do.  In my own experience, I've always been permitted to shift or cancel when a flight delay or bad weather caused the issue.
Answer: As per previous comments, if its ahead of day of arrival, no problem. What i have seen are people that digitally check in on day of arrival and call hours after they digitally checked in and say they are unable to come. The issue is that, in most cases, there's no one to verify the room has been "unoccupied." So there's no way of knowing whether or not someone, went in, slept or "did their business" and left and didn't want to pay for the room. Most hotels generally only have 1 employee there after 5pm and that person can't just leave the front desk and go check the room. If you jumped the gun and digitally checked in, then accept that you made a blunder and should have come by the front desk and gotten a key to checkin. We could easily for what ever reason cancel your reservation at no charge.


How to eliminate odor from the heavy cooking?

Question: We live in a small space. And we cook a lot leaving our home smell like a spice box.
What are the ways to follow while cooking to not spread the odor.. And secondly get rid of the smell fast.
Answer: In some cultures, there is a room called a spice kitchen that is an important feature of the house.

In order for the Spice Kitchen to serve its intended purpose, it needs a high-volume exhaust hood over the oven and a door. The foods that are going to be prepared in the Spice Kitchen should be stored there as well, so there should be cabinetry, counter space and a sink.

Some foods create an enormous amount of smell and that smell can be carried around by steam or aerosolized oils or smoke.
So, the best solution is to get rid of the smell before it circulates and settles on other areas of the house.  You need a large hood to catch the steam and smoke from cooking and duct it out of the area.  How you do this is probably beyond the scope of your question, but removing the by-products of cooking is the solution.
Comment: Thank You. This information is useful. If we can afford.. we prolly will look for a spice kitchen in our next house.
Comment: @JamesKumo glad it was helpful, but my main point was to look at how spice kitchens are used and work to get an idea of how to "fix" your kitchen.  I'm not saying you need to move or that your current kitchen will never work.


Can you explain the "Level of Risk" for each features in the context of writing 'Test Plan: Features to be tested'? Note: test plan format- IEEE 829

Question: According to IEEE 829 format for Test Plan, under the section "6. Features to be tested" it has been stated that-
"Set the level of risk for each feature. Use a simple rating scale such as (H, M, L): High,
Medium and Low. These types of levels are understandable to a User. You should be
prepared to discuss why a particular level was chosen."
I am confused about these levels of risk! Does this indicate how much risk is there if we don't test it? Or how much risk there to test it without finding any bugs? I mean, I couldn't get any clear answer about the definition of "level of risk" in this context(IEEE format).
Comment: Ok i think you are trying to say "The difficulty in testing the feature"
Comment: Thank you for answering my silly things! ^_^
Comment: Or how much risk there to test it without bugs? what does that means ?
Comment: Level of risk is usually the cumulative outcome of the criticality of the feature and risk involved if the feature breaks.
Comment: @PDHide, sorry for that sentence. I meant to say, is level of risks indicating how much risk there will be to test the feature without finding any bugs!? My question sounds a bit silly now after your answer! Your answer is really helpful and clear. Thank you.
Comment: THe document clearly says its from user perspective, so it doesn't count the difficulty in testing the feature. Such things will be covered in section 4 I believe . @Joao answer an excellent one for you to understand this in simple words
Answer: Risk is the possibility of a bad experience for someone who matters.
"who matters" may include users, sponsors, developers, testers, managers, regulatory agents, etc, etc, etc.
"bad experience" may include direct usage of the product, indirect consequences of its usage, even consequences of the existence of the product/feature itself, even if no one uses it / before going to production.
Testing doesn't influence risk. Testing is an activity to better understand risks.
For more details, I would suggest watching James Bach's talk on Risk Analysis.
The sizing described in the document is simply a comparative scale: The " people who matter" have certain perspectives of risk that serve to group particular instances (bad experiences possibilities) in High, Medium, and Low impact. You have to instantiate this scale is your context, by creating a shared understanding of people's opinion. It's a dynamic process because people change and new knowledge is added every day.


What can multiple threads do that a single thread cannot?

Question: While threads can speed up execution of code, are they actually needed? Can every piece of code be done using a single thread or is there something that exists that can only be accomplished by using multiple threads?
Comment: Based on some of the answers already posted here, I think some clarification is in order. The purpose of threading is to allow computers to (appear to) do more than one thing at a time. If this is done using a computer with a single core, you *won't see any overall speedup.* What you will see is unblocking; in a single-threaded program, the user interface will block while calculations are taking place. In a multi-threaded program, the user interface may still be usable while the calculations take place in the background.
Comment: A single-threaded program cannot deadlock resources in the way a multi-threaded program can.
Comment: Of course, if you do have multiple processor cores in your computer (which is commonplace nowadays), your program can use threads to take advantage of additional cores to perform your processing, and you *will see a speedup,* because you are throwing more horsepower at your computing problem. If you don't use threads at all, your program will only utilize a single processor core, which is fine if that's all you need.
Comment: Answer: cause a deadlock.
Comment: Answer: run on two cores
Comment: After posting my answer below a really short answer came to me--another question.  "What can a for loop do that if/goto can not?"
Comment: @Bill K so you're saying a single thread, emphasis on threads here, can run on two cores
Comment: A Thread being a programming abstraction--yes.  For instance, I believe actors run at different times (You could say "On different threads" if you really wanted to because it's standard terminology, but you don't actually see "Threads" anywhere").  In fact, it's possible for your programming language to analyze a loop and execute different iterations on different CPUs.  Again as programmers we always think "On different threads" but in this case it's important to differentiate clearly.
Comment: @zzzzBov - Of course a single-threaded program can cause a deadlock: just make scheduling explicit and any multi-threaded program becomes single-threaded.
Comment: @robert note that the speedup seen is dependent of how much synchronization is needed between the cores (and can even be a _slowdown_)
Comment: @ratchet: Of course.  As with all things, there are caveats.
Comment: @Lavinski Threads are not the only programming model that allows running on multiple cores--in fact it's probably not even the best one.
Comment: Race conditions?
Answer: First of all, threads cannot speed up execution of code. They do not make the computer run faster. All they can do is increase the efficiency of the computer by using time that would otherwise be wasted. In certain types of processing this optimization can increase efficiency and decrease running time.
The simple answer is yes. You can write any code to be run on a single thread. Proof: A single processor system may only run instructions linearly. Having multiple lines of execution is done by the operating system processing interrupts, saving the state of the current thread, and starting another one.
The complex answer is ... more complex! The reason that multithreaded programs may often be more efficient than linear ones is because of a hardware "problem". The CPU can execute calculations more quickly than memory and hard storage IO. So, an "add" instruction, for example, executes far more quickly than a "fetch". Caches and dedicated program instruction fetching (not sure of the exact term here) can combat this to some extent, but the speed issue remains.
Threading is a way of combating this mismatch by using the CPU for CPU bound instructions while IO instructions are completing. A typical thread execution plan probably would be: Fetch data, process data, write data. Assume that fetching and writing take 3 cycles and processing takes one, for illustrative purposes. You can see that while the computer is reading or writing, it's doing nothing for 2 cycles each? Clearly it's being lazy, and we need to crack our optimization whip!
We can rewrite the process using threading to use this wasted time:

#1 fetch
no operation
#2 fetch
#1's done, process it
write #1
#1 fetch
#2's done, process it
write #2
fetch #2

And so on. Obviously this is a somewhat contrived example, but you can see how this technique can utilize the time that would otherwise be spent waiting for IO.
Note that threading as shown above can only increase efficiency on heavily IO bound processes. If a program is mainly calculating things, there's not going to be a lot of "holes" we could do more work in. Also, there is an overhead of several instructions when switching between threads. If you run too many threads, the CPU will spend most of it's time switching and not much actually working on the problem. This is called thrashing.
That all is well and good for a single core processor, but most modern processors have two or more cores. Threads still serve the same purpose - to maximize CPU use, but this time we have the ability to run two separate instructions at the same time. This can decrease running time by a factor of however many cores are available, because the computer is actually multitasking, not context switching.
With multiple cores, threads provide a method of splitting work between the two cores. The above still applies for each individual core though; A program that runs a max efficiency with two threads on one core will most likely run at peak efficiency with about four threads on two cores. (Efficiency is measured here by minimum NOP instruction executions.)
The problems with running threads on multiple cores (as opposed to a single core) are generally taken care of by hardware. The CPU will be sure that it locks the appropriate memory locations before reading/writing to it. (I've read that it uses a special flag bit in memory for this, but this could be accomplished in several ways.) As a programmer with higher level languages, you don't have to worry about anything more on two cores as you would have to with one.
TL;DR: Threads can split work up to allow the computer to process several tasks asynchronously. This allows the computer to run at maximum efficiency by utilizing all the processing time available, rather than locking when a process is waiting for a resource.
Comment: Excellent answer.  I just wanted to elaborate that after a certain point, adding more threads can actually make a program run _slower_, because all the previously "wasted" time is utilized, and you are now only adding additional context switch and synchronization overhead.
Comment: +1 for describing how threads help with IO blocking processing. Another use of threads is to allow the UI to continue to process user actions (mouse movement, progress bars, keystrokes) so the user perception is that the program has not 'frozen'.
Comment: @james: I'd classify UI processing as just another form of I/O.  Perhaps the worst, as users tend to be laggy and non-linear. :)
Comment: There's a silent assumption in the question and answer around the computer being single core or CPU. My watch has two cores, I doubt the assumption is valid on any modern machines.
Comment: One more addition: *strictly* speaking, threads do not add any expressivity to most languages; you could, if you absolutely had to, implement all the multiplexing yourself and get the same results. In practice, though, this would amount to reimplementing your entire threading library - just like recursion is not strictly necessary, but can be emulated by writing your own call stack.
Comment: This answer is so 1985...
Comment: @james: UI *is* IO. The user is a very slow input device.
Comment: 1985? Make that 1965. Amdahl's Law (that quantified how much threads can speed up execution of code, in direct contradiction of the first sentence) was coined in 1967.  Computers exist sinze ~1945; so by now we've lived with multi-threaded systems longer than without.
Comment: >`Note that threading can only increase efficiency on heavily IO bound processes. If a program is mainly calculating things, there's not going to be a lot of "holes" we could do more work in.`  ...huh? Try telling that to my graphics card while I've got a 3D game running.  It uses massively parallel multithreaded processing to render enormously complicated calculations, with a minimum of I/O stuff going on.
Comment: @Mason: SIMD processing is a different animal than the general processor, and is outside the scope of my answer.
Comment: @Michael: I'm not talking about SIMD, I'm talking about multicore, which can speed up CPU-intensive tasks if they're parallelizable.
Comment: The first paragraph needs to go. The article is great, but why confuse a technically correct article with half and fully false platitudes? Threads allow you to split the problem and re-order execution. Done well, that does make the "code" execute faster. The fastest code is code that doesn't run. "code" is whatever gets an answer, so a threaded implementation can run "faster" even though the instructions don't execute faster.
Comment: @Mason et al: rather than comment on the quality of this answer, consider down-voting it and supplying your own answer. Beyond that, Stack Exchange is [collaboratively edited](http://programmers.stackexchange.com/faq#editing): if there is a factual inaccuracy that can be fixed in this answer without changing the intent of the poster, I encourage you to edit it to correct that inaccuracy.
Answer:
What can multiple threads do that a single thread cannot?

Nothing.
Simple proof sketch:

[Church-Turing Conjecture] ⇒ Everything that can be computed can be computed by a Universal Turing Machine.
A Universal Turing Machine is single-threaded.
Ergo, everything that can be computed can be computed by a single thread.

Note, however, that there is a big assumption hidden in there: namely that the language used within the single thread is Turing-complete.
So, the more interesting question would be: "Can adding just multi-threading to a non-Turing-complete language make it Turing-complete?" And I believe, the answer is "Yes".
Let's take Total Functional Languages. [For those who are not familiar: just like Functional Programming is Programming with Functions, Total Functional Programming is Programming with Total Functions.]
Total Functional Languages are obviously not Turing-complete: you cannot write an infinite loop in a TFPL (in fact, that's pretty much the definition of "total"), but you can in a Turing Machine, ergo there exists at least one program that cannot be written in a TFPL but can in a UTM, therefore TFPLs are less computationally powerful than UTMs.
However, as soon as you add threading to a TFPL, you get infinite loops: just do each iteration of the loop in a new thread. Every individual thread always returns a result, therefore it is Total, but every thread also spawns a new thread that executes the next iteration, ad infinitum.
I think that this language would be Turing-complete.
At the very least, it answers the originial question:

What can multiple threads do that a single thread cannot?

If you have a language that cannot do infinite loops, then multi-threading allows you to do infinite loops.
Note, of course, that spawning a thread is a side-effect and thus our extended language is not only no longer Total, it isn't even Functional anymore.
Comment: Since you brought up a "proof", I can't prevent myself from "well, actually..."ing you. I think you are abusing the notion of computability. The proof is a cute thing and I get your point, but it's not really at the right abstraction level. Not being able to **do things** is not the same as not being able to **compute**, e.g., you cannot use your proof to say, because Turing machine can *compute* "every computable function", it can *do* it in 3 seconds. Strictly speaking, a single threaded machine without interrupts cannot access I/O while keeping its processor busy doing computation.
Comment: And, no real computer is a Turing machine.
Comment: @ColeJohnson: A deadlock is an implementation detail. The visible output is "not halting", which is easily doable with a single thread.
Comment: @Heinzi: "easily doable" is an understatement. If I remember correctly, the second or third program that I *ever* wrote did exactly that! ;-)
Comment: If the universe is single *thread*ed, then what is *string* theory? You can't argue with science like this.
Comment: Multiple threads allow you to run on more than one physical UTM *at the same time*.
Comment: Disproof: A single thread can't deadlock, while multiple threads can.
Answer: In theory, everything a multithreaded program does can be done with a single-threaded program as well, just slower.
In practice, the speed difference may be so big there is no way one can use a single-threaded program for the task. E.g. if you have a batch data processing job running every night, and it takes more than 24 hours to finish on a single thread, you have no other option than to make it multithreaded. (In practice, the threshold is probably even less: often such update tasks must finish by early morning, before users start to use the system again. Also, other tasks may depend on them, which must also finish during the same night. So the available runtime may be as low as a few hours / minutes.)
Doing computing work on multiple threads is a form of distributed processing; you are distributing the work over multiple threads. Another example of distributed processing (using multiple computers instead of multiple threads) is the SETI screensaver: crunching that much measurement data on a single processor would take an awful long time and the researchers would prefer seeing the results before retirement ;-) However, they don't have the budget to rent a supercomputer for so long, so they distribute the job over millions of household PCs, to make it cheap.
Comment: I think the SETI example is distributed computing rather than mutli-threaded. Similar concepts but not the same thing.
Comment: @Robert: I think Péter is using SETI@Home to explain the concept of splitting up work to run on multiple processors. Distributed computing is of course different than multithreading, but the concept is similar.
Comment: The SETI screensaver is an example of threading in the sense that it *runs on a background thread in your computer;* you're still able to do other things on your computer while it is crunching data in the background. Without the thread, there would be a pause while the SETI screensaver performs its calculations; you would have to wait for it to finish before you could continue your own work.
Answer:
Although threads seem to be a small step from sequential computation,
  in fact, they represent a huge step. They discard the most essential
  and appealing properties of sequential computation: understandability,
  predictability, and determinism. Threads, as a model of computation,
  are wildly nondeterministic, and the job of the programmer becomes one
  of pruning that nondeterminism.
-- The Problem with Threads (www.eecs.berkeley.edu/Pubs/TechRpts/2006/EECS-2006-1.pdf).

While there are some performance advantages that can be had by using threads in that you can distribute work across multiple cores, they often come at a great price.
One of the downsides to using threads not mentioned yet here is the loss of resource compartmentalization that you get with single threaded process spaces. For example, say you run into the case of a segfault. It is, in some cases, possible to recover from this in a multi-process application in that you simply let the faulting child die and respawn a new one. This is the case in Apache's prefork backend. When one httpd instance goes belly up, the worse case is that the particular HTTP request may be dropped for that process but Apache spawns a new child and often the request if just resent and serviced. The end result is that Apache as a whole is not taken down with the faulty thread.
Another consideration in this scenario is memory leaks. There are some cases where you can gracefully handle a thread crashing (on UNIX, recovering from some specific signals -- even segfault/fpviolation -- is possible), but even in that case, you may have leaked all the memory allocated by that thread (malloc, new, etc.). So while you process may live on, it leaks more and more memory over time with each fault/recovery. Again, there are to some degree ways to minimize this like Apache's use of memory pools. But this still does not guard against memory that might have been allocated by third party libs that the thread may have been using.
And, as some people have pointed out, understanding synchronization primitives are perhaps the hardest thing to really get right. This problem by itself -- just getting the general logic right for all your code -- can be a huge headache. Mysterious deadlocks are prone to happen at the strangest times, and sometimes not even until your program has been running in production, which makes debugging all the more difficult. Add to this the fact that synchronization primitives often vary widely with platform (Windows vs. POSIX), and debugging can often be more difficult, as well as the possibility for race conditions at any time (startup/initialization, runtime, and shutdown), programming with threads really has little mercy for beginners. And even for experts, there still is little mercy just because knowledge of threading itself does not minimize complexity in general. Each line of threaded code sometimes seems to exponentially compound the overall complexity of the program as well increase the probability for a hidden deadlock or strange race condition to surface at any time. It can also be very difficult to write test cases to ferret these things out.
This is why some projects like Apache and PostgreSQL are for the most part process-based. PostgreSQL runs every backend thread in a separate process. Of course this still does not alleviate the problem of synchronization and race conditions, but it does add in quite a bit of protection and in some ways simplifies things.
Multiple processes each running a single thread of execution can be much better than multiple threads running in a single process. And with the advent of much of the new peer-to-peer code like AMQP (RabbitMQ, Qpid, etc.) and ZeroMQ, it's much easier to split threads across different process spaces and even machines and networks, greatly simplifying things. But still, it's not a silver bullet. There is still complexity to deal with. You just move some of your variables from process space into the network.
The bottom line is that the decision to enter into the domain of threads is not a light one. Once you tread into that territory, almost instantly everything becomes more complex and whole new breeds of problems enter your life. It can be fun and cool, but it's like nuclear power -- when things go wrong, they can go badly and fast. I remember taking a class in criticality training many years ago and they showed pictures of some scientists at Los Alamos who played with plutonium in the labs back in the WWII. Many took little or no precautions against the event of an exposure, and in the blink of an eye -- in a single bright, painless flash, it would all be over for them. Days later they were dead. Richard Feynman later referred to this as "tickling the dragon's tail." That's kind of what playing with threads can be like (at least for me anyway). It seems rather innocuous at first, and by the time your bitten, your scratching your head at how quickly things went sour. But at least threads won't kill you.
Comment: afternoon coffee break
Comment: My TL;DR answer pales in comparison to this nice piece on what single threads won't do for you.
Answer: First of, a single threaded application will never take advantage of a multi-core CPU or hyper-threading. But even on a single core, single threaded CPU doing multi-threading has advantages.
Consider the alternative and whether that makes you happy. Suppose you have multiple tasks that need to run simultaneously. For instance you have to keep communicating with two different systems. How do you do this without multi-threading? You would probably create your own scheduler and let it call the different tasks that need to be performed. This means that you need to split up your tasks into parts. You probably need to meet some real-time constraints you must make sure that your parts do not take up too much time. Otherwise timer will expire in other tasks. This makes splitting a task up more difficult. The more tasks you need to manage yourself, the more splitting up you need to do and the more complex your scheduler will become to meet all the constraints.
When you have multiple threads life can become easier. A pre-emptive scheduler can stop a thread at any time, keep its state, and re(start) another. It will restart when your thread gets its turn. Advantages: the complexity of writing a scheduler has already been done for you and you don't have to split up your tasks. Also, the scheduler is capable of managing processes/threads that you yourself are not even aware of. And also, when a thread doesn't need to do anything (it is waiting for some event) it will take up no CPU cycles. This not so easy to accomplish when you are creating your down single-threaded scheduler. (putting something to sleep is not so difficult, but how does it wake up?)
The downside of multi-threaded development is that you need to understand about concurrency issues, locking strategies and so on. Developing error-free multi-threaded code can be quite hard. And debugging can be even harder.
Answer:
is there something that exists that can only be accomplished by using multiple threads?

Yes. You can't run code on multiple CPUs or CPU cores with a single thread.
Without multiple CPUs/cores, threads can still simplify code that conceptually runs in parallel, such as client handling on a server -- but you could do the same thing without threads.
Answer: Threads are not only about speed but about concurrency.
If you have not a batch application as @Peter suggested but instead a GUI toolkit like WPF how you could interact with users and business logic with just one thread?
Also, suppose you're building a Web Server. How you would serve more than one user concurrently with just one thread (supposing no other processes)?
There are many scenarios where just one thread simple isn't enough. That's why recent advancements such as Intel MIC processor with more than 50+ cores and hundreds of threads are taking place.
Yes, parallel and concurrent programming is hard. But necessary.
Comment: "Just one thread" can mean several things - you could use delimited continuations to simulate cooperative multitasking within a single (OS or green) thread, for instance.
Comment: Threads may make it easier, but all of the tasks that you mentioned can be done without threads, and indeed used to be.  For instance, the canonical GUI loop used to be while (true) { process GUI events; compute a bit}.  No threads needed.
Comment: Sure, but I'm giving a little context to the question @Frank +1 for the tip.
Comment: There are single-process single-threaded webservers. lighttpd for example, or thttpd, or nginx (though the latter can run more than one process, but the default is one. It also is always single-threaded). They have absolutely no problem serving more than one user.
Answer: Multi-Threading can let the GUI interface still be responsive during long processing operations.  Without multi-threading, the user would be stuck watching a locked form while a long process is running.
Comment: That's not entirely correct. In theory, you could split your long operation into many smaller ones and update event processing in between.
Comment: @Sebastion N. But if the long process can't be refactored into smaller ones?  The ability to run the process in another thread can free up the GUI thread (the main thread) to still be responsive.
Answer: Multi-threaded code can deadlock the program logic and access stale data in ways that single threads cannot.
Threads can take an obscure bug from something an average programmer can be expected to debug and move it into the realm where stories are told of the luck needed to catch the same bug with it's pants down when an alert programmer happened to be looking at just the right moment.
Answer: apps dealing with blocking IO that also need to remain responsive to other inputs (the GUI or other connections) cannot be made singlethreaded
the addition of checking methods in the IO lib to see how much can be read without blocking can help this but not many libraries make any full guarantees about this
Comment: They can be single threaded (and often were).  The code tells the kernel to start some IO, and gets a signal when it completes.  While waiting for the signal, it can do other processing.
Comment: @keith that's _non_ -blocking IO I specifically said blocking
Comment: But why would you do blocking IO if you want to remain responsive?  Is there any blocking IO that generally doesn't have a non-blocking alternative?  I can't think of any.
Comment: @keith java's RMI is blocking and while you can implement a callback (but that creates another thread) with it but that can be blocked by firewalls
Comment: That sounds like a limitation of Java RMI, not an inherent limitation of single threaded code.  Besides, if you are doing RMI you have a separate "thread" of execution, just on a remote machine.
Comment: -1 wrong.  Blocking IO is handled all the time with state engines.
Answer: A lot of good answers but I'm not sure any phrase it quite as I would--Perhaps this offers a different way to look at it:
Threads are just a programming simplification like Objects or Actors or for loops (Yes, anything you implement with loops you can implement with if/goto).
Without threads you simply implement a state engine.  I've had to do this many times (The first time I did it I'd never heard of it--just made a big switch statement controlled by a "State" variable). State machines are still quite common but can be annoying.  With threads a huge chunk of the boilerplate goes away.
They also happen to make it easer for a language to break it's runtime execution into multi-CPU friendly chunks (So do Actors, I believe).
Java provides "Green" threads on systems where the OS doesn't provide ANY threading support.  In this case  it's easier to see that they are clearly nothing more than a programming abstraction.
Comment: +1 - Threads provide just an abstraction for parallelism on basically sequential machines, just like high level programming languages provide an abstraction of machine code.
Answer: OSes uses time slicing concept where each thread gets it's time to run and then gets preempted. Approach like that can replace threading as it stands now, but writing your own schedulers in every application would be overkill. Moreover, you'd have to work with I/O devices and so on. And would require some support from hardware side, so that you could fire interrupts to get your scheduler to run. Basically you would be writing a new OS every time.
In general threading can improve performance in cases where threads wait for I/O, or are sleeping. It also allows you to make interfaces that are responsive, and allow stopping processes, while you perform long tasks. And also, threading improves things on true multicore CPUs.
Answer: First, threads can do two or more things at the same time (if you have more than one core). While you can also do this with multiple processes, some tasks just don't distribute over multiple processes very well.
Also, some tasks have spaces in them that you can't easily avoid. For example, it's hard to read data from a file on disk and also have your process do something else at the same time. If your task necessarily requires lots of reading data from the disk, your process will spend a lot of time waiting for the disk no matter what you do.
Second, threads can allow you to avoid having to optimize large amounts of your code that's not performance-critical. If you only have a single thread, every piece of code is performance critical. If it blocks, you are sunk -- no tasks that would be done by that process can make forward progress. With threads, a block will only affect that thread and other threads can come along and work on tasks that need to be done by that process.
A good example is infrequently-executed error handling code. Say a task encounters a very infrequent error and the code to handle that error needs to page into memory. If the disk is busy, and the process has only a single thread, no forward progress can be made until the code to handle that error can be loaded into memory. This can cause bursty response.
Another example is if you might very rarely have to do a database lookup. If you wait for the database to reply, your code will hit a huge delay. But you don't want to go to the trouble of making all this code asynchronous because it's so rare that you need to do these lookups. With a thread to do this work, you get the best of both worlds. A thread to do this work makes it non performance critical as it should be.


Terraformed Planet

Question: There's a story I'm working on where a retrograde colony is forced to settle on a planet that has been terraformed centuries earlier. This colony has forgotten all advanced technology and live in a medieval state, so I'm trying to figure out if these individuals would encounter any traces of the terraforming that took place, and if so, how these traces would look like. So, my question is if a planet was terraformed by an advanced ancient civilization, would there be any "fingerprints" left behind eons after, and if so, how would these artifacts look like? I already envisioned remains such as machinery or satellites in the sky, but I'm curious to see what other people can come up with.
EDIT: To give more detail, the flora and fauna of the planet would be very similar to Earth's - the civilization who did the terraforming are human, just as the colonists are, so they both originate from our solar system. I'd imagine the terraforming mostly consisted of introducing plants as well as bioengineered animals that shared similarities with the extinct organisms of our own planet. Specifically, the planet is dominated by small reptile-birds and old world mammals.
Comment: This really depends on how terraforming was done. It could have been a semi-natural process lasting millions of years, quick "engineering", with or without bringing new species, or super-quick "planetary cloning".
Comment: Other than they *very obviously* didn't evolve on that world? That the geological record of the world is *very obviously* at variance with present conditions? That everything on that world is young and unsettled? BTW, how was the planet *before* terraforming? Did it have life? What happened to it? How thorough was the terraforming? What did the terraforming specifically consist of?
Comment: So the biosphere will be a mix of native and Earth-based organisms? This sounds like one popular fantasy book series, but just giving the name of the series here would be a big spoiler...
Comment: Oh I'm not sure what series you speak of. The organisms themselves would be derived from Earth-based organisms - none of the organisms would have existed before the terraforming.
Answer: There are a few important factors at play:
How wide spread was the ancient civilization?
If the civilization which teraformed the planet was a global one and its inhabitants just suddenly disappeared, then it would take tens of thousands of years for just the above ground aspects to disappear completely. This wouldn't stop future civilizations from directly coming into contact with evidence of cities, vehicles..etc with a little digging.
This articles gives a decent overview of timelines involved for human constructs to disappear back into the environment: [ https://www.discovermagazine.com/planet-earth/earth-without-people ]
How advanced was the ancient civilization
I'll use our modern civilization as reference...
For a time line of ~ 1000s of years since the ancient civilization there would be abundant evidence everywhere. Especially in arid places, the remnants of buildings and structures would last without losing much of their form.
For a time line of ~ 10000s of years much of the evidence on the surface (except for the largest of mega engineered structures) would have disappeared, but with a little digging (mines for instance) a medieval civilization would most likely come across some form of evidence that they weren't the first civilization. Evidence for the largest buildings and massive concrete structures would most likely be detectable on the time scales of tens of thousands of years if they are not destroyed in a cataclysmic process (glaciers, meteors, earthquakes...etc).
On a time scale of ~ 100,000s yrs almost all traces from the surface would have completely disappeared. Evidence would remain the how the land was changed, but without digging things up, its highly unlikely any surface structures would remain. Advanced medieval civilizations would likely come across buried evidence, however they would lack the knowledge and technology to deduce much about the things they found.
~ 1,000,000s yrs its doubtful that even our current civilization would find much evidence. There would be anomalies (high concentration of radioactive substances or synthesized chemical compounds for instance) but there would be no above ground structures left whatsoever and most buried structures would have degraded completely. Presumably certain large underground structures such as tunnel networks, vaults and radioactive waste storage might still be around but in what form depends heavily on geological activity, especially tectonic movement, and most would probably be unrecognizable to their current form.
If a civilization was more advanced than ours, enough so that they teraformed a planet, it is conceivable that they constructed extremely large machinery (with areas spanning ~ 100s km$^2$) which aided in the teraforming processes and which might be evidenced for much longer than any current structure we have built on Earth.
In the first ~ 10,000 yrs all satellite orbits would decay and they would be burned up upon reentry. The only way I see an ancient civilization leaving anything unattended for ~10,000s or more years with current technology, and still being immediately recognizable to a medieval civilization, is if they intentionally constructed a mega-structure with longevity in mind.
Any form of information transfer (books, hard-drives...etc) as well as common everyday items would be destroyed beyond use within ~100 - ~1000s of years. So while they might come across artifacts depending upon how long the civilization had been gone for, they wouldn't be able to learn much more than that they were not the first.
Answer: Fossil record discontinuity.
The fossil record before and after the terraforming event would be very different.  If there were life forms on the planet before terraforming, those forms might be present in the fossil record before the terraforming and disappear after with new forms appearing.  Or the fossil records might start very abruptly with no fossils before.  One might take that as evidence of Creation which would not be wrong in this case.
Fossil records also contains record of the chemical history of the planet.  For example the Great Oxygenation Event of Earth was billions of years ago, and we can find evidence of it in the form of deposits of precipitated iron, which turned to rust when the oxygen came.

Terraformed Planet


Definition of Hochschild (co)homology of a (dg or A-infinity) category

Question: How do you define the Hochschild (co)homology of a dg category or an A-infinity category? I've only seen it defined when the category is equivalent to a category of modules over a dg algebra; then the Hochschild (co)homology is just that of the algebra. But more generally?
Answer: It's the self-Ext algebra of the identity functor from the category to itself.  So, for an algebra, this reduces to the self-Ext algebra of the diagonal bimodule, since tensor product with that is the identity functor.
Answer: Here's a very explicit answer. You can use a bar complex equally well for $A_{\infty}$ categories and $A_{\infty}$ algebras.
Thus consider $\bigoplus_{k=2}^{\infty} A^{\otimes k}$, put a grading on this as a sum of the number of tensor factors and of the internal gradings (maybe with a shift so we start at $0$), and make this into a complex by defining $d$ to be the sum (with appropriate signs) of all ways to apply an $m_{j}$ (from the original $A_{\infty}$ category) to consecutive tensor factors.
Now take coinvariants and homology.
Answer: The appropriate general notion is that of Drinfeld center, see http://arxiv.org/abs/0805.0157.
Answer: Maybe this answer comes five years too late, but I have recently put an elementary construction of the Hochschild (co)homology of $A_\infty$-algebras on the arXiv:
http://arxiv.org/abs/1601.03963


Robin Hood app as a highschooler

Question: I'm about to enter my senior year as a highschooler and was wondering how beneficial it would be to start investing in a app for robin hood. I could invest a thousand or so and was wondering if it would be worth it
Comment: yeah I have alot saved up and was only planning on investing a small amount
Comment: Investing early is always good, but unless you have 50K+ in cash to invest or wish to invest as a hobby, I would suggest using vanguard and buying market index funds that provide instant diversification.
Comment: Be aware that Robinhood (as will other brokers) will require you be 18 to sign up.
Comment: Do you mean investing in an app _for_ RobinHood (meaning someone is building an app and is asking you for money), or investing in the stock market _using_ RobinHood?
Comment: Do you have an emergency fund?  You're "only" in HS, so don't *need* one, but it's good to get in the habit of always having some cushion.  (For example, you wreck the family car and need to come up with at least a part of the deductible.)
Comment: Excellent!  You should also think about opening a regular brokerage account at a low cost brokerage company.  That's because investing in stocks is **not** about the cool stuff like buying and selling, but boring stuff like doing research and holding on to what you buy.
Answer: Whether you have $100 or $1 Million, the earlier you start investing, the better. That said, if I were your parent I would add the following conditions:

Make sure you have college expenses covered (if you plan on going to college), either through college savings or through scholarships. The last thing you want to do is borrow money for college because your money is tied up in investments. (Others will say you should borrow as much as possible since college loans are "cheap", but I would strongly disagree)
Don't invest more in any single stock that you are willing to lose completely. A max of 10% of your portfolio is a general rule of thumb for a single stock
Don't invest in anything that you don't fully understand (options, crypto, etc.)
Your goal at this stage is to learn. With $1k it will take you many years to build up a significant portfolio, so use the time to learn what works and what doesn't, and to figure out what you're good at.
Answer: From my experience, I was able to invest in Robinhood while I was in college, and it is a great starter investing app if you are looking primarily for specific stocks. With saying that, you need to know lookup and research the certain stocks you want to purchase. This was the hardest part for me, since I did not have the time to do that. I then came to my senses and just put my money into a brokerage mutual fund. I believe being that young of age you should put your money into a mutual fund and have the professionals do all of the work. It will save you time, and money once you see how much money you can actually lose by choosing the wrong stocks. But, if you do decide to invest with RobinHood, stay away from the cheap stocks and don't put all your eggs in one basket.(all money in one stock). A thousand dollars might seem like a lot at first, which in High school it is, but in reality it is not much. But you have a great mindset on starting off investing early.
Answer: Robinhood is an easy-to-use app and it's what I use for my personal stock investments, I have a separate 401k with my employer.
If I were you I would invest in things you know/care about. Then when you get updated with information on those companies you can be better prepared about your decisions to sell/buy.
One of my rule of thumbs is whatever I invest on the app I have to be ok with losing some/all of it. Investing in the stock market is always a gamble and never certain so be ok/prepared to lose whatever you invest.
If you are interested in less volatile stock options ETF's are comprised of normal stocks, but they are diversified so less volatile than investing in individual stocks. You can look them up in the app and see their track record (last 1-5 years). As an example I invest/ed in SPY, VOO and PXLG.
Good luck investing!
Answer: You need to be honest with yourself about your risk tolerance and go from there.  What you plan to do with the account has some bearing on what brokerage you should choose, but "is it worth it to invest with robinhood?" ... it might be?
How much do you know about investing?  I'm not asking, did you know that if you invested $100 in amazon 10 years ago you'd have $100,000 now (or whatever other anecdote you'd like to use).  I mean, how much do you actually understand about investment?  Where did your $100 go?  What did you get in return?  What was your decision tree before you used your $100 to invest in amazon stock?  If your decision is nothing more than, I'll have millions tomorrow, this is not different than lottery tickets.
Once you have your head wrapped around investment as a general concept you can decide what assets you'd like to own.  The real decision here revolves around when you'll need to spend these assets.  You can't buy dinner with 0.03 shares of Tesla.  At some point these assets will be turned back in to cash and spent, so you have to come to a real decision about how long you can be without this money.  Make sure you have enough of a stable buffer that you'll be able to sell when it makes sense for you to sell, not because you need money.
After you've decided that, yes, absolutely, the proper use for this money is learning about investment, you'll pick your investments.  You'll quickly come to learn that the average market increase over the last 100 or so years is ~11%.  11% on your $1,000 is $110 (less than a netflix subscription each year).  You'll then start rationalizing more risky companies, because how are you going to make any money at $100 a year.  So you'll give a penny stock a try because you can make 50% in one day.  And that's when you should go right back up to the second paragraph and by those lottery tickets, because you're not making investment decisions anymore.
Investing is a discipline.  Rule number one of investing is "Don't lose money," it is certainly not "make as much money as you can."  You want to make an appropriate return for the given risk.  What did I do when I started years ago, I deposited some money and split it between common stock of three companies.  I think playing with play-money accounts is a waste of time because I have no retention if I have no skin in the game.  I did some research, I made my picks and the rest is history.  IF this is money that you could literally set on fire and you are being honest that this money is essentially "learn to invest tuition" then yes, do some research and make your picks.  If this is, "I just want some stock market exposure" go to Schwab or Vanguard or some other big established discount broker and buy the lowest cost index mutual fund you can like SWTSX.
It's admirable that you're so young and interested in investing and have built up your warchest.  Positive investment returns are not a guarantee.  The market is not guaranteed to go up.  GE is one of the country's oldest and most stable companies, it has lost 50% in the last 12 months (in fact, it's also about -50% over the last 20 years).  That's minus $500.  If, after you research, you decide that it's appropriate for you to put all 1,000 of your dollars in to one company's stock, then that's fine.  But make that decision with your eyes open and remember the first rule of investing.
Answer: Robinhood is great in that it's commission free but there are downsides to using it. It can be great for getting a basic understanding of how the stock market works, and the dangers associated. Robinhood even offers a somewhat limited version of margin trading if you deposit at least $2000. This will let you trade on credit so you can open bigger positions, but what they don't tell you is that they will sell off your position if you don't deposit more money in the likely event that the stock falls below a certain value.
I recommend paper trading as a first step to learning to trade. It will allow you to become familiar with the process of buying and selling as well as letting you test out different investment strategies without the risks of putting actual money on the line.

Robin Hood app as a highschooler


What is the difference between "Como estas" and Como estás"

Question: What is the difference between Como estas and Como estás with an accent??? Does it mean something else???
Answer: First of all, I'd like to say that it'd be better if you write the whole sentences, just to get the context.
However, I'll try to translate them both literally:

Como éstas => like these ones
Ex: Yo también tengo unas zapatillas como éstas.
Como éstas => eat these ones
Ex: Tú te comes esas patatas, yo me como éstas.
¿Cómo estás? => How are you? (You have to write the graphic accent
  since it's a question)
Como estas => like these
Ex: Tus pulseras son tan bonicas como estas diademas.
Comment: 5. Como estás => how you are
Comment: Be aware that, according to current ortography rules, writing *éstas* is no longer recommended. Cases 1. and 2. should be *Como estas*.
Comment: Great anwser and <3 "bonicas" xD (I guess i can "xD" instead of "lol" here :D)
Comment: I agree with serfe 100% I'm not up-to-date on the rules of the Royal Academy of the Spanish language, but it makes sense to differenciate using the accent mark in serfe's second example.
Answer: Cómo estás is:
"how" + the informal conjugated form of estar; the unshortened phrase is ¿Cómo estás tú? Note the accent in "cómo¨ which is placed due to this being a question.
"How are you?"
===========================================================
Como estas is:
"how/like" + "these"   ... followed by a feminine plural object. (Likewise for example, como este would be "how this" followed by a masculine singular noun.)
So this would be part of a larger sentence typically.
===========================================================
Also, with the accent like so:
como éstas   <-------- "how/like" + "these", same as above, except éstas with the accent is a pronoun and stands in for the object


What does "head first" mean?

Question: There are a serial programming books whose names begin with head first such as Head First Design Patterns, Head First Java, etc.
I'm not a native English speaker. What does head first mean here?
Answer: "Head first" in this case means you start putting theory into practice almost immediately. More generally it means doing something without hesitation, and it can also literally mean "the head reaching some point first".
In your case, your books mean to say that they will get you coding almost straight away, without long introductions to theory.
In computing, "head first" can also mean you code the declaration first  -that is, rather than actually code logic on how to do something, you say "A piece of code called X exists/will exist" and come back to it later after you have finished declaring everything else. However, this usage is unommon, and I'm sure your books don't mean it in this sense.
Answer: binderbound is right.  This metaphor comes from swimming.  You can cautiously wade into the water ... or you can dive in head first
Comment: Head first is even stronger than what your picture shows, here you have "hands first".
Answer: You can see, in the explanation below, that the original authors of the first book in the Head First book series are focused on stimulating the readers' brain, neurons, and imagination, creating new mental pathways and connections, all using strong story telling and visualization techniques. This is all underpinned by a process called metacognition, which is a mind and knowledge related process.
So, Head First is a catch phrase that captures the essence of their technique, which is focused on the mind (the head).
This use of the phrase head first usurps an already well known phrase that has a different and often more literal meaning outside of its usage for this particular book series.

Here are the details:
Wikipedia has a topic titled Head First (book series). You have to first recognize that this has become part of a catchy title phrase chosen by the original authors, Bert Bates and Kathy Sierra, stating with their first book in the series, Head First Java in 2003.
They apparently chose this catch phrase to be consistent with their teaching concept:

The main idea of the series is to effectively stimulate the brain by:
  - Telling stories
  - Visualizing
  - Using attention-grabbing tactics: page layout, non-standard examples, puzzles, jokes, and other means.
By using metacognition the series' authors and editors try to employ varied methods to present information and accelerate the learning process.

When you pursue the article further, you find a reference to Head First Labs, "where books of the series are presented and the main idea behind the series is explained."
You can go to their About page, where it says:

Learning isn't something that just happens to you. It's something you do. You can't learn without pumping some neurons. Learning means building more mental pathways, bridging connections between new and pre-existing knowledge, recognizing patterns, and turning facts and information into knowledge (and ultimately, wisdom).

On that same page, they also highlight some of their favorite books under the headline Brain Power, another head-focused metaphor.
Answer: Head First - Brain-Friendly Guides, and per Bert Bates (the creator of the series)

My goal with a Head First book is to write the book that I wish I'd had when I was first learning a topic.
Answer: The series tries to activate your brain before it can pump something into your head. It uses pictures and various other easy to recognize charts for easy learning. It could be named brain first to be more in line with diving.
Answer: The other answers are focusing narrowly on the meaning of "head first" in the titles of these books.  The idiom is widely used without reference to cognition, to mean "enthusiastically", "without hesitation" or "energetically".
For instance, "Jane had never heard of the Canadian dish poutine, but the aroma enticed her to dive into it head first."   It means that Jane ate it enthusiastically, not hesitating as many people might do with a new food.

What does “head first” mean?


How do I verify that a DFA is equivalent to a NFA?

Question: I'm learning how to convert NFAs to DFAs and I want to make sure I'm doing it right. Obviously, going back in the other direction isn't a thing. Does anyone know of an algorithm to check that a DFA is equivalent to a NFA?
Comment: One candidate interpretation: is there a "result checker" (in the sense of [Wasserman and Blum](https://www.cs.cmu.edu/~mblum/research/pdf/fourier.pdf)) for the problem of converting a NFA to a DFA?  In other words, is there an algorithm that is asymptotically faster than doing the conversion itself, that given an alleged (input,output) pair for the conversion-algorithm, checks whether the output is correct?
Answer: This is a problematic question. There is a way to check equivalence of automata, which I'll now explain, but I'm afraid it won't help you, as you will see at the end.
Recall that two sets $A$ and $B$ are equal iff $A\subseteq B$ and $B\subseteq A$ (this is the definition of set equality).
Thus, it is enough for you to verify that $L(D)\subseteq L(N)$ and $L(N)\subseteq L(D)$, where $D$ and $N$ are your DFA and NFA, respectively.
But how do you check containment of languages, you might ask. Well, now observe that $A\subseteq B$ iff $A\cap \overline{B}=\emptyset$ (where $\overline{B}$ is the complement of $B$).
Let's consider first checking whether $L(N)\subseteq L(D)$. To do this, you need to complement $D$ (very easy - swap the accepting an rejecting states), then construct the intersection automaton (e.g. with the product construction) with $N$, and check for emptiness, by finding a path to an accepting state.
The converse direction, however, will show why this doesn't help you. In order to check whether $L(D)\subseteq L(N)$, you need to complement $N$. But in order to complement an NFA, you first need to convert it to a DFA, rendering the whole idea pointless.
Essentially, the problem with your question is much deeper: you want to verify that you (an undefined computational model) executed a well-defined algorithm properly. So this is not really a computer-science problem.
I will say this: following the constructions I suggested, it is not hard to conclude that $L(D)\neq L(N)$ iff there is a word of length at most $2^{2n}$ ($n$ being the number of states of $N$) that is accepted by one and not by the other. So you can try all words up to this length.
Comment: Unless your NFA is big (e.g. with more than 7-8 states), your best option is probably to just check yourself carefully. Typically, after removing non-reachable states, you get a small DFA, and checking manually is not too hard.
Comment: Can't you determinize and minimize both machines and check if the two machines are isomorphic ?
Comment: Thank you for the well-thought out reply. I learned something new today. It sounds like my best bet is to just compare my work against JFLAP.
Answer: One way to proceed is to convert the NFA to a DFA and then check the equivalence of the two DFAs, for which there is a linear algorithm [1].
The following paper treats the more general case of the equivalence of two NFAs (which of course also applies to your case).
Filippo Bonchi, Damien Pous, Checking NFA equivalence with bisimulations up to congruence
Principle of Programming Languages (POPL), Jan 2013, Roma, Italy. ACM, pp.457-468, 2013.
Abstract.
We introduce bisimulation up to congruence as a technique for proving language equivalence of non-deterministic finite automata. Exploiting this technique, we devise an optimisation of the classical algorithm by Hopcroft and Karp [1]. We compare our approach to the recently introduced antichain algorithms, by analysing and relating the two underlying coinductive proof methods. We give concrete examples where we exponentially improve over antichains; experimental results moreover show non negligible improvements.
[1] J. E. Hopcroft and R. M. Karp. A linear algorithm for testing equivalence of finite automata. TR 114, Cornell Univ., December 1971.
See also the web appendix to this paper, which contains Coq proof scripts of the results, a link to an implementation and an interactive applet.
Comment: @aprogrammer The main part of my answer is a reference to an algorithm for which a Coq proof script is available, which is certainly the safest checking method I can think of.
Comment: I'm not sure what someone unsure about his understanding of a simple algorithm like the NFA to DFA one will do with a Coq proof script.  This looks like using algebra to solve the math problem of a third grader.
Comment: _One way to proceed is to convert the NFA to a DFA_, the goal of the poster is to verify the result of that algorithm.  Applying twice is indeed one way but not immune to misunderstanding of the algorithm.  That's probably why a checking method was asked.
Answer: this question is more about applied software testing and verifying correctness in practice rather than a theoretical question.

if you have other code to compute intersections and complements (and empty DFA languages), you can use the idea that $D_1 \cap \bar{D_2}$ and $D_2 \cap \bar{D_1}$ are both empty where $\bar{D}$ is the complement.
you can rely on prior tested software that has been tested to validate your results. eg AT&T FSM library
another idea: randomized testing. pick random strings within your language. determine if the strings are accepted or unaccepted by the DFA/ NFA. if the two are not equal, with high probability you will find strings that mismatch.
another idea: you can write code to traverse all branches of the DFA and NFA to some particular depth and look for mismatches. this is equivalent to enumerating all potential accepted strings of given lengths.


Tips for writing proofs

Question: When writing formal proofs in abstract and linear algebra, what kind of jargon is useful for conveying solutions effectively to others? In general, how should one go about structuring a formal proof so that it is both clear and succinct? What are some strategies for approaching problems that you will need to write formal proofs for?
Comment: Favour words over symbols.
Comment: Read books written by good authors and try to emulate their style.  For abstract algebra, Gallian's _Contemporary Abstract Algebra_ is hard to beat.  As the answer below states, pictures are often very helpful.  Pedro's advice is wise.  For a long proof, try to break it up into steps, like you would a computer program.
Answer: That is a mouthful of questions.  There are no definitive answers, but here are some ideas:
Being clear and succinct:
First, when you write your proof, make sure you define your terms, and your symbols.  Don't make your readers scramble to look up terms.  And if someone doesn't know what $\phi (a)$ is, how is he supposed to find out?
Of course I'm not suggesting you define things like "a group of order 15".  This really is standard.  If your reader doesn't know what a group is, he should read elsewhere.  But I've had recent encounters with words like "unicity" (does he mean uniqueness?).  What does the symbol dL/dT.L mean?  Maybe it's standard somewhere, but I've never seen it.  If there is any doubt, define what you mean.
Next, settle on a clear scheme for your notation.  If you have two vector spaces V and W, maybe your V vectors should be {$v_1, v_2, ... v_n$} and use w's for the W space.  Why use a's and b's?  Yet some people do.  Worse, they change the notation in midstream -- a guaranteed way to confuse people. Then there are the writers who reuse symbols and assign them different meanings later in the proof.
I would add that personally I am not a fan a Greek letters, if only because they are a pain to type; but they can be hard to read also.  However, if you have an "A" and "a" that are related and want to introduce an $"\alpha"$ that is also connected, that makes sense.
Once you've figured out your proof, think of writing it as if you were trying to explain it to a bright high school algebra student.  Write down each step and at least on the first draft don't leave out any steps.  Make sure you explain properly how you get from each step to the next.
As with defining your terms, this requires some judgement.  If you write "x + 3 = 6 so that x = 3" you don't have to explain.  If you write "a group of order 15 must have subgroups of order 5 and 3" whether you explain depends on who your audience will be.  If it is a conference of group theorists, you can skip the explanation.  If it is a 1st course in group theory, you probably should include it.
Begin by erring on the side of including more rather than less explanation. Note the word "begin".  Clear, succinct proofs to not spontaneously spring into life.  They are usually the result of several careful, attentive drafts. If I'm writing seriously I usually plan on 4 drafts.  This is true even for material that has nothing to do with math, which people manage to misunderstand anyway.
Do not skimp on drafts, but put each one away for awhile before starting on the next.  Then reread what you did with a newly critical eye. What would your supposed high school student think?
Finally, if you have a lot of explanation that is impeding the flow of the proof, move some of it to footnotes.  That way people can follow your argument without getting tangled up in the details.  If they really want the details, they'll read the notes.
How to approach:  Many books have been written on this endless subject. I can't write a book but here are some ideas:
A.  Make sure you understand what is being asked.  Do you understand the definitions?  How are you going to prove something about independent vectors if you don't know what "independent" means.
B.  Start with some simple examples.  You have a problem in $R^n$?  Can you solve it for $R^2$?  Many such solutions do not really depend on the 2 and will generalize immediately.  You have a problem about groups?  Can you solve it for a cyclic group? For an Abelian group? For $S_3$?
Someone once accused me of thinking all matrices are diagonal.  I don't really think that, but if I can solve it for a diagonal matrix, maybe I can solve it for a diagonalizable matrix.
Once you see how things are working in a simple case, you may get some insight into what is going on. Or maybe you can piggyback on your special case -- show that the difference between that and the general case doesn't affect things much.
And starting with a special case is time-honored.  Many important papers have proved only a special case of what is really desired.
C. Develop a big bag of techniques. There are things that are used over and over,  homomorphisms, isomorphisms, linear operators, basis, adjoint etc. etc. Start with the common techniques.  Work a lot of problems involving these techniques.  Someone said that if you have a hammer all problems look like a nail --well not everything can be solved with an isomorphism (I wish it could). How is that for a mixed metaphor?  Avoid them in your papers.
The more problems you work, the more techniques you will know.  You can never know too many.
There is no short cut to this.
Answer: This is a quote from a book called Visual Complex Analysis by Needham
"The basic philosophy of this book is that while it often takes more imagination and effort to find a picture than to do a calculation, the picture will always reward you by bringing you nearer to the Truth"
I find that a picture whenever possible always helps and never hinders.
Comment: +1. *Never* is a bit strong, but pretty nearly true.
Answer: You might find this useful: Halmos on Writing Math
Comment: I get a 404 on this URL
Comment: [This link](https://www.mathematik.uni-marburg.de/~agricola/material/halmos.pdf) works.
Answer: In general, a good proof is one that the intended audience can verify with complete certainty. In other words they should not have to ask any questions to be fully convinced of its correctness. Personally, I would also prefer a proof that is well-structured and does not need one to maintain in the head the current context (analogous to the scope of a statement in a computer program) but explicitly displays its structure, because it prevents mistakes and makes verification easy.
Answer: I found these series of video lectures informative about how to write proofs.
Specifically its good for beginners on how to start writing a proof.
Topology Without Tears - Writing Proofs in Mathematics
Even if it comes with a book about topology its about writing proofs in general.
Answer: For me the keypoint is this: Reflect what you are thinking when reading proofs of others and what the original proof writer had needed to do in order to you to understand the proof better/faster (and if you understand something exceptional fast, how did the proof writer achieve that?).
Regarding prose: Thinking is sequential, you cannot think simultaneously. This is why correct use of prose can help much. To demonstrate what I mean, I use an example (from here). Consider two different proofs to the following statement:
Demonstrating Example (pay attention on how you are thinking ):
Let $a,b$ be integers. If $a|b$ and $2|a$, then $2|b$.
Symbolic Version:
Let $a,b$ be integers.
$\left. \begin{eqnarray}
a|b \implies b = a k \\
2|a \implies a = 2j
\end{eqnarray}  \right \}\implies b=2jk$
So $2|b$.
Prose Version: Let $a,b$ be integers. By hypothesis, $a|b$ and $2|a$. Then the definition of divisiblity tells us that there is an integer $k$ so that $b=ak$ and another integer $j$ such that $a=2j$. By substituting $a=2j$ into the equation $b=ak$, we get $b=2jk$. Since $j,k$ are both integers, the product $jk$ is also an integer. Therefore by the definition of divisiblity again, we have shown that $2|b$.
Reflecting the example:

You probably searched the symbolic version to find the necessary steps to come to your conclusion (as this example is very easy, these steps seemed very short). This search process probably resulted in the same train of thought, the prose version presented. Then why don't just skip the search process and directly read the way as given in the prose version ( less expense).
In contrast to the symbolic version the prose version describes at a meta-level what is done and directs you, e.g. we were "substituting" (of course this is very easy to see in this simple example, but as growing more complex, you will appreciate those directions).
For some people this is also more easy to read, because it reminds them of reading a novel (this is probably ultimately caused by the first point).
Maybe you think that the prose version contains much overhead caused by "natural words". But look again: Good math prose is concise/functional. "Let", "be integers", "and", "by hypothesis", "then", "the definition of divisiblity", ... all convey a precise message for the train of thought in the proof. Some of those words will become keywords, e.g. if you see "then", you will interpret it as you do with "$\implies$" ("$\implies$" maybe seems to be more direct at first, but that's caused because you directly mapped the math meaning to that symbol. "then" already had a ["non-technical"] meaning beforehand, so mapping that math meaning to that symbol/word will maybe take slightly longer).
Last aspect of this point: Mentioning maybe your most criticized overhead phrase: "tells us that there is". a) Lateron you won't read it letter by letter or word by word, you just see the phrase (read it very fast as one semantic module ), b) "tells us that there is" reduces your thinking expense. Did you ever made notes only using some words without making real sentences? You probably notice, that after some time, reading those notes will take long because you need to think about the connection of the "staccato phrases". Same applies here.

Writing good prose:

When you read your proof and and it  feels like "Staccato phrases", consider changing your writing style to fix that (e.g. no equations in the beginning of a sentence and starting with "The equation [...]" ,...).
Write only as much prose as necessary (concise) and use standard phrases and variable names ("Let",... ; $n$ for $\mathbb{N}$, ...). Choose different looking variable names to prevent mix-up.
Show the structure of your proof in your formatting: Indent coherent subproofs (lemmas), align simlilar parts (e.g. "integer $k$ such that $b=ak$ and", underneath "another integer $j$ such that $a=2j$).
Draw a visualisation (potentially using [faster understandable] colors), if possible. This does not only help the reader, it also helps you to get a better comprehensive overview over your proof.
When writing complex proofs, consider demonstrating lemmas with examples.

Note:

A proof is almost never written directly. Consider writing down some examples, draw a visualsation, look up some definitions, look at the "tricks" of already seen proofs, make a few attempts, ... (maybe use a thin mechanical pencil and a rubber ).
Mind your readers' memory limits: Try not to introduce to many objects/variables, when they are not necessary. Condense your logic to (known) concepts (e.g. boundness, uniqueness, existence). Be consistent and adhere to habits (e.g. writing set variables capitalized).
And finally more general: When you think, you don't progress in getting the idea of an proof, don't just look up the solution. Try it just a bit more, mind the "1." point, sleep, and when you finally look up the solution, feel inspired by the tricks you recognise and add them to your repertoire.

If you have additional ideas for good proof writing, feel free to comment.
Happy proof writing :)!

Tips for writing proofs


'Grid-like' diagonal sculpting?

Question: I'm new to sculpting in blender and I've came across this problem where any diagonal sculpt that I add to my cylinder looks 'grid-like'. However, horizontal and vertical sculpts are fine. I've tried to find solutions online but seemed few have discussing about this issue. Is there a way to make the diagonal sculpt smoother? The cylinder was divided 6 times up to a few million polycounts already. Any help is appreciated.
Comment: That "grid-like" are polygons which started to be distorted a bit and corrupt shading of the mesh. The edge flow of the edges composing those faces doesn't correspond the curvature of the bulging sculpt..
Comment: Judging by how many vertices you already have I'm guessing this isn't for real-time rendering. If you don't have  a super computer and cannot afford to subdivide anymore, you might find that with the sculpting option "Dynamic Topology" in the left toolbar during sculpt mode you can add geometry specifically where you sculpt on the mesh. If you think that works as an answer just let me know and I can put it in an answer.
Answer: Try enabling Dyntopo and turning the Detail down. Dyntopo adds geometry as you sculpt, and lower detail means smaller pieces of geometry, hence more detailed. In the image below, the bulge to the lower right has the default level of 12.00, 5the one to the upper right has 0.50 and the one to the left has 2.00.
Comment: @Mr.Benson Dyntopo creates new geometry as you sculpt it; Multires subdivides whole mesh evenly, increasing polycount which allows sculpting. What do you need to do with both Mutlires and Dyntopo ? Aside from drastic increasing of polycount that isn't going to help you.
Comment: Using dynamic topology did helped solving the 'grid-like' sculpting problem. But now my polycount for rendering increased greatly and my blender lags constantly, is there a way to apply both multiresolution and dynotopo together?
Comment: @Mr.Benson I just tried, and it seems the Multiresolution modifier is not supported in Dyntopo. I rarely sculpt, and even more rarely use the multires, so I can't say if there's workaround.
Comment: I'll try different options, but still thank you so much for your help!

'Grid-like' diagonal sculpting?


How do 2 PCs learn each other's IP addresses for ARP resolution?

Question: So, if one PC will use another PC's IP address for ARP resolution, how does the PC sending the ARP Request even know which IP address to call for in the first place? What happens in a scenario where the PCs are directly connected (i.e. there is no intermediary network device like a switch)?
Comment: `how does the PC sending the ARP Request even know which IP address to call for in the first place?` - Well why would one PC send an ARP in the first place, why would a PC ever need to know the IP of another? To connect to that PC of course! I open my browser an tell my computer `I want to connect to www.google.com` so my PC has to ARP out for my default-gateway so start the process of DNS resolution and eventually TCP connectivity to a web server.
Comment: @jwbensley I'm asking _how_ ARP resolution is performed, not _why_ an IP address is necessary (see this https://serverfault.com/questions/410626/why-couldnt-mac-addresses-be-used-instead-of-ipv46-for-networking for an answer to the latter question). See the responses below for a better idea of what I'm looking for.
Comment: You could improve your question by editing it. You may find our [Question Checklist](http://meta.networkengineering.stackexchange.com/q/292/33) helpful when editing your question. I am tempted to cast a close vote for either "unclear what you are asking" or "too broad" as you seem to be mixing concepts. Why do I think it is unclear: you ask about ARP, but then you ask how IP addresses are learned, which has nothing to do with ARP. Why do I think it is too broad: it is almost vague enough to fall into a "how does networking work" type question as it stands.
Comment: @YLearn I asked about IP addressing as a further question in remark to somebody else's answer. That has nothing to do with the initial question. Thus, I'm quite scrambled as to why you would want to close it. Perhaps you misunderstood the difference? It would also be helpful if, as a moderator, you referenced such extensions on an answer given by users. For example, were you referring to JJ or Pieter's answer?
Comment: @logsofrhythms, from the title and body respectively: "*learn each other's IP addresses*" and "*which IP address*" clearly show you are asking about how the IP addresses are found. Yet you mention ARP more than anything else and use the [tag:arp] tag. Ultimately the question has **nothing at all to do with ARP** which is why the question is unclear and causes confusion to people who read it.  This confusion is why you got the two answers you reference (that mention ARP a total of once between them) and one that addresses ARP only. Your concepts are mixed and what you are asking is unclear.
Comment: @YLearn Please do not engage in argumentative behavior that does not resolve the question at hand. This can be grounds for demotion as a moderator at Stack Exchange.
Comment: @logsofrhythms, I am not being argumentative. And the issue is the "question at hand." As it stands, it is unclear and I am trying to point out how your question is unclear, giving you a chance to improve it. If you feel my comments are inappropriate, please feel free to use the [Contact Us](http://networkengineering.stackexchange.com/contact) link at the bottom of the page and ask a SE staff member to look into it.
Answer: You're correct in thinking that the two machines will have no way of knowing each other's IP addresses initially, and there are a few different ways in which this problem can be solved.
In a directly connected scenario in a home network with windows PCs, chances are that NetBIOS will be used for name resolution. You can find out more about this protocol in the appropriate RFC, here: https://www.rfc-editor.org/rfc/rfc1001
You can think of this as working in a similar way to ARP, insofar as the computer who wants to find out the IP address associated with a certain name will send out a broadcast message to every device on its subnet to find out if any of them have the name in question.
Once the target device has replied, the original machine then knows which IP to use for this name, and also vice versa, since the NetBIOS broadcast contains the same information about the sender.
There's good answer with details about NetBIOS here as well: https://serverfault.com/questions/352305/why-can-windows-machines-resolve-local-names-when-linux-cant . I don't know much about apple devices, but I believe that they use a similar protocol called "bonjour", although someone may correct me on this, and on linux, you're likely to come across Avahi (http://www.avahi.org/) as the solution to this problem.
In a non-windows situation, or in a large business network where NetBIOS is likely to be disabled because of security concerns, name resolution is likely to be controlled via DNS. Servers may have their DNS server addresses hard coded, and workstations are likely to receive their DNS server information via DHCP. Quite often the DNS and DHCP servers will be running on the same host.
DNS is pretty complicated. If you want to REALLY understand how it works, the rfc is here: https://www.ietf.org/rfc/rfc1035.txt , however the wikipedia article is probably good enough for a basic understanding.
The basic idea though, is that if a computer doesn't know what IP address is associated with a given name, it can ask it's DNS server. Assuming that your network is set up correctly, when a DHCP lease if given out, or a static IP address is assigned to a machine, a DNS record should also be created on the DNS server.
Finally, most operating systems have a "hosts" file, which contains a list of names and associated IP addresses. If there is an entry in this file for a given name, then the OS will just use that IP address and be done with it. On a windows machine, this is located at C:\windows\system32\drivers\etc\hosts. By default it's pretty empty, you just have one entry mapping "localhost" to 127.0.0.1.
Comment: Ha, I always wondered why I had to enter a computer's host name when initially configuring a host! So, if I have this right, then the computer's host name is used by NetBIOS for a NetBIOS name and through NetBIOS name resolution, a PC can learn about the IP addresses on its subnet with which it may use ARP resolution to learn their MAC addresses as well?
Answer: The ip is configured into the application that does the connection as either a dns name(resolved to ip via dns server) or as a IP static IP.
There are also auto-discovery protocols that utilise broadcasts and multi casts to advertise and find services. e.g. avahi
If pc's are auto configured using DHCP, the dhcp lease includes information such as DNS server ip, GW-ip, and can even include additional auto configuration information.
Answer: Your initial question seems to be about name resolution, but on your comment bellow you ask

How ARP resolution is performed.

I'll try to address that question.

A brief explanation of ARP resolution
When a network device needs to find the MAC address of an IP it will send a packet with destination MAC address FF:FF:FF:FF:FF:FF.
This is considered a broadcast mac address so the switch will simply flood the packet to all ports (if vlans are used then only to the ports belonging to the same vlan).
The broadcast packet is an ARP Request message, essentially asking every device on the network 'Who has this IP?'
All the devices will receive the ARP Request and the one that has the IP configured will reply back with an ARP Reply message from its MAC Address to the device's MAC address that sent the ARP Request.
So it receives the reply and adds the IP <> MAC pair to it's ARP table cache.
For as long as the entry is in cache, whenever it needs to communicate with that device it will know how to send the packets directly to its MAC address.
If the entry is expired, it will re-sent an ARP Request message and the process starts from the beginning.
This is a very crude explanation of course. There are many tutorials explaining this in great detail.
With a quick google search I came up with a nice one with graphs and all :)
http://www.omnisecu.com/tcpip/address-resolution-protocol-arp.php
http://www.tummy.com/articles/networking-basics-how-arp-works/
Now, to answer your question regarding 2 devices directly connected, the same principle applies in that case too.
ARP resolution works the same way weather it's a direct connection or using a switch with tens of devices.


Can a friend (fellow passenger) take my baggage on a connecting flight that I am unable to board?

Question: I've booked a ticket to fly from India to Kelowna, BC, Canada. My roommate and I are flying together. I have a stopover in Vancouver and due to some emergency I won't be able to catch the Kelowna flight. My roommate is going to be in the flight though. Is there any way that my baggage goes along with my roommate, as those are heavy and I won't be able to carry them with me? Due to some urgent reason, I have to be in Toronto on the same day, so I'm boarding another flight from Vancouver to Toronto.
Comment: Is this the first half of a round-trip ticket? If so, you have another problem: once you don't fly the Vancouver->Kelowna flight, all the other flights on your itinerary will be cancelled.
Comment: Send your luggage to the final destination as cargo. It is not that expensive, usually.
Comment: It is worth noting that since the Air India bombings, YVR is very strict with regards to matching people to bags and ensuring that bags are not where they shouldn't be.
Comment: if you want to do this, make sure your room mate agrees.
Most people do not transport items for casual friends and even with very good friends they might not want to take the responsibility. Too many people have be caught transporting drugs.
Comment: @Zap Lipton, It's not a round trip ticket
Comment: He really has no problem with it. I'm actually heading for a competition there and me not being there would be very bad for my team, and I wouldn't like to do that to them.
Comment: Many airlines are very cautious over this, due in part to an incident where a bomb was checked-in to the hold by a passenger who didn't board. Can't remember the flight number so can't provide further details unfortunately.
Answer: You are going to have to be careful here - firstly, you must talk to your airline, and not simply abandon the ticket for the last leg, as doing so may result in any return flights being cancelled.
Secondly, only the airline can comment on transferring your luggage to fly under your friend's ownership, unless they check that luggage in as their own from the beginning. Airlines are very hot on not allowing luggage to fly separately to its owner, especially if that separation occurs because of an action or inaction of the owner.
Comment: I think the safest option would be to just store my bags in Vancouver with someone who can pick them up, come back from Toronto to Vancouver, take bag the bags and move to Kelowna.
Answer: Here is how the airline rules said that should be handled:

Split the reservation into two separate ones.
Execute a change on your reservation that removes the leg you won't take. This will incur a change fee (yes, you need to pay extra for not taking a flight you already have paid for). If you don't do that, they will cancel any return flight (google "Hidden City Ticketing" for more info).
Check all your luggage in on your roommate's reservation. If that exceeds his/her allowance you need to pay extra for the excess luggage. You can't transfer your baggage allowance to your roommate.

As you can see, airline rules are written primarily to optimize revenue for the airline, i.e. squeeze as much money out of you as they can. If this is a real emergency, you can try to contact them and explain your situation. The agents have a fair amount of leeway to waive fees and charges, but it's very unpredictable.
DO NOT DO THE FOLLOWING:
Check your bag all the way through to Kelowna and not board in Vancouver. There is a bag with your name on the flight and if you don't show up, they have to unload it from the plane, which is expensive and incurs a delay for the whole flight.
Comment: Wait, don't you have to re-check your bags when entering Canada for the first time?
Comment: If we do have to recheck, I can just take my bags with me and not take the Kelowna flight. That works for me perfectly too. I tried changing the ticket and cancelling but they are charging me more money than the ticket itself. I can get a new ticket in that amount too and there's no point spending so much. Also, I would not miss the flight before notifying WestJet everything first. I just called them and they said they think that my bags will reach Kelowna in this condition
Comment: Maybe the roommate ought, as well, to be able to answer "Yes" to the question, "Did you pack your bags yourself?"


What is the best alternative for tomatoes in chicken curry?

Question: Some peoples do not like tomatoes in chicken curry. What alternative should I use instead of using tomatoes?
Answer: Tomatoes can be a fairly fundamental part of a curry, and attempting to substitute them would change the dish radically. I suggest instead you look for a recipe that doesn't use them in the first place (sauces based on things like yoghurt, slow-cooked onions, or coconut). You could use a similar mix of spices to your favourite tomato based recipe, but it would still be very different overall.
You may find that people like well-cooked and blended/chopped/sieved tomatoes even if they wouldn't like fresh tomatoes cut up and added towards the end of cooking (I'm not keen on nearly raw tomato myself). In this case using tinned tomatoes instead of fresh could be sufficient.
Comment: You can usually substitute tamarind for tomato.
Comment: Tomatillos also make an interesting substitute: https://en.wikipedia.org/wiki/Tomatillo#Tomatillo_as_food
Answer: I have tried adding other acidic ingredients, such as lemon, to compensate for what tomato adds to a curry. It doesn't work with dairy, but it does work with nut-based milks (coconut and cashew are my go-to for curry). It won't substitute anything by itself, but it still helps balance out the flavour profile that's thrown outta wack from lack of tomato.
I have anecdotally observed warm spices we associate with tomatoes can set our expectations to imagine tomatoes where there are none. Try increasing the spices and vegetables in the curry that are common to other tomato sauces as well! Red chili is a safe bet if you're already using lemons to add acidity.
You want to find things that fill in the blanks of missing ingredients, on a case-by-case basis, when you dedicate yourself to substitution. Most creative people are aware of this, but what separates reasonable logic from creative genius is your ability to triangulate with related recipes to find variables you can plug different stuff into. In the same manner, this process can be as intuitive or technical as you want! It's all about consistent practice, experimentation, and proper feedback. That's what I keep telling myself during the process of food magic ;)
Answer: Tomato paste, according to menu, ie 2/3tbl spoons per 500grm meat. Can add a squirt of tomato sauce for that hint of sweet at end before serving.
Comment: Why would you add tomato paste if people don't want tomatoes?