28 October 2016
There are two issues you may encounter when upgrading from 2.1.x to 2.2.x. Simply disable and enable the plugins to fix them. Follow the links for details.
23 June 2016
Monsoon Power Monitor is commonly used by researchers and engineers to measure energy consumption at high frequency. However, the lack of support for Mac OS X and Linux is a big turnoff and inconvenient. The monsoon.py included in AOSP is problematic on Mac OS X. The serial port access over USB blocks indefinitely every so often until reboot. The official support for Windows only renders virtual machine and web service as alternatives. Unfortunately, accessing the device through a virtual machine is not guaranteed to work. For example, the device enumeration API may return nothing, unlike on a real Windows machine. Therefore, setting up the web service on real Windows for remote scripting would be the expedient solution.
The Monsoon PowerTool Web Service for scripting I created is hosted on GitHub. This project contains the server-side web service in C# and a Java client. There is also a setup subproject for installation on Windows. The Java client can be built with Gradle to test the remote web service and shows output as follows.
PowerToolServiceTest > testPowerToolServiceSampling STANDARD_OUT Found connected Monsoon monitor of serial 6325 Instant main channel: samples=14355, current=0.248630.2, voltage=3.690500.2 Instant main channel: samples=24255, current=0.218130.2, voltage=3.690500.2
View build.gradle for details to set the remote WSDL URL.
The Web Service APIs are based on PowerTool 18.104.22.168. while the client APIs depend on the actual stub code generation by Apache CXF. Refer to the official developer’s guide for the API overview.
15 November 2015
DevDraft just held the Sept. challenge 2015 with an intriguing algorithmic problem. After days of contemplation, my solution reaches 100% code correctness and perfect algorithmic problem solving for runtime efficiency.
A nearby city has recently undergone a massive revitalization effort and, in order to celebrate and attract economic investment, is going to throw a parade. The mayor plans to deploy a number of security forces for the days leading up to the parade to keep the parade route free of vandalism. However, the budget is limited, so the mayor wants to make sure the security is deployed in such a way as to maximize effectiveness.
You are given a list of integers representing the threat of vandalism occurring on the city blocks along the parade route—0 means vandalism will not occur on a block, and greater integers indicate a greater danger of vandalism occurring. The parade is planned to move in a straight line and pass by every block exactly once. You are also given several security forces, each of which can patrol a number of adjacent blocks, totally nullifying the threat on the blocks they patrol. The forces come in different types with different patrol lengths; for example, an officer on bike can patrol farther than an officer on foot. The forces are represented by a list of pairs of integers, where the first integer is the number of adjacent blocks a type of force can patrol and the second is how many forces are available of that type.
The number of forces available is limited so you must place them strategically to minimize the sum of threat levels of all blocks that are not patrolled. Because the minimum threat level may be achieved by multiple arrangements of security, we ask that you output only the minimum total threat level that can be achieved, and not the positions of the forces.
Originally, the implementation is in Groovy but the runtime performance can be 100X slower than its C++ counterpart. Therefore, I decided to submit the C++ version though many Groovy constructs are not supported by the C++ STL and must be reimplemented. As expected, the rewards pay off.
The following code in C++ implements a branch and bound dynamic programming algorithm to solve the problem. More information about the solution analysis and complexity is available on the repo.
Older posts are available in the archive.