Posts

javascript - ExtJS change mask target while opening an Ext.Window -

i have extjs application , want change mask target while showing ext.window . when show window, entire dom masked, want mask div. overriding getmasktarget not working, gets target through ext.panel.header . maybe can setup window modal: false , mask component / element in window show event handler (remove mask in hide or destroy event handler depending on closeaction )?

c# - Code jam Store Credit -

problem receive credit c @ local store , buy 2 items. first walk through store , create list l of available items. list buy 2 items add entire value of credit. solution provide consist of 2 integers indicating positions of items in list (smaller number first). input first line of input gives number of cases, n. n test cases follow. each test case there be: • 1 line containing value c, amount of credit have @ store. • 1 line containing value i, number of items in store. • 1 line containing space separated list of integers. each integer p indicates price of item in store. • each test case have 1 solution. output each test case, output 1 line containing "case #x: " followed indices of 2 items price adds store credit. lower index should output first. limits 5 ≤ c ≤ 1000 1 ≤ p ≤ 1000 small dataset n = 10 3 ≤ ≤ 100 large dataset n = 50 3 ≤ ≤ 2000 sample data input 3 100 3 5 75 25 200 7 150 24 79 50 88 345 3 8 8 2 1 9 4 4 56 90 3 output case #1: 2 3 case #...

Read logcat continuously in Android app -

i'm trying read continuously - means: if, example, have process every few second write logcat, want app listen on logcat, once new line added - catch , show on screen i have 1 activity every second write counter log: runnable r = new runnable() { @override public void run() { i++; log.d("bbb", "i= " + i); mhandler.postdelayed(this, 1000); } }; i have service trying "listen" on "logcat -s bbb", once listener started - app stuck (looks app entered endless loop) , after few seconds got message app must closed. the listener code is: (the message "start read line" printed , that's it...) public static void parse() { runtime rt = runtime.getruntime(); process process = null; try { process = rt.exec("su"); dataoutputstream os = new dataoutputstream(process.getoutputstream()); os.writebytes("logcat -s bbb"); ...

Camel Processor not working in a Splitter pattern -

i have camel route which, when bit simplified, boils down following one: <bean id="myprocessor" class="com.acme.myprocessor" /> <camelcontext xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="file:/home/inbox?filename=file.txt&amp;noop=true" /> <split> <tokenize token="@" /> <process ref="myprocessor" /> </split> <to uri="file:/home/outbox" /> </route> </camelcontext> to surprise have found if processor being invoked, not able change single tokens. example: public class myprocessor implements processor { public void process(exchange exchange) throws exception { string mystring = exchange.getin().getbody(string.class); exchange.getin().setbody(mystring.touppercase()); } } in end, file produced tokens not a...

unit testing - How to return multiple values when using mock patch.object with contextlib.nested -

i new unit testing , trying write unit test using patch.object mock function calls. mocked function getobj() called twice in function testing. first time when called expecting none return_value , second time expecting some_string . not getting how it. the code follows: def test_create(self): contextlib.nested( patch.object(agent, 'try_connect', patch.object(util, 'get_obj', return_value = none), ) (mock_try_connect, mock_get_obj): proxy_info = self.util.create(data) i tried using side_effects , , give input return_value every time returning none . mock_value=mock() mock_value.side_effect = [none, 'some_string'] patch.object(util, 'get_obj', return_value = mock_value()) use assert_has_calls verify mocked out object being called how expect called. debug issue. def test_create(self): contextlib.nested( patch.object(agent, 'try_connect', patch.object(util, ...

bash - Check wordcount in until loop -

i want continue bash script when docker container has 2 mentions of string in logs..i tried following code can't seem re-count variable (using eval), stays stuck: number=`docker logs mysql 2>&1 | grep 'mysqld: ready connections' | wc -l` until [ "$number" -eq 2 ]; sleep 2 echo $number eval "$number" done echo mysql started , rebooted, continue.. i fixed this: number=0 until [ "$number" -eq 2 ]; sleep 2 number=`docker logs mysql 2>&1 | grep 'mysqld: ready connections' | wc -l` done

javascript - How to get data from one php page using ajax and pass it to another php page using ajax -

i trying data 1 php page , pass page using ajax. js : $.ajax({ url: "action.php", success: function(data){ $.ajax({ url: "data.php?id=data" } }); action.php : <?php $test= 1; ?> data.php : <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script type="" src="action.js"></script> <?php $id = $_get['id']; echo $id; ?> first of all, need echo data in action.php , , second, use data parameter of ajax request send data data.php . here's reference: jquery.ajax() so organization of pages should this: js : $.ajax({ url: "action.php", success: function(data){ $.ajax({ url: "data.php", data: {id: data}, success: function(data){ // code // alert(data); ...