1
0
forked from SPC/spc-site

Work on language support

This commit is contained in:
Alexander Nozik 2023-01-08 15:58:20 +03:00
parent e636d70c51
commit a1baa33102
Signed by: altavir
GPG Key ID: B10A55DCC7B9AEBB
6 changed files with 58 additions and 47 deletions

View File

@ -23,19 +23,19 @@ language: en
## Courses in 2022-2023:
### [Scientific literature seminar](#)
*curated by [Aleksandr Svetlichnyi](team#svetlichnyi)*
*curated by [Aleksandr Svetlichnyi](${resolvePageRef("team")}#svetlichnyi)*
[Telegram](https://t.me/spc_seminar)
### [Statistical methods and data analysis](${resolvePageRef("education.stat-methods")})
*by [Alexander Nozik](team#nozik) and [Vladimir Palmin](team#palmin)*
*by [Alexander Nozik](team#nozik) and [Vladimir Palmin](${resolvePageRef("team.index")}#palmin)*
Actual program: [SPC-A-6](https://npm.mipt.ru/youtrack/articles/SPC-A-6)
[Telegram](https://t.me/mipt_statmethods)
### [Introduction to scientific programming in Kotlin](${resolvePageRef("education.kotlin")})
*by [Alexander Nozik](team#nozik)*
*by [Alexander Nozik](${resolvePageRef("team.index")}#nozik)*
Actual program: [SPC-A-6](https://npm.mipt.ru/youtrack/articles/SPC-A-6)
@ -47,7 +47,7 @@ Actual program: [SPC-A-6](https://npm.mipt.ru/youtrack/articles/SPC-A-6)
Actual program: [SPC-A-3](https://npm.mipt.ru/youtrack/articles/SPC-A-3)
### [Instruments of development](https://npm.mipt.ru/youtrack/articles/SPC-A-5)
*curated by [Alexander Nozik](team#nozik)*
*curated by [Alexander Nozik](${resolvePageRef("team.index")}#nozik)*
Actual program: [SPC-A-5](https://npm.mipt.ru/youtrack/articles/SPC-A-5)

View File

@ -9,11 +9,11 @@ language: en
Recording of lectures in 2019 is available [here](https://www.youtube.com/playlist?list=PL4_hYwCyhAvZzRpbK4iTy9S6_OWZNEiVk).
## Lecturer
[Alexander Nozik](${resolvePageRef("team")#nozik})
[Alexander Nozik](${resolvePageRef("team.index")}#nozik)
## Course purpose
As physics (and science in general) develops, computer methods are becoming more and more important in the daily work of a scientist. In conducting an experiment, computer methods and tools are used at all stages of the work: planning the experiment, preparing the installation, collecting data, processing and publishing it. In such a situation, the quality of the programs used is beginning to play an important role. In addition, there is a need for specialists who understand both science and programming and who develop and improve software tools.
As science develops, computer methods are becoming more and more important in the daily work of a scientist. In conducting an experiment, computer methods and tools are used at all stages of the work: planning the experiment, preparing the installation, collecting data, processing and publishing it. In such a situation, the quality of the programs used is beginning to play an important role. In addition, there is a need for specialists who understand both science and programming and who develop and improve software tools.
Most students (and scientists) are more or less familiar with the basic tools of a programmer, for example, writing simple programs in Python. This is not enough for serious scientific development, so the course aims at a more advanced understanding of hardware, program structure and modern development tools.
@ -26,17 +26,19 @@ As the main programming language we will use `Kotlin`, which appeared recently a
* Extensive community.
* Possibility of commercial use.
## Course format
## Format
In 2020, the course is held with the participation of JetBrains and the support of JetBrains Research. The most active students will have the opportunity to participate in summer internships at JetBrains. There is also an opportunity for senior students to do research at the MIPT Laboratory of Nuclear Physics Experiments Methods (participant of JetBrains Research) and at the JetBrains Moscow office.
The lessons are twice a week.
* One is a lecture at MIPT campus. Lectures are dedicated to Kotlin language features and specifics of its application to science and industry problems.
* The second one is practice. Practice is dedicated to work on students projects and additional material.
To get a mark student must complete 3 practical tasks during the semester. All tasks are accepted in form of Kotlin application of notebook and pass a code-review stage.
In this course we will learn to work in Kotlin language and apply it to scientific problems. We will focus on practical aspects and examples, so that no additional knowledge is needed to understand it. For practical examples we will use the development environment [IntelliJ IDEA Community Edition](https://www.jetbrains.com/idea/).
All questions related to the course will be discussed in telegram groups [@mipt-npm](https://t.me/mipt_npm) (scientific) and [Kotlin at MIPT](https://t.me/joinchat/EpV1201A_i0rTOCxHHnxXQ) (any questions about Kotlin).
All questions related to the course will be discussed in telegram [Kotlin at MIPT](https://t.me/kotlin_mipt).
All those wishing to participate should complete the [form](https://docs.google.com/forms/d/e/1FAIpQLSeNZT8B90pT6fM9oABHFbrtv6pKfoYKfO-ANAjLlgWynMnh_g/viewform).
## Course content
## Content
1. **From hard to soft**
1. Program as a set of instructions. Evolution of programs.
2. Memory structure. Segmentation fault.
@ -45,26 +47,22 @@ All those wishing to participate should complete the [form](https://docs.google.
5. Compilation and optimization.
6. Static and dynamic linking. Libraries.
7. Program structure. Entry points.
2. **The tools of the modern programmer**
1. Automatic build systems.
2. Version control systems.
3. Integrated development environments.
3. **Kotlin language**
2. **Kotlin language**
1. Variables, classes and objects.
2. Control flow. Procedural and functional approach.
3. Short circuits.
3. Loops.
4. Data structures and operations on them.
5. Properties and Delegates.
6. Parametric types.
7. Extensions.
8. Boxing.
9. Multiplatform projects
4. **Program Architecture**
9. Multiplatform projects.
3. **Program Architecture**
1. Abstractions and interfaces.
2. basics of collective development with the help of modern tools.
2. Basics of collective development with the help of modern tools.
3. Ideology of object programming. Separation of behavior.
4. Ideology of functional programming.
5. **Scientific programming**.
4. **Scientific programming**.
1. Basics of numerical methods. The concept of numerical accuracy. Complexity of algorithms.
2. Numerical differentiation and integration.
3. Random Number Generators and Monte Carlo Modeling.

View File

@ -1,4 +1,4 @@
kotlin.code.style=official
toolsVersion=0.13.1-kotlin-1.7.20
toolsVersion=0.13.3-kotlin-1.7.20
snarkVersion=0.1.0-dev-1

View File

@ -51,7 +51,6 @@ fun Application.spcModule() {
get("magprog"){
call.respondRedirect("education/masters")
}
}
}

View File

@ -3,9 +3,7 @@ package ru.mipt.spc
import html5up.forty.fortyScripts
import kotlinx.html.*
import space.kscience.dataforge.data.Data
import space.kscience.dataforge.meta.Meta
import space.kscience.dataforge.meta.get
import space.kscience.dataforge.meta.string
import space.kscience.dataforge.meta.*
import space.kscience.dataforge.names.Name
import space.kscience.dataforge.names.asName
import space.kscience.dataforge.names.startsWith
@ -53,16 +51,30 @@ context(WebPage) internal fun HTML.spcPageContent(
}
@Suppress("UNCHECKED_CAST")
internal val FortyDataRenderer: DataRenderer = { name, data ->
internal val FortyDataRenderer: DataRenderer = object : DataRenderer {
context(SiteBuilder)
override fun invoke(name: Name, data: Data<Any>) {
if (data.type == typeOf<HtmlFragment>()) {
data as Data<HtmlFragment>
page(name) {
spcPageContent(data.meta) {
val languageMeta: Meta = DataRenderer.buildLanguageMeta(name)
val dataMeta: Meta = if (languageMeta.isEmpty()) {
data.meta
} else {
data.meta.toMutableMeta().apply {
"language" put languageMeta
}
}
page(name, data.meta) {
spcPageContent(dataMeta) {
htmlData(data)
}
}
}
}
}
context(WebPage) private fun HTML.spcHome() {
@ -248,25 +260,26 @@ context(WebPage) private fun HTML.spcHome() {
}
}
}
fortyScripts()
}
}
internal fun SiteBuilder.spcHome(dataPath: Path, prefix: Name = Name.EMPTY) {
val homePageData = snark.readDirectory(dataPath.resolve("content"))
route(prefix, homePageData, setAsRoot = true) {
site(prefix, homePageData) {
file(dataPath.resolve("assets"))
file(dataPath.resolve("images"))
file(dataPath.resolve("../common"), "")
withLanguages(
"en" to "",
"ru" to "ru"
) {
page { spcHome() }
pages("consulting", dataRenderer = FortyDataRenderer)
//pages("ru.consulting".parseAsName(), dataRenderer = FortyDataRenderer)
pages("education", dataRenderer = FortyDataRenderer)
@ -278,5 +291,6 @@ internal fun SiteBuilder.spcHome(dataPath: Path, prefix: Name = Name.EMPTY) {
name.startsWith("projects".asName()) && meta["type"].string == "project"
}
}
}
}

View File

@ -302,7 +302,7 @@ internal fun SiteBuilder.spcMasters(dataPath: Path, prefix: Name = "education.ma
val magProgData: DataTree<Any> = snark.readDirectory(dataPath.resolve("content"))
route(prefix, magProgData, setAsRoot = true) {
site(prefix, magProgData) {
file(dataPath.resolve("assets"))
file(dataPath.resolve("images"))
file(dataPath.resolve("../common"), "")