Posts

javascript - knockout.js foreach binding: property value to array of column names -

i have question knockout foreach binding table. i have array of columnnames , array of items . the items array has property called columnname . how use knockout foreach bind self.items self.columnnames? my view model looks this: var vm = function () { var self = this; self.items = ko.observablearray(); self.columnnames = [ "name", "age", "job"]; }; var vm = new vm(); ko.applybindings(vm); vm.items.push([ { 'columnname': 'name', 'value': 'john' }, { 'columnname': 'age', 'value': 25' } ]); vm.items.push([ { 'columnname': 'name', 'value': 'jane' }, { 'columnname': 'age', 'value': 26 }, { 'columnname': 'job', 'value': 'developer' } ]); ...

c# - How to return an object that's dependent on a chain of using statements? -

i'd write method similar one: c make() { using (var = new a()) using (var b = new b(a)) { return new c(b); } } this bad since when method returns, c keeps reference disposed object. note that: a implements idisposable . b implements idisposable . c not implement idisposable since author of c stated c not take ownership of b . your situation similar have seen when querying database. in attempt separate logic, see code this: var reader = executesql("select ..."); while (reader.read()) // <-- fails, because connection closed. { // process row... } public sqldatareader executesql(string sql) { using (sqlconnection conn = new sqlconnection("...")) { conn.open(); using (sqlcommand cmd = new sqlcommand(sql, conn)) { return cmd.executereader(); } } } but, of course, can't work, because time sqldatareader returns executesql method, connection...

iphone - IOS: Passing session credentials between app and website -

i doing ios application has uiwebview. user login in ios side passing php api , after login have uiwebview use same credentials. keep user login without asking him credentials. is possible it? yes can store credentials in key chain , in webview can use javascript identify elements (textfields) , populate values accordingly

linker - How to fix the armadillo library to c++ -

i'm using macbook program bits of code here , there. wanted in c++ armadillo library. after installation , doesn't seem work. for instance can write arma::mat variable, etc when run code in textmate: vec q = randu<vec>(5); cout << normalise(q); i error output: "undefined symbols architecture x86_64: "_wrapper_dgesdd_", referenced from: void arma::lapack::gesdd<double>(char*, int*, int*, double*, int*, double*, double*, int*, double*, int*, double*, int*, int*, int*) in test-56d704.o ld: symbol(s) not found architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation) rm: /var/folders/sh/vr2n15ln47j0k33yh1j0_tyw0000gn/t/test.cpp.sfz5vezn: no such file or directory the weird thing if don't use normalise or norm functions compiles well. i include library #include '/usr/local/include/armadillo' edit: i've installed armadillo package both trying " brew install armadillo ...

javascript - Getting php results to show after AJAX call without page reload -

i have 3 sections on page. pending, accepted, , denied users. output of data through php while loop. next pending users section, each user in section have 2 buttons (accept , deny). when either of buttons pressed run ajax call php file updates users status either accepted or denied (whichever pressed). the issue having without letting page refresh user's data not moved updated status section(everything updates correctly on db side). however, if move out return false; code page refreshes, $('#success').html('user status changed!'); $('#success').delay(5000).fadeout(400); goes away right when page refreshes, instantly. i need way page not refresh, user's data moved appropriate section, success message still appears. $(document).ready(function () { $('.approve').click(function () { $.ajax({ url: 'userrequest_approve.php', type: 'post', data: { id: $(this).val(), //i...

vmware - unable to install .vmdk file in windows 7 -

i need install .vmdk file in order setup base environment specific application software. below steps performed still struggling. installed vmware player (non commercial version) in system , while trying open .vmdk file through vmware player, started complaining "no operating system found". as next steps, tried install vmware-mount-5.5.0-18463.exe belive free software.but everytime in middle of installation,it showing "the wizard interrupted before vmware diskmount utility installed. system has not been modified. click finish exit installation". below system configuration: os: windows 7 ram: 4gb processor: i5-4200m cpu @ 2.50ghz dis space: 235 gb free. this first time trying install vmimage. please let me know 1. there wrong in approach? 2. there alternative way can install vmdk software? 3. there specific reason due getting above errors? in vmware world, vmdk image of virtual machine's hard drive. use vmdk, have create virtual machine, ...

When selecting an item in a datra frame, I obtain the item and the Levels R -

i have data frame , when select item, obtain next result, levels available in column. is there command desactivate this? or how should call element? this doing @ moment: a<-data$column[1] and obtain: [1] 1 1256 levels: 1 10 100 1000 ... 1000000 if want a number use: a <- as.numeric(paste(data$column[1])) [1] 1 if want a string use: a <- as.character(data$column[1]) [1] "1"