Posts

Rails belongs_to one of two models -

i'm working 2 different models person , organization . among many other attributes, both person , organization can contractor . if working person model , wanted store contractor information contractor belongs_to :person , done it. seems contractor belongs 2 other models. i searched around on google , found lot of info how assign ownership 2 different models @ once. (for example sale must belong both buyer , seller .) in situation contractor either person or organization . there way elegantly store contractor information both models in same table? if not, figure can make 2 different contractor tables, figured might opportunity learn something. many in advance. maybe can try this. rails provide polymorphic-associtions . can try build 1 model named contractorinfo belongs contractable(use polymorphic: true), person has_one contractorinfo contractable, organization has_one contractorinfo contractable.

parse.com - How to delete all objects (rows) in Parse using c# -

basically, want clear table (or class parse names it) , repopulate new values. repopulation not issue, cannot figure out how delete objects in class. coding in c#. edit: have tried accomplish parseobject question = new parseobject("questions"); await question.deleteasync(); await question.saveasync(); i have tried grasp query, no avail. (think i) can run query, dont know how perform delete operation on data. parsequery<parseobject> query = new parsequery<parseobject>(); await query.findasync(); solved: ienumerable<parseobject> query = await parseobject.getquery(q_parse_table_name).whereequalto(q_parse_column_qset, qsetno).findasync(); foreach (parseobject po in query) await po.deleteasync(); well documentation not can give algorithmic steps can try. first, objects using query. once have got objects, can use destroy method delete data. execute save method. let me know if works. edit: try await myobject.deleteasync(); on...

liferay - How to add SELECT ALL function in Search Container? -

Image
i want have select all function in search container this: this code of search container : <liferay-ui:search-container delta="5"> <%-- <c:choose> <c:when test=""> </c:when> <c:otherwise> </c:otherwise> </c:choose> --%> <liferay-ui:search-container-results results="<%= reguseraccountlocalserviceutil.getreguseraccounts(searchcontainer.getstart(), searchcontainer.getend()) %>" total="<%= reguseraccountlocalserviceutil.getreguseraccountscount() %>" /> <liferay-ui:search-container-row classname="com.pmti.bir.triu.model.reguseraccount" keyproperty="acctid" modelvar="areguseraccount" > <liferay-ui:search-container-column-text> <input name="rowchecker" type="checkbox" value="<%=areguseraccount.getacctid()%>" /> </liferay-ui:search-container-column-text> <liferay-ui:search-container...

cordova - Windows phone dropdownlist choose options not showing current selected option -

i working on windows phone 8.1 universal app using cordova. getting weird issue while working dropdownlist. when tap on dropdownlist open choose item screen can select item. screen shows options start not selected option. for example have year dropdownlist start option 2001 2050. , have selected year 2025 whenever open dropdownlist shows 2001 not 2025. you need save selected option in local settings , read when open "choose item" screen. this: windows.storage.applicationdata.current.localsettings.values["year"] = "2002";

android - Disable dragging in MPAndroidChart PieChart -

how can disable dragging gesture in piechart . want chart static image. try chart.settouchenabled(false); more details can found here .

dart - Autostart chrome app on wake up mainly on chromebook to update its data in background -

i new in dart , want create chrome app should work on chromebook. i need data updated @ particular interval if app in background or chromebook has booted/woke up. is there setting or need kind of programming? if want background page active it's more complicated... first have add in permissions "background" else window background page inactive ( declare permissions ) after need keep background page alive , should @ chrome.alarms api , when alarms fired can call server retrieve information

python - How can i use a function with "variable" constants in scipy.optimize? -

how can use "variable" constants in scipy.optimize functions? trying create iterative optimisation algorithm, updates parameters in objective function after each optimisation run. to use simple example of want do: from scipy import optimize opt def f(x, r): return r * (x[0]**2 + x[1]**3) r = 0.1 # initial r value y = [] y.append([2,2]) # initial point in range(0,10): y.append(opt.fmin(f, y[i])) # how can include 'r' in line?? r = some_function_to_update_r(r) any appreciated edit: re-declare objective function each time optimise? make loop instead? for in range(0,10): def f_temp(x_temp): return f(x_temp,r) y.append(opt.fmin(f_temp, y[i])) r = some_function_to_update_r(r) or there better way? fmin supports optional args argument, representing tuple of additional arguments passed function you're trying optimize: y.append(opt.fmin(f, y[i], args=(r,))) this explained in documentation fmin ; should habi...