Since a friend of mine told me of using OpenOffice as a daemon to run tasks automatically, I thought that would be nice to try it as a part of a proof of concept to a slideshare mini clone. It would be a matter of uploading the original file, convert it using OO and displaying a page along with it. There`s an API and many clients. I choose not to develop a new client and used JodConverter. Of course I would have to develop a new converter if I wanted to inject or run customized procedures over a document.

Read the rest of this entry »

Ultra exciting mashups in python ! Check https://zenmachine.wordpress.com/rss-to-twitter-automagic-poster/

Hi. Long time no see eh ?

There is nothing wrong with Ruby. Fine language, great gems and so on. But its interpreter sucks. Since I had to cross compile it for arm, and later fooling around with it while a friend had to run some heavy weight gdb debugging on it, I noticed that most of it was sloppy. Worst than green threads and stuff which really matters when developing for a high load and concurrency environment, there are places that plainly sucks.

It’s a shame, because Ruby itself is great, and I really appreciate that you can do everything in a lot of ways. It makes porting libraries from other languages a breeze. I hope it gets better by 1.9 or 2.0.

Meanwhile, I started to do some stuff using python, specially for networked services. Check out my come back at  https://zenmachine.wordpress.com/web-services-and-twisted/

Cheers !

icalendar gem

November 19, 2007

ICalendar (iCal) is a standard for calendar data interchange. There’s a gem called icalendar, which helps to parse and generate such file, so you may use data from your google or exchange calendar to feed your app (or make it generate data to feed your calendar, e.g., a link to Digg or Facebook in each post of your blog to setup a TODO item).

To parse a .ics file (iCal invite or TODO item) it’s just a matter of looping thru the elements in a given calendar. A ics file may hold more than one calendar, end each calendar may contain events and TODO itens.

#!/usr/bin/env ruby
require 'rubygems'

require 'icalendar'


if (ARGV.size < 1) then
 puts "Usage: ical_parse.rb <calendar.ics>"
 exit
end


cal_file = File.open(ARGV[0])

cals = Icalendar.parse(cal_file)
if (cals.size==0) then
 puts "Empty calendar"
 exit
end


cals.each {|c|

 puts "\nEvents\n\n"


	if (c.events.size == 0) then

 	puts "Empty event list"

 else

 	c.events.each { |e|

 		puts "---------------------------------------"

 		puts "Seq:"+e.sequence.to_s
 		puts "UID:"+e.uid.to_s
 		puts "DTSTART: "+e.dtstart.to_s
 		puts "summary: " + e.summary
 		puts "location: " + e.location
 		puts "description: "+e.description

 		if (not e.attendees.nil?) then

 			puts "attendee: "
 			e.attendees.each{|a|
 				puts "\t"+a.to
 			}

 		end

 		puts "---------------------------------------"

 	}

 end


	puts "\nTODO\n\n"

	t=c.todos
 if (t.size == 0) then

 	puts "Empty TODO list"

 else

 	puts "---------------------------------------"

 	t.each {|oi|

 		puts "Seq:"+oi.sequence.to_s
 		puts "UID:"+oi.uid.to_s
 		puts oi.dtstart
 		puts "summary "+oi.summary

 	}

 	puts "---------------------------------------"

 end

}

 	

Ruby and document indexing

October 30, 2007

I did some Ferret testing and the results were pretty fine. Check it out.

oy for another post

October 29, 2007

This time, scraping the web with ruby and hpricot. Did I told you before that this is not a Ruby blog ?

https://zenmachine.wordpress.com/scraping-with-hpricot-and-ruby/

imap rss feed

October 25, 2007

Here is a RSS feed generator for IMAP accounts using ruby and the excellent RubyRSS library. It may be changed to read from multiple accounts. Source code.

Also check RubyRSS website at http://www.rubyrss.com/ .

meet marvin

October 18, 2007

Marvin is a file manager for SciTE made in ruby and gtk2 I hacked to help me in a PHP project. It’s called marvin as a homage to a weird cat my mother has. Check the source code.

helping tools for scripting

October 16, 2007

Some tools I’ve been using to scripting.

  • to convert source code to html: source-highlight -s<ruby|php|perl> -fxhtml <sourcecode>

A friend of mine gave me a netgear wifi router and I decided that would be fun to have a systray applet to check for connected stations. The basic parsing was easy, but then came the GUI part. The first idea was do it in a multi plataform fashion, and later on I just decided to do it with the most important toolkits (in general) that I found bindings for: GTK and WxWidgets.

Alto I dig WxWidgets, I found the GTK binding more mature and (I never thought I would say that) easier to use. I I really think GTK is counterproductive when programming in C (or worse, C++) for Linux, but thankfully GUI programming is not my daily job.

So that’s my first GUI app in Ruby. I kinda tried to follow code guidelines for each toolkit (when I could found them) and keep the same overall structure (separated dialogs, timer control for scraping the router’s info, etc).

If I had to do another GUI app in Ruby (which I’m planning, a SciTE project manager), I would use GTK and chill out about the multi-plataform-OS stuff. Usually these kind of scripts tend to be used only by who programmed them and as example to other programmers rather than morph into a full fledged project.

WxWidget version

GTK Version