lunes, 18 de febrero de 2013

Entrando en la Robotica con Arduinos

Recien llega mi primer Arduino, el Arduino Leonardo. Para instalarlo en mi Mac con Lion, lo unico que hay que hacer es descargar de aqui . Y copiar el programa en la carpeta de programas si lo deseais.

Al parecer la pagina de Guia resulta bastante fiel hasta un momento. Que es que no me carga el ejemplo de Blink y ningun otro. Por alguna razon, dice que el puerto esta ocupado siempre. La explicacion esta en el enlace que deje anteriormente, pagina Guia.

Al parecer lo que pasa es que el directorio "/var/lock" es necesario, el cual no existe. Cree el directorio via shell y le di los permisos correctos, y me cargo perfectamente el codigo.

sudo mkdir /var/lock

te pedira el password y pondar el de usuario y despues se le pondra los permisos.

sudo chmod 777 /var/lock 

Luego cuando intente cargar nuevamente mi programa, Voila!!! Funciono!!! Una cosa curiosa intente nuevamente subir exactamente el mismo codigo y me dio el mismo error, pero si lo cambio lo vuelve a subir.

domingo, 17 de febrero de 2013

Default en C#

Hace mucho que no hago nada muy competitivo en C#, luego para calentar motores empece con una caracteristica que me estaban preguntando hace unos dias. Default(T)

Aqui les explico un poco de default(T).

Un ejemplo muy simple:

Estoy creando mi proprio diccionaria y tengo la siguiente implementacion.


class MyEmptyDictionary<K, V> : IDictionary<K, V>
{
    bool IDictionary<K, V>.TryGetValue (K key, out V value)
    {
        return false;
    }

    ....

}


El codigo anterior tiene problemas implementando la funcion TryGetValue. Cuando no se encuentra una llave. No tendria nada que asignar al parametro de salida, entonces uno piensa dejarlo asi como esta. Esa accion lleva al siguiente error. "The out parameter 'value' must be assigned to before control leaves the current method".

Luego, basicamente, lo que hace falta es devolver el valor por defecto (0, false, o dependiendo del tipo)

Luego la solucion es default(V)


class MyEmptyDictionary<K, V> : IDictionary<K, V>
{
    bool IDictionary<K, V>.TryGetValue (K key, out V value)
    {
        value = default(V);
        return false;
    }

    ....

}


mas informacion




sábado, 16 de febrero de 2013

How to tag all your audio files in the fastest possible way


I’d introduce efficient ways to add ID3 tags to MP3 files. For me, adding such tags is an absolute necessity. If I really want my MP3 files to be and remainproperly sorted and quickly usable even if I change software, I must guarantee that:
  • They are indexable through an open standard that many software tools can process automatically.
  • The corresponding data are written inside the files themselves, to follow them when the files move to another computer or operating system, and inside backups.
This said, let me make clear from the beginning that “the fastest possible way to tag MP3 files” can still involve a lot of manual work. Actual songs often are not a big deal, but MP3 audio can beanything. My own MP3 collection contains both songs directly ripped and fully tagged, in one round, from my own CDs, and other files from everywhere, all encoded without any tags. Most of those “non-song” files of mine are either:
  • Digitized analog recordings (you know what I mean: things like me singing “Merry Christmas” in kindergarten…), normally made by relatives and friends who have no clue of what tagging is, or…
  • Podcasts from “professional” radio stations, that were very unprofessionally published online without any tagging whatsoever.

Tagging songs with a graphic interface

Many music files are catalogued in several online databases. The most famous ones that are managed in an Open Source way and fully compatible with Linux are FreeDB and MusicBrainz. I have used Picard, the official MusicBrainz tagger, to tag semi-automatically the majority of my music files. The process, described in detail here, consists of these main steps:
  1. File Loading:
    • Launch Picard, select View | File Browser in the top menu.
    • Find in the Browser your music folder and drop it in the left Picard pane. Picard will put untagged files in its “Unmatched Files” folders and already tagged albums in its right pane
    • If there are files that Picard doesn’t recognize, you should probably remove them
  2. Clustering:
    • Click on “Cluster”, and Picard will rearrange the “Unmatched files” files likely to belong to the same album into album clusters.
  3. Automatic, metadata-based lookup:
    • Select unmatched files or albums and click on “Lookup”: Picard will use the (few) tags they may
      already contain to fetch other data from MusicBrainz and put all the albums it recognizes in this way in the right pane
    • At least initially, do this only on a few files or albums at a time, to understand how Picard works
    • Inside those albums (See Figure A at right), tracks actually present on your drive are represented with coloured rectangles (red means bad match, green good or perfect match), the others with music notes.
  4. Automatic, “fingerprint” based lookup:
    • If you click on “Scan” after selecting some files, Picard will calculate their Acoustid “fingerprint” and compare them against those in the online database. If there’s a match, Picard will download all the tags for those songs (see Figure B below).
    • This option works on uncompressed audio, not MP3 files, so it is normally useful (only) when you first rip songs from a CD, where they are uncompressed but untagged.
  5. Manual tagging and reordering
    • At this point, check what Picard did automatically and:
    • Manually drag and drop in the right album files that you know, but are still unmatched.
    • Select all the files and albums that are properly tagged and “Save” (right-click menu): only at this point the ID3 tags will be written inside the files, making them ready for automatic reordering with Picard itself, my script, or other methods.

Figure B

And now one shell way to tag MP3 files

The easiest way to prepare non-song MP3 files for proper tagging is to give them consistent and meaningful names. Once that precondition is verified, you can automatically use those names to write tags with a script like this:
   1 #! /bin/bash
   2
   3 for SONG in `find $1 -type f -name "*mp3"`
   4     do
   5        TITLE=`basename $SONG | cut -d_ -f1 | tr "-" " "`
   6        LEAD=`basename  $SONG | cut -d_ -f2 | tr "-" " "`
   7        YEAR=`basename  $SONG | cut -d_ -f3 | cut -c1-4`
   8        id3tag   --song="\"$TITLE\"" $SONG
   9        id3tag  --album="\"$TITLE\"" $SONG
  10        id3tag --artist="\"$LEAD\"" $SONG
  11        id3tag       -y$YEAR $SONG
  12     done
  13     exit
Here I assume that each file has a name in the format TITLE_LEAD_DATE.mp3, with the first four characters of the DATE being the YEAR of recording. Of course, once you get the trick, you can easily hack the script to work with any other (constant!) naming format. Lines 5 to 7 extract title, lead and year from the file name, replacing hyphens with spaces: a file named The-Wall_Pink-Floyd-19791130.mp3 will return “The Wall” for TITLE, “Pink Floyd” as LEAD and 1979 as YEAR. Once these strings are inside shell variables, we only have to call the id3tag program (lines 8 to 11) to write each tag inside the file. Easy, isn’t it?

source: http://www.techrepublic.com/blog/opensource/how-to-automatically-rename-and-reorder-mp3-files/3425

miércoles, 13 de febrero de 2013

Analistas Programadores – Qué hacen y qué se necesita para serlo



El Analista Programador es la persona que realiza las funciones de un analista técnico y de unprogramador; es decir, parte de una información previa recibida del analista funcional, en función de la cual desarrolla las aplicaciones y organiza los datos. Es el perfil más buscado en la actualidad.



En base a sus conocimientos en el o los lenguajes de programación necesarios en cada caso, sintetiza, organiza y lo lleva a la práctica mediante la codificación de la silución. Requiere características de personalidad similares a las de un programador, con mayor visión global y capacidad de análisis y síntesis.

Competencias Blandas

Pensamiento lógico
Interés por el orden
Constancia
Capacidad de atención y concentración
Innovación

Competencias Técnicas

Paradigma de Objetos
Lenguaje de diagramación de sistemas UML
Lenguaje de consulta de bases de datos SQL
Conocimiento real de al menos un lenguaje de programación
Técnicas de calidad de software.



No me cabe la menor duda que esta posición es la que absorbe más presión y en las áreas de desarrollo a quienes gentilmente llaman por las noches en caso de cancelaciones.Es uno de los tramos en donde pones a prueba verdaderamente tu vocación.

fuente:http://micarreralaboralenit.wordpress.com/2007/12/05/analistas-programadores-que-hacen-y-que-se-necesita-para-serlo/

martes, 12 de febrero de 2013

How to install PIL on mac os x 10.7.2 Lion

you can just download/build/install it from source:



# download
curl -O -L http://effbot.org/downloads/Imaging-1.1.7.tar.gz
# extract
tar -xzf Imaging-1.1.7.tar.gz cd Imaging-1.1.7
# build and install
python setup.py build
sudo python setup.py install
# or install it for just you without requiring admin permissions:
# python setup.py install --user




I ran the above just now (on OSX 10.7.2, with XCode 4.2.1 and System Python 2.7.1) and it built just fine, though there is a possibility that something in my environment is non-default.

For those having trouble with gcc or llvm-gcc command not found error when running setup.py, check in xcode that commande line tools are installed by going to "Xcode -> Préférences -> Downloads -> Commande Line Tools -> Install".

Alternatively,


If you use homebrew, you can install the PIL with just brew install pil. You may then need to add the install directory ($(brew --prefix)/lib/python2.7/site-packages) to your PYTHONPATH, or add the location of PIL directory itself in a file called PIL.pth file in any of your site-packages directories, with the contents:
/usr/local/lib/python2.7/site-packages/PIL
(assuming brew --prefix is /usr/local).



source:http://stackoverflow.com/questions/9070074/how-to-install-pil-on-mac-os-x-10-7-2-lion

jueves, 7 de febrero de 2013

Usando pep8.py para escribir un buen codigo en Django


Este es otro screencast creado por el site http://agiliq.com/, de la coleccion "Getting Started with Django".



Mas abajo tambien hay un video para hacer buen codigo de python con pyflakes


Fuente

martes, 5 de febrero de 2013

Configurando un poco con Google Maps

Hace poco en el proceso de hacerle un site a unas amistades, recorde que habia visto en algun site, un enlace directo, donde apareciera la direccion de un lugar fisico (hotel, instituicion, etc) como destino, y apareciera la direccion de origen vacia. De tal manera, persona que quisiera ir al local y no supiera como, solo tendria que poner su posicion y google le explicaria el camino.



donde origen, es la direccion donde el usuario esta y destino donde esta la instituicion, hotel, etc, donde queremos ir. En este caso por ejemplo si nos gustaria ir a una direccion cualquiera como. Avenida El Ecuador, numero 42, Codigo Postal: 46025, en Valencia España. Bastaria con la siguiente url


http://maps.google.com/maps?daddr=Avenida+el+ecuador+42+46025+Valencia+spain


Como sabemos en un pedido GET no pueden ir los espacion, luego, los espacios en un pedido GET son equivalentes a el simbolo de "+" . En este caso el origen se omite, para que el usuario que quiera llegar a la direccion, solo tenga que escribirlo.