某储备粮的“学习笔记”

by 咳嗽di小鱼

Definitions

  • Database: is a large and persistent collection of pieces of information organized in a way that facilitate efficient retrieval and modification.
  • DBMS: is a program that manages details related to storage and access for a database.
  • Schema: is a description of the data interface to the database.
  • Instance: is a database that conforms to a given schema.
  • Transaction: is an application-specified atomic and durable unit of work.
  • View: is a relation in the external schema whose instance is determined by the instances of the relations in the conceptual schema.
  • Trigger: is a procedure executed by the database in response to a change to the database instance

Three Level Schema Architecture

  • External schema (view): visualized data
  • Conceptual schema: logical structure
  • Physical schema: file/storage devices

Data Independence

  • Application access the data through an abstract data model provided by the DBMS, rather than direct access
  • Physical: applications cant touch the storage stucture
  • Logical: applications cant change the data organization

Four Transaction Properties

NoSQL据说就是要break these properties= =`IDK why...

  • Atomic: once the transaction happens, it happened. No intermediate stage!
  • Consistency: transaction follows the database consitences
  • Isolated: concurrent transactions wont effect each other
  • Durable: transaction results permanently

What DBMS do

  • Remoce common code from applications
  • Provide uniform access to data
  • Guarantee data integrity
  • manage concurrent access
  • Protect against system failure
  • Set access policies for data

SELECT

SELECT attribute-expression-list FROM relation-list [ WHERE condition ];

attribute-expression-list:

  • [relation-name.]attribute
  • [relation-name.]attribute [arithmatic computation] AS another name

    • i.e., E.Salary - 40000 AS SalaryDiff
  • CASE WHEN ... THEN ...
    ELSE ... END

    • i.e., CASE WHEN E.Salary < 40000 THEN 0
      ELSE E.Salary - 40000 END

relation-list:

  • list of table names
  • seperate by comma

condition:

  • arithmetic operation +, -, *, /
  • comparisions =, <>, <, <=, >. >=
  • logical connectives AND, OR, NOT
  • attribute IN (Q)
  • attribute NOT IN (Q)
  • attribute op SOME (Q)
  • attribute op ALL (Q)
  • EXISTS (Q)
  • NOT EXISTS (Q)
  • IS [NOT] NULL

Read more...


Java里一共提供了8种Layout Manager

  • BorderLayout
  • BoxLayout
  • CardLayout
  • FlowLayout
  • GridBagLayout
  • GridLayout
  • GroupLayout
  • SpringLayout

这其中最后两种是专门为GUI Builder设计的, 并不是很适合手动写, 我就没花时间研究, 但应该是这几种Layout Manager中, 灵活性最大的两种.

网上有人说GridBagLayout是手写UI时`功能最强大的Layout...可一般强大就是复杂的代名词, 我也把它跳过了= =`(好吧, 我确实比较懒, 但更主要是时间不够)

先说说基础,
给一个container设置Layout使用 .setLayout(LayoutManager) 这个方法.
针对不同的Layout, 添加component时候, .add()有时可能需要额外的参数

然后来说说我玩明白了的几种Layout

Read more...


XLib是X Window编程的基础Library, 使用时首先需要在文件头中

#include <X11/Xlib.h>

在绘制图形界面之前, 第一步要连接到一个Display. 就好比画画之前先要找到一张桌子或者画板, 你不能举着一张纸直接就往上泼墨...

// Open display 
Display* display; 
display = XOpenDisplay(""); 
if(!display){ 
    printf("Cannot open display\n"); 
    exit(-1); 
} 

Read more...


Step1: String -> Scanning (DFA) -> Tokens Scanner又叫Lexical analyzer或Lexer.

其目的在于, 将需要compile的源代码逐字读入compiler, 并将每一个符合"词汇命名规则(Lexical Syntax)"的字段转换成token存储.
换句话说, 就是一遍读, 一遍看每一个单词的拼写对不对. 对的就转成token, 拼错了就输出error.

作业中对应: A6 P4
(某些语言的compiler在Scanning之后还包含Preprocessing, 因为不在241讨论范围内, 不做解释)

Step2: Tokens -> Parsing(LL/LR) -> Intermediate Format (WLI)

Parsing又叫Syntactic Analysis.
其目的在于, 将token与token联系在一起, 并将他们的转换成符合一定规范的"中间格式", 一般是某种树状结构, 例如241中定义的WLI.

在Parsing过程中, 如果遇到不符合某种语言的"语法规则(Grammar)"时, 则输出error. 如果语法正确, 则输出对应格式.
简单说, 就是看的说的话是不是人话, 有没有缺个标点少个括号.
如果不是人话那就说明你该重新学语法去了.

作业中对应: A8 P4

Read more...