OpenZaurus cierra puertas y se centra en Ångström

Marcin Juszkiewicz anuncia hoy en el website de OpenZaurus que ya no habrán nuevas versiones de OpenZaurus. Los desarrolladores del proyecto se van a concentrar en Ångström.

De los dos websites: OpenZaurus funciona solamente en PDA Zaurus. (Salvo versiones particulares que hicieron algunos que no eran parte del proyecto OpenZaurus.) En cambio, Ångström es una distribución que apunta a toda una gama de dispositivos: agendas, teléfonos, dispositivos embedded… El proyecto lo empezaron algunas personas que trabajaban en otros proyectos similares: OpenEmbedded, OpenZaurus y OpenSimpad. La idea es unificar esfuerzos y hacer una distribución más estable y amigable al usuario.


Tags:

Leave a Comment

WindowsXP y Office a $3 para países pobres

Aceprensa publica este artículo sobre la oferta anunciada en Pekín por Bill Gates para poner al alcance de los países pobres algunos productos estrella de Microsoft. La idea en sí es interesante: de hecho ya aquí en Perú se habla mucho de que hay un mercado en las necesidades insatisfechas de los sectores más deprimidos.

El artículo cita el caso de Unilever en India: Unilever tuvo la iniciativa de vender champú (shampoo) en satchets a bajo costo. Se reduce el margen por unidad vendida, pero el menor márgen se compensa con creces debido al gran volumen de ventas. El consumidor de menos recursos también se beneficia porque se ahorra la venta minorista con muchos intermediarios que normalmente encarece el producto. Ganan todos.

Microsoft tiene bastante trabajado el asunto y lo que publican en su website es interesante. El efecto neto seguramente será positivo. También está el video de la conferencia en Pekin (si usas Linux, puedes verlo usando VLC). También es interesante este programa de Microsoft: Microsoft Authorized refurbisher. (No sé por qué me acordé inmediatamente de las PCs de segunda, de buena marca, que venden en Compuplaza en el centro de Lima.)

De todos modos, sí me han llamado la atención algunas cosas. Por ejemplo, hablan de ofrecer Windows a $3, pero se refieren a Windows XP y no a Windows Vista. Y tampoco es WindowsXP Professional, ni siquiera XP Home, sino XP Starter Edition, lo mínimo mínimo. Ni siquiera sé si se puede correr Visual Studio Express en XP Starter Edition.

También dicen que estos programas se harán a través de los gobiernos de esos países pobres. Supongo que habrán estudiado el asunto, porque pensar que los gobiernos de los países pobres son eficientes administradores… por no decir más… Bien, hay soluciones a esto, y de hecho el proyecto de One Laptop Per Child también es a través de los gobiernos.

El problema de los países menos desarrollados no es que no tengan acceso a Windows XP (ya sin entrar en el debate si es un bien o un mal que usen Windows, como con cierta ironía menciona este post). Es más, ya tienen acceso a Windows Vista y Office 2007, y el costo es alrededor de $3: se adquiere en el mercado pirata. De modo que lanzar una iniciativa para hacer llegar a los países en vías de desarrollo Windows XP Starter Edition, y además a través de los gobiernos… bien, deben saber algo que nosotros no sabemos.

Quizá una propuesta más realista sería que Microsoft liberara la versión de WindowsXP para uso personal. Si eres estudiante o usuario particular (no empresas) de un país que no está en la lista del Banco Mundial de países de altos ingresos, entonces podrías descargar legalmente y gratis el .iso del CD de la página de Microsoft. (La idea de la lista de países de altos ingresos la saqué de Cory Doctorow, que permite descargar sus libros sin costo con ese esquema). Incluso podrían permitir que se distribuyera por redes P2P, bittorrent… De hecho ya es así, con o sin el consentimiento de Microsoft.

¿Cómo controlaría Microsoft si los que descargan Windows XP están realmente en uno de esos países en vías de desarrollo, o si realmente son estudiantes o usuarios particulares? La respuesta es que no hace falta controlar nada. El que quiere delinquir, no tiene que esforzarse ni gastar mucho para comprar una copia ilegal. En realidad, en el mercado de software pirata el Windows XP ha bajado de precio, porque ahora lo que “vende” son las copias piratas de Windows Vista. No estoy a favor de la piratería, pero no seamos ingenuos… Si Microsoft liberase el Windows XP, por lo menos se ahorraría el gasto administrativo de distribuirlo y daríamos una oportunidad menos a los gobiernos de turno de demostrar lo ineficientes que son en el manejo del dinero.

Seguramente habrá gente que baje el .iso de la página de Microsoft, lo queme en un CD y lo venda (porque no todos tienen banda ancha para descargar los 600MB), y ganaría algo de plata. Excelente. Estarían dando un servicio, le ahorran a Microsoft el costo de distribución. Además los piratas ganarían menos, los perjudicarían. Doble beneficio.

El software no es como el champú que vende Unilever.


Comments (3)

Using dynamic choices with Django newforms and custom widgets

Most of the examples I have found on the web about replacing the default Django newforms widgets use hard coded values for the list of choices the widget displays. But those hard coded examples fall short when the widgets are bounded to many-to-many fields or to foreign keys in the model class. That is, when the list of choices is generated dynamically at run time, read from a database table.

The solution is obvious simple: fetch the dictionary of choices from the original widget, and use it as a parameter for your new custom widget.

It sounds simple, and it is. But it took me some time to figure out how to do it. The Django newforms lilbrary documentation is still work in progress, at least at the time of this writing. I could not found where the original widgets were stored in the Form instance. Thankfully, Django is an open source project, and Python has an interactive shell mode. Inspection of the source code and regression tests, and some playing with the Python shell is really an enlightening process. Anyway, I am posting this on the blog for further reference. I also include a working example of a sample Django blogging application I wrote for testing: pretty basic, but it and ilustrates, among other things, the use of custom widgets with dynamic choices.

Maybe the explanaition is “over-verbose”… suggestions accepted.

Don’t hit the database twice

Consider the following model class:

The standard method for displaying a form for the model class in a webpage is to subclass forms.Form, create an instance of the subclass and return the rendered the template. Examples of this can be found on the Django website and on the web.

Django newforms provides two methods that simplify the subclassing of forms.Form: form_for_instance and form_for_model. Both methods return a new class: a subclass of Form, more precisely, tuned to your model class or model instance. If you have a model class or model instance with a many-to-many relationship, and you don’t mind displaying the relationship as a listbox on the webpage, then these two methods will take care of querying the database, building the list of options and feeding it to SelectField or a SelectMultipleField widget.

The next step is to create an instance of ArticleForm, and return the rendered tempalte:

I don’t like lists for multiple option selection, at least not in webpages. I prefer checkboxes. It takes some CSS tweaking to render them correctly and evenly spaced on the webpage, but it greatly enhances the user experience.

The class generated by form_for_model (and by form_for_instance) stores the widgets in a variable named base_fields (a dictionary). This makes it simple to replace any of the default widgets with any other widget, provided it makes sense to do so. For example, the following code replaces the author and tags widgets with a RadioSelect widget and a CheckboxSelectMultiple widget:

The only thing left is to provide the list of choices that both CheckboxSelectMultiple and RadioSelect constructors expect as one of their parameters. One way to build such lists is to query the database and fetch the entries for the Tag and Author classes. Something like tagChoices = Tag.objects.all() and authorChoices = Author.objects.all(). Convert the resulting queryset to a dictionary and use it as a parameter to the RadioSelect widget constructor.

But this is querying the database twice and for the same data each time the form is displayed on the webpage: once for the original SelectMultiple widget, and then again for the custom widget. And it would be a shame to have your name on such code… Obviously, this can be avoided by retrieving the list of choices from the original SelectMultiple widget and using it as the list of choices for our custom widget:

That’s it. The Author SelectField gets replaced by radio buttons, and the Tag MultipleSelectField by some nice checkboxes. The database gets hit only once. Nothing to be ashamed of.

A complete example

Updated 2007-5-5: added editpost.html, which was not included by mistake.

The following is a test blog application I wrote. It uses form_for_instance and form_for_model to define the proper subclass of form, then replaces the standard widgets with custom ones. The widgets load the Author and Tags choices dynamically. In addition, creation and edition of the blog posts are handled by the same method. A regular expression in urls.py converts web page names to slugs as registered in the database, so permalinks are effectively implemented.

This blogging app is really basic: the Django admin interface is needed to add new tags and authors; no authentication; post slugs have to be hand created; no plugins; etc. But deactivate the edit line in urls.py, use css to pump up the desigh, edit your posts using the admin interface, and you have a Django-powered miniblog you can start customizing. Maybe pass the form with the article content to another method, before rendering the template, and write some plugins to pre-process the content prior to show it on the webpage.

Some screenshots of the Django mini-blog

This is pretty spartan. Throw in some CSS if you like.

Django Blog, main page

Django blog, edit post

[Read the rest of this entry...]


Comments (11)