-
codepoint The Unicode standard describes how characters are represented by code points. A code point is an integer value, usually denoted in base 16. In the standard, a code point is written using the notation U+12CA to mean the character with value 0x12ca (4,810 decimal). The Unicode standard contains a lot of tables listing characters and their corresponding code points:
U+12CA
is a codepoint, which represents some particular character; -
A Unicode string is a sequence of code points, which are numbers from 0 through 0x10FFFF (1,114,111 decimal). This sequence needs to be represented as a set of bytes (meaning, values from 0 through 255) in memory. The rules for translating a Unicode string into a sequence of bytes are called an encoding.
-
A character is represented on a screen or on paper by a set of graphical elements that’s called a glyph. The glyph for an uppercase A, for example, is two diagonal strokes and a horizontal stroke, though the exact details will depend on the font being used.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sphinx-quickstart | |
In conf.py add the path of the project as follows | |
sys.path.insert(0, os.path.abspath('/home/pavan/code/kafka_project')) | |
# to generate rst files from modules, use the following command | |
$ sphinx-apidoc -o build_docs/api/ -f /home/pavan/code/kafka_project/framework | |
To build the module use the following command in root_directory of sphinx where conf.py, static and templates files are included. | |
$ sphinx-build . _build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
The built-in __import__ function accomplishes the same goal as using the import statement, | |
but it's an actual function, and it takes a string as an argument. | |
""" | |
sys = __import__('sys') | |
os = __import__('os') | |
re = __import__('re') | |
unittest = __import__('unittest') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import abc | |
class SuperclassMeta(type): | |
def __new__(mcls, classname, bases, cls_dict): | |
cls = super().__new__(mcls, classname, bases, cls_dict) | |
for name, member in cls_dict.items(): | |
if not getattr(member, '__doc__'): | |
member.__doc__ = getattr(bases[-1], name).__doc__ | |
return cls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Install supervisor python3 | |
pip3 install git+https://github.com/Supervisor/supervisor | |
[supervisord] | |
nodaemon=false | |
[supervisorctl] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setup tools: | |
when ever there isa source distribution which consists of setup.py file, we can directly install using the following command | |
# cd foo.1.0/ | |
# python setup.py install | |
if we need to split the build we can use the following commands | |
# python setup.py build | |
# python setup.py install | |
prefix, exec-prefix stands for the directories that Python is installed to, and where it finds its libraries at run-time. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Threads: | |
Thread is a small piece of code executed separately. | |
Threads are created with three pieces of information | |
Thread name | |
Runnable target - run() | |
stack size | |
Life cycle of a Thread: | |
By using Thread.getState() - we can know the state of the thread. | |
Thread.getState() returns enum state of a thread. |
- matching groups
gawk '{
match($0, /ns0:OpenDate>(.+?)<\/ns0:OpenDate.+?ns0:CloseDate>(.+?)<\/ns0:CloseDate/, Arr)
printf "%s %s\n", Arr[1], Arr[2]
}' *