Author Archives: mee

Dynamic for with Spring MVC using a HashMap

Sometime you need to dynamically generate a form without knowing how many fields it will be required (i.e. when your form is driven by a configuration or by some properties). The problem is to draw the form and, return the values to the Controller, and recognize the couples Field name / Field value after the submit..

You can easily get solve this problem just adding HashMap which will hold the key-value pair data to the DataModel.

Supposing your configuration says: you have to draw two fields and these are the name, you UI will be something like*:

<c:forEach items="${newRequest.fields}" var="field">
	<f:input type="text" path="rawFields['${field.field_id}']" class="form-control validate[groupRequired[mandatoryField]]" /> (R)
</c:forEach>

When you submit the form, the values and the key for the dynamic fields will be filled.

* newRequest is the DataModel you are passing and fields is the list of Fields that user will fill with data, like that:

public class Request {
 
	/** Request type */
	private int templateRequest;
 
	// ***** Input field ***** 
	List<RequestField> fields = new ArrayList<RequestField>();
 
	private HashMap<String, Object> rawFields = new HashMap<String, Object>();
 
	[Setters and getters]
 
}
Tagged , , ,

Check your six

Eh… Caption not necessary.

Apply jQuery datepicker to multiple instances

To add multiple instance of jQuery datepicker (or timepicker), it is possible to use class instead of the ID to initialize the widget in particular when the form is generated from the backend and the exact number of field is not known.

The html code will be:

<input type="text" class="datepicker" id="date1" />
<input type="text" class="datepicker" id="date2" />
<input type="text" class="datepicker" id="date3" />

The jQuery script will be:

$('.datepicker').each(function(){
    $(this).datepicker();
});

Remember to include jquery and jquery-ui scripts to the page.

Tagged , , ,

Leadership

The milestone of the leadership: Feb 5, 1995

Feb 5, 1995

Tagged

Disaster recovery

A disaster recovery plan (DRP) is a documented process or set of procedures to recover and protect a business IT infrastructure in the event of a disaster.

6844.strip_

Background

What do you actually mean with “Unfortunately, your background isn’t exactly what our client is looking for at this time”? It’s IT not old style industry!

dilbert2008073346229

On the Nature of Software

I never think about this:

Software is remarkable stuff. Sometimes, perhaps because we work with it all the time, we forget just how remarkable it is.
Very little else in human experience is as malleable, allowing us free rein to exercise our ingenuity and inventiveness almost without limits. Also, with a very few exceptions that we’ll cover later, software is deterministic—the next state is completely determined by the current state, and (crucially) we have com- plete access to all of that state whenever we want it.
Compared to traditional engineering, we are spoiled. What do you think a Formula One engineer would give to be able to instantaneously stop an engine when it’s rotating at 19,000 revolutions per minute and examine every aspect of it in minute detail? To see the precise state of each component while under pressure and stress, for example, or to dynamically record the shape and position of the flame front within the combustion chambers during ignition?
It is exactly this kind of trick that we are able to perform with our software, which is why the empirical approach is particularly powerful when debugging. [from book Debug It!]

Con parole mie

Purtroppo apprendo solo oggi (causa un accumularsi di podcast non ascoltati) che la trasmissione Con parole mie dopo 15 anni, è ahimè terminata. Ancora una volta la RAI ha perso qualcosa di un valore inestimabile e che ne fra precipitare la qualità (già peraltro minata) sempre più in basso.

Grazie Professor Broccoli, grazie Maestro Bernardini, grazie Alfredo Provenzali, per aver contribuito per anni a rendere Radio Rai un posto un po’ meno inudibile. Vi ricorrerò per sempre!

Omnia munda mundis

Software archeology

l

Yeah, it happens… every single day of my life….

(Image owned by geek-and-poke.com)

Tagged