Wednesday, November 23, 2011

Eliminate Fast User Switching by Using an Applescript to Toggle Preferences

Alexia was a PC. I'm a Mac. However, when moving into our house after getting married, her PC bit the dust. So, eager to spread the gospel of Apple, I transferred her stuff over to my Macbook Pro.

However, as productive as Hot Corners can be when you are familiar with them (me), they can be equally frustrating to someone who is not familiar with them, nor has any intention of becoming so (Alexia). I like to tap to click sometimes, she doesn't. I have switched over to the natural scrolling of Lion, she is still using the unnatural(?) scrolling of Snow Leopard.

So, to make it work, I set up different profiles. While these allowed us to keep our individualized settings, it also had its drawbacks. Fast user switching is still not fast enough. You have to click on the name, select your name, type your password, and then wait for the cube to rotate to your profile. It was also a pain when restarting, because you were prompted for your password to confirm that the other user's programs would be terminated (also a problem if they had something open they didn't save). I also had a background program that would often crash while switching profiles. Finally, I have yet to figure the best way to share an iTunes library (and iPhoto is even worse). Permissions would always get wonky and the iTunes library file would be locked.

So today I made all that change. I had never Applescripted before, so I relied heavily on piecing code together from here and there. The Frankenstein that I ended up with was exactly what I wanted. I have a quick application called Switch that toggles back between my "preference profile" and my lovely wife's profile simply by switching the individual preferences back and forth. Run it once, and it turns off Hot Corners, tap to click, and natural scrolling, while displaying a Growl notification that Alexia's profile is now activated. Run it again, and you're back to mine.

The Hot Corners are toggled using some code that edits the plist files. I borrowed this code from a script called Lava Corners Switch. The Growl notification code is adapted from the Growl website (which I just noticed the other day is now in the Mac App Store. I declined to buy it because... how much more can Growl be improved? It gives me messages, that's great.). The toggling of the natural scrolling is implemented with UI scripting (so you have to enable access for assistive devices) and comes from commenter fireshadow52 on I added the tap to click toggling. And finally, the method testing to see if an app is running came from CodeSnippets. Then I just grabbed a nice icon from the web and slapped it on there.

To get this running, copy the code into a new Applescript. Save it as an application and throw it on your dock. Set all your settings, and then run the application to toggle all of your Hot Corners off, and switch those other two trackpad settings. Obviously individuals will need to tweak the settings they want changed, and that will take some digging online. If you use it, let me know how it works. And if there is a better way to do any of this, feel free to enlighten me.

As a side note, it amazes me how much some people know out there. I'd like to think of myself as pretty computer savvy, especially compared to those I interact with daily, but my progress to this point can best be described as blindly stumbling for hours. The knowledge of some out there is very impressive. Anyway, I hope this helps. To me, this will be so much better than multiple logins.

-- List of properties for hot corners. Just set your hot corners and it will toggle back and forth between those settings and being disabled
property tl : 1
property tr : 1
property br : 1
property bl : 1
property runs : 0

if appIsRunning("GrowlHelperApp") then
tell application id "com.Growl.GrowlHelperApp"
-- Make a list of all the notification types
-- that this script will ever send:
set the allNotificationsList to ¬
{"Switch Notification"}

-- Make a list of the notifications
-- that will be enabled by default.
-- Those not enabled by default can be enabled later
-- in the 'Applications' tab of the Growl preferences.
set the enabledNotificationsList to ¬
{"Switch Notification"}

-- Register our script with growl.
-- You can optionally (as here) set a default icon
-- for this script's notifications.
register as application ¬
"Switch" all notifications allNotificationsList ¬
default notifications enabledNotificationsList ¬
icon of application ""

-- Indicate which user or profile is now running
if runs = 1 then
notify with name ¬
"Switch Notification" title ¬
"Profile Activated:" description ¬
"User 1" application name "Switch"

notify with name ¬
"Switch Notification" title ¬
"Profile Activated:" description ¬
"User 2" application name "Switch"
end if

end tell
end if

-- Stores existing hot corners as properties for next toggle
if runs is 0 then
set tl to do shell script "defaults read wvous-tl-corner"
set tr to do shell script "defaults read wvous-tr-corner"
set bl to do shell script "defaults read wvous-bl-corner"
set br to do shell script "defaults read wvous-br-corner"

-- Disables hot corners
do shell script "defaults write wvous-tl-corner -int 1; defaults write wvous-br-corner -int 1; defaults write wvous-bl-corner -int 1; defaults write wvous-tr-corner -int 1; killall Dock"
set runs_A to 1
end if

-- Sets hot corners back to existing values
if runs is 1 then
do shell script ("defaults write wvous-tl-corner -int " & tl & "; defaults write wvous-br-corner -int " & br & "; defaults write wvous-bl-corner -int " & bl & "; defaults write wvous-tr-corner -int " & tr & "; killall Dock")
set runs_A to 0
end if

-- Initializes the trackpad preference pane
tell application "System Preferences"
set current pane to pane ""
end tell

tell application "System Events"
tell process "System Preferences"
-- Toggles between natural scrolling and unnatural(?) scrolling
click radio button "Scroll & Zoom" of tab group 1 of window "Trackpad"
click checkbox 1 of tab group 1 of window "Trackpad"
-- Toggles tap to click on
click radio button "Point & Click" of tab group 1 of window "Trackpad"
click checkbox 1 of tab group 1 of window "Trackpad"
end tell
end tell

quit application "System Preferences"

-- Keeps track of where you are at in the toggle
set runs to runs_A

-- Call to make sure growl is running
on appIsRunning(appName)
tell application "System Events" to (name of processes) contains appName
end appIsRunning

Thursday, October 6, 2011

Steve Jobs

I was really surprised when I realized how much Steve's passing affected me last night and today. Today seemed a little gloomy. I knew I loved my iPhone, iPad, and laptop, but I didn't realize that I had grown to look up to Apple's iconic CEO. Thanks Steve.

Tuesday, September 27, 2011


When I lived in downtown Marietta, I'd often walk to the corner store for snacks. Halfway there, sat an old, shirtless, plump man on his porch. His name was Henny.

Henny would say some of the oddest things to my brothers and me as we passed. Whether he was merely enjoying the lack of accountability that often is afforded the aging, or was conducting his own social experiment, I never knew. Often I would be hailed as the "candyman" as I walked by.

Once while passing, he called out "Your mom's in the hospital!" By this time I had caught on to Henny, may have given him a nod or a half hearted "Oh," but just kept walking, quite confident that my mom was not, in fact, in the hospital. My confidence may have been bolstered by having just been at home minutes prior, and having seen my mom, unhospitalized. Regardless, he didn't fool me.

And then one day, he passed away.

Wednesday, September 7, 2011

Beach with my best friend

Alexia and I went to the beach last Saturday, and it was great. I really enjoy car rides with her, cause it forces us to slow down, talk, and just spend time together, when the rest of the time it is so easy to get caught up in everything we are busy with. But man, wouldn't it be sweet when we can have our cars drive us places and we can just relax in the meantime?

Anyway, we brought Cinder. It was her first time to the beach, and it was a lot of fun watching her and Alexia play. She has had a little aversion to water since her first experience with us and water was when we had just gotten her, she was 4 months old, we took her to the park, she ran right out on the ice, and fell in. Alexia jumped in the freezing creek to rescue her. Speaking of which, I'm always impressed with how good she is with animals, of the human baby kind, or the pet kind. She does a lot of the work with Cinder, and also looks out for the chickens by making them delicious meals that consist of a bunch of scraps we have left over.

So, Cinder's a little leery of water. But she has been getting better. She would walk out into the water a bit, but was scared when the waves would crash into their foamy whiteness. In fact, her most common response to this (other than running back towards land) was to bite the wave. It was adorable. Oh, and the best friend in the title is Alexia. Cinder's just my second best.

Thursday, September 1, 2011

How to re-web your own Chacos

My 5 year old Chacos which I purchased for 40 bucks had seen better days. The soles were peeling off. So I sent them in and got them resoled under the warranty for free. Yipee! It was then that I realized that the webbing was fraying through. I called to see if this was covered under the warranty, but they said it most likely wasn't. They needed to see them first.

Not wanting to spend another $8 to ship them off, certainly not wanting to pay $36 bucks to have them re-webbed, and knowing that my brother had successfully re-webbed his own Chacos, I started my project.

You will need:
  • A torch, or matches, or some heat source to melt the ends of your webbing
  • About 10' 3/4" wide tubular webbing (costed me a little over a quarter a foot)
  • A medium sized needle
  • Strong thread (I had to go to Jo-Ann Fabric and Craft for upholstery thread)
  • A knife
  • Scissors
  • A few hours
Here are pictures of the beginning and the end, and then how I did it.

1. Remove the bar tack stitching that connects the main strap to the inside heel riser (the ones between your feet, not on the outside). I just replaced the main strap as my heel strap and buckle straps were fine, as I assume most are. But those seem replaceable too, you just need to take off the chaco logo.

The bar tack stitch also has a straight stitch underneath. So I took a knife and cut the side to side bar tack stitch, and then pulled the thread out with my leatherman. Be very careful that you don't cut any of the heel riser webbing. Take your time so you are just cutting stitches. After the bar tack is gone, you need to cut the straight line of stitches holding the strap in.

2. Cut the end of the webbing you just removed from the heel riser at an angle and fuse it with a torch. Cut the end of your new webbing complementary and fuse it as well.

3. Thread your needle and sew the two ends together well. You want to butt the ends together, not overlap. Make sure it is very secure. Otherwise the connection may break while it is being threaded through, and then you will need to cut through your sole to finish the repair.

To sew it together, I took 10 inches of thread, and threaded 2 inches through the eye of the needle. Don't tie a knot anywhere in the thread. Just sew 4 or 5 times through the smallest bite of webbing on a corner of one of the pieces. Once you have this anchor, just keep looping over that seam between the pieces. I went from one end to the other, and then back and anchored again like I did at the start. Then snip the pieces. You may want to double this if you aren't sure it is strong enough or if you don't have heavy duty thread (I'd recommend upholstery thread, which is 100% nylon and doesn't fray). Trim any protruding corners that may impede threading this seam through your sole.

4. Now pull, and pull hard. You need to pull your new webbing through the whole webbing pattern. You may need to find the right angle of pull so that the webbing moves and you don't tear your foot bed apart. Check your stitching after each pass so it doesn't fall apart on you.

5. Now that it is all the way through, snip off the old webbing by cutting your new webbing at a right angle right after the seam. Fuse the end. You can now cut the other end of your old webbing and disconnect it from the buckle. Note how it is attached, because you will be replicating that.

6. Sew your new webbing on the buckle like the old webbing was sewn. Again, thread the needle, pass through the same bite (as much as you can, you just want to concentrate your stitching on the smallest possible piece of webbing) several times, and do your best to replicate a bar tack stitch (what was there originally). With all the stitches in this project, I did it twice, with about two passes each. So I would anchor, go from one side to the other and back, anchor again, and trim the thread. Then I repeated the process. That way if one stitch breaks, you have a backup.

7. Now, put the sandal on your foot and adjust all the straps just like you normally would. Mark about where you should cut the other end of your new webbing, and cut it at an angle (it comes out of the heel riser at about a 45 degree angle). Fuse the end.

8. Slide the end into the heal riser, thread your needle, anchor, stitch two passes, anchor, trim. Repeat. You've finished repairing one sandal, now do the other.

9. Enjoy the re-webbing job that cost you under $10

I was pretty pleased with the result. My only complaint is that my new webbing is a little softer and floppier than my original webbing so it takes a bit more effort to put them on. The original webbing is tubular, but it looks like it may be stitched flat. It may stiffen up it time, or perhaps wax or a rosin could help it out.

Let me know if you have any questions.

Tuesday, July 19, 2011

2 Seconds

-- The amount of time it took me to pause at the trashcan and decide that feeding the chickens my leftover chicken was not right. I threw it away.

Monday, July 11, 2011


....and I got a Parrot AR Drone for our anniversary. It is pretty much awesome. Except for the fact that it is a little out of commission while I wait for repair parts:-).


I'd say two posts in one day, but technically my last post was started yesterday. Alexia and I currently have 17 chicks living in our basement bathroom. There are 5 Cuckoo Maran pullets that lay a dark brown egg, 4 Ameraucana pullets that lay blue/green eggs, and 8 Rhode Island Red (we think) roosters that were included in the box to keep the girls warm during the shipping process.

I spent my three week school break working non-stop building a chicken coop. I'll put up some pictures when it is finished. But the end goal is a 5x8 coop to keep 4 hens in for egg laying. The funny thing is we don't eat many eggs, but I guess we will learn to. You can blame this all on my wife to, she's from Portland:-). No, it has been fun. I originally wrote "really" before "fun" but took it away because it has been hard work too. But fun hard work.

Not sure what to title this

As the title says, I'm not really sure what a good title would be, or what this post is really about. It is just late on a Monday night, and I am procrastinating going to bed. I logged on to Facebook (seems weird to capitalize the F when it seems to usually be lowercase in their logos), and it was weird.

It was weird to see that people still do stuff on Facebook. I'm not sure why, but I guess for me, Facebook jumped the shark a while ago. In fact, logging on to Facebook (ok, each time I've written it, I've had to go back and capitalize it... no more) will someday feel like logging on to AIM and seeing that some people from high school still IM. Actually, it is funny, because in highschool, I IMed a lot. And then I did a little bit before I went on my mission, but once I came back, it felt like I think of the past. But then Google Talk came along, and we all sort of got suckered into IMing again, without even realizing it was IMing. At least I didn't. And yet, here I am, logging into Google talk, eternally "busy." But mainly busy because I don't feel like I have time in my life to allow my time on the computer to be dictated by someone else's desire to talk. Similarly, when I message someone on Google Talk, it seems forced, and I worry that I am interrupting or wasting their time. But, apparently other people still find time to get on facebook.

I don't know why I find that so weird. It feels kind of sad though. It's as though I went to a party, and it was great for a while, but then I had to leave, and then hours later I still see and hear the party going on.

It has been frustrating trying to keep up with friends. I say trying to, but really it is more like trying to try to keep up with friends. I don't know what happened to my life, but perhaps getting married and being in dental school have something to do with that. And I love being married, and I usually like school, but somewhere along the way, my life became, not incompatible, but less compatible with staying in touch with people. Just yesterday I talked to my brother Caleb for the first time in months. I found out he had been dating someone for the last year. I didn't know that. I get in touch with my mom every few weeks. But friends are even harder. I've had emails in my inbox that I have been meaning to get back to, and I will some day, for months, if not half a year. Jana, a friend from highschool who lives in Germany, yeah, I'll get back to her. Brad, I got your email in April, it's still in my inbox.

My inbox is another frustrating thing. I've got things that people send me, that I some day want to look into when I have that free day that never comes, but I just never get around to it. And when I finally do have a free moment, I find something else to occupy it with. So my inbox has become like a cluttered desk, where you keep everything on the top because you want easy access to it, and fully intend to get to it someday, but instead it becomes this disorganized mass that every once in a while undergoes the process of prioritizing, where things lower on the priority just get bumped (like I will likely not read articles you send me, as interesting as they look), and other things higher on the priority but not high enough to be a priority, get relegated to the back of the line to one day be addressed.

In fact, all of my life has become this poor juggling act. Instead of all the balls being in the air at the same time, however, I throw one ball up really high (like I deep clean the house), and while that is in the air for it's brief moment of glory, I find the next ball that has been sitting on the ground the longest, and I chuck it high (I finally read through all my brother's emails since I emailed him last on the mission, and I reply).

Blogging itself has been something that I have been meaning to do for so long, but I never get around to it. If I could blog mentally, that would be great, because I'd blog a couple times a week. I always think, "This would be interesting, I should blog about this." Doesn't happen.

But back to friends. Sometimes I get bummed and feel like those I'd grown close to in the past no longer think about me or care to keep in touch. But then I realize that some do, Nathaniel's been trying to get in touch with me for a while. And then I think that maybe everyone's life is like mine. Is this the common path we've all found ourselves on? Does anyone have leisure time anymore? I really do want to keep in touch with my friends though. I think about people a lot. And often I think about getting in touch with people. But heck, I just checked the mousetrap in the attic two days ago, that I knew had to have had a mouse in it (and it did), and had been sitting there for probably 4 months. And the only reason why I did check it, is because I had to go to the attic for another chore. All along I had this nagging thought that I needed to check the trap, but somehow I really never got around to it. The most I could do was hope it was choosing the path of dessication and not decomposition, which it did.

So if you are a friend of mine, which you probably are since you are reading this, know that my absence of communication and apparent lack of ambition in staying in contact is not reflective of my feelings toward your friendship. It is just a product of my life, and me not knowing how to manage it yet.

It is interesting too, that I have this unfailing hope, almost confidence, that some day I will have caught up with things and life won't be busy anymore. Often times, that hope keeps me motivated and working.

I'm not sure what to do to improve my communication with my family and friends. I find it difficult to make friends of the same closeness as I had made at BYU or throughout high school, and so I do value them, but at the same time it seems like an impossible task to go through life and keep in touch with everyone you want to. Maybe I will post more, and this will serve as my communication to you friends, at least those of you that read this, and you can respond in comments. Maybe I will join Google+ and feel much less overwhelmed by the sheer number of "friends" to communicate.

I guess the questions I have are these... Do most people feel as unable to truly manage their lives and stay on top of things, including communication, as I do? Do they not keep in as good contact as they would like to as well with their family and friends? If so, who the heck is on facebook still? Another trend I've noticed is that the introspective blogging of yesterday has turned into the family newsletter. Which is fine, as I think about blogging what Alexia and I are up to as well. I just don't know whether blogging as a whole has become less introspective, or whether it is just a reflection of the life stages my friends are going through.

Anyway, it feels good to write again. I feel like I've become a less social and outgoing person since I've come to Pittsburgh, and I sometimes wonder if it isn't related to not blogging. I find myself keeping to myself more often. Perhaps blogging kept the pump primed for me when I used to do it more often.

I'll try to blog more often. I hope some people still read this:-).

Monday, May 23, 2011

What's that smell?

I just walked past someone on their smoke break (in front of the med school, but that is an irony I have gotten over by now) watching a gas leak unfolding in the street about 25 meters away.

I walked away quickly.