teleren/devto huggingface dataset:
Why hosting more than one service on a single host in production can be a big problem
Tags: discuss, infrastructureascode, devops, redis
Published: 2023-09-06 13:36:57

In the ever-evolving landscape of infrastructure management, one topic often sparks spirited debates: **the practice of hosting only one service per server in a production environment**. It's a mantra chanted by many, a design principle considered gospel by some. But what if we challenge this conventional wisdom, just a bit?

Recently, I found myself in a conversation with a new client, discussing the intricacies of infrastructure design. The client confidently asserted that having more than one service on a single host in a production setup is a cardinal sin of modern architecture. While I've always been an advocate for the scalability and elegance of the one-service-per-host approach, I couldn't help but wonder: does every rule have exceptions?

---

This discussion left me intrigued and yearning for a deeper understanding. What if there are scenarios, like the symbiotic relationship between an API and its caching companion (Redis or Memcached), where bucking the trend makes perfect sense? As I delved further into this topic, I began to wonder if I'm not alone in challenging the status quo.

If you're an engineer who has, at least once, contemplated the idea of cohabitating services on a single host, this post is for you. Let's explore the reasons, scenarios, and justifications for this approach, and engage in a discussion that may very well redefine some of our long-held beliefs about infrastructure.
Time Delta - HackerRank Python Solution
Tags: python, algorithms, beginners, programming
Published: 2023-09-06 13:35:20

Time Delta is a medium difficulty problem that involves datetime manipulation and we have to return the absolute difference between in seconds. We will learn how to solve this problem in Python through a step-by-step tutorial in Python3.

## Problem Statement and Explanation

Given two timestamps in the format `Day dd Mon yyyy hh:mm:ss +xxxx` where `+xxxx` represents the time zone. We have to print the absolute difference (in seconds) between them.

Suppose the first timestamp is `Sun 10 May 2015 13:54:36 -0700` and the second timestamp is `Sun 10 May 2015 13:54:36 -0000`.

- t1 = Sun 10 May 2015 13:54:36 -0700
- t2 = Sun 10 May 2015 13:54:36 -0000

The absolute difference between them is 25200 seconds because the time zone offsets are `-0700` and `-0000` and then 7 hours is 25200 seconds. 7 \* 3600 = 25200 seconds.

- In the given solution, we will use the `datetime` module to convert the given string into a datetime object.
- Then we will find the absolute difference between them and return the difference in seconds.

## Time Delta Solution in Python

{% gist https://gist.github.com/codeperfectplus/26abad049c27b29950bfd580171d8836.js %}
## Time Complexity of the Solution

The time complexity of the above solution is `O(1)` because we are using the `datetime` module to convert the given string into a datetime object and then we are finding the absolute difference between them and returning the difference in seconds.

_Problem statement is taken from [Hackerrank](https://www.hackerrank.com/domains/python), and the solutions are implemented by **CodePerfectPlus** team_
Day 42: Typed Functions
Tags: javascript, typescript, 100daysofcode, day42
Published: 2023-09-06 13:35:00


## Defining Functions

In TypeScript, you can define functions using the `function` keyword or as arrow functions (`=>`). Let's start with the traditional function definition:

```typescript
function greet(name: string): string {
  return `Hello, ${name}! 👋`;
}
```

And here's an arrow function equivalent:

```typescript
const greet = (name: string): string => `Hello, ${name}! 👋`;
```

## Optional and Default Parameters

In TypeScript, you can make function parameters optional by adding a `?` after their name. You can also provide default values:

```typescript
function welcome(name: string = "User", age?: number): string {
  if (age) {
    return `Welcome, ${name}! You are ${age} years old. 🎉`;
  } else {
    return `Welcome, ${name}! 🎉`;
  }
}
```

Here, the `name` parameter is optional, and if `age` is not provided, it defaults to `undefined`.

## Rest Parameters

If you want to pass an arbitrary number of arguments to a function, you can use rest parameters:

```typescript
function sum(...numbers: number[]): number {
  return numbers.reduce((total, num) => total + num, 0);
}

const result = sum(1, 2, 3, 4, 5); // result is 15
```

The `...numbers` syntax allows you to pass any number of arguments, which are then treated as an array within the function.

## Function Overloading

TypeScript allows you to define multiple function signatures for the same function name, known as function overloading:

```typescript
function combine(a: string, b: string): string;
function combine(a: number, b: number): number;
function combine(a: any, b: any): any {
  return a + b;
}

const result1 = combine("Hello, ", "TypeScript!"); // result1 is a string
const result2 = combine(5, 10); // result2 is a number
```

Depending on the arguments provided, TypeScript will select the appropriate function signature.

## Higher-Order Functions


You can also create higher-order functions that take functions as parameters or return functions:

```typescript
function apply(func: (x: number) => number, value: number): number {
  return func(value);
}

const square = (x: number) => x * x;
const result = apply(square, 5); // result is 25
```
QuickViewJS: A Lightweight JavaScript Template Engine
Tags: quickview, javascript, webdev, opensource
Published: 2023-09-06 13:32:36

Hey guys. How are you today?

So, I've been working on something that's kinda helpful for beginners, small to medium projects and just people who are studying or whatever.

It's called **QuickView.js**
QuickView is a lightweight JavaScript-based templating engine designed to dynamically render HTML pages. It offers a simple syntax to embed variables and execute conditional statements and loops within HTML files.

You can check the repo here: https://github.com/tamadeu/QuickViewJS

There's still a lot of work to do (like for loops, for example). But you can do a few things for now, like a foreach loop, conditionals and include other html files to another.

The usage is pretty simple.
Just add <script src="path/to/quickview.js"></script> to your html file and start making some renderind!

In some javascript file or inline code you can just add the qv() function and start adding variables, like:
```
qv({
  "siteName": "My Site",
  "users": [
    {"name": "Alice", "age": 25},
    {"name": "Bob", "age": 30}
  ]
});
```
Then, in your html code you can just call your variables. For example:
```
<h1>{{ siteName }}</h1>
```
Now, let's say you have a menu.html and you want it in you index.html. All you have to do is: 
```
@include('menu')
``` 
And that's it. Your menu.html is added to your index.html without any extra codes in your menu.html or wherever.

You can check a small project with these functionalities here: https://tamadeu.github.io/quickview_project/

Anyway, any contributions, sugestions, critics or whatever are more then welcome. 

![meme](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/epe7zrmx0f3u26wce0fg.jpg)
SQLMorpher: LLM-Based Tool to Improve Data Transformation in Building Energy Data
Tags: llm, ai, machinelearning, sql
Published: 2023-09-06 13:32:04

Addressing data transformation challenges in the building sector, which accounted for 40% of US energy use in 2022, is crucial. Enter SQLMorpher, a tool utilizing large language models (LLMs) to produce SQL code, simplifying data harmonization. Leveraging LLMs' strengths in reasoning and coding, it creates SQL codes to connect diverse datasets. 

Read more - https://news.superagi.com/2023/09/06/sqlmorpher-llm-based-tool-to-improve-data-transformation-in-building-energy-data/
New Large-Scale Language Model Enhances Medical Queries with Textbook Knowledge
Tags: llm, ai, machinelearning
Published: 2023-09-06 13:26:01

Recent advancements in artificial intelligence have birthed the Large-scale Language Models Augmented with Medical Textbooks (LLM-AMT), a novel approach aimed at enhancing the accuracy and professionalism of medical queries handled by Large Language Models (LLMs). While traditional LLMs are technologically advanced, they sometimes produce misleading content. To counteract this, researchers have infused their model with knowledge from authoritative medical textbooks. The revamped LLM-AMT not only ensures precision but also upholds the highest medical standards, marking a significant leap in AI-driven medical applications.

Read more - https://news.superagi.com/2023/09/06/new-large-scale-language-model-enhances-medical-queries-with-textbook-knowledge/
A unified look: Why I created the 'Copilot' Gitkraken Theme
Tags: git, themes, css, productivity
Published: 2023-09-06 13:25:42

In the world of software development, choosing the right tools is crucial. In addition to functionality, the visual aspects also play an important role in the way I work. As someone who likes to work in a structured way and appreciates order, a consistent appearance of my programs is especially important to me. For quite some time, I've been using [Benjamin Benais' VS Code theme](https://marketplace.visualstudio.com/items?itemName=BenjaminBenais.copilot-theme), which colors are based on the original IDE on the GitHub Copilot website.

But since I also use Gitkraken as my preferred Git tool, I asked myself if it's possible to adjust the style here as well so that it looks uniform from the color scheme in the end? And the answer is simple and short: Yes!
![Yes! gif](https://media.giphy.com/media/MNmyTin5qt5LSXirxd/giphy.gif)

With [version 8.2](https://www.gitkraken.com/blog/gitkraken-client-v8-2) the team behind Gitkraken made it possible to create and embed your own themes. With this information I immediately sat down and started to create my own theme.

The first step was to analyze the VS Code theme by Benjamin Benais. I extracted the color values and started to develop my own Gitkraken theme based on that. In doing so, I made sure the colors were consistent and had the same visual aesthetic as my VS Code theme.
![Work gif](https://media.giphy.com/media/QNFhOolVeCzPQ2Mx85/giphy.gif)

It was a challenge to find the right shades and make sure they displayed correctly in Gitkraken. But after some tweaking and testing, I finally had my own Gitkraken theme created that matched the look of my VS Code theme.

The result was impressive. My Gitkraken now looked exactly like my other developer tools. The colors were harmonious and the overall work environment looked consistent and inviting.

![Preview](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5kq85hybtw24twpwc9x1.png)

If you want to use the theme too, feel free to get it on [Github](https://github.com/D3nn7/gitkraken-copilot-theme) (Don't forget to star 😉)
🚀 𝐑𝐞𝐟𝐥𝐞𝐜𝐭𝐢𝐧𝐠 𝐨𝐧 𝐌𝐲 𝐈𝐧𝐭𝐞𝐫𝐧𝐬𝐡𝐢𝐩 𝐋𝐞𝐚𝐫𝐧𝐢𝐧𝐠 🌟 Part 1
Tags: flutter, softwareengineering, internship
Published: 2023-09-06 13:06:18

Sharing the learnings I gained with others will also be a reminder for me in the future.

1️⃣ 𝐄𝐟𝐟𝐞𝐜𝐭𝐢𝐯𝐞 𝐂𝐨𝐦𝐦𝐮𝐧𝐢𝐜𝐚𝐭𝐢𝐨𝐧 𝐈𝐬 𝐊𝐞𝐲: Properly Communicate with the team members, learn how to ask for help, and be eager to help others. Because software engineering is a team sport.

2️⃣ 𝐄𝐱𝐩𝐞𝐜𝐭 𝐭𝐡𝐞 𝐔𝐧𝐞𝐱𝐩𝐞𝐜𝐭𝐞𝐝: Things will not always go as planned; your laptop might encounter issues, network connectivity could fail, or certain features of your app might not function properly. Unforeseen incidents like these are inevitable, and the key is to remain patient and address these problems with a calm and composed mindset. 🧘‍♂️

3️⃣ 𝐏𝐫𝐨𝐛𝐥𝐞𝐦-𝐒𝐨𝐥𝐯𝐢𝐧𝐠 𝐚𝐭 𝐈𝐭𝐬 𝐂𝐨𝐫𝐞: Start by identifying the problem you need to address. Your software functions as the solution for solving a real-life issue, which can be dissected into several smaller challenges. This approach will provide you with a more distinct understanding of your ultimate objective, allowing you to dive into these subproblems effectively 🎯

4️⃣ 𝐏𝐫𝐞𝐩𝐚𝐫𝐢𝐧𝐠 𝐟𝐨𝐫 𝐂𝐨𝐝𝐢𝐧𝐠: This was a lesson I learned over time, and since then, I've made it a practice to follow. Prior to plunging into coding, it's crucial to engage in a discussion with your seniors and team lead. Share your proposed approach, whether it's a rough sketch, pseudocode, or a step-by-step action plan, and solicit their feedback. If you're on the right path, they will encourage you to proceed, and if your thought process aligns with theirs, your execution is likely to be successful. However, if you find yourself headed in the wrong direction, they will offer suggestions for improvement and present alternative viewpoints. Embrace their input and integrate it into your thinking. Remember, it's entirely normal for your initial idea to necessitate adjustments. Instead of feeling discouraged, consider it a valuable learning experience that enhances your capacity for critical thinking and making well-informed decisions. This iterative approach ensures that you continuously refine and enhance your work.📝🚀

5️⃣ 𝐄𝐦𝐛𝐫𝐚𝐜𝐞 𝐒𝐞𝐥𝐟-𝐒𝐮𝐟𝐟𝐢𝐜𝐢𝐞𝐧𝐜𝐲: Being self-sufficient, troubleshooting and debugging is a great way to explore new things, also it helps to become more perseverant and confident. But remember to reach out to your team when it's necessary. (You need to find the balance between this)🤝

Thank you for reading!!
The Importance of AAT Courses
Tags: beginners, productivity
Published: 2023-09-06 13:05:34

**Introduction**

In today's dynamic and competitive job market, professional qualifications play a vital role in enhancing career prospects. For those aspiring to build a successful career in accounting and finance, the Association of Accounting Technicians (AAT) courses are a gateway to a promising future [aat courses](https://www.fctraining.org/). Among the top providers, Future Connect Training stands out for its comprehensive AAT courses, equipping students with the necessary skills and knowledge to excel in the financial industry. In this article, we will explore the significance of AAT courses and delve into how Future Connect Training can shape your future in the world of finance

**The Importance of AAT Courses**

AAT courses offer a solid foundation for individuals seeking a career in accounting and finance. These courses cater to students at various levels, from beginners to experienced professionals looking to upskill [aat level 2](https://www.fctraining.org/aat-level-2.php). The AAT qualifications are globally recognized and accredited, making them highly valuable in the eyes of employers. Whether you aim to become an accounting technician, finance officer, or even a chartered accountant, AAT courses can pave the way for your career progression.

Moreover, AAT courses cover a wide range of financial topics, including bookkeeping, budgeting, taxation, financial management, and more. Such comprehensive knowledge ensures that graduates are well-equipped to handle the diverse challenges faced in the financial sector.

**Future Connect Training: Empowering Your Journey**

Future Connect Training has earned a reputation as a leading provider of AAT courses, with a track record of helping students achieve their career aspirations [aat level 3](https://www.fctraining.org/aat-level-3.php). Here's how Future Connect Training sets itself apart:

**Expert Tutors:** The quality of education depends on the expertise of the instructors. At Future Connect Training, highly qualified and experienced tutors guide students throughout their learning journey [aat level 4](https://www.fctraining.org/aat-level-4.php). These tutors not only impart technical knowledge but also share practical insights gained from their own experiences in the financial field.

**Flexible Learning:** Balancing work, personal life, and education can be challenging. Future Connect Training understands this and offers flexible learning options. Students can choose from classroom-based, online, or blended learning, tailoring their studies to fit their schedules.
Laravel 10 Google Recaptcha V3 Example
Tags: laravel, google, v3, captcha
Published: 2023-09-06 13:01:02

Now I can provide you with guidance on implementing Google reCAPTCHA v3 validation in Laravel 10.

Google reCAPTCHA v3 is a spam prevention service that allows you to protect your Laravel application against abusive activities, such as bots, without requiring users to solve CAPTCHA puzzles. Instead, it assigns a score to each request based on user behavior, and you can set a threshold to determine which requests are likely to be abusive.

Here's a step-by-step guide on how to implement Google reCAPTCHA v3 validation in Laravel:

## Step 1: Set Up reCAPTCHA v3

Go to the Google reCAPTCHA website and sign in or create an account if you don't have one.

Register a new site. Choose the reCAPTCHA v3 option and provide the domain(s) where you'll be using reCAPTCHA. Google will provide you with a site key and a secret key.

## Step 2: Install Laravel's Validation Package

If you haven't already installed Laravel's validation package, you can do so using Composer:

```
composer require laravel/fortify
```

## Step 3: Configure reCAPTCHA in Laravel

In your Laravel project, open the .env file and add your reCAPTCHA site key and secret key:


```
RECAPTCHA_SITE_KEY=your_site_key
RECAPTCHA_SECRET_KEY=your_secret_key
```

## Step 4: Create a Blade View

Create a Blade view where you want to include the reCAPTCHA validation. For example, you can create a contact form:


```
<!-- resources/views/contact.blade.php -->
<!DOCTYPE html>
<html>
<head>
    <title>Contact Us</title>
    <script src="https://www.google.com/recaptcha/api.js" async defer></script>
</head>
<body>
    <h1>Contact Us</h1>
    <form action="{{ route('contact.submit') }}" method="POST">
        @csrf
        <label for="name">Name:</label>
        <input type="text" name="name" id="name" required>
        <br>
        <label for="email">Email:</label>
        <input type="email" name="email" id="email" required>
        <br>
        <div class="g-recaptcha" data-sitekey="{{ env('RECAPTCHA_SITE_KEY') }}"></div>
        <br>
        <button type="submit">Submit</button>
    </form>
</body>
</html>
```
In this form, we've added a div with the g-recaptcha class to display the reCAPTCHA widget. We use the RECAPTCHA_SITE_KEY from the .env file to set the data-sitekey attribute.

Read More :- [Laravel 10 Google Recaptcha V3 Validation Example Tutorial](https://www.tutsmake.com/laravel-10-google-recaptcha-v3-example/)
👽 0.2.1 Amalgam takes the back seat and becomes Passenger
Tags: ai, testing
Published: 2023-09-06 12:58:55

Amalgam, that were the prototype name of the tool designed to wipe out manual tests, matching your ticket with your functional code and spinning a similarity score and also tests, docs and even feedback. 
But having had a proper think on it, I'm wondering if "Amalgam" truly captures the essence. It sounds a tad too wild for a tool of this nature.
It's more like a passenger, ain't it? Riding alongside you, occasionally nudging you right if you veer off, but still letting you be the master of your own journey. 

After crossing a grand milestone last week, Amalgam has taken on the name 'Passenger'. And, just so you know, she's (identified as she/her) now crafted in TypeScript, leaving Rust for another day. And instead of trotting along with node.js, she's now galloping with a single executable binary powered by Bun.

I hope you'll join me in bringing this FOSS tool to the masses so we never have to fear about developing the wrong solution again, thanks AI. (Oh you might notice, this is an AI tool that assists you and does not and will not replace you)

## The milestones

1. I wrote some connectors and a generic connector class so its easy to add support to get ticket information from Jira (so far) and cache that so we don't keep making requests as often. An obvious goal is to keep costs down. You can easily clear the caches to fetch fresh responses. 

2. We can now convert to tickets to the wonderful BDD language Gherkin really easily which opens up test generation and comparison 

3. Passenger is focusing on a single files right now but that will extend to:
    a: realtime feedback of the file you edited
    b: A whole PR's worth of files


{% github https://github.com/adam-cyclones/passenger %}
😱Most Common Vulnerabilities in Solidity: In-Depth Part 2!
Published: 2023-09-06 12:44:49

💡 Learn about Flashloan 🌊, overflow and underflow , tx.origin , Insecure Randomness 🎲, and Improper Input Validation Attacks 🚫.

Read the article here ➡️: https://medium.com/buildbear/most-common-vulnerabilities-in-solidity-in-depth-part-2-4de3f962880d
Learn Python Basics under 50 lines
Tags: python, beginners, programming, tutorial
Published: 2023-09-06 12:43:17

Python is a popular programming language known for its simplicity and readability. Whether you're a beginner or an experienced programmer, learning Python can be a valuable skill to have. In this article, we will cover the basics of Python and guide you through the process of learning the language in just 100 lines of code. Let's get started!

1. Hello, World!: Every programming language tutorial starts with a simple "Hello, World!" program. In Python, it can be accomplished in just one line:
    

```python
print("Hello, World!")
```

1. Variables and Data Types: Python is dynamically typed, meaning you don't need to declare variables explicitly. Here's an example of a variable assignment:
    

```javascript
name = "John"
age = 25
```

1. Lists: Lists are a versatile data structure in Python. You can create a list and perform basic operations on it:
    

```python
fruits = ["apple", "banana", "orange"]
fruits.append("grape")
```

1. Control Flow: Python provides conditional statements and loops for control flow. Here's an example of an if-else statement and a for loop:
    

```python
if age >= 18:
    print("You are an adult.")
else:
    print("You are a minor.")

for fruit in fruits:
    print(fruit)
```

1. Functions: Functions allow you to encapsulate reusable code. Here's how to define and call a function:
    

```python
def greet(name):
    print(f"Hello, {name}!")

greet("Alice")
```

1. Dictionaries: Dictionaries are key-value pairs that allow you to store and retrieve data efficiently:
    

```python
person = {"name": "Alice", "age": 30}
print(person["name"])
```

1. File Operations: Python makes it easy to read from and write to files. Here's an example of reading from a file:
    

```python
with open("file.txt", "r") as file:
    content = file.read()
```

1. Exception Handling: Python provides a way to handle errors gracefully using try-except blocks:
    

```python
try:
    result = 10 / 0
except ZeroDivisionError:
    print("Cannot divide by zero.")
```

1. Classes and Objects: Python supports object-oriented programming. Here's an example of creating a class and an object:
    

```python
class Rectangle:
    def __init__(self, width, height):
        self.width = width
        self.height = height
    
    def area(self):
        return self.width * self.height

rect = Rectangle(4, 5)
print(rect.area())
```

1. Libraries: Python has a vast ecosystem of libraries that extend its capabilities. Here's an example of using the `random` library:
    

```python
import random

random_number = random.randint(1, 10)
print(random_number)
```

## Conclusion

These 10 code snippets cover the basics of Python programming. By understanding and practising them, you'll gain a solid foundation in Python development. Remember, learning programming is not just about writing code, but also about solving problems and building real-world applications. So, keep practising, exploring, and building upon what you've learned. Happy coding!