I'd like to block all characters from being inputed except 0-9,a-z,A-Z range only alphanumeric characters. So when someone types ! for examplee nothing is written into input. How can I do that?
When I try to use assertNotLesser or assertNotGreater I get compile error .. and eclipse suggest me to create a new method called like this .. http://junit-addons.sourceforge.net/junitx/framework/ComparableAssert.html I found it here I never used these options before but I need to write this test, I can do it jmock as well but I don't know how .. I need to compare my expected results let say 0, if the real result is greater that the test should fail.
Hello I'm writting junit test how can I test this method .. this is only part of this method :
public MyClass{
public void myMethod(){
List<myObject> list = readData();
}
}
How will I make the test for this? ReadData is a private method inside MyClass?
If I have 6 modules in my project is it possible to build only one out of six ? without commenting out others ?
EDIT
Submodule will not work itselft because or parent tags. I need to install the parent first to make it build. how can I do it without installing parent
Is it possible to generate comments for closing div tags, lets take this ex. into consideration normal HTML:
<div id="content">
...
...buch of html or whateve
</div>
with comments :
<div id="content">
...
...buch of html or whateve
</div><!--End of content-->
and so on go trough each div element and comment the end of it ?
I have a class that implements Runnable and am currently using an Executor as my thread pool to run tasks (indexing documents into Lucene).
executor.execute(new LuceneDocIndexer(doc, writer));
My issue is that my Runnable class creates many Lucene Field objects and I would rather reuse them then create new ones every call. What's the best way to reuse these objects (Field objects are not thread safe so I cannot simple make them static) - should I create my own ThreadFactory? I notice that after a while the program starts to degrade drastically and the only thing I can think of is it's GC overhead. I am currently trying to profile the project to be sure this is even an issue - but for now lets just assume it is.
Hello everyone, I have this string :
<meis xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" uri="localhost/naro-nei" onded="flpSW531213" identi="lemenia" id="75" lastStop="bendi" xsi:noNamespaceSchemaLocation="http://localhost/xsd/postat.xsd xsd/postat.xsd">
How can I get lastStop property value in JAVA?
This regex worked when tested on http://www.myregexp.com/
But when I try it in java I don't see the matched text, here is how I tried :
import java.util.regex.Pattern;
import java.util.regex.Matcher;
public class SimpleRegexTest {
public static void main(String[] args) {
String sampleText = <meis xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" uri=\"localhost/naro-nei\" onded=\"flpSW531213\" identi=\"lemenia\" id=\"75\" lastStop=\"bendi\" xsi:noNamespaceSchemaLocation=\"http://localhost/xsd/postat.xsd xsd/postat.xsd\">";
String sampleRegex = "(?<=lastStop=[\"']?)[^\"']*";
Pattern p = Pattern.compile(sampleRegex);
Matcher m = p.matcher(sampleText);
if (m.find()) {
String matchedText = m.group();
System.out.println("matched [" + matchedText + "]");
} else {
System.out.println("didn’t match");
}
}
}
What is the best way to achieve cross-browser(ff,ie6,chrome,opera,safari) curved corners on a div. I found this article http://jonraasch.com/blog/css-rounded-corners-in-all-browsers and I've followed instructions step by step multiple times, here is my css :
#content_wrapper{
-moz-border-radius:25px 25px 25px 25px;
-webkit-border-radius: 25px;
-khtml-border-radius: 25px;
border-radius: 25px;
background-color:#F2DADC;
border:25px solid #ECD3D5;
height:780px;
opacity:0.7;
width:747px;
margin:0px auto;
position:relative;
display:block;
zoom:1;
}
<!--[if lte IE 8]>
<style>
#content_wrapper{
behavior: url(template/css/border-radius.htc);
border-radius: 20px;
}
</style>
<![endif]-->
Can somebody point me what am I doing wrong or is there a better way to achieve the same effect, its working in all browsers except in IE
I'm trying to read in a multi line string then split it then print it .. here is the string :
1T1b5T!1T2b1T1b2T!1T1b1T2b2T!1T3b1T1b1T!3T3b1T!1T3b1T1b1T!5T1*1T
11X21b1X
4X1b1X
When I split the string with ! I get this without the last line string :
1T1b5T
1T1b5T1T2b1T1b2T
1T2b1T1b2T1T1b1T2b2T
1T1b1T2b2T1T3b1T1b1T
1T3b1T1b1T3T3b1T
3T3b1T1T3b1T1b1T
1T3b1T1b1T5T1*1T
5T1*1T11X21b1X
11X21b1X
Here is my code :
import java.io.BufferedInputStream;
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner stdin = new Scanner(new BufferedInputStream(System.in));
while (stdin.hasNext()) {
for (String line : stdin.next().split("!")) {
System.out.println(line);
for (int i = 0; i < line.length(); i++) {
System.out.print(line.charAt(i));
}
}
}
}
}
Where did I make the mistake, why is not reading in the last line? After I read in all lines properly I should go trough each line if I encounter number I should print the next char the n times the number I just read, but that is long way ahead first I need help with this. Thank you
I am building a RESTful data store and leveraging Conditional GET and PUT. During a conditional PUT the client can include the Etag from a previous GET on the resource and if the current representation doesn't match the server will return the HTTP status code of 412 (Precondition Failed). Note this is an Atom based server/protocol.
My question is, when I return the 412 status can I also include the new representation of the resource or must the user issue a new GET? The HTTP spec doesn't seem to say yes or no and neither does the Atom spec (although their example shows an empty entity body on the response). It seems pretty wasteful not to return the new representation and make the client specifically GET it. Thoughts?
I have a following HTML :
<ul class="someclass">
<li id="1">
<button type="button" class="grey"></button>
</li>
<li id="2">
<button type="button" class="grey"></button>
</li>
<li id="44">
<button type="button" class="grey"></button>
</li>
<li id="54">
<button type="button" class="grey"></button>
</li>
</ul>
Now here is what I'm trying to accomplish with jquery :
When button is clicked to find out id of parent li, here is how I tried and failed:
$(".grey").live('click', function(){
alert($(this).parents("li").attr("id"));
alert($(this).parents("li:first").attr("id"));
});
Both give me null alerted, how can I do this ?
Has anyone expirience this error before: this happens when I hit CTRL + space , here is the error :
For those who has tinyurl blocked: This compilation unit is not on the build path of the java project.
This is a maven project, mvn eclipse:eclipse doesn't help I mean it compiles and runs just fine just something is wrong and I can't figure out what. I checkouted this project from SVN, it wasn't developed on my PC.
What would you say are these kind of questions good way to improve your skills or just waste of time since they have no application in real life(or not).
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=3
How to get number range in java? for instance how can verify is the number 2389 within 10 numbers from 2400. its not but 2389 is.
Ok here is the rephrase :
Number 1000 is the range number 990 is comming in the loop, I return true because the between 990 and 1000 is 10 numbers diference.
In comes the next number 989 range is always 1000, I return false because the between 989 and 1000 is 11 numbers diference.
In comes the next number 1013 range is always 1000, I return false because the between 1013 and 1000 is 13 numbers diference.
Is there a difference between these ?
if(myString.equals("")){
}
if(myString.equals(null)){
}
if(myString == ""){
}
I have a string, I don't know is it empty or has some emtpy spaces I just wan't to stop it to be written in database if it is invalid(if empty or with some blank spaces).
I have a for loop and structure like this :
for(....)
....
....
if(isTrue)
... do something..
.. method to be executed once (doTrick) is declared outside for loop.
....endif
endfor
public void doTrick()
...
...
..end
Is it possible for a method in for loop to be executed only once? I'm using JAVA
From this morning something strange is happening to my notepad++ editor when I press return(?) on the keyboard I get some strange symbols. Here is the screenshot :
or url
http://i42.tinypic.com/2ly2ys3.gif
What can I do to fix this?
What is the best way to do the following:
List<MyObject> list = new LinkedList<MyObject>();
for(int i=0; i<30;i++)
{
MyObject o1 = new MyObject();
list.add(o1);
}
But the things is I don't wanna create objects with same name, I wanna create them with different name like o1,o2,o3,o4,o5,o6,o7,o8,o9,o10 and I wanna add each to the list. What is the best way to do this ?
Hello everyone, this morning I came across this code, and I have absolutely no idea what that means, can anyone explain me what do these represent, ex:
public class MyClass<T>
...
some bits of code then
private Something<T> so;
private OtherThing<T> to;
private Class<T> c;
Thank you
Is there a difference between these ?
if(myString.equals("")){
}
if(myString.equals(null)){
}
if(myString == ""){
}
I have a string, I don't know is it empty or has some emtpy spaces I just wan't to stop it to be written in database if it is invalid(if empty or with some blank spaces).
Every now and then I have a problem with SVN inside eclipse folder gets locked, I have to check out projects few times update and stuff like that . is there a SVN that I can use to commit files directly from console or windows folders?
I have installed a linux distro and I "think" it is vulnerable to kernel exploits. I have to update kernel but I need to know if it is really compiled in year 2003? How can I know if additional updates are made to the kernel?
Linux gandalf 2.4.21-4.ELsmp #1 SMP Fri Oct 3 17:52:56 EDT 2003 i686 i686 i386 GNU/Linux
Does also "smp" mean that it is safe from latest threats or something?
Thank you.
I chmod 777'ed an executable and trying to execute it like this: /home/gandalf/./sample but it doesn't work
/bin/bash: line 25: ./sample: Permission denied
What can be the problem?
Thanks.