diff options
-rw-r--r-- | .trash/daily 2/17-May-2025.md | 3 | ||||
-rw-r--r-- | .trash/daily/23-Jun-2025.md | 0 | ||||
-rw-r--r-- | Item Size Position.md | 40 | ||||
-rw-r--r-- | Protocol Buffers - protobuf.dev.md | 20 | ||||
-rw-r--r-- | Quickshell.md | 101 | ||||
-rw-r--r-- | The Go Programming Language - A Donovan, B Kernighan - 2015.md | 27 |
6 files changed, 191 insertions, 0 deletions
diff --git a/.trash/daily 2/17-May-2025.md b/.trash/daily 2/17-May-2025.md new file mode 100644 index 0000000..0ff674d --- /dev/null +++ b/.trash/daily 2/17-May-2025.md @@ -0,0 +1,3 @@ +# Notes on go + +**Type assertion** diff --git a/.trash/daily/23-Jun-2025.md b/.trash/daily/23-Jun-2025.md new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/.trash/daily/23-Jun-2025.md diff --git a/Item Size Position.md b/Item Size Position.md new file mode 100644 index 0000000..2479688 --- /dev/null +++ b/Item Size Position.md @@ -0,0 +1,40 @@ +[[Quickshell]] + +--- + +# Item Size Position + +`Item` type is the base type for "visual items". It has two properties: +- actual size ( width, height ) +- implicit/desired size ( implicitWidth, implicitHeight ) + +Implicit size is used by containers to determine their own. + +## Container items + +Container (ie. `Item`): +```qml +implicitWidth: child.implicitWidth + margin * 2 +implicitHeight: child.implicitHeight + margin * 2 +``` + +^ `WrapperItem` does this margin for us. + +Child (ie. `Rectangle`): +```qml +x: parent.margin +y: parent.margin +width: parent.width - parent.margin * 2 +height: parent.height - parent.margin * 2 +implicitWidth: 50 +implicitHeight: 50 +``` +[Binding](https://doc.qt.io/qt-6/qml-qtqml-binding.html) can be used to map any property +[Anchors](https://doc.qt.io/qt-6/qtquick-positioning-anchors.html) are a shorthand way to achieve many common position and size bindings. + +Using a containers' Item.childrenRect to determine size of children is a mistake. +Item.childrenRect represents the actual geometry of all child items, not the mplicit one. + +Use [MarginWrapperManager](https://quickshell.org/docs/types/Quickshell.Widgets/MarginWrapperManager) to handle size and position of container and a single child item. + +## Layouts diff --git a/Protocol Buffers - protobuf.dev.md b/Protocol Buffers - protobuf.dev.md new file mode 100644 index 0000000..9bd83c6 --- /dev/null +++ b/Protocol Buffers - protobuf.dev.md @@ -0,0 +1,20 @@ +Protocol buffer messages are often loaded in to memory completely. So large data is not a good fit. Usually not more than a few MBs. + +The same data can have many different forms of binary serialization when it is serialized, therefore serialized data (messages) cannot be compared. + +Messages are not compressed. They can be compresses with zip/gzip but to obtain maximum compression use specialized compression algorithms such as ones used by JPEG/PNG. + +Protocol buffers are not maximally efficient for large multi-dimensional arrays or floating point numbers. + +Not well supported in non-object oriented languages. + +Protocol buffer messages require their schema to be interpreted correctly. + + +--- + +# Workflow +1. Write .proto schema +2. Generate code using `protoc` compiler +3. Compile generated protobuf code together with project +4. Use Protobuff classes to serialize, share and deserialize data
\ No newline at end of file diff --git a/Quickshell.md b/Quickshell.md new file mode 100644 index 0000000..c801fee --- /dev/null +++ b/Quickshell.md @@ -0,0 +1,101 @@ +[[Item Size Position]] + +--- + +# Quickshell + +https://quickshell.org + +XDG standard config paths. Looks for `shell.qml` in all sub-directories unless root dir has one. Target specific config using `quickshell -c configname`. + +## Windows +Requires `import Quickshell`. +Types: +- PanelWindow: for bars, widgets and overlays +- FloatingWindow: standard desktop windows + +[Type reference](https://quickshell.org/docs/types/Quickshell/PanelWindow) + +## Text +[Text](https://doc.qt.io/qt-6/qml-qtquick-text.html) requires `import QtQuick. +Set `id: somename` to reference by `somename`, ie `somename.text = "blaat"` + +Strings can be concat using `+` +## Processes +Requires `import Quickshell.Io` (NOTE the capital I in Io) + +[Process](https://quickshell.org/docs/types/quickshell.io/process) object runs commands. +[StdioCollector](https://quickshell.org/docs/types/Quickshell.Io/StdioCollector) reads process' output. + +Use a [Timer](https://doc.qt.io/qt-6/qml-qtqml-timer.html) to run Process on an interval. + +## Component +A reusable tree of objects. +[Variants](https://quickshell.org/docs/types/Quickshell/Variants) creates instances of a component based on user supplied data. For example this used to create instances of a window based on the monitor list. + +To prevent many of the same processes when we reuse a component many times use `Scope` to move them outside of the reused component. +We can use a [Property Definition](https://quickshell.org/docs/configuration/qml-overview/#property-definitions) on the parent scope to communicate between components in different scopes but in the same parent scope. Properties are reactive. + +## Objects +Properties + +`[required] [readonly] [default] property <type> <name>[: binding]` + +`id` is a special property that can be used to reference an object throughout the entire current file. Has to be lowercase. + + +Functions + +```qml +function <name>(<paramname>[: <type>][, ...])[: returntype] { + // multiline expression (note that `return` is required) +} +``` + +Can be invoked in expressions, reactivity is carried through -- so +if the argument value changes all expressions are re-evaluated. + +Lambas `() => ...` + + +## Multiple files +shell.qml is the root. If a filename starts with a capital letter it can be referenced. E.g Bar.qml +```qml +Scope { + Bar {} +} +``` + +Other folders can be imported using `import` statements. + +## Singleton +Has only one instance that is accessible from every scope. For example the date process in the bar. + +Set `pragma Singleton` at the top of the file ( before imports ). and Use `Singleton` type. + + +[Clock formatting](https://doc.qt.io/qt-6/qml-qtqml-qt.html#formatDateTime-method) + + +## Signals +Event emitter. +Same rules as properties and function. + +`signal <name>(<paramname>: <type>[, ...])` + +Objects have implict `on<Signal>` (note capital S) for each signal defined. + +Connections object can be used to access difficult to reach signal handlers, +such as those from Singletons. + +`Connections { target: id; function onClicked() # example target: button }` +Does that somehow override the onClicked function of the target?? + + +All properties have `propertynameChanged` handler, powering the reactivity. + + +## Attached objects +Every object has `Component` attached, used to run stuff when an Object finishes +initializes using `Component.onCompleted`. + diff --git a/The Go Programming Language - A Donovan, B Kernighan - 2015.md b/The Go Programming Language - A Donovan, B Kernighan - 2015.md new file mode 100644 index 0000000..f0c7389 --- /dev/null +++ b/The Go Programming Language - A Donovan, B Kernighan - 2015.md @@ -0,0 +1,27 @@ +Go compiles into native machine code. +Go handles Unicode natively thus any character can be used in a string. +Divided into packages, where a package is sort of a library, except for main which defines an executable. +Import declarations **must** follow the package declaration. +Function declarations: `func <name> (<param list>) (<result list>)`. No semicolons, unless multiple statements on 1 line. +`gofmt` mandatory. `goimports` (`golang.org/x/tools/cmd/goimports`) manages imports. +Slices are dynamically sized arrays that can be accessed `s[i]` or a subset can be taken `s[i:j]`. Indexing: half-open (starts at 0). `s[i:j]` yields i through j-1. Either can be omitted. + +Convention: comment describing package preceding package declaration. + +Variables initialised to "zero value".7689 +String concatenation via `+` char. +Supports assignment operators, e.g `+=`, `*=` etc +Short-hand variable declaration requires no type, it is inferred of the value `:=` **only allowed in a function** + +For-loop structure: +``` +for initialization; condition; post { + // code +} +``` +Either part can be left away with different semantics. +All parts gone: loop forever. +Only condition is like a while x == true; +`range` keyword to loop over a slice or array with `for index, arg := range slice` + +`_` is the blank identifier, thus above if we don' need the index we can put `_`. |