About a month ago I wrote a post about how I was using IFTTT to keep a journal about cute things my kids say and do. A couple weeks later one of my favorite podcasts, Mac Power Users tweeted that they were looking for interesting IFTTT recipes for an upcoming show.

I wrote David Sparks a short email about how I'm using IFTTT web automation to keep my journal. Lo and behold, they actually mentioned it on their show - It's at about minute 55. David even calls me a "smart guy" at the end. That's kinda the nerd equivalent of having Aaron Rodgers say "nice arm" after watching you toss a piece of paper into a wastebasket.

So, I'm kinda famous.

Posted
AuthorTodd Zarwell
CategoriesTech

This site is hosted on Squarespace, an awesome service that allows you to host blogs, galleries, and websites. They have great tools for managing the look and the content of your site. Even cooler, they provide hosting that can give you more resources if you suddenly need them. For example, if I'm caught up in some scandle and CNN's breaking story links to this post, well, it won't crash. They also have really nice analytics tools, so I could see how many gawkers are coming to nerdiguy.com.

However, since Squarespace is one company of a long list of companies that do NOT financially support this blog, I'm not going to spend much more time singing their praises.

What I want to write about is Squarespace 6. This update came out a couple weeks ago, and, as is typical for a major software change, I have mixed feelings. It looks really cool. The tools to manage the site are incredible. However, some of the features that were present on the old site seem to be missing, and it's a little buggy. As someone who had spent years working on updates to a website, only to have users lament the loss of the old version, I'm very sympathetic to them. And I have the utmost confidence that the bugs will be worked out and the old features will trickle back in.

A few things have perplexed me since converting to Squarespace 6. For example, it doesn't seem like I have a lot flexibility for editing the structure of the templates. Also, I can't find an easy way to provide my readers (either one of them) with an RSS feed.

I also was struggling to embed Flash files on the site. I know, I know, Flash is going the way of the dodo. Still, I'd spent a fair amount of time programming in Flash in the past and I want to include a few of my creations here. Actually, my Oculus Invaders game seems to be the biggest reason people come to nerdiguy.com.

I had to do a little finagling with Squarespace 5 to get these Flash files embeded and working. I used swfobject and Squarespace 5 code injection, using this forum post as a guide.

However, when I upgraded to Squarespace 6 I was at a loss. I'm still getting the hang of the new version, and I initially saw no access to a file system to even store my Flash files, much less link to them or embed them. I contacted their customer support about this, and, and after several back and forth emails, got the impression that it was not possible. I was starting to get very disappointed with the new version and was wondering if I wanted the shiny new look of the new one or what appeared to be the more robust and feature rich old one.

I kept plugging away, though, and eventually figured out that you can upload and link to files (I knew it - how could you not!?). To do this, simply go to the page or journal entry where you want to appear and enter the editing mode. Clicking the "link" icon in the toolbar will give you the option of uploading a file. Clicking this will allow you to navigate to the file(s) on your computer and upload it. Once the file is uploaded you the text field will display an absolute path to your file - you'll want to copy this. If you uploaded multiple items you can hover over the "upload file button" and see all of your files. Clicking a name will display that file's path.

There.  Now all we have to do is embed it into our blog entry.  As I said earlier, I wanted to use swfobject because in my experience  this is the best way to embed Flash in a browser-independent way.  Alas, I could not make this work, even with code injection.  Instead, I took a simpler route.  I created my blog post with a little text in the beginning.  I then clicked the "Add Block" button to add a code block, then again to add some text at the end.

So essentially, the post is divided into three sections:

I added the standard object/embed Flash code in the code block and changed the language to Javascript. EDIT: Set the language to HTML, not Javascript.

<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="320" HEIGHT="240" id="Yourfilename" ALIGN="">
<PARAM NAME="movie" VALUE="Yourfilename.swf">
<PARAM NAME="quality" VALUE="high">
<PARAM NAME="bgcolor" VALUE="#333399">
<EMBED src="Yourfilename.swf" quality="high" bgcolor="#333399" WIDTH="320" HEIGHT="240" NAME="Yourfilename" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED>
</OBJECT>

Just make sure you change the two instances of *Yourfilename.swf*  to the link that you uploaded (the one I told you to copy earlier).  Set the width and height and to whatever you need, and change the background color if you desire.  

A couple more things.  For some reason, every time you I tried to edit my code block the  *display source* checkmark became checked.  This is pretty annoying, because if you save it that way it will just display your code (instead of running it when the page loads).

EDIT: Again, the image above shows the language as Javascript: It should be set to HTML. 

Lastly, when I was working on this my flash file was not working.  It didn't work in the editor, and it didn't work in the preview.  However, when I logged out and looked at my site, it worked!  You can see the results here and here.

Nothing too complicated for a real website developer.  However, with my disorientation with the new Squarespace site and the misinformation (perhaps *miscommunication* would be a fairer word) I  received from their support, I was starting to think this would not be possible.  Maybe posting my experience here will make the process easier for someone else.

Posted
AuthorTodd Zarwell
CategoriesTech
36 CommentsPost a comment

A while back I wrote a post about how I was using email, AppleScript, and Dropbox to keep a journal about my kids. Overall this has been working well, and I feel it is helping me to write more entries than I otherwise would. However, there's one thing that bothers me: It depends on Apple's native Mail application. In short, the rules I set up in Mail.app trigger an Applescript that appends the message to a text file.

Unfortunately, as hard as I try, I just can't seem to get comfortable with the Apple Mail app. I know this is may be considered blasphemy to the Apple faithful, but I just feel more comfortable using the Gmail web client. I like the keyboard shortcuts that let me fly through my inbox, and I have a workflow for using labels that I just can't seem to replicate in Mail.app.

So, my solution has been this - I manage my email in Gmail (or in Mailplane, which is pretty much the same thing). But, to catch my journal entries, I also open Mail.app at startup and keep it running on my desktop. This works, but it's not a perfect solution for multiple reasons:

  1. My MacBook Pro is getting a little long in the tooth, and running a largely unneeded program bogs it down a little.
  2. My laptop needs to be running for this to work. I'd like to be able to write an email from anywhere, hit send, and have it processed be my filter and added to my journal immediately. If my laptop is packed away, well, my email just stagnates in my inbox.
  3. Having an extra app running in my dock insults my minimalist sensibilities.

Because of these issues I thought I'd try another tack. I decided to try If This Then That, or IFTTT. I'd looked at IFTTT a while back, and while it looked powerful and interesting, I wasn't sure what to do with it. I thought this was the perfect time to give it a try.

First, a little info about IFTTT. The name really says it all: If this, then that. As in, if something happens, do something. IFTTT uses the public APIs of a whole slew of services, including Gmail, Google Reader, Twitter, Dropbox, Facebook, Instapaper, PinBoard, and about 40 more. So, you can essentially connect these APIs together like little building blocks. An example would go something like this: "Watch my Twitter account - when I 'favorite' a tweet, save the tweet in Evernote." There's a ton of other examples available at the IFTTT recipes page.

For my email needs, it would go something like: "If an email comes into my Gmail account with the subject "kid1.txt", Then append the content of that message to a specified text file in Dropbox."

So, I signed up for a IFTTT account and clicked the "Create" link. First you need to select the "This" part of If This, Then That. In my case, the This is "watch my Gmail". So, I clicked the Gmail icon and, on the next screen, selected the "New email from search" option. Then, I specified the phrase that I wanted IFTTT to watch for:

IFTTT  gmail

Next, we need to specify the "That". My That is "append the text to a file in Dropbox". So, I clicked the Dropbox icon and chose "Append to a text file" on the ensuing page. I specified the file I wanted to append to (kid1) and the path inside my Dropbox folder (Family/). I set up the Content field to format the text to include the date that it was sent and the message body.

IFTTT  content

After saving this 'recipe', I'm ready to go. I can still follow these steps: Write an email to myself, set the subject to "kid1.txt", write my "journal" entry in the content, and hit send.

Email screenshot

IFTTT sees it, grabs it, and appends the text to my journal file in Dropbox.

Text file screenshot

So, how is this method better? Well,

  • I don't have to have Mail.app running - or even have my computer running, for that matter…
  • No need for complicated scripting
  • Multiplatform - all I need is IFTTT, Gmail, and Dropbox. If I switched to a PC tomorrow, or decided my only computer was going to be my phone, this would still work.
  • IFTTT checks checks my Gmail account every 15 minutes, so I know my journal entry will be added to my text file in a timely manner.

Any concerns about this method? Yes:

  • I'm giving a third party access to my Gmail and Dropbox accounts.
  • I'm relying on a third party for this workflow. However, I'm not too worried about that: If IFTTT goes under, I'll still have my email archive and the redundancy of my Dropbox content. IFTTT is not hosting any content, so they're not going to lose my priceless journal.
  • IFTTT doesn't perform any actions on my email. It does what it's supposed to but it would be great if, when it's done its job, it could mark the email as read and archive it for me. I'll probably just do these things manually, but I think I'll have this lingering fear that I'm doing it too soon and not giving IFTTT a chance to add the content to my journal. I'm going to have to give some thought to how I want to handle that.
Posted
AuthorTodd Zarwell
CategoriesTech

I easily get annoyed with multi-step computer tasks that I seemingly have to repeat over and over and over again. I always find myself trying to find ways to automate these tasks with things like Automator, AppleScript, and Hazel on my Mac.

The thing is, I'll spend 45 minutes trying to figure out a way to automate a task that, if done manually, would have taken two minutes. I've done this for collecting optometry related RSS feeds, making journal entries, and many other things. It's OK because I like the challenge, although sometimes I wonder if I gain any time in the long run. I think I eventually do, but even if I don't I still win because whatever task I was dealing really annoyed me. Once I've automated it I don't have to deal with that ever again.

Still, I still found this recent graph from the Chart Porn Web site strangely validating:

Automating tasks

It might take more time up front, but it's worth it. Now if you'll excuse me, I'm going to be spending the few hours figuring out a way to avoid having to type periods.

Posted
AuthorTodd Zarwell
CategoriesTech
2 CommentsPost a comment
Marco Arment, the host of the podcast Build & Analyze, had this to say regarding converting his popular iPhone app to an Android app:

By the way, it's not like I hate Android.  I just don't think there's much business for me there. And again, I don't think there's zero business, I just don't think there's enough to make it worth the investment I have to put into developing and maintaining that . . .  I just look at the realities of the market, and the realities of the market - and my time - are that I barely have enough time to manage the apps on the platform I support now . . . I have to focus on the platforms I have time to focus on.  I can't add a whole bunch of them.

This pretty much mirrored my own thoughts on the subject.  From the day my iPhone app was approved in iTunes I've received requests to make it available on other platforms.  First it was BlackBerry and Palm, but the overwhelming request nowadays is for Android.  And, I fear the next Windows Phone 8 will be the next big thing.

I feel bad that I don't have an Android app. I really do.  I know it's become a very popular platform.  I'm not neglecting it because I'm playing sides.  I haven't made it because I'm already stretched so thin.

Marco suggested it would take him months to create an Android app, all while ignoring the upkeep on his Web site and iPhone apps.  Marco is a full time developer.  I, on the other hand, am a full time optometrist.  I think it would take me at least a year to create an Android app, probably more.  Why do I think that?  Well, the iPhone app took about 18 months from the day I bought a book on iPhone programming to the day I "shipped" my product.  Although I'm really proud of it, it was by far the toughest programming task I've undertaken.  

Since then I've had a couple children, still work full time (well, I've cut back a little), and still have a website and an iPhone app that I work on nearly every night. I just don't have any time left.

The other consideration is the financial aspects.  As I said, Marco Arment makes his living as a developer.  My income comes from looking at eyeballs.  I've managed to make EyeDock profitable enough to justify to my wife why, when my children get down to sleep in the evenings, I plug away at my computer instead of watching Dancing with the Stars like everyone else.  

However, the biggest reason I design websites and program is because I enjoy it.  I enjoy creating things, I enjoy making something that's useful, and, I'll admit it, I enjoy the positive feedback I get.  I have no idea how many people subscribed to my site because of my iPhone app.  I'm sure some did, but I've always thought of the app as a supplement to my EyeDock.  Perhaps I'm way off base on that - if I created an Android app maybe I'd double my subscribership and it would be well worth it.  That's an unknowable thing, unfortunately.

Even if I could justify it financially, there's still the issue of time.  I've often thought about farming out the development of an Android app to a professional.  However, my experiences with having outsiders do my coding has been less than desirable.  I feel like I've made good things because I'm an optometrist and I know exactly how I need things to work when I'm seeing patients.  An outsider just doesn't understand at the same level.  I can't justify investing my limited resources in something that I'm not confident is going to be made to my satisfaction.

I sincerely do apologize for my lack of an Android app.  I have nothing against the platform.  It's just that the iPhone came first, and I can currently only support one.  This will change if EyeDock grows to the point that I can dedicate more time and resources to it.  Believe me, nobody wants that more than I do.

Posted
AuthorTodd Zarwell
CategoriesTech



I've enjoyed a lot of things since switching to a Mac a few years ago, for all the typical reasons: It's intuitive nature, the relative security, the fact that most of the software you will need comes with the operating system, how well it works with the other Apple devices I've started to accumulate.

On the nerdier side of things, I've really enjoyed some of the under-the-hood tools that can be used to automate jobs that you find yourself doing over and over again.  As the macosxautomation site describes these features:

Sooner or later every individual, business, or organization is challenged to perform repetitive or complex procedures on their computers. Whether the task is renaming numerous files, batch processing images, or building documents using data from multiple sources, the need for powerful automation tools is shared by all computer users. Mac OS X is designed, from the ground up, for automation and offers a variety of integrated tools and technologies to solve your automation challenges.

In short, Mac automation gives the user the ability to create little computer programs that run certain jobs for you.  You can do this with a programming language called AppleScript, which is a verbose language where you can use simple English words to tell it what you want it to do.  I actually haven't spent a lot of time using this, however, because there is an even simple way to create your programs called Automator.  With Automator you can drag and drop instructions in a certain order to achieve your desired task.  For example, you could arrange instructions in this order:

  1. start with an image
  2. resize it
  3. rename it 
  4. save it in a certain file

I won't go into more detail than that as there are a lot of great rescource out there.

 

Now on to my recent problem.

I enter a LOT of data on my Web site, EyeDock.  I have some handy web forms that allow me to do this online in a nice tidy way (as opposed to having to always deal directly with the database).    However, a new part of the site is having problems with any quotation marks (") that I enter on these web forms.  Eventually this will be something I need to fix on the back end, but for now I really want to enter this data now.  If I 'escape' the quotes everything works fine, which means I have to type a front slash before every quote (\").  I found myself doing this about 50 times and I realized I had to find a better way.

One potential solution is to copy the text, paste it into a text editor, and then do a find (") and replace (\"). However, this solution didn't sound much more appealing to me than what I was already doing.  I wanted to do a find a and replace within my browser, but unfortunately browsers do not provide this option.  This was the perfect job for Mac automation.

I decided to make a service to find quotation marks and replace them.  Macosautomation describes services thusly:

The Services menu, found in the Application menu of most applications, offers a wealth of powerful automation options. In Mac OS X, many applications and system components publish their abilities as “services,” enabling the functionality of one application to be used with the items selected in another application. For example, using a Mail service from the Services menu, text selected within a Pages document can automatically be used to create a new outgoing message in Mail. Or the text of a long article displayed in Safari can be quickly summarized in a few concise sentences.

So, I opened Automator (found in the applications directory) and chose the 'create a service' option.

I knew I wanted the service to be available when text was selected, and I knew I wanted to replace that text. I'd be doing this online so I wanted to accept text from Safari, but I figured I might as well accept text from any application in case I wanted to use the service in another program.  So, so far I had these options selected:

 

Next, I had to do the search and replace.  Unfortunately this isn't one of the many options available for text manipulation in Automator.  Automator can, however, run scripts in other programming languages, including the aforementioned AppleScript.  Another option is perl.  I've become familiar with a lot of different languages over the years, but I've actually never worked with perl.  After some quick Google searches I found some examples that gave me a sense of how string substitutions work in perl and came up with this short script:

while (<>) {

$_ = ~ s/\"/\\\"/g;

print $_;

}

Which pretty much says go through the given text, and every time you see a quote ("), change it to an escaped quote (\").  The key is in the second line which uses a function that substitutes text like this:

~s/x/y/g;

Which means when you see an "x", replace it with a "y".  So, essentially, find whatever is after the first backslash and replace it with whatever is after the second backslash and before the last one.  The letter "g" at the end means global, which indicates you want this to be done on every letter "x" in the text (not just the first one).

 

So, if you want every instance of the word "hello" to be replaced with "hi" in this sentence:

"hello, my name is Todd, and I say hello"

You'd use this statement:

~s/hello/hi/g;

And get this result:

"hi, my name is Todd, and I say hi"

 

Unfortunately things get more complicated when you want to use special symbols.  Most computer languages use punctuation marks and other characters and it can be confusing if you want to use these things - the compiler needs to know if you're using these items as part of the language or if they're being used as your text.  

For example, I wanted to search for quotation marks (") and replace them with a frontslash (\) and a quotation mark.  If I followed the patterns we were using above it would look like this:

~s/"/\"/g;

However, both quotation marks and backslashes are reserved special characters.  To use them we need to escape them (which is exactly what I'm trying to do with my original text).  We'll do this by adding a frontslash not onlyin front of each quotation mark, but also in front of the frontslash!

~s/\"/\\\"/g;

So, even though it looks like my 1 year old started slapping at my keyboard, this statement actually has meaning.  These sorts of statements can actually get significantly more complicated, but can also be incredibly powerful.  To learn more do a Google search for "regular expressions".

 

So, my completed Automator script looks like this:

 

I saved it under the name "escape quotes".

 

Now, when I'm filling out these text fields in Safari, I can select the text, right click and choose services -> escape quotes.  All my quotes are automagically escaped and life is beautiful.  (As an FYI, I usually don't use Safari, but unfortunately this is the only browser that will work with services).

So, this is pretty simple stuff for a perl (or any other language, for that matter) programmer but I hope it might be helpful for someone without programming experience who wants to do something like this.  Of course you can search and replace anything you want, not just quotation marks.  If you're really ambitious you could create an automator script to ask you what you want to search for, what you want to replace it with, and then hit "go".  It would actually be a more robust service than hard coding it as I did, although for my needs (one simple task that I wanted done quickly) this worked well.

 

 

 

Posted
AuthorTodd Zarwell
CategoriesTech
4 CommentsPost a comment

I was listening to the This Week in Tech podcast this past week when panel member Brian Brushwood mentioned a magazine that fueled his interest in technology as a child: Enter Magazine.  Although I don't officially work in a technology profession or surround myself with technology people, I've never heard anyone mention this magazine before and I was beginning to think I was the only one that ever subscribed to it (which might explain why it only lasted for 17 issues).

Issue # 1 Oct 1983

The mere mention of Enter magazine brought back a flood of fond memories. I'm not sure where my mom heard about the existence of this magazine, but she must have thought it would appeal to me because it arrived in our mailbox one day.  I was hooked, and could barely wait until I received my new edition each month.  

I have fond memories of taking the magazine to school and typing in BASIC programs, line for line, into the the classroom Apple IIE.  Once I the program worked I'd start modifying it and customizing it to do and say the things I wanted it to.  This was the perfect way to learn programming, perhaps the ONLY way: my small parochial school didn't have programming classes.  Furthermore, BASIC programsI don't recall ever encountering a book about programming during my childhood, and of course the Internet didn't exist, at least not outside big universities and the military.   The only way a kid in small town Wisconsin could learn to program was to see BASIC commands in a magazine and then spend countless hours experimenting with them to to learn how to unlock their full potential.

One day my mom got a letter from Children's Television Workshop that said Enter Magazine was no longer going to be published.  In it's place I would receive 3-2-1 Contact Magazine, which would have an "Enter" section.  Needless to say, I was dismayed - I'd seen 3-2-1 Contact at school - it was OK as every kid was fascinated with the red-eyed day-glo tree frogs that always seemed to be on the cover, but it wasn't going to compare to Enter.  I was devastated. 

So, when Brian Brushwood mentioned this publication I was filled with nostalgia.  I did a Google search and found almost nothing for "Enter Magazine" - very disappointing.  Enter on the iPadHowever, there was a short Wikipedia article. This article linked to a Web site called retromags, which seems to be a place where people can upload old magazines. To my surprise, there were images of all 17 issues of the Enter covers.  Even better, all the pages of every issue were downloadable.  With a little finagling I was able to download them onto my iPad.  I was thrilled at this accomplishment, despite the fact that it merely induced my wife to sadly shake her head.

While browsing the premier issue of Enter I'm reliving the excitement of my 11 year old self.  Some high points from this issue include:

  • Can Computers Go Crazy? The reality behind "WarGames" and "Superman III".  Includes an interview with Matthew Broderick.
  • Video Games: The Falls Biggest Hits.  Includes Atari versions of Ms. Pacman, BurgerTime, Qix, and Centipede.
  • Moving Maps. "You're driving along in a car, and you make a quick turn. Guess what?  YOu're lost.  Instead of pulling out a road map, though, you push a button.  A 6"x8" screen above the radio instantly shows a map .. but what's that triangle moving along the screen?  Your car!".  The article goes on to explain how this device pulls down information from a satellite and might be available in 5 years.  That would have been 1988 - I don't remember having GPS during the Reagan administration!
  • Buying the Right Computer.  Choices range from a $50 2k RAM Timex /Sinclair with only cassette tape storage [this was actually my first computer] to a $199 64k Commodore 64 to a $1265 64-512k IBM PS (who would need all that RAM?).
  • Progress Report: Video Discs.  Video discs look like silver record albums played on futuristic record players, but with a video disc player you get sound and video.

Ah, the memories!  Did anyone besides me subscribe to Enter?

 

Posted
AuthorTodd Zarwell
CategoriesTech