Friday, January 2, 2015

Mac OSX Context Menu FTP Upload

If you’ve ever wanted to know how to FTP a file to a remote server via a right-click context menu in OS X, then continuing reading! As a bonus, I’ll add a desktop notification once the upload is completed.

What you will need:

  • Mac OS X
  • Automator
  • Curl
  • Remote FTP server, and client
  • Ruby (for desktop notification via terminal-notifier)


The first thing you want to do is install the terminal-notifier so you can receive desktop alerts after your upload is completed. Ensure you have Ruby installed, and then run the install command from Terminal.

sudo gem install terminal-notifier

Next, make sure your have a remote directory to upload your files too. I used FileZilla as my FTP client to create a remote directory on my website, named “shared”. I won’t go in depth into creating remote directories on FTP servers. If you need me to, please comment below.

Next, we use Automator to create a shell script that we can use to upload our files to our newly create FTP directory. In your Applications folder, open the Automator App. Select the ‘Service’ as your document type.

Under ‘Actions’ look for the ‘Run Shell Script’ option (alternatively you can use the search box to type in ‘run shell script’). In the script editor drop down the ‘Service receives selected’ menu and select “file and folders”

In the ‘Run Shell Script’ editor paste the following script:

for f in "$@" 
 fileName=$(basename "$f")
 printf "Uploading file: $f \n FILENAMED: $fileName \n\n"
 curl -u [username]:[password] “ftp://[your ftp site]/[directory]/$fileName" -T "$f"
 terminal-notifier -message "Upload of $f to FTP completed" -title "Upload Status" -open "http://[your ftp site]/[directory]/$fileName"


Replace the following text with your own:
  • [username] : your FTP site’s user id 
  • [password] : your FTP site’s password 
  • [your ftp site] : your FTP site’s URL 
  • [directory] : the folder path you plan on uploading files too
When you’ve configured the script, and saved it, you’ll be prompted to give it a name. I’ve named mine “Upload to FTP”. When finished you should have a new menu option on your Finder’s right-click context menu. When you right-click a file and select “Upload to FTP”, the file will be uploaded to your FTP site’s folder!

Thanks to the following sites I used for reference:


Tuesday, May 19, 2009


I ran into an interesting challenge today. I had some conditions that needed to be met in order for me to add an item to a drop down box.

Here are the conditions:

1. When ActiveOnly flag is true, then only add items that are active.
2. When ActiveOnly flag is false, add all items.

Ok, I know it seems simple, and it was very easy to write this as an if statement. This is what I started with:

} else {

Ok that gets the job done, but it doesn't look very elegant, and I've repeated my insert code twice.

After looking at this a while, I decided that there had to be a better way to write that code, so I did a classic truth table:

ONLY -------------
ACTIVE | T | F |
| T | T |

Basically indicating to me that the only time that I DON'T want to write a value is when ONLYACTIVE = true AND ACTIVE = false.

At this point this is starting to look like an opportunity for a specification pattern but I'm trying to just get the job done AND I didn't want to over kill it. Thinking in terms of specifications does shed light on how we should think about this test. If the ONLY time we DON'T write a value is when ONLYACTIVE = true AND ACTIVE = false, then shouldn't we TEST to see if this CONDITION is TRUE?

This is the final if statement result:

if(!(activeOnly && !item.IsActive)){

Now isn't that less smelly??

Tuesday, June 24, 2008

Facebook MVC


Welcome to Facebook MVC!

Obviously, if you were able to find this article you are interested in developing Facebook applications using the Model, View, Controller (MVC) design pattern! If this is truly what you'd like to do then you've come to one of the right places!

There are a few things that you'll need to have before you can get started.

1. Visual Studio 2008
2. ASP.NET MVC Preview 3
3. Facebook Developer Toolkit 1.6
4. My Facebook Developer Toolkit MVC Addon

The focus of this article is on how to setup a Facebook application using a MVC approach using ASP.NET. The Facebook Developer Toolkit (FBDT) is a great resource for people that are interested in developing a Facebook .NET application. FBDT is basically a .NET wrapper of the Facebook API. Unfortunately, the current approach taken by the FBDT for building web applications is straight WebForms & as such they use a class inheritance model which does not support an ASP.NET MVC application easily. The Facebook Developer Toolkit MVC Addon, makes supporting a Facebook ASP.NET MVC application a bit easier by adding support for web.config based configuration, & pre-controller-execution FacebookAPI setup via an Action Filter.

Please bear with me as I add more details to this article & to CodePlex

Monday, June 23, 2008


I've completed the code for my Facebook Developer Toolkit & ASP.NET MVC Preview 3 integration toolkit!

I know that nobody in the world would even read this - yet - but I'm excited about it!

I've made it RIDICULOUSLY easy! I've added support for iFrame & FBML applications and all you have to do is add an ActionFilterAttribute to your Controller Action!

The code looks something like this:

public ActionResult Index(Facebook.API.FacebookAPI facebookAPI)

After that you have complete access to the FacebookAPI that is part of the Facebook Developer Toolkit (FBDT).

Nick Berardi started trying to do the same thing with the FBDT but realized that they had an inheritance model for getting ASPX pages to work correctly which doesn't work well with microsoft's MVC model . He moved to the Facebook.NET framework because it was more object based. I feel like I've created a better domain model for the FBDT!

note: I was originally going to base my MVC implementation on Castle's Monorail since Microsoft's MVC teams is working with the folks at Castle. I did have some issues with getting both MVC frameworks to work correctly in a shared-hosting environment but ultimately Microsoft's MVC architecture had an easier fix...I get into it more when I write my real article...this is just me being excited that I'm done with my first version and Xodel (my software development company) can release some real software for the first time since I created it!

Wednesday, June 18, 2008

ASP.NET MVC & Facebook

I'm working on an MVC Facebook Application. It's been an interesting journey so far. I'll I be posting the details here.