Sencha Touch 2.1.1 on MacOS

After installing these versions:

  • sencha-touch-2.1.1-gpl.zip
  • SenchaSDKTools-2.0.0-beta3-osx
  • SenchaCmd-3.0.2.288-osx

I entered the touch-2.1.1 SDK folder and run the “sencha” command, resulting in the following output:

Selec All Code:
1
2
3
[WARN] The current working directory (/Users/pocketlabs/Downloads/Sencha/touch-2.1.1) is not a recognized Sencha SDK or application folder. Running in backwards compatible mode.
 
Sencha Command v2.0.0 Beta 3

First thing to notice there: it says “Sencha Command” instead of “Sencha Cmd”, and the version is v2.0.0 Beta 3 instead of v3.0.2.288.

So, what’s really happening is:
Sencha SDK Tools is already bundled with Sencha Command!
And it’s using that old version instead of the latest Sencha Cmd I’ve installed.

How to fix it?

Not that hard.

Selec All Code:
1
sudo chown -R [yourUsernameHere]:staff /Applications/SenchaSDKTools-2.0.0-beta3/

Now run the Sencha Cmd installer and select the following target folder for installation:
/Applications/SenchaSDKTools-2.0.0-beta3/bin

Open a new shell and try again.
It should be working now.
Enjoy!

Is HTTPS really secure?

Well… if you trust too much, things can go wrong.
Two basic things to keep in mind:

  • ALWAYS verify the protocol is HTTPS; gmail in http? I don’t think so.
  • NEVER accept a certificate after an authentication alert message.

In both cases, you’re probably about to get hacked.
And if your connection is being encrypted using TLS1.0 or older, well… bad news: you can get hacked anyway.

 

Reference:
Man-in-the-middle SSL attack.
TLS1.0 hacked; now they can decrypt your “secure” packages.

Ubuntu 12.04 blue flash player issue

YouTube and other video sites looking ugly blueish?
After upgrading to Ubuntu 12.04 all flash content gets an outstandingly intolerable blue tint.
This is caused by the latest version of the flash player plugin.

This is the solution that worked for me:

Selec All Code:
1
2
sudo mkdir /etc/adobe
echo -e "EnableLinuxHWVideoDecode=1\nOverrideGPUValidation=true" | sudo tee /etc/adobe/mms.cfg > /dev/null

So far so good and no crashes (as reported by other users).
BTW… I read Adobe isn’t planning to update flash player for linux any longer, so don’t wait for a quick fix from their side.

Rhythmbox and add-apt-repository not working on Ubuntu 12.04

When running Rhythmbox from the menu it just doesn’t open.

When running from command line it throws:

error while loading shared libraries: librtmp.so.0: 
cannot open shared object file: No such file or directory

Also, and more important, when trying to add new repos using add-apt-repository:

ImportError: librtmp.so.0: 
cannot open shared object file: No such file or directory

Solution:
We’re going to checkout the svn trunk for this lib, build it and replace our current one with the built version, which has the fix we need.

Selec All Code:
1
2
3
4
5
6
7
8
sudo su
mkdir mplayer
cd mplayer
svn co svn://svn.mplayerhq.hu/rtmpdump rtmpdump
cd rtmpdump/trunk
make
make install
cp librtmp/librtmp.so.0 /lib

All done.
You can be happy again!
:D

Got from this forum post.

Remove from all mongodb collections at once

Well, I couldn’t find any built in command to do this, so…
With little javascript magic you can…
Remove all data from ALL mongodb collections at once:

Selec All Code:
1
2
3
4
5
6
7
function removeAll(){
    db.getCollectionNames().forEach( 
        function(name){ 
            db[name].remove(); 
        } 
    );
}

Then you can call your newly created function from shell:

Selec All Code:
1
removeAll();

Yeah, be careful with that.

Simple Javascript Remote Debugger

Si desarrollan javascript apps y por algún motivo requieren remote debugging (corren dentro de un device tal vez?) les propongo una solución muy simple.

En javascript podemos sobreescribir console.log:

Selec All Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
        console.log = function(msg){
            //set your remote debugging server ip and path here
            var debuggerUrl = 'http://192.168.0.200/debug.php';
            $.ajax({
                url: debuggerUrl,
                type: 'POST',
                data: {
                    message: msg
                },
                success: function(response){
 
                },
                error: function(response){
                    alert('Oops... unable to write log!');
                }
            });
        };

En PHP podemos escribir un script ultra básico que loggee a un archivo.
Este sería nuestro debugger:

Selec All Code:
1
2
3
4
5
6
7
8
9
10
11
    $debugFile = dirname(__FILE__) . '/debug.log';
    $date = date('Y:m:d G:i:s') . "\n";
    $line = str_repeat('-', 80);
 
    //log request
    $message = print_r($_REQUEST, true);
    $message = "\n" . $line . "\n" . $date . "\n" . $message . "\n" . $line;
    $file = fopen($debugFile,'a');
    fwrite($file, $message);
    fclose($file);
    echo "request written to: $debugFile";

Presten atención a que jquery esté disponible al momento de utilizar $.ajax y asegúrense de que su webserver tenga permisos de escritura en el archivo de log.
And that’s it!

Enjoy!

Javascript: a better typeof

Leyendo un artículo de Addy Osmani encontré la siguiente función para retornar en forma mucho más consistente el data type de un dato:

Selec All Code:
1
2
3
function betterTypeOf( input ){
    return Object.prototype.toString.call(input).match(/^\[object\s(.*)\]$/)[1];
}

A continuación el sample output para distintos casos:

Continue Reading >>

vim filter

Una forma muy rápida de borrar todas las líneas de un doc que NO nos interesan:

Selec All Code:
1
:v/PATTERN/d

 

Por ejemplo, para dejar sólo las líneas de un log que contienen la palabra “ERROR”:

Selec All Code:
1
:v/ERROR/d

 

Osomness!
;)

Ubuntu: Install latest Firefox

Simple: como root:

Selec All Code:
1
2
3
add-apt-repository ppa:mozillateam/firefox-stable
apt-get update
apt-get upgrade

 

Y si por alguna extraña razón lo quieren en castilla:

Selec All Code:
1
apt-get install firefox-locale-es

Bash power: mp3 titles

Problema:
Tenemos una carpeta con mp3 sin id3tag para el title.
El title está seteado en el filename.
Queremos usar el filename para setear automáticamente el id3tag title para todos los mp3 en el dir.

Solución rápida:

Selec All Code:
1
find *.mp3 -exec mp3info -t {} {} \;