Posts

php - Arrange parent-child relationship -

i have read build tree flat array in php , convert series of parent-child relationships hierarchical tree? not figure out how implement problem. there pairs of relations such: array ( [0] => catalog.iden = catalog_sub.parent [1] => catalog.group = catalog_group.iden [2] => catalog_photo.iiden = catalog.iden ) i have not null, or 0, or explicit condition stop looping. know field has primary key auto_increment attribute. in example field named 'iden' in relation "parent". i have spent week resolve problem no result. me arrange array in order of relations. may tree of flat array. thanks in advance. update so far managed so: foreach($matches[0] &$match) { $ref = explode('=', $match); // split = sign $lft = explode('.', $ref[0]); $rgt = explode('.', $ref[1]); if($lft[1] == 'iden') { $arr[$lft[0]][$rgt[0]] = $rgt[1]; } else { $arr[$rgt[0]][$lft[0]] = $lft[1]; ...

haskell - narrowing type of a vinyl record based on the lens/index chosen -

extensible records provided http://hackage.haskell.org/package/vinyl different other libraries (hlist , others grapefruit-records/records) provide. because result of lookup based on pair (result type, label) , while other libraries have lookup based on label only. example of happening vinyl: {-# language datakinds, typeoperators #-} import data.vinyl r = fixrecord $ (field :: "x" ::: a) =: (3::double) <+> (field :: "x" ::: a) =: (2::int) main = print $ rget (field :: "x" ::: int) r print $ rget (field :: "x" ::: double) r -- prints 2\n3 for application http://hackage.haskell.org/package/rlang-qq , type of elements of record determined usage later on, seems need "x" uniquely determine value that's stored there. i want avoid "redundant" type signature in expression (rget (field :: "z" ::: [double]) (ans :: plainrec ("z" ::: [double] ': '[]))) and have more...

c# - LinqToSQL - ToList() appears to be very slow -

i'm newish linqtosql , project working on cannot changed else. translating old sql code linq. not being hot @ linq, used linqer translation me. query took 90 seconds run, thought must linqtosql. however, when copied query linqtosql produced , ran executequery on datacontext super quick expected. i've copied full queries, rather trying distil down, looks issue linqtosql doing behind scenes. to summarise, if copy t-sql created linq , run var results = db.executequery<invoicebalancecheckdto.invoicebalancecheck>(@"t-sql created linq - see below").tolist() it completes expected results in 0.5 seconds. runs same time directly in ssms. however, if use linqtosql code creates t-sql , tolist() takes ages. result 9 records, although without constraint check balance <> 0, there around 19,000 records. it's if it's getting 19,000 , checking <> 0 after it's got records. have changed linq project class used above, rather anonymous type, makes n...

c# - Keep page contents while post back -

when ever postback page blanked, have seen pages, page not being blank while post back can give me idea how can done thank you private void page_load() { if (ispostback) { // postback } else { // not postback } } refer link http://msdn.microsoft.com/en-us/library/system.web.ui.page.ispostback.aspx

search - Searching a custom listview using an ArrayAdapter in Android -

i have custom listview has 2 textviews , 1 imageview in it. uses custom arrayadapter it's adapter, , wanted add search function it. i've looked through every single tutorial find, no luck. 1 tutorial able search through regular listview (not using custom adapter), not work me because need show both textviews , imageview. need filter 1 of textviews though, don't see how trouble be. anyway, here mainactivity: public class itemid extends activity { // list view private listview lv; // listview adapter arrayadapter<string> adapter; // search edittext edittext inputsearch; // arraylist listview arraylist<hashmap<string, string>> productlist; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.testo); context ctx = getapplication(); resources res = ctx.getresources(); string[] options = res.getstringa...

class - Windows Phone Classes with same name but different folders -

i have 2 auto-generated classes generated xsd tool. the classes have same name , similar member variables. but many of members different. i storing these classes in different folders. there still conflict - this the type 'response' contains definition 'field1' how store these classes avoid conflict?? i don't want change in classes auto-generated , changing them might cause xml parsing errors the classes have structure below:- public partial class response { public string field1; public string field2; public string field3; } public partial class response { public string field1; public string field2; public string field4; } the classes stored follows myproject->classes->folder1->class1 myproject->classes->folder2->class2 if entire class autogenerated visual studio (and not touched/moved afterwards), classes have different namespaces namespaces derived folder names. different namespaces shouldn't have ...

How to get the confidence of HaarDetection in python openCV 2.0 -

the old version of opencv returned number of neighbors detected, , used measure of confidence. for example: cv.haardetectobjects(grayscale, cascade, storage, 1.2, 2, cv.cv_haar_do_canny_pruning, (50,50)) [((174, 54, 114, 114), 53)] the new version of opencv changed signature used, either detectmultiscale(image[, scalefactor[, minneighbors[, flags[, minsize[, maxsize]]]]]) -> objects or detectmultiscale(image, rejectlevels, levelweights[, scalefactor[, minneighbors[, flags[, minsize[, maxsize[, outputrejectlevels]]]]]]) -> objects the second signature has rejectlevels , levelweights which, understanding, can used confidence. this reflection of c++ version of functions. but, unclear me how pass parameters changed in python. i've tried, example, following, not change r , w : r = list() w = list() res = cascade2.detectmultiscale(image=img, rejectlevels=r, levelweights=w) print res print r, w [[ 82 158 53 53] [175 157 52 52] [103 266 112 112]] ...