Posts

java - How can I draw an image part by part? -

Image
class drawima extends jpanel{ protected void paintcomponent(graphics g) { super.paintcomponent(g); (int i=0;i<20;i++){ (int j=0;j<20;j++) { g.drawimage(buarr[i*20+j], 20*i, 20*j, 20, 20, null); try { thread.sleep(10); } catch (interruptedexception e) { e.printstacktrace(); } } } } } in part, buarr 400 blocks divided bufferedimage , want them draw 1 one, method can not draw blocks separately, how can this? swing single thread , not thread safe. this means should not perform long running or blocking ( thread.sleep ) operations within iu thread (the event dispatching thread). means can not update, modify or create ui elements outside of edt context. instead, use swing timer generate repeated callback @ specified interval , render portions of image bufferedimage , can paint component via paintcompon...

ios - Is it possible to delete data from all tables within Sqlite Database simultaneously -

actually, need delete , insert data in tables when going launch app. so, please tell me best solution yes @dai explanation correct. if going delete table rows 1 one each table memory consuming too. it takes bit of time remove table's rows. need query separately each table , need check constraint not conflict other table . suppose, table reference table b must have remove table b records before going remove table records. there many things needs check before going removing each tables records. as @dai said if dropping table no issue current implementation. i suggest 1 step ahead of this. why don't remove database copy bundle. as per knowledge creating database , place in application bundle. if previous state of database not required remove database , copy new application bundle. this fast perform on application launch.

ios - Presenting view controllers on detached view controllers is discouraged -

i trying move new view controller current view controller using following code this self.loginview = [self.storyboard instantiateviewcontrollerwithidentifier:@"login"]; [self presentviewcontroller:self.loginview animated:no completion:nil]; this code works fine ios 8 in ios 7(iphone) not working. can me rid of error? please try use [self.view.window.rootviewcontroller presentviewcontroller:self.loginview animated:no completion:nil];

android - MultipartEntity post array -

i'm trying upload file using http post request. figured doable using multipartentity, such: multipartentity entity = new multipartentity(); ... entity.addpart("caption", new stringbody("mycaption")); entity.addpart("file", new filebody(file)); entity.addpart("uploadername", new stringbody("myname")); ... my problem structure post request needs made. instead of rather straightforward... { "caption":[caption], "file":[file upload], "uploadername":[name] } ..it is.. { "newfile": { "caption":[caption], "file":[file upload] }, "uploadername":[name] } if don't need post files, can use jsonobject , put 1 jsonobject inside other, can't figure out way multipartentity. clues? in advance. ..okay, guess found way it. .... entity.addpart("newfile[caption]", new stringbody("mycaption...

java.lang.NoSuchMethodError: org.apache.commons.codec.binary.Base64.encodeBase64String -

i trying encrypt plain text using org.apache.commons.codec.binary.base64. when call method org.apache.commons.codec.binary.base64.encodebase64string(abytearray) , gives following exception exception in thread "main" java.lang.nosuchmethoderror: org.apache.commons.codec.binary.base64.encodebase64string([b)ljava/lang/string; i using jar, org-apache-commons-codec.jar. please me can't understand wrong this. first of encoding not encryption . changing representation of string while encoding, changed back . since getting exception means @ least have jar in classpath. open jar suitable zip tool 7-zip , @ manifest.mf file. jar version should greater 1.4 according base64javadoc . download latest version , replace older version.

thumbnail returns null on android above version 4.0 -

i getting same this issue public class mainactivity extends activity { imageview imgvie; bitmap bmp,extbmp; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); imgvie = (imageview)findviewbyid(r.id.imageview1); string path = "http://202.65.154.108:8080/vodstream/lokesh.stream.mp4"; bmp = thumbnailutils.createvideothumbnail(path, thumbnails.full_screen_kind); if(bmp!=null) { extbmp = thumbnailutils.extractthumbnail(bmp, 300, 300); imgvie.setimagebitmap(extbmp); } if(bmp==null) { toast.maketext(getapplicationcontext(), "sorry bitmap returns null", toast.length_long).show(); } } } when run application in nexus4s entering if condition.in other phones moving else. have suggestions. 1)- sometim...

cordova - Phonegap PDF Viewer or Open pdf file from local for Windows Phone 8 -

i working in phonegap windows phone 8 app. stuck opening pdf file local area (like in phone >> documents >> myfolder>>1.pdf) i tried in js document.addeventlistener("deviceready", deviceready, false); function deviceready() { window.open('.documents/myfolder/1.pdf', '_blank', 'location=no'); } but doesn't work. i tried window.open('**documents**/myfolder/1.pdf', '_blank', 'location=no'); and window.open('**/documents**/myfolder/1.pdf', '_blank', 'location=no'); but neither works. otherwise, if there pdf viewer plugin phonegap , wp8, please share link. note: have adobe pdf reader installed on phone try of following works you. window.open('http://www.example.com/test.pdf', '_system', 'location=yes'); window.open('http://www.example.com/test.pdf', '_blank', 'location=no,closebuttoncaption=close,enablevi...