So here I am with a great new job and for once I’m becoming satisfied with where I am and what I’m doing.  I’ve more or less been thrown into the flames when it comes to working in a Unix environment.  As someone who has been doing Web development for a few years as both a hobby and a career, I’m surprised it has taken this long.  I thought I’d take a minute to write about my experiences as a hardcore PC user who is quickly changing sides.

First of all, I have to say that my job is only the catalyst for the changeover.  I’ve since started developing my own site on a Ubuntu machine and love the one-on-one computer interaction over SSH.  While it is possible to transfer files via SSH on a Windows machine,  you will need programs like Putty and WinSCP to play nice with Unix.  As most Web servers are currently running on some sort of Linux OS, I was really missing out on a lot of capabilities and a general understanding of what was happening on those servers I pay for every month.   By running Windows and working purely with FTP clients, I was working with a fraction of the power I now have over SSH.

The other big pull for me was the freedom that is associated with Linux.  Linux and many of the programs available to the OS are free of charge, regardless of whether or not the machine is used for business.  Since these projects are open source, there is constant development and progress and the programs are often more intuitive and ground-breaking.  I also appreciate knowing what is going on under the hood.  I do not have a computer science degree, but as someone who was raised on a Windows machine, I appreciate being able to get my hands dirty if I need to.  Like I said, its all about the freedom.

If it were up to me, I would completely switch over to Linux and I don’t think I would look back.  My primary trade as a designer limits me on OS choice, and I still can’t give up PC games.  You’re probably thinking that I need to get a Mac.  Apple computers have a Unix OS and support all the design software in the world.  And you’d be right.  I’m coming around slowly.

I will probably have a Windows machine for the forseeable future.  I will miss gaming too much (even though that is becoming less of a pull as time flies out the window) and I will need a testing platform for various Web sites and applications.  Honestly though?  Thats about all I need it for.  I suspect I’ll be purely Unix in a few years.

I’ve posted about using JavaScript to detect specific browsers, but that script seems to have its limitations.  I’ve become infinitely more comfortable with PHP in recent years and find that the following is an acceptable option for detecting a browser.  Better yet, you can write code that will change depending on your visitor’s browser.  In this case, I use it to switch CSS files.  Here is the code:

<? // check for UA, convert UA string to lower case
$navigator_user_agent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? strtolower( $_SERVER['HTTP_USER_AGENT'] ) : '';

// Check browser and select CSS file
if (stristr($navigator_user_agent, "msie 6"))
{
echo '<link href="css/alternate.css" rel="stylesheet" type="text/css" />';
}

else{
echo "<link href='css/style.css' rel='stylesheet' type='text/css' />";
}
?>

If all went well you should now have a script that selects an alternate CSS file for your IE6 visitors. You can use else-if statements if you would like to add more contingencies. Another upside to this is if you’re using non-valid CSS (like *html for IE) you can shuffle it all away in another file that the W3C validator will never see. Devious!

Make sure you find your user agent string! Some of these are similar and will contain the names of other browsers, so be specific when you use a keyword to search the UA string.

I’ve always had problems with folders that start with ‘The,’ as it places the folder under ‘t’ when arranged in alphabetical order.  I’m really big into using file directories for my media, and as the computers at my work use scripts for all kinds of redundant operations, I it would be a good challenge to make one of my own.  This is pretty simple; I’ll get more in-depth with scripting as I go.

Create a new text file, copy the code into the file, and rename it to .vbs  Don’t forget to change the directories and string fields to suit your needs.  I’m not too big on VB, so I modified another script to get me started, but the search and replace functions are specific to our job (rearranging ‘the’ in the folder name).

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.GetFolder("z:\Movies")
RenameSubFolders(oFolder)
set oFolder = Nothing
set oFSO = Nothing


Function RenameSubFolders(myFolder)

For each oSubFolder in myFolder.SubFolders
dim pos
pos=InStr(oSubFolder.Name,"The ")
If pos = 1 Then
oSubFolder.Name = Mid(oSubFolder.Name, 5) + ", The"
RenameSubFolders(oSubFolder)
End If
Next

End Function

This script searches for a string in a folder name and places it at the end of the said folder name.  So, for instance, I have a ton of folders named “The (MovieName)”  This script renames them to “(MovieName), The”.  Like I said, I’m old school and use file directories for everything (no I-Tunes, thank you) so alphabetical order is very important.  Rather than taking the hours to rename a bunch of folders, I took an hour to toy around with some Visual Basic.  Totally worth it.

So in the end, I really don’t understand why people don’t use scripts more often, especially for the growing media libraries that most people have on their computers.  I guess it all comes down to I-Tunes and similar applications.

I’m finally a full-time designer, thus the lack of posts over a long period of time. The most valuable lesson I’ve learned thus far is working with Adobe software for deadlines. Having 30+ deadlines a day is a pretty common phenomenon, and honestly, I struggled the first two weeks to make this speed.

I’ve found some shortcut references for my most-used Adobe programs. If you are planning on becoming a designer, or just want to improve your speed, shortcuts are key (pun intended).

Illustrator
KeyXL (web)

InDesign
Adobe Forums (PDF)

Photoshop
Trevor Morris Photography (PDF)

Browser Testing

I finally got Linux running in Windows so I can test on Konqueror. As I suspected, it worked about the same as Safari, another KHTML browser. Anyway, the easiest way I found to get Linux running in Windows can be found here. It’s just a matter of running KMD on a virtual machine. I originally tried to get it to run using Cygwin, which was a waste of time.

Another issue I ran into a while back was testing with IE6 and below.  Having two versions of Explorer on the same OS is nearly impossible.  Microsoft released a VPC image running IE6 for this reason.  It is available here.

And if you haven’t heard yet, a beta version of Safari 3 is available for download.  You can get it here. 

Modify the Document Type Definition (DTD)

Many of the best AJAX apps activate by using custom triggers that do not qualify as valid HTML. I used to think that all was lost, and that there was a mandatory trade between functionality and usability. This is not so: doctype information may be appended to include your triggers.

For instance, I use a modal window system called LightWindow that has “author” and “caption” triggers to relate data to the script when a user clicks on an image. Neither of these triggers will validate under the XHTML 1.0 DTD. Here’s the code to fix it:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
[

<!ATTLIST a author CDATA #IMPLIED>
<!ATTLIST a caption CDATA #IMPLIED>
]>

This is how it breaks down:

<!ATTLIST element attribute dataType #IMPLIED or #REQUIRED>

Since my elements relate to linked files e.g.(<a href=) that I want to open with LightWindow, I use the element ‘a’ for link. The attribute is what you are using to communicate with your app and is also what is causing your document to not validate. The dataType can likely just be left as CDATA as it handles any kind of data. It is also likely best to leave the type defenition as #IMPLIED or optional for these purposes. A more in-depth article can be found at A List Apart.

Fix invalid symbols by changing them to HTML

If you are using a script in your document that is called using symbols such as the ampersand ‘&’ or equals ‘=’ these will cause the validator to choke. Consider using their HTML forms amp; and #61; (with ampersands in front) respectively. A complete list of symbols and HTML translations is available at the Web Design Group’s site.

For example, a line on my site used to look like this:

<link rel=“stylesheet” type=“text/css” href=“combine.php?type=css&files=dlinn.css,lightWindow.css” />

But now looks like this:

Valid HTML

Still having problems with CSS?

Yeah, me too. We’ll just have to hang in there until the newer standards (that have existed for years) are adopted or hell freezes over.

So it never fails; I get a website up and running perfectly on Firefox and IE only to find that it is broken in Safari. After playing with the CSS for a while I’ve found that there isn’t much I can do. It has to do with some absolute(ly) positioned divisions and the background not stretching to fit. Im probably going to make another CSS file specifically for Safari machines, seeing as how Safari bugs have bit me at the worst times (like in an interview). I’ve been messing with JavaScript all night long and finally found a very easy way to detect Safari here:

http://dithered.chadlindstrom.ca/javascript/browser_detect/index.html

The specific browser type is combined with other browser information in the .userAgent variable, so you have to write some script to search through it. Its easier than it sounds. Here is the code:

var ua = navigator.userAgent.toLowerCase();
if (ua.indexOf('safari/') != -1){
alert("You're using Safari, moron!")
}

Told ya! Substitute ’safari’ for whatever you need to identify.

Edit - This script searches through the user agent string.  Visit this site to find strings for the browser you are trying to identify.