Week 45 / 2022
Questions
- What is
ppa
? and how apt works?
Networking: introduction
- In packet switched systems, a frame is a simple container for a single network packet. A frame is the protocol data unit at the data link layer. Frames are the result of the final layer of encapsulation before the data is transmitted over the physical layer. and consists of a link layer header followed by a packet.
ping [destination]
: rtt (round trip time) to this detination, what is thettl
?tracepath [destination]
: nodes we are going through to this destination. each time is the time between me and this router (node) not from the previous node and this router, so we arn not adding/summing these times.- Wireshark is an open-source network protocol analyzer, a free packet sniffer
sudo add-apt-repository ppa:wireshark-dev/stable
sudo apt update
sudo apt install wireshark
sudo wireshark
Edgedb
- time in edgedb:
std::datetime
very precise and always has a timezone (ISO 8601),cal::local__datetime
doesn't worry about timezone,cal::local_date
, andcal::local_time
constraint expression on (); for properties.
- select while inserting to return specific properties not the
uuid
only:select (insert [] {...}) {....};
- iso 8601 datetime format:
YYYY-MM-DDTHH:MM:SSZ
,Z
means 0 different (offset) from UTC: in other words, it is UTC. to_datetime()
- float type with “arbitrary precision”, become imprecise after a while thanks to rounding errors.
Fastapi: scalable-fastapi-aws (TFD)
- feature flags?
- microservices?
- Observability vs. APM vs. Monitoring [vs. error reporting? (sentry)]
- Fastapi, (Github, Github Actions and pydist), [cloud provider? AWS. GCP, FLY.io], (pyenv, twine), pytest, Prometheus, Docker Hub, [container orchestration service? kubernetes], Terraform, codecov, Sentry.
- Mono-repo vs Poly-repo __ Always start with a monorepo.
- repository structure? (lib, infrastructure, services, ci_cd, tools)
- If you're following Test-driven Development (TDD), commit after each test passes. Make sure your commits are small; it will be much easier to track changes and perform code reviews.
- Application: you've decided to build yourself an application that will allow people to request that you speak at their conference or event.
- tests that cover just the happy path.
- tests:
tests/unit
,tests/integration
?, andtests/e2e
end-to-end tests? - You have a code base with tests that can run inside a CI/CD pipeline. You have an application that you can deploy and monitor. That's perfect for now, what come next, we'll set up a CI/CD pipeline for our current application.
- ..application that will be able to follow changes in your business model.
- CI/CD: it's better to use images that only contain the things you need.
- Running things as root inside a Docker container is not safe. That's why you added a new user.
- Treeaform uses a YAML-like language called HashiCorp language (HCL)
- VPC (Virtual Private Cloud)?
- Cloud Certification: sherif abdlnaby
Frappe
set-up
- vscode dev container: container-based development. Adding dev container ->
.devcontiner/devcontainer.json
. Reopen - port forwarding?
- commands:
-
git clone https://github.com/frappe/frappe_docker.git && cd frappe_docker
-
Reopen from vscode
-
version-13:
PYENV_VERSION=3.9.9 bench init --skip-redis-config-generation --frappe-branch version-13 frappe-bench
-
cd frappe_bench
-
Tell bench to use the right containers instead of localhost (or from the
common_site_config.json
):bench set-config -g db_host mariadb && bench set-config -g redis_cache redis://redis-cache:6379 && bench set-config -g redis_queue redis://redis-queue:6379 && bench set-config -g redis_socketio redis://redis-socketio:6379
-
bench new-site mysite.localhost --mariadb-root-password 123 --admin-password admin --no-mariadb-socket
-
erpnext, v13:
bench get-app --branch version-13 erpnext && bench --site [sitename] install-app erpnext
-
bench start
- Also, you can manually start containers:
docker-compose -f .devcontainer/docker-compose.yml up -d
- If you got
404 - not found
error, check for thecurrentsite.txt
, if doesn't exist, thenbench use [sitename]
- reset admin password:
bench set-admin-password [password]
. - uninstall app from the current site:
bench uninstall-app --force [app-name] --yes
pytest
Accounting
- Accountants are bean counters, whose job it is to make sure enough money is coming in to cover all the money going out.
- Accounting is much more than just keeping the books
- [Book 1 to Book 3]: 63 pages
- differences between bookkeeping and accounting?
- accounting cycle?
- Bookkeeping is the process of recording your company’s financial transactions into organized accounts on a daily basis. different techniques: (single-entry, double-entry)
- when a transaction occurs in a double entry system, one account is debited while another account is credited. An account is debited either to increase the asset balance or to decrease the liability balance.
- Debit means an entry recorded for a payment made or owed. Usually an expense or any asset addition or a reduce in the revenue, or liabilities are termed as debits.
- A credit entry is used to decrease the value of an asset or increase the value of a liability.
erpnext
- stock: main types of entries, Purchase Receipt, Stock Entry, Delivery Note.
- Warehouse types?
- Stock Balance report
- erpnext Automatic Reordering for item, will raise a Material Request for the Item. The user with roles Purchase Manager and Stock Manager will be notified when the Material Request is created.
- There are multiple reports available you can check for item's stock level.
- Quick Stock Balance quickly retrieve the current stock balance (quantity) and value of an item, in the specified warehouse, on the specified date.
- Stock Ledger Report a detailed record that keeps track of stock movements for a company.
- Stock Projected Quantity Report
ActivityPub
- The ActivityPub protocol is a decentralized social networking protocol
- Two Layers: A server to server federation protocol (Federation Protocol), A client to server protocol (Social API). ActivityPub implementations can implement just one of these things or both of them.
- User's accounts on different servers correspond to different actors. (we need a global identity?)
- Inbox and Outbox
- ActivityStreams includes all the common terms you need to represent, all the activities and content flowing around a social network. It's likely that ActivityStreams already includes all the vocabulary you need, but even if it doesn't, ActivityStreams can be extended via
JSON-LD
. (?) - "inbox" and "outbox" things can help us out both behave differently for GET and POST.
- Activity/Object message?
commands
ls -s [file/dir]
, size in (bytes? or blocks?)docker exec -i [container-name] mysql -uusername -ppassword [database-name] < [data-file.sql]
, to restore database into a mysql/mariadb running container.- inside mysql shell,
SET GLOBAL max_allowed_packet=1073741824;
, to increasemax_allowed_packet
that sets an upper limit on the size of any single message between the MySQL server and clients. mysql internals book (p99):
MySQL network communication code was written under the assumption that queries are always reasonably short, and therefore can be sent to and processed by the server in one chunk, which is called a packet in MySQL terminology. The server allocates the memory for a temporary buffer to store the packet, and it requests enough to fit it entirely. This architecture requires a precaution to avoid having the server run out of memory---a cap on the size of the packet, which this option accomplishes. The code of interest in relation to this option is found in sql/net_serv.cc. Take a look at my_net_read(), then follow the call to my_real_read() and pay particular attention to net_realloc(). This variable also limits the length of a result of many string functons. See sql/field.cc and sql/intem_strfunc.cc for details.
- for adding your local ssh keys inside container
volumes:
# Enable if you require git cloning
- ${HOME}/.ssh:/home/frappe/.ssh