Test data management for automation api testing

Question: Can you help me with some ideas on how to deal more efficent with test data used as precondition for automated api tests? I can't use api calls for creating the data, so I would have to use sql scripts. However, as every test requires quite different test data(data to be inserted in 4,5 tables; more in some cases) I don't know how to proceed to be efficient. I will try to group somehow tests that might use same data and only run the scripts once before that group of tests and delete them after(with @before class perhaps. What are your approaches when you can t use api calls and you have to deal with large data sets? Btw, I'm using java, rest assured, junit
Answer: You can create a CSV file and put your test data in that file. Now, you can read the data from the CSV file and use it in your test case.
Create a CSV file with your test data. I am using the following as an example:
Name,Emp Id,Department
abc,123,xyz

You can modify the data in your CSV file according to your test requirements.
Use the following code as a reference:
public class YourTestClass {

    @ParameterizedTest
    @CsvFileSource(resources = "/your_data_file.csv", numLinesToSkip = 1)
    // Assuming your CSV file is in the resources directory and the first line contains headers

    public void testMethod(String name, int empId, String department) {
        System.out.println("Name: " + name + ", Emp Id: " + empId + ", Department: " + department);
        // Add your assertions or test logic here
        // For example:
        assertEquals("xyz", department);
    }
}

Alternatively, if you have a large list of test data, you can use a CSV parsing library to read the data from the file and store it in a map. Below is an example:
import com.opencsv.CSVReader;

import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

public class TestDataLoader {

    public static Map<String, Object[]> loadTestData(String filePath) {
        Map<String, Object[]> testDataMap = new HashMap<>();

        try (CSVReader reader = new CSVReader(new FileReader(filePath))) {
            String[] headers = reader.readNext(); // Assuming the first line contains headers

            String[] nextLine;
            int index = 0;
            while ((nextLine = reader.readNext()) != null) {
                Object[] rowData = new Object[headers.length];
                for (int i = 0; i < headers.length; i++) {
                    rowData[i] = nextLine[i];
                }
                testDataMap.put("Test" + index++, rowData);
            }
        } catch (IOException e) {
            e.printStackTrace();
            // Handle the exception according to your requirements
        }

        return testDataMap;
    }
}

Use the map in your JUnit test class:
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

import java.util.Map;

import static org.junit.Assert.assertEquals;

@RunWith(Parameterized.class)
public class YourTestClass {

    private String name;
    private int empId;
    private String department;

    // Constructor to receive the parameters
    public YourTestClass(String name, int empId, String department) {
        this.name = name;
        this.empId = empId;
        this.department = department;
    }

    @Test
    public void testMethod() {
        // Your test logic using the parameters
        System.out.println("Name: " + name + ", Emp Id: " + empId + ", Department: " + department);

        // Add your assertions or test logic here
        // For example:
        assertEquals("xyz", department);
    }

    @Parameterized.Parameters
    public static Map<String, Object[]> data() {
        String filePath = "path/to/testdata.csv"; // Update with the actual path
        return TestDataLoader.loadTestData(filePath);
    }
}

With this approach, there is no need to hard-code test data within the code or scripts. Test data can be easily updated in the CSV file whenever any changes occur.


Do post-IPO 'insider' stock lockup periods still apply if you separate from the company

Question: Typically employees and other 'insiders' are subject to a lockup period after an initial public offering, along with blackout periods at certain points throughout the year to curb insider trading.  Would ending employment with such an organization remove the restrictions on selling during said periods?
Comment: What country. Please edit the question and add country tag. The answer would depend on 1. Regulations in place. 2. Agreement with the company. There are quite a few clauses that canbe/are applicable even after termination of employment. It depends on what you have signed.
Comment: In the US.  Nothing relevant to this circumstance is included in the option agreement.
Comment: do you still have access to the insider information?
Comment: This question is absolutely a figurative example, but I would presume that ongoing access to such information would end, given that the subject no longer has information provided by former associates at the organization.
Answer: There are quite a few regulations on "Insider Trading". Blackouts are one of the means companies adopt to comply with "Insider Trading" regulations, mandating employees to refrain from selling/buying during the notified period.
Once you leave the employment:

The "Insider Trading" is still applicable to you as individual. i.e. if it can be established that you had more information than available in public domain before you traded in the stock,
The company may [or may not] impose additional blackout periods depending on your agreement with the company, for a period of time. In your case it looks like its' not there.

So unless there is an urgent need for you to sell/buy the options, wait for some time and then indulge in trade.


How may one go about finding a definite reference to one or more examples of specific criminal cases that were prosecuted by or on behalf of TfL?

Question: According to TfL's official prosecutions policy, it seems as though they may do some of the prosecutions themselves. How could one go about finding examples of such cases that have been prosecuted in such a manner in the past? And what terminology would this fall under if it has happened? Would it be considered a "private prosecution," even though undertaken by a specifically public body?
Answer: The Mayor of London's Revenue Enforcement & Prosecutions Policy says that TfL Approved Prosecutors prosecute 'fare evasion':

on TFL Rail & London Underground, contrary to the provisions of the Regulation of Railways Act 1889 and the TfL Railway Byelaws, and
on  London Buses, contrary to section 67 of the Public Passenger Vehicles Act 1981.

Being summary only offences, dealt with by letter (Single Justice Procedure Notices and Postal Requisitions) and magistrates' court, it's unlikely there will be many (if any) case summaries or judgments freely available online. There are some purportedly real scans of letters online.
Some statistics are available, published in response to Freedom of Information Act requests. See for example Request IDs FOI-0278-2324 and FOI-2301-2223.
Some solicitors' websites may publish case studies that the solicitors use to promote hiring them to help defend against or settle such prosecutions.
The web forum Railforums.co.uk has a section for Disputes and Prosecutions, which comprises people asking what they should do in some circumstances and other people advising them what to do and/or what to expect.
More serious offences such as sexual offences, violence, criminal damage and behaviour that amounts to serious fraud is reported to the police and prosecuted by the Crown Prosecution Service.


What is the current status of Neo in the matrix?

Question: I want to know what is the current status of NEO "The ONE" in The Matrix. Is he dead? Or is he alive? Or is he in some kind of Limbo state? Why couldn't he do some alternate method to defeat the machines.
Comment: See a related question [here](http://movies.stackexchange.com/questions/24965/if-neo-survived-in-the-first-movie-how-come-he-didnt-in-the-third-movie).
Comment: @Walt - Related? *Very related*. These two questions could be paternal twins.
Answer: As discussed in this question - If Neo survived in the first movie, how come he didn't in the third movie?, Neo dies at the end of Matrix Revolutions, protecting Zion and ensuring the future of humanity.
Answer: Since there is going to be Matrix 4, it means Neo is not dead, at least not in any final way.
There is even a leaked image of Neo in his new life/form:

(source)
Comment: from your link: "Though it's teased in the end that Neo will return, it's unclear how both Reeves and Moss will reprise their roles in a sequel." So not very conclusive yet.
Comment: @Luciano as I see it, he will be there for sure, just unclear how exactly.
Answer: At the end of Matrix Revolutions, we see Sati asking the Oracle if they'll see Neo again.
The Oracle answers thinking so.
I think what Neo has become, transcends the definitions of life and death. Neo consciousness can probably appear active again in machine networks.


KHAF runway 30 ODP in the works, appears to be missing a segment

Question: Asked the FAA about this & they replied that the procedure has been redesigned since the one at the link was posted, that the old charts will be removed from the website, and that the newly designed procedure is currently in QC.
A long delayed ODP for runway 30 at KHAF can be found on the FAA website at this link. (Was supposed to be published in 2020, now scheduled for 2023.) The graphical portion is below. The text reads

TAKEOFF RWY 30: Climb to 1100, then climbing left turn on heading 150° and on PYE R-144 to HADLY, then on OSI R-255 to OSI VOR/DME. Cross OSI VOR/DME at or above 3500 before proceeding on course.

My questions are twofold. One is that the drawing indicates intercepting PYE R-144 from the left. This would be a hugely wide turn from 1100' off R30 at HAF. But even leaving that aside, and assuming they just drew it this way to reduce clutter, is it normal to not indicate on an ODP how you are supposed to intercept a radial? If you do a standard rate turn to 150 after climbing to 1100' you will end up well to the east of PYE R-144 on a parallel track (according to my sketch in Foreflight, which shows PYE R-144 having a bearing of 149 there) and never end up at HADLY. Of course this depends on the speed of the plane. But even at 200 knots (below the B shelf here) I estimate a 150 degree standard rate turn (from 300 left to 150) takes ~2 nm of linear distance, far less than the 5 nm or so between KHAF and PYE R-144. To make this work you really need to do something like "climbing left turn heading 190 to intercept PYE R-144". But you can't really tell that from the (misleading) diagram or the text.
ODPs weren't a big part of my IR training, so I'm wondering if this is common and you're just supposed to join the radial however you want to make the procedure work (i.e., using a steep enough intercept so that you join before HADLY).
Comment: Thanks for the update, but it would be better suited as an answer so everyone can see that this has, in fact been answered.
Answer: Asked the FAA about this & they replied that the procedure has been redesigned since the one at the link was posted, that the old charts will be removed from the website, and that the newly designed procedure is currently in QC.
Comment: In case anyone still cares, the SEEMS departure now exists and for piston singles it stinks. Takes you 6 miles offshore. I got assigned it the other day when I said I was departing 30. In the future I'll stick to departing off 12 when I need IFR to get out.


PageSpeed - How to reduce Reduce initial server response time and Eliminate render-blocking to increase page speed

Question: In gtmetrix, I am facing high initial server response time and render-blocking resources.
Comment: Additional DB information request, please.
OS, Version?
RAM size, # cores, any SSD or NVME devices on MySQL Host server?
Post TEXT data on justpaste.it and share the links.
From your SSH login root, Text results of:
A) SELECT COUNT(*) FROM information_schema.tables;
B) SHOW GLOBAL STATUS;    after minimum 24 hours UPTIME
C) SHOW GLOBAL VARIABLES;
D) SHOW FULL PROCESSLIST;
E) STATUS;  not SHOW STATUS, just STATUS;
G) SHOW ENGINE INNODB STATUS;
for server workload tuning analysis to provide performance enhancing suggestions.
Comment: Maybe in the new year you will have time to post the Additional DB information requested for your workload tuning analysis.  Happy New Year.
Answer: These are really two questions, so I'll address them separately.
Reduce initial server response time
Initial server response time is influenced by many things:

Server-side PHP code:
Lots of things can influence this, especially inefficient database calls
like loading entities in a loop (as opposed to loading the data in a batch
using resource collections), or waiting for outside API calls to return.
I recommend installing an APM service like NewRelic on a separate
development environment to troubleshoot if there are any bottlenecks.
Default caching:
Make sure that you are using as much caching as feasible.
This includes using Redis for the default cache
Full page caching:
The best-case scenario is when PHP doesn't need to be used at all to serve
a page. The best is to use Varnish, Fastly, or some other edge cache
that integrates well with Magento 2.  You may also
wish to look into various cache warmer extensions from
third-party vendors, to ensure that your highest traffic pages are
pre-cached frequently.
Server hardware:
Performance problems may be able to be solved by just migrating to newer
or bigger hardware. Magento 2 is a very CPU-hungry beast, and running on
CPU-optimized instances usually yield the best performance for your money
than general-purpose instances. If you can afford it, SSD storage is ideal.
PHP tuning:
Enabling PHP opcache and especially the new opcache.jit setting in PHP 8+
can yield some truly remarkable performance improvements if you aren't
already using them. Note, opcache.jit does not play nicely with some
extensions like NewRelic or IonCube Loader, and it can cause the site to
break, so definitely test new settings on a separate development environment
before implementing them on a production server.

Eliminate render-blocking resources
This is about client-side performance. You want to make sure that any dependencies that are needed to start rendering above-the-fold HTML to the browser are kept small.

Compress and Minify Javascript and CSS:
The best performance comes from creating Advanced Javascript
Bundles, which in my experience, can reduce load times by 50%,
but this can be painstaking to set up.
Use an efficient theme:
Lots of themes load way too much Javascript, adding dozens of
RequireJS dependencies to do things that Magento's core libraries
already provide. Even using Luma as a base theme is pretty heavy.
Many modern sites are choosing the Hyva theme or going
completely headless for this reason.
Avoid Jquery UI Compat mode like the plague: It's a very heavy
library, and you should only load exactly what you need, not the
whole thing.
Use smaller, less visually complex images: Vector graphics like SVG
can be rendered on any screen size and compress great. Large,
full-page ads or videos look great on billboards, but they aren't a
good fit for ecommerce.
Tune product thumbnail sizes: Your theme's view.xml file contains
the standard product image sizes that Magento 2 will create
automatically. Make sure that these match the maximum size that
your design can actually utilize. It makes no sense to download a
500px wide image and have the browser size it down if your CSS
limits the image display area to 80px.
Use a CDN: This is already pointed out by PageSpeed, but it impacts
render blocking as well.
Use efficient image formats: Image formats like WebP can save a
lot of space, and some CDNs can provide this automatically. However,
taking the time to run your high-res images through compression
like Adobe Photoshop's Save for Web feature can also go a long ways
towards making compression good by default. Even the inexpensive
Photoshop Elements has this feature.
Defer JS as much as possible: If you can, lazy-load expensive
Javascript libraries like Google Recaptcha until they are absolutely
needed, like the user focuses a form that uses it. Doing so does
require some coding experience, but it can save significant load
time. The following sample code is from https://dev.to/uf4no/improve-page-performance-lazy-loading-recaptcha-442o,
to illustrate this technique.

Answer: Time to first byte optimization:

Use a PHP profiler to find code bottlenecks. In many cases it's a 3rd-party extension or a poorly written theme file. My personal choice - tideways profiler, it's free the first 14 days or so, it should be enough for an initial audit.
Use Varnish as a Full Page Caching Application (recommended by Adobe).
Do a 3rd-party extensions audit. Turn them off one by one and see if it affects server response time.

Eliminate render-blocking resources:

Move all JavaScript to the bottom. I believe the latest Magento 2.4.6 already does that. If not - find an extension.
Remove unused CSS and JS from all pages. Google Chrome Coverage tab will help, it shows what's being used and what's not. See a screenshot of this site and that 90%+ of stacks.css isn't being used.
Identify critical and non-critical CSS. Critical CSS is what it takes to render above-the-fold content. Inline critical CSS and move everything else to the bottom.

Always test, test, test. Do a cross-browser testing to make sure your layout is OK with all the changes. Good luck!


$pV$ diagram of pure substance

Question: Why does the specific volume of saturated solid state of water decreases with increasing pressure and the specific volume of saturated liquid wrt vaporisation increases with pressure? Can anyone explain this intuitively?
Comment: Intuition is a fairly personal thing. Yours might not be anything like mine. What, specifically confuses you?
Answer: The specific volume of a saturated liquid also decreases with pressure (at constant temperature) as you move into the sub cooled liquid zone. However, along the saturation line, you are also increasing temperature, and the thermal expansion effect wins out over the compressibility.

$pV$ diagram of pure substance


What is a cool topic regarding differential equations that you would suggest for self-studying?

Question: I took a basic course in differential equations and I loved it. I'd like to study them more in depth. However, I'm taking another, more advanced course in a while. For this reason, instead of self-studying what will be surely covered in class, I would like to try and read about slightly more advanced topics, to get a grasp of what cool applications of the theory or more specifics areas of study look like. Is there any topic about DEs that caught your attention, struck you as beautiful and, ultimately, would be relatively fun for an undergraduate to try and tackle, if even a little, just to see if they're really my thing?
Comment: Try VI Arnold's Classical Mechanics text (or Goldstein's), Winfree's biology text, Weibull's Evolutionary Game Theory, Strogatz's Nonlinear Dynamics and Chaos text, Griffth's Quantum mechanics text
Answer: How basic is your basic Differential Equations course? Because without any doubt in my honest opinion, the Laplace transform would be an excellent choice of self study.
For two reasons I can come up with:
1) You can use the Laplace Transform to solve differential equations (in a sophisticated manner) That is the reason why the Laplace Transform usually is introduced in a DFQ course.
2) Because the theory of Laplace Transform is beautifully set up. Once you understand how it works, you can also calculate, for example, certain convergent improper integrals that would be practically impossible with an introductory calculus course where these types of integrals are introduced.
When I learned about this marvelous piece of mathematical theory, I had a hard time falling asleep that night. And yes, I consider Laplace as a greater mathematician than he usually is regarded by many, but that is my opinion.
In case you already studied the Transform (to an advanced level), then perhaps partial differential equations would be an option. That would be a next more indepth course in DFQ's
Comment: A nice book for this is [**The Laplace Transform: An Introduction**](http://www.amazon.com/dp/B0006AY3PC) by Earl David Rainville. It's not long and not advanced, and thus it would be a very reasonable project for un umile appassionato to work on in spare time. Another possible project is Bessel functions, at the level of Frank Bowman's book [**Introduction to Bessel Functions**](http://www.amazon.com/dp/0486604624).
Comment: "DFQ" is a rubbish acronym for differential equations.
Comment: I need to look into that...
Answer: There's some really cool applications of imaginary numbers in differential equations: fluid modelling, Bernoulli's equation for fluids, and heat flow, I'm sure many more.  Also the proof for existence and uniqueness of 1st order ODE is fairly straightforward and interesting.  The proof for 2nd order and above is a similar principle but much more complicated. Also, it's really neat to prove that the solution space for a nth order differential equation is of space n (it's obvious, but proving it is really quite fascinating).
Comment: I would not have guessed there is such a thing as an existence and uniqueness theorem for higher order ODEs. Can't a higher order ODE in normal form be reduced to a system of first order ODE?


Is Asura Krishna mentioned in the Rigveda the same as Lord Sri Krishna?

Question: I saw this particular verses from the Rigveda which says that an Asura named "Krishna" had a great enmity with Indra. I want to confirm that is this the same Sri Krishna or is it someone different? (I know that there are entities with the same name, that's why I am asking)

Rig-Veda 8.96.13-17
Comment: Post rig veda verse number and verse itself
Comment: It says asura krishna. Krishna is not an asura..... and Indra didn't kill Krishna.
Comment: Sorry, it's 8.96.11 and Sāyaṇa Bhashya
Comment: what if krsna was asura at that moment? can't he be both deva/asura since he is god?
Answer: No.
This apparently asura Krishna, mentioned in the Rig-Veda 8.96.13-17, if interpreted as a person, cannot be the Divine god (Bhagvān) of the Srimad Bhagvad Geeta.
This is because, Krishna was not killed by Indra, rather he chose to end his earthly past-times (leelas) through the medium of hunter Jara. Indra is nowhere involved.
This is narrated in the Śrīmad-Bhāgavatam Purāṇa, besides other scriptures.

ŚB 11.30.33
मुषलावशेषाय:खण्डकृतेषुर्लुब्धको जरा । मृगास्याकारं तच्चरणं विव्याध
मृगशङ्कया ॥ ३३ ॥

Just then a hunter named Jarā, who had approached the place, mistook the Lord's foot for a deer's face. Thinking he had found his
prey, Jarā pierced the foot with his arrow, which he had fashioned
from the remaining iron fragment of Sāmba's club.

Rather, Krishna is the one who destroys the ego of Indra in the famous incident when he lifted the whole mountain on his single little finger (ŚB 10.27)

On the contrary, here's an alternative translation by Dr. Tulsi Ram, which interprets the word Krishna as a non-person, and provides a metaphorical understanding of the verse -

Rig-Veda 8.96.13
अव॑ द्र॒प्सो अं॑शु॒मती॑मतिष्ठदिया॒नः कृ॒ष्णो द॒शभि॑: स॒हस्रै॑: ।
आव॒त्तमिन्द्र॒: शच्या॒ धम॑न्त॒मप॒ स्नेहि॑तीर्नृ॒मणा॑ अधत्त ॥ 13 ॥

The dark passion of pride with its ten thousand assistants and associates comes, occupies the affections and suppress the emotive and
creative streams of life. But, Indra, noble leader of men, the soul,
with its great thought and action, takes this bully over, controls its
violence, and covers it with sweetness and love.

To Conclude -
The Krishna of the Rig-Veda 8.96.13, is not the Divine God Krishna (who spoke the Srimad Bhagvad Geeta), but some other person after all, if the word Krishna is interpreted in a Proper Noun sense. Otherwise there can be a symbolic interpretation too, as mentioned above.


Role of windowing in implementing FIR filters using Fast Convolution

Question: In Fast Convolution the filtering is performed by taking FFT of both the signal and impulse response and multiplication in frequency domain using Overlap add/Overlap save method for processing continuous signals. My question is what role if any does windowing (e.g. Blackman, Hanning etc.) play before taking the FFT of the signal and impulse response?
Comment: If you already have the impulse response and the signal, and if you just want to perform filtering, then you do not need extra windowing there ? may be you want to do some *spectral* analysis instead of filtering?
Comment: Yes the requirement is just to filter the data, I was wondering if windowing before FFT made any positive contribution to filtering but as Hilmar stated in his answer the result will be wrong if any other window apart from rectangular is used.
Answer:
what role if any does windowing (e.g. Blackman, Hanning etc.) play

None. If you do apply a window (other than rectangular) for a regular overlap add/save algorithm, your results will be wrong.
Time domain windowing can be helpful if your frequency domain processing is time variant, but that requires more complicated algorithm with partially overlapping and fully reconstructing window & hop size.
Answer: It pretty much doesn't. One could say a boxcar window is used, but you most likely won't hear any mention it. The trick with doing FFT convolution is making sure your FFT length is at least equal to the number of signal samples plus the impulse response length minus one. Both your input signal and impulse response need to be padded with zeros appended to the ends to match the FFT length, which is sort of like a boxcar window. The reason we don't call it windowing is because windowing is generally applied to deal with spectral leakage during analysis, or limiting time domain response during synthesis, which doesn't apply here.
Answer: The term "Hanning" is illiterate.  The window is attributed to Julius von Hann.  So it is a Hann window, or von Hann window.
If you use overlap add/save fast convolution on von Hann windowed data where the windows are 50% overlapped, you get the same result as rectangular windows of data that are non-overlapped, except for the initial and ending transients.
You can also use 75% overlap if you don't mind a 2X gain.  Or Hamming windows if you don't mind another roughly 2% gain.
Comment: A pity Proakis/Manolakis took after it. This is the sort of mistake that's propagated by inertia: someone doesn't/won't/can't find the correct name, others hear it and take it for granted. OTOH, I'm glad they didn't shorten Hamming...


testflightapp.com, how it works, and can I assume it is safe and work longer?

Question: I heard and tried testflightapp.com and I surprised. Because only by installing their profiling with a few taps, iOS allowed installing apps from them. I have shocked. Is this normal? How are they work? And can I assume them as safe and work longer without any accidental service shutdown? (such as sued by Apple...)
Answer: You still need to use your own AdHoc distribution profiles, nothing changed there. The profile you can install via their website is only for submitting the UDID to the website.
This question is already answered here: How does TestFlight do it?
Answer: It's a standard way to distribute your apps introduced with iOS 4. "All" that Testflight did was build a webapp and community around it.


React class or function for stateful components?

Question: Which is better to use? react class based stateful component or react hooks functional stateful component? I've searched a bit but couldn't find what is preferred to use.
Comment: Please describe the scenario and requirements (what are you needing to accomplish?)
Answer: There is really no concrete answer to this, but I can provide some information that might help you decide:
On https://reactjs.org/docs/hooks-faq.html they state

In the longer term, we expect Hooks to be the primary way people write React components.

So if you want to follow the future trends of React, this might be the better way to go.
On the other hand, they also state

We intend for Hooks to cover all existing use cases for classes, but we will keep supporting class components for the foreseeable future.

So really either way is valid, it is really your own preference as you can achieve the same results from both functional and class components.
In my experience, I have preferred hooks because I find it makes writing re-usable component logic a little easier and clearer.


Good textbooks on combinatorics for self-study

Question: Can anyone recommend a good introductory textbook on analytic combinatorics for self studying? It should be for a first year graduate student.
Comment: Does this answer your question? [Good Book On Combinatorics](https://math.stackexchange.com/questions/15201/good-book-on-combinatorics)
Comment: Related: http://math.stackexchange.com/questions/15201/good-book-on-combinatorics
Answer: One book I'd highly recommend is Peter J. Cameron's

Combinatorics: Topics, Techniques, Algorithms

The first link above is to site for the book, which includes multiple resources, including links, solutions to problems (good for self-study, etc.), additional exercises and projects.  I used it in an early graduate "Special Topics" class on Combinatorics. (It's geared to be "basic" for grads, advanced for undergrads. Indeed, the text is designed in such a way as to provide ample material for a two-semester sequence, for self-study, and as a reference for future needs.) I have since self-studied the text on my own, to cover material which simply could not be covered in a single semester.
The text is loaded, and expansive in its coverage: dealing not only with combinatorial "content", but also combinatorial techniques, proofs, as well as algorithms for those with computational interest in combinatorics etc...and Cameron himself suggests which chapters to study for different aims.
You can peruse/preview the book at Amazon: Take a look inside, and also through the top link.
Table of Contents
Preface
1. What is combinatorics?
2. On numbers and counting
3. Subsets, partitions, permutations
4. Recurrence relations and generating functions
5. The principle of inclusion and exclusion
6. Latin squares and SDRs
7. Extremal set theory
8. Steiner triple theory
9. Finite geometry
10. Ramsey's theorem
11. Graphs
12. Posets, lattices and matroids
13. More on partitions and permutations
14. Automorphism groups and permutation groups
15. Enumeration under group action
16. Designs
17. Error-correcting codes
18. Graph colourings
19. The infinite
20. Where to from here?
Answers to selected exercises
Bibliography
Index.
Also, for a sample of Cameron's writing style, here's a pdf format of his Combinatorics Notes (also available at Cameron's home page, which is accessible from the book's site to which I've included a link at the top this post).

One other text that might suit your needs is Introduction to Combinatorial analysis by John Riordan, considered by many to be a "classic*.
Answer:
A Path to Combinatorics for Undergraduates: Counting Strategies [Paperback]
Titu Andreescu (Author), Zuming Feng (Author)
Authors take a problem and start solving it. You start following solution and then all of a sudden they say "Not so fast my friend.. not so fast..." pointing out how that logic was faulty and then give the actual solution. This gives me kicks.
Comment: Talk about fighting with a book!  Multiple choice tests usually have several wrong answers that result from common mistakes on them but that takes it to a whole new level.  ha!
Answer: Richard Stanley has made his Enumerative Combinatorics, volume 1, available free for personal use (for awhile) on his website at http://math.mit.edu/~rstan/ec/ec1/. There's a new edition coming out and he's looking for possible corrections.
Comment: That's a classic!!
Answer: Check out Combinatorics through guided discovery by Kenneth T. Bogart. It is intended for self-study and introduces the concepts via a sequence of exercises which are integrated into each section. This way you are forced to digest each concept as it comes along, rather than browsing through the chapter and then tackling a list of problems. I highly recommend it.
Answer: Two staples are Concrete Mathematics and The Probabilistic Method.
But combinatorics is such a wide area, that you'll need to tell us what you want to focus on. For example, there is no "combinatorics on words" in any of the above.
Answer: I guess Analytic Combinatorics by Flajolet and Sedgewick might be what you're looking for. It is freely available.
Comment: I would not classify this book as introductory at all.
Comment: @apprentice: well, certainly not suitable for undergraduates, but not that hard either, I think…
Comment: They won the 2019 Steele Prize for Mathematical Exposition: http://www.ams.org/news?news_id=4699
Answer: The books I always go back to are, in no particular order,
Ryser, Combinatorial Mathematics
Cohen, Basic Techniques of Combinatorial Theory
Tucker, Applied Combinatorics
Brualdi, Introductory Combinatorics
Comtet, Advanced Combinatorics.
Comment: I would avoid Tucker. The answers to exercises tend to be wrong and it can only confuse more newcomers.
Answer: I highly recommend Fred Roberts' book Applied Combinatorics.  (A new edition has appeared with Barry Tesman as co-author.)
Answer: If you are looking for a tough but very good book I recommend the following. I am working through it right now: A Course in Combinatorics by Van Lint and Wilson:

It gives a lot of proofs and it really has you thinking all the time.


Install multiple versions of chrome

Question: How do I install multiple versions of Chrome? I would like to say, I want Chrome, not Chromium. Or is there a extension (like Firefox)?
Comment: Multiple versions or multiple profiles?
Comment: Either, as long as they are different versions.
Answer: Update January 2020:  I am splitting this answer into 3 parts.
Part 1 (Dec 2016): Running multiple configurations of the same version of Chromium.
I launch four distinct copies of Chromium using the --user-data-dir as follows:
chromium-browser  --user-data-dir=/home/<user>/.config/chromium1
chromium-browser  --user-data-dir=/home/<user>/.config/chromium2
chromium-browser  --user-data-dir=/home/<user>/.config/chromium3
chromium-browser  --user-data-dir=/home/<user>/.config/chromium4

It appears the same command line option works for Chrome:
http://www.ericdlarson.com/misc/chrome_command_line_flags.html
All four copies of Chromium are running the same version of the software, but they have entirely distinct configurations, cookies, caches, etc.
Part 2 (Jan 2020): Manually installing multiple versions of Chromium from Snap.
Starting with Ubuntu 19.10, Ubuntu now distributes Chromium as a snap package.  Ubuntu no longer provides Chromium via .deb packages.
 Consequently, part 3 of this answer is now obsolete.  So... below are instructions for manually downloading, manually installing, and manually running Chromium from snap packages.
Warning:  The below instructions use snap packages in a way that Ubuntu/Canonical most certainly neither intends nor supports.  It is possible that installing Chromium via this method may reduce or compromise Chromium's security.  And/or this method may cause other problems.  Proceed at your own risk!!
Step 1 - Install prerequisites
$ sudo apt-get install curl jq squashfs-tools

Step 2 - Manually find and download a snap package of Chromium
Download a JSON list of the currently active Chromium packages:
$ curl -H 'Snap-Device-Series: 16' http://api.snapcraft.io/v2/snaps/info/chromium >> chromium.info

View the JSON list to find the URL of the package you want.  Note: The JSON list will contain multiple architectures, multiple "risk" levels, and multiple tracks, so be sure to find the right URL.
$ jq . chromium.info | less

Download the snap package of your choice.
$ wget 'https://api.snapcraft.io/api/v1/snaps/download/XKEcBqPM06H1Z7zGOdG5fbICuf8NWK5R_NNN.snap'

Note: Your URL will probably look like the above, but with a specific number rather than NNN.
Step 3 - Manually extract the snap package
$ unsquashfs KEcBqPM06H1Z7zGOdG5fbICuf8NWK5R_NNN.snap

As of Jan 2020, Chromium uses 149MB of disk space.
Step 4 - Manually run the extracted copy of Chromium
The extracted package will contain both the chromium browser executable and the libraries it uses.  In order for the browser to find its libraries, you will need to set the LD_LIBRARY_PATH variable.  If you wish to simultaneously run multiple versions of Chromium, you will need to set LD_LIBRARY_PATH appropriately prior to running each different version of Chromium.  Each version will need to find its libraries, and only its libraries.
$ export LD_LIBRARY_PATH=<full_path_to>/squashfs-root/usr/lib/x86_64-linux-gnu

Note:  If your architecture is not x86_64, then you will need change x86_64 in the above.
Then run chromium:
$ <full_path_to>/squalshfs-root/usr/lib/chromium-browser/chrome

Final thoughts:  You may extract the .snap file wherever you like.  You may rename the squashfs-root directory as you like.
Part 3 (Dec 2016): Manually installing multiple versions of Chromium from .deb packages
Regarding installing different versions of Chrome/Chromium, this appears to be trickier, but perhaps not too tricky.  Chromium is launched via /usr/bin/chromium-browser, which is a shell script.  If you look at this script, you see an variable named LIBDIR.  Almost all of the Chromium files are installed inside this directory, so I am hoping that I can manually extract Chromium .deb files to non-standard locations, and then just tweak this one variable.  (Use dpkg to do the extraction.)  Hopefully then I can have different versions installed and running simultaneously.  The chromium-browser shell script even seems to anticipate such a configuration:
LIBDIR=/usr/lib/chromium-browser
# [snip]
readonly UPSTREAM_VERSION="<version>"
if test -x "${LIBDIR}/${UPSTREAM_VERSION}"/chromium-browser; then
        LIBDIR="${LIBDIR}/${UPSTREAM_VERSION}"
fi
readonly LIBDIR

Update:  After attempting the above, multiple versions of Chromium seem to be working.  I have two sets (different versions) of the following packages installed:
chromium-browser
chromium-browser-l10n
chromium-codecs-ffmpeg-extra

The first set is installed by apt-get install.  The section set is installed manually via dpkg -x in a nonstandard location.
After changing the LIBDIR variable in the non-standard chromium-browser script to the appropriate non-standard path, both versions seem to be able to run simultaneously.  I am, of course, using a different --user-data-dir for each version.
Comment: Good idea with `dpkg --x`, thanx!
Answer: if you want a completely separate Google Chrome installed on your machine, including files, document folders, settings, etc. you can check out Containers.
Container is a Virtual-Machine like system that isolates a process (or a set of processes) from the main system.
A set of Docker Container files for Chrome has been developed here to
help you get started.
NOTE: This method may not be the easiest, and maybe there's a way easier way to do what you're trying to do.
Comment: glad I helped **:)**
Answer: You can set up multiple users, each with their own profile. And then you can right-click on the current user's name near the top right-corner of your Chrome window to change users (not shown in the image below).
Comment: More info please...
Answer: Install Google Chrome Beta release - it can run alongside Google Chrome stable.
Answer:
Download the deb package.
Unpack it (ar xo /path/to/file.deb)
Unpack the data.tar.xz (tar -xvf ...)
Run opt/google/chrome/google-chrome

(obviously this bypasses dependency resolution that dpkg, which normally handles deb packages, does. However chances are high, that whatever you have installed for your existing version of Chrome will satisfy the second one too. If not - you can check them in the file control from control.tar.gz that resides in the same deb)
Comment: The question was about multiple versions of Chrome. If I follow your steps, I only get one version of Chrome.

Install multiple versions of chrome


555 timer as FM transmitter vs. Tank Circuit

Question: This site seems to suggest the use of the 555 timer in astable mode to generate frequency modulation from a source.  The typical transmitter uses a tank circuit with an inductor and trimmer capacitor or an inductor and transistor like this one. I would rather use the 555 timer version because of my bad experiences with inductors and the availability of pieces. So my question is first which do you think would have the farthest transmission range and also how would I change the frequency of the 555 timer circuit? Any input appreciated.
Comment: Reading the [TI version of the datasheet](http://www.ti.com/lit/ds/symlink/ne555.pdf), in the very first line of the description: "The xx555 timer is a popular and easy to use for general purpose timing applications from 10 μs to hours or **from
< 1mHz to 100 kHz.**"
Comment: Ask yourself these questions first: what is the maximum frequency that a 555 timer will run at?  Is that within the frequency band that you want to receive?
Comment: Transmission range has nothing to do with this choice.
Comment: I would like the entire 87 - 108mhz range. I cannot find the max frequency of the 555 Timer. By the way, I was also wondering what the Diode did in the 555 version.  Could someone answer these questions via an answer instead of comment. Thank you for your time.
Comment: Do you think the linked 555 timer transmitter could work or what could I do to make it work in the 88 - 108mhz area? Also for the diode I have a 1n4001. Would that work or does it have to be the other one. Thank you for your time.
Comment: Please read Majenko's comment. He's trying to tell you something very important.
Comment: I understand that but what is the frequency in the circuit; how would I change it...sorry I'm slow to learn.
Comment: 88-107 (should be 108) MHz is a bandwidth, not a range. 'Range' would normally be understood as transmission radius, which is a function of power and aerial efficiency.
Answer: It's probably worth going back to basics to answer this as there seem to be a few things muddle in the question.
A modulation is a means of altering a carrier so that it can carry information.  A carrier can itself carry no information as it is periodic. FM is one scheme where the frequency of the carrier is changed slightly with each bit being emitted.
FM broadcast radio is an application of the frequency modulation of an audio signal to impress it upon a sinusoidal carrier, typically at 88-108MHz which is then broadcast as an RF wave.
There are other applications of frequency modulation and the 555 example you give is very much a different one. First of all, a 555 will almost certainly conk out at about 100kHz-1MHz, at very best no more than a few percent of the frequency you need.
Secondly, the values of the accompanying components would be so ridiculously small that they would be dominated by parasitics from your layout, pins etc, and very much not available in the shops.
Thirdly, the signal generated is square, not sinusoidal, so would almost certainly have truly epic harmonics at odd multiples of the carrier frequency such that in the very unlikely event that you got enough power to transmit any distance in the broadcast band, you'd soon be hearing a standard-issue boot at your front door when the relevant regulator arrived for the various shipping accidents and military incidents which your interference had caused. I'm gonna stop at three, but there are loads of other reasons.
Inductors are oddly frustrating to source order, my heart goes out to you on that, but if you want to work in RF you're going to have to get used to them, and also maybe choose a more conventional route in, ideally a legal one such as amateur radio or pre-assembled licensed/license-exempt modules?


How to design Redis data structures in order to perform queries similar to DB queries in redis?

Question: I have tables like Job, JobInfo. And i want to perform queries like below -
"SELECT J.JobID FROM Job J, JobInfo B WHERE B.JobID = J.JobID AND BatchID=5850 AND B.Status=0 AND J.JobType<>2"
How shall i go about writing my redis data types so that i can map such queries in redis?
IF i try to map the rows of table job in a redis hash for e.g. (hash j jobid 1 status 2) & similarly the rows of table JobInfo in again a redis hash as (hash jinfo jobid 1 jobtype 3.)
So my tables can be a set of hashes. Job table can be set with entries JobSet:jobid & JobInfo table can be set with entries like JobInfoSet:jobid
But i am confused in when i will do a SINTER on JobSet & JobInfoSet. how am i going to query that hash to get keys? As in the hash content of set jobSet is not identical to hash content of table JobInfoSet (they may have different key value pair.
So what exactly am i going to get as an output of SINTER? And how am i going to query that output as key-value pair?
So the tables will be a collection of redis hashes
Answer: Redis is not designed to structure the data in SQL way. Beside a in-memory key value store, it supports five types of data structures: Strings, Hashes, Lists, Sets and Sorted Sets.  At high level this is a sufficient hint that Redis is designed to solve performance problems that arises due to high computation in relational data models.  However, if you want to execute sql query in a in-memory structure, you may want to look at memsql.
Answer: Let's break down the SQL statement into different components and I'll try to show how redis can accomplish various parts.
Select J.JobID, J.JobName from Job J;
We translate each row in "Job" into a hash in redis using the SQL primary index as the redis natural index in redis.
For example:
SQL
==JobId==|==Name==
123        Fred

Redis
HSET Job:123 Name Fred
which can be conceptualized as
Job-123 => {"Name":"Fred"}

Thus we can store columns as hash fields in redis
Let's say we do the same thing for JobInfo. Each JobInfo object has its own ID
JobInfo-876 => {"meta1": "some value", "meta2": "bla", "JobID": "123"}

In sql normally we would make a secondary index on JobInfo.JobID but in NoSql land we maintain our own secondary indexes.
Sorted Sets are great for this.
Thus when we want to fetch JobInfo objects by some field, JobId in this case we can add it to a sorted set like this
ZADD JobInfo-JobID 123 JobInfo-876
This results in a set with 1 element in it {JobInfo-876} which has a score of 123. I realize that forcing all JobIDs into the float range for the score is a bad idea, but work with me here.
Now when we want to find all JobInfo objects for a given JobID we just do a log(N) lookup into the index.
ZRANGEBYSCORE JobInfo-JobID 123 123
which returns "JobInfo-876"
Now to implement simple joins we simply reuse this JobInfo-JobID index by storing Job keys by their JobIDs.
ZADD JobInfo-JobID 123 Job-123
Thus when doing something akin to
SELECT J.JobID, J.Name, B.meta1 FROM Job, JobInfo USING (JobID).
This would translate to scanning through the JobInfo-JobID secondary index and reorganizing the Job and JobInfo objects returned.
ZRANGEBYSCORE JobInfo-JobID -inf +inf WITHSCORES
5 -> (Job-123, JobInfo-876)
These objects all share the same JobID. CLient side you'd then asynchronously fetch the needed fields. Or you could embed these lookups in a lua script. This lua script could make redis hang for a long time. Normally redis tries to be fair with clients and prefers you to have short batched queries instead of one long query.
Now we come to a big problem, what if we want to combine secondary indexes. Let's say we have a secondary index on JobInfo.Status, and another on Job.JobType.
If we make a set of all jobs with the right JobType and use that as a filter on the JobInfo-JobID shared secondary index then we not only eliminate the bad Job elements but also every JobInfo element. We could, I guess fetch the scores(JobID) on the intersection and refetch all JobInfo objects with those scores, but we lose some of the filtering we did.
It is at this point where redis breaks down.
Here is an article on secondary indexes from the creator of redis himself: http://redis.io/topics/indexes
He touches multi-dimensional indexes for filtering purposes. As you can see he designed the data structures in a very versatile way. One that is the most appealing is the fact that sorted set elements with the same score are stored in lexicographical order. Thus you can easily have all elements have a score of 0 and piggyback on Redis's speed and use it more like cockroachDB, which relies on a global order to implement many SQL features.
Comment: CORRECTION:ZRANGEBYSCORE JobInfo-JobID -inf +inf WITHSCORES 5 -> (Job-123, JobInfo-876)
Comment: CORRECTION:
ZRANGEBYSCORE JobInfo-JobID -inf +inf WITHSCORES

123 -> (Job-123, JobInfo-876)
Answer: The other answer are completely correct for redis up to version 3.4
The latest releases of redis, from 4.0 onward, include supports for modules.
Modules are extremelly powerfull and it happens that I just wrote a small module to embed SQLite into redis itself; rediSQL.
With that module you can actually use a fully functional SQL database inside your redis instace.


Bohr Model of the Hydrogen Atom - Energy Levels of the Hydrogen Atom

Question: Why the allowed (stationary) orbits correspond to those for which the orbital angular momentum of the electron is an integer multiple of $\hbar=\frac {h}{2\pi}$?
$$L=n\hbar$$
Bohr Quantization rule of the angular momentum
that leads to energy levels of the Hydrogen atom:
$$E_n=-\frac {Z^2}{1+\frac {m_e}{M_p}} \frac {\Re}{n^2}$$
the question is Why quantum numbers are natural numbers? $$E=nh\nu$$
$$n=0,1,2,3....$$
Comment: This is explained in detail in the Wikipedia page on Bohr model and "correspondence principle", what is unclear?
Comment: Because the constants were picked that way.
Comment: You may want to also see http://en.wikipedia.org/wiki/De_Broglie_hypothesis.
Comment: Photons can't be in fragmented parts, so n can't be decimals. Thus, n is always whole number.
Answer: The Bohr model wasn't the right theory of all of atomic physics but it described the levels of the Hydrogen atom correctly, due to a mathematical coincidence related to this solvable mathematical problem in the full quantum mechanics.
The integrality conditions of the Bohr model were ad hoc – chosen so that the energy levels as seen in the Hydrogen absorption/emission spectra could be matched – but the most justified starting point to derive them was the Sommerfeld-Wilson quantization condition
$$ \int_0^T p_r\cdot dq_r = nh $$
where the integral of $p\,dq$ goes over one orbital period. In this form, it is analogous to the statement in the full quantum mechanics – that replaced the Bohr model in the mid 1920 – that the phase space (space parameterized by the positions $q$ and momenta $p$) is composed of cells whose area (or volume) is equal to multiples of $h=2\pi\hbar$ (or powers of $h$, if there are many coordinates). The orbit encircles an area in the phase space and the area should be quantized.
By a coincidence, this is also pretty much equivalent to the quantization of the angular momentum, $L=n\hbar$. In quantum mechanics, similar conditions hold but  for slightly different reasons and the quantization of the angular momentum allows half-integral values, too: $J=n\hbar/2$ where $n$ is integer according to quantum mechanics.
One must separate the explanations in the Bohr model from those in the proper quantum mechanics; they're inequivalent because the models are inequivalent, too. And it doesn't make too much sense to think about the origin of the conditions in the Bohr model because the Bohr model is fundamentally not the right theory as we know today.
In the full quantum mechanics, one may encounter several "quantization" facts with the quantum proportional to $h$ or $\hbar$ or $\hbar/2$. All of them have a quantum origin but the detailed explanation is different for each: the quantization  of the angular momentum; the elementary cell of the phase space; the unphysical shifts of the action by a multiple of $h$.
Comment: @LubošMotl: Yes, it's true, nobody had a clear idea of the statistical level transitions until Einstein's A,B coefficients, but Bohr's theory reproduces the right semiclassical energy levels (in the large N limit) for _any_ integrable system and this is not a coincidence. The reason is that there is a consistency condition: the level-spacing must be such that photon emission must be possible at the classical frequencies (integer multiples of the orbital frequency). This is Bohr's correspondence principle, and it really is right for the energy levels to leading order in $\hbar$. Read my answer.
Comment: While the Bohr model is not right, the justification of the Bohr model by the correspondence principle is fundamentally correct in the modern understanding too--- the reason for the quantization rule is that the emitted photon should have the classical period at classical motions.
Comment: Dear Ron, I am not sure in what sense you may have "fundamentally correct" explanations using theories that are not right. Something about $\int p\,dq$ is quantized in units of $h$ in the right theory but what this quantized quantity is clearly isn't exactly the integral over one period in a wrong Bohr model of the atom so the agreement is vague and a coincidence.
Comment: It's not a coincidence. The Bohr model is a wrong picture, but the idea that the level spacing near energy E must be equal to the classical period of the orbit with energy E is correct at large quantum numbers, and must be, because Bohr's correspondence argument is basically sound. If you couple a classical oscillator to EM field weakly, the emitted EM waves classically have frequency equal to the classical orbital frequency $\omega$ (and integer multiples thereof), so if it's photons emitted, the energy levels of the oscillator must be spaced with spacing $h\omega$.
Comment: The key point is: energy-level spacing = classical frequency = (2pi/classical-period). This is the identity Bohr uses to find everything else. It must be so for photon coupling to make sense, and it is the reason that the Bohr theory was more than a guess, but a proper seed for Heisenberg to complete to matrix mechanics.
Comment: Dear Ron, all these things happen to work for the Hydrogen atom, a single problem and a single set of levels with $E\sim 1/n^2$, and they don't work for anything else and even in this case, your description leads to a wrong interpretation of the energies etc. That's why the agreement is a coincidence.
Comment: These things work for _all_ quantum systems with an integrable classical limit, the level spacing is always asymptotic to 2-pi over the classical period (if there are many periods, as in a multi-periodic system, you have a multi-periodic energy level pattern, with independent spacings, but if the period is infinite, it breaks down). This is known asymptotic validity of WKB approximation, which is equivalent to Bohr condition, and Bohr's argument is exactly correct. It is not dependent on special problem. Please _read Bohr's argument_ before commenting, I have given it three times already here.
Comment: The Bohr model wasn't the right theory

**agreed**
Comment: @BadBoy: The Bohr model wasn't the right theory, but it was the correct _semiclassical theory_. It isn't arbitrary, and Bohr's argument are correct. Bohr orbits must have energy spacing equal to 2pi over the classical period, and there is a correspondence between Fourier components of a classical motion and off-diagonal matrix elements of position, this is what Bohr discovered, and it led to matrix mechanics. People ignore this, because it is a different argument than the one that appears in books. But it is 100% correct to semiclassical order, it is a slur on Bohr to say otherwise.
Comment: Dear Ron, I am a big Bohr fan but it is just preposterous to say that the Bohr model was a correct model of anything when it was constructed decades before people knew that all the laws of physics were actually predicting probabilities only and so on. There was no probabilistic theory of the energies before the 1920s and the right theory in any limit or outside any limit has to be probabilistic. It follows that Bohr's theory wasn't the right theory. In my answer, I indeed chose $\int p\,dq$ since it's closest to QM but he didn't have QM in 1910, not even in a limit.
Answer: The basic rule that justified the quantization of angular momentum can be derived as follows, from the correspondence principle. This derivation is heuristic and inexact, and only becomes absolutely correct once you know full quantum mechanics.
Consider an electron orbiting a nucleus of charge 1 (proton, deuteron, or triton) at large radius R with angular momentum L. The classical period is found by equating the centripetal force to the electrostatic attraction of the electron to the nucleus:
$$ {mv^2\over R} = { e^2\over R^2} $$
Where ${1\over 4\pi\epsilon_0}$ factor is absorbed into the constant e. You find the orbital velocity v from this, so
$$ v = \sqrt{ e^2\over m R} $$
Which tells you how long to go around the circle $T={2\pi R\over v}$. So the angular frequency $\omega$ of the orbit
$$ {2\pi\over T} = \omega = -\sqrt{e^2\over m R^3} $$
The kinetic energy of the orbiting electron is found directly from the centripetal formula:
$$ {mv^2\over 2} = {e^2\over 2R} $$
The potential energy is:
$$ -{e^2\over R} $$
So the total energy is half the negative potential energy
$$ - { e^2\over 2R} $$
Classically, this system will radiate electromagnetic waves which are periodic with period T. This means the outgoing radiation has frequency $\omega$. Quantum-mechaically, the orbiting electron can only emit photons with discrete lumps of energy, and this means that the energy can only change in steps of $\hbar\omega$, which is the energy of a photon of frequency $\omega$.
This means that if you have consistent photon emission, the energies must be spaced in discrete energy levels, and the spacing between two adjacent levels at large R is equal to the classical orbital frequency:
$$ \Delta E = \hbar \omega = -\hbar\sqrt{e^2\over m R^3} $$
This condition means that if there is an energy level at $E$, there is another energy level at $E-\Delta E$ (where you end up after one photon emission), then another at $E-2\Delta E$ in discrete steps.
This is all semi-classical reasoning, and only really works when the spacing $\Delta E$ is much less than the kinetic energy and the potential energy. The spacing goes to zero as the 3/2 power of the radius, so this approximation is valid for large orbits.
You can figure out the R-spacing between adjacent orbits too
$$ E = -{e^2\over 2R}$$
$$ dE = {e^2\over 2R^2} dR$$
So the spacing in E translates to a spacing in R (in the approximation that $\Delta E$ and therefore $\Delta R$ are both small so that they approximate the infinitesimal differentials above)
$$ \Delta R = {2R^2\over e^2} \Delta E = 2 \hbar \sqrt{R\over m e^2} $$
The change in E and R in each step is complicated, but $\hbar$ has the same units as angular momentum, and you can compute the change in angular momentum when you make a single step:
$$ L = mv R = \sqrt{e^2 m R} $$
$$ dL = {1\over 2} \sqrt{e^2 m\over R} dR $$
So that
$$ \Delta L = {1\over 2} \sqrt{e^2 m \over R} \Delta R =  \hbar $$
This is very simple--- the angular momentum is spaced in integer multiples of $\hbar$ at large circular orbits. From this, one can make the plausible guess that this is true for all quantum numbers, large and small, and then the Bohr model follows.
The generalization of this argument to derive the old quantum condition is to consider the period of classical orbits, and to make the energy spacing equal to $\hbar$ times the orbital frequency for a general system. This requirement means that semiclassically:
$$ J = \int p dq = 2\pi n \hbar = n h $$
This is shown on the Wikipedia page for correspondence principle. The same quantity J is an adiabatic invariant, it doesn't change under slow deformations of a classical system, and the quantized quantity must have this property, since a slow deformation doesn't have the high frequencies required to make state transitions in quantum mechanics. This argument is summarized on the wikipedia page on the adiabatic invariants.


Is it possible to merge the genomes of photosynthesizing and electron-transporting bacteria to make an electric cell?

Question: I had an idea of making electric current from bacteria. There are some bacteria that can photosynthesize, and some others are capable of transmitting electrons through each other. Is it possible that through genetic engineering, we could insert the genome that allows bacteria to perform photosynthesis, with other capable of transmitting electricity, and therefor making a bacterial culture, big enough to make a free energy source?
Comment: "through genetic engineering" I think this is the kicker. I think you've just described how it would be possible, however actually making it with the current technology would be impossible. Using bacteria to make crude oil is the current best shot at making renewable energy from the sun with biotech as far as I'm aware.
Answer: What you're describing is a phototrophic biofilm microbial fuel cell! They're pretty neat.
Essentially the sun powers the bacteria and the bacteria in the anaerobic side passes electrons through the graphite electrode to use oxygen at the cathode. There's another explanation here. You could also "unfold" cyanobacteria and layer them and you'd probably get an efficiency increase but the system would be pretty fragile. Compared to other MFCs, though, everything is fragile. Dirt even works(not very well, but it's dirt).
Answer: You do not need to merge anything. Photosynthesis already includes the electron transport across the inner membrane of the chloroplast (in case of plants) or across the bacterial membrane (in case of bacteria), creating voltage difference between inner and outer side. The only problem, this voltage is relatively difficult to take away.


In a WPF ListView how can I prevent auto scrolling?

Question: I have a WPF ListView which currently scrolls everytime I click on an item which is only partially visible.  How can I keep the control from scrolling that item into view (instead simply selecting the partially visible one)?  This behavior is very annoying when doing a drag from this control.
Thanks.
Added:  I am looking for a solution to keep the control itself from scrolling when contents are clicked that the control believes are not fully visible.  Often this is by a few pixels and the scroll is not necessary.
Answer: The items scroll into view because the default behavior on list item click is to call BringIntoView().  You can add an event handler for the RequestBringIntoView event and catch it before it bubbles up from the ListViewItems to the ScrollViewer.  In your handler, check the bounds of the sender against the visible region and if you decide that you don't need to scroll, set the event's Handled flag to true.
Comment: To clarify, use the PreviewMouseDown event to swallow it.
Answer: Since I'm currently on the road, I cannot try this, but have you tried playing around with CanContentScroll, and/or wrapping the scrollable content into a Panel, as suggested by the ScrollViewer Overview on MSDN?
In the worst case, you might want to replace the ListView's ItemsPanel by a hacked ScrollViewer with a "fuzz" factor, e.g. by capturing the RequestBringIntoView event.
Answer: have you tried this approach?
just as an addon, I don't know how much you know about the subject, but here is a good place to read more about it.
added:
I just found that you can prevent the mouse wheel of scrolling as well.


Stopping Raffle Smart Contract

Question: A smart contract has an enter() function where participants can send 1 Ethereum to enter a raffle. Is there an easy way to stop allowing the others calling this function while the winner is picked?
Answer: Yes, you can set up a "pauseable" function modifier to any of the functions which you want to control access to.
Here is an example of how to implement this from Open-Zeppelin.
You can then use it in your contract like so:
pragma solidity 0.4.24;

import "path/to/Pausable.sol";

contract MyPausableContract is Pausable {

    myFunction() whenNotPaused {
        do things...
    }

}

To explain what is happening simply:

There is a global variable which tracks if we are "paused" or "not paused" (bool)
Then there is a function modifier which simply requires that the global variable is in the "not paused" state
require(!paused);

Then there is a function which can only be called by a privileged user which can change the value of the paused variable.
Comment: I added a bit more detail too at the end. Hope this helps!
Answer: I forgot that solidity allows to use if statements. I'm still learning it.
I went on a different way and basically
bool Pause;

function setPause(bool anInput) public limited {
Pause = anInput; }

(limited is a modifier which I declared to check if the msg.sender is the contract owner)
function enter() public payable {
if (Pause == false) {
...do that...}
else{
revert("raffle is in pause. We are picking the winner"); }

Stopping Raffle Smart Contract


Fourier transform of $te^{-a|t|}$

Question: I'm stuck on trying to find the fourier transform of $te^{-a|t|}$ without integration. I have to use the fact that the fourier transform of $e^{-a|t|}$ is $2a / (a^2 + w^2)$ in my calculation. This should be a problem regarding properties of fourier transforms but integrals and derivatives don't seem to help and I'm not sure where to go from here.
Nevermind, figured it out. Use the property $F\{x(t)\} = X(jw)$, $F\{tx(t)\} = j\frac{d}{dw}X(jw)$
Answer: The result is straightforward by using the property $$\frac{d}{{dw}}F(f(t))(w) =  - F(tf(t))(w)$$.

Fourier transform of $te^{-a|t|}$


Using WN-Affect to detect emotion/mood of a string

Question: I  downloaded WN-Affect. I am however not sure how to use it to detect the mood of a sentence. For example if I have a string "I hate football." I want to be able to detect whether the mood is bad and the emotion is fear. WN-Affect has no tutorial on how to do it, and I am kind of new to python. Any help would be great!
Answer: In short: Use SentiWordNet instead and look at https://github.com/kevincobain2000/sentiment_classifier

In Long:
Affectedness vs Sentiment
The line between affect and sentiment is very fine. One should looking into Affectedness in linguistics studies, e.g. http://compling.hss.ntu.edu.sg/events/2014-ws-affectedness/ and Sentiment Analysis in computational researches. For now, let's call both the task of identifying affect and sentiment, sentiment analysis.
Also note that WN-Affect is a rather old resource compared to SentiWordNet, http://sentiwordnet.isti.cnr.it/.
Here's a good resource for using SentiWordNet for sentiment analysis: https://github.com/kevincobain2000/sentiment_classifier.
Often sentiment analysis has only two classes, positive or negative sentiment. Whereas the WN-affect uses 11 types of affectedness labels:

emotion
mood
trait
cognitive state
physical state
hedonic signal
emotion-eliciting
emotional response
behaviour
attitude
sensation

For each type, there are multiple classes, see https://github.com/larsmans/wordnet-domains-sentiwords/blob/master/wn-domains/wn-affect-1.1/a-hierarchy.xml

To answer the question of how one can use the WN-Affect, there're several things you need to do:
First map WN1.6 to WN3.0 (it's not an easy task, you have to do several mappings, especially the mapping between 2.0-2.1)
Now using the WN-Affect with WN3.0, you can apply

the same classification technique as he SentiWordNet sentiment classifier or
try to maximize the classes within text and then use some heuristics to choose 'positive' / 'negative'
Comment: I also found this. Could it be helpful? https://github.com/skozawa/japanese-wordnet-affect/blob/master/create_jp_wn_affect.py
Comment: yes, it does have a hard mapping from WN1.6 to WN3.0 but it's still going to be tough, you have to check how many synsets you lose =(
Answer: WordNet-Affect uses WordNet 1.6 offsets.
However, WordNet 1.6 is still available for download. You can use the nltk.corpus.WordNetCorpusReader class to load it. I wrote all the code to do it here.
Comment: @Westcroft_to_Apse Thank you, I updated the README.md to add a full documentation. Let me know if you have any question.
Comment: That looks very interesting. If you were to provide some documentation for it, I'm sure I'd be able to use it in my work (and would give credit).
Comment: Thank you very much! I'll let you know how it works out via GitHub.


Noun to describe a person who wants to please everybody, but sort of in an obsessed manner

Question: I'm trying to describe a character who dances for her husband so that he doesn't get mad, apologizes profusely even if she hasn't done anything wrong. However, she is also strong-willed and determined.
I considered using the word "altruist", but the character is not selfless.
Comment: Would it be fair to rephrase this as 'someone who fears displeasing people'?
Comment: I'm confused, do you mean please everybody around her, or just one person, the husband?
Answer: People pleaser describes such a person, even the obsession part.
Answer: sycophant
a self-seeking, servile flatterer; fawning parasite.
sycophant in dictionary.com
Comment: My dictionary says "a person who acts obsequiously toward someone important in order to gain advantage." It's not someone who wants to please *everyone*, they want to please one specific person with influence.
Comment: I don't think sycophant is a good choice at all—it has a very strong connotation of behaving this way *for an ulterior motive*. It may be sincere or not, but even when sincere it's still very much about getting to share in some of the qualities ascribed to the subject of the sycophancy. If a sycophant doesn't believe there's something to be gained from the behavior, the behavior doesn't happen, or stops happening.
Comment: Your link is just to the home page, not the word definition.
Comment: @Barmar: I copied the definition from my dictionary. Generally speaking, being a sycophant is a state of mind. One's MO, if you will. Thank you for the note, I'll provide the actual definition link shortly.
Comment: @Ricky: Motives are explicit in the definition: "self-seeking".  In the same way that OP dismissed "altruist" as implying selflessness, I agree with KRyan and Barmar that "sycophant" leans heavily the other way.
Comment: @KRyan: Motives in this case don't signify. It's all about one's MO.
Comment: Not quite the right word, as @Barmar says
Answer: Lapdog would be one, but that has more of a political connotation.
People-pleaser gets more at the personal dynamic, but that is usually general, not specific to one particular relationship.
It seems like you are describing a dysfunctional / abusive relationship, so what the wife is doing in an immediate sense is "placating" and as a long-term psychological strategy is  "fawning".  There aren't really good noun forms of those; calling the wife a "placater" or "fawner" would be accurate, but awkward.
Answer: Based the original description, appeaser or placater is appropriate.
More context might be needed, but the character in question is "strong-willed and determined," though "not selfless." Most of the suggested nouns are pejorative because people have assumed that the character is weak, relative to her husband. However, she might actually be more mature and wise compared to him.
Answer: A happiness pump is defined by Simple English Wikipedia as

someone who will do anything to make other people happy even if it
makes them very unhappy themselves

The term is taken from a thought experiment intended to illustrate problems with the philosophy of utilitarianism.
Comment: This is specific philosophical jargon and wouldn't suit the context the OP has asked for.
Answer: If the woman is constantly appeasing the husband, and the husband isn't contributing equally to the relationship or even downright abusive, then she would be codependent.
She then might still be strong willed in other regards (particularly if someone speaks badly of her husband)
And as nick012000 suggests, this can be a sign of abuse, but it might not be current abuse and instead someone who was raised in an dysfunctional family.  (see https://adultchildren.org/ )
Answer: This is a hard one. Calling them a doormat might be appropriate, although that usually tends to mean they do what they are told without resisting, rather than taking initiative.
Answer: I don't think there's a one-word answer.
The personality is very peculiar and may not exist as you think.  I'm concerned that your character may not be believable.
Understanding the motivation (ie why people do things) especially odd or 'irrational' things is important.  The behaviour/attitudes described is not one but two contradictory ones.  She needs some 'reason' to give-up her inner driving role for subservience.  That depends on him.  ie a relationship.  There are a lot of words at https://en.wikipedia.org/wiki/Transactional_analysis#Outline but don't be put off.
In short people do things because of some perceived reward.  Love or triumph at being a victim, or gloating at another's discomfort.  Couples often argue and both feel they've won something.  For some it's the only excitement they get and plot for when they can do it again.  You'll have noticed in the replies many references to abuse and so on.  (That's a relationship of course.) That's what people are taking away from your thumbnail sketch.  That relationship is double-ended and will change as things develop.  Lots of potential so long as you can make it believable.
Answer: A more offensive word could be "ass-kisser", or "Kiss-ass"  as in "why is she always kissing (his) ass for no reason?"
I fear that in many parts of the world she would be "an obedient wife" or "respectful
servant".
Also  a "passive" or "submissive" person would behave as described
Answer: adulator: One who lavishes excessive praises or flattery, one who adulates. (Your dictionary)
the verb to adulate means:

to show excessive admiration or devotion to; flatter or admire servilely. (Free Dictionary)
Answer: Abuse victim.
Frankly, the scenario describe sounds like the character is the victim of domestic violence, to me, and is taking actions to placate their abuser.
Comment: Leaving aside that this is pretty crass label to attach to a person regardless of whether it's true or not, using the phrase "abuse victim" only makes a claim about the _cause_ of the person's behaviour: it does not describe the behaviour itself.
Comment: Can't see any logic here, and it doesn't answer the question.
Comment: @Tim "who dances for her husband so that he doesn't get mad, apologizes profusely even if she hasn't done anything wrong" Doesn't sound like abuse to you?


How do I open an EPUB from an email in iBooks on my iPad?

Question: I have my iPad now with iOS 5.1.  In the email I have a .epub but when iPad's email program download the file, there is no way to open it on iBooks?  Tapping or double tapping on the attachment downloaded will have no reaction.  Can this be solved if I don't have a PC to place that file into Dropbox to open in iBooks?
Comment: Might be a stupid question, but have you installed the iBooks app in your iPad? It's not installed out of the box but must be downloaded from the App Store (for free).
Comment: @動靜能量 This maybe of assistance http://www.cultofmac.com/254741/how-to-add-epub-books-to-your-ipad-without-itunes-ios-tips/
Comment: I have he same problem, but what I notice is that the email seems to recognize the epub file as a zip file rather than epub. This is why ibooks wont open it but I do not have an answer.
Comment: @ken the accepted answer to the problem is indicated below with a green check mark -- the user who asked this question has deemed this to be the answer to their problem. If that's not the solution to your specific problem you may need to ask a new, more specific to your problem, question.
Answer: In all cases I have tested, iOS recognizes epub files and will offer to send them directly to iBooks.
I have tested this from the email all, dropbox app as well as mobile safari.
Other apps like Evernote and AirSharing also are able to receive my epub files, so if you are not able to do this, perhaps it's an encoding issue or something about how the files are being attached to the emails and not necessarily a problem with iOS.
Comment: hm... the epub i was trying to open was an epub purchased from O'Reilly, the MacRuby Definitive Guide... I wonder then if there is something wrong with it.  I later tried using Gmail in Safari on iPad, downloaded the file and was able to transfer to iBooks
Comment: There's a good chance the file didn't download correctly. I had a similar issue with a large ePub file recently inside iOS, which resolved itself when I connected to a more reliable network.
Comment: is it possible that this does not work if the mail account is not pop but imap?
Comment: Since IMAP is more tolerant to network errors and has better error recovery factors, I would say the chance that you have this error is more likely with POP email than IMAP email. All email will work once the mail and attachment download since the iOS device doesn't care at that point what protocol was used to deliver the package. (Just like when a physical package arrives - you don't care if it went by plane, boat, rail or truck as long as it arrives undamaged - all modes are capable of undamaged delivery)
Comment: Thanks @bmike when I click on the attachment it gives me a list with all available apps to open it with and when I select the iBook app. It just disappears and does nothing. No error or whatsoever
Comment: You can test whether the attachment is really downloaded by putting the device in Airplane mode, powering it down and restarting while in Airplane mode. At that point, you can try transferring it to iBooks and then reconnect to the network to take your next steps as appropriate.


Errors in CASTEP supercell geometry optimization

Question: These are the errors when I run my supercell on material studio using CASTEP module.
I have tried decreasing k points and also increased the cutoff energy. Furthermore I deleted all the files related to my material. But every time I am facing the same issue.
I am using hybrid functional with norm conserving pseudopotential.
How can I fix it??
Comment: +1 but can you please take a screenshot from your computer rather than a photograph from a camera?
Answer: The error message says that the computer did not have enough memory to perform the calculation (line 2 of the log you photographed). You don't give any details about your calculation, but in general the memory required for a CASTEP calculation (or any plane-wave DFT calculation) is proportional to the:

number of plane-waves ($\propto {E_\mathrm{cut}}^{\frac{3}{2}}\Omega$, where $E_\mathrm{cut}$ is the plane-wave cut-off energy and $\Omega$ is the volume of the simulation cell)
number of atoms (which affects the number of bands and also the number of pseudopotential projectors)
number of k-points (symmetry-reduced)

Reducing any of these will reduce the memory requirements, though of course you need to be satisfied that your calculation is scientifically reasonable. Certain kinds of calculation also require more RAM, for example non-local exchange-correlation functionals need significantly more RAM than semi-local functionals.
CASTEP tries to estimate the RAM it requires at the start of a calculation, and writes it to the output file. It's not 100% accurate, but the data estimates shouldn't be too far out. Here's an example from a small calculation:
+---------------- MEMORY AND SCRATCH DISK ESTIMATES PER PROCESS --------------+
|                                                     Memory          Disk    |
| Baseline code, static data and system overhead      507.0 MB         0.0 MB |
| BLAS internal memory storage                          0.0 MB         0.0 MB |
| Model and support data                               88.1 MB         0.0 MB |
| Electronic energy minimisation requirements          37.7 MB         0.0 MB |
| Force calculation requirements                        2.9 MB         0.0 MB |
|                                               ----------------------------- |
| Approx. total storage required per process          632.8 MB         0.0 MB |
|                                                                             |
| Requirements will fluctuate during execution and may exceed these estimates |
+-----------------------------------------------------------------------------+

(NB there's a slightly weird issue with some Linux builds where the baseline code appears to take many gigabytes, but the other estimated components should be good.)
I recommend you take a look at your .castep output file from the server, and see what CASTEP's memory estimate is for your calculation. If you don't have a .castep file then that usually means the RAM requirements are so large that CASTEP couldn't even get to the point where it computes the estimate!
Using disk space instead of RAM
You can ask CASTEP to conserve as much RAM as possible by moving the optimisation strategy from "speed" to "memory"; in your param file:
opt_strategy : memory

or, equivalently,
opt_strategy_bias : -3

I can't remember how you do this from the Materials Studio GUI but it's in the options somewhere. This will cause CASTEP not to keep some auxiliary data in RAM, in which case it will either recalculate it whenever it's needed, or save it to disk and read it back in when needed. (Note that CASTEP will not run as quickly if you do this.)
CASTEP can also page wavefunctions to disk, so that the data for only one k-point is stored in RAM at any one time. In the param file you can set page_wvfns to a negative number to mean "always page":
page_wvfns : -1

Parallel calculations
If you're running the calculation MPI-parallel, switching to OpenMP threading instead should also lower the RAM requirements; e.g. instead of
mpirun -np 2 castep.mpi myinput

(where "myinput" is the filename prefix you're using) you would set the environment variable CASTEP_NUM_THREADS to 2 and then run either the serial version of CASTEP or the MPI version but with only one process. For example, in a bash environment you would do
export CASTEP_NUM_THREADS=2
mpirun -np 1 castep.mpi myinput

Summary
The computer you're running on doesn't have enough RAM to perform that simulation. You could reduce the RAM required by carefully lowering the simulation accuracy, but there are limits to what you can do without compromising your scientific aims. You can ask CASTEP to save RAM where possible (though the simulations will take more time). Finally, it may be that your calculation is simply too large for that computer, and you need to find a machine with more RAM.


c' in mediation analysis

Question: I need to test the effect of X on Y through M. Based on knowledge, I know X does not have direct effect on Y. X has to act on Y through some mediator(s). In this case, do I still need to estimate the direct effect of X on Y (c') in my model? Is it ok if I only estimate a (effect of X on M) and b (effect of M on Y), and test if the product of ab is significant?
Answer: Most mediation tests require two models and you do not clarify which you are referring to. If you use the Baron/Kenny approach, you need two models: X->M and M->Y. If you do the Sobel test, you will fit a model with the marginal effect X->Y as well as the conditional (direct) effect X,M -> Y.
Comment: Thanks for your answer. My question is on the last model "conditional (direct) effect X, M ->Y". Based on my knowledge, if I know X has no way to act on Y directly, can I skip the last model? Is it OK is I only have two models X->M and M->Y?
Comment: @user106506 read and familiarize yourself with [Sobel's test](https://en.wikipedia.org/wiki/Sobel_test). You cannot simply constrain the effect to be 0 with 0 standard error, or else everything is a mediator. Baron/Kenny is different.

c' in mediation analysis


Colors look much different in solid view than the render view

Question:

My image looks fine in the solid view, but get flattened and lose colors in the render view. Anyone know why this might happen?
Comment: which render engine you are using
Comment: Also material setup could help. Check color management (unlikely, but not impossible)
Comment: also also, if "use lights" is enabled there will be differences between solid and rendered view. But anyway, without more infos or a file it's pretty much impossible to work out what the problem is
Comment: I was using Workbench for render, but it didn't seem to make much a difference whether I switched to Eevee. I also played with 'use lights' to see if it made a difference. No success there either. Uploaded the blend if you'd like to check it out. Thanks for the responses!
Comment: thanks for the file. actually after writing my answer i realised it's the same problem as in this question: https://blender.stackexchange.com/questions/196019/my-grease-pencil-colours-go-different-colours-in-render-mode
Comment: Thanks again wilks! Very helpful. Seems like such a technical issue for a newb like me. I'll be sure to pay attention to the vertex and material modes next time.
Answer: The problem: When in solid view there's no way of seeing if Vertex Colour mode is enabled or not. In your case it was enabled, which means that whatever material you used when drawing was being overridden by the brown colour selected for vertex colour. That only becomes visible when you switch to material preview or rendered mode.
The solution: I'm not sure there is an easy way to revert this. I looked but can't find a switch to disable vertex colours (whether at the object or layer level), which would be ideal.
So you could switch to Vertex Paint mode, select the same colour as your material (with the picker) and using the replace tool, fix every stroke's colour. This is gonna be long and tedious. You might be able to speed things up in some cases by isolating a layer and increasing the tool radius to do a whole layer at once. Also you can select everything that has a specific material by going in edit mode and clicking Select in the material panel.
A much simpler way would be to render the solid view with View > Render Viewport Animation. But then that limits what you'll be able to use in terms of effect and lights, as they won't show up in solid view.
Good luck and basically the advice is that in the future you should draw in Material Preview mode.

UPDATE: According to the following answer, as of 2.92 Alpha, there is an option in the Paint menu to Reset Vertex Color, which should solve this problem: https://blender.stackexchange.com/a/204738/168
Comment: https://blender.community/c/rightclickselect/h5gbbc/


Type declaration/inference in Eclipse/JSDT

Question: I would like to specify in Eclipse/JSDT the type of an instance variable as in the following example:
/**
 * @constructor
 */
function A() {
    /** @type Node */
    this.x = document.createElement("p");
}

The IDE, however, does not recognise the type of x. On the other hand, a declaration like
/** @type Node */
var x;

does work, i.e. in this case, x is known to have the type of a Node.
If I add
A.prototype.x = new Node();

to the first example, x will be known as a variable of type Node. However, this code does not run.
Answer: /** @type Node*/
A.prototype.x = undefined;


How to undo "Always perform this action" checkbox in Ubuntu?

Question: Every time you plug something in, like camera, iPod or SD card, the box pops up asking you what to do with that media. That box have a checkbox "Always perform this action". But how do I un-tick it?
Answer: Launch gconf-editor and got to /apps/nautilus/preferences. The media_auto* control what you're trying to do. more specifically, the media_autorun_x_* have the following meanings:

media_autorun_x_content_ignore -  lists the types of media for which you chose "Do nothing"
media_autorun_x_content_open_folder - lists the types of media for which you chose to mount and browse
media_autorun_x_content_start_app - lists the types of media for which you chose to start the associated application (CD player, DVD player, etc)

Removing a value from one of the lists above will make Ubuntu "forget" about what you have chosen.
Also, it's possible to change some of these settings through Nautilus' preferences interface. Access the Edit->Preferences menu, then click in the Media tab. There you can change these attributes in a more user friendly interface.
Comment: Thanks! That should have been much easier to do but well...
Comment: And indeed it is. Updated the text to give instructions on how to do it in Nautilus interface.
Answer: Much thanks, goedson. I had checked "don't ask again" after adding a new app for burning a DVD disc upon insertion. As you say, most of these settings can be changed through Nautilus' preferences interface, but not this one. While learning to use gconf-editor (nice tool, but no safety net!) I screwed up a few settings, and could not remember what they originally were. I made screen shots of all the prefs in a virgin copy of Ubuntu, and then undid the damage by referring to them.
Related to this, I also wanted to remove an extra app that I had set as one of the preferred apps for inserting a blank DVD disc. This is controlled in ~/.local/share/applications/mimeapps.list which is a simple text file that is easily edited:
[Added Associations]
application/pdf=evince.desktop;
x-content/blank-dvd=brasero-open-image.desktop;
x-content/video-dvd=brasero-copy-medium.desktop;

Just delete or comment out the offending line(s). Or, just delete mimeapps.list


What IPC method should I use between Firefox extension and C# code running on the same machine?

Question: I have a question about how to structure communication between a (new) Firefox extension and existing C# code.
The firefox extension will use configuration data and will produce other data, so needs to get the config data from somewhere and save it's output somewhere. The data is produced/consumed by existing C# code, so I need to decide how the extension should interact with the C# code.
Some pertinent factors:

It's only running on windows, in a relatively controlled corporate environment.
I have a windows service running on the machine, built in C#.
Storing the data in a local datastore (like sqlite) would be useful for other reasons.
The volume of data is low, e.g. 10kb of uncompressed xml every few minutes, and isn't very 'chatty'.
The data exchange can be asynchronous for the most part if not completely.
As with all projects, I have limited resources so want an option that's relatively easy.
It doesn't have to be ultra-high performance, but shouldn't add significant overhead.
I'm planning on building the extension in javascript (although could be convinced otherwise if really necessary)

Some options I'm considering:

use an XPCOM to .NET/COM bridge
use a sqlite db: the extension would read from and save to it. The c# code would run in the service, populating the db and then processing data created by the service.
use TCP sockets to communicate between the extension and the service. Let the service manage a local data store.

My problem with (1) is I think this will be tricky and not so easy. But I could be completely wrong? The main problem I see with (2) is the locking of sqlite: only a single process can write data at a time so there'd be some blocking. However, it would be nice generally to have a local datastore so this is an attractive option if the performance impact isn't too great. I don't know whether (3) would be particularly easy or hard ... or what approach to take on the protocol: something custom or http.
Any comments on these ideas or other suggestions?
UPDATE: I was planning on building the extension in javascript rather than c++
Comment: Another option you could add is memory mapped files.
Comment: @R.MartinhoFernandes True, but aren't Pipes basically just that? MMFs mean you still need to agree on some way of reserving memory, **communicating where that memory is**, and then ensuring both programs have access. There are enough potential issues with the Operating System at that point that it is much easier to use a built-in mechanism like pipes.
Answer: I would personally used named pipes to do the communication instead of sockets.  They're very low overhead, and very reliable on Windows.
This is very easy to use from C++ and from C#.
Answer:
Use the first if you need any sort of RPC. Otherwise, you'll find yourself writing an RPC language, validations, construction/deconstruction, etc., just a little overboard for something on a local machine.
Best option if you have a very passive plugin. The third component entirely decouples the two processes, which is great for a lot of things, including as mentioned above, async, testing, ease of implementation, etc.. Probably a silly idea if you want to do a lot of message passing.
Probably the best option overall for most things. TCP/IP is nice from the standpoint of sending stuff across the internet, but you don't really want two different IP addresses or to mess around with setting up webservers and possible port conflicts. Pipes make more sense, or some other similar serial communication model. It decouples well, it can be entirely async (TCP/IP is async, normal HTTP is not, pipes are too), its very easy to test (assuming you don't have to write any of the protocol of course), and it couldn't care less about code base. Which means tomorrow, if your C# backend turns into say, a Ruby one, or a Python one, the entire thing still 'just works'. Its better than sqlite as well, since you don't have to worry about packaging an entire library and database with your plugin.

The only downsides to the third option, is (one) that things will be async but should be responsive and active, whereas sqlite allows things to not only be mostly passive, but it isn't phased by you shutting your computer down for a week. And (two) its not amazing for RPC either, if you want to do that again you end up inventing your own protocol or dealing with something like SOAP and WSDL.
Answer: Well if you're going to use JavaScript I don't see another way to use named pipes or other system dependant communication other than writing proxy component in C++ which will allow you to access OS API directly. On the other hand if you plan to use TCP/UDP for IPC it will be much easier for you, because Firefox provides socket services that you can use easily from JavaScript component.
If blocking is your concern you can use  asynchrony socket communication or threading services to avoid locking of Firefox's GUI, but be aware that many objects are accessible only from Firefox's main thread.
Answer: The option I selected was #2: use a sqlite db. Main advantages being:

possible to implement in javascript
using a sqlite db useful for other reasons
asynchronous communication improves performance: C# code is able to cache all information the firefox extension requires rather than having to prepare it on-demand. FF extension is able to save all data back to the sqlite db rather than needing it handled immediately by C# code.
separate layer provides a nice testing-point, e.g. it's possible to run only the FF code and verify the expected results in sqlite, instead of needing a testing harness that operates across FF and C#.

Clearly some of these are scenario-dependant, so I would definitely not say this is the best general-purpose option for communication between FF extn and C# service.
UPDATE: We used just a sqlite db initially, and then wanted some synchronous communication so later exposed an http web service from the C# windows service that is called by the FF extension. This web service is now consumed by both the FF extension and other browser extensions. It's nice that it's a web service as it makes it easy to consume by different apps in different languages.