Archive

Archive for January, 2009

Weblogic ant tasks

January 29, 2009 2 comments

If you are trying to use weblogic ant task you might have run into the following problem when calling the task :

Could not create task or type of type: wlcompile.

This happens because ant can’t find the classes associated with the task, to solve this include the following snippet in your build xml:

<taskdef name="wlcompile" classname="weblogic.ant.taskdefs.build.WLCompileTask">
    <classpath>
        <pathelement location="${weblogic.jar}"/>
    </classpath>
</taskdef>

Please note the classpath element, this is important or ant will not find the appropriate class files. The weblogic.jar property points towards the weblogic.jar file present in your server/lib folder.

This example is for the wlcompile task. Here are the names and classes for the other avaiable task:

  • wldeploy – weblogic.ant.taskdefs.management.WLDeploy
  • wlappc – weblogic.ant.taskdefs.build.WLCompileTask
  • wlpackage – weblogic.ant.taskdefs.build.WLPackageTask
  • wlserver – weblogic.ant.taskdefs.management.WLServer

Good place for some more info is the bea edocs site avaiable at :  http://edocs.bea.com

Also check out Developing Applications with WebLogic Server 10.0

(Little) Console Task Manager

January 22, 2009 Leave a comment

My first ruby application. Simple console task manager with persistency. Nothing special dont be too harsh on my bad coding skills please 😛

This version has one bug, the application is fully functional but has a small bug ill get around to fixing

Code can be found here

Categories: ruby Tags: ,

Clear a form with javascript (prototypejs)

January 19, 2009 Leave a comment

The following snippet clears all fields in a form:

function apagarForm(formName) {
    $(formName).getElements().each(function(item) {
        if (item.name != "form_name" && item.type != "button" && item.type != "submit") {
            if (item.tagName == "SELECT") {
                item.selectedIndex = 0;
            } else if (item.type == "text") {
                Form.Element.clear($(item.id));
            } else if (item.type == "radio" || item.type == "checkbox") {
                item.checked = false;
            }
        }
   })
}

This uses prototype to iterate over the form fields.

Categories: web Tags: , ,

Kill Messages on Ruby applications

January 9, 2009 Leave a comment

Trying to get into ruby and i ran in to a somewhat important requirement. I need to know when my app is closing, wether it was me that shut it down or the OS just simply sent it a kill message. So i did some digging, made a fool of my self by posting to comp.lang.ruby and later on found the solution. Directly from the ruby documentation:

at_exit { block } → proc

Converts block to a Proc object (and therefore binds it at the point of call) and registers it for execution when the program exits. If multiple handlers are registered, they are executed in reverse order of registration.

   def do_at_exit(str1)
     at_exit { print str1 }
   end
   at_exit { puts "cruel world" }
   do_at_exit("goodbye ")
   exit

produces:

   goodbye cruel world

For more info visit here

Categories: ruby Tags: