Archive for the “programming” Category
After fixing the OS X Terminal’s keyboard shortcuts, I wanted to conquer the annoying functionality that keeps Terminal open after the last terminal tab is closed. I normally exit a shell by typing the command “exit”. However, you can also exit a shell by closing the Terminal tab using Cocoa methods (red close button, CMD+w). Between these two methods, things happen in a different order. (Using “exit” causes the user to logout and exit the shell, but the actual tab or window stays open until the processes end. On the other hand, using one of the window closing methods closes the window before the user logout and the processes end).
The general approach is to first watch for the EXIT signal to be sent to a shell (this happens regardless which way the Terminal is closed), then do some handling to determine if the user is exiting the last Terminal tab. However, this got rather cumbersome because of the behavior outlined above. (Sometimes when the final EXIT signal is caught there is still a tab open, other times there is no tab open when the final EXIT signal is caught). So anyway, this is how I did it.
Read the rest of this entry »
Tags: Apple, AppleScript, Bash, Command Line, computer, How-To, Mac, Macintosh, OSX, Snow Leopard, Terminal
No Comments »
I recently switched to the Mac for my work computer (with Windows XP in parallels… I have some VBA macros that are necessary to do my job. Over time, I expect to replace most of it with AppleScript.)
The other day, I noticed some weird emails in my Sent Items Folder in Entourage. They did not have a sender or a subject. If I opened them up, I could see all the headers and any html tags(if any). under the displayed headers, I could see that it was indeed emails that I was sending, but they were somehow becoming corrupted. Today, I figured out that they were emails being sent with my iPhone using my exchange account. I did a little searching and found out that there is a bug that adds some junk to the email header. Outlook on the PC doesn’t get the bad headers because of the way it connects to the server or it just ignores the bad header (it wouldn’t suprise me if the latter was the case).
Fortunately, it is just a simple added three lines at the top of the email and this should be correctable with a script. Since I am trying to learn AppleScript anyway, I thought I would take my chances. After reading a view discussions and blog posts on the issue with some suggested fixes and scripts, I came across an AppleScript made to correct the problem that I decided to examine. Unfortunately, this script didn’t work at all for me, but from looking at the script, it appeared this was mainly due to how it was attempting to detect the “bad email”. Pretty much every “solution” I found required the user to select one or more messages in Entourage and running a script from the Entourage Script menu. Not a very elegant solution, in my opinion. On top of that, it appears that Entourage does not allow AppleScripts to directly modify the email and save it back anyway. Well, I need better detection, and the ability to link the script to an Entourage Rule (and maybe still maintain the ability to run it from the script menu if I wanted.) So, I did and here you go:
Download:
FixSentFromiPhone_1.2.scpt.zip
Here is how I setup my Rule in Entourage to make it run automatically when new message arrive in my sent items folder:
Execute If all criteria are met
If
Folder Is Sent Items
Specific Header Subject Does not exist
Then
Run AppleScript FixSentFromiPhone.scpt
UPDATE: I found that there is a much easier way to do a portion of the script I wrote and updated it.
UPDATE2: It appears my script needs to be made more flexible in order to handle messages with multiple recipients (at least it didn’t work correctly when I did a “reply to all”). I am thinking about it and may update soon.
UPDATE3: Since I had not gotten around to it yet, a reader modified my script and sent me the changes he made to handle messages that had been sent to multiple destinations. I then took his changes and integrated them into the script. Everything seems to work well for me. The download above has been updated. Thanks!
Tags: ActiveSync, Apple, AppleScript, Email, Entourage, Exchange, iPhone, Office
10 Comments »

Update: A new kernel driver has been created that adds the multi-touch functionality to the Linux kernel rather than through a daemon. A version has already made its way into the vanilla kernel source.
New kernel driver for the BCM5974 touchpad (Macbook Air, Penryn)
I regular the Ubuntu Apple Intel forum and had the pleasure meeting a user, tannewt. He had just obtained a new Macbook Pro (with the multi-touch trackpad) and was very helpful in getting some of the first information about the new hardware into the forums. He also started hacking on the touchpad to make it a bit more useful since the new hardware was quite limited with the current available software
Read the rest of this entry »
Tags: Apple, Broadcom, Gestures, Linux, Mac, multitouch, touchpad, trackpad, Ubuntu
No Comments »
I found a little trick today to embed picture files into a VBA macro to use as icons for a toolbar. Normally, you would load an image file off the disk, but this is not ideal for distribution, and users get an error 53 when the expected file isn’t found.
Read the rest of this entry »
Tags: code, icons, Office, programming, toolbar, VBA, Visual Basic
No Comments »
Well, I decided that I should add a donation form onto my website. I looked for a nice convenient widget for WordPress, but I actually surprised to find that there was not much to be found. I found a few plugins that required manual insertion of a tag into your sidebar code, but I didn’t want to edit any of the site files as that makes upgrading a big pain when the time comes. The best looking plugin that I found came from a fellow blogger over at http://ejoneclicks.com. While this plugin seemed to have what I wanted, it was not a widget, and in reality, from I read, he based this on a plugin that was a widget (and he wasn’t ready for widgets), but that site now seems to be gone. Go figure.
So, I wasn’t done searching. I hung onto the plugin in case I found anything interesting in the code that I might want to adapt into something later. I finally came a across another site that was offering a widget, but it was basically just a loader for the plugin I already found… (that took a bit of time to figure out too). Well, after all was said and done, I decided that having to load two plugins to get one function was kinda dumb, so I took the two scripts and dumped them together into one widget so that I get the best of both worlds. Plus, I changed the look of the form just a little . Both the plugins were released under the GPL, and so is my modified version.
Have Fun: PayPal Donate Widget
Tags: donations, Internet, PayPal, PHP, plugin, Widget, WordPress
No Comments »
I typically use an RSS aggregator on my commonly used machines to gather newsfeeds and my regularly read comics. One such comic is Sinfest. After searching for a way to get an rss feed for this comic, I determined that the site uses a common WebComic site script called Comikaze. This script comes standard with an RSS feed. Once I found the hidden feed, I found that it was broken, but stumbled upon another site where someone had created a wrapper to fix the error, as well as provide the feed with inline images! Cool. He wrote some nice code without having to parse the XML. I wanted to make quite a few of the same type, so I had at it. Read the rest of this entry »
Tags: comics, ctrlaltdel, customize, embedded, images, news, newsfeed, Penny Arcade, PHP, RSS, webcomic, xml
No Comments »
|