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 :
http://aicameras.ca . 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 http://facialrecognitionhub.com


http://aicams.ca:5000 - live video stream processing example a
Python and OpenCV code for this example here --> :
https://github.com/zeroprg/flask-video-streaming
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:  https://jsfiddle.net/py9qodLt/2/
Second one https://jsfiddle.net/ra59u7bm/13/
Template in VUE.js https://jsfiddle.net/py9qodLt/2/
Template second example: https://jsfiddle.net/dr567qo9/

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

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

Overriding  "parent" (any component) method,  nugget from  "TPS Quick Bill" project  :
https://jsfiddle.net/rbm2u1na/54/
Useful pagination examplehttps://jsfiddle.net/taha_sh/hmapx482/ from pagination plugin: https://github.com/TahaSh/vue-paginate
Useful Scheduler component . I'm working on it to make it more complex and more extendable . It should be transformed  to Appointment board:
https://jsfiddle.net/fycxhqpf/ .
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": https://jsfiddle.net/fycxhqpf/1/
  2. Step 2. This nugget after adding 'hide/show appointments' : https://jsfiddle.net/fycxhqpf/5/
  3. This nugget after adding  'Add appointments' functionality :https://jsfiddle.net/ph5ao2f6/

Thursday, August 25, 2016

A "binary gap" task from http://codility.com 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 http://codility.com 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].
Complexity:
  • expected worst-case time complexity is O(log(N));
  • expected worst-case space complexity is O(1).
 Solution:
/ 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;
        do
        {
            int shift = N & 0x00000001;
            if( shift == 1 )
            {
                zeros = 0;
                ones += 1;
            }
            else 
            {
                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);
    else
        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
OK 

Example test:   15
OK 

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: http://asyncuisrvc.azurewebsites.net/async_ui_srvc/ui/Messanger.html


    

  
    
    


 
 


Messenger




_