Numerical Method for Solving 3D Poisson Equation with Dirichlet and Periodic Boundary Conditions

Question: Given the poisson equation
(1) $\Delta L = F$
on a three dimensional discrete grid $V$ with grid points $x = 0,\ldots, W$, $y = 0, \ldots, H$ and $t = 0,\ldots,T$ where $\Delta$ denotes the discrete Laplace operator (for example using finite differences). The solution of (1) assuming periodic boundary conditions can be obtained using three dimensional discrete Fourier transform (see for example "Numerical Recipes in C," 2nd edition, chapter 19). However, I want to solve the same problem under the following boundary conditions:
(2) $L(x, y, 0) = L'(x,y)$
for a given $L'(x,y)$ and periodic boundary conditions for all other sides, that is for $t = T$ as well as for $x = 0$, $x = W$, $y = 0$ and $y = H$.
Visually speaking I have a cube and want to enforce Dirichlet boundary conditions on one side of the cube while using periodic boundary conditions on all other sides.
I would greatly appreciate any suggestions on how to solve this problem numerically (how to solve it and, if applicable, which libraries can be used).
Thanks!
Answer: You can use ADI (Alternating Direction Implicit) methods. Split each time step into three parts (one for each direction), or two, if you want to solve in $x-y$ plane using two dimensional discrete Fourier transform.
Google "pde adi 3d" for more information.
Comment: Can you give a more specific pointer to relevant literature - both covering the theory and the numerical issues as well as my specific case of boundary conditions? I found literature on ADI in general, however are missing the links to my specific case.


If a person has a specific mutation in a gene, is it more likely he has other mutations in that gene?

Question: If a person has a specific mutation in a gene (2281 del/ins in a single copy of the Bloom BLM gene), is he more likely than the general population to have other types of mutations in the same gene?
Answer: A priori, no! Why would it? Do you have any specific hypothesis in mind you would like to discuss?
Below are some expectations from a simple model and possible reasons for why this expectation may break down under more complicated models.
Simple model
Under a simple model (panmictic population and a few other simple assumptions), the number of mutations a given individual has in any sequence considered follows a poisson distribution. Assuming that all mutations occuring have a constance selection coefficient $s$, a constant dominance coefficient $h$ and that the mutation rate for the sequence of interest is $U$, then the number of mutations an individual carry comes from a Poisson distribution with mean $\frac{U}{2hs}$ (Crow 1970).
This model is simple but is probably a pretty good approximation to reality. Below are three assumptions that are not necessarily true and that would yield to a higher variance in the number of mutations (that is a higher probability for an individual that already carry a mutation to get a second mutation).
Population structure
In reality, populations are often not panmictic. As the genetic load depends upon the population size. More specifically, the smaller the population, the higher the genetic load (or the higher the number of mutants alleles present in the population) (Kimura et al. 1963).
Past evolutionary and demographic history
Populations are not stable through time. Some population have recently gone through a bottleneck, others a quickly expanding, some are shrinking, some have recently suffered from a plague, etc... Such processes can all cause populations to differ in the number of mutations they carry and therefore would increase the variance in the distribution of number of mutations individuals carry.
Within a specific short enough sequence, physical linkage associated with specific past evolutionary process will create a relatively long lasting linkage disequilibrium.
Condition-dependent mutation rate
It has been shown in Drosophila melanogaster that individuals with poor genotype tend to have a higher mutation rate causing their lineage to accumulate even more mutations (Sharp and Agrawal 2012).
Comment: I would add that there are mutations in certain genes that increase the likelyhood of mutations in general or genomic instability. But i agree that mutation in one gene is not likely to increase mutations in that gene. https://www.ncbi.nlm.nih.gov/pubmed/16020738
Comment: I agree theoretically it's unlikely, I wonder though if there is empirical data to support this from the 1000 genomes project.
Comment: thanks! so, correct me if I'm wrong, but all 3 arguments are supporting higher variance in the total number of mutations for an individual, NOT for a higher variance in the number of mutations of the SAME gene, correct?
Comment: Yes, you are right. However, higher variance in the total number of mutations also increases the variance in the number of mutations for any sequence of interest, including a specific gene.
Comment: I think you're missing the most important factor: variation in coalescence time across the genome. The fact that the individual has one polymorphism in the gene means that the coalescence time of their two copies is not very short, and so they are more likely than average to have additional polymorphisms in the gene.
Comment: @DanielWeissman This is exactly the same as "Past evolutionary and demographic history", isn't it? Demographic (population bottleneck) and evolutionary (high background selection) is what is affecting coalescent time.
Comment: @Remi.b I think the last sentence of that section is going in the right direction. Let's be clear though: the effect I'm talking about is present in completely stable, completely neutral populations. (In fact, bottlenecks can decrease the strength of the effect.)
Answer: Bear in mind that the average mutation rate of DNA polymerase is about 1 error for every 1 x 10^6 bases.  So the probability of mutation is independent at each base pair, but low - there's nothing that would prevent another mutation, but there also is nothing that says it is demanded.
There is, however, a phenomenon known as compensating mutations - a second mutation that compensates for a detrimental effect of an earlier mutation.  For example, if I have a mutation in a gene that codes for a protein, and that mutation changes an amino acid that is a contact point for protein folding (or a similar structural component), the protein may not fold correctly until there is a compensating mutation in the region of sequence coding for the residue that interacts with that first amino acid.  Compensating mutations would tend to be positively selected if the protein function is significantly affected....
Comment: Any sources you could add?
Answer: The answer of course depends some on the details (e.g., whether or not the mutation is neutral), but in general, yes, polymorphisms should cluster along the genome. Roughly speaking, the presence of one polymorphism indicates that the most recent common ancestor of this individual's two copies of the gene probably lived pretty far in the past, so there's been a lot of time for them to accumulate additional mutations.
I'm being a little sloppy here about polymorphisms within an individual vs differences from the reference genome, but the logic is the same.


Use YouTube channels as podcast in iTunes

Question: Is there a way to subscribe to a YouTube channel and have it show up in iTunes as a podcast? I want iTunes to automatically download the videos in MP4 format or download them in FLV and convert them to MP4 in iPod format.
Answer: You may try to use Podsync. It converts YouTube/Vimeo links (groups, channels, users) to podcast feeds, which can be added to any podcast player on iOS/Android or whatever platform you use. It's completely free and easy to use.
And you don't need to download an app.
Comment: Added brief description on how it works.
Comment: While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference.  Link-only answers can become invalid if the linked page changes.
Answer: Not exactly what you want but Miro does a pretty good job of consolidating Youtube downloads and Video podcasts. Not sure if you can get it to serve up a podcast of what it's downloaded though.
Also noticed this http://vixy.net/podcaster/ haven't tried it though.
Comment: I couldn't figure out how to get Miro to subscribe to a YouTube channel. I tried using the RSS url and also the URL of the channel page.
Answer: I tried http://vixy.net/podcaster/ but their server seems to be having problems right now.
I did not solve my problem exactly the way I wanted to but this solution is pretty close.
I am using Tooble which will download and convert YouTube videos. It even has a place where you can enter a YouTube users' username and it will show all videos in their channel. Then the trick to get the videos automatically added to iTunes was to configure it to save all videos to C:\Users\MyUsername\Music\iTunes\iTunes Media\Automatically Add to iTunes
Answer: I'm using Tubecaster.
It's still in open beta, but just did the job.
Answer: This question haunted me as well, and all the available options either didn't work or didn't fit... So I made my own: YouCast

It's free and open sourced.
It works for both channels and playlists.
Supports both audio and video podcasts.
Sorts by popularity.
Comment: Does it require to keep app running all the time?
Comment: @rapt0r yes, well as long as you want to update your feeds. I'm working on a hosted version but it takes time and has its problems.
Answer: The same question haunted me three years ago when I wanted to listen some youtube channels during commuting. My first thought was "youtubers should create their podcasts, it is so easy to get the mp3 from a video, then upload it, then update a feed, then host it ... and all of this every day/week/month ...
Non, finally it's not that easy. So, as a podcast lover and a backend developer,  I created a service which is doing exactly this.
Converting episodes from a youtube channel into audio files and hosting updated feed and audio files.
Now, for youtube channel owner it's quite easy to get one podcast up to date with every episodes. The name of it is Podmytube.
You can try it freely. You only need to create an account and register your channel.
Hope this help.
Answer: Listenbox does this. It converts videos, channels and playlists to podcasts and takes care of the updates


grunt-usemin not replacing reference block with revved file line

Question: I've been having an issue with grunt-usemin where it doesn't replace the non-revved reference block with the single revved line. The two files in the reference block get concatenated and uglified just fine; the single file metadata.min.js also gets versioned just fine; but, the reference to the revved file doesn't get inserted in to index.html. Just the non-revved line.
I'm using:

grunt-usemin 2.6.0
grunt-filerev 2.1.1
the Zend Framework for templating (hence the bizarre template paths)

Here's the index.html reference block before running grunt build:

Here's the relevant Grunt config:
useminPrepare: {
  html: '../cdm_common/cdm/layouts/scripts/index.html',
  options: {
    dest: 'dist',
    root: '.'
  }
},

filerev: {
  options: {
    encoding: 'utf8',
    algorithm: 'md5',
    length: 8
  },
  js: {
    src: ['dist/js/dest/*.js'],
    dest: 'js/dest/rev/test'
  }
},

usemin: {
  html: '../cdm_common/cdm/layouts/scripts/index.html',
  options: {
    assetsDirs: ['js/dest/rev/test']
  }
},

grunt.registerTask('build' ['useminPrepare','concat:generated','uglify:generated','filerev','usemin']);

Here's the index.html after running grunt build:

Any reason why the revved line shouldn't look like this?

Is this a bug with grunt-usemin? Is a config off somewhere? Though not really answered, this is similar to: Usemin not replacing reference blocks in HTML
Been beating my head against the desk for awhile. Any insight is greatly appreciated.
Answer: Try running grunt --debug with the following usemin configuration for some more information:
usemin: {
  html: '../cdm_common/cdm/layouts/scripts/index.html',
  options: {
    assetsDirs: ['js/dest/rev/test'],
    blockReplacements: {
        js: function (block) {
            grunt.log.debug(JSON.stringify(block.dest));
            grunt.log.debug(JSON.stringify(grunt.filerev.summary));

            return '';
        }
    }
  }
}

This will echo the current block its generating and an object with the files modified by filerev.
In my case I had an extra "public/" folder so my string would not match the key in the object, and therefor usemin was unable to find the new location made by filerev:
[D] "js/build/vendors.js"
[D] "public\\js\\build\\vendors.js": "public\\js\\build\\vendors.4e02ac3d2e56a0666608.js", "public\\js\\build\\main.js": "public\\js\\build\\main.acd1b38e56d54a170d6d.js"}

Eventually I fixed this with this custom blockReplacements function, (i.e. replacing public/ and the obnoxious Windows path):
js: function (block) {
    var arr = {};
    for (var key in grunt.filerev.summary) {
        arr[key.replace(/\\/g, "/").replace(/\/\//g, "/").replace("public/", "")] = grunt.filerev.summary[key].replace(/\\/g, "/");
    }

    var path = (arr[block.dest] !== undefined) ? arr[block.dest] : block.dest;

    return '';
},

Answer: This occurred to me as well and the issue was caused by not having the correct assetDirs in the usemin block. You will want to make sure your assetDirs array contains the parent folder of your revved file.
assetDirs documentation
This is the list of directories where we should start to look for revved version of the assets referenced in the currently looked at file.
usemin: {
    html: 'build/index.html',
    options: {
        assetsDirs: ['foo/bar', 'bar']
    }
}

Suppose in index.html you have a reference to /images/foo.png, usemin will search for the revved version of /images/foo.png, say /images/foo.12345678.png in any directories in assetsDirs options.
In others words, given the configuration above, usemin will search for the existence of one of these files:
foo/bar/images/foo.12345678.png
bar/images/foo.12345678.png
@Billy Blaze should be able to replace his custom blockReplacements function by updating the assertDirs in his usemin block to be assetsDirs: ['js/dest/rev/test', 'public']
Answer: In addition to what Micah said about getting the correct assetsDirs path, you can set the DEBUG variable to actually see what paths are being searched for your files.
If your build task is "build", then you would enter this:
DEBUG=usemin:*,revvedfinder grunt build
That will help to track down exactly what path(s) you need in assetsDirs.


When baking bread in a multi cooker is some water required?

Question: If I want to bake bread in a multi-cooker, do I still need a small amount of water at the base of the inner bowl?
Answer: No - think of the inner bowl as a loaf or sheet pan the dough is in contact with, and instead of air transferring heat energy from the heating elements to the pan, the heating element is already in direct contact with the pan and outputting much less energy.
If your inner bowl is plain stainless steel, you may want to add a thin layer of cooking oil or parchment to prevent sticking.


Should QA test bugfixes in Dev Environment

Question: I encountered a situation where the dev team suggested that they will push bug fixes to our dev environment rather than to the test environment, and they asked QA to test there first. I am not sure if this is a good practice, I always thought it is better to test in the test environment, but maybe there are circumstances where testing in dev environment makes more sense?
Comment: Every place has their own definition of what "the dev environment" and "the test environment" are. There's no way for us to know, from just the content in your question, whether testing in your "the dev environment" is appropriate.
Comment: Re:"...test there first".  Do you mean that QA will do a 'confidence' test in the development system first but still do the 'official' test on the production system; OR do you mean, QA will only test the changes on the development system and claim success based on that alone?
Answer: Well why do you separate dev and test environments?
Normally it's because testers want control over when their environment changes. It's annoying when a test that was passing starts failing without you noticing because you didn't realize the environment changed.
Now a dev team pushing to a dev environment is not weird at all. It's not weird for the dev team to run tests in dev. It is a bit weird to have built a test env for the QA team and then have the QA team use the dev env to test.
But none of this is a problem so long as no one goes and changes the environment when people aren't expecting it to change. Managing change is the only reason to separate these anyway. So, if for some reason, they want to suspend that separation, maybe to tighten the time between bug fix and QA feedback, and maybe just this once, then I think it could be fine. Just don't surprise anyone with this.
If it works really well for you it may change your way of testing.
Answer: There is no right answer for this question. This depends on how your team develop new features, how they are delivered on the production, the development cycle of the team, if the project have budget to have many environments, etc.
I already work on a software where only some developed features are delivered to tests. To not merge a lot of branches that could not be delivered to production so soon, we decided to have a test environment separated having only the code that will be delivered on the next version of the software. So, use the dev environment it is not the best solution in this example.
For general cases, the better solution is have a test environment separated, because also it's normal that the development team make some changes on the software that makes the environment unstable for a certain period. When this happens, the QA team will not be affected, because they will receive only in your environment more stable builds.
But test in the dev environment can work too, but needs more discipline and maturity from the dev and QA team. If the dev team have the concern to maintain the development environment always stable, when something goes wrong they must prioritize the stabilization of the environment for the QA team continues their tests. The QA team, of course, needs to be aware about these kind of blocks, report and understand that this can happen sometimes.
Answer: General Advice
The closer the environment is to a clone of production, the more accurate your testing will be. The further away it is, the more caveats.
Many development environments are not similar to production. Mostly because they are playgrounds for developers to trial different configurations, software bundles, services, etc... This doesn't mean they are useless (for testing), they just aren't going to be definitive in proving that something has been fixed.
For those lucky few that have high-quality prod-like development environments, then they really are no different to test environments, go forth and test. Rebuild the environment first though.
For those environments with some drift from being production like, then run a sub-set of the tests. These tests aim to show sufficient quality to get that code into a more production-like environment. In the more production like environment I would re-run those tests again.
State of Development in your Organisation
The fact that your developers are suggesting this raises a question in my head. Why is it this feature/fix not getting into the Test environment?

Is there a way to reliably duplicate the defect?
Is the defect replication automated?
Is it clear to the developer what the defect is?
Is the developer collaboratively testing and exploring the issue?
Is there some sort of penalty for getting a defect fix wrong when it has been deployed to Test?
Is there some sort of penalty for treating a defect like any other feature?
Is the Test environment occupied by a release that is slated for before/after when this defect should be released?
Is it hard for the developer to obtain diagnostics from the Test environment?
Is the Test environment less production like than the development environment in this case?
Does the defect fix require changes to the environment that cannot be applied to the Test environment until all the future release use that environment?

Figuring out the root issue will help you make changes to the processes, technology, culture, and the system the bug fixes are for.
For clarity: A Penalty is any negative consequence that occurs as a result of an action. So when I say "is there a penalty?" I am talking about specific responses that may be spelled out (the number of defect/fixes directly controls remuneration), or implied (the team member is mocked).
Comment: I am a developer and my QA people want to test in a DEV environment, and keep asking why tests are sometime working and sometime failing. It's a waste of time for everyone. I will use your great points to push back against regression and testing in a DEV environment.
Answer: It would have been common sense that you ask the developer if there was a particular reason to test in the dev environment. If there is a good reason you test in the dev environment. If the devs say there is a good reason but you don't see the reason, you have the choice between testing in the dev environment and possibly starting a fight. If the devs admit there is no good reason, then you test it wherever you think is right.


Cassandra in multiple data center - EC2MultiRegionSnitch

Question: I was reading article from : http://www.datastax.com/docs/1.0/cluster_architecture/replication#networktopologystrategy and I have a question about - EC2MultiRegionSnitch. I did not understand it well. According to article: if application requests data from node, but that node does not have data, but data is in another node in other data center, will application be able to get it?
Answer: In regard to a standard implementation of Cassandra the answer is Yes. So everything in the cluster regardless of the data center would have access.
From the Apache Cassandra site:

Cassandra's support for replicating across multiple datacenters is
  best-in-class, providing lower latency for your users and the peace of
  mind of knowing that you can survive regional outages.

The site you're referencing is talking about a service they perform called partitioning where they're actually distributing data in a different way based on their partitioning scheme, while still using Cassandra as the database. They do replication based on NetworkTopologyStrategy which depends on the network and the number of datacenters.
In regard to Amazon EC2
They're mixing lingo a little bit which is where the confusion is coming in.

... on Amazon EC2 where all nodes in the cluster are within a single
  region. The region is treated as the data center and the availability
  zones are treated as racks within the data center.

So on Amazon's network a region will contain multiple data centers, but they're distributing info like it were local to a data center (probably because their network has plenty of resources and nodes). This document here goes more into the availability zones concept for their network. Basically their Network Topology is a little larger than most networks.
The data should remain in what they're considering a data center, but whether this is the same physical data center or not would depend on the number of racks, the types of machines they're running and the backbones (OC-3,OC-12,OC-48, etc lines) going between them. If you're in a region where they can't have replication across multiple data centers as quickly they'll likely have more redundancy in the physical data centers themselves.
Comment: So the data will remain locally for each data center, right?
Answer: Lets understand data distribution in multiple data center first. If you have two data-centers -- you basically have complete data in each data-center. And if you have set replication factor, say, 2 for each data-center -- this means each data-center will have 2 copies of the data. This is where token assignment to nodes comes into the picture as important factor to make sure no node is overburdened. See this image from datastax website:

You see T0 and T3 are fatter than the rest. If you see whole cluster, it seems that data must be equidistributed... but that's not true. Each data-center can be seen as virtual ring within the ring. :) You see the images below? Now you realize that T0 is carrying data range (T2, T0] and T3 is loaded with (T5, T3]! But the fact that all is within the data-center, on any sunny day, you would not need to go fetch from other data-center unless you have ALL or EACH_QUORUM (or a CL more than number of replica on the data-center) as your consistency level.
So, to answer your question: In a multiple data-center setup, you will always have data in each data-center (assuming proper replication factor is setup). If you have a consistency level such that it require to read/write from other data-center to satisfy the consistency level, the coordinating node (the one your client is connected to) will talk to a node in other data-center. In EC2, each region is a data-center, each availability zone is treated as rack.
Comment: what do you mean by "local data"? Look at consistency level. If you have set consistency level "LOCAL_QUORUM" the request will never wait for data to be returned from other data center. And, if you write with "LOCAL_QUORUM" data will be written to the data-center the client is connected to and then the replication will take place in background. So, connection speed between data-centers should not matter. You can tune it to performance requirement.
Comment: Hmm, that is not what I need, because network speed between data centers are slow. So I do not want replication occur between data centers. Can I configure Cassandra so that local data is stored local only and be accessed from other data centers?
Comment: cross-data center requests occur very rarely
Comment: local data is local to data center that is in one region. In other words, I do not want to replicate to all data centers, but I want one data center to have all replica of others.


How to remove rebar passing through an inaccessible pipe

Question: My maintenance crew recently discovered that someone drove a rebar through a sewer pipe during construction. Obviously this causes problems. The rebar in nearly dead center of the pipe which is encased in a concrete floor. Any ideas to remove the rebar with out breaking up the floor? There is access from the outside about 10-15 feet from the rebar. Thanks.
Comment: I agree and although not the answer the op wants I believe this is the best path to eliminate the rebar from the pipe. Maybe this should be an answer.
Comment: @EdBeal thanks, I posted as an answer and removed the comment.
Comment: Even if the rebar is removed, the pipe has been damaged.
Answer: They make root cutters for cutting plant roots that have grown through pipes, but they are made to cut roots, not steel. I'm not aware of anything that is specifically designed for this. Maybe you could get a steel cutting blade made for a root cutter. You would then still have to get the pipe lined afterwards to seal the holes. This would be a pretty difficult and expensive process, and it would not be guaranteed to work.
Overall, it will probably be the best and cheapest option to cut the concrete around the pipe, fix it properly, and replace the floor. If the repair blending in is of concern, you would want to cut at existing saw joints, if the concrete will be covered, you can just cut and replace the immediate area of the repair.
Comment: Phillip, I would have left the comment so the op would realize you were the first to respond. When I up vote I look at who posted first, within a few minutes give them both a vote because it wasn't someone just reposting your comment.  I hope you did not loose the upvote or 2 you had when you deleted, keep on helping that's what we do.+
Comment: If there is a device that is made for wood, but otherwise would do the job, it may work like this: The rebar steel is softer than tool steel, but concrete is harder. It may be possible to wear down the tool multiple times, replacing it each time. (While cooling it with water to not heat the tool steel too much, while grinding down any teeth) I do not say it works - just a last resort idea it the tool is cheap enough.
Answer: While you might be able to find a specialty coring outfit that can cut the rebar without damaging the pipe, I suspect that their cost is going to be higher than just busting out the floor/ digging around the pipe/ removing the rebar/ sleeving the pipe to repair/ filling and patching.
Unless you can pin this on someone with insurance, I'm afraid you're on the hook for this.
Answer: Repair of collapsed or corroded cast iron sewer pipe under concrete slabs is done where I live by either cutting through the slab or by tunneling under the slab.
Answer: You could try cutting it out with a diamond wire saw.  I have seen them slice right through tower block pillars (concrete and rebar).  If you could loop the wire over the rebar and keep it flush to the side of the pipe it would cut though easily.  There are hand saws available (basically just a diamond coated wire with loops on each end). The other option might be an angle grinder on a long pole.
Then you'd need to repair the pipe using CIPP or similar.  Good sewer CCTV companies should be able to help with that.
Comment: Hello, and welcome to Home Improvement. Thanks for the answer; keep 'em coming. And, you should probably [take our tour](//diy.stackexchange.com/tour) so you'll know how best to contribute here.


Apache setting ports both in "NameVirtualHost" and "Listen"

Question: In Apache ports.conf I have
NameVirtualHost *:80
Listen 80

I can't understand that since in NameVirtualHost *:80 the port is already set, why there is a separate Listen 80.
What does it mean? What would be if they were different?
Answer: From the Apache website:

The Listen directive does not implement Virtual Hosts - it only tells
  the main server what addresses and ports to listen on. If no
   directives are used, the server will behave in the same
  way for all accepted requests. However,  can be used to
  specify a different behavior for one or more of the addresses or
  ports. To implement a VirtualHost, the server must first be told to
  listen to the address and port to be used. Then a
  section should be created for the specified address and port to set
  the behavior of this virtual host. Note that if the  is
  set for an address and port that the server is not listening to, it
  cannot be accessed.

Apache is very flexible. The most basic way to use it is without virtual hosts. If you are not using virtual hosts, you can use the Listen directive to specify which network interfaces and ports to use. You can specify basically every option which can be specified in a virtual host right in your http.conf file (which is how Apache.org packages it last I checked BTW).
VirtualHost directives are overrides for this default behavior. They tell Apache to treat certain IP and port combinations differently. If Apache didn't have both then you would NEED to use virtual hosts. This used to be a bigger problem when virtual hosts were first invented. At the time browsers didn't know how to handle them and even though support was added to all popular browsers soon after, many people continued to use outdated browsers at the time. Because that was a long time ago, most Apache distributions now use virtual hosts by default because they are more flexible and make it possible to respond differently depending on IP, port or name.
Even now that we have virtual hosts, the fact that we can specify a default configuration for our domain is useful. Consider the case where someone enters an invalid sub domain name. Since we have a default website we can use it to show a custom page\site when someone tries to access it.
The reverse type of situation could also be true. If you wanted to you could make sites-enabled a shared folder and adjust the contents of the ports configuration files on a per server basis in order to load balance many servers.
That being said, I do think that it's odd that Apache doesn't seem to have a way to automatically set them based on the virtual host configuration.
Just for fun, I wrote a script that could make this work automatically. You can try it if you like but I warn you that you should be cautious about using it because it is almost completely untested. Meaning THIS IS NOT PRODUCTION CODE:
<?php
$path=dirname(__FILE__); // The current file path. It is used so all other paths can reliably be set relatively.

$cfg=array(
   'output_file'=>"$path/var/ports.conf.out", // This is the file to be generated.
   'template_file'=>"$path/tpl_default.php",
   'glob_patterns'=>array( // This array contains a list of directories to search for virtual hosts in.
      "$path/test-enabled/*", // For now I'd just test some copies which you can play with. Once everything is
   ),   // good then you can change this to /etc/apache/sites-enabled

);

##############
define('IS_CLI', PHP_SAPI==='cli');

echo "Auto Vhost Script\n------------------\n\n";

//echo "Arguments: \n"; print_r(arguments($argv));

echo "Output File:\n\t{$cfg['output_file']}\n";
if(!isset($cfg['output_file'])||!is_writable(dirname($cfg['output_file'])))
   die("ERROR: Cannot write to output file.\n");

echo "Template File:\n\t{$cfg['template_file']}\n";
if(!isset($cfg['template_file'])||!is_readable(dirname($cfg['template_file'])))
   die("ERROR: Cannot read to template file.\n");

echo "Search Paths:\n";
foreach($cfg['glob_patterns'] as $pattern) {
   echo "\t$pattern\n";
}
echo "\nReading configuration files...\n";

$vhosts=array();
foreach($cfg['glob_patterns'] as $pattern) {
   echo ">> $pattern\n";
   $files=glob($pattern);
   foreach($files as $file) {
      echo "\t>> ". basename($file) ."\n";
      $handle=@fopen($file, "r");
      if($handle) {
         while(($buffer=fgets($handle, 4096))!==false) {
            $status=procLine($buffer);
            if(!$status) die("ERROR: Failed reading input line.\n");
            if($status===TRUE) continue;
            $vhosts[]=$status;
         }
         if(!feof($handle)) die("ERROR: Unexpected fgets() fail.\n");
         fclose($handle);
      }
   }
}
echo "\n\nGenerating template data...\n";
$nvhost=array();
$listen=array();
foreach($vhosts as $vhost) {
   // We're just going to assume that if you have multiple VirtualHost for the same port that means you want to use
   // *:port . You could improve this by actually checking to see if multiple hosts have been assigned to this port
   // but you'd need to rearrange the data a little.
   if($vhost['is_name']||isset($nvhost[$vhost['port']])) {
      $nvhost[$vhost['port']]='NameVirtualHost *:'.$vhost['port'];
      $listen[$vhost['port']]='Listen '.$vhost['port'];
   } else {
      $nvhost[$vhost['port']]='NameVirtualHost '.$vhost['host'].':'.$vhost['port'];
      if($vhost['host']=='*')
         $listen[$vhost['port']]='Listen '.$vhost['port'];
      else $listen[$vhost['port']]='Listen '.$vhost['host'].':'.$vhost['port'];
   }
}
echo "\n\nWriting output file...\n";

$tpl=file_get_contents($cfg['template_file']);
if($tpl) {
   $tpl=str_replace('{NAME_VHOST}', implode("\n", $nvhost), $tpl);
   $tpl=str_replace('{LISTEN}', implode("\n", $listen), $tpl);
   file_put_contents($cfg['output_file'], $tpl);
}

echo "\n\nDone.\n";

function procLine($line) {
   if(!preg_match("/^(\w)*<VirtualHost(.)*>(\w)*/", $line)) return true;
   $host=substr($line, strpos($line, 'VirtualHost')+12, strlen($line)-strrpos($line, '>')+2);
   $last_square=strrpos($host, ']'); // This is in case the host is specified in IPv6 format
   $cln=strrpos($host, ':');
   if($cln!==FALSE && $cln+1<strlen($host) && $cln>$last_square) {
      $port=substr($host, $cln+1);
      $host=substr($host, 0, $cln);
   } else $port='80';
   $is_range=strpos($host, '*')!==FALSE;
   $is_ip=$is_range||filter_var($host, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE)!==FALSE;
   $is_name=!$is_ip;
   return array('host'=>$host, 'port'=>$port, 'is_name'=>$is_name, 'is_ip'=>$is_ip, 'is_range'=>$is_range);
}

All that needs to be setup is the $cfg variable at the top of the script and a ports configuration file template. To use it run it with PHP: php path/to/auto_vhost.php. Once you get that working you can add the php call to /etc/init.d/apache2 near the top (or if you look there is actually a slightly better place but only because this really isn't needed on service apache2 stop commands). Doing this will cause this script to be ran right before Apache starts or restarts so that it'll be what gets loaded.
Here is a sample template file for this:
# This file was generated from a template by auto_vhost.php

{NAME_VHOST}

{LISTEN}

<IfModule mod_ssl.c>
    # If you add NameVirtualHost *:443 here, you will also have to change
    # the VirtualHost statement in /etc/apache2/sites-available/default-ssl
    # to <VirtualHost *:443>
    # Server Name Indication for SSL named virtual hosts is currently not
    # supported by MSIE on Windows XP.
    Listen 443
</IfModule>

<IfModule mod_gnutls.c>
    Listen 443
</IfModule>

Comment: This has been added to my Gist page: https://gist.github.com/krowe/9e60eb60a8c7fe1de45e
Answer: Listen 80 tells Apache to actually set up the socket on port 80, has nothing to do with naming.
NameVirtualHost *:80 tells Apache to refer to the named vhost configs for this particular address/port socket, has nothing to do with setting up the socket.

What would be if they were differents?

The difference would be your configuration would be broken and your server wouldn't work.
Answer: Every program by default need to a port and Kernel dispatch packets to programs via port  numbers when you say :
Listen 80

You tell kernel my apache wants to use port 80 , when you get with des-port 80 give me ..., if you try:
root@debian:/home/mohsen# netstat -anp |egrep apache
tcp6       0      0 :::80                   :::*                    LISTEN      25791/apache2

When you changed Listen  line, netstat's ouput will be changed.
But, Virtualhosts:
It dont conflict port, for more details read about VirtualHost by name and VirtualHost by IP


When registering a domain, which extentions should be avoided?

Question: I'm planning to register few domains for my own portfolio, a personal blog and another for a side business. Ideally I would like to get all domains ending in .com, but if I am unable to do so, is the next best option to go for a domain ending in .net or .org? Are there specific naming conventions I should follow and extensions I should avoid?
Comment: Those "extensions" are called Top Level Domains or TLDs.
Comment: .xxx (is less than 15 characters long)
Answer: Depends on the subject matter. For a technical website (you didn't mention what your blog was about) or a design/development portfolio, you should go with whatever is the most memorable (or whatever is available). Tech-savvy users usually just use bookmarks, and if not, they tend to be more friendly toward non-.com domains, and will be more likely to remember that your website is a .net or whatever it is. However, if the website is supposed to appeal to a wide audience, a .com domain is a must. I've found that if you tell an average person the name of a website, but don't tell them the exact domain, they will just type the name of the website + .com.
Try to stay away from .org unless the website is for a non-profit organization of some sort (think Wikipedia). Whenever I go to a domain that ends in .org, I tend to think "free/open source", so if your website doesn't fall under than category, better to avoid it. Also, avoid obscure ones like .biz (as @chris mentioned).
You could also go for domain hacks (like del.icio.us and play.it), but they are usually harder to remember, and all the good ones are taken already.
Comment: Hold down the `.com` button on your iPhone some time :-)
Answer: Go for the most memorable one. Which is probably .com followed by .net then .org
I'd say that the conventions as initially planned are mostly ignored. Originally .cx was meant for sites in the Christmas islands! And .com for commercial entities.
Avoid any of the ones spammers seem to love. For instance I tend to be dubious of anything ending in .biz
Answer: If it's for a portfolio, maybe you can try with .me, .biz or .info.
If you can get the .com, it's the best option, after that I think it's more important to be well ranked on search engines than a good domain name
Comment: Or `.name`, as `firstname.surname.name`. It's ugly but it's what the TLD is for.
Answer: I can't ever remember deliberately going to a .biz or a .info, so if you're looking for TLDs to avoid, they'd be right at the top of my list.  And probably .cn should be avoided, too, since when I see that I immediately assume spam.  That last one might be different if I actually read chinese, but assuming your site will be in english, that pretty much leaves .com or some sort of clever name/country TLD.
Answer: Well .net would be the next major one you would want to grab. .org is suppost to only be for non-profit type organizations, so keep that in mind.  When I bought a domain, I just bought the main 3 you mentioned. .com .net and .org.
Answer: First, a nitpick: The .com part of a domain name is called the "top level domain" or TLD, not "extension".
There are a limited set of TLDs defined and recognized by IANA consisting of every two-letter country code and certain names with three or more letters. Originally, the generic names were just .gov, .com, .net, .org, .edu, and .mil (along with .arpa for historical reasons, as well as defined unassigned names such as .test and .example).
Recently, the TLD name space was expanded with the names .biz, .info, and .name among others, and a mechanism was created for sponsoring organization to apply for and create additional names. A complete list with notes can be found at Wikipedia, and IANA maintains the official list.
Which should you select?  The one or ones that best fit your site's purpose and content. Pragmatically, if you pick anything other than COM or NET, you will probably want to consider also capturing the same name in COM and/or NET to prevent user confusion.
In the long run, the idea is that organizations would pick the best name and stick to it, and end users would be educated that not everything ends in COM.


Time-harmonic Maxwell's equations

Question: My question is about the time-harmonic or frequency domain (differential) form of Maxwell's equations. If one solves these and obtain the complex vector field $E$, are the real and imaginary parts independent or correlated? In other words, knowing the real part of the solution, does this put constraints for the imaginary part and vice versa?
Comment: If you assume that the field is truly time harmonic complex then its real and imaginary parts are independent of each other.
Comment: If your signal (field), say $E(t)=a(t)cos(\omega t+\phi(t))$ has $s(t) = a(t)cos(\phi (t)$ and $ r(t)= a(t)sin(\phi(t)$ such that their bandwidth is much less than $\omega$ then you can say that for the complex envelope $e(t) = s(t)+ \iota r(t)$ of $E(t)$ the real and imaginary parts $s(t)$ and $r(t)$ are Hilbert transforms of each other.
Comment: @user31748 Is there a proof for your first comment in the case of a purely time-harmonic field?
Answer: No, because the coefficients of any Fourier expansion are usually independent of one other (unless some further conditions hold). The decomposition into real and imaginary part (or equivalently sine and cosine) is a special case of a more general Fourier decomposition
$$
\psi(\textbf{x},t)=\int d^3k\,d\omega\,\tilde{c}(\textbf{k},\omega)\,\textrm{e}^{-i(\textbf{k}\cdot\textbf{x} - \omega t)}
$$
where the exponentials $\textrm{e}^{-i(\textbf{k}\cdot\textbf{x} - \omega t)}$ form a basis of a $L^1(\mathbb{R}^3)$ Hilbert space and are therefore independent of one other (otherwise they would not be a basis).

Time-harmonic Maxwell's equations


Two ways to look at a double cover of the projective line

Question: Let $f:L\rightarrow \mathbb P^1_{\mathbb C}$ be the line bundle associated to the invertible sheaf $\mathcal O_{\mathbb P^1}(2)$, $\phi=(X_0-X_1)^3X_0\in H^0(\mathbb P^1, \mathcal O_{\mathbb P^1}(4))$ and $C\subset L$ defined by the equation $T^2=f^*\phi$ where $T$ is the tautological section of $f^*\mathcal O_{\mathbb P^1}(2)$.
The curve $C$ is a singular rational curve, a double cover of the projective line ramified at $P=[1:1]$ and $Q=[0:1]$. As $Q$ seen in $C$ is a smooth point of $C$, if I am not mistaken, using $\mathcal O_C(3Q)$, we can embed $C$ in $\mathbb P^2=|\mathcal O_C(3Q)|$ as a cuspidal cubic curve.
Then given two smooth distinct points $P,P'$ of $C$, in the embedding in $\mathbb P^2$, we can consider the line $\ell\subset \mathbb P^2$ determined by $(P,P')$ and associate to this pair a third point (residual in the intersection $C\cap \ell$ in $\mathbb P^2$) of $C$.
Are there some interpretations of this line and this operation (associating a third point) related directly to $f:L\rightarrow \mathbb P^1$ and the definition of $C\subset L$?
Comment: The smooth part of $C$ is a cover of $P^1-p$ that is doubly ramified over $q$, where I write $p=f(P)$ and $q=f(Q)$. If you identify the double cover with $A^1$ so that $Q$ corresponds to $0$, then the group law is addition. (The identification is unique up to scaling, which does not affect addition.)
Answer: The smooth points on a cuspidal cubic curve in $\mathbb P^2$ can be given the structure of an algebraic group, just as is done for smooth cubic curves. If the tangent directions of the cuspidal point are defined over your ground field $K$, then you get a copy of $\mathbb G_m$. If not, the tangent directions generate a quadratic extension $L/K$, and the group you get is the $L/K$ twist of $\mathbb G_m$. See for example, The Arithmetic of Elliptic Curves, Proposition III.2.5 for the split case. As usual, the group law is determined by the condition that three points add to 0 if and only if they are colinear.
Comment: If the point is cuspidal, there is only one tangent direction, and one obtains a copy of ${\mathbb G}_a$.
Comment: @MichaelStoll Oops, sorry. You're right. I misread the post as saying the curve was nodal. For cuspidal curves, the cusp is always defined over the ground field and, as you say, the group is $\mathbb G_a$. This is described in the same reference.


Why is it important that black bodies absorb all wavelengths?

Question: In every definition of a blackbody I read, it always mentions how a black body is something that emits and absorbs at every wavelength. I understand why it is important that it emits at every wavelength, since otherwise we wouldn't get the blackbody spectrum.
However, why is it important that it absorbs every wavelength? Will this affect the output? Can't I supply it energy by some other means (like giving it a power supply?). In the common hole in the box, we are not providing every wavelength but rather just giving heat directly and getting a black body output.
It seems that the absorption part of the definition has little use - why do we keep saying it then?
Comment: "I understand why it is important that it absorbs at every wavelength [...]" - did you mean to say *emit* here?
Comment: Or, "why is it important that it absorbs every wavelength?" - did you mean to say emit here?
Comment: yes sorry! I've fixed
Answer: One of the two (emission and absorption) necessarily follows from the other one by Kirchhoff's law, which, in simple terms, states that emissivity and absorptivity for any given body are the same.
Saying it must absorb every wavelength does not mean we have to put black body radiation in. It just says that whatever wavelength you shine at it, the body will absorb it. And this is really just the definition of something being black. Of course, energy can also be put in by some other means. Saying it is black and absorbs at every wavelength only means it can absorb at any wavelength, not that it will only absorb black body radiation or even that radiation is the only way to input energy.
Concerning the terminology, it is indeed not necessary to mention both, since one follows from the other. Possibly it's just to make it even clearer.
Comment: @JohnHon The photosphere of the Sun isn't a blackbody. Whilst it does absorb all radiation incident upon it, it fails the other criterion of being in thermodynamic equilibrium at a single temperature.
Comment: So then is the sun a black body? We know it emits like one but does it absorb like one? If it doesn't absorb like one - does it fail the definition for a black body?
Answer: If a blackbody reflected the light that was incident upon it at some wavelength range or allowed that light to pass through it, then the intrinsic spectrum of light emerging from the body, if it were in thermal equilibrium, would be missing the specific wavelengths that could not be absorbed.
The definition of a blackbody is that it absorbs all radiation incident upon it and that it is in thermal equilibrium at some unique temperature. Both parts of this definition are necessary.
In practical terms, a hole absorbs everything that is incident upon it so long as there is a negligible chance of any photon bouncing around whatever is behind the hole and coming out again and this could form the basis of an experimental blackbody.
Consider the thought experiment of putting two cavities, A and B, together, such that radiation can pass through a small hole from one to the other. We can allow them to equilibriate so that they attain the same temperature, in which case the flux of energy from A to B is the same as from B to A.
Now an ideal cavity absorbs everything that enters into it. But suppose that were not the case for B and that light over some range of wavelength bounces around and eventually emerges from the hole.
We can do the same experiment. A is now an ideal blackbody, but B is not. We put them together but this time insert a filter between them which only allows through the range of wavelengths that B will not absorb. We allow them to equilibriate at some temperature. The flux of radiation from A to B must equal that from B to A over the restricted wavelength range.
But all the flux going from B to A must be that which was emitted by A in the first place, since none of it is absorbed by B. That means if we pull the cavities apart and examine the spectra emerging from them, even though they are at the same temperature, the spectrum from B would have a big hole in it where it didn't absorb light. i.e. not a blackbody spectrum.
Note that a blackbody does not have to get its energy content by being illuminated. It just has to be capable of absorbing all radiation incident upon it.
Answer: With a black body, absorption is the defining property:
a black body is a body that absorbs all radiation incident upon it
One can then prove, using thermodynamic arguments (associated with Kirchoff) that if such a body is in thermal equilibrium then the spectrum emitted is the same as that of any such body at the same temperature.
What is notable about this argument is that it does not involve the shape or quality of the body, chemical composition, and things like that.


Are my tattoos and other acts committed during a period of disbelief going to be forgiven?

Question: I was born a Muslim, became a disbeliever and repented back to Islam.  Are my tattoos and other acts going to be forgiven?
Answer: Of course yes, Allah said in The Holy Quraan

Say, "O My servants who have transgressed against themselves [by sinning], do not despair of the mercy of Allah . Indeed, Allah forgives all sins. Indeed, it is He who is the Forgiving, the Merciful (53) And return [in repentance] to your Lord and submit to Him before the punishment comes upon you; then you will not be helped (54) - Surat Az-Zumar 39:53-54


Predicting products of chemical equations?

Question: Consider the equation $\ce{2 NaOH (aq) +Cl2 (g) —> NaOCl (aq) + NaCl (aq) + H2O (l)}$. How would one know the products of this reaction? Is there a general way of doing this? I would have no earthly knowledge of predicting this. Is it that we would look at each molecule and decide which goes with which on the basis of octet? Also, why does it just so happen that 2 moles of $\ce{NaOH}$ react with 1 mole of chlorine? What would happen if it was a 1:1 ratio?
Comment: Yes there is a way of doing this. It is called chemistry. It does not boil down to one or two simple rules, otherwise it would never be called a science in its own right. As to the ratio, that's quite simple: take any other ratio, and one of the reagents will be in excess.
Comment: Welcome to Chemistry.SE. We'd like you to take the [Tour](https://chemistry.stackexchange.com/tour) to get familiarized with the site and to understand our policy towards homework questions. Meantime, let us know what you have done so far to solve this specific problem as starting point.
Comment: I agree with Ivan Neretin. In addition to that, in general, knowing molecular orbital diagrams of individual reactants and possible product candidates will help quite much to guess the outcome. I did not memorize any reaction in inorganic chemistry for instance, but you can attain this kind of comprehension mostly at the end of the undergraduate program.
Answer: One would not "know" what the products of the reaction are, a priori. As mentioned by @IvanNerenten, the way you know is by studying chemistry. In fact, the reaction is different if you use cold NaOH vs hot NaOH. The reaction as written is with cold NaOH and is a disproportionation reaction.This is where the chlorine is both oxidized and reduced in the same reaction.
Answer: How would one know the products of this reaction? Is there a general way of doing this?
It's not easy at all, in chemistry, there are patterns that are valid in many cases (e.g. you know that you are adding a strong acid with a strong base you can predict that you will have a slat and water as products).
For more complex reactions it's harder to find valid patterns. There are some techniques that use ab-initio calculations and some softwares but in many cases, they are not so accurate.
I find useful these rules of thumbs not always valid:

Get a good knowledge of electrochemistry.
Write the equation highlighting the ionic compounds (e.g. $\ce{Na+ + Cl-}$ ).
Check the possible products in agreement with the stoichiometry.
Stable compounds (e.g. water) are more likely to occur compared to unstable compounds.

Why does it just so happen that 2 moles of NaOH react with 1 mole of chlorine? What would happen if it was a 1:1 ratio?
A chemical formula it's a model a representation of the expected behaviour.
If you had 1:1 ratio you would have a limiting reagent. So  you will end with 1 mole of NaOH reacting with half mole of $\ce{Cl2}$.


Creating a rank on performance and size

Question: Ranking is not something that I need to do particularly frequently in my job and its probably the weakest part of my statistics background. I have a dataset containing a list of items and a performance metric associated with each (a percentage success). Items in this list have always been ranked based upon that percentage, but I have noticed that items with small size bounce around the ranking on a weekly basis (the cost of 1 failure for a small sized item shifts the percentage hugely and results in an item jumping from 10th to 500th). Similarly there are a number of small items that often top the ranking (yay great, you got 4 of 4 right! while the item in second got 498 of 500 right...). I want to create a new ranking function that combines the quality metric with the size of the item over which the quality metric was calculated. Any guidance on a standard approach to this would be very helpful.
Answer: Rankings are the stuff statistical nightmares are made of. The reason for saying this is that once one gets beyond simple univariate data there is rarely, if ever, a "ground truth" on which to build an infallibly accurate, incontestable solution. Read Malcolm Gladwell's excellent New Yorker article on the kluge-y nature of college rankings, The Order of Things, to get a sense of just how fraught rankings really are.
http://www.newyorker.com/magazine/2011/02/14/the-order-of-things
Caveats such as are expressed in Gladwell's article never stop people from developing rankings since few ever penetrate the foggy mists of method and ask the tough questions about what it means and is really doing.
So, what can one do in your case? The important thing to bear in mind is that exclusive use of and reliance on relative metrics -- such as percentages -- biases the ranking in one direction. A simple corrective is, as noted by Evad in his answer, to add a second metric based on the absolute values of success. By combining relative and absolute metrics, one can hope to arrive at something like a normalized ranking.
However, there are lots of ways of combining things and it's here that the rubber really meets the road, so to speak. The key questions to ask at this point are Who is the audience for this metric? and If I do something sophisticated, will they understand it? Here are some possible approaches to combining these metrics:

Create deciles for each, add the values of the resulting decile assignments and rank that
Since they are in differing units, standardize each to a mean of zero and std dev of one, add them together and rank that
Use principal components to combine them into a single latent vector and rank that

The things to bear in mind are, first, that the possibilities are almost endless in terms of the heuristics that can be created from such a seemingly innocent and simple stream of information and, second, that there is no one "right" or true way to bring them together to create a rank ordering.
Comment: Some very interesting reading. Thanks for taking the time to provide your insights. I will start digging in to it!
Answer: A simple method would be to take the average success rate weighted with actual success rate of an item [where the total trials for an item is low eg below 10, or below 15. In a nice scenario the average success rate for every item would be in theory be 50% if left to chance and normally distributed.
Any threshold can be used to start with but it will be better to find the statistically significant point where 4 out of 4, or 7 out of 7 is very unlikely to have happened by chance [if there are 500+ items, 9 or 10 probably will be the minimum starting point for average 50% and may be higher / lower dependent on the average probability of success]. The threshold must be kept low though, or this method could mute statistically significant items [20 out of 20, with 50% expected success].
Based on a threshold of 10:

If trials < 10: (Trials/Threshold*SuccessRate) + (Threshold-Trials)*Average success rate
If trials >=10: Use actual success rate.

Example:

If an item has a success rate of 8 out of 8 [100%]. Then due to low confidence as it possibly occurred entirely by chance, it is averaged with weighted average success rate.
Now if the success for the item continues, line 2 shows the new confidence based expected success rate.
Finally if the success continues and reaches 10/10 [line 3], the average success of item is nolonger weighted with actual success rate. This requires programming / formulas to avoid using the formula once 10+ trials are reached and you are confident in success rate.
8 out of  8:  8/10 * 8/8 + (10-8) * 50% = 90%
9 out of  9:  9/10 * 9/9 + (10-9) * 50% = 95%
10 out of 10: 10/10 * 10/10 + (10-10) * 50% = 100%
11 out of 11: 11/11 = 100%    *Use actual success rate

This method can be used in an exponential manner as well [which will add considerable improvement]. An even simpler method is to simply exclude items below the threshold from being ranked.
Important: Items likely will not naturally all have same expected success rates which needs to be accounted for in any method unless the list is for the most part arbitrary. Example: comparing sales success of an inbound call centre verse a telemarketer salesperson.
The average salesperson might have an expected success rate of 50% [average of all sale staff] for a customer calling who is already interested, so a success rate of 16/20 [80%] from is great. BUT a telemarketer might have an expected success rate of 5% who achieves a success rate of 5/20 [25%] is actually a slightly better salesperson than the call centre worker and if a list were to be made for all phone based salespersons between the two companies, that telemarketer would be unjustly ranked very poorly in such a list.

Creating a rank on performance and size


If someone is a Monotheistic ( like a agnostic) is he Muslims or will he go to heaven

Question: I know a Pearson who is a agnostic and is a physical science at my high school. I know Arabic, Islamic law(Figh) the life of the companions of the Prophet Muhammad(SalaaAllahu alahi wa salam)( or SAW) so can agnostic person be Muslim? He believes that god can be one or many. He just doesn't know, he is just ignorant. He is a really religious person and remind of the father sa'ad ibm zaid. Zayd bin Amr Was a monotheistic and died in 605. I'm not comparing hem this teacher but he told me that he will not become a  Muslim until he looks into all religions.
Answer: If someone does not believe in:

Allah alone (1 god)
Prophet Muhammad (25 prophets)
The Holy Scriptures
The day of judgement
The angels
Jesus being only a messenger and prophet of God

If someone does not:

Follow the Qur'an
Believe in the Qur'an
Identify as Muslim
(Essentially following the 5 pillars)

They will be going to hell.

"Indeed, the religion in the sight of Allah is Islām. And those who were given the Scripture did not differ except after knowledge had come to them - out of jealous animosity between themselves. And whoever disbelieves in the verses of Allah, then indeed, Allah is swift in [taking] account."
—Qur'an 3:19


Acceleration of human accelerated into vacuum

Question: How would one calculate the acceleration of an object released into a vacuum? Imagining you have a Person in an airlock and that airlock suddenly opens depressurizing instantly from 1atm to 0 how could one calculate the acceleration? I tried doing $\frac{1}{2}A\cdot \frac{p}{m}$ because I assumed that when depressurizing into a vacuum the air pressure inside the capsule would push on the back of the person outward providing acceleration according to the pressure. When I plug in my numbers the result is an acceleration of over a 100G! Something must be wrong right? Could a human survive such an acceleration because of the short period and if they were in a space suit? Your help is much appreciated.
Comment: Atmospheric pressure over even a square meter is a lot of force. If all that force was focused on the person you would get great acceleration. But, in an airlock situation, most of the gas would escape around the person in the airlock, and the actual acceleration would but much lower - but much harder to compute, depending on the details of the geometry and the equations of compressible fluid flow.
Comment: Bear in mind that there is also air between the person and the airlock, and this air has inertia, so the force it exerts on the person will not immediately jump to zero. As the pressure differential between back and chest rises, air is also flowing around from behind. These effects all propagate at the speed of sound, which depends primarily on temperature - which reduces as the air decompresses. Compared to that, how "instantly" does the airlock really operate? Subsonic door? dematerialization within the Placnck time? Hypothetical limit conditions do often produce silly answers.
Answer: For an idealised system like whole air in the room is at the back of the person who stands at the door is apparently too high and this link 1. Link has already shows the necessary calculations so I didn't put them here and for more broad calculations you may refer this link 2. Link.


Webkit browser & automation

Question: Have anyone come across open source tools/framework for Webkit browser test automation?
Answer: There is (not tried) WebAii Automation Framework where the current Beta 220.127.116.11 has Safari 3 support added on windows (it's free but I don't think it's opensource).
If you want do it yourself:
On Apple you should be able to script it AppleScript or from
MAC OS X > 10.4: there is Automator
On Windows you might consider using P/Invoke and looking at the WinLauncher tool from WebKitTools
Answer: I haven't seen a framework to run the tests but if you're looking for input to test against there is Ian Hickson's adhoc and evil test suites in addition to the traditional acid tests.
Answer: Which WebKit? Selenium seems to have drivers for several WebKit-based browsers.
WebKit itself has a test suite, to be implemented by each platform, which the WebKit documentation calls DRT or DumpRenderTree (see also LayoutTestController).

Webkit browser & automation


Gap between bumper and trunk

Question: I have a Vitara brezza and I accidentally hit my rear bumper with a heavy bag while I was loading it in the car. There were no scratches or dents when I checked the bumper, however the gap between bumper and trunk seems to have increased. I don't have a photo clicked, however I can share a similar image down here. The bumper seems to be fitting fine from the sides though at the center it's a bit wide. Any ideas how do I fix it?
Comment: More than likely when you hit the bumper, you've either stretched or torn the mounting holes in the bumper, which is allowing it to sag a bit causing the gap. You'll probably need to pull the bumper off and see where damage may have occurred, then what would be needed to fix what you've found. Worst case scenario would involve replacement.
Comment: I checked the gap today in my vehicle and it doesn't seem to be this wide. It's only detached at the center. However, when I tried to push it back it seems to get stuck and then again it reverts back. I also noticed it bends a bit at the hinges when I try to push it. Maybe it's dislocated.
Answer: I'm going to speculate that there are some tabs along this edge that are designed to pop into some slots adjacent to them and hold this into place.  When you bumped it they popped out, perhaps they were already loose due to being removed before.  Perhaps they are mostly broken off.  That's not uncommon.
I'd try to pop them back in.  Look closely and see if you can find where the tabs are and line them up with the slots and then try to push them back in.  It may take a smack with your hand or fist to get them all the way in.
If the tabs are damaged or broken you may have to look at an alternate means of fastening.  Perhaps some zip ties or even some adhesive could be useful.
Comment: Yes there was a sensor replacement done a few weeks back. I will check if there's something loose in between.
Comment: I tried to push the bumper back in but it holds in there for a moment and pops out again as if forced to pull out
Comment: As I mentioned, it's quite possible that the tabs that hold it in place are damaged.  You may need to replace it or find an alternate method of securing it.

Gap between bumper and trunk


When and how does a conscious character recover from wounds?

Question: In Traveller (GDW: 1981 printing) if I sustain a wound in combat but am conscious at the end of combat, how and when do those wounds recover? P.34 of "Characters and Combat" details how and when unconscious characters recover from wounds, but it says nothing about a character who never becomes unconscious.
Answer: Someone pointed me to these errata, which includes the following:

Page 34,  Wounding and Death, fourth paragraph  (clarification  and  addition):
  Characters  who  are  wounded when  a  combat  ends  but  never  go  unconscious  (because  no  characteristic  ever  is  reduced  to  zero)  have  their characteristics reset to halfway between the wounded and full strength values (round fractional characteristics down).
The individual is considered to have  sustained  minor  wounds.  For  example,  a  character  with  a  strength  of  8  who  is wounded  to  a  strength  of  4  (and  remains  conscious  throughout  the  combat) becomes  strength  6  at  the  end  of  the
  combat  and  remains  so  until  recovered.  A  return  to  full  strength  for  the  character  requires  medical  attention  (30 minutes with a medical kit and an individual with at least medical-1 skill) or three days of rest.
[emphasis added]
Answer: Per the rules as written, minor wounds do NOT recover any points at all until treated. So, until treated, or 3 days have passed, no recovery happens at all; once either has happened, they're returned to full.

Minor Wounds
Any wound points applied to a
character which do not reduce more
than one physical characteristic to zero
are considered minor wounds. The
character is treated as having the reduced
characteristics until medical care
or recovery has taken place. (Starter Traveller Book 2, p9)

and

Minor Wounds: Minor wounds require
a medical kit, skill of medical-I,
and thirty minutes. Without medical
care, recovery requires three days rest. (ibid.)

Note that the Little Black Books are all essentially CT 2.0; The Traveller Book is 2.1, and the Starter Traveller boxed set is 2.2. Both TTB and ST agree that minor wounds don't heal any loss until either treated or naturally healed.
That said, many consider the minor wounds to be moved to the midway point a the same point as unconsciousness - which would be 10 minutes.

Unconsciousness
One characteristic reduced to zero
results in unconsciousness for ten
minutes. Upon recovery of consciousness,
any wounded characteristics are
placed midway between their wounded
and full levels; round fractions down. (ibid.)
Comment: The errata is a back-port from MegaTraveller. If you have the errata from Don McKinney, it's the official one. But that's not Rules as Written.


What would prevent the genocide of a legitimately dangerous race?

Question: I'm writing a low magic fantasy story in which there's a race of creatures called shadow-thralls that were basically bred as a slave race by a wizard thousands of years in the past. In the present day,they've somewhat assimilated into human cities after being liberated, however they instinctively turn to pillaging and raiding if not kept busy. They are weaker and less intelligent than humans. For story purposes, shadow-thralls periodically revolt and begin raiding every few decades until they're brought back under control and given something to keep them busy. My issue is that I can't really think of why a medieval society wouldn't just exterminate them. I need them co-existing with humans for plot reasons, but I also recognize that humans would likely have turned to extermination within the first few uprisings, kind of like how Europeans almost drove wolves extinct or how homo sapiens killed off the Neanderthals. Basically I'm asking what would motivate humans to tolerate a genuinely an aggressive race of "evil" weaker beings and not just genocide them?
Comment: Just throwing it out there, the whole concept being presented is *dangerously* adjacent to the sad reality of history. Replace "shadow-thrall" with any religious, cultural, economic, or physical identifier and re-read it...  I'll trust you to keep the story palatable.  Think of how much easier life would be if we just genocided all those excitable and violent redheads!
Comment: @A.bakker Cats aren't legitimately dangerous to a human though, at worst a pissed cat is a nuisance, even 100 of them if you ask me, the level of sustained coordinated aggression with no degree of concern for personal safety and self preservation needed for a pack of cats to bring down a human is far beyond the reasonable or plausible in the real world  we are talking domestic house cats right?
Comment: It seems like you're asking us to brainstorm solutions to a complex problem you've created for yourself. Brainstorming, and open ended questions where you're asking us to tell you facts we've made up about your world are not a good fit for this site.
Comment: If they're weaker they're not really legitimately dangerous are they if they are legitimately dangerous then the fact they are is one reason they won't be genocided, not exactly likely they'll go quietly is it  maybe you should be asking what would prevent genocide **by** a legitimately dangerous race
Comment: @Pelinore man, cats can F*** YOU UP. While a seriously pissed single house cat will probably only end a person up with a bunch of stitches and on antibiotics (since infection would be the larger concern, cat bites are at high risk for serious infection), if for some reason a whole bunch of them decided to collectively target a person with intent to kill (obviously highly unlikely irl, since cats prefer flight to fight in nearly all circumstances, but assuming for whatever reason they did), they could do some serious damage, if not actually kill that person. 100 is a lot of cats.
Comment: *"what would motivate humans to tolerate a genuinely an aggressive race of "evil" weaker beings"* maybe they're cute? and tick all the evolutionally hardwired instinctual boxes that make us like other animals (babies, baby animals & pets)  but might make us reluctant to habitually use them as shock troops.
Comment: Quite obviously, shadow-thralls are the only beings who will lend money (with interest, obviously) to the various monarchs and despots in your story.
Comment: What makes a "weaker and less intelligent" species dangerous?  Do you mean they have "glass cannon" stats (very high ATK, but very low DEF)?
Comment: @Cireo That's actually kind of the point. The shadow-thralls are meant to be juxtaposed against actual humans to show that violence/subjugation are NOT "normal" human states of being. The "ideal" slave/minion/soldier being completely and undeniably inhuman is going to be used to highlight that by trying to force other humans into these roles we alienate ourselves from that which makes us human in the first place. The story was basically inspired by Tolkien's quote that "we were all orcs in the Great War".
Comment: Hadn't heard that quote before, thanks for sharing it
Answer: Prisoners Dilemma -- They make VERY good slaves.
When we defeated Dire ArchWizard ScaryBad 200 years ago, we took all his gold and treasure. We also took his Shadow thralls. They were created as a slave race. They are still a slave race. Only now we crack the whip.
Our standing army is mostly Shadow thralls. Even though they are physically small and weak they make good footsoldiers because they were designed to fight and to follow orders. So a formation of shadow trolls does not break as easily as a formation of people. Even after it breaks they continue fighting. Our neighbours' have similar armies. Warfare is mostly thrall on thrall.
No one wants to be the first to drop their thrall army and revert to human soldiers. That would take too long and leave you vulnerable.
Keeping the army busy is not too too different from keeping a regular army busy. In Ancient Rome inventing jobs for the generals, to prevent them seizing power, was one of the Emperor's main jobs.
The thralls spend most of their time drilling and training and the rest on large public works. They build fortification and  pyramids. They dig cesspools and moats. Sometimes we have a second band follow behind and fill in the moat behind them. This keeps two battalions busy rather than one. They take well to this regimented and busy lifestyle.
Thralls are only allowed inside a town's walls when doing construction. This is where non military people encounter them. The thralls are kept on a tight leash but occasionally one slips out and runs amok.
Exception: Since thralls were originally a slave race of Dire ArchWizard ScaryBad, it is possible for other mages to bind themselves to one or more thralls. This lets the wizard mentally dominate their thralls at range. These thralls are not dangerous unless the spell is interrupted. They are branded with the Wizards initials and allowed to enter the town during daylight hours.
The public is educated with a few tips to deal with an escaped thrall. For example if a shadow thrall enters your house remember to RWAG
R: Retreat into another room or outside the house if there is no obstruction. Otherwise move into a corner.  Ideally the opposite corner to the nicest, shiniest thing in the room.
W: Wait until the thrall steals something with both hands. Thralls prioritise stealing booty over attacking people.
A: Approach the thrall when its hands are full.
G: Grab the thrall's left earlobe like Misty and Brock from Pokémon

When you do this, thralls are programmed to submit to you. They will carefully put down whatever they stole and roll over onto their back on the ground. They also release a pheremone that calms down other nearby thralls.
At this point you are legally entitled to euthanise the thrall and the owner has to pay a fine for letting it escape. Or you can choose to bring the thrall back to its owner, and they have to pay the fine to you instead.
Comment: Stopping the thrall army would not only leave you weak for a while. It would be  a political NIGHTMARE to explain why now REAL PEOPLE! have to die in wars. Anyone proposing that would cause their political opponents to host a victory party right then and there.
Comment: There needs to be a name for that group that fills in the new moat.  I may work for such an organization.
Comment: I actually really like this answer because the point I'm trying to make is something like what @Hobbamok pointed out. The whole point of the story is that forcing humans to be slaves/cannon fodder would seem completely insane and cruel if we weren't doing it already.
Answer: They have tried and failed already.
Once in a while the humans decide that enough is enough and try to finish the job after putting down a rebellion. But it always fails for many reasons:

you have to convince all kingdoms to be fully 100% willing to complete this gargantuan task. If even one tiny city-state decides to not cooperate (secretly or not) you have already failed.
the extermination is too costly, at some point the soldiers simply cant be paid enough to keep them hunting for the length of time it takes to kill every last one.
total extermination is a brutal affair, and before it is complete most soldiers desert or ask for different assignments.
the thralls live in many, many places including in the wilderniss without humans. Finding them all and keeping the bloodlust high enough for years on end is just not feasible enough.
"what THESE thralls? No these are peaceful hard workers from our village that didnt join the rebellion". As you murder innocent (?) Thralls in more and more villages and cities the population that did care about them starts to rebel against having "their" thralls killed, possibly asking compensation as well.
pure greed. Enough people who employ them for cheap labor will want to keep them. "Here you go soldiers, all my Thrall work force wink wink money exchange. Execute them over there and dont mention the actual number of thralls I used to have".

You can even make the once-a-generation culling of all Thralls a big thing in your story. People can agree or disagree, cultures could treat Thralls better or worse and even have deliberate cullings to keep the population down against rebellions (which causes the Thralls to rebel even with fewer numbers and makes that culture feel justified).
Answer: They do commit genocide at a regular basis. Most kingdoms have orders to kill them on sight.
However, shadow thralls were designed to be expendable minions. Any decent evil overlord would never allow himself to either not kill their minions and not run out of minions to torture and kill out of boredom.
Shadow thralls were engineered to reproduce at breakneck speeds when they are in low numbers. A switch stops this fast reproduction when they have "enough".
This trigger is not understood, but it has to do with how crowded their warrens are and how easy it is to obtain food. Contrary to what one would expect, it is when food is harder to find that they breed the fastest, in order to have enough manpower to gather more food.
Also, crowded warrens split, with a band of shadow-thralls migrating somewhere else. This was encoded in them by the evil overlord so they would expand the mining operation on their own.
So, the shadow-thralls cannot be exterminated, no matter how much effort the kings are willing to spare. Somewhere in the wilderness, a warren will grow, divide, grow, divide, then reach back to civilization.
Exterminating them is a gruesome job that's only done to keep their population in check. They have as much luck wiping the shadow-thralls than killing all the rats and roaches in their cities.
Answer: You underestimate the economics of slavery
"Why wouldn't they just exterminate them?" assumes that them being dangerous isn't true of human slaves either, and we've done slavery thousands of times.
Slaves have always been a dangerous gambit, revolts happen, slave masters get killed in their sleep, they require constant policing to stop escapes. But economically speaking, slaves are basically guaranteed to make you rich, all this society would have to say to itself is "would you rather grow your own food and build your own houses?" "Would you rather be as poor as the next town over?" And if, as you're saying, they don't even really need policing as long as they've got something to do, then the cost/benefit decision is obvious.
They don't even need to be particularly good slaves, cult leaders have gotten rich just by having their members doing minimum wage labour making novelty pens, as long as you don't have to pay people beyond building them a house and feeding them, things they would do with a larger portion of the money you would've paid them anyway, you keep the difference and can sell product cheaper than any competition.
and your town can perfectly mentally justify this slavery because, as you mentioned, they get restless unless you give them something to do, so they see themselves as parents to a child race.
Honestly slave races are a kind of offensive idea for obvious reasons, but if they're going to exist, you've pretty much already made an ideal one, it doesn't need more justification then you've already given it, people might be worried about the occasional revolts and violence, but that's true of real slaves, the culture will simply adjust and build structures for maintaining the status quo.
Comment: This is an interesting point. Slaves remove the incentive for technological innovation. It takes the Black Death depopulating Europe to make R&D and investment in automation an economic proposition. Slaves are self-manufacturing self-maintaining high automation.
Answer: 1:Greed, As you said they are less intelligent then humans... so cheap labor could be a reason why the upper class (who is relatively safe due to personal protection) could use them as a labor force, so what if they kill a few customers here and there?
2: Display of power, a (religious) group could want to keep them alive and revolting to make the people scared so that they themselves can remove that fear by having a standing (holy) army to fight them if needed...of course this army needs to be funded so say hello to taxes.
3: Culture/Religion, their main religion might highly frown upon killing innocents, people have done stupider things in real life based on their faiths.
4: High reproduction, they might breed so fast that taking them out permanently requires more effort then it's worth (perhaps due to internal conflicts between the parties that have to unite to actually exterminate them. As you said they ere bread for war so a high reproduction number in a short time is something the wizard might have planned for.
Answer: Farming
Your mistake in the question was the word "cities". The medieval world didn't have cities, not at the scale we'd understand today, and people didn't go there to assimilate. Medieval cities were only large towns, really, and not many people lived there.
For the other 99% of the population, farming was the thing. And this is where the shadow thralls come in, because there is no such thing as a medieval farming economy with too much workforce. The more hands you have (in the absence of machinery), the better you can farm. You don't even need to develop the horse collar, because you have teams of thralls who'll pull the ploughs. You basically have the perfect slave economy, because unlike slaves they're unable to think about rebelling.
Roads and other public works
In the meantime too, the king and his lords also have thralls. When they aren't fighting someone, they can be solving the biggest problem for the medieval world, which was how to get soldiers around quickly. That's why all major roads in all medieval states existed. Thralls would be perfect for the grunt work of roadbuilding and maintenance. And then of course the country gets the economic benefits of traders also having roads to get goods around.
Or city defenses. It took years to build defensive walls, and it took people out of farming to do it. With a strong farming economy, you've got plenty of food left for the local lord to put a team of thralls on that.
In a medieval context, you simply can't overstate the degree to which the available man-hours of muscle was the limiting factor for development. If you've got extra muscle, it'd absolutely get used. No doubt some states would go down the "slaughter" route instead though - and they'll be crushed economically (and probably also militarily) in pretty short order.
Comment: "... you simply can't *overstate* ..."
Comment: @MartinBonnersupportsMonica Oops! Thanks! :)
Answer: Have you ever heard on the NYMB (Not in my backyard) syndrome?
It's what happens when we want something, just not close to us. Like we want industries, but not close to where we live.
Same here: a genuinely and aggressive race of "evil" weaker beings is a good thing when it's busy in an enemy land, it's a bad thing when it's in our land.
So, war is the reason why such creatures are not driven to extinction: they are too useful in war to be taken permanently care of.
Answer: Unique value
Sounds very interesting! So, they're created as a slave race. Perhaps they have unique skills that make them invaluable.
I don't love cats. Not as pets. I find wild cats interesting. But generally speaking, I don't want cats anywhere near my house or slaying local biodiversity: baby birds, mammals and all these other wonderful creatures I prefer to cats.
However, I lived for a while in my mum's renovated shed, plagued by mice. I had no food in my shed or any traces of it and there was nothing I could do to keep them out. I could set traps and kill a few of them, but there was an inexhaustible supply of the little buggers and they kept me awake, shat everywhere and occasionally I'd wake up with one climbing over me.
I soon moved into a bedroom in an old house with holes between the floorboards and hundreds of wonderful places for mice to live and eat and survive. Except that the house had three cats and in my entire time there I never saw the traces of a mouse. So yes while I don't love cats, I prefer them to a mouse infestation. I was pretty unhappy when one of the cats pissed in my room once. But overall I preferred cohabitation with these cats than with the mice.
What I'm suggesting is that while shadow-thralls may be less intelligent than humans, they might be better at something than humans. I'm smarter than cats are, but I can neither hunt mice or deter them from inhabiting my abode. I would keep cats around sooner than let my home be overrun by mice. Maybe shadow-thralls are a form of pest control.
Comment: Most cities had (and have) a rat problem.  Seems like a job for the thralls!
Answer: Politics:
It's convenient for the leaders to have a periodic, predictable, easily handled threat that seemingly threatens society but is otherwise a useful workforce the rest of the time. It helps maintain those in power and promote cohesion.
Also, everyone loves cheap labour.
Answer: Elephants
My first thought was "elephants". In some countries, they are simply pests -- like having gigantic deer that eat human crops, encroach on human lands, are a danger to humans and livestock and were well on the way to being killed off. What stopped the genocide of elephants? They became a cash crop, mainly from hunters willing to pay extraordinary fees. By carefully selecting what the hunters can hunt, and where, and how frequently, the nations that have these elephants have turned them from a pest to a source of income powerful enough to convince them to expand elephant reservations beyond the original conservation agreements, willfully pushing back people to make room for more elephants.
The takeaway is you just need them to be useful (and manageable) in such a way that despite the problems of them being pests to society, their value is too high to get rid of them.
Maybe, for example, there is a tax on shadow-thrall ownership which goes into a "shadow-thrall management" fund which keeps things pretty well in check. People gladly pay the tax because the thralls always pay for themselves several times over. If things start to get out of control, there's already a crack team of full time Rangers whose only job (paid for by the taxes) is to deal with it, so the general population is rarely bothered.
Comment: What about hippos?
Answer: Just tossing in a reference to The Mote in God's Eye, by Niven and Pournelle. In that case, rather than eliminate a very dangerous alien species, they set up a blockade of the planet. (Possible because their means of FTL had only one egress point from the system).
Answer: Ethics.
Even on Earth, genocide tends to be frowned upon.  Now picture a fantasy scenario in which folks may actually have visited Purgatory, and you can imagine that almost nobody in that culture is too eager to sign up for a million laps around the Mountain of Thorns with their eyes sewn shut.
Even beyond selfish considerations, their mages can commune with the thralls.  For precious hours, the curse can be lifted entirely, and anyone can converse with the shadow-thralls as entirely normal, sensible people.  They can see how the bad magic comes back, bites into them, and makes them do bad things.
The combination of fear and pity leads the unaffected people to be compassionate and understanding.  When the shadow-thralls start beating them up and breaking things, the normal people try to remember this is their chance to cultivate a ticket to the Elysian Fields through forgiving behavior.  When the mages put down the revolt by gentle means, it gives a new generation of thinkers a chance to try to finally understand and break the curse once and for all.
Of course, for certain wizards it is also their chance to try to finally understand those long-lost secrets, and to prepare their plans to enthrall all of humanity...
Answer: Curveball Idea
Do commit mass genocide. Do it periodically enough to prevent the shadow-thrall population from reaching a number that would let it overpower humans. However, you only kill, say 30% of them and make it a mandatory thing. Do the population control during a thrall census so that owners can't cheat and add massive fines for not taking thralls to the census. Just make sure to keep, give or take depending on your population of humans and thralls, 100 or so breeding pairs of thralls in which to replenish the stock. I'd say that you shouldn't let the thrall population be more than 70% of the human population (resource loss and overpowering humans is the main reason). Also, make them were shock collars set to lethal force to prevent rioting. Don't have to take this idea, but I reckon that it would be a cool way for a rebel group opposing this structured genocide to pop up.
Answer: Let history be your guide and make them equals
I'd steer clear of the weaker, less intelligent inferior slave race idea. Instead it sounds like what you want is an equal but different war-like nomadic people that gives your country serious challenges with periodic raiding activities. Then look to historical examples and adapt them to your purposes. One example that comes to mind is the interaction between the historical nomadic Scythian people (not to be confused with the later misuse of this name) with the Persian empire (e.g. the Wikipedia article is fascinating). In general nomadic raiders can give a static empire real headaches and be surprisingly challenging to conquer. But again, I'd make them equals and not an inferior slave race. Your story will be better for it in a variety of ways.
Comment: I'm actually trying to go in a "isn't it kind of horrifying that we forced other *humans* to do this stuff in the real world" direction with the story within the context of a world where  even the poorest humans have an alternative to slaving away for a living in the form of a literally and obviously inhuman creature. Making the evil slave race human would completely defeat the point of "humans are not vicious evil slaves, they're only forced to become that by others"
Comment: My suggestion was actually "don't have a slave race at all". And I'm not suggesting making them human—just basing them on a historical human people group, for inspiration to make a realistic society and culture with realistic conflicts with the other groups.
Comment: I commend using a story to show how inhumane slavery is, but by making the slaves in the story evil I worry you may risk the opposite happening in the reader's mind if they're not turned off by the slave race motif: they may feel as though the slavery is justified because the slaves are evil, which is obviously not what you intend. If you want your readers to feel horrified at slavery you need to make the slave race (if you decide to have one) relatable not evil, and not weak or unintelligent. Basically you want your reader to see that it is unjust. Or leave out slavery entirely.