Jugando con Fluxbox nuevamente

No he usado Fluxbox desde el 2007, la verdad lo utilizaba mucho en mis PCs (Pentium 3 o similar), y lo abandoné al comprar mi primera PC que ya podía ejecutar decentemente entornos más pesados.

Como mi hermano comenzó a utilizarlo de nuevo decidí darle otra oportunidad, y en poco tiempo ya lo tengo configurado para mi gusto:

No recordaba lo sencillo que es de configurar, a pesar de utilizar archivos de texto es algo muy intuitivo y simple y ya he subido a mi repo mi configuración para sincronizarla con la de mi laptop o cualquier otra máquina que utilice. Extraño el efecto tipo exposé de Gnome, y las sombras eran algo lindo, pero la verdad es que la velocidad que se gana utilizando este WM es impresionante.


Comparto un truquito para convertir fluxbox en un tiling WM básico (sacado del blog de Dale Swanson) , en su archivo keys agreguen:

Control KP_0 :Minimize
Control KP_1 :MacroCmd {ResizeTo 958  540} {MoveTo 00 00 LowerLeft}  
Control KP_2 :MacroCmd {ResizeTo 1920 540} {MoveTo 00 00 LowerLeft}  
Control KP_3 :MacroCmd {ResizeTo 958  540} {MoveTo 00 00 LowerRight}  
Control KP_4 :MacroCmd {ResizeTo 958 1060} {MoveTo 00 00 UpperLeft}  
Control KP_5 :Maximize
Control KP_6 :MacroCmd {ResizeTo 958 1060} {MoveTo 00 00 UpperRight}  
Control KP_7 :MacroCmd {ResizeTo 958  540} {MoveTo 00 00 UpperLeft}  
Control KP_8 :MacroCmd {ResizeTo 1920 540} {MoveTo 00 00 UpperLeft}  
Control KP_9 :MacroCmd {ResizeTo 958  540} {MoveTo 00 00 UpperRight} 


Working with beego pagination

 I wanted to take a while to explain how to use this library easily. Basically we begin adding the following import:


Paginator class is pretty straightforward, so in our code we just have to make use of the current controller Context, define how many posts per page we want and the total count of posts in the query:

    paginator := pagination.SetPaginator(this.Ctx, postsPerPage, countPosts)


In the view we can format our paginator in the following way:


{{if .paginator.HasPages}}
<ul class="pagination pagination">
    {{if .paginator.HasPrev}}
        <li><a href="{{.paginator.PageLinkFirst}}">First</a></li>
        <li><a href="{{.paginator.PageLinkPrev}}">&laquo;</a></li>
        <li class="disabled"><a>First</a></li>
        <li class="disabled"><a>&laquo;</a></li>
    {{range $index, $page := .paginator.Pages}}
        <li{{if $.paginator.IsActive .}} class="active"{{end}}>
            <a href="{{$.paginator.PageLink $page}}">{{$page}}</a>
    {{if .paginator.HasNext}}
        <li><a href="{{.paginator.PageLinkNext}}">&raquo;</a></li>
        <li><a href="{{.paginator.PageLinkLast}}">Last</a></li>
        <li class="disabled"><a>&raquo;</a></li>
        <li class="disabled"><a>Last</a></li>

Aggregation it's pretty neat

So on my latest project I choose to go with MongoDB for a shopcart which heavily relies on parameters.
I've found many advantages of using Mongo on a shopcart, letting me reflect my design in a much efficent way than relational databases.

Aggregation it's kind of a dreaded word when you start looking at mongo documentation, but it's really not that difficult in my experience
for example these are a couple of snippets of code to aggregate orders.

Having the following order structure:

    "_id" : ObjectId("548f1b1ec874da273d8b4567"),
    "addresses" : [
            "_id" : ObjectId("548f1b04c874dab0398b4567"),
            "address" : "foobar 123",
            "country" : "AR",
            "state" : "fdsafsda",
            "city" : "fdsafdsa",
            "postal_code" : "3100",
            "type" : "billing",
            "user_id" : NumberLong(3),
            "updated_at" : ISODate("2014-12-15T17:31:48.953Z"),
            "created_at" : ISODate("2014-12-15T17:31:48.953Z")
            "_id" : ObjectId("548f1b16c874dab53b8b4567"),
            "address" : "foboar 432",
            "country" : "AR",
            "state" : "fdsafdsa",
            "city" : "fdsafdsa",
            "postal_code" : "3100",
            "type" : "shipping",
            "user_id" : NumberLong(3),
            "updated_at" : ISODate("2014-12-15T17:32:06.015Z"),
            "created_at" : ISODate("2014-12-15T17:32:06.015Z")
    "buyer_id" : NumberLong(3),
    "created_at" : ISODate("2014-12-15T17:32:14.616Z"),
    "items" : [
            "rowid" : "c151bea3e12059c20b371ef10d401aea",
            "name" : "Test Product",
            "qty" : NumberLong(1),
            "price" : NumberLong(3200),
            "supplier_id" : NumberLong(2),
            "updated_at" : ISODate("2014-12-15T17:32:14.627Z"),
            "created_at" : ISODate("2014-12-15T17:32:14.627Z"),
            "_id" : ObjectId("548f1b1ec874da273d8b4568")
    "status" : "pending",
    "total" : NumberLong(3200),
    "updated_at" : ISODate("2014-12-15T17:32:14.616Z")

As this is a multi-supplier shopcart, we need to retrieve only the items bought from a specified supplier, this quick query does the job:

    "$unwind": "$items"
    "$match": {
      "items.supplier_id": 2
    "$group": {
      "_id": "$_id",
      "items": {
        "$push": "$items"
      "addresses": {
        "$push": "$items"
      "date": {
        "$first": "$created_at"
      "total": {
        "$sum": {
          "$multiply": [
    "$sort": {
      "date": -1

Ok, it's kind of scary, but going step by step is not much harder than your regular SQL sentence, albeit more curly-braces happy for my taste.

First we unwind the items collection inside an order to operate through each of it's element. Then we match only the items we're interested in (those who belong to the current supplier)
we then proceed to group the results in a new order, we define an order id, a collection of items ( we push the selected items into that collection), the addresses of the customers (billing & shipping), the date, and we sum the item prices to get the totals, in the last part of the pipeline we sort the results by date.

Note that the output document is pretty nasty compared to our original order, so we could use $project it to make it nicer, but it's kinda off topic

New layout and backend

I remade the layout and backend of my blog, now it is made in the Beego framework,
I must admit that getting used to it it has been a bumpy road for me, mainly because it's a total new way of web programming for me.
As you can see most there are missing features from the previous blog, mainly comment support and photo uploading, but I plan to add
support for those in the coming months ( probably better implemented than on the previous blog anyways).

As always the code can be downloaded at Github, if you want to learn how to make a Beego website it might prove useful since it's a simple project
anyway be warned that this was made in a hurry in my spare time so it CAN and WILL be improved on the coming months, mainly separation of controllers
( the admin controller is a mess), added validation, loading  of configuration values and more.

Well, it's nice to have something new to play with. I hope you like it.

Introducing ShareMyFiles(Eos Sharer)

Let me introduce you our pet project here at EosWeb, it's codename is  sharemyfiles ( but probably it's going to be changed to a proper name somewhere in the future). The main idea is to have a personal file sharer that it's easy to use, requires no configuration and it's powerful. So far the development of sharemyfiles has been really interesting and rewarding, as a side project I've been able to have a more realistic approach at developing Go applications.

Right now it's mostly a prototype not really recommended for any serious usage, but we're gradually incorporating new features, such as Zip archive download last week, and probably we will make it way more secure on the coming months and add better usability.

That's cute, but show me the code

The code is hosted at github, you can feel free to download it, tinker, destroy, recompose, print the code and then use it as a fuel for your BBQ if you don't like it. But if you are interested in contributing, we will be happy to have your help.

Good Gophers Share

At EosWeb we are working on a new  desktop/mobile application. This is a new venture far away from our traditional web application solution, and we hope we succeed as coding in Go is both exciting and interesting. I don't want to give to much details, not by the sake of secrecy but more because it's really on early stages these are some of our most defined goals:

  • Ease to install and use
  • Multi platform support ( Linux/Android/OSX/Windows)
  • Multiple user interface: we seek to mantain both a GUI version and command line interface for servers.
  • Open Source

Keep tuned for details



[ES] Go + Gtk3

Ultimamente he estado MUY entusiasmado con Go, y he aprovechado para profundizar con éste el uso de las librerías Gtk3. Fruto de esto ha surgido estaa pequeña app de ejempo que puede servir para quienes quieran comprender a grandes rasgos el funcionamiento de una aplicación gráfica escrita en esta librería.

La aplicación no hace uso de gtk.builder ( Glade XML)  ya que justamente quería aprender a crear los widgets haciendo uso sólo del código. La verdad es que para no estar tán familiarizado con el lenguaje debo decír que me tope con muy pocos problemas, Go es en definitiva un gran lenguaje, que brinda muchos beneficios a la hora de programar.

Supongo que durante la semana ( aunque más intensamente el próximo fin de semana) estaré ideando alguna otra aplicación que pueda ser más útil. Estoy muy tentado a hacer algo más con MongoDB ( y ya he estado jugando un poco con la librería mgo)

MongoDB and noSQL

So today I tackled some problems at work with MongoDb, this is my first time using a NoSQL data engine. Basically I woke up and realized that what my client wanted required a EAV pattern implemented, I shivered, I've worked a lot with Magento and even when I think it's a excellent tool it is the prime example on why EAV can be a PITA.

For those not familiar with EAV, wikipedia describes it as:

Entity–attribute–value model (EAV) is a data model to describe entities where the number of attributes (properties, parameters) that can be used to describe them is potentially vast, but the number that will actually apply to a given entity is relatively modest. In mathematics, this model is known as a sparse matrix. EAV is also known as object–attribute–value model, vertical database model and open schema.

So far so good, the thing is that EAV isn't all roses and candy, or it is when you are modelling the data as it looks good on the database, implements easy and inserting records is a piece of cake, but ... the horror comes when querying for content, just look up on google and you will find some scary pieces of sql just for retrieving some trivial data.

Enter MongoDb...

MongoDB allowed me to avoid this, at least so far and have the app ready for the first prototype demo for the client. And it's quite easy (for this case of use at least). Plugging this implementation of Mongo on my site I successfully converted everything to NoSQL and just had to change a few snippets of code here and there. However I didn't want to put all my money on MongoDB just yet so I ended up with a Mongo/MySQL hybrid, just using the first on the model that I needed the functionality in.

I'm not really sure if this is the best approach to solve it, not being familiar with NoSQL databases makes developing in it a little slower.

Beware of luddites

This is a nice tip for newcomers to the Linux world, beware of luddites and excessive passionate fanboys. Sadly the Linux community is the only one that offers it's users enough niche markets to build different identities, and when somebody feels like this niche might no longer exist to accomodate their self perceived personality he starts getting angry.

Latest years have been a very bumpy road for Linux, with new technologies emerging and people feeling attacked by these technologies. I'm talking about KDE4, Gnome 3 and now SystemD, what experience has taught me is that whenever this pointless wars emerge we better keep off of it. Also it's important to keep our egos uninvolved, since most of the time We Do Things The Right Way ™ and everyone else is wrong as usual.

But in all seriousness, we should have a realistic vision of our capabilities and those of others, I'm not talking about just nodding in approval, but being honest with ourselves. I'm a simple web developer, which excludes me from many many of these grounds, I still can make suggestions, but I really should question myself if I'm debating someone that has years of experience working in OS Design.

Another thing learned, is that experience is valuable, it's really valuable. It gives you the perspective of being really involved with the progress of a development project and involvement with the state-of-the-art methods and techniques; and that's something to respect in fellow developers.

In the end progress will inevitably come, and we better get used to it or get knocked off the road.


picture by Martha Soukup CC-Attribution License

Quick update

So, I'll do a quick update. I've got a new laptop, which is neat. Specially because my previous one was really bad (Pentium M chips really suck). I've got a Lenovo b50-70 with an core i5 processor and 4gb of RAM, despite having some issues with the realtek card ( which i solved compiling the lwfinger rtl wifi driver ) everything works really good. I also installed the tlp package to optimize my (Fedora 20) system. I'm happy because this lappy is really quiet, lightweight and it doesn't overheat. It's also really fast despite not having a SSD (yet).

Just as I post I used AirDroid because I was too lazy to actually get the damn cable ( just came back from the gym on a hot day) it seems like a cool app. It also makes me feel like someone is watching my phone... oh well, I guess those are the perks of living connected nowadays.

Yesterday I watched Social Network, and despite several of my friends telling me it sucked I found it that it's a really great movie. In fact I understand that it's not appealing to non-programmers, but if you are into web development YOU SHOULD check it out!

Now I'm watching JOBS, it's the week of the biographical movies with actors that don't look at all like the guy.