Posts

Flatten Tree Structure Output html List (php) -

Image
i have ordered tree (the nodes in correct order output). each node has name, depth , parent_id properties. trying output nested list can visually see structure. having bit of trouble coming right. best way fix this? need change data structure and/or logic? here data: array(24) { [5]=> array(3) { ["depth"]=> int(0) ["name"]=> string(16) "basketball sport" ["parent_id"]=> null } [3]=> array(3) { ["depth"]=> int(1) ["name"]=> string(16) "basketball shoes" ["parent_id"]=> string(1) "5" } [2]=> array(3) { ["depth"]=> int(2) ["name"]=> string(6) "jordon" ["parent_id"]=> string(1) "3" } [4]=> array(3) { ["depth"]=> int(2) ["name"]=> string(6) "lebron" ["par...

c# - How to Host Portable Class Library Class Instance in ViewState -

i have asp.net web-forms application 2 projects: main web project , portable class library project . have following code: in portable project have item class: public class item { public int id { get; set; } public string name { get; set; } } and in default.aspx.cs page have following demo code: protected void page_load(object sender, eventargs e) { item item = new item(); item.id = 1; item.name = "john"; viewstate["mykey"] = item; } protected void button1_click(object sender, eventargs e) // have button named "button1" on page. { if (viewstate["mykey"] != null) { item item = (item)viewstate["mykey"]; button1.text = item.id + " " + item.name; } } obviously causing error: type 'portableproject.item' in assembly 'portableproject, version=1.0.0.0, culture=neutral, publickeytoken=null' not marked serializable while i'm aware of prob...

c++ - libvlc_video_set_subtitle_file not working -

i'm using following code set subtitle file, reason it's not working. qstring selectedfile = qfiledialog::getopenfilename(this, "open"); if(selectedfile == null) { return; } qdebug("before %d %d", libvlc_video_get_spu(player), libvlc_video_get_spu_count(player)); //int = libvlc_video_set_subtitle_file(player, selectedfile.tostdstring().c_str()); int = libvlc_video_set_subtitle_file(player, selectedfile.tolatin1().data()); qdebug("a = %d",a); qdebug("after %d %d", libvlc_video_get_spu(player), libvlc_video_get_spu_count(player)); subtitle index , count same before , after setting specific file, , function returns 1 (int a). however, setting subtitle libvlc_video_set_spu works. i'm using vlc 2.2.1 if on windows, qdir::tonativeseparators help: const qstring selectedfile = qfiledialog::getopenfilename(this, "open"); const qstring nativepath = qdir::tonativeseparators(selectedfile); libvlc_video_s...

svg groups and fill inheritance -

my goal have first group of 3 squares blue , next group of 3 squares red. minimize code, want take advantage of grouping in svg. rectangles remain blue. have tried inline styling on second group element , on use element, doesn't solve problem. thank assistance.. here's code: <svg width="1000" height="800" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink"> <style> .blue {fill:blue;} .red {fill:red;} </style> <g id="g1" class="blue"> <rect x="0" y="0" width="100" height="100" /> <rect x="0" y="105" width="100" height="100" /> <rect x="0" y="210" width="100" height="100" /> </g> <g class="red"> <use xlink:href="#g1" transform="translate(0,315)"...

jquery - Horizontal to off-canvas nav with splash screen, absolute positioning conflicts -

Image
i'm working on same site previous question (and i'm css3 noob). site i'm working on has horizontal navigation menu switches off canvas menu. i'm turning classes on , off jquery , it's looking pretty good. html divided 2 divs, #drawer , #site-canvas. simplified, html looks this <body> <nav id="drawer"> //ul menu stuff </nav> <div id="site-canvas"> <header> // header mobile version </header> <div class="splash">//splash screen<div> <div id="site-content">//lorem ipsum<div> </div> <!--end #site-canvas--> </body> it's going feature splash screen image take 100% of viewport , stay centered. /* splash page */ .splash { background: url('//image') center center; background-size: cover; min-height: 100%; } so far good, in desktop styles (1000px+ width) have conflict nav div being outside site canvas causin...

how can i use angularjs iterate a json string -

i have json string : {"age":[459,918],"id":["bizno459","bizno459"],"name":["name459","wrongname459"]} now want show using angular js : <table> <tr> <th>column</th> <th>value1</th> <th>value2<th> </tr> <tr> <td>age</td> <td>459</td> <td>918</td> </tr> <tr> <td>id</td> <td>bizno459</td> <td>bizno459</td> </tr> </table> the column dynamic, in example, there 3 : age, id, name. in example, have 2 columns: id,name. how achieve this? you can use json.parse convert json string object. after can use ng-repeat iterate on keys, , on each value every key: function tablectrl($scope){ var jsonstring = '{"age":[459,918],"id":["bizno459","bizno459"],"name...

SQL Server Get Updated Column Value -

i have col1 in table initial value of 0 1 row, want updated value of col1. my update query : update table set col1 = col1 + 1 i can last update put output : update table set col1 = col1 + 1 output inserted.col1 but not sure output value related same query or last updated other query @ same time. the value returned value of update statement. not reflect updates made other users. edit: you can store value in variable without output clause ( https://msdn.microsoft.com/en-us/library/ms177523.aspx ): update table set @col1 = col1 = col1 + 1;