软件开发备忘录

1 版本控制的使用

  1) 先更新代码再提交代码,提交代码时写注释

  2 )我使用过的的版本控制器  svn  git

  3 )

2 Freemarker 中map的访问方式

  

strMap的结构如下:

       List<String> list1 = new ArrayList<String>();
        list1.add("课程一");
        list1.add("课程二");
      
      
        List<String> list2 = new ArrayList<String>();
        list2.add("课程三");
        list2.add("课程四");
      
        Map<String, List<String>> strMap = new HashMap<String, List<String>>();
        strMap.put("语文", list1);
        strMap.put("数学", list2);

       root.put("strMap", strMap);

 

<html>
<head>
  <title>FreeMarker Example Web Application 1</title>
</head>
<body>
  ${message}

 <br> 
 
  <#if strMap??>
   <#list strMap ?keys as testKey>
     
      ${testKey}
     
      <#assign strList=strMap[testKey] >   
             <#list strList as item>  
                 ${item}  
             </#list>
          <br>
   </#list>
  </#if>
</body>

</html>

3 【编码规范】1 尽量保证一样的代码只存在一份,这样在维护中比较好维护。

这个问题也有可能是没有随时重构造成的。

4 在编写软件时,先完成初步功能,然后在慢慢修理,在修改过程中进行逐步的重构,而不是一开始就重构代码,

 重构代码并不是非得保证一样的代码只保存一份,有时候也需要根据后期的维护和扩展进行重构,在前台页面上如果是业务规则分歧比较大的,但是显示有可能大体一样的情况,应该分为2个页面进行显示,比如 修改和添加页面,有时候可以合并为一个页面,有时候我觉得分成两个页面比较好。

5  设置tomcat的内存和编码:

    set JAVA_OPTS=-Xms512m -Xmx512m -Dfile.encoding=gbk

6 不重启jetty的情况下 热运行web程序 

   配置环境:jdk1.7或更高的版本,jetty设置为1.8的版本。

  如图进行设置就可以了

  软件开发备忘录_第1张图片

 

  软件开发备忘录_第2张图片


如果是在运行时改变方法 参数或者新添加方法就不能进行热调试了



6 nginx配置备忘

 

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}

http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
    #                  '$status $body_bytes_sent "$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    client_max_body_size        100m;
    client_body_buffer_size     256k;
    client_header_timeout       10m;
    client_body_timeout         10m;
    send_timeout                10m;


    #gzip  on;
    upstream ksdfront_server{
	server 127.0.0.1:8110;
    }
    upstream ksdcms_server{
	server 127.0.0.1:8210;
    }
    upstream cas_server {
	server 127.0.0.1:8310;
    }
    server {
        listen       80;
        server_name  localhost;
	#optimize_server_names off;#优化服务器名称:关 (默认开启)
	server_name_in_redirect off;#服务器名称重定向:关(默认开启)

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

	root D:\kaoshidian_deploy\front\webapps;

	location ~^/ksdfront {
		proxy_set_header Host $host;
		proxy_set_header X-Forwarded-For $remote_addr;
		proxy_pass http://ksdfront_server;
	}		
	location ~^/cas {
		proxy_set_header Host $host;
		proxy_pass http://cas_server;
	}
	location ~^/ksdcms {
		proxy_set_header Host $host;
		proxy_pass http://ksdcms_server;
	}
	location / {
		root   html;
		index  index.html index.htm;
	}	
        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443;
    #    server_name  localhost;

    #    ssl                  on;
    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_timeout  5m;

    #    ssl_protocols  SSLv2 SSLv3 TLSv1;
    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers   on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

}


 

你可能感兴趣的:(软件开发备忘录)