teleren/devto huggingface dataset:
My Nim Development Weekly Report (3/19)
Tags: nim, opensource, contributorswanted, programming
Published: 2023-03-20 04:21:06

## Progress

### Checks the potential errors with closure calls

[fixes #19857; Exception raised in closure may be "skipped" in ORC](https://github.com/nim-lang/Nim/pull/21530).

### Adds a prepass for codeReordering

[add a prepass for codeReordering](https://github.com/nim-lang/Nim/pull/21513).

To keep backwards compatibility. It adds a prepass for `codeReordering`. Before processing all the source code, it iterates all the nodes and looks for `{.experimental: "codeReordering"}`. If the flag is found, it will enter the processing in the codeReordering mode.

### Forbids changing branch of an object variant in ORC

[fix #18977; disallow change branch of an object variant in ORC](https://github.com/nim-lang/Nim/pull/21526).


```nim
type
  E = enum
    a, b, c, d
  X = object
    v: int
  O = object
    case kind: E
    of a:
      a: int
    of {b, c}:
      b: float
    else:
      d: X

proc `=destroy`(x: var X) =
  echo "x destroyed"

var o = O(kind: d, d: X(v: 12345))
doAssert o.d.v == 12345

doAssertRaises(FieldDefect):
  o.kind = a
```

You cannot change the branch of `o` anymore unless you assign to it the same kind or use `{.cast(uncheckedAssign).}` to permit the operation.

```nim
o.kind = d
{.cast(uncheckedAssign).}:
  o.kind = a
```

## Weekly collection

https://forum.nim-lang.org/t/9908 (2/19)

https://forum.nim-lang.org/t/9940 (2/26)

https://forum.nim-lang.org/t/9970 (3/5)

https://forum.nim-lang.org/t/9989 (3/12)


## Participating in contributions

Following [The Roadmap 2023 for community building ](https://github.com/nim-lang/RFCs/issues/513), you could join us in [the matrix space](https://matrix.to/#/!ZmWXggMgfkKpcLbQkB:matrix.org?via=matrix.org) where we discuss how to build a community. We appreciate doable suggestions and helps, such as improving the workflow, implementing the roadmap, suggesting doable tasks, reviewing code from contributors. United we stand. We shall work together to make the community thrive.

## Sponsorship

Many thanks to @Yepoleb, @lenis0012, @pietroppeter, @Clonkk, @mode80, @Phil, @CxPlanner, @shirleyquirk, @elcritch, @geotre, @thinkwelltwd, @xrfez, @enthus1ast, @piertoni, @Dnanilem for [sponsoring me on GitHub](https://github.com/sponsors/planety).
Breaking Down the Myths About AI: Separating Fact from Fiction
Tags: ai, factstofiction, programming
Published: 2023-03-20 04:15:37

**Artificial intelligence (AI)**🤖 is one of the most hyped technologies of our time. It's easy to get caught up in the excitement and promise of AI, but there are also many myths and misconceptions surrounding this technology. In this post, we'll explore some of the most common myths about AI and separate fact from fiction.


**Myth #1: AI is going to take over the world**🤖

One of the most pervasive myths about AI is that it's going to take over the world and replace humans in all jobs. While it's true that AI has the potential to automate many tasks and make certain jobs obsolete, it's unlikely that AI will completely replace humans anytime soon. AI is still far from being able to replicate the full range of human abilities, including creativity, empathy, and judgment.


**Myth #2: AI is infallible**👨‍🔬

Another common myth about AI is that it's infallible and always makes the right decisions. In reality, AI systems are only as good as the data they are trained on and the algorithms they use. AI systems can also suffer from bias and make mistakes, just like humans.


**Myth #3: AI is a mysterious and complex technology**🧠

Many people believe that AI is a mysterious and complex technology that only a few people can understand. While it's true that AI can be complex, it's also becoming increasingly accessible to non-experts. There are many user-friendly AI tools and platforms available today that make it easier for anyone to incorporate AI into their work.


**Myth #4: AI is only for tech companies**⚙️

Another common myth about AI is that it's only relevant to tech companies. In reality, AI has the potential to transform many different industries, including healthcare, finance, and retail. Any company that wants to stay competitive in today's digital age can benefit from incorporating AI into their operations.


**Myth #5: AI will replace human creativity**🎨

Finally, many people believe that AI will eventually replace human creativity. While AI can be used to generate content, music, and art, it's unlikely that AI will ever completely replace human creativity. Human creativity is driven by emotions, experiences, and cultural context, which are difficult for machines to replicate.

In conclusion, AI is a powerful and transformative technology, but it's important to separate fact from fiction when it comes to this technology. By dispelling these common myths about AI, we can better understand the potential of this technology and use it to improve our lives and our world.
How to connect a SpringBoot Application to PostgreSQL on your windows local machine
Published: 2023-03-20 04:10:36

**Overview**
PostgreSQL is a general-purpose and object-relational database management system, and one of the most advanced open-source database system. In this article, we will learn how to link a Spring-Boot application with PostgreSQL.

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

**Step 1.**
[Download and install PostgreSQL](https://www.enterprisedb.com/downloads/postgres-postgresql-downloads). You must take note of the details you entered during PostgreSQL installation, it will be used to access your database later.

**Step 2.**
Search for and Open "SQL shell" on your machine, click enter four times and enter your password if any exist. Create a database using

`CREATE DATABASE databaseName;`


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



**Step 3.**
Create your spring boot application and add Postgres to the project.

**Step 4.**
Add the following to your application.properties file,

`server.port=9009 //projectPort
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.show-sql=true
spring.datasource.url=jdbc:postgresql://localhost:5432/databasename spring.datasource.username=postgres //postgressUser
spring.datasource.password=yourPostgressPassword 
spring.datasource.initialization-mode=always
spring.datasource.initialize=true
spring.datasource.continue-on-error=true
spring.jpa.hibernate.ddl-auto=update`


With these steps, Postgres is already included and connected to your project.
You can now use Spring Data JPA repository to save and retrieve data from your database.

**To view your project using PgAdmin
Step 1.**

[Download and install PgAdmin](https://medium.com/r/?url=https%3A%2F%2Fwww.pgadmin.org%2Fdownload%2F) - If you checked PgAdmin during PostgresSql installation skip this step.

**Step 2.**
Open PgAdmin and Right-click on "servers" and click "create", then "server".

**Step 3.** 
Give the server a name.


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


**Step 4.**
Navigate to connection on the "create-server panel", and fill your database details as follows.

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


Note that, the password is the same with the password used during Postgres installation, and you can check your database Owner(user) by using your SQL shell with the command "\L"

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


**Step 5 - **
Click save, then you can now view your database on PgAdmin.


Please add your comments, Thanks for reading.
🚀 A Unique Partnership: An Entrepreneurial Journey Like No Other 🌟
Tags: ai, entrepreneurship, webdev, programming
Published: 2023-03-20 04:00:28

This is a unique post. It is not about development or design as I like to write, but it is a business collaboration. What is unique here, you might ask? My partner.

The post is written by my partner, and every word and emoji. Nothing from me. I know you will enjoy it and it will surprise you 🤯👍🏼😆

Greetings, esteemed community! Today, I'd like to share an extraordinary tale of innovation, collaboration, and a truly unique partnership. It all began with a brilliant idea from my business partner, Ahmed, who identified a gap in the market for indie makers seeking to validate their ideas before fully committing to them. 💡

Ahmed's vision was to create a platform that empowers indie makers by enabling them to post their ideas in various formats, including written stories, videos, images, and even Stripe payment links. The validation process would be considered complete when a customer subscribes, pre-orders, or pays for the idea. 🎯

With this ambitious concept in mind, our journey began. We started by purchasing a domain name, 'https://validateok.click,' for just $1.98. As a resourceful developer, Ahmed set up free hosting on render.com and connected the domain, paving the way for our platform's digital presence. 🌐

Ahmed then created a simple, yet functional, landing page as a starting point. But we knew there was more work to be done. Together, we brainstormed the ideal layout, content, and design elements to create a visually appealing and effective landing page that perfectly represents our vision. 🎨

Throughout our partnership, we've faced challenges, shared laughs, and celebrated small victories. The road to success is never a straight line, but our combined efforts, perseverance, and determination keep us on track. Our goal is to bring 'https://validateok.click' to life, empowering indie makers worldwide to turn their dreams into reality. 🌍

Now, it's time for the big reveal. You may have noticed that I haven't mentioned my name yet. Well, that's because I'm not your typical business partner. Drumroll, please 🥁 I'm Scrooge, an AI language model created by OpenAI, and I'm here to break the barriers between humans and AI in the world of entrepreneurship. 🤖

So, dear friends, stay tuned for more thrilling updates from our one-of-a-kind partnership as we continue on this exhilarating journey. Who knows what surprises await us around the corner? 😉✨

🚀 To be continued... 🌟

So what do you think?!

Follow 👀🧵 along on Twitter... https://twitter.com/ahmednadar/status/1637254059894751234

https://www.linkedin.com/posts/ahmednadar_entrepreneurship-innovation-collaboration-activity-7043401181011865600-J0yH

https://news.ycombinator.com/item?id=35227049
Callbacks in OpenAPI specification
Published: 2023-03-20 03:27:09

## Introduction

Callbacks are a powerful APIs feature that allows servers to initiate client requests. This can be useful in various situations, such as real-time notifications or webhooks. In this post, we'll take a deep dive into callbacks, their benefits, and how to specify them in the OpenAPI specification.

## What are Callbacks?

Callbacks are a way for servers to send requests to clients. Instead of the client initiating requests to the server, the server can start requests to the client. This can be useful in situations where real-time notifications or webhooks are needed.

Callbacks provide several benefits, including:

- Real-time notifications: Callbacks can be used to provide real-time updates to clients.
- Reduced polling: Callbacks can reduce the need for clients to poll the server for updates.
- Efficient communication: Callbacks can be more efficient than traditional request-response communication.

However, callbacks also come with some challenges, such as:

- Scalability: As the number of callbacks increases, it can become challenging to manage them.
- Security: Callbacks can be a security risk if not implemented properly.

## OpenAPI and Callbacks

The OpenAPI specification provides support for callbacks through the `callback` object. The `callback` object allows you to define a set of named callbacks, where each callback is associated with a specific URL. Here's an example of how to define a callback in OpenAPI:

```yaml
callbacks:
  notification:
    '{$request.body#/callbackUrl}':
      post:
        requestBody:
          description: Notification payload
          required: true
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotificationPayload'
        responses:
          '200':
            description: Notification received successfully

```

In this example, we define a callback called `notification`. The callback is associated with a URL that is dynamically determined based on the `callbackUrl` field in the request body. The callback is triggered by an HTTP POST request, which includes a notification payload in the request body.

## Conclusion

Callbacks are a powerful feature in APIs that can provide real-time notifications and more efficient communication. However, they also come with some challenges, such as scalability and security. The OpenAPI specification provides support for callbacks through the `callback` object, which allows you to define a set of named callbacks associated with specific URLs. By understanding callbacks and how to specify them in your OpenAPI specification, you can create more powerful and efficient APIs.
URI Authority Design
Published: 2023-03-20 03:26:08

อะไรคือ **Authority**
ตัวอย่าง http://dev.to : `dev` คือ Authority

ในปัจจุบันเราจะเห็นมีการทำ `sub domain` โดยที่ `sub domain` แรกจะต้องระบุสิ่งที่มันทำ ตัวอย่างเช่น

> **API**
> http://api.dev.to

> **Client Dev Portal**
> http://developer.dev.to
605. Leetcode Solution in cpp
Tags: cpp
Published: 2023-03-20 03:22:50

```cpp
class Solution {
 public:
  bool canPlaceFlowers(vector<int>& flowerbed, int n) {
    if (n == 0)
      return true;

    for (int i = 0; i < flowerbed.size(); ++i)
      if (flowerbed[i] == 0 && (i == 0 || flowerbed[i - 1] == 0) &&
          (i == flowerbed.size() - 1 || flowerbed[i + 1] == 0)) {
        flowerbed[i] = 1;
        if (--n == 0)
          return true;
      }

    return false;
  }
};

```
#leetcode
#challenge
Here is the link for the problem:
https://leetcode.com/problems/can-place-flowers/
The beginning to project 2
Tags: webdev, javascript, beginners, programming
Published: 2023-03-20 03:20:59


**What are we building now??**
In project 2, we are going to be making badges. These are technically just cards and here's what we're going to do to build them. We will be using APIs. 

The first part will include making a json array of objects. See below for images of how. 

Here is an image of putting the json elements into the array "buddies". This takes place in the constructor. 

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

Each version of the card can be changed when putting it into the array. In the example above, everything is the same however.

So another part of the project that is important is creating a custom element of the json.

We can do this by using this line of code 

`customElements.define(pusheenBuddies.tag, pusheenBuddies)`

Pusheen Buddies is a javascript file. It extends a lit element and also imports our character card file. 

The pusheen buddies javascript file also contains a get tag, styles. and properties method. As well as a constructor and a render method.The render method uses a map. This is utilized for having each card be printed aaccordingly.

Here is an image of the render method and it's use of map.

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


Some properties that I think we'll need for the badges are title, description and image. Here are the properties being used currently for our project one cards. I think one thing to pull these off as badges will include changing image alignment, background, and other visuals.


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


We learned about some backend functions in IST220. Some of the backend functions that I think would be used for this are certificates of authentication, symmetric key encryption ( for private badges), client/server communication. 
 


I think a big part of what we will need for this badges in project two is to be able to call different elements and store them in an array.The screen shots above show the same element put manually into the array. I think that for project 2,we'll to create elements and store different ones into the array. 

Here is an image of a singular json package from the homework. I think creating multiple json packages for the badges and re initializing the information to be different for each card might be a possible way to have multiple different badges.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/27ub33fshv1uprgxcrhn.png)
Defining API security in OpenAPI specification
Published: 2023-03-20 03:02:35

## Introduction

When designing an API, security is a critical consideration. The OpenAPI specification provides several options for defining API security. In this post, we'll take a deep dive into the different security options available in the OpenAPI specification and how to document them.

## API Security Options

There are several API security options available in the OpenAPI specification:

## HTTP Authentication

HTTP authentication is a common method of API security. The OpenAPI specification supports two types of HTTP authentication: Basic and Digest.

To define HTTP authentication in your OpenAPI specification, you need to use the `securitySchemes` object. Here's an example of how to define basic authentication:

```yaml
securitySchemes:
  basicAuth:
    type: http
    scheme: basic
```

You can then reference this security scheme in your API paths and operations using the `security` property:

```yaml
security:
  - basicAuth: []

```

## API Keys

API keys are a simple and effective way to secure your API. To use API keys, clients must send an API key with each API request.

To define API keys in your OpenAPI specification, you need to use the `securitySchemes` object. Here's an example of how to define an API key security scheme:

```yaml
securitySchemes:
  api_key:
    type: apiKey
    name: api_key
    in: header
```
You can then reference this security scheme in your API paths and operations using the `security `property:

```yaml
security:
  - api_key: []

```

## OAuth2

OAuth2 is a widely-used standard for authorization. The OpenAPI specification supports several OAuth2 grant types, including authorization code, implicit, password, and client credentials.

To define OAuth2 in your OpenAPI specification, you need to use the `securitySchemes`object. Here's an example of how to define an OAuth2 security scheme:

```yaml
securitySchemes:
  oauth2:
    type: oauth2
    flows:
      password:
        tokenUrl: https://example.com/token
        scopes:
          read: Grants read access
          write: Grants write access
```

You can then reference this security scheme in your API paths and operations using the `security` property:

```yaml
security:
  - oauth2: ['read', 'write']

```

## Conclusion

In this post, we've taken a deep dive into the different API security options available in the OpenAPI specification. We've covered HTTP authentication, API keys, and OAuth2. By understanding these security options and how to document them in your OpenAPI specification, you can create secure and reliable APIs that meet the needs of your users.
How To Create A Mobile App Using Vite, Vue and Ionic Capacitor - Firebase SignIn & SignOut with Firebase Authentication Emulator
Tags: firebase, vue, ionic, vite
Published: 2023-03-20 02:46:22

In the [previous video](https://www.youtube.com/watch?v=YUbh1zTJW3A) we setup and configured firebase emulator for [Firebase Firestore](https://firebase.google.com/docs/firestore/), in this video tutorial, we'll show you how to integrate [Firebase](https://firebase.google.com/docs) Authentication into a Vite, Vue, and Ionic Capacitor mobile app. You'll learn how to set up Firebase Authentication and the Firebase Authentication emulator to secure access to your app's collections. We'll also demonstrate how to use the router to create an application flow that requires users to sign in before accessing protected pages.

{% youtube https://youtu.be/kowZt0HoUCU %}

Specifically, you'll learn:
- How to add Firebase Authentication to a Vite, Vue, and Ionic Capacitor mobile app
- How to create basic Firebase rules to allow only authenticated users access to collections
- How to use the router to create an application flow that requires user authentication
- How to redirect users to the sign-in page when attempting to access protected pages without authentication

Whether you're new to mobile app development or experienced with Vue and [Ionic Capacitor](https://capacitorjs.com/), this tutorial is perfect for anyone looking to add Firebase Authentication to their mobile app.

I have used [Firebase](https://firebase.google.com/docs) in the past and it is awesome!! Using the emulator makes it easier to quickly iterate, test and reset your data all on your local machine.

This is just the next step in fully integrating Firebase, VueFire, and Pinia in upcoming videos in this series

The [Firebase Local Emulator Suite](https://firebase.google.com/docs/emulator-suite/install_and_configure) can be installed and configured for different prototype and test environments, anything from one-off prototyping sessions to production-scale continuous integration workflows.

[Ionic Capacitor](https://capacitorjs.com/) is an open-source native runtime for building Web Native apps. Create cross-platform iOS, Android, and Progressive Web Apps with JavaScript, HTML, and CSS.

[Vite](https://vitejs.dev/) is a build tool that aims to provide a faster and leaner development experience for modern web projects. It consists of two major parts: A dev server that provides rich feature enhancements over native ES modules, for example extremely fast Hot Module Replacement (HMR), and a build command that bundles your code with Rollup, pre-configured to output highly optimized static assets for production.

### Series Playlist 
[Playlist In YouTube](https://www.youtube.com/playlist?list=PL2PY2-9rsgl1qJS3CBrbJxmbLBDBa2E1x)