teleren/devto huggingface dataset:
Learn SwiftUI (Day 16/100)
Tags: swift
Published: 2024-05-02 19:38:40

## Basic Structure

```swift
struct ContentView: View {
    var body: some View {
        VStack {
            Image(systemName: "globe")
                .imageScale(.large)
                .foregroundStyle(.tint)
            Text("Hello, world!")
        }
        .padding()
    }
}
```

## Form

```swift
    NavigationStack {
        Form {
            Section {
                Text("Hello World")
            }
            Section {
                Text("Hello SwiftUI")
            }
        }
        .navigationTitle("Settings")
        .navigationBarTitleDisplayMode(.inline)
    }
```

## Change state

```swift
    @State private var clicked = 0
    var body: some View {
        Button("You have clicked \(clicked) times") {
            self.clicked += 1
        }
    }
```

## 2-way binding

Notice the `$name` here:
```swift
    @State private var name = ""
    var body: some View {
        Form {
            TextField("Your name:", text: $name)
            Text(name.count != 0 ? "Hello, \(name)": "")
        }
    }
```

## Create view in a loop

```swift
    var body: some View {
        Form {
            ForEach(0..<50) {
                Text("Hello \($0+1)")
            }
        }
    }
```
4 reasons why to start freelancing 👇
Tags: freelancing, softwarecompany, entrepreneurship, webdev
Published: 2024-05-02 19:25:58

---
title: 4 reasons why to start freelancing 👇
published: true
description: From freelancer to software company, what does it take to start?
tags: freelancing,softwarecompany,entrepreneurship,webdevelopment
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9nifeynxloe901atwls5.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2024-05-18 20:45 +0000
---

##One thing leads to another##

The first business I had was building computers for friends, this gave me the knowledge and experience to move onto being a freelance software engineer.

##I met some great software engineers, that thought me a lot##

Not just the tech and how to be a better software engineer but also what it takes to service clients and deliver quality.

##Travel & meet clients from all around the world##

The older I get the more I realise how it's the experiences that make my life more "rich" and there is nothing better than travelling and meeting new clients.

##New opportunities to set-up new businesses##

Along the way I met individuals that have expressed interest in setting up a new business and opens new doors for you to experience.

I share more about my story on a podcast I was on recently where we discussed the following topics:

1. Starting your own freelance business   
2. Remote work   
3. Getting your first client   
4. What does it take to run a software company   
5. Burn out and how to "avoid" it   
6. How we need to do more to inspire future solopreneur    

Link in the comments


I hope it inspires you to reach for the skies (cheesy i know, but its true 😄) 


P.s. It's been a while Dev.to community, keep coding, keep nerding!
Computer Vision Meetup: Making LLMs Safe & Reliable
Tags: computervision, machinelearning, ai, datascience
Published: 2024-05-02 18:58:54

Large language models show impressive capabilities, but ensuring their safe and reliable deployment remains challenging. This talk will cover evaluation techniques to assess and improve LLM reliability across key vectors like groundedness and faithfulness. It will also explore detecting vulnerabilities to attacks like prompt injection and PII leaks. Attendees will learn how to build custom evaluations tailored to their use cases.

Speaker: [Shiv Sakuja](https://www.linkedin.com/in/shivsakhuja/) is a former Google engineer, and co-founder of Athina AI, an LLM observability and evaluation platform that helps developers safeguard LLMs in production.

Not a Meetup member? Sign up to attend the next event:

https://voxel51.com/computer-vision-ai-meetups/

Recorded on May 2, 2024 at the AI, Machine Learning and Data Science Meetup.
Shadcn UI: A Developer's Delight (My Experience)
Tags: webdev, javascript, programming
Published: 2024-05-02 18:50:48

Let me start by admitting this: I'm always on the lookout for new UI libraries that can streamline my development process. Recently, I stumbled upon a gem called Shadcn UI, and let me tell you, it's been a game-changer.

This wasn't just another "try it out" situation. I actually used Shadcn UI for a recent project, and it quickly became my go-to library. Here's why I was so impressed

## Beautiful by Default

Shadcn UI boasts a collection of pre-built components that are not only functional but also aesthetically pleasing. From buttons and forms to cards and modals, everything is designed with a modern and clean look. This saved me tons of time crafting UI elements from scratch, and the visual consistency across the components made my project look polished.

## Easy to Use (Seriously)

![shadcn/UI](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/a3mataitt80n3p4z0uw5.png)

One of the biggest things I look for in a UI library is ease of use. Shadcn UI delivers in spades.  The components are well-documented, and integrating them into my project was a breeze.  They even have a philosophy of "copy and paste" –  components are designed to be easily integrated with minimal fuss. This intuitive approach made development smooth and efficient.

## Customization FTW

![shadcn](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f4a1lcrv4wfktyvky1m4.png)
Don't get me wrong, the default styles are great, but Shadcn UI understands that developers like a little control. The library offers a good range of customization options, allowing me to tweak the look and feel of the components to perfectly match my project's brand identity.

## Open Source Goodness
As an open-source enthusiast, I was happy to see that Shadcn UI is freely available. This not only makes it accessible but also fosters a strong community around the library. There's a wealth of resources available online, including tutorials and additional component collections built on top of Shadcn UI.

## Beyond the Basics
While Shadcn UI excels in providing pre-built components, it goes a step further.  The library offers tools like form builders and pricing page generators that streamline specific development tasks. These extras were a welcome surprise and definitely helped me accelerate development.

## Overall Experience
My experience with Shadcn UI has been fantastic. It's a well-designed, easy-to-use library that offers a great balance of beautiful aesthetics, customization options, and developer-friendly features. Whether you're a seasoned developer or just starting out, Shadcn UI is definitely worth checking out. It can save you time, improve your workflow, and help you build stunning UIs.

You can access shadcn/UI using the following links.
[Official Site](https://ui.shadcn.com/)
[Github Repo](https://github.com/shadcn-ui/ui)

> Have you tried Shadcn UI? Share your thoughts in the comments below!
Computer Vision Meetup: Develop a Legal Search Application from Scratch using Milvus and DSPy!
Tags: computervision, machinelearning, ai, datascience
Published: 2024-05-02 18:48:58

Legal practitioners often need to find specific cases and clauses across thousands of dense documents. While traditional keyword-based search techniques are useful, they fail to fully capture semantic content of queries and case files. Vector search engines and large language models provide an intriguing alternative. In this talk, I will show you how to build a legal search application using the [DSPy framework](https://github.com/stanfordnlp/dspy) and the [Milvus](https://milvus.io/) vector search engine.

Speaker: [Mert Bozkir](https://www.linkedin.com/in/mertbozkir/) is a self-taught ML Engineer with a passion for Developer Relations.

Not a Meetup member? Sign up to attend the next event:

https://voxel51.com/computer-vision-ai-meetups/

Recorded on May 2, 2024 at the AI, Machine Learning and Data Science Meetup.
Elixir Days - Evento presencial em São Paulo
Tags: elixir, erlang
Published: 2024-05-02 18:46:40

Vai acontecer nos dias 25 e 26 de maio de 2024, em São Paulo, a conferência Elixir Days. Serão dois dias para celebrar com a comunidade brasileira de Elixir reunindo palestrantes nacionais e internacionais!

Clique no linl para saber mais <https://bit.ly/ElixirDays2024>

e clique em <https://bit.ly/ElixirDays> para comprar ingresso. Com o cupom ELIXIREMFOCO você consegue 15% de desconto.
Discover the Timeless Beauty of Diamond Stud Earrings, Sparkling Cubic Zirconia, and Convenient Lever Backs
Published: 2024-05-02 18:35:05

## INTRODUCTION:
Earrings hold a special place in the hearts of many, serving as personal statements of style and **_[grace jewlery](https://diamondveneer.com/)_**. Among the vast array of options, three classics stand out: diamond stud earrings, cubic zirconia studs, and lever back earrings. Let's dive into the world of these timeless beauties, each with its own charm.

## Diamond Stud Earrings:
Diamonds are a symbol of eternal elegance, captivating hearts with their natural allure. Diamond stud earrings embody this elegance, adding a touch of luxury to any outfit. Whether it's a simple solitaire or a more intricate design, diamond studs never fail to shine bright, effortlessly elevating your look from day to night.

What's so wonderful about diamond studs is their versatility. They can complement a casual jeans-and-tee ensemble or add a dash of glamour to a sophisticated gown. Plus, they hold sentimental value, becoming cherished heirlooms passed down through generations, each one telling its own story.

## Cubic Zirconia Stud Earrings:
If you adore the sparkle of diamonds but prefer a more budget-friendly option, cubic zirconia studs earrings are your perfect match. These gems are crafted to mimic the brilliance of natural diamonds, offering a glamorous look without the hefty price tag. With their flawless clarity and dazzling sparkle, cubic zirconia studs are a beautiful choice for anyone who loves to shine.

Cubic zirconia studs come in various shapes and sizes, allowing you to express your style effortlessly. Whether you opt for a classic round shape or a trendy halo design, these earrings are sure to turn heads wherever you go. And the best part? You can indulge in luxury without worrying about breaking the bank.

## Lever Back Earrings:
Now, let's talk about lever back earrings – the unsung heroes of earring closures. These earrings feature a unique hinged lever that provides extra security and comfort, ensuring they stay in place all day long. Whether you're running errands or hitting the dance floor, you can trust that your lever back earrings will stay put.

Lever back earrings come in a variety of styles, from minimalist designs to bold statement pieces. Whether you prefer sleek metals or sparkling gemstones, there's a pair of lever back earrings for everyone. They're not just stylish; they're practical too, making them a favorite among those who value both fashion and function.

In conclusion, diamond stud earrings, cubic zirconia studs, and lever back earrings each have their own special charm. Whether you're drawn to the timeless allure of diamonds, the affordable luxury of cubic zirconia, or the practicality of lever back closures, these earrings are sure to add a touch of elegance to your everyday style.
chat heap minchild
Published: 2024-05-02 18:17:46



Para modificar la implementación para que tout() extraiga el elemento más pequeño en lugar del más grande, necesitas ajustar la lógica en la función maxChild() y en el bucle while dentro de tout().

Aquí hay una forma de hacerlo:

En la función maxChild(), en lugar de buscar el hijo con el mayor valor, debes buscar el hijo con el menor valor.
En el bucle while dentro de tout(), en lugar de comparar a[i] con a[maxChild(i)], debes comparar a[i] con el hijo más pequeño.
Aquí tienes los cambios necesarios en tu código:

```
int heap::maxChild(int i) {
    assert(i <= parent(s-1));

    if (right(i) >= s) return left(i);
    if (a[left(i)] < a[right(i)]) { // Cambiado de '>' a '<' para buscar el hijo más pequeño
        return left(i);
    } else {
        return right(i);
    }
}

int heap::tout() {
    assert(!empty());

    int x = a[0];
    int i = 0;
    a[0] = a[--s]; // Decremento de s después de asignar el último elemento al principio
    while (i <= parent(s) && a[i] > a[minChild(i)]) { // Cambiado de '<' a '>' para buscar el hijo más pequeño
        int m = minChild(i); // Cambiado a minChild
        int c = a[i];
        a[i] = a[m];
        a[m] = c;
        i = m;
    }

    return x;
}

```
WD101-Blog
Published: 2024-05-02 18:03:55


## Myself

Hello, my name is Ben Ono.
I was born in the US and came to Japan when I was 3 years old.
I have a wife and 18month old daughter, and I live in canada with my hole family.
I looooove my daughter and taking picture of my daughter is my currently hobby.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8jies4c8kjzanylfj9gr.JPG)





My hobbies include movies and comic books.
I like action movies such as the Fast & Furious series and thrilling crime movies such as Ocean's and Now You See Me.
I also really like movies directed by Christopher Nolan. Memento, Tenet, etc. are very wonderful with their use of time trick.

I also like to travel. When I was a university student, I drove around Japan and often traveled abroad.


I worked as a Software Engineer in Japan for 5 years.
I have experience with Vue.js, Node.js, Golang, Python, Java, Javascript etc..
I have experience in both front-end and back-end, but I prefer back-end.

## Expectations for this course
I expect this course to provide me with an comprehensive knowledge of web development.
I would also like to actively contact a career advisor to get training and advice on how to pass job interviews in English.


## How was your experience with the course so far (first week)
It was interesting to relearn basic knowledge in English.

## Goals after the course

Through this course, I will improve my skills as an engineer and aim to get a job in Canada. ( and high salary )
I also hope to make more connections and friends working as an engineer.

Shared With: Risa
205. Isomorphic Strings
Tags: php, leetcode, algorithms, programming
Published: 2024-05-02 18:02:43

205\. Isomorphic Strings

Easy

Given two strings `s` and `t`, _determine if they are isomorphic_.

Two strings `s` and `t` are isomorphic if the characters in `s` can be replaced to get `t`.

All occurrences of a character must be replaced with another character while preserving the order of characters. No two characters may map to the same character, but a character may map to itself.

**Example 1:**

- **Input:** `s = "egg", t = "add"`
- **Output:** `true`

**Example 2:**

- **Input:** `s = "foo", t = "bar"`
- **Output:** `false` 

**Example 3:**

- **Input:** `s = "paper", t = "title"`
- **Output:** `true` 

**Constraints:**

- <code>1 <= s.length <= 5 * 10<sup>4</sup></code>
- <code>t.length == s.length</code>
- `s` and `t` consist of any valid ascii character.

**Follow-up:** Can you come up with an algorithm that is less than <code>O(n<sup>2</sup>)</code> time complexity?

**Solution:**

```
class Solution {

    /**
     * @param String $s
     * @param String $t
     * @return Boolean
     */
    function isIsomorphic($s, $t) {        
        $last_seen_s = array_fill(0, 256, 0);
        $last_seen_t = array_fill(0, 256, 0);
        
        foreach (array_map(null, str_split($s), str_split($t)) as $index => [$char_s, $char_t]) {
            $index += 1;
            $ascii_s = ord($char_s);
            $ascii_t = ord($char_t);
            
            if ($last_seen_s[$ascii_s] != $last_seen_t[$ascii_t]) {
                return false;
            }
            
            $last_seen_s[$ascii_s] = $last_seen_t[$ascii_t] = $index;
        }
        
        return true;
    }
}
```


**Contact Links**

- **[LinkedIn](https://www.linkedin.com/in/arifulhaque/)**
- **[GitHub](https://github.com/mah-shamim)**
58. Length of Last Word
Tags: php, leetcode, algorithms, programming
Published: 2024-05-02 18:02:09

58\. Length of Last Word

Easy

Given a string `s` consisting of words and spaces, return the length of the **last** word in the string.

A **word** is a maximal substring[^1] consisting of non-space characters only.


**Example 1:**

- **Input:** `s = "Hello World"`
- **Output:** `5`
- **Explanation:** `The last word is "World" with length 5.`

**Example 2:**

- **Input:** `s = "   fly me   to   the moon  "`
- **Output:** `4`
- **Explanation:** `The last word is "moon" with length 4.`

**Example 3:**

- **Input:** `s = "luffy is still joyboy"`
- **Output:** `6`
- **Explanation:** `The last word is "joyboy" with length 6.`



**Constraints:**

- `1 <= s.length <= 104`
- `s` consists of only English letters and spaces ` `.
- There will be at least one word in `s`.

[^1]: **Substring** `A substring is a contiguous non-empty sequence of characters within a string.`

**Solution:**

```
class Solution {

    /**
     * @param String $s
     * @return Integer
     */
    function lengthOfLastWord($s) {
        $length = 0;
        for ($i = strlen($s) - 1; $i >= 0; $i--) {
            if ($s[$i] == ' ') {
                if ($length) {
                    break;
                }
            } else {
                $length += 1;
            }
        }
        return $length;
    }
}
```


**Contact Links**

- **[LinkedIn](https://www.linkedin.com/in/arifulhaque/)**
- **[GitHub](https://github.com/mah-shamim)**
2441. Largest Positive Integer That Exists With Its Negative
Tags: php, leetcode, algorithms, programming
Published: 2024-05-02 18:01:28

2441\. Largest Positive Integer That Exists With Its Negative

Easy

Given an integer array `nums` that **does not contain** any zeros, find **the largest positive** integer `k` such that `-k` also exists in the array.

Return _the positive integer `k`. If there is no such integer, return `-1`_.

**Example 1:**

- **Input:** nums = [-1,2,-3,3]
- **Output:** 3
- **Explanation:** 3 is the only valid k we can find in the array. 

**Example 2:**

- **Input:** nums = [-1,10,6,7,-7,1]
- **Output:** 7
- **Explanation:** Both 1 and 7 have their corresponding negative values in the array. 7 has a larger value.

**Example 3:**

- **Input:** nums = [-10,8,6,7,-2,-3]
- **Output:** -1
- **Explanation:** There is no a single valid k, we return -1.

**Constraints:**

- <code>1 <= nums.length <= 1000</code>
- <code>-1000 <= nums[i] <= 1000</code>
- <code>nums[i] != 0</code>

**Solution:**

```
class Solution {

    /**
     * @param Integer[] $nums
     * @return Integer
     */
    function findMaxK($nums) {
        $ans = -1;
        $seen = [];

        foreach ($nums as $num) {
            if (in_array(-$num, $seen)) {
                $ans = max($ans, abs($num));
            } else {
                array_push($seen, $num);
            }
        }

        return $ans;
    }
}
```


**Contact Links**

- **[LinkedIn](https://www.linkedin.com/in/arifulhaque/)**
- **[GitHub](https://github.com/mah-shamim)**
Hiring for unknown future
Tags: startup, hiring, cto
Published: 2024-05-02 17:49:32

Originally, this post was published here: https://www.linkedin.com/pulse/hiring-unknown-future-andrew-panfilov-p5hff/

 Hiring for a startup presents unique challenges compared to hiring for an established company. Established companies generally have stable operations, products, organizational structures, and cultures. In contrast, startups are dynamic, constantly evolving entities. The organizational structure that was effective six months ago in a startup might already be outdated, necessitating continual adaptation and reorganization. This dynamic nature adds complexity to the hiring process.

A startup's future is often unpredictable and filled with "unknown unknowns." Specialists hired for specific roles may find their skills obsolete or less relevant by the time they are onboarded and ready to contribute due to the fast-paced changes in the startup's needs.

Hiring individuals with previous startup experience can be beneficial. They are likely to be adaptable and experienced in navigating rapidly changing environments. Similarly, diversity in the team can be an advantage, bringing a range of experiences and perspectives that might be critical in unforeseen situations.

Inexperienced but high-potential employees can also be valuable in a startup. Their lack of preconceived notions about what is possible or impossible can lead to innovative solutions to problems that more experienced professionals might find daunting or unsolvable.

A critical aspect of hiring in a startup is ensuring the alignment of values between the founders and potential employees. Skills and knowledge are essential, but if an employee's values don't align with those of the founders, it can lead to significant problems, outweighing the employee's benefits. As such, founders should be deeply involved in hiring, especially in the early stages. This involvement is crucial to maintaining the startup's culture and values, as each management level tends to hire individuals similar to themselves. Misalignment at the higher levels (like C-Suite or VP-Level) can propagate through the organization, potentially leading to internal conflicts that could jeopardize the startup.

For founders, discerning a candidate's calibre is paramount. In a startup's early stages, hiring high-calibre individuals is incredibly crucial. While luck plays a role in success, it cannot be planned or programmed.

Fortunately, the current job market favours employers. A large pool of talented and suitable candidates is available, unlike a few years ago when the market was more candidate-driven.
Open sourcing Octo STS
Published: 2024-05-02 17:40:57

Credential leaks are one of the most common ways systems are compromised, the 2024 Verizon Data Breach Report found that 31% of all breaches over the past 10 years have involved the use of stolen credentials, and long-lived credentials are at the heart of that. To eliminate our need for long-lived credentials, we created and published a GitHub Application Octo STS.

‍

Octo STS is a “Security Token Service” (STS) for GitHub credentials. The idea of an STS is largely inspired by the cloud providers like AWS and GCP, but other services have them too, including Chainguard. An STS exchanges a short-lived third-party token for a short-lived first-party token, after checking that the caller has permission to make the exchange.

‍

Our previous post where we talk about our solution to solving this problem seems to have struck a chord, and the outreach and interest we have received has been nothing short of incredible.

‍

We have heard a lot of: “We absolutely need something like this,” or, “We built something like this ourselves.”

‍

Also very understandably, we have had folks express skepticism about the level of permissions that the app needs, as we called out in our previous post:

‍

‍

To address all of these, today we are happy to announce that we are open sourcing Octo STS. This repository contains all of the source code for Octo STS, as well as the infrastructure as code we use to deploy and monitor it.

‍

For folks building something similar: let’s collaborate and build something better together. We have already gotten some fantastic ideas from folks in some of the discussions spurred by our previous post. If you are interested in collaborating, reach out to us.

‍

For folks that want to adopt this, but are unsure about the permissions: this new repository will let you see what we are doing, as well as allow your team to host and manage its own instance.

We are currently building a Chainguard Image for Octo-STS and will share more about that once it is available. If you are interested in receiving updates on the availability of that image, reach out.

[Original post](https://www.chainguard.dev/unchained/open-sourcing-octo-sts)