Monthly Archives: March 2009

virus letal

He recibido un aviso muy importante:

Si recibes una llamada al móvil, y en la pantalla aparece INVIABLE con DOS signos de exclamación (‘!!’): NO DESCUELGUES EL TELÉFONO, NI INTENTES RENUNCIAR A LA LLAMADA. Déjalo sonar hasta que pare, y después borra directamente la llamada perdida. Se trata de un virus muy potente que destruye por completo el mecanismo del teléfono: cuando esto pasa es imposible arreglarlo o tratar de encontrar una solución al problema.

Esto me parece el no vas. No solo es el virus mas destructivo del mundo mundial, sino que además te impide tratar de buscar una solución al problema.

Que Dios nos pille confesados.

killall firefox-bin

As a web developer firefox is my only choice. I need other browser to test my applications but I can’t live without firebug. I now there are other firebug-clone for other browsers but firebug is the number one.

But normally I have a console ready to type

killall firefox-bin

It’s really cool when one tab of your firefox becomes crazy and all firefox instance dies.Next generation of browsers will solve this problem. But at least now Chrome is not ready under Linux.

What can I do?, Only Cry? ;)

dojo.hitch

The first time I read about dojo.hitch I didn’t understand anything. I read in a book dojo.hitch is a very important function and widely used into dojo library but I didn’t understand why. I am using my learning of dojo to improve my skill in javascript. I remember the time when I hate javascript. I thought it was a very poor program language and everything I need to do with js was a nightmare. If browser was Netscape one way to to do one thing, if browser was IE other (of a other and a couple of hacks). But the times have changed. XHR and Ajax has reinvented the web. Web pages had became into Web Applications. Asynchronous request had opened our minds to a new generation of web applications, and all of it is thanks to javascript. Each day I spent learning js I see how much I was wrong.

Javascript literals are really powerful but the concept of scope is strange when you come from POO. this.foo in js sounds like $this->foo in PHP but its not the same.

For example in the following example:

dojo.declare("gam.desktop", null, {
    variable1: 1,
    foo: function() {
        dojo.xhrPost({
            url: myUrl,
            load: function(responseObject, ioArgs){
                console.log(this.variable1);
            }),
            handleAs: "json"
        });
    });

console.log(this.variable1); will not display 1 in firebug console. Its strange for me when I started with dojo. The problem is that here this points to the scope of the function foo and not to the scope of class gam.desktop. You can do strange tricky-hacks to solve the problem with global variables or something like that, or use dojo.hitch.

dojo.declare("gam.desktop", null, {
    variable1: 1,
    foo: function() {
        dojo.xhrPost({
            url: myUrl,
            load: dojo.hitch(this, function(responseObject, ioArgs){
                console.log(this.variable1);
            }),
            handleAs: "json"
        }));
    });

elegant isn’t it?

nslu2 installation

I need to change the HDD of my Linksys NSLU2 so I will use the opportunity to write a small HowTo to show how to set up an unslung firmware into my nslu2. Let’s start

First of all I need to download the last version of Unslung firmware and install in my ubuntu box the software to put the firmware into my nslu2:

sudo aptitude install upslug2

I put my nslu2 into upgrade mode and …

# upslug2
 [no NSLU2 machines found in upgrade mode]

What happen? I always forget I have two network cards (eth0 and eth1) and I use eth1

upslug2 -help
upslug2: usage: upslug2 {options}
options:
[extract]
-d --device[eth0]: local ethernet device to use
-t --target: NSLU2 to upgrade (MAC address)
-i --image: complete flash image to use

so …

sudo upslug2 -d eth1 -t  00:13:10:d9:03:ff -i Unslung-6.10-beta.bin

network is a my home network is a 192.168.2.0/24 so I need to change my IP if I want to connect to my nslu2:

sudo ifconfig eth1 192.168.1.2 netmask 255.255.255.0 up

Now I open a browser and type http://192.168.1.77/

From the web interface I change the ip from 192.168.1.77 to 192.168.2.77, the gateway and the dns.

change again my IP

sudo ifconfig eth1 192.168.2.2 netmask 255.255.255.0 up

and open again a browser http://192.168.2.77/

Now I format plug the HDD to the device (into Disk1) and format it from the web inteface.

Now I enable telnet, telnet to the device with the default username/password (root/uNSLUng) and unsling disk1

telnet 192.168.2.77
Trying 192.168.2.77...
Connected to 192.168.2.77.
Escape character is '^]'.
LKGD903B8 login: root
Password:
Welcome to Unslung V2.3R63-uNSLUng-6.10-beta
-------- NOTE: RUNNING FROM INTERNAL FLASH  --------
This system is currently running from the internal flash memory,
it has NOT booted up into "unslung" mode from an external drive.
In this mode, very few services are running, and available disk
space is extremely limited.  This mode is normally only used
for initial installation, and system maintenance and recovery.
BusyBox v1.3.1 (2007-12-29 03:38:35 UTC) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

# unsling disk1
Waiting for /share/hdd/data ...
Target disk is /share/hdd/data
Checking that /share/hdd/data has been properly formatted...
Checking that /share/hdd/data is clean...
Please enter the new root password.  This will be the new root
password used when the NSLU2 boots up with or without disks
Changing password for root
Enter the new password (minimum of 5, maximum of 8 characters)
Please use a combination of upper and lower case letters and numbers.
Enter new password:
Re-enter new password:
Password changed.
Copying the complete rootfs from / to /share/hdd/data ...
(this will take just a couple of minutes)
Copy complete ...
Linking /usr/bin/ipkg executable on target disk.
Linking /etc/motd to the unslung motd on target disk.
Updating /home/httpd/html/home.htm with target disk info.
Creating /.sdb1root to direct switchbox to boot from /share/hdd/data.
Unsling complete.
Leave the device disk1, /dev/sdb1, plugged in and reboot (using
either the Web GUI, or the command "DO_Reboot") in order to boot
this system up into unslung mode.
# Connection closed by foreign host.

Reboot the device enable telnet again and install openssh:

# ipkg update
# ipkg install openssh
Follow

Get every new post delivered to your Inbox.

Join 952 other followers