Friday, October 26, 2018

Horovod API and ARM based claster creation

This post will be about my long journey to setup Horovod API and ARM based claster creation.
I will place all Linux commands and possible trap on way to the goal : 8 nodes ARM bases claster .
I will show how fast this claster on MNIST dataset.  And compare perfomance when claster works on differrent nodes.

Saturday, June 23, 2018

How to use OpenCV and Flask in Python to create AI surveillance cameras software

Introduce a new web site for artificial intelegence survival cameras : . We can add your cameras feed to the cloud or send you Rasberry PI 3 with this code just only for 170 CAD$ check this site too - live video stream processing example a
Python and OpenCV code for this example here --> :
This code was tuned up for Rasberry PI 3 B+

Friday, January 20, 2017

VUE.js nuggets in JSFiddle from simple to complex (being updated)

My first VUE , very simple:
Second one
Template in VUE.js
Template second example:

VUE Component used in real  nugget  from  "TPS Quick Bill" project  Sorry still playing with jsfiddle  :
                      How to extend existing VUE.JS component:
Extending local VUE Component
Overriding  "parent" (any component) method by passing it as parameter :
Event handling nuggets:

  1. Event handling by mount() function (only from  VUE 2.0 ): 
  2. Event handling passing event by v-on:increment  component tag attribute (see: doc  ) approach 
  3. Event handling by app,$on similar to  #1  but simplified

Overriding  "parent" (any component) method,  nugget from  "TPS Quick Bill" project  :
Useful pagination example from pagination plugin:
Useful Scheduler component . I'm working on it to make it more complex and more extendable . It should be transformed  to Appointment board: .
This was really tough nugget. After 3 hours staring into miracle of  styling from Jayzou.  Thank you to mister Jayzou 谢谢   I want to make completely functional multi-user appointment board Now it will be easy to add "Add appointment " link on every cell of schedule  (in future I can add condition which prevent to draw it if this time frame is busy.

  1. Step 1. This nugget after adding link "Add appointment":
  2. Step 2. This nugget after adding 'hide/show appointments' :
  3. This nugget after adding  'Add appointments' functionality :

Thursday, August 25, 2016

A "binary gap" task from with solution

After 24 years of coding I found so my coding skills come to degradation. For last two day I polish them by using I place here some examples from there with my solutions . I use this this blog as chit sheet and to memorise that nice piece of mind twister :
  Task definition: A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N.
For example, number 9 has binary representation 1001 and contains a binary gap of length 2. The number 529 has binary representation 1000010001 and contains two binary gaps: one of length 4 and one of length 3. The number 20 has binary representation 10100 and contains one binary gap of length 1. The number 15 has binary representation 1111 and has no binary gaps.
Write a function:
class Solution { public int solution(int N); }
that, given a positive integer N, returns the length of its longest binary gap. The function should return 0 if N doesn't contain a binary gap.
For example, given N = 1041 the function should return 5, because N has binary representation 10000010001 and so its longest binary gap is of length 5.
Assume that:
  • N is an integer within the range [1..2,147,483,647].
  • expected worst-case time complexity is O(log(N));
  • expected worst-case space complexity is O(1).
/ you can also use imports, for example:
// import java.util.*;

// you can write to stdout for debugging purposes, e.g.
// System.out.println("this is a debug message");

class Solution {
    public int solution(int N) {
        // write your code in Java SE 8
        int dimension = binlog(N);
        byte A[] = new byte[dimension];
        int i = 0;
        int zeros = 0;
        int ones = 0;
        int max = -1;
            int shift = N & 0x00000001;
            if( shift == 1 )
                zeros = 0;
                ones += 1;
                zeros += 1; 
                ones = 0;
            if( zeros > max ) max = zeros;
            N >>>= 1;
        }  while ( i ++ < dimension);
      return max;
   public static int binlog( int bits ) // returns 0 for bits=0
    int log = 0;
    if( ( bits & 0xffff0000 ) != 0 ) { bits >>>= 16; log = 16; }
    if( bits >= 256 ) { bits >>>= 8; log += 8; }
    if( bits >= 16  ) { bits >>>= 4; log += 4; }
    if( bits >= 4   ) { bits >>>= 2; log += 2; }
    return log + ( bits >>> 1 );
This even more shorter solution based on recursion
static int solution(int n) {
    return solution(n, 0, 0);

static int solution(int n, int max, int current) {
    if (n == 0)
        return max;
    else if (n % 2 == 0)
        return solution(n / 2, max, current + 1);
        return solution(n / 2, Math.max(max, current), 0);
Test result:
Running solution...
Compilation successful.

Your test case: [529]
Returned value: 4 

Your test case: [9]
Returned value: 2 

Your test case: [20]
Returned value: 2 

Example test:   1041

Example test:   15

Your code is syntactically correct and works properly on the example test.
Note that the example tests are not part of your score. On submission at least 8 test cases not shown here will assess your solution.

Saturday, July 23, 2016

How to catch all pokemons or JScript chat with all available Pokemon using leaflet.js and Pokemon API

Here is JScript client of Java Messenger (Chat rooms) with available Pokemon at the same area on map: