practical copy Flashcards

(128 cards)

1
Q

Variable to store dates

A

DateTime

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Prefix for DateTime variable

A

t

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Methods for assigning date to DateTime variable

A

Convert from string
Convert from integer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Convert to DateTime from string

A

StrToDateTime(‘dd/mm/yyyy hh:mm:ss’);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Convert to DateTime from integer

A

EncodeDateTime(yyyy, mo, d, h, m, s);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Functions returning DateTime values

A

Yesterday - 00:00:00 of yesterday
Date - 00:00:00 of today
Tomorrow - 00:00:00 of tomorrow
Now - current date and time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How to do calculations with DateTime variable

A

Add/subtract number (or fractions of) DAYS to it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Functions performed on DateTime values

A

Type keywords (day, year, month, FormatSettings.Long) into ctrl+spacebar ; will usually return integer value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How to format DateTime

A

FormatDateTime(), for sFormat use letters : YMDH NSZ with - between

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How to declare an array

A

Array[first..last] of type;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Steps to working with TextFiles

A
  1. Declare logical file in variable
  2. Assign physical file to logical file
  3. Set logical file to correct state
  4. Use file
  5. Close file
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Declare file variable

A

fFile : TextFile

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Assign file

A

AssignFile(fFile, ‘’)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

States to set file to ***** include diff

A

Reset
Rewrite
Append

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Close file

A

CloseFile(fFile)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How to read from textfile

A

Reset
ReadLn(fFile, sOutput) - moves to next line

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

How to write to textfile

A

Rewrite/append
WriteLn(fFile, sInput) - moves to next line
Write(fFile, sInput) - doesn’t move to next line

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

How to loop through textfile

A

Eof(fFile)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Input and output of methods

A

Parameters and return values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Difference between function and procedure

A

Both accept parameters but only functions return a value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Declare procedure

A

procedure ProcedureName(parameterName : type);
ctrl+shift+C

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What do you use parameters as

A

Variable in method

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

How to use procedure

A

Type in name and input parameters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Declare function

A

function FunctionName(parameterName: type) : type;
Ctrl+shift+C

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
How to use function
Assign value to Result variable within method Type in name and input parameters and use result like assign it to variable or smth
26
Scope of methods and where to declare them
Declare after implementation BEFORE automatically created procedures Use global variables : frmForm.component to reference them
27
Dynamic user interface
Components created using code in runtime
28
Types of dynamic components
Visual Interactive
29
How to create non-interactive visual dynamic component
1. declare empty var of component's class (vVariable : TType) - in global var when in doubt 2. create component (component.create(parent - can say self)) assigned to said variable 3. use var (NOT COMPONENT) to assign values to prop of component - .PARENT FIRST (can be self)
30
how to insert image to be displayed
bitmap.createFromFile - string
31
what is an interactive component
has events during run time like onClick events
32
how to use interactive component
1. create as would visual component 2. declare procedure in public : add (Sender: TObject) - EXACTLY, dont change TObject to component 3. assign procedure name to event property of component
33
how to write data to a database (through code)
tables component methods: - append : adds record at end and selects it (NOT ADDS VALUE TO, DO AFTER - think of it as setting text file up to be used) - insert : adds record after currently selected and selects it NB! - POST!!! saves changes after data changed in db
34
how to add data to created record
table['fieldName'] := value; (puts into selected field) post OBVI
35
how to read data from table
1. select first record (tbl.first) 2. while loop to scroll through records till tbl.eof (EVEN THOUGH NOT A FILE HA) 3. read record - tbl['fieldName'] 4. go to next record (tbl.next)
36
WITH ALL THINGS OF USING TABLES REMEMBER!!!!!!!
put DBModule name before tblName OR IT WONT WORK you could even be a cool kid and use WITH dbmName do like a SUPER COOL KID
37
how to edit existing data in db
1. find + select record wanting to edit 2. set tbl to edit mode (tbl.Edit) 3. set new values as shown before 4. POST!!
38
how to find record in DB
tbl.Locate('fieldName', searchValue, []) - selects that record and do what you will with it after
39
generally with setting modes of tbl...
do right before doing it - like put tbl.edit right before editing ykyk - idk if this is actually a thing but i remember it once
40
what is a class
data type describing attributes and behaviour of object to be created from it (BLUEPRINT)
41
object
INSTANCE of the class - like a model formed from the blueprint
42
attributes
data fields of class (PROPERTIES)
43
behaviour
code providing interaction with attributes - INTERACTIONS with object made up of attributes, how can use attributes
44
encapsulation
grouping of attributes and behaviour into one entity (object of type class)
45
what is OOP used for?
1. independent isolated code 2. reusable code 3. improved integrity
46
how to declare a class
1. create unit file for class code type ClassName = class(optional baseClass) private declare attributes + private methods public declare public methods
47
access specifier
where accessible - private: inside class - protected: inside class / classes based on class - public: any program where class used - published: public but available in object inspector
48
remember for working with classes!
type class code in class unit!
49
types of class methods
getter (accessor) setter (mutator) constructor ToString other auxiliary (helper) methods
50
type double
real with more digits for fraction
51
class diagram
identity (name) attributes (state) name : type; methods (behaviour) declarations of methods in total forms encapsulation include private/public with -/+
52
after declared methods, what do?
ctrl+shift+C to make implementation of method
53
constructor method
INSTANTIATES (makes an instance of) object constructor keyword types of constructors: - default: sets attributes to default values > create; overload; ----- only do this if smth not working bc it just confuses things imo - manual: sets attributes to values > create(dataName : type); overload; (overloads default constructor) - declare default one first and put after with overload at end
54
constructor method implementation
Self.attribute := inputVarFromParameter
55
get method implementation
function result := attributeName can transform to more useful output - like toString or smth
56
set method implementation
self.attribute := InputVarParameterValue can include input validation or change form of input
57
auxiliary methods
just remember if function - use result keyword at end
58
ToString method implementation
function construct output string of representation of state of object assign to result
59
application of class
class declared as dataType in class unit on main unit 1. add class unit to uses 2. create variable of dataType of the class (instantiate object) AS GLOBAL VARIABLE under implementation 3. call methods of class THROUGH OBJECT VARIABLE - always use constructor create first to make object
60
what is a 2D array
array with 2 indices, each holding an array (row and column)
61
what do you use when working with a 2D array?
nested loop
62
why use a 2D array
data centralised data relationalised (totally a word)
63
what do indices represent
first (i) : row second (j) : column
64
syntax for 2D array
arrArray[index1, index2]
65
how to declare a 2D array
arrArray : array[1..i, 1..j] of type;
66
limitations of 2D array
same type set size of array - set way too big to initialise when in doubt
67
how to view 2D arrays when reading from or writing to them
treat as grid - not assigning 2 values and not assigning to 2 arrays - assigning ONE value to the jth spot of the ith array ykyk
68
how to get length of array in 2D array
length of 1st array (i): Length(arrArray) length of 2nd array (j): Length(arrArray[i]) length of 3rd array: Length(arrArray[i,i]);
69
what to do when want to work through row of 2D array
keep row index constant and loop through j
70
what to do when want to work with column of data
make second index constant and loop through first
71
first part of SQL statement
SELECT fieldName, fieldName FROM tableName
72
select all
*
73
only select unique values in field
SELECT DISTINCT fieldName FROM tblName
74
how to sort data in SQL statement
SELECT fieldName FROM tblName ORDER BY fieldName orderType types : ASC and DESC if multiple: field1 ASC, field2 DESC dont need to say ASC if ASC
75
how to select conditional data in SQL statement
SELECT * FROM tbl WHERE (logic statement)
76
SQL statement syntax
string in ''
77
what used in where clause when needing it to be more general
wildcards and the like operator
78
wildcards
represent any characters _ : one character (not none) %: zero/many characters
79
how use wildcards
put in string ALWAYS USE LIKE NOT =
80
how to combine conditions in WHERE clause
boolean operators - place in brackets!!
81
boolean operators
AND OR } between statements NOT - place after where
82
what else can be used in WHERE clause?
special SQL operators
83
special SQL operators
BETWEEN IN IS NULL IS NOT NULL
84
BETWEEN
WHERE fieldName BETWEEN min AND MAX selects all between, INCLUDING min and max values
85
IN
selects values that are in list WHERE fieldName IN (value1, value2, ..) REMEMBER IN BRACKETS
86
IS NULL
selects records with no value WHERE fieldName IS NULL
87
IS NOT NULL
selects records with values WHERE fieldName IS NOT NULL
88
how to use a date in a condition
surround with ## NOT '' not have to be in specific format - follow american ways though (eye roll)
89
how to use data of dates HA
date functions: YEAR(date) - int MONTH('') - int DAY('') - int DATE('') - returns todays date
90
what do you do if you wanna change value of data before displaying it
calculated field
91
how is a calculated field declared
same way as normal field SELECT calcField FROM tblName but rename it for aesthetics SELECT calcField FROM tblName AS calcFieldName
92
what is important to remember with AS
cannot reference AS name in later clauses - restate calcField!
93
what to use for calculations in calculated fields
mathematical operators functions > number > date > string
94
number functions to format calculated fields in SQL
INT ROUND STR FORMAT
95
INT
INT(field) - discards decimals
96
ROUND
ROUND(field, decimals) - self-explanatory
97
STR
STR(field) - returns DateTime or number as string
98
FORMAT
FORMAT(field, formatString) - returns DT or number as string in format
99
how to do formatString for FORMAT command in SQL statement
similar to delphi '0.00' '0.##' 'Currency' '0%'
100
keep in mind with date functions (previously covered) when working with calculated fields
can't use function keywords as name of calcField - e.g. AS Year
101
string functions for SQL
LEN LEFT RIGHT MID
102
LEN
LEN(string) - num chars
103
LEFT
LEFT(string, numChars) - returns indicated no of chars from start of string
104
RIGHT
opposite of LEFT
105
MID
MID(string, firstChar, chars) - returns no of chars from given point in string
106
how to combine strings
+
107
when formatting date
use abbreviations as placeholders ddmmyy hhnnss
108
what to use when want to answer question about overall dataset
aggregate functions
109
aggregate functions
SUM AVG MIN MAX COUNT
110
how to use aggregate functions
self explanatory functions NAME(fieldName) returns single value
111
how to aggregate functions relate to other fields
can't use alongside as only returns single value
112
what can you use to make aggregate functions look prettier
AS
113
how to get aggregate from multiple fields for comparison
GROUP BY
114
GROUP BY syntax
SELECT groupFieldName, aggFunc(field) AS aggfuncName FROM tbl GROUP BY groupFieldName NB - include field in select and at end!!
115
how to make a conditional statement on GROUP BY results
HAVING after GROUP BY condition
116
stompi for SQL statements
SDfFtOWGH
117
how to make changes to DB
INSERT INTO UPDATE DELETE
118
INSERT INTO
adds records INSERT INTO tblName (fieldNames) VALUES (values) - separate with values and in correct order/data type dont need to include field names if inserting all - ALWAYS ADD TO PK
119
insert multiple records into
INSERT INTO tbl (fieldNames) VALUES (values), (values), etc...
120
if no value for field in record
,,
121
DELETE
deletes records DELETE FROM tbl WHERE
122
UPDATE
changes value UPDATE tblName SET fieldName = value, fieldName = value ... WHERE - NB
123
ASCII space
32
124
ASCII 0
48
125
ASCII A
65
126
ASCII a
97
127
querying two tables
SELECT tbl1.fieldName, tbl2.fieldName FROM tbl1, tbl2 WHERE tbl1.FK = tbl2.PK link through where clause with keys
128
how to simplify two table queries
tbl AS M or smth and then M.