August 24, 2017

Copying one POJO object to another without clone

/**
 * MainClass
 */
package com.belazy.dozer;

import org.dozer.DozerBeanMapper;

/**
 * @author nijesh
 *
 */
public class MainClass {

public static void main(String[] args) {
DozerBeanMapper mapper = new DozerBeanMapper();
Employee employee = new Employee("Sachin", "tendulkar", 45);
EmployeeNew employeeNew = mapper.map(employee, EmployeeNew.class);
System.out.println(employeeNew.getEmployeeFirstName());
}

}

/**
 *
 */
package com.belazy.dozer;

/**
 * @author nijesh
 *
 */
public class Employee {

private String employeeFirstName;
private String employeeLastName;
private int employeeAge;

public Employee(String employeeFirstName,String employeeLastName, int employeeAge ) {
// TODO Auto-generated constructor stub
this.employeeAge = employeeAge;
this.employeeLastName = employeeLastName;
this.employeeFirstName = employeeFirstName;
}
/**
* @return the employeeFirstName
*/
public String getEmployeeFirstName() {
return employeeFirstName;
}
/**
* @param employeeFirstName the employeeFirstName to set
*/
public void setEmployeeFirstName(String employeeFirstName) {
this.employeeFirstName = employeeFirstName;
}
/**
* @return the employeeLastName
*/
public String getEmployeeLastName() {
return employeeLastName;
}
/**
* @param employeeLastName the employeeLastName to set
*/
public void setEmployeeLastName(String employeeLastName) {
this.employeeLastName = employeeLastName;
}
/**
* @return the employeeAge
*/
public int getEmployeeAge() {
return employeeAge;
}
/**
* @param employeeAge the employeeAge to set
*/
public void setEmployeeAge(int employeeAge) {
this.employeeAge = employeeAge;
}



}




/**
 *
 */
package com.belazy.dozer;

/**
 * @author nijesh
 *
 */
public class EmployeeNew {
private String employeeFirstName;
private String employeeLastName;
private int employeeAge;

public EmployeeNew(String employeeFirstName,String employeeLastName, int employeeAge ) {
// TODO Auto-generated constructor stub
this.employeeAge = employeeAge;
this.employeeLastName = employeeLastName;
this.employeeFirstName = employeeFirstName;
}
/**
* @return the employeeFirstName
*/
public String getEmployeeFirstName() {
return employeeFirstName;
}
/**
* @param employeeFirstName the employeeFirstName to set
*/
public void setEmployeeFirstName(String employeeFirstName) {
this.employeeFirstName = employeeFirstName;
}
/**
* @return the employeeLastName
*/
public String getEmployeeLastName() {
return employeeLastName;
}
/**
* @param employeeLastName the employeeLastName to set
*/
public void setEmployeeLastName(String employeeLastName) {
this.employeeLastName = employeeLastName;
}
/**
* @return the employeeAge
*/
public int getEmployeeAge() {
return employeeAge;
}
/**
* @param employeeAge the employeeAge to set
*/
public void setEmployeeAge(int employeeAge) {
this.employeeAge = employeeAge;
}





}

Jar files needed

dozer-5.4.0.jar
logback-classic-0.9.jar
logback-core-0.9.6.jar
slf4j.jar
slf4j-log4j13-1.0.1.jar


errors
Failed to instantiate [ch.qos.logback.classic.LoggerContext]
Reported exception:
java.lang.NoSuchMethodError: ch.qos.logback.classic.util.ContextInitializer.<init>(Lch/qos/logback/classic/LoggerContext;)V
at org.slf4j.impl.StaticLoggerBinder.init(StaticLoggerBinder.java:85)
at org.slf4j.impl.StaticLoggerBinder.<clinit>(StaticLoggerBinder.java:56)
at org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:189)
at org.slf4j.LoggerFactory.bind(LoggerFactory.java:112)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:105)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:235)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:208)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:221)
at org.dozer.DozerBeanMapper.<clinit>(DozerBeanMapper.java:67)
at com.belazy.dozer.MainClass.main(MainClass.java:15)
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.dozer.stats.StatisticsManagerImpl.<init>(StatisticsManagerImpl.java:39)
at org.dozer.stats.GlobalStatistics.<init>(GlobalStatistics.java:29)
at org.dozer.stats.GlobalStatistics.<clinit>(GlobalStatistics.java:24)
at org.dozer.DozerBeanMapper.<clinit>(DozerBeanMapper.java:68)
at com.belazy.dozer.MainClass.main(MainClass.java:15)
Caused by: java.lang.SecurityException: class "org.slf4j.impl.MessageFormatter"'s signer information does not match signer information of other classes in the same package
at java.lang.ClassLoader.checkCerts(Unknown Source)
at java.lang.ClassLoader.preDefineClass(Unknown Source)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at ch.qos.logback.classic.spi.LoggingEvent.<init>(LoggingEvent.java:114)
at ch.qos.logback.classic.Logger.filterAndLog(Logger.java:421)
at ch.qos.logback.classic.Logger.filterAndLog(Logger.java:430)
at ch.qos.logback.classic.Logger.info(Logger.java:494)
at org.dozer.config.GlobalSettings.loadGlobalSettings(GlobalSettings.java:113)
at org.dozer.config.GlobalSettings.<init>(GlobalSettings.java:67)
at org.dozer.config.GlobalSettings.<clinit>(GlobalSettings.java:46)
... 5 more


http://javabelazy.blogspot.in/

August 15, 2017

Gzip compression working Spring MVC

GZIP compression

public static String gzipCompression(String strNew) throws IOException {
    if (strNew == null || strNew.length() == 0) {
        return str;
    }
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    GZIPOutputStream gzip = new GZIPOutputStream(out);
    gzip.write(str.getBytes());
    gzip.close();
    String outStr = out.toString("UTF-8");
    return outStr;
 }


Using BufferedWriter

public static String compressString(String str) throws IOException{
if (str == null || str.length() == 0) {
    return str;
}

BufferedWriter writer = null;

try{
    File file =  new File("your.gzip")
    GZIPOutputStream zip = new GZIPOutputStream(new FileOutputStream(file));

    writer = new BufferedWriter(new OutputStreamWriter(zip, "UTF-8"));

    writer.append(str);
}
finally{        
    if(writer != null){
     writer.close();
     }
  }
 }


Using compression filter

package : com.planetj.servlet.filter.compression
spring compression filter


How to enable HTTP response compression

Read 69.18

http://docs.spring.io/spring-boot/docs/1.3.x/reference/htmlsingle/#how-to-enable-http-response-compression

GZip compression in spring

http://www.oodlestechnologies.com/blogs/Gzip-Servlet-Filter-in-Spring-MVC

Handling filters in spring MVC

https://www.mkyong.com/spring-mvc/how-to-register-a-servlet-filter-in-spring-mvc/

Working with @controllerAdvice and ResponseAdvice in spring 4

https://sdqali.in/blog/2016/06/08/filtering-responses-in-spring-mvc/

Interceptors

Interceptors are use to manipulate entities like inputstream and outputstreams. There are two kinds of interceptors ReaderInterceptor and WriterInterceptors


public class GzipWriterInterceptor implements writerinterceptors {
@override
public void aroundwriteto(writerinterceptorcontext context){
outputstream os = context.getoutputstream();
context.setoutputstream(new Gzipoutputsream(os));
context.proceed();
}
}


Using ResponseWrapper

https://stackoverflow.com/questions/25020331/spring-mvc-how-to-modify-json-response-sent-from-controller

@Override
public void doFilter(ServletRequest request, ServletResponse response,
                     FilterChain chain) throws IOException, ServletException {

    ResponseWrapper responseWrapper = new ResponseWrapper((HttpServletResponse) response);

    chain.doFilter(request, responseWrapper);

    String responseContent = new String(responseWrapper.getDataStream());

    RestResponse fullResponse = new RestResponse(/*status*/, /*message*/,responseContent);

    byte[] responseToSend = restResponseBytes(fullResponse);

    response.getOutputStream().write(responseToSend);

}


using response body advice

https://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/servlet/mvc/method/annotation/ResponseBodyAdvice.html

@controllerAdvice +  implements ResponseBodyAdvice<Object>

https://mtyurt.net/2015/07/20/spring-modify-response-headers-after-processing/

@ControllerAdvice
public class HeaderModifierAdvice implements ResponseBodyAdvice<Object> {

    @Override
    public boolean supports(MethodParameter returnType, Class<? extends HttpMessageConverter<?>> converterType) {
        return true;
    }

    @Override
    public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType, Class<? extends HttpMessageConverter<?>> selectedConverterType, ServerHttpRequest request, ServerHttpResponse response) {
        response.getHeaders().add("dummy-header","dummy-value");
        return body;
    }
}


Rest Easy spring integration

http://www.concretepage.com/spring-4/spring-4-resteasy-3-jackson-json-integration-example-with-tomcat

August 01, 2017

How dependency Injection is achieved in Spring M V C

How dependency Injection is achieved in Spring M V C




Spring will search for two annotations @autowired and @component to do this job. Inversion of control is easily achievable in spring.

A sample program is given below

public class DependencyInjectionEx{

@Autowired
TestSerivceInf service;


@Test
public void TestFun(){
System.out.println(service.callService());

}

}


The Service class that implemented the interface

@Component
Class TestServiceImpl implements TestSerivceInf {

@Override
public String callService(){
    return "consumerfed liquor shop kozhikode";
}

}


The Interface

public interface TestSerivceInf {

    public String callService()

}

Then if more than two servcieimpl class implements an interface, then we need to specify to which class we are autowiring it, Then only springs component scan will works.

One way to create Object as same name as the class.

@Autowired
TestSerivceInf testServiceImpl ; will search for TestServiceImpl class

The second way is @qualifier(value = "className")

@Autowired
@qualifier(value = "TestServiceImpl")
TestSerivceInf testServiceImpl


if you think this tutorial is really helpful let us know.

June 10, 2017

Web Service Definition Language - WSDL tutorial

Working with Web Services in Java





Problems and Its Solutions


The Web service is already in use. Use a class customization to resolve this conflict

use -B-XautoNameResoulution while generating class from wsdl.
wsimport -keep -verbose -B-XautoNameResolution cfedStock.wsdl

http://javabelazy.blogspot.in/

May 14, 2017

Java Technical Question in bayt.com

Ross is an event organizer. He has received data regarding the participation of employees in two different events ( say event One and event Two ). Some employees have participated in only one event and others have participated in both events. Ross now needs to count the number of employees who have taken part in both events. The record received by Ross consist of employee ids, which are unique. Write a program that accepts the employee ids participating in each event ( the first line relates to the first event and the second line relates to the second event). The program should print the number of common employee ids in both the events.

Suppose the following input is given to the program, where each line represents a different event.

1001,1002,1003,1004,1005
1106,1008,1005,1003,1016,1017,1112

Now the common employee ids are 1003 and 1005 so the program should give the output as:2

java source code

import java.util.ArrayList;
import java.util.List;

/**
 * solutions for question one
 */

/**
 * @author shimjith consumerfed
 *
 */
public class EventOrganizer {

private List<Integer> eventOne = null;
private List<Integer> eventTwo = null;
private static int count = 0;

/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
EventOrganizer main = new EventOrganizer();
main.getEmployeeDetails();
main.showEmployeeDetails();
main.findEmployeeDetails();
System.out.println("The employee present in both events :"+EventOrganizer.count);

}

// to get employees present in both arrays
private void findEmployeeDetails() {
// TODO Auto-generated method stub
for (int row: eventOne){

if(eventTwo.contains(row)){
count = count +1;
}
}

}

private void showEmployeeDetails() {
// TODO Auto-generated method stub
System.out.println("Employee ids of event one "+eventOne);
System.out.println("Employee ids of event two "+eventTwo);
}

private void getEmployeeDetails() {
// You can use scanner class to get values to event one and two
eventOne = new ArrayList<Integer>();
eventTwo = new ArrayList<Integer>();
eventOne.add(1001);
eventOne.add(1002);
eventOne.add(1003);
eventOne.add(1004);
eventOne.add(1005);
eventTwo.add(1106);
eventTwo.add(1008);
eventTwo.add(1005);
eventTwo.add(1003);
eventTwo.add(1016);;
eventTwo.add(1017);
eventTwo.add(1112);

}

}


out put

May 13, 2017

Hadoop

http://javabelazy.blogspot.in/

May 02, 2017

'org.eclipse.jst.jee.server:your_apps_name' did not find a matching property error



'org.eclipse.jst.jee.server:your_apps_name' did not find a matching property error

These are not error , you just need to

check Publish module context on separate xml file

Option

after double clicking server

http://javabelazy.blogspot.in/

April 14, 2017

Employee Management System using spring MVC


Employee Management System using spring MVC

Description : The project is developed using Spring MVC 3 frameworks, JSP, Servlets, JQuery, JSTL, Ajax, JSON, FTL, HTML5  Mysql With Google Map integration. IDE used Eclipse Java EE IDE for Web Developers. Version: Indigo Service Release 2

stored procedures are used.











Branch Details


Working on the project




Daily attendance details

Attendance excel reports  sample report


contact me at 8281808029

http://javabelazy.blogspot.in/

April 03, 2017

MySql sample stored procedures

if else update insert stored procedure


DELIMITER $$

CREATE
    /*[DEFINER = { user | CURRENT_USER }]*/
    PROCEDURE `cfedapps`.`p_save_branch`(in branchId int(50),in branchCode int(5),in branchName varchar(55),in address varchar(55),in district varchar(33),in pincode bigint(10),in landline bigint(15),in startDate date,in lat long,in lon long, in branchStatus varchar(5), in branchDesc varchar(55),in userId int(4), in imgUrl varchar(55),in branchEmail varchar(55),in branchType int(5))
    /*LANGUAGE SQL
    | [NOT] DETERMINISTIC
    | { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }
    | SQL SECURITY { DEFINER | INVOKER }
    | COMMENT 'string'*/
    BEGIN
 
if (branchId is not null) then

update tbl_unit_details set firmCode = branchCode,unitName = branchName where unitId = branchId;

else

insert into tbl_unit_details (firmCode,unitName,address,district,pincode,landline,startedDate,unitLat,unitLon,status,description,userId,unitImg,branchEmailid,unittype) values (branchCode,branchName,address,district,pincode,landline,startDate,lat,lon,branchStatus,branchDesc,userId,imgUrl,branchEmail,branchType);
select last_insert_id();

end if;

    END$$

DELIMITER ;


Important notes


Setting default value of a column to CURRENT_TIMESTAMP while creating a database allows to update current date time in that field automatically

sample query
create table consumerfed (itsection varchar(32),createdDate TIMESTAMP DEFAULT CURRENT_TIMESTAMP);


Thanks

http://javabelazy.blogspot.in/

March 26, 2017

കൺസ്യൂമർഫെഡ് സെയിൽസ് - അറ്റന്റൻസ് - സബ്സിഡി ഡാഷ്‌ബോർഡ്

കൺസ്യൂമർഫെഡ് സെയിൽസ് - അറ്റന്റൻസ് - സബ്സിഡി ഡാഷ്‌ബോർഡ്




കൺസ്യൂമർഫെഡ് ഡാഷ്ബോർഡ് - കൺസ്യൂമർഫെഡ് കോഴിക്കോട് റീജിയൺ വേണ്ടി നിർമിച്ച സെയിൽസ് അറ്റന്റൻസ് ഹാർഡ്‌വെയർ മൈന്റനെൻസ് അപ്ലിക്കേഷൻ ന്റെ റിപ്പോർട്ട് കാണുവാൻ സഹായിക്കുന്നു . സെയിൽസ് മോണിറ്ററിങ് സിസ്റ്റം ആണ് ഇത് ഒരു ഇൻവെന്ററി സോഫ്റ്റ്‌വെയർ എല്ലാ !





 ഈ ഡാഷ്‌ബോർഡ്  കണ്ട്രോൾ ചെയുന്നത് ഒരു സ്പ്രെഡ്ഷീറ്റ് ആണ്. ഇതിൽ b 13 ൻറെ വാല്യൂ SBDY  എന്നാക്കിയാൽ റിപ്പോർട്ട് മെയിൽ ഇൽ സബ്‌സിഡി റിപ്പോർട്ട് കൂടി കാണിക്കും .

ഈ റിപ്പോർട്ട് വഴി കോൺസുമെർഫെഡ് കോഴിക്കോട് റീജിയണൽ ഓഫീസിന് ത്രിവേണി യൂണിറ്റ് ഉകൾ മോണിറ്റർ ചെയുനതിൽ ഉപരി റീജിയണൽ മാനേജറിന് 11 മണിക്ക് തന്നെ കോൺസുമെർഫെഡ് കോഴിക്കോട് റീജിയണിന്റെ ഒരു ഔട്‍ലിനെ ഇ മെയിൽ ആയി ലഭിക്കും.

കൺസ്യൂമർഫെഡ് കോഴിക്കോട് റീജിയന്ന് വേണ്ടി നിർമിച്ച സെയിൽസ് അക്കൗണ്ട്സ് അറ്റന്റൻസ് ഹാർഡ്‌വെയർ സ്പ്രെഡ്ഷീറ്റ് എന്നിവയിലെ റിപ്പോർട്ട് ഒരുമിച്ച് കാണാൻ ഈ റിപ്പോർട്ട് സഹായിക്കുന്നു .

ഡാഷ്‌ബോർഡ് സബ്സ്ക്രൈബ് ചെയുവാനുള്ള ലിങ്ക് 

നിങ്ങൾക്ക് ദിവസവും 11 മണിക്ക് ഡാഷ്‌ബോർഡ് കാണാൻ സാധിക്കും .


കൺസ്യൂമർഫെഡ് ഡാഷ്‌ബോർഡ് കണ്ട്രോൾ പാനൽ 







To show computer details in dashboard എന്നത് നോ ആക്കിയാൽ കമ്പ്യൂട്ടർ ഡീറ്റെയിൽസ് റിപ്പോർട്ട് ഇ മൈലിൽ കാണിക്കില്ല


കൺസ്യൂമർഫെഡ് അറ്റന്റൻസ് അപ്പസ്‌ , സെയിൽസ് അപ്പസ്‌ സെർവർ ഡൌൺ അന്നെങ്കിൽ ഈ നോട്ടിഫിക്കേഷൻ ലഭിക്കും




നിങ്ങളുടെ അഭിപ്രായങ്ങൾ ചുവടെ  അറിയുക്കുക



March 25, 2017

Loading and Unloading spreadsheet template for Triveni Godowns

Description

Created a loading and unloading template for Triveni Godown no 2 for godown incharge (+biju k). The apps was developed on march 2017. The application is deployed in consumerfed kozhikode regional office google drive. The same report can be viewed in regional office. The backup of application will be created 9th of month during midnight. The backup can be viewed by I T admin (+bithesh soubhagya) at regional office kozhikode. A pdf attached mail will be send weekly.

The particular has two options in the combo box " load and unload " and " advance payment ", choose the particular enter the advance paid, then enter the loading charge per day, balance will be automatically displayed on the top.

You can contact me at 8281808029

Screenshots





link to sheet





Please provide your comments/feedbacks

Thanks to +Biju k


http://javabelazy.blogspot.in/

March 07, 2017

sample web application using ajax jquery - spring mvc


sample web application


JSP page

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
<link href="css/branches.css" rel="stylesheet" type="text/css" media="screen" />
<script src="http://code.jquery.com/jquery-1.10.2.js" type="text/javascript"></script>
<script type="text/javascript" src="js/branches.js" ></script>
</head>
<body>
<h1>listing</h1>
<div id="branchListDiv">
</div>
</body>
</html>

css page(css/branches.css)

table{
    
    border: 1px solid black;
    
}

js page(js/branches.js)


$(document).ready(function() {
var branches = ["Regional Office", "tsm nadakkavu", "zonal office"];
                        $('#branchListDiv').html('<div class="branch"><table width="400" height="80"><tr><th>TRIVENI SUPER MARKET NADAPURAM</th></tr><tr><td>NEAR BUSSTAND</td><td>400sqft</td><td rowspan="3">img</td></tr><tr><td>NADAPURAM POST</td><td>3000rent</td></tr><tr><td>PH:2345698</td></tr></table></div>');
                });



http://javabelazy.blogspot.in/

February 15, 2017

Online attendance tracking system consumerfed administration

Online attendance tracking system consumerfed


Issues and solutions

Step 0 : Download the bat file here

Step 1 : check your internet connection

Step 2 : set Mozilla as your default browser


Open Mozilla firefox browser >> Go to tools (or Type Alt+T) >> click on Option >> click on Make default button

How it works - video




Consumerfed I T Section, Kozhikode



http://javabelazy.blogspot.in/

February 11, 2017

Find the top 3 words in a sentence


Java Programs





/**
 * @author +Java Script
 * Top 3 words from sentence
 */

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class SentenceWord {
public static void main(String[] args) {
Map<String,Integer> map = new HashMap();
Scanner sc = new Scanner(System.in);
String str = sc.nextLine();

for(String s: str.split("\\s")){
           if(map.containsKey(s)){
       int a =  map.get(s);
       a = a+1;
       map.put(s,a);
}else{map.put(s,1);}
}
System.out.println(map);
}}



http://javabelazy.blogspot.in/

February 09, 2017

Interceptors



Used to control a request
They are invoked by the controller (Filter Dispatcher)
Interceptors perform action such as
o Logging
o validation
o file upload
o double submit guard etc.

 How Interceptor works?
1. Request is generated by user and sent to Servlet container.
2. Servlet container invokes FilterDispatcher filter which in turn determines appropriate action.
3. One by one Intercetors are applied before calling the Action. Interceptors perform tasks such as Logging, Validation, File Upload, Double-submit guard etc.
4. Action is executed and the Result is generated by Action.
5. The output of Action is rendered in the view (JSP, Velocity, etc) and the result is returned to the user.

Explanation: -

1. Request is generated by user and sent to Servlet container http://localhost:8080/StrutsValidationEx/ - web.xml
2. Servlet container invokes FilterDispatcher filter which in turn determines appropriate action. Invoking filter Dispatcher (web.xml)

<filter>

<filter-name>Struts2</filter-name>

<filter-
class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>

</filter>

<filter-mapping>

<filter-name>Struts2</filter-name>

<url-pattern>/*</url-pattern>

</filter-mapping>


Determining Appropriate action (struts.xml) Welcome.jsp

index.jsp 

Configuring interceptor in struts: -
<interceptors>

<interceptor name="mylogging"

class="net.viralpatel.struts2.interceptor.MyLoggingInterceptor">

</interceptor>

<interceptor-stack name="loggingStack">



<interceptor-ref name="mylogging" />

<interceptor-ref name="defaultStack" />

</interceptor-stack>

</interceptors>



This code has to be added after <result-types > tag in <package>

</package>

Note that creation of interceptor stack with the name “logginstack” is to

make sure that struts2 calls all the default interceptors as well while calling

the custom interceptor mylogging.

This is important because the validation logic will not works in our

application if we ignore default stack of interceptor.



http://javabelazy.blogspot.in/

February 03, 2017

Online sales application for consumerfed kozhikode region

Online sales application for accounts section


Description



The application was initially developed for supporting the inventory system developed by I T section (head office). The project was assigned by Regional Manger through the I T, which then modified and new features are added as a requirement by pco kozhikode. The features like cash-credit report . subsidy monitoring, monthly sales, tranfer-in transfer out monitoring were include as per the requirement of accounts manager +deepa. The project was developed on may 2015 to validate sales details for Bee bee software developed by IT section consumerfed. The data were missing, double in the software at that time, so to analyse and solve the data issue the spreadsheet was very much helped them.

     This spreadsheet helps to validate the data in the software, help to fix the bugs related with data (includes sales, expense, r&d etc). Proper internet connection is mandatory to run the sheet. The spreadsheet will change daily so as to help the triveni units to enter their last day sales details, also the system automatically compute the reports needed for accounts section and email accounts manager. The branches under kozhikode region can also enter their monthly sales transaction / account details in the sheet.  The application automatically keep a backup in consfedkozhikode@gmail.com google drive folder named " Backup ". link to spreadsheet is given in the page.

To edit the template of the sales sheet use the controller sheet, I T admin can edit this. contact number : 8281808029

controller sheet

In addition to source code , my soul is also present in this project.  I worked so sincerely and honestly on this project. Each steps were challenging as there was an unsupported behavior from the regional manager as well as regional I T section once the project was deployed. They made me to stop running the project by defaming my work.

The below are the features in the apps.


Daily sales html report

Daily sales html report
sample download here


Daily sales pdf report


sample download here


Day wise subsidy report

Day wise subsidy report with packing charges details

For sending fund flow statement

Day wise cash credit sales

Monthly wages details

Wages details email
sample download here

Monthly expense, purchase, sales report


monthly expense, sales, purchase

sample download here

Messaging to unit

sending message to unit through google spreadsheet

Fast moving consumer goods to accounts section

FMCG report consumerfed

Online sales monitoring application

Online sales monitoring application

Daily sales google script code

Google script code for spreadsheet

Automatic Backup of spreadsheet

The application will automatically create a back up of the whole spreadsheet with monthly data entered by the user in office google drive folder named backup

Messaging to triveni units through spreadsheet

any one who can login to office mail can access the spreadsheet script editor, there by helps them to send message to triveni units, a pop up will show on the screen as shown in the screen shot

Admin can lock & unlock the spreadheet

Locking and unlocking the sheet prevents the user for entering the data, the task was initially assigned by Regional Manager


link to daily sales spreadsheet


Thanks to +deepajayaprakash payyanakkal

http://javabelazy.blogspot.in/

January 26, 2017

Budget preparation (monthly) consumerfed kozhikode region- accounts section

Budget Prepartion Kozhikode region conusmerfed







Thanks to +deepa (Account Manager) for her supports

contact me at 9539604142

http://javabelazy.blogspot.in/

January 03, 2017

Java Games with source code


Add caption



http://javabelazy.blogspot.in/

January 02, 2017

Traffic Light in java


Traffic Light program in java



Traffic light in java source code


package test;


import java.awt.*;
import javax.swing.*;
import java.awt.event.*;


public class TrafficLight extends JFrame implements ActionListener {
    JButton buttonRed, buttonYellow, buttonGreen;

      Signal green = new Signal(Color.green);
      Signal yellow = new Signal(Color.yellow);
      Signal red = new Signal(Color.red);

    public TrafficLight(){
        super("Java Traffic Light Program");
        getContentPane().setLayout(new GridLayout(2, 1));
        buttonRed = new JButton("Red");
        buttonYellow = new JButton("Yellow");
        buttonGreen = new JButton("Green");
        buttonRed.addActionListener(this);
        buttonYellow.addActionListener(this);
        buttonGreen.addActionListener(this);      

        green.turnOn(false);
        yellow.turnOn(false);
        red.turnOn(true);

        JPanel trafficPanel = new JPanel(new GridLayout(3,1));
        trafficPanel.add(red);
        trafficPanel.add(yellow);
        trafficPanel.add(green);
        JPanel lightPanel = new JPanel(new FlowLayout());
        lightPanel.add(buttonRed);
        lightPanel.add(buttonYellow);
        lightPanel.add(buttonGreen);

        getContentPane().add(trafficPanel);
        getContentPane().add(lightPanel);
        pack();
        }


    public static void main(String[] args){
        TrafficLight trafficLight = new TrafficLight();      
        trafficLight.setVisible(true);
    }  
    public void actionPerformed(ActionEvent e){      
        if (e.getSource() == buttonRed){
            green.turnOn(false);          
            yellow.turnOn(false);
            red.turnOn(true);
        } else if (e.getSource() == buttonYellow){
            yellow.turnOn(true);          
            green.turnOn(false);
            red.turnOn(false);
        } else if (e.getSource() == buttonGreen){
            red.turnOn(false);          
            yellow.turnOn(false);
            green.turnOn(true);
        }
    }
}  
class Signal extends JPanel{

    Color on;
    int radius = 40;
    int border = 10;
    boolean change;

    Signal(Color color){
        on = color;
        change = true;
    }

    public void turnOn(boolean a){
        change = a;
        repaint();      
    }

    public Dimension getPreferredSize(){
        int size = (radius+border)*2;
        return new Dimension( size, size );
    }

    public void paintComponent(Graphics graphics){
        graphics.setColor( Color.black );
        graphics.fillRect(0,0,getWidth(),getHeight());

        if (change){
            graphics.setColor( on );
        } else {
            graphics.setColor( on.darker().darker().darker() );
        }
        graphics.fillOval( border,border,2*radius,2*radius );
    }
}

http://javabelazy.blogspot.in/

January 01, 2017

Temple Management System

 


Billing and accounting software







Source code


http://javabelazy.blogspot.in/

Facebook comments