azizkhani.net

I know that I know nothing

proxy(forward proxy) vs reverse proxy

clock November 5, 2015 18:31 by author Administrator

A reverse proxy is mostly a server-side concept, and is usually used in the context of CDNs (content distribution networks) for caching static HTTP content. A forward proxy is usually a client side concept used for anonymity, to subvert censorship, and (back in the days of dial-up) as a web accelerator.



apache poi excel cell type

clock November 5, 2015 13:46 by author Administrator

i have an excel file that have 2 cell that value of them have this 

cell 1 : azizkhani

cell 2:007596819379

format of cells is string (text)

but when i  read cell value in apache poi cell type in cell 2 is numeric

i want to read string value of them

for solve this prolem will write this line before reading cell value;

 

cell.setCellType(Cell.CELL_TYPE_STRING);

 

return cell.getStringCellValue();

 



how to set redis key time out (spring session timeout) maxInactiveInterval

clock October 6, 2015 20:22 by author Administrator

 

when using spring session in a container when http session is time out session or key that store in redis dose not time out for solve this problem and set timeout or that config like this code 


<beanclass="org.springframework.session.data.redis.config.annotation.web.http.RedisHttpSessionConfiguration"p:maxInactiveIntervalInSeconds="180"/>



docker save vs export

clock September 9, 2015 10:48 by author Administrator

Export

is used to persist a container (not an image).container in A running instance of an image is called container.

docker export <CONTAINER ID> > /home/export.tar

for example docker export nginx >/azizkhani/nginx.tar

 

Save

is used to persist an image (not a container). So we need the image name which


docker save nginx > /azizkhani/nginx.tar



create nginx image from Dockerfile

clock September 8, 2015 22:25 by author Administrator

i want to create nginx docker image that i can manage nginx.config

for solve this problem i do it

create nginx.config that have this content: in /azizkhani/nginx

events {

  worker_connections  1024;

}

http {

  upstream sessionApp {

    server localhost:8082;

    server localhost:8081;

  }

  server {

    listen 80;

    location / {

      proxy_pass http://sessionApp;

    }

  }

create DockerFile(without extension) : in  /azizkhani/nginx

 

 

 

 

 

 

FROM nginx

RUN mkdir -p /etc/nginx

COPY nginx.conf /etc/nginx/nginx.conf

and run this command in docker terminal after 

cd /azizkhani/nginx

docker build -t myNginxImage

and after create image 

run this command to create container from myNginxImage

$ docker run --name container-nginx-name -d -p8080:80 myNginxImage

request localhost and nginx show proxy(localhost:8081)


 


change default tomcat port in maven tomcat using maven parameter

clock September 5, 2015 20:22 by author Administrator

i want to run one app in two port for test in spring-session and redis Cool :D

mvn tomcat:run -Dmaven.tomcat.port=8081



MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk

clock September 5, 2015 20:12 by author Administrator

 

after i run redis in docker and config my spring security and spring session when i login to application . i see that i can not login and get ths exception

org.springframework.dao.InvalidDataAccessApiUsageException: MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.;nested exception is redis.clients.jedis.exceptions.JedisDataException: MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error.

after search in intenet i know that i dont run redis in persist state and i run docker with this command

 docker run -d -p 6379:6379 -v /azizkhani/Java/pdf/redis --name redis_c_p redis



how to change default redis ip in spring boot

clock September 4, 2015 16:26 by author Administrator

i run redis in docker .my docker ip is 192.168.99.100 and redis port 32768

but my spring session default host & port is 127.0.0.1 and 6379 

for change redis port in docker i run container by " docker-compose up " command

using this file docker-compose.yml


redis:

  image: redis

  ports:

     - "6379:6379"

after run docker i can monitor to redis by this command
telnet 192.168.99.100 6379
and redis is ok


but after run spring session and redis i can not connect to them 
after search i know that how change default host in spring boot application.yml

spring:

  redis:

    host: 192.168.99.100



screenshot on mac

clock July 30, 2015 11:38 by author Administrator



change default tomcat webapp directory in maven tomcat 7 plugin

clock July 29, 2015 18:53 by author Administrator

<plugin>

    <groupId>org.apache.tomcat.maven</groupId>

    <artifactId>tomcat7-maven-plugin</artifactId>

    <version>2.0</version>

    <configuration>

        <warSourceDirectory>${basedir}/target/web</warSourceDirectory>

    </configuration>

</plugin>



About the author

 Welcome to this web site . This page has two purposes: Sharing information about my professional life such as articles, presentations, etc.
This website is also a place where I would like to share content I enjoy with the rest of the world. Feel free to take a look around, read my blog


Java,J2EE,Spring Framework,JQuery,

Hibernate,NoSql,Cloud,SOA,Rest WebService and Web Stack tech...

Month List

Sign In