Ok, Uncle Steve says I shouldn't worry, this is all cached geolocation data for my own good.
But those dots and locations in France are where I had all Data usage explicitly turned off. And it still gathered them: how? (if I am to believe no-data-usage-was-enabled)....
2011-05-01
2011-01-14
Mac OS X Services are completely Awesome, Especially since you can make your own with Automator
The “Services” menu option (under the Application's menu for whatever's active) is not the best described thing about Macs. To be honest I've not had much to do with it so far. But this was a mistake: it's an incredibly powerful system-wide integration point allowing all sorts of cross-application functionality. And one of the reasons it's (relatively) hard to self-discover is because it's context-sensitive: Services only appear in the menu if they can be used. So just clicking randomly isn't going to let you know what you can get up to; try selecting some text first, and you'll find a bunch of stuff's become possible.
So I was a bit frustrated to find that an App I was using was happily let me type away, but couldn't tell me how many words or characters were in the document I was creating. Aha, I thought, I bet there's a way of writing some AppleScript to do that. AppleScript on it's own, though, requires some sort of mechanism to launch it; typically an App's got to have a scripting interface. It was this that got me pondering about using a system-wide Service instead.
Reading up on t'internet I found a myriad of ways of creating a new service, some of which looked quite complicated and some required 3rd party applications to make it all happen. However, each copy of OS X comes not only with AppleScript built in, but since 10.4 the rather nifty (if a little looked-down-upon by real developers…) Automator Drag-and-Drop automation creator. In addition to very handy stuff like making writing custom app launchers laughably easy (e.g. I've got an App that needs a particular CD loaded before it'll run, so I've got an App Launcher that checks for it being mounted before launching), and the much praised “Folder Actions” type (that lets very nifty stuff happen when files are created or moved into particular folders), Automator can be used to create Services.
So with that in mind, here's how I created a Word Counter service that will count the words and characters in any selected text, in any application, at any time:
Worked Example: Creating and testing a Word Counter Service with Automator
Acknowledgements: I don't know enough AppleScript to write my own unaided yet. So the actual code that does the work was adapted from examples at Use AppleScript to count words and characters in text
- Launch Automator (Applications → Automator)
- Choose the “Service” Template for your new Workflow:
- In the “Actions” Search box, type “Apple”, then drag “Run AppleScript” to the main Workflow window:
- Make sure that the Service options are set appropriately, and add the code to the AppleScript window that actually performs the calculation & displays the Alert Box:
on run {input, parameters} set wc to count words of (input as string) set cc to count characters of (input as string) display alert "Selection contains " & wc & " Words and " & cc & " Characters" as informational return input end run
- Now the "Gotcha". You can use “Run” to test the Workflow, but because it's a Service you'll receive this warning:
- Rectify the error by inserting a “Get Specified Text” action before the AppleScript and supply some test text to word count:
- Once you're happy with how the Workflow operates, remove the Get Specified Text action and then do File → Save As (calling the Service “Word Count”) to save the Workflow as a Service.
- You can close Automator now, we're done with that.
- Go to another application, select some text, then do (Application) → Services → Word Count:
On my iMac there's a short delay between selecting the Service and the alert box appearing. This indicates to me that we're probably not using the most efficient way of creating or calling a Service. But I'm fairly confident that's it's the quickest and simplest way of doing it, and my time is much more valuable than the computers.
Other Useful Services Ideas
ROT-13
I got some email with ROT-13 text in, which irritated me as Mail.App has no way of converting. A little Googling got me this thread: Re: Simple rot-13 encoding script …Which I turned into a Service using exactly the same steps as in the previous example, but with the following AppleScript action:
on run {input, parameters}
set inString to input as string
if length of inString is 0 then
set inString to "(abguvat fryrpgrq)"
end if
set outString to ""
set plainChars to "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
set rotChars to "nopqrstuvwxyzabcdefghijklmNOPQRSTUVWXYZABCDEFGHIJKLM"
considering case
repeat with x from 1 to count inString
set offsetNum to offset of (character x of inString) in plainChars
if offsetNum > 0 then
set outString to outString & character offsetNum of rotChars
else
set outString to outString & character x of inString
end if
end repeat
end considering
display alert outString as informational
return input
end run…I'd be happier with some other way of displaying the text, because an Alert Box is going to run out of space and I don't think you'll get scroll bars. Ideally you'd replace-in-context with the ROT-13 text, but I think support for that is application-specific.
Also note that lame attempt at error handling (the
if length of inString is 0 clause). I wanted to handle the case of no text being supplied to the Service by popping up a message to that effect (I ROT-13 encrypted ”(nothing selected)” for the script to decode instead). However, as noted above, the Services are context sensitive so you should never be able to select the ROT-13 (or Word Count) services unless their input condition (some text is selected) is met.As a side note, I had some difficulty with this Action based on my not really knowing what I was doing. Using the
input parameter directly was causing All Sorts Of Aggro, so I decided to explicitly cast it to string (calling it inString) in the process. Debugging AppleScripts within a Workflow is very limited; running the Workflow just gives you an error message which it's up to you to work out. You can run just the AppleScript itself by clicking the green arrow in the AppleScript action, but this doesn't do anything to get you up to the start point, so there's no input to the string (which was the genesis of my efforts to supply some default within the script)). However, this will at least highlight the offending statement in the code and gives you a much better chance of resolving the problem.Here's one that's even easier to create: Get your Mac to use the inbuilt TTS capabilities to speak whatever text is currently selected. No AppleScript is required for this, as there's a built-in action called “Speak Text”. Note in the screenshot below I've added a “Get Specified Text” action for testing purposes which I'll remove before doing File → Save As and calling it “Speak Selected Text”. It's well worth playing around with the different available Voices, some of which are quite bizarre…
2011-01-11
No more The Daily Show? More4, I Am Disappoint.
More4's only decent show, The Daily Show with Jon Stewart, is going from 4 nights a week to the once-per-week highlights show (Global Edition). Source.
TDS was the only reason for More4 to exist, as far as I'm concerned. Their justification for chopping it is particularly ironic:
Or in other words, their commitment to "high end" US TV means they've dropped the high-end US programme in favour of a rehash of a broad UK drama. Marvellous.
If you don't like this decision, you can complain here (I have).
TDS was the only reason for More4 to exist, as far as I'm concerned. Their justification for chopping it is particularly ironic:
More 4 have said that the reason for this is that it wants to concentrate on ‘high end’ American programming.To this end they have purchased and intend to show the US version of Shameless!
Or in other words, their commitment to "high end" US TV means they've dropped the high-end US programme in favour of a rehash of a broad UK drama. Marvellous.
If you don't like this decision, you can complain here (I have).
The Sound of Silence
Hey, nobody said I had a commitment to Blog, did they?
Still, I'm having fun playing with all these lovely new Mac toys...
2010-11-25
Those who know me...
...Will know that, unlike most of my countrymen, I do *not* regard this as a feature of the hotel room, but a Bug.
At least I've still got 3G on this side of the hotel. Unlike some others I've spent too long in this year...
2010-11-08
Same as it Ever Was...
I see our glorious leadership are standing firm to their previous positions to be for civil liberties and against nanny-state intrusion as they promised.... Oop, my mistake it turns out they're listening to the Spooks after all.
When people communicated through the telephone, and before that through letters, or face-to-face, there was an asymmetry of effort required that provided some assurance of privacy: the costs of interception were high enough that you wouldn't bother unless you had a vested interest. In the case of the State that meant some level of reasonable suspicion of malpractice or bad intent that could justify the efforts to intercept. Under these conditions, there is a reasonable expectation that if you're not up to harm, there's no interest in tracking what you're doing and there's therefore an expectation of some level of privacy. Put even more bluntly: I don't see armies of public employees steaming open envelopes in huge back-room offices, therefore I can assume that my letters aren't getting read.
But intercepting internet traffic is laughably easy, for a state organisation. It's not exactly difficult for the general public - see FireSheep for example. This reduces the asymmetry considerably. And the temptation to exploit this must be tremendous for those responsible for our collective safety.
My objections to this are twofold:
So why does Big Brother need to track it at all? Is it really just as simple (and stupid) as "Because We Can?" Sadly, it probably is. That and the fear that comes from living in a world where failure to plan for the worst is punishable in the court of public opinion...
And on that point, I'd say this: Yes, I am happiest if The Greatest Good For The Greatest Number means the odd nasty event. Privacy for all is more important than slightly increasing the chance of preventing the next mindless atrocity.
(I must admit I thought the incoming administration shared this point of view, to some extent, based on pre-election posturing and statements. More fool me for believing them, I guess)
When people communicated through the telephone, and before that through letters, or face-to-face, there was an asymmetry of effort required that provided some assurance of privacy: the costs of interception were high enough that you wouldn't bother unless you had a vested interest. In the case of the State that meant some level of reasonable suspicion of malpractice or bad intent that could justify the efforts to intercept. Under these conditions, there is a reasonable expectation that if you're not up to harm, there's no interest in tracking what you're doing and there's therefore an expectation of some level of privacy. Put even more bluntly: I don't see armies of public employees steaming open envelopes in huge back-room offices, therefore I can assume that my letters aren't getting read.
But intercepting internet traffic is laughably easy, for a state organisation. It's not exactly difficult for the general public - see FireSheep for example. This reduces the asymmetry considerably. And the temptation to exploit this must be tremendous for those responsible for our collective safety.
My objections to this are twofold:
- There's a step-change in civil liberties here, from a position of "Innocent until proven guilty" to "if you've done nothing wrong you've got nothing to hide". With the implicit assumption that if you've got something to hide, or even to obscure, you're guilty of something.
- I don't trust the government. Or any large organisation for that matter. Not necessarily that they'll abuse the information they're gathering - I think it's done openly enough that they probably are being mostly honest about the whats, whys and wherefores. No, I distrust their ability to secure that information and prevent it's leaking to other parties that would abuse it for their own means. IT Security is hard, and I've yet to see anyone demonstrate a convincing lock-down mechanism invulnerable to leak through malice or even simple cock-up.
So why does Big Brother need to track it at all? Is it really just as simple (and stupid) as "Because We Can?" Sadly, it probably is. That and the fear that comes from living in a world where failure to plan for the worst is punishable in the court of public opinion...
And on that point, I'd say this: Yes, I am happiest if The Greatest Good For The Greatest Number means the odd nasty event. Privacy for all is more important than slightly increasing the chance of preventing the next mindless atrocity.
(I must admit I thought the incoming administration shared this point of view, to some extent, based on pre-election posturing and statements. More fool me for believing them, I guess)
2010-10-31
(Sane) Americans +1, British Politics -10
So this week we've had a Big Huge Scare about bombs in cargo. And two comedians held the sanest rally for a long time in Washington (complete with some excellent banners).
The two are linked in my mind: Over there, in the land of black and white and who shouts wins, there appears to be a growing movement that's saying: "Wait, I think you'll find it's a bit more complicated than that. We'll need to think and act rationally to get past this". Over here, we've got the land of Swinging Cuts and We're All In This Together But Some Of You Are More In It Than Us. And the reverse side of that is: oh please cut them, but not me. Which goes all ways.
Far be it from me to question either the media or our beloved masters in power, but I know that if I was genuinely interested in defeating terrorism, I'd stop letting bastards and twerps terrorise me. Sure, bad things happen and bad people cause them. But we *found* these bombs, and I guarantee you it wasn't a lucky search - someone somewhere said something to someone who could do something about it. This is the way intelligence works in the real world - it's very very boring and we normally only ever find out about it when it goes wrong (which, being a human institution, it's bound to every now and again). This feels different: this feels like someone *else* has taken a deliberate decision to let the populace know just how much danger they're in, and how much they need more security blankets passing out. I note even now that our beloved Home Secretary has announced "a review" and I'm damn sure it won't come back with a "meh, bad things happen, we caught it, it's good enough" conclusion.
Oh no, not now. When the choice is between behaving rationally and refusing to be frightened or to cause others to become more fearfull, and shouting loudly at the top of our voices how terrible things are and how you must give more money and power to those trying to stop it, I know which way the wind is blowing.
On this side of the pond we've still got a way to go downhill into shouty polarising idiocy before we can think about rallying our Sanity.
The two are linked in my mind: Over there, in the land of black and white and who shouts wins, there appears to be a growing movement that's saying: "Wait, I think you'll find it's a bit more complicated than that. We'll need to think and act rationally to get past this". Over here, we've got the land of Swinging Cuts and We're All In This Together But Some Of You Are More In It Than Us. And the reverse side of that is: oh please cut them, but not me. Which goes all ways.
Far be it from me to question either the media or our beloved masters in power, but I know that if I was genuinely interested in defeating terrorism, I'd stop letting bastards and twerps terrorise me. Sure, bad things happen and bad people cause them. But we *found* these bombs, and I guarantee you it wasn't a lucky search - someone somewhere said something to someone who could do something about it. This is the way intelligence works in the real world - it's very very boring and we normally only ever find out about it when it goes wrong (which, being a human institution, it's bound to every now and again). This feels different: this feels like someone *else* has taken a deliberate decision to let the populace know just how much danger they're in, and how much they need more security blankets passing out. I note even now that our beloved Home Secretary has announced "a review" and I'm damn sure it won't come back with a "meh, bad things happen, we caught it, it's good enough" conclusion.
Oh no, not now. When the choice is between behaving rationally and refusing to be frightened or to cause others to become more fearfull, and shouting loudly at the top of our voices how terrible things are and how you must give more money and power to those trying to stop it, I know which way the wind is blowing.
On this side of the pond we've still got a way to go downhill into shouty polarising idiocy before we can think about rallying our Sanity.
Subscribe to:
Posts (Atom)






