I'm Back!

So I'm back from spring break. It's been a pretty incredibly week, and I sort of wish it didn't have to end so quickly. But I've already gone to class today, and I know I have to face school again.

Sigh.

I have yet to turn all my Moleskine notes into journal entries, so for the next few days this will be like a Twitter post.

I'm starting to like the idea of microblogging, actually. But this allows me to write short essays, so I'll stick with this... for now.
No comments

Yeaaah Spring Break

I'll be in Tennessee/North Carolina Smoky Mountains National Park for a week. So I won't be commenting.

On a different note, my interview with CTY went well. I screwed up on one or two questions, but I really got the interviewer's interest with my lesson plan. Hopefully I'll get the job *crosses fingers*

I'll also be kind of awkward if she finds this post. Oh well.
No comments

So Long and Thanks for All the Fish

And I'm done with my dolphin project.

Phew.
No comments

St. Patty's Day

I was walking home this morning at 5-ish, after finishing a philosophy paper. Some middle aged guy biked past me in the opposite direction. He said, "had a little too much to drink for St. Patty's Day huh."

Yeah. Definitely.
No comments

Widgets

I'm probably not as busy as I claim (or think) I am.

A quick search for my username came up with this:

http://www.widgetbeat.net/index.php/02/2008/notes-list-todo-widget-review/

Cool.
No comments

Hiatus

Due the the amount of work, I will be taking a brief hiatus from blogging for the next two weeks or so, save for the weekly updates on Sunday.

I look forward to when I'll have the time to write again.
No comments

Week of 2008-03-03

Busy week. Went climbing Monday, then class, GSW, and meeting. Had a better Tuesday than the last, with my project closer to completion. Another meeting at night. Spring break planning is going well, although a potential kink just came up. Starting Thursday night I didn't sleep till 3 (and on Sunday morning, 5) in the morning, working on a GUI regex webpage. It works pretty well; I'm more than pleasantly surprised by how good it looks. That's really it... two weeks more of work hell, and then I'm free! Free! For a week. Bummer.
No comments

AJAX Upload (Of Sorts)

I've said before that I'm working on a project to put a graphical front end to regular expressions. One feature we put in (among the plethora which are not really necessary) is the ability to upload a text file from your computer, and play with regex on it.

Despite all the tutorials out there, it turns out that getting a callback function from upload is really really easy. Since my method is the simplest I've seen (and I've seen quite a few while trying to figure out how to do it), I thought I would share.

Here's the html:

<iframe style="" id="TARGET_IFRAME_ID" onLoad="CALLBACK_FUNCTION();"></iframe>
<form action="server_upload_script.php" method="post" enctype="multipart/form-data" onSubmit="this.target='TARGET_IFRAME_ID';">
  <input name="max_file_size" value="100000" type="hidden">
  <input name="FILE_IDENTIFIER" id="input_file" type="file">
  <input value="Upload File" type="submit">
</form>

That's it! All uppercase variables should match, through all code in this post. The max_file_size above is not really necessary, as it is easily overridden (or so I read). When the user clicks submit, the iframe (as the target of the form) will reload with the output of server_upload_script.php. For my purposes, I just need to echo to file, so my php script is simple:

<?php
$tmp_file = "tmp.txt";
if (move_uploaded_file($_FILES['FILE_IDENTIFIER']['tmp_name'], $tmp_file)) {
  $file_handler = fopen($tmp_file, 'r');
  $contents = fread($file_handler, filesize($tmp_file));
  fclose($file_handler);
  unlink($tmp_file);
  echo $contents;
} else{
  echo "There was an error uploading the file, please try again!";
}
?>

This will save the file to a temporary tmp.txt (creative naming, I know), then open the file and read it back. If there's an error with writing the file, an error message will appear instead of the file. This could be ignored, but works well for our purposes since it shows up on a text area anyway.

Finally, now the iframe has the file you need, the last thing is to use javascript to do whatever you want with that data. That's below:

function CALLBACK_FUNCTION() {
  var file = document.getElementById(TARGET_IFRAME_ID).contentDocument.body.innerHTML;
  if (file !== '') {
    /*
     * DO OTHER STUFF
     */
  }
}

And that's it! Three short sections of code to get an upload, not that bad.

The funny thing about this is that I spent 2 hours just to come up with this. And when I started, I didn't even know a input element can take type="file"
No comments

Croaking

Why, when people die, they "croak"?

Anyway, I'm developing a sore throat. Sucks.
No comments

The Problem Science Has with Jesus Christ

I came across this story multiple times in the past few days. First on Facebook, then on some other site I was reading (forgot what it was). Here's a copy of it.

The first thing I want to say is - the professor should be fired, for the way he treats his students. You should never, ever single out a student like that, especially when talking about such a sensitive subject. I think a number of people would cry if confronted this way.

Even if the professor was nicer, so this conversation happened between two friends, the professor is still not very good at his job. Science is more than simple perception, but is a way of understanding the world. Barring the skeptic position of not accepting the senses or the external world, perception is certainly one of the main ways we gain knowledge of the world around us. That does not mean, however, that it is the only way of doing so.

There are certain things which we cannot perceive - electrons, energy, black holes - but which we nonetheless believe exist. In terms of perception, these objects are equal with God. What these objects (or rather, the theories about these objects) has over the concept of God is how they allow us to predict the future. We can manipulate electrons to power all our appliances. Black holes are what logically exists in the center of galaxies, which provide the gravitational acceleration to hold the galaxy together. Energy is simply a way to measure the way things move, or more abstractly entropy; with it we know how far a plane can fly, how long and at what angle runaway ramps should be. These objects can be used to predict how wires, stars, and cars will react.

The real problem science has with God is that it doesn't offer any predictions. Certainly God may have created the universe, and intelligently designed everything in it, but that doesn't tell us anything about what will happen in the next minute. In this way, God shares properties with other imaginary objects, like unicorns and fairies; certainly we can argue they exist but are not perceivable, but that doesn't do us any good.

Back to the debate, the student did a very good job of arguing. Would someone please make sure atheists are represented fairly next time?
No comments

Parents

Several days ago the university police came knocking on one of my friend's door.

It wasn't serious, actually. As it were, there was another case where drugs were involved, but this was not it. My friend had apparently not contacted his parents for a while, and so they panicked and contacted the university police. I myself wasn't there when the police came; I only found out when my neighbor told me afterwards. I was asked if I had seen my friend recently. I thought at first he was kidnapped or something, but luckily nothing of the sort happened.

Funny thing, parents.

I myself haven't directly contacted my parents for close to a month (since 02-13). And that was an email; I've never called, and only briefly played with VOIP the first quarter of freshman year. Of course I've been writing in my blog, but it doesn't really say much about my daily life as much as my daily mental landscape. My family is just more relaxed (or some would say cold-blooded).

On the other hand, I know someone else who lived by himself in an apartment... in his senior year of high school. His family was moving, and since it's a pain to switch schools for senior year, he just stayed by himself. His family and he were only an hour away from each other, so it wasn't too far, but it's still a significant distance.

I wonder if these habits gets passed through the generations.
No comments

Abductive Inference

So it turns out I was very wrong in my conclusions from stalking.

Several thoughts in retrospect:
  • The chances of finding a LJ entry on pastebin is minimal (as I was told)
  • ... which makes this even cooler, because that minimal chance got us talking.
  • Abductive reasoning is sketchy at best
  • Stalking entirely random people is (of course) a lot harder than stalking people you have some information on
  • ... and is therefore more prone to errors (or in my case, complete failure)
Well, it was fun, it kept me busy for an evening. One of those funny stories you can tell you friends, huh.

PS. I am more amused that I sound above.
No comments

Interview!

I get to interview with CTY for a TA position this summer! Yay!
No comments

Week of 2008-02-25

Hm. It would seem that I haven't done much this week. Nothing on my schedule stands out to me; only the purple patches of my class time. I did visit Shedd (again) yesterday, for another round of testing. The bubbles look nice, and the dolphins showed interest (as well as fright, but that's expected). This was also the closest I've been to a dolphin; I was standing in the back wall walkway area, and the dolphins came up to play with our guide, as well as just to peek out and look at us. It was kind of cool, thinking about on it. I had one thought though: it's hard to tell whether dolphins are happy or unhappy, they just look so frivolous.

I wish I was a dolphin.
1 comment

Firefox Bookmark Keywords

I had talked before about using Firefox's bookmark keywords, where you can type a (few) letter(s) into the address bar and it will go to that bookmark. This is even usable with arguments, so for example I can do:

gm Chicago IL

to get a Google Map of Chicago.

This usually works great, except when I want that page as it would be by default. Because Firefox uses '%s' to signify where the arguments would go, if I just type 'gm' and hit enter, Google Maps will instead look for a place called 's', which is usually in Mexico (strange).

The solution that I recently came up with was to put a space before the '%s'. It made sense when I came up with it, but now I can't vocalize why it would get rid of the %s if it is preceded by a space. But now, I can get to Google Maps proper with just 'gm'.
No comments