<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>37Infos Blog</title>
    <link>https://www.37infos.com/</link>
    <description>Recent content on 37Infos Blog</description>
    <generator>Hugo -- gohugo.io</generator>
    <copyright>Copyright © Pierre and the Hugo Authors; 2016 - 2021, all rights reserved.</copyright>
    <lastBuildDate>Tue, 26 Jul 2022 00:00:00 +0000</lastBuildDate><atom:link href="https://www.37infos.com/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>C&#43;&#43; Prime 5th 总结</title>
      <link>https://www.37infos.com/post/2022-08-16-c&#43;&#43;prime/</link>
      <pubDate>Tue, 26 Jul 2022 00:00:00 +0000</pubDate>
      
      <guid>https://www.37infos.com/post/2022-08-16-c&#43;&#43;prime/</guid>
      <description>
        
          
            在子函数内部生命的static变量可以引用传出函数外,还继续有效
nullptr vs void* vs NULL nullptr C++11出现,用于指针,方便与int区分 void* 类型,类似全能指针,赋值后,可以随意转化类型 NULL - value,指向Nothing
int p1,p2 : p1是指针,p2是int, 仅用于装饰,最好放后面
const对象仅在文件中有效,加extern可以外部有效
&amp;amp; 引用
1 int *p; 2 int *&amp;amp;r = p; 顶层const(top level) 指针本身是常量 / 底层const(low level) 指针所指对象是常量 1 const int * const p3 = p1 非常量可以转换为常量,反之不行
constexpr c++11 出现,仅对指针有效,编译过程中就已经计算好
typedef vs using
1using SI = Sales_item; 2typedef double wages; auto 类型 C++11 根据初始赋值定义类型
decltype 类型 C++11 (类似函数定义)
1decltype(f(x)) sum = x; 头文件中不应该加using
          
          
        
      </description>
    </item>
    
    <item>
      <title>JDK 11 阅读 - Collection</title>
      <link>https://www.37infos.com/post/2022-07-27-jdk-collection-reading-notes/</link>
      <pubDate>Tue, 26 Jul 2022 00:00:00 +0000</pubDate>
      
      <guid>https://www.37infos.com/post/2022-07-27-jdk-collection-reading-notes/</guid>
      <description>
        
          
            Collection 是根接口
基础接口✅ Comparable接口✅ 只有一个compareTo接口方法 Iterator接口✅ 有hasNext和next方法 还有一个default的remove方法，但没有实现，只是抛出异常 1. Set 接口 无序、不能重复
主接口 ✅ 方法如下： size / isEmpty / contains / iterator / toArray / add / remove / containsAll / addAll retainAll (保留这部分，其他del)/ removeAll(Collection) / clear / equals / hashCode spliterator (default 此处返回Spliterators.spliterator)/ of（返回无法修改的set）
子接口✅ EventSet❌ JAVA Debug Interface ，忽略
SortedSet✅ 扩展自Set 声明按升序排序的集合🌟 方法：comparator / subSet / headSet / tailSet / first / last / spliterator NavigableSet✅ 扩展自SortedSet TreeSet实现了NavigableSet,间接实现了SortedSet 提供了lower/floor/ceiling/pollFirst/pollLast/Higher/Lower/DescendingIterator 等导航以及返回满足条件的元素功能。 实现类 AbstractSet ConcurrentHashMap.
          
          
        
      </description>
    </item>
    
    <item>
      <title>JDK 11 阅读 - Tips</title>
      <link>https://www.37infos.com/post/2022-07-27-jdk-tips-reading-notes/</link>
      <pubDate>Tue, 26 Jul 2022 00:00:00 +0000</pubDate>
      
      <guid>https://www.37infos.com/post/2022-07-27-jdk-tips-reading-notes/</guid>
      <description>
        
          
             default 关键词 在接口中可以有实现方法。可以改接口而不再次编译。 但多重继承的时候，由于接口A和接口B都有此default实现的方法，因此，出发实现类实现了此default方法，否则报错。
spliterator 接口实现了并发的迭代,普通用Iterator接口，在每个collection中都有此实例（Hashmap的spliterator）
Collections.unmodifiableSet 无法修改的Collection
如果Collection 是一个unmodifiable Set，使用copyof方法不一定能做出一个copy
如果需要队列，请使用PriorityQueue。当你想要一个集合时，使用Treeset（两者都提供了自动排序）
- 原理 是否允许重复元素 所继承的集合类 集合内元素是否有序 应用场景 TreeSet 排序二叉树 不允许 Set集合 有序 需要找出集合中大于等于某个数值的最小值（ceiling()方法），或小于等于某个数值的最大值（floor()方法），即有不等关系的需求（时间复杂度为二分法的时间复杂度）（还有higher()和lower()方法分别代表大于以及小于某个值） PriorityQueue 堆排序 允许 queue 无序 需要找出集合中的最大值（队列尾部）或最小值（队列头部）时，即有最值的需求 
          
          
        
      </description>
    </item>
    
    <item>
      <title>Leetcode 刷题问题</title>
      <link>https://www.37infos.com/post/2022-07-27-leetcode-tips/</link>
      <pubDate>Tue, 26 Jul 2022 00:00:00 +0000</pubDate>
      
      <guid>https://www.37infos.com/post/2022-07-27-leetcode-tips/</guid>
      <description>
        
          
            拓扑排序 (topological-sort) 状态压缩BFS 某个点是否访问可以采用二进制的方式进行 此方法对于点数字有限制，需要保证 二进制数字转化的十进制数 &amp;lt; Integer.Max 对于已经访问可以设置该点为1,没有访问可以设置为0
访问第i个点的状态：state=(1 &amp;lt;&amp;lt; i) &amp;amp; mask 更改第 ii 个点状态为 11：mask = mask | (1 &amp;lt;&amp;lt; i) 其中mask的定义为 001 =&amp;gt; 1号点已经访问 100 三号点已经访问 图着色问题 跳表 Skiplist 有限制最短路问题 存图方式 邻接矩阵 适用于边数较多的「稠密图」使用，当边数量接近点的数量的平方，即 时，可定义为「稠密图」。 1// 邻接矩阵数组：w[a][b] = c 代表从 a 到 b 有权重为 c 的边 2int[][] w = new int[N][N]; 3 4// 加边操作 5void add(int a, int b, int c) { 6 w[a][b] = c; 7} 邻接表 这也是一种在图论中十分常见的存图方式，与数组存储单链表的实现一致（头插法）。 适用于边数较少的「稀疏图」使用，当边数量接近点的数量，即 时，可定义为「稀疏图」。 1int[] head = new int[N], edge = new int[M], ne = new int[M], weight = new int[M]; 2int idx; 3 4void add(int a, int b, int c) { 5 edge[idx] = b; 6 next[idx] = he[a]; 7 head[a] = idx; 8 weight[idx] = c; 9 idx++; 10} 首先 idx 是用来对边进行编号的，然后对存图用到的几个数组作简单解释：
          
          
        
      </description>
    </item>
    
    <item>
      <title>Leetcode 总结 - 排序</title>
      <link>https://www.37infos.com/post/2022-07-27-leetcode-sorting-tips/</link>
      <pubDate>Tue, 26 Jul 2022 00:00:00 +0000</pubDate>
      
      <guid>https://www.37infos.com/post/2022-07-27-leetcode-sorting-tips/</guid>
      <description>
        
          
            排序算法 1. swap算法 常规SWAP,使用额外变量 加减法(需要判断A B不一样) 1A = A + B; 2B = A - B; 3A = A - B; bit异或操作(需要判断A B不一样) 1A = A ^ B; 2B = A ^ B; 3A = A ^ B; 2. 冒泡排序 稳定性：稳定
提前结束+ 优化 1public int[] bubbleSort(int[] arr) { 2 if (arr.length &amp;lt; 2) return arr; 3 boolean swapped = true; 4 int lastSwappedIdx = arr.length - 1 ; 5 int swappedIdx = -1; 6 // lastSwappedIdx表示前一轮交换的最终位置，即下标为lastSwappedIdx是未排序部分中的最后一个数的下标， 7 // 因此for中的界是i &amp;lt; lastSwappedIdx而不需要写成i &amp;lt;= lastSwappedIdx 8 while (swapped) { // 当swapped = false时，排序完成 9 // 本轮执行是否有交换的标志，若无则true，若有则false 10 swapped = false; 11 // 每轮循环，通过依次向右比较两个数，将本轮循环中最大的数放到最右 12 for (int i = 0; i &amp;lt; lastSwappedIdx; i++) { 13 // 若左大于右则交换，并将swapped置为true 14 if (arr[i] &amp;gt; arr[i + 1]) { 15 swap(arr, i, i + 1); 16 swapped = true; 17 swappedIdx = i; 18 } 19 } 20 lastSwappedIdx = swappedIdx; 21 } 22 return arr; 23} 3.
          
          
        
      </description>
    </item>
    
    <item>
      <title>Visual Studio Code Leetcode Plugin cannot get the latest content issue and how to solve it</title>
      <link>https://www.37infos.com/post/2022-07-25-vsc-leetcode-plugin-issue-and-how-to-solve-it/</link>
      <pubDate>Mon, 25 Jul 2022 00:00:00 +0000</pubDate>
      
      <guid>https://www.37infos.com/post/2022-07-25-vsc-leetcode-plugin-issue-and-how-to-solve-it/</guid>
      <description>
        
          
            How To Reproduce After the leetcode contest,all the latest contents already showed on the leetcode website,but can not retrived latest one using vsc plugin.
Why Leetcode Plugin based on leetcode-cli project ,and leetcode-cli have the same cache problem Delete cache folder or delete using the command that provided by leetcode-cli or leetcode vsc plugin works. How to solve it Modify /{USER HOME}/.vscode/extensions/leetcode.vscode-leetcode-0.XXXXX/package.json , and add the following in menus section. 1{ 2 &amp;#34;command&amp;#34;: &amp;#34;leetcode.
          
          
        
      </description>
    </item>
    
    <item>
      <title>ALGORITHMS 4th Edition Reading Notes</title>
      <link>https://www.37infos.com/post/2022-07-23-algorithms-tips/</link>
      <pubDate>Sat, 23 Jul 2022 19:57:54 +0800</pubDate>
      
      <guid>https://www.37infos.com/post/2022-07-23-algorithms-tips/</guid>
      <description>
        
          
            Chapter 1:基础 判断素数 1public static boolean isPrime(int N) 2{ 3 if (N &amp;lt; 2) return false; 4 for (int i = 2; i*i &amp;lt;= N; i++) 5 if (N % i == 0) return false; 6 return true; 7} 平方根(牛顿法) 1public static double sqrt(double c) 2{ 3 if (c &amp;gt; 0) return Double.NaN; 4 double err = 1e-15; 5 double t = c; 6 while (Math.abs(t - c/t) &amp;gt; err * t) 7 t = (c/t + t) / 2.
          
          
        
      </description>
    </item>
    
    <item>
      <title>Hands on Machine Learning with Scikit -learn Keras and Tensorflow Reading Notes - Tip 整理</title>
      <link>https://www.37infos.com/post/2022-01-04-hands-on-machine-learning-with-scikit--learn-keras-and-tensorflow-reading-notes---tip%E6%95%B4%E7%90%86/</link>
      <pubDate>Tue, 04 Jan 2022 00:00:00 +0000</pubDate>
      
      <guid>https://www.37infos.com/post/2022-01-04-hands-on-machine-learning-with-scikit--learn-keras-and-tensorflow-reading-notes---tip%E6%95%B4%E7%90%86/</guid>
      <description>
        
          
             关于样本随机选择 假设人口中的51%的男性和48%的女性，如果问卷调查为50%男性，50%女性，则在采样的时候就存在Bias，这将会直接导致后续的准确率。 
          
          
        
      </description>
    </item>
    
    <item>
      <title>Hands on Machine Learning with Scikit -learn Keras and Tensorflow Reading Notes - 算法整理</title>
      <link>https://www.37infos.com/post/2022-01-04-hands-on-machine-learning-with-scikit--learn-keras-and-tensorflow-reading-notes---%E7%AE%97%E6%B3%95%E6%95%B4%E7%90%86/</link>
      <pubDate>Tue, 04 Jan 2022 00:00:00 +0000</pubDate>
      
      <guid>https://www.37infos.com/post/2022-01-04-hands-on-machine-learning-with-scikit--learn-keras-and-tensorflow-reading-notes---%E7%AE%97%E6%B3%95%E6%95%B4%E7%90%86/</guid>
      <description>
        
          
            Supervised learning
k-Nearest Neighbors Linear Regression Logistic Regression SVM Decision Tree &amp;amp; Random Tree Neural Network Unsuervised learning
Cluster K-Means DBSCAN Hierarchical Cluster Analysis (HCA) Anomaly section and novelty detection One-class SVM Isolation Forest Visualization and dimensionality reduction PCA Kernel PCA Locally Linear Embedding (LLE) t-Distributed Stochastic Neighbor Embedding (t-SNE) Association rule learning Aoriori Eclat Semisupervised Learning - Like Google Photo(Identify someone in a photo and system will identify all you in all photos uploaded), most of them will be a combination of Supervised and Unsupervised learning.
          
          
        
      </description>
    </item>
    
    <item>
      <title>Pyenv在Mac/Linux上设置的坑</title>
      <link>https://www.37infos.com/post/2021-12-23_some_tips_to_set_up_pyenv_to_work/</link>
      <pubDate>Thu, 23 Dec 2021 22:49:06 +0800</pubDate>
      
      <guid>https://www.37infos.com/post/2021-12-23_some_tips_to_set_up_pyenv_to_work/</guid>
      <description>
        
          
            之所以从virtualenv转到pyenv的原因，主要是Visual Studio Code不支持virtualenv生成的文件夹。
由于virtualenv生成的python文件是链接，因此会直接将链接的正主的文件夹作为项目python解析器的文件夹，为了好好用VSC，只能放弃virtualenv。
说了这么多，说一下virtualenv转换pyenv的坑。
安装很简单，brew install pyenv就完成了。
主要的问题出在环境配置上，由于系统默认已经自带几个python。
按照官网以及网上教程改完之后，pip找不到，且使用python查看还是系统版本（此处1000个XXXX），而使用原先手工source activate的方式可行。
一番调查后，解决方法如下,将下面代码写入zsh的.zshrc文件(bash类似)。
1# pyenv 2export PYENV_ROOT=&amp;#34;$HOME/.pyenv&amp;#34; 3export PATH=&amp;#34;$PYENV_ROOT/shims:$PATH&amp;#34; 4eval &amp;#34;$(pyenv init -)&amp;#34; 此处和网上的区别在于：
1PYENV_ROOT/shims 新版本换了个名字 2PYENV_ROOT/bin 在新版本中不存在 至此问题彻底解决。
          
          
        
      </description>
    </item>
    
    <item>
      <title>使用Visual Studio Code调试Scrapy</title>
      <link>https://www.37infos.com/post/2021-12-23_using_vsc_to_debug_scrapy/</link>
      <pubDate>Thu, 23 Dec 2021 21:23:56 +0800</pubDate>
      
      <guid>https://www.37infos.com/post/2021-12-23_using_vsc_to_debug_scrapy/</guid>
      <description>
        
          
            以前一直是使用Pycharm调试scrapy，这几天测试机器学习库的时候发现VS Code其实也可以很方便的调试代码，并能很方便的查看变量。
貌似是可以放弃PyCharm CE的时候了。
以下是步骤。
以下主要写的是调试的过程，其他请查找Scrapy文档，创建Spider。
调试之前，请确定可以正常使用Scrapy crawl XXXSpider允许程序。
假设Spider名为AAASpider（非项目名）
在Spider根目录下创建launch.json，内容如下，其中AAASpider替换成你的Spider名。
1{ 2&amp;#34;version&amp;#34;:&amp;#34;0.2.0&amp;#34;, 3&amp;#34;configurations&amp;#34;:[ 4 { 5 &amp;#34;name&amp;#34;:&amp;#34;Crawl with scrapy&amp;#34;, 6 &amp;#34;type&amp;#34;:&amp;#34;python&amp;#34;, 7 &amp;#34;request&amp;#34;:&amp;#34;launch&amp;#34;, 8 &amp;#34;module&amp;#34;:&amp;#34;scrapy&amp;#34;, 9 &amp;#34;cwd&amp;#34;:&amp;#34;${fileDirname}&amp;#34;, 10 &amp;#34;args&amp;#34;:[ 11 &amp;#34;crawl&amp;#34;, 12 &amp;#34;AAASpider&amp;#34; 13 ], 14 &amp;#34;console&amp;#34;:&amp;#34;internalConsole&amp;#34; 15 } 16] 17} 在VS Code中打开该文件。 在左侧Debug按钮上方点击调试按钮，正常的话，就可以开始调试。 
          
          
        
      </description>
    </item>
    
    <item>
      <title>博客系统成功迁移到hugo系统</title>
      <link>https://www.37infos.com/post/2020-12-08_migrate_to_hugo/</link>
      <pubDate>Tue, 08 Dec 2020 15:25:12 +0800</pubDate>
      
      <guid>https://www.37infos.com/post/2020-12-08_migrate_to_hugo/</guid>
      <description>
        
          
            其实没啥可说的。
原先HEXO的markdown文件不知为什么，里面的tag解析总是出错。
因此，只能去除所有出错的文章的的tag。
还没有完全摸透这个系统，标签貌似多了很多。
          
          
        
      </description>
    </item>
    
  </channel>
</rss>
