In Python, I can do this:
>>> import string
>>> string.letters
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
Is there any way to do something similar in Clojure (apart from copying and pasting the above characters somewhere)? I looked through both the Clojure standard library and the java standard library and couldn't find it.
Simple example: we have string "Some sample string Of Text". And I want to filter out all stop words (i.e. "some" and "of") but I don't want to change letter case of other words which should be retained.
If letter case was unimportant I would do this:
str.toLowerCase().replaceAll ("a|the|of|some|any", "");
Is there an "ignore case" solution with regular expressions in java?
I am scrapping data from web site using my java application and want to display the result after parsing code of html page in a Text Area made in Swing.
Text like: hello <b>every</b>one should be displayed as: 'hello everyone' in text area.
Thanks!!
I have a xml document like this rootXMLDoc=<root></root> . I need to insert paramxmlDoc= <parameter par='1'>abc</parameter>. how to insert paramxmlDoc to rootXMLDoc in java.?
I have a Class<? extends Annotation> and tried calling newInstance() but Java yelled at me for the obvious reason that I can't instantiate an interface. But I know frameworks like EasyMock are perfectly capable of instantiating interfaces. What would it take to get a completely dumb Annotation instance out of my Class?
Hi all,
Most google results for sample questions/problems for java, results in a link directing to mock certification questions. Does anyone know where can i find sample problems for practice ?
Thanks
What are the best practices for using Java's @Override annotation and why?
It seems like it would be overkill to mark every single overridden method with the @Override annotation. Are there certain programming situations that call for using the @Override and others that should never use the @Override?
Is there a method in JDK or apache commons to "pop" a list of elements from a java.util.List? I mean, remove the list of elements and return it, like this method:
public Collection pop(Collection elementsToPop, Collection elements) {
Collection popped = new ArrayList();
for (Object object : elementsToPop) {
if (elements.contains(object)) {
elements.remove(object);
popped.add(object);
}
}
return popped;
}
I'm having trouble with a JVM running an app, whose heap memory looks like a comb. It's constantly jumping from 1.5 GB to 3 GB and slowly deteriorating to higher values. I'm using G1 GC algorithm, but have no idea how to configure it.
I do not have access to the code of the app I'm running and, needless to say, it's a rather large app.
So, bottom line, does anyone know of a good guide to configure GC in Java?
Hi guys.
First I want to say is that I am 37 years old and not from programmer background (actually from biology). And my question is should I start learning Java? I have coded in PHP and JavaScript for a year and a half. Every answer would be appreciated.
Thanks in advance
Bobi.
For example:
a) int [x][y][z]
vs
b) int[x*y*z]
Initially thought i'd go with a) for simplicity
I know that Java doesn't store arrays linearly in memory like C does. But what implications does this have for my program?
Hi all,
I am tyring to merge an .mov file with a .wav file using java media framework, thus I need to know their duration. How can I do this? Any ideas would be appreciated..
Is there a "best" or more popular database for standalone Java app?
I'm currently writing by hand, but I would like to know what is commonly done, if there is something that is commonly done.
I have no experience with MongoDB and we are trying to port a JPA application to be based on MongoDB. There are 3 drivers mentioned for porting java here. Which driver would be the easiest to use for converting my existing JPA application? Would it be morphia, mungbean or daybreak. Would prefer some practical experiences with users who have gone through this path before.
I have a small Java Swing application that I want to rewrite in WPF .NET.
The application uses a JTable with an AbstractTableModel and a custom TableCellRenderer. I use my custom cell renderer to display the objects in two rows.
What is the corresponding WPF .NET component to JTable?
in java what is the syntax for commenting out multiple lines?
i want to do something like:
(comment)
LINES I WANT COMMENTED
LINES I WANT COMMENTED
LINES I WANT COMMENTED
(/comment)
I need a Java code that takes tab delimited info from a file to a displayed table. The user should be able to click a row and update it, this is followed by updating the file. The code should use Swing objects.
This is sort of the Java analogue of this question about C#.
Suppose I have a String object which I want to represent in code and I want to produce a string literal that maps to the same thing.
I was just about to write a state machine that ingests the string character by character and escapes appropriately, but then I wondered if there was a better way, or a library that provides a function to do this.
Java Servlets - How do I detect if a user is from a mobile device?
I'm using the TinyMCE javascript editor, and it doesn't work on the iphone. How can I detect if the user is coming from a mobile device?
Hi,
I am doing a project in which i require btree or b+tree data structure. but its not an important part of project. it would take my time to write a code for it. I googled it but didn't get anything....
So, can anyone provide java code for btree or b+tree implementation (with insert, delete, search algorithms)??????
it should accept string as input and form btree or b+tree of these string.
I'm relatively new to Java coding, and was looking for some help. I have a capital letter defined in a variable string, and I want to output the next and previous letters in the alphabet. For example, if the variable was equal to C, I would want to output B and D.
Thanks in advance for any help.
Say I have the following piece of java code
ArrayList<Double> myList = new Double[100];
for (Double x : myList)
x = randomDouble();
Does this actually modify myList or just the dummy variable?
I realize I should just try this code segment out, but I think this is the sort of thing I should be able to google or search for on this site, and several queries so far have turned up nothing useful.