Archive for December, 2005

VFH

I was doing some CSS work yesterday. I ended up stumbling onto a hack that I was a little unsure of what it meant. This morning I decided to figure it out.


some#id {
    color: blue;
    voice-family: "\"}\"";
    voice-family: inherit;
    color: yellow;
}

To be honest I hadn’t run into the ‘voice-family’ attribute before so I was curious, I was also curious why someone used the value ‘}’. After a few minutes of research it was very evident was what happening. Older browsers will read that effectively as :


some#id {
    color: blue;
}

While newer browsers will actually get to the bottom color of yellow. Basically the CSS author is short circuiting the parsing engine of the older browser. The voice-family attribute is similar to the font-family attribute, but it’s for text to speech browsers. How does this help you? It doesn’t really, though it’s something to keep in mind if you have to support older browsers and you want to override some portion of your CSS that ganks in an older browser.

Enlightenment

I used to use enlightenment, and to be truthful it is a nice WM, however xfce4 is just so much faster it’s not even funny. I am pretty hooked on it.

perl

I learned about programming by using perl. I went to the local perl mongers meetings and bought books on it. I have always liked perl. I have spent many months away from it though. Since I got into the IT field, I have had to work with other languages, and haven’t had a lot of time for using perl.

Lately however I have had to automate a bunch of things and perl makes that so easy. It really is a vital tool.

I have done a lot of scripting to automate database creation and inserting data. As well as just yesterday I fixed permission problems on a solaris box with perl (which was great because it was like 500 users).

Tonite I was playing with Squid, and I wanted a quick way to view access logs. I wrote a super simple CGI app so I could view the log online. I could have done it in any web enabled language, but perl seemed right. I love to use perl to open files and then itterate over each line, perl was build for that.


#!/usr/bin/perl
 
use strict;
use warnings;
use CGI;
 
my $q = new CGI;
print $q->header();
 
parseDir();
 
sub parseDir() {
    open(ACCESS, "/home/bignate/squid/logs/access.log");
    my @accessLogs = <access>;
 
    foreach my $logEntry( @accessLogs ) {
        print "<table>\n";
        print "<tr>\n";
        print "<font size=\"-1\">$logEntry</font>\n";
        print "</tr>\n";
        print "</table>\n";
    }
}
 
</access>

Granted, cheesey, but cool

little things

I like to do a couple of things to make a web app a little more usable. The first is to put some thought into the tabindex attribute. I am a tabber when it comes to navigating a form and I love it when the author took the time to make sure I can tab through the fields in a logical sequence. I really hate it when I think I am going to tab to the submit button but instead tab to the “Forgot Password” link…I also have an itchy enter pinky and I usually end up hitting tab->enter too fast to realize the tab took me to the link.

example:

<input type="text" name="firstField" tabindex="1"/>
<input type="text" name="secondField" tabindex="2"/>
 
<input type="submit" value="Submit" tabindex="3" />
<a href="forgotPasswd.html" tabindex="4">Forgot your password?</a>

The second thing I like to do is to put a little JavaScript in there to bring focus to the first field.

example:

function placeCursor() {
   if ( document.NameOfForm ) {
    document.NameOfForm.firstField.focus();
     }
}

I usually put it in the if block so I can just throw it in the JS lib that I import on every page. You can do that without the if block, but then you’ll see an error in the JS Console on other pages (I don’t like that).

Anyhow, I realize these are mundane things and you may already do them. If so skip this post :)

Rhap

I woke up this morning with a song in my head, seemingly out of nowhere. It was Queen’s Bohemian Rhapsody. In the song there is a line: “Put a gun against his head, pulled my trigger, now he’s dead”.

This got me thinking. Why do rap songs with similar lyrics draw so much ire. Then it hit me. Later in the song they say: “Skalamoosh”. No one is afraid of a band that says skalamoosh.

My advice to rappers…More skalamoosh.

« Previous Page