teleren/devto huggingface dataset:
Magic 8 Ball
Tags: beginners, cpp, showdev
Published: 2022-12-27 17:25:09

Magic 8 Ball originally was a class project from my most recent Summer course, however the professor required that we not post that code anywhere, so I’ve been refactoring it so it doesn’t match what we originally did, while staying true to the Magic 8 Ball idea.

I started out by searching for the possible options for a real Magic 8 Ball, cleared out the array and added them in. From there I updated the class private variables to remove unneeded variables, and set the default constructor to be empty.

I’ve been working on sticking to the DRY method, “Don’t Repeat Yourself”, so I moved the “checking” code (which evaluates the input by capitalizing and comparing it) into its own function. I also updated the main driver code so that the four other functions call each other, removing the need for a while loop. After the first shake is completed, the three other functions bounce from one to another while the user wants to continue shaking the Magic 8 Ball. Once the user inputs N, the driver code ends.

Wrapping up editing the small project by updating my Class UML, I realized that although I haven’t been coding in C++ since moving on from my most recent college Computer Science course, it really is like riding a bike and comes right back to me when I hop back into it. All in all, I had fun with the original project and enjoyed refactoring this very small game so I hope you enjoy!

Play it: https://replit.com/@Meg-Div/Magic-8-Ball#main.cpp

The Code: https://github.com/Meg-Div/DigitalCraftsProjects/tree/main/Magic8Ball
HIRING Full Stack Web Developers in US!
Tags: webdev, hiring, community
Published: 2022-12-27 17:22:14

MUST BE PROFICIENT IN ENGLISH!!!

Hello everyone! My company, Buchwald Digital Consulting is hiring! Our services include advertising, design, social media, and data management. At BDC, our mission is to help our clients achieve their goals, and we are always looking for new ways to innovate and improve our services. 

FLEXIBLE HOURS and PAY PER PROJECT (Subject to change)

APPLY HERE: https://forms.gle/whnd6cnhYFtFSFHL9

Application due DEC 30!

After applying, I will personally send you an email to schedule an interview. 

Best Regards,

Josh Buchwald
CEO
Buchwald Digital Consulting
Pixel art studio
Tags: codepen
Published: 2022-12-27 17:15:59

<p>Draw your pixel drawing on the canvas, then copy the CSS! Very much inspired by <a href="https://make8bitart.com/" target="_blank">https://make8bitart.com/</a></p>

{% codepen https://codepen.io/harunpehlivan/pen/VwBeprZ %}
Just saying hi and thanks to the dev.to community
Tags: community, thanks, welcome, devjournal
Published: 2022-12-27 17:05:08

Hi everybody! This is my first post here and I wanted to introduce myself to the awesome dev.to community. 

First of all I am very grateful to everyone for writing such useful articles. It did help me several time to debug my own projects, this community is essential for the well-being of the whole developer community no matter the topic. 

Keep up the good work and I will try to give back the best I can ! 

Nick
My first React project
Tags: react, beginners, webdev, showdev
Published: 2022-12-27 16:57:49

I asked [how to get motivation to learn React](https://dev.to/notaethan/how-do-i-make-myself-learn-5h4c) and to my surprise that its self gave me some motivation. I made a "skill card" using React components.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2v7b06lhixoeuqfc5st8.png)
How to host a website on GitHub
Published: 2022-12-27 16:48:34

GitHub is a company that hosts “code repositories”, collections of code for projects. Many of the code repositories are “open source”, which means they’re publicly available for the whole world to browse. That’s awesome because that’s how programmers learn from each other and build on each other’s work! Khan Academy has quite a few open-source repositories. Code repositories can contain all sorts of types of code, not just HTML and CSS – whatever code is needed to make the project work.

Why am I telling you about them? Well, GitHub has a feature called GitHub Pages, which makes it easy and free for you to create a multi-file website hosted at yourusername.github.io.

Note: Khan Academy is not affiliated with GitHub. Please consult the GitHub Terms of Use and other policies before deciding to sign up for an account, especially if you are under 13 years of age.

Sign up for a GitHub account

Visit github.com, and you’ll see a signup form on their front page. (If you don’t, congrats, you already have an account! You can skip to Step 2).
For more go to following link
[Follow link](https://amlogy.com/how-to-host-a-website-on-github/)
Second Largest Num in Array
Published: 2022-12-27 16:39:10

Approach:
1. First got the max num from array.
2. Using the above max num, got the second max num
3. If the 2nd Largest num is present, I have returned it.
4. If such 2nd largest num is absent, I have returned -1.

```
int Solution::solve(vector<int> &A) {
    int max_num = INT_MIN;
    int max_sec = INT_MIN;
    int n = A.size();


    for(int i = 0; i < n; i++)
    {
        max_num = max(max_num, A[i]);
    }

    for(int i = 0; i < n; i++) 
    {
        if(A[i] != max_num)
        {
          max_sec = max(max_sec, A[i]);
        }
    }

    if(max_sec != INT_MIN)
    {
        return max_sec;
    }
    else{
    return -1;
    }
}
```
How to create apk files
Tags: apk, webdev, gamedev, programming
Published: 2022-12-27 16:33:47

Creating an APK file (Android Package Kit) is a simple process that allows you to package your Android app for distribution and installation on other devices. This can be useful for sharing your app with others or for publishing it to the Google Play Store. Here's a step-by-step guide on how to create an APK file:

Open your Android Studio project.

Click on the "Build" menu and select "Generate Signed Bundle / APK".

Choose the type of APK you want to create. If you want to publish your app to the Google Play Store, select "Release". If you just want to create an APK for testing, select "Debug".

Select the "Next" button and choose the keystore you want to use to sign your APK. If you don't have a keystore, you can create one by clicking on the "Create new" button.

Enter the necessary information to create your keystore, including the keystore and key passwords.

Click on the "Finish" button to create your [APK file](https://apkgoods.com/).

Your APK file will be saved to the specified location, and you can now share it with others or publish it to the Google Play Store. Keep in mind that you may need to make some adjustments to your app's manifest file before publishing it to the Play Store, such as adding permissions and declaring your app's features.

I hope this guide helps you create an APK file for your Android app. If you have any questions or need further assistance, don't hesitate to ask!
Idempotence
Published: 2022-12-27 10:07:06

## What & Why

ในระบบปัจจุบัน มันยากที่จะระบบใดๆ จะสามารถการันตีการทำงานแบบ exactly once ได้ ฉะนั้นแล้ว service ใดมีโอกาสที่จะเจอปัญหา duplication request/events เข้ามาในระบบได้เสมอ วิธีการที่ practical กว่า คือที่ฝั่ง consumer ของระบบจะต้องทำให้ operation นั้นมีคุณสมบัติเป็น Idempotent กล่าวคือ เมื่อมี duplicate request/event เกิดขึ้น ระบบจะสามารถจัดการกับปัญหาได้โดยไม่สร้าง duplication record หรือ side effect ที่ไม่พึงประสงค์ในระบบ

วิธีการที่ง่ายที่สุดเพื่อสร้าง Idempotency ให้กับระบบที่ต้องยุ่งกับ database คือพิจารณาว่า เราสามารถทำ upsert กับข้อมูลได้หรือไม่ หรือเราสามารถ ignore ข้อมูลที่ถูกลบไปแล้วได้หรือไม่ เพราะวิธีนี้ เราไม่ต้องจำว่า request ที่เข้ามาใหม่นั้นเคยประมวลผลไปแล้วหรือยัง

แต่ไม่ใช่ทุกครั้งที่เราจะทำ upsert ได้ ฉะนั้นแล้ว อีกเทคนิคหนึ่งที่ช่วยได้ กล่าวคือ ในฝั่ง consumer จะต้องจดจำ message/request id ที่เคยได้รับมา เมื่อมี message/request id ที่ซ้ำเข้ามาอีก ก็อาจจะเลือก ignore ต่อ operation นั้นไปได้เลย

## Values & Enablers

- หลีกเลี่ยงปัญหา การทำ operation ใดซ้ำ เมื่อได้รับ message เดิมเข้ามา

## Guidelines

- พิจารณาใช้เทคนิคนี้เมื่อจำเป็นเท่านั้น เช่นกรณีที่ operation ไม่สามารถทำ upsert ได้ อย่างเช่น การหลีกเลี่ยงการส่ง email ซ้ำๆ เป็นต้น
- เลือกบันทึกเก็บไว้ในฐานข้อมูล ซึ่งทีมอาจจะพิจารณาใช้ Redis หรือ in-memory database ใดๆ เพื่อให้ได้ประสิทธิภาพสูงสุด
- ทีมควรพิจารณาตั้งค่า expiry date ให้กับข้อมูล โดยตั้งเวลาให้เหมาะสมกับเรื่องนั้นๆ เพื่อหลีกเลี่ยงปัญหาข้อมูลบวม
- ให้พิจารณาโอกาสที่ระบบจะถูก replay event ประกอบการตั้งเวลา expiry date ด้วย

## Cautions

- หากตั้ง expiry date เร็วเกินไป ก็จะทำให้เกิด duplicate operation ได้อยู่ดี

## References

- [Handling Duplicate Messages (Idempotent Consumers)](https://codeopinion.com/handling-duplicate-messages-idempotent-consumers/)
- [Handling duplicate messages using the Idempotent consumer pattern](https://chrisrichardson.net/post/microservices/patterns/2020/10/16/idempotent-consumer.html)
Luos Bootloader - upgrade your application software quickly
Tags: opensource, productivity, tooling, luos
Published: 2022-12-27 16:30:58

The **Luos Bootloader** will quickly upgrade your application software without using specific programming tools and without physically accessing your boards. 

Everything that is new and updated about the Luos Bootloader can be found in the documentation. 

⏩Discover more [here] (https://www.luos.io/docs/tools/boot)
Flutter Login Screen UI Design for GetX Clean Architecture
Tags: flutter, tutorial, programming, ux
Published: 2022-12-27 16:27:52

{% embed https://www.youtube.com/watch?v=ikKhLqxeq3A %}

If you want to learn about login screen design with flutter then this video will help you to learn about flutter login screen design easily. Here I am explaining a Very Simple Login Design with Flutter and GetX Clean Architecture. This tutorial is the best for Beginners who wanted to start learning about flutter design the see this tutorial. It will be Helping you to create a decent login screen yourself.

You can Checkout the Source Code:
https://github.com/imshibaji/getx_clean_app_tutorial


If you like my efforts and you would really like to support 
Please Support Me on Instamojo: https://www.instamojo.com/@shibaji/
-------------------
Visit My Website: https://www.shibajidebnath.com/
Like My Facebook Page: https://www.facebook.com/iamshibaji
Connect With Me on LinkedIn: https://www.linkedin.com/in/shibaji/
Subscribe to my Channel: http://bit.ly/2KfBqZ3
--------------
EVERYONE STRUGGLES
Tags: programming, beginners, outreachy, opensource
Published: 2022-12-27 16:21:28

> Strength and growth come only through continuous effort and struggle [Napoleon Hill]

A journey without struggle is no journey at all, The hardest step to take in a journey is always the first. commitment, readiness to learn and being opened to opinion should see one through the journey. 

It has been 3 weeks being an intern with Mboalab in the Outreachy Internship programme.

As a Intern, I find myself overwhelmed most of the time. With the ever-changing technologies and the fast-paced modern world, I tend to pass through some challenges.
From the need to balance work and life and to advance in your career as a programmer, sometimes I think a lot is vested on my chest. Having to learn new Technologies and Learning new Things. 

Nobody is an expert, but learning, practicing, and growing is what we can do. So I, with my fellow interns decided to accept this challenge and started learning about ML after discussing it with mentors, We are building a digital stethoscope android application. The greatest tool as a programmer is knowing the question to ask and when to ask the question to prevent time wasting. Everyone struggles but asking for help and asking the right question goes along way to solving different issues.
Exploring the Power of new.target in JavaScript
Tags: javascript, webdev, beginners, tutorial
Published: 2022-12-27 16:10:01

In JavaScript, the new.target property is a meta-property that can be used to determine whether a function was called with the new keyword. It returns a reference to the constructor function that was invoked with the new keyword, or undefined if the function was not called with new.

```js
function MyClass() {
  if (new.target) {
    console.log('MyClass was called with new');
  } else {
    console.log('MyClass was not called with new');
  }
}

new MyClass(); // MyClass was called with new

MyClass(); // MyClass was not called with new
```

new.target can be useful for implementing custom constructor functions, where you want to ensure that the function is always called with new, or for creating abstract base classes that cannot be instantiated directly.

```js
function MyClass() {
  if (!new.target) {
    throw new Error('MyClass must be called with new');
  }
}
```

###### If you enjoyed reading this short blog, you may also want to check out my javascript short playlist on [YouTube](https://www.youtube.com/watch?v=mFwtywr81RM&list=PLAAFB8z-Xn4HDljSfyQ__smRZcOgAYeKd).

---

##### Must Read If you haven't

###### [3 steps to create custom state management library with React and Context API](https://dev.to/devsmitra/3-steps-to-create-custom-state-management-library-with-react-hooks-and-context-api-1bfh)

###### [How to cancel Javascript API request with AbortController](https://dev.to/devsmitra/how-to-cancel-javascript-api-request-with-abortcontroller-36cm)

###### [Getting started with SolidJs – A Beginner's Guide](https://dev.to/devsmitra/getting-started-with-solidjs-a-beginners-guide-5af4)

---

###### More content at [Dev.to](https://dev.to/devsmitra "Rahul Sharma(DevsMitra)").

###### Catch me on [YouTube](https://www.youtube.com/@devsmitra?sub_confirmation=1 "Rahul Sharma(DevsMitra)"), [Github](https://github.com/devsmitra "Rahul Sharma(DevsMitra)"), [Twitter](https://twitter.com/devsmitraa "Rahul Sharma(DevsMitra)"), [LinkedIn](https://www.linkedin.com/in/rahul-sharma-18b8b374 "Rahul Sharma(DevsMitra)"), [Medium](https://devsmitra.medium.com "Rahul Sharma(DevsMitra)"), [Stackblitz](https://stackblitz.com/@devsmitra "Rahul Sharma(DevsMitra)"), [Hashnode](https://devsmitra.hashnode.dev "Rahul Sharma(DevsMitra)"), [HackerNoon] (https://hackernoon.com/u/devsmitra "Rahul Sharma(DevsMitra)"), and [Blogspot](https://devsmitra.blogspot.com "Rahul Sharma(DevsMitra)").
How do i link the socket.io to user on react
Published: 2022-12-27 11:40:50

1. **To link a socket to a user in a React application**, you can follow these steps:

Install the socket.io library:

```
npm install socket.io
```

2. In your React component, import the socket.io library and create a new socket connection:

```
import io from 'socket.io-client';

const socket = io('http://localhost:3000');
```

3. To link the socket to a specific user, you can pass the user's unique identifier (e.g. their username or ID) as a query parameter when connecting to the socket:

```
const socket = io('http://localhost:3000', {
  query: {
    userId: 'abc123'
  }
});
```

4. On the server side, you can access the user identifier by reading the query property of the socket object:

```
io.on('connection', socket => {
  const userId = socket.handshake.query.userId;
  // ...
});
```

5. You can then use the user identifier to associate the socket with the specific user in your database or other storage system.

> Keep in mind that this is just one way to link a socket to a user in a React application. There are many other approaches you can take, depending on your specific needs and requirements.

**there are several ways to make the process of linking a socket to a user more secure. Here are a few approaches you can consider:**

**Use an authenticated connection:** Instead of passing the user identifier as a query parameter, you can use an authenticated connection to link the socket to the user. For example, you could use an access token or a JWT (JSON Web Token) to identify the user. This approach is more secure because the user identifier is not transmitted in plain text over the network.

**Verify the user identifier on the server:** Once you receive the user identifier from the client, you should verify that it is valid and belongs to the correct user. This can help prevent unauthorized users from connecting to the socket using a forged or manipulated user identifier.

**Use encrypted connections:** To protect the confidentiality and integrity of the data transmitted over the socket, you should use encrypted connections (e.g. SSL/TLS). This will prevent third parties from intercepting or tampering with the data.

**Use rate limiting:** To prevent denial-of-service (DoS) attacks, you can implement rate limiting on the server to limit the number of connections allowed from a single IP address within a given time period.

It's important to keep in mind that security is a multifaceted issue, and there is no one-size-fits-all solution. You should consider the specific needs and requirements of your application, and implement the appropriate measures to ensure the security of your users and their data.
CodePen Designs - 12 : Pixel art studio
Tags: codepen, css, design, codependesigns
Published: 2022-12-27 16:03:13

### We are excited to introduce our new series that will explore the best design ideas from the Codepen community. 

We will be publishing these each day and hope you find them insightful and inspiring as we showcase some of the most talented designers in this space.

---


#### Codepen Design - 12

<p>Draw your pixel drawing on the canvas, then copy the CSS! Very much inspired by <a href="https://make8bitart.com/" target="_blank">https://make8bitart.com/</a></p>

{% codepen https://codepen.io/michellebarker/pen/WNKbQOO %}



---
## For more information

1. Check my GitHub profile
[https://github.com/amitSharma7741](https://github.com/amitSharma7741)

2. Check out my Fiver profile if you need any freelancing work
[https://www.fiverr.com/amit_sharma77](https://www.fiverr.com/amit_sharma77)

3. Check out my Instagram
[https://www.instagram.com/fromgoodthings/](https://www.instagram.com/fromgoodthings/)

4. Linktree
[https://linktr.ee/jonSnow77](https://linktr.ee/jonSnow77)

5. Check my project

- EVSTART: Electric Vehicle is the Future
[https://evstart.netlify.app/](https://evstart.netlify.app/)
-  News Website in react
 [https://newsmon.netlify.app/](https://newsmon.netlify.app/)
-  Hindi jokes API
 [https://hindi-jokes-api.onrender.com/](https://hindi-jokes-api.onrender.com/)


---
---
QA audit for e-commerce: why is it worth trying?
Tags: testing, test
Published: 2022-12-27 15:56:07

1. To received professional and unbiased feedback on the overall application quality from the customer's perspective.
2. To detect bottlenecks in the key purchase-sales flows on your site that directly influence sales and conversion rate.
3. To get a detailed QA audit report along with recommendations for optimized user experience.
4. To receive an action plan for enhancing the functional, usability, and accessibility spaces of your product.

Reach us out at info@ok-qa.com for a comprehensive consultation or to receive a detailed outline of our QA audit for the online store. https://www.ok-qa.com/
Becoming a Frontend Engineer - Getting Started
Published: 2022-12-27 15:55:22

In the previous article on becoming a frontend engineer, I introduced what frontend engineering is all about, explaining the three aspects of frontend engineering. If you haven’t read it, you can read it here. In this article, I will be presenting the first aspect of frontend engineering (Text) in detail.

The text of a web application is added using the HyperText Markup Language (HTML).  

**Creating an HTML File**
To create an HTML file, the filename should have an extension of .html. For example  index.html, or file.html. To add text to a front-end web application using HTML, you’ll need to utilize something called a code editor. 

A code editor is an application created to help software engineers write programming languages to create applications. There are several code editors like: Sublime Text, Notepad++, Atom, Visual Studio Code, etc. But I would recommend that you use Visual Studio Code because it is easy to use, has a large community of users (to help when you have issues), and many extensions to make your coding experience better. 

For the purpose of this article, download VScode and open it on your computer. Click on the  “New File..” icon, and then name it index.html. Congratulations, you’ve successfully created your first HTML file!

**Writing HTML**
HTML involves writing what you want the application to do in between tags. I’ll explain what I mean, but first, what is a tag? An HTML tag is a keyword that specifies how the web browser will format and display the content. 

There are three different types of tags:
The Opening tag: An opening tag looks like this `<p>`. That’s a “p” tag used to create a paragraph. There are different tags for different purposes, and you will learn them as you go.


The Closing tag: All opening tags must have a corresponding closing tag. A closing tag looks like this `</p>`. The difference is the slash “/” before the tag content. So when I said HTML involves writing in between tags, I meant in between the opening and closing tags. For example, if I want to write a paragraph, it would look like this 

```
<p>I am a boy</p>
```
.


The Self-closing tags: This tag doesn’t need to be closed. It is different from opening and closing tags. It is written like this `<hr/>`. The “hr” tag is used to create a horizontal line on the webpage. It is important to know if the tag you are writing is a self-closing tag, but it will get better as you learn.  


**Conclusion**
Understanding how to write HTML properly is important, as good HTML helps with accessibility, SEO, and styling, amongst other things. There are a lot of sites online to learn the basics of HTML. A good place I can recommend to begin learning and improving your HTML is w3schools. You can build simple HTML projects when you complete the modules. I hope you have fun learning!
QA audit: what for and when to perform?
Published: 2022-12-27 15:54:13

You can read numerous promos stating that it's high time to get your online store ready for the Xmas and New Year sales rush.🎄 Run proper functional testing, pay attention to the main customer journey paths and overall usability, and do not forget about accessibility.

And this is the right advice.💯 A proper QA audit of your online store is the first step towards improving the conversion rate and increasing sales.

But is the advice relevant only for the holiday season?

Our team believes that this is an issue to take care of regardless of the time of the year. QA audit for e-commerce from the OKQA team includes:
✔️Functional audit
✔️Usability audit
✔️Accessibility
✔️Stability and security audit.

What you get:
🎯Summary report with a list of all detected issues, explanations, and recommendations for further improvements.
🎯Annotated screenshots.
🎯Dedicated QA manager for consultation during the QA audit process.
🎯2 revisions.
🎯Reviewed environments: PC (Chrome, Firefox, Edge), Mac (Safari), Mobile (Chrome Android, Safari iOS).
https://www.ok-qa.com/