teleren/devto huggingface dataset:
Redux Best Practices
Tags: react, redux
Published: 2020-01-09 03:53:37

In 2019 there is still a very important place for Redux in developing larger web apps that have not been as established with the newer approaches. When advocating Redux, it is the architectural guidance that it provides to applications coming from Flux that I believe to still be so crucial. 

![flux architacture](https://facebook.github.io/flux/img/overview/flux-simple-f8-diagram-1300w.png)

The predictable flow of actions to a common store that then pushes the changes in React to update the view allows for predictable and *debuggable* sequences of operations that are easier to standardize in a team environment.

For every part of your code to which a project can have agreed upon guidelines will mean easier to understand code, a cleaner git history since every developer touching each file won't feel like they have to refactor to their own way.

### mapStateToProps
mapStateToProps is a little confusing at first, but upon closer inspection, it is just a simple function (no imported library) that simply returns a specified part of the current state.
```javascript
const mapStateToProps = (state) => {
     return { things: state.things }
};
```
a valid alternative to make easier to read is to destructure the state
```javascript
const mapStateToProps = ({ configuration }) => {
	return { colors: configuration.colors };
};
```

### mapDispatchToProps
 Do this:
```javascript
const mapDispatchToProps = {
  decrement: () => ({ type: "DECREMENT" }),
  increment: () => ({ type: "INCREMENT" }),
  getColors: params => getColors(params), //If passing variables to the action
};
```
instead of this:
```javascript
const mapDispatchToProps = dispatch => {
  return {
    decrement: () => dispatch({ type: "DECREMENT" }),
    increment: () => dispatch({ type: "INCREMENT" }),
  };
};
```
The difference is that we rely on react-redux to inject dispatch on each value that is a function in our mapDispatchToProps object, rather than relying on react-redux to inject dispatch into our mapDispatchToProps function. This is the preferred way from the official react-redux documentation. [https://react-redux.js.org/using-react-redux/connect-mapdispatch#defining-mapdispatchtoprops-as-an-object](https://react-redux.js.org/using-react-redux/connect-mapdispatch#defining-mapdispatchtoprops-as-an-object)

### connect()

When used with the Redux connect() function to export a component such as:

```javascript
export default connect(mapStateToProps, mapDispatchToProps)(MyComponent);
```

we are exporting the combination of a component that is connected to the store. Think of connect() as the glue or interface between the component and the store. Any changes to the state will be reflected in the component because it is “connected” to mapStateToProps and that information is now made available to the component through a prop.
Arun’s Chemistry Classes in Jaipur
Tags: google, wordpress, data, writing
Published: 2024-05-10 06:08:07

Arun’s Chemistry Classes, founded by renowned Chemistry Teacher Mr. Arun Kulshrestha, is a premier institute in Jaipur, Rajasthan, offering comprehensive coaching for JEE (MAINS + ADVANCE), NEET, AIIMS, and foundation courses. Our objective-centric approach, innovative teaching methods, and affordable fees make us stand out in the competitive education landscape. With a focus on proper care, examination, evaluation, and quality education, we ensure that every student receives the guidance they need to excel. Whether you're preparing for NEET or aiming for top ranks in competitive exams, **[Arun Chemistry Classes](https://www.arunsclasses.com/)** provides the essential competitive edge. Our teaching methodology emphasizes unraveling students' potentials, strengthening fundamental concepts, and honing analytical skills, ensuring their success in mastering chemistry. Join us today and become part of a powerful force propelling you towards your academic goals.

**Facebook: [https://www.facebook.com/arunsclassesofchemistry/](https://www.facebook.com/arunsclassesofchemistry/)**

**Instagram: [https://www.instagram.com/arunschemistryclasses/](https://www.instagram.com/arunschemistryclasses/)**

**Threads: [https://www.threads.net/@arunschemistryclasses](https://www.threads.net/@arunschemistryclasses)**

**Linkedin: [https://www.linkedin.com/in/arun-kulshrestha-sir-145306303/](https://www.linkedin.com/in/arun-kulshrestha-sir-145306303/)**

**Twitter: [https://twitter.com/arunschemistry](https://twitter.com/arunschemistry)**

**Pinterest: [https://in.pinterest.com/arunschemistryclasses/](https://in.pinterest.com/arunschemistryclasses/)**

**Quora:[https://www.quora.com/profile/Arun-Kulshrestha-Sir](https://www.quora.com/profile/Arun-Kulshrestha-Sir)**
How to stream LLM responses using AWS API Gateway Websocket and Lambda
Tags: aws, devops, terraform, llm
Published: 2024-05-10 06:05:38


Nowadays LLMs are everywhere. Many tasks are getting automated using AI (LLM) models. Most of these use cases are chat based where you chat with the LLM and it responds back with answers. In these scenarios it becomes useful to have a streaming mechanism where the LLM can stream responses back to the user. In such cases, the client can connect to the LLM and the LLM can stream responses back to the client as and when they are ready. This is where Websockets come into play. Websockets provide a full-duplex communication channel over a single TCP connection. This allows the LLM to stream responses back to the client. In this post, I will explain how to stream LLM responses using AWS API Gateway Websockets and Lambda. We will use AWS API Gateway to create a Websocket API which will be used to stream responses from a backend LLM inference service , to the client. We will use AWS Lambda to process the LLM responses and send them to the client over the Websocket connection. Finally we will automate the deployment of the infrastructure using Terraform.  

For more details: 

https://amlana21.medium.com/how-to-stream-llm-responses-using-aws-api-gateway-websocket-and-lambda-ba2fc9c348cc
Selecting the Top WhatsApp API Provider in India: A Guide for 2024
Tags: discuss, ai, productivity, news
Published: 2024-05-10 06:04:43

As businesses in India continue to navigate the ever-evolving digital landscape, the significance of seamless and effective customer communication cannot be overstated. At the forefront of empowering businesses with innovative solutions stands BizMagnets, a leading brand renowned for its commitment to revolutionizing customer interactions. 

Specializing in cutting-edge technologies, BizMagnets offers comprehensive [WhatsApp Business API integration](https://bizmagnets.ai/whatsapp-business-api/) services, catering to the diverse needs of businesses across various industries.

With the growing prominence of WhatsApp as a preferred communication channel for businesses, the demand for reliable [WhatsApp Business API service providers](https://bizmagnets.ai/whatsapp-business-api/) has soared. Here, BizMagnets emerges as a trusted partner, offering tailored solutions that align with the unique requirements of each business. 

Through seamless WhatsApp Business API integration, BizMagnets facilitates automated communication processes, enabling businesses to engage with their customers in real-time and deliver personalized experiences.

Key to BizMagnets' success is its unwavering dedication to reliability, security, and scalability. Businesses can rest assured knowing that BizMagnets' [WhatsApp Business API](https://bizmagnets.ai/whatsapp-business-api/) solutions guarantee high uptime, ensuring uninterrupted connectivity with customers. Moreover, BizMagnets prioritizes data security, implementing robust measures to safeguard sensitive information and ensure compliance with regulatory standards. 

Additionally, BizMagnets' scalable solutions are designed to grow with businesses, accommodating increasing message volumes and evolving communication needs effortlessly.

At the core of BizMagnets' offerings lies its expertise in WhatsApp Business API integration. By seamlessly integrating businesses' systems and workflows with the WhatsApp platform, BizMagnets empowers businesses to streamline their communication processes and enhance customer engagement. 

From sending notifications and responding to inquiries to managing customer interactions effectively, BizMagnets' integration services enable businesses to leverage the full potential of WhatsApp for driving growth and delivering exceptional customer experiences.

**conclusion**
As businesses in India seek to capitalize on the opportunities presented by WhatsApp for customer communication, selecting the right WhatsApp Business API service provider is paramount. With its proven track record of excellence and commitment to customer success, BizMagnets emerges as a top choice for businesses looking to integrate WhatsApp seamlessly into their operations. By partnering with BizMagnets, businesses can unlock the power of WhatsApp Business API integration and drive growth while delivering unparalleled customer experiences.
Python 전역변수
Tags: python
Published: 2024-05-10 05:54:55

```
nextId=0
.
.
.

global nextId
.
.
.
nextId = netxtId+1
```
전역변수를 변경하기 위해서는 변경 전에 전역변수임을 알려줌

_참조 : 유투브 생활코딩_
Get a Chance to Meet an Ultimate Beirut Escort and Enjoy Their Companion.
Tags: webdev, javascript, beginners, programming
Published: 2024-05-10 05:47:40

We pride ourselves on offering a versatile range of [Beirut escorts](https://www.zarakhalifa.com/) that exemplify Beirut's multicultural status. We offer escorts in Beirut from across the globe, including Russia, Eastern Europe, Asia, and South America. These Beirut escorts Girls bring with them the exotic appeals of their homelands which make for great date conversation at a lavish Beirut restaurant.
Our [Beirut escorts agency](https://www.zarakhalifa.com/) has escorts of all shapes and sizes; we don't just specialize in classically beautiful blondes and brunettes. While we certainly have our fair share of those beauties, we also offer a wide variety of escorts, from young to old, petite to voluptuous. Redheads, BBWs, and domination escorts are all available for companionship tonight.

We understand that hiring a [Beirut escort](https://www.zarakhalifa.com/) can often be an impulsive decision, so we make every effort to cater to this whim. We have two categories that will greatly please those spontaneous gentlemen out there – our 30-minute escorts and our Available Now escorts. For a quick, short session that gets right down to business, see our 30-minute call girls. If you want an escort immediately, see our Available Now ladies.

The majority of our [escorts in Beirut](https://www.zarakhalifa.com/) offer both incall and outcall Beirut escorts services, so whether you want to relax in your own home or head out to your escort’s place, the choice is yours. Alternatively, our escorts have no issues meeting in a neutral location like a hotel, club, or restaurant too.

Likewise, our escorts are always keen to head out on a more unique date – ones that break the mold of traditional dates. Things like walks in the park at dusk, or sauntering around and seeing Beirut’s landmarks. These dates can be just as fulfilling as a night on the town or behind closed doors.

While all of our escorts are paid well, they’re paid for their time and companionship only. While you may discuss certain activities before booking, there’s no guarantee our Beirut escorts will oblige. Regardless, any physical activity that may or may not take place is done outside of the boundaries of the client-escort relationship and is purely done so at the discretion of two or more consenting adults.

Zara Khalifa Escort Agency is a reputable, professional agency that boasts a stellar track record of bringing clients and escorts together. We make every effort to ensure that any escorts who work through us are capable of delivering an outstanding Beirut escort service that will leave our customers satisfied.
VISIT US : 
https://www.zarakhalifa.com/beirut-escorts.php
https://www.sofiyahayaat.com/
C# da Flagsdan foydalanish
Tags: beginners, programming, csharp
Published: 2024-05-10 05:42:37

`enum` - bu o’zgarmaslarni ifodalovchi maxsus “sinf” (qiymati **o’zgarmaydigan** yoki bir so’z bilan aytganda **read-only** o’zgaruvchilar). **enum** ni yaratish uchun **enum** kalit so’zidan foydalanamiz (interfeys yoki sinf o’rniga) va enum elementlari vergul bilan ajratib yoziladi:

- Enum type`Flags` atributidan foydalaning

- Bit qiymatlaridan enum ko'rinishi sifatida foydalaning, 
  chunki u bitli operatorlardan foydalanishga imkon beradi

- "|" operator yordamida o'zgaruvchiga raqam qo'shing.

- Sanoq qiymatidagi bir yoki bir nechta bit maydonlari o'rnatilganligini aniqlash uchun ushbu usuldan foydalaning. HasFlags()


enum quyidagicha ko'rinadi:

```
enum ColorTypicalEnum: int
{
   None = 0,
   Black = 1,
   Red = 2,
   Green = 4,
   Blue = 8
}
```

Flags enum turini bit maydoni sifatida ko'rib chiqish mumkinligini ko'rsatadigan atributdir. Ushbu bit maydonlari endi bayroqlar to'plamiga guruhlangan.
Bu yerda siz enum maydonlarida intni bit sifatida ko'rishingiz mumkin. Bu oddiy type.enumga qaraganda enum bilan ishlashni osonlashtiradi.

```
[Flag]
enum ColorWithFlag: int
{
   None = 0,
   Black = 1,
   Red = 2,
   Green = 4,
   Blue = 8,
   ... //after some really, really long color listing
   ThisColorIsSoRare = 268435456
}
```
Shunday qilib, biz chapga siljish operatoridan foydalanamiz shu usul orqali 2 darajalariga ega [bo'lamiz](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/operators/bitwise-and-shift-operators#left-shift-operator-): ThisColorIsSoRare = 268435456

```
[Flag]
enum ColorWithFlag: int
{
   None = 0,
   Black = 1,
   Red = 1 << 1, //2
   Green = 1 << 2, //4
   Blue = 1 << 3, //8
   ...
   ThisColorIsSoRare = 1 << 60, //268435456
   AllColors = int32.MaxValue
}
```
Endi Flagsdan foydalanishning eng qiziqarli qismiga o'tamiz. Atribut bitli operatsiyalarga ruxsat berganligi sababli, siz quyidagi kabi ajoyib narsalarni osongina qilishingiz mumkin: `Flags`

```
// group all the primary colors (i.e. red, blue, and green) into one variable
var primaryColors = ColorWithFlag.Red | ColorWithFlag.Green | 
                    ColorWithFlag.Blue

//this sums the integer representation of the color in the `primaryColors` variable, so if you do

var primaryColorsIntegerValue = (int)primaryColors;
//you would get 14
```

Quyidagi usul yordamida asosiy rang o'zgaruvchisida rang mavjudligini tekshirishingiz mumkin. `HasFlag`

```
var isPrimaryColor = primaryColors.HasFlag(ColorWithFlag.Black);
//this returns false
```
[Enum](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/builtin-types/enum)

[Qo'shimcha ma'lumotar Flags haqida](https://learn.microsoft.com/en-us/dotnet/api/system.flagsattribute?view=net-8.0)
Few Situations In Which Wagyu Takeaway Las Vegas Is A Better Option!
Tags: greekfood
Published: 2024-05-10 05:39:56


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v9b0wm74g2hoeb9b09fm.jpg)
Indulge in the succulent splendor of Wagyu beef, a culinary marvel revered for its unparalleled tenderness, marbling, and flavor. While dining out at a fine restaurant to savor this delicacy can be an exquisite experience, there are distinct situations where opting for [Wagyu takeaway Las Vegas](https://www.sultanswagyugrill.com/wagyu-takeaway-las-vegas) transcends mere convenience to become the ultimate gastronomic choice.

Picture this: a cozy evening at home, enveloped in the warmth of familiarity. The tantalizing aroma of Wagyu beef wafts through the air as you unwrap your carefully curated takeaway. Here, in the comfort of your abode, Wagyu becomes more than just a meal; it transforms into a celebration of taste and relaxation, a respite from the hustle and bustle of the outside world.

Imagine a spontaneous picnic in the great outdoors, surrounded by nature’s majesty. As the sun sets and the stars emerge, there’s no need to sacrifice gourmet quality for adventure. With Wagyu takeaway, you can elevate your outdoor dining experience to unprecedented heights, savoring each bite under the open sky, and creating memories that linger long after the meal is finished.

Consider the demands of a busy workday, where time is a precious commodity. Amidst deadlines and meetings, the thought of a sumptuous Wagyu meal may seem like an unattainable luxury. Yet, with Wagyu takeaway Las Vegas, culinary excellence is just a few clicks away, offering a brief respite from the rigors of professional life without compromising on taste or quality.

Envision a romantic evening spent with a loved one, where every detail is carefully orchestrated to perfection. With Wagyu takeaway, you can transform any setting into a culinary sanctuary, setting the stage for an unforgettable dining experience that speaks volumes without uttering a single word, igniting sparks of passion that dance in the flickering candlelight.

In the realm of social gatherings, where diverse tastes converge, Wagyu takeaway Las Vegas emerges as the undisputed hero, uniting friends and family in a collective appreciation for gourmet cuisine. Whether it’s a casual get-together or a formal affair, the allure of Wagyu transcends boundaries, captivating palates and fostering camaraderie with each delectable morsel.

In every situation, from the mundane to the monumental, Wagyu takeaway Las Vegas shines as a beacon of culinary excellence, offering a taste of luxury that knows no equal. Remember that the essence of Wagyu lies not only in its exquisite flavor but in the memories it inspires and the moments it enriches.

Indulge in the flavors of Greece at Sultan Wagyu, an authentic Greek food restaurant. Savor traditional dishes all prepared with the finest ingredients. Experience the warmth of Greek hospitality in every bite. Join us for a culinary journey to the Mediterranean at [Sultan Wagyu](https://www.sultanswagyugrill.com/).
Natural Programming ❤️️ with TypeChat & Semantic Kernel
Tags: ai, dotnet, semantickernel, daspy
Published: 2024-05-10 05:39:32


The age of programming via natural language has come to pass.

Today we use sk and typechat to code a .net sample. 

## Example 1: Controlling Computers with Natural Language

In this code, OpenAI will provide a snippet of executable code.
Demonstration of creating a directory, writing the string "hello" into a file named b.txt, and then inquiring about the contents of the newly created b.txt file:

> Create a directory named "test" in the current directory, within which create a file named b.txt and write the string "hello" into it.

```python
def program(api: IPluginApi):
    step1 = api.get_current_directory()
    step2 = api.concatenate(step1, "/test")
    step3 = api.make_directory(step2)
    step4 = api.concatenate(step2, "/b.txt")
    step5 = api.write_file(step4, "hello")
    return step5
```

> Display the contents of the b.txt file located in the "test" directory.
```python
def program(api: IPluginApi):
    step1 = api.set_current_directory("test")
    step2 = api.read_file("b.txt")
    step3 = api.output(step2)
    return step3
```
Executing the program will yield the output:
```
hello
```


In conclusion, programming control over the computer has been achieved through the use of natural language. 


## Example 2: Ordering with Natural Language, a cappuccino with added sugar

Feature: Natural language generates JSON
> I'll have a cappuccino, and please add sugar.
```
##YOUR ORDER
{
  "items": [
    {
      "$type": "LatteDrinks",
      "productName": "cappuccino",
      "options": [
        {
          "$type": "Sweetners",
          "optionName": "sugar"
        }
      ],
      "quantity": 1
    }
  ]
}
Success!
```
> 
It's possible that we could then transmit the resulting JSON to a food delivery API, thereby actualizing the order process.
For an in-depth understanding of how to utilize this feature:



Create AI agents with Semantic Kernel
​learn.microsoft.com/zh-cn/semantic-kernel/overview/

TypeChat
​microsoft.github.io/TypeChat/
Use HyDE to avoid the drawbacks of RAG
Tags: rag
Published: 2024-05-10 05:34:51

The core principle of the paper, titled "Hypothetical Document Embeddings (HyDE) for Zero-Shot Dense Retrieval," presented at arXiv:2212.10496, introduces a method called HyDE to achieve zero-shot dense retrieval. Zero-shot learning refers to the ability of a model to handle new tasks without specific labeled data for that task. In the context of information retrieval, this typically means that the system must retrieve the most relevant documents to a query without any labeled data regarding the relevance of queries and documents.

The core principle of HyDE can be broken down into the following steps:

1. Generating Hypothetical Documents: Given a query, HyDE first employs a large language model capable of following instructions, such as InstructGPT, to generate a hypothetical document. This document attempts to capture information relevant to the query, but it does not exist in reality and may contain erroneous details.

2. Unsupervised Encoding: Next, HyDE uses an unsupervised contrastive encoder, such as Contriever, to encode this hypothetical document into a vector. This encoding process can be seen as a compression process that filters out erroneous details from the document, retaining only the key information.

3. Retrieving Similar Documents: The encoded vector is then used to retrieve the most similar real documents from a document repository. This step is based on the vector space model, using the inner product (or cosine similarity) to measure the similarity between documents.

4. Retrieval Results: Ultimately, the system returns a set of real documents most relevant to the original query.

The innovation of this process lies in the fact that it decomposes the query-to-document retrieval task into two subtasks: one handled by the language model for generation, and the other by the contrastive encoder for document similarity. In this way, HyDE can achieve retrieval without any relevance labels by generating and encoding hypothetical documents, resulting in good performance across various tasks and languages.

To put it metaphorically, it can be likened to a detective game: the detective (language model) constructs a hypothetical crime scene (hypothetical document) based on clues (query), and then uses this scenario to find an actual crime scene (relevant document). This process does not require prior knowledge of the specifics of each scene (relevance labels) but instead infers based on the similarity of the scenarios.