How to expose my localhost to the WWW?

I am showing how easy we can expose tomcat or any other server which is running on localhost (machine).

Most often developers want to show their application which is running on their laptop(localhost) to expose it outside (WWW) for demo purpose.

Here i am running my openbravo (J2eeWeb Application) running on my tomcat in port 80. I am going to expose my port 80 to www , so that my client would be able to access my application and do the testing of my development.

Steps i followed,

  1. Download and install Python 2.7
  2. Download to your Desktop
  3. Run the program!
  4. register your ip  quickstart

How To Disable Startup Applications In Windows

Step 1

Click the Start Menu Orb then in the search box Type msconfig and Press Enter or Click the msconfig.exe program link.

launch msconfig.exe from the start menu in windows 7

Step 2

From within the System Configuration tool, Click Startup tab and then Uncheck the program boxes that you would like to prevent from starting when Windows starts.  Click OK to save changes when you are done.

manually select  which programs you would like to disable from auto-start

Step 3

Now that you’ve saved changes Restart Windows and the selected programs should no longer automatically start up.

restart windows 7 to save msconfig changes

That’s all there is to it!


Source: How To Disable Startup Programs In Windows 7 and Vista


JPA Notes

Java Persistence API

An entity class must follow these requirements.

  • The class must be annotated with the javax.persistence.Entity annotation.

  • The class must have a public or protected, no-argument constructor. The class may have other constructors.

  • The class must not be declared final. No methods or persistent instance variables must be declared final.

  • If an entity instance is passed by value as a detached object, such as through a session bean’s remote business interface, the class must implement the Serializable interface.

  • Entities may extend both entity and non-entity classes, and non-entity classes may extend entity classes.

  • Persistent instance variables must be declared private, protected, or package-private and can be accessed directly only by the entity class’s methods. Clients must access the entity’s state through accessor or business methods

Entities may use persistent fields, persistent properties, or a combination of both. If the mapping annotations are applied to the entity’s instance variables, the entity uses persistent fields. If the mapping annotations are applied to the entity’s getter methods for JavaBeans-style properties, the entity uses persistent properties.

If the entity class uses persistent fields, the Persistence runtime accesses entity-class instance variables directly. All fields not annotated javax.persistence.Transient or not marked as Java transient will be persisted to the data store.

Mapping annotations cannot be applied to fields or properties annotated @Transient or marked transient.

Using Collections in Entity Fields and Properties:

If a field or property of an entity consists of a collection of basic types or embeddable classes, use the javax.persistence.ElementCollection annotation on the field or property.

The two attributes of @ElementCollection are targetClass and fetch. The targetClass attribute specifies the class name of the basic or embeddable class and is optional if the field or property is defined using Java programming language generics. The optional fetch attribute is used to specify whether the collection should be retrieved lazily or eagerly, using the javax.persistence.FetchType constants of either LAZY or EAGER, respectively. By default, the collection will be fetched lazily.

When using Map elements or relationships, the following rules apply.

  • The Map key or value may be a basic Java programming language type, an embeddable class, or an entity.

  • When the Map value is an embeddable class or basic type, use the @ElementCollection annotation.

  • When the Map value is an entity, use the @OneToMany or @ManyToMany annotation.

  • Use the Map type on only one side of a bidirectional relations

Bean Validation constraints may be applied to persistent entity classes, embeddable classes, and mapped superclasses. By default, the Persistence provider will automatically perform validation on entities with persistent fields or properties annotated with Bean Validation constraints immediately after the PrePersist,PreUpdate, and PreRemove lifecycle events