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).