Project of the day: Chatterbox

March 2, 2008

I made a chat program called Chatterbox. It will be open source (of course, cause it’s in Ruby). Here’s a screenshot of the Client I made with WxRuby. You can make clients and servers with other languages though. And they’d be intercompatible!

chatterbox.png

Well, enjoy. It’ll be on DCWare soon, maybe later today if I think it’s really good.


                          Inquire: Ruby

                          February 10, 2008

                          How would I describe Ruby?

                          Io + Tcl + Python + (Others) = Ruby


                          Yo Wx-Ruby!

                          December 27, 2007

                          I’ve been looking for a Ruby GUI toolkit that’s not too hard and will install. Today I found it. WxWindows is pretty easy if you know your stuff. I’ve been working on FService and I managed to create a GUI for it. Here’s a screenie:

                          FService

                          Yeah. (Under Linux, of course.)


                          You asked for styles, you got ‘em

                          December 9, 2007

                          I added stylebar support to cRazzed, using RJS, cookies, and Sass.

                          So far there’s “wacky”, “aqua”, and “hot pink”.

                          Maybe I’ll be able to add a live demo… although it’s quite insecure… maybe I’ll just post the sources.


                          cRazzed, my new Rails app

                          December 8, 2007

                          … as in you must be crazy to use this!

                          The idea behind this is like an information center where people post content, and that content could be anything from some Textile (RedCloth) to a Ruby Snippet formatted by CodeRay.

                          Here’s a screenshot:

                          Screenshot of cRazzed


                          Rails: How to get started

                          December 7, 2007

                          First step to rails… Installing it.

                          Okay, so, it’s much easier if you have RubyGems installed, and if you do:

                          [sudo] gem install -y rails

                          You can then start a project.


                          rails [--database=sqlite3] [options] [projectname]

                          You could read the README, but that’s complicated and this is a lot easier.
                          First of all, “cd” into your new project.

                          cd [projectname]

                          Models

                          Then, you can start with a Model.
                          In Rails, Models are like collections of objects. Behind them is a technology called ActiveRecord. Using this, we can…

                          • create users… (script/generate model user name:string password:string about:string)

                          And other thing-a-ma-bobs.
                          IMPORTANT! Make sure you edit the db/migrate/[number]_create_[modelname].rb file first so that where it says create_table(…) there is a line like this right under it.

                          t.column :id, :integer, :null => false

                          Strangely, the generator doesn’t automatically put this in… I’ll have to file a bug report…

                          Rendering the information (a.k.a. Controllers)

                          Well, there is something called scaffolding which you could put in your app/controllers/[controllername]_controller.rb file… But I’m gonna teach you the hard , kind-of easy way.

                          First, the same way we generate a model:

                          script/generate controller [controllername]
                          # ...or...
                          script/generate scaffold [controllerandmodelname]

                          The app/controllers/[controllername]_controller.rb file should look like this

                          class [CamelCaseControllerName] < ApplicationController
                          layout "[layoutname]"
                          def [viewmethod]
                          [helping-hands]
                          end
                          #...
                          end

                          Views

                          I actually prefer using Haml rather than the usual RHTML, so go ahead and use RubyGems:

                          [sudo] gem install -y haml
                          #and
                          cd ..
                          haml --rails [projectname]
                          cd [projectname]

                          Great, your project is now Haml-enabled. What do I do now?

                          Fire up app/views/layouts/[layoutname].haml, and put in

                          !!!
                          %html
                          %head
                          %title= @title
                          %body
                          = yield

                          And, so, a beginning.

                          You may now delete everything in the public/ folder except the folders images/, stylesheets/, and javascripts/. After that:

                          script/server

                          Then fire up Firefox and go to:

                          http://localhost:3000/[controllername]/

                          Something should show if you configured everything correctly.


                          Numbers in Ruby

                          December 4, 2007

                          Okay, something new for my beginners, NUMBERS!

                          So, it sounds stupid, of course every programming language has numbers!


                          2 + 2 #=> 4

                          Yup. Works pretty much in every programming language.

                          Lisp:

                          (+ 2 2)

                          Why not 50×50?


                          50*50 #=> 2500

                          Why not 2 into 3?


                          3/2 #=> 1

                          ??? What just happened?

                          It seems ruby understands many types of numbers…


                          3.0/2.0 #=> 1.5

                          Cool…


                          Ruby!

                          November 14, 2007

                          Now I will turn you into my evil minions!

                          Okay, so for some of those noobs out there, here’s your first lesson.

                          Tradition has it that the first thing you should learn is “Hello, world!”. Let’s try this. Don’t worry, Ruby is designed for simplicity, so fire up IRB and let’s get started!

                          puts "Hello, World!"
                          

                          Yes! Yes! You’ve got it! Now compare to the popular C language.

                          #include
                          using namespace std;
                          int main() {
                          cout << "Hello, World!" << endl;
                          }
                          

                          Now, isn’t that easier? Muahahahahahaha! You are under my control now!


                          Follow

                          Get every new post delivered to your Inbox.