teleren/devto huggingface dataset:
React js Input Field test using Jest and Enzyme
Tags: webdev, testing, unittest
Published: 2023-09-07 13:50:21

testing the input field with jest and enzyme
first take a input field in your react js file like this
<input

```
        type="text"
        value={inputValue}
        onChange={handleChange}
        className='inputfield'
      />
```

for this input field, take handleChange function , and a useState for the input Value , like this

```
const [inputValue, setInputValue] = useState('');

  const handleChange = (event) => {
    setInputValue(event.target.value);
  };
```

this take the input from the user,

Now here, i want write test file for this input field, 

```
it('updates input value on change', () => {
    const wrapper = shallow(<App />);
    const input = wrapper.find('.inputfield');
    input.simulate('change', { target: { value: 'ahad' } });
    const refoundInput = wrapper.find(".inputfield")
    expect(refoundInput.props().value).toEqual("ahad");
  });
```

here the explain
   1. `const wrapper = shallow(<App />);`
        It starts by shallow rendering the App component, which means it renders the component without rendering its children or diving deep into the component tree. This allows you to isolate your testing to the behavior of the App component itself.

   2. `const input = wrapper.find('.inputfield');`
        It finds an input element with a CSS class of "inputfield" within the rendered App component. This is assuming that your input field has a class attribute set to "inputfield."

   3. `input.simulate('change', { target: { value: 'ahad' } });`
        It simulates a change event on the found input field and sets its value to 'ahad'. This simulates a user typing 'ahad' into the input field.

   4. `const refoundInput = wrapper.find(".inputfield");`
        It finds the input element again after the simulated change event. This step is necessary because the input variable from step 2 may not reflect the updated state of the input field after the simulated change event.

   5. `expect(refoundInput.props().value).toEqual("ahad");`
        It uses an assertion to check whether the value prop of the input field, which was found again in step 4, is equal to 'ahad'. This ensures that the input field's value has been updated correctly in response to the simulated change event.
OpenAI powered customer insights: product hunt launch 😸
Tags: ai, chatgpt, machinelearning
Published: 2023-09-07 13:47:07

Hey everyone 😊

Today we launched Anecdote on Product Hunt!

Anecdote is an AI tool for product teams which integrates with 30+ customer feedback & support channels, and pulls actionable insights from the data - helping you spot bugs, feature requests and much more

Let me know if any of you would like to try it out for free!

And upvotes are greatly appreciated 😸

https://www.producthunt.com/posts/anecdote-2
Python Objects As Dictionary Keys
Tags: python, tutorial, programming, performance
Published: 2023-09-07 13:34:20

**When can it happen?**
You have a custom class(object) and you want to store related metadata in memory . You decide to use Python dict and leverage the faster look ups O(1)  . 
In the case of a user object:

![user class](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/94g5xbgfd35ujlp479ir.png)

**Python dicts ,eq and the hash function**
For the user object , tracking the number of clicks made the user is required for later computations.The object will be the key for our dict and the number of clicks will be the value .In this case the user will be instatiated more than once.

```console
>>> u1=User(1,"Jill")
>>> clicks=dict()
>>> clicks[u1]=1
>>> clicks
{<User(1 Jill)>: 1}
>>> u2=User(2,"Lock")
>>> clicks[u2]=2
>>> clicks
{<User(1 Jill)>: 1, <User(2 Lock)>: 2}
>>> u3=User(1,"Jill")
>>> clicks[u3]=3
>>> clicks
{<User(1 Jill)>: 1, <User(2 Lock)>: 2, <User(1 Jill)>: 3}
```
Both `u1` and`u3`  are representations of the same user ,Jill with the same user_id 1 but when updating the value for `u3 `a new key is created.

This happens because Python uses the object id to generate a hash which is used as a key in the dict.Both `u1 `and `u3` have different object ids hence will have different dictionary keys despite representing the same user.

```console
>>> id(u1)
140030203095248
>>> id(u3)
140030203095440
>>> 
```

` <User(1 Jill)> `value needs to be  updated for this case since it already exists in the dictionary .To a achieve this a `__hash__` and` __eq__` dunder methods should be implented for the user object where if the objects are equal they will have the same hash.

![user class with eq and hash](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/dxgvqzpstwx5hvbuilwr.png)
Creating  a dict with the user updated object gives the required output.

```console
>>> u1=User(1,"Jill")
>>> clicks=dict()
>>> clicks[u1]=1
>>> clicks
{<User(1,Jill)>: 1}
>>> u2=User(2,"Lock")
>>> clicks[u2]=1
>>> clicks
{<User(1,Jill)>: 1, <User(2,Lock)>: 1}
>>> u3=User(1,"Jill")
>>> clicks[u3]=3
>>> clicks
{<User(1,Jill)>: 3, <User(2,Lock)>: 1}
>>>
```
Upating the` clicks `dict with the object `u3` which is represents the user Jill with user_id 1 ,updates the existing object in the dict `u1` which is respresents the same user.
HuggingFace Introduces Training Cluster Service for Advanced Model Development
Tags: ai, huggingface
Published: 2023-09-07 13:32:04

HuggingFace has unveiled its training cluster as a service, offering machine learning enthusiasts improved efficiency and scalability for training Language Models (LLMs). The service provides access to advanced GPU options like A100, H100, and Trainium nodes, and can handle multimodal training with up to 3T tokens. Users need to provide their datasets for training, or they can opt for collaborative dataset creation.

Read more - https://superagi.com/building-autonomous-business-processes-using-ai-agent-workflows/
Checkout my new blog on kamaji workflow
Tags: kamaj, kubernetes, devops, cloud
Published: 2023-09-07 13:30:23

Dive into the world of the Kamaji workflow crafted by @Clastix ! 🌐 Revolutionizing how we manage Kubernetes environments. Join the conversation on the future of container orchestration. #Kamaji #Clastix #KubernetesOps
![kamaji workflow architechture](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hyof7g5cocnhjglshxyi.png)



check the blog [here](https://blog.kssaiteja.me/kamaji-scaling-kubernetes-with-ease)
Understanding Slicing in Python: A Comprehensive Guide
Tags: javascript, beginners, programming, python
Published: 2023-09-07 13:23:56

Slicing is a fundamental concept in `Python`, allowing you to extract specific elements or portions from sequences like `strings`, `lists`, and `tuples`. In this comprehensive guide, we'll delve into the intricacies of slicing, explore its `syntax`, and provide you with practical examples to master this essential Python feature.

**Basic Slice Syntax:**

To perform a slice, you use the colon : operator within square brackets` []` after the sequence you want to slice. The basic syntax is as follows:

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

- `start`: The index where the slice begins (inclusive).
- `stop`: The index where the slice ends (exclusive).

**Slicing a String:**

![python](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/69wbgmwbo719zuqwuf41.png)



**mitting Start and Stop:**

You can omit the start and stop values to use default values. For instance, if you omit start, it defaults to the beginning of the sequence (index 0), and if you omit stop, it defaults to the end of the sequence.

![python](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2h5oxy0zpxp0ztp3xgwy.png)


**Negative Indices:**

Python supports negative indices, where `-1` represents the last element, `-2` the second-to-last, and so on.

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

**Slicing with Steps:**

You can also include a step value to skip elements within the slice.

![python](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7kp0qccq5f9acqwnn4d1.png)

**Slicing Nested Lists:**

In Python, you can slice nested lists to access elements within sublists.

![python](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5fewlbg3i73ugyqmtmwj.png)

**Conclusion:**

Slicing is a versatile tool in Python for extracting specific `elements `or `sublists `from sequences. Whether you're working with strings, lists, or other `iterable `data structures, mastering slicing is essential for efficient data manipulation and extraction.

`LinkedIn Account` : [LinkedIn](https://www.linkedin.com/in/matthew-odumosu/)
`Twitter Account `: [Twitter](https://twitter.com/iamcymentho)
**Credit**: Graphics sourced from [Youtube](https://www.youtube.com/watch?reload=9&v=Rrj2OtS6vHc)
Using Next.js and Prisma? Save hours & auto-generate components from your schema.
Tags: nextjs, prisma, react, webdev
Published: 2023-09-07 13:21:12




**Generate beautiful Next.js 13 Server Components in seconds**
_For a more in-depth guide please view the [Nexquik Github Repo](https://github.com/bcanfield/nexquik)._

Auto-generate components like the ones below from your Prisma Schema



![UI Generated From Nexquik](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vq4lhbyc20gcnervv85a.png)


## What is Nexquik?

A **Prisma Generator** / **CLI tool** to auto-generate Next.js components from your Prisma Schema.

_These will be Server Components fully equipped with Server Actions._

## So why use it?
Most web apps have a subset of pages where you need CRUD interfaces to get the job done. Generating these pages can give you hours back to focus on the meat of your project.

For example: User Management, Task/Content Management, Inventory, Feedback / Comment Systems, Polls / Surveys… the list goes on.

## Usage Examples
**Example 1: Creating a new app from scratch**
Create a full Next.js app from scratch using all of your models

`npm i nexquik -g`

Option 1: Add the generator to your Prisma schema and run prisma generate

```
generator nexquik {
  provider = "prisma-generator-nexquik"
  command  = "--init group --name Main"
}
```
Option 2: Use the command line
```
nexquik --init group --name UserManagement --include User,Admin,Organization group --name InventoryManagement --include Product,Task,Customer,Category,Order
```

**Example 2: Initializing Nexquik in an existing app**
Install nexquik into project, install dependencies and required files into project, and generate our models into the app directory.

`npm i nexquik`
`nexquik deps`

Now that we installed Nexquik and initialized it in the project, you can add the generator to your schema, and your UI will be generated every time you run prisma generate

```
generator nexquik {
  provider = "prisma-generator-nexquik"
  command  = "group --name UserManagement --include User,Admin,Organization --name TaskManagement --include Task,Product,Category"
}
```

Keeping the generator in your schema will ensure that any time your models change, your UI will reflect them.

This also allows you to benefit from enhancements to the project from the open source community.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/xas2trerxejxmcggikpv.png)
Princeton University Researchers Unveils CoALA, an Advanced Framework for Cognitive Language Agents
Tags: ai, research
Published: 2023-09-07 13:20:41

Princeton University researchers have introduced a new framework, “Cognitive Architectures for Language Agents (CoALA).” This is designed to better integrate large language models (LLMs) with external resources and enhance their control flows. While LLMs have revolutionized NLP, they still face challenges in understanding real-world knowledge and interacting externally. To address this, enhancements have led to the development of “language agents,” which use LLMs in sequential decision-making. The CoALA framework draws inspiration from historical “production systems” and “cognitive architectures,” suggesting LLMs can benefit from their approaches. Through this, Princeton's team highlights the potential for future AI agents that are more context-aware and grounded.

Read more - https://news.superagi.com/2023/09/07/princeton-university-researchers-unveils-coala-an-advanced-framework-for-cognitive-language-agents/
SQL 50 – 1757. Recyclable and Low Fat Products
Tags: leetcode, sql, interviewquestions, javascript
Published: 2023-09-07 13:20:38

It’s an easy [problem](https://leetcode.com/problems/recyclable-and-low-fat-products/), the first one from SQL 50 with the description being:


> Table: Products

> +-------------+---------+
> | Column Name | Type    |
> +-------------+---------+
> | product_id  | int     |
> | low_fats    | enum    |
> | recyclable  | enum    |
> +-------------+---------+

> product_id is the primary key (column with unique values) for this table.

> low_fats is an ENUM (category) of type ('Y', 'N') where 'Y' means this product is low fat and 'N' means it is not.

> recyclable is an ENUM (category) of types ('Y', 'N') where 'Y' means this product is recyclable and 'N' means it is not.

> Write a solution to find the ids of products that are both low fat and recyclable.

> Return the result table in any order.

> The result format is in the following example.

>  
> Example 1:
> Input: 
> Products table:
> +-------------+----------+------------+
> | product_id  | low_fats | recyclable |
> +-------------+----------+------------+
> | 0           | Y        | N          |
> | 1           | Y        | Y          |
> | 2           | N        | Y          |
> | 3           | Y        | Y          |
> | 4           | N        | N          |
> +-------------+----------+------------+

> Output: 
> +-------------+
> | product_id  |
> +-------------+
> | 1           |
> | 3           |
> +-------------+

> Explanation: Only products 1 and 3 are both low fat and recyclable.

As it proposes you need to return a list of ids of products, that are both low fat and recyclable, any order and there format example.

For this resolution first you will select the product_id (which the id required) from the table Products and where the condition is that low_fats and recyclable are true, meaning ‘Y’:

```sql
select product_id from Products where low_fats = 'Y' and recyclable = 'Y';
```

> Runtime: 1530 ms, faster than 17.91% of MySQL online submissions for Recyclable and Low Fat Products.

> Memory Usage: 0B, less than 100.00% of MySQL online submissions for Recyclable and Low Fat Products.


Feels like a beginning of an interview, very light and simple to start up a context and more complex questions regarding same matter e.g. percentages, averages, specific scenarios, etc.

---

That’s it! If there is anything thing else to discuss feel free to drop a comment, if I missed anything let me know so I can update accordingly.

Until next post! :)
JSS Medical College Mysore 2023-24 :Admission, Fees Structure, Course offered, Seat Matrix, Cut-off, Counselling
Tags: mbbs, neetug, neetugcounselling, neetpg
Published: 2023-09-07 13:20:11

JSS Academy of Higher Education and Research, Formerly known as Jagadguru Sri Shivarathreeshwara Medical College Mysore, is one of the famous privately established medical colleges in Karnataka. It is also popularly known as JSS Medical College Mysore, situated in Mysore, Karnataka. It was founded in the year 1984. JSS Medical College is recognized by the Medical Council of India. The college aims to impart excellent quality medical education that markedly improves the health sector and caters to all strata of society. JSSMC Mysore is affiliated with JSS Academy of Higher Education & Research, Mysuru and approved by the National Medical Commission (NMC).

 

Download Karnataka NEET UG Counselling 2023 eBook (College Wise Cutoff, Fees, Seat Matrix etc.)	Download
 

Hey, Students; if you are interested in admission from Jagadguru Sri Shivarathreeswara Medical College Mysore, then you should know about JSS Medical College Mysore’s Fee Structure, Courses offered, Admission Procedure, Cut Off, Facilities available and complete JSS Medical College Mysore Address & more!

JSS Medical College and Hospital Mysore
JSS Academy of Higher Education & Research has been awarded a QS 4-Stars rating in excellence by QS – Quacquarelli Symonds from the UK in 2018. This college is accredited A+ Grade by NAAC.

College Summary
Before we complete the college review, let us look at the College details of JSS Medical College Mysore.

Name of Institute	Jagadguru Sri Shivarathreeswara Medical College Mysore
Popular Name	JSS Medical College Mysore, JSSMC Mysore
Location	Mysore, Karnataka
Year of Establishment	1984
Institute Type	Deemed 
Affiliated	JSS Academy of Higher Education & Research, Mysuru
Approved	National Medical Commission (NMC)
Counselling Conducted Authority	Medical Counselling Committee (MCC) | India
Courses Offered	UG: MBBS
PG: MD/MS
Intake Capacity	MBBS : 250
MD/MS: 169
Admission Procedure	UG: NEET UG
PG: NEET PG
Counselling Procedure	For UG / PG Courses: MCC NEET Counselling
Eligibility Criteria	MBBS: 10+2 examination or its equivalent examination with 50% marks.
MD/MS: MBBS degree or its equivalent degree.
Fees Structure	19,86,400 / Yr
Hostel Facility	Yes
Official Website	https://www.jssuni.edu.in/
College Address	Bannimantap, Mysuru, Karnataka 570015
Category	Top Deemed Medical College in India
Contact Number	+91-9467445955 | +91-7707055155
 
 
https://www.justgetadmission.com/JSS-Medical-College-Mysore
#DEVDiscuss: Memorization and Learning to Code
Tags: devdiscuss, discuss
Published: 2023-09-07 13:11:21

---
title: #DEVDiscuss: Memorization and Learning to Code
published: true
description: 
tags: devdiscuss, discuss, 
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bslouhkp1m62nbt9lz3n.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2023-07-26 18:51 +0000
---
Time for #DEVDiscuss — right here on DEV 😎

{% embed https://dev.to/theodinproject/memorization-and-learning-to-code-1b6h %}

Inspired by @bycdiaz's Top 7 post, tonight’s topic is... Memorization and Learning to Code!
 
Memorization has long been touted as one of the pillars of learning to code effectively, but is that really the case? In the post above, @bycdiaz addresses the anxieties many feel about forgetting concepts and syntax and refutes the idea that good engineers have everything memorized. 

### Questions:
- **Do you use cheat sheets to help you remember specific syntax or commands? How useful do you find them?**
- **Are there any IDE features or plugins that you use to reduce the need for memorization?**
- **Do you find some programming languages easier to memorize than others?**
- **Any triumphs, fails, or other stories you'd like to share on this topic?**
What is NgComponentOutlet in Angular?
Tags: angular, typescript, frontend, softwareengineering
Published: 2023-09-07 13:09:53


`NgComponentOutlet` is used to instantiate a component type and insert its Host View into the current View.

## Things to know

You can control the component creation process by using  the attributes below:
- `ngComponentOutletInputs`: Optional component inputs object, which will be bind to the component.
- `ngComponentOutletInjector`: Optional custon `Inject` that will be used as parent for the component. Defaults to the injector of the current view container


## Example
```typescript
<!-- dynamic.component.html -->
<ng-container *ngComponentOutlet="displayedComponent"></ng-container>

<!-- dynamic.component.ts -->

@Component({
// ....
})
export class DynamicComponent implements OnInit {
  
  displayedComponent = EmptyComponent;

  showDetail = false;

  ngOnInit(): void {
      if (this.showDetail) {
        this.displayedComponent = ProductDetailComponent
      } else {
        this.displayedComponent = EmptyComponent
      }
  }
}
```

For more details visit the official documentation on [Angular.io](https://angular.io/api/common/NgComponentOutlet#description)
🍥 Introducing Dattebayo: Your Ultimate Naruto Anime API! 🍥
Tags: opensource, angular, node, api
Published: 2023-09-07 13:07:49


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


As a parent, I wanted to create something special for my daughters to enjoy their love for the Naruto anime. 🌟 When I couldn't find an API that met our needs, I decided to embark on an exciting project of my own - Dattebayo API! 🚀



🌐 [Explore Dattebayo API](https://api-dattebayo.vercel.app)




💡 Why Dattebayo?

What started as a simple idea to build a character list for my daughters turned into an open-source adventure. We now have a comprehensive API that goes beyond characters and includes clans, villages, kekkeigenkai, tailed beasts, teams, Akatsuki, and Kara. 📜




🔗 Repositories:

Frontend (Angular): [GitHub](https://github.com/viniciusschuelter/dattebayo)

Backend (Node.js/Express): [GitHub](https://github.com/viniciusschuelter/dattebayo-api)




🙏 Join the Adventure!

I invite you to explore Dattebayo API and share it with fellow Naruto enthusiasts. If you're a developer, consider contributing ideas, pull requests to help us keep this adventure going. Every contribution counts! 🌟



Let's bring the Naruto world closer to fans of all ages. Share your thoughts and join the journey! 💪
dev log 1
Tags: idk
Published: 2023-09-07 13:07:01

---
title: dev log 1
published: true
description: idk 
tags: idk
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/jso9fpl6uv7c0z4b7to8.png
# Use a ratio of 100:42 for best results.
# published_at: 2023-09-07 13:02 +0000
---
Physio-Cassette: handle physiological signals without hassle
Tags: python, signalprocessing, opensource, showdev
Published: 2023-09-07 13:01:39

If you have ever worked with physiological signals (or any signal with annotations) you may know how messy they are.

Sometimes the standards are just not there, sometimes the data is buried under layers and layers of useless abstraction (just give me the goddamn numpy array!), sometimes you just need a nice IO library.

Physio-Cassette tries to do exactly that. Just a minimal abstraction to store signals in a terse object, manipulate annotated events, and use them to sample pieces of the signal.

Looking for beta testers! If you are interested you can find it here on Github https://github.com/LucaCerina/physio-cassette or directly install it from PyPI https://pypi.org/project/physio-cassette
Creative Text Masking
Tags: html, css, frontend
Published: 2023-09-07 12:59:01

{% embed https://www.linkedin.com/posts/upek-hansaja_webdesign-webdeveloper-frontend-activity-7090598175442423808-eO6N?utm_source=share&utm_medium=member_desktop %}

Explore the art of creative text masking in web design with this stunning code example. The combination of SVG, video, and CSS transforms ordinary text into an eye-catching visual masterpiece. Discover how this technique can add depth and uniqueness to your web projects.

Source code in my [GitHub Profile](https://github.com/UpekHansaja/Creative-Text-Masking)