Up until 2022, if you were born in North Carolina and your gender identity didn’t match what your birth certificate indicated, you had one significant requirement to change it. You needed to go through sex reassignment surgery. But all that recently changed, now (April 2023) North Carolina Vital Records has a more reasonable set of requirements for changing the sex marker on your birth…
I’m Diego Medina, I have been developing secure and real-time applications since 2001. Around 2010 I started using Scala and Lift and for many years I was one of the most active members on the mailing list. You can find my on twitter @fmpwizard, github or email me at diego@fmpwizard.com I Love learning new technologies, and for the past 8+ years I have been using Go for performance hungry…
We use reflex to restart our local app whenever we make changes to any Go file. But I run into a small problem, because we use Go mod with the vendor pattern, reflex ends up on our go.mod and go.sum files, but I really don’t want them there. They are not part of the app and should not be vendored. I didn’t want to ask developers to run go mod tidy before sending a Pull Request, so I…
Today I thought it would be good to write down some information about me and my career: Technical Side I enjoy being proactive, for example, a few weeks ago we had to run data for a large client. It was a process that normally runs for a single day worth of data, but this time we had about 4 years of data. And it took about 7 hours to run. I could have left it like that, but I knew that it was…
There were many things I considered wrong when I was a child. One of them was knowing, in my Soul, that I had an older brother, but my family denied it and I didn’t have any physical proof. I remember countless afternoons, sitting at the kitchen table, trying to figure out how to fit an older brother in our family tree. My mother was pretty young when she had my older sister, and I was…
There are things that are best to leave in the past, or so I thought. For the past few weeks, memories of my upbringing have come back to the surface. Memories that I have only shared with my wife, and maybe a friend or two. Now I think it’s time to talk about them in the open, hoping that it will help me heal, and maybe it will help others with similar stories.
Throughout my life, I have always felt that life was unfair to different groups of people: minority groups, poor countries, etc. On a more personal level, I didn’t know how to stay at peace with the fact that I was able to leave my neighborhood in Argentina, and have a safe, stable life in the US. The best I could come up with, or anything I would read about, was that each person has their…
Since I found out my wife and I were having a daughter, I’ve been looking for the best way to teach her how to code. I knew I didn’t want to be pushy, I wanted to find the most natural way for this to work out. Fast forward to the present, she is 8 and a few weeks ago she decided to sit next to me while I was doing code review at work (I love working remotely!
I have been dreaming of driving an all electric car for years, the Tesla model S and X are way out of reach, pricewise. But all other options seemed to be cars in the 100 miles per charge range, which I thought was too little for our family. (Now there is the Bolt EV with an estimated 238 miles). The search This past April, I started looking for our next car, most of the time it was my wife who…
I recently started using the escape analysis report that the go build tool provides. I’m still new to it, but what I get out of it so far is knowing if a function can be inline, and/or if a parameter/variable escapes the stack and is allocated in the heap. The short and simplified version of why it is good when your function is inlined is that it saves the overhead of a functionn call by…
For years I have been just a passive users of SELinux, in the early days using it in Fedora, I would disable it because there were too many applications that didn’t work with it, I knew it was wrong, but didn’t have the knowledge nor the time to really look into the right way to deal with it. Over the years Fedora added a huge number of policies to the point that 99% of the apps I use…
I have enjoyed automatic ssl/tls certificates from Let’s Encrypt thanks to caddy server for several months already. But a couple of weeks ago I started a new side project, where I needed to run a web application that would listen for incoming requests from the nexmo servers. This was a great opportunity to try one of the many let’s encrypt/acme clients in Go. I originally used…
Go - Making a program 70% faster, by avoiding common mistakes. I often read articles where a developer would say they made this or that change to their code and a benchmark shows their function going from taking ~300ns to ~170ns and they were really happy about it. I think it’s great that there are devs out there really squeezing every CPU cycle they can. But this isn’t one of those…
Lift Comet for native Android apps A very powerful feature in Lift is its comet support, with very little code you can have an app that gives feedback to your users in real time. If you are new to the concept, these videos may help you. But things get complicated when it’s time to write a mobile app and you want to have the same real time feedback on a native app.
Improving compile time in Go The Go compiler is really fast, and I got so used to it that when compiling OwlCrawler was taking about 8 seconds I started to worry (granted I generate 3 executable files). Tracking down the issue. Some google-fu pointed me to adding the -x parameter to go build to see more details on what was going on. I noticed that the compiler was taking most of the time building…
Iron.io - Tech support done right Last week I woke up to find an email from Iron.io telling me that I was running low on my available IronMQ quota. Somehow I had made around 800,000 API requests in a week by running my OwlCrawler project. How? The reason was easy to spot, every time we got a resource offer from the Mesos master, the scheduler was checking two message queues for new tasks.
OwlCrawler - Multiple Executors per Scheduler using Mesos As I continue working on OwlCrawler, I have refactored the code a lot. After getting some great feedback on the Mesos mailing list, I went ahead and split the single executor into two separate Executors that are triggered by the main Scheduler. On the scheduler, I now have these two ExecutorInfo entries: fetcherExe := &mesos.ExecutorInfo{…
Distributed web crawler using Mesos and Go OwlCrawler is a simple yet distributed web crawler I’m working onto learn Mesos. I’m using the mesos go binding to write the logic and use Iron MQ to trigger tasks that fetch pages. At this point I’m storing the url and html in etcd but I have plans to move that to CouchDB in the near future. A bit of history. Writing a web crawler is…
Getting fancy with closures in Go While at the hackday at Gophercon I thought it would be a good idea to do some code refactoring of Cortex. Over the past 24 hours I made many changes, but one that I specially liked was that I could pass a function as a parameter to another function. This is possible in Go because functions are first class (values? | elements?) And this made the code a lot…
Go Cortex - talking to Flowdock While on one side Go-Cortex let’s me control an Arduino using voice recognition, I also wanted to expand Cortex into helping me and my team at Brokc Alloy. we currently use flowdock for internal conversations and there were two things that I wasn’t too happy about: There were times when people would say the current temperature where they live, and that…
HTTP Streaming Using Go As I continue adding features to Cortex I needed to connect to the streaming api that Flowdock provides. A quick Google search took me to this post which shows how to do that. It works, but while I was reading the code, it looked pretty low level for my taste. So I decided to try and use the http package. Making the initial request url := "https://stream.
Voice command for Arduino and Raspberry Pi using SMS and Google Now. A couple of weeks ago I went ahead and bought the Wolfson sound card for the raspberry pi. I was hoping to integrate it into Cortex to improve the voice recognition setup I had. This turned out not to work so well. The card has two built in microphones, but I had to be really close to the board to get a good quality recording.
Go Cortex Using voice recognition and an ultrasonic sensor Last week I released a small project I was working on. After I published it, I kept thinking of different ways to use it and how to make it better. I wasn’t too happy with the idea that I had to type my message on the browser, so Cortex could process it. My goal is to have Cortex run on several raspberry pi computers all across my…
Go Cortex - using Wit.ai on a raspberry pi connected to an arduino and written in go What is it? Update I wrote a follow up post where I added voice recording capabilities. Cortex is a service written in the Go language that listens for regular sentences and tries to convert them into commands to execute. And in the near future, it will also give you relevant answers. Internals Cortex understands…
GoChat - Using Go Channels A couple of weeks ago I wrote about using Go with Twitter Flight to write web applications. But I didn’t put too much emphasis on the go code, it was mostly to highlight some patterns which I think can be applied to any web application. This post is more about the go code. Using Go channels. One of the main features I like from Go is that it has concurrency…
Using Grunt and Bower with Lift I’m very grateful that I always get a chance to work with very smart people, and I get the chance to learn new tools, languages, techniques, etc. Here I’ll talk about Grunt, which Tim Nelson introduced me to. And I’ll talk a bit about Bower and how they can work together to help you in your Lift applications. What is Grunt? For those using Scala,…
Things I like about Go I was going to start this post by pointing out all the bad things about Scala and how great Go is, but I decided against it, Go is such a great language, that you don’t need to trash another language to point out Go’s strengths. So here, I’m going to list how awesome a language Go is. Things I love about Go. Fast compiler (I mean, super fast).
Twitter Flight and Go The last couple of weeks I have been using the Go language and twitter flight for a small project. I remember watching an introductory video on go right around the time I go into Scala. It look like an interesting language, I really liked their concurrent built in approach, among other features, but it was way too new as a language for me to get into.
Getting Started with Twitter Flight - Book review. About two weeks ago I was asked if I could review a book about Twitter Flight. That email came in at the right time, as I was looking into trying some new language and/or framework and Flight was something I had in my list of frameworks to try out. The publishers gave me a free copy of Getting Started with Twitter Flight, written by Tom Hamshere…
Different ways to use Comet Actors in Lift (Part III). AngularJS’ turn On my previous post, I showed how you could write a simple chat application using different techniques. The last technique was using knockoutjs, but recently there have been several posts on the Lift mailing list about AngularJS, and as I wanted to try it out, I thought it would be interesting to see what a chat…
Asynchronous snippets in Lift 2.5 On my last post I wrote about using LAFutures on your snippets. And one of the things I said was that the syntax I was looking for was this: val future1: LAFuture[String] = new LAFuture() def render = { '#my-slow-loading-element *' #> future1 } Well, over the last couple of nights I got to what I think is a great syntax: class Sample extends Loggable { val f1:…
Using LAFutures with snippets in Lift 2.x Update There is a better alternative now on this post ================================== For a while I wanted to do something like this on a Lift snippet: val future1: LAFuture[String] = new LAFuture() def render = { '#my-slow-loading-element *' #> future1 } And the idea was that the page will load right away, and once the LAFuture had a valid value, it…
Different ways to use Comet Actors in Lift (Part I). With some bits of knockout.js Lift has many great fundamental features, focusing on security at its core is one of them, and another one is the ability to take a feature like its comet support and integrate it with JavaScript (and any JavaScript framework you wish to use). Background. When I started using Lift, most of the code I wrote was in…
Different ways to use Comet Actors in Lift (Part II). With some bits of knockout.js Update: I have updated the source code on the github branch, and there is part III, using AngularJS. On my previous post, I gave an introduction of my javascript adventures (kind of). This post is about re-writing the sample chat application that comes with Simply Lift using three different techniques. Technique I…
Lift and Raspberry Pi Several months ago I blogged about controlling a servo motor with an Arduino board and a Lift application running on my computer. That was a fun little experiment I did, but having to use my regular laptop to send the signals wasn’t all that great. So I decided to try something a bit different this time. The light. I had successfully run a Lift application on my…
Status page for your Lift server. For the past week I have been building a little Lift application to run on a Raspberry Pi computer. This application is supposed to control the GPIO pins that come on the Raspberry Pi. But, as this little computer is pretty slow to boot (well, a few seconds), I thought that I should add some kind of status page that I can keep hitting from my laptop, and once I…
Comet Actors in Lift. One of my favorite features in Lift is Comet Actors, I love how easy they are to reason about, and they work great. I went ahead and recorded a presentation which focuses just on comet actors. They are split into 3 videos and I hope you find them useful. All 3 videos in a playlist: Lift Comet Actors presentation The slides are on Google Drive (they are all 3 parts in one…
How does T => JsCmd send data to Lift? I remember my first few interactions with Lift’s ajax support, which were also my first few interactions with Scala. It was pretty hard to get my head around some of the method signatures I would find all across Lift’s source code. The one that took me a while to understand was T => JsCmd . What was hard to understand was, how that type would mean…
How I work with Lift. Something I enjoy very much is teaching, specially when Lift is involved. Mainly because I learn a lot by teaching others, and secondly because I have learned a lot thanks to those who spent the time to either teach me directly, or indirectly through blog posts, articles, etc. Since I joined Elemica about 9 months ago, I have spent a good amount of time sharing what I know…
Lift Sitemap One of the many things I have recently learned from Tim Nelson is how to better use Sitemap. You know, most of us declare our site maps in Lift like this: def sitemap = SiteMap( Menu.i('Home') / 'index', Menu.i('About') / 'about', Menu.i('user.list') / 'user' / 'list' >> LoggedIn, Menu.i('user.create') / 'user' / 'create' >> LoggedIn ) To most people this looks just like any other…
H2 web console and Lift At work we use H2 as the default database while we develop our apps. This helps because t’s just easy to setup and if anything goes wrong, we just delete the file and restart our application. All this is nice, but one thing that wasn’t so smooth was accessing H2 from outside Lift, and be able to run any queries against it. Before I joined Elemica, they were…
Textile and Lift One way Lift makes developing applications fun, is by taking care of security for you. Most of the time, you don’t have to worry about common hacking attacks like XSS, this is because Lift doesn’t treat your data as plain Strings, it treats them as NodeSeq. Instead of displaying html tags, it will html encode them, before returning them the browser. This happens…
Dynamically adding fields to a Lift application A question that I see on the mailing list from time to time is how to dynamically add fields to a page. The usual answer is that they cannot really do that, at least in a clean way, but we offer a few work arounds. One of them is to declare x number of fields, and just use jQuery to hide/show them. This past week I had the same requirement at work.
A distributed Lift Comet Chat Application Lift has very powerful comet support, and 2.5 is bringing even better support. But one of the things I always wondered about was, how to have comet work across several containers. A few months ago I had an idea of how to do this, and was planning on talking about it at OSCON, but my talk wasn’t accepted. Then I decided I could just blog about it and…
Using Twitter Finagle, the Streaming api and Lift Last weekend I had a chance to try Finagle’s streaming client. It wasn’t that easy to find an example of how to use it, so I thought it would help to post a working example. Finagle The complete object here on github. I added as many comments as I could, so it should be easy to understand. Basically you stablish a connection to the…
A couple of days ago I had to rework an autocomplete widget we had at work. The old implementation was using Lift as a REST service, and then jQuery to do the autocomplete. It worked well, but it was exposing some internal database IDs and I knew we could do better. The goals. I had a few ideas of what I wanted to get out of this rewrite: As the user typed a name, there should be a drop down menu…
Arduino and Lift - controlling a servo motor. Introduction. I have been meaning to control devices from a computer for a long time. But for one reason or another, I never got to it, that is, until now. About a year ago I found out about the Arduino project, it looked very interesting, but I didn’t want to learn yet another language, I wanted to use Scala for this, so I put the idea to the…
Why do we need Template(() => Templates()) ? I have seen a few emails on the Lift mailing list where people use Template(() => Templates('filenamehere' :: Nill)) but I never knew why they used that, instead of just naming their templates on the sitemap entry like: Menu.i('myPage') / 'filenamehere' And today I run into at least one use case, which makes a lot of sense and I’m very happy is…
Debugging Lift applications using IntelliJ 11 and SBT From time to time someone will come to the Lift mailing list asking how to debug their applications from an IDE. I have to confess that most of the time I simply use println or write a spec2 test. But today I decided to just go ahead and write a little intro on how to setup sbt and intelliJ IDEA 11 to debug a Lift application (and for that…