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.
Diagrams, cache and threads 101 (and a little ranting)
December 3, 2008
I’ve been using inkscape to draw diagrams, specially abusing its import openclipart feature, but I found out that for simple sequence diagrams, there is another great tool: http://www.websequencediagrams.com/.
Their API is clean and the text parsing very accurate.Choose “Napkin” in the style combo and click draw to see their demo.
I found it via another gem, this caching 101 page for dummies. Things like this and this ‘Threads primer’ are necessary reminder nowadays. There are a lot of butchered applications and architectures popping everywhere, and without these kind souls providing the best of them going thru basic concepts, we’re all doomed.
There goes my contribution, a kind of memcached 101, both in napkin and blue modern styles !
Paste the code below to generate these diagrams. Note the alt 'command' I used to put both cases in the same diagram. Gotta love that.Alice->Application: Asks for her Profile Application->Memcached: is Alice profile there \? alt Data is not cached yet Memcached->Application: No, it's not here Application->Database: get me Alice's Profile Database->Application: here is the data - it took me a lot of time, k \? Application->Memcached: set Alice Profile there else data is already cached yay Memcached->Application: Got it end Application-->Alice: Response (her profile data)
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 }

