Youry's Blog

Youry's Blog

Archive for September 2013

CVS server on CENTOS

leave a comment »

updated from Set Up CVS Server on Linux http://is.gd/W35qfq (some mistakes and some problems found)

Assumption: server: s.com   client: c.com
Goal: user mike can use the CVS on s.com (assumption: mike has an account as “mike” on s.com)

At the first we need to create users:

in MS Excel

useradd -c <comment> <username> -G cvs

=CONCATENATE(“useradd -c “,LOWER(LEFT(RIGHT(B7,LEN(B7)-FIND(“,”,B7)-1),1)&(LEFT(B7,FIND(“,”,B7)-1))))

change password

=CONCATENATE(“echo “,CHAR(34),LOWER(LEFT(RIGHT(B7,LEN(B7)-FIND(“,”,B7)-1),1)&(LEFT(B7,FIND(“,”,B7)-1))),”:”,E7,CHAR(34),” | chpasswd”)

++++++++++

Steps:
1. install cvs and xinetd on the server
$yum install cvs
$yum install xinetd

NOTE: check whether cvs (or xinetd) has been installed:
$rpm -qa | grep cvs

2. set up cvs group and user on the server:
$groupadd cvs
$useradd -g cvs -G cvs -d /home/cvsroot cvsroot
$passwd cvsroot # set up password for cvsroot

Add mike to the cvs group:
$usermod -G mike cvs

Check whether mike is in the cvs group:
$groups mike

3. change owner of /home/cvsroot if necessary, chmod for /home/cvsroot:
$chown -R cvsroot:cvs /home/cvsroot
$chmod -R 775 /home/cvsroot

4. initialize cvs:
(login as cvsroot)
$cd /home/cvsroot
$cvs -d /home/cvsroot init  # full path is required
$chmod 644 /home/cvsroot/CVSROOT/config

5. create file for CVS self-startup, as xinetd type
(login as root)
$cd /etc/xinetd.d
$cp cvs cvspserver
$vim cvspserver  # do the following modifications:

# default: off
# description: The CVS service can record the history of your source \
#              files. CVS stores all the versions of a file in a single \
#              file in a clever way that only stores the differences \
#              between versions.
service cvspserver
{
disable                 = no             # modify
port                       = 2401
socket_type       = stream
protocol               = tcp
wait                       = no
user                       = root
passenv               = PATH
server                   = /usr/bin/cvs
env                         = HOME=/home/cvsroot    # modify
server_args        = -f –allow-root=/home/cvsroot pserver    # modify
}

6. add CVS as a service:
$vim /etc/services

Add two lines if not in the file:
cvspserver 2401/tcp #pserver cvs service
cvspserver 2401/udp #pserver cvs service

7. restart xinetd:
$/etc/init.d/xinetd restart

8. check if cvspserver has started
$netstat -l |grep cvspserver

should return:
tcp   0    0            *:cvspserver           *:*               LISTEN

9. manage users
$cp /etc/shadow /home/cvsroot/CVSROOT/passwd   # owner of passwd should be cvsroot:cvs
($cd /home/cvsroot/CVSROOT)
$chmod 644 passwd

modify passwd, delete all lines except users cvsroot and mike (you can keep some lines if needed)
for every line, delete all the content after the second “:”, and append cvsroot to that “:”

10. on client c.com, log in to the CVS server:
$export CVSROOT=:pserver:mike@s.com:2401/home/cvsroot
$cvs login

11. on client c.com, import a project /home/mike/myproject onto CVS server:
$cd /home/mike/myproject
$cvs import -m “my project” myproject mike start

12. errors:
1) As follows:
[mike@c.com ~]$ cvs -d :pserver:mike@s.com:/home/cvsroot login
Logging in to :pserver:mike@s.com:2401/home/cvsroot
CVS password:
cvs [login aborted]: unrecognized auth response from localhost: cvs pserver: cannot open /home/cvsroot/CVSROOT/config: Permission denied

Solution: turn off SELinux on s.com.
Turn it off now:
$setenforce 0

Turn it off after next restart:
$vim /etc/selinux/config
modify SELINUX=enforcing to
SELINUX=disabled

2) As follows:
[mike@c.com ~]$ cvs login
Logging in to :pserver:mike@s.com:2401/home/cvsroot
CVS password:
cvs [login aborted]: connect to [s.com]:2401 failed: No route to host

Solution: turn off firewall on s.com, or allow 2401 port in the firewall
Turn off firewall now:
service iptables stop

Turn off firewall after next restart:
$chkconfig iptables off   # or $/sbin/chkconfig –level 2345 iptables off

Check firewall status:
$/etc/init.d/iptables status

NOTE: This method applies on Fedora 12 for CVS server

References:
[1]http://blog.chinaunix.net/u/19742/showart_2256544.html
[2]http://peak.javaeye.com/blog/200035
[3]http://blog.csdn.net/do/archive/2008/07/18/2674272.aspx
[4]http://www.zzxj.net/blog/fxs_2008/archive/2010/08/24/198.html
[5]http://prewind.blogbus.com/logs/1029157.html  (CVS 常用操作 Howto)

Written by youryblog

September 28, 2013 at 5:20 PM

Posted in Uncategorized

Just Interesting

leave a comment »

Written by youryblog

September 24, 2013 at 1:29 PM

Posted in Interesting

Robots Take Over – “ultrafast machine ecology” of interacting robots in the global financial market.

leave a comment »

Robots Take Over (from http://is.gd/1TLUbK)
University of Miami (09/11/13) Annette Gallagher

University of Miami researchers recently conducted a study documenting the appearance of an “ultrafast machine ecology” of interacting robots in the global financial market. The findings suggest that for time scales of less than one second, the financial world makes a sudden transition into a cyberenvironment inhabited by packs of aggressive trading algorithms. “Our findings show that, in this new world of ultrafast robot algorithms, the behavior of the market undergoes a fundamental and abrupt transition to another world where conventional market theories no longer apply,” says Miami professor Neil Johnson. The industry’s push for faster systems that can outpace competitors has led to the development of algorithms that can operate faster than the response time for humans. The researchers assembled and analyzed a high-throughput millisecond-resolution price stream of multiple stocks and exchanges. From January 2006 through February 2011, the researchers found 18,520 extreme events lasting less than 1.5 seconds, including both spikes and crashes. They developed a model to understand the behavior and concluded that the events were the result of ultrafast computer trading and not attributable to other factors, such as regulations or mistaken trades. “What we see with the new ultrafast computer algorithms is predatory trading,” Johnson says. “In this case, the predator acts before the prey even knows it’s there.”

Written by youryblog

September 19, 2013 at 12:09 AM

Posted in Business, Interesting, IT