Hey everyone I'm trying to get a List of directories. I'm using FileUtils listFiles().
I want to do something like this: listFiles(File,IOFileFilter,false). My real questions is how I can implement the accept() from the IOFileFilter so I can check if current File is a directory?
Thank you in advance.
Ok, a friend of mine go back and forth on what "interface" means in programming.
What is the best description of an "interface".
To me an interface is a blueprint of a class, is this the best definition?
I'm doing a code review and I noticed such a code:
@Entity
@Table(name = "SOME_TABLE")
public class SomeReportClass {
@Column(name = "REPORT_NUMBER", length = 6, nullable = false)
private String reportNumber;
.....
public String getReportNumber() {
return reportNumber;
}
public void setReportNumber(String reportNumber) {
this.reportNumber = StringUtils.trimToNull(reportNumber);
}
}
Every time I see trimming inside of a setter I feel that its not the clearest solution - what is the general practice with that issue?
Is ther any way to get data from other sites and display in our jsp pages dynamically.
http://www.dictionary30.com/meaning/Misty see this url
in that one block is like
Wikipedia Meaning and Definition on 'Misty'
In that block they are fetching the data from Wikipedia and displaying into dictionaly30.
Question:
How they are fetching wiki data to their site.?
I need to display data like that in my jsp page by fetching from other site.
I am trying to use Hibernate pagination for my query (PostgreSQL )
i set setFirstResult(0), setMaxResults(20) for my sql query. My code like below:
Session session = getSessionFactory().getCurrentSession();
session.beginTransaction();
Query query = session.createQuery("select id , customer_name , address from tbl_customers ");
query.setFirstResult(0);
query.setMaxResults(20);
List<T> entities = query.list();
session.getTransaction().commit();
but when viewing SQL hibernate log, i still see full sql query:
Hibernate: select customer0_.id as id9_, customer0_.customer_name as dst2_9_, customer0_.addres as dst3_9_ from tbl_customers customer0_
Why there is no LIMIT OFFSET in query of Hibernate pagination SQL log?
Does anyone know about Hibernate pagination mechanism?
I guess that Hibernate will select all data, put data into Resultset, and then paging in Resultset, right?
I'm starting with a new project where we'll be using OpenCms. Can the workplace be integrated to an IDE, and which one is it ?
Can you suggest me any tutorial or ebook by the way?
I am using swing to create my GUI. J have a JFrame containing one main JPanel which, in its turn contain several JPanels which, in their turn, contain buttons.
I would like to set certain sizes to mu buttons and JPanels. How does it work? Should I set sizes of my buttons and then the size of the JPanel and the JFrame will be set according to the buttons sizes? Or it works in the opposite direction? I set size for the JPanel and the size of the buttons will be set automatically?
Any ideas? I can sort an array. But not in this pattern? It needs to sort by the pattern I mentioned above.
public void wackySort2(int[] nums) {
int sign = 0;
int temp = 0;
int temp2 = 0;
for (int i = 0; i < nums.length; i++) {
for (int j = 0; j < nums.length - 1; j++) {
if (nums[j] > nums[j + 1]) {
temp = nums[j];
nums[j] = nums[j + 1];
nums[j + 1] = temp;
//sign = 1;
System.out.println("Something has been done");
}
}
}
}
We are looking for Web Designers & Developers. Urgent Opening.
Profile:-
a) Have exp. in Designing websites in wordpress
b) Have Creativity in work
c) Send us your work – [email protected]
d) Min Exp. required: 2 + years
e) Can Integrate the Facebook, Twitter & other social networking websites.
To review our profile – please check – www.dicorporation.com & www.ismoip.com
Hello Team,
I am using the below code in my application ...
Process process = Runtime.getRuntime().exec(
"perl " + perlScript + " " + project + " " + fileName);
:
:
:
result = process.waitFor();
:
:
and this result gives the code 2 every time.....while running the application.
what could be the reason for the "reason code" ???
Thanks In Advance
I expect it should share a common description, like XmlSchema or IDL and should generate classes for target language.
I found Thrift and it's really nice solution, but it doesn't support structures polymorphism.
I would like to have collections of base class objects, where I could place instances of subclasses, serialize this and deserialize at the opposite side. Some mechanism of polymorphic behavior support, like Visitor, would be a perfect.
Does anybody know something suitable for these requirements?
I have come across a class that has an immutable property:
MyObject[] allObjs
The property is initialized like this:
List<MyObject> objs = createAllMyObjects();
allObjs = objs.toArray(new MyObject[objs.size()]);
When it is exposed through the accessor, it's done as a List:
public List<MyObject> getAllMyObjects() {
return Collections.unmodifiableList(Arrays.asList(allObjs));
}
Why would a programmer do this? Is there a benefit that I don't know about?
Performance is not a concern, as the array of objs will only ever number in a few dozen elements.
It seems that we are going round and round in circles.
The class is a sort of factory, so it's got a private constructor and exposes only static methods (not sure if this could be a reason for the madness).
I am trying to make an android app that makes connection with bluetooth device. It works fine but when I call BluetoothSocket.connect() and it is not able to connect to devise its blocking. The thread and does not throw any exception. So when I try to close application while connect() is running its not responding. How can I cancel it? Used BluetoothSocket.close() in ... but still its not working for me.
protected void simpleComm(Integer port) {
// The documents tell us to cancel the discovery process.
try {
Method m = mmDevice.getClass().getMethod("createRfcommSocket", new Class[] { int.class });
mmSocket = (BluetoothSocket) m.invoke(mmDevice, port);
mmSocket.connect(); // <== blocks untill is not connected
Log.d(TAG, " connection success===");
}catch(Exception e){
if (!abort) {
connectionFailed();
// Close the socket
try {
mmSocket.close();
// Start the service over to restart listening mode
BluetoothService.this.start();
} catch (IOException e2) {
Log.e(TAG,"unable to close() socket during connection failure", e2);
}
}
return;
}
}
public void cancel() {
try {
abort = true;
mmSocket.close();
} catch (IOException e) {
Log.e(TAG, "close() of connect socket failed", e);
}
}
After writing all the comments inside the code about the javadoc such as
/**
* This method compares the student's answer to the standard answer * @param ans The student's answer
* @return True for correct answer; False for incorrect answer
*/
boolean compareAnswer(int ans);
I guess it starts with :
javadoc [optionss] [packages|files]
I'm not sure what is the regular or default [option] and how can I say to produce it in my current home directory?
Hello!! i need your help! this is my code, it not so good as i wander - it is not working. i have not idea anymore.
</code>// need to get next parameter
static double getParametr(){
Scanner scanner = new Scanner(System.in);
param = scanner.nextDouble();
return param;
}
..........
................
if (i==1){
System.out.println("vvedite storoni pryamougolnika: ");
Shape parA = new Rectangle();
parA.a = Shape.getParametr(); --- this is ok
double aa = parA.a;
Shape parB = new Rectangle();
parB.b = Shape.getParametr(); ------ this is no work!!!
double bb = parB.b;
Rectangle rec = new Rectangle(aa, bb);
arrayFigur[i] = rec.area();
}
how fix mistake?
Hi,
I have this code that works just fine on the development server but
when I deploy the application, the session isn't created.
What am I doing wrong?
HttpSession session = req.getSession(true);
session.setAttribute("loggedIn", new String("true"));
Edit:
The sessions are enabled.
What I realized now is that the _ah_SESSION variable is not being
created, not even on the development server (although it works).
Hi
I want to know that can two different jvm run in the same machine?
I also want to know more about jvm working.Can any one provide some useful links.
Thanks