Showing posts with label Prototyping. Show all posts
Showing posts with label Prototyping. Show all posts

2011/07/06

Setting up Ruby on Rails 3 on a CentOS 5.4 VPS (or a tale of how a prototype turned into a specification and needed to be hosted)

For my work I had developed a prototype in Ruby on Rails to be able to do usability tests on the more dynamic parts of a new website.

However as the project progressed and the design was refined based on usability testing, it became much easier just to update the prototype rather than to change the original specifications.

As the project grew it became more and more cumbersome to keep everyone in the 40 plus people team up to date with the latest changes in the prototype and making sure that the team had a common vision of what the end product was supposed to look like. My only way to demo the site was to either take screenshots or run a server locally from my virtual machine running Ubuntu where I ran my development environment.

Running a Rails server centrally in a Microsoft centric organisation is easier said than done and I had to look outside the company for hosting providers. Eventually I settled for Hostingrails.com's virtual private server option (VPS for short, a virtual machine).

Purchasing the VPS subscription was quite easy and within a couple of hours I got an email with my credentials. But getting the server up and running turned out to be much more cumbersome than I originally imagined. I am by no means I Linux guru but I have spent enough time tinkering with various Linux and Unix distributions to not shy away from the task of configuring a server.

The server ran CentOS 5.4 and which is a Red Hat distribution sans the commercial parts. This proved to be the first hurdle: I was used to using fink on Mac OS X when installing the odd x11 application or apt-get on Ubuntu but yum (CentOs's frontend for the rpm package manager) or worse yet rpm were both new to me.

I started out using using a guide I found on assertivemagazine.com "Setup a Ubuntu VPS for hosting ruby on rails applications" but CentOS is no Ubuntu and that became quickly became abundantly clear to me. First off all the server didn't come with yum installed. Which meant that I had no "user friendly" front-end for package manager and that getting one (in this case yum) up and running was the first order of business. I had no choice but to get acquainted with rpm.

Let's walk through the process step by step (this post assumes basic knowledge of the vi editor for editing text files and I am not saying that this is the right way, it's just the way I got it working).

Step 1. Adding users and disabling root access with ssh

To add a user first log in to the machine using ssh (type: ssh root@) and once inside create a new administrator:
  1. Create a new user using: adduser
  2. Add an admin group using: groupadd admin
  3. Run visudo and give the admin group the right to run the sudo command by appending %admin ALL=(ALL) ALL
    to the end of the visudo file.
  4. Add the user you created to the admin group using usermod -a -G admin
  5. Log in as the user you created to make sure it works.
  6. Disable ssh access by root by making sure that the line beginning with PermitRootLogin is uncommented in /etc/ssh/sshd_config and set to: PermitRootLogin no
  7. Restart the ssd service using service sshd restart

Step 2. Getting yum up and running (getting acquinted with rpm)

Since yum wasn't installed from the get go I had to figure out how to install it using rpm. Luckily I found an older obsolete post that helped me to figure out what I needed to do "Install yum with rpm on CentOS". Based on the approach described there, an page about rpm and manually copying the links in the CentOS package repository (which had moved since the article was written) I figured out that the command I needed to run was the following:

sudo rpm -Uvh
http://mirror.centos.org/centos-5/5/os/x86_64/CentOS/python-libs-2.4.3-43.el5.x86_64.rpm http://mirror.centos.org/centos-5/5/os/x86_64/CentOS/python-2.4.3-43.el5.x86_64.rpm http://mirror.centos.org/centos-5/5/os/x86_64/CentOS/python-elementtree-1.2.6-5.x86_64.rpm http://mirror.centos.org/centos-5/5/os/x86_64/CentOS/python-iniparse-0.2.3-4.el5.noarch.rpm http://mirror.centos.org/centos-5/5/os/x86_64/CentOS/python-devel-2.4.3-43.el5.x86_64.rpm http://mirror.centos.org/centos-5/5/os/x86_64/CentOS/python-sqlite-1.1.7-1.2.1.x86_64.rpm http://mirror.centos.org/centos-5/5/os/x86_64/CentOS/rpm-python-4.4.2.3-22.el5.x86_64.rpm http://mirror.centos.org/centos-5/5/os/x86_64/CentOS/python-urlgrabber-3.1.0-6.el5.noarch.rpm http://mirror.centos.org/centos-5/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm http://mirror.centos.org/centos-5/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm http://mirror.centos.org/centos-5/5/os/x86_64/CentOS/yum-3.2.22-33.el5.centos.noarch.rpm http://mirror.centos.org/centos-5/5/os/x86_64/CentOS/rpm-libs-4.4.2.3-22.el5.x86_64.rpm http://mirror.centos.org/centos-5/5/os/x86_64/CentOS/rpm-4.4.2.3-22.el5.x86_64.rpm http://mirror.centos.org/centos-5/5/os/x86_64/CentOS/popt-1.10.2.3-22.el5.x86_64.rpm http://mirror.centos.org/centos-5/5/os/x86_64/CentOS/m2crypto-0.16-6.el5.8.x86_64.rpm


Step 3. Making sure that the system was up to date

Once yum is installed updating the packages is quite simple using: yum update.
To make sure you have the necessary tools installed run sudo yum groupinstall "Development Tools" which among other things installs gcc which is needed for the Rails installation.

Step 4. Installing what yum can't provide (git and sqlite)

Strangely enough yum didn't have a version of git in its repositories nor a recent version of SQLite, which both are needed for the Rails installation.

4.1. Installing Git
  1. Install the necessary libraries if they aren't already installed: yum install gettext-devel expat-devel curl-devel zlib-devel openssl-devel
  2. Download the git source code: wget http://kernel.org/pub/software/scm/git/git-1.7.6.tar.gz
  3. Untar the source code once the download is done: tar xvfz git-1.7.6.tar.gz
  4. Install the sourcecode by first moving to the directory where the files were expanded: cd git-1.7.6.tar.gz
  5. Then issue this command: make prefix=/usr/local all
  6. Last but not least run: make prefix=/usr/local install
  7. Check if git is working using: git --version
4.2 Installing SQLite
  1. Download the source using: wget http://sqlite.org/sqlite-amalgamation-3.6.23.1.tar.gz
  2. Unpack the it using: tar xvzf sqlite-amalgamation-3.6.23.1.tar.gz
  3. Move into the folder with the unpacked source: cd sqlite-amalgamation-3.6.23.1
  4. Run ./configure
  5. Make and install the package using: make && sudo make install
Step 5. Installing rvm and Ruby on Rails

Finally the last stretch of the journey. All that is left is to install rvm and rails:
  1. Download and install rvm: bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
  2. Add rvm to your path so that you can invoke it as a function by appending: [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
    to your .bash_profile
  3. Reload .bashrc for the changes to take effect by running: source .bashrc
  4. Test that rvm works by: rvm -v
  5. Install Rails using: rvm install 1.9.2
  6. Set it as default Ruby version using: rvm --default use 1.9.2
  7. Update the gems to make sure that you are up-to-date by running gem update --system and gem update
  8. Because of the non-standard sqlite3 installation you need to run the following when installing the gem: gem install sqlite3-ruby — –with-sqlite3-include=/usr/local/include \ –with-sqlite3-lib=/usr/local/lib
  9. Finally install Ruby on Rails by running: gem install rails
  10. Test that it works by running: rails -v
That's it.

Sources:
http://www.centos.org/docs/5/html/5.1/Deployment_Guide/s2-users-add.html
http://www.cyberciti.biz/faq/linux-sudo-allows-people-in-group-admin/

http://wiki.centos.org/HowTos/Network/SecuringSSH
http://kernel.org/pub/software/scm/git/RPMS/x86_64/
http://www.softpanorama.org/Utilities/rpm.shtml#Installation_Removal

http://www.how-to-linux.com/centos-52/install-git-161-on-centos-52/
http://tech.wangyaodi.com/2010/08/26/install-sqlite3-ruby-on-centos/

2011/06/03

CSS3 generators

I find myself using CSS more and more where before I used to be relying on Photoshop or its CS brethren. No more creating gradients in Photoshop or awkward hacks with the float property to create a rounded corner effects.

Assuming this might be interesting to more people than myself, I have compiled a list of tools that I've used for my latest project:

For a comprehensive guide of CSS properties and their Opera prefixes have a look at The Art of Web's CSS section.

I have yet to find good guide to IE9 and CSS3 but if you need to develop something that looks decent in IE9 you can have a look at Microsoft's IE9 Guide for Developers.


2010/04/17

My Axure grievances

Hi, I have now used Axure RP for some months now (I used to use Keynote) and before you read this post I want to assure the reader that I still think it is an awesome tool and essential for my work. However, there are a lot of things rotten in the state of Axure and these are the things that get on my nerves on a daily basis:

Interaction

1, What's up with the Windows 95 interaction style? Dialogs upon dialogs and then there are more dialogs. You would think that a product for people in the field wouldmake use of a more modern design pattern like the inspector pattern. This becomes blatantly obvious when you move from Keynote to Axure RP. Why are so many modal dialogues (case editor being the most obvious example)!

2. There's no drag 'n drop for lists, just a bunch of up and down buttons. Once again this make me feel all 1995 inside.

Weird stuff/annoyances

1, Double clicking on a big chunk of text doesn't take you to where you clicked butrather to the middle of the text field. How does that match anyone’s mental model?

2, Weird auto-scrolling in lists. Using the dynamic panels panel to edit stuff and then when closing the dialogue the list scroll to another position. Once again I fail to see how that matches anyone’s expectations?

3, Why doesn’t hidden stuff stay hidden? If I have master with a bunch of dynamic panels and I set them to hidden they show up in on the page where I use that master anyway, usually blocking important stuff. It's frustrating when making mockups of dynamic panels or popup menus.

Features

1, No compound-elements. I cannot say that all these elements belong to an other element without resorting to dynamic panels and adding state.

2, No assigning events to multiple elements. This gets especially tedious when you have a button with an image and a text. My solution is to add a transparent rectangle on top of it all and adding the case to it, but then you miss all the niceties such as roll-overs en onclick behaviour.

3, No ruler guides. This is a major omission. Since there is an automatic snap to grid it becomes a massive annoyance when you want to align with something that is off the grid.

4, Text layout is sorely lacking with line height being the most obvious omission.

5, No ability to mark something as "fixed" (like the CSS property).

6, Some frequently used event types are missing such as onscroll and onkeydown.