Finding the Day within the Year

August 11th, 2008

Unlike many other great languages, ActionScript 3 does not have a method for finding a date’s day within a year. For example, February 10, 2008, is the 41st day in the year. Here is my solution:

function getDayOfYear(date:Date):Number {
var monthLengths:Array = new Array (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);

// A leap year is divisable by 4, but not by 100 unless divisable by 400. Seriously.
if (((date.getFullYear() % 4 == 0) && (date.getFullYear() % 100 != 0)) || (date.getFullYear() % 400 == 0)) {
monthLengths[1] = 29;
trace ("leap year");
}

var dayInYear = 0;

// get day of year up to month
for (var i:Number = 0; i < date.getMonth(); i++) {
dayInYear += monthLengths[i];
}

// add day inside month
dayInYear += date.getDate();

// Start counting on 0 (optional)
dayInYear--;

return dayInYear;
}

trace(getDayOfYear(new Date("03/10/2008")));

And for giggles, here are the starting days for months in a non leap year:

var monthStartDays:Array = new Array(0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334);

Quick and Memorable Proportional Resizing in Flash

August 9th, 2008

When needing to scale loaded assets in ActionScript so that no side is larger than a particular dimension, you can spare manual proportion calculation by using the scaleX and scaleY display object properties.

Manual proportional scaling code looks like this:

myDisplayObject.height = (originalHeight * newWidth) / originalWidth;
myDisplayObject.width = newWidth;

That’s fine and dandy, but I typically need to write out the proportion math out in my head or on paper. Utilizing the scaleX and scaleY display object properties, we can accomplish proportional scaling in more memorable manner. When you change a display object’s width or height, the scaleX and scaleY properties automatically get updated. To keep the display object proportional, set the smaller side’s scale to the scale as the larger side after the larger side’s dimension is set.

var maxSize:Number = 80;
if (myDisplayObject.width > myDisplayObject.height) { // horizontal asset
myDisplayObject.width = maxSize;
myDisplayObject.scaleY = myDisplayObject.scaleX;
} else { // vertical asset
myDisplayObject.height = maxSize;
myDisplayObject.scaleX = myDisplayObject.scaleY;
}

Media Along the Path to Atheism

August 7th, 2008

As I was contemplating god and religion, several pieces of art / media accompanied my thoughts. Some of these are religious. Some are atheist. All were influential.

Contact (movie)

The topics of love, loss of a parent, and blunt discussion about the evidence of god’s existence make this one of my favorite movies of all time.

Great line: “If it’s just us, it seems like an awful waste of space.”

Ishmael by Daniel Quinn (fiction)

A fascinating novel that challenges assumptions instilled into children about humanity’s place in the universe. Atheist or not, this is a thought provoking allegory.

Great line: “There’s nothing fundamentally wrong with people. Given a story to enact that puts them in accord with the world, they will live in accord with the world. But given a story to enact that puts them at odds with the world, as yours does, they will live at odds with the world. Given a story to enact, in which they are the lords of the world, they will act as the lords of the world. And, given a story to enact in which the world is a foe to be conquered they will conquer it like a foe, and one day, inevitably, their foe will lie bleeding to death at their feet, as the world is now.”

Letting Go of God by Julia Sweeney (stage performance)

Saturday Night Live performer and cancer survivor Julia Sweeney discusses her Catholic upbringing and the life events that led her to believe that the universe can function on its own without a deity to preside over it.

Great line: “Julie, I just ignore the parts I don’t like. Why would go read the Bible, cover to cover, if you weren’t looking for reasons to get upset?”

The God Who Wasn’t There (documentary)

I’ve read the entire Bible, cover to cover, almost twice and I’ve studied large portions of the New Testament. It’s amazing how many christians have not done this, yet defend its contents. Far more useful than debating the Bible against its own contradictions is researching when and how the Bible and the church came together. This documentary explores the assumption christians make about the origins of their religion.

The God Delusion by Richard Dawkins (non-fiction)

Great line: “There may be fairies at the bottom of the garden. There is no evidence for it, but you can’t prove that there aren’t any, so shouldn’t we be agnostic with respect to fairies?”

The Purpose Drive Life by Rick Warren (”non-fiction”)

If you suffer from common middle class disconnection from the world and cannot find a worthwhile mission for the privilege you were born into, this book will help you feel less guilty about your ignorance while providing more delusion that god wants you to live self centered for his benefit.

Blue Like Jazz by Donald Miller (non-fiction)

Emo kid Don Miller went on a soul search, asked great questions, whined endlessly about his mental hangups, and stopped with “it’s not you, god, it’s me” before providing any great answers.

The Moral Animal: Why We Are, the Way We Are by Robert Wright and Mother Nature: Maternal Instincts and How They Shape the Human Species

These two books explain how morality is shaped by evolution. In short, behavior promoting repetition of genetic information is good and that which harms the species is evil.

Nothing Fails by Madonna (song)

Great line: “I’m not religious, but I feel so moved; makes me want to pray.”

God by John Lennon (song)

Great line: “God is a concept by which we measure our pain.”

Elijah by Rich Mullins (song)

Great line: “When I leave I want to go out like Elijah with a whirlwind to fuel my chariot of fire. And when I look back on the stars, well, it’ll be like a candlelight in Central Park and it won’t break my heart to say good bye.”

Irish Son by Brian McFadden (song)

Great line: “This is the city that raised me with the religion they gave me. Now I’m old enough to know my own mind. It was leaving that saved me. I’ve seen so much that has changed me. So just break with your past. Feed your own mind.”

The Republic of Heaven by Philip Pullman

While I have not yet read the His Dark Materials trilogy, I did see The Golden Compass and found The Republic of Heaven arguments by Pullman quite compelling.

“We’re used to the kingdom of heaven; but you can tell from the general thrust of the book that I’m of the devil’s party, like Milton. And I think it’s time we thought about a republic of heaven instead of the kingdom of heaven. The king is dead. That’s to say I believe that the king is dead. I’m an atheist. But we need heaven nonetheless, we need all the things that heaven meant, we need joy, we need a sense of meaning and purpose in our lives, we need a connection with the universe, we need all the things that the kingdom of heaven used to promise us but failed to deliver. And, furthermore, we need it in this world where we do exist– not elsewhere, because there ain’t no elsewhere.”

[. . .]

“We mustn’t have another king. Worshipping the wrong thing is going to lead to trouble, so we have to have a republic, by which I mean that we ourselves in this world here in the physical universe where we know we live have got to make it as much like the traditional idea of heaven as we can. By which I mean it’s a place where we’re connected to other people by love and joy and delight in the universe and the physical world. And we have to use all the qualities we have– our imagination, our intelligence, our scientific understanding, our appreciation of art, our love for each other and so on– we have to work to use those things, to make the world a better place, which it sorely needs making.”

[. . .]

“I thought wasn’t it a good thing that Eve did, isn’t curiosity a valuable quality? Shouldn’t she be praised for risking this? It wasn’t, after all, that she was after money or gold or anything, she was after knowledge. What could possibly be wrong with that? …The physical world is our home, this is where we live, we’re not creatures from somewhere else or in exile. This is our home and we have to make our homes here and understand that we are physical too, we are material creatures, we are born and we will die.”

What is the meaning of life?

August 5th, 2008

My friend John asked to interview me for a paper he’s writing in his high school English class. He had the same questions for a variety of topics and I chose the meaning of life. Here are my answers.

Why is this question important to you?
It’s a question that I’ve thought about for a long time. I lost my mother to cancer when I was 12 and that event made me think about complex questions regarding our existence at a young age. My mom was only 35, which is just 11 years older than I am now, and in some ways, it’s difficult for me to think about living past 35.
Why did you choose this question?
When I was young, I found comfort in religion. The idea that someone or something bigger than me could see and understand the answers to the questions that I could not was comforting. As I grew older, the hope that there was a reason for my mom’s untimely death started to feel intellectually dishonest and delusional. I became an atheist and found comfort in the lack of an answer as the answer. My transition is something that I like to share with others.
Has this topic affected or touched your life?
I believe that when people don’t (falsely) believe they get to exist forever, they are more diligent about their only chance at existence: they don’t fight for stupid reasons, they don’t waste time on pettiness, they try to do something productive with their time instead of wasting away in front of the TV.
What is your opinion on this topic?
The universe does not provide a purpose for you, but that does not mean you have no purpose. You can find a purpose for yourself. The meaning of life is the pursuit of happiness as an individual and making life better for the life that will come after I no longer exist.
If you could, what would you change about it?
Everyone wants to live forever. I think death is so unfortunate. It’s more than the loss of a person. It’s a loss of everything that has gone into making that person: the education, the joy, the tears, all of the experiences that bring understanding. I know how hard I work to be better as a person and I think the world is a better place because I’m here and what I want to accomplish.
Reasons for thoughts on this?
Because I know the universe existed before I was born and I had no consciousness during that period and I know the universe will continue to exist when I resume having no consciousness.
Reasons for other peoples’ thoughts?
People like to think they’re above the natural world. Death is the only thing humans haven’t conquered. I can understand why people are okay with the delusions religion offers. We are narrative creatures. We want to feel there is a beginning and end to our story.
What’s so wrong or right about this?
Thinking about your finitude can be crippling. At the same time, it can be motivating to make today mean something when there is clearly no meaning for existence in the first place.
Why do we need to answer this question?
We all must find a reason to get up in the morning and justify the consumption of resources necessary for our existence.
Can this change a person and how?
Yes. For those that find an honest meaning of life, it causes them to behave in a manner conducive to their own answer of the meaning of life. Those that don’t start holy wars, act like sheep, and behave in a manner that is unsustainable.
Anything I forgot to add that you want to add, go for it, any random comments from you would be great.
I offer two quotes from famous atheist Richard Dawkins in his book Unweaving the Rainbow: “We are fantastically privileged to exist at all, but then we also have the privilege of understanding this beautiful world in which we find ourselves. That should make us all the more eager to soak up as much as we possibly can of understanding our world and our place in it before we die.” And: “Mysteries do not lose their poetry when solved. Quite the contrary: the solution often turns out more beautiful than the puzzle…”

A List Apart: The Survey, 2008

July 30th, 2008

Hey web designers, developers, producers! It’s that time again.

I took the 2008 survey

Fairy Tale Ending

July 30th, 2008

Do not try and bend the spoon. That's impossible. Instead, only try to realize the truth: there is no spoon.

I have found greater compassion outside of the pews, greater peace through science, and greater urgency to make my life matter by letting go of god.

I have a confession to make. I grew up in a Christian home. I led a Christian club in high school. I taught Sunday School to third graders. I worked at a Christian radio station for five years. I accepted that I was *not* a Christian shortly after I published my coming out post three years ago.

(The last statement isn’t a joke or a trick. I’m not going redefine myself as a person of faith who believes in the teachings of Jesus and just rejects the church by the end of this post. This post will explain my journey to atheism.)

Six years ago, the college group leader at my church in San Diego held a series on the science within Genesis. The series did not discuss “intelligent design”, but rather how Genesis could be a metaphor for evolution. This contradicted the teaching of my church in Virginia that Genesis was literal. The discussions prompted me to start validating the faith that I was told to not question if I really wanted to understand it (that’s “faith”).

Two years later at Emerson, I took two classes on evolution as part of the honors program. Professor Alan Hankin taught Biological Evolution and changed my life is so many ways. My internal struggle of faith became quite an external debate in his class. Alan, a proud atheist, often reminded the class that science is “the study of” everything around us. He lovingly asserted to me in our many conversations that truth wasn’t a destination.

I kept reading and learning. I applied critical thinking to everything I believed to be true, validating and invalidating along the way. The more that I read about biology, evolution, and sociology, the more I tried to reconcile my Christian faith with the observations by hundreds of studies in so many fields. After awhile, I could no longer defend Christianity with logic. I was defending Christianity with a desire to believe rather than its own merit. I wanted so desperately to believe my faith was worth believing.

I didn’t stop believing in god because of tele-evangalists, gay bashers, the Crusades, the church’s many institutional hypocrisies, or President Bush (though these are all valid reasons). I stopped believing in god because I finally recognized the Bible for what it really was.

Humans are narrative creatures. Mythology is useful as a point of reference along a long timeline of existence. The narrative of Christianity is comprised of metaphors to relate the human things we deeply understand, like pain and pleasure, to the things we don’t understand, like suffering and death. It can be useful for emotionally healing and morally guiding. I respect religion for this reason. However, metaphors and narrative still separate experience from reality. When the stories replace actuality and critical thinking, it’s intellectually dishonest.

My place in this world is no more important than an ant’s. I am just a living being, made of stardust, fortunate enough to live in a time when I don’t have to mythologize how I got here. I stand on the shoulders of giants, the knowledge accumulated by all humans over hundreds of thousands of years, and get to peak at what’s over the wall of not knowing.

Explanation of header

Facebook F8 ‘08

July 23rd, 2008

I’m here! Will post more later.

Thoughts on “The ‘N’ Word” from a White Fag

July 20th, 2008

This past week, a video was leaked to FOX News that showed Jesse Jackson using “the n word”. The newsworthiness of this story, seemingly, is the hypocrisy of a black leader. Jesse Jackson previously criticized rap musicians for using “the n word” and called for a boycott of Seinfeld after one of the show’s characters used “the n word” in a comedy routine. The hypocrisy reported this past week was not that Jesse Jackson varies the level of punishment he feels necessary depending on whether you’re black or not, but his own use of “the n word” in a side comment.

I think it’s stupid for the major news media to dedicate time to discussing a word when we’re at war/occupation. I think it’s even more stupid that we can’t use the word being debated when discussing its use. This is the type of conversation that should be reserved for The View and my blog.

(ABC is stuck in the 20th century and won’t let me embed a video from its website. To see the clip referenced, go here and search for “Hot Topics 7/17: The N Word”.)

Sherri Shepherd exploded at the notion that the word should not be used by anyone in any circumstance. “Don’t tell me I can’t use that word!” she said before proceeding to explain why black people can tell non black people they cannot use the word. Apparently, Sherri can use it as a “term of endearment”, but Barbara Walters cannot because she is be incapable of using it in such a way. I maintain that the only people who get to make rules about language are members of the MLA.

Whoopi made an insightful comment: words gain meaning when we give them meaning. Unfortunately, the rest of her thought was bleeped by ABC. The network claimed that the opinions presented on The View were not those of the network, yet the network took a position in this debate. By bleeping Whoopi, ABC endorsed the opinion that the word cannot be used, even when its use is being debated intellectually (or not so intellectually in Sherri’s case).

Moments after bleeping Whoopi for 10 seconds, ABC allowed Elisabeth Hasselbeck to say, “You’re a dumb polack.” So… one racial slur is okay, but not the other? Does ABC not like Poland?

Words are just references to definitions and definitions are defined by culture — a culture that everyone gets to participate in regardless of ethnicity. If we focus on a word instead of its intended meaning, we won’t get anywhere. I can say “the f word” — fag — as a term of endearment to Arthur and feel special in our little clique. Or a female friend could burst into a party and say, “Hello my darling fags!” Or it could be yelled at us from a dumpy car full of Mexicans while we cross the street and feel insulted (it happened). I know what definition is being referenced in each scenario.

The words we use are indicative of the power relationship we feel to those we talk. I can use a paragraph or a single word to make you feel intimidated. However, it is your decision what to feel. Unlike physical offenses, being verbally offended is always a choice to be made. I can choose whether or not to be offended and accept the power dominance suggested by a word’s use.

All of which brings me to the idea of redefining words. Dan Savage, famous gay American sex advice columnist, wrote:

When I started writing this column in 1991, there was a debate raging in hellish homosexual circles about words like faggot. The idea was that if we used these words ourselves–Queer Nation, Dyke March, “Hey, Faggot” — straights couldn’t use them as hate words anymore. I chose “Hey, Faggot” as my salutation in joking reference to this lively debate about reclaiming hate words.

Dan did not say, “straights couldn’t use the word ever again.” I agree with Dan and this is how I feel about “the n word”. If those who were oppressed by a word want to reclaim the word, they should, but then they have to give the new definition back to the culture. Otherwise, they need to bury the word forever. If they reclaim and harbor the word, it’s maintaining a segregation, a power relationship of “us and them”, and it will always be divisive regardless who uses it.

Jesse Jackson used “the n word” as a black man speaking about some black people he felt were being ignored by a half black man more powerful than himself. That was the real story. I regret that the major news media missed a productive conversation about economics, opportunity, and the long term effects of discrimination.

Executive Power Documentary — HD Sneak Peek

July 15th, 2008

Some of you may know that Arthur & I have been working on a new documentary for the last six months. I’m pleased to share this high definition sneak peek of Executive Power (working title) on Vimeo.

We’ll still in production and will be posting more on the Grey Matters Media site. To support this project with a tax deductible donation, visit ReelChanges.

More Evidence Local News Isn’t News: iPhone Line

July 14th, 2008

Person in line for iPhone to KTLA reporter: “This isn’t smart. This isn’t journalism.”