jueves, 1 de noviembre de 2018

New blog

New Blog

http://daniel-m.github.io


Wow, the last time I posted here was 2016!. For a long, long time I wanted to migrate this blog, change styles and such, like wanting for some kind of perfect moment to find the ultimate template, the ultimate contents. In the same way, several posts waited in the "drafts" folder since I wasn't completely satisfied with what was in them.

I guess, in life, we always need to balance the urges to keep improving stuff with the urges to get stuff done. Waiting for better contents and better visuals I end up doing nothing. But those times of stubborness are over (i hope) hence I want to invite my little audience to head to my new blog.

http://daniel-m.github.io

I also blog ocasionaly at http://blog.parallelo.ai, the blog for a start up I work for.

I have to thank the people who comes here to read my stuff, and the ones who had reached me out by email asking questions, that's really the kind of things that drive me to keep writing. At my new blog, I plan to add an entry every 15 days or so, feel free to read me there


Finally, thanks blogger for those years, pretending to run a blog meant (and means) a lot to me


jueves, 2 de junio de 2016

Installation of MathGL 2.3.5 In Debian

Installation of MathGL 2.3.5 In Debian

Motivation

Despite that MathGL is included in the official Debian repositories, It is not the latest version, and the installed, library includes a lot of wrappers and features I'm unlikely to use.

What is MathGL?

As the official website states, MathGL is,

  • a library for making high-quality scientific graphics under Linux and Windows.
  • a library for the fast data plotting and data processing of large data arrays.
  • a library for working in window and console modes and for easy embedding into other programs.
  • a library with large and growing set of graphics.

Here you can see a gallery with MathGL graphics

I've used this library several times from long time ago (like in this project of Hodgking-Huxley action potential) and I think is a very nice library to generate graphics from your final binaries. For example, I've used it when my code is up and running and I want it to generate graphic output directly (png,pdf,...)


Installation

First of all, download the latest source from here, and then proceed to get the required prerequisistes.

Prerequisites

The list of prerequisites depends a lot on what you'd like to do with MathGL. I wanted to be able to work with Qt5 widgets, pdf output,gsl support (GNU Scientifical library),OpenMP, MPI, HDF5, and wxWidget support. I've installed the required libraries as root by,


To see the complete list of supported features you can read the CMakeLists.txt and look for every line containing option(enable-XYZ) so you add -D enable-XYZ when you call cmake.

Building MathGL

Once you've installed the prerequisites, you can build MathGL at the root directory of the source or simply a build directory. I like more the build approach since keeps the source directory clean.


Any errors during the cmake phase can be related to the lack of any prerequisite so keep an eye on the errors, they often say what needs to get installed or fixed.

If everything goes fine, you finally install MathGL as root by,

make install

And that's it.

Resources


martes, 24 de mayo de 2016

Neovim: Next generation vim


Motivation

I was wandering the web looking for some vim plugins that feature golang syntax and autocompletion. I found out about the neovim project and got interested on it, cause I'm a vim user. Here's what I've found.


Neovim?

Official Neovim webpage states,

Neovim is an extension of Vim: feature-parity and backwards compatibility are high priorities. If you are already familiar with Vim, see :help nvim-from-vim to learn about the differences.

After using it for more than a week I gotta say it's worth to use it. The customization is way to easy, as for performance neovim loads faster than my vim (this could be due to the installed plugins or other setups, though). The installation of plugins is pretty easy with the aid of vim-plug which can be installed by a single curl request from the command line.


Installation and use of Plugins

Detailed instructions of installation are located on my repo https://github.com/Daniel-M/nvimConfigFiles where I store my neovim configuration files. The Readme describes all steps to get Neovim up and running in Debian.


References

lunes, 9 de mayo de 2016

C++ seems faster than C at summing big arrays!!

Forewords

I'm some sort of self-taught programer, so it is expected that my methods and algorithms aren't state of the art optimized to best design practices and improved performance. I made the code without thinking on but doing the tast and leaving aside the code optimization and all that stuff.

The result here is just what I have found. I think that sitting and optimizing code could turn tables, but, not anyone is capable of efficiently write code (a.k.a. optimizing it for best performance), specially if you are a scientist coding (and not a computer scientist).


Motivation

For several months I've been wondering whether C or C++ is more efficient at doing science related tasks. As far as I know, the most common tasks in science involve linear algebra, and one of the simplest tasks is the sum of vectors. Given that I'm preparing some study materials I've decided to test it out and here is what i've found so far.


C++ seems faster than C at summing big arrays of integers

I made codes that compares the performance between regular C arrays (also C++ valid arrays) and STL arrays (exclusive of C++) by taking two random vectors up to 200000 components as input from a file.

One program run consist of,

  • Read a 1000 components of two random vectors from a given file.
  • Sum component to component the couple of vectors read. Report the number of components and the milliseconds it took for the whole process to standard output.
  • Increase the number of components by 1000, then repeat the read-sum-report procedure stated above.
  • Repeat increasing size until the vectors reach 200000 components.

The codes are available here


Results

Well, using my unoptimized algorithm it seems that C++ is indeed a little bit faster than C.
The time-to-completion was measured 300 times on the same machine, the resulting run-times where averaged to compensate the effects of anyother processes running.
A fitting to linear functions seemed suitable for the resulting data. The blue marks on the graph represent C++ run-times whilst purple marks represent those of C.
The fitting was made using gnuplot with the fit function: f(x) for C and g(x) for C++ (details below)


C vs C++ Benchmarking


Fitting for C with f(x)

f(x)=A*x+B

The relevant output of the fitting was


After 8 iterations the fit converged.
final sum of squares of residuals : 68.4475
relative change during last iteration : -1.00902e-13

degrees of freedom (FIT_NDF) : 197
rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 0.589448
variance of residuals (reduced chisquare) = WSSR/ndf : 0.347449

Final set of parameters Asymptotic Standard Error
======================= ==========================
A = 0.000385433 +/- 7.274e-07 (0.1887%)
B = 1.36903 +/- 0.08389 (6.127%)

Fitting for C++ with g(x)


function used for fitting: g(x)
g(x)=C*x+D

After 8 iterations the fit converged. q
final sum of squares of residuals : 48.4348
relative change during last iteration : -1.78975e-14

degrees of freedom (FIT_NDF) : 197
rms of residuals (FIT_STDFIT) = sqrt(WSSR/ndf) : 0.495845
variance of residuals (reduced chisquare) = WSSR/ndf : 0.245862

Final set of parameters Asymptotic Standard Error
======================= ==========================
C = 0.000367315 +/- 6.119e-07 (0.1666%)
D = 1.16317 +/- 0.07056 (6.067%)


Conclusions

At the beginning, the execution times of both languages are undistinguishable but it seems that C++ has better performance than C as the size of the vectors increase. It could be a matter of design, more test with different algorithms should be performed.

The difference between the fitted curves is the linear function
D(x) = f(x) - g(x) = 0.000018118*x-0.20586
Clearly when N=10 000 000 the difference between runtimes would be of just 17.91214 ms so whats the point of using C++ over C if the performance difference would be so small? Well, because of Object Oriented Programming, that's why. Besides, the C++ std::array are expected to be optimized over the regular int array[] of C.

viernes, 6 de mayo de 2016

Introducción a la programación en Python para Biólogos

Introducción a la programación en Python para Biólogos

Preparé unos materiales de estudio y algunos ejemplos para un curso express de Python que presenté para el Instituto de Biología de mi alma mater

Los materiales de estudio están disponibles en el repositorio https://github.com/Daniel-M/IntroPythonBiologos al igual que códigos de ejemplo.

Los materiales de estudio consisten en notebooks de jupyter y documentos en pdf que se encuentran en la carpeta docs/notes


Enlaces


lunes, 25 de abril de 2016

Updating all pip/pip3 installed packages

Motivation

I've been looking for several options to upgrade my local python packages installed via pip. I've read some posts at stackoverflow and some github.com issues addressing different ways to upgrade them, but I was not very satisfied. I tried to make things on my own and here's how I did it.


Updating pip/pip3 packages

I knew that the command list of pip/pip3 consoles return the list of locally installed python packages. Just needed to take that output, process it and use it to feed pip/pip3 itself in order to get the packages updated.



I hope you find this useful!

sábado, 9 de abril de 2016

Script for automated text translation in Linux*

* I'm working with GNU/Linux Debian, but it should work ;)

Motivation

Some times you are reading stuff on books, documents, or simply the web. I know it sucks to keep opening new tabs on your browser in order to get translations for some words you don't understand. A Friend of mine told me about some script that can be bound to a keystroke combination, popping out the meaning of the highlighted text.

There are several of such scripts on the web, so making one by myself wouldn't be smart righ? Wrong!. I've tried some of them and all of them lack of features like checking that the clipboard is not empty or setting some limit for the size of the text to be translated or something like checking the languages involved in the translation(It could be useful every now and then). Besides it proved to be a good bash excercise for me.


How it works?

The operation steps are:

  • Check the contents of the primary clipboard. This clipboard always stores the text selected with thw mouse pointer at X sessions.
  • Queries a translation of the contents to google translator api
  • Formats result and makes a call to notify-send to deal with notifications daemon who shows the translation

Take a look at the script here

Making things work

Download the script and place it somewhere like /usr/local/bin give it execution permissions and bind the executable to some key combination that you will press each time you need to translate a selection of text :D

jueves, 31 de marzo de 2016

Putting the shit together

A year has passed since I wrote anything in this blog. I would like to say it was lack of time, or even lack of motivation. That wouldn't be by far the most honest thing to say. Now that the word "honesty" popped out I'd like to say that "honesty" is one of the most precious qualities someone can have, I appreciate it a lot, and I do my best to remain honest even though it would get me in trouble. And it has gotten me in troubles in the past.
Theres an important link between honesty and courage. It takes courage to be to be honest and open, and who wants to be a pussy? not me if you ask me.

Anyway, things has been happening (life is always happening...) and I had and have to cope with them. Luckily, a lot is to be learned each day we have on this earth and I've been taking my lessons during the last 366 days, and I found that attitude towards "life stuff" makes an important difference.

I'm baking some posts (some of them left untouch for over a year) I'll be serving them in the next days.

I'm glad to be right back at it again.

martes, 31 de marzo de 2015

A JDM Mod Serial PIC programmer with VCC control

Since I'm kind an electronics hobbyst, I've been wanting to learn how to program Microchip PIC microcontrollers for a long time. I got some experience by using the MPLAB X IDE by Microchip with other tools that simulate PICs, and since I have an intermediate C language programming level, the learning curve was kinda smooth but sloppy. But, programming real-life PICs is a little more complicated than simulating them and it is better to have a programmer for a complete programming experience. That's why I've just started a project on building my very own JDM serial PIC programmer. To that end I'm using the hackaday platform to record all the relevant information of the process. The link to the whole project is


I hope it's useful to someone else.

sábado, 28 de febrero de 2015

Open source tools to document your software projects. Part 2: Pandoc

This is the second part of Open source tools to document your software projects if you want to read the fist part reviewing Markdown follow this link.

PANDOC

If you need to convert files from one markup format into another, pandoc is your swiss-army knife.[1]
Pandoc can convert documents in markdown, reStructuredText, textile, HTML, DocBook, LaTeX, MediaWiki markup, TWiki markup, OPML, Emacs Org-Mode, Txt2Tags, Microsoft Word docx, EPUB, or Haddock markup to HTML formats ( XHTML, HTML5, and HTML slide shows using Slidy, reveal.js, Slideous, S5, or DZSlides), Word processor  (Microsoft Word docx, OpenOffice/LibreOffice ODT, OpenDocument XML), Ebooks (EPUB version 2 or 3, FictionBook2), Documentation (DocBook, GNU TexInfo, Groff man pages, Haddock markup), Page layout formats(InDesign ICML), TeX formats(LaTeX, ConTeXt, LaTeX Beamer slides), PDF (via LaTeX), and Lightweight markup formats (Markdown, reStructuredText, AsciiDoc, MediaWiki markup, DokuWiki markup, Emacs Org-Mode, Textile), among others.

Getting pandoc

For Debian users pandoc is available from the official repositories. Get it with standard software applications
$ apt-get install pandoc -y

Using pandoc[2]

If the markdown formatted text is "pandoc.md" the following commands can be tested:

Markdown to HTML:
pandoc pandoc.md -o my_parsed_html.html
Markdown to an standalone HTML
pandoc -s pandoc.md -o my_parsed_html.html
Markdown to an standalone HTML with table of contents
pandoc -s --toc pandoc.md -o my_parsed_html.html
Markdown to  Latex
pandoc -s README -o example4.tex
Latex to Markdown
pandoc -s example4.tex -o example5.text
Markdown to PDF
pandoc -s example4.tex -o example5.text
To see more examples go to [2] or read the man page of pandoc. You can download the README file[3] and parse it to any other format by invoking pandoc and see the fancy output.

References

  1. from the creator of Pandoc at Pandoc webpage
  2. http://johnmacfarlane.net/pandoc/demos.html
  3. http://johnmacfarlane.net/pandoc/demo/README

martes, 24 de febrero de 2015

Open source tools to document your software projects. Part 1: Markdown

In the past weeks I've been preparing a set of three posts on tools for document your software projects. The main goal is to introduce the tool and not to make a complete wiki, so don't expect any detailed descriptions.

Do you document your software?


Most of the scientist when asked for their software project's documentation [1]

As a wannabe scientist I'm aware of the need of having reliable registers about all the work related to any scientific task, such as experiments, simulations, math, results, and so on. Most of the logs are taken either in paper or by type writting to digital documents (LaTex or equivalents). When the project involves software most of the scientist are not so familiar with tools as Doxygen or Sphinx(to mention a couple) due to the needed learning curve: "Ain't nobody got time for that!!". And all the "documenting" lies on tons of commented code lines which rarely will be seen when using the libraries and stuff. In the process of developing and documenting my software I became aware of several tools which could come in handy to other scientist/programmers. That is the motivation to review three tools

  1. Markdown
  2. Pandoc
  3. Doxygen

MARKDOWN  [2][3]


Markdown is intended to be as easy-to-read and easy-to-write as is feasible,and is a text-to-HTML conversion tool for web writers. Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML).[3]
Created in 2004 by John Gruber and Aaron Swartz[2] Markdown provides a easy way to create HTML formatted filesout of plain text. Once the markdown file is parsed, one obtains a pretty good looking html wich can be embeded or distributed with your software in order to make more friendly the project, (or uploaded to your blog ;) ).
Every markdown file consist of plain text file with extension .md or .mkd (or without any extension since the processor that receives the plaintext file detects the markdown format. But is good to have an extension).

Markdown basics [4][5]

A good summary of Markdown syntax is [5]

Headers

# This is an <h1> tag
## This is an <h2> tag
###### This is an <h6> tag

Emphasis

*This text will be italic*
_This will also be italic_

**This text will be bold**
__This will also be bold__

*You **can** combine them*

Lists

Unordered

* Item 1
* Item 2
  * Item 2a
  * Item 2b

Ordered

1. Item 1
2. Item 2
3. Item 3
   * Item 3a
   * Item 3b

Links

http://github.com - automatic!
[GitHub](http://github.com)

Blockquotes

As Kanye West said:

> We're living the future so
> the present is our past.

Inline code

I think you should use an
`<addr>` element here instead.

A good markdown how-to is provided by github


A good example of a Markdown text is
Heading
 =======

 Sub-heading
 -----------

 ### Another deeper heading

 Paragraphs are separated
 by a blank line.

 Let 2 spaces at the end of a line to do a
 line break

 Text attributes *italic*, **bold**,
 `monospace`, ~~strikethrough~~ .

 A [link](http://example.com).
 <<<   No space between ] and (  >>>

 Shopping list:

   * apples
   * oranges
   * pears

 Numbered list:

   1. apples
   2. oranges
   3. pears

 The rain---not the reign---in
 Spain.

The parsed output is

Heading
Sub-heading
Another deeper heading
Paragraphs are separated by a blank line.
Let 2 spaces at the end of a line to do a
line break
Text attributes italicboldmonospacestrikethrough.
link.
Shopping list:
  • apples
  • oranges
  • pears
Numbered list:
  1. apples
  2. oranges
  3. pears
The rain—not the reign—in Spain.

Parsing the document


To parse markdown formatted text you need to have markdown installed on your system. Debian based should have markdown on their official repositories (Debian Jessie - Testing has it)

# apt-get install markdown

Should do the job (obviously as root user).

To parse the text

$ markdown mymark.md > mymarkparsed.html
The html file can be opened with your favorite web browser.

Some remarks

  • Given that Markdown does not count with any standard[2] several software organizations have developed markdown versions adding new features. One example is the git-flavoured markdown syntax as decribed on [5]
  • Once the markdown is parsed, one obtains a pretty good looking html wich can be embeded or distributed with your software in order to make more friendly the project.

References

  1. "Ain't no body got time for that"
  2. http://en.wikipedia.org/wiki/Markdown
  3. http://daringfireball.net/projects/markdown/
  4. http://daringfireball.net/projects/markdown/syntax
  5. https://guides.github.com/features/mastering-markdown/
  6. http://en.wikipedia.org/wiki/Markdown#Example

martes, 17 de febrero de 2015

Set the application to open magnet links on Google-Chrome

Motivation

As a Google-chrome user I wanted to know a way to set up the system to open the magnet links.
Firefox/Iceweasel users know that Firefox handles the default applications by itself, but Google-Chrome (and i think that Chromium) lies on xdg-open. So we need to tell xdg-open how to deal with magnet links

Finding your torrent application

To find your favorite torrent application you must go to 
/usr/share/applications/
And look for a file like 
your_favorite_torrent_app.desktop
In my case It was 
transmission-gtk.desktop
You must check that the file contains the following lines (for my case, transmission-gtk)

...
Exec=transmission-gtk %U
Icon=transmission
Terminal=false
TryExec=transmission-gtk
Type=Application
StartupNotify=true
MimeType=application/x-bittorrent;x-scheme-handler/magnet;
Categories=Network;FileTransfer;P2P;GTK;
X-Ubuntu-Gettext-Domain=transmission
X-AppInstall-Keywords=torrent
Actions=Pause;Minimize;
...

The lines in bold are the important.

Configuring xdg-open

If everything is alright you can call xdg-mime command as root
# xdg-mime default transmission-gtk.desktop x-scheme-handler/magnet
wich tells xdg-open that magnet links should be opened with transmission-gtk.

That's it, all you have to do is test that everything went ok by opening a fancy legal torrent magnet link.

References

lunes, 16 de febrero de 2015

Youtube and HTML5 with no sound on Google Chrome

Youtube video players were switched to use HTML5 instead of the old known flashplayer plugin (more infomation here).
I don't know why it seems that the sound works if you use PulseAudio as your sound layer, but if you use only ALSA (as me, cuz PulseAudio s*cks and wraps around ALSA which I consider unnecessary), the sound migth not work well (In my case it was working very nice but then was gone).

The solution for google-chrome is to start the browser with the option

--try-supported-channel-layouts

So call google-chrome as

$ google-chrome --try-supported-channel-layouts

And play a nice youtube video, if that works for you, Nice!!, You can edit the menu entries and links to google-chrome adding the mentioned command option.

Sound resampling 

Resampling can be another issue (I can not tell about that but google product forum talks about it), some forums suggest to add the option --disable-audio-output-resampler, so another solution could be calling google-chrome as

$ google-chrome --disable-audio-output-resampler --try-supported-channel-layouts 

If that does not help you... Well... F*ck... 

Remarks


  • By the time i tested the solutions my google-chrome version was 40.0.2214.94 (64-bit).
  • I choose to use ALSA system only cuz is more resources efficient and allows the use of very fancy plugins like alsa-equal (reviewed on an earlier post)

sábado, 14 de febrero de 2015

Desktop notifications with notify-send - a mini how-to

Sometimes is useful to put pop-up messages on running scripts, for example when running a back up or anything else, in order to get informed about the progress. The command discussed here is

notify-send

A nice notify-send pop-up message


Display pop-up messages as ordinary user

Supposing that you have an script for make a back-up of your personal documents as

#!/bin/bash
cp -r /home/user/documents /home/user/backups/

And you want to know when the backup has finished without checking the console.

All you have to do is adding a line such as

notify-send "BackUp Completed!" "Hi peasant, the back up process is done"

So the new script looks like

#!/bin/bash
cp -r /home/user/documents /home/user/backups/
notify-send "BackUp Completed!" "Hi peasant, the back up process is done"

To see more options read the man page for notify-send.


Display pop-up messages as root

Supposing that you run the script as root and your wall username is user, yo can add this line to your script

export DISPLAY=:0.0 && sudo -u user notify-send "MsgTitle" "Message"



miércoles, 11 de febrero de 2015

Blog's new face

It's been a while since I wrote on this blog. I wanted to made some changes, reorder things and prepare good contents. (Good things come on the way).

The blog structure will be the same, but the labels were improved and the blog's url was changed to
dalogbook.blogspot.com
So, all the older posts must be accessed using this URL (e.g. changing science-logbook for dalogbook on the post's url)


martes, 11 de marzo de 2014

Invictus, A poem for crossing storms

Invictus

Out of the night that covers me,
Black as the pit from pole to pole,
I thank whatever gods may be
For my unconquerable soul.

In the fell clutch of circumstance
I have not winced nor cried aloud.
Under the bludgeonings of chance
My head is bloody, but unbowed.

Beyond this place of wrath and tears
Looms but the Horror of the shade,
And yet the menace of the years
Finds and shall find me unafraid.

It matters not how strait the gate,
How charged with punishments the scroll,
I am the master of my fate:
I am the captain of my soul.
William Ernest Henley (written on 1875)

domingo, 9 de marzo de 2014

Intención e Iniciativa

Hace algún tiempo reflexioné sobre la validez del dicho
"la intención es lo que cuenta"
Para la Real Academia de la Lengua Española, intención significa
intención.
(Del lat. intentĭo, -ōnis).
1. f. Determinación de la voluntad en orden a un fin.
"Determinación de la voluntad".

Sin duda alguna, la intención es un componente fundamental cuando se piensa de hacer cualquier cosa, sin embargo, debe conjugarse con la iniciativa de hacerla. Por cruel que suene, la verdad es que el mundo no está hecho de intenciones. Está hecho de resultados, iniciativas materializadas en cosas tangibles, por eso pienso que intención sin iniciativa, en términos de resultados, es equivalente a no haber tenido intención alguna.
¿la intención es lo que cuenta?, Yo diría que no.

domingo, 23 de febrero de 2014

Nada como una buena conversación, pero una de verdad.

Los teléfonos se inventaron para acortar distancias, no para alargarlas
Mis padres
Tardé muchos años en comprender el verdadero significado del aforismo con el cual doy inicio a esta entrada. Quizá por mi terquedad o porque cada generación trae sus propios caprichos, no veía nada de malo en extender mis conversaciones por teléfono más de lo necesario. Aquella súplica con la cual se me llamó la atención años atrás cobró sentido cuando fui consciente de lo supeditadas que están nuestras interacciones con los demás a los medios que disponemos para comunicarnos. Y es que actualmente la situación no es muy distinta y con las tecnologías emergentes se está virtualizando todo. Las conversaciones se están reemplazando por mensajes de texto cada ves más inexpresivos: Se omiten acentos, comas, y tildes, quizá por el afán de "comunicarse" lo más pronto posible o por la pereza de tomarse el tiempo para puntuar y acentuar --otra perspectiva más desalentadora apunta a la ignorancia de la ortografía. Con los afanes de "estar conectados" estamos creando una sociedad cada vez más dispersa e inconexa, los espacios de intercambio personal están siendo usurpados por espacios virtuales.

Sin duda, el abanico de posibilidades de comunicación con el cual disponemos hoy es enorme, y no puede negarse que en muchos ámbitos es deseable disponer de un medio impersonal para comunicarse rápida y eficientemente, pero no sé como la gente cambia el placer de una conversación "de tu a tu" por servicios de mensajería instantánea. El vibrar de otras personas, sus gestos, sus acentos, sus risas --las de verdad, esas que la onomatopeya del "ja ja ja" apenas puede representar-- y todas esas pequeñas cosas que como sinergia hacen que conversar sea algo placentero.
Para mi el problema radica, como todo, en abusar: basar las relaciones en medios tan volátiles como las redes sociales o los servicios de IM, pueden dar lugar vínculos igualmente volátiles. La sociedad y el mundo necesitan más de personas que conversen personalmente, que compartan, que cultiven su empatía --una dimensión humana que se desarrolla teniendo un intercambio personal con los demás-- que permita conexiones más profundas.


No se puede enseñar nada a un hombre; sólo se le puede ayudar a descubrirlo en su interior.
Galileo Galilei
A mis Padres gracias por el empujón para descubrir esto en mi interior: Que no hay nada como una buena conversación, pero una de verdad.

On the unexpected

There will be times in life when unexpected things will happen. Some people can't cope with the fact that every little detail can't be controlled, the fact that life brings his own surprises, unexpected events, unexpected situations, unexpected choices... the unexpected makes this life as dynamical as it is, and I strongly believe that unexpected things make this life worth living.
The good of the unexpected is that always represents challenges, and every challenge brings is own lesson, even if you can't endure the challenge.
The next time you confront unexpected situations, be thankful of having a dynamical life, be thankful for the opportunity of learning, when learning means growing, and growing means evolving to a better version of yourself.

domingo, 16 de febrero de 2014

Editores de texto y programación - mi perspectiva desde el uso, el abuso y la desazón

Todo estudiante de ciencias* pasa por aquella época de la vida donde debe programar (o por lo menos, intentarlo). Dejando de lado todas las peripecias asociadas con esta empresa, quiero concentrar esta entrada en mi experiencia personal con los editores de texto y los entornos integrados de programación (IDE).
* se habla de lo que se conoce.

Emacs

Emacs forma parte de la comunidad GNU. Si bien, es un editor de texto útil, la necesidad recurrente de atajos de teclado que no podía memorizar fácilmente me hacían perderle un poco el respeto.
Se comporta muy bien al trabajar desde consola, pero también ofrece una interfaz gráfica.
Una de las características más llamativas es la gran cantidad de plug-ins disponibles. Por ejemplo, hay un plugin para integrar emacs sistemas de control de versiones (como git), hay un plugin de WYSIWYG para la edición de textos en latex. La lista sigue, incluso hay plugins que ofrecen juegos de arcade.
No recomendaría este editor para los neófitos en la programación, suelo bromear diciendo que emacs es el editor de texto preferido de Davy Jones

Así se sienten los atajos de teclado demasiado largos

KDevelop

Fui usuario asiduo del entorno de escritorio KDE. Un día por recomendación de un amigo me enteré de la existencia de KDevelop, un entorno de desarrollo muy poderoso. Igual que emacs posee reconocimiento de sintaxis en varios lenguajes, y permite configurar control de versiones con git. Otra característica importante es el autocompletado de palabras, lo cual acelera el proceso de escritura. Toda una maravilla si se tiene suficiente RAM a disposición.
Pero como todo en la vida, no hay nada perfecto: los requisitos de memoria del KDevelop, así como una reciente racha de crashes hicieron que retomase mis intentos por utilizar un editor que había probado tiempo atrás: Vim

VIM (VI Improved)

Vim pareciera ser un editor de texto bastante simple, sin embargo, no hay que dejarse engañar. Puedo resumir diciendo que vim es uno de los editores de texto más potentes que he podido utilizar. Posee gran versatilidad en su sistema de comandos, además de reconocer la sintaxis de más de 200 lenguajes de programación (incluyendo TeX y Latex), permite una personalización muy amplia al punto de permitir cosas como definir sistemas de resaltado de sintaxis propios, esquemas de color y comandos personalizados. Comparándolo con emacs, vim utiliza instrucciones más simples y fáciles de recordar, tan sencillas que es posible programar usando una mano (obviamente son escasas las situaciones donde esto será necesario). Además de su versatilidad, la curva de aprendizaje es suave y basta con usarlo por algunas horas para acoplarse a esta "power tool" como lo llama su creador. Sin lugar a dudas, uno de los mejores editores que he utilizado.
Me llamó mucho la atención enterarme que vim forma parte de una campaña para apoyar niños en Uganda a través de donaciones. Buen trabajo equipo vim!!!

Vim: The power tool for everyone!
El proceso de personalización el editor vim toma tiempo, hay un sitio en particular donde se puede aprender como. Un amigo mío dispone de un repositorio en github donde publica un conjunto de configuraciones muy útiles para quienes programamos en C++, los invito a que se den una pasada por https://github.com/muzgash/vim


Y a que viene todo esto?

El proceso de programación y escritura debe ser una experiencia reconfortante, por lo tanto es importante disponer de un buen editor de texto. Para programar puede usarse cualquier editor de texto y cada cual elije el editor que más le convenga en función de sus necesidades particulares. Opté por mencionar los editores de texto más significativos entre los que he usado durante mis proyectos de programación (que consisten básicamente en aprendizaje de lenguajes). Dentro de los editores que he probado están UltraEdit(Windows), Geany (Un IDE escrito en GTK), Kate, y la lista se extiende.
Pese a todo, lo que importan son las habilidades de programación que se tienen, y no el editor se use para programar.

Enlaces de interés

  1. Página del proyecto GNU Emacs http://www.gnu.org/software/emacs/
  2. Página del proyecto KDevelop http://kdevelop.org/
  3. Página del proyecto VIM http://www.vim.org/about.php
  4. Repositorio de configuraciones de VIM https://github.com/muzgash/vim
  5. IDE Geany http://www.geany.org/
  6. Para aprender a usar vim http://code.tutsplus.com/articles/25-vim-tutorials-screencasts-and-resources--net-14631
  7. Para aprender más de otros editores