Hey kids, look what I programmed over the last few weeks! It is a small qtruby app I called Speek2me. It let’s you browse your directories and create new files and folders. I wrote it with Ruby, the best and most fun programming language on earth! :)
I am absolutely aware of the fact that there is not much novelty in this small piece of code but I like the idea of talking to my computer in a language that is more naturally than ‘ls -lh’ ‘mkdir newFolder’ and so on.
Sure, bash commands are way more compact than my own language but they are also way more difficult to memorize. I am still having problems to remember commands I don’t use that much.
If you take a look at the Firefox addOn Ubiquity you can see how you can speed up work with a more natural kind of input language. The automatic recognition of whole words gives you the possibility just to type in the first one or two letters and the system already knows what you are talking about. For example, instead of ‘delete all files from Desktop’ you could also just type ‘de’ press tab and the rest gets automatically completed like in bash.
Another cool thing about Speek2Me is that it is very easy to add new commands. One of the planed features is to give the possibility to add your own commands easily. It could look something like this:
on_command "get me a beer" do
# some ruby code to get you a beer
# ...
# return statement is a string as response
"Here is your beer, buddy!"
end
Have you tryed NetBeans for Ruby? No? Then go ahead and check it out. I have to say, it is the best IDE for Ruby I found so far. Finally I can code Ruby with an Intellisense! Very cool.
Ubiquity is a really nice plugin but it cannot console me for the long startup time and the numerous crashes I encountered with Firefox in the past 4 weeks. The time I saved with Ubiquity I spent waiting for that stupid Firefox window to pop up. And to be honest with you, the last time I used Ubiquity is at least one week ago. So I’m switching back to Safari! Give me a call when Ubiquity is available for Safari.
I was just working on some code for my RubyCocoa game (which I still haven’t found a name for) and I found quite an annoying intem about Ruby. It is very tricky to find bugs which arise from mistyped instance variables. Take a look at the following code:
class TestClass
def initialize
@head = 0
end
def method
@haed = 4
puts @head
end
end
t = TestClass.new
t.method
As you can see, I have mistyped the name of the variable @head in method. This piece of code will run without any complaints but it won’t do what you wanted. The result of the last line will be ‘0′ and not ‘4′. Now imagine you have a much more complex class with such a typo in one of your variables. This is a situation I came across at least two times by now an it took me quite a while to find this bug.