Thursday, December 28, 2017

Eclipse Oxygen: install Google Web Toolkit (GWT Eclipse Plugin)

To Install Google Web Toolkit (GWT Eclipse Plugin)
  1. Go to Help -> Eclipse Marketplace ...
  2. In Find type gwt (All Markets and All Categories) click Go
  3. Choose GWT Eclipse Plugin 3.0.0 (at time this note write) to install
  4. Choose all GWT plugin and accept all terms and conditions, click Finish
  5. Done

Reference:
  • http://marketplace.eclipse.org/content/gwt-eclipse-plugin

Saturday, December 23, 2017

Eclipse Oxygen: install SWT plugin GUI Designer

Tested on:
  1. Eclipse version: 4.7.2
  2. JDK 9.0.1
To install SWT plugin GUI Designer:
  1. Help -> Install New Software...
  2. Work with: --All Available Site--
  3. Type Filter Text: swt
  4. Select/check (undeer General Purpose Tools
    1. SWT Designer
    2. SWT Designer Core
    3. SWT Designer Documentation 
    4. SWT Designer SWT_AWT Support
    5. SWT Designer XWT Support (requres Eclipse WTPWST)
  5. Click next and Finish
To use it:
  1. Open or create Java Project
  2. New -> Other -> Window Builder -> Swing Designer -> Application Window
  3. Click Next
  4. Fill form (for example):
    1. Package: com.dedetok
    2. Name: MyTestSWTClass
  5. Click Next and Finish
Reference:
  • http://www.vogella.com/tutorials/EclipseWindowBuilder/article.html



Install apk application using adb via usb

Connect your device via USB. Makse sure your device has Developer options enable, and USB debugging checked.

Run adb in cmd, for example in Mito A150:
>adb devices
List of devices attached
J32V2ML17X026640        device

>adb -s J32V2ML17X026640 install d:\BT-POSPrinter.apk
d:\BT-POSPrinter.apk: 1 file pushed. 1.7 MB/s (259008 bytes in 0.148s)
        pkg: /data/local/tmp/BT-POSPrinter.apk
Success


References:
  • https://developer.android.com/studio/command-line/adb.html 

Debian Stretch: restrict SMTPD in Postfix

We use Sorbs.net and SpamCop.net service for restrict our SMTPD in postfix.

Add/edit /etc/postfix/main.cf:
...
smtpd_recipient_restrictions = reject_invalid_hostname, reject_non_fqdn_sender, reject_non_fqdn_recipient, reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_unauth_pipelining, permit_mynetworks, reject_unauth_destination, reject_rbl_client bl.spamcop.net, reject_rbl_client dnsbl.sorbs.net, permit_sasl_authenticated
...

Restart your postfix
# service postfix restart

Watch your postfix status
# service postfix status

References:
  • http://www.sorbs.net/mailsystems/postfix-2.3.shtml 
  • https://www.spamcop.net/fom-serve/cache/349.html

Monday, December 11, 2017

Android Studio 3: making gradle build a bit faster

Enable offline mode

If you are on a slow network connection, your build times may suffer when Gradle attempts to use network resources to resolve dependencies. You can tell Gradle to avoid using network resources by using only the artifacts that it has cached locally.
To use Gradle offline when building with Android Studio, proceed as follows:
  1. Open the Preferences window by clicking File > Settings (on Mac, Android Studio > Preferences).
  2. In the left pane, click Build, Execution, Deployment > Gradle.
  3. Check the Offline work checkbox.
  4. Click Apply or OK.

Enable configuration on demand

For Gradle to know exactly how to build your app, the build system configures all modules in your project, and their dependencies, before every build (even if you are building and testing only a single module). This slows down the build process for large multi-module projects. To tell Gradle to configure only the modules that you want to build, enable configuration on demand by following these steps:
  1. Open the Preferences window by clicking File > Settings (on Mac, Android Studio > Preferences).
  2. In the left pane, click Build, Execution, Deployment > Compiler.
  3. Check the Configure on demand checkbox.
  4. Click Apply or OK


For more option follow this rule https://developer.android.com/studio/build/optimize-your-build.html


References:

  • https://developer.android.com/studio/build/optimize-your-build.html 

Sunday, December 10, 2017

Genymotion and Virtualbox not working properly after windows 10 update Build 16299

After windows 10 automatic update into cersion 10.0.16299 Build 16299, Genymotion won't start and Virtualbox doesnot working properly.

Symptom:
  1. Genymotion (Version 2.11), will stop during loading plugin and generate genymotion-log.zip log file under folder c:\user\[username]\genymotion-log.zip.
  2. Virtualbox (Version 5.2.2 r119230) -> Global Tools -> Host Network Manager, always fail to create VirtualBox Host-Only Ethernet Adapter. There is no any VirtualBox Host-Only Ethernet Adapter (empty)
IMO, the cause of this problem, Virtualbox Network Driver does not configure properly after windows update.

Solution:
Uninstall your Virtualbox, restart your windows and reinstall your Virtualbox.

Note your existing virtual device will be safe (untouch).




Thursday, December 7, 2017

Android Studio 3 on Debian Stretch: Fail to run AVD

Symptoms:
  1. Emulator: libGL error: unable to load driver: r600_dri.so
  2. Emulator: libGL error: driver pointer missing
  3. ...etc

To solve this issue:
  1. 1. backup your libstdc++ included in android sdk.
    ~/android-sdk-linux/emulator/lib64/libstdc++/libstdc++.so.6
    $ mv libstdc++.so.6 libstdc++.so.6.bak
  2. make link libstdc++.so.6 from debian stretch
    $ ln -s /usr/lib/x86_64-linux-gnu/libstdc++.so.6 libstdc++.so.6
References:
  1. https://android.stackexchange.com/questions/145437/reinstall-avd-on-ubuntu-16-04
  2. https://stackoverflow.com/questions/36189393/android-studio-avd-error-launching

Thursday, November 16, 2017

Upgrade JDK 8 to JDK 9 and steps to fix your application in Eclipse Oxygen

To install JDK 9 in windows (tested on Windows 10)
  1. Download JDK 9 from http://www.oracle.com/technetwork/java/javase/downloads/index.html. Current version when this note created is JDK 9.0.1.
  2. Follow installation instruction.
  3. In window system environment, set JAVA_HOME to JDK 9
    for example: JAVA_HOME = JAVA_HOME=C:\Java\jdk-9.0.1\
  4. In window system environment, set to path to JDK 9 binary folder
    for example Path=...;C:\Java\jdk-9.0.1\bin;...
To Install JDK 9 in Debian Stretch
  1. Add Backport repository to /etc/apt/sources.list
    # BACKPORT
    deb http://ftp.de.debian.org/debian stretch-backports main
  2. Install JDK 9 straight forward
    # apt-get install openjdk-9-jdk openjdk-9-jdk-headless openjdk-9-jre openjdk-9-jre-headless
Note:
  1. You can remove your JDK 8
  2. Android Studio 3 and earlier does not work with JDK 9. You may used JDK 8 that bundled in Android Studio 3 (tested on Android Studio 3 in Windows 10).
Your Eclipse Oxygen (version >= 1a) may be find with JDK 9, but you need to migrating your application library from JDK 8 to JDK 9 with these steps (tested on Windows 10):
  1. "Package Explorer" right click -> Properties
  2. "Java Build Path" -> Library (tab)
  3. Remove JRE System Library [JavaSE-1.8]
  4. Click "Add Library" botton
  5. "Add JRE System Library" -> Next -> "Workspace default JRE (jre-9.0.1)" -> Finish
  6. Click Apply botton
  7. Click Apply and Close botton 

Reference:

  • http://wiki.eclipse.org/Configure_Eclipse_for_Java_9 



Tuesday, October 17, 2017

Centos 7: install epel and speedtest-cli

To install epel

# yum install epel-release

To install speedtest-cli

# yum install python2-speedtest-cli

To run speedtest-cli

# speedtest-cli
Retrieving speedtest.net configuration...
Testing from PT Media Andalan Nusa (103.253.113.233)...
Retrieving speedtest.net server list...
Selecting best server based on ping...
Hosted by CBN (Jakarta) [0.74 km]: 3.059 ms
Testing download speed................................................................................
Download: 236.99 Mbit/s
Testing upload speed....................................................................................................
Upload: 186.53 Mbit/s


References:
  • https://www.cyberciti.biz/faq/installing-rhel-epel-repo-on-centos-redhat-7-x/

Sunday, October 8, 2017

odoo 10: installing on Debian Stretch

Install from odoo repository not work

# wget -O - https://nightly.odoo.com/odoo.key | apt-key add -
# echo "deb http://nightly.odoo.com/10.0/nightly/deb/ ./" >> /etc/apt/sources.list.d/odoo.list
# apt-get update && apt-get install odoo
# apt-get install odoo
Reading package lists... Done
Building dependency tree     
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 odoo : Depends: python-pypdf but it is not installable
E: Unable to correct problems, you have held broken packages.

We install python-pypdf 1.13 using pip
# apt-get install python-pip
# pip install pyPdf


Instructions bellow may harm your system:
"The purpose of a fake package is to trick dpkg and apt into believing that some package is installed even though it's only an empty shell. This allows satisfying dependencies on a package when the corresponding software was installed outside the scope of the packaging system. Such a method works, but it should still be avoided whenever possible, since there is no guarantee that the manually installed software behaves exactly like the corresponding package would and other packages depending on it would not work properly."

We need to build fake debian package for python-pypdf. Install all requirement tools
# apt-get install equivs  dh-make

Create directory python-pypdf
# mkdir python-pypdf
# cd python-pypdf/

Optional to create default email dan full name for our fake python-pypdf
# export EMAIL="youremail@example.com"
# export DEBFULLNAME="your_full_name"

Create our fake python-pypdf configuration
# equivs-control python-pypdf

Edit file python-pypdf
# vi python-pypdf
### Commented entries have reasonable defaults.
### Uncomment to edit them.
# Source: <source package name; defaults to package name>
Section: python
Priority: optional
# Homepage: <enter URL here; no default>
Standards-Version: 3.9.2
Package: python-pypdf
Version: 1.13
Maintainer: your_full_name<youremail@example.com>
# Pre-Depends: <comma-separated list of packages>
# Depends: <comma-separated list of packages>
# Recommends: <comma-separated list of packages>
# Suggests: <comma-separated list of packages>
# Provides: <comma-separated list of packages>
# Replaces: <comma-separated list of packages>
# Architecture: all
# Multi-Arch: <one of: foreign|same|allowed>
# Copyright: <copyright file; defaults to GPL2>
# Changelog: <changelog file; defaults to a generic changelog>
# Readme: <README.Debian file; defaults to a generic one>
# Extra-Files: <comma-separated list of additional files for the doc directory>
# Files: <pair of space-separated paths; First is file to include, second is destination>
#  <more pairs, if there's more than one file to include. Notice the starting space>
Description: fake package to provide python-pypdf
 python-pypdf will need to be installed with pip
 .
 python-pypdf2 does not provide python-pypdf

We can build our fake python-pypdf and install it
# equivs-build python-pypdf
# dpkg -i python-pypdf_1.13_all.deb

Now you can install odoo 10
# apt-get install odoo
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
  odoo
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 58.7 MB of archives.
After this operation, 401 MB of additional disk space will be used.
Get:1 http://nightly.odoo.com/10.0/nightly/deb ./ odoo 10.0.20171005 [58.7 MB]
Fetched 58.7 MB in 2min 32s (385 kB/s)
Selecting previously unselected package odoo.
(Reading database ... 64960 files and directories currently installed.)
Preparing to unpack .../odoo_10.0.20171005_all.deb ...
Unpacking odoo (10.0.20171005) ...
Processing triggers for systemd (232-25+deb9u1) ...
[144408.689602] systemd[1]: apt-daily.timer: Adding 4h 39min 11.670524s random time.
Setting up odoo (10.0.20171005) ...
[144409.728850] systemd[1]: apt-daily.timer: Adding 10h 55min 37.336482s random time.
[144409.893345] systemd[1]: apt-daily.timer: Adding 9h 24min 36.399757s random time.
Processing triggers for systemd (232-25+deb9u1) ...
[144410.109266] systemd[1]: apt-daily.timer: Adding 11h 22min 7.421289s random time.


References:
  • https://github.com/odoo/odoo/issues/17002
  • https://debian-handbook.info/browse/stable/sect.building-first-package.html
  • http://nightly.odoo.com/
  • https://www.odoo.com/documentation/10.0/setup/install.html

Wednesday, October 4, 2017

Debian Stretch: XEN configure & create DomU PV ubuntu xenial part 4

We will use xen-tools to make it easier to create guest. This steps are similiar with create domu pv debian

Configure /etc/xen-tools/xen-tools.conf
# vi /etc/xen-tools/xen-tools.conf
...
# lvm = vg0
lvm = volGroup1
...
install-method = debootstrap
...
debootstrap-cmd = /usr/sbin/debootstrap
...
size   = 80G       # Root disk, suffix (G, M, k) required
memory = 2G # Suffix (G, M, k) required
#maxmem = 2G      # Suffix (G, M, k) optional
swap   = 3G # Suffix (G, M, k) required
# noswap = 1      # Don't use swap at all for new systems.
fs     = ext4     # Default file system for any disk
dist   = `xt-guess-suite-and-mirror --suite`
                  # Default distribution is determined by Dom0's distribution
...
gateway = [your_ip_gateway]
netmask = [your_ip_netmask]
broadcast = [your_ip_broadcast]
...
nameserver = 8.8.8.8
...
bridge = br0
...
passwd = 1
...
pygrub = 1
...
mirror = `xt-guess-suite-and-mirror --mirror`
...


You can create your guest by command
# xen-create-image --hostname=ubuntu1601 --ip=[your_ip] --size=67gb --vcpu=4 --dist=xenial --mirror=http://kambing.ui.ac.id/ubuntu 
...
Setting up root password
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
All done
Logfile produced at:
          /var/log/xen-tools/ubuntu1601.log

Installation Summary
---------------------
Hostname        :  ubuntu1601
Distribution    :  xenial
MAC Address     :  00:16:3E:CC:B3:5E
IP Address(es)  : 
[your_ip]
SSH Fingerprint :  SHA256:lvyAvapyE6Z+NGghQrw2SbqanHuejwqhxpo7u38kw/s (DSA)
SSH Fingerprint :  SHA256:oSZgN9IdMdfQNeOy0pnPk/wcr0JouNEH+1hdvl8hpfM (ECDSA)
SSH Fingerprint :  SHA256:eY/7/FFhMLC6XV4Gk8RmMIbBJBaYLUkBr8yOHno/uXY (ED25519)
SSH Fingerprint :  SHA256:Zc2CIx8fadkEhUN/PXL8M+DADAFXa9g0YMcfBd0dQVE (RSA)
Root Password   :  N/A

Note: you can choose closest ubuntu mirror.

Start your guest
# xl create /etc/xen/ubuntu1601.cfg
# xl list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0 11815    24     r-----     653.2
ubuntu1601                                  23  2048     4     -b----      16.4

State:

  • r - running
  • b - blocked
  • p - paused
  • s - shutdown
  • c - crashed
  • d - dying


Connect to your guest
# xl connect ubuntu1601

To make your guest start after boot/restart
# mkdir /etc/xen/auto
# ln -s /etc/xen/ubuntu1601.cfg /etc/xen/auto/ubuntu1601.cfg


References:

  1. http://blog.noviantech.com/2010/06/23/debian-kernels-and-tigon-tg3-firmware/
  2. https://wiki.debian.org/Firmware
  3. https://wiki.debian.org/LVM
  4. https://wiki.debian.org/LinuxRaidForAdmins
  5. https://ycnrg.org/xen-install-os-from-iso-pv/
  6. http://hwraid.le-vert.net/


Tuesday, October 3, 2017

Debian Stretch: LAMP apache2, mysql 5.7 community and php 7.0

Note: Install on fresh Debian Stretch (no apache and no database)

1. Install apache2


To install apache2 

# apt-get install apache2

2. Install mysql 5.7 community


Download MySql apt configuration from https://dev.mysql.com/get/mysql-apt-config_0.8.7-1_all.deb

# wget --no-check-certificate https://dev.mysql.com/get/mysql-apt-config_0.8.7-1_all.deb

Note: File name may change without notice, check latest mysql-apt-config at https://dev.mysql.com/downloads/repo/apt/

Install MySql apt configuration.

# dpkg -i mysql-apt-config_0.8.7-1_all.deb

Choose MySql 5.7 for stable version and continue by click Ok.

Install mysql 5.7 community

# apt-get install mysql-server mysql-client mysql-common

or

# apt-get install mysql-community-server mysql-community-client mysql-common

Note: at the end of installation, system will ask you to set mysql root password (NOT LINUX ROOT USER)

3. Install php 7.0


To install php 7.0:

# apt-get install php7.0 php7.0-gd php7.0-pgsql php7.0-cli php7.0-common php7.0-mcrypt php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0-xml php7.0-xmlrpc php7.0-bz2 php7.0-zip libapache2-mod-php7.0

Bonus: Install webmin


Download webmin

# wget http://prdownloads.sourceforge.net/webadmin/webmin_1.850_all.deb

Note: check http://www.webmin.com/deb.html for latest version

Install require library

# apt-get install libnet-ssleay-perl libauthen-pam-perl  libio-pty-perl  apt-show-versions

Install webmin

# dpkg -i webmin_1.850_all.deb

Note: follow this http://dedetoknotes.blogspot.co.id/2017/10/fixing-webmin-application-configuration.html to fix php.ini location

Done :)

Monday, October 2, 2017

Fixing webmin configuration file in Debian Stretch

PHP 7.0 configuration files

Others -> PHP Configuration -> Module Config:

/etc/php/7.0/apache2/php.ini=Configuration for mod_php
/etc/php/7.0/cgi/php.ini=Configuration for scripts run via CGI
/etc/php/7.0/cli/php.ini=Configuration for command-line scripts


Saturday, September 30, 2017

Debian Stretch: XEN configure & create DomU PV Debian part 3

We will use xen-tools to make it easier to create guest.

Configure /etc/xen-tools/xen-tools.conf
# vi /etc/xen-tools/xen-tools.conf
...
# lvm = vg0
lvm = volGroup1
...
install-method = debootstrap
...
debootstrap-cmd = /usr/sbin/debootstrap
...
size   = 80G       # Root disk, suffix (G, M, k) required
memory = 2G # Suffix (G, M, k) required
#maxmem = 2G      # Suffix (G, M, k) optional
swap   = 3G # Suffix (G, M, k) required
# noswap = 1      # Don't use swap at all for new systems.
fs     = ext4     # Default file system for any disk
dist   = `xt-guess-suite-and-mirror --suite`
                  # Default distribution is determined by Dom0's distribution
...
gateway = [your_ip_gateway]
netmask = [your_ip_netmask]
broadcast = [your_ip_broadcast]
...
nameserver = 8.8.8.8
...
bridge = br0
...
passwd = 1
...
pygrub = 1
...
mirror = `xt-guess-suite-and-mirror --mirror`
...

You can create your guest by command
# xen-create-image --hostname xdebian801 --ip=[your_ip]
...
Setting up root password
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
All done
Logfile produced at:
         /var/log/xen-tools/xdebian801.log

Installation Summary
---------------------
Hostname        :  xdebian801
Distribution    :  stretch
MAC Address     :  00:16:3E:61:28:46
IP Address(es)  :  [your_ip]
SSH Fingerprint :  SHA256:GVI1ri+NA82lDeVEf+pPgSHYFHzLe+SYkCxuTgBfEZw (DSA)
SSH Fingerprint :  SHA256:s5z6k6ek+V43NDG1CX77E81WWCVXZEOYNTEaQTXAaGM (ECDSA)
SSH Fingerprint :  SHA256:FUmWelgtmKtB/sCqrS3P5ZlttVRD/M0IVrArPnUs/8Y (ED25519)
SSH Fingerprint :  SHA256:LvrUnZE3ktnahsWFi+hXZ78+V87YZfmDKi9E01Rn+Zs (RSA)
Root Password   :  N/A

Start your guest
# xl create /etc/xen/xdebian801.cfg
# xl list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0 11815    24     r-----     653.2
xdebian801                                   5  2048     1     -b----       3.5

State:
  • r - running
  • b - blocked
  • p - paused
  • s - shutdown
  • c - crashed
  • d - dying

Connect to your guest
# xl connect xdebian801

To make your guest start after boot/restart
# mkdir /etc/xen/auto
# ln -s /etc/xen/xdebian801.cfg /etc/xen/auto/xdebian801.cfg

Example command to override default configuration during image creation:
# xen-create-image --hostname myexample --ip=192.168.1.1  --size=40G  --swap=2G --memory=1G --vcpus=2

References:

  1. http://blog.noviantech.com/2010/06/23/debian-kernels-and-tigon-tg3-firmware/
  2. https://wiki.debian.org/Firmware
  3. https://wiki.debian.org/LVM
  4. https://wiki.debian.org/LinuxRaidForAdmins
  5. https://ycnrg.org/xen-install-os-from-iso-pv/
  6. http://hwraid.le-vert.net/

Debian Stretch: XEN configure & create DomU HVM Centos part 2

Get centos iso cd
# mkdir iso/
# cd iso
# mkdir centos7
# cd centos7
# wget http://centos.biz.net.id/7/isos/x86_64/CentOS-7-x86_64-NetInstall-1708.iso
Note: you can choose your closest mirror.

Create logical volume for guest
# lvcreate -L300g -n xcentos701-disk volGroup1
  Logical volume "xcentos701-disk" created.
# lvdisplay
  --- Logical volume ---
  LV Path                /dev/volGroup1/xcentos701-disk
  LV Name                xcentos701-disk
  VG Name                volGroup1
  LV UUID                jmP1d1-9xFo-ruio-eEXx-Vkgi-w1Ah-X4tO7B
  LV Write Access        read/write
  LV Creation host, time server, 2017-09-29 02:29:55 +0700
  LV Status              available
  # open                 0
  LV Size                300.00 GiB
  Current LE             76800
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           254:0

Create guest configuration file /etc/xen/xcentos701.cfg
builder = "hvm"
name = "xcentos701"
memory = 8192
vcpus = 4
vif = [ 'mac=00:16:4f:02:02:15, ip=[your_ip], bridge=br0' ]
# Disk Devices
# A list of `diskspec' entries as described in
# docs/misc/xl-disk-configuration.txt
disk = [
  '/dev/volGroup1/xcentos701-disk,raw,xvda,rw',
  'file:/[your_home]/iso/centos7/centos7.iso,xvdc:cdrom,r'
  ]
boot = "dc"
vnc = 1
vnclisten = "[your_ip]"
vncdisplay = 0
vncpasswd = "password"

You need to use any vnc viewer to finish installation. At the end, set root password and reboot. 

If the reboot is stuck, destroy the instance.
# xl destroy xcentos701

You need to remove cdrom from configuration, edit /etc/xen/xcentos701.cfg 
builder = "hvm"
name = "xcentos701"
memory = 8192
vcpus = 4
vif = [ 'mac=00:16:4f:02:02:15, ip=[your_ip], bridge=br0' ]
# Disk Devices
# A list of `diskspec' entries as described in
# docs/misc/xl-disk-configuration.txt
disk = [
  '/dev/volGroup1/xcentos701-disk,raw,xvda,rw'
  ]
boot = "c"
We don't need vnc anymore, so we remove it (comment it out).

Start your guest
# xl create /etc/xen/xcentos701.cfg 
# xl list
Name                                        ID   Mem VCPUs      State   Time(s)
Domain-0                                     0 11815    24     r-----    5001.7
xcentos701                                   1 12288     4     -b----    9315.6

State:

  • r - running
  • b - blocked
  • p - paused
  • s - shutdown
  • c - crashed
  • d - dying


To connect to your guest
# xl console xencentos701

To make your guest start after boot/restart
# mkdir /etc/xen/auto
# ln -s /etc/xen/xcentos701.cfg /etc/xen/auto/xcentos701.cfg

Add user and allow su/sudo
# adduser [your_user]
# usermod -aG wheel [your_user]

References:

  1. http://blog.noviantech.com/2010/06/23/debian-kernels-and-tigon-tg3-firmware/
  2. https://wiki.debian.org/Firmware
  3. https://wiki.debian.org/LVM
  4. https://wiki.debian.org/LinuxRaidForAdmins
  5. https://ycnrg.org/xen-install-os-from-iso-pv/
  6. http://hwraid.le-vert.net/

Debian Stretch: XEN part 1

Install minimum Debian Stretch and add some tools
# apt-get install net-tools
# apt-get install fail2ban
# apt-get install debian-goodies
# apt-get install ntp
# apt-get install dnsutils

Install Firmware
1. Add firmware repository
# vi /etc/apt/sources.list
# NON FREE
deb http://httpredir.debian.org/debian stretch main contrib non-free
# apt-get update 
2. Install firmware
# apt-get install firmware-linux-nonfree

To configure timezone
# dpkg-reconfigure tzdata

If your hardware use LSI RAID for my case Mega Raid, you need to monitor your disks status. Install this tool.
1. Add Raid tools repository
# wget https://hwraid.le-vert.net/debian/hwraid.le-vert.net.gpg.key
# apt-key add ./hwraid.le-vert.net.gpg.key
# vi /etc/apt/sources.list
...
deb ​http://hwraid.le-vert.net/debian stretch main
...
# apt-get update 
2. Install Raid tools to monitor disks status.
# apt-get install megaraid-status
# megaraidsas-status
-- Arrays informations --
-- ID | Type | Size | Status
a0d0 | RAID 1 | 931GiB | optimal

-- Disks informations
-- ID | Model | Status | Warnings
a0e32s0 | SEAGATE ST1000NM0001 931GiB | online
a0e32s1 | SEAGATE ST1000NM0023 931GiB | online
a0e32s2 | SEAGATE ST1000NM0001 | ready
a0e32s3 | SEAGATE ST31000640SS 931GiB | predictive-failure

There is at least one disk/array in a NOT OPTIMAL state.

Install & configure LVM (Logical Volume Manager)
1. Install LVM2
# apt-get install lvm2 
2. Create Physical Volume on unused partition
# pvcreate /dev/sda5
WARNING: ext4 signature detected on /dev/sda5 at offset 1080. Wipe it? [y/n]: y
  Wiping ext4 signature on /dev/sda5.
  Physical volume "/dev/sda5" successfully created.
3. Create Volume Group
# vgcreate volGroup1 /dev/sda5
  Volume group "volGroup1" successfully created
# vgdisplay
  --- Volume group ---
  VG Name               volGroup1
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               784.78 GiB
  PE Size               4.00 MiB
  Total PE              200903
  Alloc PE / Size       0 / 0
  Free  PE / Size       200903 / 784.78 GiB
  VG UUID               LzgeKn-N4EO-R4mV-YbRB-6Utc-7GmB-F0ALs1

Install Xen 4.8 (default in stretch)
# apt-get install xen-system-amd64 xen-tools

Make prioritise boot xen kernel
# dpkg-divert --divert /etc/grub.d/08_linux_xen --rename /etc/grub.d/20_linux_xen
# update-grub
Including Xen overrides from /etc/default/grub.d/xen.cfg
WARNING: GRUB_DEFAULT changed to boot into Xen by default!
         Edit /etc/default/grub.d/xen.cfg to avoid this warning.
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-4.9.0-3-amd64
Found initrd image: /boot/initrd.img-4.9.0-3-amd64
Found linux image: /boot/vmlinuz-4.9.0-3-amd64
Found initrd image: /boot/initrd.img-4.9.0-3-amd64
Found linux image: /boot/vmlinuz-4.9.0-3-amd64
Found initrd image: /boot/initrd.img-4.9.0-3-amd64
done

Network configuration for bridge
# vi /etc/network/interfaces
# The primary network interface
auto eno1
iface eno1 inet manual

# Bridge
#allow-hotplug eno1
auto br0
iface br0 inet static
   address [your_ip]/24
   gateway [your_gateway]
   # dns-* options are implemented by the resolvconf package, if installed
   dns-nameservers 8.8.8.8 208.67.222.222
   bridge_ports eno1
# shutdown -r now

Edit /etc/xen/xl.conf to make bridge br0 as default network bridge
# vi /etc/xen/xl.conf
...
# default bridge device to use with vif-bridge hotplug scripts
#vif.default.bridge="xenbr0"
vif.default.bridge="br0"
...

Done! :)

Debian Stretch: XEN part 1
Debian Stretch: XEN configure & create DomU PV Debian part 3
Debian Stretch: XEN configure & create DomU HVM Centos part 2
Debian Stretch: XEN configure & create DomU PV ubuntu xenial part 4

To show memory:
# xl info | grep memory
total_memory           : 24530
free_memory            : 3122
sharing_freed_memory   : 0
sharing_used_memory    : 0

To show VCPU:
# xl info | grep cpu
nr_cpus                : 24
max_cpu_id             : 47
cpu_mhz                : 2000
free_cpus              : 0

To show volume group free space:
# vgdisplay | grep Free
  Free  PE / Size       71367 / 278.78 GiB

References:

  1. http://blog.noviantech.com/2010/06/23/debian-kernels-and-tigon-tg3-firmware/ 
  2. https://wiki.debian.org/Firmware 
  3. https://wiki.debian.org/LVM
  4. https://wiki.debian.org/LinuxRaidForAdmins
  5. https://ycnrg.org/xen-install-os-from-iso-pv/
  6. http://hwraid.le-vert.net/




Friday, September 29, 2017

WHM/Cpanel: install on centos 7 (1708)

Recommendation: install whm/cpanel on minimum Centos 7

Install yum util and network tool
# yum install yum-utils net-tools

Disable SeLinux
# vi /etc/selinux/config
...
SELINUX=disabled
...

Set  fully qualified hostname 
# hostname example.[your_domain]

Download whm/cpanel installer script
# wget https://securedownloads.cpanel.net/latest
--2017-09-29 02:02:22--  https://securedownloads.cpanel.net/latest
Resolving securedownloads.cpanel.net (securedownloads.cpanel.net)... 208.74.123.12
Connecting to securedownloads.cpanel.net (securedownloads.cpanel.net)|208.74.123.12|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 26720 (26K)
Saving to: ‘latest’

100%[======================================>] 26,720       125KB/s   in 0.2s

2017-09-29 02:02:23 (125 KB/s) - ‘latest’ saved [26720/26720]

Run whm/cpanel installer
# chmod 744 latest
# ./latest

It may takes some times. Mine, it takes al least 40 minutes.

Continue configure your whm/cpanel via web, for example https://[youripaddress]:2087

Thursday, September 21, 2017

Debian Stretch: replace php5 to 7.0

You can remove php5 by command
 # apt-get purge *php5*

Delete any configuration exist
# rm -R /etc/php5/

You need to know which php5 library you used and upgrade it to php7.0.
Note: php7.1 not available in Debian Stretch currently.

Show available php7.0
# apt-cache search 'php7.0'
php-amqp - AMQP extension for PHP
php-apcu - APC User Cache for PHP
php-all-dev - package depending on all supported PHP development packages
php-gearman - PHP wrapper to libgearman
php-geoip - GeoIP module for PHP
php-gmagick - Provides a wrapper to the GraphicsMagick library
php-gnupg - PHP wrapper around the gpgme library
php-igbinary - igbinary PHP serializer
php-imagick - Provides a wrapper to the ImageMagick library
php-libsodium - PHP wrapper for the Sodium cryptographic library
php-mailparse - Email message manipulation for PHP
php-memcache - memcache extension module for PHP
php-memcached - memcached extension module for PHP, uses libmemcached
php-mongodb - MongoDB driver for PHP
php-msgpack - PHP extension for interfacing with MessagePack
php-oauth - OAuth 1.0 consumer and provider extension
php-http - PECL HTTP module for PHP Extended HTTP Support
php-pinba - Pinba module for PHP
php-propro - propro module for PHP
php-radius - radius client library for PHP
php-raphf - raphf module for PHP
php-redis - PHP extension for interfacing with Redis
php-rrd - PHP bindings to rrd tool system
php-smbclient - PHP wrapper for libsmbclient
php-solr - PHP extension for communicating with Apache Solr server
php-ssh2 - Bindings for the libssh2 library
php-stomp - Streaming Text Oriented Messaging Protocol (STOMP) client module for PHP
php-uploadprogress - file upload progress tracking extension for PHP
php-uuid - PHP UUID extension
php-yac - YAC (Yet Another Cache) for PHP
php-yaml - YAML-1.1 parser and emitter for PHP
php-zmq - ZeroMQ messaging bindings for PHP
libapache2-mod-php7.0 - server-side, HTML-embedded scripting language (Apache 2 module)
libphp7.0-embed - HTML-embedded scripting language (Embedded SAPI library)
php7.0 - server-side, HTML-embedded scripting language (metapackage)
php7.0-bcmath - Bcmath module for PHP
php7.0-bz2 - bzip2 module for PHP
php7.0-cgi - server-side, HTML-embedded scripting language (CGI binary)
php7.0-cli - command-line interpreter for the PHP scripting language
php7.0-common - documentation, examples and common module for PHP
php7.0-curl - CURL module for PHP
php7.0-dba - DBA module for PHP
php7.0-dev - Files for PHP7.0 module development
php7.0-enchant - Enchant module for PHP
php7.0-fpm - server-side, HTML-embedded scripting language (FPM-CGI binary)
php7.0-gd - GD module for PHP
php7.0-gmp - GMP module for PHP
php7.0-imap - IMAP module for PHP
php7.0-interbase - Interbase module for PHP
php7.0-intl - Internationalisation module for PHP
php7.0-json - JSON module for PHP
php7.0-ldap - LDAP module for PHP
php7.0-mbstring - MBSTRING module for PHP
php7.0-mcrypt - libmcrypt module for PHP
php7.0-mysql - MySQL module for PHP
php7.0-odbc - ODBC module for PHP
php7.0-opcache - Zend OpCache module for PHP
php7.0-pgsql - PostgreSQL module for PHP
php7.0-phpdbg - server-side, HTML-embedded scripting language (PHPDBG binary)
php7.0-pspell - pspell module for PHP
php7.0-readline - readline module for PHP
php7.0-recode - recode module for PHP
php7.0-snmp - SNMP module for PHP
php7.0-soap - SOAP module for PHP
php7.0-sqlite3 - SQLite3 module for PHP
php7.0-sybase - Sybase module for PHP
php7.0-tidy - tidy module for PHP
php7.0-xml - DOM, SimpleXML, WDDX, XML, and XSL module for PHP
php7.0-xmlrpc - XMLRPC-EPI module for PHP
php7.0-xsl - XSL module for PHP (dummy)
php7.0-zip - Zip module for PHP
php-remctl - PECL module for Kerberos-authenticated command execution
php-tideways - Tideways PHP Profiler Extension
php-xdebug - Xdebug Module for PHP


Now you can choose and install php7.0. For instant:
# apt-get install php7.0 php7.0-gd php7.0-pgsql php7.0-cli php7.0-common php7.0-mcrypt php7.0-mysql php7.0-curl php7.0-json php7.0-cgi php7.0-xml php7.0-xmlrpc php7.0-bz2 php7.0-zip libapache2-mod-php7.0

Note:
  1. Configuration folder will change from /etc/php5 to /etc/php/7.0/.
  2. File php.ini will located in /etc/php/7.0/apache2/php.ini.




Wednesday, September 20, 2017

Debian Jessie: change MySql distribution to MySql community

Debian Stretch does not shipped MySql. Before upgrade your Debian Jessie into Stretch, you need to change your MySql Debian distribution into MySql Community.

Install MySql dependency
# apt-get install lsb-release

Download MySql apt configuration from https://dev.mysql.com/get/mysql-apt-config_0.8.7-1_all.deb
# wget --no-check-certificate https://dev.mysql.com/get/mysql-apt-config_0.8.7-1_all.deb
Note: File name may change without notice, check latest mysql-apt-config at https://dev.mysql.com/downloads/repo/apt/

"The MySQL APT repository can only replace distributions of MySQL maintained and distributed by Debian or Ubuntu. It cannot replace any MySQL forks found either inside or outside of the distributions' native repositories. To replace such MySQL forks, you have to uninstall them first before you install MySQL using the MySQL APT repository. Follow the instructions for uninstallation from the forks' distributors and, before you proceed, make sure you back up your data and you know how to restore them to a new server. "

Backup MySql
# mysqldump --all-database > backup_all_201709.sql -u root -p

Remove your MySql Distribution
# apt-get --purge remove mysql-server mysql-client
# apt-get --purge remove mysql-server-5.5 mysql-client-5.5 // if required
# apt-get --purge remove mysql-server-core-5.5 mysql-client-core-5.5
// if required
Note: check your mysql using 

# aptitude search mysql-server

Install MySql apt configuration.
# dpkg -i mysql-apt-config_0.8.7-1_all.deb
Choose MySql 5.7 for stable version and continue by click Ok. It will create apt repository file like this:

# cat /etc/apt/sources.list.d/mysql.list
### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out entries below, but any other modifications may be lost.
# Use command 'dpkg-reconfigure mysql-apt-config' as root for modifications.
deb http://repo.mysql.com/apt/debian/ jessie mysql-apt-config
deb http://repo.mysql.com/apt/debian/ jessie mysql-5.7
deb http://repo.mysql.com/apt/debian/ jessie mysql-tools
#deb http://repo.mysql.com/apt/debian/ jessie mysql-tools-preview
deb-src http://repo.mysql.com/apt/debian/ jessie mysql-5.7


Run update and install
# apt-get update
# apt-get install mysql-server mysql-client
At the end of installation, you will be ask for MySql root password (Note: this is not root Linux user)

# service mysql status
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; enabled)
   Active: active (running) since Wed 2017-09-20 09:24:13 WIB; 8s ago
 Main PID: 8432 (mysqld)
   CGroup: /system.slice/mysql.service
           └─8432 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mys...

Sep 20 09:24:13 igamdeb8 systemd[1]: Started MySQL Community Server.
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.19 MySQL Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>


Run mysql_upgrade:
# mysql_upgrade -u root -p
Enter password:
Checking if update is needed.
Checking server version.
Running queries to upgrade MySQL server.
Checking system database.
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.engine_cost                                  OK
mysql.event                                        OK
mysql.func                                         OK
mysql.general_log                                  OK
mysql.gtid_executed                                OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.host                                         OK
mysql.innodb_index_stats                           OK
mysql.innodb_table_stats                           OK
mysql.ndb_binlog_index                             OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.proxies_priv                                 OK
mysql.server_cost                                  OK
mysql.servers                                      OK
mysql.slave_master_info                            OK
mysql.slave_relay_log_info                         OK
mysql.slave_worker_info                            OK
mysql.slow_log                                     OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.user                                         OK
Upgrading the sys schema.
Checking databases.
...



Resotre your database
# mysql -u root -p < backup_all_201709.sql
Enter password:


References:
https://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/
https://dev.mysql.com/doc/refman/5.7/en/backup-and-recovery.html
https://dev.mysql.com/doc/refman/5.7/en/reloading-sql-format-dumps.html

Debian Stretch: Installing MySql (for fresh installation)

Remove all MariaDB
# apt-get --purge remove mysql-server mysql-client 
or 
# apt-get --purge remove mariadb-server-10.1 mariadb-server-core-10.1 mariadb-client-10.1 
# apt-get autoclean && apt-get autoremove
Note: option purge will remove all mariadb database

Install MySql dependency

# apt-get install lsb-release

Download MySql apt configuration from https://dev.mysql.com/get/mysql-apt-config_0.8.7-1_all.deb
# wget --no-check-certificate https://dev.mysql.com/get/mysql-apt-config_0.8.7-1_all.deb
Note: File name may change without notice, check latest mysql-apt-config at https://dev.mysql.com/downloads/repo/apt/

Install MySql apt configuration.
# dpkg -i mysql-apt-config_0.8.7-1_all.deb
Choose MySql 5.7 for stable version and continue by click Ok. It will create apt repository file like this:
# cat /etc/apt/sources.list.d/mysql.list
### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out entries below, but any other modifications may be lost.
# Use command 'dpkg-reconfigure mysql-apt-config' as root for modifications.
deb http://repo.mysql.com/apt/debian/ stretch mysql-apt-config
deb http://repo.mysql.com/apt/debian/ stretch mysql-5.7
deb http://repo.mysql.com/apt/debian/ stretch mysql-tools
#deb http://repo.mysql.com/apt/debian/ stretch mysql-tools-preview
deb-src http://repo.mysql.com/apt/debian/ stretch mysql-5.7

Run apt update
# apt-get update

Now you are ready to install MySql by issuing command
# apt-get install mysql-server mysql-client
Reading package lists... Done
Building dependency tree     
Reading state information... Done
The following additional packages will be installed:
  libmecab2 mysql-community-client mysql-community-server
The following NEW packages will be installed:
  libmecab2 mysql-client mysql-community-client mysql-community-server
  mysql-server
0 upgraded, 5 newly installed, 0 to remove and 3 not upgraded.
Need to get 36.8 MB of archives.
After this operation, 254 MB of additional disk space will be used.
Do you want to continue? [Y/n]

At the end of installation, you will be ask for MySql root password (Note: this is not root Linux user)
# service mysql status
● mysql.service - MySQL Community Server
   Loaded: loaded (/lib/systemd/system/mysql.service; bad; vendor preset: enable
   Active: active (running) since Wed 2017-09-20 08:04:27 WIB; 24s ago
 Main PID: 15189 (mysqld)
   CGroup: /system.slice/mysql.service
           └─15189 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysql

Sep 20 08:04:23 ca01 systemd[1]: Starting MySQL Community Server...
Sep 20 08:04:27 ca01 systemd[1]: Started MySQL Community Server.
# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.19 MySQL Community Server (GPL)

Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>


Reference:
  1. http://mysqlrelease.com/2017/06/debian-9-and-mysql-watch-out/
  2. https://dev.mysql.com/downloads/repo/apt/

Monday, September 18, 2017

Debian jessie: upgrade to Debian 9 (codename stretch)

Note:
  1. Debian 9 Stretch does not include MySql, your MySql will replace with MariaDB 10.1. Follow this step  to keep your MySql.
  2. PHP 7.0 will be use. Your PHP application may be not support it.
Upgrade your system and application before performing Debian 9 upgrade.
# apt-get update && apt-get upgrade -y
Note: restart your system if needed.

Install apt-listchanges
# apt-get install apt-listchanges

Edit your apt source and add Debian 9 (stretch) repository:
#deb http://security.debian.org/ jessie/updates main
#deb-src http://security.debian.org/ jessie/updates main

# Indonesia (main)
#deb http://kambing.ui.ac.id/debian/ jessie main
deb http://kambing.ui.ac.id/debian/ stretch main contrib

# NON FREE
#deb http://httpredir.debian.org/debian jessie main contrib non-free

# BACKPORT
#deb http://ftp.de.debian.org/debian jessie-backports main

# Google chrome
#deb http://dl.google.com/linux/chrome/deb/ stable main
Note: You can choose other closest mirror to you or use "deb http://mirrors.kernel.org/debian stretch main contrib".

To add CD-ROM
# apt-cdrom add

Do minimal upgrade by running apt update and apt-get upgrade
# apt-get update
...
# apt-get upgrade
...

You are ready for distribution upgrade. Edit /etc/apt/sources.list
#deb http://security.debian.org/ jessie/updates main
#deb-src http://security.debian.org/ jessie/updates main
deb http://security.debian.org/ stretch/updates main
deb-src http://security.debian.org/ stretch/updates main

#optional
#deb  http://deb.debian.org/debian stretch-updates main

# Indonesia (main)
# deb http://mirrors.kernel.org/debian stretch main contrib
deb http://kambing.ui.ac.id/debian/ stretch main contrib

# NON FREE
deb http://httpredir.debian.org/debian stretch main contrib non-free

# BACKPORT
deb http://ftp.de.debian.org/debian stretch-backports main

Note: you need to enable NON FREE repository for firmware upgrade

Do distribution upgrade
# apt-get update && apt-get dist-upgrade

Distribution upgrade will take some times depend on your connection speed. At the end of packages upgrade, you will need to interact with system.
Restart your system and enable 3rd party repository such as google chrome, virtualmin, odoo, etc. Perform final upgrade/update.
# apt-get update && apt-get upgrade -y

Your Debian 9 (stretch) is ready. :)
# uname -an
Linux saturn 4.9.0-3-amd64 #1 SMP Debian 4.9.30-2+deb9u3 (2017-08-06) x86_64 GNU/Linux

Note:
  1. A new configuration may apply, please carefully to choose a new configuration or your existing one (the option show as keep local).
  2. Default document root apache2 folder will change from /var/www/ to /var/www/html.
  3. Apache2 will run under linux user and group 'www-data'.
  4. To replace php5 to php7.0 follow this step

References: 

Friday, September 8, 2017

Windows 10 Build 15063: Fix Display Brightness on Amd

After upgrade to WIndows 10 build 15063, display brightness can not be change. To fix this we need to change value in registry.
Open regedit and change this value
  • HKEY_LOCAL_MACHINE> SYSTEM> CurrentControlSet> Control> Class> {4d36e968-e325-11ce-bfc1-08002be10318}> 0000 > KMD_EnableBrightnessInterface2 to 0
  • HKEY_LOCAL_MACHINE> SYSTEM> CurrentControlSet> Control> Class> {4d36e968-e325-11ce-bfc1-08002be10318}> 0001 > KMD_EnableBrightnessInterface2 to 0
Restart your Windows.

References:

https://community.amd.com/thread/184667

Friday, August 25, 2017

Android Studio: how to use Google Play service 11.2 release

To use latest Google Play services 11.2 release, we need to meet some requirements.
Here are my environment:
  • Android Studio 2.3.3
  • Android SDK Build-Tools 26.0.1
  • Google Play Service 43
  • Android Support Repository, rev 47
  • Android SDK Platform 26

1. Start from Google Play services 11.2 release, Google Play services dependcies are now abailable via maven.google.com. We need to change our application Grandle build scripts.

  1. Open Tab 1:Project, select Android
  2. Expand Grandle Scripts
  3. Open build.grandle (Project: [your project name])
  4. Find and add google() inside allprojects like this:
allprojects {
  repositories {
    jcenter()
    maven {
      url 'https://dl.google.com/dl/android/maven2/'
      // url 'https://maven.google.com' // NOT WORK
      // Alternative URL is 'https://dl.google.com/dl/android/maven2/'
    }
  }
}

2. Google Play services 11.2 release requires Android SDK Platform 26. You need to install it from SDK Manager and used it.
Open Tab 1:Project, select Android

  1. Expand Grandle Scripts
  2. Open build.grandle (Module: app)
  3. Make sure you use Android SDK Platform 26
android {
  compileSdkVersion 26
  buildToolsVersion "26.0.1"
  defaultConfig {
    ...
    targetSdkVersion 26
    ...
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

3. You can change and use Google Service 11.2 for example to use Google Adsmob
Open Tab 1:Project, select Android

  1. Expand Grandle Scripts
  2. Open build.grandle (Module: app)
dependencies {
  ...
  compile 'com.google.android.gms:play-services-ads:11.2.2'
  ...
}

References:

Monday, August 21, 2017

Debian Jessie: CPU frequency scaling to prevent over heat on laptop's cpu

To prevent over heat on laptop's CPU when used, we need to limit its frequency below maximum. We need cpufrequtils to do that.
To install CPU frequency scaling tools:
# apt-get install cpufrequtils
Show CPU info
# cpufreq-info
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 10.0 us.
  hardware limits: 1000 MHz - 1.67 GHz
  available frequency steps: 1.67 GHz, 1.33 GHz, 1000 MHz
  available cpufreq governors: powersave, userspace, conservative, ondemand, performance
  current policy: frequency should be within 1000 MHz and 1.67 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 1.67 GHz (asserted by call to hardware).
  cpufreq stats: 1.67 GHz:30.20%, 1.33 GHz:3.69%, 1000 MHz:66.10%  (10888)
analyzing CPU 1:
  driver: acpi-cpufreq
  CPUs which run at the same hardware frequency: 1
  CPUs which need to have their frequency coordinated by software: 1
  maximum transition latency: 10.0 us.
  hardware limits: 1000 MHz - 1.67 GHz
  available frequency steps: 1.67 GHz, 1.33 GHz, 1000 MHz
  available cpufreq governors: powersave, userspace, conservative, ondemand, performance
  current policy: frequency should be within 1000 MHz and 1.67 GHz.
                  The governor "ondemand" may decide which speed to use
                  within this range.
  current CPU frequency is 1.67 GHz (asserted by call to hardware).
  cpufreq stats: 1.67 GHz:28.63%, 1.33 GHz:3.90%, 1000 MHz:67.47%  (10888)
To show available frequency
# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
1667000 1333000 1000000
For kernel 3.16, edit file /etc/init.d/cpufrequtils, change MIN_SPEED to 1000000 and MAX_SPEED to 1333000. For example:
...
MAX_SPEED="1333000"
MIN_SPEED="1000000"
...
NOTE: Frequency must in range in # cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
Reload system daemon
# systemctl daemon-reload
References: