Imaginemos un mundo libre

La paz interior comienza en el momento en el que decides no permitir, que ninguna persona o evento, tome el control de tus emociones.

Archive for August 2009

Peruvian Radios in Amarok

with 6 comments

Estimados KDEeros peruanos y usuarios de Linux en general:

Acabo de publicar un script que agrega algunas radios online de nuestro querido Perú en el excelente reproductor Amarok versión 2.0+. Lo pueden descargar desde aquí

Para instalar el script se van al Menú Tools->Script Manager->Install Script seleccionan el script que descargaron, presionan OK y listo.

Otra forma es en vez de hacer click en “Install script” presionan “Get More Scripts”, y hacen click en “Install” a lado de “Peruvian Radio Stations” y listo. Cierran y vuelven a abrir Amarok y tendrán una pantalla como esta:

Peruvian Radio Stations in Amarok

Peruvian Radio Stations in Amarok

Hacen click en Peruvian Radio Stations y les aparecerá:

Peruvian Radio Stations in Amarok

Peruvian Radio Stations in Amarok

He agregado todas las radios que pude encontrar en la web. Disfruten escuchando la música de su preferencia, así como noticias, deportes, etc. Normalmente cuando cambias de una radio a otra, demora de 1 a 5 segundos.

Las siguientes radios fueron testeadas una y otra vez y funcionan correctamente:

Lima:
Callao 1400 KHZ AM
Capital 96.7 FM
Corazon 96.7 FM
CPN Radio 90.5 FM
Doble Nueve 99.1 FM
Felicidad 88.9 FM
La Unión 103.3 FM
Miraflores 96.1 FM
Moda 97.3 FM
Panamericana 101.1 FM
Planeta 107.7 FM
Ritmo Romántica 93.1 FM
RPP 89.7 FM
San Borja 91.1 FM
Secretos al corazón 93.1 FM
Studio92 92.5 FM
Telestereo 88 FM

Arequipa:
La Mega 94.3 FM
Las Vegas 99.3 FM
Melodia 104.3 FM
Panorama 96.5 FM
Super Stereo 105.5 FM
Yaravi 106.3 FM

Tacna:
Power 98.1 FM
Super Stereo 103.5 FM
Uno 93.7 FM

Cusco:
TV Color 98.1 FM
Willkamayu 940 AM

Trujillo:
La Grande 96.1 FM
Libertad Mundo 1160 Kcs AM

Ica:
Sonica 92.1 FM

Este pequeño script está basado en el script de Radio France con ciertas modificaciones. Gracias al desarrollador y a este tutorial que encontré en la web de Kubuntu que me permitió entender mejor como funcionan los scripts en Amarok..

Si desean que una radio sea agregada, por favor, simplemente envíen un mail a ronnycontacto(at)gmail.com indicando la stream url de la radio o simplemente la dirección del sitio web y gustosamente agregaré la radio en la brevedad posible..

Advertisements

Written by Ronny Yabar

August 5, 2009 at 7:44 am

Posted in Arequipa, KDE

Congratulations KDE team for Caizen (KDE 4.3)

with one comment

kde 4.3 (Caisen) was released today. Please read the announcement, see the improvements, applications, the platform and give this desktop a try and you will see the difference.

Congratulations and thanks to all the KDE team for the hard work..

KDE 4.3

KDE 4.3

I love KDE and now that I am doing more c++ and QT I hope to be part of the team for 4.4.

Written by Ronny Yabar

August 4, 2009 at 6:21 pm

Posted in KDE

Upgrade to Django 1.1

with one comment

Developing or considering Django to create your cool 2.0 web applications/sites?

Please, try the new version of Django (1.1) which comes with interesting new features.

If you already have Django installed, you must remove the old version directory before upgrading. The path to the directory depends of your system, but it is usually located at:

/usr/local/lib/python$version/dist-packages/
/usr/local/lib/python$version/site-packages/
or
/usr/lib/python$version/dist-packages/
/usr/lib/python$version/site-packages/

One of the new features I recently tried is the possibility to create admin actions that allow for bulk updates to many objects at once.

Example:

Imagine you have a field called status which is a boolean field and you want to change the status of many elements at the same time. It’s annoying to select an object one by one to change the status. Here come “admin actions”, they are really useful.

In this short example, I want to make some objects published/unpublished. I will define two methods in my admin.py to achieve this.

def published(modeladmin, request, queryset):
    queryset.update(status=1)
published.short_description = 'Published stores'

def unpublished(modeladmin, request, queryset):
    queryset.update(status=0)
unpublished.short_description = 'Unpublished stores'

As you can see, in this case, the actions take an argument: queryset, which contains the action to perform and the fields that will be affected.

Then, you add these actions to your model admin:

class StoreAdmin(admin.ModelAdmin):
  ...
  actions = [published,unpublished]

And your admin interface will look like this:

Django admin actions

Django admin actions

Now you can select Published/Unpublished and press “Go” to test the actions.

I selected some elements to make them unpublished and in a second I got the following:

After performing admin actions in Django

After performing admin actions in Django

Simple right?. KISS is always important. But, there are some things to consider before finishing:

Those actions(published, unpublished) are placed outside the class ModelAdmin. (StoreAdmin in this example). But, we also can define these actions as methods of the ModelAdmin.

The advantage is that defining actions as methods gives the action a more direct access to the ModelAdmin (Performance) and the possibility to call any of the methods provided by the admin.

So, I am going to define the actions as methods of StoreAdmin and rename modeladmin parameter to self.

And finally I put the strings ‘published’,’unpublished’ in actions to tell the ModelAdmin to see those actions as methods instead of direct references to functions:

class StoreAdmin(admin.ModelAdmin):
  ...
  actions = ['published','unpublished']

  def published(self, request, queryset):
    queryset.update(status=1)
  published.short_description = 'Published stores'

  def unpublished(self, request, queryset):
    queryset.update(status=0)
  unpublished.short_description = 'Unpublished stores'

And that’s it. If you want to know more about admin actions or implement advanced action techniques, take a look at the excellent Django documentation.

Another feature I tried in Django 1.1 was the option: list_editable which allow edit and save multiple rows at once from the change list page. This option has the same format that list_display, but you have two restrictions:

  • Any field in list_editable must be in list_display.
  • The same field can’t be listed in both list_editable and list_display_links
  • class StoreAdmin(admin.ModelAdmin):
      ...
      list_display = ('customer', 'state','city','phone','status')
      list_editable = ['phone']
    

    A screenshot of the list_editable option for the field phone of my Store model.

    Django - list_editable option

    Django - list_editable option

    Well, I’ll continue exploring the new features in Django 1.1. If you have something to share, don’ t hesitate to post a comment or blog about that.

    Written by Ronny Yabar

    August 3, 2009 at 7:46 am

    Posted in Django