Travis's lame ol' blog

yay, Travis finally changed his blog!

- Monday, August 31, 2009

Adding An Easy Shortcut to the JSLint javascript validator to Visual Studio

Update: 2011-05-13: JSLint WSH no longer available, see JSHint WSH.


Ever wish that Visual Studio had a JSLint add-in? Inspired by a reply to my tweet, I discovered the following solution.

  1. Grab the WSH version of JSLint.

  2. Add this jslint.bat file to the same folder you have JSLint in:

    @echo off
    cscript jslint.js //Nologo < %1
    echo.
    echo Done.
  3. In Visual Studio → Tools → External Tools…

  4. Add a new tool with the following field values:

    Title:
    &JSLint
    Command:
    %YourJSLintPath%\jslint.bat
    Arguments:
    $(ItemPath)
    Initial directory:
    %YourJSLintPath%\
    Use Output window
    checked

    VS: External Tools

  5. Open up any *.js file you'd like to validate

  6. Select the all new JSLint from your tools menu:

    VS: Tools Menu

  7. Try not to let JSLint hurt your feelings too much:

    VS: Output From JSLint

In short, JSLint is awesome.

- Monday, June 08, 2009

Welcome to the new TraviBlog

Hello and welcome to the newly re-skinned TraviBlog. This site is running on a version of dasBlog. I forget which version I originally downloaded, but I've heavily modified the source to be standards-compliant, accessible, removed as many images as possible and also added this ugly theme. Really though, who cares about the theme since most people read blogs in an RSS reader right?

If you want the source feel free to post a comment and let me know and I can generate a huge diff file showing the changes that I've made to the original source.

- Monday, February 16, 2009

Brilliant CSS for the KBD element

Stack Overflow recently implemented some brilliant CSS for <kbd> tags:

kbd
{
	padding: 5px 3px;
	white-space: nowrap;
	color: #000;
	background-color: #EEE;
	border-top: solid 2px #CCC;
	border-right: solid 4px #AAA;
	border-bottom: solid 5px #888;
	border-left: solid 3px #BBB;
}

There's something inherently beautiful about CSS used to style HTML to look like the physical object it represents.

Example: CTRL+C

- Monday, September 22, 2008

Conversations around the Campfire: an Obama/McCain CSS comparison

This conversation originated at work when we started comparing the CSS used by McCain and Obama (thanks for the link Sam!)...

Ralph W.
http://js.johnmccain.com/App_Themes/McCain08/newstyles.css
Travis H.
haha
compare with: http://www.barackobama.com/css/globalv3.css
even by the file names alone you can tell that obama's is a more scalable solution
Ralph W.
It's even localized
/* Espanol Navigation 2.0
-------------------------------------------------------------- */
Travis H.
i like how the absolute last section of mccain's is for the header
Ernie B.
that is so fitting
Ralph W.
cause you can only get head in the white house by going down
Travis H.
TEXT-TRANSFORM: uppercase;
Ernie B.
hahaha
Ralph W.
that's great
Travis H.
it looks like his css was developed by the department of redundancy department since the font-family is defined in almost every selector
Ralph W.
more of the same
Travis H.
haha, good one
Ernie B.
may as well be tables
Travis H.
INPUT.groovybutton {
not that there's anything wrong with that
i love this class name:
DIV.actioncenterbluebutton_red A {
interesting, Obama's uses EM sizing while McCain's uses PX
Ralph W.
not that there's anything wrong with that
Ernie B.
also fitting
Travis H.
I swear it's as if their CSS files directly correspond with their campaigns
Obama knows the IE6 hack:
* html #nav li * { position: relative; }
interesting, they also use CSS sprites
those trendy fuckers
wow and their spanish classnames are actually spanish!
#nav-donacion {
Ralph W.
McCain blocks those classes at the firewall...see what I did there?

This conversation has been reproduced without anyone's permission

- Friday, September 19, 2008

Conversations around the Campfire: an Apple/Palin comparison

This conversation originated at work when Ralph and I started flaming our resident MacTard developer, Ernie.

Travis H.
*grabs some gasoline*
Travis H.
Mac's are the Sarah Palin of the computing world
Ernie B.
in what respect, charlie?
Ralph W.
not true...Mac's do not have Tina Fey glasses
Travis H.
"we're enterprise ready, we sold an ipod in Russia"
Travis H.
also, i heard that the iphone 3g is retarded
Travis H.
and that the nano is pregnant
Ralph W.
3g has down syndrome ... get it right
Travis H.
you can put EFI in a PC, but it's still a pig
Ralph W.
What's the difference between Ernie on a PC and Ernie on a Mac?
Ralph W.
Lipstick

I have to pick on Ern while I can, I think pretty soon I might be the only developer in the company on a non-Mac PC.

This conversation has been reproduced without anyone's permission

- Wednesday, July 16, 2008

Replacing Notepad with Notepad 2 on XP SP3, the easiest way possible

After installing SP3 on XP I noticed that Notepad was reverted back to its crappy self, so I decided to write a handy batch script to install Notepad2 again. This script will work in XP SP2+. Place the batch file in the same directory as notepad2.exe and run it.

InstallNotepad2XP.bat

@echo off
echo *IMPORTANT*
echo This will kill all open instances of Notepad.
echo To cancel, end this batch file now (ctrl+c), or hit any key to continue.
pause
echo Killing all instances of notepad running...
TASKKILL /F /IM notepad.exe /T
echo Backing up...
call :backup %systemroot%\servicepackfiles\i386
call :backup %systemroot%
call :backup %systemroot%\System32
call :backup %systemroot%\System32\dllcache
echo Installing...
copy notepad2.exe %systemroot%\servicepackfiles\i386\notepad.exe /y
copy notepad2.exe %systemroot%\notepad.exe /y
copy notepad2.exe %systemroot%\System32\notepad.exe /y
copy notepad2.exe %systemroot%\System32\dllcache\notepad.exe /y
echo Done.
pause
goto :end
:backup
call set npath=%1
set count=0
for %%i in (%npath%\notepad.original*.exe) do (
set nname=%%i
set /a count=count+1
)
echo backing up to %npath%\notepad.original%count%.exe
copy %npath%\notepad.exe %npath%\notepad.original%count%.exe /y
:end

So That's What Happened To Doogie Howser, M.D.

It's actually kinda funny.

(if you were looking for more Doogie, Hulu will save the day)

KS

- Wednesday, May 21, 2008

JavaScript is just as easy as Ruby (even without jQuery!)

Ernie sent this ruby snippet and marveled at its brilliant simplicity:

class Date  
  def at_some_point  
    (at_midnight..tomorrow.at_midnight).to_a.rand  
  end 
end 

Date.today.at_some_point # => Tue May 21 10:23:00 -0500 2008 
Date.today.at_some_point # => Tue May 21 02:10:00 -0500 2008 
Date.today.at_some_point # => Tue May 21 18:28:00 -0500 2008 
Date.today.at_some_point # => Tue May 21 07:25:00 -0500 2008

I recalled using Date.prototype in JavaScript in the past to add some helpful date functions, so I thought I'd see if I could write a similar function just as elegantly:

Date.prototype.atSomePoint = function() {
    return new Date(rand(this.atMidnight().valueOf(), this.tomorrow().atMidnight().valueOf()));
};

new Date().atSomePoint();   \\ Wed May 21 2008 06:33:28 GMT-0400 (Eastern Daylight Time)
new Date().atSomePoint();   \\ Wed May 21 2008 12:57:13 GMT-0400 (Eastern Daylight Time)
new Date().atSomePoint();   \\ Wed May 21 2008 08:37:44 GMT-0400 (Eastern Daylight Time)

Unfortunately .atMidnight() and .tomorrow() don't exist in JavaScript's Date object by default (that I know of), so I had to write those helpers as well as a random number helper, rand():

Date.prototype.atMidnight = function() {
    this.setHours(0);
    this.setMinutes(0);
    this.setSeconds(0);
    return this;
};

Date.prototype.tomorrow = function() {
    this.setDate(this.getDate() + 1);
    return this;
};

function rand(lowerBound, upperBound) {
    return Math.floor((upperBound - (lowerBound - 1)) * Math.random()) + lowerBound;
}

While I probably would never find a use for .atSomePoint(), it certainly was easy enough to write.

- Monday, May 19, 2008

Top 3 Vista Features that FAIL

over 40 seconds to extract a 2.33MB zip file

I installed Vista Ultimate x64 recently and there are three things that I've disabled (so far).

UAC
This one was disabled before I even slipstreamed the DVD. I didn't even have to use it to know that not only would it annoy the hell out of me, but I don't really need it since I've never had any problems in XP/2000.
120dpi
The larger, crisper fonts were nice when they worked. Most software outside of the OS itself didn't support it though. Even MS's own software (like WorldWide Telescope) is inconsistent. I guess that's why this isn't enabled by default.
Window Translucency
This just seems useless IMO. It's cool that it's possible to do, but I don't think it's the best use of my GPU time.

Anyone else have any pet peeves or stuff they've turned off in their default Vista install?

(The screenshot shows the raw speed at which Vista is capable of unzipping files on my hard drive.)

- Saturday, March 29, 2008

PRK

Travis gets eyes lasered I had PRK surgery on 3/18/2008 and I thought I'd post how it went for others who're thinking about getting it. PRK is the exact same price as LASIK, uses the exact same excimer laser, but has a significantly longer heal time and is more painful. People who have poor near-sightedness, large pupils, and/or thin corneas are generally not the best candidates for LASIK, and that is where PRK comes in.

Short version: if you're as fed up with glasses/contacts as I was, you're patient and you're not a candidate for LASIK, get it. And the long version...

The Procedure (from my point of view)

I scheduled my appointment for 8am and I was up until about 3am the night before because I was so nervous. It worked out in my favor though since I was able to sleep so easily the rest of the day. We arrived at StrongVision at about 8:10am. They gave me some numbing drops for my eyes and I could feel tremendous anxiety, my extremities felt cold and clammy and I could feel the blood draining from my face. I fainted during one of the tests at my first pre-op visit, and I really didn't want that to happen during the procedure. Then they gave me a Valium to relax, and I felt much better in about 5 minutes. They took me into the laser room and gave a brief explanation of what was going to happen. Then they cleaned my eyelash area with an iodine solution, no big deal. The numbing drops work really well, it almost feels like you're blinking over empty eye sockets.

My instructions were to basically to stare at a red blinking light. With the Valium, numbing drops, and everything being blurry anyways, it was really easy to do this. They popped the little eye propper-opener into my eye in about 1 second, it is actually more comfortable than it sounds. Then they slide my head under the big machine.

From here on everything was blurry, but here's what happened from my point of view. There's a green light and another red light, ah there's the blinking red one. A ring-shaped object is placed on my eye, I feel a slight pressure as if I was resting my finger on my closed eyelid. Then a second ring is plopped on there with about the same pressure, this one is filled up with liquid, and held in place for 30 seconds. I see a white blur then the liquid is rinsed off. The stuff they rinse your eye with is ice cold, and that is the most uncomfortable part of the whole procedure. Some goop-like substance is then wiped off my eye. Another rinsing with the cold water. The light is turned off momentarily then my eye is given one more wipe before the cool part. The light is turned down again, then *BZZZ*crack*crack*crack* the laser fires up. There is a faint smell of a curling iron, but not as bad as I had expected since other people told me that was the worst part. With every *buzz* of the laser, the shape of the blinking red dot changes shape. After the laser finishes something blocks my vision for a second or two, then something white is placed on my eye, making it difficult to watch the blinking red dot. Then a translucent white disc is placed on my eye for a bit. Another swab then more squirts of that icy water, damn it's cold. A "bandage" contact is placed over my eye and a few drops placed in it. The eye-propper-opener is gently removed from my eye and I blink. My eye is closed then given a good wipe down.

At this point I can sit up and they switch the eye patch to cover my right eye and prepare my left one. They ask me to read the clock on the wall, I only see a blurry white disc. The laser runs through a few tests in the mean time, then they repeat the same procedure on my left eye. When it is finished I can easily read the clock on the wall. It is miraculous. I think I could only say "wow."

What Really Went On

They gave me a DVD of the procedure which I've uploaded to both Vimeo (higher quality) and Youtube. Watching the procedure is somewhat difficult if you're squeamish. I am still amazed at how little I felt. It's funny watching it because it looks like the most soothing part is the water squirted on my eye, and to me it was the most uncomfortable.

So here's the play-by-play of what really went on. The first metal ring scores a circle on my eye. The second ring is placed onto the score and filled with an alcohol solution that dissolves the epithelium layer of the eye. After its drained and rinsed, the epithelium is wiped off. The laser works in the UV spectrum and breaks down the carbon bonds in the cornea's cells, reshaping it. The white blur they rest on my eye is what they called the popsicle, some sort of frozen artificial tears. The white disc is Mitomycin-C, it changes the cell's mitochondria so that your eye doesn't heal too quickly, making your eye blurry. The bandage contact just reduces the chance for infection and makes it much less painful to blink. It gets removed 5 days later.

Each eye takes less than 8 minutes, and the entire procedure is less than 20 minutes. We were on the road heading home in less than an hour.

Healing

This is really the most frustrating part. The pain is very tolerable with medication, but having blurry vision is frustrating. Especially if you're like me and usually spend about 16 hours a day staring at a glowing screen. You're not supposed to read for extended periods of time either, so plan on being bored, listening to music, and sleeping a lot. The pain meds will definitely help you sleep.

The worst day pain-wise for me was the third day. Every time I opened my eye, the light felt like a hair stuck under a contact. I just kept my eyes closed as much as possible and slept most of the day. The day after was basically pain free, but was the blurriest. At day 6 I had the bandage contact removed and my vision was still a bit blurry. I couldn't even read the top line. At this point I was thinking: WTF have I done. But each day since my vision has improved noticeably.

While some people can see 20/20 after the first 5 days with PRK, it wasn't that way for me. This is really where LASIK is so much better, since you see clear right off the bat. As of 3/31, my vision was already 20/25. It will continue to get better hopefully to at least 20/20 over time (many people's vision is corrected better). The more that you blink, the more your cornea smooths out all of the imperfections from the healing process.

I'm now 2 weeks out, and the only real problems I have is a nagging head ache, the occasional blurriness when I blink, slightly dry eyes, and relatively poor night vision. The Dr. said today that all of those will get better with time so I'm not too worried. and I have another appointment 3 weeks out, and I'll be sure to post any major updates if I have any.

Update 4/22/08: Eyes were 20/20 today. I have nearly zero discomfort, aside from my seasonal allergies. I rarely use the drops any more, I wish I hadn't bought so many. Night vision is clear enough to drive and will improve over time.

local | tech