lördag 29 december 2012

play framework jpa join two tables

http://stackoverflow.com/a/7873969/517457

Every time you have a field names "xxxId" in an entity, and "xxxId" is the ID of another entity, you did something wrong. The point of JPA is to manipulate objects, and associations between objects using object references or object collections.
Your tbl_lookup_user_major looks like a join table to me. Such a join table means that you have a many-to-many (or one-to-many, is one of the IDs is unique) between Major and User. So, your Major entity should have the following field :
@ManyToMany
@JoinTable(...) // details omitted
private Set<User> users;
And your JPA query should look like
select m from Major m
inner join m.users user
where user.id = :userId

torsdag 27 december 2012

limit bandwidth on dd-wrt router

http://markmaunder.com/2011/01/26/how-to-reliably-limit-the-amount-of-bandwidth-your-room-mate-or-bad-office-colleague-uses/



tisdag 25 december 2012

reload .bashrc after changes

http://askubuntu.com/a/152463

Please place those lines -
export PATH=$PATH:/to/path/play
, in .bashrc file in your user directory and restart the system OR just execute the following command:
source ~/.bashrc

onsdag 5 december 2012

Getting the response header

http://stackoverflow.com/a/2444499/517457


$(document).ready(function() { 
    $("[name='submit']").click(function() { 
        $.ajax({
            type: "POST",
            data: $(".form-signup").serialize(),
            url: "external.asp", 
            success: function(output, status, xhr) { 
              alert(xhr.getResponseHeader("Content-Length"));
            },
            error: function(output) {
              $('.sysMsg').html(output);
            }
        }); 
    }); 
});