Thursday, 2 June 2016

error: failed to push some refs to git

error: src refspec master does not match any.
error: failed to push some refs to 'https://github.com/userid/voice.git'

solution :
1. git add -A
2. git status
3. git commit -m "message"
3.git push origin HEAD:<remoteBranch>

Thursday, 26 May 2016

Functional style in java.

Functional style in java.

Function<T,R> function = new  Function<T,R>();
Type Parameters:
T - the type of the input to the function
R - the type of the result of the function

Ref : Oracle

ex :
It is the explicit intent to make it more convenient to program in a functional style in Java. Now, in mathematics, a function is generally written like

f: A -> B
(i.e., a function from As to Bs). This corresponds also to the notation in functional languages, Scala and already existing functional libraries for Java.

Ref : Stackoverflow 

Tuesday, 24 May 2016

WARN (SqlExceptionHelper.java:233) - Unknown column 'xxx' in 'field list'

 WARN  (SqlExceptionHelper.java:233) - Unknown column 'EditedOn' in 'field list'

Solution :
1) In hibernate check the entity class.
2) In table check the column names.
3) Compare both the entity and column name.
4.Caused due to spelling mistake.

Saturday, 21 May 2016

scope of public,private,protected in java for class method

public : method which are public there scope is available to child and which ever class wants to use it.
protected : scope visible only in child package
private :  scope visible only in class. 

Difference between pathparam and QueryParam in Rest.

Difference between pathparam and QueryParam in Rest.

Pathparam : used get the part of the string from URL.
ex:  @Pathparam("id")
ex : http://localhost:8080/voice{id}

QueryParam  : using this we are able to access the key,value after from URL after "?"
ex:  @QueryParam("id")
ex : http://localhost:8080/voice?id=1009

Log file in tomcat.


1) catalina.log -- logs all the  log at the time of server start
2) localhost_access_log : logs all the request type and URI
ex :
a) 0:0:0:0:0:0:0:1 - - [21/May/2016:11:21:52 +0530] "GET /voice/p1x/network HTTP/1.1" 200 -
3) server.log : logs "ContainerBackgroundProcessor" info and error stack.
4) error.log : logs all the error stack
5) hostmamager.log :
6) manager.log : logs info about HTMLManager,manager,
ex : INFO: HTMLManager: init: Associated with Deployer 'Catalina:type=Deployer,host=localhost'
ex : INFO: HTMLManager: init: Global resources are available
ex : INFO: HTMLManager: list: Listing contexts for virtual host 'localhost'

Friday, 20 May 2016

what is purpose of calling chain.doFilter() in servlet


what is purpose of calling chain.doFilter() in servlet
chain.doFilter(request, response);

The name chain suggests that you have a sequence of filters, with each filter doing some processing and then passing on to the next in sequence, so each object has a chain member to point to the next filter in the sequence, which gets called after the filter has performed its own processing. The last in the sequence will then probably have null as the chain value, or it knows on its own that it is the last one in the sequence.

Ref : stackoverflow
author JK

public void doFilter(ServletRequest req, ServletResponse res,
FilterChain chain) throws IOException, ServletException {
...

chain.doFilter(request, response);
}

after executing the method  on calling chain.doFilter() it will call filter present in web.xml in the order of defination.


<filter>
  <filter-name>VoiceLoginFilter</filter-name>
  <filter-class>com.voice.filters.VoiceLoginFilter</filter-class>
</filter>
<filter-mapping>
  <filter-name>VoiceLoginFilter</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>