December 31, 2019

it's never too late Don't give up keep going on.


It's never too late to try to achieve your dream!
it's never too late to learn something new!
it's never too late to experience something beautiful!
its never too late to keep on trying, no matter how many times you fail!
it's never too late...

There was a man, born a long time ago, 
Bought up in a simple middle-class family, his father was a long family man and use to work on his farm.
Lost his father when he was five years old, he was too young to realize what had happened.

At the age of seven, he learned to cook, to feed his younger siblings and his mom away working.
At the age of ten, he began working as a helper in the farmland and then took up job painting horse carriages,
At the age of thirty, he established a ferry boat company the ferry was an instant success and venture failure.

Lost many jobs than finally started running a service station that got failed after six years of works.
Many businesses failed, Almost bankrupt.

Decided to sell his recipe to the various restaurants,
Rejected for 1009 times

At the age of 65, he tasted success as KFC
Founder of Kentucky Fried Chicken.
He is colonel sanders

Don't give up keep going on. 


 

December 21, 2019

OSI Model Explained | OSI Animation | Open System Interconnection Model | OSI 7 layers Animation

Animated tutorial- OSI Model Explained




Thanks


A complete source code for Tic Tac Toe program in Java will be posted soon in this blog

December 14, 2019

Spiral unwinding a matrix interview question solved java source code

To unwind a matrix spirally to an array.

/**
 * Unwinding a matrix in java
 * Tested a 5 x 5 matrix
 */
package com.konzern.solution;

/**
 * @author Arjun Babu
 *
 */
public class Unwinding {

/**
* @param amazon
*/
public static void main(String[] hematcs) {
Unwinding unwindMatrix = new Unwinding();
int[][] matrix = unwindMatrix.getInput();
unwindMatrix.display(matrix);
int[] value = unwindMatrix.unwindMatix(matrix);
}

private void display(int[][] matrix) {
System.out.println("The Input Matrix \n");
int len = matrix.length;
for (int i = 0; i < len; i++) {
for (int j = 0; j < len; j++) {
System.out.print(matrix[i][j] + "\t");
}
System.out.println();
}

}

private int[] unwindMatix(int[][] matrix) {
System.out.println("\nThe Output Array \n");
int len = matrix.length;
int loopCount = len * len;
int data[] = new int[loopCount];
int flag = 0;
int maxRow = len - 1;
int maxCol = len - 1;
int minRow = 0;
int minCol = 0;
int row = 0;
int col = 0;
for (int i = 0; i < loopCount; i++) {
data[i] = matrix[row][col];
System.out.print(data[i] + " ");
switch (flag) {
case 0:
col = col + 1;
if (col > maxCol) {
col = maxCol;
row = row + 1;
minRow++;
flag = 1;
}
break;
case 1:
row = row + 1;
if (row > maxRow) {
row = maxRow;
col--;
maxCol--;
flag = 2;
}
break;
case 2:
col = col - 1;
if (col < minCol) {
row = row - 1;
col = col + 1;
maxRow--;
flag = 3;
}
break;

case 3:
row = row - 1;
if (row < minRow) {
row = row + 1;
col = col + 1;
minCol++;
flag = 0;
}
break;
default:
break;
}
}
return data;
}

private int[][] getInput() {
int matrix[][] = { { 1, 2, 3, 4, 5 }, { 6, 7, 8, 9, 10 }, { 11, 12, 13, 14, 15 }, { 16, 17, 18, 19, 20 }, { 21, 22, 23, 24, 25 } };
return matrix;
}
}


The Input Matrix 

1 2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25

The Output Array 

1 2 3 4 5 10 15 20 25 24 23 22 21 16 11 6 7 8 9 14 19 18 17 12 13 


December 07, 2019

Unwinding a matrix in java

/**

Unwinding a matrix in java

 * Unwinding a matrix in java
 */
package com.konzern.solution;

/**
 * @author Gokul balan
 *
 */
public class Unwinding {

/**
* @param args
*/
public static void main(String[] args) {

Unwinding w = new Unwinding();
int[][] matrix = w.getInput();
w.display(matrix);
int[] value = w.unwindMatix(matrix);

}

private void display(int[][] matrix) {
int len = matrix.length;
for (int i = 0; i < len; i++) {
for (int j = 0; j < len; j++) {
System.out.print(matrix[i][j] + "\t");
}
System.out.println();
}

}

private int[] unwindMatix(int[][] matrix) {
int len = matrix.length;
int loopCount = len * len;
int data[] = new int[loopCount];
int flag = 0;
int maxRow = len - 1;
int maxCol = len - 1;
int row = 0;
int col = 0;
for (int i = 0; i < loopCount; i++) {
data[i] = matrix[row][col];
System.out.print(data[i] + "\t");
switch (flag) {
case 0:
row = row;
col = col + 1;
if (col > maxCol) {
col = maxCol;
row = row + 1;
flag = 1;
}
break;
case 1:
row = row + 1;
col = col;
if (row > maxRow) {
row = maxRow;
flag = 2;
maxCol--;
}
break;
case 2:
row = row;
col = col - 1;
if (col < 0) {
flag = 3;
maxRow--;
}
break;

case 3:
row = row - 1;
col = col;
if (row < 0) {
flag = 0;
}
break;
default:
break;
}

}

return data;
}

private int[][] getInput() {
int matrix[][] = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } };
return matrix;
}

}


Output

The marix

1 2 3
4 5 6
7 8 9

After Unwinding

1 2 3 6 9 8 7 4  5

Getting the exception


Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1
at com.konzern.solution.Unwinding.unwindMatix(Unwinding.java:45)
at com.konzern.solution.Unwinding.main(Unwinding.java:20)


Source Code


/**
 * Unwinding a matrix in java
 */
package com.konzern.solution;

/**
 * @author Konzernites
 *
 */
public class Unwinding {

/**
* @param args
*/
public static void main(String[] args) {

Unwinding w = new Unwinding();
int[][] matrix = w.getInput();
w.display(matrix);
int[] value = w.unwindMatix(matrix);

}

private void display(int[][] matrix) {
int len = matrix.length;
for (int i = 0; i < len; i++) {
for (int j = 0; j < len; j++) {
System.out.print(matrix[i][j] + "\t");
}
System.out.println();
}

}

private int[] unwindMatix(int[][] matrix) {
int len = matrix.length;
int loopCount = len * len;
int data[] = new int[loopCount];
int flag = 0;
int maxRow = len - 1;
int maxCol = len - 1;
int minRow = 0;
int minCol = 0;
int row = 0;
int col = 0;
for (int i = 0; i < loopCount; i++) {
data[i] = matrix[row][col];
System.out.print(data[i] + "\t");
switch (flag) {
case 0:
row = row;
col = col + 1;
if (col > maxCol) {
col = maxCol;
row = row + 1;
flag = 1;
minRow++;
}
break;
case 1:
row = row + 1;
col = col;
if (row > maxRow) {
row = maxRow;
col--;
flag = 2;
maxCol--;
}
break;
case 2:
row = row;
col = col - 1;
if (col < minCol) {
row = row - 1;
col = col + 1;
flag = 3;
maxRow--;
}
break;

case 3:
row = row - 1;
col = col;
if (row < minRow) {
row = row + 1;
col = col + 1;
flag = 0;
}
break;
default:
break;
}

}

return data;
}

private int[][] getInput() {
int matrix[][] = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } };
return matrix;
}

}


Output

The marix

1 2 3
4 5 6
7 8 9

After Unwinding

1 2 3 6 9 8 7 4  5

Tik Toc Toe in python, two player game, playing with computer complete source code available soon...

December 01, 2019

The Girl who knows to code - The Disappointed Day

The Disappointed Day



An aggressive shout from the Head of Technology Section.
 " What the hell he did ??? " 
" He and his scrap Ideas !!! "
 Shouting loudly, where people in a kilometre distance can hear his sound. 
Head who is a exaggerate in character was a half politician. 
He scolds the guy who came up with that solution. 
The solution was good enough, and the problem now happening was not due to the solution. The guy was disappointed much for giving a solution to the problem.
Head himself made that guy a scapegoat in many situations earlier already.
Failure in BIOS battery resets the system date to a past date since there is privilege restriction the ordinary users (unit staffs) cannot change the date, the only administrator can do it. 
So he could not log in to the software. 
Even replacing the battery could solve the issue permanently. 
People like these head are making the situation in many offices the worst. 
The subordinates even quit their job because of these peoples.

November 28, 2019

To guess number between 0 zero and 100 hundred in python


To guess number between 0 zero and 100 hundred in python


if __name__=='__main__':
    isnum=False
    num=100
    upprnge=100
    lwrnge=0
    lst=[]
    print('Think of number between 0 and 100..')
    while not isnum:
        print(num, upprnge,lwrnge)
        isnum1 = input("Is "+str(num)+" the number?y/n ")
        if isnum1=='y':
            isnum=True
        elif isnum1=='n':
            isnum2 = input("Is "+str(num)+" high?y/n ")
            if isnum2=='y':
                if upprnge >= num:
                    upprnge=num
                    num = lwrnge + round((upprnge-lwrnge)/2,0)
            elif isnum2=='n':
                if lwrnge <= num:
                    lwrnge=num
                num = upprnge - round((upprnge-lwrnge)/2,0)
            lst.append(num)
            print(lst)
    print('number is ', num)


Developed in python by steffi

November 21, 2019

Tic Tac Toe algorithm and source code in python

Tic Tac Toe algorithm and source code in python

After a short break, This the first program I wrote in python

n=3#int(input("Enter size of board! "))

def printbox(lst):
    for i in range(2*n+1):
        if i%2==0:
            for k in range(n):
                if k==0:
                    print('  ', end='')
                print('----  ', end='')
        else:
            for k in range(n+1):
                if k==n:
                    print(' |', end='')
                else:
                    pp = addcolor(lst[(i-1)/2,k])
                    print(' |',pp, end='')
        print('')

def addcolor(num):
    if num == 1:
        return '\033[0;37;41m '+str(num)+'\033[0m'
    elif num==2:
        return '\033[0;37;46m '+str(num)+'\033[0m'
    return num

import numpy as np
#strlst = '1,0,1,2,1,1,0,2,1'#input("give 9 numbers")
lst=np.zeros(9).reshape(3,3)

def iswinner(lst):
    printbox(lst)
    
    issame=True
    knum=0
    for i in range(3):
        if np.all(lst[i,:]==1) or np.all(lst[:,i]==1):
            return(1)
        elif np.all(lst[i,:]==2) or np.all(lst[:,i]==2):
            return 2
        if i==0:
            knum=lst[i,i]
        elif issame and knum!=lst[i,i]:
            issame=False
    if issame and knum!=0:
        return knum
    return 0

s=0
while s<9:
    strlst1 = input('your move i,j,number')
    i,j,knum=strlst1.split(',')
    if (s%2==0 and int(knum)==1) or (s%2==1 and int(knum)==2):
        lst[i,j]=knum
        iswin = iswinner(lst)
        if iswin == 1:
            print('1 is winner')
            break
        elif iswin==2:
            print('2 is winner')
            break
        else:
            print('no win')
        s+=1
    else:
        print('enter valid number')



paste code in 
and run





Developed by steffi thomas

November 14, 2019

FibonacciSeries using recursion - only two lines of code

/**
 * FibonacciSeries using recursion
 */
package com.konzerntech.kozhikode;

/**
 * @author Alwin
 *
 */
public class FibonacciSeries {

/**
* @param args
*/
public static void main(String[] args) {
FibonacciSeries f = new FibonacciSeries();
int count = 49;
int first = 0;
int second = 1;
f.fibonacci(first, second, count);
}

private void fibonacci(int first, int second, int count) {
if (count != 0) {
System.out.print(first + " ");
fibonacci(second, first + second, count - 1);
}
}

}


Output

0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711 28657 46368 75025 121393 196418 317811 514229 832040 1346269 2178309 3524578 5702887 9227465 14930352 24157817 39088169 63245986 102334155 165580141 267914296 433494437 701408733 1134903170 1836311903 -1323752223 512559680


Tik Toc Toe in python, two player game, playing with computer complete source code available soon...


November 07, 2019

Civil Disobedience Movement (1930 - 1931) - video tutorial


  1. Gandhiji s demand to Lord irwin (present viceroy) in the form of 11 points ( includes abolition of salt tax)
  2. Gandhiji s statement evoked no response from the statement
  3. the next way is civil disobediance, including non payement of tax.
  4. Gandhiji plan to initiate the campain by breaking the salt law  
  5. Gandhiji march from sabarmathi asram to dandti with 71 members form march  12 to april 6 (24 days) - salt sathyagraha
  6. In Tamil Nadu, C Rajagopalachari led salt march from Tirchurappali to Vedaraniyam (Tanjore)
  7. In kerala,  K Kelappan led salt march from kozhikode to payanur
  8. Gandhiji was arrested in may 5, his place was taken up by Abbas Tayabji.
  9. He too was arrested and that place was taken up by Sarojini Naidu
  10. Another significant feature of this movement was the participation of women and teenagers.


November 01, 2019

The Girl who knows to code -The subsidy day


The subsidy day





Summer hot at its peak, its getting harder and harder to sit in office.
The Kerala government had ordered to give subsidies for 100 homes per day through the organization where we are working.

A Bulk sale every day, in additional we have to fight against all types of malpractices happening.
There was a loop hole in our software, where the user can change to past date and bill on any previous dates.
This was a nightmare to account  and business team.

He came up with a solution by restricting the window user to change the system date and grands only user privilege for units under the region.
Since the day administrator privilege was given to every one.

Its twelve minutes to twelve.
Call from the subsidy unit.
A staff aggressively shouting to Information Technology head who is on the other side of the call.

" We Cannot login to the software !!! ", the issue exist every day and still the team could not find why this happening?
A long queue of people who came to buy subsidies are waiting in front of them.

The situation get worse now.
After hours of struggle, the team identified the problem. and it was because of the restricted privilege of user account that he could not login. Since our software does not allow the user to login on past date.





Secure your P C Now



Read Next >> The disappointment day

October 28, 2019

Byte array to string the fastest - high performance

/**
 *Byte array to string the fastest - high performance
 */
package com.konzern.solution;

import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.charset.CharacterCodingException;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;

/**
 * @author Athul
 *
 */
public class ProximoConvertor {


private String ascii = "ASCII";
private String DEFAULT_ENCODING = ascii;

/**
*
* @param data
* @param offset
* @param length
* @param characterEncoding
* @return
* @throws CharacterCodingException
*/
public String convertByteToString(byte[] data, int offset, int length, String characterEncoding) throws CharacterCodingException {
ByteBuffer buffer = ByteBuffer.wrap(data, offset, length);
Charset charset = Charset.forName(characterEncoding);
CharsetDecoder decoder = charset.newDecoder();
CharBuffer cBuffer = null;
cBuffer = decoder.decode(buffer);
return cBuffer.toString();
}

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub

ProximoConvertor convertor = new ProximoConvertor();
byte[] input = { -61, -106, -107, -94, -92, -108, -123, -103, -122, -123, -124, 64, -46, -106, -87, -120, -119,
-110, -106, -124, -123, 64, -39, -123, -121, -119, -106, -107, -127, -109, 64, -42, -122, -122, -119,
-125, -123 };
try {
System.out.println(convertor.convertByteToString(input, 0, 11, "CP1047"));
} catch (CharacterCodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

}


Output


Consumerfed

A most selling mobile with Low cost and best specifications available

64 GigaByte Camera

October 21, 2019

Software project consumerfed kozhikode regional office

We consumerfed Information Technology section ( Bithesh, Shimjith, Vipin) had build a software application and has been running successfully over the past five years.

We had made a research and found it how powerful is Java script, so we decide to develop this application on scripts, we use asynchronous mechanism. Feel free to contact us.


Controller sheet : A user interface developed to help other non I T peoples in the regional office, to control the application using admin panel. Simple and Easy to use interface

Controller sheet

 Script : The source code behind the application. There is around 100  services running behind the application.
Source code : Scripts


 Execution Dashboard : Dashboard have the information like what all services run , execution time, and status
Execution Dashboard


 Triggers : like batch it works.The dashboard gives additional information like Error rate of application

Triggers

Thanks for reading this page.

Please drop all your queries to us

There were many occasion when we got criticism on our project during development cycle. The accounts section criticised the most. But eventually we reach our goal. Within 2 months we were able to stabilise our services. Our fault tolerance turns to value zero. So Never Quit from what your goal is....



Gift you dear ones !!!

Every occasion and every moments are precious in your life. Gift you dear ones to show how much you care for them. A small gift can bring a beautiful smile on your dear ones face. Hurry !!!


October 14, 2019

Solving Eight Queen problem in chess board

/**
 *

Trying to solve eight queen problem in a chess board


 */
package com.codecreeks.solutions;

/**
 * @author Consumerfed kozhikode Information Technology Section
 *
 */
public class EightQueen {

/**
* @param args
*/
public static void main(String[] args) {

int[][] output = { { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0 } };

int x = 0;
int y = 0;
int queen = 1;
int queenCount = 8;

while (queen <= queenCount) {
output[x][y] = 1;
x = x + 1;
y = y + 2;
if (y >= 8) {
y = (y % 8) + 1;
}
queen++;
}

for (int row = 0; row < 8; row++) {
for (int col = 0; col < 8; col++) {
System.out.print(output[row][col] + " ");
}
System.out.println();
}

}

}

Output



1 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0
0 0 0 0 1 0 0 0
0 0 0 0 0 0 1 0
0 1 0 0 0 0 0 0
0 0 0 1 0 0 0 0
0 0 0 0 0 1 0 0
0 0 0 0 0 0 0 1

Chess Boards available

So you must be wondering what is the revenue of our blog ? The commission (around 1 to 2 %) from amazon when any one purchase any amazon product through this blog. so we request you to buy any amazon product through this blog.


October 07, 2019

Number of characters to be removed to make two string anagram

/**
 * Anagram solver
Number of characters to be removed to make two string anagram
 */
package com.steffi.samples;

/**
 * @author Konzern Technologies
 *
 */
public class Anagram {

private int ptr = 0;
private StringBuilder sb = null;

public Anagram(StringBuilder sb) {
this.sb = sb;
}

/**
* @param args
*/
public static void main(String[] args) {
String str1 = "RAMU";
String str2 = "RAMESHA";
char[] char1 = str1.toCharArray();
char[] char2 = str2.toCharArray();
StringBuilder sb = new StringBuilder();
Anagram anagram = new Anagram(sb);
String ans = (str1.length() < str2.length()) ? anagram.compute(char1, char2) : anagram.compute(char2, char1);
System.out.println("Anagram : "+ans);
System.out.println((str1.length()+str2.length())-(ans.length()*2));

}

private String compute(char[] charA, char[] charB) {
for (int i = 0; i < charB.length; i++) {
if (charA[ptr] == charB[i]) {
sb.append(charA[ptr]);
charB[i] =' ';
break;
}
}
ptr++;
if (ptr >= (charA.length)) {
return sb.toString();
} else {
return compute(charA, charB);
}
}



}


outputs

RAM
5


Inputs Strings RAMU & RAMESH
Anagram :RAM
Characters to remove 4

Inputs Strings RAMUS & RAMESH
Anagram :RAMS
Characters to remove 3

Inputs Strings ARGENTINA & BRAZIL
Anagram :RAI
Characters to remove 9

Inputs Strings KONZERN & AMADEUS
Anagram :E
Characters to remove 12


Inputs Strings VIJI & ELIZA
Anagram :I
Characters to remove 7

Inputs Strings BLACK & MAMBA
Anagram :AB
Characters to remove 6





Tik Toc Toe in python, two player game, playing with computer complete source code available soon...

September 28, 2019

Finding the missing number in a sequential array with minimum complexity


Finding the missing number using binary search

Description :


/**
 * Find missing number in a sequence Minimum complexity (n Log n)
 *
 * input : {1,2,3,5}
 * output : 4
 */
package com.steffi.solutions;

import java.util.Arrays;

/**
 * @author Consumerfed Information Technology Section
 *
 */
public class MissingNumberArray {

private static int loopCount = 0;

public static void main(String[] args) {
long startTime = System.currentTimeMillis();
int[] a = {1,2,3,4,6,7,8,9,10,11,12};
int len = a.length;
MissingNumberArray m = new MissingNumberArray();
int value = 0;
if(a[len-1]!=len) {
value = m.findMissingNumber(a, 0, len);
System.out.println(" The Missing number in the array :"+Arrays.toString(a)+" is "+value);
}else {
loopCount++;
System.out.println(" There is no missing number in the given array "+Arrays.toString(a));
}
System.out.println(" For "+len+" size array it tooks "+loopCount+" search to find the answer ");
System.out.println(" Complexity :"+len*Math.log(len));
System.out.println(" Time Taken : "+(System.currentTimeMillis() - startTime)+" ms");

}

private int findMissingNumber(int[] array, int startPstn, int endPstn) {
loopCount++;
int arraySize = endPstn - startPstn;
int position = startPstn + arraySize / 2;
if(arraySize==0) {
return position +1;
}else if (arraySize == 1) {
return array[position] + 1;
}
else if (array[position] != position + 1) {
return findMissingNumber(array, startPstn, position);
} else {
return findMissingNumber(array, position + 1, endPstn);

}
}
}

Output

 The Missing number in the array :[1, 2, 3, 5] is 4
 For 4 size array it tooks 2 search to find the answer
 Complexity :5.545177444479562
 Time Taken : 4 ms

 The Missing number in the array :[1, 2, 3, 5, 6, 7, 8, 9, 10] is 4
 For 9 size array it tooks 3 search to find the answer
 Complexity :19.775021196025975
 Time Taken : 4 ms

 The Missing number in the array :[1, 2, 3, 4, 5, 6, 7, 8, 10] is 9
 For 9 size array it tooks 3 search to find the answer
 Complexity :19.775021196025975
 Time Taken : 3 ms

 The Missing number in the array :[1, 2, 3, 4, 5, 6, 7, 8, 9, 11] is 10
 For 10 size array it tooks 3 search to find the answer
 Complexity :23.02585092994046
 Time Taken : 2 ms

 The Missing number in the array :[1, 2, 4, 5] is 3
 For 4 size array it tooks 3 search to find the answer
 Complexity :5.545177444479562
 Time Taken : 3 ms

 The Missing number in the array :[1, 2, 3, 5, 6, 7, 8, 9, 10, 11, 12] is 4
 For 11 size array it tooks 4 search to find the answer
 Complexity :26.376848000782076
 Time Taken : 3 ms

 The Missing number in the array :[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14] is 13
 For 13 size array it tooks 4 search to find the answer
 Complexity :33.34434164699998
 Time Taken : 3 ms

Buy any thing from amazon through us !!!

Facebook comments