teleren/devto huggingface dataset:
List Formatter in Android : Android Internationalization part 1
Tags: android, kotlin, androiddev, jetpackcompose
Published: 2024-04-07 17:42:36


![List formattter](https://cdn-images-1.medium.com/max/2000/1*lcF-e7WpY0mcU1V0bITDqQ.png)


When you are addressing a larger audience of distinct linguistic, and cultural behaviours it is essential that your application content evolve according to the preferences that the user locale demands. especially dealing with strings or human-readable text that is displayed in the user interface, the aspect of translating and formatting it to adapt the usage corresponding to the user default locale turns out to be vital as it ensures a smooth user experience.


## Need for list formatter

While generating a message from an arbitrarily sized list of terms/strings/units we might have to reformat them as conjunctions or disjunctions. The choice and positioning of separators and connectors ( conjunction/ disjunction ) can differ depending on the locale

for example, consider a list of string

   ` val language = ["Kotlin", "Java", "XML"]`

where you want to generate a message by the conjunction of all items in language list, like “Kotlin, Java, and XML used in Android development ”

Looks pretty straightforward to join string using a separator (, ) and connect the penultimate one with a connector but actual structure and usage varies according to locale (refer table below)
{% gist https://gist.github.com/Dinoy-Raj/a138c5be36947d53201e8abf2ef31593.js %}


## ListFormatter Class

*ListFormatter* is an immutable java class inside *package android.icu.text* used to format list of items with a separator and connectors appropriate for a given locale

create an instance of list formatter using getInstance() method either by passing the required locale along with width and type for formatting. By default it format accoording to  default locale along with conjunction as type and wide as width

    getInstance(Localelocale,ListFormatter.Typetype,ListFormatter.Widthwidth)

    val formatter = ListFormatter.getInstance(Locale.getDefault())


## Overview about parameters


### Locale

use Locale.getDefault() to get the default locale based on user device or custom locale depends upon your use case


### Type

specified according to the type of meaning expressed by the list, Type Enum inside ListFormatter class ( ListFormatter.Type )
{% gist https://gist.github.com/Dinoy-Raj/3685d02a55b95fa3f811b89471104a7a.js %}


### Width

controls the verbosity level of connectors, determines the size (width) of the string returned
{% gist https://gist.github.com/Dinoy-Raj/b18e0e5778637cbfe9a2a6538a49884b.js %}


## To sum up

{% gist https://gist.github.com/Dinoy-Raj/9e2087b3d0a2b620d37be37dc65e8c6a.js %}
Got any questions? Leave a comment below or connect me through Twitter.. :)
Learning AWS Day by Day — Day 30 — IAM
Tags: aws, cloud, cloudcomputing, beginners
Published: 2024-04-07 17:41:18

Exploring AWS !!

**Day 30:**

**IAM (Identity Access Management)**

IAM is a AWS resource that helps in managing the access to AWS resources. It helps in creating and controlling the access to specified users and limiting the access to a defined people. IAM also helps in managing users, groups, permissions, policies, roles and access keys.

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



**Benefits:**
Set permissions and have fine grained access control
Manage workloads and work force identities
Use temporary credentials to access resources as required
Least privilege policy for users

**Can be classified as:**
Users
Roles
Groups

**Root User:** created by default and is owner of account.
**IAM User: **We can create these users for specific purposes and provide specific permissions as required to control the account, keeping in mind least privilege to be granted.
**IAM Groups:** A group of IAM users, a user can belong to multiple groups. Using groups the permissions can be handled efficiently.
**IAM Roles:** AS we cannot directly assign policies to the resources in Amazon, we have roles, they can be assumed by anybody who acquires them, may it be a user or a resource.
**IAM Policies:** can manage access for AWS by attaching them to identities or roles. When a user makes a request to AWS, by checking these policy AWS decides whether to permit or not.

**Features:**
Free of Cost
Centralized control
Grant permissions
MFA (Multi Factor Authentication)
Transition function?
Tags: computerscience, ai, toc, math
Published: 2024-04-07 17:14:36


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


[Bobs Explains the transitive function]

Bob: The transition function defines the rules for moving. We can use our light bulb switch as an example of finite automata. Suppose in the off state, if the input is ON, then the state of the light bulb will shift towards ON, right? And in the ON state, if the input is OFF, then the state of the light bulb will shift towards OFF. So if we denote OFF input by 0 and ON input by 1, now we can show this using the transition function **δ(ON, 0) = OFF or δ(OFF, 1) = ON**. I hope you are getting my point, Alice. This means that here, delta is showing what the input will be to move towards a particular state.

Alice: Okay, so does the delta or transition function show the rule that determines what input will cause a move to a particular state, right?

Bob: Exactly, Alice. The transition function, often denoted by ( δ ), specifies the conditions under which a transition occurs from one state to another in a finite automaton. It’s a formal way to express the rules that govern the state changes. So, in the context of the light bulb example:

When the light bulb is OFF and the input is 1 (representing the ON switch), the transition function **(δ(OFF, 1))** will result in the light bulb state changing to ON.
Conversely, when the light bulb is ON and the input is 0 (representing the OFF switch), the transition function **(δ(ON, 0))** will result in the light bulb state changing to OFF.

Alice: Now, I got you.


[Back](https://dev.to/meu57/bob-you-are-now-a-tech-thing-2a1b)
Harnessing the Future: My Journey Through the ChatGPT Masterclass
Tags: productivity, ai, gpt3, beginners
Published: 2024-04-07 17:12:00

In an era where artificial intelligence is not just a buzzword but a fundamental component of our digital lives, I embarked on a journey to deepen my understanding and mastery of one of the most revolutionary tools in today's tech landscape: ChatGPT

The ChatGPT Masterclass: The Guide to AI & Prompt Engineering on Udemy was not just another course; it was my gateway into the future of AI. Crafted with meticulous detail by Robin & Jesper, this masterclass promised—and delivered—a comprehensive dive into the capabilities, applications, and transformative potential of ChatGPT.

**A Learning Odyssey**

From understanding the intricate workings of AI and language models to mastering prompt engineering, the course was a blend of theory and hands-on practice. Each module was a step forward in unraveling the extensive applications of ChatGPT, ranging from automating mundane tasks to crafting creative content, optimizing digital marketing strategies, and even navigating the complexities of financial planning.

But it didn’t stop at learning; it was about applying. The exercises and real-world applications presented in the course enabled me to integrate ChatGPT into various facets of my personal and professional life, revolutionizing the way I approach problem-solving, content creation, and workflow optimization.

**Transformation Beyond Skills**

What sets this masterclass apart isn’t just the breadth of skills covered but the depth of transformation it promises. As I moved through sections on SEO optimization, email marketing, resume building, and even salary negotiation with ChatGPT, I realized this wasn’t just about learning a tool. It was about preparing for a future where AI is a critical ally in our quest for efficiency, creativity, and innovation.

The inclusion of over 100+ ChatGPT & analytics intelligence prompts, a comprehensive 142-page marketing strategy guidebook, and a multitude of free resources, ensured that the learning didn’t just stop with the end of the course. With lifetime access to future updates, I am poised to remain at the forefront of AI advancements.

As I continue on my journey of learning and growth, I extend an invitation to you: let's explore the possibilities of AI together. Let’s not just anticipate the future; let's create it.

_To innovation, learning, and beyond!_

https://www.udemy.com/course/the-chatgpt-and-prompt-engineering-masterclass/
Base64 data of DALL·E 3 response
Published: 2024-04-07 16:58:31

This week, I submitted a [PR](https://github.com/tarasglek/chatcraft.org/pull/549) to [ChatCraft](https://github.com/tarasglek/chatcraft.org) that set DALL·E 3 generated image's format to `Base64` data. Previously, we used a URL format, but it was only viable for an hour due to OpenAI's [requirements](https://platform.openai.com/docs/guides/images/example-dall-e-3-generations).


![doc](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lfpykvfsbrs7nbs0kygf.png)


## The [`response_format`](https://platform.openai.com/docs/api-reference/images/create#images-create-response_format) parameter

> The format in which the generated images are returned. Must be one of `url` or `b64_json`. URLs are only valid for 60 minutes after the image has been generated.

## Usage examples
Suppose you have an `<img>` tag in your component, and the `src` attribute is populated from a variable called `imgSrc`:

```ts
<img src={imgSrc} alt="..." />
```

We can pass the `src` with the Base64 encoded image data rather than `url`

```ts
const imgSrc = "data:image/jpeg;base64,/9j/4AAQSkZJRgAB...";
```

Now, let's take a look at the API. Here's an example of a url response:

```ts
const response = await openai.images.generate({
  model: "dall-e-3",
  prompt: "a white siamese cat",
  n: 1,
  size: "1024x1024",
});
const imgSrc = response.data[0].url;
```

To obtain the response from OpenAI in Base64 format, we can update the code as follows:

```ts
const response = await openai.images.generate({
  model: "dall-e-3",
  prompt: "a white siamese cat",
  n: 1,
  size: "1024x1024",
  response_format: "b64_json",
});
const imgSrc = `data:image/jpeg;base64,${response.data[0].b64_json}`;
```

I hope you find it helpful. See you in the next post!
Exploring the World of Antiques with D&J Antique Buyers
Published: 2024-04-07 11:00:58

D&J Antique Buyers invites you to journey through the captivating world of antiques. As seasoned antique art buyers and antique estate buyers, we specialise in uncovering hidden treasures and preserving history for generations.

## Curating Masterpieces: Antique Art Buyers

At D&J Antique Buyers, we sincerely appreciate the beauty and craftsmanship of antique artworks. Our team of expert [antique art buyers](https://antiqueestatebuyers.com/) scours the globe for masterpieces from various periods and styles. From Renaissance paintings to Art Deco sculptures, we curate diverse artworks that captivate and inspire. Whether you're a seasoned collector or a novice enthusiast, trust D&J Antique Buyers to help you find the perfect addition to your collection.

## Preserving Heritage: Antique Estate Buyers

As dedicated [antique estate buyers](https://antiqueestatebuyers.com/), we understand estate antiques' sentimental and historical value. Each piece tells a story of generations past, from heirloom furniture to vintage jewellery. At D&J Antique Buyers, we evaluate and acquire unique pieces from estates, ensuring that these cherished heirlooms find new homes where they'll be appreciated and cherished. Whether you're downsizing, liquidating an estate, or simply looking to sell, trust D&J Antique Buyers to provide fair evaluations and expert guidance at every step.

## Conclusion: Trust D&J Antique Buyers for Your Antique Needs

In conclusion, [D&J Antique Buyers](https://antiqueestatebuyers.com/) offers a comprehensive solution for antique enthusiasts and collectors. With our expertise as antique art buyers and antique estate buyers, we provide a curated selection of treasures that celebrate the beauty and history of bygone eras. Whether searching for a rare masterpiece or selling cherished heirlooms, trust D&J Antique Buyers to deliver a seamless and satisfying experience. Explore the world of antiques with us and discover the timeless allure of D&J Antique Buyers.
Build These 5 Full Stack Projects For An Impressive Profile 🌟🛠️
Tags: webdev, beginners, programming, frontend
Published: 2024-04-07 16:52:02

## 🤓 Fun Fact

Did you know the first website was made by Tim Berners-Lee in 1991?

Let's dive into the websites you should build as a full-stack developer!

This is just the start, focus on building solutions to problems you encounter every day or your family, or friends have.

***

## 1️⃣ Personal Portfolio Website

A personal portfolio website that displays your projects, skills, and achievements interactively and responsively.

You can use HTML, CSS, JavaScript, and a frontend framework, and a backend technology such as Node.js, PHP, or Python to handle the data and logic.

***

## 2️⃣ Social Media Platform

Social media platforms allow users to create & share content, follow others, and chat.

You can use React for the frontend, & Firebase, MongoDB, or PostgreSQL for the backend. Implement features like authentication, notifications & real-time updates using libraries like Sockets.

***

## 3️⃣ E-Commerce Website

E-commerce that sells products/services.

You can use Bootstrap, Tailwind, or Material UI for the front-end design, and Stripe, PayPal, or Braintree for the payment processing. You can also use a backend framework such as Laravel, Django or Express to handle the logic.

***

## 4️⃣ Blog Platform

A blog platform that allows users to write and publish articles on various topics.

You can use Next.js, Gatsby, or Nuxt for the front end, and a headless CMS such as Contentful, Strapi, or Sanity for the backend. You can also use Markdown or Rich Text Editor for the content

***

## 5️⃣ 3D Graphics Website

A game website that hosts various types of games that users can play online.

You can use Phaser, Pixi.js, or Three.js for the game development, and HTML5 Canvas or WebGL for the rendering. You can also use WebSockets or WebRTC for the multiplayer functionality and leaderboards

***

## 🙌 Final Thoughts

Comment your views about this article!

Okay, that's it for today!

I hope you found this article helpful ❤️

Connect with me @ [Linktree](https://linktr.ee/arjuncodess).

Follow me on @ [Twitter](https://twitter.com/arjuncodess/). Quality content coming soon!

Happy Coding! 🚀
Thanks for 26408! 🤗
Understanding Context Hooks in React: A Beginner's Guide
Tags: react, hooks, javascript, coding
Published: 2024-04-07 16:37:35

**Introduction:**

Welcome to a beginner-friendly guide to understanding Context Hooks in React! In this post, we'll explore what Context Hooks are, why they're useful, and how to use them in your React applications. By the end, you'll have a solid understanding of how Context Hooks work and how you can leverage them to manage state more effectively in your projects.

**What are Context Hooks?**

Context Hooks are a feature introduced in React that allows you to share state across multiple components without having to pass props manually at every level of the component tree. They provide a way to create global state variables that can be accessed and modified by any component in your application.

**Why are Context Hooks useful?**

Context Hooks are particularly useful when you have data that needs to be accessed by many components at different levels of your application. Instead of passing props down through each level of the component tree, you can use Context Hooks to provide a central source of state that can be accessed by any component, no matter how deeply nested it is.

**How to use Context Hooks:**
Using Context Hooks involves three main steps:

1. **Create a Context:** First, you need to create a new context using the `createContext` function provided by React. This creates a new context object that will hold your global state.

2. **Provide the Context:** Next, you need to wrap your component tree with a `Context.Provider` component. This component takes a `value` prop, which is the initial state of your context. This `value` can be any data type, such as an object, array, or string.

3. **Consume the Context:** Finally, you can access the context value in any component using the `useContext` hook provided by React. This hook takes the context object as an argument and returns the current value of the context.


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

**Conclusion:**
Context Hooks in React provide a powerful way to manage global state in your applications. By creating a context, providing it to your component tree, and consuming it in your components, you can easily share state across your application without the need for prop drilling. So, start using Context Hooks in your React projects today and take your state management to the next level! Happy coding!
sprockets_terser_with_source_maps v2.0.0 released!
Tags: ruby, rails, sprockets, sourcemaps
Published: 2024-04-07 16:33:02

* Home GitHub - [sprockets_terser_with_source_maps](https://github.com/javier-menendez/sprockets_terser_with_source_maps)

   - Documentation uri by version
   - Compressor output as hash with data key
   - Ruby requirement version to >= 2.6.0
   - Ruby 3.3.x added to CI matrix
   - Fix GHA warning for nodejs 16 deprecation
News-Aggregator web application using Django framework
Tags: django, webdev, programming, fullstack
Published: 2024-04-07 16:21:18

I have made a **NEWS-AGGREGATOR** Application using Django framework,,,,

I got an internship 'AICTE' approved internship by `.edunet foundation`
✨
Tech stacks I have used -📍
1. Django
2. HTML
3. bootstrap

AND the good point is I have made this totally Opensource

U can download the template and customise it as per ur requirement...

:)
• If U like it give a Like, and star the repo 🍂✨
 
 I hope this will help u...
here is the opensource Code link-
-"https://github.com/SjxSubham/News-Aggregator"

And yes You can also add comment on every news... 

Here are some Pictures of that website 👇🏼
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4n0im3w4pipyomkebubu.PNG)
About FlushPassiveEffects function
Tags: react
Published: 2024-04-07 16:09:43

I wonder why flushPassiveEffects is called once before the render phase, under what circumstances does the effects from the last update carry over to the next update, and does its return value really get it?
[Code address](https://github.com/facebook/react/blob/main/packages/react-reconciler/src/ReactFiberWorkLoop.js#L885)
Day 01: Introduction to HTML, CSS, and JavaScript
Tags: webdev, javascript, beginners, programming
Published: 2024-04-07 16:00:00


Today marked the beginning of my 100-day journey to master JavaScript, starting with understanding the fundamentals of web development. I delved into the world of HTML, CSS, and JavaScript, the three core technologies that power the web.

**HTML (HyperText Markup Language):**
HTML is the foundation of web development, used to structure the content of web pages. It consists of elements that define the different parts of a webpage, such as headings, paragraphs, images, and links.

**CSS (Cascading Style Sheets):**
CSS is responsible for styling the HTML elements, making them visually appealing. It controls the layout, colors, fonts, and overall design of a webpage. CSS allows developers to create responsive and attractive web designs.

**JavaScript:**
JavaScript is a powerful programming language that adds interactivity and dynamic behavior to web pages. It can manipulate HTML elements, handle events, make asynchronous requests to servers, and create interactive features like sliders, forms, and animations. JavaScript is unique in that it can be used both on the client-side and server-side of web development.

**What can JavaScript really do?**
JavaScript is a versatile language that can perform a wide range of tasks on both the client-side and server-side of web development. Some of the key capabilities of JavaScript include:
- DOM manipulation: Changing the content and style of HTML elements on a webpage.
- Event handling: Responding to user actions such as clicks, scrolls, and keyboard inputs.
- Asynchronous requests: Fetching data from servers without reloading the entire page.
- Form validation: Checking user inputs before submitting data.
- Animations and effects: Creating dynamic and interactive elements on a webpage.

**Interpreted Vs. Compiled Code:**
JavaScript is an interpreted language, meaning that the code is executed line by line from top to bottom at runtime by the browser. This allows for quick development and easy debugging. In contrast, compiled languages like C++ or Java are translated into machine code before execution, resulting in faster performance but requiring a compilation step before running the code.

**Server-side Vs. Client-side Code:**
Server-side code runs on the server and is responsible for processing requests, handling data, and generating dynamic content before sending it to the client. Common server-side languages include Node.js, Python, PHP, and Ruby on Rails. JavaScript can also be used on the server-side with platforms like Node.js. On the other hand, client-side code runs in the user's browser and is responsible for creating interactive user interfaces and handling user events. JavaScript is the primary language for client-side development.

As I wrap up Day 01 of my learning journey, I am excited to explore more advanced concepts in the coming days and apply my knowledge to build interactive web applications. Stay tuned for more updates on my progress in mastering JavaScript!


Happy coding! 🚀

Dev Pattani