mrd abd

1

votes
1

answer
2.9k

views

Get Thread Cpu Usage

I have a set of cpu consuming executions that each run in thread with low priority. These threads will be run in a Process (Like IIS) that have many other threads that I don't want to slow them. I want to calculate the cpu usage of all other threads and if its greater than 50% then i pause one of my...
mrd abd
1

votes
1

answer
52

views

Pharo doesn't save temporary variable names

Hello Pharo community, I am following instructions based on PharoByExample. In chapter 3.6 when I paste the code of initialize method in the browser and Accept it, I see that temporary variables are renamed as tmp1 tmp2 tmp3 tmp4: initialize | tmp1 tmp2 tmp3 tmp4 | super initialize. tmp4 := self ce...
mrd abd
1

votes
2

answer
891

views

Disable hardware inputs on Selenium webdriver firefox

I have a ruby script to test a web page in Firefox. it sends mouse or keyboard events pragmatically to Browser but when hardware mouse is moved, it affects my test. How can i configure Firefox to forget hardware mouse and keyboard events?
mrd abd
1

votes
2

answer
205

views

Java gson, ClassCastException on decoding to Map<String,String[]>

I want to decode a json string like {'username':['emmet']} to a Map object. using following code: String json = '{\'username\':[\'emmet\']}'; Gson gson = new GsonBuilder().create(); Map map = new HashMap(); map = (Map)gson.fromJson(json, map.getClass()); String[] val = map.get('username'); System.o...
mrd abd
1

votes
2

answer
514

views

effective way to build a string

I want to build a long string dynamically and then write it to a file. i have a code similar to: let str = ref '' let appnd s = str := (!str ^ (Printf.sprintf '%s\n' s)) But in runtime it works very slow. i think this approach is not efficient. What is the best way to build a long string? building...
mrd abd
5

votes
1

answer
587

views

Z3: Offering random solutions in solving

I tried the following code in http://rise4fun.com/z3/tutorial (declare-const a Int) (assert (> a 100)) (check-sat) (get-model) the result is always a=101. I need some randomness in the answer that it produce a random number in the range [101,MAXINT). for example gets a seed=1000 and offers the a=123...
mrd abd
2

votes
3

answer
132

views

I expect the program prints the numbers 0 to 99, but when I run the code I see 100 lines of 99

I have a class foo: class foo{ public: int i; }; And a class bar: class bar{ public: foo* foo_; }; And a code similar to: int i=0; vector fs; while(ifoo_ = &f; fs.push_back(b); i++; } I expect that each bar->foo_ refer to a different foo, so when i have: for(i=0;ii)
mrd abd
2

votes
1

answer
182

views

Statement level reflection in java

I'm looking for a mechanism in java (maybe like Reflection) to access the statements in a program. for example i access the statements of a function, then walk throw the statement tree to have analysis on java programs. In .Net Microsoft provides the Extended Reflection. what is the alternative in j...
mrd abd