Deploying Yesod applications with Keter

Keter is the Yesod’s deployment system, fully featured and a joy to use, but there are some pitfalls that the documentation doesn’t cover, and that the user has to find out for her self; So I’ll try to give them away here together with a walk-through tutorial.

Although Keter is flexible and general enough to be used with various kind of applications and web frameworks, here I’m going to assume you’re using it to deploy Yesod applications. Moreover, I’ll assume you’re using Yesod’s scaffolding, as it is the preferred way to write production ready applications.

Continue Reading →

What's wrong with Java?

There’s already a rant about Java in a previous post, in which I basically list the annoyances that the ecosystem around Java imposes and how those relate and intersect with the problems of IDEs.

Here I’d like to talk about the issues of Java as a language. Although these are a significant part of what’s wrong with Java, keep in mind that it’s only half of the equation, the other part being its surroundings.

Continue Reading →

Using Cassius (Shakespearean template) with Hakyll

As a user of the Yesod framework, I’ve come to know and love the Cassius CSS templating language, although its reliance on Template Haskell is meant to fit better with Yesod’s needs and makes it a bit cumbersome to use everywhere else, I still like the templating language itself and its features a lot. That’s why I used it for styles generation in Silly Bytes together with Hakyll. In this post I will describe the process.

Continue Reading →

From Blogger to Hakyll

Hakyll is an amazing static site generator written in Haskell, it allows for blog posts to be written in markdown and then compiled with pandoc. It’s very well suited to be used with GitHub pages. It’s everything I wanted and more.

Silly Bytes went through its first 5 years of existence hosted on Google’s Blogger service, and it did well. Although Blogger offers a fair amount of flexibility, you can’t have total control over it, and having to write posts with the built-in WYSIWYG interface or pasting the HTML output is the biggest pain point of it. I solved most of that by writing a CLI tool that allows me to write posts offline in markdown, compile them, and deploy them from the terminal leveraging Blogger’s API. But that’s still too much of a flex.

In this post I’ll describe the process of porting an existing Blogger blog to Hakyll and GitHub pages using Silly Bytes itself as a case study.

Continue Reading →

Blogger posts from markdown and CLI

There are plans to migrate Silly Bytes to Hakyll and GitHub pages, but till then I’m still stuck with Blogger and wanted to make the posting process as painless and automatic as possible.

Every post I write is currently a separate git repo hosted on the Silly Bytes GitHub organization. The post is written and maintained in Markdown using Pandoc and a convenient Makefile generated by the made script.

Writing posts in Markdown is nice but is not that advantageous if you still have to mess around with Blogger’s web interface, so here is the plan:

  • Write posts in Markdown
  • Use made to generate a Makefile
  • Generate HTML with $ make
  • Push the HTML post to Blogger using Google’s APIs
Continue Reading →

Gentle introduction to STM32 ARM Cortex microcontrollers and boards programming

So you’ve been using AVR, PIC or some other microcontroller for a while and would like to try 32-bit ARM chips like the STM32 line. Want to start playing with them but don’t know how or where to start; I’m here to help.

ARM has taken over the embedded world, they’re ubiquitous in smartphones, tablets, laptops, computers inside computers, cars, refrigerators, microwave ovens, monitors, printers, you name it.

Note: Be aware that ARM is an architecture that manufacturers can implement. Is a common mistake to think ARM is a microcontroller on itself, it is not.

Continue Reading →

TDD (Test-Driven Development) Physical Traffic Light

Robert C. Martin (Uncle Bob) said in a talk:

Imagine you have a button that you can push, it will test your code and if everything is working a green light will come up, but if something is broken, a red light will come up […]

He was of course talking about TDD. It got me inspired to build this little tool.

Hardware schematics, firmware and host software is available in this GitHub repository. Along with information on how to compile and use.

This is a physical toy traffic light to be used with software development TDD (and testing in general) tools. It will not boost your productivity nor make you a better programmer or TDD practitioner, but it looks cool :)

Continue Reading →

Vim + Haskell

So you’re writing in the right language using the right tool already, let’s put some extra magic under your sleeves.

This is what we expect to accomplish:

  • Omnicompletion
  • Compilation and testing
    • Building
    • Testing
  • GHCI integration
  • Hoogle integration
  • Convenient mappings
    • Argument text object
    • Jump to importations
    • Jump between functions
  • Ghc-mod integration
    • Type inserting
    • Case splitting
    • Type asserting
  • Hlint integration
    • Linting
    • Managing the location list
  • Code formatting
    • Hindent integration
    • Trailing white space
    • Trailing blank lines
    • Spaces over tabs
  • Easy arrows generation
  • Types abbreviations
  • Yesod Haskell web framework
Continue Reading →

PIC16F876A conversión analógica digital + UART (Ensamblador)

Note: This post is available in Spanish only. Please use a software translator.

He dejado de usar microcontroladores PIC por los motivos explicados aquí, pero voy a dedicar este post para escribir y explicar un programa sencillo escrito en ensamblador para el PIC16F876A.

El objetivo es el siguiente:

Se pretende usar el microcontrolador para llevar a cabo la conversión analógica-digital de una tensión variable (un LDR o un potenciómetro por ejemplo) y transmitir el resultado usando la UART. Además debe ser posible recibir por la UART un byte que debe alterar la configuración del Conversor Análogo Digital (DAC) interno del microcontrolador para, por ejemplo, cambiar el canal de entrada de la señal analógica o modificar la velocidad del reloj de conversión.

Continue Reading →

Aprende Haskell rápido y difícil

Esta es la traducción al español del artículo “Haskell the hard way” por Yann Esposito.

TL;DR*: Un corto y denso tutorial para aprender Haskell.

Asómbrate con Haskell. De verdad pienso que todos los desarrolladores deberían aprender Haskell. No creo que todos necesitan convertirse en ninjas de Haskell, pero deberían al menos descubrir que es lo que Haskell tiene para ofrecer. Aprender Haskell abre tu mente.

Continue Reading →

Seamless Vim-Tmux-WindowManager-Monitor navigation

This Thoughtbot post describes how to make Vim and Tmux work together in Harmony based on this crhistoomey’s plugin, allowing you to traverse both your Vim and Tmux windows and panes respectively.

Having the ability to traverse Vim and Tmux splits without having to think about it using ctrl-h, ctrl-j, ctrl-k, ctrl-l is brilliant! But I still had an annoyance source from the window manager (Ratpoison) and the multi monitor setup.

So I took the same concept and extend it to those uses cases. Now I use ctrl-h, ctrl-j, ctrl-k, ctrl-l to move through my Window Manager splits, my Tmux panes, my Vim windows and my Monitors with minimum mental overhead. Here is how.

Continue Reading →

How to write C in 2016

Matt wrote a very interesting and totally recommended post about how to C (as of 2016). Keith Thompson wrote later a very detailed and rather useful critique with some extra notes about Matt’s post. I urge you to go ahead and read both articles.

Here I’d like to point out some things I deem important about tooling.

Continue Reading →

From PIC to AVR

This is my humble contribution to the PIC vs AVR holy war.

TL;DR: I was previously a PIC user but decided I hate it, switched to AVR and love it!

PIC from Microchip and AVR from Atmel are both wonderful families of microcontrollers for the hobbyist and professional as well. I’m going to argue, however, that AVR is overall better for every purpose and because of multiple reasons.

Continue Reading →

Firefox control on steroids (Firefox + Ratpoison + Mozrepl)

Here is what We expect to achieve. Every command starts with Ratpoison’s prefix + ‘f’ like in C-t f:

**Command**     **Action**

    f           Facebook
    y           Youtube
    r           Reddit
    g           Github
    o           Open a new tab
    w           Open a new window
    s           Search for the current content in the clipboard
    /           Jump to the tab with url mathing a user input
    l           Open a new tab with the lyrics of the currenlty playing song (mpd)
Continue Reading →