leetCode-319. Bulb Switcher

There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every third bulb (turning on if it’s off or turning off if it’s on). For the ith round, you toggle every i bulb. For the nth round, you only toggle the last bulb. Find how many bulbs are on after n rounds.

Example:

Given n = 3. 
At first, the three bulbs are [off, off, off].
After first round, the three bulbs are [on, on, on].
After second round, the three bulbs are [on, off, on].
After third round, the three bulbs are [on, off, off]. 
So you should return 1, because there is only one bulb is on.

继续阅读“leetCode-319. Bulb Switcher”

Centos6挂载40T RAID磁盘

因为ext文件系统本身分区表的限制导致无法管理超过16T的文件系统,那么当超过16T时采用XFS文件系统就可以解决问题。

 

1.使用parted创建GPT分区

2.使用mkfs.xfs -f 命令格式化GPT为XFS文件系统

注意:Centos6如果没有mkfs.xfs命令,可以通过rpm安装。下面放下地址:

http://pkgs.org/centos-6/centos-x86_64/xfsprogs-3.1.1-4.el6.x86_64.rpm

http://pkgs.org/centos-6/centos-x86_64/xfsdump-3.0.4-4.el6_6.1.x86_64.rpm

下载上面的两个rpm并按顺序安装好就可以使用mkfs.xfs进行格式化了。

Composer安装时握手失败的解决

在win10中安装Composer出现如下错误:

 

Connection Error [ERR_CONNECTION]: Unable to connect to getcomposer.org Request tohttps://getcomposer.org/installer failed with errors: SSL: Handshake timed out. Failed to enable crypto. Failed to open stream: operation failed

 

解决方法:

在php.ini中修改


<span class="pln">curl</span><span class="pun">.</span><span class="pln">cainfo</span><span class="pun">=</span><span class="str">/path/</span><span class="pln">to</span><span class="pun">/</span><span class="pln">ssl</span><span class="pun">-</span><span class="pln">certs</span><span class="pun">/</span><span class="pln">ca</span><span class="pun">-</span><span class="pln">bundle</span><span class="pun">.</span><span class="pln">crt
openssl</span><span class="pun">.</span><span class="pln">cafile</span><span class="pun">=</span><span class="str">/path/</span><span class="pln">to</span><span class="pun">/</span><span class="pln">ssl</span><span class="pun">-</span><span class="pln">certs</span><span class="pun">/</span><span class="pln">ca</span><span class="pun">-</span><span class="pln">bundle</span><span class="pun">.</span><span class="pln">crt

</span>

<span class="pln">ca</span><span class="pun">-</span><span class="pln">bundle</span><span class="pun">.</span><span class="pln">crt的内容从下面链接获取:
https://curl.haxx.se/ca/cacert.pem
########################################################
将内容保存到</span>
<span class="pln">ca</span><span class="pun">-</span><span class="pln">bundle</span><span class="pun">.</span><span class="pln">crt</span>