Tramp: A great tool for remote code development.

GNU Emacs is an awesome editor which has been around for quite some time. The flexible nature of it and its extendibility has turned Emacs into one of the best text editors which you can do pretty much anything in it including listening to music, checking email, surfing web, playing tetris and so on (I am not gonna go into Emacs vs. Vim debates at least for now). One of the most useful Emacs packages is Tramp. Tramp simply brings ssh to Emacs and allows you to load a buffer over ssh, which is wonderful for remote editing. Consider this scenario, which is very likely to happen to a lot of us: you have a powerful machine somewhere which you have remote access to. You need to write some code or implement an algorithm which needs a lot of computation power or a specific hardware (BAZINGA! GPU). Obviously, there are one hundred and one different ways to do it. You can use a cloud file sharing, online repository management system (github etc.) or if you wanna be geeky, ssh to the remote machine and fire up an editor on it. All of these are fine but if you are used to your editor and you have configed it to your fitting, it becomes tedious to work on another system. So in this case, Tramp saves your day with a ton of awesomeness (if you use emacs). One of the nice things about Tramp is that it can do multihop ssh as well. So if you have defined a gateway via ProxyCommand, Tramp still will be able to use it out-of-the-box. Another cool feature of Tramp is that you can integrate it with other emacs packages. So technically, you can start X11 applications remotely and forward the display to your local machine (hopefully, I will write another post about it sometime later). Or, load jpg images in a local buffer from the remote computer.

To use Tramp all you do is:

  1. open the find file (C-c C-f),
  2. go all the way back to the root folder
  3. type ssh:
  4. immediately, you are gonna see all of the hosts that you have connected to before.
  5. go ahead and select the one that you want to connect to
  6. enter your password
  7. viola! a dired buffer opens at the home folder, just as normal ssh over terminal (you can also load any desired directory when "ssh"ing)

I highly recommend going over the manual to learn the ins and outs of this awesome tool.

Links to download and install Anaconda and OpenCV

Hi Everyone,

Firstly, I want to say thank you guys for registering for the CV workshop. This is going to be an introductory workshop to opencv, which is one of the most popular libraries for computer vision and image processing. Although opencv has different interfaces for different languages, we will use python throughout the workshop. The reason that I chose python is:

  1. at this point you've had a couple of python programming courses/workshops so you are familiar with python,
  2. python is intuitive and easy to use,
  3. we will use jupyter notebooks along with the normal python files (.py) to test and see immediate results. As you know, the notebooks provide an interactive environment, which is a plus.

The software packages that we are going to use are:

  1. Anaconda for python 2.7, to have necessary python packages installed
  2. OpenCV 3
  3. Your editor/IDE of choice like PyCharm. Personally, I use Emacs but it does not mean that you need to use it as well.

I am going to put all of the download links and also installation documents in this post. Just please make sure that you download and install Anaconda for python 2.7 and opencv3.

PyCharm

If you want to use PyCharm as your IDE, you can find the download it and find the instructions here.

Tip: You can register as a student and get the professional version of PyCharm for free.

Anadonda for Windows:

NOTE: Remember where you install Anaconda. You are going to need it when installing OpenCV. Let's call it ANACONDA_FOLDER

NOTE: Check the box where it says "Add Anaconda to my PATH variable". If you have already installed a python version, this will replace it with the current Anacanda version.

Anaconda for GNU/Linux:

Anaconda for MacOS:

OpenCV3:

For Windows

  1. Go to the opencv download page and download version 3.1.0 for Windows.
  2. Click and extract the downloaded file.
  3. Go to opencv\build\python\2.7 folder.
  4. Copy cv2.pyd to ANACONDA_FOLDER\lib\site_packages.
  5. Done!

For GNU/Linux and MacOS:

  1. Open a terminal window.
  2. Type conda install -c menpo opencv3
  3. Done!

That's it for now. See you at the workshop.

Which keyboard layout is the best for you?

keyboard.jpg

Keyboards and their layouts are definitely one of the pieces of computer hardware that have a lot of controversy around them. Some people swear by the Cherry MX mechanical switches while some others think that clone switches work just as fine and there is no reason to go for the genuine ones. I'll just skip the debate about the switch types (reds vs. blues vs. clears vs. greens vs. etc.). In addition to the type of the switch, keyboards have different layouts with their die-hard fans. People even have argued how using the traditional QWERTY layout causes carpel tunnel syndrome and other injeries. On the other hand learning to use a new layout, especially if you were trained with QWERTY and type extensively, has a very steep learning curve and a lot of people would just give up. Because they feel what they gain in return is not worth crushing their productivity.

I spend 90% of my time behind a computer (and sometimes the remaining 10% behind a laptop!) and despite being careful with my posture, at some point I realized that I feel pain radiating from my wrist to my arm. So I started doing some research about what are the probable causes of that pain and how to stop it. Of course the first solution (after ergonimics) that I came across with, was "Use another layout". So I made the big decision and started to use dvorak and I am not gonna lie; I liked it and I still do, although obviously productivity plummeted at the beginning. However, I was always curious that how much of a "real" difference it would make for "me" because of the type of the work that I do.

So, I wrote some code to visualize my key stroke map on the actual layout based on my files on git and I'd like to share the results with you folks. I looked at the maps separately for C++, Python and Tex files and the results are very interesting:

C++

  • QWERTY:

    qwerty_cpp.png

  • Dvorak:

    dvorak_cpp.png

  • Colemac:

    colemac_cpp.png

  • Workman:

    workman_cpp.png

Python

  • QWERTY:

    qwerty_py.png

  • Dvorak:

    dvorak_py.png

  • Colemac:

    colemac_py.png

  • Workman:

    workman_py.png

Tex

  • QWERTY:

    qwerty_tex.png

  • Dvorak:

    dvorak_tex.png

  • Colemac:

    colemac_tex.png

  • Workman:

    workman_tex.png

Thoughts:

  • Looking at C++ maps, the right hand will have a lot of trouble with mainly Workman layout, since basically all the rows are used. Colemac is a little bit better but still not good. To me, Dvorak seems to win because of high stroke rate of the home row and also because of the fact that "-" is placed at the home row.
  • For Python, Workman and QWERTY look almost in the same ball park. I feel Dvorak is superior again.
  • For Tex, Colemac seems to be the way to go. I would imagine that I can live with Workman too. Next is definitely Dvorak and QWERTY looks to be the last option.

Conclusion:

  • It is absolutely impractical to use different layouts for different languages. So for me, Dvorak looks to be the best option between them.
  • I believe Dvorak has the steepest learning curve becuse almost all of the keys are replaced, which is another thing to consider.
  • I use my keyboard for even navigating web plus all the crazy emacs key strokes. So it would be interesting if I log all of my presses and then see the difference.
  • C++ is REALLY bad for my health, no matter what layout I choose, so I'll try to avoid it as much as possible.

You can find the code here and see which layout hypothetically works better for you.

Let me know what you guys think. Would you switch to a new layout? Is it really worth the time, energy and frustrations?