Content

The discovery, acceptance & management of life's gaps

A Dance with ThunderBolt – Update 2

Saturday 31 December 2011 - Filed under automation + gaps + Technology

At the stroke of midnight tonight, I will have completed 3 full months of testing of a real-time web tracking solution that depends heavily on ThunderBolt technology. Though I continue to be plagued with drive issues, a single drive has been fast enough to deal with the current read/write requirements.

Tagged: » » »

 ::  Share or discuss  ::  2011-12-31  ::  Russ Leseberg

A Dance with ThunderBolt – Update

Wednesday 30 November 2011 - Filed under automation + gaps + Technology

Initial testing of the LaCie ThunderBolt drives on a MacMini Server looked pretty good… That is after I returned the fist MacMini Server that had a dead Thunderbolt port. More in the next day or so….

Tagged: » » »

 ::  Share or discuss  ::  2011-11-30  ::  Russ Leseberg

A Dance with ThunderBolt

Monday 31 October 2011 - Filed under automation + gaps + Technology

Lacie Little Big Disk - ThunderBoltI began testing Lacie’s Big Little Disk ThunderBolt drives this last week. Lacie makes some pretty big claims for these little guys and I am determined to find out if they measure up. I have several coding projects in the hopper that will definitely put them to the test. More soon.Lacie Little Big Disk - ThunderBolt - Performance Chart

Tagged: » » »

 ::  Share or discuss  ::  2011-10-31  ::  Russ Leseberg

iPirate – The Bucs Go iPad

Wednesday 31 August 2011 - Filed under gaps + mobile + Teams + Technology

A month before the launch of Apple’s original iPad, I predicted that sports teams would replace their playbooks with the tablet computer, see Countdown to iPad – Playbook (Use Case 18).

Recently the Tampa Bay Buccaneers bought iPads for their players to do just that, see Tampa Bay Buccaneers buy each player an iPad to hold playbook, videos.

As further predicted, the Buccaneer coaches and players not only watch plays on the iPads, but if the devices are ever lost, “You’ve got a way to wipe (everything) off with the push of a button,” according to Tampa Bay Bucs Coach, Raheem Morris. ~ quote from tampabay.com article.

iPad: Team Player


In the Countdown to iPad Series (early 2010), I presented possible use cases for the amazing device that had yet to be released into the wild. Now that iPads have been with us for more than a year, it’s interesting to see just how many predictions have come true.


iPad – Copyright © 2010 Apple Inc. (www.apple.com)

Tagged: » » » » » » » »

 ::  Share or discuss  ::  2011-08-31  ::  Russ Leseberg

AppleScript | AppleScrunix – Listing files in a folder

Tuesday 26 July 2011 - Filed under gaps

One of the most common uses for AppleScript, and thus AppleScrunix, is to process files in a folder/directory. In order to process them you must first list the files. Though I find the listing of a folder of files, just as easy using straight AppleScript as I do with AppleScrunix, I much prefer the variations of returned lists in AppleScrunix.

A simple file listing in AppleScript looks like:

tell application "System Events" to set fileList to name items in folder "/Users/avail/Desktop/PDFs"


Result: {“001_FILENAME.PDF”, “001_FILENAME.txt”, “002_FILENAME.PDF”, “003_FILENAME.PDF”, “004_FILENAME.PDF”, “010_FILENAME.PDF”, “011_FILENAME.PDF”, “016_FILENAME.PDF”}

The same example in AppleScrunix looks like:

set fileList to paragraphs of (do shell script "ls /Users/avail/Desktop/PDFs/")


Same Result: {“001_FILENAME.PDF”, “001_FILENAME.txt”, “002_FILENAME.PDF”, “003_FILENAME.PDF”, “004_FILENAME.PDF”, “010_FILENAME.PDF”, “011_FILENAME.PDF”, “016_FILENAME.PDF”}

If all I had gained was a slightly shorter line of code it wouldn’t be worth it. However, now that we have entered the world of AppleScrunix, we can leverage the power of unix commands with just a few additional characters.

Simply adding an asterisk to my command, I get a list of file paths and not just file names:

set fileList to paragraphs of (do shell script "ls /Users/avail/Desktop/PDFs/*")


Result: {“/Users/avail/Desktop/PDFs/001_FILENAME.PDF”, “/Users/avail/Desktop/PDFs/001_FILENAME.txt”, “/Users/avail/Desktop/PDFs/002_FILENAME.PDF”, “/Users/avail/Desktop/PDFs/003_FILENAME.PDF”, “/Users/avail/Desktop/PDFs/004_FILENAME.PDF”, “/Users/avail/Desktop/PDFs/010_FILENAME.PDF”, “/Users/avail/Desktop/PDFs/011_FILENAME.PDF”, “/Users/avail/Desktop/PDFs/016_FILENAME.PDF”}

What if I just want to list the pdf files and not the text (txt) files? By just adding ‘*PDF’ I get the desired result:

set fileList to paragraphs of (do shell script "ls /Users/avail/Desktop/PDFs/*PDF")


Result: {“/Users/avail/Desktop/PDFs/001_FILENAME.PDF”, “/Users/avail/Desktop/PDFs/002_FILENAME.PDF”, “/Users/avail/Desktop/PDFs/003_FILENAME.PDF”, “/Users/avail/Desktop/PDFs/004_FILENAME.PDF”, “/Users/avail/Desktop/PDFs/010_FILENAME.PDF”, “/Users/avail/Desktop/PDFs/011_FILENAME.PDF”, “/Users/avail/Desktop/PDFs/016_FILENAME.PDF”}

Or, what if I just want to list the files numbered between 010 and 019? By just adding ’01*’ I get the desired list of files:

set fileList to paragraphs of (do shell script "ls /Users/avail/Desktop/PDFs/01*")


Result: {“/Users/avail/Desktop/PDFs/010_FILENAME.PDF”, “/Users/avail/Desktop/PDFs/011_FILENAME.PDF”, “/Users/avail/Desktop/PDFs/016_FILENAME.PDF”}

Study the man page for ‘ls’ and you will find a treasure trove of small command modifications that will make a big difference in your solutions.


AppleScript / AppleScrunix Examples – using the do shell script command in AppleScript.

 ::  Share or discuss  ::  2011-07-26  ::  Russ Leseberg

Using Applescript & Python To Set Title Case (AppleScrunix)

Thursday 30 June 2011 - Filed under automation + gaps + Technology

One way in which Apple has turned the Mac into the most powerful scripting/automation platform on the planet has been to provide a litany of scriptable languages as part of the standard install. Just some of the languages you will find in Mac OS X are JavaScript, Ruby, Python, and of course AppleScript. I refer to the mashing all these languages together as AppleScrunix.

Each of the languages has strengths and weaknesses. By bringing them all together on a single platform, and making it easy for them to be used together, Apple has put an amazing amount of automation power in our hands.

As shown in previous posts AppleScrunix allows me to work primarily in AppleScript and draw from other languages when my scripting language of choice comes up a bit short.

I often run across the need to do ‘simple’ title case conversion. ‘Simple’ meaning every word in the title has its first letter capitalized and all remaining letters are lowercase. Though this is possible using only standard AppleScript, the project quickly becomes complicated and ends up running slower than it needs to.

If you are interested in solving this problem just using AppleScript, you can get much of the code you need from my previous post, Applescript – Converting Uppercase & Lowercase (AppleScrunix Style).

Or you can do it using AppleScrunix and just 2 lines of code. I have messed up the title ahead of time to make it more interesting… thIs is thE stORY of a GIRL becomes This Is The Story Of A Girl.

Begin Script…

set myTitle to "thIs is thE stORY of a GIRL"

do shell script "python -c \"print " & quoted form of (myTitle) & ".title()\""


…End Script

Result: “This Is The Story Of A Girl”


AppleScript / AppleScrunix Examples – using the do shell script command in AppleScript.

2 comments  ::  Share or discuss  ::  2011-06-30  ::  Russ Leseberg

Applescript – Converting Uppercase & Lowercase (AppleScrunix Style)

Thursday 26 May 2011 - Filed under automation + gaps + Technology

As there are no built-in routines for changing the case of characters in AppleScript, the coder is required to add their own handlers. The following script (See credits below) shows one way to use AppleScript to change the names of files in a folder from lowercase to uppercase & vise-versa.

Begin Script…

tell application "Finder" to set the source_folder to choose folder


tell me to activate


display dialog "Change case to:" buttons {"Cancel", "UPPER", "lower"}

set the button_pressed to the button returned of the result

tell application "Finder"

repeat with this_item in entire contents of source_folder

set the current_name to the name of this_item as text

if the button_pressed is "lower" then

set the name of this_item to my change_case ( the current_name , "lower")

else

set the name of this_item to my change_case ( the current_name , "upper")

end if

end repeat

end tell

display dialog "Process complete"


-- AppleScript 'change_case' handler

on change_case ( this_text , this_case )

if this_case is "lower" then

set the comparison_string to "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

set the source_string to "abcdefghijklmnopqrstuvwxyz"

else

set the comparison_string to "abcdefghijklmnopqrstuvwxyz"

set the source_string to "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

end if

set the new_text to ""

repeat with thisChar in this_text

set x to the offset of thisChar in the comparison_string

if x is not 0 then

set the new_text to ( the new_text & character x of the source_string ) as string

else

set the new_text to ( the new_text & thisChar ) as string

end if

end repeat

return the new_text

end change_case


…End Script

The following handler ‘change_case’ was rewritten using AppleScrunix. Not only is there less code, but the script runs faster. Replace the AppleScript version of the handler in the above script with the unix based handler below.

Begin Handler…

-- AppleScrunix 'change_case' handler

on change_case ( this_text , this_case )

if this_case is "lower" then

set the new_text to do shell script "echo " & quoted form of ( this_text ) & " | tr A-Z a-z"

else

set the new_text to do shell script "echo " & quoted form of ( this_text ) & " | tr a-z A-Z"

end if

return the new_text

end change_case


…End Handler

The above AppleScrunix example uses shell command ‘tr’ to translate uppercase to lowercase, etc. Refer to the tr Mac OS X Man (Manual) Page for other uses.


Credits: I picked up the initial example script almost verbatim from Apple Support Communities. It was posted by a user I only know as V.K., on April 16, 2009 @ 10:13 am. ~Thanks VK!


AppleScript / AppleScrunix Examples – using the do shell script command in AppleScript.

1 comment  ::  Share or discuss  ::  2011-05-26  ::  Russ Leseberg

Sorting with AppleScript (AppleScrunix Style)

Friday 29 April 2011 - Filed under automation + gaps + Technology

As there is no built-in sort function in AppleScript you have to create your own. A common way of sorting lists is to use the repeat function… cycling through the list comparing items as you progress.  One of the more efficient approaches is a bubble sort. You can find an excellent example in Lesson 18, “Working with Lists and Records” in Sal Saghoian’s book, AppleScript 1-2-3.

This AppleScript bubble sort was taken in part from Sal’s book:

set fruit to {"pears", "bananas", "apples", "grapes", "watermelon", "pineapple"}

set last_swap_position to length of fruit

repeat while last_swap_position > 0

set comparisons_needed to last_swap_position - 1

set last_swap_position to 0

repeat with i from 1 to comparisons_needed

if item i of fruit > item (i + 1) of fruit then

set swap_item to item i of fruit

set item i of fruit to item (i + 1) of fruit

set item (i + 1) of fruit to swap_item

set last_swap_position to i

end if

end repeat

end repeat

return fruit

= {"apples", "bananas", "grapes", "pears", "pineapple", "watermelon"}

Using AppleScrunix you can sort the same list using a shell script sort command:

set fruit to {"pears", "bananas", "apples", "grapes", "watermelon", "pineapple"}

set text item delimiters to {ASCII character 10}

set fruit to fruit as string

set fruit to paragraphs of (do shell script "echo " & quoted form of (fruit) & " | sort -f")

set text item delimiters to ""

return fruit

= {"apples", "bananas", "grapes", "pears", "pineapple", "watermelon"}

Though it doesn’t save much coding, it executes faster, especially as the lists get longer. Using sort, via shell, also allows for files/lists to be sorted without having to open them. I will cover that in a future post.

We will continue to delve deeper into AppleScriptAppleScrunix in future posts.

2 comments  ::  Share or discuss  ::  2011-04-29  ::  Russ Leseberg

The Birth of AppleScrunix

Thursday 31 March 2011 - Filed under automation + gaps + Technology

On March 24, 2001 Apple introduced it’s ‘Unix’ based version of Mac OS, Mac OS X. Steve Jobs said, “Mac OS X is the most important software from Apple since the original Macintosh operating system in 1984 that revolutionized the entire industry.” See Mac OS X Hits Stores This Weekend. The following 10 years saw Apple morph from has-been to has-it-all. Check out Adam Rosen’s fun piece chronicling the evolution of OS X, Welcome to Mac OS X: An Illustrated Introduction [10th Anniversary], on Cult of Mac.

While reinventing the Mac, Mac OS X also revitalized my favorite scripting language, AppleScript. In addition to providing “control of scriptable applications and of many parts of the Mac OS,” OS X gave AppleScript access to the power of Unix, and introduced me to what I like to call AppleScrunix.

AppleScript has long offered Mac power users a way to do what they love to do better and faster. Sal Saghoian, AppleScript Product Manager at Apple, and de facto king of AppleScript, rightly states in his book, AppleScript 1-2-3, that AppleScript is the “power to make the computer do what you want and need it to do for you.”

The mashup of Applescript and Unix, AppleScrunix, brings two automation powerhouses together, creating (arguably) the most powerful automation platform on the planet. A simple example can be illustrated by solving a common problem in scripting, that of creating a date/time string for the unique naming of files.

In order to create a date/time string to append to a file name consisting of Year, Month, Day, Hours (military time), Minutes and Seconds, such as 20110331155523

…straight AppleScript might look like this:

set cd to (current date)

set text item delimiters to ""

set dateTime to year of cd & text items -2 thru -1 of ("0" & (month of cd as integer)) & text items -2 thru -1 of ("0" & (day of cd)) & text items -2 thru -1 of ("0" & (hours of cd)) & text items -2 thru -1 of ("0" & (minutes of cd)) & text items -2 thru -1 of ("0" & (seconds of cd)) as string

…with AppleScrunix you can do this:

set dateTime to do shell script "date +%Y%m%d%H%M%S"

We will delve deeper into AppleScrunix in future posts.

 ::  Share or discuss  ::  2011-03-31  ::  Russ Leseberg

The Stranger in the Zebra Suit

Sunday 27 February 2011 - Filed under Branding + gaps + thoughts

When I got up this morning I had no idea who Daniel Rothamel, aka: The Real Estate Zebra, was. Less than 8 hours later… I started following him on Twitter, @RealEstateZebra, asked to connect on LinkedIn and found myself blogging about him.

Why… you ask? Spend a couple of hours reading what his friends and colleagues have to say about Daniel Rothamel and you will want to be his friend too.

Checking my Facebook account this morning I came across a post by long time friend, Jeff Turner: Pay Attention To Your True Brand. You might remember Jeff from my July 2009 post, Living Your Brand. As expected, I enjoyed Jeff’s post and found his insight refreshing. What I didn’t expect, is that I would spend the next several hours learning about Daniel Rothamel of Strong Team Realtors, a lawsuit and the social media storm that has followed.

Zebra-artGoogle Search = ‘zebra lawsuit’ turned up these images (*credits below)

Just 5 days ago, on February 22, 2011, Denise Lones, President of The Lones Group, filed a complaint and ‘Demand for Jury Trial’ against Rothamel and Strong Team. Beyond what The Lones Group must have imagined… while the District Court of Washington was processing the paperwork… the court of public opinion granted a speedy trial and a jury of their peers assembled overnight. What probably appeared black and white then, [Yes, I too have fallen victim to zebra imagery], must seem much more gray and uncertain now.

The Lones Group took a wrong turn long before they filed the lawsuit. As Jeff Turner pointed out in his post, they shifted focus from theirtrue brand to the words and images that simply represent it.” Urs E. Gattiker, in his ComMetrics post, Brand vs. Reputation, cites Jeff Bezos, the founder of Amazon, “Your brand is what people say about you when you are not in the room,” and Richard Branson, founder of Virgin Airways, “Build brands not around products but around reputation.” At this point, I doubt The Lones Group has any misgivings about what is being said when they “are not in the room.”

Regardless of what ultimately happens with the lawsuit, Denise Lones and company has managed to do some good. They have helped strengthen Daniel Rothamel’s brand, grow his circle of friends and ignite a popular twitter meme… #SaveTheZebra. They’ve inspired his supporters to speak out thru Facebook, YouTube, and countless blog posts/comments. Their actions even lead to the creation of a fund for Daniel’s legal defense. And last but not least… without Denise Lones grossly underestimating how truly connected and small the world has become… I might not have met Daniel Rothamel, our friend in the Zebra Suit.


* Image Credits…
Left: Pic of Daniel from Chris Brogan’s post: Are Zebras Endangered
Right-top: Pic of Zebra from Mariana Wagner’s post: The Lones Group Files a Lawsuit Against Strong Team REALTORS® Over a Fricken’ Zebra Stripe?
Right-2nd-from-top: Pic of Sign from WannaNetwork.com’s page: The Lones Group vs Daniel Rothamel – Posts, Twitter Updates & Links
Right-3rd-from-top: Pic of Zebra on Laptop from Ashley Drake Gephart’s post: The Lones Group: a “case” of online reputation
Right-bottom: Pic of Zebra Pattern from Benn Rosales’ post: Would the real Zebra, please stand up? Realtor, blogger, sued

Tagged: » »

2 comments  ::  Share or discuss  ::  2011-02-27  ::  Russ Leseberg