Zetteldeft
This document contains all the source code to a set of functions for emacs
which aim to extend the deft
package and turn it into a (very very) basic Zettelkasten note-taking system.
Check out the github repository to get the source. Read on for an introduction and some documentation.
Latest additions:
- 18 Dec: insert not yet included links with
zd-insert-list-links-missing
. - 15 Nov: open link in other window with
zd-avy-file-search-ace-window
. - 13 Nov: functions to create
graphviz
added. - 4 Nov:
zd-all-tags
andzd-tag-buffer
find all tags - 21 Oct:
zetteldeft
is now a package. - 10 Oct: Insert contents of files with given search term with
zd-org-search-insert
. - 24 Sep: Count the total number of words in your zetteldeft with
zd-count-words
. - 18 July: Include a list of links with
zd-insert-list-links
, or a list of files withzd-org-search-include
.
1 What?
1.1 A Zettelkasten system for emacs
based on deft
This is my feeble attempt at recreating a Zettelkasten environment by extending the excellent deft
package in emacs
.1
I call it zetteldeft.
It is inspired by the The Archive app. For this and more on the Zettelkasten way of taking notes, see zettelkasten.de. They have a forum for discussion on both software and the specifics of the Zettelkasten philosophy.
The code that follows is created and maintained for my personal use, shared here in hope that it can benefit others as well. I’d be happy to learn how you use it and expand upon it.

Anyway, here we go.
1.2 How to use this source
This package requires:
deft
, obviouslyavy
to jump & search
From the github repository, either
- download the
org-file
andorg-tangle
it yourself. It should contain everything. - or download the
zetteldeft.el
file.
Whichever way you go, load up the package by adding the package to your load path and requiring:
(add-to-list 'load-path "~/path/to/folder/")) (require 'zetteldeft)
Or, if you use use-package
, do something like:
(use-package zetteldeft :load-path "~/git/zetteldeft/" :after deft)
and you’re good to go!
Well, not quite. First you must read on about the basics of zetteldeft
.
1.3 Basic concepts
Notes reside in the deft-directory
.
Notes are written in org-mode
syntax (although most functions should work in markdown
as well).
The filename of a note starts with a unique id based on the time and the date, for example: 2018-07-09-2115 This is a note.org
.
This unique id can be used to link notes together.
A link is indicated by a §
character, followed by the id.
For example: §2018-07-09-2115
should link to the file above.
A link can appear anywhere in the text.
When searching deft
with the id as a filter, you’ll find both the original note (with the id in its name) and all the notes that link to this note (with the id in its body). Do so with zd-search-current-id
and zd-avy-link-search
respectively
Notes can contain tags in plain text: words prepended with a #
.
This is a tag: #tag
.
Tags make it easy to retrieve notes. They can appear anywhere in the note, but I’d suggest putting them somewhere at the top.
1.4 Basic actions
Create a note with zd-new-file
and provide a name.
Insert links to other notes: use zd-find-file-id-insert
and select a file from the list.
With zd-find-file-full-title-insert
, you guessed it, the note’s title is included as well.
To branch out from a current note and link to a new one, use zd-new-file-and-link
.
To search for a tag or anything else under cursor, use zd-search-at-point
.
Combined with the power of avy
to jump to any character on screen, use these to jump and search in one go: zd-avy-link-search
and zd-avy-tag-search
.
To open the note behind a link, use zd-avy-file-search
.
1.5 An overview
While there are more functions, these should be enough to get you started. Default keybindings are suggested at the bottom of this document. Here is an overview.
| Function | Use | Keybinding |
|---|---|---|
zd-new-file |
Create new note and open | SPC d n |
zd-new-file-and-link |
Create new note and insert § id |
SPC d N |
zd-find-file-id-insert |
Pick a note and insert its § id |
SPC d i |
zd-search-at-point |
Search for thing at point | SPC d s |
zd-avy-file-search |
Select § id and open linked file |
SPC d f |
zd-avy-link-search |
Select § id and search for it |
SPC d l |
zd-avy-tag-search |
Select # tag and search for it |
SPC d t |
zd-search-current-id |
Search for id of current file | SPC d c |
More details documented below.
2 The zetteldeft
package
2.1 Package preparation
The required preamble and some other initial settings. To know how this package works, please skip right past this to the next section.
2.1.1 Preamble
Some declaration.
;;; zetteldeft.el --- a simple package -*- lexical-binding: t; -*- ;; Copyright (C) 2018 EFLS ;; Author: EFLS <email> ;; Keywords: deft zettelkasten zetteldeft ;; Version: 0.0.1 ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see <http://www.gnu.org/licenses/>. ;;; Commentary: ;; Zetteldeft: turn deft into a zettelkasten writing system to create linked notes. ;;; Code:
2.1.2 Requirements
deft
is required, obviously, and avy
is needed for some utility functions.
(require 'deft) (unless (package-installed-p 'avy) (user-error 'zetteldeft "Avy not installed, required for zd-avy-* functions.")) (require 'avy)
2.1.3 Customization
For easy but minor customization options.
(defgroup zetteldeft nil "A zettelkasten on top of deft.")
2.2 Basic zetteldeft
functions
In this section:
- 2.2.1. Search functions
- 2.2.2. IDs
- 2.2.3. Finding & linking files from minibuffer
- 2.2.4. New file creation
- 2.2.5. Moving around with
avy
- 2.2.6. Utility functions
- <IP_ADDRESS>. Deft new search
- <IP_ADDRESS>.
zd--check
checks if file is part of zetteldeft - <IP_ADDRESS>.
zd-file-rename
renames visited file - <IP_ADDRESS>.
zd-lift-file-title
returns file title from path - <IP_ADDRESS>.
zd-insert-org-title
inserts file title in org-mode - <IP_ADDRESS>.
zd-count-words
counts total number of words - <IP_ADDRESS>.
zd-copy-id-current-file
copies id in filename - <IP_ADDRESS>.
zd-id-to-full-title
returns title from ID
2.2.1 Search functions
<IP_ADDRESS> zd-get-thing-at-point
returns string
Returns the thing at point as string.
Tries to get, in the following order:
- links between
[[
- hashtags:
§
,#
or@
- words
Based on snippet suggested by saf-dmitry
on deft’s Github.
(defun zd-get-thing-at-point () "Return the thing at point, which can be a link, tag or word." (require 'thingatpt) (let* ((link-re "\\[\\[\\([^]]+\\)\\]\\]") (htag-re "\\([§#@][[:alnum:]_-]+\\)")) (cond ((thing-at-point-looking-at link-re) (match-string-no-properties 1)) ((thing-at-point-looking-at htag-re) (match-string-no-properties 1)) (t (thing-at-point 'word t)))))
<IP_ADDRESS> zd-search-at-point
thing at point
Search the thing at point.
Note that calling zd-search-at-point
on a §
link includes §
in the filter string.
Based on snippet suggested by saf-dmitry
on deft’s Github.
(defun zd-search-at-point () "Search deft with thing-at-point as filter. Thing can be a double-bracketed link, a hashtag, or a word." (interactive) (let ((string (zd-get-thing-at-point))) (if string (zd-search-global string t) (user-error "No search term at point"))))
<IP_ADDRESS> zd-search-global
for string
Search with deft for given string. If there is only one result, that file is opened, unless additional argument is true.
Based on snippet suggested by saf-dmitry
on deft’s Github.
(defun zd-search-global (str &optional dntOpn) "Search deft with STR as filter. If there is only one result, open that file (unless DNTOPN is true)." ;; Sanitize the filter string (setq str (replace-regexp-in-string "[[:space:]\n]+" " " str)) ;; Call deft search on the filter string (let ((deft-incremental-search t)) (deft) (deft-filter str t)) ;; If there is a single match, open the file (unless dntOpn (when (eq (length deft-current-files) 1) (deft-open-file (car deft-current-files)))))
<IP_ADDRESS> zd-search-filename
for string
Deft search on filename. If there is only one result, open that file.
Incremental search is turned off, and the filter is set to filenames only.
(defun zd-search-filename (thisStr &optional otherWindow) "Search for deft files with string THISSTR in filename. Open if there is only one result (in another window if otherWindow is non-nill)." ;; Sanitize the filter string (setq thisStr (replace-regexp-in-string "[[:space:]\n]+" " " thisStr)) ;; Call deft search on the filter string (let ((deft-filter-only-filenames t)) (deft-filter thisStr t)) ;; If there is a single match, open the file (when (eq (length deft-current-files) 1) (deft-open-file (car deft-current-files) otherWindow)))
<IP_ADDRESS> zd-search-current-id
searches current id
Deft search on the id of the current file.
This function is useful to easily see which notes link to the current file.
Result is not opened automaticaly.
Steps:
- Get the filename from the current buffer.
- Lift the ID from it.
- Search with resulting string.
(defun zd-search-current-id () "Search deft with the id of the current file as filter. Open if there is only one result." (interactive) (zd--check) (zd-search-global (zd-lift-id (file-name-base (buffer-file-name))) t))
<IP_ADDRESS> zd-get-file-list
returns file list with search term
Get a list of the files with given search string.
To fix: sorting of results.
The code searches for the given string and returns deft-current-files
.
(defun zd-get-file-list (srch) "Returns a list of files with the search item SRCH." (let ((deft-current-sort-method 'title)) (deft-filter srch t) deft-current-files))
2.2.2 IDs
<IP_ADDRESS> zd-id-format
for generating ID strings
String format when generating ids.
(defcustom zd-id-format "%Y-%m-%d-%H%M" "Format used when generating zetteldeft IDs. Be warned: the regexp to find these IDs is set separately." :type 'string :group 'zetteldeft)
While we’re at it, lets tell deft to create new files with this new format.
For good measure: I advise creating new notes in the zetteldeft
system with zd-new-file
or zd-new-file-and-link
as defined below.
(setq deft-new-file-format zd-id-format)
Here is the function to generate an ID string in said format.
(defun zd-generate-id () "Generates an id in `zd-id-format'." (format-time-string zd-id-format))
<IP_ADDRESS> zd-id-regex
for finding IDs
The regular expression used to search for zetteldeft IDs.
This dictates that a zetteldeft ID should consist of:
- a series of exactly 4 numbers
- followed by exactly 3 sets of a dash and two or more numbers
(defcustom zd-id-regex "[0-9]\\{4\\}\\(-[0-9]\\{2,\\}\\)\\{3\\}" "The regex used to search for zetteldeft IDs." :type 'string :group 'zetteldeft)
<IP_ADDRESS> zd-lift-id
filters the ID from a string
Return the zetteldeft ID from any string.
Searches with a temporary buffer, from the end of the string backwards (hence the -1
argument), which implies that the last zetteldeft string is returned.
(defun zd-lift-id (str) "Extract the zetteldeft ID from STR with the regular expression stored in `zd-id-regex'." (with-temp-buffer (insert str) (when (re-search-forward zd-id-regex nil t -1) (match-string 0))))
Or are there better ways than working with-temp-buffer
?
Here is a little test.
(zd-lift-id "2018-11-09-1934-12 Some text (1989) - testing (2000 p. 12-25)")
2018-11-09-1934
2.2.3 Finding & linking files from minibuffer
<IP_ADDRESS> zd-find-file
opens file from minibuffer
Select file from the deft folder from the minibuffer.
Based on deft-find-file
.
(defun zd-find-file (file) "Open deft file FILE." (interactive (list (completing-read "Deft find file: " (deft-find-all-files-no-prefix)))) (deft-find-file file))
<IP_ADDRESS> zd-find-file-id-insert
inserts file id
Select file from minibuffer and insert its link, prepended by §
.
Based on deft-find-file
.
(defun zd-find-file-id-insert (file) "Find deft file FILE and insert its link id, prepended by §." (interactive (list (completing-read "File to insert id from: " (deft-find-all-files-no-prefix)))) (insert (concat "§" (zd-lift-id file))))
<IP_ADDRESS> zd-find-file-full-title-insert
inserts id and title
Select file from minibuffer and insert its link, prepended by §
.
Based on deft-find-file
.
(defun zd-find-file-full-title-insert (file) "Find deft file FILE and insert its link id with title, prepended by §." (interactive (list (completing-read "File to insert full title from: " (deft-find-all-files-no-prefix)))) (insert (concat "§" (file-name-base file))))
2.2.4 New file creation
<IP_ADDRESS> zd-new-file
creates new file
Create new file with filename as zd-id-format
and a string.
Either provide a name as argument, or enter one in the mini-buffer.
A title is automatically added to the file, unless an additioanl parameter is given.
When evil
is used, enter the insert state as well.
The full name is added to the kill ring.
Note that the file is only actually created upon save.
(defun zd-new-file (str &optional empty) "Create a new deft file. Filename is `zd-id-format' appended by STR. No extension needed. After creating, the title is inserted in org-mode format (unless EMPTY is true) and the full file name is added to the kill ring." (interactive (list (read-string "name: "))) (let* ((zdId (zd-generate-id)) (zdName (concat zdId " " str))) (deft-new-file-named zdName) (kill-new zdName) (unless empty (zd-insert-org-title)) (when (featurep 'evil) (evil-insert-state))))
<IP_ADDRESS> zd-new-file-and-link
inserts generated id
Generate an id, append a name, and generate a new file based on id and link.
Either provide a name as argument, or enter one in the mini-buffer.
(defun zd-new-file-and-link (str) "Inserts generated id with `zd-id-format' appended with STR. Creates new deft file with id and STR as name." (interactive (list (read-string "name: "))) (insert "§" (zd-generate-id) " " str) (zd-new-file str))
2.2.5 Moving around with avy
<IP_ADDRESS> zd-avy-tag-search
Use avy to jump to a tag and search for it.
The search term should include the #
as tag identifier, so it’s as easy as jumping to the #
and running zd-search-at-point
.
(defun zd-avy-tag-search () "Call on avy to jump and search tags indicated with #." (interactive) (save-excursion (avy-goto-char ?#) (zd-search-at-point)))
<IP_ADDRESS> zd-avy-link-search
Use avy to jump to an id and search for it.
Jumps to the §
identifier and searches for the thing at point – excluding the §
character.
(defun zd-avy-link-search () "Call on avy to jump and search link ids indicated with §. Opens immediately if there is only one result." (interactive) (save-excursion (avy-goto-char ?§) (zd-search-global (zd-lift-id (zd-get-thing-at-point)))))
<IP_ADDRESS> zd-avy-file-search
Select and follow an ID link to a file.
Use avy to jump to an id and find the corresponding file. There should be only one result, as the id should be unique. That file is then opend (in another window if requested).
Jump to a §
with avy
, get the thing at point.
If it is non-nil, search it after sanitizing.
(defun zd-avy-file-search (&optional otherWindow) "Call on avy to jump to link ids indicated with § and use it to search for filenames. Open that file (when it is the only search result, and in another window if OTHERWINDOW)." (interactive) (save-excursion (avy-goto-char ?§) (zd-search-filename (zd-lift-id (zd-get-thing-at-point)) otherWindow)))
Let’s also define a function to open a file in another window.
Selection of the window occurs via ace-window
.
(defun zd-avy-file-search-ace-window () "Call on avy to jump to link ids indicated with § and use it to search for filenames. When there is only one search result, as there should be, open that file in a window selected through `ace-window'." (interactive) (require 'ace-window) (save-excursion (avy-goto-char ?§) (let ((ID (zd-lift-id (zd-get-thing-at-point)))) (select-window (aw-select "Select window...")) (zd-search-filename ID))))
2.2.6 Utility functions
<IP_ADDRESS> Deft new search
The following function launches deft, clears the filter and enters evil-insert-state
(when evil is used).
(defun zd-deft-new-search () "Launch deft, clear filter and enter insert state." (interactive) (deft) (deft-filter-clear) (when (featurep 'evil) (evil-insert-state)))
<IP_ADDRESS> zd--check
checks if file is part of zetteldeft
A quick but necessary check to see whether the provided file is part of the deft directory.
To achieve this, first check whether the buffer is visiting a file.
When that is the case, take the directory of the current buffer file name and expand it to its absolute path.
Then check whether the deft-directory
is part of that absolute path.
Signal a user error if it is not.
(defun zd--check () "Checks if the currently visited file is in `zetteldeft' territory: whether it has `deft-directory' somewhere in its path." (unless (buffer-file-name) (user-error "Buffer not visiting a file.")) (unless (string-match-p (regexp-quote deft-directory) (file-name-directory (buffer-file-name))) (user-error "Not in zetteldeft territory.")))
<IP_ADDRESS> zd-file-rename
renames visited file
Rename the current file.
Based on the function deft-rename-file
with only minor changes in the way old-filename
is set: from current buffer rather than from deft
search buffer.
Probably requires some more testing. Anyway, best to use this only when visiting a file in the deft directory.
The function also updates the #+title:
at the top of the buffer, if any is present.
(defun zd-file-rename () "Rename the current file via the deft function. Use this on files in the deft-directory." (interactive) (zd--check) (let ((old-filename (buffer-file-name)) (deft-dir (file-name-as-directory deft-directory)) new-filename old-name new-name) (when old-filename (setq old-name (deft-base-filename old-filename)) (setq new-name (read-string (concat "Rename " old-name " to (without extension): ") old-name)) (setq new-filename (concat deft-dir new-name "." deft-default-extension)) (rename-file old-filename new-filename) (deft-update-visiting-buffers old-filename new-filename) (zd-update-title-in-file) (deft-refresh))))
To update the title of the currently visited file, the following function is used.
(defun zd-update-title-in-file () "Update the #+TITLE in the current file, if present." (save-excursion (let ((zd-string-after-title "")) (goto-char (point-min)) (when (search-forward "#+title:" nil t) (delete-region (line-beginning-position) (line-end-position)) (zd-insert-org-title)))))
<IP_ADDRESS> zd-lift-file-title
returns file title from path
Returns only the file title from a file, removing path, extension, and link ID.
(defun zd-lift-file-title (zdFile) "Returns the title of a zetteldeft note. ZDFILE should be a full path to a note." (let ((baseName (file-name-base zdFile))) (replace-regexp-in-string "[0-9]\\{2,\\}-[0-9-]+[[:space:]]" "" baseName)))
<IP_ADDRESS> zd-insert-org-title
inserts file title in org-mode
Easily insert the title of the current file in org-mode
syntax, i.e. as a #+title:
line.
The code gets the base of the buffer file name, takes from it the file title (i.e. strips the link id at the beginning), and inserts the remaining string.
Below the title, an additional template string is inserted automatically.
This string, variable zd-string-after-title
, can be customized and is empty by default.
(defun zd-insert-org-title () "Insert filename of current file as org syntax." (interactive) (zd--check) (insert "#+title: " (zd-lift-file-title (file-name-base (buffer-file-name))) zd-string-after-title))
Customize the string to be inserted below the title. Used when generating a new file.
(defcustom zd-string-after-title "" "String inserted below title when `zd-insert-org-title' is called. Empty by default. Don't forget to add `\\n' at the beginning to start a new line." :type 'string :group 'zetteldeft)
<IP_ADDRESS> zd-count-words
counts total number of words
To count the total number of words, lets loop over all the files and count words in each. The total is printed in the minibuffer.
(defun zd-count-words () "Prints total number of words and notes in the minibuffer." (interactive) (let ((numWords 0)) (dolist (deftFile deft-all-files) (with-temp-buffer (insert-file-contents deftFile) (setq numWords (+ numWords (count-words (point-min) (point-max)))))) (message "Your zettelkasten contains %s notes with %s words in total." (length deft-all-files) numWords)))
<IP_ADDRESS> zd-copy-id-current-file
copies id in filename
Add the ID from the current file to the kill ring.
Steps:
- Get the filename from the buffer
- Strip the ID from it.
- Result can be empty string when no id is detected in the filename.
(defun zd-copy-id-current-file () "Add the id from the filename the buffer is currently visiting to the kill ring." (interactive) (zd--check) (let ((ID (concat "§" (zd-lift-id (file-name-base (buffer-file-name)))))) (kill-new ID) (message "%s" ID)))
<IP_ADDRESS> zd-id-to-full-title
returns title from ID
Convert a zetteldeft ID into its full title.
The ID should lead to only one title, obviously, so an error is thrown when this is not the case.
(defun zd-id-to-full-title (zdID) "Return full title from given zetteldeft ID. Throws an error when either none or multiple files with said ID are found." (let ((deft-filter-only-filenames t)) (deft-filter zdID t)) (unless (eq (length deft-current-files) 1) (user-error "ID Error. Either no or multiple zetteldeft files found with ID %s." zdID)) (file-name-base (car deft-current-files)))
2.3 Listing all tags
zd-all-tags
puts all tags in zd-tag-list
and returns them.
Use zd-tag-buffer
to create a buffer with all tags.
2.3.1 zd-all-tags
returns them all
Extracting tags with zd-extract-tags
.
(defun zd-all-tags () "Return a list of all the tags found in zetteldeft files." (setq zd-tag-list (list)) (dolist (deftFile deft-all-files) (zd-extract-tags deftFile)) zd-tag-list)
2.3.2 zd-tag-buffer
puts all tags in a buffer
The name of the buffer we’ll be using:
(setq zd-tag-buffer-name "*zd-tag-buffer*")
And some code to create that buffer.
Move to the zd-tag-buffer-name
(defun zd-tag-buffer () "Switch to the *zd-tag-buffer* and list tags." (interactive) (switch-to-buffer zd-tag-buffer-name) (erase-buffer) (dolist (zdTag (zd-all-tags)) (insert (format "%s \n" zdTag))) (unless (eq major-mode 'org-mode) (org-mode)) (sort-lines nil (point-min) (point-max)))
2.3.3 Tag extracting functions
Some utility functions to achieve all of this.
<IP_ADDRESS> zd-tag-format
provides the tag-finding regex
The regular expression used to filter out tags.
Tags start with a #
or @
and contain least one or more letters.
Dashes are allowed.
Tags should be positioned either be at the beginning of a new line, or preceded by a space. This should help filter out hashtags used in URLs.
(defcustom zd-tag-format "\\(^\\|\s\\)[#@][a-z-]+" "Regular expression used to filter out tags." :type 'string :group 'zetteldeft)
<IP_ADDRESS> zd-extract-tags
from a file
Open a given file in a temporary buffer.
Loop a search for the tag regexp.
When a tag is found, remove any whitespace from it and add it to the zd-tag-list
if it isn’t there already.
Delete the found tag and search again.
(defun zd-extract-tags (deftFile) "Find all tags in DEFTFILE and add them to zd-tag-list" (with-temp-buffer (insert-file-contents deftFile) (while (re-search-forward zd-tag-format nil t) (let ((foundTag (replace-regexp-in-string " " "" (match-string 0)))) ;; Add found tag to zd-tag-list if it isn't there already (unless (member foundTag zd-tag-list) (push foundTag zd-tag-list))) ;; Remove found tag from buffer (delete-region (point) (re-search-backward zd-tag-format)))))
2.4 Gathering notes
In this section:
2.4.1 On “gathering notes”
Sometimes you want to easily gather all notes with a certain tag or search term.
Say you want to quickly generate a list of links to all files including the tag #zetteldeft
.
The following functions do that for you. There are three of them, each either taking a search term as argument or prompting for one:
zd-insert-list-links
inserts a simple list of notes which contain the search term, spelling out the full filename for each note (including ID).zd-org-search-include
generatesorg-mode
syntax to#+INCLUDE
the files below a header with their title.zd-org-search-insert
inserts the contents of all of these notes below their respective titles.
More documentation can be found below.
2.4.2 List of links
<IP_ADDRESS> zd-insert-list-links
generates list with tagged files
Creates and inserts a list with links to all files with selected search term.
The code gets a list of files that contain the search string, runs through said list and inserts a link for each entry.
To fix: when called from within a zetteldeft note, exclude the note itself from the generated list.
(defun zd-insert-list-links (zdSrch) "Inserts at point a list of links to all deft files with a search string ZDSRCH. When searching for a tag, include # manually in the search." (interactive (list (read-string "search string: "))) (dolist (zdFile (zd-get-file-list zdSrch)) (zd-list-entry-file-link zdFile)))
<IP_ADDRESS> zd-insert-list-links-missing
generates list with new links
Does the same as the above function, but only inserts IDs that aren’t already present in the current file.
This is especially handy when you hope to check wheter all notes with a certain tag are linked to, or simply to list unlinked notes.
One potential issue, to be fixed in the future: the file from where the function is called, will also be in the list…
Another fundamental shortcoming of this piece of code, is that after it is executed, the note now includes the previously missing ID links, which in turn means that on the next run no links will be included…
The most immediate solution is for the user to be wary of this, and deleting said links and refreshing the deft cache with deft-refresh
before calling this function.
(defun zd-insert-list-links-missing (zdSrch) "Inserst a list of links to all deft files with a search string ZDSRCH, yet in contrast to `zd-insert-list-links' only includes links that are not yet present in the current file. Can only be called from a file in the zetteldeft directory." (interactive (list (read-string "search string: "))) (zd--check) (let (zdCurrentIDs zdFoundIDs zdFinalIDs) (setq zdCurrentIDs (zd-extract-links (buffer-file-name))) ; filter IDs from search results (dolist (zdFile (zd-get-file-list zdSrch)) (push (zd-lift-id zdFile) zdFoundIDs)) ; create new list with unique ids (dolist (zdID zdFoundIDs) (unless (member zdID zdCurrentIDs) (push zdID zdFinalIDs))) ; finally find full title for each ID and insert it (dolist (zdID zdFinalIDs) (setq zdID (zd-id-to-full-title zdID)) (insert " - " (concat "§" zdID "\n")))))
<IP_ADDRESS> zd-list-entry-file-link
includes a file link as list entry
Inserts for given file a link id and title as a list entry.
(defun zd-list-entry-file-link (zdFile) "Insert ZDFILE as list entry." (insert " - " (concat "§" (file-name-base zdFile)) "\n"))
2.4.3 Compiling a single org
<IP_ADDRESS> Idea and example
- Including notes with given search term
The following explains what
zd-org-search-include
does, but the concept is more or less the same forzd-org-search-insert
.For each of the notes with the provided search term, it inserts a heading, a line with
#+INCLUDE
and the full path to the relevant notes. This results in a single file that can be easily exported.The only function meant for use on the users end, is
zd-org-search-include
.For example,
(zd-org-search-include "#export")
inserts necessary code to include all files containing the tag
#export
. The results would look like the following:\* First file title #+INCLUDE: "/path/to/2018-07-13-2210 First file title.org" \* File two #+INCLUDE: "/path/to/2018-07-13-2223 File two.org"
All functions are documented below.
- Semi-automated example
You could, for example, add the following code to a document and execute (or evaluate) it from within
org-mode
. Add it under a “comment” type heading to prevent it from being exported itself, like so:* COMMENT Code
.(let (frst) (save-excursion ;; Move to next heading (outline-next-heading) (setq frst (point)) ;; Delete everything after (delete-region frst (point-max)) ;; Include the files (zd-org-search-include "#tag") ; Sort these entries alphabetically (set mark to use a region) ; (goto-char frst) (set-mark (point-max)) ; (org-sort-entries nil ?a) ))
The code deletes everything after the current header and inserts all notes with
#tag
in them.In order to also sort the entries alphabetically, uncomment the last two lines.
A final caveat: don’t put the file with the above code in you
deft
folder, or it will attempt to include itself (since it has#tag
in it). - Issues & things to note
Before we look at the functions, a note on limitations of the current implementation.
- Over-enthousiastic inclusion Sometimes, a tag appears in a file without the need for it to be included. For example, a file with a list of all tags will also include the tag one wants. In the future, this might be resolved by filtering, for example with http://ergoemacs.org/emacs/elisp_filter_list.html.
- Inclusion from second line onwards
Currently, the
#+INCLUDE
lines only include from the second line onwards. This is a work-around to prevent#+TITLE
lines from being included (and messing up the title onorg-export
. To change this, edit the inserted strings in thezd-org-include-file
function. - Sorting
The files included are unsorted, or rather: sorted as
deft
provides the results. Attempts at sorting by title are included inzd-get-file-list
, but not working properly. As a solution, useorg-sort
manually after runningzd-org-search-include
.
<IP_ADDRESS> zd-org-search-include
generates #+INCLUDE
syntax
Asks user for a search string and inserts headers and #+INCLUDE
code for all files with said tag.
When used on #tag
, make sure to include the #
manually.
(defun zd-org-search-include (zdSrch) "Inserts at point org-mode code to include all files with the selected tag. Include the # manually in the prompt." (interactive (list (read-string "tag (include the #): "))) (dolist (zdFile (zd-get-file-list zdSrch)) (zd-org-include-file zdFile)))
<IP_ADDRESS> zd-org-search-insert
generates titles & file content
Very similar to the previous function, but rather than writing syntax to include files, insert their contents directly.
(defun zd-org-search-insert (zdSrch) "Inserts at point all the content of the files with ZDSRCH. When looking for zetteldeft tags, include the # manually in the search." (interactive (list (read-string "Search term: "))) (dolist (zdFile (zd-get-file-list zdSrch)) (zd-org-insert-file zdFile)))
2.4.4 Helper functions
<IP_ADDRESS> zd-insert-file-contents
returns the contents of a file
Returns the contents of a file.
(defun zd-file-contents (zdFile &optional removeLines) "Inserts file contents of a zetteldeft note. ZDFILE should be a full path to a note. Optional: leave out first REMOVELINES lines." (with-temp-buffer (insert-file-contents zdFile) (when removeLines (kill-whole-line removeLines)) (buffer-string)))
<IP_ADDRESS> zd-org-include-file
includes a file in org
format
Inserts the title as a new header, with the #+INCLUDE
line below.
Includes only from the second line onward, so that any #+TITLE
lines are omitted.
(defun zd-org-include-file (zdFile) "Insert code to include org-file zdFile." (insert ;; Insert org-mode title "* " (zd-lift-file-title zdFile) "\n" ;; Insert #+INCLUDE: "file.org" :lines 2- "#+INCLUDE: \"" zdFile "\" :lines \"2-\"\n\n"))
<IP_ADDRESS> zd-org-insert-file
inserts a files content
For a file, insert its title and contents (without first 3 lines).
Even better would be: without any of the lines starting with #
at the beginning of the file.
(defun zd-org-insert-file (zdFile) "Insert title and contents of ZDFILE." (insert ;; Insert org-mode title "\n* " (zd-lift-file-title zdFile) "\n\n" ;; Insert file contents (without the first 3 lines) (zd-file-contents zdFile 3)))
2.5 Creating visuals
In this section:
- 2.5.1. Introducing graphs
- 2.5.2. Graph functions
- 2.5.3. Building blocks
- <IP_ADDRESS>.
zd-graph-syntax-begin
provides opening syntax - <IP_ADDRESS>.
zd-graph-syntax-end
provides closing syntax - <IP_ADDRESS>.
zd-extract-links
pulls links from a file - <IP_ADDRESS>.
zd-graph-insert-links
inserts graphviz links - <IP_ADDRESS>.
zd-graph-insert-title
inserts graphviz title line - <IP_ADDRESS>.
zd-graph-store-link
stores provided notes - <IP_ADDRESS>.
zd-graph-insert-additional-links
inserts stored links - <IP_ADDRESS>.
zd-graph-insert-all-titles
inserts all stored titles
- <IP_ADDRESS>.
2.5.1 Introducing graphs
Linking notes together in plain text is fun, but sometimes you want to visualize which notes are connected.
The following functions attempt to provide said functionallity, but are in a very early stage of development.
They generate an org source block for graphviz
, which can then be executed to generate a pdf.
A brief introduction:
zd-org-graph-search
creates a graph with all the notes containing a provided string.zd-org-graph-note
creates a graph that starts at a note, connects all notes linked to it, and all notes linked to those. In other words, it looks two levels deep.
The resulting graph looks something like this:
It’s worth noting, again, that this is very provisional.
2.5.2 Graph functions
<IP_ADDRESS> zd-org-graph-search
creates graph from search string
An org code block with graphviz
code for a graph.pdf
.
Find all notes with the provided search term. Loop over this list, and insert title and links for each one.
(defun zd-org-graph-search (str) "Insert org source block for graph with zd search results. STR should be the search the resulting notes of which should be included in the graph." (interactive (list (read-string "search string: "))) (setq zd-graph--links (list)) (let ((zdList (zd-get-file-list str))) (insert zd-graph-syntax-begin) (insert "\n // links\n") (dolist (oneFile zdList) (insert "\n") (zd-graph-insert-links oneFile)) (zd-graph-insert-all-titles)) (insert zd-graph-syntax-end))
<IP_ADDRESS> zd-org-graph-note
creates graph from note
Insert an org source code block for a graphviz presentation of a note and its connections.
When links are added, they are also stored in zd-graph--links
which is later used to insert titles.
(defun zd-org-graph-note (deftFile) "Create a graph starting from note DEFTFILE." (interactive) (setq zd-graph--links (list)) (insert zd-graph-syntax-begin) (insert "\n // base note and links \n") (zd-graph-insert-links deftFile) (zd-graph-insert-additional-links) (zd-graph-insert-all-titles) (insert zd-graph-syntax-end))
2.5.3 Building blocks
<IP_ADDRESS> zd-graph-syntax-begin
provides opening syntax
Within graphviz, I advise to use fdp
, twopi
(which overlaps more) or circo
as layouts.
(defcustom zd-graph-syntax-begin "#+BEGIN_SRC dot :file ./graph.pdf :cmdline -Kfdp -Tpdf \n graph {\n" "Syntax to be included at the start of the zetteldeft graph.")
<IP_ADDRESS> zd-graph-syntax-end
provides closing syntax
(defcustom zd-graph-syntax-end "} \n#+END_SRC\n" "Syntax to be included at the end of the zetteldeft graph.")
<IP_ADDRESS> zd-extract-links
pulls links from a file
Very similar to the zd-extract-tags
function, but returns links instead of storing them.
(defun zd-extract-links (deftFile) "Find all links in DEFTFILE and return a list." (let ((zdLinks (list))) (with-temp-buffer (insert-file-contents deftFile) (while (re-search-forward zd-id-regex nil t) (let ((foundTag (replace-regexp-in-string " " "" (match-string 0)))) ;; Add found tag to zdLinks if it isn't there already (unless (member foundTag zdLinks) (push foundTag zdLinks))) ;; Remove found tag from buffer (delete-region (point) (re-search-backward zd-id-regex)))) zdLinks))
<IP_ADDRESS> zd-graph-insert-links
inserts graphviz links
Insert the sanitized ID from the file, followed by an arrow and all of the links.
Store both the deft file provided and any found files in zd-graph--links
.
(defun zd-graph-insert-links (deftFile) "Inserts a file's links in a one line dot graph format. Any inserted ID is also stored in `zd-graph--links'." (insert " \"" (zd-lift-id deftFile) "\" -- {") (dolist (oneLink (zd-extract-links deftFile)) (zd-graph-store-link oneLink t) (insert "\"" oneLink "\" ")) (insert "}\n") (zd-graph-store-link deftFile))
<IP_ADDRESS> zd-graph-insert-title
inserts graphviz title line
Titles have to be inserted in the correct graphviz
format, like so:
B [label = "Node B"]
The following function should achieve that.
(defun zd-graph-insert-title (deftFile) "Inserts the DEFTFILE title definition in a one line dot graph format." (let ((zdTitle (replace-regexp-in-string "\"" "" (zd-lift-file-title deftFile))) (zdId (zd-lift-id deftFile))) (insert " \"" zdId "\"" " [label = \"" zdTitle " (§" zdId ")\"") (insert "]" "\n")) (zd-graph-store-link deftFile))
The title is taken from the file string and any additional quotes removed.
<IP_ADDRESS> zd-graph-store-link
stores provided notes
For future reference, linked files are stored in zd-graph--links
.
This function facilitates that process.
Provide a link to a file to store it. Simply providing an ID works too, if you provide the second argument as true.
(defun zd-graph-store-link (deftFile &optional idToFile) "Push DEFTFILE to zd-graph--links unless it's already there. When IDTOFILE is non-nil, DEFTFILE is considered an id and the the function first looks for the corresponding file." (when idToFile (let ((deft-filter-only-filenames t)) (progn (deft-filter deftFile t) (setq deftFile (car deft-current-files))))) (unless (member deftFile zd-graph--links) (push deftFile zd-graph--links)))
<IP_ADDRESS> zd-graph-insert-additional-links
inserts stored links
Insert links stored in the zd-graph--links
list.
Except the first list item, as this is considered the base file already included.
(defun zd-graph-insert-additional-links () "Insert rest of `zd-graph--links'." (setq zd-graph--links (cdr zd-graph--links)) (dolist (oneFile zd-graph--links) (zd-graph-insert-links oneFile)))
<IP_ADDRESS> zd-graph-insert-all-titles
inserts all stored titles
Insert all titles stored in zd-graph--links
.
(defun zd-graph-insert-all-titles () "Insert all graphviz title lines for all links stored in `zd-graph--links'." (insert "\n // titles \n") (dolist (oneLink zd-graph--links) ;; Sometimes, a 'nil' list item is present. Ignore those. (when oneLink (zd-graph-insert-title oneLink))))
2.6 Aesthetics
2.6.1 Highlighting zetteldeft links
To highlight zetteldeft links, let’s add a font-lock
keyword to org-mode
.
Currently, the regexp to find links is hardcoded.
Highlighting not working in comments.
(font-lock-add-keywords 'org-mode '(
("§[0-9]\\{2,\\}-[0-9-]+" . font-lock-warning-face)))
2.7 End of package
That’s all folks!
(provide 'zetteldeft) ;;; zetteldeft.el ends here
3 Suggested setup
The following assumes deft
is loaded manually in your dotfile, it merely configures the package.
None of these code blocks are tangled into the .el
file, they are here merely as a guide.
3.1 Suggested zeteldeft
keybindings
3.1.1 Keybindings with general
To call zetteldeft
functions from anywhere behind a leader key such as SPC
, I recommend general.el
with the following setup.
(general-define-key :prefix "SPC" :non-normal-prefix "C-SPC" :states '(normal visual motion emacs) :keymaps 'override "d" '(nil :wk "deft") "dd" '(deft :wk "deft") "dD" '(zd-deft-new-search :wk "new search") "dR" '(deft-refresh :wk "refresh") "ds" '(zd-search-at-point :wk "search at point") "dc" '(zd-search-current-id :wk "search current id") "df" '(zd-avy-file-search :wk "avy file search") "dF" '(zd-avy-file-search-ace-window :wk "avy file other window") "dl" '(zd-avy-link-search :wk "avy link search") "dt" '(zd-avy-tag-search :wk "avy tag search") "dT" '(zd-tag-buffer :wk "tag list") "di" '(zd-find-file-id-insert :wk "insert id") "dI" '(zd-find-file-full-title-insert :wk "insert full title") "do" '(zd-find-file :wk "find file") "dn" '(zd-new-file :wk "new file") "dN" '(zd-new-file-and-link :wk "new file & link") "dr" '(zd-file-rename :wk "rename"))
3.1.2 Spacemacs keybindings
Suggested keybindings for spacemacs
.
These can be called from anywhere behind SPC d
.
;; Prefix (spacemacs/declare-prefix "d" "deft") ;; Launch deft (spacemacs/set-leader-keys "dd" 'deft) (spacemacs/set-leader-keys "dD" 'zd-deft-new-search) ;; SEARCH ; Search thing at point (spacemacs/set-leader-keys "ds" 'zd-search-at-point) ; Search current file id (spacemacs/set-leader-keys "dc" 'zd-search-current-id) ; Jump & search with avy ; search link as filename (spacemacs/set-leader-keys "df" 'zd-avy-file-search) (spacemacs/set-leader-keys "dF" 'zd-avy-file-search-ace-window) ; search link as contents (spacemacs/set-leader-keys "dl" 'zd-avy-link-search) ; search tag as contents (spacemacs/set-leader-keys "dt" 'zd-avy-tag-search) ; find all tags (spacemacs/set-leader-keys "dT" 'zd-tag-buffer) ;; LINKS ; Insert link from filename (spacemacs/set-leader-keys "di" 'zd-find-file-id-insert) ; Insert link with full filename (spacemacs/set-leader-keys "dI" 'zd-find-file-full-title-insert) ;; FILES ; Open file (spacemacs/set-leader-keys "do" 'zd-find-file) ; Create new file (spacemacs/set-leader-keys "dn" 'zd-new-file) (spacemacs/set-leader-keys "dN" 'zd-new-file-and-link) ; Rename file (spacemacs/set-leader-keys "dr" 'zd-file-rename) ;; UTILITIES (spacemacs/set-leader-keys "dR" 'deft-refresh)
3.2 Suggested deft
setup
3.2.1 Notes & extensions
Note extensions are md
, txt
and org
.
First of this list is the default for new notes.
(setq deft-extensions '("org" "md" "txt"))
3.2.2 Set deft-directory
Search the deft directory recursively, to include subdirectories.
(setq deft-directory (concat org-directory "/notes/zetteldeft")) (setq deft-recursive t)
3.2.3 Additional deft
functions
Some personal additions.
A small function to open a file in the other window and shifting focus to it.
That final part is what the t
argument does.
(defun efls/deft-open-other () (interactive) (deft-open-file-other-window t))
Let’s add another function, to simply preview in the other window, i.e. not switch focus to it.
(defun efls/deft-open-preview () (interactive) (deft-open-file-other-window))
To select results from the item list without leaving the insert
state, I add the following keys.
(with-eval-after-load 'deft (define-key deft-mode-map (kbd "<tab>") 'efls/deft-open-preview) (define-key deft-mode-map (kbd "<s-return>") 'efls/deft-open-other) (define-key deft-mode-map (kbd "s-j") 'evil-next-line) (define-key deft-mode-map (kbd "s-k") 'evil-previous-line))
3.2.4 Ignore more org-mode
metadata
I tend to write org-mode
titles with #+title:
(i.e., uncapitalized). Also other org-mode
code at the beginning is written in lower case.
In order to filter these from the deft summary, let’s alter the regular expression:
(setq deft-strip-summary-regexp (concat "\\(" "[\n\t]" ;; blank "\\|^#\\+[a-zA-Z_]+:.*$" ;;org-mode metadata "\\)"))
Its original value was \\([\n ]\\|^#\\+[[:upper:]_]+:.*$\\)
.
4 Brainstorm
Some ideas for the future.
4.1 Saved searches
Create a list of saved searches, somewhere easily accessible.
4.2 Generate list of tags
Auto-generate a list of tags.
Might exceed my elisp-fu.
4.3 HTML export
Export HTML pages with clickeable links between notes.
4.4 Markdown export
Export markdown through pandoc
.
4.5 Templates
A system for note templates.
4.6 Minor mode
Create a minor mode on top of org-mode with some niceties:
- higlight links & tags
- clickeable links
Footnotes:
For those not yet familiar: deft is a note manager within emacs
, for easily searching and retrieving plain text notes.
It is inspired by the popular Notational Velocity.
Check out jblevins.org/projects/deft/ and notational.net.


Dear Sir, Please I know that this letter may come to you as a surprise based on the fact that I have not had any previous contact with you. Briefly, I am master Nelson Williams, son of the late Mr.Richard Williams, former director of Sierre Leone Gold and Diamond Corporation who was murdered by assailants . Shortly before this unfortunate incident, my father had informed me about an important contract he had executed (supply of Gold and diamond Mining Equipments)where he realized this fund ($15.5m)fifteen million five hundred thousand dollars and later when he heard the rumor of war in my country Sierra Leone he move the fund to Ghana where he deposited it. He showed me some lodgment documents with which he had deposited the money encased in a trunk box with a security /safe deposit company here in Accra Ghana He informed me in confidence that the security company is not aware of the exact contents of the box , rather he had told them that it contained African artworks that he had assembled for his overseas partner who would soon be coming to claim them for exportation. As a result of this explanation, the box was accepted for safe-keeping by the security company without inspection. When the political situation in Freetown, Sierra Leone worsened, I escaped into Accra , Ghana and had since contacted the security company, identified myself properly and informed them about the sad fate my father had suffered. I presented the lodgment documents and they confirmed that they have the trunk box in their vault. So I informed them that I intend initiating contacts with my fathers overseas partner who owns the consignment so that he can come and take delivery of it. My decision to retrieve this box, transfer the money and start a new life forms the basis of this enquiry from you. 1) Could you assist me with the logistics and a good personal/company bank account through which I can retrieve the consignment out he security company and transfer this money out of Ghana ? 2) Could you advise me on a good business proposition into which I can invest this money so that it would yield good dividends 3) Could you assist me obtain resident papers in your country so that I can continue my education there from where I stopped. I sincerely will agree to any suitable percentage you may request for your assistance to me. I shall prefer most of our communication to be done via phone. I need not inform you that this matter is strictly confidential. I want you to treat it as such. God will surely bless you in abundance as you made up your heart to help an orphan like me. Nelson Williams.


 True is returned only if the action is possible on all threads.
| string | $permissionMethod | Name of the permission method to call in the thread model |
| array | $threads | List of threads to check |
| array | $forums | List of forums the threads are in |
| string | $errorKey | Returned by reference. Phrase key if an error occurs |
| array | null | $viewingUser |
|
protected |
Gets information about the forum a thread belogns to.
| array | $thread | Info about the thread |
| array | $forums | List of forums that the thread could belong to |
|
protected |
|
protected |
|
protected |
|
protected |
Bulk update 1 or more fields in the given threads.
| array | $threads | List of threads to update |
| array | $forums | List of forums threads are in |
| array | $updates | Key-value pairs to update |
| string | $logAction | If specified, this action will be logged with this action |
|
protected |
Internal helper to update the discussion_state of a collection of threads.
| array | $threads | Information about the threads to update |
| array | $forums | Information about the forums that the threads are in |
| string | $newState | New message state (visible, moderated, deleted) |
| string | false | $expectedOldState | If specified, only updates if the old state matches |
| applyThreadPrefix | ( | array | $threadIds, |
| $prefixId, | |||
| & | $unchangedThreadIds = array() , |
||
| array | $options = array() , |
||
| & | $errorKey = '' , |
||
| array | $viewingUser = null |
||
| ) |
Apply a thread prefix to the specified threads if permissions are sufficient.
| array | $threadIds | List of thread IDs to change |
| integer | $prefixId | ID of the thread prefix to apply |
| array | $unchangedThreadIds | Array of thread IDs that were not updated by this action |
| array | $options | Options that control the action. Nothing supported at this time. |
| string | $errorKey | Modified by reference. If no permission, may include a key of a phrase that gives more info |
| array | null | $viewingUser |
| approveThreads | ( | array | $threadIds, |
| array | $options = array() , |
||
| & | $errorKey = '' , |
||
| array | $viewingUser = null |
||
| ) |
Approves the specified threads if permissions are sufficient.
| array | $threadIds | List of thread IDs to approve |
| array | $options | Options that control the action. Nothing supported at this time. |
| string | $errorKey | Modified by reference. If no permission, may include a key of a phrase that gives more info |
| array | null | $viewingUser |
| canApproveUnapproveThreads | ( | array | $threadIds, |
| & | $errorKey = '' , |
||
| array | $viewingUser = null |
||
| ) |
Determines if the selected thread IDs can be approved/unapproved.
| array | $threadIds | List of thread IDs check |
| string | $errorKey | Modified by reference. If no permission, may include a key of a phrase that gives more info |
| array | null | $viewingUser |
| canApproveUnapproveThreadsData | ( | array | $threads, |
| array | $forums, | ||
| & | $errorKey = '' , |
||
| array | $viewingUser = null |
||
| ) |
Determines if the selected threads can be approved/unapproved. This is a slightly more "internal" version of the canApproveUnapproveThreads() function, as the required data must already be retrieved.
| array | $threads | List of information about threads to be checked |
| array | $forums | List of information about forums the threads are in; must include unserialized permissions in 'nodePermissions' key |
| string | $errorKey | Modified by reference. If no permission, may include a key of a phrase that gives more info |
| array | null | $viewingUser |
| canDeleteThreads | ( | array | $threadIds, |
$deleteType = 'soft' , |
|||
| & | $errorKey = '' , |
||
| array | $viewingUser = null |
||
| ) |
Determines if the selected thread IDs can be deleted.
| array | $threadIds | List of thread IDs check |
| string | $deleteType | The type of deletion being requested (soft or hard) |
| string | $errorKey | Modified by reference. If no permission, may include a key of a phrase that gives more info |
| array | null | $viewingUser |
| canDeleteThreadsData | ( | array | $threads, |
| $deleteType, | |||
| array | $forums, | ||
| & | $errorKey = '' , |
||
| array | $viewingUser = null |
||
| ) |
Determines if the selected threads can be deleted. This is a slightly more "internal" version of the canDeleteThreads() function, as the required data must already be retrieved.
| array | $threads | List of information about threads to be checked |
| string | $deleteType | Type of deletion (soft or hard) |
| array | $forums | List of information about forums the threads are in; must include unserialized permissions in 'nodePermissions' key |
| string | $errorKey | Modified by reference. If no permission, may include a key of a phrase that gives more info |
| array | null | $viewingUser |
| canEditThreads | ( | array | $threadIds, |
| & | $errorKey = '' , |
||
$viewingUser = null |
|||
| ) |
Determines if the selected thread IDs can be generally edited (titles, prefixes etc.)
| array | $threadIds | List of thread IDs check |
| string | $errorKey | Modified by reference. If no permission, may include a key of a phrase that gives more info |
| array | null | $viewingUser |
| canEditThreadsData | ( | array | $threads, |
| array | $forums, | ||
| & | $errorKey = '' , |
||
$viewingUser = null |
|||
| ) |
Determines if the selected threads can be generally edited (titles, prefixes etc.)
| array | $threads | List of information about threads to be checked |
| array | $forums | List of information about forums the threads are in; must include unserialized permissions in 'nodePermissions' key |
| string | $errorKey | Modified by reference. If no permission, may include a key of a phrase that gives more info |
| array | null | $viewingUser |
| canLockUnlockThreads | ( | array | $threadIds, |
| & | $errorKey = '' , |
||
| array | $viewingUser = null |
||
| ) |
Determines if the selected thread IDs can be locked/unlocked.
| array | $threadIds | List of thread IDs check |
| string | $errorKey | Modified by reference. If no permission, may include a key of a phrase that gives more info |
| array | null | $viewingUser |
| canLockUnlockThreadsData | ( | array | $threads, |
| array | $forums, | ||
| & | $errorKey = '' , |
||
| array | $viewingUser = null |
||
| ) |
Determines if the selected threads can be locked/unlocked. This is a slightly more "internal" version of the canLockUnlockThreads() function, as the required data must already be retrieved.
| array | $threads | List of information about threads to be checked |
| array | $forums | List of information about forums the threads are in; must include unserialized permissions in 'nodePermissions' key |
| string | $errorKey | Modified by reference. If no permission, may include a key of a phrase that gives more info |
| array | null | $viewingUser |
| canMergeThreads | ( | array | $threadIds, |
| & | $errorKey = '' , |
||
| array | $viewingUser = null |
||
| ) |
Determines if the selected thread IDs can be merged.
| array | $threadIds | List of thread IDs check |
| string | $errorKey | Modified by reference. If no permission, may include a key of a phrase that gives more info |
| array | null | $viewingUser |
| canMergeThreadsData | ( | array | $threads, |
| array | $forums, | ||
| & | $errorKey = '' , |
||
| array | $viewingUser = null |
||
| ) |
Determines if the selected threads can be merged. This is a slightly more "internal" version of the canMergeThreads() function, as the required data must already be retrieved.
| array | $threads | List of information about threads to be checked |
| array | $forums | List of information about forums the threads are in; must include unserialized permissions in 'nodePermissions' key |
| string | $errorKey | Modified by reference. If no permission, may include a key of a phrase that gives more info |
| array | null | $viewingUser |
| canMoveThreads | ( | array | $threadIds, |
| $targetNodeId, | |||
| & | $errorKey = '' , |
||
| array | $viewingUser = null |
||
| ) |
Determines if the selected thread IDs can be moved.
| array | $threadIds | List of thread IDs check |
| integer | $targetNodeId | ID of node where threads are being moved to. Use 0 if unknown. |
| string | $errorKey | Modified by reference. If no permission, may include a key of a phrase that gives more info |
| array | null | $viewingUser |
| canMoveThreadsData | ( | array | $threads, |
| $targetNodeId, | |||
| array | $forums, | ||
| & | $errorKey = '' , |
||
| array | $viewingUser = null |
||
| ) |
Determines if the selected threads can be moved. This is a slightly more "internal" version of the canMoveThreads() function, as the required data must already be retrieved.
| array | $threads | List of information about threads to be checked |
| integer | $targetNodeId | ID of node where threads are being moved to. Use 0 if unknown. |
| array | $forums | List of information about forums the threads are in; must include unserialized permissions in 'nodePermissions' key |
| string | $errorKey | Modified by reference. If no permission, may include a key of a phrase that gives more info |
| array | null | $viewingUser |
| canStickUnstickThreads | ( | array | $threadIds, |
| & | $errorKey = '' , |
||
| array | $viewingUser = null |
||
| ) |
Determines if the selected thread IDs can be stickied/unstickied.
| array | $threadIds | List of thread IDs check |
| string | $errorKey | Modified by reference. If no permission, may include a key of a phrase that gives more info |
| array | null | $viewingUser |
| canStickUnstickThreadsData | ( | array | $threads, |
| array | $forums, | ||
| & | $errorKey = '' , |
||
| array | $viewingUser = null |
||
| ) |
Determines if the selected threads can be stickied/unstickied. This is a slightly more "internal" version of the canStickUnstickThreads() function, as the required data must already be retrieved.
| array | $threads | List of information about threads to be checked |
| array | $forums | List of information about forums the threads are in; must include unserialized permissions in 'nodePermissions' key |
| string | $errorKey | Modified by reference. If no permission, may include a key of a phrase that gives more info |
| array | null | $viewingUser |
| canUndeleteThreads | ( | array | $threadIds, |
| & | $errorKey = '' , |
||
| array | $viewingUser = null |
||
| ) |
Determines if the selected thread IDs can be undeleted.
| array | $threadIds | List of thread IDs check |
| string | $errorKey | Modified by reference. If no permission, may include a key of a phrase that gives more info |
| array | null | $viewingUser |
| canUndeleteThreadsData | ( | array | $threads, |
| array | $forums, | ||
| & | $errorKey = '' , |
||
| array | $viewingUser = null |
||
| ) |
Determines if the selected threads can be undeleted. This is a slightly more "internal" version of the canUndeleteThreads() function, as the required data must already be retrieved.
| array | $threads | List of information about threads to be checked |
| array | $forums | List of information about forums the threads are in; must include unserialized permissions in 'nodePermissions' key |
| string | $errorKey | Modified by reference. If no permission, may include a key of a phrase that gives more info |
| array | null | $viewingUser |
| deleteThreads | ( | array | $threadIds, |
| array | $options = array() , |
||
| & | $errorKey = '' , |
||
| array | $viewingUser = null |
||
| ) |
Deletes the specified threads if permissions are sufficient.
| array | $threadIds | List of thread IDs to delete |
| array | $options | Options that control the delete. Supports deleteType (soft or hard). |
| string | $errorKey | Modified by reference. If no permission, may include a key of a phrase that gives more info |
| array | null | $viewingUser |
| getThreadsAndParentData | ( | array | $threadIds, |
| array | $viewingUser = null |
||
| ) |
From a list of threads IDs, gets info about the threads and the forums the threads are in.
| array | $threadIds | List of thread IDs |
| array | null | $viewingUser |
| lockThreads | ( | array | $threadIds, |
| array | $options = array() , |
||
| & | $errorKey = '' , |
||
| array | $viewingUser = null |
||
| ) |
Locks the specified threads if permissions are sufficient.
| array | $threadIds | List of thread IDs to change |
| array | $options | Options that control the action. Nothing supported at this time. |
| string | $errorKey | Modified by reference. If no permission, may include a key of a phrase that gives more info |
| array | null | $viewingUser |
| mergeThreads | ( | array | $threadIds, |
| $targetThreadId, | |||
| array | $options = array() , |
||
| & | $errorKey = '' , |
||
| array | $viewingUser = null |
||
| ) |
Merge the specified threads if permissions are sufficient.
| array | $threadIds | List of thread IDs to change |
| integer | $targetThreadId | ID of the thread (in the list) that the merging will happen into |
| array | $options | Options that control the action. Nothing supported at this time. |
| string | $errorKey | Modified by reference. If no permission, may include a key of a phrase that gives more info |
| array | null | $viewingUser |
| stickThreads | ( | array | $threadIds, |
| array | $options = array() , |
||
| & | $errorKey = '' , |
||
| array | $viewingUser = null |
||
| ) |
Stickies the specified threads if permissions are sufficient.
| array | $threadIds | List of thread IDs to change |
| array | $options | Options that control the action. Nothing supported at this time. |
| string | $errorKey | Modified by reference. If no permission, may include a key of a phrase that gives more info |
| array | null | $viewingUser |
| unapproveThreads | ( | array | $threadIds, |
| array | $options = array() , |
||
| & | $errorKey = '' , |
||
| array | $viewingUser = null |
||
| ) |
Unapproves the specified threads if permissions are sufficient.
| array | $threadIds | List of thread IDs to unapprove |
| array | $options | Options that control the action. Nothing supported at this time. |
| string | $errorKey | Modified by reference. If no permission, may include a key of a phrase that gives more info |
| array | null | $viewingUser |
| undeleteThreads | ( | array | $threadIds, |
| array | $options = array() , |
||
| & | $errorKey = '' , |
||
| array | $viewingUser = null |
||
| ) |
Undeletes the specified threads if permissions are sufficient.
| array | $threadIds | List of thread IDs to undelete |
| array | $options | Options that control the action. Nothing supported at this time. |
| string | $errorKey | Modified by reference. If no permission, may include a key of a phrase that gives more info |
| array | null | $viewingUser |
| unlockThreads | ( | array | $threadIds, |
| array | $options = array() , |
||
| & | $errorKey = '' , |
||
| array | $viewingUser = null |
||
| ) |
Unlocks the specified threads if permissions are sufficient.
| array | $threadIds | List of thread IDs to change |
| array | $options | Options that control the action. Nothing supported at this time. |
| string | $errorKey | Modified by reference. If no permission, may include a key of a phrase that gives more info |
| array | null | $viewingUser |
| unstickThreads | ( | array | $threadIds, |
| array | $options = array() , |
||
| & | $errorKey = '' , |
||
| array | $viewingUser = null |
||
| ) |
Stickies the specified threads if permissions are sufficient.
| array | $threadIds | List of thread IDs to change |
| array | $options | Options that control the action. Nothing supported at this time. |
| string | $errorKey | Modified by reference. If no permission, may include a key of a phrase that gives more info |
| array | null | $viewingUser |


# -*- coding: utf-8 -*-
""" Laplcian Energy
The Laplcian energy (LE) for a graph :math:`G` is computed as
.. math::
LE(G) = \\sum_{i=1}^n | { \\mu_{i} - \\frac{2m}{n} } |
ξ(A_1, A_2 ; t) = ‖exp(-tL_1 ) - exp(-tL_2 )‖_F^2
Where :math:`\mu_i` denote the eigenvalue associated with the node of the Laplcian
matrix of :math:`G` (Laplcian spectrum) and :math:`\\frac{2m}{n}` the average vertex degree.
For a details please go through the original work (Gutman2006_).
|
-----
.. [Gutman2006] Gutman, I., & Zhou, B. (2006). Laplacian energy of a graph. Linear Algebra and its applications, 414(1), 29-37.
"""
# Author: Avraam Marimpis<EMAIL_ADDRESS>import numpy as np
import scipy
from scipy import sparse
import bct
[docs]def laplacian_energy(mtx: np.ndarray) -> float:
""" Laplacian Energy
Parameters
----------
mtx : array-like, shape(N, N)
Symmetric, weighted and undirected connectivity matrix.
Returns
-------
le : float
The Laplacian Energy.
"""
lmtx = scipy.sparse.csgraph.laplacian(mtx, normed=False)
w, _ = np.linalg.eig(lmtx)
avg_degree = np.mean(bct.degrees_und(mtx))
le = np.sum(np.abs(w - avg_degree))
return le


HOME
---------
VIEW
---------
ABOUT
MY BLOG PAGE
WECOME TO YOU IN MY BLOG PAGE
WELCOME TO MY BLOG PAGE ....
Search
HI THERE ! THIS IS MD FAISAL IMTIYAZ
Write Something from bellow:
SUBMIT


Initializing...
Hi there
Use mouse to rotate/pan/zoom.
Press space bar to toggle play/pause.
Explanation
here
.
Robert Woodley
2014


{% load static %}
{% include 'djangoapp/navbar.html' %}
{% csrf_token %}
Add a review
Enter the review content:
Has purchased the car from dealership? (select purchased car information below if checked)
Select your car (model-make-year)
{% for car in cars %}
{{car.name}}-{{car.carmake.name}}-{{ car.year|date:"Y" }}
{% endfor %}
Select Your Purchase Date:
{% if message %}
{{ message }}
{% endif %}
Submit review
{% include 'djangoapp/footer.html' %}


{% extends "global/Page.html" %} {% load otree_tags %} {% block title %}Please read this before clicking "Accept"{% endblock %} {% block content %}
This HIT is a brief (5 min.) study about interactive experiments in Amazon Mechanical Turk conducted by the researchers from the University of Zürich.
In case of any issues, please contact us via<EMAIL_ADDRESS>{% endblock %}


EXIT WOUNDS A film review by Max Messier Copyright 2001 filmcritic.com filmcritic.com
To watch a Steven Seagal film, one must fully suspend all disbelief. And to fully enjoy the audacity of Seagal, one must ignore all of the consequences associated with the following: Starting fistfights with large men in flashy nightclubs, destroying everything in sight along the way. Surviving every semi-automatic gun battle and car crash without a scratch. Purchasing Italian racing cars with bundles of $100 bills stuffed in a gym bag. Actually being able to cash out stock options from a dot-com and then creating a private surveillance unit devoted to uncovering a ring of corrupt Detroit cops involved in smuggling heroin inside of sweatshop-produced t-shirts. OK... maybe that corrupt cops thing is a bit hard to swallow.
I remember a time when I used to enjoy Seagal. Such films as Above the Law, Hard to Kill, Marked for Death, Under Siege, and Out for Justice are all solid action films from the '90s. Under Siege is even kind of good. But lately, films like Under Siege 2, Fire Down Below, and The Patriot have shown the age of the Italian stallion of Aikido.
Now, Exit Wounds stands as Seagal's biggest failure, a pitiful reminder of the death of the American action film. By overextending the violence, the ludicrousness, and the sheer improbability of everything, Exit Wounds plays out like a circus of the damned with Tom Arnold working the Tilt-A-Whirl. (Speaking of Tom Arnold, it's always a bad sign when his thespian attempts at comedy are the most memorable parts of a film.)
Exit Wounds is bad -- really, really bad.  Apparently, this particular precinct is filled with police officers who use the gym way too much, use stun guns in strange naked homoerotic bonding moments, and routinely steal heroin from police labs to fund those out-of-state fishing trips so popular among Detroit city cops. Then there's DMX, the hardcore rapper-turned-actor who does a better job in his music videos than in this role as a stereotypical drug dealer/club owner/martial arts master/dot-com entrepreneur. Seagal and DMX team up to stop the corrupt cop ring, run by Michael Jai White (Spawn).
The gratuitous violence of Exit Wounds would have made Peckinpah cringe and reach for the stop button on the remote. In earlier Seagal films, you got brief moments of violence that made the films memorable and not so gory. Exit Wounds overflows with carnage -- people being bloodied by fists wrapped in chains, body parts being impaled on exposed bolts and pipes, people being crushed by oncoming cars and buses. And every single car involved in a chase sequence erupts in flames, of course.
The biggest shame of the film is the misuse of Seagal. Instead of having Seagal demonstrate the prowess and speed of a 7th Dan of Aikido, shown off so well in his earlier films, he ends up being nothing more than a patsy, used to connect the dots of all the inane plot points in what stands as a truly rotten film.

Visit filmcritic.com on the Web at http://www.filmcritic.com
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Class 9 Study Material 2020 Learn From Home during Lockdown
Madhumita Sen Daw, Geography Teacher: DumDum PrachyaBani Mandir High School for Girls


Like most of the posts on this blog, this will be a work in progress. Cryptography is a topic which I stumbled upon and really enjoy. For the reading list skip to the end of this page. There is a long interesting history which would appeal to a casual reader. Most people would be familiar with stories about crypto during WWII, particularly because of movies like The Imitation Game(2014). Cracking of Enigma falls into the espionage theme along with stories like that of books from One of my favorites is: Operation Mincemeat: The True Spy Story That Changed the Course of World War II. Reading so much about the non-fiction side of this topic ultimately led me to the Ian Flemming novels. Of course I had seen all the movies as a kid, and like most, loved them. Reading the novels in their order of release ended up being much more fun than I have with most fictional book series perhaps because of Flemming’s true involvements during WWII.
Gentle brushing against the topic of cryptography with these classical stories eventually lead me to an interest in modern crypto. Real, crypto! Like most sciences portrayed in popular culture, it really only gets interesting when you get into the technical reading. Computerphile has several good videos on cryptographic topics. This video describes SHA1 in a way that I find quite interesting. This is just about hashing methods but it is a lovely introduction to crypto. www.youtube.com Another video from the series now gets to actual crypto in the same entertaining way; End to End Encryption (E2EE).
Learning the basics of crypto and how it’s broken is best done at the same time. Of course actually breaking the crypto is difficult. But understanding it doesn’t have to be. To learn this you can quickly get the main points about modular arithmetic, exponentiation, and periods in this video. Shor’s algorithm
I think getting a clear grasp on the topic relies on getting used to modular arithmetic. For example on a clock we use Mod 12. If you get up at 12am and the time is now 1pm well then obviously you have been up for 13 hours. 13 mod 12 = 1. You know just as well that if you get up at 7am and it is now 8pm you have also been up for 13 hours. We can do this in our head very easily, and can do other examples easily too if you get over the initial confusion. A/B = Q remainder R. In some cases we only care about the remainder R. In that case we say: A modulo B is equal to R. Where B is referred to as the modulus (or mod for short). The only difficulty is when the numbers become quite large. Here is a page that describes this very well.
This video is summed up with the 4 steps. The reason that RSA works is because Step 2, finding the period, takes a very long time:
Quantum computing is expected to dramatically speed up this step. Another good intro video that has some interesting discussion on Diffie-Hellman key exchange was given at the Chaos Communication Congress: J. Alex Halderman, Nadia Heninger: Logjam: Diffie-Hellman, discrete logs, the NSA, and you.
“Earlier this year, we discovered that Diffie-Hellman key exchange – cornerstone of modern cryptography – is less secure in practice than the security community believed. In this talk, we’ll explain how the NSA is likely exploiting this weakness to allow it to decrypt connections to at least 20% of HTTPS websites, 25% of SSH servers, and 66% of IPsec VPNs.” www.youtube.com
Applied Cypto Handbook is a very good technical introduction and probably as far as a general reader will ever want to go. http://cacr.uwaterloo.ca/hac/
This lecture is the perfect intro if you already know what methods are out there. www.youtube.com The accompanying book is worth the money if you’re looking for a textbook. The table of contents is available on amazon. http://www.crypto-textbook.com. Here is a link to Galois’ wiki. This might lead you down a wiki rabbit hole learning about interesting maths.
Here are simply two videos from PBS that will be more entertaining and succinct at discussing this really interesting topic than I. How quantum computing works How might quantum computing destroy computer security? By utilising Shor’s algorithm
A fun little topic brought up in this videos is: that quantum Fourier transform uses resonance to amplify the basic state associated with the correct period.  If that is the case you may be more familiar with protein structures than quantum mechanics. I first became introduced to the practical application of Fourier transformation while learning nuclear magnetic resonance (NMR) spectroscopy for protein structuring.  It happens automatically during data analysis but most people in the field surely would still like to know the details. Wiki has a great page: https://en.wikipedia.org/wiki/Fourier_transform “In NMR an exponentially shaped free induction decay (FID) signal is acquired in the time domain and Fourier-transformed to a Lorentzian line-shape in the frequency domain.”
The next main point addressed in this video is: Complex roots of unity. This is introduced quite well in the video. If you have never seen anything like this before then I highly recommend the short book by Feynman; QED: The Strange Theory of Light and Matter In no way does this little book talk about quantum computing. If fact it is pretty old now and is not the kind of thing that professionals will be using for reference. Why would I suggest this for someone who is new to the topic? Well it is an extremely fun introduction to the topic of QED and lays the foundation of ideas that have become mainstream over the next 30 years. Understanding some basic ideas will leave you open to recognise more complex applications, especially important if you want to only look at the basics of quantum computing.
This talk at Google by Peter Warren Singer based on his book, Cybersecurity and Cyberwar, may be a pretty interesting watch for anyone into technology security in some way. This is not a technical talk, more of something to get you into the mindset up why this topic may be interesting. www.youtube.com https://www.cl.cam.ac.uk/~rja14/book.html Security Engineering — The Book
The cryptopals crypto challenges are a fun way to learn some hands on application of cryptographic techniques. http://www.cryptopals.com/
Announcing the first SHA1 collision on February 23, 2017. This was a really big event in the crypto community. I think many people in the cyber security field assume that experiments and findings in public and academic research are a few years behind government capabilities. Take from that what you will. https://security.googleblog.com/2017/02/announcing-first-sha1-collision.html
There are countless reasons why crypto is interesting. The applications range from the most mundane day to day requirements in the modern world such as banking, personal communication, the use of medical data (which I post about here Pretty good privacy for academic data) all the way out to the most hypothetical academic applications. An interesting point to think about is the journey that each data packet makes across the mystical internet. Most electronic communications travel across a number of boarders and further distances than most people will travel in their entire life. Our world would not run very smoothly if all communication was sent in a readable format with no protection. Here is some basic info on the infrastructure require for modern electronic communication: www.youtube.com, www.youtube.com And the Submarine Cable Map.
While we’re on the topic, I found this video on the Cornwall cable landing station. The physical infrastructure and engineering requirements of global communication are sometimes easy to forget if one spends more time on computer programming or mathematics www.youtube.com.
/r/crypto wiki
https://www.reddit.com/r/crypto/wiki/index
Textbook: An Introduction to Mathematical Cryptography
http://citeseerx.ist.psu.edu/viewdoc/download;jsessionid=5F72903FBACA6DF57799612526CC437F?doi=<IP_ADDRESS>.9999&rep=rep1&type=pdf
Cryptology ePrint Archive
http://eprint.iacr.org
Handbook of Applied Cryptography
http://cacr.uwaterloo.ca/hac/
Goldreich: The Foundations of Cryptography
http://www.wisdom.weizmann.ac.il/%7Eoded/foc-drafts.html
Handbook of Elliptic and Hyperelliptic Curve Cryptography
http://www.hyperelliptic.org/HEHCC/
eBACS: ECRYPT Benchmarking of Cryptographic Systems
http://bench.cr.yp.to
Mihir Bellare and Shafi Goldwasser’s Lecture Notes
http://cseweb.ucsd.edu/%7Emihir/papers/gb.pdf
Charm: A tool for rapid cryptographic prototyping
http://www.charm-crypto.com/index.html
eHash Wiki
Hash Function Zoo
and the SHA-3 Zoo
http://ehash.iaik.tugraz.at/wiki/The_eHash_Main_Page
Cryptology ePrint Archive
http://eprint.iacr.org
IACR Conferences (Crypto, Eurocrypt, Asiacrypt)
http://www.iacr.org/conferences/
IEEE Symposium on Security and Privacy (There are loads of papers and talks on YouTube under Program of past events)
https://www.ieee-security.org/TC/SP2017/past.html
Crypto Stack Exchange
https://crypto.stackexchange.com
Blogpost so-you-want-to-crypto
https://www.seancassidy.me/so-you-want-to-crypto.html
Authenticated Encryption Zoo
https://aezoo.compute.dtu.dk/doku.php?id=AE%20Zoo
Helger Lipmaa Cryptology Pointers
http://kodu.ut.ee/~lipmaa/crypto/
Free Course: Applied Cryptography
https://www.udacity.com/course/applied-cryptography–cs387
Kerckhoffs’s principle
https://en.wikipedia.org/wiki/Kerckhoffs%27s_principle
Schneier’s Law
https://www.schneier.com/blog/archives/2011/04/schneiers_law.html
crypto blogs from David Wong’s github
https://github.com/mimoo/crypto_blogs
Shor in Haskell The Quantum IO Monad
http://www.cs.nott.ac.uk/%7Epsztxa/publ/qio.pdf
The Quipper Language: programming language for quantum computing
http://www.mathstat.dal.ca/%7Eselinger/quipper/
Like most of the posts on this blog, this will be a work in progress. Cryptography is a topic which I stumbled upon and really enjoy. For the reading list skip to the end of this page. There is a long interesting history which would appeal to a casual reader. Most people would be familiar with stories about crypto during WWII, particularly because of movies like The Imitation Game(2014). Cracking of Enigma falls into the espionage theme along with stories like that of books from One of my favorites is: Operation Mincemeat: The True Spy Story That Changed the Course of World War II. Reading so much about the non-fiction side of this topic ultimately led me to the Ian Flemming novels. Of course I had seen all the movies as a kid, and like most, loved them. Reading the novels in their order of release ended up being much more fun than I have with most fictional book series perhaps because of Flemming’s true involvements during WWII.
Gentle brushing against the topic of cryptography with these classical stories eventually lead me to an interest in modern crypto. Real, crypto! Like most sciences portrayed in popular culture, it really only gets interesting when you get into the technical reading. Computerphile has several good videos on cryptographic topics. This video describes SHA1 in a way that I find quite interesting. This is just about hashing methods but it is a lovely introduction to crypto. www.youtube.com Another video from the series now gets to actual crypto in the same entertaining way; End to End Encryption (E2EE).
Learning the basics of crypto and how it’s broken is best done at the same time. Of course actually breaking the crypto is difficult. But understanding it doesn’t have to be. To learn this you can quickly get the main points about modular arithmetic, exponentiation, and periods in this video. Shor’s algorithm
I think getting a clear grasp on the topic relies on getting used to modular arithmetic. For example on a clock we use Mod 12. If you get up at 12am and the time is now 1pm well then obviously you have been up for 13 hours. 13 mod 12 = 1. You know just as well that if you get up at 7am and it is now 8pm you have also been up for 13 hours. We can do this in our head very easily, and can do other examples easily too if you get over the initial confusion. A/B = Q remainder R. In some cases we only care about the remainder R. In that case we say: A modulo B is equal to R. Where B is referred to as the modulus (or mod for short). The only difficulty is when the numbers become quite large. Here is a page that describes this very well.
This video is summed up with the 4 steps. The reason that RSA works is because Step 2, finding the period, takes a very long time:
Quantum computing is expected to dramatically speed up this step. Another good intro video that has some interesting discussion on Diffie-Hellman key exchange was given at the Chaos Communication Congress: J. Alex Halderman, Nadia Heninger: Logjam: Diffie-Hellman, discrete logs, the NSA, and you.
“Earlier this year, we discovered that Diffie-Hellman key exchange – cornerstone of modern cryptography – is less secure in practice than the security community believed. In this talk, we’ll explain how the NSA is likely exploiting this weakness to allow it to decrypt connections to at least 20% of HTTPS websites, 25% of SSH servers, and 66% of IPsec VPNs.” www.youtube.com
Applied Cypto Handbook is a very good technical introduction and probably as far as a general reader will ever want to go. http://cacr.uwaterloo.ca/hac/
This lecture is the perfect intro if you already know what methods are out there. www.youtube.com The accompanying book is worth the money if you’re looking for a textbook. The table of contents is available on amazon. http://www.crypto-textbook.com. Here is a link to Galois’ wiki. This might lead you down a wiki rabbit hole learning about interesting maths.
Here are simply two videos from PBS that will be more entertaining and succinct at discussing this really interesting topic than I. How quantum computing works How might quantum computing destroy computer security? By utilising Shor’s algorithm
A fun little topic brought up in this videos is: that quantum Fourier transform uses resonance to amplify the basic state associated with the correct period.  If that is the case you may be more familiar with protein structures than quantum mechanics. I first became introduced to the practical application of Fourier transformation while learning nuclear magnetic resonance (NMR) spectroscopy for protein structuring.  It happens automatically during data analysis but most people in the field surely would still like to know the details. Wiki has a great page: https://en.wikipedia.org/wiki/Fourier_transform “In NMR an exponentially shaped free induction decay (FID) signal is acquired in the time domain and Fourier-transformed to a Lorentzian line-shape in the frequency domain.”
The next main point addressed in this video is: Complex roots of unity. This is introduced quite well in the video. If you have never seen anything like this before then I highly recommend the short book by Feynman; QED: The Strange Theory of Light and Matter In no way does this little book talk about quantum computing. If fact it is pretty old now and is not the kind of thing that professionals will be using for reference. Why would I suggest this for someone who is new to the topic? Well it is an extremely fun introduction to the topic of QED and lays the foundation of ideas that have become mainstream over the next 30 years. Understanding some basic ideas will leave you open to recognise more complex applications, especially important if you want to only look at the basics of quantum computing.
This talk at Google by Peter Warren Singer based on his book, Cybersecurity and Cyberwar, may be a pretty interesting watch for anyone into technology security in some way. This is not a technical talk, more of something to get you into the mindset up why this topic may be interesting. www.youtube.com https://www.cl.cam.ac.uk/~rja14/book.html Security Engineering — The Book
The cryptopals crypto challenges are a fun way to learn some hands on application of cryptographic techniques. http://www.cryptopals.com/
Announcing the first SHA1 collision on February 23, 2017. This was a really big event in the crypto community. I think many people in the cyber security field assume that experiments and findings in public and academic research are a few years behind government capabilities. Take from that what you will. https://security.googleblog.com/2017/02/announcing-first-sha1-collision.html
There are countless reasons why crypto is interesting. The applications range from the most mundane day to day requirements in the modern world such as banking, personal communication, the use of medical data (which I post about here Pretty good privacy for academic data) all the way out to the most hypothetical academic applications. An interesting point to think about is the journey that each data packet makes across the mystical internet. Most electronic communications travel across a number of boarders and further distances than most people will travel in their entire life. Our world would not run very smoothly if all communication was sent in a readable format with no protection. Here is some basic info on the infrastructure require for modern electronic communication: www.youtube.com, www.youtube.com And the Submarine Cable Map.
While we’re on the topic, I found this video on the Cornwall cable landing station. The physical infrastructure and engineering requirements of global communication are sometimes easy to forget if one spends more time on computer programming or mathematics www.youtube.com.
/r/crypto wiki
https://www.reddit.com/r/crypto/wiki/index
Textbook: An Introduction to Mathematical Cryptography
http://citeseerx.ist.psu.edu/viewdoc/download;jsessionid=5F72903FBACA6DF57799612526CC437F?doi=<IP_ADDRESS>.9999&rep=rep1&type=pdf
Cryptology ePrint Archive
http://eprint.iacr.org
Handbook of Applied Cryptography
http://cacr.uwaterloo.ca/hac/
Goldreich: The Foundations of Cryptography
http://www.wisdom.weizmann.ac.il/%7Eoded/foc-drafts.html
Handbook of Elliptic and Hyperelliptic Curve Cryptography
http://www.hyperelliptic.org/HEHCC/
eBACS: ECRYPT Benchmarking of Cryptographic Systems
http://bench.cr.yp.to
Mihir Bellare and Shafi Goldwasser’s Lecture Notes
http://cseweb.ucsd.edu/%7Emihir/papers/gb.pdf
Charm: A tool for rapid cryptographic prototyping
http://www.charm-crypto.com/index.html
eHash Wiki
Hash Function Zoo
and the SHA-3 Zoo
http://ehash.iaik.tugraz.at/wiki/The_eHash_Main_Page
Cryptology ePrint Archive
http://eprint.iacr.org
IACR Conferences (Crypto, Eurocrypt, Asiacrypt)
http://www.iacr.org/conferences/
IEEE Symposium on Security and Privacy (There are loads of papers and talks on YouTube under Program of past events)
https://www.ieee-security.org/TC/SP2017/past.html
Crypto Stack Exchange
https://crypto.stackexchange.com
Blogpost so-you-want-to-crypto
https://www.seancassidy.me/so-you-want-to-crypto.html
Authenticated Encryption Zoo
https://aezoo.compute.dtu.dk/doku.php?id=AE%20Zoo
Helger Lipmaa Cryptology Pointers
http://kodu.ut.ee/~lipmaa/crypto/
Free Course: Applied Cryptography
https://www.udacity.com/course/applied-cryptography–cs387
Kerckhoffs’s principle
https://en.wikipedia.org/wiki/Kerckhoffs%27s_principle
Schneier’s Law
https://www.schneier.com/blog/archives/2011/04/schneiers_law.html
crypto blogs from David Wong’s github
https://github.com/mimoo/crypto_blogs
Shor in Haskell The Quantum IO Monad
http://www.cs.nott.ac.uk/%7Epsztxa/publ/qio.pdf
The Quipper Language: programming language for quantum computing
http://www.mathstat.dal.ca/%7Eselinger/quipper/


Happy December! We have a minor point release today. It has just a few small bug fixes.
The release is now available for download:
We've also published version 0.14.4
of the react
, react-dom
, and addons
packages on npm and the react
package on bower.
autoCapitalize
and autoCorrect
props are now set as attributes in the DOM instead of properties to improve cross-browser compatibility<select>
elements not handling updates properly.printDOM()


23.4 Changing and Generating XML
Just
like for HTML and other kinds of structured text, the simplest way to
output an XML document is often to prepare and write it using
Python's normal string and file operations, covered
in Chapter 9 and Chapter 10. Templating, covered in Chapter 22, is also often the best approach. Subclassing
class XMLGenerator, covered earlier in this
chapter, is a good way to generate an XML document that is like an
input XML document, except for a few changes.
The xml.dom.minidom module offers yet another
possibility, because its classes support methods to generate, insert,
remove, and alter nodes in a DOM tree representing the document. You
can create a DOM tree by parsing and then alter it, or you can create
an empty DOM tree and populate it, and then output the resulting XML
document with methods toxml,
toprettyxml, or writexml of the
Document instance. You can also output a subtree
of the DOM tree by calling these methods on the
Node that is the subtree's root.
23.4.1 Factory Methods of a Document Object
The
Document class supplies factory methods to create
new instances of subclasses of Node. The most
frequently used factory methods of a Document
instance d are as follows.
Builds and returns an instance
c of class Comment for
a comment with text data.
Builds and returns an instance e of class
Element for an element with the given tag.
Builds and returns an instance t of class
TextNode for a text node with text
data.
23.4.2 Mutating Methods of an Element Object
An
instance e of class
Element supplies the following methods to remove
and add attributes.
Removes e's attribute
with the given name.
e.setAttribute(name,value)
|
|
Changes e's attribute
with the given name to have the given
value, or adds to
e a new attribute with the given
name and value
if e had no attribute named
name.
23.4.3 Mutating Methods of a Node Object
An instance n
of class Node supplies the following methods to
remove, add, and replace children.
Makes child the last child of
n, whatever
child's parent was
(including n or None).
n.insertBefore(child,nextChild)
|
|
Makes child
the child of n immediately before
nextChild, whatever
child's parent was
(including n or None).
nextChild must be a child of
n.
 Returns
oldChild.
23.4.4 Output Methods of a Node Object
An instance n of class
Node supplies the following methods to output the
subtree rooted at n.
n.toprettyxml(indent='\t',newl='\n')
|
|
Returns a string, plain or Unicode, with the XML source for the
subtree rooted at n, using
indent to indent nested tags and
newl to end lines.
Like
n.toprettyxml('',''),
i.e., inserts no extraneous whitespace.
Writes the XML source for the subtree rooted at
n to file-like object
file, open for writing. Note that
file.write must accept
Unicode strings (as covered in Section 9.6.1), unless
all text in the XML source produced can be converted implicitly to
plain strings using the current default encoding (normally
'ascii').
23.4.5 Changing and Outputting XHTML with xml.dom.minidom
The following example uses
xml.dom.minidom to analyze an XHTML page and
output it to standard output with each hyperlink's
destination URL shown, in three sets of parentheses, just before the
hyperlink:
import xml.dom.minidom, urllib, sys
f = urllib.urlopen('http://www.w3.org/MarkUp/')
doc = xml.dom.minidom.parse(f)
as = doc.getElementsByTagName('a')
for a in as:
value = a.getAttribute('href')
if value:
newtext = doc.createTextNode(' (((%s)))'%value)
a.parentNode.insertBefore(newtext,a)
class UnicodeStdoutWriter:
def write(self, data):
sys.stdout.write(data.encode('utf-8'))
doc.writexml(UnicodeStdoutWriter( ))
This example wraps sys.stdout in a little
UnicodeStdoutWriter class in order to encode
Unicode output. Further, it uses encoding 'utf-8'
because that is the encoding that the XML standard specifies as the
default, and up to Python 2.2.2 we have no way of asking object
doc to explicitly request a different
encoding. In Python 2.3, method writexml accepts
an optional keyword argument named encoding that
lets us control the encoding attribute in the XML
declaration.
|


For this assignment we chose to test two different input methods, a mouse and a laptop touch screen. We tested 3 people starting with Carl Mueller, then Shiva Darian, and ending with Benjamin Lee. We did not alternate the order of conditions accross the participants, however the sample size of three people made it unlikely that we'd develop heuristics about each condition in the short testing period. Our results showed inconsistency across each condition. No one scenario had a higher throughput across the board. I believe that this is due to the small sample size of participants and without further testing, we cannot claim any statistically significant results.


|
Class Summary |
| Cargo |
This class is responsible for holding the weight of a certain piece of cargo and returning it when necessary. |
| CargoTest |
The test class CargoTest. |
| CoffeeShop |
|
| CoffeeShopTest |
The test class CoffeeShopTest. |
| Edge |
Write a description of class Edge here. |
| EdgeTest |
The test class EdgeTest. |
| ExperimentController |
This class is responsible for reading from a .txt file, adding in all the nodes, edges, and then printing out the closest neighbor in a breadth first order |
| Graph |
Write a description of class Graph here. |
| GraphTest |
The test class GraphTest. |
| Truck |
|
| TruckTest |
The test class TruckTest. |
| Vertex |
Write a description of class Vertex here. |
| VertexTest |
The test class VertexTest. |
| Warehouse |
|
| WarehouseTest |
The test class WarehouseTest. |


Take the survey
Requires a touch device
View the results
Best viewed on a PC or tablet
Download data
Generated once a day
Fork on GitHub
Node + Open Source


Contents of Elliott 900 Technical Manual
Errata.pdf
README.TXT
Volume 1 Functional Specification
Volume 2A Programming Information
Volume 2B Programming information
Volume 2C Programming Information
Volume 3 Operating Instructions
Volume 4A Engineering Maintenance - Basic Equipment - Binder 1
Volume 4B Engineering Maintenance - Basic Equipment - Binder 2
Volume 4D Engineering Maintenance - Optional Units
Volume 4E Engineering Maintenance - Peripheral Equipment
Volume 4H Engineering Maintenance - Logic Elements
index.htm
BACK TO PARENT

BACK TO TOP


A switch behaves a bit like a checkbox - it can be on or off (i.e checked or unchecked). The key difference is that a switch is not a true form control. It typically executes JavaScript on the client when toggled (i.e. without a full page reload) rather than storing form data to be sent to the server.
Whereas checkboxes are often used to allow multi-selection from a group of choices, switches are more often used in isolation or as a series of unrelated options.
A switch requires the switch role and aria-checked attribute for assistive technology.
REMEMBER: every switch requires a visible, programmatic label to indicate its purpose.
The default version of the switch requires JavaScript to maintain the aria-checked state when clicked.
The switch__control child element requires a tabindex value of 0 (zero) to be keyboard focusable.
To disable a switch, apply the aria-disabled attribute.
The tabindex property must be set to -1 (negative one) to prevent keyboard focus.
This version of the switch uses a checkbox under the hood. It should be used if you require the switch to store data inside of a form. As mentioned above however, this is not the intended purpose of a switch. You may wish to consider using an actual checkbox instead.
To disable a checkbox switch, apply the disabled attribute.
The following custom properties (aka CSS Variables) are available for system color-scheme appearance (i.e. light-mode & dark-mode) and other general theming purposes:


WorkOut Buddies
Experience life style change with friends!!
Login
Email address
Password
Login
Or sign up
HERE
.
Forgot Password
Activate Account


@* * Copyright 2017 HM Revenue & Customs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. *@ @import uk.gov.hmrc.play.views.html.helpers.form @import helpers._ @import controllers.CreateGroupAccountVM @import controllers.CreateGroupAccount.keys @(model: CreateGroupAccountVM)(implicit request: Request[_], messages: Messages) @main_template(title = Messages("createAccount.group.title"), topNavigation = false) {
@Messages("createAccount.p1")
@Messages("isAgent.details")
}


pointy hat
`Prev `__
P
`Next `__
--------------
**pointy hat**: n.
See `*wizard hat* <../W/wizard-hat.html>`__. This synonym specifically
refers to the wizards of Unseen University in Terry Pratchett's
*Discworld* series of humorous fantasies; these books are extremely
popular among hackers.
--------------
+----------------------------------------------+----------------------------+----------------------------------+
| `Prev `__ | `Up <../P.html>`__ | `Next `__ |
+----------------------------------------------+----------------------------+----------------------------------+
| point-and-drool interface | `Home <../index.html>`__ | pointy-haired |
+----------------------------------------------+----------------------------+----------------------------------+


hr:No limit
hr size:50px
hr size:20% size=3
hr size:40% size=5
hr size:60% size=7
hr size:80% size=17


(setq load-path (cons "~/path/to/orgdir/lisp" load-path))
(setq load-path (cons "~/path/to/orgdir/contrib/lisp" load-path))
wirte require 'org-install
in .emacs
, documents autoload with the startup
of emacs not autoload with org-mode startup.
Add following lines in .emacs
.
;; The following lines are always needed. Choose your own keys.
(add-to-list 'auto-mode-alist '("\\.org\\'" . org-mode))
(add-hook 'org-mode-hook 'turn-on-font-lock) ; not needed when global-font-lock-mode is on
(global-set-key "\C-cl" 'org-store-link)
(global-set-key "\C-ca" 'org-agenda)
(global-set-key "\C-cb" 'org-iswitchb)
open *.org
emacs will go to org-mode
.
* Top level headline
** Second level
*** 3rd level
some text
*** 3rd level
more text
* Another top level headline