Domando los bits
  • Blog
  • About/Acerca
  • Contact(o)

Scala for IDEA: good support

5/21/2014

0 Comments

 
Whichever tool you use, it is very important that has good support, because it is nearly impossible in complicated software products to be bug free.

Many open source projects have quick responses in their forums or in places Stackoverflow.
What I've verified in the latest months is that Scala plugin for IntelliJ IDEA are quite fast in solving bugs.
For example, today, I've reported a bug and in two hours it has been solved.  It has happened to me several times.  In this way, I'm highly motivated in reporting bugs.
Other example is this other bug.
0 Comments

Jython is nearly death

4/13/2014

0 Comments

 
It's a pity but Jython development is terribly slow.  It was one of the first alternative languages in the JVM.  Last stable version dates from August 2012, and now we are in April 2014.
0 Comments

Eclipse or IntelliJ IDEA

4/13/2014

0 Comments

 
One of the best things in the open source world is the big quantity of inter-operable alternatives.

In the JVM world, we have:
  • NetBeans
  • Eclipse
  • IntelliJ IDEA
All of the are of good quality and free (IDEA has also a paid option, but the free one is quite powerful).

I haven't had time to test seriously NetBeans, but I've been many years with Eclipse.  Eclipse has many available plugins.  I've even created successfully RCP apps, i.e., applications that use the infraestructure of the IDE as a framework.

Lately, I'm using a lot IDEA, due to its Scala support, simplicity and it has been chosen by Google as the reference IDE for Android development.  IDEA looks like lighter.  Recently, in version 13.1, the Python support has been made free.

You can work simultaneously in the same project with all of them if you wish, with no problems and no interferences, making use of the strength of each one.

0 Comments

Jenkins and branch selection in GIT

4/13/2014

1 Comment

 
Now we are migrating to GIT from SVN.

We're very happy with GIT (but a little confused at first).

One problem is selecting in Jenkins a branch.  Jenkins available plugins don't help for this task.  Luckily, I've found this wonderful article that has helped me.  But I've improved a little, and instead of launching a cron job for gathering the available branches, I calculate them on the fly.

I've created a parameter of type Extensible Choice, and added this script in other to feed it:

 def ej(cmd) {   def proc = cmd.execute(null, new File("/home/jenkins/jobs/MyProject/workspace"))   def sb = new StringBuffer()   proc.waitForProcessOutput(sb, sb)   def cod = proc.exitValue()   if (cod != 0)       throw new Exception("Error ${cod} when invoking '${cmd}':\n${sb}")   sb.toString() }  ej("git fetch --all") ej("git remote prune origin")  def re = ~/->/  ej("git branch -r").tokenize("\n").grep({!re.matcher(it).find()}).collect() {   it.replace("origin/", "").trim() } 
Even though, I'm not an expert in Groovy, it works ok.

It's easy to debug thanks to the button Run the Script Now.

Now you can easily select a branch with a combo box!!.
1 Comment

OMD and Charts

4/13/2014

0 Comments

 
Currently I'm using OMD, a Nagios compatible monitoriing package that let's you easily switch from different implementations.

I've chosen to work with Shinken as the core monitoring, Thruk as the web interface and PNP4Nagios as the chart package.

It works ok, but some charts a never shown for most services, even if I restart all the services.  I don't know which component to blame for the bad behaviour.

After some painful research, I've discovered that the solution was rather simple:

I had to delete this file: /omd/sites/mysite/var/shinken/retention.dat, and all the charts reappeared again.

0 Comments

Using Scala scripts in Jenkins

4/13/2014

0 Comments

 
I use mainly Maven, Ant, and Bash scripts for automating tasks in Jenkins.  In this way, non-tech people can start complex tasks with a simple GUI, and you have a log of all activity.

Now, I've used another possibility, and it's about running Scala scripts,  thanks to this plugin: jenkins-scala-plugin.

Even though it isn't in the official repository of Jenkins and you have to compile it, it works flawlessly.

Or you can simply use t
 scala path/myscalascript.scala arg1 arg2 
I prefer for non-trivial scripts to use an external editor, instead of using an embedded script.
0 Comments

Dónde escribir mi blog

4/13/2014

0 Comments

 
Después de haber ensayado con Google +, Blogger y Wordpress, me he decidido por weebly por su potencia y facilidad de uso, en su versión gratuita.

Blogger también me gusta,  y ya lo llevo usando desde hace varios años en ámbitos no profesionales, y quería probar otro diferente para aprender.


Si tuviese hosting propio, seguramente optaría por Wordpress, debido a la gran cantidad de plugins.

Ahora voy a migrar mis primeras entradas realizadas a Wordpress a este sistema.
0 Comments

Comenzando con Scala

4/13/2014

0 Comments

 

Una forma sencilla de experimentar es usando el REPL interactivamente, tras teclear el comando "scala" desde una consola.

Aún mejor si usamos el Worksheet View de IDE tales como IDEA o Eclipse, pues tiene la ventaja de que tenemos la asistencia del IDE, resalte de sintaxis con colores y ver el resultado interactivamente.

IDEA tiene un editor bastante completo, y es el que suelo usar.  En los foros responden rápido, y lo actualizan frecuentemente, resolviendo problemas y añadiendo características.  Además la Community Edition tiene soporte gratuito para Scala, a través de un plugin que debe ser descargado aparte.  También se puede usar el Scala IDE, que usa Eclipse.


Para un uso más serio, he escrito algunos guiones en Scala, en concreto para Linux, aunque se podría también en otros sistemas como Windows.

Para ello debemos comenzar el guión con esta cabecera:
 #!/bin/sh DIR=$(cd `dirname "${BASH_SOURCE[0]}"` && pwd) exec scala "$0" "$DIR" "$@" !# val dir :: resto = args.toList println(s"Estoy ubicado en el directorio: $dir") println(s"Mis argumentos son: $resto") 
A base de println(), se puede depurar fácilmente.  Al igual que un guión en Bash, Python o Perl, no hace falta compilar, lo hace automáticamente.
0 Comments

Scala: lenguaje que últimamente más uso en el servidor.

4/13/2014

0 Comments

 
Scala
Debo confesar que estoy obsesionado con el lenguaje de programación Scala.  Tras algo más de un par de años probándolo, y siguiendo de cerca su evolución, estoy convencido de su futuro y productividad.

Me gusta Scala por los siguientes motivos:
  • Librerías de calidad, especialmente en frameworks Web y Rest
  • Se puede usar la ingente cantidad de librerías Java
  • Diseñado para ser totalmente interoperable con Java
  • Herramientas de calidad que están mejorando a buen ritmo. Además hay donde elegir (IDEA, Eclipse, Netbeans)
  • Regularidad, tiene pocas construcciones pero bastantes potentes
  • Inferencia de tipos, que evita tener que especificar información redundante, acercándose a las ventajas de los lenguajes estáticos
  • Una comunidad potente.  Atrae talento.
  • Documentación de calidad.  La navegación por las APIs es muy clara.
  • Cierta madurez, está en proceso de estabilización.  Prueba de ello es que la versión 2.11 no rompe compatibilidad con la 2.10, excepto en algún área ya marcada como experimental en la 2.10.
  • Posibilidad de usar programación funcional, que simplifica según que algoritmos.
  • Pattern matching.
  • Capacidad de definirse sus propios DSLs.  Muchas características avanzadas del lenguaje viene dada a través de librerías, en lugar de formar parte del compilador en sí.   Esto permite adaptaciones más profundas a las necesidades del proyecto, claro está, para quien tenga conocimientos avanzados del lenguaje,

Ahora se acerca el momento de que el equipo del cual formo parte, empiece a usarlo.  Las resistencias a introducir algo nuevo, cuando las personas ya son productivas con lo que conocen.

Mi objetivo es migrar una aplicación grande, básicamente en Jython (la versión de Python para JVM) y una cantidad menor de Java
, en Scala.

A través de ejemplos, ya iré explicando más ventajas.
0 Comments

Lenguajes estáticos frente a dinámicos

4/7/2014

0 Comments

 
He trabajado con lenguajes dinámicos y estáticos, y he llegado a varias conclusiones sobre sus ventajas e inconvenientes:

Ventajas de los dinámicos

  • Más sencillez del lenguaje, y más rapidez por tanto para aprender
  • Programas más compactos

Ventajas de los estáticos

  • La información de tipos, puede considerarse documentación.
  • Si hay inferencia de tipos, no se incrementa apenas el tamaño de código.
  • IDEs pueden ser más sofisticados, en cuanto a asistencia, navegabilidad
  • Mayor capacidad de refactorización
  • Detectar prematuramente errores de inconsistencia, aunque no de lógica.
Esto hace que prefiera en muchas situaciones lenguajes estáticos, si tienen inferencia de tipos y características como genéricos.
0 Comments

    Author

    Specialist in Open Source Devel / Especialista en desarrollo Open Source

    Archives

    April 2014

    Categories

    All

    RSS Feed


Powered by Create your own unique website with customizable templates.