Saturday, September 24, 2016

Windows: How to check if an executable is 32-bit or 64-bit?

1. Open the .exe file in a text editor. Don't use the build-in notepad as it does not handle large files very well. I strongly recommend using Notepad++.

2. Search for the first occurrence of "PE"

3. Check the next printable character after "PE".
For x86, it should be "L".
For x64, it should be "d†".


Ref:
64 bit - How to check if a binary is 32 or 64 bit on Windows? - Super User

Wednesday, August 17, 2016

Jira: View watched issues

https://<domain_name>/issues/?jql=watcher%20%3D%20currentUser()
- or -
https://<domain_name>/issues/?jql=issue%20in%20watchedissues()
- or -
search for issue in watchedissues() in the Advanced search.

Ref:
See my watched issues in Jira | mediatribe.net

Monday, August 15, 2016

AngularJS: Integrate with Papa Parse


I was trying to write a Web app to parse .csv file with Papa Parse and AngularJS. The first problem I ran into was that ng-model does not support input[file]. Luckily, custom directive come to rescue!

The second problem was that, I was unable to access the value of my custom directive within my controller's scope. I was able to resolve it by creating a custom object to hold the value.

The third problem was that, after parsing the .csv file, I would update the result in my controller, but the changes were not being reflected in HTML. Since Papa Parse is not AngularJS aware or verse versa, I need to notify AngularJS about the changes by wrapping my update logic within $scope.$apply().


Ref:
angularjs - ng-model for <input type="file"/> - Stack Overflow
AngularJS and scope.$apply — Jim Hoskins
AngularJS: API: input

Monday, July 25, 2016

Python 3.5: pip install error: Unable to find vcvarsall.bat


* Windows 7
* Python 3.5.2

Problem:
I was trying to install cx_Freeze
pip install cx_freeze

It failed with the following error:
    creating build\lib.win32-3.5\cx_Freeze\samples\zope
    copying cx_Freeze\samples\zope\qotd.py -> build\lib.win32-3.5\cx_Freeze\samples\zope
    copying cx_Freeze\samples\zope\setup.py -> build\lib.win32-3.5\cx_Freeze\samples\zope
    running build_ext
    building 'cx_Freeze.util' extension
    error: Unable to find vcvarsall.bat


Solution:
Apparently, this "unable to find vcvarsall.bat" is a well known issue...Luckily, Steve Dower from Microsoft has posted a solution for us.

For Python 3.5 and later, install Visual C++ Build Tools 2015
For Python 3.3 and 3.4, install Windows SDK for Windows 7 and .NET 4.0
For Python 2.6 to 3.2, install Microsoft Visual C++ Compiler for Python 2.7 


Ref:
How to deal with the pain of “unable to find vcvarsall.bat” – Python Engineering at Microsoft
Python 3.4, Windows 10 and Unable to find vcvarsall.bat - Stack Overflow
visual studio - Unable to find vcvarsall.bat using Python 3.3 in Windows 8 - Stack Overflow
windows - What version of Visual Studio is Python on my computer compiled with? - Stack Overflow
python - error: Unable to find vcvarsall.bat - Stack Overflow

Sunday, June 26, 2016

Android: User profile data location (root required)

To find users on a device:
adb shell pm list users

you should see something like this:
Users:
        UserInfo{0:Alice:13}
        UserInfo{11:Bob:10}


Bob's user ID is 11. His data files can be found at:
/mnt/shell/emulated/11

P.S. If you are using ES File Explorer, first install SuperSU, then enable Root Explorer within ES File Explorer. You should be prompted to grant root access to ES File Explorer.


Bonus:
To run an app as Bob for example:
adb shell am start --user 11 \ -n "com.example.myapp/com.example.myapp.testactivity" \ -a android.intent.action.MAIN -c android.intent.category.LAUNCHER


Ref:
Set up Managed Profiles | Android Developers

Saturday, June 25, 2016

Android: Screen recording via ADB

To start a screen recording (requires Android 4.4 (KitKat) or above):
adb shell screenrecord /sdcard/example.mp4

Stop the screen recording by pressing Ctrl-C, otherwise the recording stops automatically at three minutes or the time limit set by --time-limit. The default and maximum value is 180 (3 minutes).

To take a screenshot:
adb shell screencap /sdcard/screen.png


Ref:
ADB Shell Commands | Android Studio

Saturday, June 18, 2016

Android: What are the application-icon-* in aapt dump badging?

Question:
When running aapt dump badging, there is a list of application-icon.*
application-icon-120:'res/drawable-ldpi-v4/icon.png'
application-icon-160:'res/drawable-mdpi-v4/icon.png'
application-icon-213:'res/drawable-tvdpi-v4/icon.png'
application-icon-240:'res/drawable-hdpi-v4/icon.png'
application-icon-320:'res/drawable-xhdpi-v4/icon.png'
application-icon-480:'res/drawable-xxhdpi-v4/icon.png'
application-icon-640:'res/drawable-xxxhdpi-v4/icon.png'


What are those numbers 120, 160, 213...etc.?

Answer:
Each number represent a screen density, e.g.
120 = DENSITY_LOW = ldpi
160 = DENSITY_MEDIUM = mdpi
213 = DENSITY_TV = tvdpi

...etc.


Ref:
DisplayMetrics | Android Developers