Pages

2.08.2016

On alarming

https://docs.google.com/document/d/199PqyG3UsyXlwieHaqbGiWVa8eMWi8zzAn0YfcApr8Q/edit

Debugging with certainty

One of the things I've been trying to learn lately is how to debug. I've always dreaded the thought of debugging someone else's code as there's no documentation, or their code is terrible, or I'm dumb, or all of the above. I'll say to myself "there's not much that I can change if those are the reasons, other than damning my luck". But that's no solution.

After talking with a very brilliant co-worker and friend, he suggested me to watch this talk. He knew I'd bite instantly as the speaker is a Clojure developer and I'm a Lisp fanboy. I have to say that I loved the talk but for a deeper, less obvious reason. I'll explain.

Debugging with the Scientific Method gives you certainty in an uncertain situation. Those familiar with psychology will agree with me that there's nothing the mind avoids the most other than uncertainty. Not knowing what to do or where to go makes you feel uncomfortable and, if you are prone to it, panic. Under such circumstances, one of the responses is to flee. Quit. Surrender. Give up. Probably try tomorrow?

Having a tried and true method to debug (and fix) things is The Silver Bullet. No matter what your problem is, no matter how badly documented or how many sins in your codebase. Follow the process. Carefully. Systematically. It will take time (screw schedules!) but you'll fix it. That's a certainty.

Emacs + OSx + iterm2 = Meta key works!

Three years ago I got a Mac laptop at work, and it was my first contact with Mac/OSx. Two of those three years I avoided using it for any meaningful work. There were weeks at a time that I didn't even carried it with me. Not so much because I didn't like it (hey, it's a Linux under the hood!) but because all my work environment was already set up in my work desktop and I'm not a fan of duplication.

Everything was well until curiosity got me (and I started working from home more frequently) so I decided to get out of the comfort zone and really try to use it. It's been a year already. I can say that the most painful thing has been getting the Meta key in Emacs to work correctly. I was able to avoid finding a solution for a year (boy, am I lazy!) and settled with half-solutions like using Esc instead, but now it is inevitable to find one since I bought a personal laptop recently. 

I tried first some of the stuff here: https://www.emacswiki.org/emacs/MetaKeyProblems
The first more or less useful set up was to swap modifier keys in System Preferences but that changed the whole layout for other applications and it meant strain injury for apps that weren't emacs. 

Finally, this is the stuff that worked:
  • In System preferences: 
    • Keyboard > Modifier keys > Reset all to default
    • Spotlight > Uncheck "Spotlight menu keyboard shortcut" or set it to something else 
  • Install and launch iterm2
  • In the iterm menu > Preferences > Keys > Remap modifier keys, set:
    • Left command key: Control
    • Right command key: Control
    • Leave the rest on default
  • Now in iterm menu > Preferences > Profiles, set:
    • Left option key acts as: +Esc
    • Right option key acts as: +Esc
  • Profit!
Happy emacs!

12.06.2015

IntelliJ and Lombok

Here's how to start using Lombok in IntelliJ:
  1. Get the plugin: https://github.com/mplushnikov/lombok-intellij-plugin
  2. Follow the instructions in that page according to your platform
  3. Go to File > Project Structure > Global Libraries > Click on (+)
  4. Look for the latest version of org.projectlombok:lombok (org.projectlombok:lombok:1.16.6 at the time if this writing)
  5. For each project module: Go to File > Project Structure:
    1. Select the module
    2. Go to the dependencies tab
    3. Click on (+)
    4. Library...
    5. Global Libraries > Lombok > Add selected
Done!

6.14.2012

The second debate

Here's the second debate between the Mexico 2012 presidential candidates in short:
  • Andres Manuel Lopez Obrador: "My proposal is legitimate"
  • Enrique Peña Nieto: "I'll solve everything if you legitimate me"
  • Josefina Vazquez Mota: "I am legitimate for I am a woman"
  • Gabriel Quadri de la Torre: "My proposal is that you legitimate me"

Not really enlightening if you ask me.

4.16.2012

Problems with git push from Emacs in Windows XP

When I try to push to my GitHub repos, I have found that git push origin master just sits there indefinitely.

How did this happen and how do I solve it?

Let's begin.

My configuration is: Windows XP, RailsInstaller (Ruby 1.9, Rails 3.2), Emacs 23.3.

Some symptoms: I am running a Windows shell from Emacs with Meta-x shell and I try to push to GitHub.but the command just sits there indefinitely and ssh is not found so I can verify I am using the correct RSA public key.

The cause: The shell environment is not including the RailsInstaller path modifications.

(Sub-optimal) solution: Run the Git Bash shell found in Start > Programs > Rails > RailsInstaller and push from there.

A proper solution would be to include the environment variables that the RailsInstaller provides but, taking a look at the "Command Prompt with Ruby and Rails" shortcut found in the same location as Git Bash, it looks like I need to do more than some key punches as running Emacs from that shortcut is not useful either.

I'll try to keep this problem in mind if I find a solution in the future so I can update this post.

Bye!

9.19.2011

End of the holiday

Yesterday was the last day of the long September weekend. I had a really good time with my family. I visited my grandparents, too. Me and my girlfriend celebrated our third year together. I feel very happy.

Moreover, I enjoyed reading the first chapter of Lovász's, et al "Discrete Mathematics". I'm almost done with the first chapter and I think I have understood and learned a lot of things. It is surprising the way they explain counting and how each thing connects beautifully with the next; starting with a simple story of a geek party and, 20 pages later, ending with properties of the binomial coefficients. I can tell there's no way to avoid learning something and being amused as well. I can't wait to start with the second chapter but first I'll finish the complementary exercises of this one. 

I had good rest, too. I slept really well this four days. I needed a short vacation like this and I'll need a lot of energy tomorrow. There are a lot of things to do: finish the spec review, prepare some slides about how we are addressing the challenges with the libraries we are using, and start with the database seminar. I think I'll need to use the Pomodoro Technique so I can have more control of my time. I'll need every minute I have.

Good night.