`
文章列表
  Write C code to implement the strstr (Search for a substring) function. Do not use any system library such as strlen. The strstr function locates a specified substring within a source string. Strstr returns a pointer to the first occurrence of the substring in the source. If the substring i ...
Given a binary tree where all the right nodes are either leaf nodes with a sibling (a left node that shares the same parent node) or empty, flip it upside down and turn it into a tree where the original right nodes turned into left leaf nodes. Return the new root. For example:Given a binary tree { ...
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascending order). The replacement must be in-place, do not allocate extra memo ...
打印一个数的所有乘数组合,从大到小,不能有重复。 Print all unique combinations of factors of a positive integer. For example, if the given number is 24 then the output should be: 12*2 8*3 6*4 6*2*2 4*3*2 3*2*2*2   public List<String> getFactorNumberCombinations(int n) { List<String> result = new ...
题目:已知随机函数rand(),以p的概率产生0,以1-p的概率产生1,现在要求设计一个新的随机函数newRand(), 使其以1/n的等概率产生1~n之间的任意一个数。解决思路:可以通过已知随机函数rand()产生等概率产生0和1的新随机函数Rand(),然后调用k(k为整数n的二进制表示的位数)次Rand()函数,得到一个长度为k的0和1序列,以此序列所形成的整数即为1--n之间的数字。注意:从产生序列得到的整数有可能大于n,如果大于n的话,则重新产生直至得到的整数不大于n。第一步:由rand()函数产生Rand()函数,Rand()函数等概率产生0和1。 [cpp]  ...
  基本原理:通过修改笔记本电脑键盘的驱动和相关注册表项来完成的。  实际操作:  修改键盘的驱动:通过“我的电脑”打开系统属性,选择硬件标签:打开设备管理器,我们发现中文Windows XP操作系统下,默认的键 ...
Rudix: The hassle-free way to get Unix programs on Mac OS X   http://code.google.com/p/rudix/downloads/list
mac默认不会加载~/.bashrc,所以要自己在/etc/profile文件中增加一下内容(root权限): if [ -f ~/.bashrc ] ; then. .bashrcfi加这么几行后,打开终端,就会自动加载~/.bashrc了
On Solaris /tmp is mounted swapfs and is it correct to put the eaccelerator files into /tmp/eaccelerator. You will have to remake the directory after a reboot.In linux tmpfs can be used in the same way, either on /tmp or elsewhere.See: http://www-128.ibm.com/developerworks/library/l-fs3.htmlMy update ...
在新主机的迁移过程中,最大的困难就是WP permalink rewrite的设置. 因为旧主机是用的Apache, 使用的是WP本身就可以更改的.htaccess,没有太大的难度.而这次在VPS上跑的是Nginx,主要是因为Nginx的速度比Apache要快很多. 但是另一方面就不是那么舒服了,因为Nginx的rewrite跟Apache不同,而且是在服务器上面才能更改. 下面是其间的一些研究笔记.(以下用例如无特别说明均摘自nginx wiki) 1 Nginx rewrite基本语法 Nginx的rewrite语法其实很简单.用到的指令无非是这几个
转自: http://www.61dh.com/blog/2009/01/ubuntu.html 参考: http://phosphorusandlime.blogspot.com/2008/05/ubuntu-command-line-email.html 我在一部冗余的笔记本电脑(Compaq Presario R3000, 显示屏坏了)上装了Ubuntu+Apache+PHP,平时主要用来调试代码。此外还有一个重要的用途:我在上面运行一些Cron Job, 用来更新网站开发日志的日志分类栏目。虽然每次运行结果都会被存在LOG文件里,但是有时Cron Job运行会出错,为了在第一时间里发 ...
转自: http://www.cnitblog.com/201/archive/2010/06/14/66744.html   由于各种原因,需要通过ssh登录linux或者unix主机,很多时候我们需要通过ssh的终端启动一 些服务或者运行一些程序,但是默认情况下,当我们关闭ssh终端连接,随之启动的程序也会关闭。原因是:SSH会话关闭时,ssh所关联的pty关闭,系 统会给这个pty所关联的session中的所有进程发送SIGHUP信号,SIGHUP的默认信号处理程序是终止进程,除非进程自己处理了 SIGHUP。 解决方法如下: 使用现成的命令nohup,可以让指定的程序在pt ...
From: http://alestic.com/2010/10/ec2-ssh-keys   Amazon recently launched the ability to upload your own ssh public key to EC2 so that it can be passed to new instances when they are launched. Prior to this you always had to use an ssh keypair that was generated by Amazon. The benefits of us ...
1、提升服务器的文件句柄打开打开 /etc/security/limits.conf : (增加) *    soft    nofile    51200 *    hard    nofile    51200 # vi /etc/security/limits.conf 加上* soft nofile 51200* hard nofile 51200 2、提升nginx的进程文件打开数 nginx.conf : worker_rlimit_nofile 51200; 3、修改php-fpm.conf文件,主要需要修改2处。
from http://www.lstk.net/index.php?id=23 When you running a highload website with PHP-FPM via FastCGI, the following tips may be useful to you : ) 1. Compile PHP’s modules as less as possible, the simple the best (fast); 2. Increas PHP FastCGI child number to 100 and even more. Sometime, 200 is OK! ...
Global site tag (gtag.js) - Google Analytics