Seit Hamburg

Alias en shell

A shell is a software that provides an interface to the user. There could be two kinds of shells, text or graphical. In either category, the purpose of the shell is to lauch a program.

We can create alias inside a shell to invoke those programs in a more efficient way.

To do that, we just edit the file .bashrc. For example, if we want to create an alias in ubuntu to update the system, we add the following line:

#Alias for updating the system

alias update = “sudo apt-get update”

To override all possible aliases, we just write a backslash and the command will be run as-is.

\ls

Junio 1, 2009 Publicado por backdoormann | linux | | No Comments Yet

Flash in Fedora 10

Sencillo:

The YUM version simply installs the repository configuration files, after which you must install the Flash plugin separately.

To begin, refer to the Adobe site at http://get.adobe.com/flashplayer/. Select YUM for Linux to download, and confirm.

Then proceed with the instructions showed below:

su -c 'yum install flash-plugin nspluginwrapper.x86_64 \
    nspluginwrapper.i386 alsa-plugins-pulseaudio.i386 \
    libcurl.i386'

Yasta.

Diciembre 24, 2008 Publicado por backdoormann | linux | | No Comments Yet

Memory Stick in Sony Vaio. Ubuntu Hardy.

svn co -r155 http://svn.berlios.de/svnroot/repos/tifmxx/trunk/driver/
cd driver/
wget http://www.sw83.de/misc/tifm_ms.patch
patch -p0 < tifm_ms.patch
make
sudo make install

http://swanseadivers.net/blog/tag/sony-vaio-ubuntu-hardy-linux/

Noviembre 29, 2008 Publicado por backdoormann | linux | | No Comments Yet

Sysvconfig

A text menu based utility for configuring init script links. It provides extensive explanations at each step.

Some features supported by sysvconfig are:

- Enable or disable services.
- Edit init links.
- Restore from backup file if you make a mistake.
- Menu or command line interface.
- View all services, each with its status and a brief description.

Sysvconfig will install service command to start, stop, restart the service using service command use the following format:

sudo service apache2 restart

sudo service apache2 stop

Septiembre 7, 2008 Publicado por backdoormann | linux | | No Comments Yet

Montar imagen ISO en Ubuntu

sudo mount -t iso9660 -o loop archivo.iso /directorio/de/montaje

Más: http://bronch.wordpress.com/2006/05/24/como-montar-archivos-iso-bin-mdf-y-nrg-en-linux/

Mayo 20, 2008 Publicado por backdoormann | linux | | No Comments Yet

Configuring MySQL for Linux

Three main tasks for the basic configuration of MySQL in Linux:

1. Create the grant tables.

2. Start the server.

3. Verify server function.

For the first step we have to find the script mysql_install_db. In Ubuntu it is located in the folder /bin.

The initial account settings created with this script have no passwords associated with the accounts.

You can start the MySQL daemon with the following command in root mode:
cd /usr ; /usr/bin/mysqld_safe &

Remember to set a password for the MySQL root user.
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password ‘new-password’
/usr/bin/mysqladmin -u root -h name-of-your-laptop password ‘new-password’

See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl, you’ll get output similar to that shown below:
cd mysql-test ; perl mysql-test-run.pl

./mysqladmin Ver 8.40 Distrib 4.0.22, for pc-linux on i686
Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Server version 4.0.22
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /tmp/mysql.sock
Uptime: 45 sec

Threads: 1 Questions: 1 Slow Queries: 1 Opens: 6 Flush Tables: 1 Open Tables: 0 Queries per second avg: 0.022

Once the server is up and running, test it out! Put your SQL knowledge to work and ensure that you’re able to create tables and work with data. Don’t forget that one of your first tasks should be to add security to the default accounts created during the installation process.

Mayo 6, 2008 Publicado por backdoormann | bd, programacion | | No Comments Yet

Paso de parámetros a funciones en Java

En el paso de parámetros a funciones hay dos aproximaciones clásicas: el paso por valor y paso por referencia.

En el paso por valor se realiza una copia de los valores que se pasan, trabajando dentro de la función con la copia. Es por ello que cualquier cambio que sufran dentro, no repercute fuera de la función.

En el paso por referencia no se realiza dicha copia, por lo que las modificaciones de dentro de las funciones afectan a los parámetros y esos cambios permanecen al final de la función.

En Java el paso por parámetro es por valor, aunque los efectos son de paso por referencia cuando los argumentos son objetos. ¿cómo sucede eso? Pues es muy fácil, si una función tiene como argumento un tipo primitivo (int, float, etc…), en Java se realiza una copia para la función y cualquier cambio a dicho argumento no afecta a la variable original. Este paso de parámetros en Java está orientado a utilizar el valor de la variable para otros cálculos.

En el caso de los objetos es distinto. En realidad lo que sucede es que en Java siempre tenemos referencias a los objetos. Por eso al pasar a una función como argumento un objeto, pasamos la referencia al mismo, es decir, aunque se hace una copia para el paso por valor, como lo que se copia es una referencia, los cambios al objeto referenciado sí son visibles y afectan fuera de la función.

La única excepción es la clase String , cuyos objetos no son mutables. Cualquier modificación de un objeto String lleva aparejada la creación de una nueva instancia del objeto. Si deseamos el mismo comportamiento para el paso de parámetros del resto de objetos, tenemos que recurrir al objeto StringBuffer.

Comentarios originales:

Bueno, decir que la clase String es una excepción es algo equivocado. Efectivamente, la clase String es una clase inmutable, porque no se puede modificar el estado del objeto a través de ningún método del mismo. El objeto String inicializa su valor en el constructor y a partir de ese momento no cambia. Por lo tanto, como tu bien dices, cuando utilizamos el operador suma, ejemplo:

a = a + ” texto añadido.”;

Lo que se está haciendo es crear un nuevo objeto String con el resultado de concatenar el String a con en String ” texto añadido.”. Finalemente el operador de asignación hace que a deje de referenciar al antiguo String y apunte al objeto recién creado. Por supuesto, las otras referencias que puedan haber al antiguo a (en la función que llamo a esta) sigen apuntando al antiguo objeto.

Esto no es ninguna excepción, es simplemente el resultado lógico de la semantica de llamada de función de Java (paso por valor de la referencia) y de la semantica de las variables a objetos (las variables nunca son los objetos “en si” sino una referencia a los mismos).

Cualquier objeto inmutable reflejará este comportamiento.

Referencias:

http://www.error500.net/garbagecollector/java/paso_de_parmetros_a_funciones.html

Abril 28, 2008 Publicado por backdoormann | programacion | | No Comments Yet

Navegador en modo texto.

Existe un navegador en modo texto que se llama links2. Para instalarlo en Ubuntu:

sudo aptitude install links2

Una vez que lo tenemos instalado, si queremos ver alguna página con este navegador hay que teclear en el terminal:

links2 www.google.es

Podremos acceder a un manual desde el programa. No tiene más complicación.

Marzo 22, 2008 Publicado por backdoormann | linux | | No Comments Yet

Colores en la salida del comando ls

En la consola de Ubuntu no salen los colores al hacer listados de archivos con el comando ls. Para conseguirlo hay que editar el archivo /etc/bash.bashrc y añadir al final:

alias ls = ‘ls –color=auto’

Marzo 21, 2008 Publicado por backdoormann | linux | | No Comments Yet

Cita

“Los malos tiempos van pasando y la suerte decide; tus manos o reciben o no reciben, pero mientras tengas amigos y no a la muerte por amiga, todo será pan y trigo; porque la muerte es lo único que define”.

Miguel Ángel Benítez Gómez (Delinquente)

Enero 6, 2008 Publicado por backdoormann | citas | | No Comments Yet