Sacramento, CA

AM Clouds/PM Sun 84° | 52°

Seattle, WA

Mostly Sunny 64° | 46°

Buk Life

Archive for the ‘Development’ Category

25 May 2010

Get SSL working on MAMP Pro

Here’s what I did to get MAMP Pro working so I could test the HTTPS pages of the site I’m working on.

1) Follow these instructions from Rocket Theme to the letter.  I didn’t need to deal with any of the “Possible Issues” section.
2) Go into “/Applications/MAMP/conf/apache/ssl.conf” and add a new vhost within the <IfDefine> blocks at the end of the page.  This vhost will mirror the settings of the vhost you would have already setup in MAMP:

<VirtualHost test.dev:443>
DocumentRoot "/Path/to/document/root"
ServerName test.dev
SSLEngine on
SSLCertificateFile /Applications/MAMP/conf/apache/ssl_crt/server.crt
SSLCertificateKeyFile /Applications/MAMP/conf/apache/ssl_key/server.key
<Directory "/Path/to/document/root">
Options All
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

3) That’s really it.  Restart MAMP and you’re good to go.

Tags:

11 May 2010

Flash SEO

Flash has a strong reputation for creating visually stunning websites, and rightfully so. Just head over to The FWA to see some of the best flash-based websites ever designed. As good as flash is at delivering rich media to the web, there are some serious downsides to consider.

One of the largest drawbacks to flash content is it’s relative invisibility to search engines and accessibility programs. The criticism is true when talking about Flash as a closed platform. The code written is compiled into a SWF, and then embedded online. This makes searching an indexing flash content extremely difficult for most search engines. Accessing Flash content is also a problem for screen readers and other accessibility programs.

These issues, combined with the popularity of the Apple devices, create a lot of hesitancy for companies to fully embrace Flash content in their projects and sirs. I’m going to talk about a few key principals that will help Flash gain visibility and accessibility across multiple platforms, and at the same time make Flash content easier to update and maintain.

Does it need to be Flash?

The first step, of course, is to figure out what content needs to be in Flash, and what does not. There’s no point to constructing a site using flash if the same design can be achieved using more open, standards-compliant code. Once the decisions have been made as to what content will be built in Flash, than it’s time to start thinking along the same lines as proponents of web standards.

Use the Principals of Web Standards

The primary rule in web development today is the separation of content from presentation. The same principal can be applied to Flash projects. Separating the content from the design means updating and maintaining the Flash site will be much easier if the code doesn’t need to be recompiled and edited every time a change needs to be made. Making things like the navigation, links, and photos flexible and external are all great steps to create clean, smart, and flexible projects.

Smart Degradation

If the Flash content and design are properly separated, than re-purposing the content is extremely easy. If the content is in XML format, it can be applied to an XML site-map which will help search engines index the site’s content much easier. In addition, there are browser and platform detection scripts which could allow you to display the XML content in regular HTML format if the browser or device isn’t compatible with Flash. (iPad anyone?) You can also detect older browsers and Flash players. Content can then be delivered in the most efficient way possible to all users.

For example, head over to the BKWLD site on an iPad or iPhone, and you will see that the features on the homepage are still visible and interactive. This helps serve the most people possible the site’s content, no matter what environment they are using to visit the site.

Hybrids

There is also the option of creating hybrid sites, which are very popular because they combine flash elements with standard HTML markup. This allows the user to have a rich experience, as well as giving search engines easy access to the site’s content. Making use of flashvars and XML/JSON add to the flexibility of the site by allowing Flash to communicate directly with the rest of the site.

SWFObject & Deep Linking

Making use of programs like SWFAddress and SWFObject allow the Flash content to be more transparent and visible to search engines. SWFAddress will create a specific URL for each page in a full-browser Flash experience. Knowing what section the user is on, and showing that section in the browser’s address bar allow search engines to look at specific pages, and create extremely accurate analytical reports.

SWFObject is a way to create valid code though the W3C Validation tools. Also, SWFObject has the ability to replace Flash content with a static image, which maintains the visual design if the user doesn’t have flash enabled.

Conclusion

It’s ultimately about choosing the right tool for the right project. Flash has many advantages, which need to be carefully weighed against the areas in which Flash falls short. The ideas described here can certainly help Flash communicate better with browsers, search engines, analytical tools, and accessibility programs.

26 April 2010

It’s the Idea, Not the Technology

There are so many arguments happening now about this technology and that development language. The battle for supremacy has led to some fairly bad blood between some amazing companies. Listening to the recent debates between Adobe and Apple about flash on the iPad and iPhone has got me thinking. It seems like no matter what, there will be a problem and a battle until we as designers and developers get our heads in the right place.

This is because the debate is centered around technologies and programming languages. This strife is very prevalent in all areas of the web design industry. Should you use Flash or Javascript for that slideshow? Should we connect to this MySQL database, or this SQL server over here? .NET or PHP? There are some very opinionated groups, which is too bad because all of these technologies are amazing in their own right.

At the core of every project is an idea, and that is by far the most important thing to consider. Once the creative idea has been set, realizing that idea can happen any number of unique and innovative ways.

When figuring out how to produce the project, it’s all about what technology is best suited for the design. How much interactivity will it have? Of course you’re not going to utilize Flash for a site that is just plain, static text, and you’re not going to link up to a database when your site consists of two pages.

After these things have been sorted out, then pick the technology that you are most comfortable and efficient with. For example, I work really well in Flash and Actionscript. I am very comfortable with the language, and it comes naturally to me. That doesn’t mean that Flash should be used for everything, but in at the end of the day it’s all about the idea being produced, —not what technology was used to make it. If you need a slideshow, it can be written in Javascript, Flash, or hell even Lingo, as long as you end up with a killer slideshow.

It’s also not about the newest technology; it’s it’s about the best technology. My old college instructor is a professional type designer for a 1st-class graphic design agency. She stands by Freehand as the best tool out there for type and letterform design. It’s not a new program by any measure, but it works for her, and she produces some incredible work.

So we need to relax about the technology debates, and focus on making kick- ass designs, and have fun doing it.

23 April 2010

Surprises with implementing Open Graph and the Like button

I tried out some of the newly announced Facebook features today, specifically the Open Graph markup and the Like social plugin.  They were both technically simple to deploy, as promised.  You have less control over the appearance of the Like button than I’d like.  For instance, they don’t have an option to ONLY display the like button without a list of total likes.  You can work around this by reducing the width of the iframe, but it was an unexpected restriction.  For us, the goal was to provide a handy way to Like us on Facebook; we don’t care to give screen real estate to showing your friends who have also Liked us (for the majority of visitors, I expect there would be none).

I initially went about including the Like button the wrong way.  In the demos they showed at the F8, it appeared that they would expect each deep linked article page in a blog to have a unique Like button, like how CNN is implemented.  So I did this:

However, when you click Like, it adds a link in your profile section on Facebook for that specific deep link.  For example, check out the article link added here from CNN:

You could imagine that very quickly this area would be cluttered with all the articles a person had liked on news sites and blogs.  Then I noticed this suggestion from the Open Graph Best Practices:

Make only real-life things into objects. Users don’t want news articles and other transient content as objects on their profile.

This advice makes sense, though it’s inconsistent that Facebook would tout their partner (CNN) whose implementation contradicts this.  Thus, I moved the Like button into the footer, making it site wide, and added a Digg link in it’s place.

Ideally, users clicking the Like button would be added to the BKWLD Facebook page (we previously had a group, which we’re deprecating).  So far, I’m not seeing this happen; users who Like our Facebook page and users who Like us on the BKWLD site appear to be dropped into separate buckets.  The Social Graph markup doesn’t have a field to specifically relate the object (our site) with a Facebook Page.  I assume that Facebook uses some black magic to join the references to BKWLD in the Social Graph metas with the BKWLD references in our Facebook Page.  Possibly this isn’t working because our Facebook page is so new.  Or possibly something got confused during my initial implementation that was per blog article.  It also doesn’t appear that the “fb:admins” meta tag is having any effect.  I’m curious to see if this generated page will be automatically merged into the official BKWLD Facebook Page in the next few days.  Or if a person Likes a site on the Facebook site and that site has Open Graph markup on the home page, does Facebook read it and pull that info in?

In sum, I think the social plugin and Open Graph standard are pretty great in terms of functionality for users that can be added with minimal effort by developers.  I hope some clarification comes from Facebook about how (or if) merging works between different pages.

23 November 2009

Restoring a Minimized AIR App From the Mac OS Dock

Those familiar with the Mac OS dock will know that clicking the dock icon of a minimized application will restore that application to it’s pre-minimized state. This is a nice little feature as the minimize/tray area of the dock can quickly become a disorganized mess if you keep a lot of apps open. Those familiar with developing AIR apps will also know that AIR apps don’t do this out of the box. This kinda sucks.

Fortunately there is a fairly easy way to implement this feature for yourself. All you need to do is setup two event listeners and two properties.

The two properties you need are “isMinimized” and “isMaximized”. Both are booleans, the first indicating the application is … drumroll … minimized and the section maximized. While you could get away with just one of these having both offers more flexibility in the future should you need it. For example: it is possible for an app to be neither maximized nor minimized.

The two events you need to listen for are NativeWindowDisplayStateEvent.DISPLAY_STATE_CHANGING and InvokeEvent.INVOKE. The first event is dispatched when the application’s display state changes (i.e., when maximized or minimized). The second is dispatched when the dock icon is clicked.

With those few things all you need to do now is a few start up things:



/**
 * Event handler for the application's creationComplete event
 */
private function init():void
{
         // Check to see if we have a dock available for clicking
         if (NativeApplication.supportsDockIcon)
         {
               // Wire up a listener for the dock icon's invoke event
               NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, onDockIconClick);
         }

         // Effectively, listen for minimize and maximize event.
         this.addEventListener(NativeWindowDisplayStateEvent.DISPLAY_STATE_CHANGING, onChanging);
}

/**
 * Event handler for display state change events
 */
private function onChanging(event:NativeWindowDisplayStateEvent):void
{
      switch (event.afterDisplayState) // <-- our new state
      {
	case "minimized":
		isMaximized = false;
		isMinimized = true;
		break;

	case "maximized":
		isMaximized = true;
		isMinimized = false;
		break;
	}
}

/**
  * Called when the dock icon is clicked.
  */
private function onDockIconClick(event:InvokeEvent):void
{
	if (isMinimized)
	{
		// If the app is minimized call this
		stage.nativeWindow.restore();
		isMaximized = true;
		isMinimized = false;
	}
}


In the above code it’s assumed that init will be called by the app’s creationComplete event. init then checks to see if the platform on which the app is running supports dock icons (that is, is Mac OS). If it is we add an event listener for the InvokeEvent which is dispatched when the app’s dock icon is clicked. After that init wires up a second event listener, this time listening for the NativeWindowDisplayStateEvent.DISPLAY_STATE_CHANGING event. This event is dispatched when the app is minimized or maximized.

onChanging is our event handler for the display state change event. We use this method to keep track of whether our app is maximized or minimized. onDockIconClick is our event handler for the app’s InvokeEvent that will be dispatched when the dock icon is clicked. This method checks to see if the app is currently minimized, and if it is it calls the window’s restore method.

12 November 2009

Creating Application Menus in Mac OSX with Adobe AIR

Adobe AIR is a great tool for quickly creating cross platform desktop applications.  For the most part you can code once and deploy on any OS that AIR supports and you app will look and feel like a native app.  There are a few caveats of course and one of them is working with menus.  In particular menus are handled somewhat differently in Mac OS than they are in Windows. This post won’t get into the nitty gritty of actually creating and modifying menu items as that is covered quite nicely in Adobe’s documentation on the subject, but I will tell you how to create native menus on Mac OS that are indistinguishable from those of native Mac apps.

First, the Differences

In Windows menus belong to each window. So File, Edit, View and such are items in each open window of an application. In AIR this corresponds to the menu property of a NativeWindow.

Windows menu example

In Mac OS the corresponding menu is called an application menu and there is only one for all windows of the application. In AIR this corresponds to the NativeApplication’s menu property.

Mac OS Application Menu

So what you say? AIR has features that let you handle Windows vs. Mac menu differences quite easily. This is true, a quick check of the docs will reveal how quickly this can be accomplished. However, you’ll notice in the above screen grab that application menus on Mac OS list the application name in bold. There is nothing in the AIR docs about how to accomplish this.

What To Do?

You can just ignore this and create a menu like the (quite nice) SQLite administration tool Lita. Note Lita has “Lita” in the menu but it’s not bolded.

Lita's Mac OS Menu

Or you can not even bother with the application name like the (also extremely useful) MonsterDebugger.

MonsterDebugger's Mac OS Menu

Both of these approaches are completely valid. After all both Lita and MonsterDebugger are incredibly useful applications that make my life as a developer much easier and lacking a proper Mac OS application menu doesn’t detract from their utility in any way. However it’s also quite simple to create application menus that look identical to a true native application.

Creating Seamless Application Menus For Mac OS

It’s so simple to create seamless application menus on Mac OS that you don’t even have to do anything! That’s right, just create an application and AIR makes one for you:

Default AIR Application Menu on Mac OS

Everything you see above you get for free (note: adl is the AIR debugger. If I were to publish a release build and install the application you’d see the name set in the application descriptor xml file). You might now be saying that this is all good and well but what if you want to customize the menu at all? The good news is you can, it just take a tad more work.

To start you’ll need to note that AIR gives us three menu items in addition to the “Application Name” item (the bold one). For this example I’ll assume you’re only interested in keeping the app name item so we’ll just get rid of everything but that one.

First you’ll need to get a reference to the application’s menu:


// Get a reference to the NativeApplication's menu, if this is Mac OS
// Note: you'll need to handle menus differently if you are on Mac OS or Windows.
// See the AIR docs related to creating native menus for details.
if (NativeApplication.nativeApplication.supportsMenu)
{
var appMenu:NativeMenu = NativeApplication.nativeApplication.menu;
}

If you were to loop over this you’d see all of the menu items from the above screen grab. You’ll also notice that each of the items is a NativeMenuItem (more on this later). Since we only want the first one we can now remove all the others:


// Get rid of our unwanted menu items
// The app name item is the first one
while (appMenu.items.length > 1)
{
menu.removeItemAt(menu.items.length - 1);
}

At this point our menu consists of one item: the application name menu item. This menu item is pre-populated with some standard elements like “About” and “Quit”. If you’re happy with this as-is, you can now freely add your own menu items. If you need to customize this application name menu item a bit simply take advantage of the fact that it’s a NativeMenuItem and go nuts.

Using this method you’ll now see your application’s name (that is, the name you set in the application descriptor xml file) up in bold when you publish a release build and install. Here at BKWLD we’ve recently used this technique and here are the results:

Spyder Elastic Sales Application Menu on Mac OS

6 Adobe AIR is a great tool for quickly creating cross platform desktop applications.  For the most part you can code once and deploy on any OS that AIR supports and you app will look and feel like a native app.  There are a few caveats of course and one of them is working with menus. [...] Sean Monahan,Flex Developer

November 12th, 2009 at 01:19 PM
Posted By: Sean Monahan in Development

6 November 2009

Two requests per subdomain

I recently learned that  the http spec suggests browsers only open two simultaneous connections to a given subdomain at a time.  I haven’t tested to see how widely adopted this is.  Though I have noticed in Safari, looking at the activity viewer, that if the page requests many large assets (like a flash audio player where the user has advanced through tracks quickly), file requests start to queue up.  In a recent blog by Campaign Monitor, they mention that they server images from multiple subdomains at a time so the web browser opens up more connections at time.  You don’t even need multiple servers.  You could wildcard the subdomains on your webserver and serve up a unique subdomain.  As pointed out on Stack Overflow, you don’t want to choose a completely random subdomain on every request or the browser can’t cache the image.  It’s a pretty extreme optimization technique , though something to keep in your toolbox.

30 October 2009

Using Polymorphic Associations

One thing that has always impressed me with websites is how they present you with the most important information when you login. This could be a deadline, some updates from other users, or just general announcements.

Some of the sites I use at work and on a personal level are perfect examples, GitHub and Basecamp.

github.png
basecamp.png

But how is this technically feasible? Sure, you are probably thinking just gather all the data you need and loop through it. Right? No, I will explain why. I didn’t understand this for the longest time, and I hope to help solve any your questions about using them.

Diagram
With Garrett and Larry both having many comments, messages and connections, we already have the data we need.

Problem is we need to sort them accordingly (by date) and keep all associations tied. It is harder than it sounds.

In this case we have 3 datasets, some comments, some messages and some connections. If we were to put all 3 collections in a list in order of when we gather them, they will be out of order. What we need to do is make one collection that references any type of data we need to list out. What makes this useful is we can also track other information that is helpful to users and not possible if we loop through the actual data. That is what a Polymorphic Association is.

Within the Feed model we need to keep track of the model it will reference, the actual reference to the specific item within that model, and any other information you would like to have. I like to keep track of it’s action, as well as the user who performed that action.

reference.png

How would this look like in the database?

For this example I will use Ruby to try to show you how easy it is to display a dashboard like interface for your users.

Within the view you can loop and render a custom template for each item, this will give you the desired look that simulates the dashboard feel.

I am going to leave this here, you can create the views however you want. I have this repo stored on GitHub so you can clone it and mess with it however you like. I have uploaded a demo on Heroku for you to see as well.

7 October 2009

VPN through PHP on (MT)

It’s been a two day quest, but I’ve finally gotten our web server to talk to a remote SQL server over VPN.  I wish I could document the steps as a how to (I’d like it for myself if I have have to do this again), but I’ve tried so many things I’m not sure which steps are true dependencies and which are extraneous.  First, the server in question is a LAMP server, running Plesk, hosted at Media Temple.  For the most part, it’s a vanilla configuration.  Here’s some of the things I learned in the process of getting this up:

  • The VPN is of the Cisco type, but using their linux software was a dead end.  I couldn’t get it to compile, it needed kernel headers and patches and on and on.  Eventually, I was directed to using VPNC.  There are scripts that convert pcf files to the format VPNC uses.  Also, you can store the VPN password within the config file, which is perfect for my situation.  If I feel like enduring further pain, it may be useful to get this working locally and stop using the Cisco Mac client altogether.
  • It turns out you need to be running as root to use VPNC.  Thus, for the users that would be running this, I had to add entries to the sudoers file.  I made it passwordless because I knew I’d be calling it from PHP.
  • I had to allow /usr/local/sbin as an open_basedir in php so that I could call VPNC.
  • From exec(), I needed to use the full path to VPNC.
  • Lastly, and this was particularly painful because I knew I was sooo close at this point, I had to comment out “Defaults requiretty” within sudoers.  When this is on, it prevents you from running sudo outside of the command line.

This was a very frustrating journey so hopefully this helps someone else.  Or me in the future.

4 October 2009

Digital: Where the Wild Things Are – A day of reflection at SODA’s Click 2009

SODA's Click 2009 - 10/01/2009

SODA's Click 2009 - 10/01/2009

This past thursday (10/1/09) our creative directors, Jeff Toll and Demetre Agres and I had the pleasure of attending the Click 2009 SODA event at the Art Directors Club in NYC.  There we got to hear from amazing boutiques like Unit9 (particularly loved them), Syrup, and Poke, as well as from some of the agency juggernauts like Goodby, CP+B, JWT, and Ogilvy, all introduced and hosted by the after-hearing-him-talk-I-truly-get-why-he’s-such-a-likable-force-in-the-industry Michael Lebowitz (which I am pretty sure I learned is “lEbowitz, not lEEBowitz) from the infamous Big Spaceship.

The topic and discussion points varied from more granular subjects like “Branding with numbers” (which I found surprisingly intriguing) to more general monsters like “What is the future of entertainment”.

First off I have to say what a pleasure it is to hear from such talent in one room, on one day, and in person.  I mean Jason Zada, Lebowitz, and Mike Geiger to name a few…truly a pleasure.

Of all the nuggets of wisdom I can take away from the discussions, what is interesting to me is that despite agency head-counts, annual billings, specific focus, country of origin, or AOR vs. project-based orientation, we are all facing similar issues; digital agencies finding their autonomy from the traditional ones, an ever-changing set of tools, an even more-changing option of techniques and services we have the option to render should we decide to, and a myriad of ways we can manage the whole damn thing.  But here in-lies the beauty, though facing the same obstacles and issues, the lot of us are choosing completely different approaches to the hurdles, and its working.

We have the luxury of working in an industry that is defining itself each day, and that works for me.  After all, what are we if we are not problem solvers?  At the end of the day we are simply choosing what tool we want to solve the problem with.  So I welcome and embrace the luxury of being able to re-define, re-shape, and re-focus. What fun it is after all.

So after a wonderful day with our peers, and a couple others enjoying an amazing city with good colleagues and friends, I am glad our industry is a kid.  It has many options, and oh so much potential.  Im not sure if its the couple cups of coffee, or the Where the Wild Things Are soundtrack I am listening to as I type this, but I love this kid and want what’s best for him too.  So let’s keep talking.

Art Directors Club NYC

Art Directors Club NYC

2 We have the luxury of working in an industry that is defining itself each day, and that works for me. Ryan Vanni,CEO/Founder

October 4th, 2009 at 04:38 PM
Posted By: Ryan Vanni in Design, Development, General