Posts Tagged How-to

Why we don’t like public speeches and what can be done about it

Tags: , , , ,

The first step to eliminate your weaknesses is to realise that they exist and name them. I know I am not good when it comes to public speech. My diploma thesis is quite good, source code isn’t so bad at all, but the way I presented them in the front of people  who could say “Yes” or “No” to my degree, was really far away from the state I could summarize as “decent presentation”. In short:  it definitely wasn’t the best performance ever but probably was close to the worst one :)

And that’s why I recently bought an interesting book “Confesions of a Public Speaker” by Scott Berkun.

The most important thing you should know before you even consider buying this title is that:

Reading this book will NOT make you a better speaker, only practice can do it.

But this book will tell you why you should practice, what you should practice and how you could prepare to your speech to maximize probability of performing really well.

Continue reading this post …


Be Sociable, Share!

Wicket Tutorial, part 6 – listing locations in a simple manner

Tags: , , ,

Today we will add simple listing view for locations added to the database in previous posts.  I said ‘simple’ as there are some more sophisticated ways to show many items using Wicket but probably we will not have many locations to show in our application so simple view without pagination should be ok. More complicated way (DataTable component) will be covered in the future when we will add ‘listing items’ feature’.

Continue reading this post …


Be Sociable, Share!

Wicket tutorial, part 5 – generic unique entity validator

Tags: , , ,

As I promised in the previous post, today we will focus on transforming our unique name validator in Wicket to generic one. So now, let’s simply list what we are going to achieve;

  • validator should validate any entity object in our project
  • validator should check unique value of any property from validated object
  • error message should be generic too but customization should be easy

Continue reading this post …


Be Sociable, Share!

Wicket Tutorial, part 4 – custom validator for unique entity name

Tags: , , ,

Welcome back to our Wicket tutorial series! :) As I mentioned in previous post, today we will concentrate on building validator stopping user from adding item location with non-unique name. At first we will start with non-generic but working validator and then we will try to make is as flexible as possible. Ok, so let’s write some code!

Problem

As you might remember, currently we have Wicket form with basic validation checking existence of name field and whether its length is in proper range or not:

		Form<AddLocationPage> addLocationForm = new Form<AddLocationPage>("addLocationForm",
				new CompoundPropertyModel<AddLocationPage>(this));
		add(addLocationForm);

		Label nameLabel = new Label("nameLabel", "Location name");
		addLocationForm.add(nameLabel);

		RequiredTextField<String> nameField = new RequiredTextField<String>("name");
		nameField.add(LengthBetweenValidator.lengthBetween(MIN_LOCATION_NAME_LENGTH, MAX_LOCATION_NAME_LENGTH));
		addLocationForm.add(nameField);

		Button submitButton = new Button("submitButton") {
			@Override
			public void onSubmit() {
				Location location = new Location(name);
				locationService.save(location);

				getSession().info("Location added successfully");
				setResponsePage(LocationsPage.class);
			}
		};
		addLocationForm.add(submitButton);

Continue reading this post …


Be Sociable, Share!

Wicket Tutorial, part 3 – first form in our application

Tags: , , , , ,

Hello Visitor :) In previous posts we created base project and added common layout to ItemDirectory Wicket application. Today we are going to add first form to allow users to insert some data into our application.

As main feature of ItemDirectory is to manage information where items (books, movies, music, postage stamps) are stored in our home/work, the first data we need to know are locations where we actually can store those things. So we start with adding table, entity and form to manage locations of our precious items.

Database, entity and DAO

First thing we need is locations table in database and entity mapping class:

- sql create table script listing:

create table locations (
	id bigint(20) not null auto_increment,
	name varchar(255) not null,
        PRIMARY KEY (id),
	UNIQUE KEY unique_name (name)
);

- entity class listing:

@javax.persistence.Entity
@Table(name = "locations")
public class Location extends AbstractEntity {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
   @Column(length=255, nullable=false)
    private String name;
        protected Location() {
		super();
	}
	public Location(String name) {
		super();
		this.name = name;
	}
	// getters, setters omitted
}

As you can see, Location class is very simple: only one field, but the only thing we want at the moment from this entity is a name describing where item is stored. Is it “Bookcase in living room, second drawer from the top” or “Cabinet in the saloon, top bookshelf”.

Continue reading this post …


Be Sociable, Share!

Wicket Tutorial, part 2 – adding common layout to the project

Tags: , , , , ,

Hello everyone! In the previous post we set up base project using Wicket for out future development of ItemDirectory web application. That post, which was intended to be mainly about Wicket, surprisingly gathered some attention amongst Spring fans and was even mentioned in weekly summary at SpringSource.com. Nice! :)

Ok, enough about the past. Today we are going to add some nice common layout to ItemDirectory. Go go go! :)

The layout

As winning “The best designed web application ever” award is not the purpose of this tutorial, I didn’t want to spend a lot of time on creating beautiful layout. After a short search in Google results I found nice free template which seems to suit well to our tutorial needs:

Author of this free template is Spyka and you can download it from here. There you can find two other colour variations of our template ( if you don’t like orange :) ) and many others to choose from if you want to choose completely different one.

Continue reading this post …


Be Sociable, Share!