Blog Archive
-
▼
2010
(60)
-
▼
December
(31)
- python reference
- 2011 SPRING newbie picking housing assignment noit...
- 2011 SPRING newbie picking housing assignment noit...
- Reproducing the feature outputs of common programs...
- Dan's ICSI Projects page
- Speech Signal Processing
- Reproducing the feature outputs of common programs...
- Awk Tutorial and Introduction
- linux top命令详解 - Marvin - CSDN博客
- XBOX360 Slim 4G破解必须验货 Kinect游戏也可玩D版 - 电玩巴士
- Noise Robustness resources CODE, toolkit, tutorial
- MFCC based feature vectors of my music collection ...
- List of DOS commands - Wikipedia, the free encyclo...
- Good feature for speech based Emotion Identification
- Thesis Search website
- ProQuest Document View - Discriminative and genera...
- Gaussian Mixture Selection Top 20
- RUN MATLAB COMPUTATIONS ON A SUN GRIDENGINE CLUSTER
- perl goto example
- Some resources for noise-robust and channel-robust...
- 四钻信誉◆车载GPS导航仪AV通用型 无线倒车后视套装-淘宝网
- 【铁将军309】STEEL MATE 309GPS 最新报价 图片 参数 论坛 铁将军309报价大全...
- How to Make Free VoIP Calls on Your iPhone | iPhon...
- How to Make Free VoIP Calls on Your iPhone | iPhon...
- iPhone Skype app lets you make free VOIP calls ove...
- Programming Wiki: Programming Languages and Resources
- matlab中常见英文词含义_Alextoy_新浪博客
- How to get input from keyboard in matlab
- 7个习惯 让你成为高效能人士
- dijktra's algorithm
- dijkstra's algorithm in C++
-
►
November
(29)
- http://www.fit.vutbr.cz/research/groups/speech/pub...
- China Town & Tian Tian Supermarket - shopping - Me...
- 爱普泰克的板子使用心得 « 猪哥的Blog
- iPhone_4_Finger_Tips.pdf
- 简单必备需掌握 iPhone 4实用技巧28条_苹果iPhone 4(32GB)_手机中国
- Matlab foder and file read in loop & Struct
- Matlab text file read example and tutorial
- Apple最新发布!第四代苹果手机:iPhone 4全面介绍 - 苹果fans-中文Apple Blog
- C语言结构体赋值
- myFeng: SVMlight使用简介
- shogun | A Large Scale Machine Learning Toolbox
- The comparation between libsvm and SVM light
- Perl Programming Tutorial: Data Structures
- Automatic Speech Recognition:
- NCE4-L41 Training elephants
- __LINE__ equivalent for Linux shell: $LINENO
- LingPipe: Language Identification Tutorial
- Good Internet resources for Speech Processing
- 《数据结构》考试大纲
- Try goto in linux
- Howto: Linux Rename Multiple Files At a Shell Prompt
- C Programming - Use of the ftime() Function
- [C Language] Use of the ftime() Function
- [C Language] exit function
- Handling Binary Files in Perl
- How to solve: error C2065: 'cout' : undeclared...
- Development for Beginners | C++ Beginner's Guide |...
- How to compile a C program on Visual Studio 2010
- Essential DOS Commands and Concepts
-
▼
December
(31)
Thursday, December 30, 2010
python reference
Wednesday, December 29, 2010
Reproducing the feature outputs of common programs in Matlab using melfcc.m
Tuesday, December 28, 2010
Friday, December 24, 2010
linux top命令详解 - Marvin - CSDN博客
top命令是Linux下常用的性能分析工具,能够实时显示系统中各个进程的资源占用状况,类似于Windows的任务管理器。下面详细介绍它的使用方法。
top - 01:06:48 up 1:22, 1 user, load average: 0.06, 0.60, 0.48
Tasks: 29 total, 1 running, 28 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.3% us, 1.0% sy, 0.0% ni, 98.7% id, 0.0% wa, 0.0% hi, 0.0% si
Mem: 191272k total, 173656k used, 17616k free, 22052k buffers
Swap: 192772k total, 0k used, 192772k free, 123988k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1379 root 16 0 7976 2456 1980 S 0.7 1.3 0:11.03 sshd
14704 root 16 0 2128 980 796 R 0.7 0.5 0:02.72 top
1 root 16 0 1992 632 544 S 0.0 0.3 0:00.90 init
2 root 34 19 0 0 0 S 0.0 0.0 0:00.00 ksoftirqd/0
3 root RT 0 0 0 0 S 0.0 0.0 0:00.00 watchdog/0
统计信息区
前五行是系统整体的统计信息。第一行是任务队列信息,同 uptime 命令的执行结果。其内容如下:
01:06:48 当前时间
up 1:22 系统运行时间,格式为时:分
1 user 当前登录用户数
load average: 0.06, 0.60, 0.48 系统负载,即任务队列的平均长度。
三个数值分别为 1分钟、5分钟、15分钟前到现在的平均值。
第二、三行为进程和CPU的信息。当有多个CPU时,这些内容可能会超过两行。内容如下:
Tasks: 29 total 进程总数
1 running 正在运行的进程数
28 sleeping 睡眠的进程数
0 stopped 停止的进程数
0 zombie 僵尸进程数
Cpu(s): 0.3% us 用户空间占用CPU百分比
1.0% sy 内核空间占用CPU百分比
0.0% ni 用户进程空间内改变过优先级的进程占用CPU百分比
98.7% id 空闲CPU百分比
0.0% wa 等待输入输出的CPU时间百分比
0.0% hi
0.0% si
最后两行为内存信息。内容如下:
Mem: 191272k total 物理内存总量
173656k used 使用的物理内存总量
17616k free 空闲内存总量
22052k buffers 用作内核缓存的内存量
Swap: 192772k total 交换区总量
0k used 使用的交换区总量
192772k free 空闲交换区总量
123988k cached 缓冲的交换区总量。
内存中的内容被换出到交换区,而后又被换入到内存,但使用过的交换区尚未被覆盖,
该数值即为这些内容已存在于内存中的交换区的大小。
相应的内存再次被换出时可不必再对交换区写入。
进程信息区
统计信息区域的下方显示了各个进程的详细信息。首先来认识一下各列的含义。
序号 列名 含义
a PID 进程id
b PPID 父进程id
c RUSER Real user name
d UID 进程所有者的用户id
e USER 进程所有者的用户名
f GROUP 进程所有者的组名
g TTY 启动进程的终端名。不是从终端启动的进程则显示为 ?
h PR 优先级
i NI nice值。负值表示高优先级,正值表示低优先级
j P 最后使用的CPU,仅在多CPU环境下有意义
k %CPU 上次更新到现在的CPU时间占用百分比
l TIME 进程使用的CPU时间总计,单位秒
m TIME+ 进程使用的CPU时间总计,单位1/100秒
n %MEM 进程使用的物理内存百分比
o VIRT 进程使用的虚拟内存总量,单位kb。VIRT=SWAP+RES
p SWAP 进程使用的虚拟内存中,被换出的大小,单位kb。
q RES 进程使用的、未被换出的物理内存大小,单位kb。RES=CODE+DATA
r CODE 可执行代码占用的物理内存大小,单位kb
s DATA 可执行代码以外的部分(数据段+栈)占用的物理内存大小,单位kb
t SHR 共享内存大小,单位kb
u nFLT 页面错误次数
v nDRT 最后一次写入到现在,被修改过的页面数。
w S 进程状态。
D=不可中断的睡眠状态
R=运行
S=睡眠
T=跟踪/停止
Z=僵尸进程
x COMMAND 命令名/命令行
y WCHAN 若该进程在睡眠,则显示睡眠中的系统函数名
z Flags 任务标志,参考 sched.h
默认情况下仅显示比较重要的 PID、USER、PR、NI、VIRT、RES、SHR、S、%CPU、%MEM、TIME+、COMMAND 列。可以通过下面的快捷键来更改显示内容。
更改显示内容
通过 f 键可以选择显示的内容。按 f 键之后会显示列的列表,按 a-z 即可显示或隐藏对应的列,最后按回车键确定。
按 o 键可以改变列的显示顺序。按小写的 a-z 可以将相应的列向右移动,而大写的 A-Z 可以将相应的列向左移动。最后按回车键确定。
按大写的 F 或 O 键,然后按 a-z 可以将进程按照相应的列进行排序。而大写的 R 键可以将当前的排序倒转。
命令使用
1. 工具(命令)名称
top
2.工具(命令)作用
显示系统当前的进程和其他状况; top是一个动态显示过程,即可以通过用户按键来不断刷新当前状态.如果在前台执行该命令,它将独占前台,直到用户终止该程序为止. 比较准确的说,top命令提供了实时的对系统处理器的状态监视.它将显示系统中CPU最“敏感”的任务列表.该命令可以按CPU使用.内存使用和执行时间对任务进行排序;而且该命令的很多特性都可以通过交互式命令或者在个人定制文件中进行设定.
3.环境设置
在Linux下使用。
4.使用方法
4.1使用格式
top [-] [d] [p] [q] [c] [C] [S] [s] [n]
4.2参数说明
d 指定每两次屏幕信息刷新之间的时间间隔。当然用户可以使用s交互命令来改变之。
p 通过指定监控进程ID来仅仅监控某个进程的状态。
q该选项将使top没有任何延迟的进行刷新。如果调用程序有超级用户权限,那么top将以尽可能高的优先级运行。
S 指定累计模式
s 使top命令在安全模式中运行。这将去除交互命令所带来的潜在危险。
i 使top不显示任何闲置或者僵死进程。
c 显示整个命令行而不只是显示命令名
4.3其他
下面介绍在top命令执行过程中可以使用的一些交互命令。从使用角度来看,熟练的掌握这些命令比掌握选项还重要一些。这些命令都是单字母的,如果在命令行选项中使用了s选项,则可能其中一些命令会被屏蔽掉。
Ctrl+L 擦除并且重写屏幕。
h或者? 显示帮助画面,给出一些简短的命令总结说明。
k 终止一个进程。系统将提示用户输入需要终止的进程PID,以及需要发送给该进程什么样的信号。一般的终止进程可以使用15信号;如果不能正常结束那就使用信号9强制结束该进程。默认值是信号15。在安全模式中此命令被屏蔽。
i 忽略闲置和僵死进程。这是一个开关式命令。
q 退出程序。
r 重新安排一个进程的优先级别。系统提示用户输入需要改变的进程PID以及需要设置的进程优先级值。输入一个正值将使优先级降低,反之则可以使该进程拥有更高的优先权。默认值是10。
S 切换到累计模式。
s 改变两次刷新之间的延迟时间。系统将提示用户输入新的时间,单位为s。如果有小数,就换算成m s。输入0值则系统将不断刷新,默认值是5 s。需要注意的是如果设置太小的时间,很可能会引起不断刷新,从而根本来不及看清显示的情况,而且系统负载也会大大增加。
f或者F 从当前显示中添加或者删除项目。
o或者O 改变显示项目的顺序。
l 切换显示平均负载和启动时间信息。
m 切换显示内存信息。
t 切换显示进程和CPU状态信息。
c 切换显示命令名称和完整命令行。
M 根据驻留内存大小进行排序。
P 根据CPU使用百分比大小进行排序。
T 根据时间/累计时间进行排序。
W 将当前设置写入~/.toprc文件中。这是写top配置文件的推荐方法。
Thursday, December 16, 2010
Monday, December 13, 2010
Noise Robustness resources CODE, toolkit, tutorial
Some resources for noise-robust and channel-robust speech processing
This page is a collection of links to software and data resources related to research on automatic speech recognition (ASR) that is robust to background noise and convolutional distortions such as reverberation. Some of the links pointed to by this page are also relevant to research on enhancing speech for human listening. This page has now been replaced by the Resources listings at www.isca-students.org. However, this page should stay up, because the URL for this page has been referenced in at least one published paper. (In that paper, in IEEE Trans. Speech and Audio Processing in 2006, it was referenced as the place to download the Qualcomm-ICSI-OGI tools.) As of February 2007 there are no working links on this page which are not included in the ISCA listings (although there are a few dead links which might start working again), and there are a lot of links in the ISCA listings which are not included on this page.Successful approaches to robust ASR may combine more than one robustness technique. Because of the simple data flow of much signal processing code, different tools can often be used together simply by running them in sequence, using pipes or intermediate files. Two convenient choices for intermediate file formats are HTK feature files, and waveforms. Many of the tools online here operate on HTK feature files, or can output HTK feature files. The HTK format is a useful intermediate file format for feature files because it is simple to read, write, and convert to other formats, and because of the popularity of HTK. Also, some algorithms can be used with other tools without any modification to those other tools by having the algorithms run speech-enhancement-style, outputting processed waveforms which the other tools treat as they would any other audio input file. Using processed waveforms as an intermediate format also allows listening, waveform plotting, and spectrogram plotting, which may lead to useful insights. If using processed waveforms as an intermediate format, it is often safest to store these processed waveforms in floating point, rather than the usual 16-bit integer storage format, to reduce roundoff error and eliminate the risk of overflow (numbers too large to represent in the 16-bit format) or underflow (numbers too small to represnt in the 16-bit format). Since processing algorithms may increase the loudness of some waveforms or introduce quiet details such as noise floors, there is a risk of overflow or underflow with a 16-bit integer format even if the original waveforms were well scaled for that format.
Enhancement/compensation software for ASR and human listening:
- Voicebox Matlab toolbox
- Karlsruhe Beamforming Toolkit
- Qualcomm-ICSI-OGI front end, speech detection, and noise reduction
- Patrick Wolfe's Matlab noise reduction code
- UCL Enhance
- CtuCopy
- University of Kentucky Microphone Array Processing Toolbox (this covers more than one category and is filed in another category)
- Trausti Kristjansson's page
- Marc Ferras' code for multi-microphone speech enhancement
Software for ASR:
- The RESPITE CASA Toolkit
- Seneff auditory model
- RASTA and MSG
- MVA (Mean-Variance-ARMA)
- Gabor filter analysis
Software for signal quality measurement:
Software and data for reproducing or simulating acoustic conditions:
- FaNT tool for adding noise or telephone characteristics to speech
- CTU snr tool
- Acoustic impulse responses
- University of Kentucky Microphone Array Processing Toolbox
- Univ. of Patras room acoustics simulators
- Additive Noise Sources
- NOISEX noises
- ShATR recordings
- Meeting room digits recordings
Other:
VOICEBOX
The VOICEBOX Matlab toolbox for audio processing includes a noise reduction routine (specsubm), routines to read and write audio files from Matlab, and many other things.Beamforming Toolkit
The Karlsruhe beamforming toolkit: "btk is a toolkit that provides a basis for the implementation of powerful beamforming algorithms. btk uses Python as a scripting language for ease of control and modification. The capacity to efficiently perform advanced numerical computations is provided by Numeric Python (NumPy), the GNU Scientific Library (GSL), as well as a few extra algorithms we've implemented ourselves."Qualcomm-ICSI-OGI front end, speech detection, and noise reduction
Click here for an archive containing source code and documentation for the Qualcomm-ICSI-OGI noise-robust front end described in the ICSLP 2002 paper by Adami et al. The archive also contains tools for using the speech detection, Wiener filter noise reduction, or nonspeech frame dropping features of the front end independently of other features. The noise reduction can be used independently of other components to produce noise-reduced waveforms.Matlab noise reduction tools by Patrick Wolfe
Matlab source code for various noise reduction algorithms is available here.UCL Enhance
Software and literature references for this speech enhancement tool are available here.CtuCopy
CtuCopy is an open source tool for speech enhancement and ASR feature extraction. "CtuCopy acts as a filter with speech waveform file(s) at the input and either a speech waveform file(s) or feature file(s) at the output." As of version 3.0.7, it can be used for several different noise reduction techniques in the spectral subtraction family, and several ASR feature extraction algorithms. It was written by Petr Fousek of the Czech Technical University in Prague's Speech Processing and Signal Analysis Group. As of this writing CtuCopy version 3.07 is available at http://www.idiap.ch/~fousek/ctucopy/ and in the future it should be available in the download section at http://noel.feld.cvut.cz/speechlab (there is currently an older version of CtuCopy at the second link).Trausti Kristjansson
Trausti Kristjansson created this page (while at the University of Toronto) which provides Matlab source code for (1) spectral subtraction noise removal, (2) the Algonquin variational inference algorithm for removing noise and channel effects, and (3) the Recognition Analyzer diagnostic tool which displays features, HTK log likelihoods, and HTK state sequences and can create resynthesized audio from MFCC features.Marc Ferras' code for multi-microphone speech enhancement
This page provides source code for several blind multi-microphone speech enhancement techniques. These were implemented by Marc Ferras while pursuing his masters thesis on multi-microphone signal processing for automatic speech recognition in meeting rooms.The RESPITE CASA Toolkit
The RESPITE CASA Toolkit is a toolkit for Computational Auditory Scene Analysis (CASA). This includes a tutorial on using the toolkit for missing data speech recognition.Seneff auditory model
This page has source code for an implementation of Stephanie Seneff's auditory model front end for ASR.RASTA and MSG
C/C++ implementations of the RASTA and MSG (modulation-filtered spectrogram) algorithms for robust feature extraction are available as part of this ICSI speech software package. There is also this older page for RASTA at ICSI. There is a MATLAB implementation of RASTA at Dan Ellis' Matlab page.MVA (Mean, Variance, ARMA)
This page provides source code for this technique proposed by Chia-Ping Chen and Jeff Bilmes which post-processes noisy cepstra by doing mean and variance normalization (M for mean, V for variance) and bandpass modulation filtering (A for ARMA).Gabor filter analysis for speech recognition
This page provides articles, filter definitions, software tools, and discussion related to automatic speech recognition (ASR) with Gabor filters. A Matlab package for feature selection using the Feature Finding Neural Networks (FFNN) approach proposed by Tino Gramß (Gramss) is available as well. (This FFNN package was used to select Gabor filters for ASR.)NIST Speech Quality Assurance Package (SPQA)
The SPQA package includes SNR measurement tools which do not require a clean audio reference.Objective Speech Quality Assessment
The CSLU Robust Speech Processing Laboratory software repository page hosts the Objective Speech Quality Assessment package (developed by Bryan Pellom, and analyzed in an ICSLP 98 paper by Hansen and Pellom) which calculates various metrics of speech quality based on comparing clean audio with noisy or noise-reduced audio.CTU snr tool
This open source tool can be used both to measure the SNR of signals and to mix noise into signals at a specified SNR. It is available from the Czech Technical University in Prague's Speech Processing and Signal Analysis Group in the download section at http://noel.feld.cvut.cz/speechlab.FaNT tool for adding noise or telephone characteristics to speech
The FaNT (Filtering and Noise-adding Tool) tool can be used to add noise to speech recordings at a desired SNR (signal-to-noise ratio). The SNR can be calculated using frequency weighting (G.712 or A-weighting), and the speech energy is calculated following ITU recommendation P.56. The tool can also be used to filter speech with certain frequency characteristics defined by the ITU for telephone equipment. This tool was used to create the noisy data for the popular AURORA 2 speech recognition corpus.Acoustic impulse responses
This page, created by James Hopgood, is a collection of acoustic impulse responses for simulating convolutional distortion. The focus is on hands-free / far-field acoustic conditions. Some past speech recognition work (by Shire, Kingsbury, Avendano, Palomaki, Morgan, Chen, Gelbart, possibly others) has been done using a set of impulse responses collected using four mics and various degress of reverberation in the varechoic chamber at Bell Labs. They can be downloaded here. Another set of impulse responses from the Bell Labs varechoic chamber, using 31 speaker positions and a linear 22-element microphone array, has been made available by Aki Harma here. More acoustic impulse responses from various rooms, including microphone array situations, are available as part of the Sound Scene Database in Real Acoustical Environments from the Real World Computing Partnership, here. The site noisevault.com has acoustic impulse responses as well as links to software and documents regarding impulse response measurement and acoustic simulation; it seems aimed at audio engineers and audio engineering hobbyists. Three impulse responses measured in two meeting rooms are available as part ofITU-T G.191 Annex A, also known as the ITU-T Software Tools Library (STL). These impulse responses are in the 2005 STL release (STL2005) but not in earlier releases. The acoustics of the meeting rooms are described in the STL users manual.University of Kentucky Microphone Array Processing Toolbox
This Matlab toolbox allows simulation of different room geometries, microphone locations, and speaker locations. It also includes routines for microphone array sound processing, microphone placement calculation, measuring RT60, and measuring sound velocity.Room acoustics simulator
The AudioGroup at the University of Patras have placed public domain room acoustics simulators online here.Additive Noise Sources
The CSLU Robust Speech Processing Laboratory software repository page hosts a package named Additive Noise Sources which contains noise files for use in simulating additive noise.NOISEX noises
This page at Rice has a set of downloadable noises. I think these are from the NOISEX-92 collection, but I don't know if this is the complete collection. I am not trying to give a comprehensive list of corpora on this page, but this page in the comp.speech FAQ has some links.ShATR multiple simultaneous speaker corpus
Here. "ShATR is a corpus of overlapped speech collected by the University of Sheffield Speech and Hearing Research Group in collaboration with ATR in order to support research into computational auditory scene analysis. The task involved four participants working in pairs to solve two crosswords. A fifth participant acted as a hint-giver. Eight channels of audio data were recorded from the following sensors: one close microphone per speaker, one omnidirectional microphone, and the two channels of a binaurally-wired mannekin. Around 41% of the corpus contains overlapped speakers. In addition, a variety of other audio data was collected from each participant. The entire corpus, which has a duration of around 37 minutes, has been segmented and transcribed at 5 levels, from subtasks down to phones. In addition, all nonspeech sounds have been marked."Meeting room digits recordings
Here is a set of connected digits (like TIDIGITS) recordings made with table-top microphones in a conference room at the International Computer Science Institute. (This audio data is also available from the LDC as part of the ICSI Meeting Corpus.)Pitch and Voicing Estimates for Aurora 2
The Pitch and Voicing Estimates for Aurora 2 archive from Microsoft Research "consists of a set of pitch period and voicing estimates for utterances found in the Aurora 2 corpus". The algorithm used was described in J. Droppo and A. Acero, "Maximum a Posteriori Pitch Tracking" in ICSLP 1998.A brief list of resources that are not specific to noise and channel robustness
ISCA resources page, WaveSurfer speech visualization tool (view waveforms, spectrograms, formant tracks, pitch tracks) and other KTH-hosted software, HTK recognizer, SPHINX recognizer , JULIUS recognizer, Edinburgh Speech Tools Library, ISIP recognizer and ISIP Foundation Classes for speech processing, CSLR SONIC recognizer, CMU-Cambridge Statistical Language Modeling toolkit, SRILM - The SRI Language Modeling Toolkit, ICSI speech software package (link above under "RASTA and MSG"), COLEA Matlab Tool for Speech Analysis, some more links to tools here. For collections of speech recordings: Linguistic Data Consortium, European Language Resources Association (despite the name they have non-European languages too), Corpora Group at CSLU, VoxForge (recordings available at no cost), LibriVox (recordings available at no cost), VoxForge's list of corpora, and also see the Corpora listings on the ISCA Students web siteA list of phonetics tutorials and speech processing tutorials and softwareSunday, December 12, 2010
Good feature for speech based Emotion Identification
STATIC:
f0
duration
MFB: Mel filter Bank coefficent
Voice Quality
Other:
JItter, HNR, shimmer
Saturday, December 11, 2010
Friday, December 10, 2010
Gaussian Mixture Selection Top 20
Tuesday, December 7, 2010
perl goto example
# http://www.tutorialspoint.com/perl/perl_goto.htm
$count = 0;
START:
$count = $count + 1;
if( $count > 4 ){
print "Exiting program\n";
}else{
print "Count = $count, Jumping to START:\n";
goto START;
}
Monday, December 6, 2010
Saturday, December 4, 2010
Friday, December 3, 2010
How to Make Free VoIP Calls on Your iPhone | iPhone.AppStorm
How to Make Free VoIP Calls on Your iPhone | iPhone.AppStorm
Thursday, December 2, 2010
matlab中常见英文词含义_Alextoy_新浪博客
How to get input from keyboard in matlab
%UNTITLED Summary of this function goes here
% Detailed explanation goes here
intV=input('input the value of First Paratmer(must be digit): '); %作用是输入a的数据,此数据必须是数字形式的。
strV=input('input the value of Second Paratmer(must be string): ','s'); %作用是输入a的数据,此数据必须是字符形式的
fprintf('Firt Parameter= %d\n', intV);
fprintf('\nSecond Parameter= %s\n', strV);
Wednesday, December 1, 2010
dijktra's algorithm
#include "stdafx.h"
#include
#include
#include
#define infi 999
using namespace::std;
class queue
{
private:
int q[100];
int front, rear;
protected:
queue()
{
front=rear=-1;
}
int isempty()
{
if((front==-1 && rear==-1) || (front>rear))
{
front=rear=-1;
return 1;
}
return 0;
}
void push(int a)
{
if(isempty())
front++;
q[++rear]=a;
};
int del()
{
return q[front++];
}
};
class dj :public queue
{
private:
int mat[10][10], dist[10], path[10];
public:
int n;
void input()
{
cout<<"Enter number of nodes:\n"; cin>>n;
cout<<"\n\nEnter adjacency matrix\n"<
}
void init(int m)
{
push(m);
dist[m]=0;
for(int i=1;i<=n;i++)
{
if(i!=m)
{
push(i);
dist[i]=infi;
}
path[i]=0;
}
}
void min_dist(int m)
{
int v, w;
init(m);
while(!(isempty()))
{
v=del();
for(int i=1;i<=n;i++)
{
if(mat[v][i]!=0)
{
w=i;
if((dist[v]+mat[v][w])<(dist[w]))
{
dist[w]=dist[v]+mat[v][w];
path[w]=v;
}
}
}
}
}
void disp_path(int m)
{
int p=path[m];
if(p==0)
return;
disp_path(p);
cout<<" "<
void disp_dist(int m)
{
cout<<"Cost: "<
};
void main()
{
system("cls");
int c=0;
dj a;
a.input();
cout<<"\n\nPress any key to continue"<
system("cls");
for(int i=1;i<=a.n;i++)
{
a.min_dist(i);
for(int j=1;j<=a.n;j++)
{
if(i!=j)
{
if(++c==10)
{
cout<<"\n\nPress any key to continue"<
system("cls");
c=0;
}
cout<<"From "< cout<<"------------"<
cout<<")"<
}
}
}
cout<<"\n\nPress any key to exit"<
}
/*Output:
Enter number of nodes:
4
Enter adjacency matrix
0 1 5 4
1 0 2 6
5 2 0 3
4 6 3 0
From 1 to 2:
------------
Minimum distance route: (1 2)
Cost: 1
From 1 to 3:
------------
Minimum distance route: (1 2 3)
Cost: 3
From 1 to 4:
------------
Minimum distance route: (1 4)
Cost: 4
From 2 to 1:
------------
Minimum distance route: (2 1)
Cost: 1
From 2 to 3:
------------
Minimum distance route: (2 3)
Cost: 2
From 2 to 4:
------------
Minimum distance route: (2 1 4)
Cost: 5
From 3 to 1:
------------
Minimum distance route: (3 2 1)
Cost: 3
From 3 to 2:
------------
Minimum distance route: (3 2)
Cost: 2
From 3 to 4:
------------
Minimum distance route: (3 4)
Cost: 3
From 4 to 1:
------------
Minimum distance route: (4 1)
Cost: 4
From 4 to 2:
------------
Minimum distance route: (4 1 2)
Cost: 5
From 4 to 3:
------------
Minimum distance route: (4 3)
Cost: 3
*/
dijkstra's algorithm in C++
#include "stdafx.h"
#include
#include
#include
#define infi 999
using namespace::std;
class queue
{
private:
int q[100];
int front, rear;
protected:
queue()
{
front=rear=-1;
}
int isempty()
{
if((front==-1 && rear==-1) || (front>rear))
{
front=rear=-1;
return 1;
}
return 0;
}
void push(int a)
{
if(isempty())
front++;
q[++rear]=a;
};
int del()
{
return q[front++];
}
};
class dj :public queue
{
private:
int mat[10][10], dist[10], path[10];
public:
int n;
void input()
{
cout<<"Enter number of nodes:\n";
cin>>n;
cout<<"\n\nEnter adjacency matrix\n"<
for(int j=1;j<=n;j++)
cin>>mat[i][j];
}
void init(int m)
{
push(m);
dist[m]=0;
for(int i=1;i<=n;i++)
{
if(i!=m)
{
push(i);
dist[i]=infi;
}
path[i]=0;
}
}
void min_dist(int m)
{
int v, w;
init(m);
while(!(isempty()))
{
v=del();
for(int i=1;i<=n;i++)
{
if(mat[v][i]!=0)
{
w=i;
if((dist[v]+mat[v][w])<(dist[w]))
{
dist[w]=dist[v]+mat[v][w];
path[w]=v;
}
}
}
}
}
void disp_path(int m)
{
int p=path[m];
if(p==0)
return;
disp_path(p);
cout<<" "<
void disp_dist(int m)
{
cout<<"Cost: "<
};
void main()
{
system("cls");
int c=0;
dj a;
a.input();
cout<<"\n\nPress any key to continue"<
system("cls");
for(int i=1;i<=a.n;i++)
{
a.min_dist(i);
for(int j=1;j<=a.n;j++)
{
if(i!=j)
{
if(++c==10)
{
cout<<"\n\nPress any key to continue"<
system("cls");
c=0;
}
cout<<"From "< cout<<"------------"<
cout<<")"<
}
}
}
cout<<"\n\nPress any key to exit"<
}
/*Output:
Enter number of nodes:
4
Enter adjacency matrix
0 1 5 4
1 0 2 6
5 2 0 3
4 6 3 0
From 1 to 2:
------------
Minimum distance route: (1 2)
Cost: 1
From 1 to 3:
------------
Minimum distance route: (1 2 3)
Cost: 3
From 1 to 4:
------------
Minimum distance route: (1 4)
Cost: 4
From 2 to 1:
------------
Minimum distance route: (2 1)
Cost: 1
From 2 to 3:
------------
Minimum distance route: (2 3)
Cost: 2
From 2 to 4:
------------
Minimum distance route: (2 1 4)
Cost: 5
From 3 to 1:
------------
Minimum distance route: (3 2 1)
Cost: 3
From 3 to 2:
------------
Minimum distance route: (3 2)
Cost: 2
From 3 to 4:
------------
Minimum distance route: (3 4)
Cost: 3
From 4 to 1:
------------
Minimum distance route: (4 1)
Cost: 4
From 4 to 2:
------------
Minimum distance route: (4 1 2)
Cost: 5
From 4 to 3:
------------
Minimum distance route: (4 3)
Cost: 3
*/
Tuesday, November 30, 2010
Monday, November 29, 2010
Sunday, November 28, 2010
爱普泰克的板子使用心得 « 猪哥的Blog
Saturday, November 27, 2010
Friday, November 26, 2010
Wednesday, November 24, 2010
Matlab foder and file read in loop & Struct
Monday, November 22, 2010
Matlab text file read example and tutorial
Saturday, November 20, 2010
C语言结构体赋值
C语言结构体赋值
1 对成员赋值. |
Friday, November 19, 2010
myFeng: SVMlight使用简介
shogun | A Large Scale Machine Learning Toolbox
The comparation between libsvm and SVM light
发信人: CnF (帮我开机器-程序跑起来没有?), 信区: AI
标 题: Re: 有没有大侠比较过libsvm和svm-light?
发信站: BBS 水木清华站 (Mon May 12 01:04:12 2003), 转信
不会吧? 我以为libSVM是目前最快的SVM训练软件呢. SVM-light2.0是98年出来的,
挺土的,因为那时候还刚开始探索decomposition algorithm.它的算法详见
Joachims, T. (1998). Making large-scale SVM learning practical. In B. Scholk
opf, C. J. C. Burges, and A. J. Smola (Eds.), Advances in Kernel Methods - S
upport Vector Learning, Cambridge, MA. MIT Press.
同年出现的还有Platt的SMO算法. SVM-light还没有用上SMO的二维二次规划问题的
解析解法(虽然它也用的两个样本的working set). 但是可能由于它的其他得力机制,如
shrinking和Kernel Cache,在比较中才比SMO快的.(SVMlight用了80M内存,SMO没有用,光
这一点就不平等,我怀疑Joachims的算法实际上没有SMO快的.)
LibSVM2.3是2001年才出来的,其算法详见
Chang, C.-C. and C.-J. Lin (2001c). LIBSVM: a Library for Support Vector Mac
hines (Version 2.3). http://www.csie.ntu.edu.tw/~cjlin/papers/libsvm.pdf (Ju
ne 2001)
它综合了SVM-light和SMO的算法,而且还是被Keerthy改正过的SMO, 在很多地方比J
oachims的算法考虑得精细得多(比如shrinking机制,确实想得够妙了), 当然Joachims提
出了这些机制的思想,虽然实现得比较粗糙,但对于后来算法的发展有重要意义.
我觉得LibSVM不太可能比SVMlight慢吧,不过我只是这么一想,没做过试验. 你比的
是它们的什么版本? LibSVM出来2.4了,不过核心算法还是2.32的没变. SVMlight我不知
道后来又出新版本没有. 要试验比较的话, 注意让它们在同等条件下比较,包括解同样的
问题(这个其实不用说了,数据集,样本数,C值,核函数参数都要一样), 同样的Kernel Ca
che大小(也就是内存使用),同样的终止条件(这里注意LibSVM默认用的双边KKT违反tole
rance=0.001的终止条件,而SVMlight用的单边tolerance,默认大概也是0.001,也就是比
LibSVM松了一倍.) 后面二者对速度影响会很大的. 另外还有它们用的浮点数类型是否一
样, LibSVM默认用float而不是double型存放核函数矩阵的元素, 等于可用内存大了一倍
, 但结果的有效位数会下降.
至于分类效果好坏, 应该跟用哪种解二次规划的算法没什么关系吧. 只要它们用一
样的终止条件卡着, 结果应该都是精确的. 但是支持向量个数及alpha值,b值都会差一点
,这个不奇怪,就是吧样本顺序重排一遍再算结果也会有少许区别的. 如果试验中两个算
法用的一样的终止条件, 分类效果总是一个明显比另一个好,那就实在太奇怪了, 只能说
明我的理解不对了.
【 在 alamarik (走向成熟) 的大作中提到: 】
: 最近弄了一阵子svm,发现libsvm和svm-light两个工具
: 听不错的。其中,libsvm似乎是从svm-light基础上发展起来的
: 但是在解二次规划的方法上,没有完全沿用svm-light的方法。
: 我做了些简单的实验,发现普遍来说,svm-light比libsvm快,而且效果
: 好一些。不知道有没有大侠对他们有研究,比较一些如何?
: 不过,libsvm很容易使用,很容易被集成在自己的cpp工程中,svm-light
: 似乎很麻烦吧,呵呵。
: 期待大家的回复。。。。。。
--
主楼不关门,是我永远的梦想
实验室不断电,是我最大的愿望
每天早上帮我按一下Power,是我唯一的请求
有没有办法来电自动开机呢?如果知道请给我写信,谢谢!
※ 修改:・CnF 于 May 12 01:08:20 修改本文・[FROM: 166.111.151.78]
※ 来源:・BBS 水木清华站 smth.org・[FROM: 166.111.151.78]
发表者 Tintin 以 03:57
Perl Programming Tutorial: Data Structures
Data Structures: Scalars, Arrays, Hashes
In this section, we'll discuss the basic data structures available in Perl. Make sure you practice some of the examples discussed here!
Data Structures :: Scalars
A scalar is a number or a string. You can apply the usual manipulations on numbers, +, -, *, /, %, but Perl also has an exponentional operator. So how would you write 2 cubed?
2**3
Powerful? Yes.
What about string operations? String concatenation for example:
"hello" . "world"
The above would result in a single word, "helloworld". You can string multiple concatenations into one operation.
There is a string repetition operator: x. For example:
"w00t" x 3
would yield "w00tw00tw00t".
The standard logical operators are present and can be used on strings too! The following table (Schwartz 37) illustrates the Logical operators on scalars:
Comparison Numeric String
Equal == eq
Not Equal != ne
Less Than < lt
Greater Than > gt
Less Than or Equal To <= le
Greater Than or Equal To >= ge
Other operators include ++, --, !, &&, ||, ?:, *= += -=, ->, \. See Schwartz pgs. 38-39.
One of the powerhouses of Perl is the automatic type conversion between numbers and strings. It technically isn't even a type conversion because numbers and strings are both scalars.
(4**2 + 3 / 2) . " is the result of the expression 4^2 + 3/2"
This would result in a string "17.5 is the result of the expression 4^2 + 3/2".
So how do we store these scalars into actual variables we can use? Simple:
$result = (4**2 + 3 / 2) . " is the result of the expression 4^2 + 3/2";
Now the string is stored in the variable result.
You can do many cool things with variables in Perl, for example:
($x, $y) = ($y, $x);
swaps variables x and y. A far cry from C...
To remove trailing newlines from strings, you can use either chop or chomp. chop always removes the last character from the string, while chomp only removes newlines. So be safe and use chomp to remove newlines from input (more on input later).
Data Structures :: Arrays
An array variable is signified by the @ character.
A list literal is defined by parentheses and separated by commas:
@arr_1 = (1, 2, 3);
@str_arr = ("hello", "cruel", "world");
@arr_42 = qw(the meaning of life doesn\'t exist);
@arr_gen = (0 .. 5);
str_arr is an array of strings. What is arr_42? It is the shorthand method of writing a list of strings using the qw or quote word function. arr_gen is the same as the list (0, 1, 2, 3, 4, 5).
What about adding into an array or deleting from an array?
@arr_gen = (-1, @arr_gen, 6); # adds -1 to the front, 6 to the back of list
($a, @arr_gen) = @arr_gen; # removes -1 from @arr_gen to $a
$length = @arr_gen; # length is 7
($first) = @arr_gen;
These aren't the only ways to add or remove from a list (see below). What does the fourth statement do? Whenever you set an array to a scalar, Perl automatically takes the length of the array and sets that value to the scalar. The last statement gets the first element of arr_gen or 0. But how do we access different elements in the array?
Element access in arrays are much like any other programming language:
$arr_gen[3] = 42;
@arr_gen[0,1] = (10, 11);
In the first line, we access the fourth element in the array and change the value to 42. In the second line, we change the first two elements in the array to 10 and 11 by slicing. You can easily reverse lists using slicing also (see Schwartz pg. 53), but there is an even easier method below for list reversals.
Another powerful feature of arrays in Perl is negative indexing:
@arr_gen = (0 .. 5);
$a = $arr_gen[-2]; # $a gets assigned 4
$last = $#arr_gen; # last == 4
What does the last statement do? It gives last the last index value of the array (not the length).
So how do we add/remove from lists with ease? Simple, treat them like stacks or queues:
@arr = (1 .. 3);
$new_rvalue = 4;
$new_lvalue = 0;
push(@arr, $new_rvalue); # @arr == (1, 2, 3, 4)
unshift(@arr, $new_lvalue); # @arr == (0, 1, 2, 3, 4)
$x = pop(@arr); # $x == 4, @arr == (0, 1, 2, 3)
$y = shift(@arr); # $y == 0, @arr == (1, 2, 3)
Instant stacks and queues. Nice!
How about reversing a list? Simply call the reverse function:
@rev_a = reverse(@a);
Simple enough... how about sorting a list?
@mylist = (1, 2, 4, 0, 32, 22, 17, 53, 42);
@sorted = sort(@mylist);
@sorted is 0, 1, 17, 2, 22, 32, 4, 42, 53. Wait! That isn't sorted... well technically it is. The sort function performs an ASCII sort, not a numeric sort. More on sorting numerically later.
Data Structures :: Hashes
A hash is a data structure that holds scalars, but is indexed by a key value or another scalar.
Hash variables are declared with %. Elements in the hash are referenced by $key. For example:
$myhash{"key1"} = "555-111-29391-secret-key!"
$myhash{"key2"} = "333-123-33904-secret-key!"
$key = "key2";
print "$myhash{$key}"; # Prints the value in the hash of key2
There are some useful hash functions:
keys - lists all current keys in the hash (order doesn't matter. Why? So a useful way to use the keys function call is to loop through each key in the hash perhaps:
foreach $key (keys (%myhash)) {
print "$myhash{$key}\n";
}
This would loop through the %myhash hash and print each key. More on foreach later...
values - returns a list of all values in the hash.
each - each works much like keys does, but returns a list of both the key and the hash value.
delete - deletes a value out of the hash:
delete $myhash{"key1"}; # Deletes the key key1 and it's value
Hashes can be sliced also! For example:
@keys = qw(key3 key4 key5);
@myhash{@keys} = ("665-345-09284-secret-key!", "958-544-94950-secret-key!",
"448-39403-secret-key!");
@myhash{@keys} is the same as @myhash{"key3", "key4", "key5"} = ("665-345-09284-secret-key!", "958-544-94950-secret-key!", "448-39403-secret-key!");
Data Structures Review
Scalars are just numbers or strings. It's a fundamentally supported data type in Perl!
Arrays are collections of scalars indexed by integers much like other programming languages, but Perl has powerful extras added in.
Hashes are like arrays, but with scalar indexes.
There are other data structures, custom records and self-referential types.
Thursday, November 18, 2010
Wednesday, November 17, 2010
NCE4-L41 Training elephants
Two main techniques have been used for training elephants, which we may call respectively the tough and the gentle. The former method simply consists of setting an elephant to work and beating him until he does what is expected of him. Apart from any moral considerations this is a stupid method of training, for it produces a resentful animal who at a later stage may well turn man-killer. The gentle method requires more patience in the early stages, but produces a cheerful, good-tempered elephant who will give many years of loyal service.
The first essential in elephant training is to assign to the animal a single mahout who will be entirely responsible for the job. Elephants like to have one master just as dogs do, and are capable of a considerable degree of personal affection. There are even stories of half-trained elephant calves who have refused to feed and pined to death when by some unavoidable circumstance they have been deprived of their own trainer. Such extreme cases must probably be taken with a grain of salt, but they do underline the general principle that the relationship between elephant and mahout is the key to successful training.
The most economical age to capture an elephant for training is between fifteen and twenty years, for it is then almost ready to undertake heavy work and can begin to earn its keep straight away. But animals of this age do not easily become subservient to man, and a very firm hand must be employed in the early stages. The captive elephant, still roped to a tree,plunges and screams every time a man approaches, and for several days will probably refuse all food through anger and fear. Sometimes a tame elephant is tethered nearby to give the wild one confidence, and in most cases the captive gradually quietens down and begins to accept its food. The next stage is to get the elephant to the training establishment, a ticklish business which is achieved with the aid of two tame elephants roped to the captive on either side. When several elephants are being trained at one time it is customary for the new arrival to be placed between the stalls of two captives whose training is already well advanced. It is then left completely undisturbed with plenty of food and water so that it can absorb the atmosphere of its new home and see that nothing particularly alarming is happening to its companions. When it is eating normally its own training begins. The trainer stands in front of the elephant holding a long stick with a sharp metal point. Two assistants, mounted or tame elephants, control the captive from either side, while others rub their hands over his skin to the accompaniment of a monotonous and soothing chant. This if supposed to induce pleasurable sensations in the elephant, and its effects are reinforced by the use of endearing epithets, such as 'ho ! my son', or 'ho ! my father', or 'my mother', according to the age and sex of the captive. The elephant is not immediately susceptible to such blandishments, however, and usually lashes fiercely with its trunk in all directions. These movements are controlled by the trainer with the metal-pointed stick, and the trunk eventually becomes so sore that the elephant curls it up and seldom afterwards uses it for offensive purposes.
__LINE__ equivalent for Linux shell: $LINENO
Perl Linux
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
__FILE__ $0
__LINE__ $LINENO
Tuesday, November 16, 2010
LingPipe: Language Identification Tutorial
Good Internet resources for Speech Processing
http://www.is.cs.cmu.edu/11-751
The technology to allow humans to communicate with machines by speech and the technology to enable machines to understand when humans communicate with each other is rapidly maturing. This course provides an introduction to the theoretical background as well as the experimental practice that has made the field what it is today. We will cover theoretical foundations, essential algorithms, major approaches, experimental strategies and current state-of-the-art systems and will introduce the participants to ongoing work in representation, algorithms and interface design. The course will be completed by a brief overview of multilingual speech recognition dealing with various languages.
This course is primarily for graduate students in LTI, CS, Robotics, ECE, HCI, Psychology, or Computational Linguistics. Others by prior permission of instructor. No prior experience with speech recognition is necessary. The course is suitable for graduate students with some background in computer science and electrical engineering, as well as for advanced undergraduates.
The course involves written and programming assignments. Some reading of papers may also be required.
Monday, November 15, 2010
《数据结构》考试大纲
适用专业:计算机科学与技术、计算机软件工程
数据结构课程是一门实践性强的课程,需要进行大量的练习,数据结构课程的习题类型一般分为三类:一类是概念题,常见的形式包括是非判断题、简答题、选择题(单选或多选)与填空题几种;另一类是算法题,包括算法设计与算法填空两种形式;还有一类介于这两类题型之间,称为综合题或者问题求解题,这类题概念性一般不强,也不是写算法,可能是一种方法的具体应用,希望在复习中,多做一些相关的习题。
一、考试内容
1.数据结构的基本概念和术语
2.线性表
应掌握有关线性表基本概念,了解线性表基本操作有哪些;还要掌握线性表顺序存储结构与链式存储结构的构造原理和特点,在这两种存储结构上对线性表实施的一系列操作所对应的算法设计原理和方法,如线性链表、循环链表与双向链表的插入、删除算法的设计等。
3.数组与广义表
在程序设计语言中,通常将数组定义为具有相同类型的数组元素的集合,数组的基本操作有存、取、修改、查找和排序等。掌握常用操作的算法设计。本章的目的是介绍多维数组的逻辑结构特征及其存储方式,特殊矩阵和稀疏矩阵的压缩存储方法及广义表的概念,要求熟悉这些内容。本章重点是熟悉多维数组的存储方式、矩阵的压缩存储方式、广义表的定义及其表头表尾的运算,难点是稀疏矩阵的压缩存储表示下转置运算。
4.堆栈与队列
堆栈与队列是计算机领域非常重要的数据结构,从逻辑上看,堆栈与队列都是线性结构,掌握堆栈与队列的基本概念、常用操作的算法设计等。
5.串
本章的目的是介绍串的逻辑结构、存储结构及其串上的基本运算。本章重点是掌握串的基本概念和三种表示方法,这也是难点。
6.树与二叉树
了解树型结构的基本概念,掌握其名词术语,如:结点的度、树的度、叶结点、分支结点、树的层次、树的深度、树林、树的有序性等。掌握二叉树的定义、类型、性质;二叉树的存储结构、二叉树的遍历;二叉排序树的定义、建立、删除、查找等。了解Huffman树的概念。
7.图
图是非线性结构中比树结构还要复杂的结构,掌握图的定义、名词术语,如:顶点的度、路径、子图、图的连通、生成树与最小生成树、拓扑排序等;掌握图的存储结构、基本操作并了解图的其一些算法的设计。
8.查找
查找是顺序表和链表的基本应用,应理解查找的基本概念,熟练掌握顺序表查找的基本方法(顺序查找、二分查找),掌握静态索引结构以及查找、构造的基本算法。,理解散列的概念,了解散列函数的构造、解决冲突的方法。重点是熟练掌握顺序表查找的算法并理解静态/动态索引结构的特点。
9.内排序
排序是一种十分基本和重要的操作,了解排序的基本概念,掌握各种内排序方法,会设计内排序的算法。重点掌握插入排序(直接插入排序)、选择排序(直接选择排序、堆排序)、交换排序(气泡排序、快速排序)、归并排序等典型的排序算法及性能分析。
二、考试题型(分值,按100分计)
1、 选择题(单选)(8分)
2、 填空题(30分)
3、 运算题(30分)
3、 程序分析题(8分)
4、 算法设计题(24分)
三、参考书
[1] 《 数据结构(C语言版)》, 严蔚敏主编, 清华大学出版社
[2] 《数据结构题集(C语言版)》, 严蔚敏,吴伟民编著,清华大学出版社
四、考试时间:120分钟
==========
清华计算机专业课考研复习高效攻略
清华计算机专业课暑期复习高效攻略每年都有很多超自信的同学雄赳赳气昂昂的冲刺清华的计算机专业,同样每年也都有很多同学挥泪洒别清华计算机专业的考场。清华计算机专业排名全国第一,又是中国数一数二的名校,其角逐的激烈程度可想而知,专业课的考察的难度也是众所周知。如何在如此激烈的竞争中杀出一条血路金榜题名于2011,优化专业课备考的各个环节事半功倍的复习是关键。专业课教研室对同学们如何在暑期高效备考提供以下建议,供大家参考。复习总体指导思想谈到暑期的复习计划,由于各人的基础和学习背景不同,无法做一个统一的安排,但会有一个总体的指导思想。大家在暑期阶段要看完《数据结构(面向对象方法与C++描述)》、《计算机组成与设计》、《计算机系统结构》、《操作系统概念》这四本书。这一遍不用太细,但要知道大体内容的位置,翻书的时候知道到何处去查找。另外看这四本书的时候可以结合《数据结构习题解析》做一些题目。这里面的题目质量都很好,而且老师喜欢在里面出题,毕竟这是清华老师自己写的书。专业参考书目解析
01 《数据结构(面向对象方法与C++描述)》(第二版) 殷人昆等 清华大学出版社
02 《数据结构习题解析》 殷人昆等 清华大学出版社
03 《计算机组成与设计》(第二版) 王诚、刘卫东、宋佳兴 清华大学出版社
04 《计算机系统结构》(第二版) 郑纬民,汤志忠 清华大学出版社
05 《操作系统-精髓与设计原理》(第五版) William Stallings,陈渝译 电子工业出版
社(2006年2月)
06 《操作系统概念》(第六版) 郑扣根 译 高等教育出版社
这几本书都要买,都要看,没有轻重主次之分。除了这些书之外,还要给大家强烈推荐一本书。《计算机专业研究生入学考试全真题解》,共分5册,分别是:数据结构与程序设计分册。离散数学分册。操作系统分册。编译原理分册。硬件分册(包括数字逻辑、计算机组成原理、计算机系统结构)。这5册内容基本覆盖了计算机专业研究生入学考试涉及的7大部分。书中对知识点和考点之间的关系进行了深入挖掘,对典型例题进行了深入剖析,以求达到举一反三的目的。本书为硬件分册,包括如下几部分内容:试题分析和解题方法。这部分体现了全书的指导思想。主要内容概述。常考知识点及复习方法建议。真题详细解析。这部分是本书重点,汇集了近年来全国20余所著名院校计算机专业研究生入学考试的试题,对其进行了细致、深入的分析、解答和扩展。本书适合报考计算机专业研究生的考生有针对性地进行专业课的复习,也适合希望深入学习计算机专业知识的高校学生作为辅导书参考。同时,本书还可以作为习题集使用。
Thursday, November 11, 2010
Try goto in linux
# usage: tcsh try1.sh
# output:
#Try goto in linux
#This is Line 3
#This is Line 7
#!/bin/bash
echo "Try goto in linux"
echo "This is Line 3"
goto START
echo "This is Line 5"
START:
echo "This is Line 7"
Howto: Linux Rename Multiple Files At a Shell Prompt
1、我想把它们的名字的第一个1个字母变为"q",其它的不变
[root@pps mailqueue]# for i in `ls`; do mv -f $i `echo $i | sed 's/^./q/'`; done
或者写个脚本,显得更加清晰:
for file in `ls`
do
newfile =`echo $i | sed 's/^./q/'`
mv $file $newfile
done
2、修改前面5个字母为zhaozh
[root@pps mailqueue]# for i in `ls`; do mv -f $i `echo $i | sed 's/^...../zhaozh/'`; done
3、修改后面5个字母为snail
[root@pps mailqueue]# for i in `ls`; do mv -f $i `echo $i | sed 's/.....$/snail/'`; done
4、在前面添加 _hoho_
[root@pps mailqueue]# for i in `ls`; do mv -f $i `echo "_hoho_"$i`; done
5、所有的小写字母变大写字母
[root@pps mailqueue]# for i in `ls`; do mv -f $i `echo $i | tr a-z A-Z`; done
上面是五中完成有关Linux批量重命名方法。
====
Howto: Linux Rename Multiple Files At a Shell Prompt
How do I rename multiple files at a shell prompt under Linux or UNIX operating systems?
Renaming multiple files at a shell prompt is always considered as a black art by many UNIX gurus.
To be frank if you understand regex then it is not a black art anymore. A regular expression is a string that describes or matches a set of strings, according to certain syntax rules (see regex @ wikipedia for more information). Linux (and *BSD) comes with handy utility called rename. As a name suggest 'rename' renames the filenames supplied according to the rule specified (syntax):
rename "regex-rule" files
Rename command syntax
rename oldname newname *.files
For example rename all *.bak file as *.txt, enter:
$ rename .bak .txt *.bak
Examples: Linux Rename Multiple Files
Convert all mp3 filenames to more readable and usable format. Most of the time MP3 got multiple blank spaces, which may confuse many command line based Linux utilities and mp3 players
$ ls
Output:
06 - Gorillaz - Feel Good Inc.mp3
DDR - Kung- Fu Fighting (bus stop).mp3
AXEL CRAZYFROG.mp3
Remove all blank space with rename command:
$ rename "s/ *//g" *.mp3
$ ls
Output:
06-Gorillaz-FeelGoodInc.mp3
DDR-Kung-FuFighting(busstop).mp3
AXEL-CRAZYFROG.mp3
Linux Shell script to rename files
Before using the rename command I was using the following shell script to rename my mp3s:
#!/bin/bash
# To remove blank space
if [ $# -eq 0 ];
then
echo "Syntax: $(basename $0) file-name [command]"
exit 1
fi
FILES=$1
CMD=$2
for i in $FILES
do
# remove all blanks and store them OUT
OUT=$(echo $i | sed 's/ *//g')
if [ "$CMD" == "" ];
then
#just show file
echo $OUT
else
#else execute command such as mv or cp or rm
[ "$i" != "$OUT" ] && $($CMD "$i" "$OUT")
fi
done
To remove .jpg file extension, you write command as follows:
$ rename 's/\.jpg$//' *.jpg
To convert all uppercase filenames to lowercase:
$ rename 'y/A-Z/a-z/' *
Read the man page of rename command for more information:
man rename
Wednesday, November 10, 2010
[C Language] Use of the ftime() Function
Program FTIME.C illustrates how to continually fetch the time of the system clock so as perform a task for a specified period of time. In this simple example, a dot is printed for 5000 ms. Struct timeb consists of, among other things, a long integer, "time" which is the number of seconds since Jan 1, 70 and a short integer, "millitm", which is the fractional number of milliseconds.
At the beginning of the task, line 9, the start time is fetched. The task is then performed, in this case, the simple printing of a dot and the current time is fetched off the system clock in line 14. This is repeated until the current time is 5000 ms larger than the start time.
The advantage of this approach over using the TurboC delay function is that while executing the delay function, nothing else is being done. Thus, although the delay function has its place, it is unusable in many applications, where something dynamic must be done for a specified period of time.
/*
** Program FTIME.C
**
** Illustrates the use of ftime function to perform a task for a period
** of time. Prints dots for 5000 msecs.
**
** H. Paul Roach, MSU, 5 August, '96
*/
#include
#include
#include
/* 4 */
void main(void) /* 5 */
{ /* 6 */
struct timeb t_start, t_current; /* 7 */
int t_diff; /* 8 */
ftime(&t_start); /* 9 */
do /* 10 */
{ /* 11 */
printf("."); /* 12 */
ftime(&t_current); /* 13 */
t_diff = (int) (1000.0 * (t_current.time - t_start.time)/* 14 */
+ (t_current.millitm - t_start.millitm)); /* 15 */
} /* 16 */
while(t_diff < 5000); /* 17 */
} /* 18 */
[C Language] exit function
Handling Binary Files in Perl
http://www.tutorialspoint.com/perl/perl_read.htm
Syntax
read FILEHANDLE, SCALAR, LENGTH, OFFSET read FILEHANDLE, SCALAR, LENGTH |
Definition and Usage
Reads, or attempts to read, LENGTH number of bytes from the file associated with FILEHANDLE into BUFFER. If an offset is specified, the bytes that are read are placed into the buffer starting at the specified offset.
Return Value
The number of bytes read or the undefined value.
Example
Try out following example:
#!/usr/bin/perl -w |
It will produce following result. This is just sanpshot of the result
kerberos_master 751/udp # Kerberos authentication |
Handling Binary Files in Perl
sub copy_file {
my ($srcfile, $destfile) = @_;
my $buffer;
open INF, $srcfile
or die "\nCan't open $srcfile for reading: $!\n";
open OUTF, ">$destfile"
or die "\nCan't open $destfile for writing: $!\n";
binmode INF;
binmode OUTF;
while (
read (INF, $buffer, 65536) # read in (up to) 64k chunks, write
and print OUTF $buffer # exit if read or write fails
) {};
die "Problem copying: $!\n" if $!;
close OUTF
or die "Can't close $destfile: $!\n";
close INF
or die "Can't close $srcfile: $!\n";
}
How to solve: error C2065: 'cout' : undeclared identifier
#includeusing namespace std;
How to compile a C program on Visual Studio 2010
Walkthrough: Compiling a C Program on Visual Studio 2010
Visual C++ 2010 includes a C compiler that you can use to create everything from basic C programs to Windows API applications.
This walkthrough shows how to create a basic C program by using a text editor, and then compile it on the command line.
You can use your own C programs instead of typing the sample programs shown in this walkthrough. You can also use any C code sample programs that are included in the Help topics.
By default, the Visual C++ compiler treats all files that end in .c as C source code, and all files that end in .cpp as C++ source code. To force the compiler to treat all files as C regardless of file name extension, use the /Tc compiler option.
You must understand the fundamentals of the C++ language. If you are just getting started learning C++, we recommend the C++ Beginner's Guide by Herb Schildt, which is available on the MSDN Web site.
To create a C source file and compile it on the command line
Click Start, point to All Programs, Microsoft Visual Studio 2010, and Visual Studio Tools, and then click Visual Studio 2010 Command Prompt.
Depending on the version of Windows on the computer and the system security configuration, you might have to right-click Visual Studio 2008 Command Prompt and then click Run as Administrator to successfully run the application that you create by following these steps.
Note The Visual Studio 2010 Command Prompt automatically sets the correct path of the C compiler and any required libraries. Use it instead of the regular Command Prompt window. For more information, see Setting the Path and Environment Variables for Command-Line Builds.
At the command prompt, type notepad simple.c and press ENTER.
Click Yes when you are prompted to create a file.
In Notepad, type the following lines.
On the File menu, click Save to create a C source file.
Close Notepad.
At the command prompt, type cl simple.c and press ENTER.
The cl.exe compiler generates an executable program, Simple.exe.
You can see the executable program name in the lines of output information that the compiler displays.
To see a list of all files in the \simple\ directory, type dir simple.* and press ENTER.
The .obj file is an intermediate format file that you can safely ignore.
To run Simple.exe, type simple and press ENTER.
The program displays this text and exits:
This is a native C program.
To close the Command Prompt window, type exit and press ENTER.
Essential DOS Commands and Concepts
http://www.lsi.upc.edu/~robert/teaching/foninf/doshelp.html#dir
Essential DOS Commands and Concepts
- Backup Files
- Change the Default Drive
- CHDIR (CD) Change Directory Command
- COPY Command
- DIR (Directory) Command
- ERASE Command
- File-Naming Conventions
- FORMAT Command
- MKDIR (MD) Make Directory Command
- Rebooting the computer (Ctrl-Alt-Del)
- RENAME (REN) Command
- RMDIR (RD) Remove Directory Command
- Stop Execution (Ctrl-Break)
Introduction
DOS (an acronym for Disk Operation System) is a tool which allows you to control the operation of the IBM PC. DOS is software which was written to control hardware. IDRISI, Atlas*GIS, Microstation, AutoCAD, CPS/PC, and ARC/INFO are, in turn, application software which run under DOS. By this we mean that, although IDRISI, Atlas*GIS, Microstation, AutoCAD, CPS/PC, and ARC/INFO were written to accomplish a single task or application (in this case manipulation of spatially related data), they must use DOS to pursue its work.DOS can be used for a wide range of tasks far beyond the requirements of this class. You will be able to manage well if you master only a small subset of DOS commands and functions. These relate almost exclusively to file and directory management and are introduced in this handout.
This tip sheet assumes that you have learned how to turn on the PCs as they are configured in room 230 and that you have familiarized yourself with their keyboards (no small task in itself). It also assumes that you understand the meaning of the concept of a file and the elements of a file specification (drive, filename, and extension). The microcomputers you will be using are equipped with two floppy disk drives. The A-drive is the 3.5" (1.44MB) drive and the B-drive is the 5.25" (360KB) drive. The microcomputers also contain a C-drive, a hard disk drive of 130MB or 200MB capacity.
You will quickly find that the best way to learn how to use a computer is through experimentation. That is, once you have learned a command, try some variations until they don't work, then start over. Often there are five or six ways for you to accomplish a particular task. Usually, I will introduce you to only one, leaving it up to you to discover the rest. Don't hesitate to consult the DOS Reference Manual; copies can be found on the bookcase in room 230. Finally, don't be unduly disturbed by error messages. With computers, one of the best ways to learn is by making mistakes.
Most of the common DOS commands you need to use for this class (copy, rename, delete) are available to you in Windows through the Filemanager icon. And, since you can move back and forth between DOS and Windows, it doesn't matter which option you employ. Some commands are faster in invoke in Windows, some in DOS. If you haven't worked with Windows previously, go to the Windows tutorials in the help area.
Backup Files
It is possible to lose files by mistake, although the more you practice the less likely it becomes. For your own peace of mind, it is good practice to make backup copies of your most valuable files on a separate diskette. Store your backup disk in a safe place and don't carry it through a metal detector. Use the COPY command to create the backup.There is no need to backup every file you create, only the ones in which you've invested much work. Also, prune your backup diskette every week or two using the ERASE command. Backup files which have been made redundant by subsequent additions will simply create clutter on your backup diskette. An effective file naming convention is essential to keeping track of your backups.
Change the Default Drive
To change the default drive, simply type the letter of the your choice. The new default will be listed in subsequent DOS prompts.Example:
- C> A: [enter]
- Changes the default drive from C to A.
- A> C: [enter]
- Changes the default drive from A to C.
CHDIR (CD) Change Directory Command
Once you have located the directory you want, you may move from directory to directory using the CD command (change directory)Example:
- C> cd furniture
- Moves you to the directory called 'FURNITURE'
- C> cd \furniture\chairs
- Moves you to the directory called 'CHAIRS' under the directory called 'FURNITURE'.
- C> cd ..
- Moves you up one level in the path.
- C> cd \
- Takes you back to the root directory (c: in this case).
COPY Command
The COPY command can be used both to copy files from disk to disk or to create a second copy of a file on a single disk. (There are many more uses of the COPY command, but only the basic operation is discussed here.)Example:
- C> copy c:kermit.exe a:
- Copies the file 'KERMIT.EXE' from the C drive to the A drive and gives it the same name.
- C> copy a:brazil1.dat b:\south\brazil2.dat
- Creates a copy of 'BRAZIL1.DAT' from drive A on drive B, putting it in the 'SOUTH' subdirectory and renaming it 'BRAZIL2.DAT'.
Example:
- C> copy a:myfile.txt b:
- C> copy c:command.com b:com.com
- C> copy b:golly.gee a:whao.boy
- C> copy command.* a:
- C> copy a:mymap.dwg c:\maps
DIR (Directory) Command
The DIRECTORY command lists the names and sizes of all files located on a particular disk.Example:
- C> dir a:
- Shows directory of drive A
- C> dir b:
- Shows directory of drive B
- C> dir \agis
- Shows files in a subdirectory on drive C (default)
- C> dir
- Shows directory of drive C
- C> dir /w
- Shows directory in wide format, as opposed to a vertical listing.
DIR Options
Two little characters, '*' and '?', will make your life with computers much easier. Their use is illustrated below.Example:
- C> dir a:*.ex
- Lists all files on the A drive with an extension of 'EXE'.
- C> dir b:kermit.*
- Lists all files on the B drive with a filename of 'KERMIT'.
Example:
- C> dir a:labe?.com
- Lists all five-letter files with the first four letters 'LABE' and an extension of 'COM'.
- C> dir b:format.c??
- Lists all files with a filename of 'FORMAT' and an extension beginning with 'C'.
Example:
- C> dir a:labe?.*
- Lists all five-letter files with the first four letters 'LABE' and any extension.
- C> dir c:*.ex?
- Lists all files with an extension beginning with 'EX'.
ERASE Command
The ERASE command deletes specified files.Example:
- C> erase a:myfile.txt
- Erases the file MYFILE.TXT from the diskette in the A drive. If no drive specification is entered, the system looks to delete the specified file form drive C (in this case).
BEWARE: I will rescind your laboratory privileges for a full week if you ever knowingly use either the command: erase c:*.*, or the command: erase *.*. Guess what happens?
File-Naming Conventions
Careful file naming can save time. Always choose names which provide a clue to the file's contents. If you are working with a series of related files, use a number somewhere in the name to indicate which version you have created. This applies only to the filename parameter; most of the file extension parameters you will be using are predetermined (or reserved by DOS for certain types of file).Example:
- WORLD.DAT
- An ATLAS*GRAPHICS file containing data for a world map. The DAT extension is required by ATLAS*GRAPHICS.
- BRAZIL.BNB
- A boundary file of Brazil in binary form.
- BRIT1.DAT
- BRIT2.DAT
- BRIT3.DAT
- Three versions of a data file for a map of Britain.
FORMAT Command
You must format new disks before using them on the IBM computers. The format command checks a diskette for flaws and creates a directory where all the names of the diskette's files will be stored.Example:
- C> format a:
- Formats the diskette in the A drive.
- C> format b:
BEWARE: Executing the format command with a diskette which already contains files will result in the deletion of all the contents of the entire disk. It is best to execute the format command only on new diskettes. If you format an old diskette make sure it contains nothing you wish to save.
MKDIR (MD) Make Directory Command
This command creates a new directory.Example:
- C> mkdir mine
- Creates a directory called 'MINE'
Rebooting the computer (Ctrl-Alt-Del)
In some cases, when all attempts to recover from a barrage of error messages fails, as a last resort you can reboot the computer. To do this, you press, all at once, the control, alternate and delete.BEWARE: If you re-boot, you may loose some of your work--any data active in RAM which has not yet been saved to disk.
RENAME (REN) Command
The RENAME command permits users to change the name of a file without making a copy of it.Example:
- C> ren a:goofy.txt pluto.txt
- Changes the name of 'GOOFY.TXT' on the A drive to 'PLUTO.TXT'.
RMDIR (RD) Remove Directory Command
This command removes a directory. It is only possible to execute this command if the directory you wish to remove is empty.Example:
- C> rd mine
- Removes directory called 'MINE'.
Stop Execution (Ctrl-Break)
If you wish to stop the computer in the midst of executing the current command, you may use the key sequence Ctrl-Break. Ctrl-Break does not always work with non-DOS commands. Some software packages block its action in certain situations, but it is worth trying before you re-boot.
Converted 20 July 1994. KEF.