Category: Java

Unable to reference local variable with JsonBuilder

January 3, 2014 at 11:59 pmCategory:Java

I have the following code

The addTicketCommand object is not null on line 2 yet is undefined within the JsonBuilder closure. Is it not possible to access local variables in groovy from within closure?

You should be able to access addTicketCommand inside the closure as below. Mark the use of “parenthesis” instead of “curly” braces.

Download only email subject in JavaMail & imaps

October 22, 2013 at 10:57 pmCategory:Android | Java

I’m trying to download only subject of emails, because it should take less time (downloading ~10 emails with photos take approximately 10 min :/).

Code that I’m now using is:

it seems to me that you should look into prefetching the messages with:

LinearLayout dynamically display depending on a given number

October 11, 2013 at 10:58 pmCategory:Java

I want to create a method that can dynamically display LinearLayout in a LinearLayout moreover that is located in a specified area in my Android application, the number of this linear layout changes depending on a given number.

Also, in each LinearLayout I want to display a Button & below it a TextView.

Here is the method I have already created:

you just need to set the layoutparams

}

Hibernate: How to get full sql query for session.save method?

October 1, 2013 at 10:58 pmCategory:Java

I’m saving new object via Hibernate. What I would like to obtain is full sql query which was use. In debug Im getting query with “?” .

How to obtain same query with values.

K.

This is from my log4j configuration (Hibernate 3.6.8).

log4j.logger.org.hibernate.SQL = DEBUG, C

log4j.logger.org.hibernate.type.descriptor.sql.BasicBinder = TRACE, C

log4j.appender.C = org.apache.log4j.ConsoleAppender

log4j.appender.C.layout = org.apache.log4j.PatternLayout

log4j.appender.C.layout.ConversionPattern = [%d{dd MMM yyyy HH:mm:ss,SSS}] %-5p %C.%M : %m%n

SQL has the logger for the SQL statement (you need to set it to DEBUG level) & BasicBinder the logger for the actual parameters (TRACE level)

JFrame doesn't add TabbedPane

September 30, 2013 at 10:58 pmCategory:Java

My JFrame is not adding the JTabbedPane & I don’t know if the crash is some sort of bug of my eclipse. There are no syntaxes errors or anything that seems to be to me wrong. Could anyone else try to run it & see if it works? The code is already ready to run. Thanks in advance

You’ve added JMenuBar in Content pane. It is not required.

remove this line in your code mainFrame.add(bar); & mainFrame.setJMenuBar(bar); is already added.