Archives for : March2014

Create equal spaced columns/cells in a table by only altering margins

This is a hard thing to write a title for, and a hard problem to explain. I had a situation where I wanted to put some space between columns in a table, but I couldn’t alter the left margin of the left most column, or the right margin of the right most column, as that would stuff up some alignment. In addition, I wanted to have the exact same amount of margin taken away from each column, as to not stuff up the sizing. See the following illustration to help visualise the problem… numbers in the illustration are to follow with the example I give.


So, how is this done?

Firstly, let’s imagine we had 5 columns. That means that there are 4 gaps (one between the 1st and 2nd, 2nd and 3rd, 3rd and 4th, and 4th and 5th.) We need to times the gap we want in each space by the number of spaces.

a = gap we want (let’s say 10)
b = number of cells (lets say 5)
c = number of gaps = b-1 (in this example, 4)
d = total space in gaps = a * c (in this example, 40)

We know that we need a total of d (in this example, 40 pixels) to be removed from all the cells all in all. In addition, we want to make sure that each cell has the same amount removed. Thus, we divide the total amount of space by the total number of cells

e = d/b (in this example, 40/5 = 8)

So we want to make the left and right margins of each cell total the value of e – that is, we want to subtract exactly e from each cell.

For the left most cell (cell 0), we can’t alter the left margin, so we have no choice but to add e in it’s entirety to the right margin of the left most cell. For the second cell (cell 1), we want the gap to total a. So therefore, we need to make the left margin of cell 1 equal to a minus the right margin of cell 0. In this case, it will equal 2. When we get to the right margin of cell 1, we want to make it such that the total margins of the cell equals e, so we work out the right margin to be e minus the left margin of cell 0.

If we proceed with this pattern, we’ll keep removing exactly e from each cell. When we get to the final cell, it will be at a stage such that you will only need to add e to the left margin (and not to the right margin,) and, if done correctly, all the spaces will be of equal size.


A nice recursive python script can work this out for you:

#remember, first cell is cell 0, and last cell is total-1.
# for example, if there were 5 cells, first one would be 0, last one would be 4.
def leftMargin(item, total, gap):
if (item == 0):
return 0.0
return gap - rightMargin(item - 1, total, gap)

def rightMargin(item, total, gap):
if (item == 0):
return (gap * (total - 1.0)) / total
if (item == total-1):
return 0.0
return ((gap * (total - 1.0)) / total) - rightMargin (item - 1, total, gap)

# here is some dummy data.
# how many cells do we have??
total = 5.0

# how many units is the gap supposed to be?
gap = 10

for i in range(0, int(total)):
print str(i) + ": " + str(leftMargin(i, total, gap)) + " " + str(rightMargin(i, total, gap))


Deductive argument against abortion

There is quite a simple deductive argument against abortion, and is something I always point to when discussing the ethics of abortion. It goes like this:

  1. Killing a human being without just cause is morally wrong
  2. Abortion has the intention of killing a developing child in the womb
  3. Abortion rarely has a just cause
  4. A developing child is biologically a human being
  5. Therefore, abortion in principle is morally wrong

Most of the pro-choice reasoning is simply attacking one of the premises, including premise 1 (which is somewhat surprising.) However I believe all these premises hold up even under attack from pro-choice reasoning. Let’s have a look at each of these premises individually.

Premise 1

Many people would say that killing a human being isn’t morally wrong providing that human being is not a person. However the definition of a person proposed by pro-choice advocates is neither consistent nor logical, but they are all absurd due to poor reasoning as to why that definition is the right definition, or their definition is so broad that it includes many many born and sometimes mature human beings (which is also absurd.) For example, it’s hard to justify that someone is a person because they’re outside of the womb. Why does their location make a difference? Certainly, some things have changed – they’re outside of the womb now, but all the justifications I’ve heard for this don’t make sense. This is partly because there isn’t really any justification as to why someone outside a womb is a person and someone inside a womb isn’t a person. Another example would be consciousness or self-awareness – one needs to have these characteristics in order to be a person. However, in addition to being absurd (no proper justification as to this reasoning,) it is so broad it would include many humans, including all infants, many elderly, anyone in a coma, and everyone when they fall asleep. If they’re using the reasoning “only people have the right to life” to justify abortion, it also justifies killing anyone who isn’t a person by the defintion given. If they alter their defintion to only include those who are born, we go back to the first scenario we had in where there isn’t any reasonable justification as to why a baby is suddenly a person based on it’s location.

Of course, all this is if someone changes the first premise to person, but that doesn’t really make sense because there’s no logical reasoning to it and it’s ambiguous, unlike human being.

Premise 2

One might say that abortion is simply “expelling” a foetus from the womb, however there is always the underlying intention that the foetus won’t live. This is demonstrated in part by late-term abortions, where it’s plausible to deliver the child early and it has a fighting chance at living. The intention of abortion is to ensure that there is no living baby inside or outside of the womb afterwards. The intention of “expelling” a foetus from the womb can’t be separated from the intention of wanting to kill the child.

Premise 3

What is a just cause? I think the only just cause can be found by using the principle of double effect, and abortion is justified if the effect of not performing an abortion is morally worse than performing it. This happens very rarely, if at all. For example, I would argue that the life of the mother is more important than the life of the foetus solely because the life of the foetus is dependent on the life of the mother rather than one human having a greater claim to the right to life than another. I can’t stress this enough. Both the foetus and the mother have the same right to life by virtue of being human. However the foetus’ life depends on the mother’s life. As such, we aim to save the greatest number of lives as possible. If the mother dies (typically) the child she is carrying will also die. Such that, if the pregnancy is severely endangering the life of the mother, then saving the greatest number of lives is to save the mothers life. However, we also need to make sure that there isn’t any other option that can be taken, such as attempting to deliver the child by C-section and at least give the child a fighting chance at life (see above.) I don’t consider this to be an abortion as much as it is a tragic loss of a wanted child. Most common case scenario is ectopic pregnancies.

Many people will try and argue that there are other just causes. However, the right to life shared by all human beings has to be applied universally and equally. No one’s has greater or lesser basic human rights than another human. When someone tries to say that foetuses are been given greater human rights, they are using a flawed comparison. This is because they aren’t comparing the same human right. They are comparing the right to life with the right to bodily autonomy. If bodily autonomy is a right, it’s certainly not greater than the right to life. The foetus’ right to life trumps the right to bodily autonomy not because the foetus has greater rights in general than the mother, but because that particular right is greater. For example, the mother’s right to life trumps the foetus’ right to bodily autonomy (however as a human being that hasn’t yet developed the ability to communicate with language, I am yet to find a case of a foetus invoking that right.)

It’s scary that apart from bodily autonomy (which isn’t sufficient cause,) all the proposed just causes can also be used to justify infanticide. One needs to provide sufficient reasoning and justification as to why something is a just cause.

Premise 4

Biologically, a foetus is a human being. There’s no way around it. It’s as much a clump of cells as every other human being. It’s as much of tissue as every other human being. It’s not a parasite, because a parasite has to be of a different species to the host body (that logic that a foetus starts off as something that’s biologically not human and then suddenly becomes human at birth doesn’t have any biological justification.) The biggest objection to this is actually by modifying premise 1 to say “person” instead of human being. As such, premise 1 would say “killing a person without just cause is morally wrong.” (let’s call this premise 1b) This is true, killing a person without just cause is morally wrong, and if this premise was swapped with the replacement, the argument wouldn’t logically make sense. However, just because this new premise is true doesn’t mean the old premise isn’t also true. This is demonstrated because the entire set of persons is a subset of the entire set of human beings (such that all persons are human beings.) So this doesn’t help the cause at all, because this new premise could simply be a logical step from the old premise that “killing a human being without just cause is morally wrong”. Premise 1b being true doesn’t make premise 1 false. In addition, persons being a subset of human beings means that all persons are human beings, but does not mean instantly that all human beings aren’t persons (it would have to be a proper subset for this to be the case.)

One of the biggest problems here is that people will change the definition of “person” to fit their political agenda. Let’s stick with human being, because there’s no reason as to why we should be replacing premise 1 with premise 1b. Just because premise 1b is true doesn’t make premise 1 false.


If all these premises presented are true, which I have aimed to demonstrate, then one would rightly conclude that abortion, in principle, is morally wrong. In principle is there to allow for if there is ever a just cause (as per premises 2 and 3.) Where there there is a just cause (which is very rare) then it wouldn’t be morally wrong in that case, but as exceptions don’t define a rule, we can’t use that case to say it’s not morally wrong all the time.

Of course, we’ll see many of these premises being attacked as described above, but I’m confident that all the attacks will fail. The attacks are solely an attempt to justify the unjustifiable, either for political gain or because of the consequences otherwise faced. For women who have had an abortion, they don’t want to believe that they killed their own child. That’s an absolutely tragic thing to feel, and I can sympathise with wanting to hold to the belief that this wasn’t the case. However, the truth shouldn’t be prevented for this reason alone; especially as we should be aiming to prevent this happening to even more women. As for post-abortive mothers, as they were following what the law allowed and what society approved of, I would not hold them morally responsible for the death of their child (the abortionist in many cases would be held morally responsible however.)

We need to be sympathetic and caring for post-abortive mothers, women in crisis pregnancies and mother’s doing it tough. It’s easy to logically show something is wrong, but it doesn’t mean it’s easy in practice, and that is quite often an argument made in favour of abortion. However, we should be doing what is right… even if it’s the harder option.