Bienvenidos a un lugar donde la programación, los vídeos, las divagaciones y las subnormalidad se combinan para demostrar que el caos puede ser bello.
Serabe Reloaded
Conecto ergo sum. Non conecto ergo urgueo.
"No te preocupes por tus dificultades con las matemáticas, puedo asegurarte que las mías son mayores."
Albert Einstein
Programmers Jokes.
In C we had to code our own bugs. In C++ we can inherit them.
C gives you enough rope to hang yourself. C++ also gives you the tree object to tie it to.
With C you can shoot yourself in the leg. With C++ you can reuse the bullet.
A computer without COBOL and Fortran is like a piece of chocolate cake without ketchup and mustard.
Why all Pascal programmers ask to live in Atlantis?
Because it is below C level.
Hug a developer today.
Hug a developer today. They are in pain. At least, I work for a Open Source project, so I have no boss… but me.
Anyway, you can hug me if you want :-).
RMagick4J 0.3.6
I am glad to announce a new version of rmagick4j.
RMagick4J aims to implement the ImageMagick funcionality and the C
portions of RMagick for make it works in JRuby.
Current stable version: 0.3.6
Project URL: http://code.google.com/p/rmagick4j/
Installation: gem install rmagick4j
Google Summer of Code project should be thanked for making this new
release possible.
In release 0.3.6 you can find the next improvements:
- More Draw primitives (clip-path [creatin a clip-path and using a
clip-path], fill-rule, rotate, scale [reimplemented], skewX, slewY,
stroke-linecap, stroke-linejoin, stroke-miterlimit, translate). - Solve a bug with transparent stroke and line primitive.
- Added the following Draw instance methods:
- annotate
- get_multiline_type_metrics
- Solved a bug that caused the background become black while resizing
images with alpha channel.
Please try out your applications with rmagick4j and help us provide
feedback. It is our goal to make a fully-compatible implementation of
RMagick4j in JRuby.
Sustituyendo a las animadoras con Ruby en Mac.
El título del post puede sonar raro, pero lo que voy a mostrar hoy es cómo conseguir tu propia animadora en Mac con Ruby. Lo que haremos será hacer que nuestro ordenador, con una orden como:
ruby cheerleader.rb Serabe
Nos muestre por pantalla:
Dame una S
Dame una E
Dame una R
Dame una A
Dame una B
Dame una E
SERABE!!!
Además, utilizando el comando say de Mac, nos lo dirá (si queréis que lo grite, subid el volumen al máximo).
Empecemos con el código:
-
string = ARGV.join(' ')
Aquí simplemente recogemos los parámetros pasados por consola y los concatenamos con un espacio entre medias. Ahora la parte interesante:
-
string.each_byte do |b|
-
if /[a-zA-Z]/ =~ b.chr
-
shout = 'Dame una '+b.chr.upcase
-
puts shout
-
`say #{shout}`
-
end
-
end
Para cada letra, una vez comprobado que es una letra y no un espacio, construimos un grito ('Dame una S'), lo imprimimos por pantalla y hacemos que el comando say lo diga.
Finalmente, con un
-
puts string.upcase + '!!!'
-
-
`say #{string}`
Imprimimos la última frase.
Ya habéis visto cómo crearos vuestra propia cheerleader. En próximos episodios veremos cómo añadirle autoregeneración como Claire.
RMagick: Dibujar con patrones
Una interesante cualidad de la clase Draw de RMagick es la posibilidad de definir patrones a través del método pattern.
En primer lugar, lo básico:
-
require 'rubygems'
-
require 'RMagick'
-
-
include Magick
Ahora definamos el patrón. Para ello, necesitamos cinco parámetros, el nombre, dos números que recomiendo ponerlos a cero (después de unas cuantas pruebas, no he notado diferencias notables) y después las dimensiones del patrón.
-
draw = Draw.new
-
-
draw.pattern('circles', 0, 0, 10, 10) do
-
draw.stroke 'none'
-
draw.fill 'red'
-
draw.rectangle 0, 0, 10, 10
-
draw.stroke 'LightGreen'
-
draw.fill 'blue'
-
draw.circle 5, 5, 5, 0
-
end
Ya, por último, dibujamos un cuadrado y lo plasmamos en una imagen de 300x300.
-
draw.stroke 'circles'
-
draw.stroke_width 25
-
-
draw.fill 'none'
-
-
draw.polygon 150,0, 300,150, 150,300, 0,150
-
-
img = Image.new 300, 300
-
-
draw.draw img
-
-
img.write 'pattern.jpg'
Obteniéndose el siguiente resultado:
New RMagick4J release.
RMagick aims to implement the ImageMagick funcionality and the C portions of RMagick for make it works in JRuby.
Current stable version: 0.3.5
Project URL: http://code.google.com/p/rmagick4j/
Installation: gem install rmagick4j
Google Summer of Code project should be thanked for making this new release possible.
In release 0.3.5 the following improvements have been made:
- Implemented Draw primitives (affice, arc, pattern, path).
- Improved Image and ImageList:
- Implemented more of Pixel (from_HSL, to_HSL, <=>, fcmp, intensity).
- Implemented the fill classes.
- Added a side-by-side (MRI vs JRuby) image testing tool named Bullseye.
- Added 680 color names. It can search, but not retrieve the name correctly capitalized.
- Changed gem name from RMagick4J to rmagick4j.
This version should allow Gruff Graphs and Ruports to largely work without issues. Please try out your applications with rmagick4j and help us provide feedback. It is our goal to make a fully-compatible implementation of RMagick4j in JRuby.
Ay, Serabe, que no haces nada ni tan siquiera regular.
Hoy me he tirado unas cuatro horas para encontrar un bug, uno de estos puñeteros bichos que te atrapan y te dejan cosas como estas:

Para que os hagáis una idea, tenía que ser esto:

Como se puede apreciar, son sensiblemente diferentes. Así que cuatro horas de mi vida han transformado lo primero, en lo segundo.
El problema venía en que, tal y como Tom (mi mentor del GSoC) propuso, se ha cambiado la clase PixelPacket de forma que ahora trabaja con enteros. El problema, mejor no os lo cuento que es más aburrido que lo anterior.
En fin, que hoy me voy a la cama con un ego más grande que el de Enrique Dans.
Sweating blood
Si alguno está investigando sobre las Stories de RSpec, y no consigue hacerlas funcionar, un
-
require 'spec/story'
debería solucionarlo todo...
Joder lo que hace mi inutilidad y mi falta de documentación.
Tweets del 01-04-2008
- Free Graph Paper Creator http://www.printfreegraphpaper.com/ #
- Regex Mate http://regexmate.com/ #
- Songs Backwards Online http://www.talkbackwards.com/ #
Tweets del 29-03-2008
- Shell-Fu http://www.shell-fu.org/ #
- Cents of Perspective http://tinyurl.com/3xdara #
"En un beso, sabrás todo lo que he callado."
Neruda
