龙鸟----龙腾九宵,鸟瞰天下

搜索,云计算,海量存储......

文章图片

一、第三方创业投资服务平台

1、科技及投资类媒体(原创类文章为主)

36氪,http://www.36kr.com/

银海网,http://www.inhai.com/ 

Tech2ipo,http://tech2ipo.com

动点科技Technode,http://www.technode.com/

爱范儿,http://www.ifanr.com/

雷锋网,http://leiphone.com

Web20share天涯海阁,http://www.web20share.com/

创业邦,http://www.cyzone.cn/

创业家,http://www.chuangyejia.com/

爱黑马,http://www.iheima.com/

Showeb20分享网络2.0,http://www.showeb20.com/

透明体TMT,http://toumingti.com/

Internet2share,http://www.internet2share.com

PingEast(英文博

你可以按照以下简单的五步来重置MySQL数据库服务器密码。第一步,停止MySQL服务器。第二步,使用–skip-grant-tables选择启动mysqld进程以便解除要求密码登录提示。第三步,以root用户连接mysql服务器。第四步,设置一个新的mysql root用户密码。第五步,退出并重启mysql服务器。以下给出每步的具体命令。

1、停止mysql服务

/etc/init.d/mysql stop

输出:

Stopping MySQL database server: mysqld.

2、设置忽略密码启动mysql服务器

mysqld_safe --skip-grant-tables &

输出:

[1] 5988

Starting mysqld daemon with databases from /var/lib/mysql

mysqld_safe[6025]: started

3、使用mysql客户端连接mysql服务器

mysql -u root

输出:

Welcome to the MySQL monitor. Commands end with ; or g.

Your MySQL connection id is 1 to server version: 4.1.15-Debian_1-log

Type ‘help;’ or ‘h’ for help. Type ‘c’ to clear the buffer.

mysql>

4、设置一个新的mysql root用户密码

mysql> use mysql;

mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';

mysql> flush privileges;

mysql> quit

5、停止mysql服务器

/etc/init.d/mysql stop

输出:

Stopping MySQL database server: mysqld

STOPPING server from pid file /var/run/mysqld/mysqld.pid

mysqld_safe[6186]: ended

[1]+ Done mysqld_safe –skip-grant-tables

6、启动mysql服务器并测试

/etc/init.d/mysql start

mysql -u root -p

Could not read symbols:Linux/UNIX系统下编译时,常见的一类报错信息。

  通常情况下,该编译报错信息之前会给出出现错误的静态库(.a结尾文件)、或动态库(.so结尾文件),

  该报错的基本原因是当前编译器无法对库文件进行正确的解析

Could not read symbols报错类型

  具体的报错信息会在Could not read symbols:字段后给出,常见的一些报警信息形如:

  /usr/lib/libdemo.so: could not read symbols: File in wrong format

  /usr/lib/libz.a: Could not read symbols: Bad value

  /usr/lib/libcode.a: Could not read symbols:Invalid operation

  /usr/lib/htmlparse.a: could not read symbols: Archive has no index; run ranlib to add one

  /usr/lib/htmlparse.a: could not read symbols: Malformed archive

  Linux出现Could not read symbols报警主要原因为当前编译环境和库文件生成时对应的环境不同,由于Linux本身编译选项非常复杂,可以从以下几个方面逐步排查:

Could not read symbols原因和解决方案

  1、 gcc/g++版本不正确

  众所周知Linux gcc编译器(GNU Compiler Collection)是功能强大的交叉编译器,但其众多的版本会导致兼容问题。如果联编所使用的 .a/.so文件是由另一个不同版本的gcc编译生成后,当移植到另一个不同版本gcc环境下编译时,(例如:将gcc2.9x老版本下的.so,拷贝入新版gcc环境

1、 yum安装环境

apache php 都是用Yum安装

# yum install httpd php php-cli

保证php有php-cgi,因为suphp需要php的执行模式为cgi/fastcgi

[www.inhai.com:/root]#php -v

PHP 5.2.6 (cli) (built: May  5 2008 10:32:59)

Copyright (c) 1997-2008 The PHP Group

Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies

[www.inhai.com:/root]#php-cgi -v

PHP 5.2.6 (cgi-fcgi) (built: May  5 2008 10:29:53)

Copyright (c) 1997-2008 The PHP Group

Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies

Suphp安装

# wget http://www.suphp.org/download/suphp-0.7.1.tar.gz

# tar zvxf suphp-0.7.1.tar.gz

# cd suphp-0.7.1

Suphp的编译参数有2种 主要是setid-mode的区别

1、测试模式,没有任何安全所言

# ./configure --prefix=/usr/local/suphp \

--sysconfdir=/usr/local/suphp/etc \

--with-apache-user=apache \

--with-setid-mode=owner \

--with-apxs=/usr/sbin/apxs \

--with-apr=/usr/bin/apr-1-config

2、生产模式使用下面的配置

# ./configure --prefix=/usr/local/suphp \

--sysconfdir=/usr/local/suphp/etc \

--with-apache-user=apache \

--with-setid-mode=paranoid \

--with-apxs=/usr/sbin/apxs \

--with-apr=/usr/bin/apr-1-config

具体2者的区别 将在后面apache配置那里说明

# make

# make install

# mkdir /usr/local/suphp/etc

# cp doc/suphp.conf-example /usr/local/suphp/etc/suphp.conf

如果装不上,提示缺少apr、apr-util、apxs等文件,可以执行

yum -y in

Cassandra、MongoDB、CouchDB、Redis、Riak、HBase比较

本文有标题党之嫌。在NoSQL如日中天的今天,各种NoSQL产品可谓百花齐放,但每一个产品都有自己的特点,有长处也有不适合的场景。本文对Cassandra,Mongodb,CouchDB,Redis,Riak以及 HBase 进行了多方面的特点分析,希望看完此文的您能够对这些NoSQL产品的特性有所了解。

CouchDB

Written in:Erlang

Main point:DB consistency,  ease of use

License:Apache

Protocol:HTTP/REST

Bi-directional (!)  replication,

continuous or  ad-hoc,

with conflict  detection,

thus, master-master  replication. (!)

MVCC – write operations  do not block reads

Previous versions  of documents are available

Crash-only  (reliable) design

Needs compacting  from time to time

Views: embedded  map/reduce

Formatting views:  lists & shows

Server-side  document validation 

(本文是写给职场老人的,对新人可能借鉴意义不大。)

    十几年职场生涯,从来都只听说过上司培养下属,给他发展的空间,没有听说过培养上司的。我也是从基层一步一步做起来的,期间没少得到各级上司的特别关照。亲睐我的上司教会了许多工作和生活上的东西,讨厌我的上司也同样教了不少,只不过我是把反面教材拿来正面学习罢了。跟绝大多数同仁一样,我也从来以为上司培养下属是天经地义的事儿,不会培养下属的上司肯定不是个好上司。

    最近却听到一件事,一个公司空降了一位新领导,资历较浅,专业度不够,下属们的反应五花八门。有口服心不服的,有心口皆不服的,表现程度不尽相同。部分人甚至明火执仗地对着干,欺负上司不懂,最后闹到一拍两散的地步。那个离开了的下属还愤愤不平,强烈质疑公司的干部任用标准。如果简单地看,这样的事情每家公司都有,全世界每天不知要发生几千几万次,太平常了,但看似平常的东西未必是真的平常。

    换个角度思考,身为下属的你,既然知道上司不专业,为什么不去培养他呢?除非你能把他赶走。管理学的教科书好象没有教过我们这方面的内容,但职场上的生存之道应该是有的。

&nbs

文章图片

     Facebook的PHP项目HipHop for PHP是一个由PHP到C++的转换程序,一个重新实现的PHP运行库,和许多常用PHP扩展的重写版本构成,目的是旨在加速和优化 PHP。

     用Facebook官 方博客(无法直接访问)上项目负责人赵海平(北大1987届遗传与分子生物专业,普林斯顿计算机科学博士)的话说,HipHop项目对 Facebook影响巨大。它目前已经支撑了Facebook 90%的Web流量。由于HipHop,Facebook Web服务器上的CPU使用平均减少了50%,从而大大减少了服务器的需求。为了让这一改进也惠及社区,他们决定将之开源,希望能够进一步帮助提高更多大 型复杂PHP网站的可伸缩性。

     PHP和Facebook的问题

众所周知,Facebook的前端主要是用PHP写的。赵海平说,过去六年Facebook从PHP语言的进展上获益良多。PHP非常简单,易 学易用,好读好调试,因此新工程师成长很快,有利地促进了Facebook的更快的创新。

PHP是一种脚本语言,其好处是编程效率高,能够支持产品的快速迭代。但是与传统的编译语言相比,脚本语言

Redis的主从复制策略是通过其持久化的rdb文件来实现的,其过程是先dump出rdb文件,将rdb文件全量传输给slave,然后再将dump后的操作实时同步到slave中。下面是一篇介绍Redis复制原理的文章,文章作者为新浪微博的田琪同学(@摇摆巴赫)。

本文会讨论一下Redis的复制功能以及Redis复制机制本身的优缺点以及集群搭建问题。

Redis复制流程概述

Redis的复制功能是完全建立在之前我们讨论过的基于内存快照的持久化策略基础上的,也就是说无论你的持久化策略选择的是什么,只要用到了Redis的复制功能,就一定会有内存快照发生,那么首先要注意你的系统内存容量规划,原因可以参考我上一篇文章中提到的Redis磁盘IO问题。

Redis复制流程在Slave和Master端各自是一套状态机流转,涉及的状态信息是:

Slave 端:

REDIS_REPL_NONEREDIS_REPL_CONNECTREDIS_REPL_CONNECTED

Master端:

REDIS_REPL_WAIT_BGSAVE_STARTREDIS_REPL_WAIT_BGSAVE_ENDREDIS_REPL_SEND_BULKREDIS_REPL_ONLINE

整个状态机流程过程如下:

Slave端在配置文件中添加了slave of指令,于是Slave启动时读取配置文件,初始状态为REDIS_REPL_CONNECT。

Slave端在定时任务serverCron(Redis内部的定时器触发事件)中连接Master,发送sync命令,然后阻塞等待master发送回其内存快照文件(最新版的Redis已经不需要让Slave阻塞)。

Master端收到sync

redis和memcache比较像的,memcache可以实现服务器的集群,redis肯定也是可以的。下面在一台机,实现redis主从复制。

1,copy一下redis.conf,生成一个从机的配置

cp /usr/local/redis/redis.conf /usr/local/redis/redis_slave.conf

2,修改主服务器的配置redis.conf

bind 127.0.0.1

3,修改从服务器的配置redis_slave.conf

pidfile /usr/local/redis/var/redis_slave.pid

port 6380

bind 127.0.0.1

logfile /usr/local/redis/var/redis_slave.log

dbfilename dump_slave.rdb

slaveof 127.0.0.1 6379

4,启动主服务器,从服务器

redis-server /usr/local/redis/redis.conf

redis-server /usr/local/redis/redis_slave.conf

查看一下,redis.log文件会有以下内容

[6956] 11 Apr 17:07:14 * Server started, Redis version 2.4.10

[6956] 11 Apr 17:07:14 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.

[6956] 11 Apr 17:07:14 * The server is now ready to accept connections on port 6379

[6956] 11 Apr 17:22:15 * 1 changes in 900 seconds. Saving...

[6956] 11 Apr 17:22:15 * Background saving started by pid 7154

[7154] 11 Apr 17:22:15 * DB saved on disk

[6956] 11 Apr 17:22:15 * Background saving terminated with success

[6956] 11 Apr 18:30:14 * 1

开发过程中,经常遇到各种统计,如网页查看数,每次打开网页,都需要更新数据库,如在view字段加1

此类数据,不需要实时精确,因此可以积累起来批量处理,如1分钟更新一次,简单写了个基于redis类:

<?php

/**

 * RedisBatchClass

 * @authorLongniao <longniao@gmail.com>

 * @url http://www.inhai.com/

 * @version1.0

*/

class RedisBatch {

public$_Server;

public$_Host;

public$_Port;

public$_Varvar;//数组变量

public$_Vartime;//时间变量

public$_Interval;//时间间隔

public$_Runflag;//执行开关

function __construct()

{

$this->_Server= new Redis();

$this->_Host= '127.0.0.1';

$this->_Port= '6379';

$this->_Varvar= 'batchvar';

$this->_Vartime= 'batchtime';

$this->_Interval= 5;

$this->_Runflag= false;

$this->_Server->connect($this->_Host, $this->_Port);

if($this->_Server->exists($this->_Vartime)){

$lastTime = $this->_Server->get($this->_Vartime);

if(time() - $lastTime > $this->_Interval)

{

$this->_Runflag = true;

$this->refresh();

}

}

else

{

$this->refresh();

}

}

/**

* 添加

*/

public function add($id)

{

return $this->_Server->lpush($this->_Varvar, $id);

}

/**

* 获取

*/

public function get()

{

return $this->_Server->lRange($this->