Archive for September, 2004

Late Start Day!

Wednesday, September 29th, 2004

Tomorrow is a late start day, meaning that I can blog without feeling guilty. I might as well skip the part about saying that I’ve been busy; its obvious when I haven’t blogged in two weeks. This one will be shorter because I still don’t have that much time, so I’m going to talk about the plans for the CSHS website rather than about me (my latest entries seem to center more on me lately than anything else, which isn’t good).

We’re moving along quite nicely, in my opinion, though it might not seem like it. The pretty new look that I developed back in March was applied on September 1st and seems to be holding up quite well markup-wise. Normally, I’ll design a theme and find out later that I need to completely redo a part of it to accommodate some new feature, but the CSHS layout and design has only needed minor changes to remain flexible. I took my first stab at creating icons the other day when I made an attachment icon for the news posting system, but other than that the only tweaks to the design have been small (borders, gradients, additions because of dynamic modules).

If you visit the site right now (http://www.cshsweb.com), it’s not that much to look at, beyond the pretty new design. Content-wise, it is still lacking because I’ve been waiting for new content to arrive. Now that I’ve finally got it, I’ve found that the rudimentary backend page organization system that keeps all the pages and tabs on track has some major bugs (try the Counselors link to see what I mean). I could either spend two hours fixing this, or I could just implement my newer system that has been in development for the last three weeks. There are two problems with this solution, however.

First, my newer system (code-named Rancho for the street I live on) requires PHP version 5. It doesn’t work better with version 5, it doesn’t like PHP 5 more, it requires it. In other words, Rancho will not run on PHP 4 or lower. I have PHP 5 installed on my development computers at school and at home, but the school’s web host, who happens to be one of my clients, still uses PHP 4.2. Not only is version 4.2 not PHP 5, it’s an outdated version of the 4.x line (the latest 4.x version is 4.3.9). Put simply, my brand-new system is useless unless the upgrade is done. It’s not that I didn’t know that this situation would arise, it’s just that I had planned for the new system to be put into place much later than now, by which time I hoped that the web host would have upgraded by its own accord. The second problem with using the new system is that it is not even alpha quality, meaning that it is possibly bug-ridden and could crash under major stress because of a lack of testing. Of course, the best way to test it would be in a live situation, so that’s not such a bad thing for me, just a bad thing for visitors.

So all I have to do is get the web host to upgrade to PHP 5, right? It’s not that easy. The school’s host is a reseller for another, larger hosting company that probably puts thousands of websites on a single server. Upgrading PHP on the school’s server could possibly impact the other websites that are virtually hosted on the same server because applications written for PHP 4 (such as this blogging system) are sometimes broken by upgrading to PHP 5. Most programmers have already updated their code for PHP 5 compatibility, but not all. Anyway, there’s a good chance that the larger hosting company will tell the school’s host that the upgrade can’t be done because of the possibility of impacting others on the server. Meaning that we then have to search for a new web host, one that will support PHP 5.

Again, not that hard, right? All we have to do is cancel our current account and sign up with another host. But if you remember, our current webhost is a client of mine, meaning that I would be taking business away from him by moving. That certainly won’t help our relationship. Then again, he might be perfectly fine with it. He said that he’d get a reply from “Big Hosting Company X” by today, so hopefully I’ll know something by tomorrow.

Rancho itself could become a really awesome app. Everything is built around a page framework where each page of content is stored in the database and can call upon plugins to add extra functionality, such as the latest news blurbs or a list of users or site statistics (the possibilities are truly limitless). About 40,000 lines of code is enough to have the following major features implemented already:

  • Fully dynamic page management system
  • Authentication/profile system is in place but not heavily implemented (yet). Each page is owned by a user or a usergroup (a large collection of users such as Webmasters or Students) who can do whatever they want with the page as well as grant control to another user so that they may make changes too.

  • The following plugins: School News and Statistics, which uses flash to generate the prettiest graphs I have ever seen done by a web-based application. (Seriously, they rock.)

  • Full page metadata, meaning descriptions of what they contain as well as the times that they were created and modified. This allows for the generation of extra data such as the exact number of years, days, hours, minutes, and seconds since the page was added or modified. This is a nice feature for visitors as well as for admins who need to check to see which pages are oldest and likely in need of updating.

  • Dynamic page styling which allows pages to overwrite the global stylesheet in order to make page-specific style changes. Theoretically, a page could have a completely different layout from the rest of the site and remain the same backend-wise as the other pages.

Features that I’ll be implementing soon include:

  • Page check timestamps, which allow an administrator searching for outdated pages to mark a page as having been checked on a certain date and time so that other admins don’t check the same page until some time has passed. VERY USEFUL for sites with multiple admins, which CSHS will end up having when I retire from my position in the next two years.

  • Complete administration area for the management of the site in several formats: plain HTML, pretty HTML/JavaScript/ActiveX for Internet Explorer users, and prettier XUL for Firefox users. Browser-specific layouts are iffy, but they’re doable. (And I’d like to try, at least.) The nicer admin area formats would provide near-WYSIWYG (what-you-see-is-what-you-get) functionality, meaning that admins won’t have to muddle about with HTML. Firefox has a companion program called Composer which is for creating web pages (though it’s not very good right now), and parts of that codebase could possibly be used for the editing components in the XUL formatted admin area.

  • Possibly wiki-like page versioning, which would allow administrators to restore pages to older versions if they make a mistake or if the site is somehow hacked.

As far as I know, there is no other content management system (CMS) that brings together these kinds of features, which is why I’m so excited about it. Most CMSs use a modular approach where you see one page with a selection of modules such as news, forums, downloads, memberlist, etc. My system is the first working one that allows modules to be plugged in anywhere on a page in a truly modular fashion. So yeah. Some of these features may never get implemented, but there’s a good chance that they will if I continue to have time to work on Rancho.

Some things, especially the admin area, will require some serious abstraction to work. The idea is that you would be able to use the same code to generate any of the three interfaces by masking the background work with objects and methods. So if I wrote code like this:

$admin = new AdminPanel();
$admin->setPanelType('xul');
$admin->generatePanel();

the XUL panel would be loaded. If an Internet Explorer needed to use the admin panel (IE doesn’t support XUL), I can just use the same code, the only change being that ‘xul’ would change to ‘ie’. The AdminPanel object is smart enough to run the right code in the generatePanel function depending on what the panel type is set to. Understand? This is called abstraction, a method often used when working with multiple databases.

Pretend that you write a PHP application that stores its data in a MySQL database, the most common database used with PHP. A database query to retrieve your data might look like this:

$conn = mysql_connect('hostname','username','password');
mysql_select_db('databasename',$conn);
$sql = \"SELECT * FROM mytable\";
$result = mysql_query($sql,$conn);
while($row = mysql_fetch_array($result)) {
     echo($row['mycolumn']);
}
mysql_close($conn);

This code might look scary, but it’s actually quite simple. In the first line, you are opening a connection to the database using your username and password and storing the connection in something called a variable. Variables in PHP are the same as variables in math: they can mean or represent just about any value. In the second line, you are choosing which database you want to use, using the connection you made. In the third line, you store your SQL query in another variable. The SQL query is somewhat complex at first; just realize that it is grabbing some data from a table in the database (something like grabbing the data from an Excel worksheet). You then perform the query using the mysql_query function, and the result of the query is stored in yet another variable. Finally, you use a looping construct called a while statement to ‘loop’ through the results of the query. This is similar to looking at each row of an Excel document one at a time. Inside the while statement, you can perform operations on the data in that particular row. Because the while statement continues to loop until it has cycled through all the rows in the query result, the code inside the while statement is repeated for each row. In this case, we are simply using the echo function to output the content of the cell ‘mycolumn’ to the browser. Anyone who views a PHP page like this will see all of the cells in a single column of a database table, similar to hiding all columns but one in an Excel sheet. The last step is to close the connection to the database with the mysql_close function. That wasn’t so hard, was it?

You finish coding your application and sell it to a few people. However, one client requests that your application use a PostgreSQL database rather than a MySQL database. In your code, you’ve used MySQL-only functions, meaning that you have to go through your code and change every SQL query to make it PostgreSQL compatible (in larger applications, this could be nearly impossible to do). How could you have avoided this? Abstraction, of course. The above code would look somewhat like this if abstracted:

$db = new Database();
$db->setType('pgsql');
$db->sql_connect('hostname','username','password','dbname');
$sql = \"SELECT * FROM mytable\";
$result = $db->sql_query($sql);
while($row = $db->sql_fetchrow($result)) {
     echo($row['mycolumn']);
}
$db->sql_close();

What has changed here? Instead of using PHP’s native database functions, these functions have been masked, or abstracted, by an object stored in the variable ‘db’. Otherwise, everything is the same - the script will output the exact same data to users. However, since you are using generic, abstract functions rather than the native ones, you can change to a different type of database simply by setting a different type with the setType function. The above code will work with PostgreSQL; if I want it to work with MySQL, all I need to do is change ‘pgsql’ to ‘mysql’. It really is that simple. Programmers are inherently lazy, and you have just saved yourself tens of hours (with larger programs) if you use abstract functions rather than native, specific ones.

I did my best to explain this, feel free to email if you have questions. I want to get better at explaining programming concepts so that I can explain things better to the people I work with. (Oh, and I need to get some practice in before I write my book!)

Kreed.

Update

As you can see by the weird fontage in the code snippets and the tiny feature list text, there are some style problems. I’ll fix it tomorrow morning.

Firefox Preview Release

Wednesday, September 15th, 2004

I just downloaded the new preview release of Firefox 1.0. It rocks! It seems much stabler and slightly faster than 0.9.3 (which in my opinion was almost worse than 0.8 in some ways). And there’s some great new features, such as improved page searching and a built-in RSS checker, meaning that I don’t need 3rd party extensions to do it anymore. Also, the new extension/theme website, Mozilla Update, has lots of neat stuff to install…woo!

Do They Sell Time on eBay?

Tuesday, September 14th, 2004

I’d like to buy some time, please. Just an hour or two per day. And maybe another hour for sleep. The closest thing that I could find to buying time on eBay was Power-Nap. Supposedly, it gives you three hours of sleep in twenty minutes…whatever. Still, someone could make a huge profit off of selling time. Just shrinkwrap it, give it a fancy name like “Astrotime” or “24/7 Plus,” and you’ve got a marketable product. Woo!

I don’t think that my problem is that I don’t have enough time, really, but rather than I suck at making up a schedule and actually sticking to it. I end up doing something entirely different from what I had planned. I guess I just need to get into the habit or something, and then I’ll be better, but for now my chronic procrastination problem can only get worse. If I use my time wisely and spread out the work, I’ll have no problem reading two books by Sunday, writing essays on both, and handing the essays in next week. But it will likely be the night before the assignments are due that I actually do them. That’s not a good thing. But eventually I’ll miss a deadline, fail some project, and I will have learned. I hope.

Many things have been happening lately, and I haven’t really said anything about anything, so I’ll just jump right in. It’s been an entire month since school started already, which blows my mind because it seems like we just started yesterday. Soon it will be October, and then the Cool will come, and all will be better. I can do without 100+ degree heat. Anyway, school-wise, I’m definitely doing better than last year. I find myself actually wanting to do my work sometimes (gasp!), though certain classes, namely chemistry, remain boring. In English I am continuing to read a book called Brave New World, by Aldous Huxley. It’s a strange, futuristic sci-fi type novel about how a man from the past, John the Savage, comes to live in a futuristic society where drugs, sex, and flamboyance not only run rampant, but are socially acceptable. Sort of weird, but Huxley’s view of how society will be in a few centuries is suprisingly similar to the way it seems to be heading now. I mean, he wrote the book in the 1930s! That thur’s some foreward thinking.

For Brave New World, I have to keep a journal as I read it (not hard, but time-consuming), and I have to write three quick paragraphs answering some questions about the book after I finish it. When I’m done with that, I have to write an essay talking about the various religious themes in the book, as well as the impact of the main drug, soma. Everything is due on the 21st. I’m not going to say how far I am through the book, but I will say that in order to have the weekend to work on the essay, I’ll have to read and journal about 35 pages per day for the next four days. Not too bad, but 35 pages can take a long time when you’re writing page-long journal entries on every chapter. Now, had I not been stupid, I could have been reading those 140 pages a week ago, taking my pages per day down to about 15. But no…I had to procrastinate. (This entry is more of a lecture at myself than anything worth reading.)

The lesson here is that, with future books, I need to get a calendar and plot out where I should be by the end of each day so that I don’t wait so long before getting things done. Not procrastinating is also good because when I have to do a large assignment all at once, I get really fed up with whatever the assignment is about, so I’ll want to forget about it for a while. This happened with my Brave New World reading: I read the majority of the first half of the book within two nights before meeting with Kulinski the next day, so I didn’t want to think about it for another week. I’m such a bad keed.

My other major class is AP Euro, which I’ve talked about enough that it’s obvious that it was hard at the beginning. Now, things aren’t as bad. I have to go to school early tomorrow morning to finish a test, but beyond that I’m free until my critique of Postmodernism for Beginners, by Jim Powell, is due. Oh yeah, I’m sort of pseudo-independent studying in AP Euro too - Mrs. Cheeseman-Meyer has decreed that I am officially “up to the AP standard” as far as my writing ability goes, and so I will be challenged futher with difficult research projects and papers and such. I’m actually excited about this, because I can really kick butt with research-based assignments. The thing is, I still have homework other than for English and AP Euro, so it will be hard to spend a great deal of time on stuff for those two classes.

Chemistry really hasn’t been a problem of later, and Algebra isn’t hard, and neither is Spanish. But I’ve got Debate to go to tomorrow, and LitMag on Thursday. It’s not like I’m losing that much time by attending them, but it still delays me a bit. And my Photoshop class starts in a week, so I’ll have that to take care of too. On top of those things is the CSHS website, which is getting much better but will need a good amount of time to improve (I’m working on a database-driven backend so that pages can be fully dynamic). In my 90 minutes of work time each day, I have to not only code the new backend, but update the existing site as well, and things can pile up quick, especially when I requested them (which makes me obligated to post them). While Mr. Trapani has been gone, I’ve been put under the control of Mrs. Albertsen, the librarian. She can be a bit stern at times, and she is very quiet, but working with her isn’t as bad as it seemed like it would be when I first talked with her. I could be moving my workstation to her office, and the administration people could possibly be getting me some new equipment (computers, scanners, etc) to work with that would be much appreciated. Our current equipment really is out of date: for example, the scanners take about ten minutes to scan a single page, and the computers don’t have enough memory to compensate for the load placed on them during the scanning process, so they freeze while the scan is taking place and become generally unusable.

The CSHS website will soon have to take a back seat as I turn to my church’s website, which is in dire need of updating. My deadline is the 19th, which is too soon for comfort. Eeew eew…it’s really too bad I haven’t had time to actually earn any money for everything I’ve been doing lately. That’d make it all feel much better. Not that I’d charge my church for my services, but I could use a bit from the school if they feel like throwing some my way. After all, a fully dynamic, updatable website is much more than a simple web development class would ever accomplish. (Brag, brag, brag…gloat.)

I’ve been thinking a lot lately about the state of the education system in America and what needs to change to get students motivated and to a level of proficiency that they should be at. I mean, there are kids at CSHS, sophomores even, that write as if they were in 5th grade! And I ask, is this really their fault? Or is there just something wrong with the system. Likewise, I’d like to know: am I just really smart, or are other kids who are as smart as or smarter than I am getting screwed? Why is it that I have been offered all these extra choices, but it doesn’t seem like the same choices are offered to anyone else? Somethings are explainable, such as my Photoshop course; that came about because of my voluntary services to the school last year. But in English, I really didn’t do anything to get into an advanced independent study class - I just got pulled aside by Kulinski one day and there was no going back after that. And the same thing has just occurred in AP Euro. A note one of my papers from Mrs. Cheeseman-Meyer asked me to stop in to talk about more advanced options, and here I am skipping out on assignments the rest of the class is doing while I write critiques about books that are entirely off the subject we are currently studying.

Don’t get me wrong - I want to be in these special programs. But I sometimes don’t think I deserve it. There’s a girl in my AP Euro class called Dana that sits to the front-left of me who takes extensive notes on everything and has written three page test essays in 45 minute class periods. That’s pretty amazing, I should think. But why isn’t she getting any kind of special treatment? (Though truthfully, I don’t know if she is or not.) Am I just a strong enough writer that my sheer “awesomeness” at writing non-fiction outweighs the fact that I might not be as good a student as others? Or am I just as good a student, but I think I’m not because I see these uber-scholars in my classes that are sure to have much higher GPAs than mine?

And about this “Brett is a good writer” thing…what?! Me…a good writer? Sure, I’ve always been okay at writing stuff…I scored well on the AIMS reading and writing tests…but does that really warrant special classes and special assignments? Are other students being cheated? Do I deserve to cheat them? I dunno. I guess this just all comes down to a self-esteem thing. While my teachers say different, I just don’t think I’m that good of a student/writer/whatever. I was once the smart kid, but now I’m just another GPA in a sea of student ID numbers. I know that there are people at CSHS who are better than me at stuff. But I ask: What about them? I can’t be the only sophomore in an independent study English course, right? Right? But what if I am? Does that mean I’m smarter than I think? Or am I stupid to even think that I’m smart?

I just…don’t…know. And I don’t know how to handle it. Eventually people are going to realize how favorable my situation is, how I’ve got two great teachers preparing me for AP tests and college and beyond…while everyone else gets left behind. And then what will they think? Will there be resentment? Jealousy? Unhappiness? A large decline in my social status? Probably. And what about my own friends? Jim is in many of my classes…what will he think when I’ve got different assignments from him? Were I in his place, what would I think? I’d be…annoyed. Somewhat resentful. But that’s me. That’s coming from someone who’s used to being at or near the top of every class. Jim isn’t the kind of person who gets all jealous with it, because he just doesn’t care that much…right? But lately, he seems to care more. He has good grades, he’s in debate with me…maybe he does care.

Or maybe I’m just wrong about everything, and maybe I should stop throwing out these rhetorical questions. But…why? Why? Why me? Why was I chosen? Why do I matter? Why do I care about mattering? Why do I care about caring about mattering? It don’ make no seense. And finally…why am I up at midnight writing this when I should be asleep?

Update

10/7/04 - My opinion has changed on some of the above subjects. I just don’t have time to write about it right now.

I Will Blog Now, Thanks

Thursday, September 2nd, 2004

I have literally had no time to blog in recent weeks. I forecasted many entries ago that my time would be severely limited because of school, and it is. Now I have the following things to worry about/do homework for/study for/work for/etc.

Honors Algebra 3-4
Contrary to popular belief, this class is not hard, and never will be. I’m not trying to brag, I’m not trying to say that I’m just too good at the math we’ve been doing to care, but it’s true. DelGrosso is a nice teacher, but like many nice teachers (though not all), he isn’t the best one I’ve ever had. I find myself impatiently wanting to skip ahead a section or two and get some homework done in advance, only to have my plans foiled by the fact that he never puts the homework up on the board until after he has given us a long and droning sermon on what amazing things there are to know in Section X.y.

Honors Chemistry
I shudder when I think of this class. The Safety Nazi is ever vigilant and will stop at nothing to bore us out of our minds with pointless experiments and tedious worksheets. I really, really hope this class improves, for the sake of my sanity. I will say no more, less I faint with the pain.

AP European History
I wanted a challenge, and I got one. This is the hardest class I’ve ever been in, and though I’ve done pretty well so far (97% on one essay, 93% on second one, 95% on the last test, 100% on everything else), no matter what I do, it is never enough. I can take notes ’till the cows come home (to use one of those neat down-home sayings), and I can study hours at a time, but it really doesn’t make much of a difference. What matters most is a) attending class and taking extensive notes during lectures and b) understanding the underlying concepts of a period in order to remember the rest of it. It really isn’t that bad, and it sure is interesting, but I still spend more time each night on AP Euro than on anything else.

Web Development
Things have been sketchy in webdev lately. First, Trapani is currently not at school for reasons that I won’t write about here, though I will say that he won’t be back for at least another week. This is okay in some respects because it means that I am left alone to pretty much do whatever I need to do on the website without interruption. Not that Trapani is particularly annoying or anything; it’s more that when he is at school I have a constant flood of things that need to be added/modified/changed on the site, whereas right now I’m in a very relaxing quiet period. Let it be known that I work best in either complete silence or seclusion, or in seclusion with some good music playing in the background.

Anyway, I’m sort of juggling three projects right now: 1) moving pages from the old site to the pretty new design, 2) coding a nice, new, dynamic site with database-driven functions and such, and 3) a registration/scheduling application for schools which could be quite profitable. This is a lot for me to need to do, but once the first one is done I’m supposed to be able to delegate the remedial tasks of updating pages to some minions provided by the school, which will help a lot.

Kulinski
I’ve been a bad kid. I really haven’t been working on my stuff for English at all. I’m supposed to have read at least half of Brave New World, by Aldous Huxley, by the 7th, and I’m only on page 15-ish. I’m also supposed to be jounaling about my reading, which I haven’t started doing yet. Oh, and I’m also supposed to write three essays by the 21st, at which time I should have finished the book. It isn’t that I can’t handle this kind of work-load, it’s just that I have no time. I NEED TIME! Where does it all go? Why can’t I buy more when I run out?

Nasr
After a hard day, Spanish class is all I need to loosen up and feel better about things. Something happens to make the entire class start laughing at least once every period, and my table, comprised of Marion Thiefain, Kyle Short, and Kyle Rimmer, is a good one. We all tried to pronounce Marion’s last name and came up with THAY-fawhn, which is nowhere near right, though fun to annoy her with. There is much binder-stealing and general joking around, but we still manage to learn something. And I’m finally getting back my ability to speak and write Spanish, which is great seeing as we’re already three weeks into the semester.

Debate
Yes, I joined the school debate team. As far as I know, I’ll be competing in the Ted Turner (partner) event and impromptu, which is where you make up a speech about a random topic. The only problem is that I have no talent when it comes to public speaking and am mortified about having to present in front of a large audience. We’ll see how far I get.

LitMag
I’m in LitMag again too, and I’m determined to do more this year than I did last year. I can do Photoshopping, web sites, etc, whatever they need, just ask and I will obey. I have a meeting tomorrow after school, the first one this year. Hopefully there’ll be some new members.

Work
Technically I still have a part-time job. I haven’t done much since writing a contact-management system for a theatre awards organization a week or so before school started. I dunno if I’ll have time for much else.

Continuing Technical Education
Supposedly I’m still learning stuff about PHP. I got a new book last weekend called Advanced PHP Programming, by George Schlossnagle. I had to pay for it in quarters because I’m poor. Hopefully I can talk the school into some financial reimbursement for my services (they’d better pay…or there will be no more website….BWAHAHAHAHA!).

So yeah, that’s about it for now. I might post again this weekend; it’ll be a three-dayer.

Quote of the Day (sort of)

There’s no need for John Kerry to campaign. All he needs to do is put on one commercial on national TV the day before the election with this short message: “Elect me…or there will be no more ketchup.”