BLOG: Mitch Wilson, Austin TX Web & Multimedia Developer – Austin, TX

30Dec/100

WRX in parking garage

Today I parked next to a 2011 Subaru WRX in the parking garage. It was white and looked great. Much better than in the pics on the Subaru site. The nose was not as long.

Filed under: Geek Out No Comments
21Oct/100

git help: checkout new clean project copy

I love git. But throwing away changes you've already committed locally can be a real pain. A git guru buddy of mine ("Thanks, Mike!") provided a command line incantation worthy of sharing, since this is such a common problem frustrating git lovers around the world.

WARNING: this procedure deletes all files in the branch (project), even files not checked in. So you must first move all unchecked files to another directory.

From the command line (my example is on a mac) in your git repo root directory:

  1. Run git status. The output will list any "Untracked files" .
  2. Move all "Untracked files" you want to keep to another directory for safe keeping.
  3. Run git status again for review before running the following destructive procedure.
  4. Run these commands.
    git checkout -f
    git clean -f -d
    git reset HEAD^^^ --hard
    git checkout -f
    git clean -f -d
    git pull
Filed under: Geek Out No Comments
20Oct/100

Wow I have a youtube channel

You probably do too. I mean, I did and didn't even think about it until now. What great tech times we live in. I have a whole videos site just by marking favorite videos.

Check it out, if you dare.

Filed under: Geek Out No Comments
27Sep/100

Validate your damn code, please

Sorry, I have to rant. I'm working at 4am and marveling at the code mess big-ball-of-mud thing before me.

Designers, developers, our bosses and loved ones like to complain about browser inconsistencies. Often my four-year old says, "Daddy, why doesn't my CSS work in IE8?" This is kitchen-table discussion-material across America along with religion and taxes. You have your zealots, like me, and then you have the "Hey I just need to get this code finished, ok, I'm going to hack this page with whatever I google." Face it; we've all done it. Now we need to stop. Or stop bitching. My four-year old can get away with it. He won't learn how to validate until he's five. What's your excuse?

Here's mine. Validate the home page of this blog. I just did. 20 errors and 20 warnings. Unfortunately when you try it might not work, because my blog redirects. Oh the happiness and hypocrisy. Yes. But it's not me. It's them. Those people who give me WordPress widgets, for free -- thank you! So my blog is an exception. Everybody has them.

Everyone also has projects that should not be exceptions. Like work projects. Like projects you charge people for and then depend on. And the people, teammates, co-workers, friends, and loved ones who work on the code after you depend on things like Web standards and valid well-designed code.

You of course are the first beneficiary. If you're asking, "Why doesn't this work in IE!?!" Ask yourself, "Is my code valid? Do I use a doctype?" If either answer is "No" or "What?" then you have a problem. It's time for an intervention. Help me help you. Listen. Commit. Validate your code.

Or stop bitching about browser incompatilibites and just say, "I"m a tool and part of the problem."

How can you even expect different browsers to render your page the exact same way ... if your code is invalid? So you get a pass but browser makers don't?

I don't think so.

Filed under: Geek Out No Comments
3Apr/100

What does "1" + 2 + 3 equal?

We're talking JavaScript here. Kind of a trick question. Given operator precedence, I thought that the addition would have been performed first. For example, if multiplication were involved, it would be done before string concatenation, even if at the end of the statement (see Example C). What does "1" + 2 + 3 equal? You might guess 15, but that would be incorrect. The answer is the string "123." Let's test it and learn about operator precedence involving JavaScript strings.

Example A

<script>
var a = '1' + 2 + 3; // equals "123"
document.write(a);
</script>

The code simply runs left to right. And "1" + 2 comes before 2 + 3. What matters is, reading left to right, the datatype mix of the pair of values associated by the + operator. The first pair is "1" + 2, so that is evaluated first. The result of "1" + 2 will then be added to 3.

So here is what happens.

  1. "1" + 2 runs first and equals "12" because the operand "1" is a string, JavaScript performs datatype conversion on the 2 to convert it to a string "2" and then the + operator does concatenation to produce "12."
  2. Now, in memory while the program is running, we have "12" + 3 to process next. Again, because one of the operands is a string, JavaScript converts the number 3 to a string and performs concatenation on "12" + "3" to produce the final result "123"

Example B

Another example. Addition occurs among pairs from left to right, eg, 1 + 1 being the first pair, until a string is encountered.

<script>
var b = 1 + 1 + '2' + 3; // equals "223"
document.write(b);
</script>

When a string is encountered, the JavaScript interpreter performs concatenation and converts any non-string arguments to a string. The result is 1 + 1 = 2, then 2 + '2' involves a string, so the number 2 is converted into the string '2' and we have '2' + '2' = '22'. Then the final '22' + 3 results in '22' + '3' = '223' and we're done.

Example C

The final example shows how crazy this can be. When concerning addition vs. concatenation, we move from left to right. When other operations are involved, we might start at the end then move left to right.

<script>
var c = 1 + 1 + '0' + 2 * 5; // equals "2010"
document.write(c);
</script>

Example C shows that the last pair, 2 * 5, because it involves multiplication, is evaluated first, after which we have 1 + 1 + '0' + 10. Then 2 + '0' + 10. Then '20' + 10 that finally equals '2010' and we're done.

8Jan/100

Cold Song – Sting

What power
art thou
who from
below
hast made
me rise
unwillingly and slow
from beds of
everlasting
snow?

See'st thou not
how stiff
how stiff
and wondrous old
Far, far
unfit
to bear
the bitter
cold?

I can scarcely
move
or draw
my breath
Can scarcely
move
or draw
cold my breath
Let me, let me, let me freeze
again.
Let me, let me freeze
again to death.
Let me, let me, let me freeze
again
to death.

Filed under: Geek Out No Comments
1Jan/103

maxChar jQuery Plugin: New Release 0.3

Happy New Year!

I can't believe I'm saying this ... due to popular demand ... I have updated maxChar, my configurable jQuery plugin that adds a character counter to Web forms.

Example character counter

New and Improved

New features added in 0.3.0 are:

  • Feature change: Displays negative characters when past limit rather than truncating characters in form input.
  • New option: truncate - If true, on form submit truncates submitted value down specified by limit. Does not change (respects) user text in form field. Default is true.
  • Bug fixes: Fixed serveral issues related to removing over-the-limit characters in the form field.
  • Overview, Instructions and Examples

    See the main page, maxChar jQuery Plugin.

    Download maxChar 0.3.0

    Download from the jQuery plugins repo maxChar release page.

    Bug Fixes

    For information about the bugs fixed, see the maxChar bugs page.

    Filed under: Geek Out 3 Comments
    31Dec/090

    Working on next version of maxChar

    The new version of maxChar will be coming out soon. I've received a lot of great comments and it's getting mentioned on other sites as well now. This has inspired me to set aside some time for the next version. Here are some of the sites I found that mention my plugin.

    Filed under: Geek Out No Comments
    31Oct/090

    Boromir, who art thou?

    Oh the things we argue about. Here's an interesting one. Wouldn't movies and books be better if more main characters died? Wouldn't stories be less predictable, thus more engaging? Enter Boromir, Captain-General of Gondor, the heir to the Steward of Gondor, Denethor II. Is the death of Boromir an example of a main character dying? Some say yes, some say no.

    We had this discussion at work the other day, and there was disagreement among the men. The two sides bascially split based on the character of Boromir in the book vs. in the movie. Is the character of Boromir played down in the movie vs. the book? Certainly. Peter Jackson has to cut huge parts of the books out of the movies. I read the books a long time ago, in the fourth grade, so I am not the best authority here. I do recall Boromir having, obviously, a lot more scenes in the books than in the movies. One could argue he was a main character in the book but not in the movies. So, his death could be an example of a main character dying in a book, but not an example of a main character dying in a movie.

    I argue that, in the movies, Boromir was not a main character. Even in the books, I think of Boromir as a supporting character. He represented Man's corruptibility and although his character was important in that role, it was a supporting role, not a main role. Hey, just because he was in the Fellowship does not mean he was a main character. That's like saying the extra in Star Trek was a main character because he was in the away team. Nope, he was there to die because none of the main characters could die. And that's the issue here. Same with Boromir. He served his purpose in the books and once his supporting role was over, he died. Period.

    As another example, take the character of Wash from Firefly. He was definitely a main character and he died right at the end. You have seen Firefly, right? If not, you should. At the end of The Return of the King, Bilbo and Frodo die metaphorically, in my opinion, by setting sail with the Elves. But that's not the same thing.

    So, was Boromir a main character? What say you?

    Filed under: Geek Out No Comments
    27Sep/090

    Quest for new wireless router

    My quest has begun. After years of battle with my router and with Time Warner Austin, I set out again to the front. Time to buy a new router. Unfortunately, I am keeping Time Warner (bastards have a monopoly on my area, but some day ... Your time is coming Time Warner).

    Anyway, back to the router issue at hand. I currently have a Linksys BEFW11S4. Over the past couple of years since I ... Speak of the devil. I am not kidding. I just lost my connection and had to power cycle the router. Again. Also power cycled the cable modem.

    Router features

    So, what do I need in a router? I need something that works with what I have now, a mix of wireless G and N devices. I need a router fully loaded for sharing files at home, connecting via vpn to the office, open for gaming and even for an occasional Website that I am hosting at home, etc. and that I can easily administer via a Web interface. Of course I want the best range and the best security available to consumer-level routers. Do I expect too much? We'll see.

    Required features

    • Web interface
    • VPN
    • At least 1 ethernet connection (for Canon MP970 printer)
    • At least 1 USB 2.0 connection (for Iomega LDHD250-U external hard drive)
    • 1 up connection
    • Dual band signals - One signal for surfing and another for streaming
    • QoS - Quality of Service is actually a tech term for exactly what it sounds like, a good uninterrupted signal. You can prioritize certain types of traffic, for example, video streaming over Web surfing.

    Bonus features

    • Integrated cable modem - I've seen this but not sure if it works or not with Time Warner (Grrrr, Time Warner)
    • Dual SSID - Allows two wireless networks, one public and one private.

    Router reviews

    Here are the products I looked at worthy of comment.

    • AirPort Extreme Base Station
    • Motorola SURFboard SBG900 DOCSIS 2.0 Wireless Cable ModemGateway (Black)
    • ZyXEL NBG334W 802.11g Dual-SSID
    • ZyXEL X550N
    • Netgear Rangemax WNDR3700 Dual Band Wireless-N Gigabit Router
    • D-Link DIR-655 Extreme N Wireless Router

    As I review each router, I will not discuss every feature. That would take too long. I will discuss the features most relevant in the course of a normal discussion. If a particular required feature is missing, I will stop there in the discussion and call "deal breaker" and move onto the next router review.

    AirPort Extreme Base Station

    Many people remark on the stability of the AirPort Extreme Base Station from Apple. Plus, it supports having two wireless networks instead of just one like most routers. With two networks, you can have one public network and one private network. Routers that support only one network force you to choose whether to make your network ssid public or private. With dual ssids you can have both. This allows you to setup a guest network for visiting family and friends and have your personal devices/computers on the private network, to prevent guests or neighbors from having access to your shared files, etc. even when they are on your home network. Users on the public network cannot access computers on the private network. But they still have internet access. Cool.

    Unfortunately, the AirPort has no admin Web interface. Puzzling. That's a deal breaker. I need to be able to login to the router, forward ports, etc.

    Motorola SURFboard SBG900 DOCSIS 2.0 Wireless Cable ModemGateway (Black)

    As I am displeased with Time Warner cable, replacing their cable modem with one built into the router intrigued my interest. Would it work better? I'll never know. The Motorola router has no WAN uplink and does not support MAC address spoofing. Maybe I would not need either feature but not having them makes me nervous. Maybe with the built-in cable modem I woudn't need MAC address spoofing? Not sure, just nervous. Deal breaker.

    D-Link DIR-655 Extreme N Wireless Router

    I almost bought this router. Again, some great customer reviews on amazon, but no dual SSID and some other D-Link products sound shoddy with negative custom reviews. While reviews of this particular router were mostly great, it got a bit nervous. Deal breaker.

    ZyXEL NBG334W 802.11g Dual-SSID

    The ZyXEL router sounds like a great router and the one I would have bought if I were not interested in N technology. I'll just say it rocks in every other way, and ZyXEL, based on customer reviews at amazon and elsewhere sounds like a great company. But no N support is a deal breaker.

    ZyXEL X550N

    So, then, you ask, "What about the newer ZyXEL that does have N?" Again, looks like a terrific router but, unfortunately, the new one drops support for dual ssid. Not necessarily a deal breaker, until I found a router that has everything, the Netgear Rangemax WNDR3700.

    Netgear Rangemax WNDR3700 Dual Band Wireless-N Gigabit Router

    And we finally come to the winner. This router literally has all my requirements and extras. And I found it last, when I about to bite the bullet and buy the D-Link router. Great customer reviews, all the features I could want, and a nice price. I bought it on amazon, then noticed it wasn't in stock. My mistake. I found it in stock on buy.com at $20 more, but I ordered it anyway. I need it now and the price was still decent and well under other seller's prices.

    Read about The Netgear Rangemax 3700 on Amazon

    Filed under: Geek Out No Comments