piektdiena, 2013. gada 13. decembris

How I implemented tag input with spring.

I was using bootstrap (v.3.) CSS as my basis and first step was to find version of control wich is aiviable for that task. Control I found was Chosen (Check feedle here.). It has .v.3 support around and look like I wanted.
Next task was to get it work like this (I want to be able to select different roles for one user):


itemLabel="name" itemValue="id" id="select_role" data-placeholder="Choose a Role..."  class="form-control chosen-select" multiple="true" tabindex="4" >


And yes.... here is my entity definition:

@Entity
@Table(name="member", uniqueConstraints = @UniqueConstraint(columnNames = "email"))
public class Member implements Serializable {
/** Default value included to remove warning. Remove or modify at will. **/
private static final long serialVersionUID = 1L;

@Id
@GeneratedValue
private Long id;

@ManyToOne
@JoinColumn(name = "company_id")
private Company company;

@NotNull
@Size(min = 1, max = 25)
@Pattern(regexp = "[A-Za-z ]*", message = "must contain only letters and spaces")
private String name;

@JsonIgnore
private String password;

@NotNull
@NotEmpty
@Email
private String email;

@NotNull
@Size(min = 10, max = 12)
@Digits(fraction = 0, integer = 12)
@Column(name = "phone_number")
private String phoneNumber;

@JsonIgnore
@ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL)
@JoinTable(name = "member_roles", joinColumns = { 
@JoinColumn(name = "MEMBER_ID", nullable = false, updatable = false) }, 
inverseJoinColumns = { @JoinColumn(name = "ROLE_ID", 
nullable = false, updatable = false) })
private Set roles = new HashSet(0);

public Set getRoles() {
return roles;
}

public void setRoles(Set roles) {
this.roles = roles;
}

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getEmail() {
return email;
}

public void setEmail(String email) {
this.email = email;
}

public String getPhoneNumber() {
return phoneNumber;
}

public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}

public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

}


And role:

@Entity
@Table(name = "role")
public class Role implements Serializable {

/** Default value included to remove warning. Remove or modify at will. **/
private static final long serialVersionUID = 1L;

@Id
@GeneratedValue
private Long id;
@NotNull
@Size(min = 1, max = 25)
@Pattern(regexp = "[A-Za-z ]*", message = "must contain only letters and spaces")
private String name;
public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

@JsonIgnore
@ManyToMany(fetch = FetchType.EAGER, mappedBy = "roles")
private Set members = new HashSet(0);
public Set getMembers() {
return members;
}

public void setMembers(Set members) {
this.members = members;
}

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}
}

But when I try to put this at form I got conversation error because spring try to convert representation of role at string to role object itself. I had to teach Spring how to do that conversation:

public class StringToRole implements Converter {

@Autowired
private RoleDao roleDao;

@Override
public Role convert(String roleid) {
Role role = roleDao.findById(Long.valueOf(roleid));
return role;
}


}

And register converter in spring context:




class="org.springframework.format.support.FormattingConversionServiceFactoryBean">


pirmdiena, 2013. gada 28. oktobris

For myself to remember - how to start remote X session

username@hostname ~$ xhost +
access control disabled, clients can connect from any host

username@hostname ~$ export DISPLAY=:0.0

username@hostname ~$ ssh -Y remotusername@remotehost
remotusername@remote's password:

ceturtdiena, 2013. gada 10. oktobris

Implement java class search in FAR menus.

So to implement it you have to download java class search tool:
http://www.inetfeedback.com/jarscan/

Next you create new FAR menu iteam like this:

java -jar "C:\path_to_jarscan\jarscan.jar" -dir !\ -class !?Search for:?!

trešdiena, 2013. gada 9. oktobris

APC paper at my home

Today I got my purchased APC paper - http://apc.io/products/paper/

It is preloaded with android based firefox OS. Lot of things from software side do not work:
http://apc.io/8750-known-issues/

Also producer support as it apears is not so good as expected about drivers and source.

Let's see how it works.

ceturtdiena, 2013. gada 28. marts

OpenGrok - super tool for your source indexing.

In days my collegue pointed me, that there is software what could fulfill my long time dream - search engine and web for different project sources I am working on. Thank you Karlis !

Yes such tool exists and it's name is - OpenGrok

It alows you connect to different sources and do indexing of code. Then you can deploy tomcat application for search and result display.


It support many nice search and display options.

sestdiena, 2013. gada 23. februāris

Linux jornal 2005. - kādam vajag?

 Tīru māju un gribu tikt vaļā no 2005 gada (ir arī divi 2010 gada) Linux Joranal izdevumiem.

Ja kādam vajag dodiet ziņu.

ceturtdiena, 2013. gada 21. februāris

Jenkins and SVN.

As you probably know Jenkins saves password and username for SVN authentification.  If you ever decide to change password for that user, changing SVN authentification in Jenkins is not enough.
You also need to remove any cached authentification data for existing workspaces.

This is a way to do that:


@echo off
rmdir /s /q "%APPDATA%\Subversion\auth"

otrdiena, 2013. gada 15. janvāris

Skype uninstall

As recent skype version make me more and more trouble I move away from it. Best way to remove skype is here - http://community.skype.com/t5/Windows/I-can-t-uninstall-Skype/m-p/1242586

People who want to talk with me now can use xmmp enabled software like JITSI - https://jitsi.org/


pirmdiena, 2013. gada 14. janvāris

Jenkins install on Centos

What could be simpler than that??


sudo wget -O /etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.repo
sudo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key
sudo yum install jenkins
sudo service jenkins start/stop/restart