Archive for September, 2007

theLaunch v2.3.1b

30/09/2007

Several bug fixes, and the addition of SHIFT + CTRL + M to the Global Close feature. Now, it also minimizes all accounts to their tray icons with the mentioned shortcut.

IMPORTANT: Due to several last-minute bugs that always seem to attack me, I’ve decided that for future versions, I will only send the script 7 (seven) days after releasing it here, to the Messenger Plus! Script Database.

This is to prevent the upload of a bogus version to such popular site (I imagine most people get my script there and not here), and also to not bother the script moderators who have to go back and forward with my frequent updates.

Note: I’ll be taking screenshots and posting them on theLaunch page.

Advertisements

theLaunch v2.3

28/09/2007

A new update on my Messenger Plus! Live script is out.

Download it!

PHP: Contar votos de Ley de Bosques de Greenpeace Argentina

27/09/2007

Sí, una extraña combinación de temas…

Tenía ganas de mostrar el contador de votos de la Ley de Bosques que propone Greenpeace de Argentina en el sidebar. Así que hice lo siguiente:


Básicamente, bajamos el iframe donde está el contador oficial, tomamos el número, y le damos formato. ¡Y listo! Después incluímos el archivo PHP donde querramos mostrar el contador:


O mediante JavaScript, o como iframe, etc.

theLaunch v2.2

26/09/2007

Released the new version 2.2 of theLaunch, script for Messenger Plus! Live.

A new version is on the works, but probably won’t be out for a couple of days.

Check out the page for theLaunch.

WebMail Notifier

25/09/2007

WebMail Notifier is probably one of the best email-related extensions for Mozilla Firefox.

I had used GMail Manager, which is great if you only have GMail accounts (yes, it works for multiple accounts). But if you have Yahoo! and Hotmail accounts as well, you need a bit more than that.

And, yes! WebMail Notifier also works for Hotmail and Hotmail Live (or Windows Live Mail, whatever Microsoft decided to call it this week).

Right now I’ve got all my accounts on the status bar of my browser, in one unique envelope icon (nothing fancy or shiny). When I get new messages, the proper account appears on the tooltip of said envelope. Optionally, I can get notified with a sound or a pop-up. I’m not that desperate, so I don’t have those options on; I can’t really say how it looks or works.

Anyway, give it a shot. I’m sure you’ll find it useful, if you’re a email monster like myself. ;-)

MySQL: Updating and Selecting (Sub-Query)

23/09/2007

A neat trick I didn’t know (I’m more PHP than MySQL, but always wanting to simplify my PHP code):

UPDATE `table1` SET `counter`=(SELECT COUNT(*) FROM `table2`)  WHERE `id`={$id}

If the things to count in table2 are specific, you can use WHERE in the sub-query as well:

UPDATE `table1` SET `counter`=(SELECT COUNT(*) FROM `table2` WHERE `id`={$id})  WHERE `id`={$id}

As you can see, it’s much easier than turning to PHP and then back to MySQL. Not saying you have to do everything in one side or the other, but it’s nice to know when certain things can be done with either. ;-)

Side Note: I use the backwards tilde (`) for databases, tables, and fields (this is important, as sometimes we use names that might mean something for the database engine!).
I also use upper-case for SQL commands, as it’s easier to read and it separates SQL from PHP in projects.

Batch + aMSN: Launching multiple accounts automatically

15/09/2007

Have you ever wondered how to open multiple aMSN accounts with one click? Well, this is what I’ve done with some Batch and a hack found at the aMSN forums:

  1. Open the amsn file (it has no extension) with NotePad++ or a similar text editor.
  2. Add the following code before the line that has “vwait events”:
 proc auto_login_argv { user } {
if { [winfo exists .main.loginscreen] } {
.main.loginscreen.user delete 0 end
.main.loginscreen.user insert 0 $user
.main.loginscreen UsernameEdited
after 1000 “::MSN::connect”
}
}

if { $argv != “” } {
after idle [list auto_login_argv $argv]
}
  1. Save the changes and go to the beginning of the file. Replace the first lines for the following:
#!/bin/sh
# \
exec wish $0 $@
  1. Save changes again.
  2. Now we create the batch file (.bat). Open a text editor and save an empty file as aMSN.bat, and save it on the Desktop or somewhere else. Add the following to it:
@echo off

echo Open mymail1@hotmail.com? [Y / N]
set /P open1=
if /i “%open1%” == “Y” start “” “C:\Program Files\aMSN\bin\wish.exe” “C:\Program Files\aMSN\scripts\amsn” mymail1@hotmail.com

echo Open mymail2@hotmail.com? [Y / N]
set /P open2=
if /i “%open2%” == “Y” start “” “C:\Program Files\aMSN\bin\wish.exe” “C:\Program Files\aMSN\scripts\amsn” mymail2@hotmail.com

echo Open mymail3@hotmail.com? [Y / N]
set /P open3=
if /i “%open3%” == “Y” start “” “C:\Program Files\aMSN\bin\wish.exe” “C:\Program Files\aMSN\scripts\amsn” mymail3@hotmail.com

echo Open mymail4@hotmail.com? [Y / N]
set /P open4=
if /i “%open4%” == “Y” start “” “C:\Program Files\aMSN\bin\wish.exe” “C:\Program Files\aMSN\scripts\amsn” mymail4@hotmail.com
  1. Save the changes. Now double-click on the aMSN.bat file and make sure it works.

There are probably better ways to code it, but I’m rather new to Batch. I only use small bits of code from time to time.

The only downside I see is that aMSN eventually takes up more memory than WLM. But still, I like its less cluttered interface.

JavaScript: onMouseOver + window.status

15/09/2007

A little clarification that I just came across…

On Firefox you can do this:

Visit Google!

If you try it out, you’ll see that it doesn’t actually work. At least, it didn’t for me in Mozilla Firefox 2.0.

What I then found out was that I needed to add “return true” after both statements. Hence, this will work:

Visit Google!

;-)

Batch + aMSN: Abriendo múltiples cuentas al mismo tiempo

08/09/2007

aMSN es un programa completamente gratuito y de código abierto, que imita al MSN Messenger (ahora conocido como Windows Live Messenger).

Algunos se deben preguntar cómo hacer para abrir múltiples cuentas automáticamente… Pues aquí tengo la solución…

  1. Abrir el archivo amsn (sin extensión) con un programa de edición de texto como el Bloc de Notas (Notepad) de Windows o con NotePad++
  2. Agregar el siguiente código antes de la línea “vwait events”:
 proc auto_login_argv { user } {
if { [winfo exists .main.loginscreen] } {
.main.loginscreen.user delete 0 end
.main.loginscreen.user insert 0 $user
.main.loginscreen UsernameEdited
after 1000 "::MSN::connect"
}
}

if { $argv != "" } {
after idle [list auto_login_argv $argv]
}
  1. Guardar los cambios. Cambiar las primeras líneas por:
#!/bin/sh
#
exec wish $0 $@
  1. Guardar los cambios.
  2. Ahora crearemos el archivo batch para poder abrir las cuentas. Elige crear un nuevo archivo vacío y llámalo aMSN.bat, y guárdalo al escritorio. Ábrelo para editar y coloca el siguiente código:
@echo off

echo Abrir micuenta1@hotmail.com? [Y / N]
set /P open1=
if /i "%open1%" == "Y" start "" "C:Archivos de programaaMSNbinwish.exe" "C:Archivos de programaaMSNscriptsamsn" micuenta1@hotmail.com

echo Abrir micuenta2@hotmail.com? [Y / N]
set /P open2=
if /i "%open2%" == "Y" start "" "C:Archivos de programaaMSNbinwish.exe" "C:Archivos de programaaMSNscriptsamsn" micuenta2@hotmail.com

echo Abrir micuenta3@hotmail.com? [Y / N]
set /P open3=
if /i "%open3%" == "Y" start "" "C:Archivos de programaaMSNbinwish.exe" "C:Archivos de programaaMSNscriptsamsn" micuenta3@hotmail.com

echo Abrir micuenta4@hotmail.com? [Y / N]
set /P open4=
if /i "%open4%" == "Y" start "" "C:Archivos de programaaMSNbinwish.exe" "C:Archivos de programaaMSNscriptsamsn" micuenta4@hotmail.com
  1. Guarda los cambios. Ahora haz doble click sobre aMSN.bat y prueba si todo ha sido correctamente configurado. Deberías poder elegir cuáles cuentas abrir.

Seguramente el archivo batch puede ser programado mejor, pero sólo sé lo básico del lenguaje. Si tienes más de cuatro cuentas, simplemente agrégalas, y aumenta el número de las variables.

PHP: Pasando datos en forma de array

08/09/2007

Tenemos un formulario o una URL con campos o parámetros en una matriz (o array).

modo=perro&color[]=marron&color[]=blanco&tam=toy

¿Cómo llamarle desde nuestro código PHP? Muy sencillo. Lo que debemos hacer es revisar la variable correspondiente al método usado:

<?php
echo "Busco ".$_GET['modo'].". De los siguientes colores:\n";
	if(is_array($_GET['color']))
	{
		for($i = 0; $i 

Este ejemplo sirve para los métodos GET y POST. Simplemente cambia la variable $_GET por $_POST y usa un formulario o el objeto XmlHttpRequest de JavaScript para enviar los datos.