<?xml version="1.0" encoding="utf-8" ?><rss version="2.0"><channel><title><![CDATA[code_while的博客]]></title><description><![CDATA[]]></description><link>https://blog.youkuaiyun.com/code_while</link><language>zh-cn</language><generator>https://blog.youkuaiyun.com/</generator><copyright><![CDATA[Copyright &copy; code_while]]></copyright><item><title><![CDATA[Java下得到ArrayList<String>占用内存大小的方法]]></title><link>https://blog.youkuaiyun.com/code_while/article/details/102463928</link><guid>https://blog.youkuaiyun.com/code_while/article/details/102463928</guid><author>code_while</author><pubDate>Thu, 30 Apr 2020 00:41:09 +0800</pubDate><description><![CDATA[刚需：压测时需要占用较大的内存，但使用ArrayList&lt;String&gt;时，无法获得每次调用占用的内存大小.

问题：Java中List的实际申请长度并不是size()取到的长度，而且，每次String申请的内存地址空间和主机有关，诸多因素导致计算估值并不是很准确

参考方案如下

代码


Runtime r = Runtime.getRuntime();
long startRAM...]]></description><category></category></item><item><title><![CDATA[基于消费者生产者模型，使用线程池控制发送HTTP请求的定时器]]></title><link>https://blog.youkuaiyun.com/code_while/article/details/105852167</link><guid>https://blog.youkuaiyun.com/code_while/article/details/105852167</guid><author>code_while</author><pubDate>Thu, 30 Apr 2020 00:33:50 +0800</pubDate><description><![CDATA[摘要：

   在业务中遇到了一种场景，在对于被请求方难以被优化的情况下，尝试通过在发送端通过线程池控制允许同时发送请求的数量，以降低直接请求服务端的压力，也要考虑请求发送失败时的重试机制；同时，需要每一次请求后的数据的集合，进行数据库的批量查询，因此使用多线程中的经典的消费者生产者模型进行控制变量，等待所有请求处理完毕后，再统一进行操作。

上干货

   先来看线程池的声明，因为...]]></description><category></category></item><item><title><![CDATA[jdbcTemplate使用变量名的方式替换SQL，实现批量查询和模糊查询]]></title><link>https://blog.youkuaiyun.com/code_while/article/details/105851438</link><guid>https://blog.youkuaiyun.com/code_while/article/details/105851438</guid><author>code_while</author><pubDate>Wed, 29 Apr 2020 23:44:26 +0800</pubDate><description><![CDATA[在项目中遇到了一种优化场景，既需要条件查询、批量查询，又需要判断进行模糊查询，同时，在某种特殊场景下，会查询大量的数据，在不使用缓存的前提下，针对操作数据库的层级，进行了优化，同时只返回固定数据，减轻数据库的I/O负担。代码如下：

   特别说明：考虑过使用jdbcTemplate拼接SQL后的查询效率和使用Mybatis的方式进行比较，但个人比较喜欢jdbcTempla...]]></description><category></category></item><item><title><![CDATA[expected single matching bean but found 2: onedbJdbcTemplate,twodbJdbcTemplate]]></title><link>https://blog.youkuaiyun.com/code_while/article/details/99956377</link><guid>https://blog.youkuaiyun.com/code_while/article/details/99956377</guid><author>code_while</author><pubDate>Wed, 21 Aug 2019 13:54:07 +0800</pubDate><description><![CDATA[异常问题，如题，详细见下


Error creating bean with name 'monitorDao': 
Injection of autowired dependencies failed;
 nested exception is org.springframework.beans.factory.BeanCreationException: 
 Could not autowi...]]></description><category></category></item><item><title><![CDATA[已知一棵树的先序遍历和中序遍历，获取其后序遍历]]></title><link>https://blog.youkuaiyun.com/code_while/article/details/95597652</link><guid>https://blog.youkuaiyun.com/code_while/article/details/95597652</guid><author>code_while</author><pubDate>Fri, 12 Jul 2019 10:50:15 +0800</pubDate><description><![CDATA[public class Test {
	
	public class Tree{
		public String data;
		public Tree left;
		public Tree right;
	}
	
	public Tree buildTree(String a,String b)
	{
		Tree root = new Tree();
		int apos = 0;
		...]]></description><category></category></item><item><title><![CDATA[VMware创建Centos7设置网卡下载docker]]></title><link>https://blog.youkuaiyun.com/code_while/article/details/85107255</link><guid>https://blog.youkuaiyun.com/code_while/article/details/85107255</guid><author>code_while</author><pubDate>Wed, 19 Dec 2018 20:33:23 +0800</pubDate><description><![CDATA[     搭建Centos7

     Cenos7创建时需要注意选择语言为美式英语，时区选择为亚洲上海。其余皆可默认。

     设置网卡

     1.查看VMware菜单栏中编辑选项中的“虚拟网络编辑器”

     可以查看子网IP和子网掩码如下

     

    点击“NAT设置”，查看网关（GATEWAY）信息如下，记录。

    

    2.进入/etc/sysco...]]></description><category></category></item><item><title><![CDATA[JQuery获取Select中option中的值，并由a标签传值]]></title><link>https://blog.youkuaiyun.com/code_while/article/details/80957244</link><guid>https://blog.youkuaiyun.com/code_while/article/details/80957244</guid><author>code_while</author><pubDate>Thu, 13 Dec 2018 19:08:47 +0800</pubDate><description><![CDATA[    过程坎坷，直接肝代码

    我需要用jstl从后台服务器上获取得到的数据ArrayList&amp;lt;String&amp;gt;，即此处的singleSize，利用forEach循环通过select输出，但一直苦于没有什么好方法可以获取到option中的值还得是通过a标签传递到后台。


&amp;lt;select id=&quot;select&quot;&amp;gt;
	&amp;lt;c:forEach items=&quot;${lis...]]></description><category></category></item><item><title><![CDATA[学习使用eclipse通过git创建新分支并上传代码及修改branch]]></title><link>https://blog.youkuaiyun.com/code_while/article/details/84025288</link><guid>https://blog.youkuaiyun.com/code_while/article/details/84025288</guid><author>code_while</author><pubDate>Tue, 13 Nov 2018 11:17:54 +0800</pubDate><description><![CDATA[git中的命令总结

git commit ：是将本地修改过的文件提交到本地库中
git push ：是将本地库中的最新信息发送到远程库中
git pull ：是从远程获取最新版本到本地，并自动merge
git fetch ：是从远程获取最新版本到本地，但不会自动merge
git merge ：是用于从制定的commit(s)合并到当前分支，用来合并两个分支
其中，git pull相当于g...]]></description><category></category></item><item><title><![CDATA[mybatis报错：Parameter 'xxx' not found.]]></title><link>https://blog.youkuaiyun.com/code_while/article/details/83899827</link><guid>https://blog.youkuaiyun.com/code_while/article/details/83899827</guid><author>code_while</author><pubDate>Fri, 09 Nov 2018 16:39:01 +0800</pubDate><description><![CDATA[手动编写mybatis的SQL代码时，如果只在mapper中编写SQL语句，则会报如题错误。

mapper中的


&amp;lt;select id=&quot;findBetweenTS&quot; resultMap=&quot;BaseResultMap&quot;&amp;gt;
    SELECT t.* FROM push_message t WHERE
    t.ts &amp;gt;= #{start} AND #{end} &amp;gt;=...]]></description><category></category></item><item><title><![CDATA[自JDK1.8之后，String拼接字符串的底层原理]]></title><link>https://blog.youkuaiyun.com/code_while/article/details/82991231</link><guid>https://blog.youkuaiyun.com/code_while/article/details/82991231</guid><author>code_while</author><pubDate>Wed, 10 Oct 2018 08:18:05 +0800</pubDate><description><![CDATA[以下内容皆是基于JDK1.8之后的版本进行的讨论和验证，并且使用javap -v指令显示底层的汇编指令从而查看真实过程：

    String进行字符串拼接：

上代码

    测试样例：


class Main{
	public static void main(String[] args){
		String a=&quot;asd&quot;;
		a=a+&quot;bd&quot;;
	}
}

    调用javap指...]]></description><category></category></item><item><title><![CDATA[SSM框架（SpringMVC+spring+mybatis）原理]]></title><link>https://blog.youkuaiyun.com/code_while/article/details/82933593</link><guid>https://blog.youkuaiyun.com/code_while/article/details/82933593</guid><author>code_while</author><pubDate>Wed, 03 Oct 2018 20:13:47 +0800</pubDate><description><![CDATA[
	SpringMVC框架

	在用户发起请求之后，DispatchServlet将截获请求并解析URL，即，去掉协议名、域名、端口号和项目名，获取其他字符串，如对于请求地址http:///127.0.0.1:8080/project/student/getStudent来说，即为获取student/getStudent。
		将解析出来的URL作为key值，到handleMapping中查找所有...]]></description><category></category></item><item><title><![CDATA[C++编程socket编程用recv函数接收，返回值为0解决方案]]></title><link>https://blog.youkuaiyun.com/code_while/article/details/82656336</link><guid>https://blog.youkuaiyun.com/code_while/article/details/82656336</guid><author>code_while</author><pubDate>Wed, 12 Sep 2018 09:52:22 +0800</pubDate><description><![CDATA[        先讲下背景，我需要写一个客户端，用winsock发送请求到服务器，服务器用tomcat写的，通过responseBody返回字符串作为发还给客户端的数据。

错误表现为：

        在用Visual Studio2017调试的时候，在Debug模式下，是没有任何问题的，而在Release模式下，则报错。

        错误代码如下：


    char buffer[...]]></description><category></category></item><item><title><![CDATA[Java在不同系统中的回车换行]]></title><link>https://blog.youkuaiyun.com/code_while/article/details/82108000</link><guid>https://blog.youkuaiyun.com/code_while/article/details/82108000</guid><author>code_while</author><pubDate>Mon, 27 Aug 2018 10:11:13 +0800</pubDate><description><![CDATA[被坑过，特别记录

首先，要明确回车（carriage return）：\r，换行（line feed）：\n，

Windows系统：\r\n，

unix/Linx系统：\n，

Mac系统：\r

我们可以看Windows下的示例：


package test01;

/**
 * Java输出测试
 * @author yanhan
 *
 */

public class Scanne...]]></description><category></category></item><item><title><![CDATA[Communications link failure及导致此原因的Permission denied: connect]]></title><link>https://blog.youkuaiyun.com/code_while/article/details/81605262</link><guid>https://blog.youkuaiyun.com/code_while/article/details/81605262</guid><author>code_while</author><pubDate>Sun, 12 Aug 2018 12:17:56 +0800</pubDate><description><![CDATA[起因：昨天编写的好好的程序，今天突然连不上MySQL数据库了，尤其是在使用mybatis-generator-core的逆向工程的生成工具时，完全不能成功。

提示信息没有保存好，大致意思如标题所示

借鉴博客1：https://blog.youkuaiyun.com/qq_19598855/article/details/45440157

借鉴博客2：https://blog.youkuaiyun.com/gsyin...]]></description><category></category></item><item><title><![CDATA[Result Maps collection already contains value for com.javaedu.dao.BrandMapper.BaseResultMap错误解决方案]]></title><link>https://blog.youkuaiyun.com/code_while/article/details/81535854</link><guid>https://blog.youkuaiyun.com/code_while/article/details/81535854</guid><author>code_while</author><pubDate>Thu, 09 Aug 2018 14:24:15 +0800</pubDate><description><![CDATA[
11:30:05.908 [main] ERROR o.m.spring.mapper.MapperFactoryBean - Error while adding the mapper 'interface com.javaedu.dao.BrandMapper' to configuration.
org.apache.ibatis.builder.BuilderException: Err...]]></description><category></category></item><item><title><![CDATA[小白学python（4）之面向对象思想]]></title><link>https://blog.youkuaiyun.com/code_while/article/details/81462319</link><guid>https://blog.youkuaiyun.com/code_while/article/details/81462319</guid><author>code_while</author><pubDate>Mon, 06 Aug 2018 22:21:09 +0800</pubDate><description><![CDATA[    Python是一门面向对象（OOP）的语言，其中，Python将所有数据、或元素、或变量统统都视为一个对象。

    Python中类的实现方法示例如下：


class Person:
    def __init__(self,name,sex,age=0):
        self.__name=name
        self.__sex=sex
        self._...]]></description><category></category></item><item><title><![CDATA[小白学python（3）之条件判断和算符]]></title><link>https://blog.youkuaiyun.com/code_while/article/details/81387679</link><guid>https://blog.youkuaiyun.com/code_while/article/details/81387679</guid><author>code_while</author><pubDate>Fri, 03 Aug 2018 15:34:50 +0800</pubDate><description><![CDATA[一、产生随机数字

引用包random


import random
random.random() #0.17545038208999364
random.random() #0.023681335981880824
random.randint(1,100) #45
random.randint(1,100) #11
random.randrange(1,100) #91
random.ra...]]></description><category></category></item><item><title><![CDATA[小白学python（2）之常见的Python函数]]></title><link>https://blog.youkuaiyun.com/code_while/article/details/81386914</link><guid>https://blog.youkuaiyun.com/code_while/article/details/81386914</guid><author>code_while</author><pubDate>Fri, 03 Aug 2018 14:51:57 +0800</pubDate><description><![CDATA[函数
			描述
		abs(x)
			返回x的绝对值
		max(x1,x2,..)
			返回数列中的最大值
		min(x1,x2,....)
			返回数列中的最小值
		pow(a,b)
			返回a的b次方的值，类似a**b
		round(x)
			返回与x的值最接近的整数，如果x与两个整数接近程度相同，则返回偶数值
		round(x,n)
			同round(x)，只不过会保...]]></description><category></category></item><item><title><![CDATA[xgboost下载失败解决方案]]></title><link>https://blog.youkuaiyun.com/code_while/article/details/80371622</link><guid>https://blog.youkuaiyun.com/code_while/article/details/80371622</guid><author>code_while</author><pubDate>Sat, 19 May 2018 09:32:39 +0800</pubDate><description><![CDATA[xgboost-0.71-cpxx-cpxxm-win_amd64.whlis not a supported wheel on this platform.当你需要这个比较玄学的xgboost包的时候，但是老是下载失败，一定烦爆炸了。在此，非常感谢这两篇博客的帮助https://blog.youkuaiyun.com/MrLevo520/article/details/53141692https://blo...]]></description><category></category></item><item><title><![CDATA[Python中import, from...import,import...as的区别]]></title><link>https://blog.youkuaiyun.com/code_while/article/details/80324079</link><guid>https://blog.youkuaiyun.com/code_while/article/details/80324079</guid><author>code_while</author><pubDate>Tue, 15 May 2018 15:53:11 +0800</pubDate><description><![CDATA[https://blog.youkuaiyun.com/colourful_sky/article/details/76114508]]></description><category></category></item></channel></rss>