Friday, February 29, 2008

ExtJS & Rails - ExtJS scaffold generator installation script

What?
An automatic installation script for the ExtJS scaffold generator plugin (demo keynotes)to get you up and running.

Why?
Rails' scaffolding gets you up an running lightning fast. ExtJS is a wonderful javascript desktop library. Let's marry them

How?
Run the following script - it will

  • Create the rails application
  • Install the ExtJS scaffolding plugin
  • Download and install ExtJS for your application
  • Generate two sample models - posts and purchases
  • Setup the database
  • Create links to the sample models on the application landing page
  • Run the server
Then all you have to do is point your browser to http://localhost:3000, assuming the server is running on your computer.

Have fun!

# Create the app
rails ext_scaffold_setup
cd ext_scaffold_setup

# Install the plugin and extjs
script/plugin install http://rug-b.rubyforge.org/svn/ext_scaffold
curl -O http://extjs.com/deploy/ext-2.0.2.zip
unzip -q ext-2.0.2.zip
rm ./ext-2.0.2.zip
mv ./ext-2.0.2 ./public/ext

# Generate some scaffolds - posts and purchases
./script/generate ext_scaffold post title:string body:text
./script/generate ext_scaffold purchase order_id:integer amount:decimal description:text

# Create the database for the models
rake db:migrate

# Create links to the models on the landing page
echo '<title>ExtJS Scaffold generator sample</title>echo '<style type="text/css" media="screen">a {text-decoration:none; color:#abc}</style><a href="http://www.blogger.com/posts">Posts</a> <a href="http://www.blogger.com/purchases">Purchases</a>' > ./public/index.html

# All set, run the server!
./script/server

Point your browser to http://localhost:3000, and you're good to go.

Wednesday, February 27, 2008

Manual Depth Perception (OpenGL Shading)

Shadows play a tremendous roles in our visual understanding of depth. This can be used to trick the eye:















In the above image, the color of square B is, in fact, the same as that of square A. Don't believe me? These are small crops of the above image:




However, shadows are also very important to aid the eye. Or so we learned in Graphics. So we had to make shadows for a map. Manually.

Here's the m
ap without shadows. Green is lowland, red is highland, black and white even higher.


















And, with shadows:


















Aiding, huh? Aaaand, just the shadows... Please note that each of these pixels is calculated based on two values - an evelation coordinate (z) of the map at any given point (x,y), and a static directional (x,y,z) vector of sun light.


Tuesday, February 26, 2008

Hidden OS X Gems

What?

A handpicking of 4 "hidden" OS X gems from OakInnovations' list of 10

  1. Easily compare versions of a file, and cherry pick among the differences: FileMerge

  2. Summarize any text: Summarize

  3. Save snippets of text and images by dragging them from your web browser to the Desktop: Drag n Drop Save

  4. Have folders update their content automatically based on simple rules: Smart Folders
How?
  1. FileMerge - Type in FileMerge in Searchlight, or use the Finder menu Finder > FileMerge > Compare Files

  2. Summarize - Select text, go to the application menu (e.g. Safari) > Services > Summarice

  3. Drag n Drop Save - Just mark the text or picture you want to save, and drag it to the Desktop. (Only works in Carbon applications - yet another reason to switch to WebKit)

  4. Smart Folders - In Finder, File > New Smart Folder (or just hist cmd + opt + N). A smart folder can be really simple and powerful, or complex and very powerful.

    (On my Desktop I have a smart folder Recent Ruby with rules Modified within last 1 day, and name ends in rb. This gives me a quick overview over all the files in all my current Ruby projects that I've worked on today.)

Monday, February 25, 2008

BackPackIT BackOffIT! ClockingIT isIT!

What?

ClockinIT: A free, beautiful, open source project management website.



"ClockingIT was created for fun, not profit, using Ruby on Rails"



While 37signal's Backpackit has had a bit of monopoly on the ajaxian project management frontier, ClockingIT recently sprung up from two dedicated Norwegian developers, and the community seems to be building strong.

ClockingIT specs: built leveraging a ton of open source goodies, including Ruby on Rails, MySQL, Juggernaut (cometing), and more.

Why?


Three main points for ClockingIT over Backpackit:

  • It's Free
  • It's Open source
  • It's Up and running in 2 minutes
How?

Go to ClockingIT.com and signup.

For developers who want to contribute, get the source with darcs (howto) or with git (repository: git://repo.clockingit.com/cit).

[git installation instructions on OS X 10.5]

Git on OS X 10.5

What?

Git on OS X 10.5 Leopard.

Why?

Git is YARC (yet another revision control system) with some outstanding differences. You can find out for yourself just what those are, but as a hint git is written by Linus Torvalds who hates CVS and SVN - "a bad idea and its bad fix walking hand in hand."

So what does git have going for it?

  • Distributed repositories - you don't need to rely on a central host
  • Branching made easy - in the same spirit, code branches is a breeze
  • Speed - it's just that much faster
How?

So you want it - now how do you get it?

Thanks Wincent.com for the seamless installation script. Just copy the text, paste it into the terminal, and stick around to watch it all happen (and type your password at sudo time.

More configuration scripts are also available, as well as an introductory tutorial.

# build expat dependency
curl -O http://surfnet.dl.sourceforge.net/sourceforge/expat/expat-2.0.1.tar.gz
tar xzvf expat-2.0.1.tar.gz
cd expat-2.0.1
./configure
make
make check
sudo make install
cd ..

# build GPG for signature verification
curl -O ftp://ftp.gnupg.org/gcrypt/gnupg/gnupg-1.4.7.tar.bz2
openssl sha1 gnupg-1.4.7.tar.bz2
tar xjvf gnupg-1.4.7.tar.bz2
cd gnupg-1.4.7
./configure
make
make check
sudo make install
cd ..

# copy GPG files from Tiger install
mkdir -m 700 ~/.gnupg
cp ${PATH_TO_TIGER_HOME_FOLDER}/.gnupg/*gpg* ~/.gnupg/

# git
curl -O http://kernel.org/pub/software/scm/git/git-1.5.2.4.tar.bz2 \
-O http://kernel.org/pub/software/scm/git/git-1.5.2.4.tar.bz2.sign
gpg --verify git-1.5.2.4.tar.bz2.sign git-1.5.2.4.tar.bz2
tar xjvf git-1.5.2.4.tar.bz2
cd git-1.5.2.4
make prefix=/usr/local all
make prefix=/usr/local test
echo $?
sudo make prefix=/usr/local install
cd ..

# manpages
curl -O http://www.kernel.org/pub/software/scm/git/git-manpages-1.5.2.4.tar.bz2 \
-O http://www.kernel.org/pub/software/scm/git/git-manpages-1.5.2.4.tar.bz2.sign
gpg --verify git-manpages-1.5.2.4.tar.bz2.sign git-manpages-1.5.2.4.tar.bz2
sudo tar xjv -C /usr/local/share/man -f git-manpages-1.5.2.4.tar.bz2