teleren/devto huggingface dataset:
New Array Method in JavaScript: groupBy
Tags: webdev, javascript, programming, beginners
Published: 2023-12-07 07:00:00

The groupBy method is a new addition to the JavaScript standard library that simplifies the process of grouping elements in an array based on a specified key or function. It was officially introduced in ECMAScript 2021.

**Syntax**

```
array.groupBy(keyFn, [mapFn])
```

**Arguments:**

- keyFn: A function that takes an element as an argument and returns the key for grouping.
- mapFn (Optional): A function that takes an element as an argument and returns the transformed value to store under the key.

**Return value**

The groupBy method returns a new Map object where the keys are the unique values of the key function application to each element, and the values are arrays containing the corresponding elements from the original array.

**Examples**

Example 1: Grouping by a property

```
const people = [
  { name: "John", age: 30 },
  { name: "Jane", age: 25 },
  { name: "Peter", age: 30 },
];

const groupedByAge = people.groupBy(person => person.age);

console.log(groupedByAge);
// {
//   30: [{ name: "John", age: 30 }, { name: "Peter", age: 30 }],
//   25: [{ name: "Jane", age: 25 }],
// }
```

Example 2: Grouping and transforming elements

```
const products = [
  { name: "Apple", price: 1.5 },
  { name: "Banana", price: 0.8 },
  { name: "Orange", price: 1.2 },
];

const groupedByPrice = products.groupBy(
  product => product.price,
  product => product.name
);

console.log(groupedByPrice);
// {
//   "1.5": ["Apple"],
//   "0.8": ["Banana"],
//   "1.2": ["Orange"],
// }
```

**Advantages of using groupBy**

- Conciseness: Compared to using loops and manual manipulation, groupBy provides a more concise and readable way to achieve the same result.
- Readability: The code becomes more readable and easier to understand, especially when dealing with complex data structures.
- Efficiency: Depending on the implementation, groupBy can be more efficient than manual approaches, especially for large datasets.

**Compatibility**

The groupBy method is relatively new and not yet supported by all browsers. However, it is widely supported by modern browsers and can be easily polyfilled for older environments.
OpenHermes 2.5 Vs GPT-4 Vs LLama2 = The Winner
Tags: datascience, machinelearning, programming, ai
Published: 2023-12-07 06:37:43

the AI news in the past 7 days has been insane with so much happening in the world of AI

So In this Article, we’re diving into some of the latest AI developments from major players like llama2 13 Billion, GPT-4 and OpenHermes 2.5.

The main feature of OpenHermes 2.5 is that it mostly uses GPT-4 generated data for extra learning

In this step-by-step guide, we will cover what is OpenHermes 2.5, how to use OpenHermes 2.5 and why OpenHermes 2.5 so much better than GPT-4 and Llama2 13 Billion

The full article can be found [link](https://quickaitutorial.com/openhermes-2-5-vs-gpt-4-vs-llama2-the-winner/)
"Bakery Safety And Compliance: Exploring Bakeroo's Work Health And Food Safety Features"
Tags: food, bakery, software
Published: 2023-12-07 06:36:01

Bakeroo is a bakery management application specialising in several key features, including safety and compliance. They provide a suite of features to help bakers protect their customers, employees, and businesses.
In this article, we'll explore how Bakeroo's Work Health and Food Safety Features provide a comprehensive solution for bakeries looking to ensure the highest safety and compliance standards.
Bakeroo has worked hard to develop a platform that meets the needs of bakers everywhere. With user-friendly tools for tracking food safety, employee health screenings, time tracking, temperature logs, and more, Bakeroo simplifies managing safety and compliance requirements in the bakery industry.
https://getbakeroo.com

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/69rh5u4947u7q47i68m6.jpeg)[]
User Interface For Wyze app
Published: 2023-12-07 06:29:22

The app boasts an intuitive and user-friendly interface designed to make navigation seamless. The home screen provides an overview of all connected devices, allowing users to monitor their status at a glance. Tabs at the bottom of the screen offer easy access to specific device categories, such as cameras, sensors, and bulbs, streamlining the user experience.

[https://wyzeapppc.com/](https://wyzeapppc.com/)
[https://wyzeapppc.com/wyze-cam-app-for-android.html](https://wyzeapppc.com/wyze-cam-app-for-android.html)
Mastering Modern Web Development 😎💪
Published: 2023-12-07 06:24:11

## 1. Getting Started with HTML, CSS, and JavaScript:
Learn the fundamentals of building the structure (HTML), styling (CSS), and interactivity (JavaScript) of web pages.

## 2. Version Control with Git:
Discover the power of version control to track changes, collaborate with others, and manage your code effectively using Git.

## 3. Frontend Frameworks:
Explore popular frontend frameworks such as React, Angular, or Vue.js to build dynamic and responsive user interfaces.

## 4. Backend Development with Node.js:
Delve into server-side development using Node.js and learn how to build scalable and efficient backend services.

## 5. Databases and Data Modeling:
Understand the basics of databases, including SQL and NoSQL options, and learn how to design effective data models for your applications.

## 6. API Development and Consumption:
Master the creation and consumption of APIs to enable communication between different parts of your application or external services.

## 7. Authentication and Authorization:
Ensure the security of your applications by implementing robust authentication and authorization mechanisms.

## 8. Testing and Debugging:
Explore different testing strategies and debugging techniques to ensure the reliability and quality of your code.

## 9. Deployment and Hosting:
Learn how to deploy your web applications to the cloud and choose the right hosting solution for your project.

## 10. Continuous Integration/Continuous Deployment (CI/CD):
Implement CI/CD pipelines to automate the testing and deployment processes, streamlining your development workflow.

## 11. Performance Optimization:
Optimize your web applications for speed and efficiency, including techniques for front-end performance and server-side optimizations.

## 12. Keeping Up with Trends:
Stay up-to-date with the latest trends, tools, and best practices in the ever-evolving field of web development.

Whether you're a complete beginner or have some coding experience, this guide will provide you with a solid foundation and guide you on your journey to mastering modern web development. Get ready to create amazing web experiences and join the thriving community of web developers! 🚀
Double Girder EOT Crane Manufacturers in Bangalore, Belgaum, Mangalore
Published: 2023-12-07 06:15:44

ABCO Engineers is the largest Double Girder EOT Crane Manufacturers in Bangalore, Belgaum and Mangalore They are the expert Goods lift Manufacturers, Winch Manufacturers



<p><a href="https://www.abcoengineers.com/contact">Transfer Car Manufacturers Bangalore</a></p>

<p><a href="https://www.abcoengineers.com/products">Balanced C-Hook Manufacturers Bangalore</a></p>

<p><a href="https://www.abcoengineers.com/double-girder-cranes" target="_blank">EOT Crane Manufacturers Bangalore</a></p>

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vg9uj5ppuspau44qmgvf.jpg)
cpp八股文系列
Published: 2023-12-07 06:14:26

# c++语言基础篇
#### 1.说说智能指针
回答：首先智能指针被发明出来是为了防止内存泄漏，避免程序员忘记释放申请的内存。由于智能指针是一种类，超出了类的作用域，会自动调用析构函数释放资源。因此不需要手动释放内存。

常用的接口
```c++
T* get()//获取裸指针
T* operator*()//重载取值运算符
T* operator->()
T& operator=(const T& val);
T* release()//将智能指针内部的裸指针初始为null，不改变指向的内存
void reset (T* ptr = nullptr) //释放指针所指向的内存，如果传了个指针，改智能指针将会内部初始化为改值，记住只能传裸指针，但是不要用reset来进行复制！，因为这不会增加引用计数，两个指针的引用计数是独立的。
```

##### 1.unique_ptr
不能进行复制得本质是删除了拷贝构造函数和拷贝赋值运算符。
但是是有移动赋值的！

删除器的使用
定义删除器，然后模板中为两个参，第一个是托管的类型名，第二个是删除器类型，指针的参数中也是，（但是这里的第一个参数是指针类型，和直接创建智能指针有些不同）
```c++
#include <iostream>
#include <memory>

// 自定义删除器
void myDeleter(int* p) {
    std::cout << "Custom deleter called. Deleting resource.\n";
    delete p;
}

int main() {
    // 创建 unique_ptr，使用自定义删除器
    std::unique_ptr<int, decltype(&myDeleter)> ptr(new int(42), myDeleter);

    std::cout << "ptr points to " << *ptr << std::endl;

    // 当 ptr 超出作用域时，myDeleter 将被调用来删除资源
    return 0;
}

```

##### 2.shared_ptr
和unptr一样都支持异常安全，只要超出了作用域都会释放资源

会有循环引用问题
A类中有一个b的shared_ptr，B类中有一个a的shared_ptr，
形成了一个闭环，可以想象一下内部布局，当要释放A的时候，A中有一个b的指针计数为1，释放B的时候，B中有一个a的技术为1，所以永远无法释放，解决方法就是把其中一个换位weak_ptr，因为wptr不会增加引用计数，所以也不会阻止对象销毁。

#### 2.const和static的区别
static：
修饰局部变量：static让变量生命周期延长到整个程序结束，但是作用域还是限制在语句块内
修饰全局变量：会把改变量限制在只在该文件内可见
修饰函数：同上
修饰类成员变量和成员函数：让成员变量和成员函数属于类而不是对象。**注意** static函数没有this指针，所以也就不能用visual来修饰，this->visual->ctable->virtual function。也只能访问static修饰得成员。
其中私有static和公有也是有区别的，私有只能被类的内部访问，公有可以被外部访问
const：
#### 3.说说类和对象
私有成员不能被继承，公有和保护可以被继承，公有继承不改变变量隐私，保护继承全部变为保护，私有继承全部变为私有
Get GPU names + counts with TensorFlow API
Tags: tensorflow, gpu, ai, googlecloud
Published: 2023-12-07 06:11:34

I'm running some benchmarks and want to output the GPU in use, rather than track it manually.

In my case, there'll only ever be 0 or 1 gpu type, but possibly more than 1. Hence the error if there are multiple names.

May the graphics be ever in your favor! 🖥️

```
from itertools import groupby
import tensorflow as tf

gpu_devices = tf.config.experimental.list_physical_devices('GPU')
gpu_details = [tf.config.experimental.get_device_details(gpu) for gpu in gpu_devices]

gpus_by_name = {
  k: list(v) for k, v in groupby(gpu_details, key = lambda x: x['device_name'])
}

gpu_names = list(gpus_by_name.keys())

if len(gpu_names) == 0:
    gpu_name = "None"
    gpu_count = 0
elif len(gpu_names) == 1:
    gpu_name = gpu_names[0]
    gpu_count = len(gpus_by_name[gpu_name])
if len(gpus_by_name.keys()) > 1:
    raise "Dunno how to handle multiple gpu types"
```
A Python function to convert Chinese number to Arabic number
Tags: python, chatgpt, algorithms
Published: 2023-12-07 06:09:13

# TL;DR

```python
def chinese_to_arabic(chinese_number):
    chinese_arabic_dict = {
        '零': 0, '一': 1, '二': 2, '三': 3, '四': 4,
        '五': 5, '六': 6, '七': 7, '八': 8, '九': 9,
        '十': 10, '百': 100, '千': 1000, '万': 10000, '亿': 100000000
    }

    total = 0
    r = 1  # The factor that will multiply the unit, such as 10 for 十, 100 for 百.

    for i in range(len(chinese_number) - 1, -1, -1):
        val = chinese_arabic_dict.get(chinese_number[i])
        if val >= 10 and i == 0:  # This is for when the Chinese number begins with 十 (such as 十一).
            if val > r:
                r = val
                total = total + val
            else:
                r = r * val
        elif val >= 10:
            if val > r:
                r = val
            else:
                r = r * val
        else:
            total = total + r * val

    return total


print(chinese_to_arabic('一'))  # Should return 1
print(chinese_to_arabic('二'))  # Should return 2
print(chinese_to_arabic('十一'))  # Should return 11
print(chinese_to_arabic('二十五'))  # Should return 25
print(chinese_to_arabic('一百三十四'))  # Should return 134
print(chinese_to_arabic('七千八百九十七'))  # Should return 7897
```

Thanks to the help of ChatGPT 4!

### Origin prompt:
```
Would you write a python function to convert chinese number to arabic number?

一 = 1
二 = 2
十一 = 11
二十五 = 25
一百三十四 = 134
七千八百九十七 = 7897
...

```
Manufacturers of Elastic Tape in India - Dinesh Enterprise
Published: 2023-12-07 05:53:52

Dinesh Enterprise is a leading manufacturer of elastic tapes in India. We have established ourselves as a reliable and renowned brand in the industry, known for our commitment to quality and customer satisfaction.Our manufacturing facility is equipped with state-of-the-art machinery and technology, enabling us to produce elastic tapes of the highest standards. for more information visit our website :- https://www.dineshelastics.com/
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zwtdcva57hia0bwlz633.jpg)
iQlance Solutions - Software Developers Phoenix
Published: 2023-12-07 05:44:47

iQlance a Leading [software developers phoenix](https://www.iqlance.com/software-development-phoenix/)

iQlance offers comprehensive services for developing iOS and Android mobile apps. We can help you if you have an idea and need help building a digital solution to maximize your return on investment, or if your app has stopped working and you want to get it back up and running. Allow us to assist you in realising your business objectives by giving you designs that will set your app out from the competition. At iQlance Software Development Phoenix, we strive to assist organizations of all sizes and stages in reaching their full potential.

What makes us different?
iQlance has been around for decades, building web apps since the dawn of the internet. That is a very long time! But we're still kids at heart, and we're all about cutting-edge Mobile App Development Phoenix services and slashing innovation. Employees at our organization are encouraged to excel in areas such as client-server business productivity, workflow apps, e-commerce, and web portals.
If you require assistance with the design or development of a web application, please contact us; our office is located in Phoenix, Arizona.
Devops
Published: 2023-12-07 05:38:51




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


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





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

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


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



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/gtaid6b13qkdmqgwjqqk.png)
Thiết kế nội thất Minh Gia
Published: 2023-12-07 05:36:31

Thiết kế và thi công nội thất chuyên nghiệp
Chuyên thiết kế, thi công nội thất gỗ tự nhiên và gỗ công nghiệp✔️Sản xuất, cung cấp các sản phẩm đa dạng từ phòng ngủ, phòng khách✔️phòng bếp....
144/4B Lê Văn Khương, P. Hiệp Thành, Q. 12, TP.HCM
0901525999
noithatminhgia@gmail.com
Essential Tools for Developers: Ideas, Text Editors, and More
Tags: devtools, codenewbie, development, developer
Published: 2023-12-07 05:02:00

Developer
A developer is an individual who builds and creates software and applications. They write, debug, and execute the source code of a software application.

Essential Tools
1. IDE (Integrated Development Environment)
2. Text Editors
3. Version Control System

IDE
An Integrated Development Environment (IDE) is a software application that provides features to support software development. It comes with built-in support to perform operations in a language. Features include:
- Detecting and highlighting code based on file type.
- Checking syntax.
- Running programs within the IDE using a terminal interface.
- Allowing you to write your plugins for customization and also share the plugins.

Examples of IDEs are IntelliJ and Visual Studio.

Text Editors
A text editor is software used for plain text and works on the principle of WYSIWYG, which means "What You See Is What You Get."

Code Editor
Also known as a source code editor, a code editor is a text editor that has the ability to edit code and highlight syntax. An example is Visual Studio Code.

IDE vs. Code Editor
IDEs are heavyweight software, while code editors are lightweight. IDEs provide tools for development, such as database integration and IntelliSense, out of the box. They can be used to build projects at the production level as well.
Live updates for Mobile apps
Tags: ionic, capacitor, mobile, javascript
Published: 2023-12-07 04:45:56

## The Future of Mobile App Updates: Live Editing Without Limits


In the fast-paced world of mobile app development, staying agile and responsive to user needs is paramount. Traditional app update cycles can be a bottleneck, with lengthy app Store review processes delaying critical updates. But what if you could bypass these delays and push updates instantly? Welcome to the era of mobile live updates.

### Understanding Mobile Live Updates

Mobile live updates allow developers to push code changes directly to apps already installed on users' devices. This method is ideal for making quick fixes, patching security vulnerabilities, or updating content without waiting for app store approval.

### The Limitations: No Native Code Changes

While live updates sound like a developer's dream, there's a catch: you can't alter native code. This means that any updates involving changes to the app's core functionality or the introduction of new features still require the traditional app Store review process.

### The Solution for React Native: [Expo](https://expo.dev)

For React Native developers, Expo offers a seamless live update experience. With Expo, you can deploy JavaScript and asset updates to your users instantly. Expo handles the complexities of live updates within the constraints of app store guidelines, ensuring that your app remains compliant while delivering the latest content to your users.

### The Solution for Ionic: [Capgo](https://capgo.app)

Ionic developers, meet Capgo – your ally in the world of live updates. Capgo specializes in pushing HTML, CSS, and JavaScript updates to live iOS Ionic apps. It's designed to work within Apple's strict guidelines, ensuring that your updates are compliant and your app's presence on the App Store remains secure.

### Embracing the Power of Live Updates

With solutions like Expo for React Native and Capgo for Ionic, developers can now enjoy the flexibility of live updates. These tools empower you to keep your app up-to-date, enhance the user experience, and stay ahead of the competition – all without the traditional update hurdles.

### Ready to Revolutionize Your App Updates?

The future of mobile app development is here, and it's time to embrace the power of live updates. Whether you're using React Native or Ionic, tools like Expo and Capgo are here to streamline your update process.

[Discover How to Implement Live Updates with Expo](https://expo.dev)

[Learn More About Capgo for Ionic Apps](https://capgo.app)


**Embrace the future of mobile app updates with live editing – no limits, no delays.**

[Get Started with Live Updates](https://capgo.app)
Upload a file to AWS S3 by consuming a REST API exposed on Spring Boot
Published: 2023-12-07 04:34:07

Things to keep in mind:
1.- This code will upload a file given as input on a HTML Form.
2.- Postman is used to test/evaluate the REST API endpoint to upload a file into AWS S3 bucket and then into a directory.


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


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



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



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


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1eslmioy2t2hzrrpz1dz.png)
Django 5.0 is here
Published: 2023-12-07 04:24:38

Django 5.0 is released 🎉🎉🎉

Lot of exiting changes to DjangoORM and more..

Let's take a brief look at what's new.

- Generated fields

The new GeneratedField enables the creation of database-generated fields, where values are automatically computed by the database itself based on other fields (and indexable too). For example, if you have `first_name` and `last_name` fields, you can use a GeneratedField to create a full_name property that is a combination of the two, allowing the database to handle the generation process.

- Database-computed default values

This was the last significant obstacle to fully representing the structure of Django models in the database schema. In Django versions prior to 5.0, the only option for setting a default value for a field was through Field.default, and it was calculated on the Python side, not in the database. The new Field.db_default option addresses this limitation by allowing the creation of default values directly in the database schema, providing a valuable improvement for consistency

- Form field group rendering

The new concept of form field group rendering makes field rendering simpler and more reusable. Now you can use `filed.as_field_group` to render separate fields without any inconsistencies.
Custom Themes and Dark Mode
Tags: webdev, opensource, design, python
Published: 2023-12-07 04:13:23

In the next couple of weeks, I'll be tackling a functionality that I've never really messed with before but always wanted to do, that being [Custom Themes](https://github.com/TheShiveshNetwork/Pokedex/issues/22) and [Dark Mode](https://github.com/TheShiveshNetwork/Pokedex/issues/12)!

## The Schematic

Considering I've never worked with these functionalities before, I'll have to do some research. For dark mode, I believe I'll use a library as it will be relatively easy to incorporate into the code. So far, I've looked at [darkmode-js](https://www.npmjs.com/package/darkmode-js) which seems like a pretty nice package for me to use. As for the custom themes, I believe I may have to crack out a Python web scraper mainly because I have some big plans for that, of course, I have a backup in case I'm heavily time-constrained or problems arise. 

## Updates

I'll be posting a couple of updates throughout the development process, I hope you can stick around and watch my progress through these brand-new implementations! Until next time, see ya.
Download a file from AWS bucket
Published: 2023-12-07 03:48:03

Here is the code:

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

This was the file:

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

And this is the result gotten:


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/smeg9bend4w7dg11py2z.png)
Upload a file in a bucket into a directory
Published: 2023-12-07 03:39:40

First, create manually the AWS S3 bucket, then enable ACLs to finally, run the code:


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


This generates this:


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