Posts

How to resolve Nattable conflicts between DefaultRowSelectionLayerConfiguration and ButtonCellPainter on left mouse keydown event? -

i developing rcp application, , using nebula's nattable that. configer row selection (use defaultrowselectionlayerconfiguration) , , configer cell button (use buttoncellpainter) . both ui bing left mouse down event. what want is: when click left mouse button, button responds event while button of whole row selected. below part code: selectionlayer = new selectionlayer(columnhideshowlayer,false); selectionlayer.setselectionmodel(new rowselectionmodel<row>(selectionlayer, bodydataprovider, new irowidaccessor<row>() { @override public serializable getrowid(row rowobject) { return rowobject.getstatus(); } })); selectionlayer.addconfiguration(new defaultrowselectionlayerconfiguration()); class buttonclickconfiguration<t> extends abstractuibindingconfiguration { private final buttoncellpainter buttoncellpainter; public buttonclickco...

Java jTextPane one line with regular and bold Text missplaced -

Image
i have textpane using styleddocument. if message typed first adds current time , other users ip document after custom message entered user added right behind in bold. apparently problem bold takes more space , makes misplaced resulting in this: <- code used process following: public void addtext(string msg) { long timems = system.currenttimemillis(); date instant = new date(timems); simpledateformat sdf = new simpledateformat("hh:mm"); string time = sdf.format(instant); simpleattributeset bold = new simpleattributeset(); styleconstants.setbold(bold, true); try { styleddocument doc = getchat().getstyleddocument(); doc.insertstring(doc.getlength(), time + ": " + client.getclient().getpartnerip() + " >>", null); doc.insertstring(doc.getlength(), msg + "", bold); jscrollbar sb = getchatscroller().getverticalscrollbar(); sb.setvalue(sb.getmaximum()); } catch (badlocationexception ...

spring - Integration test: test the Autowired annotation -

i want test injection dependencies in spring. i have class: public someclass { @autowired somebean bean ; public somebean getbean(){ return this.bean ; } } i want test this: public someclasstest { someclass someclass ; @before public void setup(){ someclass = new someclass() ; } @test public testbeanwired(){ assertnotnull(someclass.getbean()) ; } } i have tried contextconfiguration test configuration file, test fails, don't want use @autowired in test, want create instance of class , bean autowired automatically. that possible if bean annotated @configuration , if byte-code instrumented. otherwise, beans created spring autowired. not beans created using new . because spring has no way know created object , must inject dependency in it. that's fundamental principle of dependency injection: objects instantiated ,...

MongoDb document size is too large PhP.How to increase limit -

i want save documents gives me size large error. can not break data multiple collection not me while searching , joining, is there way can save array using gridfs , still searchable or increase document size limit. store data .txt files , shifting mongodb.txt files not searchable , hence need parsed , have search. please help.

c# - Handle multiple threads, one out one in, in a timed loop -

i need process large number of files overnight, defined start , end time avoid disrupting users. i've been investigating there many ways of handling threading i'm not sure way go. files come exchange inbox attachments. my current attempt, based on examples here , bit of experimentation, is: while (datetime.now < dtendtime.value) { var finished = new countdownevent(1); (int = 0; < numthreads; i++) { object state = offset; finished.addcount(); threadpool.queueuserworkitem(delegate { try { startprocessing(state); } { finished.signal(); } }); offset += numberoffilesperpoll; } finished.signal(); finished.wait(); } it...

Mysql Update and Replace Syntax in PHP -

i need eliminate character (") column in database. can in mysql command line following command: mysql> update tname set colname=replace(colname, '"',''); and works perfectly. since need run in php, have used following syntax in php dosent work : $sql0 = "update tname set colname=replace(colname,'"','')"; if (mysqli_query($conn, $sql0)) { $result0 = "unwanted character removed "; } else { $result0 = "error filtering failed: " . $sql . "<br>" . mysqli_error($conn); } any idea?? you have escape double quotes inside double-quoted strings. $sql0 = "update tname set colname=replace(colname,'\"','')"; if (mysqli_query($conn, $sql0)) { $result0 = "unwanted character removed "; } else { $result0 = "error filtering failed: " . $sql . "<br>" . mysqli_error($conn); }

java - Which use for non-inherited abstract classes? -

what practice tells non-inherited abstract classes ? is there reason them exist in program not aiming @ providing api ? make sense systematically turn such classes non-abstract classes? if in cases ? well, abstract keyword forbids inctances creation (in order create instance 1 has inherit abstract class), however, abstract classes can have static methods e.g. // abstract: there's no sence in creating instance of class abstract class mathlibrary { // private: there's no sence in inheriting class private mathlibrary() {} // gamma function public static double gamma(double value) { ... } ... } please note, when in java abstract final class not allowed, in c# abstract sealed class static class : // c# static == abstract sealed public static class mathlibrary { // gamma function public static double gamma(double value) { ... } ... }

stored procedures - Updating a column name of a same table which has a parent child relationship using mysql -

i searched lot of doing task found no appropriate solution. basically scenario is. have user_comment table in there 5 column(id,parent_id,user_comments,is_deleted,modified_datetime). there parent child relationship 1->2,1->3,2->4,2->5,5->7 etc. now sending id front end , want update column is_deleted 1 , modified_datetime on records on id children , children's of children. i trying doing using recursive procedure. below code of procedure create definer=`root`@`localhost` procedure `user_comments`( in mode varchar(45), in comment_id int, ) begin declare p_id int default null ; if(mode = 'delete') update user_comment set is_deleted = 1, modified_datetime = now() id = comment_id ; select id user_comment parent_id = comment_id p_id ; if p_id not null set @@global.max_sp_recursion_depth = 255; set @@session.max_sp_recursion_depth = 255; call user_comments('delete...

Bootstrap Popover Plugin not working with dynamic element through ajax -

using popover of bootstrap popover plugin library pulling content ajax , assigning html , calling $('[data-toggle="popover"]').popover(); not working. $.ajax({ url : '/recent_activity_jsn.html', data : {}, datatype : 'json', type : 'get', cache: false, success : function(res) { $("#recentactivitydiv").html(recentactivitymaindiv); $('[data-toggle="popover"]').popover(); }, error:function(response) { alert("server error please try again"); } });

c# - Custom Nancy bootstrapper not being called -

i building nancy based application uses nancyhost embedded web server. i trying serve static content, creating custom bootstrapper described in documentation here . however, problem see custom bootstrapper class never instantiated , configureconventions method never called. there specific action have in order make sure custom bootstrapper registered? the custom bootstrapper code below: using nancy; using nancy.conventions; using system; namespace application { public class custombootstrapper : defaultnancybootstrapper { protected override void configureconventions(nancyconventions conventions) { console.writeline("test"); conventions.staticcontentsconventions.add(staticcontentconventionbuilder.adddirectory("client", @"client")); conventions.staticcontentsconventions.add(staticcontentconventionbuilder.adddirectory("lib", @"lib")); base.configureconventio...

Rails flash message password -

i need idea of making flash message password i have application has posts , need when try edit post or delete message asked password...please note don't want or have users, want have 1 password flash message, please tell me how make it put following code on posts controller http_basic_authenticate_with name: "root", password: "passpass", except: [:index, :show]

How to Reboot android phone programitically? -

i trying reboot android device through activity.i m using following code. public void reboot(){ powermanager pm=(powermanager)getsystemservice(context.power_service); pm.reboot(null) } and have given manifest permission too. android:name="android.permission.reboot error::java.lang.securityexception: neither user 10098 nor current process has android.permission.reboot. only applications signed system firmware signing key allowed these operations. more information can found in links below how compile android application system permissions programmatically switching off android phone

github - Clone git repo inside another repo (and don't treat the cloned one as a submodule) -

in previous project able clone third party git repo project repo. added cloned repo , committed changes project repo. way able keep cloned repo date via git pull in cloned repo folder, , able modify files in , commit them own project repo. i have tried replicate in new project , facing strange issue. follow same steps (in case cloned repo project of mine) when add cloned repo files own repo, main repo recognizes cloned 1 submodule (though no .gitmodules file generated). i compared git related files , found no difference between previous project , current one. cloned same third party repo used in previous project ( https://github.com/wymsee/cordova-http.git ) , able modify/add files , commit them own repo. can't see difference between third party repo clone , own project can't understand why latter treated submodule first isn't. ideas?

javascript - Different link color on different html pages using the same css doc -

i'm new programming, apologize is, i'm sure, relatively simple question. i'm looking efficient way make link color within <a> tags of each html page different (i.e. 1 page have green links, while have blue links) without having add class="green" or class="blue" every single <a> tag. i understand have separate css documents each page, i'd keep whole site on 1 css page, don't have update each style sheet separately when want make overarching changes. is there way of defining style rules in <a> tags in relation class of higher tag? example, possible say <body> <div class="page1content"> <p>text here <a href="someurl.com"> link here </a> more text <a href="secondurl.com"> second link</p> </div> <div class="footer"> <p>even more text <a href="thirdurl.com"></a></p> </div> </bod...

compiling java package classes. Cannot access Class. class file contains wrong class while working with packages -

i trying compile few files in package in java. package name library . please have @ following details. this directory structure: javalearning ---library ------parentclass.java ------childclass.java i tried compile in following way: current directory: javalearning javac library/parentclass.java //this compilation works fine javac library/childclass.java //error on here the following parentclass.java : package library; class parentclass{ ... } the following childclass.java : package library; class childclass extends parentclass{ ... } the error follows: cannot access parentclass bad class file: .\library\parentclass.class please remove or make sure appears in correct sub directory of classpath you've got casing issue: class parentclass that's not same filename parentclass.class , nor same class you're trying use in childclass : class childclass extends parentclass . java classnames case-sensitive, windows filenames aren't. if...

Excel: Obtain the row of the smaller value -

Image
i have following columns: - original values, b - absolute values, c - sorted absolute values (i obtain ordered values (c) using small formula given range - see link bellow) i need know each ordered absolute value, if original value or not negative: so in picture red columns filled-in manually... there way automatize via formula ? here link sandbox in excel online: http://1drv.ms/1vu2mz4 if first link not work, same thing , formulas on google sheets a partial answer, might enough if column e in screenshot want , column d helper column intended make column e easy compute. the problem abs() loses information. instead of using that, use function doesn't lose information doesn't change sort order , makes possible recover absolute value after sorting. 1 way leave positive numbers alone send negative numbers absolute value + 0.5. example, in b2 enter =if(a2 >= 0,a2, 0.5+abs(a2)) in c2 enter =small($b$2:$b$6,-1+row()) in d2 enter =int(c2...

magento2 - Magento 2 - Product filters using Obeserver Event -

i trying create 1 observer apply additional filters product collection. so use magento 2 event :catalog_product_collection_load_after observer code : public function execute(\magento\framework\event\observer $observer) { $collection = $observer->getevent()->getcollection(); $collection->addattributetofilter('size',10); return $this; } but above code working fine product collection, showing wrong pagination , product count same happen layer navigation. is there solution that?

does python has a way to implement C#-like indexers? -

this question has answer here: implement list-like index access in python 2 answers how implement in python c# indexers-like this[int i] {get set}? in other words, how write follow code in python? public class foo{ ... list<foo2> objfoo; ... public foo2 this[int i] { get{ return objfoo[i]; }} }//end class foo //in class or method... ofoo = new foo(); ... foo2 x = ofoo[3]; if want make class work python list (which similar arrays in other languages), can subclass list , give class custom methods , properties without overriding of list methods or properties unless need to. trying mimic of you've posted: class foo(list): def __init__(self, *args): self.extend(args) self.x = "now" def smack(self): print("smackity!") ofoo = foo(1, 2, 3, 4, 5, 6) print(ofoo[3]) # prints ...

c# - How to add users to groups under Sub site's in sharepoint sitecollection? -

i have 2 sub-sites in sharepoint site,samplesite1 , samplesite2 under parentsite called mainsite. http://xyz.sharepoint.com/sites/mainsite/ - siteurl http://xyz.sharepoint.com/sites/mainsite/samplesite1 - subsite1's url http://xyz.sharepoint.com/sites/mainsite/samplesite2 - subsite2's url each of sites have 2 groups superuser , normaluser respectively. the credential uses siteurl of mainsite. securestring password = new securestring(); string pwd = "pass123"; string username = "abc@xyz.com"; password = converttosecurestring(pwd); clientcontext clientcontext = new clientcontext("http://xyz.sharepoint.com/sites/mainsite/"); clientcontext.credentials = new sharepointonlinecredentials(username, password); incase of adding user subsite's groups normaluser,can use same sharepoint context above siteurl access , perform operations(add/remove user) in groups present under subsites? if yes,how can it?i have built code add or remo...

ios - Append audio samples to AVAssetWriter from streaming -

i'm using project when i'm recording video camera, audio comes streaming. audio frames not synchronised video frames. if use avassetwriter without video, recording audio frames streaming working fine. if append video , audio frames, can't hear anything. here method convert audiodata stream cmsamplebuffer audiostreambasicdescription monostreamformat = [self getaudiodescription]; cmformatdescriptionref format = null; osstatus status = cmaudioformatdescriptioncreate(kcfallocatordefault, &monostreamformat, 0,null, 0, null, null, &format); if (status != noerr) { // shouldn't happen return nil; } cmsampletiminginfo timing = { cmtimemake(1, 44100.0), kcmtimezero, kcmtimeinvalid }; cmsamplebufferref samplebuffer = null; status = cmsamplebuffercreate(kcfallocatordefault, null, false, null, null, format, numsamples, 1, &timing, 0, null, &samplebuffer); if (status != noerr) { // couldn't create sample alguiebuffer nslog(@"fail...