Here’s an idea that’s been kicking around inside my head recently.
A standard M2M relationship, as represented in SQL, looks like this:
CREATE TABLE movie (
id SERIAL PRIMARY KEY,
name VARCHAR(255)
);
| ### JHW 2018 | |
| import numpy as np | |
| import umap | |
| # This code from the excellent module at: | |
| # https://stackoverflow.com/questions/4643647/fast-prime-factorization-module | |
| import random |
| * [ ] A1: Do images that convey contextual content have equivalent alternative text specified in the alt attribute of the img element? | |
| * [ ] A2: Do images that are purely decorative, and not contextual, have empty, or null, alternative text specified, e.g. alt=""? | |
| * [ ] A3: Does the alternate text convey contextual relevance to the page it is on? | |
| * [ ] A4: Do images that convey complex content have longdesc attributes or equivalent text content available elsewhere on the page? | |
| * [ ] A5: Does text content contained in images disappear when images are not available, i.e. is there text contained in the images? | |
| * [ ] A6: Do image map area elements have the link destination correctly titled? If the title attribute is used, it ought not to duplicate the alt text. | |
| * [ ] A7: Do form non-text controls, e.g. input type image, provide a text alternative that identifies the purpose of the non-text control? | |
| * [ ] A8: Do noframes elements have appropriate equivalent or alternative content for user agents that do not suppor |
| NEWTON is riding his bicycle in Lincolnshire when he comes across | |
| SOCRATES on the road. | |
| SOCRATES: For what purpose do you return to Woolsthorpe my dear sir? | |
| NEWTON: Cambridge has been closed due to the plague. | |
| SOCRATES: By Zeus! Closed? | |
| NEWTON: Indeed. | |
| SOCRATES: And so what are you doing with your time here? Surely not | |
| farming. |
Here’s an idea that’s been kicking around inside my head recently.
A standard M2M relationship, as represented in SQL, looks like this:
CREATE TABLE movie (
id SERIAL PRIMARY KEY,
name VARCHAR(255)
);
| def bitstruct(structure, value): | |
| result = [] | |
| index = 8 | |
| for part in structure: | |
| result.append((value & ((2 ** index - 1) - (2 ** (index - part) - 1))) >> (index - part)) | |
| index -= part | |
| return tuple(result) | |
| if __name__ == "__main__": | |
| assert bitstruct((8, ), 42) == (42, ) |
| export PATH=/usr/local/bin:$PATH | |
| export PATH=/usr/local/share/python:$PATH | |
| RED="\[\033[01;31m\]" | |
| GREEN="\[\033[32m\]" | |
| LGREEN="\[\033[01;32m\]" | |
| YELLOW="\[\033[01;33m\]" | |
| BLUE="\[\033[01;34m\]" | |
| PURPLE="\[\033[01;35m\]" | |
| CYAN="\[\033[01;36m\]" |
| #!/usr/bin/env python | |
| import os | |
| import os.path | |
| for root, dirs, files in os.walk("."): | |
| for filename in files: | |
| path = os.path.join(root, filename) | |
| if any(filename.endswith(ending) for ending in [".py", ".html", ".txt", ".css"]): | |
| marked = [] |
| #!/usr/bin/env python | |
| import os | |
| import os.path | |
| for root, dirs, files in os.walk("."): | |
| for filename in files: | |
| path = os.path.join(root, filename) | |
| if any(filename.endswith(ending) for ending in [".py", ".html", ".txt", ".css"]): | |
| tabs = False |
| # Implementation of Simon Plouffe's formula for Pi in Hex | |
| # | |
| # James Tauber 2007-03-14 | |
| # http://jtauber.com/blog/2007/03/14/generating_the_hex_digits_of_pi/ | |
| def pi(): | |
| N = 0 | |
| n, d = 0, 1 | |
| while True: | |
| xn = (120*N**2 + 151*N + 47) |
| # Python implementation of the Gibbons-Lester-Bird algorithm[1] for enumerating | |
| # the positive rationals. | |
| # | |
| # James Tauber 2004-07-01 | |
| # http://jtauber.com/ | |
| # | |
| # [1] http://web.comlab.ox.ac.uk/oucl/work/jeremy.gibbons/publications/rationals.pdf | |
| def rationals(): | |
| """ |