Posts

Featured post

java - Regex doesn't work in String.matches() -

i have small piece of code string[] words = {"{apf","hum_","dkoe","12f"}; for(string s:words) { if(s.matches("[a-z]")) { system.out.println(s); } } supposed print dkoe but prints nothing!! welcome java's misnamed .matches() method... tries , matches input. unfortunately, other languages have followed suit :( if want see if regex matches input text, use pattern , matcher , .find() method of matcher: pattern p = pattern.compile("[a-z]"); matcher m = p.matcher(inputstring); if (m.find()) // match if want indeed see if input has lowercase letters, can use .matches() , need match 1 or more characters: append + character class, in [a-z]+ . or use ^[a-z]+$ , .find() .

itext - Showing an error while using XMLWorkerHelper -

i trying convert html data pdf. have used xmlworker-5.5.6.jar. while executing code showing error of missing resources. can please help. in advance. here code document document = new document(pagesize.letter); pdfwriter pdfwriter = pdfwriter.getinstance(document, new fileoutputstream(new file(filepathpdf))); document.open(); document.addauthor("me"); document.addcreator("me"); document.addsubject("thanks support"); document.addcreationdate(); document.addtitle("please read this"); xmlworkerhelper worker = xmlworkerhelper.getinstance(); string str = sb.tostring().substring(sb.indexof("<html"),sb.length()); system.out.println(str); worker.parsexhtml(pdfwriter, document, new stringreader(str)); document.close(); system.out.println("done."); and here error : 08-24 12:28:42.079 14077-15044/com.abc.abc e/androidruntime: fatal exception: asynctask #5

javascript - How to ignore case (upper/lower) while triggering change for select in jquery? -

please see code below: <html> <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> </head> <body> <select> <option>one</option> <option>two</option> <option>three</option> <option>four</option> <option>five</option> </select> <script> $("select").val("two").trigger("change"); </script> </body> </html> in case option not set value "two" . if change : $("select").val("two").trigger("change"); then works. how can ignore case while triggering change select? $("select").val("two".tolowercase()).trigger("change"); make value in lowercase , able check not matter upper or lower case in string

android - App Crashes. Error Inflating XML. Cant find image because xxxhdpi folder is not there -

switched eclipse project android studio. maintaining resources under drawable-mdpi folder only. in studio preview of xml loads images correctly. when run app in device resolution higher mdpi app crashes, shows error inflating binary xml. after long analysis found issue device trying load images corresponding density folder not available. created folder drawable-xhdpi , put images in folder. app works fine. why android studio can't pick image other density drawable folder , resize possible eclipse. can't maintain 5 different drawable folders because there lots of images. you have add "drawable-hdpi" resource directory , paste hdpi resources there because 70% android devices supports hdpi resolution images. if maintain hdpi, ok. android manages remaining resouces hdpi resouce directory.

excel - How to open file using Open File Dialog -

i've been searching on web solution on how open file using open file dialog in vbscript. can point me on right track? my code below opens excel file wanted more dynamic in terms input file name can change , not hard coded. set objexcel = createobject("excel.application") objexcel.displayalerts = 0 set objshell = wscript.createobject("wscript.shell") path = objshell.currentdirectory infilename = "inputfile.xlsx" infilepath = path + "\" + infilename 'open target workbook set objworkbook1 = objexcel.workbooks.open(infilepath, false, true) msgbox "reading data " & infilename & vbnewline, vbokonly + vbinformation, _ "reading data" when in doubt, read documentation . set dialog = objexcel.filedialog(3) dialog.allowmultiselect = true dialog.show each f in dialog.selecteditems set objworkbook = objexcel.workbooks.open(f) '... stuff ... objworkbook.close next

git - Use merge operation in gradle (using grgit) -

i want merge branch branch in git using gradle git (grgit) plugin. branch merged first branch , branch first branch merged second branch. so, merge operation this: def grgit = org.ajoberstar.grgit.grgit.open(dir: project.parent.projectdir) grgit.checkout(branch: 'origin/first') grgit.merge(head:'origin/second',mode: org.ajoberstar.grgit.operation.mergeop.mode.only_ff) it builds fine doesnot merge operation. idea?