Monday, December 17, 2012

In SVN and Eclipse, if you have problems with a folder, with a small red x, try right-click->Team->Revert and then right-click->Team->Refresh/Cleanup

In SVN and Eclipse, if you have problems with a folder, with a small red x, try right-click->Team->Revert and then right-click->Team->Refresh/Cleanup.

Then try to commit again, it should work.

Friday, November 23, 2012

Using your Locale across requests and ignoring the Faces computed locale




if you want to use your Locale in a faces application, keep it in a session-scoped bean and use it like this

<f:view locale="#{myBean.myLocale}">
<f:loadBundle var="messages" basename="messages.Messages"></f:loadBundle>

You may wonder why not set your Locale (setLocale()) once on the viewHandler.

It is not enough because Faces computes its own locale on every request (or page refresh F5).

So you should do it and every request and this is exactly what <f:view locale="#{myBean.myLocale}"> ensures: that your locale is set as the view's locale on every request (and even if i wanted to set it explicitly on every request using viewHandler.setLocale() i didn't find any right event/timing to do it before the <f:loadBundle is processed. Even the preRenderView event i had learned about is not good)

This will ensure that even if you refresh the page, it is YOUR locale (from the bean propery) and not the Faces-computed locale (the browser locales filtered by <supported-locale>s or the <default-locale> if no <supported-locale> are specified)  that will be used.

Friday, July 27, 2012

Primary Keys through OneToOne and ManyToOne Relationships



Read this:

Primary Keys through OneToOne and ManyToOne Relationships

A common model is to have a dependent object share the primary key of its parent. In the case of a OneToOne the child's primary key is the same as the parent, and in the case of a ManyToOne the child's primary key is composed of the parent's primary key and another locally unique field.
JPA 1.0 does not allow @Id on a OneToOne or ManyToOne, but JPA 2.0 does.
One of the biggest pitfalls when working with composite primary keys comes with the implementation of associations to entity classes whose tables have multi-column primary keys (using the @JoinColumns annotation). Many JPA implementations may throw seemingly inconsistent exceptions when not specifying referencedColumnName for every @JoinColumn annotation, which JPA requires (even if all referenced column names are equal to the ones in the referencing table). See http://download.oracle.com/javaee/5/api/javax/persistence/JoinColumns.html

[edit] JPA 1.0

Unfortunately JPA 1.0 does not handle this model well, and things become complicated, so to make your life a little easier you may consider defining a generated unique id for the child. JPA 1.0 requires that all @Id mappings be Basic mappings, so if your Id comes from a foreign key column through a OneToOne or ManyToOne mapping, you must also define a Basic @Id mapping for the foreign key column. The reason for this is in part that the Id must be a simple object for identity and caching purposes, and for use in the IdClass or the EntityManager find() API.
Because you now have two mappings for the same foreign key column you must define which one will be written to the database (it must be the Basic one), so the OneToOne or ManyToOne foreign key must be defined to be read-only. This is done through setting the JoinColumn attributes insertable and updatable to false, or by using the @PrimaryKeyJoinColumn instead of the @JoinColumn.
A side effect of having two mappings for the same column is that you now have to keep the two in synch. This is typically done through having the set method for the OneToOne attribute also set the Basic attribute value to the target object's id. This can become very complicated if the target object's primary key is a GeneratedValue, in this case you must ensure that the target object's id has been assigned before relating the two objects.
Some times I think that JPA primary keys would be much simpler if they were just defined on the entity using a collection of Columns instead of mixing them up with the attribute mapping. This would leave you free to map the primary key field in any manner you desired. A generic List could be used to pass the primary key to find() methods, and it would be the JPA provider's responsibility for hashing and comparing the primary key correctly instead of the user's IdClass. But perhaps for simple singleton primary key models the JPA model is more straight forward.
TopLink / EclipseLink : Allow the primary key to be specified as a list of columns instead of using Id mappings. This allows OneToOne and ManyToOne mapping foreign keys to be used as the primary key without requiring a duplicate mapping. It also allows the primary key to be defined through any other mapping type. This is set through using a DescriptorCustomizer and the ClassDescriptor addPrimaryKeyFieldName API.
Hibernate / Open JPA / EclipseLink (as of 1.2): Allows the @Id annotation to be used on a OneToOne or ManyToOne mapping.

[edit] Example OneToOne id annotation

...
@Entity
public class Address {
    @Id
    @Column(name="OWNER_ID")
    private long ownerId;
 
    @OneToOne
    @PrimaryKeyJoinColumn(name="OWNER_ID", referencedColumnName="EMP_ID")
    private Employee owner;
    ...
 
    public void setOwner(Employee owner) {
        this.owner = owner;
        this.ownerId = owner.getId();
    }
    ...
}

[edit] Example OneToOne id XML

<entity name="Address" class="org.acme.Address" access="FIELD">
    <attributes>
        <id name="ownerId">
            <column name="OWNER_ID"/>
        </id>
        <one-to-one name="owner">
            <primary-key-join-column name="OWNER_ID" referencedColumnName="EMP_ID"/>
        </one-to-one>
    </attributes>
<entity/>

[edit] Example ManyToOne id annotation

...
@Entity
@IdClass(PhonePK.class)
public class Phone {
    @Id
    @Column(name="OWNER_ID")
    private long ownerId;
 
    @Id
    private String type;
 
    @ManyToOne
    @PrimaryKeyJoinColumn(name="OWNER_ID", referencedColumnName="EMP_ID")
    private Employee owner;
    ...
 
    public void setOwner(Employee owner) {
        this.owner = owner;
        this.ownerId = owner.getId();
    }
    ...
}

[edit] Example ManyToOne id XML

<entity name="Address" class="org.acme.Address" access="FIELD">
    <id-class class="org.acme.PhonePK"/>
    <attributes>
        <id name="ownerId">
            <column name="OWNER_ID"/>
        </id>
        <id name="type"/>
        <many-to-one name="owner">
            <primary-key-join-column name="OWNER_ID" referencedColumnName="EMP_ID"/>
        </many-to-one>
    </attributes>
<entity/>

[edit] JPA 2.0

Defining an Id for a OneToOne or ManyToOne in JPA 2.0 is much simpler. The @Id annotation or id XML attribute can be added to a OneToOne or ManyToOne mapping. The Id used for the object will be derived from the target object's Id. If the Id is a single value, then the source object's Id is the same as the target object's Id. If it is a composite Id, then the IdClass will contain the Basic Id attributes, and the target object's Id as the relationship value. If the target object also has a composite Id, then the source object's IdClass will contain the target object's IdClass.

[edit] Example JPA 2.0 ManyToOne id annotation

...
@Entity
@IdClass(PhonePK.class)
public class Phone {
 
    @Id
    private String type;
 
    @ManyToOne
    @Id
    @JoinColumn(name="OWNER_ID", referencedColumnName="EMP_ID")
    private Employee owner;
    ...
}

[edit] Example JPA 2.0 ManyToOne id XML

<entity name="Address" class="org.acme.Address" access="FIELD">
    <id-class class="org.acme.PhonePK"/>
    <attributes>
        <id name="type"/>
        <many-to-one name="owner" id="true">
            <join-column name="OWNER_ID" referencedColumnName="EMP_ID"/>
        </many-to-one>
    </attributes>
<entity/>

[edit] Example JPA 2.0 id class

...
public class PhonePK {
    private String type;
    private long owner;
 
    public PhonePK() {}
 
    public PhonePK(String type, long owner) {
        this.type = type;
        this.owner = owner;
    }
 
    public boolean equals(Object object) {
        if (object instanceof PhonePK) {
            PhonePK pk = (PhonePK)object;
            return type.equals(pk.type) && owner == pk.owner;
        } else {
            return false;
        }
    }
 
    public int hashCode() {
        return type.hashCode() + owner;
    }
}

Synthax for using a named parameter of type List in JPA Query Language when using Hibenate

example:

WHERE person IN (:persons)

note the (: persons ) notation.

and then you set the paramater as usual:

query.setParamater("persons", myListofPersons);

Monday, June 25, 2012

Modify the version of your webapp to 2.5 in a "maven-archetype-webapp" generated web application


By default, maven will generate a version=2.3 and "DTD-style" web.xml.

Also, the "Dynamic Web Module" Facet is set to 2.3. (right-click, see Project Facets)

These 2 configutations are old, you most probably are using Java EE 5 or 6 features and this will surely create you problems when deploying your project on an application server.

For example your @PersistenUnit in your Servlets will not be considered by the application server and those fields will be left null.

Also even the Eclipse will generate problems when deploying to the server.

So, today this this can create problems, as in most cases your apps are modern.

Update your web.xml with this:

<?xml version="1.0" encoding="UTF-8"?>
<web-app 

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"
>

...

</web-app>



Also, update the "Dynamic Web Module" Facet to 2.5. For Eclipse it is not enogh to just change the version in web.xml

Watch this for how to change it to 2.5, i recopy the steps here:

1. Uncheck the Dynamic Web Module facet checkbox and click Apply.
2. Re-check the Dynamic Web Module facet, choose version 2.5 (or 3.0) and click “Further Configuration”.
3. In the Content Directory field, type “/src/main/webapp”. Be sure that the “Generate web.xml deployment descriptor” is checked. Click OK.
4. Click Apply, then click OK.

In Eclipse Maven can't download an artifact: use the checkbox"Force Update of snapshots/releases"

Right click your project, Maven->Update Dependencies than tick the "Force Update of snapshots/releases", then OK.

Tuesday, June 19, 2012

JAX-WS, Jersey, GF 3.1.2, don't forget an @ApplicationPath annotated class in your webapp for your resource classes to be deployed


NetBeans saved my day. I wanted to test Jersey (with Eclipse Indigo) and GF 3.1.2 simply didn't see them when deployed my webapp, the browser didn't see any response from sever for my "/alfa" URL.

I had a resource class:

package com.test.jersey;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;

@Path("alfa")
public class MyResource {

 public MyResource() {
 }

 @Produces("text/plain")
 @GET
 public String sayHello() {
  return "hello again";
 }

}

So tried the example in the java6 tutorial (helloworldapplication) with Netbeans 7.1, right-cliked and chosen "Test RESTFfull Webservices " (as the tutorial says) and in NetBeans it worked perfectly this way (it launches a super web interface for testing all the class's resource methods...impressing) and also when deployed and testing it from a browser.

So, what was the difference between my webapp ant this one?

And i saw that netbeans generated a class

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.netbeans.rest.application.config;
/**
 * This class is generated by the Netbeans IDE,
 * and registers all REST root resources created in the project.
 * Please, DO NOT EDIT this class !
 */
@javax.ws.rs.ApplicationPath("resources")
public class ApplicationConfig extends javax.ws.rs.core.Application {
}


...and i copied it in my source files in Eclipse and there you go, it worked after a redeploy....

So When using JAX-RS, include this @ApplicationPath annotated class

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.test.jersey;

import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;

/**
 * This class is generated by the Netbeans IDE, and registers all REST root
 * resources created in the project. Please, DO NOT EDIT this class !
 */
@ApplicationPath("")
public class ApplicationConfig extends Application {
}

I replaced "resources"  by "", to be able to use URLs like /alfa and not /resources/alfa, to hit my class.

Saturday, June 16, 2012

Glassfish 3.1.2 plugin for Eclipse 3.7 Indigo is not compatible (won't install) in Eclipse 3.5 Galileo

Eclipse 3.5 Galileo does not allow installation (through update sites) of the GF 3.1.2 plugin for Eclipse 3.7 Indigo (plugin that is called "Oracle GF Server Tools" in fact) from the update site "http://download.java.net/glassfish/eclipse/indigo" (Glassfish 3.1.2 plugin for Eclipse 3.7 Indigo ).

So in Eclipse 3.5 you are stucked with the Eclipse 3.5 Galileo plugin for Glasfish 3.1 (not for 3.1.2) that strangely can control also a Glassfish 3.1.2 runtime environment. (it was available here: https://ajax.dev.java.net/eclipse , as indicated here: http://marketplace.eclipse.org/content/glassfish-java-ee-application-server-plugin-eclipse)

Short Story:
Initally i had a GF 3.1.1 installed and then added in Eclipse 3.5 a new server environment for it, using the default Eclipse 3.5 plugin for Glassfish 3.1 (Java EE 6) that Eclipse proposes in the Nwe Server wizzard.

Afterword, GS's Update tool updated my GF 3.1 to 3.1.2 so this is how i ended up having a Eclipse 3.5 and a plugin for GF3.1, but actually controlling GF 3.2

Wednesday, November 30, 2011

Very important CSS solution: vertical align of an image in IE7 or IE8

This is a copy/paste of a very important resource to CSS users to solve the problem of vertical aligning of an image in IE7 or IE8. The original url is here. The key parts are highlighted in blue. This may be the solution to your problem.

 

You may also be interested in how to make divs (block elements) behave as inline blocks (that is: "flow" next to eachother "like words in a paragraph" - and next to other inline elements like words, images, spans - and wrap down on a new line automatically when there is no more space in the container, and all this by keeping them as "blocks" with respect to their size and inner content which can be anything), so also take a short look at this nice example called "IE7-/Win: inline-block and hasLayout".

-------------------------------------------------------------------

Centering (horizontally and vertically) an image in a box

The problem

We want to center an image inside a container, bigger than the image and with assigned dimensions. The image is not a background one, it’s a true <img> element.
Any image has well defined dimensions, so the easiest and most reliable way to solve the problem is:
  • make the image display:block
  • assign to the image the needed left and top margins to get it centered in the container. Each of this margin value is obviously half the difference between a dimension of the container and that of the image.
For example if you have images of two different sizes, like in a photo gallery with “landscape” and “portrait” images, to be centered in fixed size containers, then assigning to each <img> one of two classes (with different margins) will solve the problem.
But there are cases when one does not want to use the previous method. For example when many images, all with different dimensions are involved and it is not practical to assign different margins to each of them, or when the dimensions of the container and those of the image are not expressed in the same units (px, em, %, …) hence the difference cannot be computed. It’s useful to have a different solution, independent on the image’s size.

A solution

The horizontal centering is not difficult. If the image is left with its default inline display, then text-align: center is the obvious solution, working well in all browsers.
For the vertical centering the best solution, working in modern browsers, is to assign display: table-cell; vertical-align: middle to the container. This works in Gecko based browsers, Opera 6+, Safari, IE8. It leaves IE7 and lower (both Windows and Mac) out.
For IE7- the idea is to create a sort of line-box having as height the height of the container, and the using again vertical-align: middle. The line-height property cannot be used to achieve this, since it doesn’t work correctly in IE7-/Win in presence of images. Also the use of a big font-size (without specifying line-height) is problematic, because the height of the generated box is slightly bigger than the font-size. And IE5/Mac (differently from IE/Win) is able to resize (according to user choice) line-height and font-size expressed in pixels, so it would have problems with this approach, unless the height of the container is expressed in em. Note: this same argument precludes the general use of such vertical centering method, based on line-height, in Gecko based and Safari browsers.
Fortunately IE7- has (partial) support for display: inline-block. If an empty inline-block element (for example a span) is added inside the container and it is assigned height: 100%; vertical-align: middle then it allows to precisely get what we want: a line box with the desired height. In other words, the inline-block element respects an assigned height (equal to the container’s one) and props the line open, so that vertical-align: middle (both on the extra element and the image) gives the desired vertical centering.
Some details:
  • The extra, empty inline-block element may have zero width in IE7-/Win, but it must have at least width: 1px in IE/Mac, otherwise it has no effect (this sometimes offsets the horizontal centering by 1px. It could be counteracted with a -1px margin, but the problem is barely visible.)
  • In IE5/Mac the vertical centering is some pixels off. The use of a small font-size or line-height on the container seems beneficial, not clear why (IE5/Mac is a bit incoherent here, especially when playing with its font size settings.)
A combined solution, using display: table-cell and the extra span with display: inline-block, works in Gecko based browsers, Opera 6+. Safari, IE5+/Win, IE5/Mac.
A variation of this technique can be used to vertically center a block element (even with unknown height) inside another one (with known height) which is a more interesting problem.

The code

Putting all together, and naming “wraptocenter” the class of the container, that’s the relevant CSS. Code for IE/Mac is wrapped in a suitable filter. Code for IE7-/Win is put in conditional comments.
<style type="text/css">
.wraptocenter {
    display: table-cell;
    text-align: center;
    vertical-align: middle;
    width: ...;
    height: ...;
}
.wraptocenter * {
    vertical-align: middle;
}
/*\*//*/
.wraptocenter {
    display: block;
}
.wraptocenter span {
    display: inline-block;
    height: 100%;
    width: 1px;
}
/**/
</style>
<!--[if lt IE 8]><style>
.wraptocenter span {
    display: inline-block;
    height: 100%;
}
</style><![endif]-->
And that’s the relevant HTML
<div class="wraptocenter"><span></span><img src="..." alt="..."></div>

Some examples

To demonstrate the solution, it is applied to two different sized images, and to two different sizes for the containers. The first containers have dimensions expressed in pixels, the second ones in ems. The containers are given a grid background to better check the centering.

(images removed for not displaying corectly on copy/paste to this blog post, see original url)

Some other examples where the images contain a (red) grid, which should align with the light grey grid of the container background.

(images removed for not displaying corectly on copy/paste to this blog post, see original url)

Other, slightly more complex, examples: images in floated containers, an image gallery with captions.

An article on this problem by Steve Clay.
Many thanks to Ingo Chao, for his help and comments.
CSS tests home

Wednesday, April 6, 2011

Type 'com.theapplicationbox.gwt.jpa.entities.Person' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized

I had this exception today when using Gilead 1.3.2.1839 + GWT 2.2 (and other technologies, but not important: Hibernate 3.3.2.GA + Hibernate EntityManager 3.4.0.GA(JPA 1.0)+Spring 3.0.5:)


Type 'com.theapplicationbox.gwt.jpa.entities.Person' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized.
 Everything concerning Gilead was set correctly in my GWT project in Eclipse, that is:
  •  the application.gwt.xml (place in com.theapplicationbox) contained the Gilead configuration
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='application'>
    <!-- Inherit the core Web Toolkit stuff.                        -->
    <inherits name='com.google.gwt.user.User' />


    <!-- Inherit the default GWT style sheet.  You can change       -->
    <!-- the theme of your GWT application by uncommenting          -->
    <!-- any one of the following lines.                            -->
    <inherits name='com.google.gwt.user.theme.standard.Standard' />
    <!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
    <!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/>     -->


    <!-- Other module inherits                                        -->
    <!-- Gilead inherits, as in the docs: http://noon.gilead.free.fr/gilead/index.php?page=stateless -->
    <!--  adapted from "net.sf.gilead.Adapter4Gwt15" to "net.sf.gilead.Gilead4Gwt" -->
    <inherits name='net.sf.gilead.Gilead4Gwt' />
    <!-- Uncomment if your Domain class use JPA mapping annotations -->
    <inherits name='net.sf.gilead.emul.java5.ejb3.Ejb3' />


    <!-- Specify the app entry point class.                         -->
    <!--<entry-point class='com.theapplicationbox.gwt.client.ExampleEntyPoint' />-->
    <!-- Specify the paths for translatable code                    -->
    <source path='gwt/client' />
    <source path='gwt/shared' />
    <source path='middletier/common/interfaces' />
    <source path='jpa/entities' />


    <entry-point class="com.theapplicationbox.gwt.client.entrypoints.application.ApplicationEntryPoint"></entry-point>
</module>
  •  jpa/entities folder which contains Person.java is declared as source folder
  <source path='jpa/entities' />
  • the entity class had a default constructor, implemented Serializable and inherited LightEntity of Gilead:
    import net.sf.gilead.pojo.gwt.LightEntity;
    public class Person extends LightEntity implements Serializable {
    public Person(){}
    ...
    }

So there was no reason i got this.
But...

My service interface generating this problem were:
public interface IPersonService<T> extends RemoteService {


    List<T> getAll() throws IllegalArgumentException;


    public List<T> saveModifications(List<T> persons);
}
and
public interface IPersonServiceAsync<T> {
    void getAll(AsyncCallback<List<T>> callback) throws IllegalArgumentException;


    void saveModifications(List<T> persons, AsyncCallback<List<T>> callback);
}
The problem is that i shouldn't have used generics HERE in GWT. So:

  • either foget about <T> in the interface and method definitions and just use List<Person> in the methods definitions
  • keep the genericity but in a new couple of interfaces called IGenericService and IGenericServiceAync and then inherit from them:
public interface IPersonService extends IGenericService<Person> {
}
and
public interface IPersonServiceAsync extends IGenericServiceAsync<Person> {
}
   And in your code make sure you use the IPersonServiceAsync, not the generic version.


The answer by Bruno Marchesson to a similar pb (see bellow) says:
Looks like the RPC service signature declares that it returns an array of Object, which is forbidden by GWT serialization policy (too generic).
You should return an array of Pais instead.

The same happened in my case behind the scenes, even though i didn't have List<Object> as return type, but it finally got down to that and here is why.

The genericity is useful at compile time but the java class file bytes will not contain any type parameters information like T.
This is called type erasure. Instead, List<T> is replaced by List<Object> and here we are in exactly the same case.

The answer to the Exception
The answer is explained in this post by Bruno Marchesson in response to this original post.
The person in the original post signaled this well-known exception:

Caused by: com.google.gwt.user.client.rpc.SerializationException: Type '[Ljava.lang.Object;' was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized.

How i found these answers
I looked on the Gilead forum with these keywords "was not included in the set of types which can be serialized by this SerializationPolicy" and tried randomly until these 2 posts: the original and the response.

Also this post says a very interesting advice:

 I've found you have to be as
specific as possible when delaring your RPC methods and serializable
class fields. 

This post i founded googling with:
"Type * was not included in the set of types which can be serialized by this SerializationPolicy or its Class object could not be loaded. For security purposes, this type will not be serialized"

Tuesday, February 8, 2011

OnMouseDown in Firefox blocking OnMouseMove. Fix: add "return false;" in OnMouseDown

In your "onmousedown" event handler of a DOM element in Firefox (FF), make sure you add a "return false;" in case you have problems. That could solve your problem.

This was the solution in my case. I had a problem because not returning false from that handler caused the element "to be dragged by FF": that is, after i mousedown-ed on it and then started to move without releasing the mouse, FF initiaited that "draggable behaviour", like it does for the images, where the the element follows your mouse pointer and is a bit transparent.

So, while still with the mouse down:
  • FF initiaited that "draggable behaviour"
  • this was stopping document.onmousemove handler to act (that i had assigned in the onmousedown handler).
Releasing the mouse pointer had another strange effect:
  • onmouseup was also NOT triggered and,
  • just after that, document.onmousemove was "free" and acting.
So i ended up with the mouse up and document.onmousemove acting - which is not what i wanted.

I was implementing a kind of scroller(see code snippet bellow) where you mousedown the cursor of the scroll, move you mouse around to make the cursor move and then release the mouse and cancel the cursor move.
This is a snippet of the code that works; note the "return false;"


/*snippet of code, for all code email me*/

/*when mousedown-ing the cursor of the scroll, prepare the "real-time"
update of the cursor and content position(thanks to document.onmousemove).
I used jquery to avoid the differences between browsers
*/

$(cursor).mousedown(function(event){
    registerReferences(event);
    $(document).mousemove(scroll);
    return false;
});


/*this does the actual move of the cursor and the content we scroll with this scroller
*/

function scroll(event){
    var newValue = cursorTop + event.screenY - y;
    if (newValue < min) 
        newValue = min;
    else 
        if (newValue > max) 
            newValue = max;
    cursor.style.top = appendUnit(newValue);
    setContentMarginTop(newValue);
}


/*relasing the mouse cancels modification of the position of the cursor and content
*/

$(document).mouseup(function(event){
    $(document).unbind('mousemove');
});
...

Before adding "return false;", on the first mouse down and mouse up the scrolling worked. The above problem started the second time i tried to manipulate the scroll. So this must be a consequence of the very first onmousedown call not having returned false. The third and the n-th attempt behaved like the 2nd: not working.

I found the "return false;" mention here googling with "firefox drag disable". I tried it in my case and that did it.

Sunday, December 19, 2010

Welcome to the blog of theapplicationbox.com website.

Hi, I'm Vlad BALAN, from theapplicationbox.com The future posts will be my way to log various experiences i had related to JEE, HTML/CSS, Javascript/Ajax and other Java and webdesign subjects: workarounds, solutions, answers, etc. that i found on web explained by others and that should be known by many of us, developers.

Use "hibernate.hbm2ddl.auto=update" to update your schema (add remove columns, etc.) without losing data in tables.

Use <property name="hibernate.hbm2ddl.auto" value="update" /> to update your schema (add remove columns, etc...