Saturday, February 27, 2010

El terratrèmol de Xile i twitter

Escric això quan fa encara poques hores que ha succeït un terratrèmol de magnitud 8,8 a l'escala Richter a Xile, amb l'epicentre sota el mar a 55 Km de la ciutat de Concepción.

Hi ha hagut almenys 52 morts i diversos danys materials que han obligat, entre d'altres, a tancar l'aeroport internacional de Santiago (la web no respon ara mateix).

Els mitjans tradicionals informen amb molt més detall de l'esdeveniment (El País, BBC News). També es pot fer el seguiment en directe de les notícies que proporciona la televisió xilena.

El que m'ha motivat a escriure aquesta entrada és que m'he assabentat de la notícia a través de Twitter, abans que per la resta de mitjans, bé sigui per contactes que es trobaven a Xile en el moment del terratrèmol o bé perquè hi tenen coneguts o familiars amb qui han intentat contactar. Actualment #terremotochile, Chile i Tsunami són trending topics a Twitter.

No em vull posar a escriure més extensament sobre el paper que pot jugar i juga actualment Twitter en la difusió de notícies d'"última hora" i de com pot desbancar els mitjans tradicionals en aquest aspecte, i menys quan a mida que passen les hores va augmentant la xifra coneguda de morts com a conseqüència del terratrèmol. Però sí que m'ha semblat convenient mencionar-ho. M'ha semblat un exemple clar de com ha canviat respecte fa uns anys la forma com consumim informació.

Saturday, February 13, 2010

¡Contrato de datos europeo ya!

La verdad es que tener un teléfono con contrato de datos te cambia la forma de usar el teléfono y también de hacer muchas cosas del día a día. Recuerdo que no hace mucho tenía un iPhone de primera generación que usaba en España con una tarjeta prepago, y sólo podía disfrutar de la mayoría de aplicaciones cuando disponía de una conexión WiFi.

Las aplicaciones de los móviles de nueva generación estan pensadas para el caso cuando se dispone de conexión a Internet permanente: consulta a mapas, sitios cerca de mí, correo electrónico y mensajería a través de Internet. La conexión permanente (y si puede ser de alta velocidad mediante 3G) es primordial para este tipo de usos del teléfono.

Está claro que para el e-mail, mensajería instantánea, twitter, facebook y demás la conectividad permanente es una gozada. Pero me doy cuenta que cuando realmente le puedes sacar partido a la mayoría de aplicaciones móviles es cuando estás fuera de casa. Cosas como encontrar un restaurante cercano, consultar un mapa en el extranjero o ver dónde se encuentra el WC más cercano son cosas útiles que puedes hacer con tu teléfono en tu ciudad, pero que son todavía más útiles cuando estás en territorio desconocido.

Por lo menos en España, las tarifas de datos suelen tener validez dentro del territorio nacional. Así, mientras no salga de España sé que no voy a pagar un euro más por conectarme a Internet desde el móvil. Pero si me voy a Portugal, o a Francia, o a cualquier país del mundo, entonces deberé pagar tarifas carísimas (11,6 € + IVA por 10 MB en Europa, o por 1 MB en el resto del mundo) en concepto de roaming de datos.

Creo que esta limitación no tiene mucho sentido. Por un lado trabajamos para tener una Unión Europea sin fronteras, y por otro creamos fronteras artificiales. Cómo sería si en los Estados Unidos tuvieras que pagar roaming a la que sales de New York o de California...

Claro que es una sociedad de libre mercado y supongo que las operadoras no tienen por qué ofrecer este servicio. Al fin y al cabo no es una primera necesidad ni muchísimo menos. Pero sí que creo que hay demanda de tarifas de datos a nivel por lo menos europeo. En mi caso particular, me he encontrado muchas más veces con la necesidad de usar una de estas aplicaciones que te quitan de un apuro fuera de España que dentro. ¿Normal, no?

Pues eso. Creo que sería muy interesante que las operadoras empezaran a pensar en planes de este estilo. En opciones para que la conexión a Internet de ámbito internacional sea menos dolorosa. Para que no haya que ir buscando WiFis por medio mundo porque queremos mirar nuestro e-mail. Las posibilidades de una sociedad global con acceso móvil permanente a Internet pueden ser enormes.

Sunday, February 07, 2010

PHP development on OS X: Eclipse alternative to Coda

I develop using both PHP and Java on OS X. I use Eclipse as my main development environment for Java and have been using Coda for a long time for PHP development.

Coda is a very useful tool by Panic, the creators of Transmit, one of the best FTP and SSH file transmission tools for Mac OS X. It is a PHP, HTML and CSS file editor. Coda optimises your web development workflow by seamlessly integrating with Subversion and by allowing you to upload the files you have just changed to your server's FTP by just hitting a key combination. Coda costs $99 for a single user license.

While Coda's CSS code completion is pretty good, I find myself working mostly with backend PHP files and XSLT templates for presentation. Apparently Coda can do PHP autocompletion, but at least for me it fails at a very basic level; for instance I cannot get it to autocomplete class attributes even when editing the class file itself. Sometimes it just gets frustrating.

I wanted to find a better alternative to Coda with the following features:
  • PHP code autocompletion.
  • SVN integration.
  • Ability to quickly upload changed files to my server's FTP.
Eclipse is a free alternative to Coda which can provide you with the previous features. However, you need to prepare the environment in order to be able to do the three things listed above. I decided to write this post because I thought it might be useful to someone else. So here are the steps I took:

1. Download Eclipse for PHP developers. This is the main Eclipse IDE including PDT (PHP Development Tools) and WTP (Web Tools Platform). This has almost everything you will need (PHP syntax coloring, code completion and so on).

2. Install the Subversive SVN plugin. You will need this in order to manage your projects with subversion. To install the plugin you will need to start Eclipse, go to Help -> Install new software, add the Subversive update site and install the Subversive packages. Detailed instructions on installing the plugin can be found at the subversive website.

3. Install the ant plugin. You will need ant to be able to upload your files via FTP. I found ant to be the best and most effective alternative to accomplish this task. I tried Aptana file upload and Eclipse Remote Systems Explorer. These both options allow you to upload files from the eclipse GUI, but they do not synchronize your files. That means you'll either keep track of what changed and upload the files one by one, or upload your entire site every time. While the Aptana documentation states it has the ability to sync files, it appears to have been removed from the latest release. To install the ant plugin you have to start Eclipse and go to Help -> Install new software, select the Galileo site, and then browse for Programming languages -> Eclipse java development tools.

4. Download the apache commons-net libraries. You will need these to be able to use FTP from ant. Place the JAR files somewhere in your hard drive.

5. Configure eclipse/ant to use apache-commons. To do this you have to start Eclipse and go to the Preferences window. Then find the Ant -> Runtime category, click on the classpath tab and then click on external JARs. Select the files commons-net-2.0.jar and commons-net-ftp-2.0.jar (which you downloaded in step 4) and click ok.


6. Checkout your project from SVN. Go to File -> New -> SVN -> Project from SVN. Please check the subversion website if you need further information on checking out a project (I assume you already know how to do that if you are reading this).

7. Add a build.xml file to your project. This is going to be an ant buildfile which we are going to use to upload our files. You can use the following code as an example:

<?xml version="1.0" encoding="UTF-8"?>



<project name="MyProject">



<target name="Upload changed files">

<ftp

server="ftp.myserver.com"

userid="benlinus"

password="4815162342"

remotedir="www"

depends="yes"

verbose="yes"

>


<fileset dir="www" />

</ftp>

</target>



</project>


Please change the server, userid and password to suit your needs. Also you might have to adapt the remotedir and local directory settings. The key here is the depends="yes" attribute, which tells the ant task to upload only the local files that are different from the files on the server.

8. Add your buildfile to the ant view. If the ant view is not open, go to Window -> show view -> other and select the ant view. You can add your build.xml file by dragging and dropping it onto the view or by clicking on the add buildfiles icon.

That's pretty much it. Now you can edit your code using Eclipse using advanced code autocompletion, manage your project using Subversion and upload your files by double-clicking on the "Upload changed files" target we just created.

Bonus: You can hit the command+option+x, q key combination in order to run your ant task.

All comments will be appreciated! And if you have a better alternative please share it :)