Posts

angularjs - Broken 2 Way Data Binding -

going through forms angular2 tutorial . , part code isn't doing tutorial explains should happen. before reach conclusion angular2 beta has bug maybe try out. it's problem around 2 way data binding of "powers dropdown" user input change isn't being reflected in model. 2 way binding occurs with: <select class="form-control" required [(ngmodel)]="model.power"> edit: see full code here when run code keep eye on "{"id":18,"name":"dr iq","power":"really smart","alterego":"chuck overstreet"} " output. notice changes edit 2 txt inputs changes dropdown not reflected in output.

ios - Swift/CoreData - Variable reference changes after initializing -

i'm getting feet wet coredata using swift , coming across doesn't make sense me. basically i'm building simple map app user can drop pin, select info button annotation view, , add location "favorites" list. want keep list between sessions. i have in appdelegate: func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool { // override point customization after application launch. self.datacontroller = datacontroller() return true } datacontroller() code located deals with....you guessed it. data. have init() , 1 other function adds data. this code takes info , uses function in datacontroller class add data data set let defaultaction = uialertaction(title: "ok", style: .default, handler: { (action) -> void in let appdelegate = uiapplication.sharedapplication().delegate as! appdelegate appdelegate.datacontroller.additemtodata(self.locat...

sql server - Passing variable into xp_cmdshell -

i have stored procedure in sql server checks today's backup files (files has date in filename). after checks, move on robocopy these files folder. the challenge: in folder, there files yesterday's or other dates. today's bak files required transfer. --@day allows me capture day of month declare @day char(2) set @day = right('00' + convert(nvarchar(2),datepart(day,getdate())),2) --print @day --in "myfolder", might containts files --project_backupfile_01_2006_02_28_001.bak --or project_backupfile_01_2006_02_27_001.bak --currently need hard code 28 represent 28th. how pass in @day? exec master..xp_cmdshell 'dir d:\myfolder\project*28*.bak/b' --similarly, pass in @day variable --project_backupfile*02_*@day.bak -- copy backup fules ftp local drive exec master..xp_cmdshell 'robocopy "d:\source" "e:\mssql\restore\" project_backupfile*_02_28*.bak /nfl /ndl /copy:dat /r:2 /w:1 /xo /e /z /mt:10' use variabl...

decision tree - Arguments length error when trying to test model using party package in R -

i have divided data set 2 groups: transactions.train (80% of data) transactions.test (20% of data) then built decision tree using ctree method party package follow: transactions.tree <- ctree(dt_formula, data=transactions.train) and can apply predict method on training set , use table function output result follow: table(predict(transactions.tree), transactions.train$satisfaction) but problem occurs when try output table based on testing set follow: testpred <- predict(transactions.tree, newdata=transactions.test) table(testpred, transactions.test$satisfaction) and error follow: error in table(predict(pred = svm.pred, transactions.tree), transactions.test$satisfaction) : arguments must have same length i have done research on similar cases suggested omitting na values did without changing error outcome. can me poniting out what's problem here?

Cannot post variable from android client to php server -

i develop android code transmit , received between android apps , php. received part based on json, working. have tested set variable manually in php code. however, when have posted variable android php, cannot receive it. can tell me problem ? @override protected string doinbackground(void... params) { arraylist<namevaluepair> namevaluepairs = new arraylist<namevaluepair>(); namevaluepairs.add(new basicnamevaluepair("username", <your username here>)); try { httpclient httpclient = new defaulthttpclient(); httppost httppost = new httppost(<your url php file>); httppost.setentity(new urlencodedformentity(namevaluepairs, "utf-8")); httpresponse response = httpclient.execute(httppost); // execute post url string st = entityutils.tostring(response.getentity()); // result php web log.d(tk_configuration.tag, "in try loop" + st); // still executing final...

sql - postgresql insert or create with temp table merge -

i have 3 tables: a b , c . b temp table created output of csv . goal copy necessary values b a but 1 of attributes has created or selected c . so far have with table_c_data ( insert table_c (id) select table_c_id table_b b not exists (select * table_c c b.table_c_id = c.id) returning * ) insert table_a (w,x,y,z) select table_c.id, x, y, z table_b inner join table_c_data table_c on table_b.table_c_id = table_c.id; but having trouble figuring out how have original table_c_data return if record does existing. (before added in where clause specifying existing query ran expected, trying handle uniquness constraints have check whether record exists first)

go - Golang unmarshal json map & array -

after reading json , go , understand basics of decoding json in go are. however, there problem input json can map & array of maps. consider following problem: package main import ( "encoding/json" "fmt" ) func main() { b := []byte(`[{"email":"example@test.com"}]`) c := []byte(`{"email":"example@test.com"}`) var m interface{} json.unmarshal(b, &m) switch v := m.(type) { case []interface{}: fmt.println("this b", v) default: fmt.println("no type found") } json.unmarshal(c, &m) switch v := m.(type) { case map[string]interface{}: fmt.println("this c", v) default: fmt.println("no type found") } } now, how value email : example@test.com in both cases( b & c ) question: if json array, want loop on each & print email. if json map, want print email directly pla...