wiki-codes
my personal wikipedia

Feb 28, 2013

Tomcat no Linux



sudo unzip apache-tomcat-7.0.37.zip -d /opt
   wget http://archive.apache.org/dist/tomcat/tomcat-7/v7.0.37/bin/apache-tomcat-7.0.37.zip
na basta bin: chmod 700 *.sh
sh startup.sh

Feb 26, 2013

Acessando pasta compartilhada windows pelo linux

# sudo apt-get install smbfs

# mount -t cifs -o guest //10.0.0.3/MP3 /mnt/mp3/

Feb 15, 2013

Linux Ubuntu - Low Graphics Mode


Only for ATI graphics cards
When the message that "your system is running in low-graphics mode" appears:
Press Ctrl+Alt+F1 to see the terminal one. Then login with your credentials, and then run the following commands:
sudo apt-get install fglrx    
sudo reboot
The same can be done from the recovery mode (after enabling networking), if your Ubuntu completly refuses to enter anything but recovery mode.

Instalando Glassfish no Ubuntu

Instale Java:


sudo apt-get install openjdk-7-jdk


Verifique se está funcionando:


javac -version


Instale o unzip:


sudo apt-get install unzip


Baixe e descompacte o Glassfish na pasta opt


wget http://download.java.net/glassfish/3.1.1/release/glassfish-3.1.1.zip
sudo unzip glassfish-3.1.1.zip -d /opt

Crie um arquivo de inicialização


sudo vim /etc/init.d/glassfish


#!/bin/bash

GLASSFISH_HOME=/opt/glassfish3
case "$1" in
start)
    ${GLASSFISH_HOME}/bin/asadmin start-domain domain1
    ;;
stop)
    ${GLASSFISH_HOME}/bin/asadmin stop-domain domain1
    ;;
restart)
    ${GLASSFISH_HOME}/bin/asadmin stop-domain domain1
    ${GLASSFISH_HOME}/bin/asadmin start-domain domain1
    ;;
*)
    echo "usage: $0 {start|stop|restart}"
    ;;

esac

exit 0

Obs: Para salvar e fechar o vim aperte "Esc" depois ":w" para salvar e então "Esc" ":q" para fechá-lo.

Após isto, dar permissão e então iniciar


sudo chmod 755 /etc/init.d/glassfish
sudo update-rc.d /etc/init.d/glassfish defaults


sudo /etc/init.d/glassfish start

créditos: http://blog.rueedlinger.ch/2012/02/glassfish-3-1-and-mysql-5-1-on-ubuntu-server-11-10/

Linux Ubuntu - Inserir senha inicial para o root

Comando:
 - sudo passwd root

Feb 10, 2013

Filtro Selects em JS


<html>

<head>

<script type="text/javascript">

function mudar(obj) {
sumirTudo();
if(obj.value != '') aparecer('sel_' + obj.value);
}

function sumirTudo() {
document.getElementById('sel_1').style.display = 'none';
document.getElementById('sel_2').style.display = 'none';
document.getElementById('sel_3').style.display = 'none';
}

function aparecer(id) {
document.getElementById(id).style.display = 'block';
}

</script>

</head>

<body onload="sumirTudo();">

<select onchange="mudar(this)">
<option value=""></option>
<option value="1">a</option>
<option value="2">b</option>
<option value="3">c</option>
</select>

<select id="sel_1">
<option value="1">a1</option>
<option value="2">b1</option>
<option value="3">c1</option>
</select>

<select id="sel_2">
<option value="1">a2</option>
<option value="2">b2</option>
<option value="3">c2</option>
</select>

<select id="sel_3">
<option value="1">a3</option>
<option value="2">b3</option>
<option value="3">c3</option>
</select>

</body>

</html>