Go from .NET to Ruby in One day. For (and by) the complete Linux n00b
posted May 31st 2010There are 1001 guides out there for installing bits and pieces of Ruby, Linux or Rails. This is intended as an absolute beginners guide, specifically for Windows users who don’t know jack about Linux, Ruby OR Rails. I’m a complete n00b at this. I spent a day or two trying to get this setup, finally worked it out and have gone back and done it all again whilst writing this guide on how I did it. I’ve tried to find the easiest way with the least complications. Advanced users will laugh at me, but they can go #&^$ themselves. If this whole setup wasn’t so difficult to use, I wouldn’t have needed to spend so long working out half of this stuff in the first place. I hope it helps other .NET Ruby hopefuls, but please keep in mind, I am FAR from an expert, so comments/improvements/suggestions are more than welcome!
I was issued something of a challenge last week: To write our next web app in Ruby.
Not such a big deal right? I mean, it’s just another language? Can’t be that hard? I read this quickstart guide, and whilst Ruby is rather odd little language, it didn’t appear to be anything that I couldn’t handle. So, I decided to give it a go..
The first thing I’d suggest as a .NET developer of nearly 10 years, is that if you’re seriously considering giving Ruby on Rails a go, I strongly suggest playing around with .NET MVC first. As a big fan of MVC, getting into Rails was a lot easier, as many of the concepts found in MVC were…well…stolen fromRails. If you’re familiar with Models, Views, Controllers, lambda expressions, partials and all that stuff, Rails will be a breeze. Ruby is still an ugly SOB in my opinion…but at least Rails will feel familiar to you.
Step 1. Installing Linux.
You could use Cygwin, or even Windows, but I’d really suggest not. I tried this, and it’s just a pain in the ass. Besides, you won’t be using either in our production environment, so you best get used to Linux sooner rather than later! I chose Ubuntu, just because that’s what came up in Google. If that statement doesn’t make it clear, I’m a complete Linux beginner. I used Linux about 10 years ago, and haven’t touched it since. So if lack of knowledge of Linux is what’s been stopping you, have no fear. If I can manage it, anyone can.
You have a couple of options to get up and running with Linux. Setup a new Linux box, or run a Virtual Machine. I didn’t have a spare box lying around, so I chose the latter. So, first thing you’ll need to do is go off and download Oracle VM VirtualBox and Ubuntu. Then mount the Ubuntu ISO as a virtual CD drive in Windows (there are plenty of apps to do this, google it).
Install VirtualBox and create a New Machine, Call it Linux, choose Linux/Ubuntu as your OS Type. You can pretty safely click next repeatedly during the rest of the install. Once it has installed the VM, go to settings > storage. Click the little empty CD controller and from the CD/DVD device on the right, choose the drive which has your Linux ISO. Click ok and start up the VM. If you’ve done everything right to this point, Ubuntu should start installing. If it crashes because it can’t find your ISO, go back and check your settings.
Assuming you have a fairly standard machine, it should all install easily enough. Skip the language packs if you don’t need them, they take forever to download and install. Once it has installed, you’ll need to “power off” the VM, and remove the ISO so that Linux can boot. When you first get into Linux, it’ll want to install a heap of updates…just let it.
Ok, so If you’re a Linux n00b like me, you wont even know where to start. In fact, you’re probably wondering why the damned VM window is so small. To fix this, go to the Devices menu in VirtualBox, click the Install Guest Additions. This will mount another ISO in Linux. Go to Applications>Accessories>Terminal. Welcome to Linux’s DOS prompt
cd /media
cd VBOXADDITIONS_3.2.0_61806/
(bit of a tip for the REAL n00bs…rather than typing the directory, just hit TAB and it will autocomplete)
sudo sh ./VBoxLinuxAdditions-x86.run
This will go off and install a heap of stuff to make Linux run nicer with your host environment….including allow you to have nicer screen resolutions. Once it is done, do a reboot. Couple of quick tips. Right Ctrl is your host key. Ctrl+F will give you fullscreen.
That’s it. Step 1 complete! The best part is that you haven’t completely committed to using Linux, it’s not too late to back out. You’re only ever a delete key away from being back in the safe hands of Uncle Bill and his crazy Cousin Steve.
Step 2. Installing Ruby.
Unfortunately, that was the easy part. The next part caused me a lot of grief. I eventually worked it out, but only after a lot of Googling, and a lot of swearing and it turns out I didn’t actually need to do most of it. Hopefully I can save you from the same fate. The first thing you need to know is, whenever Googling, resist the temptation to Cut and Paste helpful command line tips and tricks. These often include references to a specific version of a package, and can screw everything up real quick. If you need to install ANYTHING, make double sure that you’ve got the right version. The problem here is that so many versions of Ruby, Gems and Rails have come and gone, and the installation methods, requirements and problems are all different. This can be a major headache for Linux beginners! Even going through this the second time, I’m still running into issues!
So, crack open the terminal again. If you haven’t already guessed you’ll spend a lot of time here! First thing to note is a command called “sudo”. Sudo is the Linux verison of “run as administrator”. Most of the commands you run for installation will be prefixed with this. It will prompt you with your admin password and then carry on. Second thing to note is that for the most part, you won’t need to download anything from any third party website when doing installs. Linux has a rather nifty package installer that gets and installs everything for you! If you’re keen you can download source packages and compile them yourself, but we won’t need to do any of that.
So theoretically, Ubuntu should have most of what you need already, but we do need to go get a few bits and pieces. Make sure that the updater has finished before trying this, as it won’t work if it is still running.
The first thing you need is ruby.
sudo apt-get install ruby-full build-essential
Run this to make sure it installed ok.
ruby -v
This will print the version you just downloaded (hopefully!)
This will go off and get the latest version of ruby and install it and a heap of other libraries for you. Done! You’ve run your first Linux command and installed ruby!
To install gems :
sudo apt-get install rubygems
Run this to make sure it installed ok
gem -v
While you’re here, install the ruby-debug gem
gem install ruby-debug
Done and done.
Step 3. Installing Rails
Ok, so now we have ruby, and ruby gems. Now we need rails.
sudo apt-get install rails
Yeah…that’s it.
Now that all looks pretty simple, and you could’ve done most of it from the one line. But there are PLENTY of guides out there that will show you how wget your source packages, untar them, compile them, run them blah blah blah. Linux zealots want to know why people still use Windows over Linux? Have a read of your guides! You have to have a PhD in astrophysics just to learn how to run a web app!
Step 4. Install your IDE
Given that you’re a .NET developer, you’re going to need an IDE. None of this command line editing BS. We’ll be using Aptana Studio.
Go here: http://www.aptana.org/studio/download
Download the archive. You’re most likely using Firefox, so you should be able to find the zip in the downloads folder. Extract the archive to your home directory. You can then run aptana directly from there. You can also create a shortcut in your Applications menu. In Ubuntu, go to Preferences > Main Menu > Programming. Click the New Item button. Fill in the details, navigate to Aptana executable and select it, and also click the icon to change it to the Aptana one. Click Ok, close. And check it out in your Applications menu!
Great, that was easy! Well…not so fast! This is Linux! You can’t install something so easily! You need to do some more command line hacking. Ubuntu doesn’t come with Sun Java, which appears to be a prerequisite for Aptana. So now we need to install that.
First we need to add the java repo:
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
Then get the updated list of files
sudo apt-get update
Then install Java
sudo apt-get install sun-java6-jre
You can now run Aptana. Once you open Aptana, you’ll also want to click on the Plugins button and install RadRails. It’s pretty self explantory.
That’s about all you need to get up and running.
If at this point, you’re wondering “why the hell am I doing this???”, I don’t blame you! We’re nearly done…hang in there! At this point you should be able to run a pretty basic website. So this a good time to….
Step 5. Watch a video
As you won’t have installed it, you’ll need to install curl before you get too far in the video, and mongrel (a webserver) too. Just run:
sudo apt-get install curlsudo apt-get install mongrel
If you ever find yourself missing something, that’s usually a good way to try to install it.
This 15 minute video will take you about 2 hours to get through. With a bit of luck, everything you’ve done till now will see you through the video. Use Aptana as your text editor for the examples. You’ll be pausing every ten seconds, but stick with it. By the end of it you’ll understand why so many developers love RoR….even if you still think Ruby is a pile of poo (like me), you’ll see how quick it is to get something up and running in Rails.
Before watching the video, make sure you create yourself a code directory.
cd ~ mkdir code cd code
And now enjoy the video!
http://media.rubyonrails.org/video/rails_blog_2.mov
Step 6. What next?
The good news is, that if you got through the video and everything worked, then you have everything you need to create your first web app. One good thing about Ruby is that there is a plethora of resources out there to get you moving from here. The one major pitfall is that there are HEAPS of tutorials that are hopelessly out of date, and can not only lead you astray but cause you some serious headaches if you mess up your installation!
There is a lot still to learn about RoR, especially for me, but I hope this is a good starting point. My goal was to write something that got ME up and running. I figure there are plenty of Windows developers out there (like me) that wouldn’t have the foggiest idea where to start, so if that is you, I hope this has helped!
Cheers,
Alan
fivesecondtest.com update coming soon…very soon!
posted October 13th 2009We’ve been working hard on the latest update to fivesecondtest.com. We’ve made a lot of changes, many of which won’t be visible in the update, but there are some fairly notable changes that WILL be visible in the next few days.
The first major change is the addition of Premium tests. Yes, we all knew it was coming eventually!
The first thing I have to mention is that our free tests will remain free in exactly the same state that they are now, and will forever remain free! Premium tests, however, give you three benefits (with more to come!).
1. You will receive double the number of responses given to free tests.
2. You will receive your results much quicker than free tests.
3. You get to feel good about supporting fivesecondtest.com!
One thing, that hasn’t been terribly clear in the past is that tests don’t keep getting results forever. Whilst it may seem a little unfair, currently most tests will receive about 12 results. We don’t decide this, it is a factor of how many tests are created versus how many responses are given. At the moment, that ratio is 12 to 1. That means for every test that is created today, 12 tests are viewed. The upshot of this is that we spread the love evenly, ensuring that all users get roughly the same number of results.
For some people, 12 results isn’t enough, whilst for others 12 is plenty. So we’re giving you the choice. Upgrade if you wan’t, but don’t feel obligated! Keep in mind this also about the speed in which you get your results, not just the quanitity!
The astute among you may realise that if premium test are getting MORE results, then everyone else must be getting less! You’d be correct. Partially. Another thing we’re trying to do in this release, and more so in the future, is promoting the idea of Karma. We’re letting you see who is doing your test, to give you an opportunity to do theirs in return. At the moment this is purely to help you help those that helped you. In the future, their will be benefits to your kindness…and yes we ARE watching who is being naughty and nice.
Another feature we’re adding is the non-repetition of tests. Once you’ve done a test, you should never see it again. If you do, one of two things has happened… someone has created multiple tests that LOOK the same, or my code is broken…in which case, let me know!!
We’ve now added a really nice manage page. This is a central location for managing your tests. Here you can enable, disable, upgrade, share and delete all your tests. In the future we’ll be adding more features here, for example, the ability to get results in your inbox, or subscribe to an RSS feed for a test’s results.
We haven’t changed the actual test process too much, although we’ve made it a little quicker for people who’ve seen the instructions before, you won’t have to sit through them again. The upload process has been revamped to clean up our front page, and we’ve changed how we show site activity on the front page. There have been a lot of other little changes here and there, and a lot of changes in the background that will enable us to release some much requested features in the near future.
Anyway… this is just a heads up! Matt will be giving another update when we go live, which should be in the next few days!
Cheers and thanks for your awesome support to date!
Angry Monkeys
How game designers can help application developers : Part 1
posted September 06th 2009I’m a gamer. Our house has an Xbox 360, PS3 (the new slim variety) a Wii, an old xbox, an old ps2, a Gamecube, 2 Nintendo DSs and even a Gameboy Micro, plus the PC and a pair of iPhone 3GSs. Most of these get a fairly regular workout, except for perhaps the Micro and the Gamecube. Suffice to say, we’re a gaming house. My wife is a Nintendo nut, and I’m more into PC and Xbox gaming. The PS3 is a blu-ray player….
What’s this got to do with application design? More than you’d think!
Usability, in application design, is often an afterthought. Not only in terms of interface design, but in terms of the user experience or user journey. This is mostly true for developer driven application design. The sort of design that evolves at the hands of a developer only to be “spruced up” by a designer later (if we’re lucky). We consider how things work, but not really how they will be experienced.
You can spot these apps a mile away. I know, because I’ve built plenty of them in my time. You don’t realise how bad they are until you see someone trying to actually use your application in a real world environment, something many developers never ever witness and as a result never learn.
Some typical examples, if I may:
- Features that were clearly important at the start of development, remain visually prominent well after the feature has been demoted in importance or the focus of the application has changed.
- Repetitive tasks use interfaces which are too cumbersome and time consuming to work, often as a result of a developer building an interface in isolation rather than as part of a work-flow.
- Building a data interface which requires pre-existing data but with no way to add it, requiring the user to leave their current process to add the prerequisite data somewhere else.
- Interface elements which are either non-obvious in their function or “tricky” to use for the inexperienced.
- The worst offender, inconsistent design and implementation. When a developer is left to their own devices, they will often come up with different solutions to the same problem. There is nothing worse than using an application which implements the same process two different ways in two different areas!
I’ll be honest, you’ll see a few of these issues in our own Fivesecondtest.com. But we’re working on addressing these… I promise!
Whilst most of these issues could be easily addressed by a better pre-build process or even just some rudimentary user testing, this is often something that is out of the hands of the developer. Often in a small team, these tasks fall into the hands of the dev, something which, let’s face it, we’re all ill equipped to deal with. Not only that, but often the entire build process is focused on getting the job done quickly, rather than having a good product at the end.
So, back to the games….
Imagine you’re playing an RTS like Command and Conquer, Age of Empires or Starcraft. The enemy is approaching and you’re in dire trouble. You need to build a wall, some defence towers and at least 20 units to fend off the attack. If all that isn’t enough, you have only about 5 minutes in which to do it. The pressure is on!
If the game is well designed, you will have enough time to fend off the horde. If the game is well designed, you will be able to achieve it all with a minimal amount of effort (time pressure aside!). Finally, if the game is well designed, there will be minimal interference from unrelated factors whilst you attempt to achieve your goals.
Let’s think about that more for a moment.
If it takes too long for us to complete our task, we will be overrun by the Zerg Swarm and lose the game. If it is too difficult to complete the task, we will most likely give up and go play something else. If the game interrupts us constantly by notifying us that our citizens are unhappy, that another player wants to trade with us and that we should consider building more farms, we will get annoyed at the game and blame it for making us lose.
Game developers spend crazy amounts of time considering these issues to ensure their game is fun to play, and yet in reality the same issues face us as application developers. We may not expect our users to have fun, but we still want them to be able to achieve their goals, and hopefully enjoying it enough to come back again next time!
Come back next week for Part 2 of, “How game designers can help application developers”
Topics
Search
Archive
- August 2010 (4)
- July 2010 (2)
- May 2010 (2)
- April 2010 (3)
- March 2010 (1)
- February 2010 (3)
- January 2010 (3)
- November 2009 (1)
- October 2009 (2)
- September 2009 (4)
- August 2009 (5)
- May 2009 (2)
- April 2009 (1)
- March 2009 (4)
- November 2008 (1)
- December 2007 (2)
Comments(1)