24 Jul 2014, 11:19


Dart logo

yeah, about that…

Google’s attempt to improve on Javascript and get a server-side language at the same time. I have always wanted something else to thrive over javascript, and tried many good options like coffeescript or opal. Most of them are really good and easy to use as long as everything is correct. Sadly that is not what happens. The bug fixing is a vital phase of software development, and in this is the problem with all the languages that compile to javascript. Fixing the code is already hard enough as it is, imagine if you have to debug an auto-generated code in a language you possibly don’t master. For this reason I never adopted any of those for my development projects, and that is why dart quickly got my attention when they announced the dart VM embedded in chrome (ok, it is dartium, a branch of chromium but still counts).

Not just that, it is also a very flexible language where types are recommended but not enforced. syntax is a bit outdated, they opted for the java style to make developers feel comfortable. With languages like ruby and python getting more and more users everyday I am not sure it was the best decision. Although I have to agree, every developer feels familiar to a language with all the semi colons, curly brackets shenanigans that resembles java.

They have also done a good job in their package system, the pub. It feels just the same as using ruby gems.

Dart start is quite close to Sinatra, it is still lacking the template rendering, but it s a good start (pun unintended)

IDE. Ah, the IDE… why always Eclipse google? It is so bad, rebuilds workspace every other minute, hangs all the time. In fact, it hangs so much, my most used terminal command is “killall dart”. Seriously, why Eclipse again?

Overall it is good and I hope it works out. Being a google product, I believe it will be forced upon us like google+ anyway, so why not to make the best of it and enjoy all the benefits?

09 Jan 2014, 11:25

Release It!

Someday your little database will grow up. When it hits the teenage years - about two in human years - it will get moody, sullen, and resentful. In the worst case, it will start undermining the whole system (and it will probably complain that nobody understands it, too).

Release It - Michael T. Nygard

15 Oct 2013, 13:20

Sharepoint full page little trick

For those of you with a very specific task to create a hotsite in sharepoint(MOSS) and can’t (or dont want to) create a new template just for that, here it goes: https://gist.github.com/tiagodll/6990155 with this simple snippet your div is the new body of your page so go ahead and put the whole html code you need in there. Loading ….

15 Aug 2013, 22:21

Css expandabox

Those of you following my posts for a while might know that I like javascript. I like javascript as much as I like not using javascript when I can use css instead.

So trying to make an expandable box I realised its behaviour is very similar to a checkbox. you have the small excerpt and when you click it you get the full text.

That being said, it is possible not only to change the label properties according to its state, but to set its state by clicking the label.

  input[type="checkbox"].expand-content{ display:none; }

  input[type="checkbox"].expand-content + label .collapsed { display:block; }
  input[type="checkbox"].expand-content + label .expanded { display:none; }

  input[type="checkbox"].expand-content:checked + label .collapsed { display:none; }
  input[type="checkbox"].expand-content:checked + label .expanded { display:block; }

<input class="expand-content" id="theradio" type="checkbox" />
<label for="theradio">
    <div class="collapsed">
this is the small content</div>
<div class="expanded">
this is the big content</div>

This is also available on my gist profile

13 Jul 2013, 17:14

Elixir + MongoDB + Dynamo -> because we are all web junkies

Now that you know how to have an elixir software accessing mongodb, what is the next logical step? to build a blog engine, obviously

So lets get started, shall we?

23 Jun 2013, 17:15

So, what is elixir?

Elixir logo

A bit of background first: In my masters I had a module called Programming Paradigms and Languages. What this module is about is the different paradigms, and one language for each of them.

The chosen languages were: Object Oriented: Ruby Functional: Clojure Logical: Prolog Process Oriented: Erlang Mathematical Programming: Matlab

Out of that what I can say is:

Ruby syntax is awesome. So elegant but there are many performance issues
Clojure is very nice for the academic world, but I cant imagine anyone using it for commercial software building.
Prolog. Ah, prolog... I have had a love/hate relationship with this since my undergrad. Powerful but very specific.
Erlang: blazing fast. handle processes like no one else, but it is probably the worst syntax I've ever seen. Ok, not the worst, but close to that (Yes mind fuck, I didn't forget you)
Matlab... this doesn't even had to be in this list

So, after that my conclusion is: I want a language able to handle many processes like erlang, but with a nice syntax like ruby and maybe add there some cool recursion features from clojure if you can.

That is elixir.

“Elixir is a functional meta-programming aware language built on top of the Erlang VM. It is a dynamic language with flexible syntax with macros support that leverages Erlang’s abilities to build concurrent, distributed, fault-tolerant applications with hot code upgrades."- http://elixir-lang.org/

So, just like that it has become my favorite language. But just like all open source, making it work is always a hassle. But this is for the next post.

Lets have an easy start: how to add Elixir to your path? I am new to the mac world, for those of you that like me are not great at this, let’s go step by step:

check if it is already there: type "echo $PATH" on bash (capital letters)
if elixir is there, you are good to go. if it is not, add it by typing
echo 'PATH=$PATH:/Software/elixir/bin' >> ~/.bash_profile (I put it in the folder Software under root, use your path)
close your bash and open it again. type iex, if you get the interactive shell, go ahead and play with it :)

07 Nov 2012, 17:29

Raspberry pi + ruby + sinatra = #winning

There is something about hardware/low level development that amazes me. I am not really good at it, I don’t actually want to be, my relation with hardware is the same I have with sports: I love to learn new sports, practice it a little bit, but when it starts to get too competitive, ie, the guys are getting serious about it, I loose interest.

That being said, I have to say I’ve played a lot with this things. The first one was the pic. I friend of mine(electric engineer) helped me to get started and to like it. The next step was to upgrade(or is it downgrade?) to arduino, a platform much easier than pic, and that comes ready for development. I got a lot of fun with that, but then when I’ve moved to london, I brought just the essential, so it was left behind.

But when I read about the new raspberry pi, got all excited again! I would be finally able to create high level code and run it in a computer with the size of a credit card. Then you ask: but master, how can I do that???

Simple little grasshopper, you just have to have a pi and a little patience. step1: install ruby; step2: install sinatra; step3: install node.js, and this is the tricky one, I had no idea it was needed… run your code and GG!

Now, making your rasp visible to the outer world… that is for another post. ps: It involves changing your router settings, and that…. that is enough to make me sad…

24 Mar 2012, 17:31

PetaPoco. Said whaaaat?

So, maybe some of you guys checked out my dead database project, the dNet.Db. It is free and open source @ http://dnetdb.codeplex.com/ I started developing that framework because I always thought it is important to automatize the simple and boring part of database. And by this I mean that it load an object values should be as easy as object.load(), or object.LoadList() if you want an array. And it was working fine. But we all know how a project like that requires a lot of maintenance, adding new databases support, fixing bugs and things like that.

A few weeks ago I was talking about this to a friend and he told me about the project massive. Massive is nice, but it doesn’t support everything I needed (mainly because of the stored procedures), so trying to go further into that, I found the PetaPoco(http://www.toptensoftware.com/petapoco/).

This is the kind of framework I consider that fit all my needs:

  • really easy to install
  • easy to fetch objects from the db
  • supports sqlite
  • allows you to use plain old SQL for all the other situations.

So I’ve been using it for a bit now, and it hasn’t let me down. I am not thinking about using my framework anymore. So I decided to write a little tutorial of how it works.

Install: There is a nuget for that. If you don’t know what a nuget is, here is a link, probably I’ll talk about this someday, but this is really cool, check it out.


public class Project
      public int Id { get; set; }
      public string Name { get; set; }

Voil’a… Easy as pie… then you could say:-Hum… the loading part might be tricky…. not really… this is the code:

var db = new PetaPoco.Database(“Base”); ViewBag.Projects = db.Fetch<Models.Project>("");

and that’s it. Ok, that’s not it. Well it is if you have a really simple object, but you don’t. So… now comes the tricky part? Yes. Compared to the other part it is. but not so much

The loading bit is exactly the same, but now I’ll add some more code to the model:

    public class Feature
        public int Id { get; set; }
        public int ParentId { get; set; }
        public int ProjectId { get; set; }
        public string Title { get; set; }
        public string Description { get; set; }
        public Project project { get; set; }
    public class Project
        public int Id { get; set; }
        public string Name { get; set; }
        public Dictionary<long, Feature> Features { get; set; }
    class ProjectFeatureRelator
        Dictionary<long, Feature> features = new Dictionary<long, Feature>();

        public Project MapIt(Project p, Feature f)
            Feature fExisting;
            if (features.TryGetValue(f.Id, out fExisting))
                f = fExisting;
                features.Add(f.Id, f);

            f.project = p;
            p.Features = features;
            return p;

Now, this looks a lot, but let’s understand what happened there: 1 - I’ve added a new class (feature). This class have a primary key Id, and I want it to load the project associated with it. 2 - I’ve added a new property to the project class:Features. this is because I want the list of features to be loaded as well. Note that I’ve annotated the [PetaPoco.ResultColumn] to make the connection. 3 - So far so good, but now comes the ugly part: the join. I admit it is not an elegant code as the rest, but it is not so bad, and it is very easy, you just have to copy it, and use it in your code.

I don’t know if it is a good idea to use this in a big project, but for the small ones, I will definitely use it.

23 Mar 2012, 17:37


So seems like asp.net mvc is finally popular? That’s perfect, I mean, this is how it should have been since the beginning.

Let’s start with what is mvc: Mvc is to build the application as model, view and controller. What does that means? It means that the view should be only responsible for showing the interface, the data access should be in the model layer, and everything else should be done by the controller.

Sounds nice, right? Old but gold… But the thing is… and how about the web? Usually we had a asp / aspx / php / jsp / etc file. This file is requested, and then, from this point on you can call your controller logic. But this isn’t the proper way to do it. This way your view is mixed with the controller.

And then, there was the light! true MVC to the web applications. Is this hard to implement? off course not, my little grasshopper…. You just have to think your application in a different way. and what is that way? Routes!

And your routes file should look like this:

public static void RegisterRoutes(RouteCollection routes)

            "Default",                                              // Route name
            "{controller}/{action}/{id}",                           // URL with parameters
            new { controller = "Home", action = "Index", id = "" }  // Parameter defaults


And how do you use it? Easy: you set it as your controller name, and action, so every time the user types that address the method defined as action is called. so when the user types website/home/index, the method index inside the controller home is called.

Ok, we’ve got the code, but how to display it to the user? In the controller method, there should be a return View(). You can return View(“name-of-the-view”)

Now you have the request processed in the right place, and you have your view. Sweet! :D Buuuuuuuuut, something is still missing… and that’s because you have to connect those 2. And this is called the mighty ViewBag!

View bag - speaking like mr jobs would say - is a magical, fantastic… the better ever created object to carry values between controller and view. So how do you use this thing? Easy:

ViewBag.YourVariable = "The title";

and in the view you can use it like this:

By the way, this brings up another topic:RAZOR

Once again: this is magical, fantastic, amazingly simple. you can put C# code in the view just by adding a @ in front of it. And, if you want to put a chunk of code, just use

  //several lines of code

and how about the model? Well… the model is the same as before, I won’t talk about it here. But that’s it for now. I’ll write more about razor.

23 Mar 2012, 17:30

Hello world!

To start with, I’ll explain why I am creating this blog. Maybe you know my old blog. It is dead now. It was in my old server and I decided not to keep it, but what makes me mad is the domain. it expired and now I don’t even have email. Anyway, new blog, new posts, new life. I don’t hate java anymore, yay! Just kidding… I still do. But not as much. You see, now the servlets seems to work. The IDEs are decent. And java is so far behind .Net, they don’t even try to compete anymore… Maybe that’s the best part. So this is my first…ish post… at least the first in this blog.