Sunday, November 11, 2012

Parrot Bluetooth MKi Series Remote Control Functions

Did Parrot create the most complicated automotive Bluetooth system remote control on the market today?

I made the following diagram to show the functions of the remote.  Now you be the judge:


Technically (if you consider the up and down actions of the jog shuttle knob to be equivalent to separate + and - buttons) this is an 8 button remote control.  Many buttons also have a secondary function if you hold them down for 2 seconds as opposed to simply pressing and releasing them (for example, pressing and holding down the jog knob toggles the dim night mode on the display.)

Would you like a PDF with this graphic in higher resolution so you can learn to use your remote? I created one here for you to download.

Wednesday, August 22, 2012

How to Flatten a Folder Structure in AppleScript

Introduction (i.e. The Problem)
You can skip this introduction if you already understand the problem and are trying to solve the same issue.  Just start at Describing the Solution.

Ok, so recently I was given a large archive of files.  These were old automated backups that I had nothing to do with in the past.  They were stored in individual directories.  The directories each had a name that indicated the date the backup was run.  Inside the directories were one or more files that indicated a time that the backup was started.  It looked a bit like this:


The above is much smaller than the actual directory but it gives you an idea.  There was a single top folder called "archive" that contained all the subdirectories (or folders.)  Each subdirectory had a date as the name in Year-Month-Day (yyyy-MM-dd) format separated by hyphens.  Under each directory was one or more files.  The files had names that indicated when their particular backup started in Hour-Minute-Second (HH-mm-ss) format separated by hyphens.

Now I had to run a batch application on every .bkp file to create a summary of each change for audit purposes.  This application could take an entire directory of .bkp files and generate the needed report.  It had one shortcoming though, it could take a single directory as its input and would look for every .bkp file but it was not recursive.  Meaning it would not check subdirectories.  That means I could manually point it to each "date" directory such as "02-03-2010" but not to the top level "archive" directory.  As there were over 500 "date" directories I really didn't want to have to do that manually.

Describing the Solution
What I needed was a way to move every .bkp file stored under a date directory up one level so the files were under the top level "archive" directory.  Then I could just point the batch application to the "archive" directory and it would run though every file.

However, in moving the files that only had the time as their name such as "11-00-00" out of its sub directory I would lose what date it was created on.  I'd rather not lose that information.

Even worse you can see several .bkp files have the same name so they could not all be moved into the top level directory without name conflicts.

What I needed was to prepend the subdirectory name such as "02-03-2010" to the .bkp filename so the filename was actually "02-03-2010_11-00-00.bkp" (in this case I used an underscore "_" character as a separator between the folder and the file name.)  Then I could move the file up to the top level directory and not worry about name conflicts or files being overwritten.

Searching the Web for a Solution
Since I'm on a Mac this seemed like a perfect job for AppleScript.  As a good engineer never reinvents the wheel I figured I'm not the first person to run into this problem so I could probably find a solution out there and just reuse it.

I found this first:  Flatten folder structure via AppleScript | Macworld
This script basically worked but it didn't solve the problem of duplicate named files being moved into the same directory.  I needed something a bit more advanced.

I also found this:  Mac OS X Hints
But that didn't seem to work and still didn't address the naming issues.

Unfortunately I didn't find any workable solutions.

Creating Our Own Solution
Ok, so here's the solution.  Looking at some of the code for the two links I listed above I wrote the following script.


-- Select the folder in the front most window that you want to flatten before running
-- this script deletes the folders it flattens so it can destroy data!
--
(* Behavior…

Select Folder_Top in the front most Finder window, then run script…

Before:
-Folder_Top (type: folder)
--A   (type: folder)
---1  (type: file)
---2  (type: file)
--B   (type: folder)
---1  (type: file)
---2  (type: file)

After:
-Folder_Top (type: folder)
--A_1  (type: file)
--A_2  (type: file)
--B_1  (type: file)
--B_2  (type: file)

*)

tell application "Finder"
set this_folder to (selection as alias)
set this_folder_list to every folder of this_folder
repeat with i in this_folder_list
set this_file_list to every file of i
repeat with x in this_file_list
set theFile to (name of x)
set theFolderName to name of container of x
set name of x to theFolderName & "_" & theFile -- change "_" to whatever seperater string you want.
end repeat
set this_file_list_with_new_name to every file of i
move this_file_list_with_new_name to this_folder
-- delete i  (* uncomment this line to delete the subdirectories when done*)
end repeat
end tell


You should be able to copy and past this into the AppleScript Editor.  Then go into the Finder and select your top level folder.  Go back to the Script Editor and click Run.  If you trust the script uncomment the delete line and it will remove the empty subdirectories when it is done moving the files.  Good luck!

PS
I've received a couple of emails that this can be useful in preparing to batch process videos with Handbrake if you don't want to use the Handbrake CLI (Command Line Interface.)  I added a mention here so if anyone searches specifically on Handbrake folders in Mac OS X they will find this entry.

PPS
I was not able to figure out how to do this using the more simple Automator in Mac OS X.  I realize you can use Automator to call an AppleScript but that defeats the point here.  If anyone can implement this logic using Automator I'd love to hear from you.

Tuesday, June 12, 2012

Comparing Verizon shared data pricing


Ok so Verizon has announced its shared data pricing.  On June 28, 2012 you will now be able to share a data plan across multiple phones much like you already can share text messages or voice minutes (think like a “Family Share” plan.)

The question quickly becomes, for someone like me, that does have multiple phones on a single Family Share plan, will sharing the cost of data instead of paying for data on each phone save me money?

Here we go.

Let’s assume you have two smart phones (like an iPhone or an Android.)

On AT&T currently you would pay monthly:
$69.99 for 700 shared minutes with rollover minutes.
$30 for unlimited texting shared across all phones.
$30 for 3GB of data for your first phone.
$30 for 3GB of data for your second phone.

That’s a monthly cost of $159.99 and remember AT&T does not include a hotspot feature with the $30 a month data plan. 

On Verizon currently (without shared data) this same setup would look like this:
$69.98 for 700 shared minutes.
$30 for unlimited texting shared across all phones.
$30 for 2GB of data for your first phone.
$30 for 2GB of data for your second phone.

That’s a monthly cost of $159.98.  1¢ less than AT&T but 1GB less of data for each phone. Like AT&T, Verizon does not include a hotspot feature with the $30 a month data plan. 

Now let’s see how much Verizon with shared data will cost:
$70 for 4GB of shared data (you could go as low as 1GB for $50 but I tried to keep the plans close in data capacities)
$40 for unlimited minutes and text messages on the first phone
$40 for unlimited minutes and text messages on the second phone

That’s a monthly cost of $150.  A savings of just under $10 from the non-shared data plan.  And if you could drop your data to 1GB or 2GB you could save an additional $20 or $10 a month respectively.  Also it appears Verizon includes the Mobile Hotspot feature on the shared data plans which it didn’t with the non-shared data plan we chose above.

Let’s look at one other scenario that actually mimics my current phone plan:

Now let's assume you have two smartphones like an iPhone and one basic phone that has no data or texting.

On AT&T currently you would pay monthly:
$69.99 for 700 shared minutes with rollover minutes.
$30 for unlimited texting shared across all phones.
$30 for 3GB of data for your first phone.
$30 for 3GB of data for your second phone.
$9.99 for the non-smartphone.

That’s a monthly cost of $169.98.

On Verizon currently (without shared data) this same setup would look like this:
$69.98 for 700 shared minutes.
$30 for unlimited texting shared across all phones.
$30 for 2GB of data for your first phone.
$30 for 2GB of data for your second phone.
$9.99 for the non-smartphone.

That’s a monthly cost of $169.97.  1¢ less than AT&T but 1GB less of data for each phone.

Now let’s see how much Verizon with shared data will cost:
$70 for 4GB of shared data (you could go as low as 1GB for $50 but I tried to keep the plans close in data capacities)
$40 for unlimited minutes and text messages on the first phone
$40 for unlimited minutes and text messages on the second phone
$30 for the non-smartphone.

That’s a monthly cost of $180.  That’s an increase of $10 from the non-shared data plan. If you could drop your data to 1GB or 2GB you could save an additional $10 or break even with the monthly cost of the non-shared data plan.  Also it appears Verizon includes the Mobile Hotspot feature on the shared data plans which it didn’t with the non-shared data plan we chose above.

So what's the conclusion here?  If you have any non-smartphones on your shared plan it will probably cost you more to go to shared data because they are increasing the cost per phone. This may encourage people to move away from basic phones and use smartphones. I'm sure Verizon would like that as they make more off of smart phones. This is also reflected in their basic phone offerings. They barely offer any basic phones and often charge $80 or more for these phones that provide little functionality outside of making and receiving calls.  However, if you have all smartphones it looks like it might save you a little money.  Interestingly the differences are around $10 a month.  Those actuaries at Verizon juggled the numbers so no matter how you arrange your plan, they make pretty much the same amount of money but did you expect anything different?

My biggest disappointment is in how much a non-data basic phone adds to the monthly fee.  With the previous Family Share plan, that line was $9.99 a month.  With the data sharing plan (and remember this basic phone won't use/cannot access the data portion of this plan) that line now costs $30 month.  Another way to look at it is currently, an additional smartphone costs $9.99 + $30 for data whereas a basic phone just adds $9.99 per month.  On the new plan a basic phone costs $30 per month whereas an additional smartphone costs only $10 more at $40 per month.  You could look at it like you pay $30 per line (as opposed to $9.99) and $10 for data (as opposed to $30.)



You can view the Verizon shared data plan details yourself here.

Monday, June 04, 2012

When Naming a Group on Facebook, don't use & (an ampersand)

Although Facebook will happily allow you to create a group with an ampersand & in the name you cannot search on it.

Let's say, for example, you created a new Facebook group or page called:  "A and B - Sales & Service"

Then you typed the exact phrase "A and B - Sales & Service" into Facebook's search field.  You would be disappointed to find the search results are 0.

You see, the & is a valid character in a group or page name on Facebook, however, it breaks the Facebook search routine.  So, continuing with this example, if you instead typed "A and B - Sales" It would find your group successfully.

Something to keep in mind when naming your next product or interest on Facebook.