Posts

php - Wordpress update_user_meta not working -

** solved ** had failed require wordpress in form processor. adding line @ top fixed (always simplest thing, right!?): require_once( explode( "wp-content" , __file__ )[0] . "wp-load.php" ); i've created custom front-end profile client's site, , i'm adding way other users favorite profile. (please don't suggest buddypress or plugin -- i've tried dozen, , none of them have of capabilities need. thanks.) :) anyway.... here overview. hope it's clear. let's user 1 viewing profile of user 10. in database, user 1 has field called favorite_10 can set "yes" or "no" (or null) when clicks "favorite" button in user's profile, run simple script change value "yes" "no" or vice-versa that's it. think it's pretty solution, form processing script breaking @ update_user_meta line. here go. foreach($sitterlist $sitteritem) { $code = 'favorite_'.(esc_html($sitterit...

asp.net web api - How to post a string to web API controller? -

i new web api. using visual studio community 2015. simple testing code. webapiconfig.cs: config.routes.maphttproute( name: "defaultapi", routetemplate: "api/{controller}" ); view: $.ajax({ url: 'api/classingalgorithm/', type: 'post', data: { userweightings: json.stringify('hello') } }); controller: public class classingalgorithmcontroller : apicontroller { [httppost] public classingresult postweightings([frombody]string userweightings) { return null; } } in controller method, "userweightings" null. why? change ajax request below. $.ajax({ url: 'api/classingalgorithm/', type: 'post', contenttype: "application/json", data: json.stringify('hello') });

ios - UILabel doesn't show some Emoji on device -

when use uilabel, need show emoji expression. 😀, has 2 different kind of unicode . u+1f600 and e415 , sb-unicode. if latter 1 , assign uilabel's text, won't show on device. show on simulator. how can solve it?

html - I don't know why my function Flip() in JavaScript isn't returning anything. I want it to return if it is heads or tails -

javascript - don't see obvious wrong function flip() { var probability = math.floor(math.random()); if (probability > 0.5) { document.getelementbyid("message").innerhtml("heads!"); } if (probability < 0.5) { document.getelementbyid("message").innerhtml("tails!"); } html - nothing should wrong in html (besides selectors) <body> <button onclick="flip()" id="submit">flip coin</button> <p id="message"></p> </body> you should assign innerhtml below, not function. check demo - fiddle . function flip() { var probability = math.floor(math.random()); if (probability > 0.5) { document.getelementbyid("message").innerhtml = "heads!"; } if (probability < 0.5) { document.getelementbyid("message").innerhtml = "tails!"; } }

excel - Unmerge merged cell when empty -

i'm trying code right fail @ point: have excel sheet merges cell 1 underneath depending on value that's written in top cell, when value deleted merged cell i'd cells unmerge. try work sub keep code bit clean (don't know proper rules try) : public sub letitmerge(target object) if target.value = empty call unmergecell(target) else if (target.value = vv call mergecell(target) end if end sub sub unmergecell(m object) m.resize(1, 1).unmerge m.borders(xlinsidehorizontal).linestyle = xllinestyle.xlcontinuous end sub sub mergecell(n object) n.resize(2).merge 'merge cells n.verticalalignment = xlcenter 'center text n.horizontalalignment = xlcenter 'center text end sub a few minor tweaks code, appears working me. the worksheet_change event fires time there change on worksheet. based on value of changed cell, run either of unmerge or mer...

algorithm - Splitting 61 into integer partitions -

in program doing, have vector called a = [5, 6, 7] , have split integer 61 additive partitions using integer list. 1 example be 61 = 5 + 6 + 7 + 7 + 6 + 6 + 6 + 6 + 6 + 6 there many ways split this. have programmatically. 1 approach found follows. don't know if give result. first check if 61 divisible number in list. if is, can use number add many times (i.e. quotient) 61. in case, 61 prime number. fail. next step take first number in list (in our case, 5) , subtract 61 , try see if answer divisible member in list. if is, again found way addition. in case, subtracting 5 61 gives 56, divisible 7 , our solution be 61 = 5 + 7 + 7 + 7 + 7 + 7 + 7 + 7 + 7 in manner continue down list until find answer after subtraction divisible member in list. now given list me, [5, 6, 7] such there exists integer partition such that, can 61 additions using integer partition. won't have worry whether solution exists. approach seems crude. wonder if there efficient way using algor...

javascript - How to sort xPage multiline editBox by field converter? -

i have multiline edit box on page. want converter converts entered text list (replaces e.g. comas new line) @unique , sort on save. here code doesn't work: <xp:inputtextarea value="#{document1.members}" id="inputmembers" multipletrim="true" immediate="true"> <xp:this.multipleseparator><![cdata[#{javascript:"\n"}]]></xp:this.multipleseparator> <xp:this.converter> <xp:customconverter> <xp:this.getasobject><![cdata[#{javascript:@unique(value).sort();}]]></xp:this.getasobject> <xp:this.getasstring><![cdata[#{javascript:@replacesubstring(value, ",", "\n");}]]></xp:this.getasstring> </xp:customconverter> </xp:this.converter> it replace comas new line doesn't sort list don't use multipleseparator property. otherwise, getasobject converter executed every entry (=line) separately. that...