This could be useful to have a graphical view of how much space a component is taking on the screen.
class JComponent
def create_border
setBorder(BorderFactory.createLineBorder(Color.black))
end
end
This could be useful to have a graphical view of how much space a component is taking on the screen.
class JComponent
def create_border
setBorder(BorderFactory.createLineBorder(Color.black))
end
end
Here’s how you set a color, defined in your colors.xml, from code:
textView.setTextColor(getResources().getColor(R.color.red));
I received this exception:
Exception in thread "main" org.hibernate.SessionException: Session was already closed
A solution is presented in this post. Another solution would be to modify your code to use this:
HibernateUtil.getSessionFactory().openSession();
the first time, instead of :
HibernateUtil.getSessionFactory().getCurrentSession();
The above solution was found on this stackoverflow answer
If you receive this error, Initial SessionFactory creation failed.java.lang.NoClassDefFoundError: javax/persistence/JoinTable, make sure you have the ejb3-persistence.jar added to your classpath.
The package attribute in <hibernate-mapping package=”some.package”> is used so that you can write:
<hibernate-mapping package=”h1″>
<class name=”Whatever” table=”WHATEVER”>
<id name=”id” column=”WHATEVER_ID”>
<generator class=”native”/>
</id>
</class>
</hibernate-mapping>
instead of:
<hibernate-mapping>
<class name=”h1.Whatever” table=”WHATEVER”>
<id name=”id” column=”WHATEVER_ID”>
<generator class=”native”/>
</id>
</class>
</hibernate-mapping>
This will appear if you didn’t define the current_session_context_class property. One possible way of fixing this would be adding:
<property name=”current_session_context_class”>thread</property>
to your hibernate.cfg.xml
Here’s how:
URLConnection a = new URL("http://insertWebsiteAddressHere").openConnection();
System.out.println(a.getContentLength());
Suppose you have a ResultSet and you want to find out how many columns it holds. Here’s how you do it:
ResultSet rs = statement.executeQuery();
ResultSetMetaData metaData = rs.getMetaData();
int numberOfColumns = metaData.getColumnCount();