Posts

java - Compilation effects of declaring method parameters "final" -

this question has answer here: is there performance reason declare method parameters final in java? 8 answers marking method parameter final needed allow variable access inner anonymous classes , useful coding-tool enforcing variable use conventions within method. apart that, there other compilation-related motivation use final -keyword? specifically, give compiler hints facilitate specific optimization otherwise not performed? or compiler smart enough recognize if variable never modified anyways? for example, i'm thinking whether there difference how variables passed method. e.g. variable of primitive type (int, byte, etc.) needs copied when passed method prevent modifications trickle out calling code, whereas if parameter marked final , "passed reference" without such concerns, i.e. no copy-operation needed. but let's keep question more gen...

sorting - Ranking diagonal values of matrix in ascending order and other than diagonal values depending on diagonal values in matlab -

this question has answer here: ranking matrix values in ascending order in matlab 1 answer input matrix: 1.0000 0 0.2173 0.2585 0.3764 0 0 0 0 0 0.2173 0 0.2173 0.2173 0.2173 0.2585 0 0.2173 0.2585 0.2585 0.3764 0 0.2173 0.2585 0.3764 expected output matrix: 5 1 2 3 4 1 1 1 1 1 2 1 2 2 2 3 1 2 3 3 4 1 2 3 4 for given matrix r={r(i,j)} following 2 operations done input matrix: 1.we rank diagonal values in ascending order.(i.e small value rank 1 given , next small value rank2 , on) ex: 0-1st rank 0.2173-2nd rank 0.2585-3rd rank 0.3764-4th rank 1.0000-5th rank 2.other diagonal cell sort rest values rowise depending on diagonal value....

c - How to correctly use a startup-ipi to start an application processor? -

my goal let own kernel start application cpu. uses same mechanism linux kernel : send asserting , level triggered init-ipi wait... send deasserting , level triggered init-ipi wait... send 2 startup-ipis vector number (0x40000 >> 12) (the entry code application processor lies there) currently i'm interested in making work qemu. unfortunately, instead of jumping 0x40000 , application cpu jumps 0x0 cs register set 0x4000 . (i checked gdb). the intel multiprocessor specification (b.4.2) explains behavior noticed valid if target processor halted after reset or init. shouldn't apply code of linux kernel? sends startup-ipi after init-ipi. or misunderstand specification? what can have application processor jump 0x000vv000 , not 0x0 cs register set 0xvv00 ? can't see, linux changes behavior. it seems misunderstood specification: since application cpu started in real mode 0x000vv000 equivalent 0xvv00:0x0000 . not possible represent address in ...

d3.js - D3 Force Directed Map Source and Target Properties -

is possible use names other source , target d3 force directed map? connecting api provides me needed information supplying 'src-port' , 'dst-port'. if change names in static json file 'source' , 'target' links on map appear. if leave is, following error message: e.source undefined is there way can specify property names instead of using defaults, 'source' , 'target'? here complete code work with: function buildmap(node, ids, mode) { d3.select("svg").remove(); width = 960, height = 500; svg = d3.select(node).append("svg") .attr("width", width) .attr("height", height) .attr("id","chart") .attr("preserveaspectratio","xmidymid") .attr("viewbox","0 0 960 500"); var color = d3.scale.category20(); var force = d3.layout.force() .charge(-220) .linkdis...

javascript - json_encode putting empty array on the end of json -

i'm writing ajax application , have function in php script: public function expire_user() { $r=array("return"=>'ok'); echo json_encode($r); } that gets called javascript: $.getjson("/users/expire_user",function(data){ alert('success'); }); the problem alert never displays. think due json_encode returning invalid json, because when go url directly, displays {"return":"ok"}[] which not valid json due '[]' on end. why json_encode putting empty array on end , how rid of can receive valid json? wild guess, maybe should set correct headers json in php function this: public function expire_user() { $r=array("return"=>'ok'); header("content-type: application/json"); echo json_encode($r); } or send content x-json headers this: public function expire_user() { $r=array("return"=>'ok'); $json_data = json_enc...

php - Is it possible to submit your own admin forms in Wordpress? -

i'm wondering if possible , how it, create own page in wordpress, after want submit form, info , save it. sounds simple, find no results. i saw can use do_settings_sections create custom form easily, auto-saves, want refer function , later show screen. far @ moment, close, calling function y form this: function edit_university() { echo " *test* "; } add_action( 'admin_post_edit_university', 'edit_university' ); i submit form , see echo test, out of wordpress admin page. it's simple page echo test; how can resend later page?

java - Gradle projects vs. Eclipse projects? -

i found interesting open-source layout library on github i'd incorporate android project i'm working on in eclipse. however, noticed library in question seems have been developed using gradle, don't have. i'm not sure ide used develop library, in case, i'm not familiar gradle @ all... gradle-d projects compatible non-gradle-d eclipse? depend on ide used? (in case, how can 1 tell used develop it?) what steps (if any) need take incorporate library? need install & run plugins, example? thank help. gradle build system android studio uses (the new ide being developed google android development). can use gradle eclipse plugin load gradle projects eclipse.