第一篇:Latex使用小结
LATEX使用小结
2010-10-03 09:04:49| 分类: 默认分类|字号 订阅
原文地址:LATEX使用小结
作者:丁三家的小包子 虚拟打印机转换eps格式
1.建立一个虚拟打印机:控制面板->printer->add a printer->add a local printer->FILE:(print to file)->然后从列表中随便选择一个支持postscript的打印机.2.设置:右击刚建立的虚拟打印机图标,properties->general->printing preferences->advanced->document options->PostScript Options->PostScript Output Options,选Encapsulated PostScript(EPS), 完工。
将8位图像转换为eps格式时,只需用Snagit的convert功能即可。
而在24位真彩色图转换时,有人推荐用Konvertor转换软件。我发现转换后,图像的分辨率大大降低,visio图像很容易出现漏字,图片模糊。用虚拟打印机转换eps格式就不会影响原图的分辨率。步骤如下:
右击打印,然后选中图片,选择之前创建的虚拟打印机,填写输出文件路径(D:fig1.eps
Latex排版时,如何用bibtex管理参考文献。
BibTeX 是一个使用数据库的的方式来管理参考文献程序, 用于协调LaTeX的参考文献处理.BibTeX 文件的后缀名为.bib.先来看一个例子: @article{Gettys90,author = {Jim Gettys and Phil Karlton and Scott McGregor}, title = {The {X} Window System, Version 11}, journal = {Software Practice and Experience}, volume = {20}, number = {S2}, year = {1990}, abstract = {A technical overview of the X11 functionality.This is an update of the X10 TOG paper by Scheifler & Gettys.} } 说明: 第一行@article 告诉 BibTeX 这是一个文章类型的参考文献.其它格式: article, book, booklet, conference, inbook, incollection, inproceedings, manual, misc, mastersthesis, phdthesis, proceedings, techreport, unpublished 等等.在LaTeX中使用BibTeX 为了在 LaTeX 中使用BibTeX 数据库, 你必须先做下面四件事情: 1)包含宏包 usepackage{natbib} 2)设置参考文献的类型(bibliography style).标准的为 plain: bibliographystyle{plain} 其它的类型包括:
unsrt – 基本上跟 plain 类型一样, 除了参考文献的条目的编号是按照引用的顺序, 而不是按照作者的字母顺序.alpha – 类似于 plain 类型, 当参考文献的条目的编号基于作者名字和出版年份的顺序.abbrv – 缩写格式.3)标记引用(Make citations).当你在文档中想使用引用时, 插入 LaTeX命令 cite{标号} 例如:、cite{Gettys90},根据cls文件的不同定制,以及在正文引用格式的不同要求,也可能是citet或者citep命令。
“标记”就是前边定义@article后面的名称.4)告诉 LaTeX 生成参考文献列表.在 LaTeX 的结束前输入 bibliographystyle{jmb}
% this can be plain, alpha, etc.bibliography{./MYREFS} 文件中应包含jmb.bst(定义参考文献类型)文件和MYREFS.bib文件
运行 BibTeX分为下面四步
1.用LaTeX编译你的.tex 文件 , 这是生成一个.aux 的文件, 这告诉BibTeX 将使用那些引用.2.用BibTeX 编译.bib 文件.3.再次用LaTeX 编译你的.tex 文件, 这个时候在文档中已经包含了参考文献, 但此时引用的编号可能不正确.4.最后用 LaTeX 编译你的.tex 文件, 如果一切顺利的话, 这是所有东西都已正常了.获取bib文件
(1)使用如下网址可以将springer文献格式变成bibtex: http://www.xiexiebang.com}, publisher = {ACM}, address = {New York, NY, USA}, };
@book条目为有确定出版社的书籍。
不可少域author或editor, title, publisher, year.可省略域volume或number, series, address, edition, month, note.@booklet条目为印制的有封皮的作品,但没有出版社或赞助机构的名称。不可少域title.可省略域author, howpublished, address, month, year, note.@conference与下面的@inproceedings相同。
@inbook条目为一本书的一部分(章,节或某些页)。
不可少域author或editor, title, chapter和/或pages, publisher,year.可省略域volume或number, series, type, address, edition, month,note.@incollection条目为一本书中有自己题目的一部分。不可少域author, title, booktitle, publisher, year.可省略域editor, volume或number,series, type, chapter, pages,address, edition, month, note.@inproceedings条目为会议论文集中的一篇文章。不可少域author, title, booktitle, year.可省略域editor, volume或number, series, pages, address, month, organization, publisher, note.@InProceedings{b07name, author = {a and b},title = {title}, booktitle = {Proceedings of the conference}, address = {Sydney, Australia}, month = Nov, year = 2008, pages = {1-2}, affiliation = {Uni-name, Country}, URL = {http://url/} };@manual条目为科技文档。不可少域title.可省略域author, organization, address, edition, month, year, note.@mastersthesis条目为硕士论文。不可少域author, title, school, year.可省略域type, address, month, note.@misc条目为不属于其它任何类型的作品。不可少域没有。
可省略域author, title, howpublished, month, year, note.@misc{name,author = “a”, title = “title”, howpublished = “Website”,};year = {2008}, note = {url{https://www.xiexiebang.com}} @phdthesis条目为博士论文。不可少域author, title, school, year.可省略域type, address, month, note.@proceedings条目为会议论文集。不可少域title, year.可省略域editor,volume或number, series, address, month, organization, publisher, note.@techreport条目为学校或其它研究机构印制的报告。不可少域author, title, institution, year.可省略域type, number, address, month, note.@techreport{name, author = {a and b} title = {title}, institution = {institution rpt no.} year = {2008} };
@unpublished条目为有作者和标题的还未出版的作品。不可少域author, title, note.可省略域month, year.在每项条目中还可以有可省略域key和crossref.参考文献及图片表格等超链接。包含宏包
usepackage[dvipdfm]{hyperref} 然后在正文中使用latex命令 cite{} ref{} 就可以实现文档中参考文献及图片表格等超链接。
图片命令 begin{figure} begin{center} includegraphics[width=7in]{sc.eps} caption{Framework of inspection system} label{fig1} end{center} end{figure} 若是一个双栏文档,使用begin{figure*}可实现跨栏排版,适用于表格编排。
子图排版 begin{figure*} begin{center} subfigure[subfigure1]{includegraphics[width=1.5in]{fig6(a).eps}} subfigure[subfigure2]{includegraphics[width=1.5in]{fig6(b).eps}} subfigure[subfigure3]{includegraphics[width=1.5in]{fig6(c).eps}} subfigure[subfigure4]{includegraphics[width=1.5in]{fig6(d).eps}} subfigure[subfigure5]{includegraphics[width=1.5in]{fig6(e).eps}} subfigure[subfigure6]{includegraphics[width=1.5in]{fig6(f).eps}} subfigure[subfigure7]{includegraphics[width=1.5in]{fig6(g).eps}} subfigure[subfigure8]{includegraphics[width=1.5in]{fig6(h).eps}} caption{Wavelet smoothing results} label{fig6} end{center} end{figure*} 每个子图属性显示为(a)subfigure1,(b)subfigure2.......三线表格 begin{table} centering
caption{it is an example}
vspace*{10pt}
begin{tabular}{@{}lcccc@{}} %% toprule {aa} & multicolumn{2}{c}{bb} & multicolumn{2}{c}{cc}[-2pt] cmidrule(1){2-5} {aa} & {bb} &{cc} & {dd}&{ee} hline {1} &a &b &c &d mbox{2}
&a &b &c &d mbox{3}
&a &b &c &d mbox{4}
&a &b &c &d mbox{5}
&a &b &c &d mbox{6}
&a &b &c &d mbox{7}
&a &b &c &d bottomrule end{tabular} end{table} cmidrule(1){2-5}实现2-5列的短划线。
第二篇:4AUnit 7 It’s late
Unit 7 It’s late Language targets: 1.Using numbers to tell the times.2.Using expressions to communicate with other learners Eg: What’s the time, please? It’s….What time do you get up/go to school? I … at …
Four skills: the numbers from 1 to 100.What’s the time, please? It’s….3.Be able to count the numbers from 1 to 100.4.Learn the sounds of the letters “ n, p”.5.Be able to sing a song: “ Go to school!”
6.Revision focus: a zoo, a park, a cinema, a supermarket, the Great Wall.Lesson 1 Language skills: Listening: Locate specific information in response to proper expressions: Speaking: Using “What’s the time? It’s….” to communicate with other learners.Writing: one, two, three, four, five, six, seven, eight, nine, ten.The learning materials: ______________________________________________________________________________________________________________ The learning course: Pre-task preparation: 1.Free talk Practise in pairs.Invite some pairs to have a talk.2.Revision a.Count the numbers from “1 to 10”.b.Count the numbers from “ 11 to 20”.Pay attention to the pronunciation “teen”.3.Listen and act.Clap 1, 2, 3….While-task procedure: 1.Numbers a.Show and read 30, 40, 50, 60, 70, 80, 90, 100 Pay attention to the pronunciation “ ty”
b.Play a guessing game.What’s in my hand?(hiding the numbers)It’s …
c.Show and read.35, 45, 55, 65, 75, 85, 95.(one by one)2.Time a.T: What’s the time? It’s …..Read the sentences after the teachers.b.Practise the reading.6:20, 9:34, 5:45, 12:15 c.Show a clock and ask: T: What’s the time? S1, S2,S3….d.Play a game.The teacher turn the time and let the students guess.S1, S2, S3… 3.Practise the reading.4.Copy: one, two, three, four, five, six, seven, eight, nine, ten.Post-task activity: Divide the class into groups.Play a guessing game.One writes the time and the others guess.Consolidation: Listen and repeat.Read and words.Homework: 1.Listen and read.2.Dictate the learned words.Lesson 2 Language skills: Listening: Locate specific information in response to proper expressions: Speaking: Using “What’s the time? It’s….” to communicate with other learners.Writing: What’s the time? It’s … The learning materials: ______________________________________________________________________________________________________________ The learning course: Pre-task preparation: 1.Free talk Practise in pairs.Invite some pairs to have a talk.4.Revision a.Numbers.Show and read.b.Time.Read the times one by one.Pay attention to “ teen, ty” While-task procedure: 1.Show the clock and ask: What’s the time? It’s ….2.Work in pairs.Invite some to say.3.Play a guessing game.Guess: What’s the time?….4.Ask and answer P55 Practise in pairs.Check the answers.Post-task activity: Play “listening and drawing” in groups.Consolidation: 1.Copy: What’s the time? It’s…..2.Listen and draw: I want to see 7:15/8:30.Homework: Listen and read.Dictation.Lesson 3 Language skills: Listening: Locate specific information in response to proper expressions: Speaking: Using “What time do you….? I … at….” to communicate with other learners.Pronouncing the sounds of the letters “n, p” correctly.Reading: Read the text fluently.The learning materials: ______________________________________________________________________________________________________________ The learning course: Pre-task preparation: 1.Have a free talk 2.Revision: What’s the time? It’s….While-task procedure: 1.T to Ss: I get up at…(repeat sometimes)What time do you get up? 2.Encourage the students to answer: I get up at six o’clock.3.Learn to say: What time do you get up? I get up at six.4.Show some picture and learn to say: have breakfast, have lunch, have supper, go to school, watch TV 5.Listen to the tape and answer.Mike goes to school at ….Mike comes home at… 6.Listen and repeat.7.Practise the reading in parts and in roles.8.Listen and repeat Name new panda Peter The new panda’s name is Peter.Post-task activity: Do a survey.1.Find out your friends’ timetable by using “ What time do you…?” 2.Report _____ at ______ Consolidation: 1.Listen and read.2.Dictation.Homework: Listen and read.Finish the survey after class.Lesson 4 Language skills: Listening: Locate specific information in response to proper expressions: Speaking: Using the learned phrases to communicate with other learners.Writing: What time do you ….? I … at ….The learning materials: ______________________________________________________________________________________________________________ The learning course: Pre-task preparation: 1.Free talk 2.Revision Play a game.Count from one to hundred.Don’t say the multiples of “3”.Say “Hello”.Eg one, two, hello, four…
If one makes a mistake the other say.“… you’re out.”
3.Look and read.Have breakfast have lunch have supper go to school watch TV 4.Report.Talk about the survey finished after class.Find out: Who has the best time? Give some suggestions to sb.You … at….It’s too …
5.Copy: have breakfast
have lunch have supper go to school watch TV What time do you get up?
I get up at … While-task procedure: 1.Ss’ book page 52-53.Listen and repeat.2.Show some pictures and revise the words A supermarket
a park
a zoo a cinema the Great Wall 3.T to S1/S2 Excuse me, What’s the time? It’s… It’s time to go home/go to school.Yes.Let’s go.4.Make a dialogue in pairs.5.S1 to T Elicit: Shall we go by bus? Learn to say.Post-task activity: Make a dialogue in groups.Each one writes down a time and talk about the time and where to go Consolidation: Workbook p27-30 Homework: Listen and read.Dictation.Lesson 5 Language skills: Listening: Locate specific information in response to proper expressions: Speaking: Using the learned phrases to communicate with other learners.Writing: The learned words and sentences in Unit7.The learning materials: ______________________________________________________________________________________________________________ The learning course: Pre-task preparation: 1.Free talk: invite some students to say.2.Revision Revision
Look and march:
6:30a.m
go to bed
7:10a.m
watch TV
7:20a.m
have breakfast
9:00a.m
have lunch
11:30a.m
go home
4:40p.m
get up
5:30p.m
play a game
8:00p.m
have a supper
9:00p.m
go to bed
Look and do pair work.What’s the time? It’s….What time do you…?
While-task procedure: 1.Look and read P58 a.Read by oneself.b.Invite to read.c.Find out which picture is the funniest.Why? 2.Learn to sing a song.a.Learn to say the sentences.b.Practise the reading by adding actions.c.Learn to sing the song line by line.d.Practise the singing in groups.e.Invite some groups to sing.Post-task activity: Make a new song.Divide the students to make a new song.Encourage the students to make a new song.Enjoy the new songs.Consolidation: 1.Finish the workbook.2.Dictation.Homework: Listen and read.Dictation.
第三篇:sqlldr使用小结
sqlldr使用小结
sqlldr userid=lgone/tiger control=a.ctl
LOAD DATA
INFILE ’t.dat’ // 要导入的文件
// INFILE ’tt.date’ // 导入多个文件
// INFILE * // 要导入的内容就在control文件里 下面的BEGINDATA后面就是导入的内容
INTO TABLE table_name // 指定装入的表
BADFILE ’c:\bad.txt’ // 指定坏文件地址
************* 以下是4种装入表的方式
APPEND // 原先的表有数据 就加在后面
// INSERT // 装载空表 如果原先的表有数据 sqlloader会停止 默认值
// REPLACE // 原先的表有数据 原先的数据会全部删除
// TRUNCATE // 指定的内容和replace的相同 会用truncate语句删除现存数据
************* 指定的TERMINATED可以在表的开头 也可在表的内部字段部分
FIELDS TERMINATED BY ’,’ OPTIONALLY ENCLOSED BY ’“’
// 装载这种数据: 10,lg,”“"lg”“",”lg,lg“
// 在表中结果: 10 lg ”lg“ lg,lg
// TERMINATED BY X ’0Array’ // 以十六进制格式 ’0Array’ 表示的// TERMINATED BY WRITESPACE // 装载这种数据: 10 lg lg
TRAILING NULLCOLS ************* 表的字段没有对应的值时允许为空
************* 下面是表的字段
(col_1 , col_2 ,col_filler FILLER // FILLER 关键字 此列的数值不会被装载
// 如: lg,lg,not 结果 lg lg)
// 当没声明FIELDS TERMINATED BY ’,’ 时
//(// col_1 [interger external] TERMINATED BY ’,’ ,// col_2 [date ”dd-mon-yyy“] TERMINATED BY ’,’ , // col_3 [char] TERMINATED BY ’,’ OPTIONALLY ENCLOSED BY ’lg’
//)
// 当没声明FIELDS TERMINATED BY ’,’用位置告诉字段装载数据
//(// col_1 position(1:2),// col_2 position(3:10),// col_3 position(*:16), // 这个字段的开始位置在前一字段的结束位置
// col_4 position(1:16),// col_5 position(3:10)char(8)// 指定字段的类型
//)
BEGINDATA // 对应开始的 INFILE * 要导入的内容就在control文件里
10,Sql,what
20,lg,show
=======================================
//////////// 注意begindata后的数值前面不能有空格***** 普通装载
LOAD DATA
INFILE *
INTO TABLE DEPT
REPLACE
FIELDS TERMINATED BY ’,’ OPTIONALLY ENCLOSED BY ’”’
(DEPTNO,DNAME,LOC)
BEGINDATA
10,Sales,“"”USA“"”
20,Accounting,“Virginia,USA”
30,Consulting,Virginia
40,Finance,Virginia
50,“Finance”,“",Virginia // loc 列将为空
60,”Finance“,Virginia // loc 列将为空***** FIELDS TERMINATED BY WHITESPACE 和 FIELDS TERMINATED BY x’0Array’ 的情况
LOAD DATA
INFILE *
INTO TABLE DEPT
REPLACE
FIELDS TERMINATED BY WHITESPACE
--FIELDS TERMINATED BY x’0Array’
(DEPTNO,DNAME,LOC)
BEGINDATA Sales Virginia ***** 指定不装载那一列
LOAD DATA
INFILE *
INTO TABLE DEPT
REPLACE
FIELDS TERMINATED BY ’,’ OPTIONALLY ENCLOSED BY ’”’
(DEPTNO,FILLER_1 FILLER, // 下面的 “Something Not To Be Loaded” 将不会被装载
DNAME,LOC)
BEGINDATA
20,Something Not To Be Loaded,Accounting,“Virginia,USA” ***** position的列子
LOAD DATA
INFILE *
INTO TABLE DEPT
REPLACE
(DEPTNO position(1:2),DNAME position(*:16), // 这个字段的开始位置在前一字段的结束位置
LOC position(*:2Array),ENTIRE_LINE position(1:2Array))
BEGINDATA
10Accounting Virginia,USA
***** 使用函数 日期的一种表达 TRAILING NULLCOLS的使用
LOAD DATA
INFILE *
INTO TABLE DEPT
REPLACE
FIELDS TERMINATED BY ’,’
TRAILING NULLCOLS // 其实下面的ENTIRE_LINE在BEGINDATA后面的数据中是没有直接对应
// 的列的值的 如果第一行改为
10,Sales,Virginia,1/5/2000, 就不用TRAILING NULLCOLS了
(DEPTNO,DNAME “upper(:dname)”, // 使用函数
LOC “upper(:loc)”,LAST_UPDATED date ’dd/mm/yyyy’, // 日期的一种表达方式 还有’dd-mon-yyyy’ 等
ENTIRE_LINE “:deptno||:dname||:loc||:last_updated”)
BEGINDATA
10,Sales,Virginia,1/5/2000
20,Accounting,Virginia,21/6/1ArrayArrayArray 30,Consulting,Virginia,5/1/2000
40,Finance,Virginia,15/3/2001 ***** 使用自定义的函数 // 解决的时间问题
create or replace
function my_to_date(p_string in varchar2)return date
as
type fmtArray is table of varchar2(25);
l_fmts fmtArray := fmtArray(’dd-mon-yyyy’, ’dd-month-yyyy’,’dd/mm/yyyy’,’dd/mm/yyyy hh24:mi:ss’);
l_return date;
begin
for i in 1..l_fmts.count
loop
begin
l_return := to_date(p_string, l_fmts(i));
exception
when others then null;
end;EXIT when l_return is not null;
end loop;
if(l_return is null)
then
l_return :=
new_time(to_date(’01011Array70’,’ddmmyyyy’)+ 1/24/60/60 *
p_string, ’GMT’, ’EST’);
end if;
return l_return;
end;
/
LOAD DATA
INFILE *
INTO TABLE DEPT
REPLACE
FIELDS TERMINATED BY ’,’
TRAILING NULLCOLS
(DEPTNO, DNAME “upper(:dname)”,LOC “upper(:loc)”,LAST_UPDATED “my_to_date(:last_updated)” // 使用自定义的函数)
BEGINDATA
10,Sales,Virginia,01-april-2001
20,Accounting,Virginia,13/04/2001
30,Consulting,Virginia,14/04/2001 12:02:02
40,Finance,Virginia,Array872682Array7
50,Finance,Virginia,02-apr-2001
60,Finance,Virginia,Not a date ***** 合并多行记录为一行记录
LOAD DATA
INFILE *
concatenate 3 // 通过关键字concatenate 把几行的记录看成一行记录
INTO TABLE DEPT
replace
FIELDS TERMINATED BY ’,’
(DEPTNO, DNAME “upper(:dname)”,LOC “upper(:loc)”,LAST_UPDATED date ’dd/mm/yyyy’)
BEGINDATA
10,Sales, // 其实这3行看成一行 10,Sales,Virginia,1/5/2000
Virginia,1/5/2000
// 这列子用 continueif list=“,” 也可以
告诉sqlldr在每行的末尾找逗号 找到逗号就把下一行附加到上一行
LOAD DATA
INFILE *
continueif this(1:1)= ’-’ // 找每行的开始是否有连接字符-有就把下一行连接为一行
// 如-10,Sales,Virginia,// 1/5/2000 就是一行 10,Sales,Virginia,1/5/2000
// 其中1:1 表示从第一行开始 并在第一行结束 还有continueif next 但continueif list最理想
INTO TABLE DEPT replace
FIELDS TERMINATED BY ’,’
(DEPTNO,DNAME “upper(:dname)”,LOC “upper(:loc)”,LAST_UPDATED date ’dd/mm/yyyy’)
BEGINDATA // 但是好象不能象右面的那样使用
-10,Sales,Virginia,-10,Sales,Virginia,1/5/2000 1/5/2000
-40, 40,Finance,Virginia,13/04/2001
Finance,Virginia,13/04/2001 ***** 载入每行的行号
load data
infile *
into table t
replace
(seqno RECNUM //载入每行的行号
text Position(1:1024))
BEGINDATA fsdfasj //自动分配一行号给载入 表t 的seqno字段 此行为 1
fasdjfasdfl // 此行为 2...Array ***** 载入有换行符的数据
注意: unix 和 windows 不同 \\n & /n
< 1 > 使用一个非换行符的字符
LOAD DATA
INFILE *
INTO TABLE DEPT
REPLACE
FIELDS TERMINATED BY ’,’
TRAILING NULLCOLS
(DEPTNO,DNAME “upper(:dname)”,LOC “upper(:loc)”,LAST_UPDATED “my_to_date(:last_updated)”,COMMENTS “replace(:comments,’\n’,chr(10))” // replace 的使用帮助转换换行符)
BEGINDATA
10,Sales,Virginia,01-april-2001,This is the Sales\nOffice in Virginia
20,Accounting,Virginia,13/04/2001,This is the Accounting\nOffice in Virginia
30,Consulting,Virginia,14/04/2001 12:02:02,This is the Consulting\nOffice in Virginia
40,Finance,Virginia,Array872682Array7,This is the Finance\nOffice in Virginia
< 2 > 使用fix属性
LOAD DATA
INFILE demo17.dat “fix 101”
INTO TABLE DEPT
REPLACE
FIELDS TERMINATED BY ’,’
TRAILING NULLCOLS
(DEPTNO,DNAME “upper(:dname)”,LOC “upper(:loc)”,LAST_UPDATED “my_to_date(:last_updated)”,COMMENTS)
demo17.dat 10,Sales,Virginia,01-april-2001,This is the Sales
Office in Virginia
20,Accounting,Virginia,13/04/2001,This is the Accounting
Office in Virginia
30,Consulting,Virginia,14/04/2001 12:02:02,This is the Consulting
Office in Virginia
40,Finance,Virginia,Array872682Array7,This is the Finance
Office in Virginia
// 这样装载会把换行符装入数据库 下面的方法就不会 但要求数据的格式不同
LOAD DATA
INFILE demo18.dat “fix 101”
INTO TABLE DEPT
REPLACE
FIELDS TERMINATED BY ’,’ OPTIONALLY ENCLOSED BY ’“’
TRAILING NULLCOLS
(DEPTNO, DNAME ”upper(:dname)“,LOC ”upper(:loc)“,LAST_UPDATED ”my_to_date(:last_updated)“,COMMENTS)
demo18.dat
10,Sales,Virginia,01-april-2001,”This is the Sales
Office in Virginia“
20,Accounting,Virginia,13/04/2001,”This is the Accounting
Office in Virginia“
30,Consulting,Virginia,14/04/2001 12:02:02,”This is the Consulting
Office in Virginia“
40,Finance,Virginia,Array872682Array7,”This is the Finance
Office in Virginia“
< 3 > 使用var属性
LOAD DATA
INFILE demo1Array.dat ”var 3“
// 3 告诉每个记录的前3个字节表示记录的长度 如第一个记录的 071 表示此记录有 71 个字节
INTO TABLE DEPT
REPLACE
FIELDS TERMINATED BY ’,’
TRAILING NULLCOLS
(DEPTNO,DNAME ”upper(:dname)“,LOC ”upper(:loc)“,LAST_UPDATED ”my_to_date(:last_updated)“,COMMENTS)
demo1Array.dat
07110,Sales,Virginia,01-april-2001,This is the Sales
Office in Virginia
07820,Accounting,Virginia,13/04/2001,This is the Accounting
Office in Virginia
08730,Consulting,Virginia,14/04/2001 12:02:02,This is the Consulting
Office in Virginia
07140,Finance,Virginia,Array872682Array7,This is the Finance
Office in Virginia
< 4 > 使用str属性
// 最灵活的一中 可定义一个新的行结尾符 win 回车换行 : chr(13)||chr(10)
此列中记录是以 a|\r\n 结束的select utl_raw.cast_to_raw(’|’||chr(13)||chr(10))from dual;
结果 7C0D0A
LOAD DATA
INFILE demo20.dat ”str X’7C0D0A’“
INTO TABLE DEPT
REPLACE
FIELDS TERMINATED BY ’,’
TRAILING NULLCOLS
(DEPTNO,DNAME ”upper(:dname)“,LOC ”upper(:loc)“,LAST_UPDATED ”my_to_date(:last_updated)",COMMENTS)
demo20.dat 10,Sales,Virginia,01-april-2001,This is the Sales
Office in Virginia|
20,Accounting,Virginia,13/04/2001,This is the Accounting
Office in Virginia|
30,Consulting,Virginia,14/04/2001 12:02:02,This is the Consulting
Office in Virginia|
40,Finance,Virginia,Array872682Array7,This is the Finance
Office in Virginia|
================================
象这样的数据 用 nullif 子句
10-jan-200002350Flipper seemed unusually hungry today.10510-jan-20000ArrayArray45Spread over three meals.id position(1:3)nullif id=blanks // 这里可以是blanks 或者别的表达式
// 下面是另一个列子 第一行的 1 在数据库中将成为 null
LOAD DATA INFILE *
INTO TABLE T
REPLACE
(n position(1:2)integer external nullif n=’1’,v position(3:8))
BEGINDATA 10
20lg
-----------------------------
第四篇:GridCtrl使用小结
http://www.xiexiebang.com/
GridCtrl使用详解
CGridCtrl类主要是通过grid样式显示数据 在单文档中的使用方法
步骤一 初始化 在CView类的.h头文件中包含文件:
#include “Gridctrl.h” 并且手写加入如下的成员函数:
CGridCtrl * m_pGridCtrl;步骤二 构造与析构 构造函数中:
m_pGridCtrl = NULL;析构函数中:
if(m_pGridCtrl)
delete m_pGridCtrl;步骤三 如果需要打印功能的话添加同名打印函数代码 在CView类的OnBeginPrinting()函数中添加如下代码: if(m_pGridCtrl)
m_pGridCtrl->OnBeginPrinting(pDC,pInfo);//简单吧,这就是类的好处其它两个打印函数也一样的做法.步骤四 在OnInitaUpdate()函数中或者你自己添加的要显示Grid的消息函数中如下初始化: //创建非模式对话框 CDlg *dlg;dlg=new CDlg();dlg->Create(IDD_Dlg,this);
//初始化GridCtrl控件 if(m_pGridCtrl!=NULL){ deletem_pGridCtrl;m_pGridCtrl=NULL;} if(m_pGridCtrl == NULL){ // Create the Gridctrl object m_pGridCtrl = new CGridCtrl;if(!m_pGridCtrl)return 0;// Create the Gridctrl window CRectrect;GetClientRect(rect);m_pGridCtrl->Create(rect, this, 100);// fill it up with stuff m_pGridCtrl->SetEditable(false);m_pGridCtrl->SetTextBkColor(RGB(0xFF, 0xFF, 0xE0));//黄色背景 m_pGridCtrl->EnableDragAndDrop(false);try { m_pGridCtrl->SetRowCount(k);//设置行数为k行 m_pGridCtrl->SetColumnCount(4);//k列
m_pGridCtrl->SetFixedRowCount(1);//标题行为一行
http://www.xiexiebang.com/
m_pGridCtrl->SetFixedColumnCount(1);//同上 } catch(CMemoryException* e){ e->ReportError();e->Delete();return 0;} //填充列标题 int row=0;for(int col=0;col<4;col++){ GV_ITEM Item;Item.mask = GVIF_TEXT|GVIF_FORMAT;Item.row = row;Item.col = col;if(col==0){ Item.nFormat = DT_CENTER|DT_WORDBREAK;Item.strText.Format(_T(“【类别】”),col);} else if(col==1){ Item.nFormat = DT_LEFT|DT_WORDBREAK;Item.strText.Format(_T(“第一列”),col);} else if(col==2){ Item.nFormat = DT_LEFT|DT_WORDBREAK;Item.strText.Format(_T(“第二列”),col);} m_pGridCtrl->SetItem(&Item);} // fill rows/cols with text for(row = 1;row < k;row++)for(col = 0;col < h;col++){ GV_ITEM Item;Item.mask = GVIF_TEXT|GVIF_FORMAT;Item.row = row;Item.col = col;if(col < 1){ //行标题头
Item.nFormat = DT_CENTER|DT_VCENTER |DT_SINGLELINE|DT_END_ELLIPSIS |DT_NOPREFIX;Item.strText.Format(_T(“%d”),row);
http://www.xiexiebang.com/
} else if(col==1){ //第一列的值 Item.nFormat = DT_CENTER|DT_VCENTER |DT_SINGLELINE|DT_END_ELLIPSIS |DT_NOPREFIX;str=“aa”;Item.strText.Format(_T(“%s”),str);}else if(col==2){ //第二列第值 Item.nFormat = DT_CENTER|DT_VCENTER |DT_SINGLELINE|DT_END_ELLIPSIS |DT_NOPREFIX;CStringstr;str=“bb”;Item.strText.Format(_T(“%s”),str);} m_pGridCtrl->SetItem(&Item);} m_pGridCtrl->AutoSize();
//--------------设置行列距------------------for(int a=1;a
步骤五: 添加WM_SIZE消息,调整控件的界面占屏幕大小
if(m_pGridCtrl->GetSafeHWnd())
{
CRectrect;
GetClientRect(rect);
m_pGridCtrl->MoveWindow(rect);
}
在对话框中的使用方法 步骤一 创建数据显示表格对话框
在资源管理器中新创建一个对话框,假设为CDlgTestReportBox。从工具箱中加入Custom Control,就是人头像的那个,将其区域拉伸至要显示数据表格的大小,充满整个对话框。
在CDlgTestReportBox类的头文件中: #include “GridCtrl.h”
http://www.xiexiebang.com/
再定义成员变量: CGridCtrl* m_pGrid;添加OnShowWindow()消息处理函数如下:
voidCDlgTestReportBox::OnShowWindow(BOOL bShow, UINT nStatus){ CDialog::OnShowWindow(bShow, nStatus);// TODO: Add your message handler code here if(m_pGrid!=NULL){ deletem_pGrid;m_pGrid=NULL;} if(m_pGrid==NULL){ m_pGrid=new CGridCtrl;CRectrect;GetDlgItem(IDC_ReportAera)->GetWindowRect(rect);//得到显示区域 ScreenToClient(&rect);m_pGrid->Create(rect,this,100);m_pGrid->SetEditable(false);m_pGrid->SetTextBkColor(RGB(0xFF, 0xFF, 0xE0));//黄色背景 try { m_pGrid->SetRowCount(10);//初始为10行
m_pGrid->SetColumnCount(11);//初始化为11列 m_pGrid->SetFixedRowCount(1);//表头为一行 m_pGrid->SetFixedColumnCount(1);//表头为一列 } catch(CMemoryException* e){ e->ReportError();e->Delete();// return FALSE;} for(int row = 0;row
http://www.xiexiebang.com/
{ Item.nFormat = DT_CENTER|DT_WORDBREAK;Item.szText.Format(_T(“报表显示”),col);} else if(row < 1)//设置0行表头显示 { Item.nFormat = DT_CENTER|DT_WORDBREAK;Item.szText.Format(_T(“ 项目%d”),col);} else if(col < 1)//设置0列表头显示 { if(row
步骤二 嵌入上面的对话框 显示数据
在你需要显示数据的对话框上的头文件中,假设为CDlgTest,加入 #include ”GridCtrl.h“ CDlgTestReportBox* m_pTestReportBox;将数据显示对话框放入你的对话框相应位置上,在CDlgTest::OnInitDialog()中:
if(!m_pTestReportBox){
m_pTestReportBox=new CDlgTestReportBox(this);} m_pTestReportBox->Create(IDD_DlgTestReportBox,this);
http://www.xiexiebang.com/
//定义区域变量 CRectrectDraw;GetDlgItem(IDC_AeraReport)->GetWindowRect(rectDraw);ScreenToClient(&rectDraw);//动态测试数据显示区域rectDraw //将对应的对话框放到指定区域 m_pTestReportBox->MoveWindow(rectDraw);m_pTestReportBox->ShowWindow(SW_SHOW);自定义填充数据的函数:CDlgTest::FillGrid()如下: CGridCtrl* pGrid=m_pTestReportBox->m_pGrid;for(int row = pGrid->GetRowCount()-1;row >= pGrid->GetRowCount()-3;row--){ for(int col = 1;col <= pGrid->GetColumnCount();col++){ GV_ITEM Item;Item.mask = GVIF_TEXT|GVIF_FORMAT;Item.row = row;Item.col = col;if(row==pGrid->GetRowCount()-3&&col>0)//平均值 { if(col==10){ Item.nFormat = DT_CENTER|DT_WORDBREAK;Item.szText.Format(_T(” %6.2f “),avjch);} else{ Item.nFormat = DT_CENTER|DT_WORDBREAK;Item.szText.Format(_T(” %6.2f “),av[col-1]);} } pGrid->SetItem(&Item);//提交数据 if(row==0||col==0){ COLORREF clr = RGB(0, 0, 0);pGrid->SetItemBkColour(row, col, clr);pGrid->SetItemFgColour(row, col, RGB(255,0,0));} }//循环结束
pGrid->Invalidate();} CGRIFCTRL原理:
DBGRID和一般的GRID的不同之处在于,一般的GRID并不适合显示大的数据量,如果一个表中有上万条记录都要插入到GRID中,这将是一个很慢的过程,并且在GRID中移动滚动条时,它的记录的滚动也是很慢。而DBGRID并不会真正把这些记录的数据全部插入到控件中,当DBGRID的滚动条滚动时,它会根据DBGRID的显示面积的大小和查询得到的总记录数计算出当前应该显示哪些行,然后插入
http://www.xiexiebang.com/
到表格中,这样一来,速度肯定快,而且没有数据量多少的限制。幸运的是,CGridCtrl类已经为我们提供了这种机制,它是采用虚模式实现的。使用这种方式,即使你向这个该控件插入一百万条数据,它并不会真的生成一百万行,而是随着你的滚动条的滚动,计算出在屏幕上要显示的行和列,然后会向你提供一个接口,通过这个接口,你可以在这儿设置你要显示的数据。下面给出使用CGridCtrl控件的虚模式的步骤: 步骤一 初始化
在视图的初始化函数里添加如下代码:
void SetVirtualMode(TRUE)
设为虚模式
BOOL SetRowCount(intnRows)
设置总的行数。
BOOL SetFixedRowCount(intnFixedRows = 1)
设置固定的行数据 BOOL SetColumnCount(intnCols)
设置列数 BOOL SetFixedColumnCount(intnFixedCols = 1)设置固定的列数 步骤二 响应消息 显示数据
我们假设CGridCtrl是放在单文档视图中,而且它关联的变量是m_GridCtrl,利用ClassWizard添加视图的OnNotify响应函数。这个响应函数的写法是固定的,类似下面的代码:
BOOL CGridCtrlTestView::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult){ if(wParam ==(WPARAM)m_Grid.GetDlgCtrlID()){ *pResult = 1;GV_DISPINFO *pDispInfo =(GV_DISPINFO*)lParam;if(GVN_GETDISPINFO == pDispInfo->hdr.code){ //这是添加的函数,在这个函数里设置当前要显示的数据 SetGridItem(pDispInfo);return TRUE;} } returnCGridCtrlTestView::OnNotify(wParam, lParam, pResult);} 在上面的代码中,SetGridItem(pDispInfo)是添加的函数,在这个函数里我们设置当前要显示的数据。pDispInfo是一个GV_DISPINFO的结构体对象,它包含了每个单元格的信息,如行号,列号,有没有位图,背景色,前景色等。CGRIDCTRL会把当前要显示那个单元格行号,列号传递给我们,我们只要设置里面显示的数据就可以了。如下面是一个显示数据的例子。
voidCGridCtrlTestView::SetGridItem(GV_DISPINFO *pDispInfo){
pDispInfo->item.strText.Format(”row%d,col%d",pDispInfo->it
http://www.xiexiebang.com/
em.row, pDispInfo->item.col);}
第五篇:git使用小结
git使用小结
1.git-config 配置git,一般需要配置的是user.name,user.email,有时sendemail.smtpserver也要配置,比如,我使用msmtp:
git-config –global sendemail.smtpserver /usr/local/bin/msmtp 如果你仅仅是想给这一个项目配置,把–global选项去掉。查看配置的选项是–list。2.git-pull git-pull没必要带后面那长长的url(-_-b 我那么用了好多次,不过我用的是!git-pull)。如果你在给Linux内核这样的项目工作,记得git-pull之前检查是不是在master分支。3.git-format-patch 如果发送多于一个补丁,最好用[PATCH n/m]的形式,加上-n。加signed-off-by那行是-s。指定为几次commit生成补丁,直接加数字,比如,$ git-format-patch-3 检查补丁是–check,最好加上这个。4.git-send-email 如果一次提交补丁比较多,最好用–no-chain-reply-to,因为如果不用的话,在thread嵌套会太深,不利于别人阅读。这个也可以通过选项sendemail.chainreplyto来控制。–signed-off-by-cc,要加上,可以省去手工处理的麻烦。–compose用来编辑[PATCH 0/m],这个一般是对整个patchset的描述。–smtp-server,如果你不想用git-config指定的话,用它也行。–cc和–to就不用说了。5.git-commit 在git-commit之前最好git-add。git-commit几个常用的选项有:-s 会增加Signed-off-by行,-e编辑commit message,-a表示all,-m是指定commit信息。同样,删除文件是先git-rm。查看commit列表用git-rev-list,查看某个commit用git-show,查看commit的日志用git-log,-p是以补丁的形式查看。6.其它 git-diff也可以比较不同版本之间的差异,某个版本的某个文件的差异,如: $ git-diff v2.6.22 $ git diff v2.6.20 init/main.c $ git-diff v2.6.23 v2.6.24-rc1 init/main.c git-whatchanged也差不多: $ git-whatchanged-p init/main.c 7.错误提交了commit怎么办? a)git-revert 这个本身就会产生一个commit,如果用得多了会让你的log看起来不那么干净。;-)b)git-reset 用这个要当心,它会把那个commit之后的commit全部删除。一个好的办法是:先建立一个临时的分支,然后再git-reset,再git-rebase,最后再删除临时的分支。详细可以看这里。