Saturday, July 30, 2016

Android Studio 2.1.2: Installing Genymotion plugin

THIS PAGE IS OUT OF DATE. Genymotion does not provide free anymore

Software:
  • Android Studio 2.1.2
  • Android SDK 25.1.7
  • Java 1.8.0_60
  • VirtualBox 5.1.2
  • Genymotion 2.7.2 
  • Windows 10 build 10586
We assume all softwares above already installed.
To install plugin into Android Studio 2.1.2 do these steps:
  1. From Android Studio go to File -> Settings... -> Plugins -> Browse repositories...
  2. In search box type genymotion and install
  3. Point your genymotion installation directory. File -> Settings... -> Other Settings -> Genymotion and fill Select the path to the Genymotion folder, for example C:\Program Files\Genymobile\Genymotion
  4. Your Genymotion icon will show on Toolbar. To show this, go to View and check on Toolbar.
Troubleshooting for Genymotion: Unable to start the Genymotion virtual device on VirtualBox Host-Only Network.
  1. Go to Network and Sharing Center -> Change adapter settings.
  2. Right click on VirtualBox Host-Only Network and select Properties
  3. Checked on VirtualBox NDIS6 Bridged Networking Driver
  4. Do this on all VirtualBox Host-Only Network for example VirtualBox Host-Only Network #2
References:

Friday, July 29, 2016

Connecting ADB to Android 4.2.2 devices

Enabling Developer mode on devices (phone):
  1. Go to Settings -> About phone
  2. Tap on Build number until message looks like "... you are already a developer ..."
Enabling Developer options on devices:
  1. Go to Settings -> Developer options
  2. Turn it on and let device to allow development settings
  3. Check on USB debugging to enable it and let device to allow debugging via USB
Connect your device to your PC. Notification USB debugging connected will appear.
Run adb devices to make sure the device connected to adb properly.
>adb devices
List of devices attached
J32V2ML17X026640        device
If you have multiple adb.exe on your pc, make adb from Android SDK as default by put reference to this file into path. In Windows:
  1. Go to Control Panel -> System -> Advanced system settings
  2. Go to Environment Variables -> System Variables, then select variable Path then click Edit
  3. Add your path to correct adb.exe location from Android SDK, for example C:\Java\android-sdk-windows\platform-tools
Tested on MITO A150 Android 4.2.2, PC Windows 10 SL, AMD Processor.
To turn off debugging, go to Settings -> Developer Options uncheck on USB debugging. Next time you want to test your application, just check on USB Debugging.
References:

Thursday, July 7, 2016

Install Android 4.4 x86 r5 in VirtualBox 5 Windows 10

I use NOX App Player to run Android on PC Windows base, to play Clash of Clan. BlueStack 2 has a problem, it almost stuck on every starting up, I remove/uninstall it. I try Android 4.4 x86 as alternative, hope Android 6 x86 stable become available soon. Have fun.... 
Prerequisite:
Install:
  1. Create VirtualBox 
    • Name: Android 4.4 x86
    • Type: Linux
    • Version: Other Linux (32-bit)
    • Memory size 1024MB
    • Virtual Harddisk
    • Type: VDI
    • Storage on Physical hard disk: dynamic allocated
    • File location and size
    • Location: D:\virtualboximages\Android 4.4 x86.vdi
    • Size: 8GB
  2. Mounting android 4.4 x86 installation images
    • Setting -> Storage
    • Controller IDE -> Optical Drive -> Location: D:\Master\android emulator\android-x86-4.4-r5.iso
  3. Install android 4.4 x86
    • Android 4.4 x86 -> Start
    • Select Installation Android-x86 to harddisk
    • Please seect a partition to install Adnroid-x86: sda unknow 
    • Please seect a filesystem to format sda: ext2 (Ext3 not support)
    • Do you want to install boot lader GRUB?: Skip
    • Do you want to install EFI GRUB2?: Skip
    • Do you want o install /system directory as read-write?: Yes
    • Wait until Installing Adnroid-x86 100%
References:

Thursday, June 23, 2016

Xen 4.4: How to configure dom0 and domu with different ip subnet in Debian Jessie

Dom0 and domu has different subnet and dom0 act as router
  • Dom0 has A.B.C.81 with netmask 255.255.255.0.
  • Domu has ip range X.Y.X.144 - X.Y.Z.151 netmask 255.255.255.248.
OVH inform us, this ip range (X.Y.X.144 - X.Y.Z.151) will be reroute via A.B.C.81. It means, br0 becomes a gateway for domu.

Solution: 
This is text diaagram for paritcular case:
A.B.C.254 ---- A.B.C.81
(Gateway)       (br0/dom0)
                       X.Y.X.150 ---- X.Y.X.144 - X.Y.Z.149 (domu)
                         (br1/dom0)
List of ip can not be used for domu 
  • X.Y.X.144 as address 
  • X.Y.X.151 as broadcast
  • X.Y.X.150 OVH ask me to assign this ip as a gateway
I create a new bridge network br1 which does not attach to any physical device and assign it as router with ip Z.Y.Z.150:
# brctl addbr br1
# ifconfig br1 Z.Y.Z.150 netmask 255.255.255.248 up
# brctl stp br1 on (optional)
Here is a new bridge configuration:
# brctl show
bridge name     bridge id               STP enabled     interfaces
br0             8000.e03f49e8149b       yes             eth0
br1             8000.feffffffffff       no              vif2.0
virbr0          8000.000000000000       no
Here is route output:
# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         A.B.C.254  0.0.0.0         UG    0      0        0 br0
A.B.C.0    *               255.255.255.0   U     0      0        0 br0
192.168.0.0     *               255.255.255.0   U     0      0        0 virbr0
X.Y.X.144  *               255.255.255.248 U     0      0        0 br1
You can create your domu using xen-create-image with ip range from X.Y.X.145 to X.Y.X.149 and br1 as bridge network. This is an example:
# xen-create-image --hostname test --size=10GB --swap=1024MB --memory=512MB --vcpu=1 --dist=jessie --ip=Z.Y.Z.145 --netmask=255.255.255.248 --gateway=Z.Y.Z.150 --bridge=br1
Ping reply from outside (public) after dom0 make internal process to reroute from br0 into br1:
>ping x.y.z.145

Pinging x.y.z.145 with 32 bytes of data:
Reply from x.y.z.145: bytes=32 time=276ms TTL=50
Reply from x.y.z.145: bytes=32 time=270ms TTL=50
Reply from x.y.z.145: bytes=32 time=288ms TTL=50
Reply from x.y.z.145: bytes=32 time=269ms TTL=50

Ping statistics for x.y.z.145:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 269ms, Maximum = 288ms, Average = 275ms
To make it permanent, add br1 into /etc/network/networking in dom0:
auto br1
iface br1 inet static
        address X.Y.X.150
        netmask 255.255.255.248
        broadcast X.Y.X.151
   pre-up brctl addbr br1
References (thanks):

Tuesday, June 14, 2016

Odoo: Installation problems

Symptom: FATAL:  role "odoo" does not exist

Solution:

You need to create postgresql user with name odoo. As root create postgresql user:
# su - postgres -c "createuser -s odoo"

Symptom: new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)

Solution:

Alter postgresql encoding.

# su postgres

$ psql postgres
psql (9.6.4)
Type "help" for help.

postgres=# update pg_database set datallowconn = TRUE where datname = 'template0';
UPDATE 1
postgres=# \c template0
You are now connected to database "template0" as user "postgres".
template0=# update pg_database set datistemplate = FALSE where datname = 'template1';
UPDATE 1
template0=# drop database template1;
DROP DATABASE
template0=# create database template1 with template = template0 encoding = 'UTF8';
CREATE DATABASE
template0=# update pg_database set datistemplate = TRUE where datname = 'template1';
UPDATE 1
template0=# \c template1
You are now connected to database "template1" as user "postgres".
template1=# update pg_database set datallowconn = FALSE where datname = 'template0';
UPDATE 1
template1=# \q


References: