Saturday, December 23, 2017

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