21.6.05

Powerpoint notes removal add-in

I described earlier a way to add a VBA macro in Powerpoint to allow removing the comments out of PPTs. This required adding the macro each time manually or having the macro in the powerpoint template by default. I decided that I make this small utility more handy by adding this as PPT add-in. This way the macro will be available all the times when dealing with PPTs.

Here is the PPT add-in (HJK_Remove_Notes.ppa), which you need to copy to the Microsoft add-ins directory. In my workstation the target directory is: C:\Documents and Settings\hkaukovu\Application Data\Microsoft\AddIns

After this you should restart the Powerpoint and navigate to Tools -> Add-Ins and press "Add New...". Choose the HJK_Remove_Notes.ppa -file and press Enable Macros button to start the add-in. You should have Plugins -menu item after the "Help" and from there if you choose "Delete Notes" you should be able to delete all the notes from the currently open PPT. The VBA macro will confirm you before you delete the notes.

If you find any issues pls let me know.

Comment on Blojsom installation on OC4J

I wrote in my earlier article about installing Blojsom on OC4J.

There is an easier way for installing applications on OC4J as pointed by Olaf Heimburger in his blog:

http://www.orablogs.com/olaf/archives/001043.html

20.6.05

OC4J: Adding your own logging handler for J2EE application logging

For those that have the need to use their own custom or ready-made logging handlers with Oracle OC4J container, here is a sample how to do it.

Oracle OC4J J2EE logging is based on the J2SE 1.4 java.util.logging. This is the new standard logging utility that has most of the same features log4j has, althought log4j still has more custom logging handlers compared to JUL logging.

You can add your own JUL (java.util.logging) handler as logging handler in the container component (defined in j2ee-logging.xml), but this doesn't affect any of the sub-component loggings, like JMS, server, RMI etc. j2ee-logging.xml affects on custom logging events used in the applications.

One thing to note here is that in order to use e.g. java.util.logging.FileHandler, you must set the "-Djava.util.logging.config.file" -option in the "java -jar oc4j.jar" call to configure the logging options. Setting the properties in the j2ee-logging.xml doesn't have any effect on the java.util.logging handlers.

So in order to run the OC4J with the wanted logging handler you need to startup the container with following command line:
java -Djava.util.logging.config.file=d:\apps\jdev1012\j2ee\home\properties\logging.properties -jar oc4j.jar




Here is a sample j2ee-logging.xml:

<logging_configuration>
<log_handlers>
<log_handler name="oc4j-handler" class="java.util.logging.FileHandler">
</log_handler>
</log_handlers>
<loggers>
<logger name="oracle" level="ALL" useParentHandlers="false">
<handler name="oc4j-handler"/>
</logger>
</loggers>
</logging_configuration>



Here is a sample logging.properties file:

java.util.logging.FileHandler.level=ALL
# "/" the local pathname separator
# "%t" the system temporary directory
# "%h" the value of the "user.home" system property
# "%g" the generation number to distinguish rotated logs
# "%u" a unique number to resolve conflicts
# "%%" translates to a single percent sign "%"
java.util.logging.FileHandler.pattern=%h/central%u.log
java.util.logging.FileHandler.limit=0
java.util.logging.FileHandler.count=1
java.util.logging.FileHandler.append=true
java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter

oracle.emp.kaukovuo.logger.test.LoggerServlet=ALL

11.4.05

Loading Java properties file inside EJB component (OC4J)

Loading properties file inside Java is common way to parametrize the application. Under single JVM you would use following code to load the properties file:


Properties prop = new Properties();
try
{
prop.load(new FileInputStream("hello.properties"));
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}


Under OC4J you might want to keep all the properties files under the same directory e.g. $OC4J_HOME/properties. For this you should edit the container application.xml file under $OC4J_HOME/config -directory. Add following line to the application.xml:

<library path="../properties"/>


In the J2EE application you can trust the class loader to find the properties file under this directory. For this you should code your application as:


Properties prop = new Properties();
try
{
prop.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("hello.properties"));
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}

24.3.05

Calling C/C++ gSOAP Web Services from JDeveloper

gSOAP is publicly developed C/C++ SOAP framework for Web Services client and server development.

Here is some loggin information trying to get Java -> C++ (via Web Services) to work together.

gSOAP distribution does not have ready made *.dlls or *.lib libraries for direct compilation. I had already Microsoft Visual C++ 6, which was just perfect environment for compiling the gSOAP basic *.dll's and sample C/C++ application. I tought I start the mini-project with the calculator samples mentioned in the manual. Generated the needed source code (*.cpp and *.h) + resource files using soapcpp2.exe.

Ok. after little bit of tweaking I got the first calc.exe to run as Web Service. Remember to add the "soap_set_namespaces(&soap, namespaces);" line after "soap_init(&soap)" in the C++ code. This will result the response message having all the needed namespaces and avoiding "SOAP version mismatch or invalid SOAP message" -error. Also noticeable was that the simple samples in manual did not work "as is" but the multi-threaded (with pooling) seems to work just fine, so that code base was used to serve the Web Service calls.

Imported the generated WSDL to the JDeveloper (9.0.5.2) and generated the Java sample code. Trying to run the Web Service stub results in following error message: "Method 'ns1:add' not implemented: method name or namespace not recognized".

=> The problem was that the sample Calc.cpp had some odd namespace definitions. After I copied the namespace definitions form Calculator.nsmap the Web Service started working.

After this the TCP packet monitor showed that Web Service returns the right answer, but Java deserializer returns an exception at Java side:

[SOAPException: faultCode=SOAP-ENV:Client; msg=No Deserializer found to deserialize a ':result' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.; targetException=java.lang.IllegalArgumentException: No Deserializer found to deserialize a ':result' using encoding style 'http://schemas.xmlsoap.org/soap/encoding/'.]
at org.apache.soap.SOAPException.<init>(SOAPException.java:78)
at org.apache.soap.rpc.Call.invoke(Call.java:308)
at oracle.emp.kaukovuo.ws.mypackage.CalculatorStub.add(CalculatorStub.java:79)
at oracle.emp.kaukovuo.ws.mypackage.CalculatorStub.main(CalculatorStub.java:36)
Process exited with exit code 0.


Looks like the result -element should be data typed (the same kind of problems as with Microsoft SOAP Toolkit). This is easily worked around with J2EE Web Services by adding web.xml initialization parameter "accept-untyped-request" to "true". How is this done in Java client environment when receiving response?

The response to the question lies in gSOAP manual chapter: "8.1.5 XSD Type Encoding Considerations".

The most important thing is to compile the header file with "-t" option. This generates code to send typed messages (with the xsi:type attribute).
For fast development you should take a look at the *.xml files that soapcpp2 compiler generates. These will reflect the requests and responses that the SOAP client/server will receive. In the first phase you don't need to get everything running to test.

1.12.04

Slide WebDAV server on Oracle or Orion J2EE, not working?

Ran into very interesting Apache project "Slide":
http://jakarta.apache.org/slide/index.html

This is an open source WebDAV J2EE implementation that is runnable (theoretically) on any Servlet 2.3 compliant web container.
Well, of course I could not resist trying this out on Oracle OC4J server. Deploying went fine but trying to run the engine will result on errors complaining on XML libraries. Apparently this product is built on top of open source XML libraries and out of the box they are not compliant to be run on any J2EE container.

The second trial was with Orion J2EE server. The deployment went fine but received errors when trying to access the http://localhost/slide -URL. The errors seem to complain about missing encoding libraries. If I just knew what should I do...
Here is the error message:

Orion/2.0.5 initialized
28 Nov 2004 22:06:07 - org.apache.slide.webdav.WebdavServlet - ERROR - java.io.UnsupportedEncodingException: "UTF-8"
java.io.UnsupportedEncodingException: "UTF-8"
at sun.io.Converters.getConverterClass(Unknown Source)
at sun.io.Converters.newConverter(Unknown Source)
at sun.io.CharToByteConverter.getConverter(Unknown Source)
at sun.nio.cs.StreamEncoder$ConverterSE.<init>(Unknown Source)
at sun.nio.cs.StreamEncoder$ConverterSE.<init>(Unknown Source)
at sun.nio.cs.StreamEncoder.forOutputStreamWriter(Unknown Source)
at java.io.OutputStreamWriter.<init>(Unknown Source)
at com.evermind.server.http.EvermindHttpServletResponse.getWriter(Unknown Source)
at javax.servlet.ServletResponseWrapper.getWriter(ServletResponseWrapper.java:37)
at org.apache.slide.webdav.util.DirectoryIndexGenerator.generate(DirectoryIndexGenerator.java:165)
at org.apache.slide.webdav.WebdavServlet.doGet(WebdavServlet.java:352)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:244)
at org.apache.slide.webdav.WebdavServlet.service(WebdavServlet.java:158)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
at com.evermind._ha.doFilter(Unknown Source)
at org.apache.slide.webdav.filter.LogFilter.doFilter(LogFilter.java:141)

at com.evermind._ctb._psd(Unknown Source)
at com.evermind._ctb._bqc(Unknown Source)
at com.evermind._ax._luc(Unknown Source)
at com.evermind._ax._ucb(Unknown Source)
at com.evermind._bf.run(Unknown Source)
ApplicationServerThread, 28-marras-2004 22:06:07, unauthenticated, GET, 500 "Internal Server Error", 40 ms, /

27.11.04

Deploying Blojsom on Orion J2EE Server

As many of you might know already is Oracle J2EE technology based on Orion J2EE server. Currently these two servers go their separate ways in development, but there are still quite a lot similarities. I use this container at home for my personal web projects (family home pages etc). The installation of blojsom Blog server is pretty much the same as in Oracle J2EE server, with the exception of different name in http web site XML configuration file.

Here is the steps to deploy the blojsom blogging application on ORION J2EE container. Tested on 2.0.5 version.

  1. Download the WAR file for blojsom (http://sourceforge.net/project/showfiles.php?group_id=72754)

  2. Copy blojsom.war to it's own directory, without any other files in it.

  3. Make subdirectory META-INF

  4. cd META-INF

  5. Create/edit application.xml -file with following content:


  6. <?xml version = '1.0' encoding = 'windows-1252'?>
    <!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN" "http://java.sun.com/dtd/application_1_3.dtd">
    <application>
    <display-name>Blojsom</display-name>
    <module>
    <web>
    <web-uri>blojsom.war</web-uri>
    <context-root>blojsom</context-root>
    </web>
    </module>
    </application>

  7. Change directory to the root directory where blojsom.war exists. Create an EAR file out of the directory:

  8. <path_to_your_jdk_home>\jdk\bin\jar cvf blojsom.ear *
    You should see something like:
    added manifest
    adding: blojsom.war(in = 2493553) (out= 2449558)(deflated 1%)
    adding: web-inf/(in = 0) (out= 0)(stored 0%)
    adding: web-inf/application.xml(in = 387) (out= 240)(deflated 37%)
  9. Copy this *.ear file to ORION_HOME/applications -directory

  10. Edit ORION_HOME/config/server.xml

  11. Add following line under the application-server -root element:
    <application name="blojsom" path="../applications/blojsom.ear" auto-start="true" />

  12. Edit ORION_HOME/config/default-web-site.xml

  13. Add following line:
    <web-app application="blojsom" name="blojsom" load-on-startup="true" root="/blojsom" />

  14. Start the ORION server

  15. Auto-deployment should start at this point.
  16. Edit ORION_HOME/applications/blojsom/blojsom/WEB-INF/default/blog.properties

  17. Change the blog-base-url and blog-url to point to your server and ORION port.
    Change also other meaningful descriptive parameters to match your needs.
  18. Restart the ORION server

  19. Point your browser to url http://localhost:<port>/blojsom/blog/default/

26.11.04

Removing Powerpoint slide comments

I am working as a sales consultant and use Powerpoint slides quite often to describe the presented material. Many time some of the Powerpoint slides are annotated by someone else and if I want to deliver the PPT to the customers/partners I must remove the annotations. Doing this manually is time-consuming. Here is a trick to add a simple Visual Basic macro that automatically removes the annotations and leaves the slides.


Sub DelNotesShapes()
Dim oSld As Slide
For Each oSld In ActivePresentation.Slides
If oSld.NotesPage.Shapes.Count > 0 Then
oSld.NotesPage.Shapes.Range.Delete
End If
Next oSld
Set oSld = Nothing
End Sub


Press Alt-F11, choose from menu Insert->Module and copy above VBA code to the editor. Press Save and exit the VBA editor.
Run the macro in PPT with Alt-F8, choosing above macro name DelNotesShapes and "Run". After this all the notes/annotations are removed.

17.11.04

How to deploy Blojsom blogging application on standalone OC4J

Here is the steps to deploy the blojsom blogging application on Oracle Container 4 J2EE.

  1. Download the WAR file for blojsom (http://sourceforge.net/project/showfiles.php?group_id=72754)

  2. Copy blojsom.war to it's own directory, without any other files in it.

  3. Make subdirectory META-INF

  4. cd META-INF

  5. Create/edit application.xml -file with following content:


  6. <?xml version = '1.0' encoding = 'windows-1252'?>
    <!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN" "http://java.sun.com/dtd/application_1_3.dtd">
    <application>
    <display-name>Blojsom</display-name>
    <module>
    <web>
    <web-uri>blojsom.war</web-uri>
    <context-root>blojsom</context-root>
    </web>
    </module>
    </application>

  7. Create an EAR file out of the directory:

  8. <path_to_your_jdk_home>\jdk\bin\jar cvf blojsom.ear *
    You should see something like:
    added manifest
    adding: blojsom.war(in = 2493553) (out= 2449558)(deflated 1%)
    adding: web-inf/(in = 0) (out= 0)(stored 0%)
    adding: web-inf/application.xml(in = 387) (out= 240)(deflated 37%)
  9. Copy this *.ear file to OC4J_HOME/applications -directory

  10. Edit OC4J_HOME/config/server.xml

  11. Add following line under the application-server -root element:
    <application name="blojsom" path="../applications/blojsom.ear" auto-start="true" />

  12. Edit OC4J_HOME/config/http-web-site.xml

  13. Add following line:
    <web-app application="blojsom" name="blojsom" load-on-startup="true" root="/blojsom" />

  14. Start the OC4J server

  15. Auto-deployment should start at this point.
  16. Edit OC4J_HOME/applications/blojsom/blojsom/WEB-INF/default/blog.properties

  17. Change the blog-base-url and blog-url to point to your server and OC4J port.
    Change also other meaningful descriptive parameters to match your needs.
  18. Shutdown the OC4J and restart it.

  19. Point your browser to url http://localhost:8888/blojsom/blog/default/

Testing Oracle Software Packager

Finally got the time to test drive the Oracle Software Packager 2.2 that is used to create installation packages installable by Oracle Universal installer.

Great tool! After 1 hour I got my first installation staging area built up and tested using Oracle Universal installer.
Just wondering why this tool is not more widely used within our customers and partners.

Oracle Software Packager can create installation components which can be bundled together to create a main installation component. This seems to work nicely when using a "custom" installation option. All the subcomponents can be either selected or de-selected the same way as it works with OracleAS or OracleDB installation.

I'm going to use the installer to bundle all custom Interconnect adapters, adapter customizers and transformations so that they are more easily installed. The package will be called OracleAS Interconnect Power Pack.

25.10.04

First post

Finally got the time to get my blog up and running. This blog is mainly concentrated on Oracle technology.