Personal Memo

install_name_tool -change libmysqlclient.16.dylib /usr/local/mysql/lib/libmysqlclient.16.dylib ~/.rvm/gems/ruby-1.9.3-p125\@MIMO/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle

clojure koans first stopper solved

Yesterday, I started the clojure koans, and all the koans related with the data structures were to easy and showed how easy and cool data structures are at clojure, but I got my first stopper :) when I was faced with a higher order function that I’d completely forgot.

What are higher order functions?

They are functions that have at least one of the following properties

  • Return functions (for example functions that are mapped to other functions like Integration - Calculus)
  • Take at least one function as a paramater (function composition g(f(x)))

From my examples looks like I hadn’t forgot what is a mathematical higher function, and the functions composition case remember me, the C/C++ feature to receive functions pointers as parameters ;) quick example at http://www.cplusplus.com/reference/clibrary/cstdlib/qsort/

My solution for the first higher order function koan https://github.com/sarcilav/clojure-koans/commit/cd2f89e5620a4a195c03d7e71e8bc8827b045345

You could check my solutions at https://github.com/sarcilav/clojure-koans/tree/solutions

Thoughts? Suggestions?

Trying clojure-koans

Let’s see if clojure koans is a good approach to clojure as ruby koans is to ruby.

Why I like ruby koans approach

Koan is used in Zen-practice to provoke the “great doubt”, and test a student’s progress in Zen practice.

Basically because they let you learn by examples and show the corner cases of situations that you will find in the wild when you are working with the language.

Other reasons are:

  • It introduces unexperienced developers to the red-green cycle, that we will use later on projects (TDD).
  • They usually show how to test/code in more than one way the same piece of code
  • It introduce important things as debugging and error handling

I’ll update later this week, with my thoughts on clojure koans

The Dynamic Hungarian Algorithm for the Assignment Problem with Changing Costs

After postponing this read like a year, is time to face it

Super easy html to pdf in Rails

After trying PDFKit, htmldoc (PDF::HTMLDoc) and PDFmyURL, the winner is PDFmyURL.

WHY not PDFKit?

I dislike PDFKit for the installation issues and the stupid big amount of dependencies, because you need a lot of XOrg and Qt libs to make it work (it depends on wkhtmltopdf —the fugliest and random name, I know that it comes from Webkit html to pdf but it is ugly—), and I don’t want to play with xserver libraries on my server just for this. But I must say that PDFKit works and makes an amazing work, so if you don’t care about having X libs on your server you can try it.

WHY not htmldoc?

Ruby has an amazing wrapper for htmldoc, and it works really well, but It (htmldoc) can handle styles properly, so if you are planning to use it to ‘print’ one of your views, you must remake it without styles, or just be happy with the version without styles.

WHY PDFmyURL?

  1. Super easy to use.
  2. Fast and Free web service.
  3. If you need customization you can pay it for it.
  4. I just need 3 lines in a helper to use it https://gist.github.com/1230528
  5. It has a nice api
The big TVs

The big TVs