link · 20. May 2012 · Write a comment · Categories: Life

All the hoopla over Will Smith slapping a reporter who tried to kiss him on the lips, and all I could think was how easy he was on the reporter. I don’t care if kissing celebrities on the lips is the reporter’s “schtick.” It’s inappropriate, trying to kiss a complete stranger on the lips. It’s an invasion of personal space, an assumption of intimacy that doesn’t exist. Unlike so many gays I know, I don’t like kissing anyone on the lips unless I’m fucking him – or want to fuck him (which means I don’t want to kiss any women on the lips – no offense, ladies.)

19. May 2012 · Write a comment · Categories: Life

The NATO protests so far this weekend have been mild compared to NATO protests of the past. Of course, the delegates are only now starting to arrive – we could see far worse tomorrow and Monday. What gets me is that most (pretty close to all) of these protestors aren’t from Chicago. Chicagoans are pretty peaceful, laid back, quiet even. Chicagoans get upset about schools closing and buildings being constructed with non-union labor, not about an international summit that has the potential to help make Chicago a destination for international travelers (most of Chicago’s tourists are Americans).

I’ve been reading reports of the protests on local news sites. The protestors, including the local Occupy Chicago protestors, complain about how NATO and other international organizations ignore the poor, the “99%.” What the protestors don’t seem to realize is the damage they’re doing to the 99% right now. They’ve been marching through downtown in the hundreds the past couple of days, probably in the thousands tomorrow and Monday. They’ve been kept well out of sight of delegates arriving for the summit, and they won’t get anywhere near the summit site.

So what have they accomplished? They’ve managed to shut down the Loop – including hundreds of shops and restaurants owned by people in the 99%, small business owners who depend on the area’s hundreds of thousands of office workers and tens of millions of tourists a year to pay their bills and keep people employed. It’s a beautiful weekend in Chicago – we don’t get many of those. The streets should be packed with 99-percenters spending money, eating, taking pictures, and making plans to come back and spend more money. Instead, the protestors are clogging the streets and sidewalks – and not spending any money. Shops and restaurants are either closed or empty. They’re losing money on what would otherwise be a perfect spring weekend.

A hundred thousand people (including me) live in downtown Chicago. I was walking down the street earlier as a NATO motorcade passed enroute from airport to hotel. The police at every intersection were there only to stop cars at intersections so the motorcade could pass unhindered – they made no effort to stop me from progressing down the street. It’s not the summit that’s causing inconvience. It’s the protestors – the out-of-town protestors who have no respect for the people they’re inconveniencing in their efforts to get media attention.

I can understand the usefulness of protests in the Middle East and elsewhere, in countries where it’s the only way to be heard. We’ve seen over the past couple of years just how effective protests can be in those places. But in the US, where real change happens at the ballot box, these protestors in these numbers are doing more harm than good. And the harm is to the very 99% they claim to have rallied around.

link · 19. May 2012 · Write a comment · Categories: Life

This is what prison should be like. The prison has one of the lowest re-offending rates in the world (16% compared to 67.5% in the US), despite having some violent criminals (including murderers). It’s all about rehabilitation and training, and it’s paying dividends by releasing prisoners who become better neighbors. I’ve long felt the American penal system is all about revenge. We think throwing someone in a cage is justice, but prisoners eventually get released. Which would be better: bitter prisoners who have spent years or decades suffering abuses and indignities, or prisoners who learn how to support themselves and contribute to peaceful society?

aside · 15. May 2012 · Write a comment · Categories: Life, Technology

Is there really any legitimate reason to continue to have expiration dates on credit/debit cards? My card expired last month. The bank sent a new one with the same number but a different expiration date. I updated a number of accounts to charge the “new” card, but I’m still getting emails from creditors I forgot about complaining about declined charges. I’ll have to endure this again in three years. I can understand how expiration dates once might have been useful, back in the days of those paper credit card “machines,” but when everyone and their mother can validate a credit card via a cell phone, it just doesn’t make sense anymore.

08. May 2012 · Write a comment · Categories: Tips

One of the stupid features of Mac OS X Lion is it’s auto-locking feature – it locks files (by default) after 2 weeks so they can’t be edited without explicitely authorizing Lion to “unlock” the file. Can I call that “stupid” again?

Disable it in System Preferences > Time Machine > Options. (Oh, and putting it there is pretty stupid, too.)

Disable file locking in OS X Lion

As a followup to my previous post on creating a new file with Automator, I’m sharing some of the other Services I use. Simply follow the instructions in that post, replacing the code in step 5 with what’s provided below. Obviously, alter the other steps as appropriate. And keep in mind that you can add keyboard shortcuts to any of these following the directions in the previous post.

Insert Current Date/Time

This code creates a date in the format “Saturday, 5 May 2012, 21:51:55 CDT”. (CDT will be replaced with whatever time zone you’re in.) Change the “set date_ to” line to whatever format you prefer.

	set month_ to month of (current date) as string
	set wkday_ to weekday of (current date) as string
	set day_ to day of (current date) as string
	set year_ to year of (current date) as string
	set time_ to do shell script "date '+%H:%M:%S %Z'"
	set date_ to (wkday_ & ", " & day_ & " " & month_ & " " & year_ & ", " & time_)
	set the clipboard to the date_
	tell application "System Events"
		set frontmostApplication to name of the first process whose frontmost is true
	end tell
	tell application frontmostApplication
		activate
		tell application "System Events"
			keystroke "v" using {command down}
		end tell
	end tell

Open Terminal Here

This code launches Terminal and changes the directory to the current Finder folder.

	tell application "Finder" to set p to target of window 1 as string

	set x to POSIX path of file p

	tell application "Terminal"
		activate
		do script "cd '" & x & "'"
	end tell

Toggle Hidden Files

Sometimes you need to see files/folders that are hidden by default (such as those starting with a period). This will toggle the visibility of these files.

	tell application "Finder" to quit
	set OnOff to do shell script "defaults read com.apple.finder AppleShowAllFiles"
	if OnOff = "NO" or OnOff = "OFF" then
		set OnOffCommand to "defaults write com.apple.finder AppleShowAllFiles ON"
	else
		set OnOffCommand to "defaults write com.apple.finder AppleShowAllFiles OFF"
	end if
	do shell script OnOffCommand
	delay 1
	tell application "Finder" to launch

Toggle Function Keys

I do development and support work for a software package that relies heavily on function keys F1-10. When I’m working in that program, I need the function keys to function as, well, function keys. But when I’m not, I want to use the other functions assigned to those keys by OS X. I could use the “fn” key, but that’s an extra key to press. It’s easier just to toggle the functions of the function keys as needed. This code is the equivalent of going to System Preferences -> Keyboard and checking or unchecking:

	--Check if GUI Scripting is Enabled
	tell application "System Events"
		if not UI elements enabled then
			set UI elements enabled to true
		end if
	end tell

	--Enable/Disable "Use all F1, F2, etc. keys as standard function keys" option in Keyboard & Mouse Preference pane and close System Preferences
	tell application "System Events"
		tell application "System Preferences"
			reveal anchor "keyboardTab" of pane "com.apple.preference.keyboard"
		end tell
		click checkbox 1 of tab group 1 of window 1 of application process "System Preferences"
	end tell
	if application "System Preferences" is running then
		tell application "System Preferences" to quit
	end if

Note: Since this script relies on GUI Scripting, it can be broken by future OS updates, in which case you would have to modify the “click checkbox” line as appropriate.

 

You may have noticed that I use “do shell script” a lot in my AppleScripts. There may be ways to do the same thing using “pure” AppleScript, but I’ve spent a decade writing Unix/Linux bash/shell code, so it’s just quicker and easier for me.

Here’s how to create an Automator Service that will create a new file in the frontmost Finder window. It will be available from the Finder Services menu, and you can even assign a keyboard shortcut to it via the Services Preferences window.

NOTE: These instructions are for Mac OS X 10.7 (Lion). I have no idea if this works with other versions of OS X – and no way of testing it with anything but Lion.

1. Open Automator. When the document type dialog displays, select Service and click Choose.

Automator Document Type Dialog

2. In the new window that opens, change the “Service receives” dropdown to “no input” and the “in” drop-down to “Finder”.

Service Receives drop-down image

3. From the Actions column, locate the Run AppleScript action. (Hint: Use the search field at the top of the column to filter actions.)

Actions Column

4. Double-clicking on Run AppleScript will insert the shell of the action in the workflow.

Run AppleScript

5. Replace the “(* Your script goes here *)” line with the following code:

	try
		tell application "Finder" to set the this_folder ¬
			to (folder of the front window) as alias
	on error -- no open folder windows
		set the this_folder to path to desktop folder as alias
	end try

	set thefilename to text returned of (display dialog ¬
		"Create file named:" default answer "filename.txt")
	set thefullpath to POSIX path of this_folder & thefilename
	do shell script "touch \"" & thefullpath & "\""

	-- Resolves issue with window losing focus:
	tell application "Finder" to activate

Your window should look like this:

Service Window with completed script

6. Save the service and give it a name, such as New File. Keep in mind that whatever you enter as the name will appear in the Services menu.

Now, just open a folder in Finder and choose your service from the Finder -> Services menu.

Services Menu

When you run the script, you’ll be prompted for a name for the new file. The default “filename.txt” will be populated for you.

New File DialogClick OK, and the file will be created in the frontmost Finder window. If you don’t have a window (folder) open, it will create the file on the desktop. If the file already exists, it will not replace the existing file, but it also won’t warn you that the file already exists.

BONUS: If you want to assign a keyboard shortcut, from the Services menu, choose Services Preferences. Double-click next to your service name, where it says “none”. Then click the “add shortcut” button and enter the keystroke you want to use and press Return to save. I chose Ctrl-Option-Command-N because those three modifier keys are right next to each other, it’s an easy combination to remember, and it’s not likely to be in use by any other application.

Add Shortcut

Now you can create a new file with just a keystroke rather than using the Finder -> Services menu.

20. April 2012 · Write a comment · Categories: Life

20120420-120002.jpg

These tags are posted on trees all over my neighborhood. Which makes me wonder…how much wood, ink, and oil went into making hundreds of these larger-than-legal-sized, full-color tags and the plastic ties used to hang them? Surely there’s a more environmentally friendly way of pointing out how environmentally friendly trees are.