Posts

reflection - Java private method hiding public accessors -

i have class this: import java.util.list; import java.util.string; import javax.xml.bind.annotation.xmltype; @xmltype public class foo { private list<foo> compound; private string bar; // private method used internally know // if compound instance private boolean iscompound() { return compound != null && compound.size() != 0; } // public setter compound instance var public void setcompound(list<foo> compound) { this.compound = compound; } // public getter compound instance var public list<foo> getcompound() { return compound; } public void setbar(string bar) { this.bar = bar; } public string getbar() { return bar; } } in normal use, class behaves expect. methods getcompound , setcompound , set compound list. however, i'm using class object that's passed in web service built using jax-ws. when jax-ws compiler sees class, ignores setco...

ksh: zero divisor error when declaring a variable -

update : weird. looked further, , realized there 2 *ksh packages in server: pdksh-5.2.14-37.el5_8.1.x86_64 mksh-39-7.el6_4.1.x86_64 and mksh set in /etc/alternatives : lrwxrwxrwx 1 root root 9 apr 23 10:39 /etc/alternatives/ksh -> /bin/mksh i pointed /bin/pdksh , tried script again, , worked. to replicate issue, changed /bin/mksh , time, script worked without error. in short, not replicate issue anymore. weird. i'm looking further. thanks. given korn shell script: #!/bin/ksh u=$1 with $1 passed abc/s0mething , how can work around error? ksh: abc/s0mething 0 divisor. ksh version: @(#)mirbsd ksh r39 2009/08/01 thanks. it's weird, if asking workaround, can be u=`printf '%q' $1` however, not able replicate problem on system understand it... if doesn't work, shall remove answer.

git - Gerrit - Gitlab Integration -

in order improve development process, our organization have decided introduce gerrit in development workflow. person responsible implementing gerrit server. user guides available in internet helpful in implementing gerrit our existing workflow. using jenkins , sonar non-interactive users verifying builds. while dealing repositories 1 question rises. of open sources using gerrit-replication plugin replicate latest code public code repository. these public repositories exposed using gitlab users can clone code. here doesn't need public repository code maintained in house. is choice point both gitlab , gerrit common git repository location? any appreciated. you can use gerrit in front of gitlab via replication feature. replication feature not git clone/fetch, pushs (approved) changes remote repository. you have import repositories via e.g. 'git push origin master' requires permissions (or need admin). not big deal unless forget remove these permissions. if ...

push notifications iOS add device -

i new iphone , when tried test xcode project push notifications , doesn't token , failed token , think because when creating certificate didn't mark on device , want add device testing , token should ?? - (void)application:(uiapplication*)application didregisterforremotenotificationswithdevicetoken:(nsdata*)devicetoken { nslog(@"my token is: %@", devicetoken); } - (void)application:(uiapplication*)application didfailtoregisterforremotenotificationswitherror:(nserror*)error { nslog(@"failed token, error: %@", error); } for should first set provisioning profile in have added device udid. add below code register pushnotification in device. when run app first time ask permission . //push noti [[uiapplication sharedapplication]registerforremotenotificationtypes:(uiremotenotificationtypealert|uiremotenotificationtypebadge|uiremotenotificationtypesound)]; if allow below delegate called. , give device token. -(void)application:(uiappl...

php - Symfony2 : Redirect user to index page when page not found or 404 errors thrown -

i want redirect user particular page when page not found error comes in symfony2. for customization of error page message created app\resources\twigbundle\views\exception\error404.html.twing but want redirect user particular page. how can that? thanks you want create event listener listens kernel.exception event kernel dispatches when encounters exception. then, check inside listener if exception instance of notfoundhttpexception , , if is, redirect page of choice. here's exemple: <?php // src/acme/demobundle/eventlistener/acmeexceptionlistener.php namespace acme\demobundle\eventlistener; use symfony\component\httpkernel\event\getresponseforexceptionevent; use symfony\component\httpfoundation\redirectresponse; use symfony\component\httpkernel\exception\notfoundhttpexception; class acmeexceptionlistener { public function onkernelexception(getresponseforexceptionevent $event) { // exception object received event $exception = $...

html - How to lock JavaScript element on page? -

i made new element in javascript , appendchild ed parentnode of html element, seems great, see , can put data in it, when i'm trying change size of browser, or scroll element "following me". how can "lock" it, won't move place put in? thank answering. made it! :) used method wrote @abhishek verma. you can create element , apply following css class. .staticelement { position: static; top: 0: left: 250; } you can change position of div changing value of top left element in css.

Java Syntax expression.new MyClass -

having function public parametermethodparameterbuilder withparameter() { methodparameter parameter = new methodparameter(); return withparameter(parameter).new parametermethodparameterbuilder(parameter); } what mean of experession below withparameter(parameter).new parametermethodparameterbuilder(parameter) the syntax obj.new inner() creates , returns instance of inner class(*) inner linked instance obj of encapsulating class. when inner class declared, need instance of encapsulating class instantiate inner class. syntax confronted purpose. here simplest example this: public class mainclass { public class innerclass { } } you instantiate innerclass way: mainclass mc = new mainclass(); mc.new innerclass(); (*) inner class = non-static nested class