Posts

css - Unexpected resulting box height -

i'm setting: font-size: 13.44px line-height: 1.4881 multiplying those, gives 20.000064 but rendered/calculated height of box 19px why? http://jsbin.com/vokesukeye/2/edit?html,output as wrote in comment earlier: pixel values being rounded, first font-size 13px , result 19px, due nature of pixels (which whole pixel or no pixel, except possibly on retina displays)

How to check a checkbox in a jsTree (JavaScript) -

i'm using jstree , having problem preset checkboxes via data stored in cookie. i'm able store clicked checkboxes in cookie not know how check checkboxes data saved within cookie. maybe problem way create jstree because none of samples tried work. to give code understand did have @ submit function. iterates on of checked checkboxes , creates array of id's id field stored in metadata way , maybe that's reason why not work way expected. <script> $(document).ready(function() { $("#treeviewdiv").jstree({ "core": { // core options go here "multiple": true, // no multiselection "themes": { "dots": false // no connecting dots between dots } }, "json_data": { "data": [{ "data": "options", "metadata": { "group": "1" }, "ch...

compiler construction - llvm ir not behaving as expected -

i have following llvm ir , having spent best part of day trying debug cannot seem handle on it. program freezes (with) segfault @ loop when run on windows machine. ; standard declaration etc %gen__list__0 = type { i8*, i64, i64 } %const_array_offset = type { i64, i64 } ; other declaration etc @gbl_constant_59 = common constant [20 x i8] c"aaaaaaaaaaaaaaaaaaaa", align ; more function declarations etc define internal %gen__list__0 @gen__fun__elevate12(%const_array_offset*) { entry: %1 = alloca %gen__list__0 %2 = getelementptr %const_array_offset, %const_array_offset* %0, i32 0, i32 0 %3 = load i64, i64* %2 %4 = getelementptr %const_array_offset, %const_array_offset* %0, i32 0, i32 1 %5 = load i64, i64* %4 %6 = sub i64 %5, %3 %7 = mul i64 %6, i64 2 %8 = getelementptr %gen__list__0, %gen__list__0* %1, i32 0, i32 0 %9 = getelementptr %gen__list__0, %gen__list__0* %1, i32 0, i32 1 %10 = getelementptr %gen__list__0, %gen__list__0* %1, i32 0, i32 2 store...

c++ - Can't access protected member variables of the most base class through std::unique_ptr in diamond -

i not advanced programmer. suppose there classic diamond inheritance: class base class a: virtual public base class b: virtual public base class last: public a, public b suppose base has variable, m_x , common both a , b , such 1 of a , or b , can called @ time, not both (which needed). around this, used: class last: public a, public b { private: std::unique_ptr<base> m_p; public: last(int i) { if (i) m_p = std::unique_ptr<base>(new a()); else m_p = std::unique_ptr<base>(new b()); } }; this fine, m_p->m_x cannot accessed anymore because says it's protected, both a , b call m_x in constructors directly, no problems. is known limitation or wrong way it? if it's wrong, solutions there? here code based on diagram found here (a bit lower on page): #include <iostream> #include <memory> class power { protected: double m_x; public: power() {} power(double x):...

scala map in a method argument can not add key-value -

in scala , how pass map method reference object can add key-value map. tried code, doesn't work. var rtnmap = map[int, string]() def getuserinputs(rtnmap: map[int, string]) { rtnmap += (1-> "ss") //wrong here } i understand, default, argument in method val, final in java, can provide safety. @ least should allow insert new entry. have idea ? welcome functional programming first of use case possible mutable map . have using immutable map because default available in scala. package scala.predef default available in scala , don't need import default. below code works excepted. import scala.collection.mutable.map val gmap = map[int, string]() def getuserinputs(lmap: map[int, string]) = { lmap += (1-> "ss") } below call change contents of gmap getuserinputs(gmap) here proof scala> import scala.collection.mutable.map import scala.collection.mutable.map scala> | val gmap = map[int, string]() gmap: scala...

assembly - Compare two values from the stack? -

this question has answer here: gas: many memory reference 3 answers i stuck in assembler code want compare 2 values of stack. x86, syntax at&t cmpl -4(%ebp), 4(%ebp) error: many memory references `cmp' i think not possible compare 2 values based on multiplier , ebp. suggestions ? you can compare 2 values in memory using cmpsd instruction. op wants equivalent to: cmpl -4(%ebp), 4(%ebp) he can placing addresses of memory locations of interest in esi , edi respectively, , using cmpsd memory-to-memory string-compare instruction : lea -4(%ebp), %esi lea 4(%ebp), %edi cmpsd (forgive non-expert abuse of at&t syntax). that's different in practice. other answers provided here (load value register , compare) more practical. if nothing else, solutions burn 1 register, , hack burns two. lesson: in assembler, ther...

join - IndexedRDD used in streaming context? -

i want use fast join operation in spark streaming context, such join b, fixed dataset reading file, b small streaming rdd read socket. i've tried common way provided spark, 5,000,000 rdd joining 10 streaming rdd costs 4 seconds. later i've tried using indexedrdd, can't make it. have following questions: is 4 seconds slow? can use performance tuning method such broadcast join improve? if slow, why? heard rdd's join operation linear search, true? can indexedrdd's join operation faster common way? how use indexedrdd in streaming context? i've tried way: streaming_rdd.transform{ rdd => indexed_data.innerjoin(indexedrdd(rdd)){(id, a, b) => (a, b)} it pass compile when running got error: java.lang.classcastexception: scala.collection.immutable.$colon$colon cannot cast [lscala.tuple2; i don't know if proper way use indexedrdd, , don't know caused error either. can 1 me?