List Dir by Gubatron – List your directories on a text file with a right click

Last week my wife told me if I knew an easy way (without using the cmd.exe) on Windows to list the contents of a directory, she basically wanted to give her users a one click solution to list the contents of a folder and have them on notepad.

So, I created a solution in python, compiled it with p2exe and by executing a .reg file, it gets bound to your right click context menu on Windows.

You can download the zip file here
Instructions are included (where to unzip, etc) , and source code is included as well.

We found way more advanced solutions for this, but they were non-free versions, or shareware versions that would expire.
This only took about an hour to create, so you can use this all you want, note that it will only list the names of the files, each on one line, and folders will look like [this].

Customizing, Building

If you want to add more information about the file, you’ll have to hack it, you have the source code inside the .zip file, it’s python so its pretty easy, all you’ll need to build it is, python2.5, py2exe, and then you just execute that setup.py script, I believe like this

python setup.py py2eye

and it will create a new binary version for you on a dist/ folder.

DO NOT BUY THIS SOFTWARE ITS FREE SOFTWARE

Check if your PHP’s diff syntax isn’t breaking

Say you’re working on emacs, without any kind of syntax checking, and you don’t want to commit your code cause you might have syntax errors.

If you’re smart, the best way to know what files you actually changed, is using

svn diff | grep +++

(that is, if you’re using subversion, which I hope you are)

then you’d have to do,

php -l 

on each one of the files…

well, that looks like a script to me.

Add the following script to your path, name it… checkdiffsyntax

#!/bin/bash

#Put all the files that changed on a temp file and then dump them into a MYBLOOP_DIFF_FILES variable
TMP_FILE=/tmp/changed_${USER}
svn diff | grep +++ | awk {'print $2'} > ${TMP_FILE}; export MYBLOOP_DIFF_FILES=`cat ${TMP_FILE}`

for file in $MYBLOOP_DIFF_FILES
do
  php -l $file
done

rm ${TMP_FILE}

UPDATE
I learn how to use for as a one liner on bash, and also how to do this without dumping the filepaths to a file which gets fed into a string… now it just goes straight from awk into the for loop, sick. I will leave the example above for future reference in case you need how to put the contents of a file on a variable and then reading from them

New script looks like this now, one liner.

svn diff | grep +++ | for file in `awk {'print $2'}`; do echo ${file}; php -l ${file}; done

chmod 777 it, and you’re ready to go.

Should look like this when you run it

angel@foobar:~/public_html$ checkdiffsyntax
No syntax errors detected in members/ajax/mashup.php
No syntax errors detected in foo/mashups/twitter/twitter.php
No syntax errors detected in foo/classes/utils.php
No syntax errors detected in foo/classes/user.php

Los Amigos Invisibles by The Hudson River

These guys are one of those things that really make you proud to be a venezuelan.

They gave out an amazing concert last night, the crowd went nuts and at the end people were screaming “OTRA OTRA OTRA OTRA”.

Se la comieron.


That’s me with my Leones del Caracas Baseball Cap – just a discrete sign to signal that I’m a Caraqueño

It’s awesome to see LAI first timers around you go nuts and repeat over and over how good they are. If Los Amigos Invisibles are coming to your town, don’t miss it.

If you want to get a taste of what they sound like, click here, you can get all of their albums in Amazon.com

MyBloop.com Twitters for you

If you have a MyBloop.com account, and you like to brag about your good taste in Music to all your “Followers” on Twitter , now MyBloop.com will make your life a little easier for all that microblogging.

No more copying and pasting to your twitter account, just activate your Twitter account the next time you’re logged in on MyBloop.

You can do this on the Audio Player window of MyBloop, you’ll only need to do this once, and then every song or playlist you play will be automatically posted to your twitter account.

See how easy it is to start showing off:

1. Login and Open a Music File or Playlist

2. Enter your Twitter Account info, only once.

3. There’s no 3, check your Twitter account, its already happening.

On Another Note

Flickr.com has released a picture uploader that resembles a lot how MyBloop.com lets user upload their pictures, basically they let you select more than one picture on a Flash/Flex based app, just like the one in MyBloop.com

Apache2: EnableSendFile

Aunque no recomiendo apache para servir archivos estaticos (demasiado overhead, es mejor que le eches un ojo a nginx o a lighttpd), encontre hoy una directiva que puede eliminar un poco el overhead al hacer una llamada directa al sistema -> sendfile.

De momento lo que hice en uno de los servidores fue muy sencillo:

sudo apt-get install sendfile

Agregamos la directiva en /etc/apache2/apache2.conf

EnableSendFile On

(Puedes poner esta directiva solo en algun directorio, si lo deseas solo en un directorio)

Reseteamos el servidor

sudo kill -HUP <#proceso_principal_apache>

Chequeamos que no haya pasado ningun error con la configuracion

tail -f /var/log/apache2/error.log

[Tue Aug 07 08:11:30 2007] [notice] SIGHUP received.  Attempting to restart
[Tue Aug 07 08:11:33 2007] [notice] Apache/2.2.3 (Ubuntu) configured -- resuming normal operations

Supongo que ahora esta funcionando con sendfile, noto menos tiempo de espera para recibir el archivo.

Si alguien tiene algo que comentar sobre EnableSendFile, bienvenido, primera vez que lo pruebo, aunque brevemente pq montamos nginex en esa maquina a los 10minutos de probar esto. 🙁

2 Linux Commands I always forget

Taken on the museum of sex in paris

ldd

ldd is good when you need to know what shared dependencies has an executable file. For example.

angel@mbweb1:/bin$ ldd /bin/bash
        libncurses.so.5 => /lib/libncurses.so.5 (0x00002ac651098000)
        libdl.so.2 => /lib/libdl.so.2 (0x00002ac6512f4000)
        libc.so.6 => /lib/libc.so.6 (0x00002ac6514f8000)
        /lib64/ld-linux-x86-64.so.2 (0x00002ac650e7b000)

ltrace / dtruss for mac

As seen in the manual:

ltrace is a program that simply runs the specified command until it exits. It intercepts and records the dynamic library calls which are called by the executed process and the signals which are received by that process. It can also intercept and print the system calls executed by the program.

Here’s some sample output of ltrace

ltrace -p 929
--- SIGSTOP (Stopped (signal)) ---
--- SIGSTOP (Stopped (signal)) ---
fcntl(10, 4, 2050, 12, 0)                                                              = 0
accept(10, 0x7fffb0855b30, 0x7fffb08557ac, -1, 0)                                      = 76
fcntl(10, 4, 2, 0, 0)                                                                  = 0
signal(17, NULL)                                                                       = NULL
request_init(0x7fffb08557b0, 2, 0x7fffb0857ac5, 1, 76)                                 = 0x7fffb08557b0
sock_host(0x7fffb08557b0, 0, 0x7fffb08555d8, 40, 0x7fffb085583a)                       = 0
hosts_access(0x7fffb08557b0, 0x2b0bfaa95580, 0x7fffb0853648, -1, 0x7fffb085583a)       = 1
getsockname(76, 0x7fffb0855b20, 0x7fffb08557ac, 0x2aaab0000000, 0x2aaab0017ea0)        = 0
malloc(8496)                                                                           = 0x2aaab01857b0
malloc(256)                                                                            = 0x2aaab000b490
malloc(256)                                                                            = 0x2aaab000b5a0
memset(0x2aaab0186678, '00', 472)                                                    = 0x2aaab0186678
memset(0x2aaab0186b48, '00', 72)                                                     = 0x2aaab0186b48
memset(0x2aaab0186558, '00', 72)                                                     = 0x2aaab0186558
memset(0x2aaab0186608, '00', 112)                                                    = 0x2aaab0186608
pthread_mutex_init(0x2aaab01863c0, 0xda6668, 0, 0x2aaab0186678, 0)                     = 0
pthread_mutex_lock(0xd94200, 0xda6668, 0, 0x2aaab0186678, 0xda6668)                    = 0
memcpy(0x2aaab0185c68, "", 528)                                                        = 0x2aaab0185c68
malloc(41)                                                                             = 0x2aaab0002f80
memcpy(0x2aaab0002fa0, "%H:%i:%s", 8)                                                  = 0x2aaab0002fa0
malloc(41)                                                                             = 0x2aaab00646e0
memcpy(0x2aaab0064700, "%Y-%m-%d", 8)                                                  = 0x2aaab0064700
malloc(50)                                                                             = 0x2aaab0064720
memcpy(0x2aaab0064740, "%Y-%m-%d %H:%i:%s", 17)                                        = 0x2aaab0064740
pthread_mutex_unlock(0xd94200, 0xdaaab1, 17, 0, 64)                                    = 0
strcmp("latin1", "utf8")                                                               = -1
memset(0x2aaab0185e78, '00', 1312)                                                   = 0x2aaab0185e78
malloc(1040)                                                                           = 0x2aaab00576e0
malloc(256)                                                                            = 0x2aaab0017ea0
pthread_mutex_lock(0xd93f00, 0x2aaab0185bf8, 0, 704, 128)                              = 0
pthread_mutex_unlock(0xd93f00, 0x2aaab0185bf8, 0x3252d661, 1, 128)                     = 0
pthread_self(0x2aaab0186398, 0x2aab7963b5ce, 0x39988b2e, 0xf9988b2b, 0xd93f00)         = 0x2b0bfbde9e70
pthread_self(0x2aaab0186398, 0x2aab7963b5ce, 0x39988b2e, 0xf9988b2b, 0xd93f00)         = 0x2b0bfbde9e70
malloc(240)                                                                            = 0x2aaab0017d20
memset(0x2aaab0017d20, '00', 240)                                                    = 0x2aaab0017d20
sprintf("", "")                                                                        = 11
fcntl(76, 4, 0, 0x7fffb0855450, 0)                                                     = 0
fcntl(76, 3, 0, -1, 0)                                                                 = 2
malloc(16391)                                                                          = 0x2aaab0131590
fcntl(76, 4, 2050, 0, 0x200000)                                                        = 0
setsockopt(76, 0, 1, 0x7fffb0855634, 4)                                                = 0
setsockopt(76, 6, 1, 0x7fffb0855634, 4)                                                = 0
pthread_mutex_lock(0xd93f00, 6, 501, -1, 4)                                            = 0
pthread_cond_signal(0xd94920, 6, 0x2aaab01857c0, 0, 4)                                 = 0
pthread_mutex_unlock(0xd93f00, 5, 1, -1, 0xd94920)                                     = 0
select(13, 0x7fffb0855720, 0, 0, 0)                                                    = 1
fcntl(10, 4, 2050, 12, 0)                                                              = 0
accept(10, 0x7fffb0855b30, 0x7fffb08557ac, -1, 0)                                      = 80
fcntl(10, 4, 2, 0, 0)                                                                  = 0
signal(17, NULL)                                                                       = NULL
request_init(0x7fffb08557b0, 2, 0x7fffb0857ac5, 1, 80)                                 = 0x7fffb08557b0
sock_host(0x7fffb08557b0, 0, 0x7fffb08555d8, 40, 0x7fffb085583a)                       = 0
hosts_access(0x7fffb08557b0, 0x2b0bfaa95580, 0x7fffb0853648, -1, 0x7fffb085583a)       = 1
getsockname(80, 0x7fffb0855b20, 0x7fffb08557ac, 0x2aaab0000000, 0x2aaab0017fb0)        = 0
malloc(8496)                                                                           = 0x2aaab01355a0
malloc(256)                                                                            = 0x2aaab0017fb0
malloc(256)                                                                            = 0x2aaab00180c0
memset(0x2aaab0136468, '00', 472)                                                    = 0x2aaab0136468
...

strace

the same as ltrace, but only for system calls.

Nokia N95

Today I got a new N95, hands down a more functional phone than the iphone, might not look as cool, but here are some features:

– GPS
– Wifi
– Bluetooth
– 5Megapixel camara on the back
– Video camara on the front
– FM Radio
– Micro SD slot
– Recorder
– Stereo Speakers
– USB compatible
– Media player
– Adobe Flash Player
– Real Player
– Plays DivX
– pretty much a bunch of software including Quickoffice right out of the box

I still have to play more with it to talk about it with more knowlege.