CSE116的学习笔记-Lec#8:Model of Execution live
Model of ExecutionLive Examples
Lecture QuestionQuestion: in a package named “execution”, implement the following classes:
Class Battery with:
A constructor that takes a variable named “charge” of type Int
Class Flashlight with:
A constructor that takes no parameters
When a new Flashlight is created, declare a state variable named “battery” of type Battery and set it to a new Battery with 5 charge (ie. Batteries included)
A method named “use” that takes no ...
CSE116的学习笔记-Lec#7:Model of Execution More Example
Model of Execution
More Memory Examples
Multiple Obejects on the heap1234def winBattle(character: PartyCharacter, xp: Int): Unit = { character.battlesWon += 1 character.experiencePoints += xp}
123456789101112131415161718def main(args: Array[String]): Unit = { // Add the value mobXP to the stack with a value of 20 val mbXP: Int = 20 // Add the value bossXP to the stack with a value of 100 val bossXP: Int = 100 // A new object of type PartyCharacter is created ...
CSE116的学习笔记-Lec#6:Model of Execution
Model of Execution
Interpretation v. Compliation
Interpretation
Code is read and executed one statement at a time
Compliation
Entire progeam is translated into another language
The translated code is interpreted
Interpretation
Python and JavaScript are interpreted languages
Run-time error are common
Program runs, but crashes when a line with an error is interpreted
This program runs without error
12345678910111213class RuntimeErrorExample: def _init_(self, in ...
CSE116的学习笔记-Lec#5:Object & Class
Objects
Objects have State and Behavior
State / Variables
Objects store their state in variables
[Vocab]Often called fields, member variables, or instance variable
Behavior / Functions
Objects contains functions that can depend on its state
[Vocab]When a function is part of an object it’s called a method
Object with State1234567891011object ObjectWithState { //state of the object var x: Int = 10 var y: Int = 7 //Behavior of the object def doubleX(): Unit = ...
EE202的学习笔记-Lec#1:Basic Components and Circuit Variables
EE-202Copy Right ©️ :Farah VandrevalaEE202LRA1:Circuit Analysis:220910582
Basic Components and Circuit VariablesCircuit Terminology
Electric: Mathematical model that approximates the behavior of a actual electical system.
Electric Charge(Q): Charge conservation gener governs the working of electrival circuits. Charge(Q),measured in Coulum (C)
Current(I): Rate of flow of change. measured in Ampere(A).i = dQ / dt = Q / t1A = 1C / 1S
Voltage(V) (Pot ...
CSE116的学习笔记-Lec#3:Scala Unit Testing
Unit TestingTesting
How do you know if your code is correct?
Submit to AutoLab?
Does not exist outside of class
Does not exist for your project
Recall1234567891011121314package exampleobject Conditional { def computeSize(input: Double): String = { val large: Double = 60.0 val medium: Double = 30.0 if (input >= large) { "large" } else if (input >= medium) { "medium" } else { ...
CSE116的学习笔记-Lec#2:Scala Basics cont'
Lecture #2 9/4授课时间:2020-09-04 13:50:00
Scala Basics cont’Scala Types
All values in Scala are objects
Objects contain variables and methods
No primitive values in Scala
Int
A whole number
32 bit representation
-2147483648 to 2147483648
values out side this range will overflow
12val a: Int = 27397129println(a)
Long
A whole number (like int)
64 bit representation
-9223372036854775808 to 9223372036854775808
Useful when you expect values that would overflow an Int
12val a: Long = 273971 ...
解决域名覆盖的问题
原因以我用GitHub.io搭我的博客为例,GitHub会生成一个CNAME文件来进行域名重定向。但是当你使用 hexo d指令是会导致建好的CNAME文件被覆盖 / 删除。这时你又要重新去生成CNAME文件,十分的繁琐。
解决方案问题也很好解决,既然hexo默认没有 CNAME 文件,那我们在本地生成一个 local CNAME 即可解决问题,步骤也非常的简单。
首先在终端cd到你的博客根目录,接着cd到 source 文件夹,
1cd source
输入以下指令生成CNAME文件:
1touch CNAME
创建完成后使用 vim 指令打开 CNAME文件,并输入你的自定义域名:
1vim CNAME
修改完 CNAME 文件保存退出即可,后续再使用 hexo d 时就不会出现这种情况。
CSE191的学习笔记
CSE-191 Discrete StructuresCopy right©️ : Andrew Hughes (SUNY at Buffalo)
Introduction to Propositional Logic (9/2 Lec#1)Outline
Propositional Logic
Propositions
Logical Operators
Truth Tables
The Foundations: Lagic and Proofs
Rules of logic specify the precise meanings of mathematical statements
Logic is the basis of all correct mathematical arguments (i.e.,proofs)
Important in all of CS and CEN:
Problem soving
Software engineering (requirements specification, verification)
Databases (r ...
Hexo博客搭建-如何在文章中插入图片
绝对路径在你的博客的根目录中,进入 source 文件夹,新建一个 image 文件夹。你可以将需要加载的图片统统放在这里,但是并不建议这么做,因为当文章多起来的时候就显得很乱,很难去整理。
1![](/images/xxx.jpg)
我一般是将主页的图片素材放入此文件夹,文章图片我更推荐下方操作。
相对路径这种方法是对每一个文章新建一个同名的文件夹,用于放入对该文章的素材,比较推荐。首先你需要修改你的 _config.yml,将 post_asset_folder 改为 true:
1post_asset_folder: true
后续创建新文章的时候就会生成同名文件夹,图片丢进去即可。需要注意的是,在使用此方法之前的文章需要你自己创建同名文件夹,系统并不会补上。