Tweets for 2009-03-27
- Finally got notification that my application for the Apple Developer Program went through – about three weeks after sending in the paperwork #
March 27, 2009
Tweets for 2009-03-27
March 23, 2009
Tweets for 2009-03-23
March 21, 2009
Tweets for 2009-03-21
March 19, 2009
Tweets for 2009-03-19
March 16, 2009
Tweets for 2009-03-16
March 12, 2009
Tweets for 2009-03-12
March 11, 2009
Heroes No More
Just finished watching the final episode of Heroes chapter 3. And I can see why a lot of people have been disappointed with the show lately.
I enjoyed the show in its first two seasons. I enjoyed the connections between the various characters and slowly learning about how they were all connected. Sure, the show had a Lost feel to it but it was still enjoyable. I cared for the characters and I laughed and cried with them.
Chapter 2 was not so good. There were cracks in the logic and things were beginning to feel not so cohesive. Yet, I liked the show because the characters were still (mostly) likable.
That’s totally gone with Chapter 3. All of the familiar characters are there but they are all twisted. You don’t find anybody to care for or to cheer for in the show anymore. Everybody is bad. Everybody has an evil side. Sure, I believe the intent was to show that there are no heroes or villains – that we have both heroes and villains inside all of us. But the way they did it ruined the show for me. Totally.
And that’s not even getting into the logic holes and continuity issues. Not to mention the time paradoxes. The thing with a show like Heroes is that the writers have to believe in the world they create. They have to believe that the world that they’ve imagined exists and it works according to a certain set of rules. That’s when you get a believable story that the viewer invests in.
If you think, “Hey, it’s just a comic book kind of thing. Anything can happen in a comic book!”, it just won’t work. There’s things like Ando moving Hiro’s eyelids for them to teleport. That belongs in a parody or a spoof, not a show that takes itself seriously. Come on now, how is that supposed to work exactly? If you were to believe somebody has the power to teleport, then you’re supposed to believe that that power is in his eyelids and anybody operating those eyelids (whether the owner of the said eyelids wants to or not) can teleport? That just boggles the mind … (Yes, I know I’m getting all worked up over a TV show :p)
There are so many other instances like the above – why don’t they use the Haitian to nullify Sylar’s and Arthur Petrelli’s power before all the things in the story take place and kill them? Why is it that nobody prevents the events of the stories if Mendez’s comic is still being published? How is it that Mendez’s comic has the events of the current storyline even though they’ve messed with the timeline several times and Mendez wrote the comic prior to his death when the timeline was unaltered? And let’s not even get into the instances where people’s powers switch on and off just like that to suit the convenience of the writers …
Suffice it to say, I didn’t like chapter 3. I found a lot of characters that I’d liked before being perverted into something that they weren’t supposed to be – at least based on how their characters were portrayed earlier. And it doesn’t look as if I’ll like chapter 4 either. It seems to be another morality tale about present-day (or near-past) America and how taking away people’s civil liberties (and creating camps like Guantanamo Bay are bad.)
We’ve seen this motif over and over both in comics (both Marvel and DC did their variations on this theme) and in mainstream entertainment from Hollywood. I’m tired of that. Come on, give the soapbox a rest. Give me something that I can enjoy, characters that I can relate to. But I fear that Heroes might not have the miraculous recovery that the fifth season of Lost seems to be having currently. Ah, well, guess there’ll always be another show to tune in to …
March 8, 2009
Tweets for 2009-03-08
March 7, 2009
Scripting the Apple
As I mentioned yesterday, I wanted to find a solution for creating dynamic signatures for Mail.app on my Mac. Of course, there’s a little bit more to the story. On OS X 10.5 at least, I couldn’t even seem to create a styled signature because the interface for creating a signature appeared to be very bare. There were no hyperlink, bold, italic buttons to stylize the text. However, I learnt that you could style a signature quite easily by creating the text in a mail message itself (or in some other HTML or rich-text editor) and then copying and pasting the text into the signature box
So I had a fairly OK looking signature with links to my site and to my book. Now all I needed was a way to dynamically add a witty quote to it each time I sent out a mail. I did look at a couple of Mac signature generators but those which were available simply created a sig that had to be copied and pasted into your e-mail manually and that was way too much work for me :p There were a couple of scripts which were supposed to automate the work but the sites to download those scripts appeared to have disappeared into the Internet graveyard a long time ago. So I was out of luck
Unless of course, I wrote my own solution It was when researching how to create my own solution that I was first reminded of fortune . I’ve used this little mod in various forms over the years and once I was reminded of it, I knew I could install this under OS X and get it to provide the witty sayings for me. And that was where I came across Fink The quaintly named (they say the name comes from the German name for Finch because finches had a connection to Darwin :p) Fink is a package manager for OS X which allows you to download and install *nix applications which had been modified to run under OS X. Fink comes with a GUI named Fink Commander, which allows you to do most of your package management using a graphical user interface.
But enough of Fink. Suffice it to say that I used Fink and was able to install fortune on my Mac and had it working fine. But now I needed Terry Pratchett quotes. I already had a file full of quotes that I had been using for ages to generate signatures but they weren’t in a format suitable for use by fortune. Fortunately, (pun not intended, honest :p) I was able to find a collection of quotes already in the right format. Once installed, I had my fill of Pratchett quotes to choose from (I must mention here that most sites tell you only the Linux file system location to copy the quote file to. If you are on Mac and had used Fink to install fortune, you might be slightly puzzled as to where the file went. As I was. The correct location is /sw/share/fortunes – just something to keep in mind :))
Once all that was in place, it was just a matter of writing a script using AppleScript which would activate Mail.app, create a new outgoing message and add a signature to that mail using both a static part (links to my site and my book) and a dynamic part (the Pratchett quote output from fortune). At first, I was simply going to generate the signature on the fly and add it to the mail message. But that was where I ran into problems
I had my pre-created static signature in Mail.app showing up as nicely formatted HTML output. But when I put in HTML code via my script in to the body of the mail message, the output wasn’t formatted – it was simply HTML code! And of course, I didn’t like that
So I tried creating a signature via AppleScript. I was able to create a new signature and populate it with the dynamically generated content but that signature, when used, still came out as HTML code and not formatted text. So that was out.
My final solution was a slightly cumbersome one but one that worked I basically created the outgoing e-mail message, and then set it to a pre-existing formatted HTML signature. I also copied the quote generated by fortune to the clipboard. Then I had my script move the cursor to the very end of the message so that it was below the signature and then pasted in the fortune. Voila! dynamic signature
I then used iKey to set up a hoteky so that I could simply run the script from my desktop any time I wanted to create a new e-mail with a dynamic signature. Simple as that
Of course, there’s one scenario that the above doesn’t cover – when I reply to an existing mail. Then I’d only get the static part of the signature. So what I did there was to create a second version of the script which didn’t create a new outgoing mail message. It simply activated Mail.app thus bringing whatever window was open already to the front, and then moved the cursor to the end of that window and copied in the quote generated by fortune – problem solved
If anybody is interested, here’s the final script that I came up with. (The version I provide is the full version but it should be simple enough to modify it to get the secondary version …):
tell application "Mail" activate copy return & return to myContent get do shell script "/sw/bin/fortune discworld" copy "--" & return & ¬ the result & return to theFortune set the clipboard to theFortune as text set mySig to signature "Signature #1" set myMsg to make new outgoing message tell myMsg set the content to myContent set visible to true set message signature to mySig end tell tell application "System Events" keystroke tab keystroke tab keystroke tab keystroke (ASCII character 31) using command down --keystroke "This is where it should go" keystroke "v" using command down end tell end tell
The above seems fairly straightforward to me (now) but if anybody wants any clarifications as to any part of the script, I’d be happy to help
March 6, 2009
The Book of the Mac
I’ve been slowly getting disillusioned with working on Windows due to the various issues that have plagued me on that platform in recent years. As I believe I’ve mentioned before, I would have switched away from Windows years back except for the fact that I had so many applications which were developed on (and for) Windows. I tried Windows Vista for a while and for a while, even swore by it. But that was before I started experiencing mysterious application crashes and lock ups. I then went back to Windows XP. And let me be honest, Windows XP has worked pretty flawlessly for me.
And then Microsoft released the first betas of Windows 7. It was touted as better than Vista and that it fixed all the biggest issues with Vista. So I took heart and tried out the Windows 7 beta. My opinion? Other than for some annoying and confusing changes which just made it look even more like OS X, it still had the same annoying application issues that I’d noticed with Vista. It was probably then that I began wondering if Microsoft was working so hard at emulating OS X, why not switch to OS X in the first place?
Of course, I can’t swear to the above but that thought. or something similar, has led me to finally switching allegiances and going over to the dark side Yes, baby, I’m a Mac user now!
Once I made the switch-over, the first thing I did, of course, was to try and find applications to replace all of my standard faithfuls that I’d used over the years under Windows. I knew that I might have trouble with some applications, especially since I wrote some of them, but I didn’t expect any trouble with e-mail since I currently use Thunderbird and there’s already a version of Thunderbird available for the Mac platform. But sometimes, when you’re wrong, you can be utterly wrong! 😀
I thought it would be as simple as installing Thunderbird for Mac and then copying over my existing Thunderbird mailbox files to for me to set for e-mailing under OS X. And at first, it appeared to work like that. Then I noticed that some of my mail folders were not accessible and this turned out to be a permissions issue (yeah, you don’t have that under Windows :p) However, once I fixed the permissions, Thunderbird started crashing all the time. It became so bad, that I had to find an alternative e-mail program.
So I looked at Mail.app, the standard mail client which comes with OS X. It imported in my existing Thunderbird mail with no trouble at all. (Since Thunderbird had an option to import Apple Mail, I thought I might be able to go back to Thunderbird by importing back my mail but Thunderbird unfortunately would only import the main mailboxes – not the mail in local folders.) I tried out Mail.app and it actually worked very well. It worked with IMAP folders better than Thunderbird had and it had this nifty feature called “smart folders” which allows a user to display mail from different locations/mailboxes fitting a given set of criteria as a virtual folder.
The only trouble I had with Mail.app was something trivial – the lack of customizable signatures Yes, I love my e-mail sigs. I like being able to insert a witty quote from a Terry Pratchett book in all of my e-mails and I couldn’t do this with Mail.app. Now most people would have shrugged and moved on but little details like that niggle at me
So, I first looked at alternative e-mail clients. But I didn’t find anything that had the right mix of features that I was looking for. So I went back to Mail.app and considered how I could leverage the application to do what I wanted to get done. That was when I came across AppleScript. AppleScript allows you to automate the various OS X components quite easily and it seemed easy enough to write a script that would do what I needed with regards to creating a dynamic signature.
But it turned out to be slightly more complicated than I thought and given that this entry is getting overlong, the actual process will have to wait till my next blog entry