Posts

Announcing MapPrint 1.0.0

I'm proud to announce that the first stable version of MapPrint is out! You can read all about it here: github.com/afast/map_print The motivation behind this gem was to provide a way of exporting maps to png or pdf. But not only the map, but also GeoJSON on the map and images/texts around it. On top of simple text and images, it has the ability to add a scalebar and a legend to show the references of what is being printed on the map. Go ahead and take a look, there are a few examples and an in-depth explanation in the wiki.

Caleidoscopio de dos naciones

Países hay muchos Pero prefiero a dos Copas hay muchas Cuatro, tienen los dos Norte y Sur Disciplina  y Corazón A veces glamour A veces pasión Blanco y Negro por el pasado Por la gloria es el dorado De Azul el cielo pintado Rojo pasión! O estoy errado? Así mi corazón está pintado Muchos creen que dividido Pero no esta separado Es como metal fundido

Keep sidekiq running using monit

Image
As an application grows it starts taking care of more and more work. At some point the first task comes that needs to be processed in background and one of the usual suspects for ruby is sidekiq. Now, did it ever happen to you that you get it all up and running on the server and next thing you know it's down and you get error reports that stuff ain't working? Meet monit, a tool that'll let you get ahead of trouble. It automatically restarts programs when down and can even send emails upon failures. Install monit Depending on your package manager this may differ: apt-get install monit yum install monit brew install monit Configure monit Edit  /etc/monit.conf or  /etc/monitrc Uncomment(or add) these lines: set httpd port 2812 and use address localhost allow localhost Add sidekiq entry Create the file /etc/monit.d/sidekiq.monitrc with: check process sidekiq_application_production0 with pidfile /path/to/shared/tmp/pids/side...

Export to Excel with spreadsheet gem

While using the spreadsheet gem to export data to a Microsoft Excel file I encountered various problems and lack of proper documentation forced me to dig pretty deep. So here are a few tips you might find useful. The gem works with a workbook object and worksheets in this workbook. To get started: workbook = Spreadsheet::Workbook.new sheet1 = workbook.create_worksheet name: worksheetname To write a row of data as usually is done in reports you can use: sheet1.row(1).replace [ 'col1', 'col2', 'col3'] Rows and Columns are 0 based, so col1 would be printed on A2 (Excel coords). Now to the beauty of it all, formatting, first of all, create a format: bold = Spreadsheet::Format.new :weight => :bold bold20 = Spreadsheet::Format.new :weight => :bold, size: 20 nobold20 = Spreadsheet::Format.new size: 20 bold_grey_bg = Spreadsheet::Format.new pattern_bg_color: :cyan, weight: :bold, pattern: 1, pattern_fg_color: :black Use :weight to set bold,...

It's all about timing baby!

Image
Image: Suat Eman / FreeDigitalPhotos.net Yeah, it's about timing. There was a problem in one of our projects at moove-it related to slow processing. There is a daemon spawning new threads to process certain new entries to the database. The entries come from a different system, that's the reason for this program which processes each new entry. Sometimes at certain hours of a day there are peaks in the entries to the database and the process will fall behind by about 20.000 entries or more. So we started analyzing the code to understand what was happening and why it took so long. We noted that each new thread the daemon spawned took about 5 seconds to complete its task. As we narrowed the measurement we came up with some code that took 5 seconds to execute but it only involved access to the database. So thanks to Aaron Patterson's ( @tenderlove ) talk at RubyConf Uruguay about "Who makes the best asado" where he talked about rails and how it manages threads ...

Changing jobs

By the end of 2010 I asked my girlfriend to marry me. She said yes and so my life started to change. Specially my perspective of life changed. I meditated a lot about my future, what I wanted to do, where I wanted my family to live and my children to grow up. I started thinking a lot about my job. And so, during the last months of 2010 and the first of 2011, I was more and more convinced that I wanted something different for my career. I was working at Artech using GeneXus for web development. GeneXus is a great tool for web developing and it uses a 4th generation language. It is declarative and focuses on the knowledge of the business and you can generate to a lot of languages like java, .net, ruby, etc. For more info: genexus.com My personal problem with this tool is that I never felt completely in control. I will not discuss whether it was because of bugs in the tool or my ignorance using it. But still, I accumulated stress because things that should be easy weren't and some...

Video de la Massi

El trailer hecho pa la Maxi 2011