Posts

ios - JSON format issue in PHP REST service receiving POST from AFNetworking 2.0 -

i have situation post json string ios code using afnetworking 2.0 code. client code looks this: nsurl *url = [nsurl urlwithstring:baseurlstring]; nsstring *jsonstring = [[nsstring alloc] initwithdata:jsonpayloadforproject encoding:nsutf8stringencoding]; nsdictionary *parameters = @{@"project": jsonstring}; afhttpsessionmanager *manager = [[afhttpsessionmanager alloc] initwithbaseurl:url]; manager.requestserializer = [afjsonrequestserializer serializer]; manager.responseserializer.acceptablecontenttypes = [nsset setwithobject:@"text/html"]; [manager post:@"service.php" parameters:parameters success:^(nsurlsessiondatatask *task, id responseobject) { nslog(@"%@", [responseobject description]); } failure:^(nsurlsessiondatatask *task, nserror *error) { uialertview *alertview = [[uialertview alloc] initwithtitle:@"post json project error" message:[error localizedde...

Template with Inheritance C++ -

using inheritance , templates, ive sort name array of employee information. got 3 classes, payroll, simplevector , sortingvector. payroll contains user info attributes, simplevector creates dynamic array of type payroll store user info. sortingvector class in charge of sorting array names. keep getting many different errors whenever tried fix previous error. posting each class: payroll class #pragma once #include<iostream> #include<string> #include<vector> using namespace std; class payroll { private: int empnumber; string name; double hours; double payrate; double grosspay; int *aptr; int arraysize; public: payroll(int size); payroll(); payroll(const payroll & apayroll); ~payroll(); //mutators void setvector(payroll &apayroll); void setempnumber(int empnumber); void setname(string name); void sethours(double hours); void setpayrate(double payrate); void setgr...

angularjs - angular ng-repeat prefilter in javascript -

i have following angular js filter ng-repeat on tr element. how accomplish of in javascript? possible in 1 custom filter? note: showrow function returns bool, search string string ng-repeat="lob in filtered = (lobs | filter : showrow | filter : searchstring | orderby : 'name':true ) you can use $filter service, or $scope.$eval: $filter('orderby')( $filter('filter')( $filter('filter')($scope.lobs, $scope.showrow), $scope.searchstring), 'name', true); $scope.$eval("lobs | filter : showrow | filter : searchstring | orderby : 'name':true"); not tested, should close enough work. and yes, using first way, create own filter that.

c# - Memory efficient data structure for high performance -

i have need circular buffer (or other data structure), on can "toarray" or similar call current state of buffer , use whilst buffer carries on possibly overwriting values held. the reason use case returned data passed worker thread process , idea ensure little data overwritten possible in between calls. choice of circular data structure ostensibly reduce memory usage of buffer fixed value. i built data structure below, until yesterday sufficient needs. relevant calls takesnapshot, takeall , takeweakarraysnapshot variations on same theme. the call made quite when 1000 samples of reference types available. all calls result in out of memory exception @ point. exception takeweakarraysnapshot reverts null midway through using array (something guess fact gc handle weak?) is there more suitable memory efficient data structure use or doing wrong? changing gc handle type normal help. possible create output type wraps references (like attempted weakreference) reclaimed ga...

c++ - StgOpenStorageEx returns STG_E_FILEALREADYEXISTS -

i struggling attempting find out why stgopenstorageex returns stg_e_filealreadyexists on compound document when opening readonly. didn't make sense. file there , wasn't trying create anything. open up. couldn't find answer online thought share answer found here. stgopenstorageex returns stg_e_filealreadyexists when file not compound document. in situation having problem encrypting , decrypting content compound document creating invalid. wasn't compound document @ all.

ruby on rails - Array function not working on a JavaScript array created from element text -

so have following element, when clicked on calls javascript function response(tag). pass element "rops" function. <li><div class="rops"><span class="rops-text"> tag2 </span></div></li> <li><div class="rops"><span class="rops-text"> tag2 </span></div></li> so when click on 1 of these elements adds them array. array functions work array, , created array. see following working case , not working case: they work if create array self: working case: var checka = []; checka[0] = "tag1"; checka[1] = "tag2"; alert(checka.indexof("tag2")); //gives me correct answer. not-working: array created this: response(tag) { myarray[i] = string($(tag).text()); //at current point has ["tag1", "tag2"] //but if same alert(myarray.indexof("tag2")); //gives me -1 (similar other array function). so in short...

asp.net web api2 - Web Api Routing with 404 response IHttpActionResult -

i trying below routes work having issue. route api/user/name works fine; result "whats up". however, route api/user/register results in 404. private void configurewebapi(httpconfiguration config) { config.maphttpattributeroutes(); var jsonformatter = config.formatters.oftype<jsonmediatypeformatter>().first(); jsonformatter.serializersettings.contractresolver = new camelcasepropertynamescontractresolver(); } the controller: using system.web.http; using angular.data.iservices; using angular.data.modals; namespace angular.api.controllers { [routeprefix("api/user")] public class usercontroller : apicontroller { private iuserservice _userservice; [route("name")] [httpget] public string name() { return "whats up"; } [route("register")] public ihttpactionresult register(user usr, string password) { _...