teleren/devto huggingface dataset:
C# - Asynchronous Initialization of Singleton Pattern
Tags: csharp, programming, tutorial
Published: 2023-11-08 15:30:00

In scenarios where you need to initialize a Singleton instance asynchronously (e.g., database connection, network setup), you can use `async` and `Lazy<T>` to ensure that the initialization occurs only when the Singleton is first accessed.

```csharp
using System;
using System.Threading.Tasks;

class Program
{
    static async Task Main()
    {
        var singleton = await Singleton.InstanceAsync();

        Console.WriteLine($"Singleton instance created at {singleton.CreationTime}");
    }
}

class Singleton
{
    private static readonly Lazy<Task<Singleton>> lazyInstance = new Lazy<Task<Singleton>>(async () =>
    {
        var instance = new Singleton();
        await instance.InitializeAsync();
        return instance;
    });

    public DateTime CreationTime { get; private set; }

    private Singleton()
    {
        // Private constructor to prevent direct instantiation.
    }

    public static Task<Singleton> InstanceAsync()
    {
        return lazyInstance.Value;
    }

    private async Task InitializeAsync()
    {
        // Simulate asynchronous initialization (e.g., database connection)
        await Task.Delay(1000);
        CreationTime = DateTime.Now;
    }
}
```

In this example:

1. We define a `Singleton` class with a private constructor to prevent direct instantiation.

2. We use `Lazy<Task<Singleton>>` for asynchronous initialization. The `InstanceAsync` method returns a `Task<Singleton>` representing the Singleton instance. The `async` lambda inside `lazyInstance` is responsible for initializing the Singleton asynchronously.

3. In the `InitializeAsync` method, we simulate asynchronous initialization (e.g., establishing a database connection) with `await Task.Delay(1000)`.

4. In the `Main` method, we asynchronously access the Singleton using `await Singleton.InstanceAsync()`, ensuring that the Singleton is initialized only when it is first accessed.

Using this approach, you can ensure that your Singleton instances are created asynchronously, allowing you to perform complex initialization tasks without blocking the calling code. This is particularly useful for scenarios where the initialization process may involve I/O operations or other time-consuming tasks.
Design Tokens: Cool Philosophy, Cumbersome Experience
Tags: android, programming, design
Published: 2023-11-08 15:20:00

Have you ever found yourself struggling to turn UI/UX designs into code? It can feel like a never-ending journey through the digital wilderness. Unfortunately, it’s not getting any easier. UI/UX design is constantly evolving, with new trends, devices, and user expectations popping up faster than you can say “responsive design.” As a result, coders often feel like they’re playing catch-up.

Figma is one of the leading design platforms used in various companies of all sizes. It is used where I work, too. For our new product, our designers created the screens and everything. Then, they marked the design as “ready for development.” They also noted Figma has a new feature called “Dev mode”.

Curious about new things, I turned on “Dev mode” in the design file, hoping it would make things easier.

In the typography guidelines page, I saw they used a couple of the font features.

I checked layouts for the Android XML code. It was as useless as before.

Looked at texts for TextView code. Useless as ever.

Then, I went to see how colors are defined. For this project, our design team used tokens for colors. But, does Figma list these colors in Android color resource format? Or, in any other format at all? Or, can devs even see all of the tokens in one place?

Of course not.

> Design tokens are in beta for designers, and the feature is non-existent for developers in Figma.

I just want to start by saying, I’m totally on board with the whole design tokens thing, and I think they’re pretty awesome. You know, it’s just so helpful to have a common language that both the design and code folks can use to make sure we’re all on the same page.

But here’s the kicker — our tools are struggling, and they’re struggling hard. It’s like they’re stuck in the past while design philosophies are evolving faster than a superhero on caffeine.

Don’t get me wrong, I’m all about progress and keeping things fresh, but our tools need a serious update to keep pace with the ever-changing design world. We want to ride the wave of these new design philosophies, but it feels like we’re on a rusty old bicycle.

So, yeah, I’m all for design tokens, but we’ve got to get our tools up to speed.

After chatting with our designers, we found out that they can export tokens as JSON. It’s better, but I still had to manually define a hundred colors one by one. It’s error-prone and inefficient.

Tried using ChatGPT to reformat the JSON to Android format. It couldn’t understand how to do it.

Then I did this:

{% embed https://devdalgic.github.io/token-android-parser/?source=post_page-----6374d783c97d-------------------------------- %}

Paste your exported Figma JSON and instantly get Android colors. You can choose the naming format and whether you want to use uppercase letters for hex color naming.


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

I believe exported format of JSON can differ, but the tools should be fine. Let me know if you find it helpful!

_Disclaimer: The cover image is created with AI._
Exploring the List of Great SMM Panels at SMM-Panels-List.com
Tags: socialmedia, marketing, grow, smmpanels
Published: 2023-11-08 15:17:02

What Are SMM Panels?

[SMM panels](https://smm-panels-list.com/), or Social Media Promoting panels, are stages that offer a wide run of administrations outlined to upgrade your social media nearness. Whether you're an influencer, trade owner, or somebody looking to extend their online reach, SMM boards can assist you accomplish your objectives. These boards regularly give administrations such as expanding devotees, likes, comments, and more on different social media stages like Instagram, Facebook, Twitter, and TikTok.

A Incredible List of SMM Boards:

At [SMM-Panels-List.com](https://smm-panels-list.com/), you'll find a curated determination of some of the most excellent SMM boards accessible within the showcase. What sets this stage separated is its commitment to quality and reasonableness. They've done the legwork to recognize SMM boards that offer high-quality administrations without breaking the bank.

The SMM-Panels-List.com Distinction

Here's why SMM-Panels-List.com stands out among the rest:

> 1. Quality Assurance
> SMM-Panels-List.com doesn't compromise on quality. They've meticulously confirmed each SMM board on their list to guarantee merely receive administrations that meet industry measures. You'll trust that the administrations advertised are true and successful.
> 2. Reasonable Estimating
> One of the foremost critical preferences of utilizing SMM boards recorded on SMM-Panels-List.com is their competitive estimating. You'll be able get to these services without straining your promoting budget, making it an fabulous choice for both people and businesses.
> 3. Assortment of Administrations
> The SMM boards included on SMM-Panels-List.com cover a wide cluster of social media platforms and administrations. Whether you're looking to extend your Instagram devotees, boost engagement on your Facebook posts, or make your tweets go viral, you'll discover a board that suits your particular needs.
> 4. User-Friendly Interface
> Exploring the site may be a breeze, and you'll find all the data you wish to form an educated choice. The stage is outlined to assist you make the foremost of your social media promoting endeavors.

[SMM-Panels-List.com](**url**) is your door to getting to top-notch SMM boards that combine quality with reasonableness. With their carefully curated list of SMM boards, you'll be able lift your online nearness, lock in along with your group of onlookers, and supercharge your brand's perceivability. Investigate the control of social media promoting with certainty at SMM-Panels-List.com, and observe your online impact take off. It's time to require your social media diversion to the following level with the incredible list of SMM boards accessible at your fingertips.
 
Visit [SMM-Panels-List.com](**url**) nowadays and open the potential of social media showcasing!
I made an app that generates random blob creatures! Use cases include: endless avatar creation
Tags: react, javascript, math, svg
Published: 2023-11-08 15:05:56

So the other day I discovered the Haikei blob generator and I just started obsessively hitting that generate button; you know the one that looks like a die 🎲 and after 15 minutes of mindless clicking, I decided I needed to make my very own blob generator. And the research began!

I revisited articles about Bezier curves, and learnt that about using them in SVG. After hours of experimenting I came up with a function that generates blobs! Later, I just added some eyes! And now I have a blob creature generator.

If you want to see how I did it, check out this video I made:

{% youtube https://youtu.be/eWgc1_30sHU?si=HQnOY-LjIv-eiedG %}

If you want to checkout the code:
https://github.com/PikoCanFly/blobster.git

Happy ~~blobbing~~ coding!
Fixing RabbitMQ Startup issues
Tags: rabbitmq, installation
Published: 2023-11-08 14:57:57

You installed RabbitMQ successfully via homebrew and later you needed to make use of it. Ran `brew services list` and discovered that RabbitMQ was no longer running because it had `stopped`. You run `brew services start RabbitMQ` to bring it back up and you see a log saying: 

```
==> Successfully started `rabbitmq` (label: homebrew.mxcl.rabbitmq)
```
But when you check `brew services list` again you see that it didn't start at all or started and stopped almost immediately.

Here is how I fixed it:

1.) `brew services stop rabbitmq` to stop RabbitMQ.

2.) `brew uninstall rabbitmq` to uninstall RabbitMQ but after running this there might be some leftover folders that were not deleted while uninstalling RabbitMQ. This will be fixed in step 3.

3.) Run `find / -type d -name "rabbitmq" -print 2>/dev/null`. This will show us paths that have stale RabbitMQ data. The result can look something like this:

```
/usr/local/etc/rabbitmq
/usr/local/var/lib/rabbitmq
/usr/local/var/log/rabbitmq
...
```
Which is the first three lines of the command and the most important part we need from the command. Note that the command may take some time(like 10 minutes) to run to completion.

4.) Remove the folders found in the paths above (etc, lib, log) by running the commands below:

```
rm -rf /usr/local/etc/rabbitmq
rm -rf /usr/local/var/lib/rabbitmq
rm -rf /usr/local/var/log/rabbitmq
```
The commands will remove those leftover folders from RabbitMQ as they may hold data from previously installed RabbitMQ which may not allow the RabbitMQ that will be installed in step 6 to work properly.

5.) Next, update homebrew by running `brew update` and if any error as `fatal: couldn't find remote ref refs/heads/master` is encountered, running `brew tap --repair` should fix the problem.

6.) Install RabbitMQ by running `brew install rabbitmq`.

7.) Lastly, start RabbitMQ by running `brew services start rabbitmq`.

8.) Run `brew services list` and RabbitMQ should be started now(green).

```
rabbitmq       started <user> ~/Library/LaunchAgents/homebrew.mxcl.rabbitmq.plist
```
You may choose to run this command over and over again to be sure RabbitMQ is up like I did.

In fact, another way to confirm it's working is you can (like I also did) visit [RabbitMQ localhost](http://localhost:15672) and login using `guest` as both email and password to interact with the RabbitMQ GUI.

If step 7 throws an error, you can do `brew services restart rabbitmq`.

Note that these are the exact steps I took to fix the errors I had(on MacOS Intel Corei7 Ventura 13.5.1) and this might differ for others.

[Reference here](https://medium.com/@anjantalatatam/how-to-clean-install-rabbitmq-1ae214436b7d)
تعرف على الأدوات والمواد الضرورية لتركيب شيش حصيرة بنجاح.
Published: 2023-11-08 14:49:19

مقدمة إلى شيش حصيرة

يعتبر شيش الحصيرة وسيلة فعالة للتحكم في الإضاءة والحفاظ على خصوصيتك في المنزل، سنتعرف على مزايا وأنماط مختلفة و [اسعار تركيب شيش حصيرة](https://alusolutions.net/ar/rolling-shutter-manufacturing-companies/) من شيش الحصيرة وكيف يمكن أن تضيف قيمة إلى منزلك.

 

أنواع شيش حصيرة واستخداماتها المتعددة

سواء كنت تبحث عن حماية من الشمس الحارة أو الأمان والخصوصية، شيش حصيرة تعتبر خيارًا رائعًا. سنلقي نظرة على أنواع مختلفة من شيش الحصيرة وكيف يمكن استخدامها بشكل فعال في منزلك.



تركيب وصيانة شيش حصيرة بسهولة

في هذا المقال، سنشرح كيفية تركيب وصيانة شيش حصيرة بسهولة. ستجد نصائح وإرشادات مفصلة تساعدك في الاستفادة القصوى من هذه التقنية الرائعة في منزلك.

 

شيش حصيرة حماية: حلاً مثاليًا للأمان

إذا كنت تبحث عن وسيلة لحماية منزلك بشكل فعال، فشيش حصيرة حماية هي الحلاً المثاليًا. في هذا المقال، سنستكشف فوائد استخدام شيش حصيرة حماية وكيف يمكن أن تزيد من مستوى الأمان في منزلك.
Learning a new language can make us a better person
Published: 2023-11-08 14:45:34

So, let me share my experience: When I started learning a new language, it makes my horizon a bit wider. I learn something that I did not know before.

2 Kinds of languages: natural languages and programming languages.

Natural languages help us think about the same facts in different trains of thoughts, plus we can talk to people that we would not be able to talk with . Most importantly, every developer must learn English language. But also we can learn more natural languages.

Programming languages are another way to become a new view at the same facts! I tried coding the same exercise in JavaScript and TypeScript, it will give me a new perspective. Plus, I meet new people in a new community.

Dev is a good place to find new people and new inspiration to learn! Thanks for being part of the community!
Generate Fake Data with Snowfakery, Negotiation Tips, Dynamic Components for LWC
Tags: salesforce, salesforcedevelopment, salesforceadministration, salesforceadmin
Published: 2023-11-08 14:44:42

#  This is a weekly newsletter of interesting Salesforce content

See the most interesting #Salesforce content of the last days 👇

✅ **[Start Generating Fake Data with Snowfakery](https://unhandledsunshine.com/2023/08/28/start-generating-fake-data-with-snowfakery/)**
Learn how to generate and insert fake data into Salesforce with Snowfakery, a free and open source tool. Discover how to quickly get started using pre-made "recipes" that specify the data you want to create. No need to write your own recipes - there are already plenty available. 

✅ **[Negotiation Tips for Architects](https://medium.com/salesforce-architects/negotiation-tips-for-architects-298ed90b3fdd)**
In a recent blog post, the software developer reflects on a past job interview where he successfully negotiated a significant salary increase. However, he realizes that he missed out on maximizing his potential gain. He delves deeper into the story, sharing the negotiation tactics he has since learned and how they can be applied to various aspects of architectural work. 

✅ **[Dynamic Components for Lightning Web Components Is Now GA](https://developer.salesforce.com/blogs/2023/10/dynamic-components-for-lightning-web-components-is-now-ga.html)**
Introducing Dynamic Components for LWC in the Winter '24 release! With dynamic import and instantiation, devs and admins can easily build a custom UI and reuse components across applications. Previously available in the Aura framework, dynamic components now extend their functionality to LWC, offering even more flexibility and adaptability for UI customization.

✅ **[Enhanced Loop(For Each) Vs Traditional Loop(For)](https://adityanthiruchuri.blogspot.com/2021/08/enhanced-loopfor-each-vs-traditional.html)**
In this blog post, the writer explores the efficiency of enhanced for-loops compared to traditional for-loops in apex code. By using an example of iterating through a list of Opportunity records, the writer delves into the effectiveness of both methods. 


✅ **[Salesforce Fact #768 | Website field showing record detail page url in screen flow datatable](https://sfactsabhishek.blogspot.com/2023/10/salesforce-fact-768-website-field.html)**
Learn how to display hyperlinks in a screen flow datatable for account records using the Website field in Salesforce. By temporarily storing the record detail page URL in this field, users can easily navigate to the desired page.




Check these and other manually selected links at https://news.skaruz.com

Click a Like button if you find it useful. 
Thanks.
UICollectionView in Xcode
Tags: swift, mobile, beginners
Published: 2023-11-08 14:39:04

1.Add a collection view in the View Controller
![1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/97tghekqzbbty0cgmq9y.png)

2.Set a layout of the collection view
![2](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/smx780vfjynkp1xr27pi.png)

3.Add a constraint to the collection view
![3](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h112ha5kqlcpk8le3pzw.png)

4.Add another required objects inside of collection view and add required constraints
![4](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hac5cphhyz4m85nfk033.png)

![4-1](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dlpld7tsb501qbzrhlwa.png)

_*NOTE: you can decide how many line will be displayed by specifying the line number_
![lable-note](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/95dgrwspzgstplcxg81t.png)

5.Create a collection view cell, `RecipeCVCell`
![5](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/js2t9lz4rth39tnntali.png)

```swift
import UIKit

class RecipeCVCell: UICollectionViewCell {
    @IBOutlet weak var imageView: UIImageView!
    @IBOutlet weak var nameLabel: UILabel!
    @IBOutlet weak var descriptionLabel: UILabel!
}
```

6.Select `Collection View Cell` and add `RecipeCVCell` in a custom class
![6](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/10s8xzz6u2iz6djyfscr.png)

7.Select `RecipeCVCell` and add an identifier, `RecipeCell`
![7](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2u36opz91y5egifthp78.png)

8.Connect Collection View with your view controller
```swift
    override func viewDidLoad() {
        super.viewDidLoad()
        collectionView.dataSource = self
    }
```

9.Create an extension of `UICollectionViewDataSource`
- `cellForItemAt` will be implemented for the collection view
```swift
extension ViewController: UICollectionViewDataSource {
    func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        return recipes.count
    }
    
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "RecipeCell", for: indexPath) as! RecipeCVCell
        let recipe = recipes[indexPath.item]
        
        cell.nameLabel.text = recipe.name
        cell.descriptionLabel.text = recipe.description
        cell.imageView.image = UIImage(systemName: recipe.image)
        
        return cell
    }
}
```

10.Demo
![10](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ozwio9h6iij799zymti6.png)
The Log Blog
Tags: javascript, beginners, tutorial, codenewbie
Published: 2023-11-08 14:38:46


The built-in JavaScript function known as `console.log()` is an excellent debugging tool. It’s often taught early on in a student's JavaScript learning journey as it allows us to see the results of our code quickly. It takes minutes to learn, but an hour or so to master. Once a JavaScript programmer has a good grasp of console.log(), they will have gained an invaluable tool for debugging their code and learning from the process.

To briefly explain console.log to those who haven’t used it. `console.log()` is a JavaScipt `method`. When we give console.log a value, it will log that value to the [console](https://developer.chrome.com/docs/devtools/console/). This helps with debugging as it can quickly show us the value of an element we’re working with. The syntax is as follows: console.log([parameter](https://developer.mozilla.org/en-US/docs/Glossary/Parameter)). 

## To Log, or not to log?

That is the question. And the answer is YES! When we’re coding, it’s all too easy to write lines and lines of code without ever checking to make sure that everything we’re working with does what we think it does. And then once you finally test your code and get a bunch of wacky errors, it’s difficult to tell when the buggy code was put in. However, if you log your values frequently, you’re more likely to catch when buggy code is written.

If you'd like to learn more about console.log, you can find the W3Schools and MDN documentation for it [here](https://www.w3schools.com/jsref/met_console_log.asp) and [here](https://developer.mozilla.org/en-US/docs/Web/API/console/log).
This Is How I Prepare The Very Best Regularization / Classification Images Dataset For Stable Diffusion
Tags: sdxl, stablediffusion, class, reg
Published: 2023-11-08 14:29:15

Processing my updated and improved Stable Diffusion training regularization / classification images dataset

This dataset makes huge improvement especially at Stable Diffusion XL (SDXL) LoRA / DreamBooth training

But works good for all SD versions

The scripts are recently upgraded so this new dataset will be even much better than the previous awesome one

The scripts are shared : https://www.patreon.com/posts/sota-subject-and-88391247

The dataset is shared here : https://www.patreon.com/posts/massive-4k-woman-87700469


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


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


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


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