Microphone on Ubuntu Gutsy and HP 6710s

Yesterday at last I've figured how to properly configure microphone on ubuntu gutsy. Yes, it's sounds ridiculous, what is difficult in configuring microphone. Indeed it not so simple, if we can't find what's going on. I have HP 6710s laptop with sound card (lspci -v)
00:1b.0 Audio device: Intel Corporation 82801H (ICH8 Family) HD Audio Controller (rev 03)
and Ubuntu 7.10 Gutsy. Here are my settings from gnome-volume-manager (screenshots) that works with skype.


Arithmetic operation on a date


Next post about very obvious thing, but I've lost about 30 minutes to find out how to do it. So this post is some kind of note, for my information.
The problem was, how to get yesterday date from datefield. I use very nice component DataPicker from Microba Controls library which deliver calendar. Ok but back to topic. How to get a day before some date selected on that component, or day after, or back to today's date. Example:



// -1 day
try {
Calendar c = Calendar.getInstance();
c.setTime(dateField.getDate()); // set calendar date from field
c.add(Calendar.DATE, -1); // substract one day
dateField.setDate(c.getTime());
} catch (PropertyVetoException ex) {
ex.printStackTrace();
}
// today
dateField.setDate(new Date());
// + 1 day
try {
Calendar c = Calendar.getInstance();
c.setTime(dateField.getDate()); // set calendar date from field
c.add(Calendar.DATE, 1); // add one day
dateField.setDate(c.getTime());
} catch (PropertyVetoException ex) {
ex.printStackTrace();
}

JPA, Postgresql and auto increment id attribute


I'm still writing this stupid frontend for database. Really it's confusing when have to write piece of software only for student project. Never mind. I've left idea with web app written in jsp/jsf (god's know what else) and 've started a new project. It's also would be tv schedule, but now it would be a desktop app written using netbeans, swing, postgresql and jpa.
So, todays problem. How to insert new object into database? I've written the front controller for a model, with method addStacja that get a Stacjtv object as an argument.



public boolean addStacjatv(Stacjatv st) {
em = getEntityManager();
try {
em.getTransaction().begin();
em = getEntityManager();
try {
em.getTransaction().begin();
em.persist(st);
em.getTransaction().commit();
return true;
} finally {
em.close();
} em.persist(st);
em.getTransaction().commit();
return true;
} finally {
em.close();
}
}


simple code, nothing special. But every time, when I invoke it, I get exception:


Internal Exception: org.postgresql.util.PSQLException: ERROR: null value in column "id" violates not-null constraint
Error Code: 0
Call: INSERT INTO stacjatv (id, url, opis, nazwa) VALUES (?, ?, ?, ?)
bind => [null, fff, fff, ff]

well, Postgresql make auto increment using sequence. JPA doesn't know about it. I've googled and found solution in JPA Toplink Documentation. We have to tell JPA that we want to use sequence to generate next id value of primary key, so to solve the problem, we have to make some modification in model class.
I had to change Stacjatv.java which was generated by Netbeans creator. New version looks like it:

...
@Id
// start modyfication
@GeneratedValue(generator="stacjatv_id_seq",strategy=GenerationType.SEQUENCE)
// end
@Column(name = "id", nullable = false)
private Integer id;
...

Netbeans, postgresql, JPA and tutorial


I've started learning JSP, JSF and other stuff used to develop J2EE apps. Of course everything is standing on database, and with accessing to the postgresql database I had the biggest problem.



I start with tutorials founded on netbeans.com web site, 1st Using Java Persistence API Within a Visual Web Application, but unfortunately every time when I start application I got such error on glassfish console:


Local Exception Stack:
Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0 (Build b58g-fcs (09/07/2007))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: No suitable driver found for jdbc:postgresql://ldap.krajniak.test/lastvideo
Error Code: 0
(...)
com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
Caused by: java.sql.SQLException: No suitable driver found for jdbc:postgresql://ldap.krajniak.test/lastvideo
at java.sql.DriverManager.getConnection(DriverManager.java:602)
at java.sql.DriverManager.getConnection(DriverManager.java:154)
at oracle.toplink.essentials.sessions.DefaultConnector.connect(DefaultConnector.java:100)
... 97 more
sending notification to server...server

strange error, couldn't resolve it for 2 days, and at last today I resolved it. As I think, stupid bug, stupid error. How to resolve it? Very simple, you have to launch glass admin panel (e.g. right click on Service->Servers->GlassFish->View Admin Console), next click on Application Server and JVM Settings->Path Settings. In classpath type full path to postgresql .jar file, restart glassfish server and that's all. Tutorial apps now is able to connect to database :-)

1st

Hi there,
This blog is for improving my English, so don't be confused if you see here a lot of mistakes. Feel free to tell me about them.
Who am I?, so would be nice to introduce myself. I born in 1986, current I'm student of computer science at Poznan University of Technology.
Most of my entries probably would be about working with dotnetnuke framework.