Posts

java - Organizing array of unknown number of constants in all possible ways -

this question has answer here: permutations/combinatorics library java? [closed] 2 answers permutation of array 8 answers what best way of looping through array, ending organizing in possible ways can organized in? suppose have array: {a, b, c, d} what organize so: {b, a, c, d} {b, d, c, a} and forth, looping around creating 1 array analyze per looping. thank you,

Why are markers not shown on PrimeFaces GMap? -

i use following code initialize mapmodel , add test marker . @postconstruct public void init() { advancedmodel = new defaultmapmodel(); advancedmodel.addoverlay(new marker(new latlng(36.890257, 30.707417), "test")); } it used gmap model following xhtml. <p:gmap id="gmap" center="36.890257,30.707417" zoom="12" type="roadmap" model="#{mapbean.advancedmodel}" style="width:100%; height:400px;" /> when open page in browser map shows not marked. suggestions? the problem on using spring framework. class had annotated @named instead of @managedbean

python - To create loop that lets my regression formula include one variable each tome -

i've been working on stepwise regression. i'll find loop lets regression formula include 1 variable each time, i'm having trouble loop. code follows: def forward_selected(data, response): remaining = set(data.columns) remaining.remove(response) selected = [] current_aic, best_new_aic = 0.0, 0.0 while remaining , current_aic == best_new_aic: aics_with_candidates = [] candidate in remaining: formula = "{} ~ {} + 1".format(response,' + '.join(selected + [candidate])) aic = smf.ols(formula, data).fit().aic aics_with_candidates.append((aic, candidate)) aics_with_candidates.sort(reverse=true) best_new_score, best_candidate = aics_with_candidates.pop() if current_aic < best_new_aic: remaining.remove(best_candidate) selected.append(best_candidate) current_aic = best_new_aic formula = "{} ~ {} + 1".format(res...

android - variable textview not working -

i have code , cant variable string here private void location() { layoutinflater layoutinflater = layoutinflater.from(this); view promptview = layoutinflater.inflate(r.layout.alquila, null); textview tv = (textview) promptview.findviewbyid(r.id.gen); random r = new random(); int = r.nextint(101); tv.settext(i +""); final string passwd = tv.gettext().tostring(); final alertdialog alertd = new alertdialog.builder(this).create(); button btnadd1 = (button) promptview.findviewbyid(r.id.button3); btnadd1.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { new sendpostrequest().execute(); toast.maketext(login.this, passwd, toast.length_long).show(); // btnadd1 has been clicked alertd.dismiss(); } }); alertd.setview(promptview); alertd.show(); } and need variable string "passwd" to... public class sendpostrequest extend...

java any class for temperature? -

i trying write code checking temperature every hour. there class java.util.calendar; gets months , hours , seconds there class getting temperature? help. there libraries available such jscience , there's no class temperature measurements included in jdk. in case this, need @ conversion between fahrenheit , celsius, suggest write own, or use double.

ios - My ImageView's content mode stop working after I draw something on the image -

thanks time. the image fine before tap image, , image compacted after tap it. here code: i not using storyboard, create code, here imageview. , added constraints code well. let imageeditingview: uiimageview = { let imageview = uiimageview() imageview.contentmode = .scaleaspectfill imageview.clipstobounds = true return imageview }() override func touchesbegan(_ touches: set<uitouch>, event: uievent?) { if touches.first != nil { lastpoint = (touches.first?.location(in: imageeditingview))! } } override func touchesmoved(_ touches: set<uitouch>, event: uievent?) { if touches.first != nil { let currentpoint = touches.first?.location(in: imageeditingview) drawlines(frompoint: lastpoint, topoint: currentpoint!) lastpoint = currentpoint! drawlines(frompoint: lastpoint, topoint: lastpoint) } } func drawlines(frompoint: cgpoint, topoint: cgpoint) { uigraphicsbeginimagecontext(imageeditingv...

c# - Default combobox first item mixed with database results -

public static void fill_combo(string table, combobox cmb, string columns) { ds = new dataset(); try { conn.open(); da = new sqldataadapter($"select {columns} [{table}]", conn); da.fill(ds, table); cmb.datasource = ds.tables[table]; cmb.valuemember = ds.tables[table].columns[0].tostring(); cmb.displaymember = ds.tables[table].columns[1].tostring(); cmb.selecteditem = null; cmb.text = "select..."; } catch (exception ex) { messagebox.show(ex.message, "error"); } { if (conn != null) { conn.close(); } } } hey guys. code above i'm trying results database , bind them combobox, want first item random "select..." isn't in database. in advance. option 1 - can insert datarow containin...