Android hierarchyviewer in monkeyrunner unable to load window data - monkeyrunner

I'm trying to use the hierarchy-viewer in monkey runner to see the layout of my Android app.When i called device.getHierarchyViewer() method i got following issue.
E/hierarchyviewer: String index out of range: 1155
130924 11:36:18.917:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
] Script terminated due to an exception
130924 11:36:18.917:S [MainThread] [com.android.monkeyrunner.MonkeyRunnerOptions
]Traceback (most recent call last):
File "F:\python\testing.py", line 311, in <module>
pressButton ('id/action_bar_home_btn_area')
File "F:\python\testing.py", line 86, in pressButton
easy_device.touch(By.id(buttonID), MonkeyDevice.DOWN_AND_UP)
File "F:\python\testing.py", line 86, in pressButton
easy_device.touch(By.id(buttonID), MonkeyDevice.DOWN_AND_UP)
at com.android.chimpchat.hierarchyviewer.HierarchyViewer.findViewById(Hi
erarchyViewer.java:75)
at com.android.monkeyrunner.easy.By.findView(By.java:72)
at com.android.monkeyrunner.easy.EasyMonkeyDevice.getElementCenter(EasyM
onkeyDevice.java:219)
at com.android.monkeyrunner.easy.EasyMonkeyDevice.touch(EasyMonkeyDevice
.java:85)
at com.android.monkeyrunner.easy.EasyMonkeyDevice.touch(EasyMonkeyDevice
.java:81)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
java.lang.RuntimeException: java.lang.RuntimeException: Could not dump view
Any help regarding this is appreciated.

You may try AndroidViewClient's dump:
usage: dump [OPTION]... [serialno]
Options:
-H, --help prints this help
-V, --verbose verbose comments
-I, --ignore-secure-device ignore secure device
-F, --force-view-server-use force view server use (even if UiAutomator present)
-S, --do-not-start-view-server don't start ViewServer
-k, --do-not-ignore-uiautomator-killed don't ignore UiAutomator killed
-w, --window=WINDOW dump WINDOW content (default: -1, all windows)
-i, --uniqueId dump View unique IDs
-x, --position dump View positions
-d, --content-description dump View content descriptions
-c, --center dump View centers

Related

Unable to get the Ada scrolling text demo working on the microbit on GNAT 2019 community edition

I'm trying to run the demo described here: https://blog.adacore.com/ada-on-the-microbit
I followed the tutorial's directions carefully. I did install the 2019 versions of the software instead of the 2018 versions. GPS seems to be installed and working on my windows 7 machine. The project builds but pyocd-flashtool can't seem to recognize my microbit. It reports it as a "generic cortex_m" and throws an exception.
Here's the output:
gprbuild --target=arm-eabi -d -PC:\Domains\ada\microbit_scrolling_text_demo\microbit_example.gpr
C:\Domains\ada\microbit_scrolling_text_demo\src\main.adb -largs -Wl,-Map=map.txt
Compile
[Ada] main.adb
Bind
[gprbind] main.bexch
[Ada] main.ali
Link
[link] main.adb
[2019-09-21 18:40:29] process terminated successfully, elapsed time: 02.57s
Retrieving the load address.
arm-eabi-objdump C:\Domains\ada\microbit_scrolling_text_demo\obj\main -h
Load address is: 0x00000000
Creating the binary (flashable) image.
arm-eabi-objcopy -O binary C:\Domains\ada\microbit_scrolling_text_demo\obj\main C:\Domains\ada\microbit_scrolling_text_demo\obj\main.bin
Flashing image to board...
pyocd-flashtool -a 0x00000000 C:\Domains\ada\microbit_scrolling_text_demo\obj\main.bin
WARNING:root:Unsupported board found 9901
INFO:root:DAP SWD MODE initialised
INFO:root:ROM table #0 # 0xf0000000 cidr=b105100d pidr=2007c4001
INFO:root:[0]<e00ff000: cidr=b105100d, pidr=4000bb471, class=1>
INFO:root:ROM table #1 # 0xe00ff000 cidr=b105100d pidr=4000bb471
INFO:root:[0]<e000e000:SCS-M0+ cidr=b105e00d, pidr=4000bb008, class=14>
INFO:root:[1]<e0001000:DWT-M0+ cidr=b105e00d, pidr=4000bb00a, class=14>
INFO:root:[2]<e0002000:BPU cidr=b105e00d, pidr=4000bb00b, class=14>
INFO:root:[1]<f0002000: cidr=b105900d, pidr=4000bb9a3, class=9, devtype=13, devid=0>
INFO:root:CPU core is Cortex-M0
INFO:root:4 hardware breakpoints, 0 literal comparators
INFO:root:2 hardware watchpoints
Traceback (most recent call last):
File "C:\GNAT\2019\lib\runpy.py", line 162, in _run_module_as_main
"__main__", fname, loader, pkg_name)
File "C:\GNAT\2019\lib\runpy.py", line 72, in _run_code
exec code in run_globals
File "C:\GNAT\2019\bin\pyocd-flashtool.exe\__main__.py", line 9, in <module>
File "C:\GNAT\2019\lib\site-packages\pyOCD\tools\flash_tool.py", line 214, in main fast_verify=args.fast_program)
File "C:\GNAT\2019\lib\site-packages\pyOCD\flash\flash.py", line 286, in flashBlock flash_start = self.getFlashInfo().rom_start
File "C:\GNAT\2019\lib\site-packages\pyOCD\flash\flash_cortex_m.py", line 44, in getFlashInfo raise Exception("Unsupported flash operation on generic cortex_m")
Exception: Unsupported flash operation on generic cortex_m
Could not flash the executable.
[workflow stopped]
Anyone know what could be wrong?
In C:\GNAT\2019\lib\site-packages\pyOCD\board\mbed_board.py (or the equivalent location on your platform), add this line and it will work.
"9901": BoardInfo( "Microbit", "nrf51", "l1_microbit.bin", ),

Uploading Binary File to Openstack Swift Gives Error

I am trying to upload a binary file I have to Openstack Swift. This size of this file is 129MB. I am using the Python client for uploading:
swift_client = swiftclient.Connection(preauthurl=swift_public_auth_url,preauthtoken=swift_access_token,auth_version="2.0",insecure=True,tenant_name="admin")
with open("/path/to/file/file.ckpt", 'r') as read_file:
swift_client.put_object(swift_container_name, 'file.ckpt', contents= read_file.read(),content_type='text/plain')
print "done"
This throws the following error:
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
File "/usr/local/lib/python2.7/dist-packages/swiftclient/client.py", line 1824, in put_object
response_dict=response_dict)
File "/usr/local/lib/python2.7/dist-packages/swiftclient/client.py", line 1673, in _retry
service_token=self.service_token, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/swiftclient/client.py", line 1322, in put_object
raise ClientException.from_response(resp, 'Object PUT failed', body)
swiftclient.exceptions.ClientException: Object PUT failed: https://abc.xyz/swift/v1/AUTH_123456789abcdefghijklmn/container/file.ckpt 413 Request Entity Too Large [first 60 chars of response] <html>
<head><title>413 Request Entity Too Large</title></h
However, when I tried replacing test.ckpt with a blank text file test.txt, it got uploaded with the same parameters. I know this error occurs when the file size is greater than 5GB but what can be the problem here?
Found out that the problem was because of configuration on my Nginx proxy server. Got it fixed by increasing client_max_body_size. More details here: https://www.cyberciti.biz/faq/linux-unix-bsd-nginx-413-request-entity-too-large/

Cloudify nodecellar,Task failed 'script_runner.tasks.run' -> RecoverableError('ProcessException: ',)

when I try to install nodecellar with Cloudify,I am getting the following error
2015-07-13T17:31:03 LOG <nodecellar> [mongod_a50aa.configure] ERROR: Exception raised on operation [script_runner.tasks.run] invocation
Traceback (most recent call last):
File "/root/cloudify.host_dba5c/env/local/lib/python2.7/site-packages/cloudify/decorators.py", line 125, in wrapper
result = func(*args, **kwargs)
File "/root/cloudify.host_dba5c/env/local/lib/python2.7/site-packages/script_runner/tasks.py", line 58, in run
return process_execution(script_func, script_path, ctx, process)
File "/root/cloudify.host_dba5c/env/local/lib/python2.7/site-packages/script_runner/tasks.py", line 74, in process_execution
script_func(script_path, ctx, process)
File "/root/cloudify.host_dba5c/env/local/lib/python2.7/site-packages/script_runner/tasks.py", line 143, in execute
stderr_consumer.buffer.getvalue())
How can I fix this problem?
This exception is raised by the Cloudify Script Plugin you ran a script, which exited with a non-zero error code. Here is the source of that error.
The script that returned non-zero code is that script which is mapped to the configure operation on the mongod node. Which script that is depends on the version of the Nodecellar blueprint that you are using.
I can't give a more detailed answer without information regarding the specific blueprint version, which Cloudify version you have installed, details about your provider (local, Vagrant, Openstack, AWS), and OS (Ubuntu, Centos, etc).

yuicompressor for css throws error for some files

i just tried using the yuicompressor for CSS. Works for most files, but for one it didnt, and gives me this error:
"C:\Program Files (x86)\JetBrains\PhpStorm 8.0.1\jre\jre/bin/java" -jar C:/nodejs/node_modules/yuicompressor/build/yuicompressor-2.4.8.jar style.css -o style.min.css
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21)
Caused by: java.lang.StackOverflowError
at java.util.regex.Pattern$Loop.match(Pattern.java:4663)
After these lines there are thousand errors.
I looked at another post here but it didnt fix it really. It said something about increasing the stack size(?), if thats the solution, how would i do that? google wouldnt give me any useful answere either.
thanks in advance.
To increase the stack size, you need passing -Xss option to java. Default is 512k, try increasing it, for example to -Xss2048k.
To do this, you either need to modify node_modules\yuicompressor\nodejs\cli.js accordingly, by adding args.unshift('-Xss2048k');:
var spawn = require('child_process').spawn,
fs = require('fs'),
compressor = require('./index'),
args = process.argv.slice(2);
args.unshift(compressor.jar);
args.unshift('-jar');
args.unshift('-Xss2048k');
...
and then specify a path to yuicompressor binary in a Program field of your file watcher (like C:\Users\My.Name\AppData\Roaming\npm\yuicompressor.cmd).
Or, set up your file watcher in a different way, using java as a Program:
Program: C:\Program Files (x86)\JetBrains\PhpStorm 8.0.1\jre\jre\bin\java.exe
Arguments: -Xss2048k -jar "C:\Users\My.Name\AppData\Roaming\npm\node_modules\yuicompressor\build\yuicompressor-2.4.8.jar " $FileName$ -o $FileNameWithoutExtension$.min.css

How to add a custom parser to logster?

I want to track the HTTP response codes returned by my nginx web-server, using logster.
1) I found and installed logster. I also pip-installed pygtail, which is required for logster.
https://github.com/etsy/logster
2) I found a python script that parses nginx access_log and placed it in the parsers subdir.
https://github.com/metabrainz/logster/blob/master/musicbrainz/logster/NginxStatus.py
...but when I run the logster command, I get a python exception:
Traceback (most recent call last):
File "/usr/local/bin/logster", line 5, in <module>
pkg_resources.run_script('logster==0.0.1', 'logster')
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 505, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1245, in run_script
execfile(script_filename, namespace, namespace)
File "/usr/local/lib/python2.7/dist-packages/logster-0.0.1-py2.7.egg/EGG-INFO/scripts/logster", line 449, in <module>
main()
File "/usr/local/lib/python2.7/dist-packages/logster-0.0.1-py2.7.egg/EGG-INFO/scripts/logster", line 380, in main
module = __import__(module_name, globals(), locals(), [parser_name])
ImportError: No module named NginxStatus1
````
What am I doing wrong?
The exception error was rather misleading: the file was placed in the right place (the parsers subdir), but - as it turns out- logster must be re-setup after a new parser is added (this isn't documented, unfortunately). so just run:
sudo python setup.py install
in the logster directory and things should start working correctly.

Resources