Posts

jquery - ASP.NET MVC RadioButtonFor Not Selected On Load -

there many other questions here on stack overflow , elsewhere, have spent far time sifting through them answers not ask 1 myself. have tried many of solutions found here , none of them work. my problem stated in title; radio buttons not being set on page load , can't figure out why. in code below model has boolean value cansubmit, cansubmityes , cansubmitno id's generated id's using viewcontext.viewdata.templateinfo.getfullhtmlfieldid("cansubmityes") and viewcontext.viewdata.templateinfo.getfullhtmlfieldid("cansubmitno") my radio buttons , corresponding labels set following: @html.labelfor(function(m) m.cansubmit, "yes", new {.for = cansubmityes}) @html.radiobuttonfor(function(m) m.cansubmit, true, new {.id = cansubmityes, .class = "submit-toggle-yes"}) @html.labelfor(function(m) m.cansubmit, "no", new {.for = cansubmitno}) @html.radiobuttonfor(function(m) m.cansubmit, false, new {.id = cansubmitno, .class...

railstutorial.org - Advanced Testing Setup - Ruby on Rails Tutorial -

Image
i'm working through ruby on rails tutorial , test worked fine until installed advanced testing setup @ end on chapter 3. never got expected result now when run test receive message result when run rake db:migrate here's copy of controller it's warning of duplicate title in staticpagescontrollertest . last test looking contact page, change it's title 'should contact'. then try re-running rake rake db:migrate

algorithm - Permutations and indexes, python -

i create list of permutations of lets 0,1,2 perm = list(itertools.permutations([0,1,2])) this used accessing indexes in list in specific order. every time index accessed popped. when element popped, elements indexes higher popped elements index shift 1 position down. means if want pop list indexes [0,1,2] result in index error, since index 2 not exist when reach it. [0,1,2] should therefor popped in order [0,0,0]. more examples [0,2,1] = [0,1,0] [2,0,1] = [2,0,0] [1,2,0] = [1,1,0] right being handled through series of checks, question if knows smart way turn list of lists generated itertools desired list: [(0, 1, 2), (0, 2, 1), (1, 0, 2), (1, 2, 0), (2, 0, 1), (2, 1, 0)] [(0, 0, 0), (0, 1, 0), (1, 0, 0), (1, 1, 0), (2, 0, 0), (2, 1, 0)] simply iterate through each tuple, , decrement indexes of each subsequent index greater element: l=[(0, 1, 2), (0, 2, 1), (1, 0, 2), (1, 2, 0), (2, 0, 1), (2, 1, 0)] def lower_idxs(lst): new_row = list(lst) i, val in e...

c# - Filter on Group By dataGrid -

i'm working on wpf - mvvm application. i have datagrid populated invoices filtered textbox works fine. now, grouped invoices invoice number (suppinvnumber), , filter doesn't work anymore. how can make work? viewmodel public class consultinvoiceviewmodel:viewmodelbase { public context ctx = new context(); private icollectionview _datagridcollection; private string _filterstring; private observablecollection<invoice> invoicecollection; public consultinvoiceviewmodel() { datagridcollection = collectionviewsource.getdefaultview(get()); datagridcollection.filter = new predicate<object>(filter); } public icollectionview datagridcollection { { return _datagridcollection; } set { _datagridcollection = value; onpropertychanged("datagridcollect...

spring - Bad deserialize with jackson -

i try call url accept list. data sent {"contactavailableidlist":["1"],"contactidlist":["2","3"]} method on server @requestmapping(value = "/lodgers/{lodgerid}/associate/dissociate/contact", method = requestmethod.put) public void associatelodgerandcontact(@pathvariable("lodgerid") long lodgerid, @requestbody @valid final list<long> contactidlist, @requestbody @valid final list<long> contactavailableidlist) { lodgerservice.associatedissociatelodgerandcontact(lodgerid, contactidlist, contactavailableidlist); } "{"timestamp":1445958336633,"status":400,"error":"bad request","exception":"org.springframework.http.converter.httpmessagenotreadableexception","message":"could not read document: can not deserialize instance of java.util.arraylist out of start_object token\n @ [source: java.io.pushbackinputstrea...

c# - How to stop thread if another thread has acquired lock on critical section? -

i have created scheduler executes piece of program in x minutes time interval. if program execution takes more time, next job should not wait current job completed. using system.timers.timer . _scheduler = new system.timers.timer(someminutes); _scheduler.elapsed += new elapsedeventhandler(ontimedevent); _scheduler.enabled = true; _scheduler.autoreset = true; private void ontimedevent(object source, elapsedeventargs e) { lock(obj) { //critical section } } if use lock, next thread waits current thread release lock. don't want behavior. if thread acquired lock object on critical section thread should exit without executing critical section you can use monitor . msdn: the monitor class controls access objects granting lock object single thread. object locks provide ability restrict access block of code, commonly called critical section. while thread owns lock object, no other thread can acquire lock. can use monitor class ensure no other thread al...

amazon iam - Does amzon congnito support for authenticating for IAM user -

there basic inquiry, suppose mobile game vendors, , have game player(users). want confirm whether game player iam user ? if so, how authenticate iam user using amazon congnito ? document not mention .. there no api login/authenticate (verify passwords) aws iam users. amazon cognito allows authenticate players/users when login facebook, twitter, digits, amazon, google or openid connect compatible provider (see external identity providers in documentation). alternatively, if store users , credentials in own backend database, can use cognito's developer authenticated identities feature authenticate players ( docs , sample ). whether using external provider or developer authenticated identities, cognito enables provide users aws credentials can directly access resources in aws (e.g. such s3 or dynamodb).