Lion, SMTP Postfix Relay, and Dreamhost

When developing web-apps locally it is useful to have a fully functional smtp server to test automated emails associated with your application. Many times the network you are developing on will not allow you to simply start up postfix and and run your own local smtp server. However, this doesn’t imply that you can’t use postfix – modifying postfix to relay all outgoing mail to an external / offsite smtp server that you have control of will enable you to develop & test the parts of your application that require a local outgoing smtp server without an issue.

Many times port 25 (the default smtp port) will be blocked somewhere along the line in your network connection. You can figure out if your network configuration or ISP is blocking port 25 by running telnet smtp.server.com 25.

Edit /etc/postfix/main.cf [code] relayhost = [mail.domain.com]:587 smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = noanonymous smtp_use_tls = yes [/code] Create/edit /etc/postfix/sasl_passwd[code] [mail.domain.com]:587 username@domain.com:password [/code]

Run this command in your shell once the above two files are created/modified: [code] sudo chmod 600 /etc/postfix/sasl_passwd sudo postmap /etc/postfix/sasl_passwd sudo launchctl stop org.postfix.master sudo launchctl start org.postfix.master

# test postfix, cmd+d after typing message content to send message mail -s “Testing, Testing” you@domain.com [/code]

References: Debian Postfix Docs Remote SMTP on Linux Postfix SMTP Auth Support for Relayhost Port 25 Blocking

Continue Reading

Part 2: Thoughts on Buzzmarketing

Empowered Interactivity

A while ago I read an article on the lessons to learn from the DropBox marketing model. After reading the chapter on empowered interactivity I immediately recalled that article and how incentivizing referals increased signups by something like 60%. People generally want to share what is useful to them, and they really want to share something if it can benefit them in someway. When thinking of what the word ‘benefit’ (or more specifically, economic incentive) means to a given person I immediately think of the RSA Animate video about what motivates us and the example they give about Wikipedia: experienced professions and academics who could easily use hours spend researching and writing Wikipedia articles working for sizable monetary reward instead choose to work for free. Why? Because it is satisfying: there is a social currency that one receives when achieving something that a community of persons respects and affirms. This is why the FAQ model that Stackoverflow employs works so well (although the model has changed a bit since they tied site reputation to the ability to interact with the Careers site).  This is why monetary referrals without social recognition don’t always work so well.

Secrecy

These couple lines rung true with a couple recent products / marketing efforts I’ve seen:

Secrets are currency. Revealing a secret is a definite conversation starter… Limit those in the know of a secret, those not in the know want the currency of knowing – they want to be part of the exclusive circle. (Buzzmarketing, P.37)

Push Pop Press immediately came to mind while reading this. They haven’t released anything yet, they have only demoed the product to a select few, and there are no publicly available demo videos. They are near 6,000 followers on twitter and really haven’t put any money into marketing their product. I’m interested in what they are coming out with, and I’m sure many others are too. They are definitely playing the secrecy card correctly. The MacHeist bundle was successful because of exclusivity and secrecy that they built up around the bundle. Apple (obviously) does this with almost all their product releases. Gmail did this with the invite system when gmail originally launched. Being in the know is attractive, and people will ‘spread the word’ if they know something others don’t.

Continue Reading

Thoughts on Buzzmarketing

I’m currently reading Buzzmarketing by Mark Hughes, a book about word-of-mouth advertising. I’m only about a 1/4 way through the book but as I’m reading through the book I keep comparing the ideas that he is presenting to experiences in my own life in order to understand the practical application of his ideas. I’m not a marketer by trade, this book is the first step in my goal to achieve a better understanding of marketing methods (especially marketing via social networking channels).

The two key concepts I’ve pulled from the first section of the book are: 1) the human desire of having something worthy of the interest of others 2) the effectiveness of creating a ‘pre-packaged conversation’ that people want to share with others. As I was reflecting on these two key concepts I’ve thought of a couple examples which show how these concepts play out in the ‘real world’.

The ‘Bed Intruder’ Song

The bed intruder song, virtually overnight, became the funniest most watched “have you see this?” video on YouTube pushing the song to the top 100 chart in iTunes. This video definitely pressed the ‘hilarious button’ that Mark talks about in his book.

Failed Door-to-Door Marketing

Open Range is a new internet service being rolled out in the town I’m currently living in. I don’t know much about the service other than it is lest costly than the standard cable + internet combo offered by Comcast. There is a door-to-door marketing effort going on in our neighborhood. I don’t like door-to-door marketers, I don’t want to talk to them and avoid conversation if at all possible. Mark recounts a story about a car company that used a ‘moose button’ to start the conversation between store employees and customers about a new brake product / sale. Each employee had a big button with the image of a moose pinned to their shirt. Something wierd or different that inspires the customer not the sales person to start the conversation. If this open range salesman had something interesting or weird to attract me to him I probably would of asked him what was going on, instead he approached me with the classic boring line “Have you heard of open range?”.

Having something worth sharing makes you feel as though you have some sort of unique worth, giving others this worth or ‘buzz currency’ in a way that is connected to what you are marketing seems to be the key to effective social / word-of-mouth marketing. The interesting thing about this marketing model is it preys on the insecurity of the human race, it assumes that people want to be noticed and approved of by others.

Continue Reading

Economic Analysis & The App Store

I read two articles – the app bubble and bad news about iphone economics – which surprised me a bit.

Their analysis, which doesn’t account for gain in human capital and the value of lock-in (or alternatively the cost of switching), seems to posit that the App Store is bad for everyone. I could be completely misevaluating the arguments presented, but I believe that if you dig into the arguments presented significant benefits are not being accounted for.

Apple is Paid to Advertise

Apps aren’t very profitable for Apple either. According to Apple Insider, “Apple has long maintained that the App Store isn’t meant to be a profit generator, as much as a means of attracting customers to the iPhone and iPod touch.” The App Store’s gross profits amount to just 1 percent of Apple’s total gross profits.

If something is a ‘means of attracting customers’ then it is a valuable asset, a marketing tool. Even if Apple were losing money running the App Store they would still continue to operate the store because it is incredible marketing tool. The fact is that Apple is being paid to advertise the iOS platform. There is alot of time and money being pumped into advertising individual iOS applications and the more those applications are being designed and developed vendor lock-in takes place which is extremely valuable (vendor lock-in is what makes Microsoft so valuable, valuable enough that Intel just bet 7.68 billion on a more-or-less Microsoft specific technology). Many smaller companies have to choose between the iOS platform and the Android phone (it really isn’t a platform… yet) and most – in my opinion – are choosing the iPhone. Every application that is released on the App Store increases the marketing value of the App Store.

iOS Apps Keep Customers Happy

The decision to adopt a technology sometimes depends on whether or not your current hardware will support it. This is why Square Space developed an iOS app – it keeps customers happy and helps future customers more easily make the choice to using Square Space. Additionally, developing an App Store application to tie in with your product prevents a second-mover from jumping into the uncaptured market and pulling customers into a separate service which integrates with your free / paid iOS application (ex: some sort of Square Space competitor).

Experience is Valuable

Developers don’t develop open source applications such as Seashore, Sequel Pro, and Adium for profit. Open source applications are developed for the experience and for the gratification that comes with knowing you are the master of something (this video has some thought provoking ideas about the reason people spend time on tasks which do not result in a direct monetary gain). Developers are more valuable when they can bring an idea from conception to release and when they can prove their ability to quickly master new technologies. Having an iOS application published on the App Store gives concrete evidence to an employer that an employee has those skills – it is a screening device. Yes, an individual developer may not make a profit on an app they developed, but if it allows them to earn 20% over the next 5 years then there is most definitely a net gain.

Continue Reading

AppleScript Tips & Tricks

I’ve done a fair amount of applescript work (mostly automation & UI scripting related projects) over the last couple months and – although very frustrating – applescript can allow you to achieve some incredible automation tasks. I’ve compiled a disjointed lists of tips, tricks, and source code that some trying to wade through applescript (specifically ui scripting which can be especially tricky) might find useful.

Enable Access for Assistive Devices

[code lang=”applescript”] tell application “System Events” set UI elements enabled to true end tell [/code]

When “set value of text field” Won’t Work

[code lang=”applescript”] set value of attribute “AXValue” of text field 1 to “String” [/code]

How To Iterate Through Rows in a Table

[code lang=”applescript”] repeat with r in rows of table 1 of window 1 log r end repeat [/code]

Retrieve Every UI Element Available in a Window

[code lang=”applescript”] tell application “System Events” tell process “Process Name” set visible to true return every UI element of front window return name of every UI element of front window end tell end tell [/code]

Get a List of the Children of a UI Element

[code] return value of attribute “AXChildren” of UI element 1 [/code]

Create / Update / Connect Network Preferences VPN Services

Although since OS X 10.5 we have been given better applescript access to network preference settings, it still isn’t possible to create / update services / interfaces through applescript. With some tricky UI scripting and the help of the UI Element Inspector (or the advanced UI Browser) it is possible to create and update VPN service information. I also wrote a couple functions that allow you to check the existence of a VPN service and the connection status. You can check out the source code here. Note that although the code is VPN service specific it wouldn’t be terribly hard to modify the code for use in automating the creation of aiport, ethernet, etc services.

Take a Screenshot of a SWF

This is a bit more complex that one would expect. Because the Flash Player isn’t built using cocoa it doesn’t support alot of native applescript methods and getting a screenshot of the actual content (not containing the title bar!) of the swf is actually pretty challenging. The script will take a screenshot of only the content of the actual swf. This is useful if you have a flash app that has loadable swf components that the user should be able to preview through a thumbnail. Coupling the script with the following bash script allows you to easily generate thumbnails for all the swfs in the specified directory.

[code lang=”bash”] #!/bin/bash

function normalize_path() { eval “NORMALIZED_PATH=$1” NORMALIZED_PATH=`php -r “echo realpath(‘$NORMALIZED_PATH’);”` }

find ../path/to/swfdirectory -name “*.swf” | while read line; do # remove the relative reference normalize_path “$line” line=$NORMALIZED_PATH

# open the flas open -a “Flash Player” “$line”

sleep 1

thumbnailPath=${line/.swf/.jpg} osascript slide_preview.scpt “$thumbnailPath”

killall “Flash Player” done

exit 0 [/code]

Other Applescript Code Snippets: Quit Application by Process Name XCode Build & Run Toggle First VPN Connection in Network Preferences Mark Selected Message as Replied Helpful Applescript Articles Applescript for Python Programmers Details on Applescript Variable Types

Continue Reading

Videobox & Mootools 1.2.x

I love MooTools. I’ve been using it before the 1.2 days; it has been great watching how much it has matured. One of the best things about MooTools is the amount of components that have been written for it: Videobox, SlimBox, and TextBoxList just to name a few. However, the switch from 1.1 to 1.2 broke alot of existing functionality and with that broke alot of the existing components.

Just the other day I found just the component I was looking for: Videobox. The examples on the site looked great, but it didn’t work with the newest version of MooTools. I spent some time converting the animation code over to the new 1.2 syntax and fixing some other random bugs, you can grab the fixed version here. I emailed the developer with the fixes, so hopefully he will post it on the project page soon.

Continue Reading

Fix MacBook Pro Optical Drive Problems

Yesterday I was greatly distraught when my MacBook Pro’s superdrive would not accept blank DVD-Rs. When I inserted a blank DVD-R it spun around for a bit, sped up, slowed down, stopped, then spit it back out at me with no error message. It read DVDs, burned CDs, and read CDs fine; but I could not get it to accept a blank DVD-R! I searched around and found information about the MacBook superdrive update which killed alot of people’s optical drives. I couldn’t remember if i installed the update or not, so I was fairly worried because I did not want to drop $400 to fix something which an Apple update broke.

I tried a bunch of tricks to try to get my beloved superdrive to work, but to no avail. Finally while searching around on google someone suggested to get a CD cleaner. I went to Staples and picked one up for $10, put it into my optical drive, and bam it burns DVD-Rs again! I’m guessing the firmware update made the optical drive more sensitive to dust. If your having trouble with your MacBook’s optical drive I suggest grabbing one of these CD drive cleaners and trying your luck before resorting to bringing your computer back to the Apple store.

Continue Reading

TextMate: Local CSS Validation

Although TextMate comes with a built in CSS validation command it would sometimes fail for me depending on where I was working from (some locations have proxy software on the main router). I rewrote the command in the style of the PHP-HTML validator I posted earlier. You can add more validation options using -F. I’ve only used this script on CSS only files, it might not work on inline CSS in HTML documents.

[code lang=”bash”]#!/usr/bin/env ruby -wKU

scope = STDIN.read scope.gsub!(/< /?style.*?>/, ”)

open(‘|curl -sF file=@-;type=text/css -F lang=en http://jigsaw.w3.org/css-validator/validator’, ‘r+’) do |io| io < < scope io.close_write while io.gets $_.gsub!(//, ‘&’) print $_ end end [/code]

Continue Reading

TextMate: W3C HTML Validation For Local PHP Files

It is impossible to validate local PHP files via the built in W3C validation that the TextMate HTML bundle provides because it does not parse the PHP code in the PHP document. I’ve modified the default validation script to retrieve the file using OS X’s built in apache server (the script assumes you have your files in the ~/Sites directory) so it will work for not only PHP, but any apache-interpreted language. I’ve added the ss option to the W3C validator, you can add/remove any validation options to the curl command as you see fit.

[code lang=”bash”] #!/usr/bin/env ruby -wKU STDOUT.sync = true

page = `echo $TM_FILEPATH | sed “s|.*/$USER/Sites/|http://localhost/~$USER/|” | xargs curl -s`

open(‘|curl -sF uploaded_file=@-;type=text/html -F ss=1 http://validator.w3.org/check’, ‘r+’) do |io| io < < page; io.close_write while io.gets $_.gsub!(//, ‘&‘) puts $_ end end [/code]

Hope everyone had a blessed and happy easter!

Continue Reading

Flash: Create MovieClip With Custom Class

I’ve always wanted to attach a movieclip to the stage with a class other than MovieClip without having to use swfmill or the ide to create a movieclip with linkageID + custom class. Well that day is finally here! I found a nice snippet of code on the net and modified it a bit to act more like attachMovie (ability to specify an initOb). The result? createClassMovieClip:s [code lang=”actionscript”] /* Description: A function used for creating empty movie clips with subclass association.

Parameters: c:Function – The class to associate with the the empty movie clip. name:String – The instance name for the empty movie clip. depth:Number – The depth for the empty movie clip. initOb:Object – Optional, object to copy properties from

Returns: MovieClip – A reference to the newly created movie clip. */ MovieClip.prototype.createClassMovieClip = function(c:Function, name:String, depth:Number, initOb:Object) : MovieClip { var mc:MovieClip = this.createEmptyMovieClip(name, depth); mc.__proto__ = c.prototype; mc.constructor = c;

if(initOb) { for(var prop in initOb) { mc[prop] = initOb[prop]; } }

c.call(mc); return mc; } [/code]

Use it just like attachMovie except you specify a class for the first parameter, eg: [code]createClassMovieClip(CustomClass, “new_clip”, getNextHighestDepth(), {_x:10, _y:10, something:function(){this.something = 10;}})[/code] Pretty slick!

Snipplr

Snipplr is a neat site I came across a couple months ago but forgot to post about. It a nicely designed web-2.0-ish site that allows you to post and view code snippets for various different languages (Cocoa, PHP, HTML, CSS, etc). It even has cloudtags and TextMate integration! I’ve been posting some smaller snippets on that site instead of the source code page, so go and check it out.

In the same vein, Code Beach was recently launched. Code Beach is basically the same idea as Snipplr, except it is focused solely on Cocoa based code snippets. It’s nice to see more of these code sharing sites cropping up, they save alot of time!

Continue Reading