Posts

How to disable the close button of window using Qt? -

i want disable close button on window (main application window) when operation starts user can't exit application , enable again when operation complete. how can in qt application? platform windows 7. alternatively show message if user press close button , exiting application process running in background , abort closing application. how can either? if want disable button, can use next: auto flags = windowflags();//save current configuration //your main configuration trick setwindowflags(qt::customizewindowhint | qt::windowtitlehint | qt::windowminmaxbuttonshint ); //... setwindowflags(flags);//restore if sure such "feature" not irritate users, can use this, in case use link comment.

mysql - Querying for dates listed in another table -

i want select rows of table between 2 dates (which found in seperate table). details of tables , query can found in previous question here (i interested in how in hive/hiveql). current query stands, runs long time seems hang indefinitely, whereas when hardcode in dates runs completion quickly. tables , query reference: visit_info, these columns: pers_key - unique identifyer each person pers_name - name of person visit_date - date @ visited business valid_dates, these columns: condition - string start_date - date end_date - date and query itself: select pers_key, pers_name visit_info cross join (select start_date, end_date valid_dates condition = 'condition1') b (a.visit_date >= b.start_date , a.visit_date <= b.end_date) group a.pers_key its worth noting im using hive 0.12, getting rid of join , putting select statement in clause out of question. i'm wondering wrong query, or causing fail. suggestions how improve appreciated. try: select ...

java - Android: NullPointerException when the application attempts to encrypt .txt file -

i trying encrypt/decrypt file virtual device (genymotion). show code , exceptions have. guess nullpointerexception comes line declare view v = null in onactivityresult method not know how fix it. exceptions 07-22 13:34:10.241 10419-10419/? e/androidruntime﹕ fatal exception: main process: application.nikola.com.encryptdecrypt, pid: 10419 java.lang.runtimeexception: failure delivering result resultinfo{who=null, request=1, result=-1, data=intent { dat=file:///storage/emulated/0/nikola.txt }} activity {application.nikola.com.encryptdecrypt/application.nikola.com.encryptdecrypt.mainactivity}: java.lang.nullpointerexception: attempt invoke virtual method 'int android.view.view.getid()' on null object reference @ android.app.activitythread.deliverresults(activitythread.java:3539) @ android.app.activitythread.handlesendresult(activitythread.java:3582) @ android.app.activitythread.access$1300(activitythread.java:144) @ ...

hadoop - Loading XML to PIG : Error 2998 -

i'm using piggybank-0.12.0.jar , , pig version 0.12 (cdh) pig --version apache pig version 0.12.0-cdh5.3.2 (rexported) i trying load xml file using xmlloader of piggybank jar . during getting below error: register piggybank-0.12.0.jar; define xmlloader org.apache.pig.piggybank.storage.xmlloader(); define regexextractall org.apache.pig.piggybank.evaluation.string.regexextractall(); revisionxml = load 'test3.xml' using xmlloader('rev') (revision:chararray); error: error org.apache.pig.tools.grunt.grunt - error 2998: unhandled internal error. found interface org.apache.hadoop.mapreduce.jobcontext, class expected any idea why coming up. got solution above error 2998. to resolve it, either can build piggybank jar source. link: https://cwiki.apache.org/confluence/display/pig/piggybank in case, had used in built piggybank jar cdh distribution (since, didn't had privilege bypass proxy online download). worked fine me. thanks, ...

Convert a black or white only rgb array into a 1 or 0 array in Python -

i relatively new python , working image containing 'hits' particle detector totally black , white. in order count number of hits (and later separate hits different particles) need group adjacent white pixels. my code ensures image black or white , tries use scipy label function group white pixels (this should work groups none 0 values , made black pixels have 0's , white pixels hold 1. returns 0 labels , unsure why. think may fact not 1's , 0's still tuples of lists working with. is there way create array of 1's or 0's based on whether pixel black or white? def analyseimage(self, impath): img = image.open(impath) grey = img.convert('l') bw = np.asarray(grey).copy() #switches black , white label effective bw[bw < 128] = 255 # white bw[bw >= 128] = 0 # black lbl, nlbls = label(bw) labels = range(1, nlbls + 1) coords = [np.column_stack(np.where(lbl == k)) k in labels] imfile = image.froma...

ios - How do I set the initial scene in a sprite kit project? -

i have 2 skscenes gamescene , menuscene , default scene appears when open app gamescene want menuscene appear first i tried change code in gameviewcontroller: import uikit import spritekit extension sknode { class func unarchivefromfile(file : string) -> sknode? { if let path = nsbundle.mainbundle().pathforresource(file, oftype: "sks") { var scenedata = nsdata(contentsoffile: path, options: .datareadingmappedifsafe, error: nil)! var archiver = nskeyedunarchiver(forreadingwithdata: scenedata) archiver.setclass(self.classforkeyedunarchiver(), forclassname: "skscene") let scene = archiver.decodeobjectforkey(nskeyedarchiverootobjectkey) as! menuscene archiver.finishdecoding() return scene } else { return nil } } } class gameviewcontroller: uiviewcontroller { override func viewdidload() { super.viewdidload() if let sce...

asp.net mvc 5 - Randomize loading order of products -

i working on site friend site can sell goods. got index view loading of ef 6, mvc 5 , people on here. wondering if there way randomize loading order it's different each time. here's code products control index method: private accessorizeforlessentities entities = new accessorizeforlessentities(); // get: /products/ public actionresult index() { var products = entities.products.include(p => p.productimage); ienumerable<displayproductsviewmodel> model = products.select(p => new displayproductsviewmodel() { id = p.productid, name = p.productname, image = p.productimage, price = p.productprice.tostring() }).tolist(); return view(model); } is there way can alter code randomize loading order? just order random. example: entities.products.include(p => p.productimage).orderby(o => guid.newguid())