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...

Facebook comments