I like that old time rock & roll

I just bought two "compilation" albums that should keep me occupied for a couple of days.

Eddie Cochran
Buddy Holly

Greatest hits or whatever. I get the morning shift in work, of music. We throw on tunes and rock. Friday I put on the Beastie Boys "License to Ill", and previous installments included Red Hot Chili Peppers, Guns n' Roses, Blind Melon, and I forget what else. It's a good time. Time to mix it up with some 50s rock.

We make a cute couple

Don't we?

For the past two days my brothers and I have been working on my lawn. It's exhausting. It'll be awesome when it's done. I'll have pictures up in about a month.

I have an affinity for science

This has been apparent since I started learning about science, besides biology. I'm up the latest I've been up for the past month or so. It's 2 AM. Bear with me.

I was always also pretty good at math. No genius, but kind of quick to catch on. This was displayed in first grade when I was moved from the B class to the A class in Math. I was 6. This also was evident when instead of learning long division the way the teachers would teach it, I taught myself a way to do it without writing even a quarter as much as the teacher's method. I taught this to a kid in the class who was having problem doing it, and he got in trouble because he didn't "do all the math". But it gave right answers. I never got in trouble.

Then after about 8 years of video games (Nintendo and Sega Genesis mainly), by the time I was 14, I knew that I wanted to make video games, but didn't know what to learn to be able to do that. In the meantime, I was still in first track math, getting 95s or so without trying much, acing Geometry and Trig, doing good in calculus. When I was a junior, I had to start thinking about college, and had no idea what I wanted to do besides make video games, which I hadn't researched at all.

So, instead, I was doing good in chemistry and generally enjoying it, so in my Junior year, I wanted to be a chemist. The next year, I learned physics, was really good at it, and highly enjoyed it. Although, I was only in 2nd track physics. So I wanted to be a physicist. Either of these two would have been a disaster, I think, compared to what I did end up taking.

In college, still looking to fill that gaping void, I took a few physics classes, including astronomy. Today, I still can't get enough physics. With the advent of the internet, and podcasts, I listen to all things physics and astronomy, including Astronomy Cast. But not only podcasts. Audiobooks are like 4 hours long. I have 18.7 hours worth, including three Stephen Hawking books, and one by the Dalai Lama, which is called "The Universe in a Single Atom", which is just a history of his studies and learnings from various minds in theoretical physics.

The only things is I'm not smart enough to come up with my own theories or even begin to understand some of the more complex theories out there. There's not math in those books, though, just theories or almost proven theories, but no math to back them up. Which is fine, I'd be completely lost since I haven't had a math course in years. The way they explain it is good. The current Astronomy Cast is "What shape is the Universe?" I just get so completely lost thinking about it. You might be able to come up with any shape as long as you can come up with a bit of evidence to prove it. I can say, "When you step away from the universe and look at it, it spells 'Jason'".

And talking about 11 parallel universes. A universe that is always expanding. And every object in space, every other galaxy we see is moving away from us, but we're not in the center. There is no center. And is it finite?

The big bang. How when the universe "started", it started as a point with a trillion trillion trillion trillion trillion grams per square centimeter or whatever. My one theory is this... I imagine multiple big bangs in the past, but each time, the universe collapsed on itself. So there's no way to know just how old the universe is because each time it started over. Time started over. Einstein, move over :)

If you think about that, multiple big bangs, but this universe is always expanding now... it means that in the past big bangs there was more mass in the universe that gravity made it eventually come back together. After billions and billions of years. But what happened to that mass that now it's expanding with no collapse in sight? I don't know that there's no collapse in sight, though. If the acceleration of the expansion of the universe is slowing down, then it will collapse again. Of course I don't know that this isn't already a theory since I don't read or listen enough, and anything that Hawking doesn't discuss has since been ignored. But I'll take credit for it :)

Just wrapping my head around those ideas; the infiniteness of the universe, the shape, the center. How instead of Newton's theory of gravity where objects PULL other objects to them, instead there's wells created in space. How nothing in space travels in a straight line, not even light, since it gets warped by these divots in space created by mass. It might keep me up later thinking about it, but I wouldn't venture to call myself even an amateur theoretical physicist, maybe not even a hobbyist, I just want to understand. But Astronomy Cast says some of it is the most difficult ideas to understand. Well, I love a challenge.

Amazon.com Market

Sometimes I'll add an item to my amazon.com cart, only to end up leaving it there for months.




When I added that MicroSD card for my phone, it was like $30. Buy!

Now, Jaws on the other hand... Damnit, I missed the $9.99 price.

Another item, I think it was Bill & Ted's Excellent Adventure, just reached below $6 earlier this morning. Might have to hop on that one.

Barack Obama called today

Actually, some intern working for his campaign in Delaware County, PA, who's never met him, etc, telling me that in order to vote for Barack Obama during the Primary on April 22nd or whenever it is, I have to register as Democratic, instead of whatever I'm listed as (Independent or Other I think they said)... (Actually, I specifically remember I put "Unaffiliated" thinking no one would bug me, but it's a swing position, so everyone bugs you. Oh well, better to not lie to everyone than just say I have no affiliations to imaginary parties :) Not to offend anyone, I just don't take politics very seriously...) So, they said I would have to "register as democrat" in order to "vote for Obama" because that's what every unaffiliated person does, but that I could "change back later".

First off, I don't get that rule. If everyone knows which way you're voting, what the hell's the point of voting, other than getting off the couch and heading to the polling station. Oh, yeah, there they can hand you fliers and tell you that you've picked the wrong side like a jackass. I agree with the whole voting thing and democracy, but I like to not be bugged. I know there's an election coming up in November (who hasn't seen Hilary and Barack on TV in the past year?).

Oh yeah, so, chances are I'll vote democratic, but I'm not voting at the primary, if I have to change my affiliation. I picked that for a reason. Make people think they have to work for my vote. I'd rather not even have to care about politics, but there's just a lot of crap wrong with the world, and my little vote can make a difference! Unless I pick the wrong guy... (or girl)

Two new songs, Kodie looks funny

These two new songs could be said to be written for Kodie, since one was before I went to pick her up at the Vet, and the second one when I got her home and all fed (2 full cans of soft meaty dog food!).

The first one, a Mother Fing Jam in G, can be downloaded here. It shows why I love my new found experience of fingerpicking, and also hammering on two notes at the same time with two different fingers on two very different strings. You just have to put on headphones and listen to it to tell where I'm talking about. Otherwise, it's just I hear a rhythm in my head and play along.

The second one, Long Jam, here, starts off finding a rhythm to play along with, then plays around in D for a while.

Kodie got her whole bottom row of teeth pulled :( The front though, none of her big teeth. These looked real bad in the past week or so, and I noticed two of them, at least, were really loose. So they're all gone. She's fine though. They said in a few weeks, if I want I can go back to the hard food, if Kodie will eat that stuff still! I gave her some soft food, and it was like meat with gravy. Two full cans, and she just ate it up. She was starving so we'll see how she is tomorrow. If she's still excited about getting food, then I actually have to learn how to portion it for her! Usually when the bowl's empty I fill it and it won't be empty for about a day or so. She's very good about eating that food because she doesn't like it :) It's only when necessary. But I bet I could keep filling her bowl up with this soft, meaty, gravy covered food and she'll just keep eating it.

I watched the HBO show "In Treatment" tonight and really liked it. I was like "I should probably watch that show, it's on a couch, and there's no room for bad acting, so it's probably excellent or really shitty". Then as I was thinking that, it came on. It was probably an "On Next" thing. It's on HBO. It was excellent, I must say. Might watch it some more.

Dogs are the best

I was sick Monday and Tuesday, but when I went downstairs after two days of bed ridden disgustingness, I noticed my dog wasn't eating anything, hadn't eaten for two days. While I would have been flattered if she stopped eating because I was sick, I know they're smarter than that :P I tried to give her her favorite treat and she turned it down.

Today (Wed the 12th) I was fine on maybe taking one more day off to fully recover, but I had to get the dog to the Vet, and I might as well go to work after that. I was feeling like total garbage up until about 2:30, though, and then from about 3:15 onto the end of the day. Took Kodie to the Vet at 9 or shortly after, was in work by 9:45. I missed the phone calls from the Vet because this is how delirious I was all day: we're in sort of a lunch meeting at work, and I'm like "Hmm, if my phone goes off... blah blah, should I check to see if it's on? Nah it's fine"... 2:30 rolls around and I'm like "Man, they still haven't called me..." The office closes at 3 and opens again at 6. I check my pockets... no phone! No idea. It was in the car. I may have even been delirious about Kodie not eating for 2 days since I was totally out of it for 1. But just her energy level, it was soooo low, and if you know Kodie, you know she's nothing but energy most of the time. You *can* calm her down, but usually she does much more stupid and funny things when she's all crazy :)

It's like, of course Vets can say "Oh we have to check for everything" and charge you for it all... but it's not even that expensive. But you can tell that Kodie has some bad teeth and might not be eating because it hurts her. But the Vet's gonna do blood tests, spool tests, all this stuff, might as well. And you can't say "I think it's just because of her teeth", even though in the end you may be right... because us lay people don't know.

I know I can't say that because in my profession, it is also best to be thorough. I know sometimes I can see the answer WAAAY before I even begin looking into code, lots of times I can tell you the exact file the problem is in, and almost never can I tell you what line it's on. Sometimes I boggle my own mind on how quick I come across some of these answers.

Just that it's probably way less expensive to find a problem with your pet relatively soon after a scheduled appointment so you don't have to get all the tests again :)

She'll be fine though. She may never be able to eat hard food again, but I'm sure the Vet will tell me what kind of food to give her. They called me at like 7 and said I could pick her up after giving me the lowdown on her condition and how none of the tests they've done led to anything (no kidding!?). They said I can take her home or leave her overnight because she has another thing tomorrow. Leave her overnight?! Yeah right. They tell me she can't eat any food, even though I took her there because she hadn't eaten any food for two days. Plus, the lady doctor assistant was like "I gave her some of the i/d food (some sort of dietary food for dogs), and she ate it right up" And I was like "That's good! Was it soft?" And she's like "Yeah, it was soft". But I get Kodie home and they gave me this 3/4 full tin of that food and told me not to feed her because she's having a procedure done tomorrow to her teeth. I'm like "Ok. No problem"... Yeah right. She's gotta be starving, so I give her almost all of the can of food. There's hardly any left :) But now she seems real good. She had so much energy tonight out with the neighbor's dog, it was great :)

Acid3: Embarassing Browser Makers Everywhere

Did you take Acid3 with your browser?

My FireFox 3 beta 3 scores 61 out of 100. The best reported was Opera 9.5 at 65. The cofounder of Opera was a designer of CSS or something. Acid3 was more of a Javascript + CSS test, whereas Acid2 was strictly CSS. FireFox 3 beta 3 passes that easily.

Microsoft's IE6 doesn't fare well. I think it got 7 out of 100. IE7 is probably way better? Nope. 12. Linux based browsers like Konquerer scored in the mid 50s.

I read a comment somewhere, probably Slashdot, that said these tests aren't to see if it's a good browser, but more to push the browser makers so that developers can use the things that they test for and take for granted that a wide variety of users will be able to support them. That should make a lot of developers happy. Except for Microsoft! They just got done making sure their latest version of IE, 8, which is in beta, passes the Acid2 test. That's where free software owns. Release cycles based on business fiscal schedules are no good for anyone.

Sorry for the Atom Spam

There's probably two subscribers to my feed, and one of them yelled at me :p But Google Reader should be back to business now, shortly after showing 400+ new items from this website. Atom has an ID that it uses, and Google Reader apparently keeps track of your read items by that ID and doesn't care about the date at all, evidently. So, new items showed up back to the beginning of this website.

So, will there be 400+ new items every time I post? No. It has all those IDs now, which are new and changed, and unless I change them, they won't show up again.

I can't just write a post apologizing though. I have to talk about the new cool thing that I'm working on here at home. I've talked about it before but apparently, wasn't able to carry through with it. Reasons were mainly that my laptop proved to be way to slow after the initial "wow" factor of installing Ubuntu. (My reaction now would be more "Wow, FreeBSD on a ThinkPad RULES!") The thing I'm talking about is my seamless integration between front end Javascript and backend Java. I wrote about it here. But I've made a few changes.

First, instead of the backend generating XML, it'll just read XML and spit out results in JSON. I'm kind of partial to that technology because of the name... it just kicks ass. I got my first foray into JSON last week at work. Initially, our backend PHP was just returning a few things, like 3, for the front end Javascript to parse and spit into HTML on the website. What the final requirements called for was way more complex, and I didn't want to have to come up with some naming scheme, because it would just get so ugly. Some things were related to each other but not to everything. It would be something like this:

"What is my name?:Jason,Steve,Albert:Jason:True: Jason,80%:Steve,5%,Albert:15%,2000,Elite"

This is like a quiz or trivia, where the question was "What is my name?", the possible answers "Jason,Steve,Albert" comma separated, the correct answer "Jason", whether that person got it write "True", and finally the percentages that other people guessed, the total points for that user "2000", and their ranking "Elite". And that's not even all of it. It has to include the next question, and all of those possible answers. Painful. So instead, this is what it looks like:

{
"LastQuestion" : {
"Text" : "What is my name?",
etc
},
"User" : {
"Points" : "2000",
etc
},
"AnswerPercentages" : {
"Jason" : "80",
etc
}
}


Much easier to maintain, much easier to read, much MUCH easier for the front end to parse! This can be parsed like this... assume your callback function is called "callback" and is passed whatever is returned from the server, e.g. the JSON code above:

function callback(data){
var obj = eval(data);
alert(obj.LastQuestion.Text); // will alert "What is my name?"
}


Yup, it's that easy.

Next affair... I'll need, and will build over time, a large Javascript library for building out websites with the data returned from the server. Tables, forms, etc. This will generally be a pain in the ass and is attributed to me delaying this project for as long as possible. Ugh.

If I get tired of that, then something's gotta give, and I'll either stop this crazy experiment or go crazy writing Javascript for hours and hours. Thank God for FireBug.

More code for your convenience

I had this log file from my server that's just been sitting there collecting errors for about 2 years. It got pretty big, upwards of 60 MB. So, I wrote this program to break it into chunks. I looked over the FreeBSD documentation to see if there's a program that just reads the last few KB or so. I was getting no output on my new "Browse By Month" code, and when I wrote this program, I was able to split the file into chunks of about 976 KB each (1,000,000 bytes).

package filebreaker;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;

public class FileBreaker {
public static void main(String []args){
String dir = "/usr/home/jason/Downloads/";
String filename = dir + "catalina.out";
int chunk = 1000000;

try {
BufferedInputStream fs = new BufferedInputStream( new FileInputStream(filename) );
BufferedOutputStream os = null;
int itr = 0;
byte []buf = new byte[chunk];
int status = 0;
while (status != -1){
status = fs.read(buf, 0, chunk);
String chunkFilename = dir + "/out/catalina-" + itr + ".txt";
os = new BufferedOutputStream(new FileOutputStream(chunkFilename));
os.write(buf);
os.flush();
os.close();
itr++;
}
fs.close();
}
catch (Exception e){
e.printStackTrace();
}
}
}


I found out the error. I'm using Java 1.6.0 on my local machine, and have yet to install it on my server. I used a method (Calendar.getDisplayName(int, int, Locale)) that wasn't part of Java 1.5.0, which is running on my server. DOH!

I also now like putting code on my website since I have new css for handling <code /> tags. It looks like this:

code {
display: block;
overflow: auto;
width: 600px;
white-space: pre;
}

code br {
display: none;
}


:D My text formatter takes line breaks and replaces them with "<br />", and I wanted code to be preformatted so I don't have to replace tabs with spaces, and also I didn't have to check if I was inside a "code" tag and not insert <br /> for line breaks. It's just a very convenient way to handle it that might look like crap in another browser that's not FireFox. I'll add lots more code now :)

Hello URL Rewriting!

After about an hour of programming, I have my URLs in a search engine friendly format! This has many other benefits as well:

For instance, I don't have to know the ID of the news I want to link to, just the title. So, I can make a link to a news item I have previously written by typing in the title in a format that it expects. For the news item titled "The Guitar Player", the link will be "the-guitar-player". Click here to test.

Also, if I want, I can modify my "text writer" component in JSF, to search for strings like "[[The Guitar Player]]", and to write out the url, namely "/news/the-guitar-player". Or I'd have to make it "[[News|The Guitar Player]]" if I want to add more dynamic linking, say for photos, downloads, comments, etc. This is much like a Wiki works. It can be a "news wiki" or a "wiki blog" or something ridiculous like that.

Also, after I save this, it will probably write out all of the news in my atom.xml file... it might take a while, there'll be 454 news items! That's ok though. I'll probably have to delegate that task to a new thread, so I can get to adding more news right away.

Categories are changed for rewriting purposes. "Labels" have not been updated yet. I have to make a new page because a "Label" object can pertain to Downloads and Pictures, so I have to list results for each, or modify the URL rewrite filter to accept "/picture/label/me" and "/download/label/music" to list pictures of me and my music downloads, respectively.

I don't run Apache HTTPD, so I had to write the URL rewriter all in Java for Tomcat. It wasn't too bad. Regular Expressions are neat.

The meat:

String url = ((HttpServletRequest)req).getRequestURL().toString().replace(HttpUtil.getBaseUrl((HttpServletRequest)req), "");

if (rewriteConfig.ignoreUrl(url)){
chain.doFilter(req, resp);
}
else {
String location = rewriteConfig.getLocation(url);
String rewriteUrl = rewriteConfig.getUrl(location, url.replaceAll("/" + location + "/", ""));

if (rewriteUrl != null){
RequestDispatcher dispatcher = req.getRequestDispatcher(rewriteUrl);
dispatcher.forward(req, resp); // forward the request
}
else {
chain.doFilter(req, resp);
}
}


url is the requestUrl stripped of the host. This is so I can make it work on dev (http://localhost:8080/jtccom) and production (/).

This filter is called for every request, so I have an "ignore" map set up. This tests if the URL contains a ".", since every rewritten url will only contain numbers, letters, and the occasional "/" or "-". This is a HashMap for quick lookups. So, it won't attempt to rewrite calls to "/js/someFile.js".

The "location" part of the request is "/x/", so for news it will be "/news/". The location is "news". This is so I only have to loop through rewrite patterns for news, not for everything.

The pattern is written as "([0-9a-z-]+)/?" so if I pass in the whole URL (without the host), "/news/my-news-title", it won't match, so that's what the next line does, removes "/news/" so it's just "my-news-title". The getURL function returns the rewritten URL, so like "/news.jsf?title=my-news-title". I created a new unique column for News, and my "DaoWeb" interface has a "ChangeListener" property, so if I create a news or change it's title, it updates the "TitleKey" in this case. Pictures are just forwarded by their picture id for now, so
"/picture/23" as an example.

Coming soon: News by date span! /news/2008 for all news in 2008. /news/2008/03 for all news in March 2008! /news/2008/03/23 for all news on my birthday this year!!

Tune in for more updates. I'm cranking now, and Java is like riding a bike. I also fixed a few bugs.