Friday, February 1, 2019

ionic2 Android, Build failed version 9.2.0 is needed for the google-services plugin

You could edit a file of platforms/android/cordova-plugin-fcm/xxx-FCMPlugin.gradle
At the end of the file shows

dependencies {
compile ''
compile ''

Modify to,

dependencies {
compile ''
compile ''

Then recompile, hope it helps ^^

ionic2 ios xcode failed at Linking with duplicate symbols

ionic2 projects are very sensitive with its node_modules and dependencies, to me personally.
And bad luck came to me when i rename my project name. And the iOS platform has to be

$ ionic cordova platform rm ios
$ ionic cordova platform add ios

Starting all my problems. After successfully running
$ cordova platform rm ios
$ corvoda build ios
Everything went smooth event i can archive and upload to TestFligtth

And the day after, i had to compile and release in Android. The 1st problem starts
the $ionic/core had thrown version is '4' expected is '3'. After several time of
remove node_modules/ dir and npm install with no luck. I decided to
$ npm cache clean --force
$ npm install
$ cordova platform rm android
$ cordova platform rm ios
$ cordova platform add android@6.3.0
$ cordova platform add ios@4.5.4

I don't really sure if that is the root of all evil, anyway the Android was smooth.
And i need to be sured that smooth to ios too. And there is something to be edited,
an error of _requiresUserActionForMediaPlayback at AppBackground.m
just remove the underscore ( _ ) char from the beginning or requiresUser..

And if you stumbled with linking problem, as it shows many duplicate vars
at the xcode build report, then simply go to build phase and type the keyword
e.g SOSPicker then it will shows 2 or more SOSPicker.m and remove the ones
that not use then rebuild.

Hope it helps

cordova build android, Error spawn EACCES

Reference too
cordova build --verbose android helps identifying a necessary
is the solution. It will shows which gradle being used.

As per my case `$ which gradle ` shows to /usr/local/bin/gradle but
the cordova execution refers to Android Studio' gradle.

Hope it help ^^

Friday, August 3, 2018

CLANG, -fblock undefined reference to `_NSConcreteGlobalBlock'

Recently i pickup objective-c to play with. And stumbled upon with this little beast called
Block which similar to lambda function. I am running *debian 8 x64*

During compilation:
$ clang `gnustep-config --objc-flags` -fblocks -o method-2 method-2.m -I/usr/lib/gcc/x86_64-linux-gnu/4.9/include -I/opt/obj-c/libobjc2/ -I/usr/lib/ -lgnustep-base  -lobjc

it outputs:
In file included from method-2.m:1:
In file included from /usr/include/GNUstep/Foundation/Foundation.h:30:
In file included from /usr/include/GNUstep/GNUstepBase/GSVersionMacros.h:219:
/usr/include/GNUstep/GNUstepBase/GSConfig.h:416:13: warning: ignoring
      redefinition of Objective-C qualifier macro [-Wobjc-macro-redefinition]
#    define __strong
/usr/include/GNUstep/GNUstepBase/GSConfig.h:417:13: warning: ignoring
      redefinition of Objective-C qualifier macro [-Wobjc-macro-redefinition]
#    define __weak
2 warnings generated.
/tmp/method-2-ed2a94.o:( undefined reference to `_NSConcreteGlobalBlock'
clang-6.0: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:9: recipe for target 'method-2' failed
make: *** [method-2] Error 1

After minutes of googling found this link that saying to add the -lBlocksRuntime
which has the neccessary reference to *_NSConcreteGlobalBlock*

i then edit the compile rules to
$ clang `gnustep-config --objc-flags` -fblocks -o method-2 method-2.m -I/usr/lib/gcc/x86_64-linux-gnu/4.9/include -I/opt/obj-c/libobjc2/ -I/usr/lib/ -lgnustep-base  -lobjc -lBlocksRuntime

it compiled successfully. ^^

here is the source code of method-2.m:


typedef void (^CompletionBlock)();
@interface SampleClass:NSObject
/* method declaration */
- (int)max:(int)num1 addNum:(int)num2 callback:(CompletionBlock)callbackFN;

@implementation SampleClass

/* method returning the max between two numbers */
- (int)max:(int)num1 addNum:(int)num2 callback:(CompletionBlock)callbackFN{

   /* local variable declaration */
   int result;


   if (num1 > num2) {
         result = num1;
      } else {
            result = num2;
   return result; 


int main () {
   /* local variable definition */
   int a = 100;
   int b = 200;
   int ret;
   SampleClass *sampleClass = [[SampleClass alloc]init];

   /* calling a method to get max value */
   ret = [sampleClass max:a addNum:b callback:^{
      NSLog(@"Callback is called");
   NSLog(@"Max value is : %d\n", ret );
   return 0;

And i also use this headers file located in

Thursday, October 12, 2017

HAProxy forwarding custom port

Hi, just a small note of am being doing. That to setup HAProxy to forward custom port request to one of my nodejs server.

Add these into existing /etc/haproxy/haproxy.cfg

frontend mynodejs
  bind *:3000
  default_backend nodejs

backend nodejs
  server nodejs1
Source of snippet is from here
Have fun ^.^

Friday, May 26, 2017

Debian8 Xfce4 Crash Whenever Thunar About to Show video Thumbnail

If your debian8 release is 8.3 and having xfce4 crash all the time whenever a *.mov or video
file processed by Thunar, then bear with me. You can check your debian8 release by

$ cat /etc/debian_version

This the crash log whenever at least one movie file thumbnail processed by Thunar
$ sudo tail -f /var/log/messages

May 26 17:17:08 debian8 org.freedesktop.thumbnails.Thumbnailer1[5619]: libva info: VA-API version 0.36.0
May 26 17:17:08 debian8 org.freedesktop.thumbnails.Thumbnailer1[5619]: libva info: va_getDriverName() returns -1
May 26 17:17:08 debian8 org.freedesktop.thumbnails.Thumbnailer1[5619]: libva error: va_getDriverName() failed with unknown libva error,driver_name=(null)
May 26 17:17:08 debian8 org.freedesktop.thumbnails.Thumbnailer1[5619]: libva info: VA-API version 0.36.0
May 26 17:17:08 debian8 org.freedesktop.thumbnails.Thumbnailer1[5619]: libva info: va_getDriverName() returns -1
May 26 17:17:08 debian8 org.freedesktop.thumbnails.Thumbnailer1[5619]: libva error: va_getDriverName() failed with unknown libva error,driver_name=(null)

So, i browse to xfce4 download page and download the source of the stable release, 4.12
is the stable release as this blog written. After the download, extract and go to the
src/tumbler-0.1.31 dir

$ ./configure

if the the configuration complain some of the missing lib you could
$ sudo apt-get install libxfce4ui-1-dev libxfce4util-dev libxfce4util-common

If the configure is meet then

$ make
$ sudo make install

And reboot, when i open a dir that contain movie file using Thunar the xfce4 no longer crash.
Hope it helps ^^

I found that the daemon automatically run with the old one
$ ps -ef | grep tum
adesanto  9242     1  0 18:01 ?        00:00:00 /usr/local/lib/tumbler-1/tumblerd

so i rename the old daemon and create symbolic link to the new one
# mv  /usr/local/lib/tumbler-1/tumblerd  /usr/local/lib/tumbler-1/bak-tumblerd
# ln -s ln -s /opt/xfce4com/src/tumbler-0.1.31/tumblerd/.libs/lt-tumblerd /usr/local/lib/tumbler-1/tumblerd

have fun

Sunday, July 31, 2016

ESP8266, Send and Receive HTTP Request, PART-1

The Beginning
I bought two of ESP8266 from my local store. And try to play with them using Arduino UNO.
The ESP8266 needs the 3.3 powersupply. And tried to use the 3.3 of the UNO but no avail.
So i setup the LM317T in a breadboard like this.

And after wiring all the stuffs. is become

1x LM317T
1x 10uF Polar Capacitor
1x 220ohm
1x 470ohm (i replace it with 1k resistor) (5V powersupply)
1x 470ohm with 9V powersupply
2x 47ohm ( to perform as dummy load, no need for later usage)

**Fritzing, will be updated soon**

I replaced the 470 with 1k simply because if the dummy load is attached the voltage drop badly.
After several trial&error the best fit is 1k. It is showing 3.6 with no load with 4.8V from the USB
wallplug powersupply. Then i arrange my UNO and ESP8266 as in the picture.

**Fritzing, will be updated soon**

    1 => Connect to Station or as a client
    2 => As Router
    3 => Both, you will notice that it has router ip and static client IP by AT+CIFSR
    Set static IP
3. AT+CWJAP="TP-LINK_BOSSD","**yourpassword**"
    To connect to your wifi
    Whether to use Multiple connection or Single, later in my code i use single
5. AT+CIPSTART=1,"TCP","",80
    Open a Connection
6. AT+CIPSEND=1,+2
    Where the 1 for the Multiple ID but to simplify later i use Mux=0 (Single) so you only need to
    create the AT command with AT+CIPSEND=NByte
    Where NByet is the length of your string,
    Example: GET /minimal.php/this HTTP/1.0  <-- 30="" br="" chars="" in="" is="" length="">    Total of NLength is 30 plus 2 pairs of NL/CR \r\n.
    Note if your trying these steps using the arduino serial monitor dialog,
    then set the ending to "Both NL/CR", paste the "GET ..." string
    and hit an Enter key and one more Enter key.

1. While the 2 Arduino UNO hooks to my Laptop,
    The esp8266 serial line keeps jumping and sending data.
    By powering one of the UNO to external power removed the `jumpy`
2. Arduino 5V must also connected to external power supply that source the LM317T
   Which i use an USB 5V wallplug.

   ** Which result not enough current **
   The specs say 5V 1A but unable to power these 2x Atmega328, 1x ESP8266, 1x RC522 Module, 
   LCD 16x2,  I2C Lcd, though. Using 9V 0.6A powersupply works great. 

   This one also fails.
3.AT+IPR=9600 to change the baudrate. DO NOT USE THIS!!!
   but to use AT+UART=9600,8,1,0,0 (The flow control has to be disabled!)
4. I set my HardwareSerial or Serial.begin(19200) twice of the SoftwareSerial
    after several trial&error it is better to configured like such to remove gibberish output.
    Using 9V also gives more stability. All gibberish are almost removed completely.
5. Zener 3.3V and a resistor of 68ohm before the zener to GND fails to provide
    stable 3.3V, it always shows 4.5V
6. All GND must be connected! I forgot to connect my Arduino GDN to common GND
    and the result is gibberish output at the serial monitor

1. The full AT commands
2. I found the doc about AT+UART to change baudrate here but it says that is deprecated??
    as my AT+GMR output is this
    AT version:
    SDK version:0.9.5