Pages

Sunday, March 28, 2010

ExtJS -=- Event on an anchor link

Hi!

If you want to use anchor tag (A) in your application with ExtJS, you must consider it as a button. Here's an example how to do this:

Anchor tag
Sign In



JavaScript
 var signIn = Ext.get('signin');
 signIn.on('click', function() {
      //console.debug("CLICK");
      // Your instructions here...
});

Sunday, March 21, 2010

Java -=- @SuppressWarnings() possible values

Hi! 

Here is the list of possible @SuppressWarnings. This annotation remove selected warnings in Java  code. To use is, simply put @SuppressWarnings("cast") for one type, and @SuppressWarnings({"boxing", "cast"}) for more than one type. 
  • all to suppress all warnings
  • boxing to suppress warnings relative to boxing/unboxing operations
  • cast to suppress warnings relative to cast operations
  • dep-ann to suppress warnings relative to deprecated annotation
  • deprecation to suppress warnings relative to deprecation
  • fallthrough to suppress warnings relative to missing breaks in switch statements
  • finally to suppress warnings relative to finally block that don’t return
  • hiding to suppress warnings relative to locals that hide variable
  • incomplete-switch to suppress warnings relative to missing entries in a switch statement (enum case)
  • nls to suppress warnings relative to non-nls string literals
  • null to suppress warnings relative to null analysis
  • rawtypes to suppress warnings relative to un-specific types when using generics on class params
  • restriction to suppress warnings relative to usage of discouraged or forbidden references
  • serial to suppress warnings relative to missing serialVersionUID field for a serializable class
  • static-access to suppress warnings relative to incorrect static access
  • synthetic-access to suppress warnings relative to unoptimized access from inner classes
  • unchecked to suppress warnings relative to unchecked operations
  • unqualified-field-access to suppress warnings relative to field access unqualified
  • unused to suppress warnings relative to unused code

Sunday, March 14, 2010

Mac OS X recover lost root password

If you have the password to an account that is an administrator on the system, then it is easy to recover the password using the sudo command. Open a terminal window and type:

sudo passwd root
and you will be prompted for your password (the user account that you do remember). Then you will be prompted for the new root password twice. That’s it!

The sudo command is a wonderful way to control who can do what on a system. In this case, since the user account is considered an administrator, the sudo command allows you (after confirming that you are who you say you are with the user password) to run a command as if you were root. The command we are running is passwd root which is the command to change the password for the root user.

If you do not have an administrator password, either, you can still reset the root password. Boot the system from the Mac OS X installation CD and select the Reset password option from the installer screen and follow the directions.

Source: http://www.tech-recipes.com/rx/712/mac-os-x-recover-lost-root-password/

Tuesday, March 9, 2010

XSLT -=- String to Upper Case

Hi!

In order to convert a string to upper case with XSLT, you can use the translate function. Here's an example how to do this.


This example show the value of the VALUE variable in the XML. If VALUE equals "toto". So the XSLT will show "toto".
 




If we use "translate" function, it will convert each character to the equivalent character in upper case. The following example will show "TOTO"...

Monday, March 8, 2010

  When creating a new record with Ext.grid.EditorGridPanel and Ext.form.ComboBox

Hi!

When you create a new record that contains a combo box, you should set the value to a empty string in order to avoid getting  . For example.



// My Column Model for the Ext.grid.EditorGridPanel
cm: new Ext.grid.ColumnModel([
{
     header: _("CURRENT_STATUS"),
     dataIndex: 'statusId',
     editor:new Ext.form.ComboBox({
          id: 'currentStatus'+id,
          store: statusStore,
          displayField: 'i18n',
          valueField: 'id',
          typeAhead: true,
          forceSelection:true,
          lazyRender : false,
          triggerAction: 'all',
          selectOnFocus:true
     }),
     renderer: Ext.util.Format.comboRenderer('currentStatus'+id)
}]

...

// My ADD Button

bbar:[
{
     text: _("ADD_BTTN"),
     icon: Constants.ICON_PATH + '/add.png',
     cls: 'x-btn-text-icon',
     tooltip: _("ADD_BTTN_TOOLTIP"),
     handler: function() {
          grid.getStore().insert(0, new Ext.data.Record({"statusId": ""}));
          grid.startEditing(0, 1);
     }
}]


When adding a new record. The combo box will show an empty string

Tuesday, March 2, 2010

Catching com.arjuna.ats.internal.jta.transaction.arjunacore.commitwhenaborted exception

Hi!

If you want semantically clear application exception you should perform a flush() operation from inside the container-managed transaction at the moment just before you are ready to complete the method. It allows you to handle an exception while you are in control, without the container interfering (EJBException) and potentially worse - swallowing your persistence layer exception (go find it in container logs).

If you've got an exception from the flush() call, then you can catch it on the service layer and throw an application exception that the client can recognize.

Example:

try{
     manager.persist(relationshipDocumentType);
     manager.flush();

}catch (Exception e){
     ...
}


The exception will be catched and you will be able to do what you want.