13 - 读取传感器:数字摄像头

读取摄像头是高潮,运气好的话几行代码一调就出来,不幸的话,整一个多月发现摄像头原来是坏的orz...

时序关系

帧。 帧是一幅完整的图像。以我们所用的数字摄像头为例(型号我忘了),默认设置下1秒有30帧。

场。 一帧包含两个场,奇数场和偶数场。奇数场传送奇数行数据,偶数场传送偶数行数据。如果一帧(一副完整图片)有480行,那么奇数场和偶数场会各有240行,奇数场传第1,3,5....行,传完后到偶数场传2,4,6....行。奇数场和偶数场传送的是同一幅图像的不同行,对提取道路信息来说,只使用奇数场/偶数场的数据就足够了。每一场的开始,会出现一个场中断。

行。 如果一幅图像是640*480,那么一行就有640个像素点。 每一行的开始,会出现一个行中断。
继续阅读“13 - 读取传感器:数字摄像头”

Stockbroker Grapevine - GCC - O(n3)解法

原题

Description

Stockbrokers are known to overreact to rumours. You have been contracted to develop a method of spreading disinformation amongst the stockbrokers to give your employer the tactical edge in the stock market. For maximum effect, you have to spread the rumours in the fastest possible way.

Unfortunately for you, stockbrokers only trust information coming from their "Trusted sources" This means you have to take into account the structure of their contacts when starting a rumour. It takes a certain amount of time for a specific stockbroker to pass the rumour on to each of his colleagues. Your task will be to write a program that tells you which stockbroker to choose as your starting point for the rumour, as well as the time it will take for the rumour to spread throughout the stockbroker community. This duration is measured as the time needed for the last person to receive the information.

Input

Your program will input data for different sets of stockbrokers. Each set starts with a line with the number of stockbrokers. Following this is a line for each stockbroker which contains the number of people who they have contact with, who these people are, and the time taken for them to pass the message to each person. The format of each stockbroker line is as follows: The line starts with the number of contacts (n), followed by n pairs of integers, one pair for each contact. Each pair lists first a number referring to the contact (e.g. a '1' means person number one in the set), followed by the time in minutes taken to pass a message to that person. There are no special punctuation symbols or spacing rules.

Each person is numbered 1 through to the number of stockbrokers. The time taken to pass the message on will be between 1 and 10 minutes (inclusive), and the number of contacts will range between 0 and one less than the number of stockbrokers. The number of stockbrokers will range from 1 to 100. The input is terminated by a set of stockbrokers containing 0 (zero) people.
继续阅读“Stockbroker Grapevine - GCC - O(n3)解法”

RHEL6: NIS的简单配置

参考文档

1. 鸟哥Linux私房菜-NIS http://linux.vbird.org/linux_server/0430nis.php
2. The Linux NIS(YP)/NYS/NIS+ HOWTO http://www.tldp.org/HOWTO/NIS-HOWTO/ypserv.html

实验环境

1. Server1, Server2 系统都是RHEL6.5;
2. Server1 IP为 192.168.122.108;
3. Server2 IP为 192.168.122.50;

实验内容

1. 以Server1 作为 NIS Server, Server2 作为Client.
2. 在Server2上尝试用NIS Server提供的用户信息登录;
3. 配置NFS家目录;


配置NIS Server

1. 安装所需软件包

[root@server1 ~]# yum install yp-tools ypbind ypserv rpcbind

2. 配置Server所属的域和主机名,Server 和 Client要在同一个域里呀。
修改/etc/sysconfig/network

HOSTNAME=server1.nis.example.com
NISDOMAIN=nis.example.com
YPSERV_ARGS="-p 1011"

修改/etc/hosts

192.168.122.108 server1.nis.example.com

继续阅读“RHEL6: NIS的简单配置”

RHEL6: NFS Server 安装与简单配置

参考文档

1. 鸟哥的Linux私房菜-NFS http://linux.vbird.org/linux_server/0330nfs.php
2. Linux NFS-HOWTO http://www.tldp.org/HOWTO/NFS-HOWTO/index.html
3. RFC 1094 https://tools.ietf.org/html/rfc1094
4. Redhat NFS https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Storage_Administration_Guide/ch-nfs.html

实验环境

1. Server1, Server2 系统均为RHEL6.5;
2. Server1 IP 192.168.122.108;
3. Server2 IP 192.168.122.50;

实验内容

1. 以Server1 作为NFS Server,共享/nfs_pub;用户的udi和gid都使用555.
2. Server2 设置成 NFS Client, 用autofs挂载192.168.122.108:/nfs_pub 到 /nfs/nfs_pub
继续阅读“RHEL6: NFS Server 安装与简单配置”

RHEL7: 救援模式修改root密码

RHEL7的救援模式,相当于RHEL6的单用户模式。
要在不知道root密码的前提下修改root密码,进入救援模式最靠谱。

参考文档

How To Reset Your Forgotten Root Password On CentOS 7 Servers

步骤

1. 进入Grub后修改启动选项。(按e可以编辑)

2. 在linux那一栏,加上

init=/sysroot/bin/sh

3. 删除

rhgb quiet

继续阅读“RHEL7: 救援模式修改root密码”

RHEL6: Postfix的安装与简单配置

Postfix 可用作Mail Server, 它配置起来要比Sendmail简单得多。

参考文档

1. 鸟哥Mail server http://linux.vbird.org/linux_server/0380mail.php
2. Postfix官方文档 http://www.postfix.org/documentation.html
3. 鸟哥DNS server http://linux.vbird.org/linux_server/0350dns.php

实验环境

3台虚拟机,操作系统为CentOS 6.5;
Host1的IP是192.168.56.101, Host2的IP是192.168.56.102,Host2的IP是192.168.56.103;

实验内容

1. Host1与Host2互相收发邮件;
2. 用Telnet发邮件;
3. 邮件Relay;
4. Virtual Alias Domain;
5. Virtual Mailbox Domain;
6. SASL认证;
7. Dovecot.

继续阅读“RHEL6: Postfix的安装与简单配置”