December 20th, 2005
Ok. Yet another entry about my favorite database system, MySQL. MySQL 5.0 was recently released and I’ll say straight away that it’s a massive improvement on MySQL 4.x. I have only one word for this particular entry. Views. Views are a fairly standard feature for RDBMSs. Views are this really nifty way to make dealing with the disjointed nature relational databases much easier. Take for example a database of class lists for teachers. Each teacher has a list of students. You have a table filled with your teachers, another table full of students, and a third that contains only student ids and teacher ids. You need this third table because there isn’t a one-to-one relationship between students and teachers. One student can have multiple teachers and one teacher can have multiple students. The third table which holds only the student and teacher ids is commonly called a Join table. It contains no real information, it’s just a way to connect other bits of info together. Got it? Good. Ok…
So let’s say you want to get a list of students for a given teacher, “Ari Denison”. Without Views you would be forced to tell the database to spit out a combination of info from all three of our tables: Give me the first and last name of students who all share the same teacher id. It would look something like this without using views…
SELECT
students.full_name,
teachers.full_name
FROM
students,
teachers,
join_table
WHERE
teachers.full_name = “aran j. denison”
AND
teachers.id = join_table.teacher_id
AND
students.id = join_table.student_id;
A bit confusing eh? Especially just to pull some really simple data. Unfortunately the advantage of an RDBMS is also one big pain in the butt. Multiple tables related by common fields. So… Views were created to eliminate or reduce this complexity. Actually, they have a number of other purposes, but this is my favorite.
A View allows you to create a sort of fourth table that already contains a combination of the other three so that you can tell the database to give you data from the View rather than from the other three like so…
SELECT
student_name,
teacher_name,
FROM
student_teacher_view
WHERE
teacher_name = “ari_denison”
Way better, eh? Well, it’s way, way, way better when you are pulling info from more than 3 tables. The WHERE stuff can get amazingly complex. Creating Views greatly simplifies lookups and that makes me smile just a bit each time I eliminate an hour of coding by using them. I’m glad that Views and a few other stylin’ features like Triggers and Stored Procedures have been worked into MySQL 5.0. They will quite literally shave hours off my work week.
Posted in WebLog | No Comments »
December 1st, 2005
Why is it so easy to work the graveyard shift? I’m not all that fond of the daylight sleeping thing. It’s a pain in the ass for all sorts of practical reasons. Especially in this little town. But there’s something awesome about working at night. I always used to do my darkroom sessions at night. No interruptions, I could play my music as loud as I wanted, and it was easy to control the light for viewing prints. The same applies here… basement office, loud music, stable temperatures (I get sleepy when it’s too warm), no phone calls, no interruptions. In short, the perfect working environment for programming. Gets a bit lonely in it’s way… but only when I’m not working hard enough or get bored waiting for a slow computer.
In other news… I decided to go see an allergy doctor. I think it’s a good thing. Been fighting this crap for too long and I want to know what’s causing it. It’s bad enough that I don’t like to exercise outside. How wrong is that? It’s not that it’s better inside, I have no idea what causes it, but at least when I’m inside working out I’m not wet, cold, miserable and unable to breathe. I hear that allergy tests suck. All sorts of poking and prodding and pain. Oh well. I’m also going to see a shrink about leftover crap from my mom dying and from my mind-fuck of a divorce.
I’m sick and tired of hitting emotional roadblocks. I want my life to be open and to move forward, but there’s fear lurking around every corner. It’s actually closing my mind, making me not even consider certain options. Why not eventually go back to full-time photography? Why not get married or let myself fall in love again. There’s no rational reason, no lack of talent or determination, or opportunity… so why don’t I even consider any of it? I haven’t had much success figuring it out on my own so it’s time to get some help. There are causes and solutions to everything, doesn’t mean we can find them all on our own. Right?
Anyway… I had better get back to work.
Posted in WebLog | No Comments »
December 1st, 2005
Ok, wow. Just picked up a Quad 2.5GHZ G5 Powermac for a project I’m working on at the Public Defenders office. GOOD GOD IS THIS MACHINE FAST!!! I mean like orders of magnitude faster than anything I’ve ever worked on, ever, anywhere. Wow.
I have a dual 2.0GHZ G5 with 5GB of RAM at home and that machine is no slouch. Rips through just about anything I throw at it. Chews up monster multi-layered photoshop files with cycles to spare. But that baby can’t hold a candle to the Quad with only 512MB of ram. It’s really that fast. Ah… hopefully my 16 hour epic work days will shrink down to a quicky 12. Lovely. Too bad I can’t take it home and put it to work on all these weddings I’ve been shooting.
Posted in WebLog | No Comments »