Report inadequate content

16/09/2013

Force kill of processes in Windows

Sometimes Windows Tasks Manager is not able to kill an in-memory process. We try to close it several times with no luck :(

For these frustration moments we can make use of a console command named TaskKill

With TaskKill the pain ends simply with:

taskkill /IM filename.exe /F

More info about taskkill: http://technet.microsoft.com/en-us/library/cc725602.aspx

{
}

8/08/2013

A true multiline regexp in PHP. The "I miss U" technique

The following regular expression matches tags that are opened and close in different lines, albeit can be used for any other purpose. It is also ungreedy, meaning that when the first closing tag is found the rest of equal tags will be ignored.

It is very easy to remember and to apply, I call it the "I MISS YOU" technique, see the why in the regexp modifiers: ...

25/06/2013

Finding abusers. List of most frequent IPs in Apache log

Internet is full of malware and people with leisure time who will hammer your server with no good intentions, most of them will try to access well-known URLs looking for exploits of software like Wordpress (/wp-admin.php, /edit, etc...).

If you monitor for a while your access_log it's easy to find out unwanted behaviour. If you want to get a list of the most frequent IPs in...

7/06/2013

Converting a CSV to SQL using 1 line in bash

The command line is very powerful and can do amazing stuff in one single line by pipelining a series of commands. This post is inspired after creating a line that mixed sed and awk, but with just only awk I'll show you an example on how to convert a CSV file to an SQL insert

Let's take an input CSV named events-2013-06-06.csv with 16 columns per line. It looks like...

{
}

6/06/2013

Migrating a Github repo to Bitbucket (or similar services)

Github is awesome. Bitbucket is awesome too. They are both excellent services, but Bitbucket has a plus: it's free for private repos.

That's one of the reasons on why we decided to stop paying our $25/mo Github account for small projects and moved to Bitbucket. Although the Bitbucket guys have now a one-click "import from Github tool", the solution is so simple that I don't...

3/06/2013

Rellenar una columna con Hash aleatorio en MySQL

Tenemos unos cuantos cientos de datos y queremos crear un hash para poder acceder a ellos de forma directa y cifrada.

Imagina, por ejemplo, la típica tabla de usuarios en la que un campo contiene un hash para guardar en cookies y hacer el autologin por cookie.

Al crear el nuevo atributo este queda vacío así que necesitarás esta pequeña consulta para generar códigos...

15/04/2013

Migrate Posterous without losing the images

It might seem very obvious to you that if you migrate from Posterous blogs to another service your images should be transitioned as well.

If you want a free service (as Posterous was) there are only two options where you can migrate your Posterous to without writing all your posts one by one again:

1) Wordpress.com (but losing all the images) 2) Obolog.com (and ...

14/03/2013

Best web-based alternatives to Google Reader

If you are a Google Reader reader you have certainly seen the message that is going to disappear by July 1st 2013. If you read from mobile then plenty of cool apps like Flipboard you can use, but when it comes to a web-based interface these are the alternatives I found worth using.

The first thing you should do before it is too late is to download a copy of your Google...

13/03/2013

Configure Compass,Sass,Less... in PHPStorm

PHPStorm 6 bundles a new feature called "File watchers" which enables Sass, LESS, SCSS, CoffeeScript, TypeScript transpilation. This option will compile your compass/scss/whatever files when the source file is saved (this is when you lose the focus or manually save).

So, for the basic stuff you can stop using external programs and watchers likeCodeKit or...

7/03/2013

Features in PHP 5.4

We had to create a file upload form that allows a user to upload big files. In order to keep a good experience for the user we decided to show the progress bars.

There are several ways of doing that but it came to my mind that PHP 5.4 had an improvement on file upload, making it easier now and wondered if I had the last excuse to upgrade the servers from 5.3 to 5.4.

...