teleren/devto huggingface dataset:
Challenge: can you spot an error in C++ code?
Tags: cpp, programming, challenge, community
Published: 2022-07-04 11:29:01

PVS-Studio developers made an entertaining quiz for you. Try to quickly find a bug in a code fragment. If you spot an error - click on it.


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

Code analyzers restlessly search for errors. They can find even those that are hard to notice. We chose several code fragments in which PVS-Studio found errors. All fragments are from [open-source projects] (https://pvs-studio.com/en/blog/inspections/?utm_source=dev_to&utm_medium=articles&utm_content=quiz_cpp).

We encourage you to compete with our analyzer and find these errors yourself! You'll see ten code fragments. If you manage to find an error in under 1 minute, you score one point.

The 1-minute limit is made on purpose. Otherwise you'll definitely find all errors — code fragments are short. Anyway, treat this quiz as a game, and not as a real test of your programming skills :)

When you find an error, highlight it with a mouse, and click "Answer". Sometimes there are several places in code with an error. You can highlight any of them and the answer will be correct. I'll explain it with an example.

```
case FuriHalSubGhzPreset2FSKDev476Async:
  preset_name = "FuriHalSubGhzPreset2FSKDev476Async";
  break;
  FURI_LOG_E(SUBGHZ_PARSER_TAG, "Unknown preset");
default:
```

This code fragment is taken from the FlipperZero project. The PVS-Studio analyzer warns us that part of the code is never executed: [V779] (https://pvs-studio.com/en/docs/warnings/v779/?utm_source=dev_to&utm_medium=articles&utm_content=quiz_cpp) [CWE-561, CERT-MSC12-C] Unreachable code detected. It is possible that an error is present. subghz_i.c 44

The developer was probably in a rush and used a logging macro after the `break` operator. Or this is a result of unsuccessful refactoring. Anyway, the error here is obvious. But what should we highlight?

On the one hand, we can choose the break operator as an answer. It's before the `FURI_LOG_E` and breaks the `switch` operator execution. So, the problem's here.

On the other hand, we can choose the logging macro. This is the unreachable code.

Which is the correct answer then? This is easy. In this case, whatever we highlight — the `break` operator or the `FURI_LOG_E` macro — will be the correct answer.

Now I think the rules are clear. Good luck: [play the quiz] (https://quiz.pvs-studio.com/en/cpp/utm_source=dev_to&utm_medium=articles&utm_content=quiz_cpp).

Don't forget to share this quiz with your teammates! Have fun, and we wish you bugless code!
Size Units in CSS
Tags: webdev, beginners, tutorial, css
Published: 2022-07-04 11:16:19


Length or Size units play very important role in defining the ammount of space a block of element takes on the screen. in Most forms of software designing we use generally two types of size units.
1. **_Absolute or Fixed_**
2. **_Relative_**

Absolute size units are generally used in only designing and printing of sample screen etc. they are not used in live projects because size of device screen vary so much and using them will make project ugly and not tempting to use but still they are used in basic builduing and small testing projects. while on the other hand Relative units varry according the device size and are directrly proportional to size of screen. 
each size unit in css is written after a number of required size. i.e for example 2px,3cm,5mm,60vw,20vh etc. Note there is no space in between hose two (unit and number). we can omit the size unit if we wish to keep it zero.

we need size units in various properties of css. for example specifying the margins and padding,specifying font sizes,specifying border radius,specifying height and width of boxes etc.
below are some examples of fixed size units

```
/*length in centimetres*/
height: 10cm;
/* length in millimetres*/
height: 10mm;
/*length in inches a inch is equal to 2.54 cm */
height: 10in;
/*length in pixels a pixel is 1/96th part of inch*/
height: 10px;
/*length in points a point is 1/72 part of pixel*/
height: 10pt;
/*length in picas a pica is equal to 12 points*/
height: 10pc;
```
Relative size units are given below that are most commonly used in CSS.
**_em_** -it is a size unit that compares it size from the size of current font element. 2em means twice,0.5em means half,0.25em means one fourth etc.
`height: 0.5em;`
Top 10 SEO Tools You Need in 2022
Tags: seo, tools, 2022, google
Published: 2022-07-04 11:10:31

If you are working in the field of SEO or if you are managing a content or Ecommerce website then you should be always up to date with all the latest and most important SEO tools. 

SEO tools help us to rank our content on search engines. One more thing is very important that how fast your website loads. So if you are using WordPress for your website then I can convert your WordPress frontend to NextJS. And your website speed and SEO will increase extremely.


Don't forget to check my Gig - [I will convert your blog or news website to NextJS headless WordPress site](https://www.fiverr.com/santoshmlm/convert-your-blog-or-news-website-to-nextjs-headless-site)

So here is the list of Top 10 SEO tools that you need in 2022.

**1. Google Keyword Planner -** Designed for keyword research for Google Ads, Google Keyword Planner (GKP) is an invaluable tool in an SEO toolbox. This is mainly because the tool is from Google itself, and many SEOs believe its data is the most accurate.

**2. Ahrefs Webmaster Tools -** Monitor your website’s SEO health, see who’s linking to your website, and learn what your website is ranking for on Google 

**3. Ahrefs’ Keyword Generator -** See the top 100 keyword ideas for any seed keyword, as well as related search data

**4. ShortPixel -** Large images (in terms of file sizes) can take a longer time to load and, therefore, impact your page speed. 

**5. AlsoAsked -** Find People Also Ask questions. For almost every query you search for on Google, you’ll see a SERP feature is known as People Also Ask (PAA).

**6. Google Trends -** Google Trends shows the popularity of a topic over time.

**7. Google Search Console -** Use Google Search Console to find and fix technical errors on your website, submit sitemaps, see structured data issues, check your Core Web Vitals, and more.

**8. Google Analytics -** Google Analytics is quite likely the most used analytics tool out there. It’s no wonder—not only is it free, but it’s also powerful. It gives you a whole range of data for your website, which you can parse and dissect to improve almost every aspect of your marketing.

**9. Cloudflare -** A content delivery network (CDN) is a globally distributed server network that makes it quicker for users to access your website. It caches static content across its servers so that it can get content to load faster by serving it from a location near the visitor.

**10. GTmetrix -** Page speed has been a Google ranking factor since 2010. So if your site is extremely slow, this may be a reason why it’s not ranking as well as it can be.

Use GTmetrix to check your page speed and see how the page is performing.

I can also convert your WordPress frontend to NextJs. and your website speed and SEO will increase.

Don't forget to check my Gig - [I will convert your blog or news website to NextJS headless WordPress site](https://www.fiverr.com/santoshmlm/convert-your-blog-or-news-website-to-nextjs-headless-site)

You can also connect with me on Facebook - [Click here](https://www.facebook.com/sirmonu)
Let's have a quick look about most common HTTP STATUS codes and responses
Tags: webdev, programming, http, status
Published: 2022-07-04 10:47:12

## There are generally five levels of HTTP status:

**100s:** Informational codes indicate that the request initiated by the browser is continuing.

**200s:** Success codes returned when the browser request was received, understood, and processed by the server.

**300s:** Redirection codes returned when a new resource has been substituted for the requested resource.

**400s:** Client error codes indicate that there was a problem with the request.

**500s:** Server error codes indicate that the request was accepted, but an error on the server prevented the fulfillment of the request.

Let’s now look at some of the most common ones you will encounter.


Apart from them, three types of STATUS we are most familiar with. They are:

**- Successful Responses:** 200-299 (GOOD Status) 
**- Client-Side error:** 400-499 (BAD Status)
**- Server-Side error:** 500-599 (BAD Status)


However, we are not practically connected with all of these 300 STATUSES at a time. The most common STATUSES we are using regularly are only a few. Let's discuss them below-

 GOOD STATUSES FIRST #####

**Status 200 (OK)**
- the request has been processed successfully on the server.

**Status 201 (Created)**
- one or more new resources have been successfully created on the server and has led to the creation of a resource.

**Status 202 (Accepted)**
- the request has been accepted for processing. Which has not been completed or may not have started yet.

**Status 203 (No Content)**
- the server has successfully fulfilled the request and there is no content to send in the response.


 BAD STATUSES #####

**Status 400 (Bad Request)**
- message to inform you about your request's overarching result

**Status 401 (Unauthorized)**
- nope...! you are not supposed to be here. You don't have the AUTHORIZATION

**Status 403 (Forbidden)**
- ops! take permission first, you don't have that for this action.

**Status 404 (Page not found)**
- maybe the page you are looking for, it's incorrect. The server could not find the requested URL.


**Status 500 (Internal server error)**
- the server may have encountered some unexpected error while the request trying to reach the server. This error is usually returned by the server when no other error code is suitable.

**Status 502 (Bad gateway)**
-  the server on the internet received an invalid response from another server. You can try refreshing the web page, clearing your browser cache, and switching to another browser.

**Status 503 (Service unavailable)**
- the server is currently unavailable. Most of the time, it occurs because the server is too busy or maintenance is being performed on it.

**Status 504 (Gateway timeout)**
- times up! did not get a response in time from the upstream server. In other words, one server didn't receive a timely response from another server that it was accessing while attempting to load the web page or fill another request by the browser.
Chrome Extensions to make your life with css easy
Tags: css, productivity, beginners, webdev
Published: 2022-07-04 10:41:39

Working with CSS can be a brain-drainer, and it is not a hidden fact. Here are few chrome extensions that can make life easy when working and debugging css

**1. Whatfont**
Ever wondered what is that awesome font that you find on a site that you just visited, [whatfont](https://chrome.google.com/webstore/detail/whatfont/jabopobgcpjmedljpbcaablpmlmfcogm) can help you find it in a giffy
![whatfont](https://lh3.googleusercontent.com/CyGmJzJBUyaEwgAlsTqiCVRrkhKQpEaDHiXGLIbjJnQIz4txsgGuo-cNTeRDI2ljxAHjJFjM72xXTtJfvZrDx50Fnw=w640-h400-e365-rj-sc0x00ffffff)

**2. Visbug**
[Visbug](https://chrome.google.com/webstore/detail/visbug/cdockenadnadldjbbgcallicgledbeoc) is what I could call the swiss amry knife of a web developer, it providers easy inspection, modification of a web page
![visbug](https://portalzine.de/wp-content/uploads/sites/3/2019/02/visbug_browser_design_tool.jpg)

**3. CSS peeper**
[CSS peeper](https://chrome.google.com/webstore/detail/css-peeper/mbnbehikldjhnfehhnaidhjhoofhpehk) helps you to look into the web pages assets and styles without ever opening up your inspector
![css peeper](https://mac-cdn.softpedia.com/screenshots/CSS-Peeper_2.jpg)

**4. Emmet re:view**
[Emmet Re:view](https://chrome.google.com/webstore/detail/emmet-review/epejoicbhllgiimigokgjdoijnpaphdp),is the easiest way to check the responsiveness of a website
![emmet](https://lh3.googleusercontent.com/og19ii-_XXkaIYDepWFufuHFLlRIbcMyvJLuQRrXjHoO9jIE3GkiZ7DlPnEg1tPtHifJHUrXJ_Q4xBLmXRDHQ341Mkc=w640-h400-e365-rj-sc0x00ffffff)

Happy Coding!!
Perform Cross Browser Testing on Cloud with Cypress & LambdaTest | Cypress Tutorial | Part XIII
Tags: javascript, tutorial, beginners, cypresss
Published: 2022-07-04 10:26:06

Learn what is LambdaTest Cypress CLI and how to perform Cypress cross browser testing on cloud with LambdaTest. [Try LambdaTest now](https://accounts.lambdatest.com/register?utm_source=devto&utm_medium=organic&utm_campaign=jul04_sb&utm_term=sb&utm_content=tutorial_video)


Know more on LambdaTest Cypress Testing-: [https://www.lambdatest.com/cypress-testing](https://www.lambdatest.com/cypress-testing?utm_source=devto&utm_medium=organic&utm_campaign=jul04_sb&utm_term=sb&utm_content=tutorial_video)


This video is a part of our Cypress Testing Tutorial series for beginners. In this video, Chris DeSilva (@desilvadev) showcases how to leverage cloud-based cross browser testing platforms like LambdaTest to scale browser testing with Cypress using the LambdaTest Cypress Command Line Interface. You will also learn how to run multiple tests in parallel and analyze the overall performance through the LambdaTest dashboard. By the end of this video tutorial, you will know how to run Cypress parallel tests on the LambdaTest platform.

Also learn: 🔔
🔹What is Cypress command line interface?
🔹Why use LambdaTest Cypress CLI?
🔹How to set up LambdaTest Cypress CLI for cross browser testing with Cypress?
🔹How to perform Cypress testing With LambdaTest Cypress CLI?
What Are Cypress Actions? | GitHub Actions | Cypress Automation | Cypress Tutorial | Part XII
Tags: javascript, tutorial, beginners, cyress
Published: 2022-07-04 10:24:07

Learn how to set up GitHub actions to run Cypress tests. [Try LambdaTest now](https://accounts.lambdatest.com/register?utm_source=devto&utm_medium=organic&utm_campaign=jul04_sb&utm_term=sb&utm_content=tutorial_video)


Know more on LambdaTest Cypress Testing-: [https://www.lambdatest.com/cypress-testing](https://www.lambdatest.com/cypress-testing?utm_source=devto&utm_medium=organic&utm_campaign=jul04_sb&utm_term=sb&utm_content=tutorial_video)


GitHub actions makes it easy to automate all your software workflows in conjunction with world-class CI/CD tools. GitHub actions let you create, test, and deploy code directly from GitHub. 
This video is a part of our Cypress Testing Tutorial series for beginners. In this video, Chris DeSilva (@desilvadev) showcases the benefits of setting up the GitHub actions and how to use GitHub actions for running Cypress end-to-end tests.  In addition, this video helps understand the purpose of continuous integration to build out and trigger the GitHub action workflow with Cypress. 

Also learn: 
🔹What are Cypress actions?
🔹What are Cypress GitHub actions?
🔹What are GitHub actions?
🔹How to run Cypress actions in GitHub?
🔹How do I run Cypress tests in GitHub actions?
What Are Cypress Mouse Commands? | Cypress E2E Automation | Cypress Tutorial | Part XI
Tags: javascript, tutorial, beginners, cypress
Published: 2022-07-04 10:22:19

This Cypress Testing Tutorial deep dives into the fundamentals of the Cypress Mouse Events, wherein you’ll learn how to handle mouse hover events in Cypress, and much more. [Try LambdaTest now](https://accounts.lambdatest.com/register?utm_source=devto&utm_medium=organic&utm_campaign=jul04_sb&utm_term=sb&utm_content=tutorial_video)


Know more on LambdaTest Cypress Testing-: [https://www.lambdatest.com/cypress-testing](https://www.lambdatest.com/cypress-testing?utm_source=devto&utm_medium=organic&utm_campaign=jul04_sb&utm_term=sb&utm_content=tutorial_video)


This video is a part of our Cypress Testing Tutorial series for beginners. In this video, Chris DeSilva (@desilvadev) showcases what are Cypress Mouse Commands and Mouse Events in Cypress. Mouse events include mouse hover operation, right mouse button, long mouse press, drag & drop, and more. Furthermore, he also demonstrates how to use the trigger commands and action slash commands. By the end of this video, you’ll also know how to create a hover effect using Cypress Mouse Commands. 

You will also learn: 
🔹How do you right-click on Cypress?
🔹How do you pass multiple true Cypress?
🔹How do you click elements in Cypress?
🔹How do you perform mouseover operation in Cypress?
Common Ninja's Summer Hackathon: Build E-Commerce Apps, and Win Awesome Prizes!
Tags: webdev, ecommerce, hackathon, javascript
Published: 2022-07-04 10:18:10

The e-commerce market is huge and presents numerous opportunities for developers and companies to bring their innovation and creativity forward and solve problems for merchants and their customers.

From tools that improve conversions, to smart automations that optimize sales, to useful apps that help bring more customers and more.

We're happy to announce a Common Ninja's virtual hackathon for **e-commerce app developers** 🎉

In the hackathon, you will build an e-commerce app using Common Ninja's universal API for commerce. You'll only need to focus on building the app’s functionality while the Common Ninja platform will take care of the integrations, authentication and monetization of your app.

**Registration ends on July 7th, 2022. So hurry up!**

Register and learn more about the hackathon below 👇🏻
[https://www.commoninja.com/hackathon-2022/](https://www.commoninja.com/hackathon-2022/)
logging in cloudwatch
Tags: python, aws, cloudwatch
Published: 2022-07-04 10:13:29




Settingup cloudwatch client in server 

```
sudo aws configure
sudo yum install amazon-cloudwatch-agent
```

verify installation using below commands

```
cat ~/.aws/credentials
cat ~/.aws/config
```

To check cloudwatch status using below commands or [here](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/ReportCWLAgentStatus.html)
```
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -m ec2 -a status
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -m ec2 -a stop
sudo /opt/aws/amazon-cloudwatch-agent/bin/amazon-cloudwatch-agent-ctl -m ec2 -a start

```



Setting up python environment

```

#pip install python-json-logger
#pip install boto3
#pip install watchtower

import boto3
from pythonjsonlogger import jsonlogger
import watchtower

credentials = boto3.Session().get_credentials()
access_key = credentials.access_key
secret_key = credentials.secret_key
region = ""

cloudwatch_client = boto3.client("logs", 
region_name=region,
aws_access_key_id=access_key,
aws_secret_access_key=secret_key
)



def get_logger(log_group, logger_name):    
    logger = logging.getLogger(logger_name)
    logger.setLevel(logging.DEBUG)
    
    formatter = jsonlogger.JsonFormatter(fmt='%(asctime)s :: %(lineno)s :: %(levelname)-8s :: %(name)s ::  %(message)s')
    
    handler = watchtower.CloudWatchLogHandler(log_group_name=log_group, log_stream_name=logger_name, boto3_client=cloudwatch_client)

    handler.setFormatter(formatter)
    logger.addHandler(handler)
    return logger


log_group = "app_name"
login_logger = get_logger(log_group, "login")


```




Reference:
- https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/install-CloudWatch-Agent-commandline-fleet.html
- https://docs.exasol.com/db/latest/administration/aws/monitoring/aws_cloudwatch_agent.htm

- [Cloudwatch setting with IAM role](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/QuickStartEC2Instance.html)
Creating Your Own Voice Assistant in Python
Tags: python, tutorial, webdev, programming
Published: 2022-07-04 10:10:59

Let’s be honest with ourselves, at some point in our lives we wanted our own Jarvis. There’s something incredibly awesome about having a personal voice assistant to be able to give us information, manage our schedules, and just help us out with our day to day lives.

In this article, we’ll build a foundation with python that you can use to build your own personal voice assistant.

---

###How the Voice Assistant Works

The foundation of our program will be a speech recognition library and a Text to speech library(TTS) which will allow us to communicate with our script purely through audio.

The script will run on a loop of:
* Waiting for a command from the user
* Understanding and fulfilling a command

We’ll add some basic examples to do some small talk, tell the time, open apps and a few other things. This foundation can very easily be augmented to add whatever functionality you might want from your assistant. If you can do it in python, you can make the bot do it.

---

###Setup
In a new python project, first install the speech recognition library with:

`pip install SpeechRecognition`

And install the TTS library with:

`pip install pyttsx3`

---

###The Code
In a python file, we’re then going to:
* Load in our imports
* Configure the text to speech
* Define our speech function


{% gist https://gist.github.com/LiorB-D/bed419f05be6a79e532b756f24a90bbd %}

The bot above can fulfill the following commands:
* Tell the time
* Give a random number
* Open and Close Slack

---
###Building More

Whatever tasks you want your assistant to complete, you can now simply add another conditional to the list!

Of course, you can add a lot more complexity:
* Power the assistant w/ Conversational AI via [Rasa](https://codesphere.com/articles/create-your-own-ai-chatbot-in-minutes-with-rasa)
* Play music with the Spotify API
* Pull information from wikipedia via [Web Scraping](https://codesphere.com/articles/scrape-your-first-website-in-minutes-with-python)

That’s all for today!

Got any questions? Let us know down below.

As always, happy coding from your friends at [Codesphere](https://link.codesphere.com/OO), the swiss army knife that every development team needs!
Saviom Software PTY.LTD
Published: 2022-07-04 09:48:48

[Saviom](https://www.saviom.com/?utm_source=Content_Promotion&utm_medium=backlinks&utm_campaign=backlinks&utm_id=backlinks) is a world leader in providing **[Enterprise Resource Management](https://www.saviom.com/resource-management-software.php)** and Workforce planning solutions. Saviom's solution has been implemented by many Fortune 500 companies, including but not limited to Siemens, Telstra, Fujitsu, GWS. It has helped organizations to optimize their workforce and improve overall 
business efficiency. Its forecasting capabilities enable organizations to enhance profitable utilization, reduce 
bench time, and minimize hiring/firing costs.
 
Saviom's solutions can be customized for any specific industry. Its highly configurable interface allows users to personalize the software as per business needs and individual stakeholders’ requirements. Saviom's UI and UX capabilities are carefully designed for easy navigation that helps users find the required information effortlessly without going through too many clicks. The software’s open API seamlessly integrates with critical business applications eliminating duplication efforts and ensuring data consistency. 

Saviom's multidimensional resource scheduler maintains a single version of the truth to enable real-time decision-making without conflicting existing resource bookings. Moreover, role-based secured access to the data and seamless resource requisition process helps overcome matrix organization complexities. Powered by real-time business intelligence, Saviom's reports, analytics, and dashboards improvise the organization's health index. The software’s collaboration platform streamlines effective communication across the enterprise to avoid missing any critical updates or information. 

Already five years ahead of the market, Saviom's innovative resource management software has become a game-changer in the project management landscape. By assisting businesses in reducing resource costs significantly and maximizing profitable utilization of resources, Saviom’s futuristic solution is helping customers deliver more projects with fewer resources