Tuesday, September 22, 2009

Reinstalling Adobe AIR - Reinstalando Adobe AIR

PROBLEM: Difficulties to install Adobe AIR again.

DESCRIPTION:
I execute the janitor to free some space on my hard disk and Adobe AIR was uninstalled by error. When I tried to reinstall on my ubuntu linux 64bits, It was not possible, it sends that the administrator don't let you installed again. The problem was with the certificates, when you uninstall Adobe AIR it uninstalls everything but the certificates.

SOLUTION:
  1. Remove Adobe-certs from synaptics or manually with the following: sudo dpkg --purge adobe-certs
  2. If you cannot find adobe-certs, then you can check and empty the following folders /etc/opt and /var/opt

PROBLEM: Dificultades para reinstalar Adobe AIR

DESCRIPCIÓN:
Yo ejecuté el encargado de limpieza para liberar algo de espacio en mi disco duro y desinstaló la aplicación Adobe AIR por error.



Cuando traté de reinstalarlo en mi ubuntu linux 64bits, no fué posible, envía que el administrador no te deja instalarlo otra vez. El problema está con los certificados, cuando uno desinstala el Adobe AIR desinstala todo menos los certificados.

SOLUCIÓN:
  1. Remover Adobe-certs desde synaptics o manualmente con el siguiente comando: sudo dpkg --purge adobe-certs
  2. Si no puede contrar adobe-certs,entonces puede revisar y vaciar los siguientes directorios /etc/opt y /var/opt


Friday, August 21, 2009

TweetDeck - Ubuntu 64 bit distrib.

It seems that for Adobe, Linux is the ugly duck for they development. TweetDeck is a twitter client that works on Adobe Air platform, so you need to install Adobe Air first, but there isn't a 64 bit version, so you need to use the 32 bit version.

To install TweetDeck do the steps in the following link first to install Adobe Air http://kb2.adobe.com/cps/408/kb408084.html

Once Adobe Air is installed correctly, then you need to download tweet deck, but you need to do this manually because the download button does not work, you do this by clicking in the version number (see the arrow in the following image):

Then execute the Applications->Accesories->Adobe Air Application Installer

Load the tweetdeck package downloaded and install.


Parece que para Adobe, Linux es el patito feo para su desarrollo. TweetDeck es un cliente de twitter que trabaja sobre la plataforma de Adobe Air, así que necesita instalar primeramente Adobe Air, pero no existe una versión de 64 bits, así que necesita instalar la versión de 32 bits.

Para instalar TweetDeck ejecute los pasos en el siguiente link primero para instalar Adobe Air http://kb2.adobe.com/cps/408/kb408084.html

Una vez que Adobe Air está instalado correctamente, entonces necesita descargar TweetDeck, pero necesitará hacerlo manualmente porque el botón de descarga no funciona, puede hacer esto dándole click en el número de versión (vea la flecha en la siguiente imagen):

Luego ejecute Applicaciones->Accesorios->Adobe Air Application Installer

Cargue el paquete TweetDeck descargado e instálelo.

Friday, May 22, 2009

Setup dreamweaver to color code altenate file types

PROBLEM

How to setup an alternate file type in dreamweaver to be colored code?

DESCRIPTION

When using CakePHP, the files internally are php, but with the file extension .ctp, so when open the .ctp file in dreamweaver the file is interpreted as a text file, it would be better if when opening a .ctp file be interpreted as a php file.

SOLUTION

Open the MMDocumentTypes.xml file located in C:\Program Files\Macromedia\Dreamweaver MX\Configuration\DocumentTypes look for the following section:



and change the winfileextension="php,php3" macfileextension="php,php3" for
winfileextension="php,php3,ctp" macfileextension="php,php3,ctp"

and that's all.

PROBLEMA

Como configurar un tipo de archivo alternativo para ser coloreado por código en Dreamweaver?

DESCRIPCIÓN

Cuando se usa CakePHP, los archivos internamente son php, pero las extensiones de los archivos son .ctp, así que cuando se abre un archivo .ctp en dreamweaver, el archivo es interpretado como un archivo de texto, sería muco mejor si cuando se abriera un archivo .ctp fuera interpretado como un archivo php.

SOLUCIÓN

Abra el archivo MMDocumentTypes.xml file localizado en in C:\Archivos de programa\Macromedia\Dreamweaver MX\Configuration\DocumentTypes buscar por la siguiente sección:


y cambie winfileextension="php,php3" macfileextension="php,php3" por
winfileextension="php,php3,ctp" macfileextension="php,php3,ctp"

y eso es todo.

Sunday, April 26, 2009

Multilingual Apps with cakePHP in windows- Aplicaciones multilenguaje en CakePHP en windows

PROBLEM

How to create a multilingual application in cakephp in a windows environment

DESCRIPTION

It is needed to translate web content for international audience. Cakephp uses the Localization (L10n) and Internationalization (I18n) standards. In cakephp the locale files are stored in the app/locale directory and arranged in language named subfolders, example: /app/locale/eng/LC_MESSAGES for english /app/locale/spa/LC_MESSAGES for spanish and so on, the name of the subfolder is the three letter standar located in http://www.loc.gov/standards/iso639-2/php/code_list.php

Locale files uses the ".po" file extension and cakephp uses the default.po name located in each language subfolder/LC_MESSAGES

SOLUTION

Add the following code to the app_controler.php in the beforeFilter function, this is to work in each cakephp page.

function beforeFilter() {

//For Localization
App::import('Core', 'l10n'); // Localization utility
$this->L10n = new L10n(); //instantiate the L10n class
$this->L10n->get("spa"); //select the language, in this case spa= Spanish
}

And after this, everything contained in the function __() will be looked up in the locales.

The function __() receives two parameters, the firs is the name of the text that is going to look for, and the second is a boolean value and when it is true, it returns the value without sending it to the view, this is a very useful parameter for anidated functions.

The .po files contains the strings to be replaced and have the following sintax:

msgid ""
msgstr ""
and it works very simple, msgid has the string located in the __() function and it is going to be replaced for msgstr, example __('home'), for the default.po located in /app/locale/spa/LS_MESSAGES that contains the following:
msgid "home"
msgstr "Inicio"
msgid "email"
msgstr "correo electrónico"
The function it is going to replace the string 'home' for the string 'Inicio'. The following example represents when the __() function has been called from inside another function:
echo $form->input('email', array('label'=>__('email',true)));
notice that it has the second parameter in true, that means that is going to return the value, but not for the view, instead it is going to return the value for the input function.

.po files must has the RTF-8 character groups, if you want your site to be in spanish you are going to need the "ñ,Ñ,á,é,í,ó,ú" characters, there is a utility that helps you to create the .po files it is called the poedit.exe and it is found in http://www.poedit.net/

The issue is that you can set up a parsers in Poedit, basically definitions of file types and command line parameters for xgettext, which is executed fo find the parts in a file that should be translated. So there is a parser for PHP in there, but often, for example in the CakePHP

framework, you have to deal with files that are PHP files, but that have a different extension, in the CakePHP case views end with .ctp… Just adding “*.ctp” to the list of extensions in the PHP parser setup does not cut the mustard and you end up getting an error message like this:

xgettext: warning: file ‘[…].ctp’ extension ‘ctp’ is unknown; will try C.

To solve this, you need to tell xgettext that it has to deal with PHP files by adding “–language=PHP” to the list of commandline options. This is done by opening Poedit’s preferences and navigating to the parsers section there. In the PHP parser under “Parser command” (btw. this is the MAC version of Poedit) I have now the following line:

xgettext --language=PHP --force-po -o %o %C %K %F

.ctp files or any file specified in the PHP parser is now treated as PHP and translation sections are found.

PROBLEMA

¿Cómo crear una aplicación multilenguaje en cakephp en un ambiente de windows?

DESCRIPCIÓN

Se necesita traducir contenido web para audiencias internacionales. Cakephp usa los estándares de Localización (L10n) e Internacionalización (I18n). En cakephp los archivos locales son guardados en el directorio app/locale y acomodados en subcarpetas nombradas según el lenguaje, ejemplo: /app/locale/engLC_MESSAGES para inglés, /app/locale/spa/LC_MESSAGES para español y así sucesivamente, el nombre de la subcarpeta es el estandar de tres letras localizado en http://www.loc.gov/standards/iso639-2/php/code_list.php

Los archivos de Localización usan la extensión ".po" y cakephp usa el archivo default.po localizado en cada subcarpeta de /LC_MESSAGES

SOLUCIÓN

Agregue el siguiente código en en el archivo app_controler.php en la función beforeFilter, esto es para que funcione en todas las páginas de cakephp.

function beforeFilter() {

//Para localización
App::import('Core', 'l10n'); // Utilería de localización
$this->L10n = new L10n(); //Instancia de la clase L10n
$this->L10n->get("spa"); //selección del idioma, en este caso spa= Spanish
}

Y después de esto, todo lo contenido en la función __() será buscado en los archivos de localización.

La función __() recibe dos parámetros, el primero es el nombre del texto que va a ir a buscar, y el segundo es un valor booleano y cuando es verdadero, regresa el valor sin enviarlo a la vista(view), este es un parámetro muy poderoso porque funciona para funciones anidadas.

Los archivos .po contienen los textos a ser reemplazados y deben tener la siguiente sintaxis:

msgid ""
msgstr ""
y funciona de una manera muy sencilla, msgid tiene los textos localizados en la función __() y van a ser reemplazados por msgstr, ejemplo __('inicio'), para el archivo default.po localizado en /app/locale/eng/LS_MESSAGES que contiene lo siguiente:
msgid "inicio"
msgstr "Home"
msgid "correo electrónico"
msgstr "email"
La función va a reemplazar el texto 'inicio' por el texto 'home. El siguiente ejemplo representa cuando la función __() ha sido llamada desde dentro de otra función:
echo $form->input('correo_electronico', array('label'=>__('correo electrónico',true)));
Note que el segundo parámetro está en verdader, esto significa que va a regresar el valor, pero no para la vista, en su lugar va a regresar el valor a la función input.

Los archvios .po deben tener caracteres en el grupo RTF-8, si usted quiere que el sitio esté en español va a necesitar los caracteres "ñ,Ñ,á,é,í,ó,ú", existe una utilidad que ayuda a crear los archivos .po llamada poedit.exe y se encuentra en http://www.poedit.net/

El problema es que se pueden configuar analizadores de sintaxis (parsers) en Poedit, básicamente la definición de los tipos de archivo y los parámetros de la linea de comando para la función xgettext, la cual es ejecutada para encontrar las partes en un archivo que deba ser traducido. Así que existe un analizador sintáctico para PHP ahí, pero usualmente para por ejemplo en el caso de CakePHP se tiene que lidear con archivos que son archivos PHP, pero tienen diferente extensión, en el caso de CakePHP las vistas tienen extensión .ctp… solo agregando la extensión“*.ctp” a las listas de extensiones en el analizador sintáctico PHP no funciona, y se obtiene un error como el siguiente:

xgettext: warning: file ‘[…].ctp’ extension ‘ctp’ is unknown; will try C.

xgettext: precaución: archivo‘[…].ctp’ la extensión ‘ctp’ es desconocida; se intentará usar C.

Para resolver esto se necesita decirle a xgettext que tiene que tratar con archivos PHP agregando “–language=PHP” a la lista de opciones de la linea de comandos. Esto se hace abriendo las preferencias de PoEdit y navegar hasta la sección de analizadores sintácticos (parsers). En el analizador sintáctico (parser) de PHP en el comando del parser hay se modifica la linea de la siguiente manera:

xgettext --language=PHP --force-po -o %o %C %K %F

Los archivos .ctp o cualquier otra extensión especificada en el parser de PHP es ahora tratado como PHP y las secciones de traducción ahora son encontradas.




REFERENCES

http://book.cakephp.org/view/161/Localization-Internationalization
http://g-roc.com/33_poedit-xgettext-parser-setup-reminder.html

Monday, April 13, 2009

My first program - Mi primer programa

I think it is time to talk about my first program that I coded. It was a long time ago that I had the fortune to use a Commodore 64, it was like a keyboard and a monitor with a 5/4 inches disk drive. This computer was famous because it has a lot of games, but also had a BASIC interpreter. The name of the computer was 64 because it has 64 Kb of memory, a great amount for that time. Later there was a model named Commodore 128 you figure it out why this name.
Well the first program I coded was:

10 PRINT "NORBERTO BURCIAGA"
20 GOTO 10

It was a very nice program that cycles itself, but wrote my name indefinitely on the screen.

NORBERTO BURCIAGA
NORBERTO BURCIAGA
NORBERTO BURCIAGA
NORBERTO BURCIAGA
NORBERTO BURCIAGA
NORBERTO BURCIAGA
.
.
.
to infinity and beyond!

May second program was a pretty modification to this one:

10 A=0
20 PRINT A
30 A=A+1
40 GOTO 20

This program print a sequence of numbers starting from 0 to infinity

0
1
2
3
4
.
.
.
To infinity and beyond!

This programs may seem simple and useless, but for a kid this was awesome, to give orders to a machine and work. Later I made a lot of modifications to those programs just for fun an to test.

Thanks to my uncle Francisco Molinar to let me use his computer those days to let me start in this fabulous world of software.

Yo creo que ya es tiempo de hablar del primer programa que he codificado. Fué hace mucho tiempo que tuve la fortuna de utilizar una Commodore 64, era como un teclado y un monitor con una unidad de discos de 5 1/4 pulgadas. Esta computadora era famosa porque tenía muchos juegos, pero también tenía un interpretador BASIC. El nombre de la computadora era 64 porque tenía 64Kb de memoria, una gran cantidad para ese tiempo. Después existió un modelo llamado Commodore 128 ustedes adivinen el porqué del nombre. Bueno el primer programa que yo codifiqué era:
10 PRINT "NORBERTO
BURCIAGA"
20 GOTO 10

Un bonito programa que se ciclaba así mismo, escribía mi nombre indefinidamente en la pantalla.
NORBERTO BURCIAGA
NORBERTO
BURCIAGA
NORBERTO BURCIAGA
NORBERTO BURCIAGA
NORBERTO
BURCIAGA
NORBERTO BURCIAGA
.
. . hasta el infinito y más allá!

Mi segundo programa fué una bonita modificación de este:
10 A=0
20 PRINT A

30 A=A+1

40
GOTO 20

Este programa imprimía una secuencia de números empezando de 0 hasta el infinito
0 1 2 3 4 . . . Hasta el infinito y más allá!

Estos programas pueden parecer simples y sin utilidad, pero para un niño esto era espectacular, darle órdenes a una máquina y que funcionara. Después hice muchas modificaciones a estos programas solo por diversión y para hacer pruebas. Gracias a mi tío Francisco Molinar por permitirme usar su computadora esos días y permitirme empezar en ese mundo fabuloso del software.

Thursday, April 9, 2009

Some Apache configuration for cakephp - Algo de configuración de Apache para cakephp

INTRODUCTION

Cakephp is a great framework for creating fast and professional web sites. There are some tricks to configure correctly in Apache web server with php if it is wanted to be configured in a different directory (virtual directory) outside the main www area.

PROBLEM

Creating a virtual directory in Apache web server for a cakephp project.

DESCRIPTION

Cakephp uses mod_rewrite module, this is needed because cakephp uses friendly urls, example:

unfriendly url: http://www.blogger.com/post-create.g?blogID=3570594853912202313
friendly url: http://www.serviprod.com/users/add

Mod_rewrite module allows you to modify your URL being identified with a regular expression pattern and replaced with another url and reinjecting this new url. In other words it is going to identify your friendly url with a regular expression and then converting your url to an unfriendly url and send it to the web server to be processed.

Activating mod_rewrite is sometimes tricky in Apache web server, and sometimes you need to be aware of the new url created if it is correct, but the problem is that you cannot see this new url in your browser, sometimes you are guessing what your new url might be.

What I want to create is a web site outside of the web root of Apache web server, that it is a cakephp web site in a windows environment.

SOLUTION

  1. Copy your cakephp framework (cake_1.2.1.8004) to the desired directory in my case it would be C:\Almacen\003.DES\serviprod
  2. Rename the cakephp framework folder to your desired web site name as specified in cakephp documentation. In my case I am going to rename the folder "cake_1.2.1.8004" to "serviprod"
  3. Need to find the correct Apache's web server configuration file (httpd.conf), this is important because in linux there must be more than one httpd.conf file, in windows environment there is no such problem but just in case.
  4. Need to find the following line "LoadModule rewrite_module modules/mod_rewrite.so" it is usually commented with a "#", you need to uncomment this line taking the "#" out. This is going to activate the mod_rewrite module in your apache web server.
  5. Your webroot it is determined by the following line: DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs", it is important to know where is your webroot to see that where you put your site is outside this root.
  6. You need to create an alias to tell the apache web server where is your site. Alias: Maps web paths into filesystem paths and is used to access content that does not live under the DocumentRoot. In my case the Alias I created is: Alias /serviprod "C:/Almacen/003.DES/serviprod/serviprod" where /serviprod it is going to be de way the site is accessed and the rest is the physical path of the site.
  7. Now you need to give apache access to those files, so you need to create a directory segment with the appropiate security:
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
    Note the FollowSymLinks option that it is going to let you rewrite urls specified in the .htaccess file in the main directory of your cakephp site. And AllowOverride All to let the .htaccess file change the urls.
  8. The .htaccess doesn't know that the site it is been accessed thru an alias, so when it needs to reinject the new url, it is going to be not with the alias name, so we need to add a line to a .htaccess file: rewritebase /youralias. In my case the .htaccess it is going to be like follows:

RewriteEngine on
RewriteBase /serviprod
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]

with the RewriteBase /serviprod line added to the original file.

INTRODUCCIÓN

Cakephp es un excelente framework de php para crear sitios web rápidamente y profesionales. Existen algunos trucos para configurar correctamente el servidor de web Apache con php si se quiere configurar un sitio web en un directorio diferente (directorio virtual) fuera del area principal de www.

PROBLEMA

Crear un directorio virtual en el servidor web Apache para un proyecto del framework cakephp.

DESCRIPCIÓN

Cakephp usa el módulo mod_rewrite, esto es necesario porque cakephp usa urls amigables, ejemplo:

url no amigable: http://www.blogger.com/post-create.g?blogID=3570594853912202313
url amigable: http://www.serviprod.com/users/add

El módulo Mod_rewrite permite modificar los URL identficados con una expresión regular y reemplazados con otro url y reinyectándolo. En otras palabras va a identificar el url amigable con una expresión regular y luego convirtiendolo a un url no amiable y enviándolo al servidor web para ser procesado.

Activar mod_rewrite algunas veces es truculento en el servidor de web Apache, y algunas veces necesitará estar pendiente del url creado si es correcto, porque el problema es que no puede ver este nuevo url en su navegador, algunas veces se adivina cual es este nuevo url.

Lo que yo quiero crear es un sitio web fuera de la raiz web del servidor web Apache, que es un sitio web cakephp en un ambiente windows.

SOLUCIÓN

  1. Copie el framework cakephp (cake_1.2.1.8004) al directorio deseado en mi caso será: C:\Almacen\003.DES\serviprod
  2. Renombre la carpeta del framework cakephp al nombre deseado del sitio web como se especifica en la documentación. En mi caso voy a renombrar la carpeta "cake_1.2.1.8004" a "serviprod"
  3. Es necesario encontrar el archivo de configuración del servidor web Apache (httpd.conf), esto es importante porque en linux deben existir más de un archivo de estos httpd.conf , en el ambiente windows no hay tales problemas, pero solo por si acaso.
  4. En el archivo de configuración se necesita encontrar la siguiente linea "LoadModule rewrite_module modules/mod_rewrite.so" está usualmente comentada con un "#", es necesario quitarla de modo comentario quitando el "#". Esto va a activar el módulo mod_rewrite en el servidor web Apache.
  5. La raiz de sitios web (webroot) está determinado por la siguiente linea: DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs", es importante saber donde está su webroot para ver que se colocó el sitio fuera de esta raiz.
  6. Es necesario crear un "alias" para decirle al servidor web Apache donde se encuentra el sitio. Alias: Convierte caminos web (web paths) en caminos del sistema de archivos (filesystem paths) y es usado para acceder a contenido que no está bajo la raiz web (DocumentRoot). En mi caso el Alias creado es: Alias /serviprod "C:/Almacen/003.DES/serviprod/serviprod" donde /serviprod será la manera de que el sitio es accesado y el resto es el camino físico hacia el sitio.
  7. Ahora se necesita dar acceso al Apache a esos archivos, así que se necesita crear una sección Directory con la seguridad apropiada:
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
    Note que la opción FollowSymLinks permitirá reescribir urls especificados en el archivo .htaccess en el directorio principal de su sitio cakephp. Y la opciópn AllowOverride All le permitirá al archivo .htaccess cambiar los urls.
  8. El archivo .htaccess no sabe que el sitio ha sido accesado a través de un Alias, así que cuando necesite reinyectar el nuevo url, no será con el nombre del alias, así que será necesario agreagar una linea al archivo .htaccess: RewriteBase /tualias. En mi caso el archivo .htaccess será como sigue:

RewriteEngine on
RewriteBase /serviprod
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]

Con la linea RewriteBase /serviprod agregada con respecto al archivo original.

Thursday, January 29, 2009

Tribute to HP-150 - Tributo a la HP-150


The first computer that I saw in person and literally touch in mi life was the HP-150, and I mean leterally because it has a tochscreen, well it was not exactly a touchscreen in the sense of touching and with the preassure detect the position of your finger, instead it has a lot of holes arround the monitor with a lot of infrarred leds, similar to those used in a remote control. When somebody put his finger, that person cut a pair of rays of infrarred signals one for each coodenate and the computer calculates the position of your finger. This is not a great resolution it was like about two characters, but it is an amazing technology for 1983 and at this time I was arround 12 years old.

It was during a demo of this machine that the owner of a store made to my father with the purpouse of selling it to him. At that time, people didn't realize the potential of a computer, and my father was only looking for a typewritter machine, not a computer. The seller let us (my brothers and I) use it for just a momment because we were kids and computers were expensive. What I remember from that experience is that it has like a menu of five big options (aprox) represented each one with an icon, and when you touch one, another menu was presented until you finally reach the application you wanted to execute.
Click to go to larger photo of the Hewlett-Packard-150 Touchscreen Personal Computer with Hewlett-Packard 9121 Dual Drives.

It was not a PC compatible machine, but uses the ms-dos operative system

La primera computadora que yo ví en persona y literalmente toqué en mi vida fué la HP-150, y me refiero a literalmente porque tenía una pantalla sensible al tacto, bueno, no era exactamente sensible al tacto en el sentido de mediante presión detecta la posición del dedo, en cambio tenía un montón de agujeros alrededor de la pantalla con un monton de leds infrarrojos, similares a los usados en un control remoto. Cuando alguien ponía su dedo, la persona cortaba un par de rayos infrarrojos uno para cada coordenada y la computadora calculaba la posición del dedo. Esto no era una gran resolución era como acerca de dos caracters, pero una tecnología increible para 1983 y en este tiempo yo tendría alrededor de 12 años.

Fué durante la demostración de esta máquina qu eel dueño de una tienda le hizo a mi papá con el propósito de vendérsela. En ese tiempo, las personas no se daban cuenta del potencial de una computadora, y mi papá estaba buscando solamente una máquina de escribir, no una computadora. El vendedor nos permitió (a mis hermanos y a mí) usarla por solo un momento porque nosotros eramos niños y las computadoras eran carísimas. Lo que yo recuerdo de esa experiencia es que tenía un menú de cinco grandes opciones (aprox.) representadas cada una por un ícono, y cuando se tocaba alguno, otro menú era presentado hasta que finalmente se alcanzaba la aplicación que se quería ejecutar.

Norberto Burciaga
http://www.nbsis.com