ruby


I have brought the Ming Ruby library up to date with Ming 0.3, added patches submitted by users over the past year and included a ton of user supplied examples. I hope to find time soon to include the real examples on a page by themselves with the code needed to generate each. You can check it out on rubyforge: Ming Ruby 0.1.8

I mentioned in creating Flash videos using FFMpeg that you could use Ming to create your own Flash video player. I've added a patch to the ruby -ming extension for video streaming so now it is possible to create a streaming player with both PHP and Ruby using their Ming extensions. The following examples show you how.
(more…)

After playing with the Ruby Ming extension a little more I found that they don't have support for SWFVideoStreams so I made a patch to add it. The patch also fixes the beta issues I described in building the ming ruby extension.
(more…)

I've been trying out Ming SWF output library in PHP for a few days and I thought I would give the Ruby extension a try to see how well it worked. It turns out that it is kind of old and busted but it is fixable.
(more…)

For fun I recently pimped out a ruby script that I had written for some testing with a little color and a spinner. If you have never used ANSI escape codes before I've put together a simple script that shows how easy it is.

(more…)

I'm not sure if something isn't set up correctly of if this is just a fact of life with rails but the sessions it creates never seem to go away. I think before rails 1.1 the sessions where stored in /tmp and now they are stored in the apps directory along with everything else so they is probably no internal mechanism to delete them. I only noticed because after about a month of an certain app running the disk on the machine started to fill up. After digging a little I found 50K ruby_sess.* files hanging out in the rails session directory.

Anyway it was easy enough to clean up the stale ruby_sess files by going into the rails webapp/session directory and then running the following command:

find -type f -name "ruby_sess*" -exec rm -f {} \;
 

I'm not sure why the app is creating sessions but it isn't something that stores state so I didn't have to worry about killing active sessions here. If you do need to worry about that you will probably want to toss a time on the find command.

After looking a little more I found a post about this that has a ruby way of cleaning up the sessions.

Tags: , ,

Setting up ruby to work with Oracle seems to be a pain for a lot of people. Here are the steps I follow to set it up on a linux box from nothing to Active Record or DBI in 7 steps.

(more…)

I was looking at implementing a luhn and credit card type check the other day in java and I noticed that there seems to be a lack of code for doing this in ruby. So I figured I would put something together for doing the checks in ruby.

The following function will do a luhn check for a given number (any number not just credit card numbers). The luhn algorithm is fairly simple, if you want to learn more about it check here.

(more…)