teleren/devto huggingface dataset:
Atomic sync blocks in Swift
Tags: technology, ios, swift
Published: 2024-01-14 21:59:28

---
title: Atomic sync blocks in Swift
published: true
date: 2024-01-08 07:00:00 UTC
tags: Technology,ios,Swift
canonical_url: https://easyblunders.wordpress.com/2024/01/08/atomic-sync-blocks-in-swift/
---

_We will access state from different threads synchronously and do it in a safe manner. That must be easy!_

When considering concurrent access to data (a.k.a. state, a.k.a. variables) in Swift, from different threads, the usual practice is to use [Structured Concurrency](https://docs.swift.org/swift-book/documentation/the-swift-programming-language/concurrency) or [Grand Central Dispatch](https://developer.apple.com/documentation/DISPATCH) (Dispatch Queue, anyone?). Combine and other reactive frameworks also provide support. But there’s a catch. These are all asynchronous APIs, meaning that if I call it now, I’ll get results sometimes later. What if I need the result now and continue some logic based on it? What if I don’t use async/await tasks everywhere yet?

Well, Dispatch Queues have also `.sync()` method, but from experience it’s best to avoid it. We don’t always have the luxury of knowing which Dispatch Queue we’re currently running on and calling `.sync()` on the same queue is a certain death (or deadlock).

Certainly, the code can and should be restructured to run asynchronously if thread safety is needed. We should rewrite our codebases towards modern approaches. Rainbows and unicorns await those who always do all the right things. Using Structured Concurrency or GCD is still the best practice, no doubt about it. But sometimes we just need that sync block in our test or a routine already running in background and we’re willing to wait for it. Can we make it happen, please?

Yes, we have [OSAllocateUnfairLock](https://developer.apple.com/documentation/os/osallocatedunfairlock) (iOS 16+) or [NSRecursiveLock](https://developer.apple.com/documentation/foundation/nsrecursivelock) (iOS 2+) at our disposal. Use them as mutexes to guard a critical section:

```
let myLock = OSAllocatedUnfairLock()
myLock.withLock {
    consistentState1 = "Some"
    consistentState2 = "information"
}
```

```
import Foundation

let myLock = NSRecursiveLock()

func changeState1(_ value: String) {
    myLock.lock()
    consistentState1 = value
    myLock.unlock()
}

myLock.lock()
changeState1("Some")
consistentState2 = "information"
myLock.unlock()

```

Also, there’s a [great summary](https://swiftrocks.com/thread-safety-in-swift) of available thread safety tools by SwiftRocks.
How to distinguish which HTML tag has to close tag or Not?
Published: 2024-01-08 06:56:47

If any HTML element doesn't have any content inside them then it will not have a closing tag.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tsbprhr0hd5nd34dw4wf.png)
For Example image tag will not contain any content inside it that's why it doesn't have a closing tag.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fs9hp0czuhgaotcjfvyg.png)
The paragraph tag will have content that's why it has a closing tag.

I am a Web Developer & enjoy working on challenging projects, which is what makes this job so rewarding. You can reach out to my [My Portfolio Site](https://gauravweb.dev/). I hope this article will helpful
Logto: Free Open Source Identity Infrastructure for Developers
Tags: opensourcesoftwares, elestio, logto
Published: 2024-01-08 16:41:21

---
title: Logto: Free Open Source Identity Infrastructure for Developers
published: true
date: 2024-01-08 06:49:01 UTC
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wfvk1d24hcn3ddxglurw.jpg
tags: Opensourcesoftwares, Elestio, Logto
canonical_url: https://blog.elest.io/logto-free-open-source-identity-infrastructure-for-developers/
---

Empower your projects with [Logto](https://elest.io/open-source/logto?ref=blog.elest.io), the ultimate free open-source identity infrastructure tailored for developers. Say goodbye to the complexities of authentication and authorization, and welcome a seamless, modern solution.

<iframe width="200" height="113" src="https://www.youtube.com/embed/h-p2L8z6XEM?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen title="Logto: Free Open Source Identity Infrastructure for Developers"></iframe>
_Watch our Logto platform overview_

## **Add login, signup, and forgotten password to your projects**

Logto simplifies your development journey by offering a spectrum of user authentication options, from passwordless to multi-factor authentication (MFA). Elevate user experiences with ready-to-use UI components that include email and SMS passwordless logins, social sign-ins, and more.

## **Business authentication**

Catering to consumer and SaaS app builders, Logto streamlines customer sign-ups and retention. Its versatile features, including webauth (passkey), machine-to-machine, and branding customization, allow you to tailor the authentication process to your business needs.

## **Branding and customization**

Take control of your app's identity with Logto's branding and customization capabilities. Craft a unique and consistent brand experience through customized UI elements, ensuring your users feel at home with your application.

## **User, roles, and permissions**

Logto goes beyond authentication, providing robust authorization and user management tools. From API RBAC to organization multi-tenancy, Logto offers a comprehensive suite to meet diverse requirements, fostering efficient user and organization management.

## **Conclusion**

Designed for the modern era, Logto prioritizes an excellent developer experience, supporting various frameworks and platforms. With a powerful management API, detailed docs, and SDK examples, Logto empowers developers to seamlessly integrate identity infrastructure into their projects. Grow and scale with trust and security, backed by Logto's open-standard nature.

From proof of concept to managing multiple products, Logto is your go-to solution for reliable identity infrastructure.

[Deploy your fully managed Logto instance on Elestio.](https://elest.io/open-source/logto?ref=blog.elest.io)and
"Unveiling Excellence: Beetle Media Group's Digital Marketing Mastery"
Tags: digitalmarketing, seo
Published: 2024-01-08 06:37:55

Beetle Media Group is [Mohali's premier digital marketing agency](https://beetlemediagroup.com/), renowned for its innovative strategies and impactful campaigns. With a dynamic team of experts, they specialize in elevating brands through cutting-edge SEO, social media management, web design, and content creation. Their client-centric approach and proven track record make them a go-to choice for businesses seeking unparalleled online visibility and growth. Beetle Media Group stands out for its commitment to delivering tailored solutions that drive measurable results, setting benchmarks in the realm of digital marketing in Mohali.
The WWCode Days of Code Challenge
Tags: programming, coding, codingchalle, consistency
Published: 2024-01-08 06:33:10

Staying consistent might not be easy at the start. Here's a challenge by #WomenWhoCodeAccra to help you stay on track.

✨ Join Women Who Code and our community of coders to level up your skills during our online Days of Code Challenge! Learn at your own pace with our fun, supportive community. Sign up starting today to begin the challenge on Monday, January 8th. ✨

The WWCode Days of Code Challenge is hosted by the WWCode Technical Track communities and is an ongoing, self-directed and self-paced learning experience that will allow you to start the New Year with a commitment to level up your skills!

Finding time to work on your skills or projects — or going at it alone — can be challenging. The WWCode Days of Code Challenge will give you the space and encouragement to improve your skills, finish projects, help other coders and learn from other technologists.

👩‍💻 Who this challenge is for:

Any technologist who wants to work on their coding skills in a supportive, interactive community.
All learning and coding levels.
All tech stacks.
💖 Why you should join:

Flexibility: Learn and work online at your own pace and level — and in your own tech stack.
Community: Meet, learn from, and mentor other coders who share your passion for tech.
New Year, New You: Start the New Year strong by building your network and knowledge to help you excel in your career in 2024!
📅 Join Today to Begin the Challenge Monday, January 8th

The challenge will happen online. Here’s how to join:

Register for the challenge on Hopin.
Attend the Opening Ceremony on January 8th at 11:00 AM EST, or access the recording afterwards, to learn all about how to participate in the program.

Start the challenge on Monday, January 8th (or your chosen start date)!
Code every day for your selected number of days — 7, 14, 30, 60, or 100.
Share your progress with the community at least once per week.
We look forward to learning with you!
ISTILAH CODING MENURUT SAYA
Tags: webdev, coding, code, programming
Published: 2024-01-08 06:30:53


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

Menurut kamu, selain itu apa lagi nih?😮

Yuk belajar bareng serta diskusi dikolom komentar, serta di save biar ga lupa💬😝

🌱Follow : @appardana
💭Stay Young, Be Innovative and Keep Learning

#coding #programmer #code #Content #Tips #Trick #Knwoledge #Management #CSS #React #ReactJS #Frontend #JustifyContent #Javascript #Phyton #C #Web #Skills #IT #Backend #Developer #Roadmap #SelfImprovement #Growth #Aditria #Pardana #AditriaPardana #appardana #iAppTech ⚛️💻


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f3ezjogsg0rr0t37tlbl.jpg)
Ağ Sanallaştırma ve overlay protokoller
Tags: vxlan, geneve, gre, network
Published: 2024-01-08 06:17:11

Geleneksel bilgisayar ağları altyapısında ağ bölümleme (segmentasyon) için standart bir şekilde VLAN yani "Sanal Yerel Alan Ağı" kullanılmaktadır. İlgili yapı OSI 2. katmanda çalışmaktadır ve aslında ağ cihazlarındaki portlar vasıtasıyla, ağa bağlı cihazların mantıksal olarak gruplandırılmasını sağlar. VLAN'ın bir çok yararı olmasına rağmen yazımız için konumuz bu olmadığından dolayı bu detaylara girmeyeceğim. Sadece bu geleneksel mimariye "underlay network" denildiğini bilmemiz yeterli.

"Overlay network" kavramı ise IP altyapısının hazır olduğu ve altyapıda yer alan underlay ağ'dan izole başka bir ağı temsil etmektedir.

# 1. Overlay protokoller

Overlay ağ üzerinde GRE, VXLAN ve GENEVE başta olmak üzere ortak olarak Katman 2 çerçevelerini Katman 3 IP paketleriyle birlikte kapsüllemesi ve taşınması işlevini oluşturmaktadır. Her ikisi de UDP protokolü ile veri taşımaktadır.

## 1.a. GRE

**GRE** (Generic routing encapsulation), daha sonrasında bahsedeceğimiz VXLAN ve GENEVE'nin aksine ağ oluşturma işlevi için değil, IP ağı üzerinde tünelleme yapmak için kullanılmaktadır. Dolayısıyla noktadan noktaya tünelleme yapmaktadır. Diğer yöntemlerin aksine güvenli bağlantı sağlamak için VPN uygulamalarıyla birlikte kullanılması gerekmektedir. Dolayısıyla genel bir ağ sanallaştırması için tekil kullanılması uygun görülmeyecektir.

## 1.b. VXLAN

**VXLAN** (Virtual Extensible LAN), özellikle geniş bulut ortamlarındaki ağ altyapısının yönetilebilmesi için  VMware, Arista Networks ve Cisco firmalarının girişimleriyle oluşturulmuş bir standarttır. Tabi ki diğer bir çok üretici de bu standartı destekleyerek kullanım alanı oldukça genişlemiştir. VXLAN, VLAN kavramı ile aynı Katman 2 ağ hizmetlerini ağlamak için tasarlanmış olmasına karşın, genişletilebilir yapısı ile daha esnek bir çözüm sunmaktadır. En önemli çözümü VLAN yapısının 4096 bölümleme içermesine karşın VXLAN'ın 16 milyon bölümlemeyi desteklemesi olarak görülebilir.

## 1.c. GENEVE

**GENEVE** (Generic Network Virtualization Encapsulation), ise VMware, Microsoft, Red Hat ve Intel başta olmak üzere yine standart bir şekilde VXLAN'ın bazı eksikliklerini kapatmaktadır. VXLAN'ın başlık (header) uzunluğu 8 Byte iken, GENEVE'de 16 Byte'a çıkmaktadır. Bu başlık verisinde özellikle "protokol identifier" verisi bulunduğu için çoğullama gibi bazı özellikleri kendi içerisinde çözümünü barındırabilmektedir. Ayrıca yine aktarım güvenliği, hizmet zinciri oluşturma ve bant içi telemetri özellikleri GENEVE'in artılarındandır. Bunlara ek olarak VXLAN içerisinde değişken olarak kullanılacak alanlar bulunmamasına karşın GENEVE bu yönden daha geniş veri sunabilmektedir.

# 2. Openstack Neutron

Yukarıda bahsettiğimiz her 3 overlay protokolü de Openstack Neutron ile çalışmaktadır. 

Kaynak: https://docs.openstack.org/neutron/rocky/admin/intro-overlay-protocols.html
Stainless Steel 316L Sheets & Plates Manufacturers
Published: 2024-01-08 06:01:35

Running a
successful business
since 1995
Chhajed Steel & Alloys Pvt. Ltd. is a fast growing industrial supplier providing world class materials of construction for industrial projects ranging from mass producing consumer industries to extreme pressure petrochemical plants.
In our 26 years of existence, our products and supplies have been inspected, accepted and approved by clients, independent inspection agencies and engineering consultants such as Larsen & Toubro Group, Jindal Group, B A R C , Crompton Greaves Ltd , and other renowned players.

Chhajed steel and alloys had supplied the materials to chemical, fertiliser & petrochemical industries, sugar & distillations plants, pump & valve manufacturers, engineering, electrical & cement industries their New project, project expansion, and routine maintenance. Continuous improvements is a way of life. At chhajed our knowledge of international standard & Specifications expertise in workmanship and responsibilities towards our customers which are the Main elements of our mission.
We have very ambitious plan to expand our activities & further building good source for improve Quality and reduce costing with fastest delivery, looking at the huge demand of our product. In the same time we at chhajed are building up quality system in the line of international Standard.
Chhajed steel and alloys is the largest manufacturer, supplier and stockist of plates to various countries like saudi arabia, kuwait, qatar, oman, yemen, uae, iran, turkey, kazakhstan, greece, Singapore, thailand, indonesia, vietnam, south africa, south america, brazil, india and australia, and Egypt.
Chhajed steel and alloys was based on the theory of continually perceiving the requirements of its Clients and understanding that quality, on-time conveyance, cost and client benefit are vital to it Achievement. We can redraw plates for clients that require uncommon plate sizes or Particular tempers for their application
I built an open source web calendar inspired by the Google calendar
Tags: webdev, frontend, javascript, opensource
Published: 2024-01-08 06:10:52

**Shameless plug coming right up**

Hi everyone. My name is Tom, and I’ve done it again.

“Ok?” You might think. “I don’t know you. What have you done?”

For some reason, I have become very fond of building web calendars. As a matter of fact, I’ve spent some time almost every day for the past two years doing so. For my third stab at building a calendar, I decided to lean heavily on the Material Design 3 specification. I did my research. Studied the Google calendar and a few other similar ones. Then I coded. The result:

https://schedule-x.dev

Happy to receive feedback of any kind, good or bad.
What to Look for When Buying Computer Memory for Your PC
Published: 2024-01-08 06:04:53

In the world of PC parts, choosing the right computer memory is a pivotal decision that directly impacts your system's performance. As you start on the journey to [buy computer memory](https://bulkdevices.co.uk/memory), understanding key factors becomes essential to make an informed purchase and optimize your PC's capabilities.

1. Compatibility is Key
Before diving into the vast array of options, check the compatibility of the computer memory with your motherboard. Different motherboards support specific types of RAM (Random Access Memory) and have limitations on the total amount that can be installed. Confirm the type (DDR3, DDR4, etc.) and maximum capacity your motherboard can handle.

2. Consider Your Usage Needs
The type of computer memory you choose should align with your usage requirements. If you're into gaming, video editing, or other resource-intensive tasks, opting for higher-capacity RAM with faster speeds can significantly enhance your system's performance. For everyday tasks, a standard configuration might suffice.

3. Speed Matters, But Balance is Key
The speed of your computer memory, measured in MHz, influences how quickly data can be accessed. While faster RAM speeds can boost performance, the benefits may not be as noticeable in all scenarios. Strive for a balanced approach that considers your budget and the overall capabilities of your computer parts.

4. CAS Latency and Timings
CAS latency (Column Address Strobe) and timings are additional factors that impact memory performance. Lower CAS latency and tighter timings generally result in better responsiveness. However, finding the perfect balance between speed, capacity, and timings is crucial to ensure optimal performance within your budget.

5. Brand Reputation and Reviews
When it comes to buying computer memory or any PC parts, the reputation of the brand matters. Opt for well-established brands known for reliability and customer satisfaction. Reading reviews from other users can provide valuable insights into the real-world performance and reliability of specific memory modules.

In conclusion, buying computer memory involves more than just looking at capacity and price. Understanding the compatibility, considering your usage needs, balancing speed with budget, paying attention to CAS latency and timings, and trusting reputable brands are all critical aspects of making an informed decision.

As you delve into the world of [PC components](https://bulkdevices.co.uk/), remember that your computer memory is an investment in the overall performance and efficiency of your system. By being mindful of these factors, you can confidently choose the right memory modules that align with your PC's unique requirements. Happy upgrading!
How To Properly Do a Link Exchange (Google-Proof Method)
Published: 2024-01-08 06:02:13

As the character Caesar once said in the War for the Planet of the Apes: “Apes strong together”. The same can be said for brands and websites.

You have a better chance of increasing your online presence and reach by working with other brands than against them.

One way to collaborate with other brands, content creators, and websites is through link exchanges—an indispensable part of the modern-day SEO landscape.

The following guide will explore what they are, how you can use them to improve your SEO ranking, and more. Without further ado, let’s jump into the nitty gritty.

What is a Link Exchange?
Link exchange (aka link swapping) is an agreement between two (or more) websites to link to each other’s content (cross-linking).

This is in contrast to one-way links where one website links to content on a high-authority website’s content without reciprocation.    

A link exchange essentially creates a symbiotic relationship that helps both parties, allowing them to improve their engagement, boost their online authority, and advance their search engine rankings.

At least 73% of all websites use link exchanges in some capacity.    

While the concept seems straightforward enough, it isn’t completely safe. As benign and well-meaning as it may seem (in some cases), link-sharing can backfire and potentially leave your website blacklisted. But why?

Google’s Stance on Link Swapping
Search Engine providers such as Google are well aware of black hat SEO tactics used to increase page rankings.

Overuse or misuse of link exchanges leaves you at a high risk of violating [Google’s spam policies](Google’s spam policies.). This is a big no-no since Google still owns the largest search engine market share.


Considering this, your goal should be to rank as high as possible on Google more than any other search engine. Bing has certainly been on the rise, but it still pales in comparison to its competitors.

Thus, you want to avoid being caught in a link scheme at all costs. Link schemes are deemed as any black hat SEO strategies that attempt to manipulate search engine rankings through the unnatural use of links.
Learn React with me
Published: 2024-01-05 22:39:40

Today I start "The Ultimate React Course 2024: React, Redux & More" by Jonas Schmedtmann on Udemy. I will share a detailed blog post on everything I learned in the course.
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pwvuysukzjtauv48yohn.jpg)

```
import { useEffect, useState } from "react";

export default function App() {
  const [advice, setAdvice] = useState("");
  const [count, setCount] = useState(0);

  useEffect(function () {
    getAdvice();
  }, []);

  async function getAdvice() {
    const res = await fetch("https://api.adviceslip.com/advice");
    const data = await res.json();
    setAdvice(data.slip.advice);
    setCount((a) => a + 1);
  }

  return (
    <div>
      <h1>{advice}</h1>
      <button onClick={getAdvice}>Get Advice</button>
      <Message count={count} />
    </div>
  );
}

function Message(props) {
  <p>
    You have read <strong>{props.count}</strong> pieces of advice
  </p>;
}
_**

#### 


**_
```