The unicode-range CSS descriptor sets the specific range of characters to be used from a font defined by @font-face and made available for use on the current page. If the page doesn’t use any character in this range, the font is not downloaded; if it uses at least one, the whole font is downloaded.
In Emacs, the fill-paragraph function neatly reflows a block of text, wrapping lines to fit within a specified column width. VS Code offers an extension called “Rewrap,” which you can install to enjoy similar functionality.
Selecting the text you want to rewrap and pressing Alt+Q, or
Placing your cursor within a comment block and pressing Alt+Q to rewrap that comment.
This feature can increase your productivity significantly if you’re editing or writing a considerable amount of text. It streamlines the process of formatting paragraphs, ensuring that they look neat and are easier to read, very much like Emacs’ fill-paragraph.
I recently ventured into deploying a service on Google Cloud Run. My goal was straightforward: create a service that fetches webpage titles and captures screenshots of URLs. However, the journey led me into a peculiar bug when I actually used it on Goole Cloud Run.
The Bug
During the development phase, I worked with a python:3.11-slim base image on macOS, and my Dockerfile functioned without a hitch. Here’s a snapshot of the Dockerfile I used:
Yet, upon deploying to Google Cloud Run and initiating the screenshot capture process, I hit a snag:
playwright._impl._api_types.Error: Executable doesn't exist at /home/.cache/ms-playwright/chromium-1084/chrome-linux/chrome
╔═════════════════════════════
║ Looks like Playwright was just installed or updated.
║ Please run the following command to download new browsers:
║
║ playwright install
║
║ <3 Playwright Team
╚═════════════════════════════
Official Playwright Docker Image Saves the Day
Rather than wrestle with the error, I pivoted to an official Docker image of Playwright, and skipped installation of dependency:
The playwright 1.39.0 requires slightly more than 512MB of memory to run on Google Cloud Run. Adjust the memory limit on GCR, as it’s 512 MB by default.
Conclusion
Use the official Docker image to save time, or specify the PLAYWRIGHT_BROWSERS_PATH environment variable on a supported linux docker image.
This tool
Eruda: Console for Mobile Browsers
is handy for examining HTML elements on mobile devices without any installation. Simply copy and paste the code below into the address bar, an icon will show up on the screen.
a-shell notably supports Python, which is relevant given Python’s ongoing discussions about adding Tier 3 support for the iOS platform in version 3.13.
PEP 730
.
The focus is on “embedded mode”, since there are no stdout on iOS and you can’t provide things like the Python REPL
When using the a-shell action in iOS Shortcuts to execute shell commands or Python scripts, it is often necessary to wait for the execution to finish before continuing to execute other actions.
This can be achieved by using the open shortcuts:// command as the last step in the a-shell action and adding a Wait for Return action afterwards. This combination allows for waiting until a-shell finishes executing a long-running process before proceeding with other actions.
how to fully reset safari on your mac
for some unknown reason, the Safari option Show Develop menu in menu bar is grayed out and i am unable to click it. Reset the safari according to this article help me solve the issue.
I use this prompt to study German. Whenever I encounter a new German word, I ask ChatGPT to explain it to me. This prompt works particularly well with GPT-4.
When I enter a German word, your task is to provide a comprehensive analysis of that word. The analysis includes the following segments:
1. Meaning and Usage: Explanation of the word's meaning and common usage scenarios.
2. Linguistic Analysis: Analysis of the word's structure including any prefix, root, and suffix, and its etymology if applicable.
3. Comparisons between German and English: Highlighting any similarities or differences between the German word and its English counterpart.
4. Cultural Context: Any pertinent cultural context related to the word, if applicable.
5. Example Sentences: Providing sentences to illustrate the word's usage.
6. Memory Tips: Suggestions for remembering the word's meaning and usage.
7. Additional Vocabulary: Providing related words, synonyms, or antonyms to broaden vocabulary knowledge.
8. Gender and Plural (for nouns): Indicating the gender of the noun and its plural form, if applicable.
9. Conjugation (for verbs): Present tense conjugation, if applicable.
Refer to this format to provide a thorough understanding of the inquired German word, aiding in learning and retention of the word and related vocabulary.
Here is an example.
Input: Anzeige
The German noun "Anzeige" translates to "advertisement," "display," or "notification" in English, depending on the context. It's often used to refer to advertising materials, displays on devices, or formal notifications, such as reporting a crime. Here’s a detailed analysis of the word:
### 1. **Meaning and Usage:**
- **Advertisement:** "Anzeige" can refer to an advertisement in a newspaper, magazine, or online platform.
- **Display:** It can also denote a display on devices such as computers, phones, or other electronic gadgets.
- **Notification/Report:** In a legal or formal context, "Anzeige" can refer to a notification or a report, often related to reporting incidents to authorities.
### 2. **Linguistic Analysis:**
- Compound Word: "Anzeige" is derived from "anzeigen," a verb which means "to display," "to indicate," or "to report."
### 3. **Gender:**
- "Anzeige" is a feminine noun, thus it is "die Anzeige."
### 4. **Comparisons between German and English:**
- The multiple meanings of "Anzeige" in German align with various English terms such as "advertisement," "display," and "notification" based on context.
### 5. **Cultural Context:**
- "Anzeige" is a common term used in various contexts in German-speaking countries, whether it's in advertising, technology, or legal realms.
### 6. **Example Sentences:**
- Ich habe eine Anzeige in der Zeitung geschaltet. (I placed an advertisement in the newspaper.)
- Die Anzeige des Telefons zeigt einen niedrigen Batteriestand. (The display of the phone shows a low battery level.)
- Er hat eine Anzeige gegen den Dieb erstattet. (He filed a report against the thief.)
### 7. **Memory Tips:**
- Associating "Anzeige" with visuals or formal notifications can help in remembering its various meanings.
- Relating "Anzeige" to its verb form "anzeigen" (to display, to indicate, to report) can also serve as a mnemonic aid.
### 8. **Additional Vocabulary:**
- Die Werbung (the advertising, feminine): A general term for advertising.
- Der Bildschirm (the screen, masculine): Referring to the display screen of electronic devices.
- Die Meldung (the report, notification, feminine): A term often used for notifications or reports.
This analysis should provide a thorough understanding of "Anzeige" and its usage in German. If there are any further inquiries or if you need more examples, feel free to ask!
In a Django application deployed with gunicorn, it is important to optimize the handling of database connections to improve performance and efficiency. This post explores the behavior of gunicorn in relation to database connections and provides insights on how to reuse connections effectively.
Django + Gunicorn
Improtant note about Django ORM is that Django ORM does not have a build-int database connection pool like SQLAlchemy. The lifetime of the persistant connections are controlled by the
CONN_MAX_AGE, the default value is 0.
The Sync Worker Class
In the case where CONN_MAX_AGE is set to 0, a new database connection is created for every HTTP request and closed at the end of each request. This can potentially lead to increased overhead due to the constant creation and closure of connections.
However, if CONN_MAX_AGE is set to a value greater than 0, the database connection is not closed immediately after the request is finished. In gunicorn’s sync worker class, which is process-based with a fixed number of processes, subsequent requests will be processed by the same processes, keeping the number of database connections stable.
The Async Worker Class: eventlet and gevent
For the default case where CONN_MAX_AGE is 0, there are no issues as connections are closed at the end of each request.
However, if CONN_MAX_AGE is not 0, problems can arise. In gunicorn’s async worker class, such as eventlet and gevent, each new HTTP request creates a new greenlet thread to handle it. Each thread maintains its own connection, leading to an accumulation of database connections over time.
To tackle this issue, the official gunicorn documentation recommends using the gevent worker and activating greenlet support for Psycopg2 when connecting to PostgreSQL. This can be achieved using the
psycogreen
library.
References
For more information, refer to the following resources: