GBCMS v1.3 Released!

The Green Beast CMS (GBCMS) is a powerful, highly configurable, flexible content management system featuring three (3) ready-to-use pages, including a news page with RSS and a content form, easy setup and install, file uploaders, and more! If you’re looking for a powerful content management system (that does not require a database of any kind), you should give the GBCMS a thorough try. I’m confident you’ll find it not only meets but also transcends your needs in an efficient way.

December 19th, 2005 | 8 Remarks

Google Homepage Translate

It’s still rough around the edges and the code needs to be optimized heavily (also you can’t run multiple instances of the Google Translate module on the same page, although I don’t know why you would need to), but it’s basically done.

If you’re a Google Personalized Homepage user (like you should be), the way to use the module is simple. Go to your personalized homepage, and click the “Add Content” link at the top-left of the page. On the bar that expands out, look down for “Add your own content.” Click it, and it’ll give you a text field to enter the address to an RSS feed or a module. Type in: http://base.google.com/base/items?oid=2965185083363856584 and hit “Go.” The Google Translate module should appear on your personalized homepage now. Feel free to leave comments, suggestions, and so forth, but remember it’s not refined; I only had a few minutes to work on this thing yesterday, and there are a lot of optimizations that could take place to make it work better all around. Enjoy!

December 15th, 2005 | 3 Remarks

Using PHP to maintain a specific filesize

The script started off with some simple configuration…

  1. <?php
  2. $file = 'data/data_tracker.txt';
  3. $maxlen = 300000; // bytes/chars before file truncation begins
  4. $input = '<p style="padding:0; line-height:130%;"><strong>'
  5. .'IP: '.getenv('REMOTE_ADDR'). "</strong><br />\n"
  6. .' <span style="font-size:85%;">DT: '.date("M jS, Y - g:i a"). "<br />\n"
  7. .' PG: '.getenv('REQUEST_URI'). "<br /></span></p>\n\n";
  8. ?>

The settings are pretty clear: $file is the location of the tracking file to be written to, $maxlen is the maximum filesize (in bytes) that $file can reach, and $input is what will be prepended to the file. Let’s move on.

  1. <?php
  2.  
  3. if(@$handle = fopen($file, 'r')){
  4. $data = @fread($handle, filesize($file));
  5. fclose($handle);
  6. }
  7.  
  8. while(strlen($data) > $maxlen){
  9. $temp = explode("\n\n", $data);
  10. unset($temp[count($temp)-1]);
  11. $data = implode("\n\n", $temp);
  12. }
  13.  
  14. if(@$handle = fopen($file, 'w')){
  15. fwrite($handle, $input.$data);
  16. fclose($handle);
  17. unset($file, $maxlen, $input, $data, $temp, $handle);
  18. }
  19.  
  20. ?>

The first thing we do is open and read the file. The contents of $file are loaded into the $data variable.

Next is the best part of the script. We run a while loop, checking the strlen() of the $data variable, and making sure that it is greater than the $maxlen. As long as it is, we can delete chunks of data at a time. We don’t want to remove each letter until it is at exactly $maxlen in bytes, but we want to remove the oldest chunks of data until the amount of bytes is less than or equal to $maxlen. Generally, the file size will be kept less than $maxlen, depending on the size of each chunk.

The last part just writes the new data, following truncation (if necessary), and prepends $input.

Anyway, I found this routine helpful and figured I’d share it with anyone who may be interested in accomplishing something similar. Download the entire code: tracker_3.txt.

December 11th, 2005 | 2 Remarks

SciFiTunes Revisited

The new shows available in the iTMS include Alfred Hitchcock, Battlestar Galactica, Monk, Surface, Conan O’Brien, Jay Leno, Dragnet, Law & Order, The Office, and Knight Rider. Unfortunately, I still see no Stargate SG-1 (or Atlantis), but my hopes are still high that they’ll be made available eventually.

December 7th, 2005 | Remark

Page Weight and Semantics

There is no such thing as a non-semantic SPAN or DIV

At least, in a sense. “What!?!! You’re crazy!” you say. Well, for your information, according to the W3C the SPAN and DIV elements have no semantic value, except that they can be used where no semantic or structural tag exists, making them as meaningless as not having a tag in the first place (save the fact that a tag is present for structure and/or presentation, but not semantics). Therefore their only drawback is that they increase page weight. Admittedly, it is best practice to avoid using additional HTML where unnecessary, however the disadvantage of using additional HTML tags such as SPAN and DIV is minimal (page weight increase).

I said above that there is no such thing as a non-semantic SPAN or DIV in a sense. Let me elaborate on the reasoning behind that. If, by saying non-semantic, you mean that SPANs and DIVs have no semantic value, then there is indeed a such thing as a non-semantic SPAN or DIV — in fact, with that reasoning, all SPANs and DIVs are non-semantic, which makes the adjective “non-semantic” redundant (except that there is a tag in place, giving a structural, and often presentational, meaning to the element, but not a semantic one). On the other hand, in the sense which I spoke on above, if by saying non-semantic you mean that it is bad practice to use SPANs and DIVs where they are inappropriate due to their semantic value, then you are incorrect, because they have no semantic value to begin with. As a result, the statement “non-semantic SPAN or DIV” is highly redundant, since SPANs and DIVs are inherently non-semantic.

Back to page weight

Once you understand that SPANs and DIVs don’t confuse screen-readers and other handicap-assistant software, your only reason to argue that adding an extra DIV or SPAN (or HTML comment) is a bad idea is that it increases the page weight. However, when you come to realize that the majority of a page’s weight is from its content, you’re on the losing end of the argument. The template itself can easily be between 2-10 kilobytes (this page, including its content, makes a total of roughly 4k, excluding images), and still be much smaller than a table layout’s template. Unless you’re going for a strictly bare-bones design (which would not require extra DIV or SPAN elements anyway), there should be no problem with the size of the page. If your page is 180k, following the addition of content, then instead of trying to reduce the amount of HTML in your template (unless your HTML is 50%+ of the total page weight), perhaps you should try reducing the amount of content or splitting up the content into multiple pages. There are different approaches to remedying the problem of a very heavy page, but consider the biggest source of your page weight (the content) before attempting to reduce the size of your template (and risk compatibility).

So just what are you saying?

All I’m saying is there’s no reason to freak out about additional, meaningless markup for presentation — or structure. If your image replacement technique requires an extra SPAN, so what? It’s just a few more bytes. At least it’s cross-browser compatible and accounts for most, if not all, of the problems it tries to fix (for example, CSS on/images off). You may prefer to omit such meaningless tags, and that’s a good general practice, but preference does not indicate necessity. I’ll give up a few bytes of bandwidth/loading time any day to permit more accessible documents.

December 5th, 2005 | 4 Remarks

Why Favicons Are Useful

Use favicons as bookmarks to save space.

December 4th, 2005 | Remark

Firefox 1.5 Fixtensions

Let me first summarize the problems I was having. Upon upgrade completion, Firefox alerted an error (though I do not remember what it was), but then seemed to function fine. It did try to update all the extensions and remove those that were incompatible, but plugins that claimed to be compatible with 1.5 were not working. Right-clicking an extension and hitting the “Options” menu froze the Extension Manager window. I tried to uninstall an extension to reinstall it, and it said “This item will be uninstalled when you restart Firefox.” I restarted Firefox, but it did not uninstall the extension. I uninstalled Firefox, restarted the computer, and then reinstalled Firefox, but the extension’s message did not change.

Now, considering all I had done, the only thing that could be the problem was that the profile was somehow corrupt. It turns out that was the case, but fortunately, the problem in the profile was isolated to a very specific segment, which saved me all of my bookmarks, form information, cookies, etc. If I’ve described your problem, or something very similar, the following steps may be most effective for your recovery. Be warned, though, that this method requires you delete and reinstall all of your extensions (and possibly your themes). If you lose anything or your computer crashes, it’s not my fault. You may wish to read over the steps before taking them.

  1. Make sure you have Firefox 1.5 installed. Make sure it’s completely closed (all windows, including things like the Download or Extensions Managers).
  2. Create a new folder somewhere easily accessible, preferably on your desktop. Don’t worry, you can delete the folder once we’re done.
  3. Navigate to your profile directory in a new window.
  4. In your profile directory, find the following files. Highlight them, right-click and hit “Cut.” (Alternatively, you can drag and drop the files into the folder on your desktop.)
    • defaults.ini
    • components.ini
    • extensions.rdf
    • extensions.cache
    • extensions.ini
  5. Navigate to the folder you created on your desktop and hit “Paste.” The files from your profile directory will be removed and placed in the folder on your desktop.
  6. In your profile directory, go to the folder named “extensions.” Right-click and hit “Select All” (or just hit Ctrl+A) to highlight all files. Right-click and hit “Cut” again (or just use Ctrl+X).
  7. Go back to the desktop folder. Create another folder inside the desktop one called “extensions” and hit “Paste” (Ctrl+V) inside the new “extensions” folder.
  8. Open Firefox again. All the files you cut out of the profile directory, excluding the extensions, should be regenerated by Firefox. If you open your Extensions Manager, you should only see the Talkback extension which comes with Firefox 1.5. If you see other extensions, go back and make sure you didn’t miss a step.
  9. Go to the folder on your desktop and into the “extensions” subdirectory. Most, if not all, of the folders should have awkward names, such as “{A04838-c918a0 … }” In each of those folders there should be a “chrome” directory. Typically, you can find out what extension it is by the name of the file in that folder. If you can’t, go back up a folder and open the file “install.rdf” (or “install.js” if there is no RDF file) in your favorite text editor. The name of the extension can be found in there (if you’re unfamiliar with most of what’s in the file, you can be sure that the only thing you recognize is the name of the extension – also it’s easier to tell the name of the extension in the RDF file because RDF is an XML format that is easier to read than JavaScript). Note that themes are located here, too, so if you run across a theme you may want to look for new versions of that, or simply delete them if they are incompatible with Fx 1.5. The only way to get your extensions back now is to search Google for the name of the extension and reinstall it. Once you’re done, you may have to restart Firefox a couple of times before all the extensions are enabled, and once you’re sure everything’s working properly, you may delete that folder from your desktop.

I admit it may seem like it would take forever, but the time it takes to search for and install each extension over again isn’t that bad. I have a great number of extensions and found that it only took a few minutes, possibly 20 to 30, to reinstall all the ones I had previously. Also, I’ve found that a number of extensions, such as URI ID and miniT, are obsolete in favor of native inclusion in Fx 1.5. This is also a great way to redisover or find new extensions.

With that, ladies and gentlemen, I am soon going to explore the wonderful new things Fx 1.5 has implemented, such as the canvas element and SVG!

Oh, and look! They fixed that weird bug where you have to focus on a textarea or div with scrollbars in order to scroll with the mousewheel.

December 2nd, 2005 | Remark

All Decked Out

Mike, of Green-Beast fame, posted a Deck Your Blog! meme kind of thing, and I decided to participate. The changes to this blog are minimal, but I may consider keeping them, as I really like what I’ve changed (those orange navigation links were just starting to look horrible… more so than they were to begin with).

Here are some specific people I’d like to see make a Christmas-theme for their blogs, but anyone can (and hopefully will!) participate.

  • Dave Brent (sorry, Dave, I know you’re busy, but please?)
  • The Name’s Dan (because I know he has some interesting design skills and I want him to design something on his own, instead of borrowing everyone else’s themes).
  • And anyone else on my blogroll…or even those that aren’t!

December 1st, 2005 | Remark