Sunday, October 18, 2015

IoT Mobile Apps development using HTML 5 and Javascript

Recently, I came to know about an interesting framework called "Evothings" which makes developers life easy as to develop Mobile IoT applications just by using HTML 5 and JavaScript.
It helps developers to build  or connect with any bluetooth, BLE, Wifi , NFC devices just with little help of HTML 5 and Java script.
Evothings is a Sweden based startup and it is hyperload live mobile development feature is fantastic, it is makes developing and testing very easy. This framework comes with lot of working examples in connecting with different devices. And of-course it is open source apache 2 licensed framework.
It supports connectivity to many devices (working examples for each given)
To name few devices
Estimote beacons, Aurdino, Philips HUE light, Electric Imp, Rasberry pi,etc...

Monday, October 12, 2015

Apache cordova App - Change App icon or logo.

 To change the default icon or logo of an Cordova application. we just have to replace the default icon.png from the below folder icons and re-build the cordova app and then deploy it. 

For iOS:

PROJECT_PATH/platforms/ios/PROJECT_NAME/Resources/icons


For Android:

PROJECT_PATH/platforms/android/res/drawable

also you need to update the icon name change in manifest file.

PROJECT_PATH/platforms/android/AndroidManifest.xml

Time to solve algorithm /puzzles :-) - Angry Professor

Angry Professor


The Problem statement is from "hackerrank.com" and I solved it using "javascript". 
At the bottom look for my derived solution.
Problem Statement

The professor is conducting a course on Discrete Mathematics to a class of N students. He is angry at the lack of their discipline, and he decides to cancel the class if there are fewer than K students present after the class starts.
Given the arrival time of each student, your task is to find out if the class gets cancelled or not.


Input Format
The first line of the input contains T, the number of test cases. Each test case contains two lines. 
The first line of each test case contains two space-separated integers, N and K
The next line contains N space-separated integers, a1,a2,,aN, representing the arrival time of each student.
If the arrival time of a given student is a non-positive integer (ai0), then the student enters before the class starts. If the arrival time of a given student is a positive integer (ai>0), the student enters after the class has started.


Output Format
For each testcase, print "YES" (without quotes) if the class gets cancelled and "NO" (without quotes) otherwise.


Constraints
Note 
If a student enters the class exactly when it starts (ai=0), the student is considered to have entered before the class has started.

  • 1T10
  • 1N1000
  • 1KN
  • 100ai100,where i[1,N]
Sample Input
2
4 3
-1 -3 4 2
4 2
0 -1 2 1
Sample Output
YES
NO
Explanation
For the first test case, K=3, i.e., the professor wants at least 3 students to be in class but there are only 2 who have arrived on time (3 and 1), hence the class gets cancelled.
For the second test case, K=2, i.e, the professor wants at least 2 students to be in class and there are 2 who have arrived on time (0 and 1), hence the class does not get cancelled.


Solution :-