domingo, 31 de mayo de 2015

enable connection to postgresql server on Eclipse Luna

On Eclipse Luna to add a connection to postgresql Server follow these steps:

1. go to "Data Source Explorer" tab, on "Database Connections" Double click and choose "New"
2. From the "Connection Profile Types" choose "PostgreSQL" and click on Next
3. On the new Window, on Drivers option click on the button called "New Driver Definition", on "Name/Type" click on "PostgreSQL JDBC Driver", next move to JAR List Tab, then click on "Add JAR/Zip" button
4. Now you have to download the PostgreSQL JDBC Driver available, go to https://jdbc.postgresql.org/download.html and download the appropriate driver for you, this depend on what jdk version you are using. Once you have downloaded it, go to the directory where it is, choose it and click on OK
5. Then just click on "OK"
6. Now, you back on the Window from step 3, in fact it is call "New JDBC Connection Profile", here you need to specify the connection details like Database Name, User Name and Password, you are free to choose the option "Save Password". Once you are done click on "Next", read the Summary page, check if everything is OK and click on "Finish".

Now, if everything is OK on the Data Source Explorer Tab you may click on your database name and see the tables, index and everything.

that's it

viernes, 29 de mayo de 2015

install glassfish support on Eclipse Luna

This is an important info, specially if you are going to develop application with database support. So, to enable glassfish support on Eclipse Luna just follow these steps:

1. From Luna's main menu bar, go to help>Install New Software
2. Click on Add Button
3. on Name type a specific name in my case I chose Glassfish Tools for Eclipse, on the Lotaction type: http://download.oracle.com/otn_software/oepe/12.1.3.5/luna repository, and click on OK
4.  now with a few seconds to download the definitions from the repo. Once it have done, click on "Glassfish Tools", you may browse the entire list in case you are interested on any of them.
5. Then click on Next Button, accept the license agreement and wait until it finishes

doing this process, another repo will be configure on Eclipse ( http://download.oracle.com/otn_software/oepe/12.1.3.5/luna/repository/dependencies), don't be aware about it.

One thing more, I tried to do this behind a proxy and it was impossible - at least for me- I talked with the sys admin and told me it was not any rule against the eclipse repo, by the end of that day I tried at home and the process was really quick, take it in count.

and that's all, now you can create an instance of Glassfish for call it from Eclipse Luna.

Bye

lunes, 18 de mayo de 2015

install additional software on Eclipse Luna over Ubuntu 14.10


For any reason, the process to install additional software on eclipse is tricky. Some days ago I've install pydev+python support on it without any problems. Now I need to add another packages but the access to repos is extremely slow, so in order to fix this on Ubuntu, from command line just pass some args like this:

./eclipse -vmargs -Djava.net.preferIPv4Stack=true

after this you may do an update, install additional software or access to the Eclipse Software Center.

I read a lot at google about this problem, it looks this bug was fixed but several people still got it, anyway, at least for me it works using that parameter.

Cheers

domingo, 17 de mayo de 2015

start, stop and reload glassfish 4.x on Ubuntu

this is a short post, if you've already downloaded and installed glassfish 4.x (most of the time at /opt directory), you may use these commands to work with it:

1. to start: sudo ./asadmin start-domain

2. to enable admin's page (at 4848 port): sudo ./asadmin enable-secure-admin

3. to restart: sudo ./asadmin restart-domain

4. to stop: sudo ./asadmin stop-domain

that's all

cheers

jueves, 7 de mayo de 2015

install and configure Oracle 11g Express Edition on Ubuntu

There are several guides online how to achieve the installation of Oracle XE on Ubuntu, in my case I need it for academic purposes, I am pretty sure the installation of the full Oracle Suite has to be more friendly.

Cool, I read several of those guides, maybe some of them are out of date, in other cases the steps were enough, but in my case I had to mix a lot of them in other to accomplish the process, I am using Ubuntu 14.10 so maybe this would required to custom the installation. Before begin I need to say Oracle XE just accept up to 11GB of data storage, it may use up to 1 GB of RAM -although I you have more it won't be used- and the resources used will not exceed one CPU. As you may read, Oracle XE works great if you are a beginner in this DBMS.

1. the first step is to download the package -by the way for Linux there is a RPM package-, just go to this URL:
www.oracle.com/technetwork/products/express-edition/downloads/index.html  
create your account and then the download process will start.

2. From your $HOME directory create a directory called "oracle", copy the ZIP file and unzip it using:
  unzip oracle-xe*.zip

3. Open a terminal and install some needed packages:
  sudo apt-get install alien libaio1 unixodbc vim

4. next you have to convert the rpm package to deb, using:
   sudo alien --to-deb --scripts oracle*.rpm

5. then we need to configure awk and chkconfig:
    sudo ln -s /usr/bin/awk /bin/awk
    sudo mkdir /var/lock/subsys

6. Oracle requires to have a separate shm mount moint, in order to get this type:
   sudo rm -rf /dev/shm
   sudo mkdir /dev/shm
   sudo mount -t tmpfs shmfs -o size=2048m /dev/shm

   Notice you are typing size=2048m, this is related to the amount of physical RAM your system has, take some notes about it:
   -whether you are using a 32bit based system you must type just 2048m even whether you have more of it.
   -whether you are using a 64bit based system you are free to type the amount of RAM installed. in my case I have 4 GB but I just type 3GB of it
   -if you have a swap partition less than 2 GB you need to create expand it or create a swap file. I will avoid this step because most of the systems have more than 2 GB of RAM, enough HDD space so it would be a good a idea to expand you swap partition instead to do extra -and even more confused- steps

 Now, the idea is to everytime you start your system, you may have an available working environment for Oracle, so you need to write these steps in one file as I show next:

   sudo nano /etc/rc2.d/S01shm_load
    #!/bin/sh
    case "$1" in
    start) mkdir /var/lock/subsys 2>/dev/null
           touch /var/lock/subsys/listener
           rm /dev/shm 2>/dev/null
           mkdir /dev/shm 2>/dev/null
           mount -t tmpfs shmfs -o size=2048m /dev/shm ;;
    *) echo error
       exit 1 ;;
   esac

    Finally save the file and give exec permissions:
     sudo chmod 755 /etc/rc2.d/S01shm_load

7. Now, we need to create a chkconfig script (please type each line without any quote for read purpose at the blog I had to use them), login as root:
    sudo -i
 
  Then copy these lines:
 

 
Since blogger does not have a way how to embed code snippet I had to use an external service. 
 
Type the lines exactly as they are in. 


8. logout from root:
exit

9. give exec permissions:
   sudo chmod 755 /sbin/chkconfig

10. go to the "oracle" directory you created from step 2:
    cd ~/oracle/Disk1

11. install the deb package generated:
     sudo dpkg -i oracle*deb

Wait some minutes.

At this stage, oracle-xe is installed and ready to be configured, the next steps are really important so be prepare:

12. Edit your .bashrc en add the next lines at the end:
     export ORACLE_HOME=/u01/app/oracle/product/11.2.0/xe
     export ORACLE_SID=XE
     export NLS_LANG=`$ORACLE_HOME/bin/nls_lang.sh`
     export ORACLE_BASE=/u01/app/oracle
     export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
     export PATH=$ORACLE_HOME/bin:$PATH
     save it and close it
13. configure oracle using this command:
     sudo /etc/init.d/oracle-xe configure
    

     You'll be asked about:
     -available port for Oracle XE(it suggested 8080 I chose another one)
     -available port for Oracle Listener (I kept the default: 1521)
     -A password for SYS and SYSTEM user accounts

    Then You have to wait some minutes in order to confirm all stages, If evey of them were OK you should see something like this:
    Starting Oracle Net Listener...Done
    Configuring database ... Done
    Starting Oracle Database 11g Express Edition instance... Done
    Installation completed successfully

14. So at this point, all howtos online say eveything is ready, in my case I got an error at the "configure database" stage, this is where this guide might give you something new:

After this, you have to check 4 log files at:
/u01/app/oracle/product/11.2.0/xe/config/log

At least in my case I found something useful in cloneDBCreation.log, the other ones looked ok. So I found this error:
ORA-01109 database not open

besides this message, everything looks ok, the database was mounted and unmounted, for some reasons it could not be reopened. It seems the configure process almost finished, so I decided to try to connect to DB Engine using sqlplus.

15. Cool, before this, your current user needs to be part of the dba group:
    usermod -a -G dba 
16. login using sqlplus:
     sqlplus / as sysdba

17. now you have to be logged, then type these commands:
    shut immediate
    startup

18. Verify if some instante is ready to accept connections:
   select status from v$instance;

And that's all, for the moment, I know I missed the part to load oracle as a service, for now you may use it loading it manually, it's not perfect but it is a start. In fact, the log files do not give the necessary information in order to solve properly this issue. Several years ago I tried to install Oracle (I guess it was 8i) on CentOS and the process was less complex. It would be great the guys from Oracle may create a deb package.

Suggestions are welcome.

Be good

sábado, 2 de mayo de 2015

install and configure Kivy and Eclipse Luna

Today I would like to post about Kivy, which is a great Framewok based on python to develop apps with rich UI. I think this is a cool library, I am not using it for business purposes, I am teaching python this semester so it's really cool to focus on it.

So, first to install kivy on Ubuntu, open a terminal and type these commands:

1. sudo add-apt-repository ppa:kivy-team/kivy
2. sudo apt-get update
3. sudo apt-get install python-kivy kivy-examples

after this, you may check the examples at /usr/share/kivy-examples

Next step is to install eclipse luna which is the latest version of this project, just go to:
https://www.eclipse.org/downloads/ and choose the version you like more, in my case I chose "for Java EE DEvelopers" one, wait until it's downloaded

once it finished, just unpack the tar.gz file, and execute the file called "eclipse" and that's it, now you have Eclipse Luna installed.

last steps are:
from eclipse main menu, go to "help" menu and choose "install new software", in the new window, in the"work with..." section type:
http://pydev.org/updates

Pydev is another important IDE for Python, the integration with eclipse is really great.

click on next, accept the terms and wait some minutes until it finished the process

and if you don't get any weird message you have done this job

cheers