22 April 2010
By Pau Sanchez
In Programacion, Python
I implemented a function in Python that mimics http_build_query function.
##
# Mimics the behaviour of http_build_query PHP function
# This method can be useful for sending data to flash applications
##################################################
def http_build_query(params, topkey = ”):
from urllib import quote
if len(params) == 0:
return ""
result = ""
# is a [...]
Continue reading
http_build_query, PHP, Python
08 April 2010
By Pau Sanchez
In PHP, Programacion, manso trick
There could be a lot of reasons to detect the OS in PHP, and I’m pretty aware that these reasons could open a discussion by themselves. Anyway, it could be useful to do some tweaks or optimizations, to run one commands or anothers, or simply it can be useful as additional information for webmasters, developers [...]
Continue reading
PHP, sistema operativo, so, truco manso
07 December 2009
By Pau Sanchez
In PHP
The other day I was looking how to create PDF files in PHP.
The first thing that came to my mind was the PDFlib extension included in PHP since version 4. The problem with this library is that I thought it was kind of low-level, and I didn’t had any idea on where to start.
In fact, [...]
Continue reading
pdf, PHP, php-pdf
06 November 2009
By Pau Sanchez
In General
This was me, looking how to install PHP 5.3 in the new Ubuntu Karmic, because using the new functionality of late static binding will simplify my code, and I’ve found something amazing. A new feature that was missing in PHP, but they have included in PHP 5.3…
the…
wait for it….
wait for it….
wait for it….
GOTO
It’s amazing how [...]
Continue reading
goto, karmic, PHP, php 5.3, ubuntu
28 June 2009
By Pau Sanchez
In PHP, Programming
Following function detects if the GIF contains an animation (it has more than 1 frame) or is just a static file.
function isAnimatedGif($filename)
{
$filecontents=file_get_contents($filename);
$str_loc=0;
$count=0;
// There is no point in continuing after we find a 2nd frame
[...]
Continue reading
animado, gif, PHP
27 March 2009
By Pau Sanchez
In General
Scaling an image to keep it under specific bounds, for visualizing purposes is a common task, but it’s even better if we can scale the image without deforming it. In this cases we have to scale the image and keep it’s original aspect ratio.
Nowadays there are thousands of libraries for any general purpose language that [...]
Continue reading
aspect ratio, aspecto, escalar, imagenes, javascript, PHP
22 February 2009
By Pau Sanchez
In PHP, Programming
I hope PHP 6 will solve all my problems with UTF-8, but it has not been released yet, and one has to keep coding with the tools it has available.
I think I will probably be sharing the class for string manipulation that I’ve been coding (which of course is 100% compatible with UTF-8).
For now, I’m [...]
Continue reading
i18n, internacionalización, PHP, utf-8
27 November 2008
By Pau Sanchez
In PHP
I am currently working on a PHP library/framework (I think it looks more like a library than a framework, and I think it’s better this way).
The thing is that for some of the components I needed to parse some data (look at parser definition), and for that task I needed a PHP tokenizer (or PHP [...]
Continue reading
analizador lexico, analizador sintactico, lexer php, parser, PHP, php tokenizer, tokenizador, tokenizer