Wednesday, May 30, 2012

On God and How I already know.

>>You know that God exists.

God is about as absurd as elves or unicorns. More even.

>>You want to fight that truth with everything you can,

Fight what truth? All religions make contradictory claims with the same quality of evidence. Why should I accept the Jewish Scape-goat blood sacrifice God of Jesus any more than the Norse collect you from the battle field God of Odin? It's culture invented deities. They don't actually make sense. Why should Odin send Valkyries to collect you from the battlefield? Isn't that just a cultural way to make people fight harder? Why should God sacrifice himself to himself? Isn't that just Jewish scapegoating and blood sacrifice to atone for sins. These aren't ways the universe should actually work. These are ways that primitive people would invent.

>>but it doesn't change the fact that He has made it obvious to anyone who doesn't intentionally blind themselves to it,

By providing better natural answers for everything?

>>and you know it to be true.

I think it's silly. It's hard pressed to suppose that that is me knowing that Allah is God or that the blood of Zalmoxis will make me live forever.

>>You also know that God has a moral standard to which he holds humanity accountable.

According to the Bible, women are chattel, and slavery is fine, and killing people for minor crimes is great. Picking up sticks on a Sunday is as great of a crime as murdering your father on a Monday. You only really use your own moral standard. And it's an insult to such a moral standard to credit your God with it. Your God would burn Gandhi in hell forever for failing to accept Jesus as his personal Lord and Savior. Gandhi gets eternal torture for a thought crime.

>>Your own conscience tells you this to be true, and also tells you that you've failed to live up to it.

It really doesn't. Anymore than shaving makes me feel that I have changed Allah's creation.

>>There's nothing more I can do to show you these things - you already know them.

These things being the standards of your God? Which suggest that twice as sinful to have a female child as a male child, or that burnt flesh is pleasing to God? Or that God so loved me that he murdered his child, because apparently killing things is some kind of forgiveness. Which it clearly isn't but it's pretty clear why first century Jewish culture might think so.

>>If you continue to walk in willful blindness of the obvious truth,

I cannot express how honestly I think your religion is stupid.

>>then you'll unfortunately have to accept the consequences of denying that truth.

Eternal torment from a loving God, for thought crimes of not believing. Because when Hitler burns Anne Frank for being Jewish we say that he is evil, but when God burns Anne Frank forever for being Jewish that makes him good? That eternal torment is the just desserts for Gandhi or Buddha. Such absurdity should shock the mind of even a child.

>>For your sake, I pray that you won't suppress the truth for the rest of your life. If you take your last breath in this life without repenting and believing in God, it will be too late. And you'll regret it for eternity.

And if you fail to accept Allah, and put partners unto Allah, he will mock you and then send you to hell. Such silly bits of threats of eternal phantorment do not make a good argument. If your God would eternally punish people for finite crimes, he is evil. If your God would eternally torture people for thought crimes, he is absurd. Your religion worships a tyrant in the sky, revels in the blood of his dead son, because culturally sacrificing living things to God to achieve forgiveness made sense to goat herders in the ancient middle east, but in this day and age... wake up!

>>Please, listen to reality. Please, listen to your conscience. Please, listen to truth.


Friday, May 25, 2012

I just ate some crow.

Speculating on the mockup chess board program I used below I suggested that it couldn't change height or width. And then looking at the code so as to alter it to be able to, I started seeing function after function would work with the given height. In the end I ended up seeing it fed in by the PHP itself and took a couple guesses what it was called.

Makes an 8x10 chessboard.

The question at hand is given the promotion rule, when does the bias towards black's army of pawns even out with regard to the height of the board? At what height would an average player against an average player be more likely to win* with whites rather than blacks.

*winning defined as the capture of every piece.

Update: the answer appear to be greater than 8 and less than 12.

It seems like the queen can actually sacrifice her way to the back row, then take out all the pawns. The king retreats to the right and to safety. The only way the pawns win is by reaching the other side. And becoming exactly what they are rebelling against. Animal farm.

Thursday, May 24, 2012

ZoomAnimator to specific location in Visual Library.

I totally wanted Visual Library in Netbeans to zoom in all nicely animated, so cue ZoomAnimator. Except that the damned thing zooms to the upper left corner. There's no choice in it, that's where it starts going. Which seemed rather odd. I mean the library files had MouseCenteredZoomAction and that zooms to a specific location (the mouse). So I tried to role up my own class and found it really odd. It kept messing up, being off here and there along the edges and not going where I told it to to go. So I looked up MouseCenteredZoomAction Source and found what it was doing. Then I fixed my class and quickly realized why it wasn't being consistent. The view.scrollRectToVisible depends on the current state of the view window. You cannot easily predict where the view window will be after the zoom. Which is why the MouseCenteredZoomAction class sets the zoom, forces it to validate the scene, and then checks for the window data. Thankfully that's pretty much identical to preTick and postTick in the Zoom Animator Listener class, and to straddle that with the pre and post ticks commands is rather easy.

You likely don't care about this, it's all greek to you (rare, likely imaginary, reader of this blog). But, mark my words. Somebody is going to google and find this and love the hell out of it. It will make their day.

You can ensure it zooms to a specific location by giving it a rectangle similar to the view field.

    protected void zoomrange(Rectangle rectangle) {
        Rectangle viewBounds = getView().getVisibleRect();
        double zoomw = (float) viewBounds.width / rectangle.width;
        double zoomh = (float) viewBounds.height / rectangle.height;
        double zoom = min(zoomw, zoomh);
        Rectangle normaled = new Rectangle(rectangle.x, rectangle.y, (int)(viewBounds.width / zoom), (int)(viewBounds.height / zoom));
        getSceneAnimator().getZoomAnimator().addAnimatorListener(new FocusZoomAnimatorListener(this, normaled));

import java.awt.Point;
import java.awt.Rectangle;
import javax.swing.JComponent;
import org.netbeans.api.visual.animator.AnimatorEvent;
import org.netbeans.api.visual.animator.AnimatorListener;
import org.netbeans.api.visual.widget.Scene;
import org.netbeans.api.visual.widget.Widget;

 * @author Tat
public class FocusZoomAnimatorListener implements AnimatorListener {

    private Point point;
    private Rectangle rectangle,viewRect;
    private Point center;
    private Point mouseLocation;
    private JComponent view;
    private Scene scene;
    private Widget widget;

    public FocusZoomAnimatorListener(Widget widget, Point point) {
        this.widget = widget;
        this.point = point;
        scene = widget.getScene();
        view = scene.getView();
    public FocusZoomAnimatorListener(Widget widget, Rectangle rectangle) {
        this.widget = widget;
        this.rectangle = rectangle;
        scene = widget.getScene();
        view = scene.getView();

    public void animatorStarted(AnimatorEvent ae) {

    public void animatorReset(AnimatorEvent ae) {

    public void animatorFinished(AnimatorEvent ae) {

    public void animatorPreTick(AnimatorEvent ae) {
        if (point != null) {
            viewRect = view.getVisibleRect();
            center = widget.convertLocalToScene(point);
            mouseLocation = scene.convertSceneToView(center);

    public void animatorPostTick(AnimatorEvent ae) {
        if (point != null) {
            center = scene.convertSceneToView(center);
            view.scrollRectToVisible(new Rectangle(
                    center.x - (mouseLocation.x - viewRect.x),
                    center.y - (mouseLocation.y - viewRect.y),
        } else {
            viewRect = scene.convertSceneToView(rectangle);

Wednesday, May 23, 2012

Which is better Loop or System.arraycopy on modern Java 7?

It's irrelevant.

The compiler will replace your loop with the System.arraycopy anyway.

What was once true in 2007, apparently is largely irrelevant.

Testing array copy vs. for loop with 10 elements...
Copying with System.arraycopy took 33 ms.
Copying with for loop took 45 ms.

Testing array copy vs. for loop with 100 elements...
Copying with System.arraycopy took 8 ms.
Copying with for loop took 16 ms.

Testing array copy vs. for loop with 1000 elements...
Copying with System.arraycopy took 97 ms.
Copying with for loop took 145 ms.

Testing array copy vs. for loop with 10000 elements...
Copying with System.arraycopy took 1583 ms.
Copying with for loop took 1584 ms.

Testing array copy vs. for loop with 100000 elements...
Copying with System.arraycopy took 46101 ms.
Copying with for loop took 47080 ms.

That's right, baby... the compiler replaced the loop with the System.arraycopy natively. And then the Netbeans IDE flagged the loop with a note that it should be replaced with System.arraycopy. You are no longer allowed to do it wrong.


* I ran some more test cases and it turns out you can trigger older loop characteristics for copying variable subsets of the array. If it will loop and copy (at times) less than the full array the loop loses about 20%. And if it's a function set to copy a subset and you use very large numbers it can loose ~50%.

 If you loop with a static final int for small number the loop will compile as an unrolled loop and beat the pants off System.arraycopy.

Looping appears to be much more fickle to optimizations (of which clearly replaced with System.array copy is one.) You likely are better off System.arraycopy in all cases. At least in Windows 7 (Since System.arraycopy is a native function it might differ from one OS to another).

Saturday, May 12, 2012

But Jesus died so horribly...

We are to accept that God needed blood to fix the universe, and only his own blood had enough magic to do it, so he gave himself a body and killed it.

Telling us how terrible crucifixion is doesn't make the story make more sense. A religion built on the idea of blood sacrifice doesn't make sense in reality. That we should have an unfathomably vast universe and the most important aspect of it are the blood carrying cells of some critters on this one tiny speck of a planet. However, that is exactly what a culture obsessed with primitive blood magic would invent as a religion. Telling us that Jesus suffered greatly, though not as greatly as people who actually survive for a while on the cross before dying, or die of cancer or something like that. Doesn't change the nature of the story and why it doesn't make sense. God sacrifices himself to himself to sooth his human anger emotions towards his creations. It's a rather gaping plothole. But, it's exactly what would have been invented if Christianity were invented. The Jews were obsessed with primitive blood magic and scapegoats, and the Romans were obsessed with the children of the gods and their wacky adventures. You invent a religion in that context, and you invent Christianity. Where the wacky son of God dies as a scapegoat for those who accept it. -- Telling us how horrible that death was, doesn't make the story make any more sense.

Friday, May 4, 2012

Bayesian thought, the End of Christainity

I'm currently reading The End of Christainity and was hoping Richard Carrier's chapter on Neither Life nor the Universe seem Intelligently Designed would be better, it's a great chapter mind you, and certainly worth it the price of the book in and of itself.

But, more and more I find myself thinking in a Bayesian sense. It's worthwhile to ask yourself whether you can go from hypothesis A to conclusion c cleanly. Does ~A get there cleanly? And what do we observe. Even for seemingly basic premises and thought that haven't so much as occurred to me ever such thoughts illuminate arguments I've never heard or thought about.

Why can't people in heaven or hell communicate with Earth? I mean you can't really get from the premise "there is an afterlife" to the conclusion therefore that afterlife will be completely barred from communicating with the living. But, necessarily that's a requirement if there is no afterlife. While one could conclude that there are a myriad of afterlives that could have that restriction, it's not what we should expect of Christianity. Why not allow the living to occasion to hear the screams of torment of the damned. Or of the blessings of heaven? Why allow a child to lose their faith when their mother dies and goes to heaven? Why not allow the mother a couple quick words to save their child's eternal soul? It seems as though this restriction would be both counter productive and arbitrary. But, if there were no afterlife, it simply would be the obvious result. There is no undiscovered country, there is only death.

Or how can you cleanly go from the premise, there was a historical Jesus to there will be no evidence for a historical Jesus. You can very cleanly go from "there was no historical Jesus" to there will be no evidence for a historical Jesus. It's not about proof but that, on balance, the premise "there was no historical Jesus" would be stronger. And while the question could be reversed rather suddenly by a well placed piece of paper, it can't be the case that the evidence for a historical Jesus outweighs the opposite claim if every prediction of the opposite claim that must be true actually seems to be true.

How does one get from God exists, to therefore God should become a demigod and sacrifice himself to himself to appease God's human-anger emotions towards innocent people for the crimes of their ancestors. Well, I don't see an easy way to get there. But, on the premise that there is no God, I should expect to find religions everywhere that are simply the product of the cultures they were invented in, and in a culture that is obsessed with primitive blood magic, atonement of sin, appeasement of gods, punishing innocence to allow the guilty to go free, god's emotions, etc. Such cultures we know actually existed, and which did have strong and rather new pagan influences from Rome, we should almost expect Christianity. In fact, if you mix Jewish thought of the Messiah with Pagan love of demigods and the wacky adventures thereof, we should almost perfectly predict Christianity to arise from that very culture. And we should see gods all over the world, the product of their own cultures. And this seems to be exactly what we do see. But to actually assemble a universe based on the oxygen carrying cells of some terrestrial animals on this tiny speck of dust in a universe of 70,000,000,000,000,000,000,000 stars, seems a little freakish. The actual universe actually hinges on blood magic being true? That's not something I could really get from "God exists". However, I could conclude that from God doesn't exist. Because then if people are inclined to invent gods, and we generally should accept that they are, then they would invent gods that humans would invent. With human emotions and stray bits of human culture. Much like we see with Yahwah and Jesus. One could offer perhaps that that culture existing is unlikely. But, that's a sharpshooter fallacy. For if we have Viking culture, we end up with heaven being a pub in the sky where the best heaven is for those who died in valiant battle. Any culture that existed, could well have ended up with their own religion and we could just as easily be discussing that religion, rather than Christianity. The specific form of the culture doesn't matter, just that cultures should exist, and religions which reflect those cultures should arise within those cultures.

How do we get from God exists to God should punish people on the basis of belief. That there are two afterlives which are infinitely good and infinitely bad. How do we get from that premise to that conclusion? I don't rightly know. But, I know how we get there from no God existing. If God doesn't exist then these theological claims are made up by people, and people believe religions not based on truth (as they would all be false) but rather based on Public Relations (PR) and as such, infinite sticks and infinite carrots could do wonders towards propagating a religion, and the better it propagates the more it will propagate. So the religions would be optimized towards propagation and not towards dissemination of the truth. If you don't want infinite suffering believe this. If you want infinite bliss believe this. Teach it to your children, tell it to others, make them also believe. If God exists why doesn't he evangelize people himself? After all, shouldn't God be able to do a better job at it? Why depend on silly human agents? If there were no God, all there are are human agents. Each of these points actually provide rather strong evidence that religion is completely bogus. There a heck of a lot of assumptions we just take for granted that are actually hugely problematic if we think about them correctly. Why should Gandhi burn forever in hell for failing to believe the correct tenants of a religion largely believed in a region he was not from? Why should religions be hugely dependent on region? Why is the message delievered in book form, if books and languages change? How do we get from God exists to God will have human emotions? The list goes on and on. We accept a lot of things without question that we really should question profusely. Why are souls undetectable? If they don't exist, ofcourse they'd be undetectable. But, how do we go from "Souls exist" to "souls should be completely undetectable"? Wouldn't seeing souls leave the bodies of dying people, tell people that they have souls and perhaps they go somewhere and could be saved?  There's a lot of baggage concern religion, and why should the supernatural be undetectable? If I developed Jedi powers, anybody could tell I had them, and even if they didn't I could, with a wave of my hand, convince them that I did have those powers they were looking for. Such things would be supernatural and detectable so why are the only supposed supernatural things completely undetectable. How do we go from "The Supernatural Exists" to "The Supernatural is Undetectable". I do however see quite easily how we go from "The Supernatural Exists" to "The Supernatural is Undetectable". At best, the hypothesis "The supernatural exists" must by this argument be less likely than "The supernatural doesn't exist" because we don't detect it. That alone suffices to make it a better claim.