wiki-codes
my personal wikipedia

Mar 25, 2013

Instalando driver Realtek Semiconductor Co., Ltd. RTL8191SEvA Wireless LAN Controller no Linux

Realize o download do driver em:
http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1&PNid=21&PFid=48&Level=5&Conn=4&ProdID=230&DownTypeID=3&GetDown=false&Downloads=true

Faça o download (RTL8192SE) versão mais nova.

descompacte-o utilizando exemplo abaixo:
# tar -xvzf rtl8192se_linux_2.6.0019.1207.2010.tar.gz

altere no arquivo base.c line 320 
'IEEE80211_HW_BEACON_FILTER | 
mude para /*IEEE80211_HW_BEACON_FILTER |' 

execute na pasta o comando make && make install como root.

após isto execute:
modprobe rtl8192se

Reinicie a máquina

Pronto, driver está instalado com sucesso!

Mar 20, 2013

Linux: Aonde esta JVM?

 
# update-java-alternatives -l
 
will tell you which java implementation is the default for your system and where in the filesystem it is installed. Check the manual for more options.

This depends a bit from your package system ... if the java command works, you can type readlink -f $(which java) to find the location of the java command. On the OpenSUSE system I'm on now it returns /usr/lib64/jvm/java-1.6.0-openjdk-1.6.0/jre/bin/java (but this is not a system which uses apt-get).

On Ubuntu, it looks like it is in /usr/lib/jvm/java-6-openjdk/ for OpenJDK, and in some other subdirectory of /usr/lib/jvm/ for Suns JDK (and other implementations as well, I think).

font: http://stackoverflow.com/questions/5251323/where-can-i-find-the-java-sdk-in-linux

Mar 12, 2013

Criar coluna EM Openbravo

No DB


adição EM FK

ALTER TABLE C_BPARTNER_LOCATION
  ADD "EM_TRNS_REGI_ID" VARCHAR2(32)

     ALTER TABLE C_BPARTNER_LOCATION 
       ADD CONSTRAINT "C_BPARTNER_LOCATION_REGI" FOREIGN KEY ("EM_TRNS_REGI_ID")
REFERENCES  "TRNS_REGI" ("TRNS_REGI_ID") ENABLE

No openbravo, adicionar campo em tables and fields, colocando tipo Table, criando uma reference key como table reference e então dar um ant compile.development

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>

Jan 4, 2013

Openbravo - Database Models

Hi folks,
When you want to create something new on Openbravo, first thing to do on the construction process is to create his skeleton on the database. The ERP tool needs at least eight obrigatory fields to run a simple window and they are:

1. ID
This column will serve to identify the registry on the table. Openbravo uses UUID (more info here or simple one here) for recognition, so you gonna need a varchar2(32) in case of a oracle database or character varying(32) in case of postgreSQL;

2. Client ID (AD_ORG_ID)
To identify on with client this registry is, openbravo need this column on the record. As the ID of this table, the Client ID uses UUID also (and have a foreign key rule), so varchar2(32) on oracle or character varying(32) on postegreSQL;

3. Organization ID (AD_CLIENT_ID)
Same as the Client ID but, for the organization;

4. Is Active
This column determines if the record is active or not. This fella is used in lot of process, such as selects on database and other things, so be aware sometimes when you are trying to check a registry but he is not appearing on the window, etc. Different from the other cited above, this column is a char(1) on oracle or postegreSQL (both cases);

5. Created
This column shows the time that the record has been created. In the case of oracle this column will have a DATE property, but on postgreSQL will be a time stamp without timezone; 

6. Createdby
Created is a column that will determine the user who created this record. As a identified column, the User ID gonna be inserted on him, so this column is a varchar2(32) in case of a oracle database or character varying(32) in case of postgreSQL. This column doesn't have a foreign key rule, but you can make a join to the user table, to gather more information on the user who created this record;

7. Updated
Finally, this shows the time that the record was updated;

8. Updatedby
This guy is just like the 'Created' but he will be filled when the user updates the record;

----

So, to make a table on oracle you gonna need at least:

ORACLE:

CREATE TABLE  "TABLENAME" 
(
"TABLENAME_ID" VARCHAR2(32) NOT NULL ENABLE, 
"AD_CLIENT_ID" VARCHAR2(32) NOT NULL ENABLE, 
"AD_ORG_ID" VARCHAR2(32) NOT NULL ENABLE, 
"ISACTIVE" CHAR(1) DEFAULT 'Y' NOT NULL ENABLE, 
"CREATED" DATE DEFAULT SYSDATE NOT NULL ENABLE, 
"CREATEDBY" VARCHAR2(32) NOT NULL ENABLE, 
"UPDATED" DATE DEFAULT SYSDATE NOT NULL ENABLE, 
"UPDATEDBY" VARCHAR2(32) NOT NULL ENABLE, 
-- insert extra columns here
CONSTRAINT "TABLENAME_ISACTIVE_CHECK" CHECK (ISACTIVE IN ('Y', 'N')) ENABLE, 
CONSTRAINT "TABLENAME_KEY" PRIMARY KEY ("TABLENAME_ID") ENABLE, 
CONSTRAINT "TABLENAME_AD_CLIENT" FOREIGN KEY ("AD_CLIENT_ID")
REFERENCES  "AD_CLIENT" ("AD_CLIENT_ID") ENABLE, 
CONSTRAINT "TABLENAME_AD_ORG" FOREIGN KEY ("AD_ORG_ID")
REFERENCES  "AD_ORG" ("AD_ORG_ID") ENABLE
)

POSTGRESQL:

CREATE TABLE TABLENAME
(
TABLENAME_ID  CHARACTER VARYING(32) NOT NULL,
AD_CLIENT_ID  CHARACTER VARYING(32) NOT NULL,
AD_ORG_ID     CHARACTER VARYING(32) NOT NULL,
ISACTIVE      CHARACTER(1) NOT NULL DEFAULT 'Y',
CREATED       TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT now(),
CREATEDBY     CHARACTER VARYING(32) NOT NULL,
UPDATED       TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT now(),
UPDATEDBY     CHARACTER VARYING(32)     NOT NULL,
-- insert extra columns here
CONSTRAINT HRSALARY_ISACTIVE_CHECK CHECK (isactive = ANY (ARRAY['Y'::bpchar, 'N'::bpchar])),
CONSTRAINT TABLENAME_KEY PRIMARY KEY (TABLENAME_ID), 
CONSTRAINT AD_ORG_CUS_PROJECT FOREIGN KEY (AD_ORG_ID)
REFERENCES AD_ORG (AD_ORG_ID), 
CONSTRAINT AD_CLIENT_CUS_PROJECT FOREIGN KEY (AD_CLIENT_ID)
REFERENCES AD_CLIENT (AD_CLIENT_ID),
)

---

If you wanna a deep info, check here,

See ya ;)