teleren/devto huggingface dataset:
Timezones
Published: 2023-07-24 05:25:21




```
In Relate we saved CST to DB and converted back to UTC to display in UI

but it is better to store in UTC and add UTC Offset based on timezone.
```



The main difference between UTC (Coordinated Universal Time) and CST (Central Standard Time) lies in their time offsets and geographical regions of use.

1. UTC (Coordinated Universal Time):
   - UTC is a time standard that serves as the basis for timekeeping worldwide.
   - It is not tied to any specific location on Earth and is used as a reference for time in various regions.
   - UTC is the primary time standard by which all other time zones are defined.
   - It does not observe daylight saving time, so it remains constant throughout the year.
   - The offset for UTC is +00:00, meaning it is the same as Greenwich Mean Time (GMT).

2. CST (Central Standard Time):
   - CST is a time zone observed in certain regions, particularly in North America and Central America.
   - It is 6 hours behind UTC during standard time (UTC-6).
   - CST is typically used in locations like Central United States (e.g., Texas, Kansas, Illinois) and Central America (e.g., Mexico City, Guatemala City).
   - During daylight saving time, some regions in CST switch to Central Daylight Time (CDT), which is UTC-5.

In summary, UTC is a global time standard used as a reference for timekeeping, while CST is a specific time zone observed in regions such as North America and Central America. The main difference is the time offset, with CST being either UTC-6 or UTC-5 during daylight saving time.
Mastering Software Architecture: A Comprehensive Guide to Design, Deployment, and Scaling
Tags: softwareengineering, architecture, management, webdev
Published: 2023-07-24 05:05:32

Software architecture is a critical aspect of any software development project that involves planning and designing a high-level view of the system's components and their interactions. The scope of the project should be defined by analyzing the requirements, selecting the language and database, and identifying design principles and patterns.

Once the development phase is complete, it's time to move on to the production scope, which involves setting up the infrastructure, deployment, scaling, security, and monitoring of the system.
Infrastructure can be managed via VPS or cloud, while deployment can be done using continuous integration (CI) and continuous deployment (CD) tools. Scaling can be achieved via horizontal or vertical scaling, and load balancing. Security measures include OAuth, JWT, session management, and authentication services like Auth0, Okta, Cognito, or AD. Monitoring tools like Azure AppInsight, AWS Cloudwatch, Datadog, and ELK can help track system performance and identify issues.

To ensure successful implementation, it's crucial to consider the project's budget, time frame, and develop a solid plan. Testing strategies like unit, load, and security testing should be employed to ensure the system functions correctly. Choosing the right architecture, like Monolith, Microservices, Micro Frontend, Serverless, or Domain Drive, can also make a significant difference in the system's scalability and maintainability.

In summary, software architecture is essential for any software development project, and careful consideration should be given to the project scope, budget, time, and plan, along with the selection of appropriate design principles, patterns, and architecture. The production scope should involve setting up infrastructure, deployment, scaling, security, and monitoring, with a focus on selecting the right tools and testing strategies to ensure the system's success.
How an innocuous oversight (silently) bricked my game
Tags: javascript, webdev, canvas
Published: 2023-07-24 04:58:11

TLDR; if you use `ctx.save()`, remember to restore!

It all started on a typical day, tucked away in the dark cave that is my abode. Developing my next project with JS & canvas, I came across an unusual issue that would only appear after some time. 

My rendering logic, typically rendering on-demand at 60fps, crept to a halt. _But why, poor V8, are you experiencing such trauma?_ V8 was a such good engine for so long, and I've created many canvas apps and never experienced this.

Despite showcasing it's stress, V8 was compliant with providing very capable performance debugging tools and eventually showed me the whey. What I saw, friends, was this very ominous debug profile:

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6isbotv41fj7v0j1enlg.png)

That save call? Fine. Lack of a `ctx.restore()` after it? Huge mistake! Without digging into documentation, I can only assume that V8 accumulates a stack of save states for `CanvasRenderingContext2D` that are only released once restored, or until a certain threshold is met. 

Lesson learnt!
Convert HTML to PDF in Python: Step-by-Step Guide
Tags: python, html, beginners, webdev
Published: 2023-07-24 04:13:07

In today's digital age, I find myself often needing to convert HTML content into PDF format. Whether it's for generating reports, archiving web content, or creating printable documents, the ability to transform HTML into a PDF file has become a valuable skill in my programming toolkit.

Thankfully, Python provides powerful libraries that simplify this task, making it accessible to programmers of all levels, including beginners like me. In this article, I will guide you through the process of converting HTML to PDF using Python, enabling you to effortlessly generate professional-looking PDF documents from HTML content.

By leveraging Python libraries such as pdfkit and wkhtmltopdf, I discovered that I can harness the capabilities of the underlying command-line tool, wkhtmltopdf, while benefiting from the simplicity and flexibility of Python code.

I will walk you through the installation and configuration of these libraries, ensuring that we have everything set up correctly.

Once our environment is prepared, we will dive into the actual conversion process, where I'll show you how to load HTML files or HTML content and transform them into beautiful PDF documents.

But our journey doesn't stop there. We will also explore various customization options, allowing you to tailor the PDF conversion to suit your specific needs.

You will learn how to adjust page size, margins, headers, and footers, as well as incorporate CSS stylesheets and external assets for enhanced PDF rendering.

I will equip you with the knowledge to handle images and external resources seamlessly, ensuring that your PDFs accurately reflect the original HTML content.

As with any programming endeavor, I know that troubleshooting is an inevitable part of the process. Rest assured, I will address potential challenges that you may encounter during the conversion, such as font issues or rendering discrepancies, and provide practical tips and solutions to help you overcome them.

Additionally, I will point you toward additional resources for delving into advanced topics and further expanding your skills.

By the end of this article, I am confident that you will possess the necessary knowledge and tools to convert HTML to PDF effortlessly using Python.

This newfound capability will empower you to automate document generation, enhance your applications, and unleash your creativity in producing visually appealing and professional PDF documents.

So, let's embark on this journey together and unlock the potential of HTML to PDF conversion in Python.
Third day writing code
Published: 2023-07-23 21:04:27

Hey guys! Just when I thought CSS would be the basic emulation of adding different colours and backgrounds continuously it proved me wrong, it can do a lot more than that! 

Today I completed the coloured markers challenge on freecodecamp!. The first part of the challenge was to learn how to make secondary and tertiary colours. In order to make a secondary colour we have to combine two primary colours. For example, to make a magenta colour we mix two primary colours red and blue.

The different types that I learned today of applying colour to an element with CSS were with hexadecimal or hex values.

Hex colour values start with a `#` character and take six characters from 0-9 and A-F. The first pair of characters represent red, the second pair represents green, and the third pair represents blue. For example, `#4B5320`.

With hex colours, `00` is 0% of that colour, and `FF` is 100%. So `#00FF00` translates to 0% red, 100% green, and 0% blue, and is the same as `rgb(0, 255, 0).`

The HSL colour model, or hue, saturation, and lightness, is another way to represent colours.
The CSS `hsl` function accepts 3 values: a number from 0 to 360 for hue, a percentage from 0 to 100 for saturation, and a percentage from 0 to 100 for lightness.

The interesting twist here is that I learned how to add different colours to turn them into gradients! It actually reminded me of the very early days of Microsoft Word and its colour gradient features. It was cool to see how it was actually made.

The CSS `linear-gradient` function lets you control the direction of the transition along a line, and which colors are used. E.g `linear-gradient(gradientDirection, color1, color2, ...);`

After getting to grips with how to add colours and gradients to different parts of the website I jumped to learning how to add shadows. Adding a shadow makes the colours look a little more multidimensional and real.

Lastly, I had an introduction to the `offsetX`, `offsetY` and `spreadradius` properties. 

That wraps up my third day of writing code, I am beginning to have a basic understanding of the CSS elements highlighted above and I am so excited to continue on this journey.
A Beginner's Guide to Web Development: HTML, CSS, and JavaScript
Tags: beginners, javascript
Published: 2023-07-24 04:03:58

Welcome to the fascinating world of web development! Creating websites and web applications is an exciting journey that allows you to bring your ideas to life on the internet. In this beginner's guide, we'll explore the essential trio of web development: HTML, CSS, and JavaScript. Whether you're new to programming or coming from a different background, this guide will set you on the right path to start your web development adventure.


**1. Understanding the Building Blocks**

_a. HTML (Hypertext Markup Language):_

HTML forms the backbone of every web page, defining its structure and content using tags. Let's see a simple example of an HTML document that displays a basic webpage:

```
<!DOCTYPE html>
<html>
<head>
    <title>My First Web Page</title>
</head>
<body>
    <h1>Hello, World!</h1>
    <p>Welcome to my website.</p>
</body>
</html>

```


_b. CSS (Cascading Style Sheets):_

CSS is responsible for the presentation and styling of your web page. You can use CSS to control colors, fonts, layouts, and more. Here's a basic CSS example to style our previous HTML:

```
body {
    font-family: Arial, sans-serif;
    background-color: #f0f0f0;
    margin: 0;
    padding: 0;
}

h1 {
    color: #007bff;
}

```

_c. JavaScript:_

JavaScript is a dynamic programming language that adds interactivity to your web page. It enables handling user interactions and updating content without reloading the page. Here's a simple JavaScript example that changes the content of our webpage when a button is clicked:

```
<!DOCTYPE html>
<html>
<head>
    <title>My First Web Page</title>
</head>
<body>
    <h1>Hello, World!</h1>
    <p>Welcome to my website.</p>
    <button onclick="changeText()">Click me!</button>

    <script>
        function changeText() {
            var paragraph = document.querySelector('p');
            paragraph.textContent = 'You clicked the button!';
        }
    </script>
</body>
</html>

```


**2. Setting Up Your Development Environment**
Before diving into web development, you'll need a text editor and a web browser for testing your web pages.

Creating Your First Web Page

_a. HTML Structure:_

Start by creating an HTML document with the basic structure: 
```
<!DOCTYPE html>, <html>, <head>, and <body>.
Add content using tags like <h1>, <p>, <img>, and <a>.
```

_b. CSS Styling:_

```
Create a separate CSS file and link it to your HTML using the <link> tag.
Define CSS rules to style HTML elements like body, h1, p, and a.
```

_c. JavaScript Interaction:_
```
Embed JavaScript code within <script> tags.
Use JavaScript to add interactivity, such as handling button clicks or form submissions.
```

**Conclusion**

Congratulations on taking your first steps into the world of web development! With HTML, CSS, and JavaScript, you have the fundamental tools to create dynamic and visually appealing websites. Keep exploring, experimenting, and building projects to enhance your skills. Web development is an ever-evolving journey, and the possibilities are endless. Happy coding!
Feather Dress: A Fashion Statement or a Cruelty to Animals?
Published: 2023-07-24 03:33:23

Feather dress is a type of clothing that uses feathers as a decorative element, either as a trim, a fringe, or a full layer. Feather dress can be made from various types of feathers, such as ostrich, peacock, pheasant, or even synthetic ones. Feather dress is often seen as a glamorous and elegant choice for special occasions, such as weddings, parties, or red carpet events. However, [feather dress](https://www.catchallstore.com) also raises some ethical and environmental concerns, such as the welfare of the birds that provide the feathers, the sustainability of the feather industry, and the impact of feather waste on the ecosystem.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/sslim3zvjmo0va819xf0.jpg)

One of the main arguments in favor of feather dress is that it is a form of artistic expression and creativity. Feather dress can create stunning visual effects, such as adding texture, movement, color, and shape to the outfit. Feather dress can also reflect the personality and mood of the wearer, such as playful, romantic, or daring. Feather dress can be seen as a way of celebrating the beauty and diversity of nature, as well as honoring the cultural and historical significance of feathers in various traditions and rituals.

However, one of the main arguments against feather dress is that it is a form of animal exploitation and abuse. Feather dress can involve harming or killing birds for their feathers, either by plucking them alive or slaughtering them for their meat and skin. Feather dress can also contribute to the decline of some bird species that are endangered or threatened by habitat loss, poaching, or disease. Feather dress can be seen as a way of disrespecting and destroying the life and dignity of animals, as well as ignoring the ecological and ethical consequences of using feathers as a fashion accessory.

Therefore, feather dress is a controversial topic that has both supporters and critics. Some people may argue that feather dress is a harmless and beautiful way of dressing up, while others may argue that feather dress is a cruel and wasteful way of dressing down. The choice of wearing feather dress may depend on one's personal values, preferences, and beliefs. However, it is also important to be aware of the facts and impacts of feather dress on both animals and humans, and to make informed and responsible decisions when it comes to fashion.
Sharcode CARET (Classification And Regression Training)
Published: 2023-07-24 03:12:04

🚀 **[Excited about machine learning](https://sharcode.com/)?** 🤖 Discover the power of CARET (Classification And Regression Training) - your one-stop solution for building top-notch predictive models! 📈📊

🔎 Want to conquer complex regression and classification problems? Look no further! CARET offers a unified interface for training and evaluating various ML models, making it a go-to choice for data scientists and researchers alike. 💼💻

**💡 Key Features:**
📚 Streamlined Model Development
⚙️ Easy Data Preprocessing
🎯 Model Tuning & Hyperparameter Optimization
📊 Comprehensive Model Evaluation Metrics

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nwioqmm65ri4xdyc1cqe.png)
YouTube video link: https://youtu.be/TsgcOnKOYk8

#ClassificationAndRegressionTraining #MachineLearning #DataScience #CARET #ModelDevelopment #PredictiveModels #AI #ML #DataScientists #TechInnovation #sharcode #sharcodewebsite #sharcodeplatform
Going into week 7, and I'm struggling.
Tags: webdev, beginners, programming, codenewbie
Published: 2023-07-24 02:41:00

Coding is hard, but I'm still optimistic. I feel when I am listening to lecture and applying it in class I understand the concepts perfectly. But once I open VSCode, outside of class I immediately draw a blank…where do I even start? A few Google searches point me in the right direction sometimes, but for the most part it's difficult for me to build something on my own. I still have hope, but it's definitely frustrating.
AntDB Core billing system replacement of a provincial company of China Telecom
Tags: database
Published: 2023-07-24 02:09:36

AntDB helped a provincial company of China Telecom get the data of billing system on the cloud, including the data layer, approval and payment process and other large-scale business. In terms of system design, hot transaction data such as resources and assets are migrated to AntDB database, which greatly improves the access efficiency of business-critical data and the overall performance of CDR transaction.

application effectiveness:

- 500% transaction performance improvement

- 60 billion transactions per day
If Censorship Affects Learning Speed & Humanities Ability To Evolve With Digital World: Could This Be Intentional?
Tags: devjournal, web3, productivity
Published: 2023-07-24 02:04:09

Why is the perpetuating trend leading closer and closer to net neutrality; 

It used to be that the internet was free, and if you did have a business online, you still did appreciate the level of free useful information you could come across.

However, it is as if these days; those days are fading behind us, with more and more introduction of AI solutions flooding the market with the next bidder's product hoping for payday. 

When is it enough, when will people realise that when digital liberty is being threatened it could be a sign to either acknowledge, diverge or call out the obvious. 

I would go further to say; what is driving up cyber crime is never the need to just break into someone's infrastructure without cause. 

It is something that is being done out of spite; the ones who are fully aware, recognise the effects of censorship and deliberate search query tempering. This is before we disclose the **demonetisation of digital privacy.** 

Public networks and spaces no longer let you use your phone without a VPN on an open network. And if they suspect you do; your Device MAC is automatically flagged. This is before getting into more involved setup like tunnels, tor and i2p...

So if these conglomerates are preaching privacy, yet demonising whoever is for it; where is the absolute in their statement? 

Unless the intent is to confuse and leave the masses dumber than ever, so they have no choice but to rely on AI? 

Added to that: the massive damage caused by the gene-editing shots that were administered during the global lock-down. 

It's nothing being shown on the mainstream; but simply because you see no fire, never means there's no smoke...
TIL more about flexbox...
Published: 2023-07-24 01:16:12

Thanks to the [Flexbox Froggy](https://flexboxfroggy.com/) exercise, I finally feel like I have a better grasp on flexbox. Although I took an HTML & CSS mini-course about 3 years ago, I have always felt a little fuzzy on the concept.

### What is flexbox?

Flexbox refers to the flexible box layout system in CSS, and it is a particularly useful tool when styling elements in a 1-dimensional row such as component layouts. 

Example of the CSS display flex property:
```CSS
.container {
display: flex;
}
```
### What new things did you learn? 
During the exercise, I learned about the `flex-flow` CSS property which is a shorthand property that allows us to combine both the `flex-direction` and `flex-wrap` properties.  

Example:
```CSS
.container {
display: flex;
flex-flow: column-reverse wrap-reverse;}
```
TIL: Turn a video to frames and then back again with ffmpeg
Tags: todayilearned, ffmpeg
Published: 2023-07-24 01:10:52

Here are a collection of bash commands and then a final script that I used this week to convert a video to frames.
Edit those frames a bit, and then convert the edited frames back to video

This was for my `rmbg` tool, which I discussed in [this weeks newsletter](https://coreyja.com/posts/weekly/20230721).
The script at the end actually uses [`rembg`](https://github.com/danielgatis/rembg) which is the tool that inspired my rust port!

Disclaimer: It turns out this is NOT the "state of the art" background removal for videos! Keep your eyes peeled for a future TIL covering [RobustVideoMatting](https://github.com/PeterL1n/RobustVideoMatting)

But the `ffmpeg` scripts for converting to frames are still useful!

## Make PNGS from video

```bash
ffmpeg -i input_video.mp4 'frames/%06d.png'
```

## Make video from PNGS

```bash
ffmpeg -framerate 24 -pattern_type glob -i 'frames/*.png' output_video_without_audio.mp4
```

## Combine Video and Audio

```bash
ffmpeg -i output_video_without_audio.mp4 -i input_video.mp4 -map 0:v -map 1:a -c copy -shortest output.mp4
```

## Add overlay

```bash
ffmpeg -i video.mp4 -i overlay.png -filter_complex "[0:v][1:v] overlay=0:0" -c:a copy output.mp4
```

## Background Removal Script

```bash
input_video=$0

# Make PNGS from video
ffmpeg -i "$input_video" 'frames/%06d.png'

# Remove background from all frames
rembg p frames frames_out

# Make video from pngs
ffmpeg -framerate 24 -pattern_type glob -i 'frames_out/*.png' bg_removed.mp4

# Add back in the audio track
ffmpeg -i bg_removed.mp4 -i "$input_video" -map 0:v -map 1:a output.mp4
```
TIL (CodeAcademy CSS)
Published: 2023-07-24 01:05:57

Recently I have learned in depth about HTML and CSS - I knew a little from older platforms such as MySpace and LiveJournal's profile layout editing but it is really cool to see things come together.

With HTML I learned how to make unordered lists using:

```
<ul>
  <li></li>
  <li></li>
</ul>

```

And also to add videos.

With CSS I learned what a stylesheet is and how to style html. Adding something as simple as:

```
<link href="style.css" rel="stylesheet">
```

Changed the code entirely to show a full website instead of just text, images, and links.

I wonder if, in the future, programming languages also have clear cut styles such as CSS for HTML? Or if it is all a part of the same language?