Archive for November, 2007
ycp is not only a language. YaST ruby bindings improvements
After quite lot of hacking nights, I managed to get some yast2 ruby bindings improvements working.
You might know that ycp is not only a language, but a component technology. Every component using the YaST2 technology can be reused from other YaST components no matter what language they are written in, as long as there are bindings for that. That was the original intention of the ruby bindings.
So for example, there is a component call Storage, which is written in the ycp language. The component (well, it is really a namespace, but YaST sees it as a namespace component) is located in /usr/share/YaST2/modules/Storage.ycp (.ybc for the bytecode compiled version) and offers some medium level functions that YaST uses.
This component needs low level access to the system, for which there is another module called Libstorage ( located in /usr/share/YaST2/modules/LibStorage.pm ) which in this case is written in perl which is a language YaST supports as long as you follows some simple rules.
The reason is because libstorage is a C++ library, and there is no easy way to bind it to the YaST environment, but as YaST supports perl, you can generate perl bindings for the C++ library and all the library functionality will be available to other components in YaST.
So repeat after me. ycp is not only a language. It is a communication protocol, used by YaST component framework.
So, with the ruby bindings, you where able to do:
require 'yast'
m = YaST::Module.new("Storage")
dp = m.GetDiskPartition("/dev/sda1")
dp.each do | key, value |
puts "#{key} #{value}"
end
But I was never happy with the syntax. The idea was that you construct a dynamic proxy for a YaST component and then call methods on it. This had some disadvantages:
- If the component did not exist, you did not get an error till the method call
- It was not possible to do introspection to the component, because the methods call where implemented using the method_missing hook. So basically the proxy responded to all methods and only raised an error if the equivalent call to the YaST side was not possible.
So I decided to look for a new approach. This is the result till now:
require 'yast'
require 'ycp/storage'
dp = YCP::Storage::GetDiskPartition("/dev/sda1")
dp.each do | key, value |
puts "#{key} #{value}"
end
Oh yes, you notice. First, there is no need to instantiate the module, a classic require will do it. The bindings modify the built-in require method, so if you require something under ycp/, a module is created on the fly. A real module, a real symbol. You can also import it manually using YCP::import
Now, you can do this:
puts YCP::Storage.methods
When the module is imported, the symbols are declared in the module, so you can ask for them in the module. I still need to work on other symbol types, but it should be straight forward.
The last improvement is that I simplified the C part of the bindings a lot, and moved most of the magic to pure ruby code, which makes easier to work with.
Next improvement, the other way around, making nicer how to call ruby components from any other component.
Cool things in a cold day
Nice surprise today:
ITO time spent on YaST. No success yet with Wt. It does not provide something like Qt’s QSocketNotifier, or glib’s gioadd_watch which integrate themselves with the event loop. Did a hack with a standard select and a timeout, did not work. Even worse, Wt crashes on processEvents().
Will hosted a hack session on Saturday. While I did not get any code done, I got motivated by the Kopete 4.x state to continue working on it at home. Yesterday I commited my chat window participants view code for Kopete. It simplifies the code and the signal battle a lot. I still have to fix some issues.
The Android stuff is so cool. Read this post about Dalvik: how Google routed around Sun’s IP-based licensing restrictions on Java ME. The Activity, Services and Intents model seems natural for other scenarios, not only mobiles.
Presidente Constitucional
Paralelamente a la Cumbre Iberoamericana, organizaciones de izquierda organizan un evento llamado Cumbre de los Pueblos.
No pude evitar reirme con este comentario:
En una crítica al modelo que impera en Chile, señalaron que “en este país, las empresas transnacionales activaron la maquinaria militar y financiera del imperio para derrocar al Presidente Constitucional Salvador Allende”, dando paso a un sistema donde “los poderes fácticos y el gran capital han pasado a controlar la política, los medios de comunicación y la institucionalidad”.

Ahora ya no es presidente solamente. Sino que es necesario recalcar que es un presidente “constitucional”. Veremos que relación tuvo Allende con la Constitución:
El diputado Orrego afirmó también que el Presidente Salvador Allende no estaba respetando el Estatuto de Garantías Democráticas que había hecho posible su elección. Este listado de derechos individuales había sido incorporado a la Constitución en 1970 como condición para que la Democracia Cristiana lo eligiera con sus votos como presidente, pues el candidato socialista sólo había obtenido el 36.2% del voto popular y, por lo tanto, el Congreso podía elegir a la primera magistratura a cualesquiera de las dos primeras mayorías relativas. Más tarde, Allende reconocería que él firmó este Estatuto sólo como una maniobra “táctica” (Regis Debray, The Chilean Revolution: Conversations with Allende, 1971).
Luego, veamos que dijo la cámara de diputados en esa época sobre Allende y la constitución:
El Acuerdo, aprobado por casi dos tercios de los diputados (63.3%), acusaba al gobierno del Presidente Allende de veinte violaciones concretas a la Constitución y las leyes, entre las cuales destacaban amparar grupos armados, torturar, detener personas ilegalmente, amordazar la prensa, manipular la educación, limitar la posibilidad de salir del país, confiscar la propiedad privada, formar organismos sediciosos, violar las atribuciones del Poder judicial, el Congreso y la Contraloría, y todo ello de manera sistemática y con el fin de instaurar en Chile “un sistema totalitario”, es decir, una dictadura comunista.
Aparte de salir electo gracias a un acuerdo “especial” que no respetó, y de limpiarse el trasero con ella, no hay otra relación entre el presidente Allende y la Constitución. Asi como no hay relación alguna entre la extrema izquierda Chilena, incluyendo al PC, una sección del PS, Lautaristas, gente del Frente con un Chile democrático. Cualquier comentario que ellos reciben en este sentido se confronta utilizando a Pinochet. Los crímenes del gobierno militar se han usado para canonizar a la extrema izquierda Chilena, e incluso hacer caso omiso cuando se llenan la boca hablando de democracia.
Estoy hasta los huevos de escuchar a incongruentes izquierdistas hablar de democracia, llevar a ese dictador a ser una figura con estatua EN LA PLAZA DE LA CONSTITUCIÓN!!, con una plaza llevando su nombre en cada ciudad Europea y llamando a sus cobardes héroes (asaltantes de bancos, y asesinos) “prisioneros políticos”, los cuales son defendidos y protegidos por el cobarde gobierno que nuestro país tiene ahora, con una incongruencia ideológica sin límites.
Hoy hasta los textos escolares de mi país estan manipulados para convencer al mundo de que este tipo es un ejemplo. Por supuesto jamás se le va a mostrar sus violaciones a la constitución, las acusaciones de racismo y antisemitismo que se le imputan.
No, no me saquen a Pinochet en los comentarios, que Pinochet también me dejó hasta los huevos. Y utilizar A para defender B, lo indefendible, también.
temas.cl, spammers con valores
Danilo Sánchez Villasmil edita una revista online de cosas que no me interesan. Un día recibí un spam para subscribirme a su basura, con una interesante “letra chica”.
Si no desea recibir la información que entregamos a través de nuestro e mail, envíenos un correo a info@temas con la indicación “no deseo”. De lo contrario, puede confirmarnos su aceptación al señalar “sí deseo”. En todo caso, si usted no nos envía su rechazo a ésta suscripción, presumimos que desea seguir recibiendo nuestras informaciones, y será un agrado continuar prestándole este servicio.
Tomamos este cuidado porque no hacemos spam y condenamos a quiénes los practican.
No hay cosa que mas me irrite que el opt-out. Por qué debo gastar mi tiempo en de-subscribirme de basura en la que nunca me he inscrito y gastar mi tiempo en vez de el de este descriteriado. Más aún si su basura se autopublicita como revista valórica.
Esa vez respondí en forma bastante amable, pese a lo enojado que estaba con la patudez de este valórico señor:
Sr. Danilo Sánchez Villasmil
el doble discurso… “revista de valores”, pero utilizando tácticas dudosas como el opt-out “si no digo nada, asumimos que quiere nuestra basura”, o sea, para mantener mi cómoda situación en vez de cambiar a la que Ud. intenta “forzar” , debo utilizar mi tiempo y no el suyo. ¿Quien le ha dado derecho a utilizar el tiempo de los demás?
Mi tiempo es mío. Y si la gente no tiene 20 segundos para responder a su “inscripción automática en listas de basura” no es porque quiera recbir dicha basura, y Ud. lo sabe, pero los “valores” no llegan tan lejos, no? y se siente con el derecho a “asumir”. Veremos que opina la gente en los blogs sobre esto.
Bueno, a pesar de mi descontento, hoy recibí la nueva edición de la basura esa. O sea el tipo aparte de patudo e incongruente, es un mentiroso.
wheres my gphone?
Google is talking about their mobile phone platform here, the website is here.
According to the website:
On November 12th, an early look at the Android Software Development Kit (SDK) will be made available to developers via our website.
A quote from the website:
All applications are created equal Android does not differentiate between the phone’s core applications and third-party applications
Se also the amazing list of members of the alliance.






