20070128

Com descarregar els videos de la lliga del mundo i pujar-los al youtube



La gent de "El Mundo" i de "El Pais" han arribat a un acord amb "Audiovisual Sport" per penjar els videos de la lliga a les webs de les seves edicions electroniques.

elpais.com encara ha ocultat una mica el video, pero elmundo.es ha possat el flv molt accesible i es facilment baixable.

Nomes cal fer un "Ver codigo fuente" de la pagina del video (per exemple aquesta)

Busquem la part de la crida al flash:


var Parametros = "?nombreArchivo=/cr4ip/ES/videos/futbol/lfp/2006-2007/20/vil_rma/index.flv&fotograma=/elmundo/videos/futbol/lfp/2006-2007/20/vil_rma/index_0.jpg&anchoVideo=384&altoVideo=288" + nuevos_parametros; // Parametros que se le pasan al swf
if ( typeof(JSIncludePubli) != "undefined")
{
EscribeReproductorFlash(ArchivoFlash, Parametros, Ancho, Alto);
}

Nomes cal agafar l'adreça de ?nombreArchivo=X.flv i afegir-li davant

http://estaticos.elmundo.es

Aixi, en aquest cas la url del flv seria algo aixi com http://estaticos.elmundo.es/cr4ip/ES/videos/futbol/lfp/2006-2007/20/vil_rma/index.flv


Aqui ja podem provar el video amb algun software de visualitzacio de FLVs (com el FLV Player)

Despres nomes cal agafar un software de traduccio de FLV a AVI com el SUPER

Transformar el video i ja es pot penjar tranquilament de youtube.

Evidentment, no ho fare, i aquest tutorial no preten que ningu ho faci i violi els SAGRATS drets d'autor de AudioVisualSport

:)

20070122

Bug in animateClass jquery extension

If you have tried to use the excellent animateClass extension to jquery maybe you have found that doesn't work in IE.

For example this sample code changes dynamically a h1 element from class "inicial" to class "final" producing a nice transition animation when you enter the page.


<script type="text/javascript">
$(document).ready(function()
{
$('#titolseccio').animateClass('final', 500);
});
</script>


With this release of animateClass (January 2007) this example only works in some browsers (particularly Firefox, the most popular in the developers community), but fails in Internet Explorer 6 and 7 (shamefully the most broadly used by the rest of the mortals (including customers))

You can solve this particular problem patching the animateClass.js

You have to download the uncompressed version of animateClass.js and look for a line like this:

if( typeof newStyle[n] != "function" && newStyle[n] /* No functions and null properties



and add this two conditions:

&& typeof newStyle[n] != "boolean" && typeof newStyle[n] != "number"


Resulting in this line:

if( typeof newStyle[n] != "function" && typeof newStyle[n] != "boolean" && typeof newStyle[n] != "number" && newStyle[n] /* No functions and null properties */


Now you can save your patched version of animateClass.js and reload your html page in Explorer (remember to Shift+Reload to avoid cached .js confusions)

The explanation of the problem is that javascript IE doesn't allow you to use string functions (like replace) on booleans and numbers, causing an unhandled exception.

Watch Out, this is not a generic patch, I'll warn the animateClass developer to patch it properly. For example, with this patch, you will not be able to animate any number CSS value (in the example the animation is from "20px" to "40px" the px makes it a string value, not a number).

20070115

Post de resum del 2006

Amb una mica de retard ...

Gadgets of the year (comprats o regalats):
La Fonera
iPOD Shuffle
Portàtil ACER
Guitarra Red Octane (Guitar Hero)

Samarretes del any:
La vida son Contrarios
Bug Fixed
Red or Dead de Divinas Palabras
Ovolution


Friky coses guays del 2006:

JQuery
Ruby on Rails
CakePHP
OpenLaszlo

Coses que he aprés al 2005:
API Rest del YOUTube
JQuery
Prototype + Scriptaculous
CakePHP

Jocs als que m'he viciat aquest any:
WarHammer 40.000, Dawn of War al PC
Guitar Hero I i II a la PSP

Nous grups del 2006 que m'han agradat:
Girls in Hawaii
Be Brave Benjamin
Ghost to Falco

Grups que he descobert aquest any:
The Spinto Band
Artick Monkeys
Josh Ritter


Millor concert al que he anat:
Pixies al FIB 2006
(seguit d'aprop de Belle and Sebastian i Happy Mondays al Primavera Sound)

Millors pelis que he vist:
Salvador
Ficció

Llibres que he llegit i m'han agradat:
Búsqueda - John Battelle
Sistemas Emergentes - Steven Johnson
Pere Calders - Tots els contes
Todd Solondz, en los suburbios de la felicidad - Jordi Costa
Amos del Mundo - Juan Carlos Castillón


Comics:
V de Vendetta
Watchmen
Persépolis
Lenore

Series a les que m'he enganxat (per ordre d'adicció):
Prison Break
Six Feet Under
Scrubs
My Name is Earl
IT Crowd
Little Britain
Lost
CSI Las Vegas

Sortides al Extranjer:
Costa Rica
Benicassim i Castelló
Cardiff

Millors Hotels als que he anat:
Pachira Lodge, Tortuguero, Costa Rica
Abba Castellón
Park Plaza Hotel, Cardiff


On he menjat millor:

Els Pescadors
Celler de Can Recasens (Poblenou)
Abba Castellón
El castell de Can Gimenelles

20070112

How to look for long running pages in the Apache Logs using awk

In this tutorial we will learn how to look for pages, that takes 3 or more seconds to be served by Apache.

Usually the slow pages will be some sort of dynamic ones (PHPs, ASPs, Servlets or JSPs) because the static html pages take very short time to be served.


This procedure can help you in find some bottlenecks in your dynamic web application.


First step, change your Apache configuration



Locate your httpd.conf usually located in the $APACHE_HOME/conf directory

Edit the file (vi powa) and change the format of the Log File, adding a %T at the end.

Example:
from:
LogFormat "%h %l %u %t \"%r\" %>s %b" common
to:
LogFormat "%h %l %u %t \"%r\" %>s %b %T" common

Restart your apache server



go to $APACHE_HOME/bin ./apachectl stop and ./apachectl start

Now, if you locate the log file and take a look on the output (tail -f access_log) you can see the last column is the time taken in seconds to serve the page.

Example:

555.254.999.71 - omatech [12/Jan/2007:12:12:47 +0100] "GET /omatech/rulez/pk_microcalls.view_tralari_tralara?p_user_logged_id=1&p_load_id=07 HTTP/1.1" 200 3713814 4
555.254.999.71 - omatech [12/Jan/2007:12:38:35 +0100] "GET /omatech/rulez/pk_microcalls.view_ekipoja?p_user_id=1&p_type=C&p_cust=739 HTTP/1.1" 200 73793 5


In the above example, the first request have taken 4 seconds, and the second 5 seconds.

Extract the long duration requests with awk



This is the tricky one, you must use awk to extract the requests that takes more than 3 seconds, this step is useful because you eventually will have lots and lots of requests that take 0 seconds.


awk '/[^0-2]$/ {print $0}' access_log



This line uses awk to parse the file and extract the lines that DO NOT ends with 0, 1, or 2.


The [^] is for negation, the 0-2 is the range, and the $ stands for "at the end of the line"

I hope it will be useful