Monday, June 15, 2009

https://sugarcrm-ooo-integration.dev.java.net/

This open source project is aimed at creating a OpenOffice.org Extension for Sugar CRM(open source CRM product). I am committed to contribute for this cause. Any one who is interested can participate and contribute.

Project Home URL
https://sugarcrm-ooo-integration.dev.java.net

Developer Guide(How to setup build environment?)
https://sugarcrm-ooo-integration.dev.java.net/files/documents/8056/134956/file_134956.dat/Developers_Guide%20_OpenOffice.org_Extension_for_SugarCRM.pdf

Java.Util.Logging Example

This example is a simple illustration for using Java.Util.Logging. Java.Util.logging comes with J2SE.

create the following directory structure

->loggingdemo
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp|->Main.java
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp|->logging.properties

logging.properties

# Java Logging Properties
# Author : Deepak Dhanukodi
handlers=java.util.logging.FileHandler, java.util.logging.ConsoleHandler
# Default global logging level.
.level=SEVERE
# Loggers.
loggingdemo.level=ALL
# --- ConsoleHandler ---
# Override of global logging level
java.util.logging.ConsoleHandler.level=ALL
java.util.logging.ConsoleHandler.formatter=java.util.logging.SimpleFormatter
# --- FileHandler ---
# Override of global logging level
java.util.logging.FileHandler.level=ALL
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter
# Unlimiting size for output file
java.util.logging.FileHandler.limit=0
# Number of output files to cycle through, by appending an
# integer to the base file name:
java.util.logging.FileHandler.count=1
# Append to already existing file
java.util.logging.FileHandler.append=true
java.util.logging.FileHandler.pattern=system.log

Main.java

package loggingdemo;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import java.util.logging.Filter;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.LogRecord;
import java.util.logging.Logger;

/**
* Java.utils.logging Demo
* @author Deepak Dhanukodi
*/
public class Main {
static String LOGGING_PROPERTIES = "loggingdemo/logging.properties";
private LogManager logManager;
private Logger logger;
/**
* @param args the command line arguments
*/
public void initialize() throws IOException
{
logManager = LogManager.getLogManager();
Properties prob = new Properties();
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(LOGGING_PROPERTIES);
logManager.readConfiguration(inputStream);
logger = Logger.getLogger(this.getClass().getName());
}
public void log()
{
logger.log(Level.WARNING, "I have hit a warning here.");
logger.warning("Same warning again");
//User defined filter
Filter filter= new Filter() {

public boolean isLoggable(LogRecord record) {
// Allow only FINE and filter the rest
if(Level.FINE == record.getLevel())
return true;
return false;
}
};
Filter oldFilter = logger.getFilter();
logger.setFilter(filter);
logger.severe("You can't reach me.");
logger.finer("You can't reach me, either.");
logger.fine("Horray,I am through.");
logger.setFilter(oldFilter);
logger.severe("You can reach me.");
logger.finer("You can reach me, either.");
logger.fine("Horray,I am through,again.");
}
public static void main(String[] args) throws IOException {
Main main = new Main();
// Initialize logger
main.initialize();
main.log();
}
}

Run

D:\>javac /loggingdemo/Main.java -d .

D:\>java -cp . loggingdemo.Main
15 Jun, 2009 5:10:53 PM loggingdemo.Main log
WARNING: I have hit a warning here.
15 Jun, 2009 5:10:53 PM loggingdemo.Main log
WARNING: Same warning again
15 Jun, 2009 5:10:53 PM loggingdemo.Main log
FINE: Horray,I am through.
15 Jun, 2009 5:10:53 PM loggingdemo.Main log
SEVERE: You can reach me.
15 Jun, 2009 5:10:53 PM loggingdemo.Main log
FINER: You can reach me, either.
15 Jun, 2009 5:10:53 PM loggingdemo.Main log
FINE: Horray,I am through,again.

D:\>

system.log

This log file is created in the same dir where you had executed java process.

15 Jun, 2009 5:10:53 PM loggingdemo.Main log
WARNING: I have hit a warning here.
15 Jun, 2009 5:10:53 PM loggingdemo.Main log
WARNING: Same warning again
15 Jun, 2009 5:10:53 PM loggingdemo.Main log
FINE: Horray,I am through.
15 Jun, 2009 5:10:53 PM loggingdemo.Main log
SEVERE: You can reach me.
15 Jun, 2009 5:10:53 PM loggingdemo.Main log
FINER: You can reach me, either.
15 Jun, 2009 5:10:53 PM loggingdemo.Main log
FINE: Horray,I am through,again.

Installing PHP as a Shared Module in APACHE HTTPD Server @ Open Solaris/ Solaris 10

Environment Details

cc = /usr/bin/cc
make = /usr/bin/make
Apache root = /export/home/Apache2.2.9/httpd-2.2.9_build/php
Src php = /export/home/php-5.2.6/php-5.2.6
Src Apache httpd= /export/home/Apache2.2.9/httpd-2.2.9_src

Setting the PATH

bash-3.2# export PATH=/usr/bin/cc:/usr/bin/make:$PATH

Building Apache httpd

bash-3.2#/export/home/Apache2.2.9/httpd-2.2.9_src/configure --prefix=/export/home/Apache2.2.9/httpd-2.2.9_build
bash-3.2#make
bash-3.2#make all

Start Apache HTTPD Server

bash-3.2#/export/home/Apache2.2.9/httpd-2.2.9_build/bin/apachectl start

Go to the following URL at Browser

http://localhost

The response at the browse should be "It works!".

Stop Apache HTTPD Server

/export/home/Apache2.2.9/httpd-2.2.9_build/bin/apachectl stop

Building PHP

./configure --prefix=/export/home/Apache2.2.9/httpd-2.2.9_build/php --with-apxs2=/export/home/Apache2.2.9/httpd-2.2.9_build/bin/apxs --with-config-file-path=/export/home/Apache2.2.9/httpd-2.2.9_build/php

bash-3.2# make
bash-3.2# make all

Configure Apache HTTPD with PHP

Add the following line to file 'Apacheroot/conf/httpd.conf'

LoadModule php5_module modules/libphp5.so

Note : # is a comment here @ Apache conf file...

Add the following mapping for PHP to invoke PHP parser for PHP files in the same conf file.
AddType application/x-httpd-php .php

Create PHP file

create a file named info.php @ /Apacheroot/htdocs
phpinfo();
?>

cp /export/home/php-5.2.6/php-5.2.6/php.ini-dist /export/home/Apache2.2.9/httpd-2.2.9_build/php/php.ini

Restart Apache HTTPD Server

$ /export/home/Apache2.2.9/httpd-2.2.9_build/bin/apachectl restart

Access the pho file as
http://localhost/info.php in a browser

The response shows the php configuration.