[Solved] Find the highest number between two literal strings using a Regular Expression

You can use this code to extract the numeric portion from the untitledNNN.java file name: Pattern p = Pattern.compile(“^untitled(\\d+)[.]java$”, Pattern.CASE_INSENSITIVE); for (String fileName : fileNames) { Matcher m = p.matcher(fileName); if (!m.find()) { continue; } String digits = m.group(1); … // Parse and find the max } Demo. Since you are OK with throwing an … Read more

[Solved] find Special word from text and put to array [closed]

Assuming all your text is in a file and that English and persian translations are on different lines. What you need to do is read each line from the file and check if it is ASCII or not. How do you check that? import java.nio.charset.Charset; import java.nio.charset.CharsetEncoder; public class StringUtils { static CharsetEncoder asciiEncoder = … Read more

[Solved] Null Pointer Except, but why? [closed]

I believe this line is wrong: if(type.equals(null)) strTypeList = “What?What?What?LOLOLOLOLOLnopechucktesta”; it should be: if(type == null) strTypeList = “What?What?What?LOLOLOLOLOLnopechucktesta”; Without seeing the contents of the method calls here: Type = AddyBook.get(x).getContactType(); it’ll be hard to debug but if I were to guess it would be the method “getContactType()” is returning null. EDIT: Try unchaining the … Read more

[Solved] Getting time of special timezone in UNIX-time format. Android [duplicate]

I just needed adding an offset of my timezone. Function below was exactly what i wanted! public static long getCurrentTimeInUnixFormat(){ return (System.currentTimeMillis() + TimeZone.getTimeZone(“GMT+3”).getOffset(System.currentTimeMillis())) / 1000; } 1 solved Getting time of special timezone in UNIX-time format. Android [duplicate]

[Solved] How do I display a different image everytime the image is clicked? [closed]

If you are using html js and css: jsfiddle http://jsfiddle.net/harshdand/dec2mpbv/ html: <img src=”http://picture-gallery.dnspk.com/albums/userpics/10001/normal_1124750273-15.jpg” id=”images”/> js make an array of images u want var currentImageIndex = 0; var images=[ ‘http://picture-gallery.dnspk.com/albums/userpics/10001/normal_1124750273-15.jpg’, ‘http://images7.alphacoders.com/408/thumbbig-408758.jpg’, ‘http://images6.alphacoders.com/410/thumbbig-410020.jpg’, ‘http://picture-gallery.dnspk.com/albums/userpics/10001/normal_1127034390-11.jpg’ ]; document.getElementById(‘images’).setAttribute(‘src’,images[0]); document.getElementById(‘images’).onclick = function(){ if(currentImageIndex<images.length-1) currentImageIndex++; else currentImageIndex = 0; document.getElementById(‘images’).setAttribute(‘src’,images[currentImageIndex]); } solved How do I display a different image everytime the … Read more

[Solved] Spring Security – api gateway pattern – bug?

Alright, after many hours we found a solution to what seemed to be inconsistent behavior. Meaning sometimes you’d log in and it’d retain the proper session and you could go the the localhost:8080/ui page and not get the Whitelabel Error page… sometimes you’d still get it. On the Gateway server… 1) Added RequestMethod.POST @Controller public … Read more

[Solved] Programming Challenges 110106 [closed]

I think you problem may be here while (input.hasNext()) { int num = Integer.parseInt(input.next()); if (input.next() == “”) { The second line reads an input, but so does the next line. So when the loop is at the last element, the first line will read it, then the next line will try to read a … Read more