Posts

arrays - assembly program to sort in special way? help please? -

8086 assembly language program sorts array follows: smallest value in array should placed in first cell. second smallest value in last cell. third smallest value in second cell of array. fourth smallest value placed in before-last cell of array. • above procedure continues until array sorted. note in above-described sorting technique, large values in initial array end being placed @ middle part of array here code sorting in normal way : org 100h .model small .data table db 9,2,6,8,5,1 b db 6 dup(0) val1 db 5 nl db ' ','$' .code mov ax,@data mov ds,ax lea bx,table mov dl,val1 lbl1: lea bx,table mov cl,5 lbl2: mov al,[bx] mov dl,[bx+1] cmp al,dl jb lbl3 mov [bx],dl mov [bx+1],al lbl3: ...

Excel - Averege value in column when cells contains certain text but average without zeros -

i'm trying average row of number when cell in same row contains text "mobile" formula =averageif(a:a,"*mobile",b:b) don't value because zeros in column b. [column - website] blic - computer blic - mobile b92 - computer b92 - mobile politika - computer politika - mobile [column b - cost] $5.00 0 0 $13.00 $20.00 $17.00 average - computer $8.33 average - mobile $10.00 average - total $9.17 how exclude zeros? thanks, instead of =averageif() use more powerful =averageifs() can add more criteria: =averageifs(b:b, a:a,"*mobile",b:b, "<>0")

php - Issues wih the Wordpress API Customization -

i'm making first wordpress theme , i'm learning api customization. there's wrong code made. what's wrong? when load wp-admin page, it's shown blank. this php code //welcome message settings $wp_customize->add_setting( 'welcome_message' , array( 'default' => 'hi', )); $wp_customize->add_section( 'test_welcomemessage' , array( 'title' => __('welcome message','my_test'), 'description' => 'write own welcome message visitors' )); $wp_customize->add_control( 'welcome_message', array( 'label' => __( 'welcome messagee', 'mytheme' ), 'section' => 'test_welcomemessage', 'settings' => 'welcome_message' ))); } and html structure <div id="welcomecontainer"> <div class="welcomemessage...

postgresql - fan out each row into multiple rows per keys in a JSON column -

i have table: create table user_stats (username varchar, metadata_by_topic json); insert user_stats values ('matt', '{"tech":["foo","bar"],"weather":"it sunny"}'); insert user_stats values ('fred', '{"tech":{"stuff":"etc"},"sports":"bruins won"}'); the top-level keys in metadata_by_topic strings (e.g. "tech", "weather"), values under them arbitrary json. i'd query maps these top-level keys own column, , json values different column, so: username | topic | metadata ----------------------------------- matt | tech | ["foo","bar"] matt | weather | "it sunny" fred | tech | {"stuff":"etc"} fred | sports | "bruins won" where username , topic both of type varchar , metadata of type json. this: select * json_each((...

javascript - bootstrap table unable to load json objects -

my ajax script sends json objects browser table unable load json object. ajax script: $.ajax({ type : "post", url : "getlabels.jsp", data : "mailingid=" + selectedvalue, // poscodeselected success : function(data) { response = $.parsejson(data);// statement sends data succesfully browser }, error : function(response) { var responsetextobject = jquery.parsejson(response.responsetext); } }); this bootstrap table embedded jsp page. <table data-height="299" data-show-refresh="true" data-show-toggle="true" data-show-columns="true" data-search="true" data-select-item-name="toolbar1"> <thead> <tr> <th data-field="rownumber" >id</th> <th data-field="firstname" >first name</th> ...

for loop - R comparing unequal vectors with inequality -

i have 2 single vector data frames of unequal length aa<-data.frame(c(2,12,35)) bb<-data.frame(c(1,2,3,4,5,6,7,15,22,36)) for each observation in aa want count number of instances bb less aa my result: bb<aa 1 1 2 7 3 9 i have been able 2 ways creating function , using apply, datasets large , let 1 run night without end. what have: fun1<-function(a,b){k<-colsums(b<a) k<-k*.000058242} system.time(replicate(5000,data.frame(apply(aa,1,fun1,b=bb)))) user system elapsed 3.813 0.011 3.883 secondly, fun2<-function(a,b){k<-length(which(b<a)) k<-k*.000058242} system.time(replicate(5000,data.frame(apply(aa,1,fun2,b=bb)))) user system elapsed 3.648 0.006 3.664 the second function faster in tests, let first run night on dataset bb>1.7m , aa>160k i found this post , , have tried using with() cannot seem work, tried loop without success. any or direc...

osx - NSTextField in NSTableCellView - end editing on loss of focus -

i have view view-based nstableview (which has cell view single text field) , buttons , textfields outside tableview. 1 of buttons adds object datasource tableview, , after inserting row tableview, makes editable. if user enters text , pressed return key, receive - (bool)control:(nscontrol *)control textshouldendediting:(nstext *)fieldeditor delegate method fine, , can run validation , save value. delegate doesn't called if user selects of other buttons or textfields outside tableview. what's best way detect loss-of-focus on textfield inside nstablecellview, can run of validation code on tableview entry? if understand correctly want control:textshouldendediting: notification fire in following situation: you add new object array controller. the row in table representing object automatically selected. you programmatically select text field in relevant row editing. the user (i.e. without making edits in text field) gives focus control elsewhere in ui one...