Thursday, October 29, 2009

Use Eclipse to Build a Starter Java Web Application

  • Create a new eclipse project using the Dynamic Web Project. 
  • After it's created, you may find an error in web.xml: Cannot find the declaration of element 'web-app'. To fix it, change all occurrences of j2ee to javaee in the attributes of the web-app tag in web.xml.
  • Place all jars required by your app:
    • into yourWebApp/WEB-INF/lib folder if you want just your app to acces it
    • into tomcatHome/shared/lib folder if you want all web apps on the server to share it
    • into tomcatHome/common/lib folder if you want all application and the server to be able to use it

Using Derby aka JavaDB

  • The database package is included with j2ee package or download.
  • To start the server: go to bin folder and fire-off the startNetworkServer.bat or the like on other OS's.
  • To create a database: connect to the server with the following JDBC URL: jdbc:derby://localhost:1527/fiber1;create=true. Replace fiber1 with the name of the DB you want to be created upon connect.
  • There is a tool called DdlUtils freely available from Apache that allows migration from one DB vendor to another. That means migration of the schema and the data. Can be used via Ant or from a Java program.

Saturday, October 24, 2009

System Recovery Using Linux

Recently, oe of our laptops failed.  It was slowly getting worse and worse.  We had to recover the files, but the installed windows OS wasn't operational any more.  I have run into a SystemRescueCD. It's an open project, that provides a set of rescue-oriented tools, togather with the basic linux system on a bootable CD or USB.

Here's how I have done the retrieval of the files:
  • Mount the windows harddisk:
    mkdir /mnt/sjb/windows
    ntfs-g3 /dev/sda1 /mnt/sjb/windows
  • Mount the USB to copy the files onto:
    mkdir /mnt/sjb/usb
    mount -t vfat /dev/sdb1 /mnt/sjb/usb (vfat is an extension of fat16)
I have also used an external harddisk connected via USB to copy a larger amount of data from the laptop's harddisk.  To find which device name I should point to to mount it (like /dev/sda1), I have used the testdisk utility available on the CD.

Friday, October 23, 2009

Confluence Wiki Office-Connector Plugin: Problem when Using IE

We have experienced problems, on some of our computers, when trying to use Office Connector plugin with IE.  Office Connector is a plugin that allows to easily edit an attached office document in its native editor, whether MS Word, Excell or OpenOffice Writer or some other. In Firefox, it works very well, once you install the add-on.  But in IE, it displays a message:

Unable to create an ActiveX object to open
the document. This is most likely because
of the security settings for your browser.

Notes:
  • The SharePoint.OpenDocuments ActiveX class is installed as part of MS Office, as part of Office Tools. The problem is not related to the IE version (both, IE6 and IE7 sometimes worked and on other computers didn't).
  • If you try to open for edit a document attached to a confluence page, the above class gets loaded into IE, and can be found in the list of loaded IE extensions.
  • To verify that it's installed correctly on your machine, run the script
    WScript.Echo "About to create an new SharePoint.OpenDocuments.1"
    dim obj
    set obj = CreateObject("SharePoint.OpenDocuments.1")
    WScript.Echo "Finished"
  • After tweaking the existing versions of the MS Office on the machine, it started working.

VBScript, VB, VBA Scripts and The Like: A Few Basic Facts

First two samples. A VBScript:

WScript.Echo "About to create an new SharePoint.OpenDocuments.1"

dim obj
set obj = CreateObject("SharePoint.OpenDocuments.1")

WScript.Echo "Finished"


And a VBA:
Public Sub myTest()
    Dim spObject As Object
    Dim aaa As String
   
    On Error Resume Next
    Set spObject = CreateObject("SharePoint.OpenDocuments.1")
   
    If Err.Number <> 0 Then
        aaa = "sss"
    End If   
End Sub

Notes:
  • In VBScript, the try/catch/finally/end try is available.  Not in VB/VBA.
  • VBA runs in a MS Office App only, while the VBScript is more like JavaScript: can run in the browser or from the command line. Use CScript.exe to run in the latter environment.
  • How to output a line to the console in VB/VBA? Don't know.

Tuesday, October 20, 2009

Windows Remote Desktop Connection Issues

Clipboard Sharing Not Working
* if the RDPCLIP is not running, start it (Start Menu -> Run -> CMD and type RDPCLIP)
* if it's running, restart it. 
That was tested with WinXP. 

Friday, October 2, 2009

RedHat Software Installation Utility RPM

Simple usage:
  • You need: an RPM file downloaded from rpmfind.net website or the like
    • On that website, provide the complete name of the package, but only the name, in main search box.
  • Run: rpm -Uvh name_of_the_rpm.rpm
    • The nice thing: this command will not install anything until all dependencies are satisfied.
    • If any dependencies are unsatisfied, this command will indicate what is needed. Download it and append the name of additional .rpm file(s) to the command and execute again. Continue the loop until all dependencies are satisfied.
That's it. For today.