Wednesday, January 27, 2010

How to Work with Lawyers at a Startup

If you’re a startup and you don’t have a close relationship with a few law firms you’re really missing one of the most important relationships that any entrepreneur can have.

If you don’t follow the image reference above or the tag line,You don’t need double talk; you need Bob Loblaw (try saying it out loud), and if you care! the link is here.

http://www.cloudave.com/link/how-to-work-with-lawyers-at-a-startup

Tuesday, January 26, 2010

DiffMerge 3.3

DiffMerge is an application to visually compare and merge files for Windows, Mac OS X and Unix.

Product Features:
  • Diff Graphically shows the changes between two files. Includes intra-line highlighting and full support for editing.
  • Merge Graphically shows the changes between 3 files. Allows automatic merging (when safe to do so) and full control over editing the resulting file.
  • Folder Diff Performs a side-by-side comparison of 2 folders, showing which files are only present in one file or the other, as well as file pairs which are identical or different.
  • Windows Explorer Integration. Right-click on any two files in Windows Explorer to diff them immediately.
  • Configurable. Rulesets and options provide for customized appearance and behavior.
  • International. Compatible with 42 different character encodings.
  • Cross-platform. Identical feature set on Windows, Mac OS X, and Unix.
http://sourcegear.com/diffmerge/

Sunday, January 24, 2010

20+ .htaccess Hacks Every Web Developer Should Know About

Apache's .htaccess(hypertext access) configuration file can be a very powerful tool in a web developer's toolkit if used properly. It can be found in the webroot of your server and can be easily edited using any text editor. In this article I'm going to show you 20 .htaccess hacks and how to use them.

Before I start with this article I'd like to start by saying that abusing the .htaccess file will hurt the performance of your website. The .htaccess file should only be used if you have no other way to achieve certain things.

http://devmoose.com/coding/20-htaccess-hacks-every-web-developer-should-know-about

Thursday, January 21, 2010

Jaml: beautiful HTML generation for JavaScript

Generating HTML with JavaScript has always been ugly. Hella ugly. It usually involves writing streams of hard-to-maintain code which just concatenates a bunch of strings together and spits them out in an ugly mess.

With Jaml, we can do exactly that. Jaml is a simple library inspired by the excellent Haml library for Ruby. It works by first defining a template using an intuitive set of tag functions, and then rendering it to appear as pretty HTML.

All we need to do is call Jaml.register with a template name and the template source. Jaml then stores this for later use, allowing us to render it later using Jaml.render(). Rendering with Jaml gives us the nicely formatted, indented HTML displayed above.

You can see live examples of all of the above at http://edspencer.github.com/jaml.

Jaml currently sports a few hacks and is not particularly efficient. It is presented as a proof of concept, though all the output above is true output from the library. As always, all of the code is up on Github, and contributions are welcome :)

Jaml would be suitable for emulating a Rails-style directory structure inside a server side JavaScript framework – each Jaml template could occupy its own file, with the template name coming from the file name. This is roughly how Rails and other MVC frameworks work currently, and it eliminates the need for the Jaml.register lines. Alternatively, the templates could still be stored server side and simply pulled down and evaluated for client side rendering.

http://edspencer.net/2009/11/jaml-beautiful-html-generation-for-javascript.html

Sunday, January 17, 2010

Firebug 1.5 - Stable

Firebug 1.5 is Firebug 1.4 with enhancements and bug fixes. It supports Firefox 3.5 and 3.6. 1.5 release notes Among the major enhancements:

  • Mike Radcliffe's Inspector. A key feature, now solid as a rock,
  • Jan 'Honza' Odvarkos expanded and refined Net panel, with accurate timings,
  • Steve Roussey's reworking of HTML editing and entity support,
  • Kevin Decker's CSS and Style side panel improvements,
  • Support for dynamic, graphical breakpoints through out Firebug.
  • Tested support for the soon-to-be-released Firefox 3.6
http://getfirebug.com/releases/firebug/1.5/firebug-1.5.0.xpi

Wednesday, January 13, 2010

Fluidium

Fluidium is an open-source platform for developing Rich Internet Applications that run as native Mac OS X desktop apps. Fluidium is much like Adobe Air, except open source (liberal Apache license), and exclusive to the Mac.

Increasingly, new applications are being written as web apps, but native Cocoa applications still provide the best user experience on Mac OS X. Using Fluidium, you can wrap your existing web app in a pure, native Mac application shell and provide the best of both worlds to your demanding user base.

Fluidium is unabashedly Mac-only, and makes no cross-platform compromises. With the high quality of native Mac apps, cross-platform, least-common denominator approaches don't cut it on OS X. Your Fluidium-based app will fit right in on OS X as a first-class Cocoa citizen.

Fluidium is based on the same open source technology that powers the popular Mac OS X Site Specific Browser, Fluid.
http://fluidium.org/

Sunday, January 10, 2010

Protolicious

Protolicious is a set of javascript snippets based on prototype.js (and other random stuff)

Element (Element.Methods) extensions

  • Element#setProperty
  • Element#swapClassName
  • Element#enableClassName
  • Element#contains
  • Element#indexOf
  • Element#isTagName
  • Element#getContentWidth
  • Element#getContentHeight
  • Element#setWidth
  • Element#setHeight
  • Element#appearVisible
  • Element#delegate
  • Element#fillDocument
  • Element#centerInViewport

Function extensions

  • Function.K
  • Function#negate
  • Function#runOnce
  • Function#_new
  • Function#toDelayed
  • Function#toDeferred
  • Function#addAdvice

Array extensions

  • Array#sum
  • Array#namespace

Field (Form.Element.Methods) extensions

  • Field#isBlank
  • Field#present

Form (Form.Methods) extensions

  • Form#unserialize

Event extensions

  • Event.simulate
  • Event.register
  • Event.unregister

Cookie

  • Cookie.set
  • Cookie.get
  • Cookie.unset

Prototype

  • Prototype.addScript
  • Prototype.addStylesheet

Object extensions

  • Object.isEvent
  • Object.methodize
http://github.com/kangax/protolicious

FirePHP Rails Plugin

This plugin allows you to log messages and objects from your Rails controllers and views to the FirePHP console.

You can use firephp, or its alias fb

The first parameter is the message to be sent. This can be any Ruby object that responds to the to_json method.

The second optional parameter is the log level as a symbol. This can be one of :log, :info, :warn, or :error. It defaults to :log.

Messages will not be logged in the production environment.

This plugin is based on the rails-firephp gem.

http://github.com/smith/firephp_rails

Ajax.JSONRequest is JSONP for Prototype.js

The Basics

Your options are:

  • onCreate: When the request is built but before it is invoked
  • onSuccess: When the request is completed
  • onFailure: When the request times out and fails
  • onComplete: When the request is completed, regardless of success or failure
  • callbackParamName: The name of the callback query parameter to use (defaults to "callback")
  • parameters: Parameters to pass to the request
  • timeout: The seconds before canceling the request and invoking onFailure

Handling response content:

The first (and only) argument passed to your response handlers is a Ajax.JSONResponse object. Access the resulting JSON data via that object's responseJSON property or get at the raw JSON string with that object's responseText property.

new Ajax.JSONRequest('http://api.flickr.com/services/feeds/photos_public.gne', {
callbackParamName: "jsoncallback",
parameters: {
tags: 'cat', tagmode: 'any', format: 'json'
},
onCreate: function(response) {
console.log("1: create", response, response.responseJSON);
},
onSuccess: function(response) {
console.log("1: success", response, response.responseJSON);
},
onFailure: function(response) {
console.log("1: fail", response, response.responseJSON);
},
onComplete: function(response) {
console.log("1: complete", response, response.responseJSON);
}
});

Handling Failures

Since there is no way to inspect what happens after we make a request with the JSONP technique, we're stuck having to make informed guesses about what's going on.

This example makes a request to an invalid URL. Since the callback is not invoked within the default timeout period (10 seconds) the request is "cancelled" and the onFailure callback is invoked if specified. The Ajax.JSONResponse will have the status of 504 and statusText of "Gateway Timeout".

new Ajax.JSONRequest('http://api.flickr.com/services/feeds/asdfasdfasdfasdfasdfsdf', {
callbackParamName: "jsoncallback",
parameters: {
tags: 'cat', tagmode: 'any', format: 'json'
},
onCreate: function(response) {
console.log("2: create", response, response.responseJSON);
},
onSuccess: function(response) {
console.log("2: success", response, response.responseJSON);
},
onFailure: function(response) {
console.log("2: fail", response, response.responseJSON);
},
onComplete: function(response) {
console.log("2: complete", response, response.responseJSON);
}
});

Using a custom timeout period

You can set your own timeout period. This example sets this timeout to 0.1 seconds which is pretty much guaranteed to fail.

new Ajax.JSONRequest('http://api.flickr.com/services/feeds/photos_public.gne', {

// Short timeout illustrates failure mechanism. This will "fail" because we don't
// get a response in time.
timeout: 0.1,

callbackParamName: "jsoncallback",
parameters: {
tags: 'cat', tagmode: 'any', format: 'json'
},
onCreate: function(response) {
console.log("3: create", response, response.responseJSON);
},
onSuccess: function(response) {
console.log("3: success", response, response.responseJSON);
},
onFailure: function(response) {
console.log("3: fail", response, response.responseJSON);
},
onComplete: function(response) {
console.log("3: complete", response, response.responseJSON);
}
});
http://github.com/dandean/Ajax.JSONRequest

Sunday, January 3, 2010

VIM Destroys All Other Rails Editors

Flame War Disclaimer

What you use to edit code is any other tool and it comes down to personal preference. Personally I LOVE Vim. There are hundred different ways you could set up Vim. This is the setup that's worked best for me. Hope you enjoy it as well.

First things first

Install MacVim or Gvim (For Debian based distros install with apt-get). I do frequently use terminal Vim or Vi but I like having both available. If you're on Windows you probably want to spin up a Linux box or a VM. Ruby on Rails development on Windows is going to painful.

Let's Get Plugged In

Download pathogen.vim it makes managing Vim plugins a lot simpler. Create a ~/.vim/autoload/ directory and copy pathogen.vim into it.
$ mkdir ~/.vim
$ mkdir ~/.vim/autoload
$ cp ~/Downloads/pathogen.vim ~/.vim/autoload/
Next you need to create and edit your .vimrc file so that pathogen gets loaded in the correct order.
$ mvim ~/.vimrc
Content:
call pathogen#runtime_prepend_subdirectories(expand('~/.vimbundles'))

set tabstop=2
set smarttab
set shiftwidth=2
set autoindent
set expandtab
Create a .gvimrc to specify colorscheme
$ mvim ~/.gvimrc
Content:
colorscheme vividchalk
Create a ~/.vimbundles directory and install plugins. I prefer to clone them from github.com when I can. Some plugins still need to be downloaded from vim.org, extracted and copied to your .vimbundles directory. Either way go vote up plugins you find useful on vim.org. If you don't have git installed check out git-scm.com
$ mkdir ~/.vimbundles
$ cd ~/.vimbundles
Install rails.vim
$ git clone git://github.com/tpope/vim-rails.git
Install cucumber.vim
$ git clone git://github.com/tpope/vim-cucumber.git
Install vividchalk.vim
$ git clone git://github.com/tpope/vim-vividchalk.git
Install haml.vim (There are two. I use Tim Pope's.)
$ git clone git://github.com/tpope/vim-haml.git
Install endwise.vim
$ git clone git://github.com/tpope/vim-endwise.git
Install surround.vim
$ git clone git://github.com/tpope/vim-surround.git
Install unimpaired.vim
$ git clone git://github.com/tpope/vim-unimpaired.git
Install abolish.vim
$ git clone git://github.com/tpope/vim-abolish.git
Install repeat.vim
$ git clone git://github.com/tpope/vim-repeat.git
Install NERD_tree.vim
$ git clone git://github.com/scrooloose/nerdtree.git
Install NERD_commenter.vim
$ git clone git://github.com/scrooloose/nerdcommenter.git
Restart Vim and you now have a super powerful Rails editor at your fingertips. Check out each of the plugins for documentation of features.

http://www.adamlowe.me/2009/12/vim-destroys-all-other-rails-editors.html

JavaScript Charts Roundup

Flot

Flot is a jQuery-based JavaScript plotting library, which focuses on simple usage. The results are fairly attractive, and has some interactive features, such as zooming. It works with all modern browsers (including IE6+, where Google’s ExCanvas is used). If you’re into Prototype, check out Flotr, a Prototype port.

jqPlot

This is another jQuery plugin, and produces results not dissimilar to Flot. It provides quite a wide range of graphing options.

dojo Charts

Dojo Charting, part of the Dojo Toolkit, provides many common chart types including line, bar, area and pie charts.

Bluff

Bluff is a James Coglan’s JavaScript port of Ruby’s Gruff graphing library. It depends on James’ JS.Class (and ExCanvas to support IE).

PlotKit

PlotKit is based on MochiKit, but unfortunately only supports IE6+ via Adobe’s discontinued SVG viewer.

Protochart

Inspired by Flot and PlotKit, Protochart build upon Prototype and ExCanvas, providing a good range of charting options.

Google Visualisations

Google Visualizations provide a variety of ways to represent your data, including charts from the Google Chart API as well as pure client-side visualizations (some of which require Flash).

Yahoo UI Charts

YUI charts let you visualize tabular data on a web page in a variety of different ways, but unfortunately the chart control depends on Flash 9.

Processing

This is not just restricted to charts, and it doesn’t support IE (yet), but I wanted it to include it anyway as, like Raphaël, Processing is such a powerful tool.

http://dailyjs.com/2009/12/15/javascript-charts-roundup/

Web Development for the iPhone: HTML & CSS Support

Safari and Safari for the iPhone support all HTML elements, including deprecated elements and even some proprietary elements that were never part of any W3C specifications. In addtion, Safari supports some HTML5 elements, even though the HTML5 specifications have not been finalized.

http://www.evotech.net/blog/2009/12/web-development-for-the-iphone-html-css-support/