Archive for February, 2012

Autocopy links of files uploaded to Dropbox public folder with a folder action

This tutorial is largely based on this post on the Dropbox forums, all credit on the script goes to the original author Christian G.

My contribution is that this script also invokes a Growl message (thus, you will need Growl installed) also, the # character is replaced by %23 (because Dropbox does not like it much)

Here goes the script :

on adding folder items to this_folder after receiving added_items
	try
		set the item_count to the number of items in the added_items
		if the item_count is equal to 1 then
			set theFile to item 1 of added_items
			set theRawFilename to ("" & theFile)

			set tid to AppleScript's text item delimiters
			set AppleScript's text item delimiters to ":"
			set theFileName to (text item 6 of theRawFilename) as text
			set AppleScript's text item delimiters to tid

			set theWebSafeFileName to switchText from theFileName to "%20" instead of " "
			set theWebSafeFileName to switchText from theWebSafeFileName to "%23" instead of "#"

			set theURL to "http://dl.dropbox.com/u/YOUR_DROPBOX_ID/" & theWebSafeFileName
			set the clipboard to theURL as text

			tell application "GrowlHelperApp"

				set the allNotificationsList to ¬
					{"Public URL"}

				set the enabledNotificationsList to allNotificationsList

				register as application ¬
					"CopyDropboxURL" all notifications allNotificationsList ¬
					default notifications enabledNotificationsList ¬
					icon of application "Dropbox"

				notify with name ¬
					"Public URL" title ¬
					"Dropbox Public Folder Updated" description ¬
					(theURL & " copied to clipboard.") application name "CopyDropboxURL"

			end tell
		end if
	end try
end adding folder items to

to switchText from t to r instead of s
	set d to text item delimiters
	set text item delimiters to s
	set t to t's text items
	set text item delimiters to r
	tell t to set t to item 1 & ({""} & rest)
	set text item delimiters to d
	t
end switchText

How to use this

First of allyou have to know your Dropbox user ID and change the YOUR_DROPBOX_ID to it. This is the number that appears after /u/ in your public Dropbox links.

Now open the apple script editor and save this script into Macintosh HD/Library/Scripts/Folder Action Scripts as CopyDropboxURL.scpt.

Next navigate to your Dropbox public folder in finder, right click (or ⌘-click) it. Choose Services->Folder Actions Setup… from the menu. In the menu that opens choose the CopyDropboxURL.scpt.

Beijing Soup

I’ve been searching for this recipe for quite a long time. Finally I got hold of it thanks to my brother. And due to popular demand here is the recipe complete for one of the best soups out there. So… without further delays.

Ingredients

  1. One whole chicken
  2. Shiitake mushrooms (dried)
  3. Black mushrooms (dried)
  4. A carrot
  5. Bamboo sprouts
  6. Two eggs
  7. Soy sauce
  8. Rice vinegar
  9. Sambala sauce
  10. Tapioca starch
  11. Salt
  12. Whole black pepper
  13. Chicken bouillon cube

Preparation of ingredients

Hint : I recommend reading the whole recipe first as some of the steps can be done at the same time.

It is best to begin by dipping the mushrooms in warm water (shiitake and black mushrooms separately) as it takes about 30 minutes for them to soak well. The longer the better. After they have soaked cut the shiitake to small pieces.

Cut off the legs and breasts of the chicken, put them aside we will not be needing them for this meal.

Clean the carrot and cut it to small pieces. Cut the bamboo sprouts as well.

Crack the two eggs into a bowl and scramble them.

Cooking

Heat about 1.5L of water, salt it, put in a dozen of grains of the whole pepper and put the chicken inside. Cook for about 45 minutes.

Take the chicken out and put the bouillon cube as well as the mushrooms (both), carrots and bamboo sprouts inside.

Cut off all of the meat from the bones of the chicken and put it back into the soup (the meat, not the bones).

Cook for about ten minutes, then add two table spoons of vinegar, three table spoons of soy sauce and two spoonfuls of Sambala sauce (or more, if you wish the soup to be more spicy).

Cook for another 10 minutes, afterwards add in the eggs and stir well. Finally prepare two spoons of tapioca starch in a bowl – add a bit of water and mix until all of the starch has diluted. Then add the mix to the soup. Cook for about 10 minutes and you are done.

Afterword

The soup is to be eaten very hot. If you do not have chicken you can use more bouillon cubes instead (still, it is much better with real meat).