Posts

octree - Barnes Hut worst case memory scenario -

i want run barnes hut n-body simulation ( wikipedia article ). know how memory single node of octree occupy, can't figure out worst case memory usage scenario given number of particles. in short, i'm wondering how many nodes possibly exist in octree given number of particles. need know know how memory allocate octree. edit: oh, , i'm writing in c if wants give me code instead of , explanation. i have this, way worse worst case scenario. it's guaranteed @ least allocate enough memory. i'm hoping can give me little more memory efficient. int kbh_worstcase(int particles) { // returns number of nodes required store number of particles in worst case scenario int worst; unsigned int n; worst=1; n=1; while(n<particles) { n=n<<3; worst+=n; } return worst; } i'm not sure if such suitable criterion exists. octree takes account particles distribution change during simulation. effective depth of t...

CSS and form input:text not showing input text -

i trying make input form have background image, apply css class input, default value not show (it work if there no css class applied). here html: <form> <input type="text" class="emailinput" value="enter email address"> <input type="submit" class="emailbtn" value=""> </form> and here css associated it: input.emailinput { color:#000; background:url('images/emailbackground.png') no-repeat; display:block; width:313px; height:31px; text-indent:-5000px; position:relative; top:0px; left:-2px; border:none; } input.emailbtn { background:url('images/emailbtn.png') no-repeat; display:block; width:55px; height:38px; text-indent:-5000px; position:relative; top:-32px; left:323px; border:none; } i @ total loss. appreciated. perhaps text-indent:-5000px; causing text positioned out of visible area.

refactoring - Is there command-line tool to extract typedef, structure, enumeration, variable, function from a C or C++ file? -

i desiring command-line tool extract definition or declaration (typedef, structure, enumeration, variable, or function) c or c++ source file. way replace existing definition/declaration handy (after transforming extracted definition user-submitted script). there such generic tool available, or resonably close approximation of such tool? scriptability , ability hook-up user created scripts or programs of importance here, although academically curious of gui programs too. open source solutions unix/linux camp preferred (although curious of windows , os x tools too). primary language interests c , c++ more generic solution better (i think not need super accurate parsing capabilities finding, extracting , replacing definition in program source file). sample use cases (extra - curious mind): given nested struct s , variable (array) initializations of these types, suppose there need change struct definition adding or reordering fields or rewriting variable/array definitions in ...

javascript - how can i toggle a <p:password> field to text and password with a checkbox check uncheck -

i using p:password tag registration. want toggle field text when checked check box, change password type mode when unchecked. how solve problem primefaces component. using primefaces 3.0 , jsf 2.0. under cover generates <input type="password"/> field (with other attribute name etc..) so if need show password have check box like <input type="checkbox" id="showpassword" onclick="showpassword()"/> show password in javascript function showpassword(){ var showpasswordcheckbox = document.getelementbyid("showpassword"); if(showpasswordcheckbox.checked){ document.getelementbyid("id_for_your_password_field").type="text"; }else{ document.getelementbyid("id_for_your_password_field").type="password"; } }

javascript - How to scroll when cursor is on the edge of div? -

Image
i have div(menubar) has lot of links , these links out of view. must make div scroll right or left when cursor @ edge of menu div, in order bring these menu items view. i beginner jquery, appreciated. markup in jsfiddle short: use-ready solutions: scrolling-carousel jmycarousel ( demo ) smooth div scroll full answers can read on relative questions: jquery plugin continually horizontally scroll on mouseover looking jquery plugin (or code) automatically scroll carousel items on mousover

android - How to reference the current or main activity from another class -

i find myself needing access methods require referencing activity. example, use getwindowmanager , need access activity. code using these methods in other class has no reference activity. until now, i've either stored reference main activity or passed context of activity class. there better way this? passing context better way refrence activity. you can pass context class. in activity :: anotherclass obj = new anotherclass(this); in class class anotherclass{ public anotherclass(context context){ } }

java ee - Primefaces dataTable only adding a single row -

i've been digging through archives find answer might help, nothing seems apply. i have page in jsf nested datatables holding list backing bean. page seems holding data without issues, when attempt add rows either of datatables using p:collector primefaces object, datatable ever displays single row. adding empty object both lists. the objects contained in list custom objects implement serializable. my backing bean conversationscoped, , data in backing bean instantiated when conversation started. here main page: <ui:composition template="/templates/pagelayout.xhtml"> <ui:define name="pagecontent"> <h:form id="genericworkflowmainform" enctype="multipart/form-data"> <p:panel id="actionlist"> <div align="right"> <p:commandbutton id="addactionbutton" value="add action" update="actiontable"...