Posts

IE<= 10: I can type characters inside contenteditable=false element -

this dom structure: <div contentediatble="true"> <span contenteditable="false" class="my-block"> <span contenteditable="false">my block</span> <i contenteditable="false" class="icon-remove">x</i> </span> </div> root <div> looks textbox: in ie 9 , 10, when click root <div> , suppose caret after <span class="my-block"> element, , when typing, words should after whole block. but actually, when start typing, characters inside <span class="my-block"> element(rather after), followed <i contenteditable="false" class="icon-remove">x</i> , , can delete contents of <span class="my-block"> using backspace(but not delete whole span) this annoying , it's hard fix. ie makes tons of troubles developers :( however, expected result works in ff, chrome , ie11...

javascript - jstree plugin & stopPropagation issue -

i using jstree 3.0.8 first time , have issue stoppropagation. when click on span.nodeinfo, despite stoppropagation, stills trigger event of parent link. you can see exemple on jsfiddle : http://jsfiddle.net/cloughylow/7p0xq698/29/ 1. wanna : i need put a button on parts of tree trigger action. here use alert tests (at least dialog). ( <span class="nodeinfo">?</span> in html below) i want disable select ( deselect_node(data.node) in js below) and trigger open/colse on parents nodes ( toggle_node(data.node) on js below) the last 2 points of list ok. can't make first 1 work without trigger third 1 caus stoppropagation doesn't seem work. have idea i'm doing wrong ? 2. i've done: html div id="mytreeview"> <ul> <li class="jstree-open" data-jstree='{"icon":"fa fa-folder"}'> title <span class="nodeinfo">?</span> ...

python - Stop SIGALRM when function returns -

i have problem can't seem solve myself. i'm writing small python script , know why signal.alarm still works after function it's located in returned. here code: class alarmexception(exception): pass def alarmhandler(signum, frame): raise alarmexception def startgame(): import signal signal.signal(signal.sigalrm, alarmhandler) signal.alarm(5) try: # some code... return 1 except alarmexception: # code... return -1 def main(): printheader() keepplaying = true while keepplaying: score = 0 level in range(1): score += startgame() answer = raw_input('would keep playing ? (y/n)\n') keepplaying = answer in ('y', 'y') so problem when startgame() function returns, sigalrm still counting down , shutdown program. here traceback: would keep playing ? (y/n) traceback (most recent call last): file "game.py", line 84, in <mo...

c++ - Can I use OpenMP reduction when the variable is an array element? -

the openmp manual says a type name in declare reduction directive cannot function type, array type, reference type, or type qualified const , volatile or restrict . what can produce results array elements? started with: int main() { // create input array static const int snum = 5000; int input[snum]; for(int i=0; i<snum; ++i){ input[i] = i+1; } // shared output variables reduction int sum[2]; sum[0] = 0; sum[1] = 0; #pragma omp parallel #pragma omp declare reduction(+:sum[0]) #pragma omp declare reduction(+:sum[1]) for(int i=0; i<snum; ++i) { int* p = input+i; if(i%2==0) sum[0] += *p; else sum[1] += *p; } } this gives compiler error: 27013152.cpp:16:9: error: ‘#pragma’ not allowed here #pragma omp declare reduction(+:sum[0]) ^~~ 27013152.cpp:17:33: error: ‘sum’ not name type #pragma omp declare reduction(+:sum[1]) ...

How to get a returned List of Objects object type from a Java method? -

i have getter method in class returns list of objects. looks this: public list <cars> getcars() { // code here } the class contains other getters one. in class, want getter methods contained in first class , display name of methods , returned data types. i'm able name of above method (getcars) , it's returned data type (list). however, can't seem "cars" type of object list contains. best can "objecttype". there way of getting "cars" displayed? i've read type erasure , how generics removed in bytecode it's used benefit of java compiler. problem related type erasure? is possible word "cars" displayed? when read type erasure there seems way generics list examples i've seen string , integer , not objects. get generic type of java.util.list thanks you can hold of (generic) information method using standard java reflection: class<?> yourclass = class.forname("a.b.c.classthathasthemet...

swift - Cannot access "Parse.setApplicationId()" -

i'm trying make app swift/obj-c (bridging header) parse.com so here's question: saw on many sites can use parse.setapplicationid("appid","clientid") when try code says use of unresolved identifier 'parse' i imported framework , set bridging header in properties. imported frameworks required it's written on parse.com all other classes/objects parse can used swift in code. this problem because of bug in xcode... (i think compiler failed) after restarted xcode error gone.

multithreading - C++ - Passing data between threads -

i have thread pool consists of 4 threads: t1, t2, t3, , t4. running concurrently, input t3 , t4 depends on output t2. how should implement message queue after t2 completes, send output data t3 , t4 processing? have tried implement message queue using locking mechanism, seems locking quite expensive. there lock-free mechanism pass data between threads? using boost::thread in visual studio 2010. boost has lock-free queue: http://www.boost.org/doc/libs/1_56_0/doc/html/lockfree.html .