Why Not?

What shall we do today…

Applescripts when the Macbook Wakes Up or Sleeps

I’ve been getting into Applescript development lately and found a nifty program to run some scripts whenever I put my macbook to sleep or wake it up. The program is called SleepWatcher and here are the steps you can take to get it working:

  1. Download and install SleepWatcher

  2. Create two scripts in your home directory (~/) named .sleep and .wakeup.

  3. Copy and paste the following into your .sleep script:
    #!/bin/sh
    osascript ~/Library/Scripts/sleep.scpt
    
  4. Copy and paste the following into your .wake script:
    #!/bin/sh
    osascript ~/Library/Scripts/wake.scpt
    
  5. Run “chmod +x” on .sleep and .wake

  6. Open AppleScript Editor, create a sleep.scpt and wake.scpt and save it to ~/Library/Scripts/

Alternatively, you can download the two scripts I wrote and modify them for your tasks.

My sleep script does the following:

  • Disconnect from my work VPN
  • Turn off Bluetooth

Download Sleep Script

My wake up script automates:

  • Check if there is an internet connection and determine the wireless network
  • If I am on my school’s wireless, turn off my bluetooth and connect to my work VPN
  • If I am on my home network, turn on bluetooth and mount my network drives

Download Wake Up Script


Top 5 moments of 2009

Every week I tune in to watch the Totally Rad Show on Revision3. It is a show the reviews current movies, tv, videogames, comics, and more. A great show that talks about entertainment that fits my tastes. Every year they have an awards show where the three hosts give their top 5 from each category of movies, tv, etc. This year they introduced a new final topic that did not fit under the “entertainment” theme of the show, their top 5 moments of 2009.

Upon seeing this, I figured it would be good to write about my top five moments of 2009:

  1. Working on IBM’s Jazz Foundation and Jazz.net
  2. Organizing the first Hak5 Live event at Virginia Tech
  3. Attending Defcon in Las Vegas
  4. My adventures during Virginia Tech’s Spring 2009 graduation weekend with my friend Tim
  5. Wednesday Nights at The Flying Saucer in Raleigh, NC

Wow, looking back on it all, 2009 was awesome. I wonder how I will top it in 2010?


Time Machine Error: “This backup is too large for the backup volume”

I have been running into this issue lately since I restored my macbook from a Time Machine backup. The error says the following:

“This backup is too large for the backup volume. <space required for backup> is needed, but only <free space on disk> is available.”

This error is the result of a bug in Time Machine where it creates a full backup of your system after you restore your hard drive from a backup.

To fix this, you need to open your backup hard drive, delete the .sparsebundle file located on the drive, and do a new full backup. This will restart Time Machine to delete old backups as needed.

Snow Leopard 10.6.1 Error: This version of Mail (4.0) is not Compatible with Your Version of OSX (10.6.1)

I recently restored my macbook from a Time Machine backup and ran into the following error whenever I tried to start Mail.app:

Error: This version of Mail (4.0, 1075/1076) is not Compatible with Your Version of OSX (10.6.1)

The reason for this is that the data associated with the 10.6.1 update for Mail.app did not get applied when i restored from the backup. To solve this error download and install the following patch from Apple:

http://support.apple.com/kb/DL930


Making Usable Frameworks and SDKs

User experience is one of the most important parts when developing a project. Users should never have to think or fight with your product if you wish for it to succeed. If you look at most of the successful web applications today, the simplicity of the user experience if prevalent.  Gmail and Google Calendar are the two applications that immediately jump to mind when I think about this.  The user can know how to interact with the complicated software within a couple minutes. Unfortunately, this beautiful simplicity does not exist often enough in development frameworks and SDKs.

SDKs and frameworks are complicated behemoths that are hard to learn.  In my mind, when I have to learn a new framework, it is almost like learning a new programming language.  Actually, it may be even more difficult to learn a new framework because concepts don’t translate from one framework to another. I don’t know how many hours I’ve lost when learning a new SDK and just trying to wrap my mind around how each piece of code talks with each other or getting the correct security key to access a web app’s API.  How much time have you invested in debugging Windows SDK errors rather than actually creating code? These problems are barely the tip of the ice berg in SDK usability. As such, I believe that a better way to look at frameworks, especially if you are interested in large adoption, is to see them as a piece of production level software rather than a tool to solve a problem.

We can take this thought by looking at the difference in popularity between two well known javascript frameworks, jQuery and dojo. These two libraries deal with very different problems in the javascript space, but are still compared by their respective users since they cross many paths. As such, jQuery is known by many proficient web developers and designers, while dojo is more popular with advanced developers. This is a result of how the two libraries throw the users into the code to start playing around..

jQuery makes a lot of sense for developers that have only used core javascript and CSS when creating website. The fundamental way to develop with jQuery is to use CSS selectors with everything you do. For example:

   1:  $("a").click(function(event){
   2:      alert("a link was clicked!");
   3:  });

I believe the above code, in my opinion, makes sense to new developers once they read the intro jQuery docs:

- $(“a”) creates an array of all anchor nodes on the page

-when a user clicks on any link on the page, an alert box will appear

On the dojo end of things, the CSS selection system is not a core fundamental to development.  They have a system much like jQuery’s (it’s called dojo.query() ), but dojo aims to solve many of javascript’s shortcomings by introducing a module system, widgets, data layer, xhr, and much more.  As such, dojo has a higher bar of entry, it isn’t too difficult, but users must learn how to interact with the dojo code loading system and make sure the web page dependencies are all correct. To recreate the same type of onclick event in dojo, we can do the following:

   1:  dojo.query("A").connect( "onclick", function(event){
   2:      alert("a link was clicked");
   3:  });

It isn’t too much more, but I feel that the above syntax might confuse some users. What is dojo.query? What does “connect” do? Why should i do this instead of dojo.query().onclick?

What I am trying to get across with the above examples, without getting into a dojo vs. jQuery argument, is that jQuery is so much more popular than dojo because it has a much lower bar for users to pick up and start making simple programs with. jQuery is even one of the first libraries that web development classes teach their students. Jeffrey Brown, in an interview with CSS-Tricks captured how students pick up jQuery so fast:

I find Javascript is a bear to teach. Imagine you were them, so far they have learned Digital Design Production (fairly straight forward, you tell a program what to do and you see your changes instantly), HTML (extremely straight forward, you write it and it shows up), and CSS (you change it and it changes on the screen). Then all of a sudden here is this beast that is capable of complicated thought, you can’t always see the changes you make in your site, and if you type a single character incorrectly it could break it. Not to mention its syntax is unlike anything they have seen thus far. It is a big jump and often we (web professionals) are too quick to lump JS with HTML and CSS. It falls in the same category but it doesn’t teach or learn the same way.

I make them stick it out with JS for a solid month or two, then just when they think they can’t process any more JS I show them JQuery. They always say the same thing, “Why didn’t you show us this first?” and I always say the same thing, “Because you need to know how to write JS on your own and not rely on a third party library.” They still hate me, but at least they know the basics of Javascript. Jquery works for them, as with many of us, because of the use of the familiar CSS selectors.

The process Brown seems to take here when teaching students is HTML > CSS > Javascript > jQuery because the library solves so many problems and makes simple sense for people that just learned CSS.

We can even extend this topic into how popular some web application APIs are, more specifically, Twitter. Twitter’s web site is the most unpopular way to interact with the service, more people are using mobile or desktop clients to talk with their friends and followers. This is because Twitter’s API is so simple to use. If you are a web developer, you will understand that all you need to do is make an AJAX call to the Twitter and you can grab the data from a user account, their search service, etc.

Let me repeat that.

To get twitter data, you give an AJAX call the URL and you get all the data you are interested in back.

No difficult security validation. (ok, some if you are worried more than just the search API)

No crazy programming model of objects, methods, etc.

Just a single URL and a function to handle the data returned.

It honestly can’t get simpler than that.

How many tech news stories do you read that has something about a new twitter client a day? a lot?

How much news do you read about new Flickr/Google Maps/Yahoo Pipes/whatever applications and clients?

Twitter’s consumer product is not it’s website.

Twitter’s consumer product is the API.

When creating your frameworks with the intention of large developer adoption, ask your self these questions:

-How long is it between downloading the SDK to writing hello world?

-How much documentation does the user need to read to understand our model of development? Can the user figure out what is going on just from looking at the packaging of the example files?

-How much example code do you give the user to copy and past into their application to start hacking away with?

-How easily accessible is the documentation for the user?

-How easy is it for users to discover new features and aspects of our SDK?

Hopefully with these thoughts in my mind, you never hear a user say “I spend more time fighting with the APIs than actually developing my code!”

For the best example of a failure to make a simple framework, Joel Spolsky captures it best in his classic article, How Microsoft Lost the API War

The Ryding List

Here it is! After a few days of getting tips from friends, colleagues, comments, and twitter, I have found a wealth of great things to do in Raleigh.

The purpose of this is is that I want to explore and experience everything that Raleigh has to offer. I’ve come to really love the city and want to see everything all the new things I haven’t found in it yet.

As I go through this list, I have one simple rule:

Finish this list before I leave at the end of the summer

So without further ado, I give you The Ryding List:

———————————————————————————–

  1. Rush Hour Go Karting
  2. Outdoor Laser Tag
  3. Drive In Movie
  4. Drag Queen Bingo (yes, and apparently this is done in some churches)
  5. Outdoor Movie at Raleigh Art Museum
  6. First Friday
  7. Duke Gardens
  8. Big Boss Brewery Tour
  9. Dinner at The Pit
  10. Carolina Roller Girls
  11. State Farmer’s Market
  12. Ole Time Barbecue
  13. Flea Market on the Fairgrounds
  14. Cooper’s BBQ
  15. Frisbee Golf
  16. Take a Rickshaw Ride
  17. Paddleboat ride on Lake Johnson
  18. Take picture with the Andy Griffith Statue
  19. Couch Trip Bar Crawl
  20. Segway Tour of Raleigh
  21. Go to Goodberry’s
  22. Drinks at Boylan Bridge
  23. Walk from State Capitol to Executive Mansion
  24. Explore City Market
  25. NC Museum of Art
  26. Eat at Char-Grill
  27. Koka Booth
  28. See a movie at the Rialto Theater
  29. Explore Umstead Park
  30. Locopops
  31. See a punk band at The Brewery
  32. Sailing Class at Lake Crabtree
  33. Explore Raleigh Rose Garden
  34. Explore the area around Dix
  35. Eat at Flying Biscuit Cafe
  36. Eat at Neomonde
  37. Snoopy’s Hot Dogs
  38. See a plane land at RDU’s Observation Deck
  39. Eat at Poole’s Diner

———————————————————————————–

Wow, that is a ton of fun and amazing things that I will be experiencing this summer around Raleigh, NC.

I also received many recommendations for events and places that I have already done, if you are wondering here they are:

———————————————————————————–

-Downtown Raleigh Live: Free concert every other weekend in Moore Square

-Lily’s Pizza: hands down, the BEST pizza in the Triangle

-Coffee at Third Place and/or Cafe Helios: two amazing coffee shops with free wifi

-D.H. Hill Library: NC State’s community library, I have spent some time doing work from here and am constantly impressed by the wonderful, modern design and current technology offerings

-Cookout =  weekend nights + 2am + milkshakes, enough said

-Pizza and Pretzels at Mellow Mushroom: some great food to be eaten here

-Improv comedy shows and classes at ComedyWorx: i have been here a bunch and every show has been amazing

-Beers at Flying Saucer: hundreds of beers on tap (even root beer!), gret staff, great environment to catch up with friends at

-Karaoke at Napper Tandy’s Irish Pub: great DJ and fun times to be had!

-Stand up at Goodnight’s Comedy: every Wednesday night is Fajita Margarita night, $10 for fajita’s and free tickets to the amateur comedy show.

-Raleigh Beer Fest: 100s of beers to sample, went to it for the first time this year. Amazing

-Cary Wine Festival: same as beer festival, but with wine. Another great time with some really amazing wines

-North Hills Beach Music: every Thursday evening from 6-9pm is a free concert at North Hills outdoor mall.  I recommend getting there early, definitely not enough parking for latecomers.

-Tweetup: a meetup organized through twitter. It doesn’t even matter if you are on Twitter, I’ve been to them and met some really amazing people from all walks of life. Artists, comedians, film makers, engineers, entrepreneurs, and many more. If you want to branch out and get to know some fun people, go to one!

———————————————————————————–

There you go! The Ryding List, a list of everything that I have not yet done in Raleigh. Keep up with this blog through the summer, I guarantee I will have some amazing and funny stories to tell.

Thanks to everyone that helped out with this list:

Pat, Kristen, Seth, Jason, Robert, Melissa, Cliff, Allison, Kara, Katy, Allison, Paul, Matt M., Stephanie, Matt L, Taylor, Jess, @DeirdreReid, @steveburnett, @zy1125, @jillstacey, @Geistbear

The Full Raleigh Experience

Wednesday night has become one of the most important nights of the week for my friends and I. It is when we meet up for dinner and drinks to take a break and catch up with each other’s lives. This Wednesday was no different, except that I had an idea.

This idea is a result of my goal for my social life this year in Raleigh. Last year I felt that I lived the IBM Co-Op experience to its fullest. To help this, I decided to live near NC State in order to easily explore the city. In the past six months, I have had some amazing times, but I still haven’t felt I have seen all that Raleigh has to offer.

To fix this problem, I have decided to create a list.

This list will involve important landmarks, events, venues, restaurants, bars, tours, theaters, plays, whatever comes to mind that I personally have not experienced yet. My good friend Jason decided to name it, “The Ryding List” after the wonderful episode of How I Met Your Mother that involved Barney Stinson performing tasks from The Murtaugh List.

But I need your help.

Since I am still new to the area, I only have a general idea of the major places in Raleigh. I want to find out about the hole-in-wall restaurants, the hidden treasures, the places that people who really know Raleigh can tell me about. If you know of anything in the city that you would tell a friend or family that they need to see before they leave, I want to know about it. So please email me, leave a comment, or reply to me on twitter (@strife25) so that I can find out about these really interesting spots in Raleigh.

I will be blogging, taking pictures, recording some Qik videos and tweeting about the tasks as I do them throughout the summer. On top of this, if you would like to meet up with me as I go through my list, please email or DM me on twitter as I am sure there will be some events in Raleigh you didn’t know about yourself. If you are on twitter, go ahead an follow the hashtag #theRydingList.

I will be taking input for this list until Sunday at 12:00 pm, where I will then post it here for everyone to see.

Thank you in advance for contributing to the beginning of a wonderful adventure for me, my friends, and all the people we meet along the way.

The current Ryding List with misspelled venues and random thoughts included!

Book Review: Javascript: The Good Parts

theGoodParts

Last week I finished reading Douglas Crockford’s Javascript: The Good Parts. This is a book aimed at average to advanced Javascript developers or experienced developers that have an interest in the language but have only heard bad things about it.  If you are in either of these two camps, I highly recommend this book.

Crockford does well in debunking the myths that people have associated with Javascript in the past and enlightens us on how powerful the language actually is. If you know me, you will already know that I am a big fan of Javascript and how unique it is compared to normally used languages such as Java or C++.

When reading this book, I remembered a wonderful article by Steve Yegge on how to interview Ruby developers. The most important point I found in the article was that,

“It’s extremely uncommon for average programmers or language novices to be able to speak intelligently about their favorite language’s weaknesses, because the language books and tutorials rarely focus on the weaknesses.”

This is what I found to be the best part of Javascript: The Good Parts. The last chapters of the book focuses solely on where the language fails. Most introductory books and tutorials emphasize on only the strengths of a language, never the bad parts. Crockford takes this a step further by explaining why the good parts are good and the weaknesses of Javascript. If you consider yourself a serious Javascript developer, this is a must read. Although some parts will reiterate topics you will already know, the information is good.

On another note, I find it interesting to figure out the association of the animals on the covers of O’Reailly books. These animals represent the overall idea and theme that the book is trying to make. For Javascript: The Good Parts, I believe that the butterfly is being used to represent how Javascript began its life with a slow and ugly start, but as time went on, it grew to become a beautiful and important language.

Customize the CSS of Dojo’s Tab Container

A few weeks ago I developed a page on Jazz.net that required the functionality from dojo’s dijit.layout.tabContainer. This is a great widget that quickly adds some great organization and functionality to your page. The problem I ran into was customizing the CSS of the Tab Container. This is not a simple task as dojo’s templating system creates a lot of DOM on the page when it is rendered, so the HTML you write with dojo is very simple, but the output is complicated. So with a little reverse engineering, firebug, and an afternoon I was able to customize the tabs to my site’s design specs. You can check out the final product here

Since the DOM structure is really complicated, I am attaching a CSS file of the skeleton template you will need to customize the Tab Container to your site’s designs.

The other problem I ran into was that I needed to add some DOM nodes to the tabs themselves to apply some final touches. To do this, I had to extend the TabContainer widget and change some properties so that I could access the template of the tab itself.

The following code assumes you already have a working knowledge creating/extending dojo widgets, questions dealing with stuff I do not mention here can most likely be answered on the dojo toolkit website

So jumping into the code, to access the tab itself, we must first create the two following functions:

*NAME* should be replaced with the namespace you are using for your site.

——————————————————————-

dojo.declare(/*Namespace of your widget*/ ), dijit.layout.TabContainer, {
	_controllerWidget: "*NAME*.TabController"
});

dojo.declare("*NAME*.TabController",	dijit.layout.TabController, {
	buttonWidget: "*NAME*._TabButton"
});

——————————————————————-

The above code gives gives us access to the _TabButton private widget when the page loads, the following code is where you will place the logic to add the DOM nodes you need:

——————————————————————-

dojo.declare( "*NAME*._TabButton", dijit.layout._TabButton, {
	postCreate: function() {
		this.inherited(arguments);
                this.innerDiv = /*DO STUFF*/;
        }
});

——————————————————————-

In the above code, this.innerDiv is the important detail. this.innerDiv is the dojoAttachPoint to one of innermost divs on a tab, one level deeper gives us access to the node that contains the title of the div, and is probably not something you want to mess with unless you know what you are doing. To access the other dojoAttachPoints of the Tab, take a look at the tabs in the source or with Firebug on the live page. This tutorial was to help get past all the crud of figuring out how to access the DOM of the tab itself. Here is our final product:

——————————————————————-

(function(){

dojo.provide( /*Namespace of your widget*/ );
dojo.require("dijit.layout.TabContainer");

dojo.declare(/*Namespace of your widget*/ ), dijit.layout.TabContainer, {
	_controllerWidget: "*NAME*.TabController"
});

dojo.declare("*NAME*.TabController",	dijit.layout.TabController, {
	buttonWidget: "*NAME*._TabButton"
});

dojo.declare( "*NAME*._TabButton", dijit.layout._TabButton, {
	postCreate: function() {
		this.inherited(arguments);
		this.innerDiv = /*DO STUFF*/;
	}
});

})();

——————————————————————-

Download CSS Skeleton for TabContainer

Life Till Now

I am kind of late with this post, but it looks like I finally have the free time, and energy to get to it. Since January I have been on my second co-op with IBM working on the Jazz Foundation Web UI team. That looks like a mouthful, but it basically means I am helping to develop the tools of the framework that the products implementing a Web UI under the Jazz technology will use.

Since coming on in the middle of January, this job has been a roller coaster of excitement and achievements for me. I cannot say enough how impressed I am with the team I am fortunate enough to work with, I don’t think I have ever been in an environment where so many people I talk to are so passionate and extremely smart with what we are all working on. To sum it up: I love my job. It is really rewarding to be working on projects that many people will be interacting with and using for a good deal of time. This job has involved a lot of Javascript, building Rich UIs, and designing our projects to accommodate enterprise users and many different products and servers interacting with each other. Some really interesting and cutting edge work is being done, and it is amazing to be a part of.

The other half of my time at IBM has been devoted to implementing and designing new pages on the Jazz.net website. This was not one of the original projects I was planning to interact when coming on the team, but it has been a very worthwhile one. Where the Web UI work increases my skills with Javascript and the Dojo toolkit, Jazz.net development has made me comfortable to work with CSS and developing standards-compliant pages that work with IE. See some of my work here and here

Outside of work, it has been amazing to return to Raleigh. It has certainly been different compared to last year, but so is life. Last year, I feel I lived the IBM experience to its fullest, this time though, my goal was to interact and explore the community of Raleigh as much as possible. One of the firs t things I did was attend my first Tweetup. Although it was nerve racking at first to go to my first internet meet up, it greatly fit with my goal of exploring the area. I met people from all walks of life, from artists, to developers, to entrepreneurs. It was an amazing experience that came with some free food.

The last big event that happened to me was attending my first ever video game conference. It was the Carolina Games Summit out in Goldsboro, and was a small event with some interesting speakers, but it was interesting none the less. It is certainly an experience when you walk into a room and the first thing you see are a storm trooper, 2 Boba Fetts, and Darth Vader.