initial commit
Browse files- Dockerfile +25 -0
- indexer.py +37 -0
- requirements.txt +9 -0
- source/1c9a699b-8649-4102-9c43-3ef5a89abd43.html +44 -0
- source/2nd brain training by Forte labs.html +11 -0
- source/3 Questions That Will Change Your Mindset From Busy to Strategic.html +13 -0
- source/4 Ways Managers Can Increase Flexibility Without Losing Productivity.html +9 -0
- source/5 ChatGPT features to write better code.html +15 -0
- source/5 Everyday Habits That Make You Age Faster.html +13 -0
- source/5 Questions Every Manager Needs to Ask Their Direct Reports.html +11 -0
- source/5 easy Ayurvedic recipes to boost immunity, appetite and digestion - Hindustan Times.html +11 -0
- source/6.3. Preprocessing data — scikit-learn 0.24.2 documentation.html +11 -0
- source/7 Microservices Best Practices for Developers - DZone Microservices.html +13 -0
- source/@Today Print Nth line from a file in unix.html +13 -0
- source/Bash Keyboard Shortcuts .html +13 -0
- source/Design Patterns- Elements of Reusable Object-Oriented Software.html +14 -0
- source/Home Assistant Python Script to set an entity state.html +18 -0
- source/Lucene and Solr Reference - FactorPad.html +13 -0
- source/[Solved] Emergency Mode Due to Bad fstab in Raspberry Pi.html +15 -0
- source/__init__ vs __new__ and When to Use Them.html +25 -0
Dockerfile
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.11.0
|
| 2 |
+
|
| 3 |
+
ENV PYTHONUNBUFFERED 1
|
| 4 |
+
|
| 5 |
+
EXPOSE 8000
|
| 6 |
+
|
| 7 |
+
RUN useradd -m -u 1000 user
|
| 8 |
+
USER user
|
| 9 |
+
ENV HOME=/home/user \
|
| 10 |
+
PATH=/home/user/.local/bin:$PATH
|
| 11 |
+
|
| 12 |
+
WORKDIR $HOME/app
|
| 13 |
+
|
| 14 |
+
COPY requirements.txt ./
|
| 15 |
+
RUN pip install --upgrade pip && \
|
| 16 |
+
pip install -r requirements.txt
|
| 17 |
+
|
| 18 |
+
|
| 19 |
+
COPY --chown=user . $HOME/app
|
| 20 |
+
|
| 21 |
+
#RUN ls -al
|
| 22 |
+
|
| 23 |
+
#CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]
|
| 24 |
+
|
| 25 |
+
CMD ["python","indexer.py"]
|
indexer.py
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from langchain.embeddings import HuggingFaceEmbeddings
|
| 2 |
+
from langchain.vectorstores import Chroma
|
| 3 |
+
from langchain.text_splitter import RecursiveCharacterTextSplitter
|
| 4 |
+
from langchain.document_loaders import BSHTMLLoader
|
| 5 |
+
from langchain.chains import RetrievalQA
|
| 6 |
+
from langchain.document_loaders import TextLoader
|
| 7 |
+
from langchain.document_loaders import DirectoryLoader
|
| 8 |
+
|
| 9 |
+
#Load the documents
|
| 10 |
+
loader = DirectoryLoader('.', glob="./source/*.html", loader_cls=BSHTMLLoader)
|
| 11 |
+
docs=loader.load()
|
| 12 |
+
|
| 13 |
+
#splitting the text into chunks, trying with 1000 size
|
| 14 |
+
text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=200)
|
| 15 |
+
texts = text_splitter.split_documents(docs)
|
| 16 |
+
|
| 17 |
+
#init db and embeddings
|
| 18 |
+
persist_directory="./index/chroma"
|
| 19 |
+
embeddings = HuggingFaceEmbeddings(model_name="sentence-transformers/all-MiniLM-L6-v2")
|
| 20 |
+
vectordb = Chroma.from_documents(documents=texts,
|
| 21 |
+
embedding=embeddings,
|
| 22 |
+
persist_directory=persist_directory)
|
| 23 |
+
|
| 24 |
+
sentences = ["This is an example sentence", "Each sentence is converted","A monkey in zoo","Shark in the park","Boss on loose","a quiet date"]
|
| 25 |
+
query="This sentence is an example"
|
| 26 |
+
query2="Each sentence is converted"
|
| 27 |
+
id=["a1","a2","a3","a4","a5","a6"]
|
| 28 |
+
meta=[{"n":1},{"z":2},{},{},{"n":3},{"n":4}]
|
| 29 |
+
|
| 30 |
+
#docsearch=FAISS.from_texts(sentences,embeddings,meta,id)
|
| 31 |
+
#m=docsearch.similarity_search_with_score(query2,filter={"n":2})
|
| 32 |
+
query="How to Increase Flexibility Without Losing Productivity"
|
| 33 |
+
docs = vectordb.similarity_search(query)
|
| 34 |
+
for i in range(0,len(docs)):
|
| 35 |
+
print("\n")
|
| 36 |
+
print(docs[i].page_content)
|
| 37 |
+
print("Done")
|
requirements.txt
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
uvicorn
|
| 2 |
+
marko
|
| 3 |
+
bs4
|
| 4 |
+
fastapi
|
| 5 |
+
loguru
|
| 6 |
+
chromadb
|
| 7 |
+
langchain
|
| 8 |
+
sse_starlette
|
| 9 |
+
dropbox
|
source/1c9a699b-8649-4102-9c43-3ef5a89abd43.html
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<html><head><title>MicroPython: ESP32/ESP8266 with DHT11/DHT22 Temperature and Humidity Sensor | Random Nerd Tutorials</title><meta name="URL" content="https://randomnerdtutorials.com/esp32-esp8266-dht11-dht22-micropython-temperature-humidity-sensor/"/>
|
| 2 |
+
<meta name="Source" content="internet"/>
|
| 3 |
+
<meta name="Created" content="2021-12-15T06:45:00.000Z"/>
|
| 4 |
+
<meta name="Already Read" content="true"/>
|
| 5 |
+
<meta name="Name" content="MicroPython: ESP32/ESP8266 with DHT11/DHT22 Temperature and Humidity Sensor | Random Nerd Tutorials"/>
|
| 6 |
+
<meta name="parent" content="References"/>
|
| 7 |
+
</head><body><H1>MicroPython: ESP32/ESP8266 with DHT11/DHT22 Temperature and Humidity Sensor | Random Nerd Tutorials</H1><a href="https://www.notion.so/MicroPython-ESP32-ESP8266-with-DHT11-DHT22-Temperature-and-Humidity-Sensor-Random-Nerd-Tutorials-1c9a699b864941029c433ef5a89abd43">Link to original Notion Page</a></p><table border='1'><tr><td><b>Property</b></td><td><b>Value</b></td></tr><tr><td>URL</td><td>https://randomnerdtutorials.com/esp32-esp8266-dht11-dht22-micropython-temperature-humidity-sensor/</td></tr>
|
| 8 |
+
<tr><td>Source</td><td>internet</td></tr>
|
| 9 |
+
<tr><td>Created</td><td>2021-12-15T06:45:00.000Z</td></tr>
|
| 10 |
+
<tr><td>Already Read</td><td>true</td></tr>
|
| 11 |
+
<tr><td>Name</td><td>MicroPython: ESP32/ESP8266 with DHT11/DHT22 Temperature and Humidity Sensor | Random Nerd Tutorials</td></tr>
|
| 12 |
+
<tr><td>parent</td><td>References</td></tr>
|
| 13 |
+
</table> <div><p class='n_paragraph'>This tutorial shows how to use the DHT11 or DHT22 temperature and humidity sensors with the ESP32 and ESP8266 development boards using MicroPython firmware.</p ><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/49f56ea8-3410-4a0c-8950-29fda29cc9b0/dht11_dht22_esp8266_esp32.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20220720%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20220720T153601Z&X-Amz-Expires=3600&X-Amz-Signature=f29f64c5545b2e28ae2c06c5cd1a20e0f2ebd8b561bf25dedf002d3d8fad9c71&X-Amz-SignedHeaders=host&x-id=GetObject'/><h2 class='n_heading_2'>DHT Module Usage</h2 ><p class='n_paragraph'>There is a dht module that comes with the MicroPython firmware by default. So, it is easy to get temperature and humidity.</p ><p class='n_paragraph'><b>1.</b> Start by importing the dht and machine modules:</p ><pre>import dht
|
| 14 |
+
from machine import Pin </pre><p class='n_paragraph'><b>2.</b> Create a dht object that refers to the sensor’s data pin, in this case it’s GPIO 14:</p ><pre>sensor = dht.DHT11(Pin(14))
|
| 15 |
+
#sensor = dht.DHT22(Pin(14)) </pre><p class='n_paragraph'><b>3. </b>To measure and read the sensor values, use:</p ><pre>sensor.measure()
|
| 16 |
+
sensor.temperature()
|
| 17 |
+
sensor.humidity() </pre><p class='n_paragraph'>Continue reading for the complete and detailed tutorial.</p ><h2 class='n_heading_2'>Prerequisites – Flashing MicroPython</h2 ><p class='n_paragraph'>To follow this tutorial you need MicroPython firmware installed in your ESP32 or ESP8266 boards. You also need an IDE to write and upload the code to your board. We suggest using Thonny IDE or uPyCraft IDE:</p ><h2 class='n_heading_2'>Introducing the DHT11 and DHT22 Sensors</h2 ><p class='n_paragraph'>The DHT11 and DHT22 sensors are used to measure temperature and relative humidity. These are very popular among makers and electronics hobbyists.</p ><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/983ec67f-7467-4edc-9db5-b54f9c6ec811/DHT11-DHT22-Temperature-Humidity-Sensor.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20220720%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20220720T153601Z&X-Amz-Expires=3600&X-Amz-Signature=c4a9d91c4c23cea9bb0e5127fc1b4e79a6cbd9350a4d58a27f3c856825dbcded&X-Amz-SignedHeaders=host&x-id=GetObject'/><p class='n_paragraph'>These sensors contain a chip that does analog to digital conversion and spit out a digital signal with the temperature and humidity. This makes them very easy to use with any microcontroller.</p ><h3 class='n_heading_3'>DHT11 vs DHT22</h3 ><p class='n_paragraph'>The DHT11 and DHT22 are very similar, but differ in their specifications. The following table compares some of the most important specifications of the DHT11 and DHT22 temperature and humidity sensors. For a more in-depth analysis of these sensors, please check the sensors’ datasheet.</p ><p class='n_paragraph'>The DHT22 sensor has a better resolution and a wider temperature and humidity measurement range. However, it is a bit more expensive, and you can only request readings with 2 seconds interval.</p ><p class='n_paragraph'>The DHT11 has a smaller range and it’s less accurate. However, you can request sensor readings every second. It’s also a bit cheaper.</p ><p class='n_paragraph'>Despite their differences, they work in a similar way, and you can use the same code to read temperature and humidity. You just need to select in the code the sensor type you’re using.</p ><h2 class='n_heading_2'>DHT Pinout</h2 ><p class='n_paragraph'>DHT sensors have four pins as shown in the following figure. However, if you get your DHT sensor in a breakout board, it comes with only three pins and with an internal pull-up resistor on pin 2.</p ><p class='n_paragraph'>The following table shows the DHT22 and DHT11 pinout. When the sensor is facing you, pin numbering starts at 1 from left to right</p ><p class='n_paragraph'>With Mesh facing us DHT pin 1 is left on the keyes module</p ><h2 class='n_heading_2'>Parts Required</h2 ><p class='n_paragraph'>To follow this tutorial you need to wire the DHT11 or DHT22 temperature sensor to the ESP32 or ESP8266. You need to use a 10k Ohm pull-up resistor.</p ><p class='n_paragraph'>Here’s a list of parts you need to build the circuit:</p ><p class='n_paragraph'>You can use the preceding links or go directly to <a href='https://makeradvisor.com/tools/?utm_source=rnt&utm_medium=post&utm_campaign=post'>MakerAdvisor.com/tools</a> to find all the parts for your projects at the best price!</p ><h2 class='n_heading_2'>Schematic: ESP32 with DHT11/DHT22</h2 ><p class='n_paragraph'>Wire the DHT22 or DHT11 sensor to the ESP32 development board as shown in the following schematic diagram.</p ><p class='n_paragraph'>In this example, we’re connecting the DHT data pin to GPIO 14. However, you can use any other suitable digital pin.</p ><p class='n_paragraph'>Learn how to use the ESP32 GPIOs with our guide: <a href='https://randomnerdtutorials.com/esp32-pinout-reference-gpios/'>ESP32 Pinout Reference: Which GPIO pins should you use?</a></p ><h2 class='n_heading_2'>Schematic: ESP8266 with DHT11/DHT22</h2 ><p class='n_paragraph'>Follow the next tutorial if you’re using an ESP8266 board.</p ><h2 class='n_heading_2'>Code</h2 ><p class='n_paragraph'>Open a new file in your MicroPython IDE (like <a href='https://randomnerdtutorials.com/getting-started-micropython-esp32-esp8266/'>uPyCraft IDE</a> or <a href='https://randomnerdtutorials.com/getting-started-thonny-micropython-python-ide-esp32-esp8266/'>Thonny IDE</a>) and copy the following code.</p ><pre># Complete project details at https://RandomNerdTutorials.com
|
| 18 |
+
|
| 19 |
+
from machine import Pin
|
| 20 |
+
from time import sleep
|
| 21 |
+
import dht
|
| 22 |
+
|
| 23 |
+
sensor = dht.DHT22(Pin(14))
|
| 24 |
+
#sensor = dht.DHT11(Pin(14))
|
| 25 |
+
|
| 26 |
+
while True:
|
| 27 |
+
try:
|
| 28 |
+
sleep(2)
|
| 29 |
+
sensor.measure()
|
| 30 |
+
temp = sensor.temperature()
|
| 31 |
+
hum = sensor.humidity()
|
| 32 |
+
temp_f = temp * (9/5) + 32.0
|
| 33 |
+
print('Temperature: %3.1f C' %temp)
|
| 34 |
+
print('Temperature: %3.1f F' %temp_f)
|
| 35 |
+
print('Humidity: %3.1f %%' %hum)
|
| 36 |
+
except OSError as e:
|
| 37 |
+
print('Failed to read sensor.')
|
| 38 |
+
</pre><h3 class='n_heading_3'>How the Code Works</h3 ><p class='n_paragraph'>Import the Pin class from the machine module to define pins, import the sleep method from the time module to add delays to your code, and finally import the dht module to import the functions to read from the DHT sensors.</p ><pre>from machine import Pin
|
| 39 |
+
from time import sleep
|
| 40 |
+
import dht </pre><p class='n_paragraph'>Define a dht object called sensor on the specified data pin. In this case, we’re connecting the data pin to GPIO 14. Use the following command if you’re using a DHT22 sensor:</p ><pre>sensor = dht.DHT22(Pin(14)) </pre><p class='n_paragraph'>Comment the previous line and uncomment the next one if you’re using a DHT11 sensor.</p ><pre>#sensor = dht.DHT11(Pin(14)) </pre><p class='n_paragraph'>In the while loop, we use try and except statements. In the try statement we try to get temperature and humidity values.</p ><p class='n_paragraph'><b>Note: </b>try and except allows us to continue the execution of the program when an exception happens. For example, when an error occurs, the try block code execution is stopped and transferred to the except block. In our example, the exception is especially useful to prevent the ESP32 or ESP8266 from crashing when we are not able to read from the sensor.</p ><p class='n_paragraph'>In the try statement, first add a delay of two seconds because the DHT22 maximum sampling rate is two seconds. In case of the DHT11, it is one second.</p ><pre>sleep(2) </pre><p class='n_paragraph'>Before requesting temperature and humidity, you need to use the measure() method on the sensor object.</p ><pre>sensor.measure() </pre><p class='n_paragraph'>Then, read the temperature with sensor.temperature() and the humidity with sensor.humidity(). Save those readings on the temp and hum variables.</p ><pre>temp = sensor.temperature()
|
| 41 |
+
hum = sensor.humidity() </pre><p class='n_paragraph'>The following command converts the temperature to Fahrenheit degrees.</p ><pre>temp_f = temp * (9/5) + 32.0 </pre><p class='n_paragraph'>Finally, print all the readings on the MicroPython shell using the print() function:</p ><pre>print('Temperature: %3.1f C' %temp)
|
| 42 |
+
print('Temperature: %3.1f F' %temp_f)
|
| 43 |
+
print('Humidity: %3.1f %%' %hum) </pre><p class='n_paragraph'>In case there is an error getting the readings, the except statement runs and an error message is printed:</p ><pre>except OSError as e:
|
| 44 |
+
print('Failed to read sensor.') </pre><h2 class='n_heading_2'>Demonstration</h2 ><p class='n_paragraph'>After copying the code and making any necessary changes, you can upload the code to your ESP32 or ESP8266.</p ><p class='n_paragraph'>If you’re using Thonny IDE, you just need to go to <b>Device</b> > <b>Upload current script as main script</b>. After uploading the code, press the ESP on-board RESET button.</p ><p class='n_paragraph'>New temperature and humidity readings should be displayed on the MicroPython Shell, every two seconds.</p ><p class='n_paragraph'>If you’re using uPyCraft IDE and you’re having trouble uploading the code, go to the following tutorial and scroll down to the “Running Your First Script” section: <a href='https://randomnerdtutorials.com/getting-started-micropython-esp32-esp8266/'>Getting Started with MicroPython on ESP32 and ESP8266</a>.</p ><h3 class='n_heading_3'>Troubleshooting</h3 ><p class='n_paragraph'>If your DHT sensor fails to get the readings, read our <b>DHT Troubleshooting Guide</b> to help you fix the issue.</p ><h2 class='n_heading_2'>Wrapping Up</h2 ><p class='n_paragraph'>Getting temperature and humidity readings with MicroPython is easy thanks to the dht module. After defining a dht object, you just need to use the temperature() and humidity() methods.</p ><p class='n_paragraph'>We hope you’ve found this guide useful. Now, you can display your sensor readings in a web server that you can access from your smartphone. Just follow this tutorial: Web Server MicroPython….</p ><p class='n_paragraph'>If you like MicroPython and you want to learn more, we recommend taking a look at our eBook: <b>MicroPython Programming with ESP32 and ESP8266</b>.</p ><p class='n_paragraph'>Thanks for reading.</p ></div></body></html>
|
source/2nd brain training by Forte labs.html
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<html><head><title>2nd brain training by Forte labs</title><meta name="Source" content="youtube"/>
|
| 2 |
+
<meta name="Created" content="2022-05-05T07:41:00.000Z"/>
|
| 3 |
+
<meta name="Already Read" content="false"/>
|
| 4 |
+
<meta name="Name" content="2nd brain training by Forte labs"/>
|
| 5 |
+
<meta name="parent" content="References"/>
|
| 6 |
+
</head><body><H1>2nd brain training by Forte labs</H1><a href="https://www.notion.so/2nd-brain-training-by-Forte-labs-4746e420b2a042e99040396fa043c196">Link to original Notion Page</a></p><table border='1'><tr><td><b>Property</b></td><td><b>Value</b></td></tr><tr><td>Source</td><td>youtube</td></tr>
|
| 7 |
+
<tr><td>Created</td><td>2022-05-05T07:41:00.000Z</td></tr>
|
| 8 |
+
<tr><td>Already Read</td><td>false</td></tr>
|
| 9 |
+
<tr><td>Name</td><td>2nd brain training by Forte labs</td></tr>
|
| 10 |
+
<tr><td>parent</td><td>References</td></tr>
|
| 11 |
+
</table> <div><p class='n_paragraph'></p ><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/29ec5b98-d2e8-41e1-963b-e26bca1728d9/3BC435DA-8606-4105-B786-63A1582981F5_1_105_c.jpeg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20220720%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20220720T153007Z&X-Amz-Expires=3600&X-Amz-Signature=67d78f28efce6bee4e3098ddf7129a18e3d5efe9ad6b3f213c28b0d4a1f87329&X-Amz-SignedHeaders=host&x-id=GetObject'/><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/b4ed2a3b-0d17-4985-bf30-7bea959c75a6/17B35F6F-9195-464B-86FA-B52AF33BD48E_1_105_c.jpeg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20220720%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20220720T153007Z&X-Amz-Expires=3600&X-Amz-Signature=1899a80ddc3efaa888732fe153f1ff31592ad8c629084abaccd48eb79c79e7ab&X-Amz-SignedHeaders=host&x-id=GetObject'/><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/d3a282cd-4e73-4f09-a5bb-5f5877f83a63/34A91E7F-553C-4544-AF07-6A8E46AA44B1_1_105_c.jpeg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20220720%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20220720T153007Z&X-Amz-Expires=3600&X-Amz-Signature=4546225857a327ca9f34e0aad2e4a65db298496e81c9ee1988cacbc8d3b74318&X-Amz-SignedHeaders=host&x-id=GetObject'/><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/a77dd957-3475-4729-8f44-c5b0927aa6f0/1FDD50F8-F23A-4977-9635-88DC6FDC8CB5_1_105_c.jpeg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20220720%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20220720T153007Z&X-Amz-Expires=3600&X-Amz-Signature=36937d80b433e980a70eff596db25b470338bb296ef0661d4d4addce5af6e5a5&X-Amz-SignedHeaders=host&x-id=GetObject'/><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/02d7467c-3f03-45a4-a442-36edbd138597/C0DB4727-FCE6-4809-8974-52FCD0DF9205_1_105_c.jpeg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20220720%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20220720T153007Z&X-Amz-Expires=3600&X-Amz-Signature=25701cccad9555740dc308309b638fec032cefc77a0df138da0a0b14f3c8d8cd&X-Amz-SignedHeaders=host&x-id=GetObject'/><p class='n_paragraph'></p ></div></body></html>
|
source/3 Questions That Will Change Your Mindset From Busy to Strategic.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<html><head><title>3 Questions That Will Change Your Mindset From Busy to Strategic</title><meta name="URL" content="https://www.entrepreneur.com/article/376023"/>
|
| 2 |
+
<meta name="Source" content="internet"/>
|
| 3 |
+
<meta name="Created" content="2021-10-16T14:50:00.000Z"/>
|
| 4 |
+
<meta name="Already Read" content="false"/>
|
| 5 |
+
<meta name="Name" content="3 Questions That Will Change Your Mindset From Busy to Strategic"/>
|
| 6 |
+
<meta name="parent" content="References"/>
|
| 7 |
+
</head><body><H1>3 Questions That Will Change Your Mindset From Busy to Strategic</H1><a href="https://www.notion.so/3-Questions-That-Will-Change-Your-Mindset-From-Busy-to-Strategic-d148a8ab5cbc486cbd111a4a919ca055">Link to original Notion Page</a></p><table border='1'><tr><td><b>Property</b></td><td><b>Value</b></td></tr><tr><td>URL</td><td>https://www.entrepreneur.com/article/376023</td></tr>
|
| 8 |
+
<tr><td>Source</td><td>internet</td></tr>
|
| 9 |
+
<tr><td>Created</td><td>2021-10-16T14:50:00.000Z</td></tr>
|
| 10 |
+
<tr><td>Already Read</td><td>false</td></tr>
|
| 11 |
+
<tr><td>Name</td><td>3 Questions That Will Change Your Mindset From Busy to Strategic</td></tr>
|
| 12 |
+
<tr><td>parent</td><td>References</td></tr>
|
| 13 |
+
</table> <div><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/bca2b146-a479-4b43-ad93-4e84ac014f25/1627418583-GettyImages-488337007.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20220720%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20220720T153735Z&X-Amz-Expires=3600&X-Amz-Signature=1bde2069cb161ea74eee470b12dd66367040c8d4c65d620346211f346e5039f6&X-Amz-SignedHeaders=host&x-id=GetObject'/><p class='n_paragraph'>With these simple shifts in perception, you can leave 'frantic' behind and make real progress on goals.</p ><p class='n_paragraph'>Opinions expressed by Entrepreneur contributors are their own.</p ><p class='n_paragraph'>Just about every time I ask someone how they are doing, they reply with something akin to, “Busy, but good.” There’s so much that demands our <a href='https://www.entrepreneur.com/topic/attention'>attention</a>, from ads to scrolling through <a href='https://www.entrepreneur.com/topic/social-media'>social media</a> to work calls to family activities. While I realize everyone is fractionally or wholly overcommitted, with me being no exception, at some point I began noticing that at the end of some days, I would sum up with, “I have no idea where the day went” or “I didn’t get anything on my list done” or “I feel like I made no progress.” This trend got me wondering about ways to better define progress. Even if it’s small, such progress, I thought, has to be focused, and of a sort that actually pushes me — not just a series of ticks on an ever-growing list. To produce this new mindset, I asked myself three questions, and the result has been a huge difference in how I spend time and what I’m able to accomplish. Now, instead of hearing myself ask, “Where did the time go?” I get asked “Where do you find the time for everything you do?”</p ><h2 class='n_heading_2'>1. Does a task affect my future or my “right now”?</h2 ><p class='n_paragraph'>So many items that filled up my list, I found, simply didn’t affect the future. They might be tasks that pushed paper back and forth, or were a step in a larger process only. They didn’t achieve much and would likely have to be redone anyway, but I was letting them take up a majority of my time. So, I began asking, “Does the time I spend on this task move me into the future and help me get where I’m going, or does it keep me in the same place I am presently?” If it’s something that keeps me in the same place, it’s in one of two buckets: it has to be done or doesn’t have to be done. If the former, maybe as a part of my job or because it’s something my boss is asking for, I get it done quickly and effectively and move on. If it’s something that doesn’t really have to be done, I delete it. Perhaps it’s a meeting that was optional; I’ll then ask whether I will be adding value or getting value? If neither, I don’t attend — protecting that time for projects that help me create the future I’m working on.</p ><h2 class='n_heading_2'>2. How much does it affect my future?</h2 ><p class='n_paragraph'>Some projects should take less time based on how much they affect the days and weeks to come. One major lightbulb moment came during a particular project; I needed to determine the best platform for hosting my courses for Invinciblesparkle.com. I needed something that was cost effective, but allowed my students to get the content they needed with convenience, and with an easy checkout process. I spent hours checking out blogs and reading about the best services and how they integrated with emails, along with other topics. I finally just picked one of the big providers and signed up. What I realized when I got into it was that I really just needed a good option for right now. As my business needs changed, I realized, it would be easy to simply move content somewhere else — there was no need to spend hours researching a forever solution. Too much focus was placed on the task itself — specifically the word “best” — and not how that task affected the future. In time, the need may be for a totally different solution, and I could have used some of those lost hours for something else.</p ><h2 class='n_heading_2'>3. Is this task producing or consuming?</h2 ><p class='n_paragraph'>I can’t tell you how many times I’ve opened up an app, then ten, twenty or thirty minutes later thought, “What did I open this for?” The reason is that I switched from producing to consuming — started reading and interacting and forgot what I went in to do. In time, I started thinking about all the hours in a day spent on that consumption — devoted to social media, television, <a href='https://www.entrepreneur.com/topic/online-shopping'>online shopping</a>…you name it — and I was floored. Once I absorbed that hard truth, I was better able to switch to producing time and/or adapt consumption time for the better. In the case of the latter, for example, while I watch my favorite tv shows, I might also work on website edits or other tasks that don’t require silence.</p ><p class='n_paragraph'>The answers to these three questions helped me take control of my time, focus my energy and make better strides towards my goals. They will allow you to focus on what drives you forward, and the result will be not just a feeling of “busy”, but “accomplished”.</p ></div></body></html>
|
source/4 Ways Managers Can Increase Flexibility Without Losing Productivity.html
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<html><head><title> 4 Ways Managers Can Increase Flexibility Without Losing Productivity</title><meta name="Created" content="2022-02-23T15:42:00.000Z"/>
|
| 2 |
+
<meta name="Already Read" content="true"/>
|
| 3 |
+
<meta name="Name" content=" 4 Ways Managers Can Increase Flexibility Without Losing Productivity"/>
|
| 4 |
+
<meta name="parent" content="References"/>
|
| 5 |
+
</head><body><H1> 4 Ways Managers Can Increase Flexibility Without Losing Productivity</H1><a href="https://www.notion.so/4-Ways-Managers-Can-Increase-Flexibility-Without-Losing-Productivity-14366f141a74404382e210d87aa453b1">Link to original Notion Page</a></p><table border='1'><tr><td><b>Property</b></td><td><b>Value</b></td></tr><tr><td>Created</td><td>2022-02-23T15:42:00.000Z</td></tr>
|
| 6 |
+
<tr><td>Already Read</td><td>true</td></tr>
|
| 7 |
+
<tr><td>Name</td><td> 4 Ways Managers Can Increase Flexibility Without Losing Productivity</td></tr>
|
| 8 |
+
<tr><td>parent</td><td>References</td></tr>
|
| 9 |
+
</table> <div><ul><li class='n_bulleted_list_item'> Managers will need to think differently about when employees work together, who works together, and how to share information and with whom, all while being careful to stay abreast of any changes and rapidly communicating changes in priorities.</li ><li class='n_bulleted_list_item'> Flexibility has tremendous benefits for employees, including reduced burnout and greater job satisfaction. However, it can also result in spiraling coordination costs for managers, untenable amounts of wasted effort, and the inability to respond quickly to client requests. The brief huddles that once allowed teams to promptly brainstorm solutions and align efforts are now harder to pull together.</li ><li class='n_bulleted_list_item'> <b>Rethink who works together</b> <div><ul><li class='n_bulleted_list_item'>managers may also need to reorganize their larger teams into multiteam systems of smaller, empowered, and interconnected groups. These smaller teams improve flexibility and adaptability. This reconfiguration reduces the coordination costs placed on the manager without dumping them all on the most accommodating employee(s). Each employee is only asked to help coordinate with a couple of other individuals rather than everyone in the larger team.</li ></ul></div></li ><li class='n_bulleted_list_item'><b>Rethink Information Sharing</b><div><ul><li class='n_bulleted_list_item'>Work progress transparency often promotes accountability and helps managers more quickly identify when an employee needs assistance</li ></ul></div></li ><li class='n_bulleted_list_item'><b>Rethink what people work on</b><div><ul><li class='n_bulleted_list_item'> Priorities are likely to change over time, especially in dynamic environments. Frequently and clearly communicating priorities will help ensure that your employees’ time and efforts are well spent, no matter when or where they’re working.</li ><li class='n_bulleted_list_item'>Managers are still responsible for making sure everyone is rowing to the correct location in the same direction — even if they’re rowing at different times.</li ></ul></div></li ></ul></div></body></html>
|
source/5 ChatGPT features to write better code.html
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<html><head><title>5 ChatGPT features to write better code</title><meta name="URL" content="https://medium.com/geekculture/5-chatgpt-features-to-boost-your-daily-work-404478fd70ca"/>
|
| 2 |
+
<meta name="Source" content="internet"/>
|
| 3 |
+
<meta name="Category" content="interest"/>
|
| 4 |
+
<meta name="Created" content="2023-04-15T10:23:00.000Z"/>
|
| 5 |
+
<meta name="Already Read" content="false"/>
|
| 6 |
+
<meta name="Name" content="5 ChatGPT features to write better code"/>
|
| 7 |
+
<meta name="parent" content="References"/>
|
| 8 |
+
</head><body><H1>5 ChatGPT features to write better code</H1><a href="https://www.notion.so/5-ChatGPT-features-to-write-better-code-dec892a9ccc346ab9983410f7fd7a151">Link to original Notion Page</a></p><table border='1'><tr><td><b>Property</b></td><td><b>Value</b></td></tr><tr><td>URL</td><td>https://medium.com/geekculture/5-chatgpt-features-to-boost-your-daily-work-404478fd70ca</td></tr>
|
| 9 |
+
<tr><td>Source</td><td>internet</td></tr>
|
| 10 |
+
<tr><td>Category</td><td>interest</td></tr>
|
| 11 |
+
<tr><td>Created</td><td>2023-04-15T10:23:00.000Z</td></tr>
|
| 12 |
+
<tr><td>Already Read</td><td>false</td></tr>
|
| 13 |
+
<tr><td>Name</td><td>5 ChatGPT features to write better code</td></tr>
|
| 14 |
+
<tr><td>parent</td><td>References</td></tr>
|
| 15 |
+
</table> <div></div></body></html>
|
source/5 Everyday Habits That Make You Age Faster.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<html><head><title>5 Everyday Habits That Make You Age Faster</title><meta name="Source" content="internet"/>
|
| 2 |
+
<meta name="Created" content="2021-10-14T15:46:00.000Z"/>
|
| 3 |
+
<meta name="Notes" content="2021-10-14T21:13:00.000+05:30 → Aging slowly"/>
|
| 4 |
+
<meta name="Already Read" content="true"/>
|
| 5 |
+
<meta name="Name" content="5 Everyday Habits That Make You Age Faster"/>
|
| 6 |
+
<meta name="parent" content="References"/>
|
| 7 |
+
</head><body><H1>5 Everyday Habits That Make You Age Faster</H1><a href="https://www.notion.so/5-Everyday-Habits-That-Make-You-Age-Faster-136612b923d44a13961b729c5731c58f">Link to original Notion Page</a></p><table border='1'><tr><td><b>Property</b></td><td><b>Value</b></td></tr><tr><td>Source</td><td>internet</td></tr>
|
| 8 |
+
<tr><td>Created</td><td>2021-10-14T15:46:00.000Z</td></tr>
|
| 9 |
+
<tr><td>Notes</td><td><a href="../Notes-box/2021-10-14T21:13:00.000+05:30 → Aging slowly.html">2021-10-14T21:13:00.000+05:30 → Aging slowly</a></td></tr>
|
| 10 |
+
<tr><td>Already Read</td><td>true</td></tr>
|
| 11 |
+
<tr><td>Name</td><td>5 Everyday Habits That Make You Age Faster</td></tr>
|
| 12 |
+
<tr><td>parent</td><td>References</td></tr>
|
| 13 |
+
</table> <div><p class='n_paragraph'><a href='https://victormong.medium.com/5-toxic-everyday-habits-that-make-you-age-faster-3cca112a6c8b'>https://victormong.medium.com/5-toxic-everyday-habits-that-make-you-age-faster-3cca112a6c8b</a></p ></div></body></html>
|
source/5 Questions Every Manager Needs to Ask Their Direct Reports.html
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<html><head><title>5 Questions Every Manager Needs to Ask Their Direct Reports</title><meta name="URL" content="https://hbr.org/2022/01/5-questions-every-manager-needs-to-ask-their-direct-reports"/>
|
| 2 |
+
<meta name="Created" content="2022-02-19T02:47:00.000Z"/>
|
| 3 |
+
<meta name="Already Read" content="false"/>
|
| 4 |
+
<meta name="Name" content="5 Questions Every Manager Needs to Ask Their Direct Reports"/>
|
| 5 |
+
<meta name="parent" content="References"/>
|
| 6 |
+
</head><body><H1>5 Questions Every Manager Needs to Ask Their Direct Reports</H1><a href="https://www.notion.so/5-Questions-Every-Manager-Needs-to-Ask-Their-Direct-Reports-385e6578a418424cbdd0befde7c867e4">Link to original Notion Page</a></p><table border='1'><tr><td><b>Property</b></td><td><b>Value</b></td></tr><tr><td>URL</td><td>https://hbr.org/2022/01/5-questions-every-manager-needs-to-ask-their-direct-reports</td></tr>
|
| 7 |
+
<tr><td>Created</td><td>2022-02-19T02:47:00.000Z</td></tr>
|
| 8 |
+
<tr><td>Already Read</td><td>false</td></tr>
|
| 9 |
+
<tr><td>Name</td><td>5 Questions Every Manager Needs to Ask Their Direct Reports</td></tr>
|
| 10 |
+
<tr><td>parent</td><td>References</td></tr>
|
| 11 |
+
</table> <div><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/fafcf0b9-a8ad-4a0c-aebe-f2c2c438b561/Jan22_22_1076982960.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20220720%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20220720T153349Z&X-Amz-Expires=3600&X-Amz-Signature=e839625589da3e27a944f74f7365d2ea1e28a27e2772e6f39268c7b9c470fd8a&X-Amz-SignedHeaders=host&x-id=GetObject'/><p class='n_paragraph'>Summary. If you’re worried that your employees are eyeing the door, it’s time to start having some important career-defining conversations. In this piece, executive coach Susan Peppercorn outlines five questions to start asking your direct reports so that you can get a better...</p ><p class='n_paragraph'>Sara, a departing employee, sat across from her company’s HR leader for an <a href='https://hbr.org/2020/01/what-to-say-in-an-exit-interview'>exit interview</a>. As a marketing executive for a financial services company, she was resigning after five years to take a CMO role at a fintech startup.</p ><p class='n_paragraph'>When the HR director asked Sara, “Is there anything else we could have done to keep you here?” Sara paused. “Yes. I wish there had been conversations about my career goals and opportunities for growth,” she said.</p ><p class='n_paragraph'>This is just one of the discussions that often takes place too late, after top talent is already on the way out the door.</p ><p class='n_paragraph'>As the number of workers quitting their jobs continues to swell amid the Great Resignation, soon-to-be-former employees are finding themselves in exit interviews with HR representatives who hope to gain a clearer sense of what’s happening inside the company — and who often learn — after the fact — things that management was unaware of. Exit interviews provide “a way to find out what is happening, or what has happened, that may be motivating this employee… to leave,” according to Yuletta Pringle, knowledge advisor at the Society for Human Resources Management.</p ><p class='n_paragraph'>Yet as the above dialogue illustrates, these conversations may be too little too late. In a recent <a href='https://www.gallup.com/workplace/247391/fixable-problem-costs-businesses-trillion.aspx'>Gallup study</a>, more than half of employees surveyed said that no one — including their manager — had talked to them about how they were feeling in their role in their last three months before they quit. And 52% of exiting employees stressed that their manager or organization could have done something to prevent them from leaving their job.</p ><p class='n_paragraph'>Having coached hundreds of employees in career transition for more than a decade, I can validate these findings. Countless clients have told me they wished their employer had asked them questions to encourage their growth before they resigned. They wanted these questions to come from their manager proactively, rather than retroactively from HR.</p ><p class='n_paragraph'>Before asking questions as a manager, though, it’s critical to know what motivates employees to stay with an organization and why. Gallup research shows <a href='https://www.gallup.com/workplace/285674/improve-employee-engagement-workplace.aspx'>12 needs</a> managers can meet to improve employee engagement, including:</p ><ul><li class='n_bulleted_list_item'>Prioritizing employee development</li ><li class='n_bulleted_list_item'>Facilitating a sense of purpose</li ><li class='n_bulleted_list_item'>Caring about employees</li ><li class='n_bulleted_list_item'>Considering employee opinions</li ><li class='n_bulleted_list_item'>Focusing on employee strengths</li ></ul><p class='n_paragraph'>These five measures map closely with research recently published by HBR on <a href='https://hbr.org/2021/11/6-strategies-to-boost-retention-through-the-great-resignation'>strategies to boost retention.</a> With these five needs in mind, consider incorporating the questions below into routine check-ins with your direct reports, so that you can ask employees the questions they want to hear before they’re gone:</p ><h2 class='n_heading_2'>1. How would you like to grow within this organization?</h2 ><p class='n_paragraph'>Career development is the most critical of the elements identified by Gallup, and two-thirds of people — regardless of their level — leave their company because of a lack of career-development opportunities. With this in mind, it’s important to figure out what growth opportunities each employee needs for optimum development, whether through sponsorship, coaching, mentoring, visibility, or challenging work assignments.</p ><p class='n_paragraph'>To get at the answer, you might also ask, “What role would love to do (whether it exists or not), and what can I do as your manager to encourage your development in this company?”</p ><h2 class='n_heading_2'>2. Do you feel a sense of purpose in your job?</h2 ><p class='n_paragraph'>For the five years that Sara worked for the financial services company that she was resigning from, she never felt that her work impacted people’s lives in a meaningful way. By joining a fintech company committed to improving the accessibility and affordability of financial services for underserved populations, she was excited that her marketing efforts could make a difference in the lives of people who needed access to capital. Her employer and manager missed an opportunity to tap into Sara’s sense of passion and purpose in her marketing role.</p ><p class='n_paragraph'>Managers can play a meaningful role in helping employees understand <a href='https://hbr.org/2018/07/creating-a-purpose-driven-organization'>how their roles contribute to the organization’s broader mission</a>. But helping employees feel a sense of purpose must go deeper than this to tap into what’s purposeful to employees about their job and connects with their own values.</p ><h2 class='n_heading_2'>3. What do you need from me to do your best work?</h2 ><p class='n_paragraph'>The most effective managers respect and care about their employees by knowing them as individuals, acknowledging their achievements, having performance conversations, and conducting formal reviews. These supportive behaviors build a work environment where employees feel safe experimenting with new ideas, sharing information, exploring development opportunities, and supporting each other.</p ><p class='n_paragraph'>As you explore what your employees need to do their best work, you might also ask, “What is your biggest frustration, and what action can I take to help you deal with it? What have you been trying to tell me that I’ve not been hearing? How would you like to be recognized?”</p ><h2 class='n_heading_2'>4. What are we currently not doing as a company that you feel we should do?</h2 ><p class='n_paragraph'>The best managers let workers know that their opinions count by promoting open dialogue and providing honest feedback on employees’ opinions and suggestions, supporting good ideas and addressing unfeasible ones. By asking individual team members what they feel the company could be doing better, what market opportunities the organization might be overlooking, and how to leverage company resources more effectively, you’re validating that their thoughts matter.</p ><p class='n_paragraph'>You might also ask things like, “Are you satisfied with our current work from home/hybrid policy? If not, what do you think needs to change? How satisfied are you with the tools you use to communicate with your colleagues when working remotely?”</p ><h2 class='n_heading_2'>5. Do you have the opportunity to do what you do best every day?</h2 ><p class='n_paragraph'>When Sara was in her marketing role, her concentration was on data analytics. Although she learned how to master analyzing customer use data, she never considered it one of her strengths. Her new role will allow her to concentrate on branding and audience acquisition, areas that she enjoys and excels in. Once again, her former employer missed an opportunity to harness the best of Sara’s talents before she took them to a new organization.</p ><p class='n_paragraph'>To determine whether your employees are focusing on their strengths, you might also ask, “What is the best part of your job? Which of your talents are you not using in your current role? What part of your job would you eliminate if you could?”</p ><p class='n_paragraph'>When managers make checking in with these five questions a regular part of how they interact with their employees, it helps ensure that people feel seen and valued. And when managers help individuals on their teams feel that way, they’re more likely to be rewarded by employees who become advocates for the department and organization, no matter how long they stay.</p ><ul><li class='n_bulleted_list_item'><a href='https://hbr.org/search?term=susan%20peppercorn&search_type=search-all'>Susan Peppercorn</a> is an executive career transition coach and speaker. She is the author of <a href='https://www.amazon.com/Ditch-Your-Inner-Critic-Work/dp/0999453610/ref=tmm_pap_swatch_0?_encoding=UTF8&qid=1527033158&sr=8-1'>Ditch Your Inner Critic at Work: Evidence-Based Strategies </a><a href='https://www.amazon.com/Ditch-Your-Inner-Critic-Work/dp/0999453610/ref=tmm_pap_swatch_0?_encoding=UTF8&qid=1527033158&sr=8-1'>to Thrive in Your Career.</a> Numerous publications including the New York Times, Wall Street Journal, Fast Company, the Boston Globe, and SELF Magazine have tapped her for career advice. You can download her free <a href='http://www.susanpeppercorn.com/'>Career Fit Self-Assessment</a> and <a href='http://www.susanpeppercorn.com/'>25 Steps to a Successful Career Transition</a>.</li ></ul></div></body></html>
|
source/5 easy Ayurvedic recipes to boost immunity, appetite and digestion - Hindustan Times.html
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<html><head><title>5 easy Ayurvedic recipes to boost immunity, appetite and digestion - Hindustan Times</title><meta name="URL" content="https://www.hindustantimes.com/lifestyle/recipe/5-easy-ayurvedic-recipes-to-boost-immunity-appetite-and-digestion-101662211218123.html"/>
|
| 2 |
+
<meta name="Created" content="2022-09-04T02:46:00.000Z"/>
|
| 3 |
+
<meta name="Already Read" content="false"/>
|
| 4 |
+
<meta name="Name" content="5 easy Ayurvedic recipes to boost immunity, appetite and digestion - Hindustan Times"/>
|
| 5 |
+
<meta name="parent" content="References"/>
|
| 6 |
+
</head><body><H1>5 easy Ayurvedic recipes to boost immunity, appetite and digestion - Hindustan Times</H1><a href="https://www.notion.so/5-easy-Ayurvedic-recipes-to-boost-immunity-appetite-and-digestion-Hindustan-Times-7e774ba573f94d2b9caf2ca543a49606">Link to original Notion Page</a></p><table border='1'><tr><td><b>Property</b></td><td><b>Value</b></td></tr><tr><td>URL</td><td>https://www.hindustantimes.com/lifestyle/recipe/5-easy-ayurvedic-recipes-to-boost-immunity-appetite-and-digestion-101662211218123.html</td></tr>
|
| 7 |
+
<tr><td>Created</td><td>2022-09-04T02:46:00.000Z</td></tr>
|
| 8 |
+
<tr><td>Already Read</td><td>false</td></tr>
|
| 9 |
+
<tr><td>Name</td><td>5 easy Ayurvedic recipes to boost immunity, appetite and digestion - Hindustan Times</td></tr>
|
| 10 |
+
<tr><td>parent</td><td>References</td></tr>
|
| 11 |
+
</table> <div><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/77722c29-2bb0-4333-afbd-20219de39445/metabolism_1654089069171_1662211334072_1662211334072.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20220904%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20220904T213413Z&X-Amz-Expires=3600&X-Amz-Signature=2e297d2e2dae8669bb52f345196f20a0abc9910146d6be513833e41e3617121c&X-Amz-SignedHeaders=host&x-id=GetObject'/><p class='n_paragraph'>While we all achieve our daily targets and finish chores, we seldom focus on little things that impact our health in a big way. <a href='https://www.hindustantimes.com/lifestyle/health/ayurveda-expert-on-best-ways-to-consume-black-pepper-health-benefits-101661497128262.html'>Eating the right food </a>at the right time in the perfect quantity can at times make a lot of difference in our overall wellness. Low energy levels, headaches, fatigue, poor digestion, poor appetite, frequent bouts of cough and cold are often ignored and tagged as minor health issues. However, all these symptoms are sign of a poor immunity and neglect of health. Ayurveda believes in a holistic approach to health and focuses on prevention. There are certain foods that one can have on a daily basis to boost energy levels, appetite, sleep, heart health, cut cholesterol, and improve digestion. (Also read: <a href='https://www.hindustantimes.com/lifestyle/health/ayurvedic-rules-to-consume-honey-health-benefits-how-to-eat-dos-and-donts-101661671147297.html'>Ayurvedic rules to consume honey: Health benefits, how to eat, dos and don'ts)</a></p ><p class='n_paragraph'>Here are 5 easy Ayurvedic recipes you can try to improve your overall health, as suggested by Dr Archana Sukumaran of Kerala Ayurveda Ltd.</p ><h2 class='n_heading_2'>1. Kharjuradi mantha (daily energy drink)</h2 ><p class='n_paragraph'>Dates or kharjura are an excellent source of energy, according to Ayurveda. Kharjuradi mantha is an instant energy drink loaded with the goodness of dates - fibre, proteins, and minerals. This brightly sweet and gently sour drink is an excellent tonic to relieve anaemia, thirst, and exertion. It helps to rebuild your ojas or vitality.</p ><p class='n_paragraph'><b>Ingredients</b></p ><p class='n_paragraph'>Seedless dates- 30g</p ><p class='n_paragraph'>Seedless grapes- 50g</p ><p class='n_paragraph'>Pomegranate seeds- ½ Pomegranate</p ><p class='n_paragraph'>Tamarind juice - ½ tsp</p ><p class='n_paragraph'>Amla powder- 1 pinch</p ><p class='n_paragraph'>Jaggery - 2 tsp</p ><p class='n_paragraph'>Cold water- 2 cups</p ><p class='n_paragraph'><b>Method of preparation</b></p ><p class='n_paragraph'>Soak all the ingredients in cold water for 2-3 hours. Then blend it in a mixer grinder, add 2-3 cups of cold water, and stir well before drinking.</p ><p class='n_paragraph'><b>2. Mukkudi (Medicated buttermilk)</b></p ><p class='n_paragraph'>Mukkudi or khala is a vibrant, soul-soothing Ayurvedic drink made with buttermilk. Mukkudi is integral to restoring the digestive fire in Karkidaka chikitsa, the wellness regimen for the monsoon practised in the Kerala tradition of Ayurveda. This buttery and savoury drink is one of the best appetisers in Ayurveda. This excellent tonic is loaded with Indian spices for all your digestive issues.</p ><p class='n_paragraph'><b>Ingredients</b></p ><p class='n_paragraph'>Ginger- 2 small piece</p ><p class='n_paragraph'>Garlic- 4-5 cloves</p ><p class='n_paragraph'>Coriander seeds- ½ tsp</p ><p class='n_paragraph'>Cumin - ½ tsp</p ><p class='n_paragraph'>Pepper powder- ¼ tsp</p ><p class='n_paragraph'>Ajwain- ¼ tsp</p ><p class='n_paragraph'>Turmeric powder- 1 pinch</p ><p class='n_paragraph'>Asafoetida - 1 pinch</p ><p class='n_paragraph'>Curry leaves - 2-3 leaves</p ><p class='n_paragraph'>Neem leaver- 1-2 leaflets</p ><p class='n_paragraph'>Salt - as per taste</p ><p class='n_paragraph'>Buttermilk- 3 cup</p ><p class='n_paragraph'><b>Method of preparation</b></p ><p class='n_paragraph'>Grind ginger, garlic, curry leaves, and neem leaves in a mixer grinder; roast and grind coriander seeds, cumin, pepper, and ajwain. Take a kadai, add 3 cups of buttermilk, and add the before-mentioned grounded paste. Let it boil for 1 minute. Add enough salt, one pinch of turmeric powder, and a pinch of asafoetida, and cook for 1 minute.</p ><h2 class='n_heading_2'>3. Mudga yusha (Medicated green gram soup)</h2 ><p class='n_paragraph'>Yusha is a medicated soup that rejuvenates you on a tiring day. It is loaded with protein, fibre, and iron and is an excellent choice to optimise your blood sugar level. It is easy to digest and rich in nutrients, hence recommended as the first choice of nutrition after detoxifying panchakarma procedures in Ayurveda.</p ><p class='n_paragraph'><b>Ingredients</b></p ><p class='n_paragraph'>Green gram- ½ cup</p ><p class='n_paragraph'>Pepper - ½ tsp</p ><p class='n_paragraph'>Dry ginger powder- ¼ tsp</p ><p class='n_paragraph'>Salt - as per taste</p ><p class='n_paragraph'>Ghee- 2 tablespoon</p ><p class='n_paragraph'>Mustard seeds - ½ tsp</p ><p class='n_paragraph'>Curry leaves- 2-3</p ><p class='n_paragraph'>Water - 250 ml</p ><p class='n_paragraph'><b>Method of preparation</b></p ><p class='n_paragraph'>Cook green gram in a pressure cooker with sufficient water, take only the substrate and add salt, pepper, and dry ginger powder. Season the mixture well with mustard, curry leaves, and ghee.</p ><p class='n_paragraph'><b>4. Rasaala (medicated curd)</b></p ><p class='n_paragraph'>Rasaala is a medicated curd that has imbibed all six rasas or tastes by churning curd in sweet, salty, and spicy ingredients. This dish, predominantly sweet and savoury, is a probiotic carminative and appetiser that can help gain a healthy body weight.</p ><p class='n_paragraph'><b>Ingredients</b></p ><p class='n_paragraph'>Curd - 200ml</p ><p class='n_paragraph'>Jaggery - 3 tsp</p ><p class='n_paragraph'>Pepper - 1 tsp</p ><p class='n_paragraph'>Mustard seeds- 1 tsp</p ><p class='n_paragraph'>Fenugreek - ½ tsp</p ><p class='n_paragraph'>Cumin seeds -½ tsp</p ><p class='n_paragraph'>Curry leaves - 2-3</p ><p class='n_paragraph'>Ghee - 2 tsp</p ><p class='n_paragraph'>Salt as per taste</p ><p class='n_paragraph'><b>Method of preparation</b></p ><p class='n_paragraph'>Add pepper powder, salt, and jaggery to fresh, non-sour curd. Churn it well. Season it with ghee, mustard, fenugreek, cumin seeds, and curry leaves.</p ><p class='n_paragraph'><b>5. Apoopa (Barley pancake)</b></p ><p class='n_paragraph'>Apoopa is a well steamed sweet sattvic dish enriched with protein, vitamins, and minerals. It is fluffy and easy to digest. This heart-friendly dish helps to nourish and energise you quickly and maintain optimum cholesterol levels.</p ><p class='n_paragraph'><b>Ingredients</b></p ><p class='n_paragraph'>Barley flour - 1 cup</p ><p class='n_paragraph'>Cow milk - ½ cup</p ><p class='n_paragraph'>Water - as per need</p ><p class='n_paragraph'>Jaggery - ½ cup</p ><p class='n_paragraph'>Ghee - 1 tsp</p ><p class='n_paragraph'>Cardamom- 2-3</p ><p class='n_paragraph'>Grated coconut- ¼ cup</p ><p class='n_paragraph'>Bay leaves/ turmeric leaves- 4-5</p ><p class='n_paragraph'><b>Method of preparation</b></p ><p class='n_paragraph'>Roast the barley flour in a pan on low flame and add cardamom and grated coconut. Make jaggery syrup in another vessel by heating jaggery with 100 ml of water. Mix this syrup with roasted barley flour in the pan, add 1 tsp ghee, and knead well. Spread the soft dough on bay leaves or turmeric leaves and steam for 15-20 minutes.</p ></div></body></html>
|
source/6.3. Preprocessing data — scikit-learn 0.24.2 documentation.html
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<html><head><title>6.3. Preprocessing data — scikit-learn 0.24.2 documentation</title><meta name="URL" content="https://scikit-learn.org/stable/modules/preprocessing.html"/>
|
| 2 |
+
<meta name="Created" content="2021-06-28T15:54:00.000Z"/>
|
| 3 |
+
<meta name="Already Read" content="false"/>
|
| 4 |
+
<meta name="Name" content="6.3. Preprocessing data — scikit-learn 0.24.2 documentation"/>
|
| 5 |
+
<meta name="parent" content="References"/>
|
| 6 |
+
</head><body><H1>6.3. Preprocessing data — scikit-learn 0.24.2 documentation</H1><a href="https://www.notion.so/6-3-Preprocessing-data-scikit-learn-0-24-2-documentation-9a63bf0a071f4e678b10db9c94829ced">Link to original Notion Page</a></p><table border='1'><tr><td><b>Property</b></td><td><b>Value</b></td></tr><tr><td>URL</td><td>https://scikit-learn.org/stable/modules/preprocessing.html</td></tr>
|
| 7 |
+
<tr><td>Created</td><td>2021-06-28T15:54:00.000Z</td></tr>
|
| 8 |
+
<tr><td>Already Read</td><td>false</td></tr>
|
| 9 |
+
<tr><td>Name</td><td>6.3. Preprocessing data — scikit-learn 0.24.2 documentation</td></tr>
|
| 10 |
+
<tr><td>parent</td><td>References</td></tr>
|
| 11 |
+
</table> <div><h2 class='n_heading_2'>6.3.1. Standardization, or mean removal and variance scaling</h2 ><p class='n_paragraph'><b>Standardization</b> of datasets is a <b>common requirement for many machine learning estimators</b> implemented in scikit-learn; they might behave badly if the individual features do not more or less look like standard normally distributed data: Gaussian with <b>zero mean and unit variance</b>.</p ><p class='n_paragraph'>In practice we often ignore the shape of the distribution and just transform the data to center it by removing the mean value of each feature, then scale it by dividing non-constant features by their standard deviation.</p ><p class='n_paragraph'>For instance, many elements used in the objective function of a learning algorithm (such as the RBF kernel of Support Vector Machines or the l1 and l2 regularizers of linear models) assume that all features are centered around zero and have variance in the same order. If a feature has a variance that is orders of magnitude larger than others, it might dominate the objective function and make the estimator unable to learn from other features correctly as expected.</p ><p class='n_paragraph'>The <code>preprocessing</code> module provides the <code>StandardScaler</code> utility class, which is a quick and easy way to perform the following operation on an array-like dataset:</p ><p class='n_paragraph'>Scaled data has zero mean and unit variance:</p ><p class='n_paragraph'>This class implements the <code>Transformer</code> API to compute the mean and standard deviation on a training set so as to be able to later re-apply the same transformation on the testing set. This class is hence suitable for use in the early steps of a <code>Pipeline</code>:</p ><p class='n_paragraph'>It is possible to disable either centering or scaling by either passing <code>with_mean=False</code> or <code>with_std=False</code> to the constructor of <code>StandardScaler</code>.</p ><h3 class='n_heading_3'>6.3.1.1. Scaling features to a range</h3 ><p class='n_paragraph'>An alternative standardization is scaling features to lie between a given minimum and maximum value, often between zero and one, or so that the maximum absolute value of each feature is scaled to unit size. This can be achieved using <code>MinMaxScaler</code> or <code>MaxAbsScaler</code>, respectively.</p ><p class='n_paragraph'>The motivation to use this scaling include robustness to very small standard deviations of features and preserving zero entries in sparse data.</p ><p class='n_paragraph'>Here is an example to scale a toy data matrix to the <code>[0, 1]</code> range:</p ><p class='n_paragraph'>The same instance of the transformer can then be applied to some new test data unseen during the fit call: the same scaling and shifting operations will be applied to be consistent with the transformation performed on the train data:</p ><p class='n_paragraph'>It is possible to introspect the scaler attributes to find about the exact nature of the transformation learned on the training data:</p ><p class='n_paragraph'>If <code>MinMaxScaler</code> is given an explicit <code>feature_range=(min, max)</code> the full formula is:</p ><p class='n_paragraph'><code>MaxAbsScaler</code> works in a very similar fashion, but scales in a way that the training data lies within the range <code>[-1, 1]</code> by dividing through the largest maximum value in each feature. It is meant for data that is already centered at zero or sparse data.</p ><p class='n_paragraph'>Here is how to use the toy data from the previous example with this scaler:</p ><h3 class='n_heading_3'>6.3.1.2. Scaling sparse data</h3 ><p class='n_paragraph'>Centering sparse data would destroy the sparseness structure in the data, and thus rarely is a sensible thing to do. However, it can make sense to scale sparse inputs, especially if features are on different scales.</p ><p class='n_paragraph'><code>MaxAbsScaler</code> was specifically designed for scaling sparse data, and is the recommended way to go about this. However, <code>StandardScaler</code> can accept <code>scipy.sparse</code> matrices as input, as long as <code>with_mean=False</code> is explicitly passed to the constructor. Otherwise a <code>ValueError</code> will be raised as silently centering would break the sparsity and would often crash the execution by allocating excessive amounts of memory unintentionally. <code>RobustScaler</code> cannot be fitted to sparse inputs, but you can use the <code>transform</code> method on sparse inputs.</p ><p class='n_paragraph'>Note that the scalers accept both Compressed Sparse Rows and Compressed Sparse Columns format (see <code>scipy.sparse.csr_matrix</code> and <code>scipy.sparse.csc_matrix</code>). Any other sparse input will be <b>converted to the Compressed Sparse Rows representation</b>. To avoid unnecessary memory copies, it is recommended to choose the CSR or CSC representation upstream.</p ><p class='n_paragraph'>Finally, if the centered data is expected to be small enough, explicitly converting the input to an array using the <code>toarray</code> method of sparse matrices is another option.</p ><h3 class='n_heading_3'>6.3.1.3. Scaling data with outliers</h3 ><p class='n_paragraph'>If your data contains many outliers, scaling using the mean and variance of the data is likely to not work very well. In these cases, you can use <code>RobustScaler</code> as a drop-in replacement instead. It uses more robust estimates for the center and range of your data.</p ><p class='n_paragraph'>References:</p ><p class='n_paragraph'>Further discussion on the importance of centering and scaling data is available on this FAQ: <a href='http://www.faqs.org/faqs/ai-faq/neural-nets/part2/section-16.html'>Should I normalize/standardize/rescale the data?</a></p ><p class='n_paragraph'>Scaling vs Whitening</p ><p class='n_paragraph'>It is sometimes not enough to center and scale the features independently, since a downstream model can further make some assumption on the linear independence of the features.</p ><p class='n_paragraph'>To address this issue you can use <code>PCA</code> with <code>whiten=True</code> to further remove the linear correlation across features.</p ><h3 class='n_heading_3'>6.3.1.4. Centering kernel matrices</h3 ><p class='n_paragraph'>If you have a kernel matrix of a kernel that computes a dot product in a feature space defined by function , a <code>KernelCenterer</code> can transform the kernel matrix so that it contains inner products in the feature space defined by followed by removal of the mean in that space.</p ><h2 class='n_heading_2'>6.3.2. Non-linear transformation</h2 ><p class='n_paragraph'>Two types of transformations are available: quantile transforms and power transforms. Both quantile and power transforms are based on monotonic transformations of the features and thus preserve the rank of the values along each feature.</p ><p class='n_paragraph'>Quantile transforms put all features into the same desired distribution based on the formula where is the cumulative distribution function of the feature and the <a href='https://en.wikipedia.org/wiki/Quantile_function'>quantile function</a> of the desired output distribution . This formula is using the two following facts: (i) if is a random variable with a continuous cumulative distribution function then is uniformly distributed on ; (ii) if is a random variable with uniform distribution on then has distribution . By performing a rank transformation, a quantile transform smooths out unusual distributions and is less influenced by outliers than scaling methods. It does, however, distort correlations and distances within and across features.</p ><p class='n_paragraph'>Power transforms are a family of parametric transformations that aim to map data from any distribution to as close to a Gaussian distribution.</p ><h3 class='n_heading_3'>6.3.2.1. Mapping to a Uniform distribution</h3 ><p class='n_paragraph'><code>QuantileTransformer</code> provides a non-parametric transformation to map the data to a uniform distribution with values between 0 and 1:</p ><p class='n_paragraph'>This feature corresponds to the sepal length in cm. Once the quantile transformation applied, those landmarks approach closely the percentiles previously defined:</p ><p class='n_paragraph'>This can be confirmed on a independent testing set with similar remarks:</p ><h3 class='n_heading_3'>6.3.2.2. Mapping to a Gaussian distribution</h3 ><p class='n_paragraph'>In many modeling scenarios, normality of the features in a dataset is desirable. Power transforms are a family of parametric, monotonic transformations that aim to map data from any distribution to as close to a Gaussian distribution as possible in order to stabilize variance and minimize skewness.</p ><p class='n_paragraph'><code>PowerTransformer</code> currently provides two such power transformations, the Yeo-Johnson transform and the Box-Cox transform.</p ><p class='n_paragraph'>The Yeo-Johnson transform is given by:</p ><p class='n_paragraph'>while the Box-Cox transform is given by:</p ><p class='n_paragraph'>Box-Cox can only be applied to strictly positive data. In both methods, the transformation is parameterized by , which is determined through maximum likelihood estimation. Here is an example of using Box-Cox to map samples drawn from a lognormal distribution to a normal distribution:</p ><p class='n_paragraph'>While the above example sets the <code>standardize</code> option to <code>False</code>, <code>PowerTransformer</code> will apply zero-mean, unit-variance normalization to the transformed output by default.</p ><p class='n_paragraph'>Below are examples of Box-Cox and Yeo-Johnson applied to various probability distributions. Note that when applied to certain distributions, the power transforms achieve very Gaussian-like results, but with others, they are ineffective. This highlights the importance of visualizing the data before and after transformation.</p ><p class='n_paragraph'>It is also possible to map data to a normal distribution using <code>QuantileTransformer</code> by setting <code>output_distribution='normal'</code>. Using the earlier example with the iris dataset:</p ><p class='n_paragraph'>Thus the median of the input becomes the mean of the output, centered at 0. The normal output is clipped so that the input’s minimum and maximum — corresponding to the 1e-7 and 1 - 1e-7 quantiles respectively — do not become infinite under the transformation.</p ><h2 class='n_heading_2'>6.3.3. Normalization</h2 ><p class='n_paragraph'><b>Normalization</b> is the process of <b>scaling individual samples to have unit norm</b>. This process can be useful if you plan to use a quadratic form such as the dot-product or any other kernel to quantify the similarity of any pair of samples.</p ><p class='n_paragraph'>This assumption is the base of the <a href='https://en.wikipedia.org/wiki/Vector_Space_Model'>Vector Space Model</a> often used in text classification and clustering contexts.</p ><p class='n_paragraph'>The function <code>normalize</code> provides a quick and easy way to perform this operation on a single array-like dataset, either using the <code>l1</code>, <code>l2</code>, or <code>max</code> norms:</p ><p class='n_paragraph'>The <code>preprocessing</code> module further provides a utility class <code>Normalizer</code> that implements the same operation using the <code>Transformer</code> API (even though the <code>fit</code> method is useless in this case: the class is stateless as this operation treats samples independently).</p ><p class='n_paragraph'>This class is hence suitable for use in the early steps of a <code>Pipeline</code>:</p ><p class='n_paragraph'>The normalizer instance can then be used on sample vectors as any transformer:</p ><p class='n_paragraph'>Note: L2 normalization is also known as spatial sign preprocessing.</p ><p class='n_paragraph'>Sparse input</p ><p class='n_paragraph'><code>normalize</code> and <code>Normalizer</code> accept <b>both dense array-like and sparse matrices from scipy.sparse as input</b>.</p ><p class='n_paragraph'>For sparse input the data is <b>converted to the Compressed Sparse Rows representation</b> (see <code>scipy.sparse.csr_matrix</code>) before being fed to efficient Cython routines. To avoid unnecessary memory copies, it is recommended to choose the CSR representation upstream.</p ></div></body></html>
|
source/7 Microservices Best Practices for Developers - DZone Microservices.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<html><head><title>7 Microservices Best Practices for Developers - DZone Microservices</title><meta name="URL" content="https://dzone.com/articles/7-microservices-best-practices-for-developers"/>
|
| 2 |
+
<meta name="Source" content="internet"/>
|
| 3 |
+
<meta name="Created" content="2021-09-20T18:35:00.000Z"/>
|
| 4 |
+
<meta name="Already Read" content="false"/>
|
| 5 |
+
<meta name="Name" content="7 Microservices Best Practices for Developers - DZone Microservices"/>
|
| 6 |
+
<meta name="parent" content="References"/>
|
| 7 |
+
</head><body><H1>7 Microservices Best Practices for Developers - DZone Microservices</H1><a href="https://www.notion.so/7-Microservices-Best-Practices-for-Developers-DZone-Microservices-f02b65955afc4a999791d4d9733efeea">Link to original Notion Page</a></p><table border='1'><tr><td><b>Property</b></td><td><b>Value</b></td></tr><tr><td>URL</td><td>https://dzone.com/articles/7-microservices-best-practices-for-developers</td></tr>
|
| 8 |
+
<tr><td>Source</td><td>internet</td></tr>
|
| 9 |
+
<tr><td>Created</td><td>2021-09-20T18:35:00.000Z</td></tr>
|
| 10 |
+
<tr><td>Already Read</td><td>false</td></tr>
|
| 11 |
+
<tr><td>Name</td><td>7 Microservices Best Practices for Developers - DZone Microservices</td></tr>
|
| 12 |
+
<tr><td>parent</td><td>References</td></tr>
|
| 13 |
+
</table> <div><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/e958d166-f11a-4336-8ed1-9a1691614020/15163221-thumb.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20220720%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20220720T153851Z&X-Amz-Expires=3600&X-Amz-Signature=b1b40d9e1b38cba2e27e5043450d8789a68f8ae60d17e32dc8fb4f22ccfa85bd&X-Amz-SignedHeaders=host&x-id=GetObject'/><p class='n_paragraph'>Unless you’ve been developing software in a cave, you’ve probably heard people sing the praises of microservices. They’re agile, simple, and an overall improvement on the <a href='https://konghq.com/learning-center/microservices/monolith-vs-microservices/?utm_source=guest&utm_medium=devspotlight&utm_campaign=community'>monolith</a> and service-oriented architecture days. But of course, with all the benefits of microservices comes a new set of challenges.</p ><p class='n_paragraph'>In this article, we’ll look at some microservices best practices. Plus, we’ll suggest a few proven ways to help you design, orchestrate, and secure your microservices architecture. By understanding these practices, you’ll have a head start on a successful project.</p ><h2 class='n_heading_2'>Benefits and Challenges of Microservices</h2 ><p class='n_paragraph'>Before we dive into microservices best practices, however, we should first talk about some of the <a href='https://konghq.com/learning-center/microservices/?utm_source=guest&utm_medium=devspotlight&utm_campaign=community'>benefits</a> and challenges of microservices and why you would want to use them in the first place.</p ><p class='n_paragraph'>Briefly, microservices are an improved software architecture that allow you to:</p ><p class='n_paragraph'>Of course, with these benefits, we have a new set of challenges, including inter-service communication, <a href='https://konghq.com/learning-center/api-gateway/building-a-secure-api-gateway/?utm_source=guest&utm_medium=devspotlight&utm_campaign=community'>security</a>, and scalability.</p ><p class='n_paragraph'>With that quick overview of the benefits and challenges of microservices, let’s now dive into some best practices. These best practices will help you create a robust, easy-to-manage, scalable, and secure system of intercommunicating microservices.</p ><h2 class='n_heading_2'>1. Small Application Domain</h2 ><p class='n_paragraph'>Adopting a microservices strategy requires embracing the <a href='https://en.wikipedia.org/wiki/Single-responsibility_principle'>single responsibility principle</a>. By limiting the scope of responsibility for any single service, we limit the negative impact of that service failing. If a single microservice is responsible for too much, its failure or unavailability will have a domino effect on the rest of the system.</p ><p class='n_paragraph'>A microservice should be just that: micro. Keep the app domain of your microservices small, dedicated to one logical functionality. This will reduce the impact that a given microservice has if any issues arise. In addition, smaller services are simpler to maintain. The result is easier updating and faster development.</p ><p class='n_paragraph'>What does this look like in practice? For example, let's assume that our microservice is an API server that accepts requests to fetch data, and an authorization token must accompany those requests. When you're just starting, this is the only microservice that requires an authorization token. Why not just make authentication and token generation part of the microservice? At first glance, the advantage is fewer moving parts, less to manage.</p ><p class='n_paragraph'>Of course, there will come a day when you'll have other services that require an authorization token. You'll soon find your original microservice functioning as an API server and an authentication server. If your API server goes down, then your authentication server goes down with it. With that, so does every other service that requires an authorization token.</p ><p class='n_paragraph'>Be considerate of your future self: keep your microservices small.</p ><h2 class='n_heading_2'>2. Separation of Data Storage</h2 ><p class='n_paragraph'>Multiple microservices connecting to the same database are still, in essence, a monolithic architecture. The monolith is just at the database layer instead of the application layer, making it just as fragile. Each microservice should have, as much as possible, its own data persistence layer. This not only ensures isolation from other microservices but also minimizes the blast radius if that particular data set were to become unavailable.</p ><p class='n_paragraph'>At times, it might seem to make sense for different microservices to access data in the same database. However, a deeper examination might reveal that one microservice only works with a subset of database tables, while the other microservice only works with a completely different subset of tables. If the two subsets of data are completely orthogonal, this would be a good case for separating the database into separate services. This way, a single service depends on its dedicated data store, and that data store's failure will not impact any service besides that one.</p ><p class='n_paragraph'>We could make an analogous case for file stores. When adopting a microservices <a href='https://konghq.com/learning-center/microservices/microservices-architectures/?utm_source=guest&utm_medium=devspotlight&utm_campaign=community'>architecture</a>, there's no requirement for separate microservices to use the same file storage service. Unless there's an actual overlap of files, separate microservices ought to have separate file stores.</p ><p class='n_paragraph'>With this separation of data comes an increase in flexibility. For example, let's assume we had two microservices, both sharing the same file storage service with a cloud provider. One microservice regularly touches numerous assets but is small in file size. The other microservice has only a few files that it touches periodically, but those files are hundreds of gigabytes in size.</p ><p class='n_paragraph'>Using a common file store service for both microservices makes you less flexible to optimize costs since you have a mix of large and small files and a mix of regular and periodic access. If each microservice had its own data persistence layer—and that could be a separate microservice, of course—then you’d have more flexibility to find the provider or service that best fits the needs of that individual microservice.</p ><p class='n_paragraph'>Cost optimization, the flexibility of options, and less dependence on a single solution that could fail—these are all reasons to separate the data of different microservices.</p ><h2 class='n_heading_2'>3. Communication Channels</h2 ><p class='n_paragraph'>How microservices communicate with one another—in particular, regarding events of interest—requires thoughtful consideration. Otherwise, a single unavailable service can lead to a communication breakdown that collapses an entire application.</p ><p class='n_paragraph'>Imagine a system of microservices for an online store. One microservice takes orders placed by a website. Another microservice sends a text notification to the customer that it received their order. Another microservice notifies the warehouse to send out the product. Finally, another microservice updates inventory counts.</p ><p class='n_paragraph'>There are two types of communication between microservices: synchronous and asynchronous. If we approach the above example using synchronous communication, a web server might process a new order by first sending a request to the customer notification service. After the customer notification service responds, the web server sends a request to the warehouse notification service, and again it waits for a response. Last, the web server sends a request to the inventory updater. Our synchronous approach would look like this:</p ><p class='n_paragraph'>Of course, suppose the customer notification service happened to be down. In that case, the request to notify the customer might timeout or return an error or perhaps leave the web server waiting for a response indefinitely. The warehouse notification service might never get the request to fulfill the shipment. Synchronous communication between microservices can create a dependency chain that breaks if any link in the chain breaks.</p ><p class='n_paragraph'>In asynchronous communication, a service sends a request and continues its life without waiting for a response. In one possible asynchronous approach, the web server might send the "notify customer" request and then complete its task. The customer notification service is responsible for notifying the customer and sending an asynchronous request to the warehouse notification service, which is responsible for sending a request to the inventory updater service. It might look like this:</p ><p class='n_paragraph'>In this model, of course, we see that asynchronous communication can still result in a chain dependency, and the failure of a single service would still disrupt the application.</p ><p class='n_paragraph'>A simple but effective approach to asynchronous communication is to adopt the publish/subscribe pattern. When an event of interest occurs, the producer—in this case, the microservice—publishes a record of that event to a message queue service. Any other microservices interested in that type of event subscribe to the message queue service as consumers of that event. Microservices only talk to and listen to the message queue service, not each other.</p ><p class='n_paragraph'>For our example, it might look like this:</p ><p class='n_paragraph'>The message queue is a separate service of its own, decoupled from all of the microservices. It is in charge of receiving published events and notifying subscribers of those events. This ensures that the failure of one microservice, which might mean delayed delivery of a message, has minimal impact on other related but unconcerned services.</p ><p class='n_paragraph'>There are many tools to accomplish this kind of asynchronous communication (for example, Kafka or RabbitMQ). Look for ways to integrate tools like these as asynchronous communication backbones for your microservices.</p ><p class='n_paragraph'>There are cases when synchronous communication between microservices is necessary. Most request-response interactions are, out of necessity, synchronous. For example, an API server querying a database must wait for the query response; a web server fetching cached data must wait for the key-value store to respond.</p ><p class='n_paragraph'>When synchronous communication is needed, you’ll want to use the open source <a href='https://konghq.com/kong/?utm_source=guest&utm_medium=devspotlight&utm_campaign=community'>Kong Gateway</a> to ensure that your communication is routed quickly and reliably to the right microservices.</p ><h2 class='n_heading_2'>4. Compatibility</h2 ><p class='n_paragraph'>As much as possible, maintain backward compatibility, so your consumers don’t encounter broken APIs. The popular way to do this is by following path level compatibility guarantees like <code>/api/v1</code> or <code>/api/v2</code>. Any backward-incompatible changes go to a new path like <code>/api/v3</code>.</p ><p class='n_paragraph'>However, despite our best efforts as software engineers, sometimes we need to deprecate APIs, so we’re not stuck running them forever. With the <a href='https://konghq.com/blog/api-gateway-request-transformation/'>API gateway request transformation</a> plugin, your microservices can alert your API consumers by easily injecting deprecation notices alongside the original API response or attaching a “deprecation header” similar to <a href='https://kubernetes.io/docs/reference/using-api/deprecation-policy/#rest-resources-aka-api-objects'>Kubernetes</a>.</p ><h2 class='n_heading_2'>5. Orchestrating Microservices</h2 ><p class='n_paragraph'>Orchestration of your microservices is a key factor of success in both process and tooling. Technically, you could use something like systemd and Docker or podman to run containers on a virtual machine, but that doesn’t provide the same level of resiliency as a container orchestration platform. This negatively affects the uptime and availability benefits that come with adopting a microservices architecture. For effective microservice orchestration, you’ll want to rely on a battle-tested container orchestration platform; and the clear leader in that field is <a href='https://konghq.com/learning-center/kubernetes/what-is-kubernetes/?utm_source=guest&utm_medium=devspotlight&utm_campaign=community'>Kubernetes</a>.</p ><p class='n_paragraph'>Kubernetes manages all of your containers’ provisioning and deployment while handling load balancing, scaling, replica sets for high availability, and network communication concerns.</p ><p class='n_paragraph'>You might deploy bare Kubernetes on-premises, or you might go with a cloud distribution like Azure Kubernetes Service, Red Hat OpenShift, or Amazon Elastic Kubernetes Service. The built-in scheduling, replication, and networking capabilities of Kubernetes make microservice orchestration much easier than on a traditional operating system.</p ><p class='n_paragraph'>Couple Kubernetes with <a href='https://kuma.io/'>Kuma</a> service mesh and <a href='https://konghq.com/solutions/kubernetes-ingress/?utm_source=guest&utm_medium=devspotlight&utm_campaign=community'>Kong Ingress Controller</a>, and you have microservices that are discoverable, monitored, and resilient—like magic.</p ><h2 class='n_heading_2'>6. Microservices Security</h2 ><p class='n_paragraph'>As your application comprises more and more microservices, ensuring proper security can become a complicated beast. A centralized system for enforcing security policies is vital to protecting your overall application from malicious users, invasive bots, and faulty code. <a href='https://konghq.com/?utm_source=guest&utm_medium=devspotlight&utm_campaign=community'>Kong</a> ought to be the start of your security story with microservices, whether you’re running on VMs or in Kubernetes. The abundance of Kong-maintained <a href='https://docs.konghq.com/hub/#security'>security plugins</a> makes it easy to address some of the most common needs for microservices, including <a href='https://konghq.com/blog/kong-gateway-key-authentication/'>authentication</a>, authorization, traffic control, and <a href='https://konghq.com/blog/kong-gateway-rate-limiting/'>rate limiting</a>.</p ><h3 class='n_heading_3'>Example: Rate Limiting with Kong Ingress Controller</h3 ><p class='n_paragraph'>To demonstrate an example of a security plugin at work, we'll deploy Kong's <a href='https://docs.konghq.com/hub/kong-inc/rate-limiting/'>Rate Limiting plugin</a> to show how Kong can prevent excessive inbound requests to your applications. We'll create a local Kubernetes cluster with <a href='https://kind.sigs.k8s.io/'>kind</a> and then deploy the Kong Ingress Controller by following these <a href='https://docs.konghq.com/kubernetes-ingress-controller/1.3.x/deployment/k4k8s/'>instructions</a>.</p ><p class='n_paragraph'>After creating a cluster and deploying the Kong Ingress Controller, our first step is to set up the Rate Limiting plugin. There are different scopes for which you can set up the plugin. We’ll use the default project on our Kubernetes cluster for our use case and scope the plugin to that default namespace.</p ><p class='n_paragraph'>Now, we’ll create an “echo service” and an ingress for the service. In this case, we’re borrowing the example from Kong’s <a href='https://docs.konghq.com/kubernetes-ingress-controller/1.3.x/guides/getting-started/#set-up-an-echo-server'>Getting Started with Kubernetes Ingress Controller</a> documentation:</p ><p class='n_paragraph'>The last thing we need to do is test! We’ll borrow the shell-demo from the Kubernetes<a href='https://kubernetes.io/docs/tasks/debug-application-cluster/get-shell-running-container/'> documentation for in-cluster testing</a>:</p ><p class='n_paragraph'>Before getting into our shell pod, we’ll need the cluster IP of kong-proxy:</p ><p class='n_paragraph'>Now, we can get shell access to our pod and test the rate limiting:</p ><p class='n_paragraph'>The additional step of using an intermediary pod to test the rate limiting won’t be necessary for most cloud providers, which gives you a load balancer out of the box. In this case, since we’re using <code>kind</code>, there’s no load balancer provisioned, so our test comes from within the cluster. This same test would work externally if a load balancer were available.</p ><p class='n_paragraph'>Rate limiting is just one example of where Kong fits into the security concerns of your overall microservices strategy and best practices but can easily provide a fully comprehensive solution. Kong maintains several plugins and products to keep your communication channels bulletproof, API change impact minimal, and your application domains manageable. Plus, it's compatible with most programming languages and vendor options.</p ><h2 class='n_heading_2'>7. Metrics and Monitoring</h2 ><p class='n_paragraph'>An architecture built on microservices can lead to massive scaling of hundreds or thousands of small, modular services. While that yields huge potential for increased speed, availability, and reach, a sprawling system of microservices requires a strategic and systematic approach to monitoring. By keeping an eye on all of your microservices, you'll ensure that they are functioning as they ought to, are available to your users, and are using resources appropriately. When any of these expectations are not met, you can respond by taking proper action.</p ><p class='n_paragraph'>Fortunately, you don't need to reinvent the wheel when it comes to monitoring. There are several widely adopted monitoring solutions that can integrate seamlessly within your infrastructure. Some solutions use metrics exporter SDKs which can be integrated by adding one or two lines of code in your microservice. Others can be integrated with your API gateway or service mesh as a plugin, for monitoring networking concerns and resource usage.</p ><p class='n_paragraph'>As your monitoring tools gather metrics, those metrics can be consumed by visualization tools—beautiful dashboards that help you see the numbers behind your microservices. How many users were online last Thursday at 8:00 PM? How much has CPU load increased since we released that new feature? What's the latency between our product shipping API and the invoicing API?</p ><p class='n_paragraph'>By monitoring your microservices and having your hard numbers presented clearly, you're equipped to make informed decisions about how to keep your microservices healthy and available. As you do that, you'll keep your users happy.</p ><p class='n_paragraph'>Microservices are a wild ride! You start with the incredible benefits of speedier deployment and scalability, reduced downtime, and overall improvement of your business availability. Then, you throw in your orchestration platform, along with some best practices powered by Kong and its plugins, and boom! You have a symphony of packets flowing to and fro between your microservices that are secure, reliable, and bulletproof. We’ve only covered a small subset of what Kong can do, so I’d highly recommend checking out <a href='https://docs.konghq.com/hub/'>Kong Hub</a> to see all the functionality available to ease your journey to microservice nirvana!</p ></div></body></html>
|
source/@Today Print Nth line from a file in unix.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<html><head><title>@Today Print Nth line from a file in unix</title><meta name="Source" content="internet"/>
|
| 2 |
+
<meta name="Category" content="interest"/>
|
| 3 |
+
<meta name="Created" content="2023-05-19T12:50:00.000Z"/>
|
| 4 |
+
<meta name="Already Read" content="false"/>
|
| 5 |
+
<meta name="Name" content="@Today Print Nth line from a file in unix"/>
|
| 6 |
+
<meta name="parent" content="References"/>
|
| 7 |
+
</head><body><H1>@Today Print Nth line from a file in unix</H1><a href="https://www.notion.so/Today-Print-Nth-line-from-a-file-in-unix-6a9a7ad206124dbeb47c0f3a208ce81a">Link to original Notion Page</a></p><table border='1'><tr><td><b>Property</b></td><td><b>Value</b></td></tr><tr><td>Source</td><td>internet</td></tr>
|
| 8 |
+
<tr><td>Category</td><td>interest</td></tr>
|
| 9 |
+
<tr><td>Created</td><td>2023-05-19T12:50:00.000Z</td></tr>
|
| 10 |
+
<tr><td>Already Read</td><td>false</td></tr>
|
| 11 |
+
<tr><td>Name</td><td>@Today Print Nth line from a file in unix</td></tr>
|
| 12 |
+
<tr><td>parent</td><td>References</td></tr>
|
| 13 |
+
</table> <div><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/424424d4-2d68-4832-af85-6e95f4626469/Untitled.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20230607%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230607T213303Z&X-Amz-Expires=3600&X-Amz-Signature=94ae88fe97a2a095c8cf361aba67872459f84d70cc77d8853411a911e3dbd1bc&X-Amz-SignedHeaders=host&x-id=GetObject'/><p class='n_paragraph'></p ></div></body></html>
|
source/Bash Keyboard Shortcuts .html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<html><head><title> Bash Keyboard Shortcuts </title><meta name="URL" content="https://ostechnix.com/list-useful-bash-keyboard-shortcuts/"/>
|
| 2 |
+
<meta name="Source" content="internet"/>
|
| 3 |
+
<meta name="Created" content="2022-02-14T16:09:00.000Z"/>
|
| 4 |
+
<meta name="Already Read" content="true"/>
|
| 5 |
+
<meta name="Name" content=" Bash Keyboard Shortcuts "/>
|
| 6 |
+
<meta name="parent" content="References"/>
|
| 7 |
+
</head><body><H1> Bash Keyboard Shortcuts </H1><a href="https://www.notion.so/Bash-Keyboard-Shortcuts-77a9ea5db6dc42269b823660ac26916a">Link to original Notion Page</a></p><table border='1'><tr><td><b>Property</b></td><td><b>Value</b></td></tr><tr><td>URL</td><td>https://ostechnix.com/list-useful-bash-keyboard-shortcuts/</td></tr>
|
| 8 |
+
<tr><td>Source</td><td>internet</td></tr>
|
| 9 |
+
<tr><td>Created</td><td>2022-02-14T16:09:00.000Z</td></tr>
|
| 10 |
+
<tr><td>Already Read</td><td>true</td></tr>
|
| 11 |
+
<tr><td>Name</td><td> Bash Keyboard Shortcuts </td></tr>
|
| 12 |
+
<tr><td>parent</td><td>References</td></tr>
|
| 13 |
+
</table> <div><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/0040e64e-e3b9-425e-b88a-bbe40071a8c1/Bash.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20220720%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20220720T153354Z&X-Amz-Expires=3600&X-Amz-Signature=4d9bb393aab80e43d1a86fd616b4a5d34958c51ac1d9071fd28b573625ac649c&X-Amz-SignedHeaders=host&x-id=GetObject'/><p class='n_paragraph'>Nowadays, I spend more time in Terminal. I learned many BASH tricks over time. Here is the list of useful of BASH keyboard shortcuts that every Linux users should know to get things done faster in their BASH shell. I won't claim that this list is a complete list of BASH shortcuts, but just enough to move around your BASH shell faster than before.</p ><h2 class='n_heading_2'>Bash keyboard shortcuts</h2 ><p class='n_paragraph'>Learning how to navigate faster in BASH Shell not only saves some time, but also makes you proud of yourself for learning something worth. Well, let's get started.</p ><h3 class='n_heading_3'>ALT key shortcuts</h3 ><p class='n_paragraph'>1.<b> ALT+A</b> - Go to the beginning of a line.</p ><p class='n_paragraph'>2.<b> ALT+B</b> - Move one character before the cursor.</p ><p class='n_paragraph'>3.<b> ALT+C</b> - Suspends the running command/process. Same as CTRL+C</p ><p class='n_paragraph'>4.<b> ALT+D</b> - Closes the empty Terminal (I.e it closes the Terminal when there is nothing typed). Also deletes all characters after the cursor.</p ><p class='n_paragraph'>5.<b> ALT+F</b> - Move forward one character.</p ><p class='n_paragraph'>6.<b> ALT+T</b> - Swaps the last two words.</p ><p class='n_paragraph'>7.<b> ALT+U</b> - Capitalize all characters in a word after the cursor.</p ><p class='n_paragraph'>8.<b> ALT+L</b> - Uncaptalize all characters in a word after the cursor.</p ><p class='n_paragraph'>9.<b> ALT+R</b> - Undo any changes to a command that you have brought from the history if you’ve edited it.</p ><p class='n_paragraph'>10.<b> ALT+.</b> (note the <b>dot</b> at the end) - Use the last word of the previous command.</p ><p class='n_paragraph'>If you want to use the same options for multiple commands, you can use this shortcut to bring back the last word of previous command. For instance, I need to short the contents of a directory using "ls -r" command. Also, I want to view my Kernel version using "uname -r". In both commands, the common word is "-r". This is where ALT+. shortcut comes in handy. First run, ls -r command to do reverse shorting and use the last word "-r" in the nex command i.e uname.</p ><h3 class='n_heading_3'>CTRL key shortcuts</h3 ><p class='n_paragraph'>1.<b> CTRL+A</b> - Quickly move to the beginning of line.</p ><p class='n_paragraph'>Let us say you're typing a command something like below. While you're at the N'th line, you noticed there is a typo in the first character</p ><pre>$ gind . -mtime -1 -type </pre><p class='n_paragraph'>Did you notice? I typed "gind" instead of "find" in the above command. You can correct this error by pressing the left arrow all the way to the first letter and replace "g" with "f". Alternatively, just hit the <b>CTRL+A</b> or <b>Home</b> key to instantly go to the beginning of the line and replace the misspelled character. This will save you a few seconds.</p ><p class='n_paragraph'>2.<b> CTRL+B</b> - To move backward one character.</p ><p class='n_paragraph'>This shortcut key can move the cursor backward one character i.e one character before the cursor. Alternatively, you can use LEFT arrow to move backward one character.</p ><p class='n_paragraph'>3.<b> CTRL+C</b> - Stop the currently running command</p ><p class='n_paragraph'>If a command takes too long to complete or if you mistakenly run it, you can forcibly stop or quit the command by using <b>CTRL+C</b>.</p ><p class='n_paragraph'>4.<b> CTRL+D</b> - Delete one character backward.</p ><p class='n_paragraph'>If you have a system where the BACKSPACE key isn't working, you can use <b>CTRL+D</b> to delete one character backward. This shortcut also lets you logs out of the current session, similar to exit.</p ><p class='n_paragraph'>5.<b> CTRL+E</b> - Move to the end of line</p ><p class='n_paragraph'>After you corrected any misspelled word in the start of a command or line, just hit <b>CTRL+E</b> to quickly move to the end of the line. Alternatively, you can use END key in your keyboard.</p ><p class='n_paragraph'>6.<b> CTRL+F</b> - Move forward one character</p ><p class='n_paragraph'>If you want to move the cursor forward one character after another, just press <b>CTRL+F</b> instead of RIGHT arrow key.</p ><p class='n_paragraph'>7.<b> CTRL+G</b> - Leave the history searching mode without running the command.</p ><p class='n_paragraph'>As you see in the above screenshot, I did the reverse search, but didn't execute the command and left the history searching mode.</p ><p class='n_paragraph'>8.<b> CTRL+H</b> - Delete the characters before the cursor, same as BASKSPACE.</p ><p class='n_paragraph'>9.<b> CTRL+J</b> - Same as ENTER/RETURN key.</p ><p class='n_paragraph'><b>Tip:</b> ENTER key is not working? No problem! <b>CTRL+J</b> or <b>CTRL+M</b> can be used as an alternative to ENTER key.</p ><p class='n_paragraph'>10.<b> CTRL+K</b> - Delete all characters after the cursor.</p ><p class='n_paragraph'>You don't have to keep hitting the DELETE key to delete the characters after the cursor. Just press <b>CTRL+K</b> to delete all characters after the cursor.</p ><p class='n_paragraph'>11.<b> CTRL+L</b> - Clears the screen and redisplay the line.</p ><p class='n_paragraph'>Don't type "clear" to clear the screen. Just press CTRL+L to clear and redisplay the currently typed line.</p ><p class='n_paragraph'>12.<b> CTRL+M</b> - Same as CTRL+J or RETURN.</p ><p class='n_paragraph'>13.<b> CTRL+N</b> - Display next line in command history.</p ><p class='n_paragraph'>You can also use DOWN arrow.</p ><p class='n_paragraph'>14.<b> CTRL+O</b> - Run the command that you found using reverse search i.e CTRL+R.</p ><p class='n_paragraph'>15.<b> CTRL+P</b> - Displays the previous line in command history.</p ><p class='n_paragraph'>You can also use UP arrow.</p ><p class='n_paragraph'>16.<b> CTRL+R</b> - Searches the history backward (Reverse search).</p ><p class='n_paragraph'>17.<b> CTRL+S</b> - Searches the history forward.</p ><p class='n_paragraph'>18.<b> CTRL+T</b> - Swaps the last two characters.</p ><p class='n_paragraph'>This is one of my favorite shortcut. Let us say you typed "sl" instead of "ls". No problem! This shortcut will transposes the characters as in the below screenshot.</p ><p class='n_paragraph'>19.<b> CTRL+U</b> - Delete all characters before the cursor (Kills backward from point to the beginning of line).</p ><p class='n_paragraph'>This shortcut will delete all typed characters backward at once.</p ><p class='n_paragraph'>20.<b> CTRL+V</b> - Makes the next character typed verbatim</p ><p class='n_paragraph'>21.<b> CTRL+W</b> - Delete the words before the cursor.</p ><p class='n_paragraph'>Don't confuse it with CTRL+U. CTRL+W won't delete everything behind a cursor, but a single word.</p ><p class='n_paragraph'>22.<b> CTRL+X</b> - Lists the possible filename completions of the current word.</p ><p class='n_paragraph'>23.<b> CTRL+XX</b> - Move between start of command line and current cursor position (and back again).</p ><p class='n_paragraph'>24.<b> CTRL+Y</b> - Retrieves last item that you deleted or cut.</p ><p class='n_paragraph'>Remember, we deleted a word "-al" using CTRL+W in the 21st command. You can retrieve that word instantly using CTRL+Y.</p ><p class='n_paragraph'>See? I didn't type "-al". Instead, I pressed CTRL+Y to retrieve it.</p ><p class='n_paragraph'>Ctrl+U and CTRL+Y shortcuts are very useful in situations where you want to quickly delete the commands and retrieve them instantly.</p ><p class='n_paragraph'>Ctrl-U will delete from the cursor to the beginning of the line, and Ctrl-Y will bring it back.</p ><p class='n_paragraph'>So if you have entered a long and complex command, but then remembered you needed to execute something else first, don't delete it, but press Ctrl-U. When you have executed all the intermediate commands, you press Ctrl-Y.</p ><p class='n_paragraph'>25.<b> CTRL+Z</b> - Stops the current command.</p ><p class='n_paragraph'>You may very well know this shortcut. It kills the currently running command. You can resume it with <b>fg</b> in the foreground or <b>bg</b> in the background.</p ><p class='n_paragraph'>26.<b> CTRL+[</b> - Equivalent to ESC key.</p ><h3 class='n_heading_3'>Miscellaneous</h3 ><p class='n_paragraph'>1.<b> !!</b> - Repeats the last command.</p ><p class='n_paragraph'>2.<b> ESC+t</b> - Swaps the last two words.</p ><p class='n_paragraph'>For example, it would turn the following command from,</p ><pre>ls -al </pre><p class='n_paragraph'>to,</p ><pre>al -ls </pre><p class='n_paragraph'>That's all I have in mind now. I will keep adding more if I came across any Bash shortcut keys in future. If you think there is a mistake or typo in this article, please let me in the comments section below. I will check and update it accordingly.</p ></div></body></html>
|
source/Design Patterns- Elements of Reusable Object-Oriented Software.html
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<html><head><title> Design Patterns- Elements of Reusable Object-Oriented Software</title><meta name="Source" content="Book Notes"/>
|
| 2 |
+
<meta name="Created" content="2022-11-23T02:42:00.000Z"/>
|
| 3 |
+
<meta name="Notes" content="2023-01-02T08:40:00.000+05:30 Builder Design Pattern,2023-01-02T18:54:00.000+05:30 Factory Method,2022-07-22T10:11:00.000+05:30 AbstractFactory Design Pattern,2023-01-03T08:56:00.000+05:30 Prototype Design Pattern,2023-01-04T08:42:00.000+05:30 Singleton Design Pattern,2023-01-09T08:47:00.000+05:30 Structural Patterns,2023-01-09T08:52:00.000+05:30 Adapter Design Pattern,2023-01-09T09:45:00.000+05:30 Bridge design Pattern,2023-01-10T09:30:00.000+05:30 Composite Design Pattern,2023-01-11T08:27:00.000+05:30 Decorator Design Pattern,2023-01-11T09:36:00.000+05:30 Facade Design Pattern,2023-01-11T10:43:00.000+05:30 Flyweight Design Pattern,2023-01-12T09:48:00.000+05:30 Proxy Design Pattern,2023-01-13T09:41:00.000+05:30 Behavioral Patterns,2023-01-13T09:45:00.000+05:30 Chain of Responsibility Design Pattern,2023-01-13T20:17:00.000+05:30 Command Design Pattern,2023-01-13T20:41:00.000+05:30 Interpreter Design Pattern,2023-01-17T08:07:00.000+05:30 Iterator Design Pattern,2023-01-17T08:37:00.000+05:30 Mediator Design Pattern,2023-01-17T09:01:00.000+05:30 Memento Design Pattern,2023-01-17T09:20:00.000+05:30 Observer Design Pattern,2023-01-17T13:18:00.000+05:30 State Design Pattern,2023-01-17T14:15:00.000+05:30 Table-based lookup- alternative to State Design Pattern,2023-01-17T14:30:00.000+05:30 Strategy Design Pattern,2023-01-17T15:14:00.000+05:30 Template Method Design Pattern"/>
|
| 4 |
+
<meta name="Already Read" content="false"/>
|
| 5 |
+
<meta name="Name" content=" Design Patterns- Elements of Reusable Object-Oriented Software"/>
|
| 6 |
+
<meta name="parent" content="References"/>
|
| 7 |
+
</head><body><H1> Design Patterns- Elements of Reusable Object-Oriented Software</H1><a href="https://www.notion.so/Design-Patterns-Elements-of-Reusable-Object-Oriented-Software-1fe1c3ef2b2e4dfcbe31df82ce0b7712">Link to original Notion Page</a></p><table border='1'><tr><td><b>Property</b></td><td><b>Value</b></td></tr><tr><td>Source</td><td>Book Notes</td></tr>
|
| 8 |
+
<tr><td>Created</td><td>2022-11-23T02:42:00.000Z</td></tr>
|
| 9 |
+
<tr><td>Notes</td><td><a href="../Notes-box/2023-01-02T08:40:00.000+05:30 Builder Design Pattern.html">2023-01-02T08:40:00.000+05:30 Builder Design Pattern</a>,<a href="../Notes-box/2023-01-02T18:54:00.000+05:30 Factory Method.html">2023-01-02T18:54:00.000+05:30 Factory Method</a>,<a href="../Notes-box/2022-07-22T10:11:00.000+05:30 AbstractFactory Design Pattern.html">2022-07-22T10:11:00.000+05:30 AbstractFactory Design Pattern</a>,<a href="../Notes-box/2023-01-03T08:56:00.000+05:30 Prototype Design Pattern.html">2023-01-03T08:56:00.000+05:30 Prototype Design Pattern</a>,<a href="../Notes-box/2023-01-04T08:42:00.000+05:30 Singleton Design Pattern.html">2023-01-04T08:42:00.000+05:30 Singleton Design Pattern</a>,<a href="../Notes-box/2023-01-09T08:47:00.000+05:30 Structural Patterns.html">2023-01-09T08:47:00.000+05:30 Structural Patterns</a>,<a href="../Notes-box/2023-01-09T08:52:00.000+05:30 Adapter Design Pattern.html">2023-01-09T08:52:00.000+05:30 Adapter Design Pattern</a>,<a href="../Notes-box/2023-01-09T09:45:00.000+05:30 Bridge design Pattern.html">2023-01-09T09:45:00.000+05:30 Bridge design Pattern</a>,<a href="../Notes-box/2023-01-10T09:30:00.000+05:30 Composite Design Pattern.html">2023-01-10T09:30:00.000+05:30 Composite Design Pattern</a>,<a href="../Notes-box/2023-01-11T08:27:00.000+05:30 Decorator Design Pattern.html">2023-01-11T08:27:00.000+05:30 Decorator Design Pattern</a>,<a href="../Notes-box/2023-01-11T09:36:00.000+05:30 Facade Design Pattern.html">2023-01-11T09:36:00.000+05:30 Facade Design Pattern</a>,<a href="../Notes-box/2023-01-11T10:43:00.000+05:30 Flyweight Design Pattern.html">2023-01-11T10:43:00.000+05:30 Flyweight Design Pattern</a>,<a href="../Notes-box/2023-01-12T09:48:00.000+05:30 Proxy Design Pattern.html">2023-01-12T09:48:00.000+05:30 Proxy Design Pattern</a>,<a href="../Notes-box/2023-01-13T09:41:00.000+05:30 Behavioral Patterns.html">2023-01-13T09:41:00.000+05:30 Behavioral Patterns</a>,<a href="../Notes-box/2023-01-13T09:45:00.000+05:30 Chain of Responsibility Design Pattern.html">2023-01-13T09:45:00.000+05:30 Chain of Responsibility Design Pattern</a>,<a href="../Notes-box/2023-01-13T20:17:00.000+05:30 Command Design Pattern.html">2023-01-13T20:17:00.000+05:30 Command Design Pattern</a>,<a href="../Notes-box/2023-01-13T20:41:00.000+05:30 Interpreter Design Pattern.html">2023-01-13T20:41:00.000+05:30 Interpreter Design Pattern</a>,<a href="../Notes-box/2023-01-17T08:07:00.000+05:30 Iterator Design Pattern.html">2023-01-17T08:07:00.000+05:30 Iterator Design Pattern</a>,<a href="../Notes-box/2023-01-17T08:37:00.000+05:30 Mediator Design Pattern.html">2023-01-17T08:37:00.000+05:30 Mediator Design Pattern</a>,<a href="../Notes-box/2023-01-17T09:01:00.000+05:30 Memento Design Pattern.html">2023-01-17T09:01:00.000+05:30 Memento Design Pattern</a>,<a href="../Notes-box/2023-01-17T09:20:00.000+05:30 Observer Design Pattern.html">2023-01-17T09:20:00.000+05:30 Observer Design Pattern</a>,<a href="../Notes-box/2023-01-17T13:18:00.000+05:30 State Design Pattern.html">2023-01-17T13:18:00.000+05:30 State Design Pattern</a>,<a href="../Notes-box/2023-01-17T14:15:00.000+05:30 Table-based lookup- alternative to State Design Pattern.html">2023-01-17T14:15:00.000+05:30 Table-based lookup- alternative to State Design Pattern</a>,<a href="../Notes-box/2023-01-17T14:30:00.000+05:30 Strategy Design Pattern.html">2023-01-17T14:30:00.000+05:30 Strategy Design Pattern</a>,<a href="../Notes-box/2023-01-17T15:14:00.000+05:30 Template Method Design Pattern.html">2023-01-17T15:14:00.000+05:30 Template Method Design Pattern</a></td></tr>
|
| 10 |
+
<tr><td>Already Read</td><td>false</td></tr>
|
| 11 |
+
<tr><td>Name</td><td> Design Patterns- Elements of Reusable Object-Oriented Software</td></tr>
|
| 12 |
+
<tr><td>parent</td><td>References</td></tr>
|
| 13 |
+
</table> <div><h1 class='n_heading_1'>Introduction </h1 ><h3 class='n_heading_3'>What is a design Pattern ?</h3 ><ul><li class='n_bulleted_list_item'>Design patterns make it easier to reuse successful designs and architectures.</li ><li class='n_bulleted_list_item'>A design pattern names, abstracts, and identifies the key aspects of a common design structure that make it useful for creating a reusable object-oriented design. The design pattern identifies the participating classes and instances, their roles and collaborations, and the distribution of responsibilities</li ><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/b369d288-826f-4ce9-88f6-291b0c71261e/Untitled.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20230118%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230118T213418Z&X-Amz-Expires=3600&X-Amz-Signature=32c61766b3322146bf7c1052e4292527f2c59bf2b80c6ffb671063ed0893c203&X-Amz-SignedHeaders=host&x-id=GetObject'/><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/43b8ea71-bc37-455a-ad20-de1d496c200e/Untitled.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20230118%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230118T213418Z&X-Amz-Expires=3600&X-Amz-Signature=f96f30d1b4b1a5413b1032f4da9d1bfe30a4e52dadd1d5ba7dc392022f50fadd&X-Amz-SignedHeaders=host&x-id=GetObject'/><ul><li class='n_bulleted_list_item'>Design patterns help you define interfaces by identifying their key elements and the kinds of data that get sent across an interface. A design pattern might also tell you what not to put in the interface.</li ><li class='n_bulleted_list_item'>Design patterns also specify relationships between interfaces. In particular, they often require some classes to have similar interfaces, or they place constraints on the interfaces of some classes. </li ><li class='n_bulleted_list_item'><code>An abstract class is one whose main purpose is to define a common interface for its subclasses. An abstract class will defer some or all of its implementation to operations defined in subclasses; hence an abstract class cannot be instantiated.</code></li ><li class='n_bulleted_list_item'><code>The names of abstract classes appear in slanted type to distinguish them from concrete classes.</code>[for the notations section].</li ></ul><h3 class='n_heading_3'>Design Principles</h3 ><ul><li class='n_bulleted_list_item'><b>Programming to an an interface, not an implementation</b><div><ul><li class='n_bulleted_list_item'>implementation reuse is only half the story. Inheritance's ability to define families of objects with identical interfaces (usually by inheriting from an abstract class) is also important. Why? Because polymorphism depends on it.</li ><li class='n_bulleted_list_item'>There are two benefits to manipulating objects solely in terms of the interface defined by abstract classes:<div><p class='n_paragraph'>1. Clients remain unaware of the specific types of objects they use, as long as the objects adhere to the interface that clients expect.</p ><p class='n_paragraph'>2. Clients remain unaware of the classes that implement these objects. Clients only know about the abstract class(es) defining the interface.</p ></div></li ><li class='n_bulleted_list_item'>This so greatly reduces implementation dependencies between subsystems that it leads to the following principle of reusable object-oriented design: Program to an interface, not an implementation.</li ></ul></div></li ><li class='n_bulleted_list_item'><b>Inheritance versus Composition</b><div><ul><li class='n_bulleted_list_item'>Inheritance is “compile time“ and white-box. The details of parent are visible to sub-classes. <div><ul><li class='n_bulleted_list_item'>It is easier to use and modification of reused implementation is easier</li ><li class='n_bulleted_list_item'>"inheritance breaks encapsulation" . The implementation of a subclass becomes so bound up with the implementation of its parent class that any change in the parent's implementation will force the subclass to change.</li ></ul></div></li ><li class='n_bulleted_list_item'>Composition or assembly is “run-time” by objects acquiring reference to other objects. <div><ul><li class='n_bulleted_list_item'>All communications happen only through defined interfaces to encapsulation is better preserved.</li ><li class='n_bulleted_list_item'>Composition requires objects to respect each others' interfaces, which in turn requires carefully designed interfaces that don't stop you from using one object with many others.</li ><li class='n_bulleted_list_item'>Favoring object composition over class inheritance helps you keep each class encapsulated and focused on one task. Your classes and class hierarchies will remain small and will be less likely to grow into unmanageable monsters</li ><li class='n_bulleted_list_item'>However, a design based on object composition will have more objects (if fewer classes), and the system's behavior will depend on their interrelationships instead of being defined in one class.</li ><li class='n_bulleted_list_item'>Reuse by inheritance makes it easier to make new components that can be composed with old ones.</li ></ul></div></li ></ul><p class='n_paragraph'>Hence the principle:</p ><p class='n_paragraph'> Favor object composition over class inheritance [ie prefer ‘have’ relation over ‘type of’ relation]</p ></div></li ><li class='n_bulleted_list_item'><b>Delegation</b><div><ul><li class='n_bulleted_list_item'>Delegation is a way of making composition as powerful for reuse as inheritance. In delegation, two objects are involved in handling a request: a receiving object delegates operations to its <b>delegate</b>. This is analogous to subclasses deferring requests to parent classes. The call however is explicit [instead of through inheritance.</li ><li class='n_bulleted_list_item'>The receiver passes itself to the delegate to let the delegated operation refer to the receiver.</li ><li class='n_bulleted_list_item'>The main advantage of delegation is that it makes it easy to compose behaviors at run-time and to change the way they're composed.</li ><li class='n_bulleted_list_item'>Delegation has a disadvantage it shares with other techniques that make software more flexible through object composition: Dynamic, highly parameterized software is harder to understand than more static software. There are also run-time inefficiencies, but the human inefficiencies are more important in the long run.</li ><li class='n_bulleted_list_item'>Delegation is a good design choice only when it simplifies more than it complicates.</li ></ul></div></li ><li class='n_bulleted_list_item'><b>Inheritance versus Parameterized Types</b><div><ul><li class='n_bulleted_list_item'>Parameterized type is also called generics. or templates Recall class parameterization in c++/java.</li ><li class='n_bulleted_list_item'>Parameterized types let you change the types that a class can use. But neither inheritance nor parameterized types can change at run-time</li ></ul></div></li ></ul><h3 class='n_heading_3'>What is a framework ?</h3 ><p class='n_paragraph'> The framework dictates the architecture of your application. It will define the overall structure, its partitioning into classes and objects, the key responsibilities thereof, how the classes and objects collaborate, and the thread of control. A framework predefines these design parameters so that you, the application designer/implementer, can concentrate on the specifics of your application. The framework captures the design decisions that are common to its application domain.</p ><p class='n_paragraph'>Frameworks thus emphasize design reuse over code reuse, though a framework will usually include concrete subclasses you can put to work immediately.</p ><p class='n_paragraph'></p ><h3 class='n_heading_3'>Design Aspects that design pattern let you vary ?</h3 ><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/084e52bb-a942-4427-a790-a36817069be2/Untitled.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20230118%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230118T213418Z&X-Amz-Expires=3600&X-Amz-Signature=b3b4dc9bea15e2f9cce9834cfb3836414176b997ba1fbe883226373547a63fe8&X-Amz-SignedHeaders=host&x-id=GetObject'/><p class='n_paragraph'></p ><ul><li class='n_bulleted_list_item'>Design for changes<div><ul><li class='n_bulleted_list_item'>Encapsulate the concept that varies</li ></ul></div></li ></ul><p class='n_paragraph'></p ><ul><li class='n_bulleted_list_item'>Well-designed object-oriented systems are just like this – they have multiple patterns embedded in them – but not because their designers necessarily thought in these terms. Composition at the pattern level rather than the class or object levels lets us achieve the same synergy with greater ease.</li ></ul><p class='n_paragraph'></p ><ul><li class='n_bulleted_list_item'><b>Design Pattern as aid in identifying targets for Refactoring</b><div><ul><li class='n_bulleted_list_item'>In developing reusable software we have to often reorganize or refactor. Design patterns help you determine how to reorganize a design, and they can reduce the amount of refactoring you need to do later.</li ><li class='n_bulleted_list_item'>The lifecycle of object-oriented software has several phases. Brian Foote identifies these phases as the prototyping, expansionary, and consolidating phases.<div><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/3aed6c29-9a6f-4dab-8b26-cf7bcc132cd5/Untitled.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20230118%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230118T213429Z&X-Amz-Expires=3600&X-Amz-Signature=26ef888e988efe1963aa0619fdf97578a3e7e9f506707e703adc93e886c4c105&X-Amz-SignedHeaders=host&x-id=GetObject'/></div></li ><li class='n_bulleted_list_item'>Refactoring involves tearing apart classes into special-and general-purpose components, moving operations up or down the class hierarchy, and rationalizing the interfaces of
|
| 14 |
+
classes. This consolidation phase produces many new kinds of objects, often by decomposing existing objects and using object composition instead of inheritance. Hence black-box reuse replaces white-box reuse. The continual need to satisfy more requirements along with the need for more reuse propels object-oriented software through repeated phases of expansion and consolidation – expansion as new requirements are satisfied, and consolidation as the software becomes more general.</li ><li class='n_bulleted_list_item'>This cycle is unavoidable. But good designers are aware of the changes that can prompt refactorings. Good designers also know class and object structures that can help avoid refactorings – their designs are robust in the face of requirement changes. A thorough requirements analysis will highlight those requirements that are likely to change during the life of the software, and a good design will be robust to them.</li ><li class='n_bulleted_list_item'>Our design patterns capture many of the structures that result from refactoring. Using these patterns early in the life of a design prevents later refactorings. But even if you don't see how to apply a pattern until after you've built your system, the pattern can still show you how to change it. Design patterns thus provide targets for your refactorings.</li ></ul><p class='n_paragraph'></p ></div></li ></ul><h3 class='n_heading_3'><b>UML notations</b></h3 ><ul><li class='n_bulleted_list_item'><b>Class diagram notations</b><div><ul><li class='n_bulleted_list_item'>Abstract and concrete classes</li ><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/3bc88fc3-f9e0-496a-9d0e-57762cfb58a7/Untitled.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20230118%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230118T213429Z&X-Amz-Expires=3600&X-Amz-Signature=f01e494eaeb136604cd0c03483d735f844449198eb1ae9543a2df2b8f2d2b301&X-Amz-SignedHeaders=host&x-id=GetObject'/><ul><li class='n_bulleted_list_item'>Participant vs implied Client class<div><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/3f7a899e-2b88-49be-9c81-59278e79796a/Untitled.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20230118%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230118T213429Z&X-Amz-Expires=3600&X-Amz-Signature=9695b51f617716120f42465e8eaab4518ce2cd90e910b5264c7d3ca0164ba78f&X-Amz-SignedHeaders=host&x-id=GetObject'/></div></li ><li class='n_bulleted_list_item'>Class relationships</li ><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/3688a306-f836-452f-a849-faf613d88dbb/Untitled.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20230118%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230118T213429Z&X-Amz-Expires=3600&X-Amz-Signature=aefbcfa54f8f063785020e384b47bcffe41df6da1ecef82ceb14c433a9829277&X-Amz-SignedHeaders=host&x-id=GetObject'/><p class='n_paragraph'></p ><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/7a9b8a59-26b7-4299-88af-d72c4a9c1a60/Untitled.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20230118%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230118T213429Z&X-Amz-Expires=3600&X-Amz-Signature=fc4b9e52ded0a8db77d1e975f8d6bd60bc6636e6940faab0ae759e20e5588bcb&X-Amz-SignedHeaders=host&x-id=GetObject'/><ul><li class='n_bulleted_list_item'>Pseudocode annotation<div><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/130f1ba4-b960-476a-903e-8b2ddd4c2834/Untitled.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20230118%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230118T213429Z&X-Amz-Expires=3600&X-Amz-Signature=18914a093528e687cedac3a74408891b0ea427b821617b42f8873822195facf8&X-Amz-SignedHeaders=host&x-id=GetObject'/></div></li ></ul></div></li ><li class='n_bulleted_list_item'><b>Object Diagram</b> <div><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/db5ab894-091c-4a06-8848-d01613c19336/Untitled.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20230118%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230118T213429Z&X-Amz-Expires=3600&X-Amz-Signature=f6416a04d501e763d269b5747ca7b6e3cae8bd8fec89e93d4236da247d4cb138&X-Amz-SignedHeaders=host&x-id=GetObject'/><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/c94bf3db-d3b8-45a4-8d25-4898a2e1e818/Untitled.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20230118%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230118T213429Z&X-Amz-Expires=3600&X-Amz-Signature=8553d0754f63e377ec07e6c07492a3cf01d785d488844759edad7fac4b08cc1d&X-Amz-SignedHeaders=host&x-id=GetObject'/></div></li ><li class='n_bulleted_list_item'><b>Interaction Diagram</b><div><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/4f2f6b12-64cd-4f69-878d-7e9bbad10bab/Untitled.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20230118%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230118T213430Z&X-Amz-Expires=3600&X-Amz-Signature=a7d26dfc8966ef98f1b54297a34efbf3b845402061b79ce4b2eb4ed1909b812a&X-Amz-SignedHeaders=host&x-id=GetObject'/><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/e3f7d8fe-304e-473d-b78b-3fb619421eb0/Untitled.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20230118%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230118T213430Z&X-Amz-Expires=3600&X-Amz-Signature=d8ee6d3afcfb34678aec829b88173a74cddeee440c7bfb01497d8f4697b6e1a3&X-Amz-SignedHeaders=host&x-id=GetObject'/><p class='n_paragraph'></p ></div></li ></ul></div></body></html>
|
source/Home Assistant Python Script to set an entity state.html
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<html><head><title> Home Assistant Python Script to set an entity state</title><meta name="Additional Keywords" content="Github"/>
|
| 2 |
+
<meta name="URL" content="https://github.com/xannor/hass_py_set_state"/>
|
| 3 |
+
<meta name="Source" content="internet"/>
|
| 4 |
+
<meta name="Created" content="2023-02-25T03:08:00.000Z"/>
|
| 5 |
+
<meta name="Already Read" content="false"/>
|
| 6 |
+
<meta name="Name" content=" Home Assistant Python Script to set an entity state"/>
|
| 7 |
+
<meta name="parent" content="References"/>
|
| 8 |
+
</head><body><H1> Home Assistant Python Script to set an entity state</H1><a href="https://www.notion.so/Home-Assistant-Python-Script-to-set-an-entity-state-627562a55308499cadddef18da343737">Link to original Notion Page</a></p><table border='1'><tr><td><b>Property</b></td><td><b>Value</b></td></tr><tr><td>Additional Keywords</td><td>Github</td></tr>
|
| 9 |
+
<tr><td>URL</td><td>https://github.com/xannor/hass_py_set_state</td></tr>
|
| 10 |
+
<tr><td>Source</td><td>internet</td></tr>
|
| 11 |
+
<tr><td>Created</td><td>2023-02-25T03:08:00.000Z</td></tr>
|
| 12 |
+
<tr><td>Already Read</td><td>false</td></tr>
|
| 13 |
+
<tr><td>Name</td><td> Home Assistant Python Script to set an entity state</td></tr>
|
| 14 |
+
<tr><td>parent</td><td>References</td></tr>
|
| 15 |
+
</table> <div><h1 class='n_heading_1'>Set State</h1 ><p class='n_paragraph'>Home Assistant Python Script to force set an entity state</p ><h2 class='n_heading_2'>How it works</h2 ><p class='n_paragraph'>This script adds a service that lets you update the state and/or attributes of any entity, similar to the developer tools</p ><p class='n_paragraph'>Requires <code>python_script:</code> to be enabled in you configuration</p ><h2 class='n_heading_2'>Installation</h2 ><h3 class='n_heading_3'>HACS</h3 ><p class='n_paragraph'>Requirements:</p ><ul><li class='n_bulleted_list_item'>HACS version 0.9 or higher</li ><li class='n_bulleted_list_item'>Enabled <code>python_scripts:</code> in your Home Assistant configuration</li ><li class='n_bulleted_list_item'>Enabled <code>python_scripts</code> as option, in the HACS configuration. (If you missed this, kindly read below!)</li ></ul><p class='n_paragraph'>You are only able to use this custom repo with HACS, if Python Scripts is enabled in Home Assistant. Also, "python_scripts" should have been enabled during the HACS setup through "Integrations" in Home Assistant.</p ><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/010abb0c-125f-47c8-9b12-6b092c16cdd8/68747470733a2f2f692e696d6775722e636f6d2f494741344c567a2e706e67?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20230225%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230225T213404Z&X-Amz-Expires=3600&X-Amz-Signature=f27f63efb9b30f17b2250f7e8229d235a803a91e9df8ca290dff50330e9ebb01&X-Amz-SignedHeaders=host&x-id=GetObject'/><p class='n_paragraph'>If you missed that part, you need to remove HACS, and add it again, in order to find the "Python Script" category! This time, remember to set a checkmark in "Enable python_scripts discovery & tracking":</p ><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/5de3240b-8bbb-4579-93ab-e5fdec5a0431/68747470733a2f2f692e696d6775722e636f6d2f626a445577447a2e706e67?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20230225%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230225T213404Z&X-Amz-Expires=3600&X-Amz-Signature=8996bb479c10d4e5508938a385d517cbd72d881f093c1dddcf9a2895ff19b5cf&X-Amz-SignedHeaders=host&x-id=GetObject'/><p class='n_paragraph'>Find more information about the HACS configuration <a href='https://hacs.xyz/docs/configuration/basic#changing-the-configuration'>here</a> and <a href='https://hacs.xyz/docs/categories/python_scripts'>here</a>. If you used the YAML-way to configure HACS, it's a bit easier. Just edit the YAML configuration for HACS. That parts is also mentioned <a href='https://github.com/xannor/hass_py_set_state/blob/master/here'>https://hacs.xyz/docs/categories/python_scripts#enable-if-you-used-yaml-to-configure-hacs</a>.</p ><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/fd06b67f-a514-4975-9283-088e6b225bc3/68747470733a2f2f692e696d6775722e636f6d2f6f64505639386a2e706e67?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20230225%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230225T213404Z&X-Amz-Expires=3600&X-Amz-Signature=f3f99ff8e00f22cc64e1cb4594494b8549880c01388b0156ded2e67f3892d4f5&X-Amz-SignedHeaders=host&x-id=GetObject'/><h3 class='n_heading_3'>Manual</h3 ><p class='n_paragraph'>Copy the Python script in to your <code>/config/python_scripts</code> directory.</p ><h2 class='n_heading_2'>Service arguments</h2 ><h2 class='n_heading_2'>Usage</h2 ><p class='n_paragraph'>Each call requires at least an entity_id and a state or attributes (otherwise it wont do anything)</p ><p class='n_paragraph'>example:</p ><pre>entity_id: sensor.random_sensor
|
| 16 |
+
state: 0
|
| 17 |
+
allow_create: true
|
| 18 |
+
</pre><p class='n_paragraph'>(Thanks to <a href='https://community.home-assistant.io/u/rodpayne'>@rodpayne</a> for the initial script: (<a href='https://community.home-assistant.io/t/how-to-manually-set-state-value-of-sensor/43975'>https://community.home-assistant.io/t/how-to-manually-set-state-value-of-sensor/43975</a>)</p ><p class='n_paragraph'>I'm not that used to HACS, but i spotted <a href='https://github.com/xannor/hass_py_set_state/issues/1'>#1</a> - so i guess it's better with more details about HACS here.</p ><p class='n_paragraph'>It would be even better to ask the HACS team to add a disclaimer on the "hacs/settings" page, about missing categories. I guess most users just started using HACS, would like that. But i don't have the time to do that, right now.</p ><p class='n_paragraph'>Thanks for making the scrip ready for HACS, btw :-)</p ></div></body></html>
|
source/Lucene and Solr Reference - FactorPad.html
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<html><head><title> Lucene and Solr Reference - FactorPad</title><meta name="URL" content="https://factorpad.com/tech/solr/reference/solr-reference.html"/>
|
| 2 |
+
<meta name="Source" content="internet"/>
|
| 3 |
+
<meta name="Created" content="2022-03-23T16:59:00.000Z"/>
|
| 4 |
+
<meta name="Already Read" content="false"/>
|
| 5 |
+
<meta name="Name" content=" Lucene and Solr Reference - FactorPad"/>
|
| 6 |
+
<meta name="parent" content="References"/>
|
| 7 |
+
</head><body><H1> Lucene and Solr Reference - FactorPad</H1><a href="https://www.notion.so/Lucene-and-Solr-Reference-FactorPad-56bfabc0999d4a16b4f1d6a2f4c3c4b0">Link to original Notion Page</a></p><table border='1'><tr><td><b>Property</b></td><td><b>Value</b></td></tr><tr><td>URL</td><td>https://factorpad.com/tech/solr/reference/solr-reference.html</td></tr>
|
| 8 |
+
<tr><td>Source</td><td>internet</td></tr>
|
| 9 |
+
<tr><td>Created</td><td>2022-03-23T16:59:00.000Z</td></tr>
|
| 10 |
+
<tr><td>Already Read</td><td>false</td></tr>
|
| 11 |
+
<tr><td>Name</td><td> Lucene and Solr Reference - FactorPad</td></tr>
|
| 12 |
+
<tr><td>parent</td><td>References</td></tr>
|
| 13 |
+
</table> <div><p class='n_paragraph'>This page outlines our Apache Solr and Lucene reference material by command and topic to help you learn text analysis and search faster.</p ><ol><li class='n_numbered_list_item'><b>Outline</b> - Review the outline of our Solr reference below starting with the command line scripts.</li ><li class='n_numbered_list_item'><b>Take on a project</b> - Install Solr on a local server as we do here, or fire up a server on a cloud hosting platform.</li ><li class='n_numbered_list_item'><b>Reference</b> - Return here for examples and syntax for the command line scripts and configuration files.</li ><li class='n_numbered_list_item'><b>Test environment</b> - Start with a test environment and explore whether Apache Solr suits your enterprise search or custom website search needs.</li ><li class='n_numbered_list_item'><b>Production environment</b> - Plan your approach as you build towards a production environment.</li ></ol><p class='n_paragraph'>Here we focus on the command line using a Linux-based operating system, however many of the same commands work for macOS. There are slight differences for Windows.</p ><h2 class='n_heading_2'>Outline and Guide to our Apache Solr Reference</h2 ><p class='n_paragraph'>Beginner</p ><p class='n_paragraph'>Currently we offer the following sections, and will add to it over time.</p ><ol><li class='n_numbered_list_item'>Administration Using the Solr Script</li ><li class='n_numbered_list_item'>Creating Indexes Using the Solr Post Script</li ><li class='n_numbered_list_item'>Listing of Solr Fields and Field Types</li ><li class='n_numbered_list_item'>Analyzers, Tokenizers and Filters</li ><li class='n_numbered_list_item'>Solr schema.xml and solrconfig.xml Customizations</li ></ol><p class='n_paragraph'>If a more linear approach better suits you, tutorials can be accessed from our <a href='https://www.youtube.com/playlist?list=PL6YwPExkSESo9FfA2msf2Wi9FC-0-JQRz'>Apache Solr Search Tutorials</a> on YouTube and all code examples are provided in text on this website at <a href='https://factorpad.com/tech/solr/tutorial/index.html'>Solr Tutorial</a>.</p ><h3 class='n_heading_3'>Apache Solr Search Reference Outline</h3 ><p class='n_paragraph'>Below is a list of commands, tools, settings and terms used with Apache Solr for setting up website search and enterprise search. In general, this text analysis reference is for Solr Version 7.</p ><p class='n_paragraph'>Optimized for html5, web pages open in the current browser window.</p ><h3 class='n_heading_3'>1. Administration Using the Solr Script</h3 ><p class='n_paragraph'>The Solr script is used to manage Solr cores and collections from the command line. It is also used to start and stop Solr instances. In SolrCloud mode is can be used to set up shards and replicas and link to Apache ZooKeeper to manage search in a distributed environment.</p ><h3 class='n_heading_3'>Finding help</h3 ><p class='n_paragraph'>Help and syntax for the commands within the Solr script can be found using either <code>help</code> generally or with <code>-help</code> for each command.</p ><h3 class='n_heading_3'>Commands within the bin/solr script</h3 ><p class='n_paragraph'>The solr script has 12 commands entered at the command line. It is accessed using <code>~/$SOLR_HOME/bin/solr</code> where <b>$SOLR_HOME</b> is the directory where Solr was installed. In the case of Solr 7, the whole path would be <code>~/solr-7.0.0/bin/solr</code>.</p ><h3 class='n_heading_3'>2. Creating Indexes With the Solr Post Script</h3 ><p class='n_paragraph'>The solr post script is used to post or put documents into a core or collection. It is also located in the <code>~/solr-7.0.0/bin</code> directory in a test environment.</p ><h3 class='n_heading_3'>3. Solr Fields and Field Types</h3 ><p class='n_paragraph'>As you head towards building a Solr search application in production you will need to become intimately familiar with Solr Fields, Types, Classes and Properties.</p ><h3 class='n_heading_3'>4. Analyzers, Tokenizers and Filters</h3 ><p class='n_paragraph'>The Solr schema (<code>managed-schema</code> or <code>schema.xml</code>) is used for both indexing and at a query time to analyze incoming streams of text. The field analysis process is broken into 3 steps: analyzers, tokenizers and filters.</p ><h3 class='n_heading_3'>5. Solr schema.xml and solrconfig.xml Customizations</h3 ><p class='n_paragraph'>Customized index structures and search applications require modifications to the <code>schema.xml</code> and <code>solrconfig.xml</code>. Importing data to the customized structures and parsing documents is an important step in building the customized index as you move beyond the "Schemless" configruation.</p ><h2 class='n_heading_2'>Other Apache Solr and Lucene Content</h2 ><ul><li class='n_bulleted_list_item'><a href='https://factorpad.com/tech/solr/tutorial/index.html'>Apache Solr Tutorial</a></li ></ul><h2 class='n_heading_2'>Questions and Answers</h2 ><p class='n_paragraph'><b>Q: </b> How often do we post new Solr content?<b>A: </b> As with everything here new content depends on demand and whether we are working on projects for clients. If you want something pushed to the front of the queue let us know. Engage with us on YouTube or elsewhere on social media. Let us know what you want more of.</p ><h2 class='n_heading_2'>What's Next?</h2 ><p class='n_paragraph'>Consider subscribing to our YouTube Channel here, for more free learning about Apache Solr and Apache Lucene.</p ><ul><li class='n_bulleted_list_item'>This is the Outline, so the Outline button is disabled.</li ><li class='n_bulleted_list_item'>To learn more about the Solr Reference, click Back.</li ><li class='n_bulleted_list_item'>Please consider helping to defray costs of making this content freely accessible, click Tip.</li ><li class='n_bulleted_list_item'>To dive in and learn about Solr help, click Next.</li ></ul><p class='n_paragraph'>solr examples</p ><p class='n_paragraph'>apache solr</p ><p class='n_paragraph'>solr search</p ><p class='n_paragraph'>website search</p ><p class='n_paragraph'>enterprise search</p ><p class='n_paragraph'>apache lucene</p ><p class='n_paragraph'>apache solr search</p ><p class='n_paragraph'>solr examples</p ><p class='n_paragraph'>text analytics</p ><p class='n_paragraph'>solr commands</p ><p class='n_paragraph'>solr syntax</p ><p class='n_paragraph'>solr help</p ><p class='n_paragraph'>solr wiki</p ><p class='n_paragraph'>solr settings</p ><p class='n_paragraph'>solrcloud</p ><p class='n_paragraph'>solr configuration</p ></div></body></html>
|
source/[Solved] Emergency Mode Due to Bad fstab in Raspberry Pi.html
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<html><head><title>[Solved] Emergency Mode Due to Bad fstab in Raspberry Pi</title><meta name="URL" content="https://www.clarkle.com/notes/emergecy-mode-bad-fstab/#:~:text=To%20do%20that%2C%20enter%20mount,will%20panic%2C%20but%20it's%20fine."/>
|
| 2 |
+
<meta name="Source" content="internet"/>
|
| 3 |
+
<meta name="Category" content="interest"/>
|
| 4 |
+
<meta name="Created" content="2023-05-09T15:18:00.000Z"/>
|
| 5 |
+
<meta name="Already Read" content="false"/>
|
| 6 |
+
<meta name="Name" content="[Solved] Emergency Mode Due to Bad fstab in Raspberry Pi"/>
|
| 7 |
+
<meta name="parent" content="References"/>
|
| 8 |
+
</head><body><H1>[Solved] Emergency Mode Due to Bad fstab in Raspberry Pi</H1><a href="https://www.notion.so/Solved-Emergency-Mode-Due-to-Bad-fstab-in-Raspberry-Pi-9b04ea5d88ae420bbf2331245d81edd4">Link to original Notion Page</a></p><table border='1'><tr><td><b>Property</b></td><td><b>Value</b></td></tr><tr><td>URL</td><td>https://www.clarkle.com/notes/emergecy-mode-bad-fstab/#:~:text=To%20do%20that%2C%20enter%20mount,will%20panic%2C%20but%20it's%20fine.</td></tr>
|
| 9 |
+
<tr><td>Source</td><td>internet</td></tr>
|
| 10 |
+
<tr><td>Category</td><td>interest</td></tr>
|
| 11 |
+
<tr><td>Created</td><td>2023-05-09T15:18:00.000Z</td></tr>
|
| 12 |
+
<tr><td>Already Read</td><td>false</td></tr>
|
| 13 |
+
<tr><td>Name</td><td>[Solved] Emergency Mode Due to Bad fstab in Raspberry Pi</td></tr>
|
| 14 |
+
<tr><td>parent</td><td>References</td></tr>
|
| 15 |
+
</table> <div><p class='n_paragraph'>You can automatically mount a drive on your Raspberry Pi by editing your fstab file. <a href='https://community.linuxmint.com/tutorial/view/1513'>Learn how to automatically mount a drive on your Raspberry Pi here</a>.</p ><p class='n_paragraph'>But if you’re like me, editing fstab rarely works right the first time. This typically results in your system crashing on startup with a message saying that your Raspberry Pi has gone into “Emergency Mode”. You fix this by removing (or editing) the new line from your fstab file. But how do you do that if your system won’t start up?</p ><p class='n_paragraph'><b>Here’s how to get your Raspberry Pi out of Emergency Mode, and booting again:</b></p ><ul><li class='n_bulleted_list_item'>Take your SD card out of your Pi and mount it on another computer.</li ><li class='n_bulleted_list_item'>Open the boot partition, and the file <b>cmdline.txt</b></li ><li class='n_bulleted_list_item'>Add <b>init=/bin/sh</b> to the end of the line and save the file</li ><li class='n_bulleted_list_item'>Unmount, place back into your Pi, and power up your Pi. Your Pi will boot into a minimum shell environment as root.</li ><li class='n_bulleted_list_item'>At this point, you need to mount the actual filesystem, but without loading fstab. To do that, enter <b>mount -o remount,rw / –target /</b> and hit enter</li ><li class='n_bulleted_list_item'>Now, edit your fstab file by entering <b>vi /etc/fstab</b> and hitting enter</li ><li class='n_bulleted_list_item'>After you’ve made your edits, exit the file, then at the command line, type exit. The system will panic, but it’s fine.</li ><li class='n_bulleted_list_item'>Remove the SD card from your Pi and put it back into the other computer.</li ><li class='n_bulleted_list_item'>Open the boot partition, and the file <b>cmdline.txt</b></li ><li class='n_bulleted_list_item'>Remove <b>init=/bin/sh</b> from the end of the line and save the file</li ><li class='n_bulleted_list_item'>Unmount the SD card, place it back into your Pi, and power up your Pi. You should be good to go now.</li ></ul><p class='n_paragraph'>Alternatively, throw your Pi away and just grab a new <a href='https://amzn.to/2pEczUw'>Raspberry Pi 3 from Amazon</a>.</p ></div></body></html>
|
source/__init__ vs __new__ and When to Use Them.html
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<html><head><title>__init__ vs __new__ and When to Use Them</title><meta name="URL" content="https://santoshk.dev/posts/2022/__init__-vs-__new__-and-when-to-use-them/"/>
|
| 2 |
+
<meta name="Source" content="internet"/>
|
| 3 |
+
<meta name="Category" content="reference"/>
|
| 4 |
+
<meta name="Created" content="2023-05-22T14:49:00.000Z"/>
|
| 5 |
+
<meta name="Already Read" content="false"/>
|
| 6 |
+
<meta name="Name" content="__init__ vs __new__ and When to Use Them"/>
|
| 7 |
+
<meta name="parent" content="References"/>
|
| 8 |
+
</head><body><H1>__init__ vs __new__ and When to Use Them</H1><a href="https://www.notion.so/__init__-vs-__new__-and-When-to-Use-Them-d6504fb2009b4dc798fb31419fa79e6c">Link to original Notion Page</a></p><table border='1'><tr><td><b>Property</b></td><td><b>Value</b></td></tr><tr><td>URL</td><td>https://santoshk.dev/posts/2022/__init__-vs-__new__-and-when-to-use-them/</td></tr>
|
| 9 |
+
<tr><td>Source</td><td>internet</td></tr>
|
| 10 |
+
<tr><td>Category</td><td>reference</td></tr>
|
| 11 |
+
<tr><td>Created</td><td>2023-05-22T14:49:00.000Z</td></tr>
|
| 12 |
+
<tr><td>Already Read</td><td>false</td></tr>
|
| 13 |
+
<tr><td>Name</td><td>__init__ vs __new__ and When to Use Them</td></tr>
|
| 14 |
+
<tr><td>parent</td><td>References</td></tr>
|
| 15 |
+
</table> <div><img src='https://s3.us-west-2.amazonaws.com/secure.notion-static.com/07cf841c-f091-414d-b681-26e19168c1d8/__new__vs__init__.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAT73L2G45EIPT3X45%2F20230522%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20230522T213331Z&X-Amz-Expires=3600&X-Amz-Signature=8c36c5751549d791e4049ccd23d77a20bd034d1e6aabf2b84007719e279289a9&X-Amz-SignedHeaders=host&x-id=GetObject'/><h2 class='n_heading_2'>Introduction</h2 ><p class='n_paragraph'>I recently got asked to me what did <code>__init__</code> dunder method did in Python. And I was like, “it is used to initialize variables inside a class”. And just after that, the follow-up question was, “then what is <code>__new__</code> used for. And I was completely blank and was not able to answer that.</p ><p class='n_paragraph'>I was not able to answer that question because there are not many tutorials out there that talk about <code>__new__</code>. I didn’t want to happen this with you. And that is why I came up with this blog post for you.</p ><h2 class='n_heading_2'>Similarities</h2 ><p class='n_paragraph'>Let’s start with similarities.</p ><ul><li class='n_bulleted_list_item'>Both of them are called/invoked during the creation of the instance.</li ></ul><h2 class='n_heading_2'>Differences</h2 ><p class='n_paragraph'>Let’s start with differences.</p ><p class='n_paragraph'>Talking about the first point. <code>__new__</code> is called when the instance is first created. This happens before the initialization of the class.</p ><p class='n_paragraph'>By the way, did you note that the first argument to <code>__init__</code> is always <code>self</code>? This self is the instance of the class. <code>self</code> is what <code>__new__</code> returns.</p ><p class='n_paragraph'>Coming to the third point, <code>__new__</code> is supposed to return an instance of the class. Note that if <code>__new__</code> does not returns anything, <code>__init__</code> is not called.</p ><h2 class='n_heading_2'>Which one of them is a constructor?</h2 ><p class='n_paragraph'>If you are coming from another language, you might be surprised that there are two similar things doing the same kind of work. Most languages you might have worked with would have something called a constructor.</p ><p class='n_paragraph'>In Python, that concept is broken down into <b>constructor</b> and <b>initializer</b>. And you might have guessed, <code>__new__</code> is the constructor and <code>__init__</code> is the initializer.</p ><p class='n_paragraph'>Please note that <code>__new__</code> is implicit. Meaning that if you don’t actually need to modify the creation of an instance of the class, you don’t need to have a <code>new</code> method.</p ><p class='n_paragraph'>One more thing I’d like to add is… instance variables are local to an instance. So anything you are doing in init is local to that instance only. But anything you are doing in new will be affecting anything created for that type.</p ><h2 class='n_heading_2'>Execution flow with an example</h2 ><p class='n_paragraph'>I am going to add some code to make this more engaging. Consider this example:</p ><p class='n_paragraph'>This is the simplest example of both <code>__new__</code> and <code>__init__</code> in action. If you save the above code in a file and run it, you’d see something like this:</p ><pre>$ python3 in_it.py
|
| 16 |
+
__new__ called
|
| 17 |
+
__init__ called
|
| 18 |
+
</pre><p class='n_paragraph'>As you can see, the new method is called first and then execution is passed to the init method.</p ><h2 class='n_heading_2'>Use Cases</h2 ><h3 class='n_heading_3'>Use case for <code>__new__</code></h3 ><p class='n_paragraph'>One of the best use cases I can take an example of is when creating a Singleton. As we know, Singleton ensures a class only has one instance and provides a global point of access to it.</p ><p class='n_paragraph'>Some of the places I have seen singleton in action are in game programming where there is only one instance of the player. Another place, if you have used frontend libraries like Vuex (or Redux), there is only one global instance of the store. Doesn’t matter how many instances you create, you’ll end up having only one.</p ><p class='n_paragraph'>Let’s see how to achieve similar behavior in Python:</p ><p class='n_paragraph'>Output:</p ><pre>$ python3 singleton.py
|
| 19 |
+
creating...
|
| 20 |
+
<__main__.Singleton object at 0x7f943301d350>
|
| 21 |
+
<__main__.Singleton object at 0x7f943301d350>
|
| 22 |
+
</pre><p class='n_paragraph'>As you can see, <b>creating…</b> is printed only once. they both point to the same memory location. In my case, it’s <code>0x7f943301d350</code>.</p ><p class='n_paragraph'>You might be guessing that can’t we do the same thing with <code>__init__</code>? No! That’s because <code>__init__</code> does not return anything. We’ll see in the next section what <code>__init__</code> is well suited for.</p ><p class='n_paragraph'>But first, I wanted to show you another use case of new.</p ><p class='n_paragraph'>Output:</p ><pre>$ python3 newexample.py
|
| 23 |
+
Initializing 4-legged animal
|
| 24 |
+
Initializing 2-legged animal
|
| 25 |
+
</pre><p class='n_paragraph'>I am by no means a zoologist. But you get my point here. You can use <code>__new__</code> to conditionally create an instance from a class.</p ><h3 class='n_heading_3'>Use case for <code>__init__</code></h3 ><p class='n_paragraph'>As we have already seen previously. <code>init</code> is there to initialize an instance variable. These instance variables can later be used in different methods of the instance.</p ><p class='n_paragraph'>I have extensively used <code>__init__</code> when I used to work with <a href='https://www.qt.io/'>Qt framework</a>. Qt is a framework for desktop-based UI development. When initializing UI objects, you can set how wide or long the window could be. You can also read preferences from a file and apply that during the initialization phase of an application. Setting the window title could be another example.</p ><p class='n_paragraph'>Here I’ll demonstrate one such example:</p ><p class='n_paragraph'>The above example is by no means a complete example, but when set up correctly, it will show a window similar to this.</p ><p class='n_paragraph'>Sample PySide window</p ><h2 class='n_heading_2'>Key Takeaways</h2 ><ul><li class='n_bulleted_list_item'>In most cases, you don’t need</li ><li class='n_bulleted_list_item'><code>__new__</code> is called before <code>__init__</code>.</li ><li class='n_bulleted_list_item'><code>__new__</code> returns a instance of class.</li ><li class='n_bulleted_list_item'><code>__init__</code> receives the instances of the class returned by <code>__new__</code>.</li ><li class='n_bulleted_list_item'>Use <code>__init__</code> to initilize value.</li ></ul><p class='n_paragraph'>The same concept can be used to answer the question of abstraction vs encapsulation.</p ><h2 class='n_heading_2'>Conclusion</h2 ><p class='n_paragraph'>That is all I know about <code>__init__</code> vs <code>__new__</code>. If you have something in your mind that I missed. Please let me know.</p ><p class='n_paragraph'>I’ll also list some references I look to write this blog post so that you can really the real source of information.</p ></div></body></html>
|