20160430

Ruben Berenguel, PhD

Started a long time ago. It was supposed to be about a phenomenon leading to chaos: separatrix splitting. I got a research grant. I worked on holomorphic dynamics. Travelled. Presented. Too many roadblocks with the separatrix problem. Switched topics. Welcome to a different new world, infinite dimensional dynamical systems. I read the literature. Researched, proved some things. My grant ran out. I worked. A lot. Too many times I considered giving up. Kept thinking of the sunk cost fallacy. My advisor and my girlfriend helped me keep at it. I pushed on.



All this happened in early February, and since then many more things have happened. Right now I'm working part in London and part at home as a mix of software and data engineer, with a dash of devops to make it more spicy. Truly a jack of all trades (but I specially like the data science part).
Written by Ruben Berenguel

20151102

SyncTeX and pdf-view-mode for emacs

Or, destiny is cruel
Back in the days of yore, when I was switching between my Windows machine and a Linux machine, I remember having SyncTeX active in my Windows machine. It was a wonderful experience: SyncTeX lets you click anywhere on a generated file from LaTeX and gets back to your editor, to the place generating where you clicked. This was extremely useful, specially later on when you need to adjust many formulas to fit and you need a bit of back-and-forth-ing.

Then I got a Mac, and since Preview is so handy I slowly forgot about SyncTeX. Time went on, and I merrily kept on editing LaTeX files as usual. I even managed to deliver my PhD dissertation a couple weeks ago, the formal speech will be in a month or two (come at your own risk). AucTeX’s preview saved most of the days, so I slowly even forgot SyncTeX existed. Shame on me indeed.

The other day I got an annotated PDF from one of my advisors, and I just couldn’t open the annotations. I tried all programs I had for Mac, and no luck: annotations weren’t showing, just saw the icons. Surveying for some command-line tool to extract annotations (just in case) I found pdf-tools, a replacement for DocView based on Poppler. It had the awesome ability of actually displaying annotations, with it it was pretty clear the annotations were broken in that PDF. I got a new set of PDFs from my advisor with the annotations in place, though. While waiting for it to arrive…

I saw SyncTeX was an option of pdf-tools. I had been using that, hadn’t I? So, I activated SyncTeX in AucTeX (it is TeX-source-correlate-method, see here) and indeed: I could have two frames, one with the actual LaTeX sources and the other with a PDF, and go from one to the other. Even hyperreferences in PDF work! See (well, click on the full-screen mode to see it larger or you won't see anything)!



Getting pdf-tools to work wasn’t incredibly tricky (given the hoops you need for some packages, sometimes). Just

brew install pdf-tools

and after reading

brew info pdf-tools

I was told to run

  emacs -Q --batch --eval "(package-install-file \"/usr/local/Cellar/pdf-tools/0.60/pdf-tools-0.60.tar\")"

and this does the trick (well, change emacs for your actual emacs, which likely is /Applications/Emacs.app/Contents/MacOS/Emacs) You’ll also need to add to your .emacs file (or temporarily in your *scratch* buffer)

(setenv "PKG_CONFIG_PATH" (concat "/usr/local/Cellar/zlib/1.2.8/lib/pkgconfig" ":" "/usr/local/lib/pkgconfig:/opt/X11/lib/pkgconfig"))
(getenv "PKG_CONFIG_PATH")

and run

(pdf-tools-install)

as advised in the package’s README. And that's it, open a PDF and activate pdf-view-mode to check everything is in place. Well worth it!
Written by Ruben Berenguel

20150619

Cold Brew Yerba Mate

Thermometers are already hitting 29°C with temperature feelings around 32 or 33. It’s this time of the year when I need cold drinks to keep me alive. I’m not a big soda fan (except when I’m on Finland in the Nordic Go Academy camp, they are so stocked on soda that I’m dragged in,) so my go-to drink is usually freshly squeezed lemonade with some ice cubes and sometimes a pinch of soda to make it fizz (and make it less acid.) Oh, and quite a bit of sugar. Even if I like sweet drinks, this has less sugar than a normal soda anyway.

A drawing I did 2 years ago.
More recent drawings on Sketchedlife.net
But when I need a caffeine punch, my summer treat is cold-brewed yerba mate. You may know yerba mate as the typical Argentinian “herbal tea”, which is exactly what it is. You can have a quick look at Wikipedia to know what it is and how it works.

Fondness for yerba mate is an “acquired taste,” much like coffee or beer. It is bitter, grassy, weird. Then you start to appreciate it and then, suddenly, you crave it. Adding sugar makes the process faster, if you have a sweet tooth. From a personal point of view, the first time I tasted mate I thought it tasted like grass (much like nowadays when I drink green tea, even if I kind of like green tea.) Then one summer my shoemaking teacher brewed some cold and sweet mate with lemon juice, and it tasted great. I was a convert from then on, and have kept drinking since then.

During winter, I like my mate (which I don’t drink that often during cold weather, though) warm, drank as is custom in a hollowed and treated gourd. But during summer, there are few things that taste as good as some cold brew (or hot and then cooled down) mate with lemon (known in some parts of South America as tererĂ©.)

Cold brewing, now that I mention, is the process of “brewing” something using only cold water. It is getting increasingly popular as a way of preparing coffee, specially in places where getting some good espresso is hard. To cold brew some coffee just pour a decent amount of ground coffee (a cup for each 4-5 cups of water, IIRC) in a bottle, fill with water and let it rest in your fridge for a couple days (stir a few times during the process.) After two days you’ll have a very good tasting cold coffee. For an extra flavour kick, before drinking I pour cold brew coffee through my Aeropress. And beware of not drinking the sludge at the bottom!

You can cold brew almost anything that can be tasted, so in addition to caffeinated stuff you can use fruits or herbs. In this case, they are known as Aguas frescas and we also prepare them at home so we have always something cold and natural to drink. Our favourite so far this summer is 2 sliced oranges, 15 hibiscus flowers for 2 litres of water and 24 hours of chill time. Add a little sugar to taste. In close fight, the peel without any white of a grapefruit and the pulp of that same grapefruit with 2-2.5 litres of water. Hibiscus is optional, sugar is mandatory afterwards. It's bitter, powerful and refreshing.

For cold brewing yerba mate, you follow the same basic procedure: some amount of mate, some amount of water and some lemon or orange if you like the taste. My personal amounts (nothing prevents you to change it depending on your love for bitter/citrus tastes)

  • 3 tablespoons of yerba mate
  • The skin of half a lemon, with the least amount of “white” you can manage
  • Half a lemon in dices, peeled (with the least amount of “white”, again)
  • Around 1 litre of warm (around 50 or 60 degrees Celsius so the brewing starts a little quicker) water
  • Once lukewarm, put in the fridge for a day or two (once it reaches its taste peak it won’t get much tastier anyway)
With this amounts I usually add 1 teaspoon of sugar per glass to get it sweet enough. Be sure to remove the white from the lemon, it will be quite bitter if you don’t.

You can purchase yerba mate from Amazon, or if you live close to some South American market, you’ll definitely find some there. Which also lets you purchase your winter supplies: a gourd and a bombilla (the metal straw used to drink) in person, so you can ask for best sizes, materials and even ask about preparing. I have tasted Taragui and Rosamonte, and they are very good, most mates are pretty similar anyway. Once you get used to the taste though, getting some really good mate pays off.  It's also pretty good to have a good quality electric kettle. By the way, if you prefer sweet mate in the winter, add sugar to the heated water instead of adding sugar to the gourd. 
Written by Ruben Berenguel