Tuesday, November 10, 2009

Some Java Application Servers and Application Frameworks

  • Application Servers, JSP enabled (javax.servlet container):
    • TomCat from Apache Servlet container, no EJBs (Approx 6 Megabytes)
    • Jetty no EJBs, light, run on Android
    • JBoss from RedHat JSP, Servlets and EJBs
    • Blazix from Desiderata Soft JSP, Servlets and EJBs (1.5 Megabytes)
    • WebLogic from BEA Systems JSP, Servlets and EJBs (Approx 40 Megabytes)
    • WebSphere from IBM JSP, Servlets and EJBs (Approx 100 Megabytes)
    • GlassFish from Sun/Oracle JSP, Servlets and EJBs
  • Application Frameworks
    • Spring - for the Java platform and .NET Framework - alternative to, replacement for, or even addition to the EJB model. - light weight
    • Tapestry - builds upon the standard Java Servlet API - integrates with any kind of backend, including JEE, Spring and Hibernate. - successor of HiveMind - light weight
    • Hibernate - many Java frameworks use Hibernate as a persistence layer, which can generate a database schema at runtime capable of persisting the necessary information. This allows the application designer to design business objects without needing to explicitly define a database schema. - Hibernate is an object-relational mapping (ORM) library for the Java language, providing a framework for mapping an object-oriented domain model to a traditional relational database. Hibernate solves object-relational impedance mismatch problems by replacing direct persistence-related database accesses with high-level object handling functions. - Hibernate's primary feature is mapping from Java classes to database tables (and from Java data types to SQL data types). Hibernate also provides data query and retrieval facilities. Hibernate generates the SQL calls and relieves the developer from manual result set handling and object conversion, keeping the application portable to all supported SQL databases, with database portability delivered at very little performance overhead. - Hibernate can use the XML file or the annotation to maintain the database schema.
    • Struts - cleanly separate the model (application logic that interacts with a database) from the view (HTML pages presented to the client) and the controller (instance that passes information between view and model). Struts provides the controller (a servlet known as ActionServlet) and facilitates the writing of templates for the view or presentation layer (typically in JSP, but XML/XSLT and Velocity are also supported). - face competititon from "light weight" MVC frameworks such as Spring MVC, Stripes, Wicket, MyFaces and Tapestry
    • JBoss Seam - managed by Gavin King, initiator of Hibernate - Seam combines the two frameworks Enterprise JavaBeans (EJB3) and JavaServer Faces (JSF).
    • See also: - java-source.net
  • Saturday, October 24, 2009

    Apache 2 on Ubuntu


  • install sudo apt-get install apache2 sudo apt-get install apache2ctl apache2ctl start
  • Document root
    DocumentRoot value is set in the file:
    /etc/apache2/sites-available/default

    Note that, by default, the value is /var/www/

  • config
    /etc/apache2

  • logs
    /var/log/apache2
  • to check that nothing else is running on port 80
  • lsof -i:80    (including docker publish)
  • Saturday, October 10, 2009

    Your time is limited

    "Your time is limited, so don't waste it living someone else's life. Don't be trapped by dogma — which is living with the results of other people's thinking. Don't let the noise of others' opinions drown out your own inner voice. And most important, have the courage to follow your heart and intuition. They somehow already know what you truly want to become. Everything else is secondary."
    ...........................................................................Steve Jobs delivered on June 12, 2005 at Stanford

    Wednesday, September 30, 2009

    mysql on Ubuntu







  • mysql -h 192.168.50.93 -P 3307 -u legui -p     (warning, you need "-p")
  • mysql --host 192.168.0.145 --port 3307 --user=search_wip -pxxxxxxxx
  • show databases 
  • use xx


  • Install
    sudo apt-get install mysql-client
    sudo apt-get install mysql-server
    Add this source to your sources.list:
    deb http://security.ubuntu.com/ubuntu hardy-security main
    do an apt-get update

  • If the mysql runs on 192.168.0.11
    sudo vi /etc/mysql/my.cnf
    then
    # skip-external-locking
    bind-address = 192.168.0.11
  • it prints this at restart:
    * Checking for corrupt, not cleanly closed and upgrade needing tables.
    It is not an error, it just says that "mysql is" Checking for...
  • to start
    sudo /etc/init.d/mysql start
    (don't forget the sudo, otherwise it fails and not very explicit in the error)
  • Enable firewall mysql ports to be open using
    sudo firestarter
    or if the server doesn't have kde
    sudo /sbin/iptables -A INPUT -i eth0 -s 192.168.0.20/24 -p tcp --destination-port 3306 -j ACCEPT
  • If running a jdbc access from the same machine on Ubuntu, do this first
    mysql -u root -p
    mysql> GRANT ALL ON GG.* TO 'root'@'192.168.0.11';
    or
    mysql> GRANT ALL ON test.* TO 'root'@'192.168.0.11' IDENTIFIED BY 'password' WITH GRANT OPTION;
    mysql> FLUSH PRIVILEGES;
    mysql> commit;
    From phpmysql, you should see a user with the following privileges:
    root 192.168.0.11 global ALL PRIVILEGES Oui
  • You can then connect through DbVisualizer (not putting the db name yet). You can then create the db
    mysql> CREATE DATABASE GG;
    mysql> CREATE TABLE j_2 ( Id int AUTO_INCREMENT PRIMARY KEY, Date Date, Myint integer, Url varchar(255) );
    mysql> commit;
    etc
  • log
    /var/log/mysql/mysql.log
  • helpful
    SHOW DATABASES;
    SHOW GRANTS FOR 'root'@localhost;
    SELECT * FROM j_3 INTO OUTFILE '/toto.txt';
  • Note: This one is a good post:
    http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html




  • To use phpmyadmin
    you need a root password:

    mysql -u root

    >UPDATE mysql.user SET Password=PASSWORD('admin') WHERE User='root'
    >FLUSH PRIVILEGES;

    Also, don't forget to create the link
    sudo ln -s /usr/share/phpmyadmin/ phpmyadmin

    /var/www/phpmyadmin/libraries$ vi config.inc.php
    $cfg['PmaAbsoluteUri'] = 'localhost/phpmyadmin/';
    $cfg['Servers'][$i]['host'] = '192.168.0.5';
    $cfg['Servers'][$i]['password'] = 'mypassword';

    Also, you may want to add the line (it seems it is 3600 sec by default)
    /etc/phpmyadmin$ vi config.inc.php
    $cfg['LoginCookieValidity'] = 10000000;

  • About export/import
    Export:
    mysql -u root -p
    mysql> use test
    mysql> select * from jg_seeds_3 INTO OUTFILE '/tmp/jg_seeds_3.txt'
    Import:
    $ sudo mysqlimport -u root -p GG /tmp/jg_seeds_3.txt
    -> password (mysql pw)
    Please note that the file base name jg_seeds_3 has to match the table name in GG. The file extension (txt here doesn't matter). Put the input file in /tmp since mysql user has all privileges on the folder and all its parents.
  • mysql dump
  • dump:
    mysqldump -h bo-sql-lb-master.be.p1.canon -u bill -p --max_allowed_packet=1073741824 --lock-tables=false stats_fr tb_popu > popu-all.sql
    load:
    mysql -h hostname -u user --password=password databasename < filename

    Fedora admin survival kit

  • Network config
    /usr/bin/system-config-network

    /etc/rc.d/init.d/
    /etc/sysconfig/network

    files in /etc/sysconfig/network-scripts/*

  • Upgrade from Fedora 5 to Fedora 10:
    I get the error: Error enabling swap device hdb3: No such file or directory
    The /etc/fstab on your upgrade partition does not reference a valid swap partition.

    What I did is rename hdb3 by sdb3 in fstab. Then the install worked fine.
    After that, I had to change in /etc/X11/xorg.conf: Driver "i810" to Driver "vesa"

    After that I start having applications that crashed with different errors. I started to be tired of this upgrade, I decided to re-install totally. The Fedora10 installer froze when it asked me for license, no keyboard, mouse inactive (eventhough it was active in the first screen of the installer). I said OK, let's give Ubuntu a try... Using Ubuntu 8.04 I finally could install without issue, no video configuration to change, no application crashing, Ubuntu works for me.
  • Monday, September 7, 2009

    free.fr

  • PagePerso propose MySql and PostgreSQL but these have to be used from the free.fr server, cannot be accessed directly from the outside.
  • When using the db url jdbc:postgresql://sql.Free.fr/esicdtek:5432
    it seems it is not using the server name at all
  • if you want to put a public machine on your personal freebox LAN, I recommend putting the public machine on your main subnet and using a new router to create a subnet with all the other machines. See
    http://www.sangoma.com/support/tutorials/tcp_ip.html
  • Tuesday, September 1, 2009

    SSII

  • Regie: Délégation de personnel chez le client
  • Forfait: Projets que la SSII traite chez elle
  • Infogerence: cas particulier d'outsourcing, correspond aussi bien à la maintenance du parc, qu'à la gestion de projets, qu'à la sécurité informatique et même aux formations.
  •