flickerbulb

soho zombie, slave to the man, code monkey, lover & hater, and, one downright good looking bastard.

post netnewswire item to delicious bookmarks applescript

for blog reading i use the amazing (and free!) software from newsgator called NetNewsWire.

i discovered an applescript for posting post currently being read to my delicious bookmarks.

this was pretty good as it was, but, but i wanted a bit more, so i modified it to prompt for additional tags.

i have also added support for growl notifications, if growl is running.

when you run the script for the first time, it prompts you enter your username, password, and default tags.

you only need to enter that stuff once: after that it just runs.

additionally, i set up a quickilver trigger to run when i push “control + d”, scoped only to NNW.

so, now every time i wish to save whatever it is i am reading in NNW, i just hit “control + d” and it prompts for tags, then runs in the background.

its fast and works great.

to use it yourself, copy the script below and open the Script Editor (included in mac os x).

paste it in, and save it to:

~/Library/Scripts/Applications/NetNewsWire/to read in delicious.scpt

 
property usernamePasswordString : ""
property tagsString : ""
 
on run
	checkUsernameAndPassword()
	postToDelicious()
end run
 
on postToDelicious()
	tell application "NetNewsWire"
		if exists selectedHeadline then
 
			set theResults to display dialog "Enter tags for this item" default answer ""
			if button returned of theResults is "OK" then
				set myTags to text returned of theResults
			end if
 
			set thisHeadline to (title of selectedHeadline)
 
			set u to "\"?&url=" & (URL of selectedHeadline) & ¬
				"&description=" & (title of selectedHeadline) & ¬
				"&tags=" & tagsString & " " & myTags & "\""
			set curlStatement to "/usr/bin/curl -u " & usernamePasswordString & " -d " & u & " https://api.del.icio.us/v1/posts/add"
			set retValue to do shell script curlStatement
			if retValue contains "wrong" then
				display dialog "Headline did not post to Delicious. Something went wrong."
			else
 
 
 
				set the enabledNotificationsList to ¬
					{"Item Posted to Delicious"}
 
				tell application "System Events"
					set growlRunning to ¬
						(count of (every process whose name is "GrowlHelperApp")) > 0
				end tell
 
				if growlRunning then
					tell application "GrowlHelperApp"
 
						register as application ¬
							"scriptNetNewsWire" all notifications enabledNotificationsList ¬
							default notifications enabledNotificationsList ¬
							icon of application "NetNewsWire"
 
						notify with name ¬
							"Item Posted to Delicious" title thisHeadline description "Posted to Delicious with tags: \"" & myTags & ¬
							"\"" application name "scriptNetNewsWire" icon of application "NetNewsWire"
					end tell
				end if
 
			end if
		else
			display dialog "Please select a headline to post to del.icio.us"
		end if
	end tell
end postToDelicious
 
on checkUsernameAndPassword()
	-- Check to see if the file where our username and password are stored exists
	try
		do shell script "cd " & POSIX path of (path to preferences as text) & "; ls | grep com.flickerbulb.toread.txt"
		try
			set prefFile to ((path to preferences as text) & "com.flickerbulb.toread.txt")
			open for access file prefFile with write permission
			set prefs to read file prefFile using delimiter {return}
			close access file prefFile
			set usernamePasswordString to item 1 of prefs
			set tagsString to item 2 of prefs
		on error e
			close access file prefFile
		end try
	on error
		set username to text returned of (display dialog "Please enter your Delicious username" default answer "username")
		set pass to text returned of (display dialog "Please enter your Delicious password" default answer "password")
		set tags to text returned of (display dialog "Please enter any desired default tags" default answer "toread ")
		try
			set prefFile to ((path to preferences as text) & "com.flickerbulb.toread.txt")
			open for access file prefFile with write permission
			set eof of file prefFile to 0
			write username & ":" & pass & {return} & tags to file prefFile
			close access file prefFile
		on error e
			close access file prefFile
		end try
		set usernamePasswordString to username & ":" & pass
		set tagsString to tags & " "
	end try
end checkUsernameAndPassword

Tyler Durden’s 8 Rules of Innovation

“It’s only after we’ve lost everything that we’re free to do anything.”

Oh, yeah… don’t be afraid to make big mistakes. More importantly, don’t worry about everything going according to plan. In fact, if everything’s going according to plan, there’s a good chance nothing remarkable is getting done.

They say life is what happens while you’re making other plans. Innovation is what happens when you recognize when to change the plan and perhaps the entire game. Maybe your initial plan falls apart, or maybe you simply need to throw the current plan away.

Don’t let the plan restrict the freedom to have a game-changing idea, and act on it, at any time. Losing everything may be the best thing that ever happens to you.

Tyler Durden’s 8 Rules of Innovation | Lateral Action

“Could You Explain Programming Please”

Being a programmer and the only computer literate person in my family, I get tech support calls from my family all the time. I got a phonecall from a brother-in-law today:

Him: Hey, you’re good with computers right?

Me: Yes.

Him: And you know how to program computers?

Me: Yes, thats my job actually.

Him: Could you explain programming please?

Me: I’m sorry, what do you mean?

Him: I want to make a game like Halo, but I don’t know how to start. Could you explain what I need to do?

Me: You should probably go to the library and get a book.

Him: Can you just tell me what I need to do?

Me: Wait a minute. Are you asking me to explain how to program computers?

Him: Yeah.

Me: Over the phone?

Him: Yeah.

My brother in law apparently made several unsuccessful attempt to “learn programming” by opening up exes in Notepad. He created a text file with the words “Morph the screen into something cool” and couldn’t figure out how to run it, even had the balls to ask me “how do I install my program? Do I just put a shortcut on the desttop”.

My dad, a programmer, lent him an unfortunately titled book called “Teach Yourself Java in 24 hours”. He immediately flipped to the back of the book and reading sections on server and Swing development, and was very excited to see that he could write his own server after just one day.

In the end, I was unable to teach my brother in law how to make his own Halo over the phone, and he decided that I wasn’t a very good programmer.

The Daily WTF – “Could You Explain Programming Please”

holy cow is this me

Once you get into flow it’s not too hard to keep going. Many of my days go like this: (1) get into work (2) check email, read the web, etc. (3) decide that I might as well have lunch before getting to work (4) get back from lunch (5) check email, read the web, etc. (6) finally decide that I’ve got to get started (7) check email, read the web, etc. (8) decide again that I really have to get started (9) launch the damn editor and (10) write code nonstop until I don’t realize that it’s already 7:30 pm.

Fire And Motion – Joel on Software

embedding quicktime movies

the once-and-for-all best way to put quicktime in an HTML document:

<script src=“/_Assets/scripts/AC_QuickTime.js” language=“JavaScript” type=“text/javascript”></script>

<script language=“JavaScript” type=“text/javascript”>
  QT_WriteOBJECT_XHTML('/userfiles/Media/IMTA_MTA.mov', '290', '208', '',
    'autoplay', 'false',
    'emb#bgcolor', 'silver',
    'align', 'middle');
</script>

,

Before you go