Posts

Refactoring using Java 8 -

i want refactor code using java 8, thought instead of using setter method this: class myservice{ user user = new user(); user.setname(response.getname()); user.setid(response.getid()); user.settype(response.gettype()); user.setdesignation(response.getdesignation()); } in service class. i made method in user pojo class user{ public static user create(response response){ user user = new user(); user.setname(response.getname()); user.setid(response.getid()); user.settype(response.gettype()); user.setdesignation(response.getdesignation()); return user; } } and in service class, wrote: list<user> userlist=reponselist.stream().map(user::create).collect(tolist()); is right way or better solution other this? have lot of setter methods in service. instead of creating static create method, define user constructor takes response , initializes that. class user{ public user(response response) { ...

javascript - Jquery on click function only works for the first row of data. -

i have table auto-generated data database , created using jquery. created using following tr variable appended main tbody : below code : var list = " <tr id='order_no_tr'><td id='order_no_td" + item.documentno + "'>" + item.documentno + "</td><td>" + item.progressstatus + "</td><td>" + newdate + "</td>\n\ <td><button type='button' id='cnfrmd_rcvd" + item.c_order_id + "' class='btn btn-default btn-sm cnfrmd_rcvd" + item.c_order_id + "' >confirm received</button>\n\ <input type='hidden' name='order_no_txt' id='order_no_txt" + item.c_order_id + "' value='" + item.c_order_id + "' class='order_no_txt" + item.c_order_id + " btn btn-primary'/>\n\ </td></tr>"; $("#order_no_tbody...

python view not working after deploying django app -

i attempting deploy new app using apache , mod-wsgi. app takes date provided in post request , plots graph , table specific time range. date appears set correctly using python internal (development) web server, fails when using apache/wsgi. issue appears view; # set initial date custom_date = [1, 1, 2015] def getcustomdata(request): global custom_date form = dateform() if request.method == 'post': custom_date[0] = (str(request.post['custom_date_day'])) custom_date[1] = (str(request.post['custom_date_month'])) custom_date[2] = (str(request.post['custom_date_year'])) date_reformat = datetime.datetime.strptime(str(custom_date[0]+' '+custom_date[1]+' '+custom_date[2]), '%d %m %y') chart_date = date_reformat.strftime('%-d %b %y') return render(request, 'custom_results.html', {'cdate': chart_date}) else: date_reformat = datetime.date...

java - Project creation of silk4j getting "interface SpringProxy is not visible from class loader" -

Image
i got following error during creation of new silk4j project in eclipse. interface org.springframework.aop.springproxy not visible class loader looks indirect dependencies not imported can add explicitly in pom , try again <import-package> ... org.aopalliance.aop, org.springframework.aop, org.springframework.aop.framework, ... </import-package>

ios - App is rejected by apple -

my application been reject apple . have message me during review, app crashed on ipad running ios 9.2.1 , iphone running ios 9.2.1 when we: -launch app -logged in this occurred when app used: - offline - on wi-fi - on cellular network but working fine on simulator , ios devices . it dont know whats wrong . here crash reports http://a697.phobos.apple.com/us/r30/purple69/v4/f4/65/c0/f465c0c1-0261-7798-dca8-9b48c0de869a/temp..lfhkdwhz.crash?downloadkey3=1454075117_e097b43bf35613b18c897f3917dcd353 http://a401.phobos.apple.com/us/r30/purple49/v4/cb/6c/c8/cb6cc858-d47a-aba8-0a7c-1bf304c4c56f/temp..rhzbnjqi.crash?downloadkey3=1454075117_556853386b65ca6d799acd6f6ce64fac i dont know these crashes , how resolve them ? if have read apple instructions, said crashed on offline test. means while there no internet connection there not available. simply follow these steps: check internet reachability @ every place in app used after adding test app on device in app...

jsf - <f:setPropertyActionListener> Parent is not of type ActionSource -

i pass value when click on table row: <h:outputlink id="lnkhidden" value="datacenterprofile.html" style="text-decoration:none; color:white;"> <f:setpropertyactionlistener target="#{datacenterscontroller.selectedid}" value="#{item.componentstatsid}" /> </h:outputlink> i error: <f:setpropertyactionlistener> parent not of type actionsource, type is: javax.faces.component.html.htmloutputlink@aa25b91 is there appropriate jsf tag can used replace <h:outputlink> ? the f:setpropertyactionlister works actionsource components h:commandlink , h:commandbutton . should use 1 of these if want way. see

Calculate the mean of specific cells of multiple csv files -

i have multiple csv files, same format. there columns object , columns values. example: .....animals | age .... dog 2 cat 4 dog 6 ....etc. and want calculate mean age of dogs in csv files. language easier use calculation? regarding implementation? done java , opencsv library.