teleren/devto huggingface dataset:
C Program For Working Calculator.
Tags: beginners, c, ssdf
Published: 2021-11-11 12:35:45

Here Is The Complete C Programming Code For Working Calculator.
``` C
#include<stdio.h>
int main()
{
    int a, b;
    char op;
    float result;
    printf("Enter First Number:");
    scanf("%d", &a);
    printf("Enter Second Number:");
    scanf("%d", &b);
    printf("Enter Operater What Do You Want:");
    scanf(" %c", &op);
    switch (op)
    {
    case '+':
        result=a+b;
        printf("The Sum Is %f", result);
        break;
    case '-':
        result=a-b;
        printf("The Subtract Is %f", result);
        break;
    case '*':
        result=a*b;
        printf("The Multiply Is %f", result);
        break;
    case '/':
        result=a/b;
        printf("The Division Is %f", result);
        break;
        default:
    printf("Please Enter Envalid Operater");
        break;
    }
}
```
Code Smell 101 - Comparison Against Booleans
Tags: webdev, beginners, programming, tutorial
Published: 2021-11-11 12:33:16

*When comparing to booleans, we perform magic castings and get unexpected results.*

> TL;DR: Don't compare against true. Either you are true, or false or you shouldn't compare

# Problems

- Hidden castings

- The least surprise principle violation.

- [Fail Fast](https://dev.to/mcsee/fail-fast-48dm) principle violation

# Solutions

1. Use booleans

2. Don't mix booleans with *boolean castable objects*

# Context

Many languages cast values to boolean crossing domains.

# Sample Code

## Wrong

[Gist Url]: # (https://gist.github.com/mcsee/118ff2e5ebd9779675f664ed46bae95d)
```bash
#!/bin/bash

if [ false ]; then
    echo "True"
else
    echo "False"
fi

# this evaluates to true since 
# "false" is a non-empty string


if [ false ] = true; then
    echo "True"
else
    echo "False"
fi

# this also evaluates to true
```

## Right

[Gist Url]: # (https://gist.github.com/mcsee/405d45ed06a94a81d1f1a3b06381c0f9)
```bash
#!/bin/bash

if  false ; then
    echo "True"
else
    echo "False"
fi

# this evaluates to false   
```

# Detection

[X] Automatic 

Linters can check for explicit comparisons and warnings.

# Tags

- Castings

# Conclusion

It is a common industry practice to use many non booleans as booleans. 

We should be very strict when using booleans.

# Relations

{% post https://dev.to/mcsee/code-smell-69-big-bang-javascript-ridiculous-castings-49ij %}

# More Info

{% post https://dev.to/mcsee/fail-fast-48dm %}

# Credits

Photo by <a href="https://unsplash.com/@michaelheld">Michael Held</a> on <a href="https://unsplash.com/s/photos/disguise">Unsplash</a>
  
* * *

> If it doesn’t work, it doesn’t matter how fast it doesn’t work.

_Mich Ravera_
 
{% post https://dev.to/mcsee/software-engineering-great-quotes-26ci %}

* * *

This article is part of the CodeSmell Series.

{% post https://dev.to/mcsee/how-to-find-the-stinky-parts-of-your-code-1dbc %}
Getting Started with Fast API and Docker
Tags: beginners, python, docker, fastapi
Published: 2021-11-11 12:33:05

##Fast API
**Fast API** is a web framework for building APIs with Python 3.6+ based on standard Python type hints. It is one of the fastest python frameworks available and very easy to learn and use.

##Installation of fastapi on windows
     pip install fastapi
     pip install uvicorn
##Installation on MacOS and Linux
     %pip install fastapi
     %pip install uvicorn
###An Example
###Create a python file and save as myapp.py with:
     from fastapi importFastAPI
     app=FastAPI()
     @app.get("/")
     async def greetings():
         return "Helloo my viewer. Really proud of you!!"
###Then run the server with the command:
     uvicorn myapp:app --reload
####The server is open when the following info shows up:
       INFO:     Uvicorn running on http://127.0.0.1:8000 (Press 
       CTRL+C to quit)
       INFO:     Started reloader process [28720]
       INFO:     Started server process [28722]
       INFO:     Waiting for application startup.
       INFO:     Application startup complete.
Then open your browser at http://127.0.0.1:8000
You will see the JSON response as:
```"Helloo my viewer. Really proud of you!!"```
To see the automatic interactive API documentation add '/docs' to your url i.e (http://127.0.0.1.8000/docs):
![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/syfhvyyv5pasmg3i8wcw.PNG)
##Docker
**Docker** is an open source platform for building ,deploying and managing containerized applications.
**Docker file** is a text document that contains all the commands a user could call on the command line to assemble an image
**Docker image** is a read-only, inert template that comes with instructions for deploying containers.
**Docker container** is a virtualized runtime environment that provides isolation capabilities for separating the execution of applications from the underpinning system.

In Python requirements.txt file is a type of file that usually stores information about all the libraries, modules and packages in itself that are used while developing a particular project.
####Creating a requirements.txt file:
    pip freeze > requirements.txt
###Docker python application:
####we need to create a directory
     cmd docker-python-app
####Then enter into the directory and create a Dockerfile with:
    FROM python:3.6
    COPY . /src  
    CMD ["python", "/src/index.py"] 
####Then create a python file(This python file(index.py) will be executed in the docker container.) with:
       print("Hello Docker!!")
####creating a docker image for the python application:
     $ docker build -t python-app 
####Then run docker with:
    $ docker run python-app 

Hope this was useful, please feel free to leave your comments below.
Neovim Tip, Smarter Path
Tags: neovim, vim, lua, productivity
Published: 2021-11-11 22:17:40

---
title: Neovim Tip, Smarter Path
published: true
date: 2021-11-11 00:00:00 UTC
tags: [neovim, vim, lua, productivity]
canonical_url: https://teukka.tech/posts/vimtip-path/
---

## Intro

Fuzzy finders can be a good tool for navigating files in a codebase, but they don't give you the same functionality as a properly set `path` option in vim. Key mappings like `gf`, `[i`, `[d`, and commands like `:find` depend on having your path set correctly to find the file you're searching for. Using the `:find` command also gives us the ability to tab complete a file name, a feature which fuzzy finders do not offer.

An poorly set path can cause a significant slow down when trying to tab complete a filename with `:find`, or jump to a file with `gf`, especially if you work with languages like javascript where projects contain the fathomless void known as `node_modules`.

In his [excellent gist](https://gist.github.com/romainl/7e2b425a1706cd85f04a0bd8b3898805), romainl illustrates how a well set path can make navigating a codebase quick and easy, capturing only the files relevant to our work in a project. However, in his gist he sets the path manually, what I want to do is automatically set the path on a per-project basis. My answer to this, is to use [fd](https://github.com/sharkdp/fd).

## The Code

I added the following code to my `init.lua`, but it can work in vimscript and in regular vim as well! This requires that you have the `fd` binary installed on your machine.

```lua
vim.o.path = table.concat(vim.fn.systemlist("fd . --type d"),",")
```

Since `fd` will respect your `.gitignore` file, the above code will set every directory currently tracked by git in your path, ensuring that you can access your project files without having to deal with slowdowns caused by vim looking inside of directories such as `node_modules`.

To speed things up when you open a directory in a path that is not currently tracked by git, you
can use the following snippet:

```lua
local setPath = function()
  if gitBranch() ~= "" then
    return ".," .. table.concat(vim.fn.systemlist("fd . --type d --hidden -E .git -E .yarn"),","):gsub("%./", "") .. "," .. table.concat(vim.fn.systemlist("fd --type f --max-depth 1"), ","):gsub("%./", "") -- grab both the dirs and the top level filesystem
  else
    return vim.o.path
  end
end



vim.o.path = setPath()
```
architectural Renderings cost
Published: 2021-11-11 11:57:09

3DPraxisStudio is a well-known name to accomplish all the 3d architectural visualization needs. Here, we offer trustable 3d [architectural renderings Cost](https://3dpraxisstudio.com/rendering-price/) so that you can visualise your building before it shapes up. We have been in the same industry for the last 7 years, which has helped us stabilize a strong image in this competitive market. Our quality services with utmost creative ideas have taken us on the top in between the competitors. In case, if you find us interesting to fulfil your dream project, we drop our contact number here – (+91) 9898-262-517
Passing Components as Props in React
Tags: react, javascript, programming, tutorial
Published: 2021-11-11 11:11:55

Programming is a lifelong learning journey, and most of that journey is asking Questions.

And one of the Q i've asked while learning <strong>React</strong> is `How To pass a component as Props?`.

In this short Tutorial we will pass a simple **React component** (Hello) to The App component as props


![Hello world Component](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/62vo55co8ys8h48puttf.png)
 

Pass it as a Prop

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

*****

And This is How we use it in **App** Component.
> Components Must Start with an upper case letter.
That's why we rename it Here

![use component as a prop](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bbz8qnvr007v5yrr2v75.png)

That's it Easy Peasy Lemon Squeezy 😎

So this is a Simple Exp though, but when it comes to large Apps, you will definitely need to use this.

Hope you like this Tuto
Create simple mobile app and transfer data between pc and mobile

Tags: tutorial, bluetoothlowenergy, ionic, mobileapp
Published: 2021-11-11 11:08:54

This project will demonstrate how to easily create a mobile app to connect to BleuIO dongle and share data between them. 

At first, we will connect BleuIO dongle to our pc. 

We already created a simple mobile app for this project. All you need to clone this project and run the app on your mobile phone. You can make changes if you need to. 

**Requirements**

BleuIO connected to a pc with ionic framework installed. 
Ionic framework 
Mobile phone. 
Android studio. 
We will set BleuIO dongle as peripheral, and our mobile app will connect to this dongle. Then we can start sending data back and forth.

Connect your BleuIO dongle to the computer.

Connect to dongle using comport and start advertising by AT+ADVSTART.

Clone this git repo.
**git clone https://github.com/smart-sensor-devices-ab/bleuio_sps_example_mobileapp.git**

go inside the folder and run npm install

if you run ionic serve, you will be able to see the layout on the browser. But for this app, we need mobile phones native feature. Therefore connect your android phone to your computer and run ionic cap run android

If you get an error regarding gradle, Type ionic capacitor update and run  ionic cap run android again.

Your app will install and open up on your mobile phone.

Make sure the dongle is on peripheral mode and advertising. 

Click scan for BleuIO devices.

On the scan result, select one of your dongles to connect.

After a successful connection, you can send data back and forth, and you will be able to see your messages on both the mobile app and the terminal.

For better understanding, watch the video.

[For better understanding, watch the video.](https://www.youtube.com/watch?v=9GwYnEmdCHI "BLE project")
Handling Oracle reference cursor as output of JDBC adapter service
Tags: webmethods, jdbc, referencecursor, integration
Published: 2021-11-16 09:40:43

---
title: Handling Oracle reference cursor as output of JDBC adapter service
published: true
date: 2021-11-11 11:01:47 UTC
tags: #webMethods, #JDBC, #referenceCursor, #integration
canonical_url: https://tech.forums.softwareag.com/t/handling-oracle-reference-cursor-as-output-of-jdbc-adapter-service/245720
---

This article explains the steps to handle the output fields of a adapter service of type ‘stored procedure with signature’ where the field is of type Ref Cursor / OracleCursor.

**Step1.**  
The Output fields of the JDBC type ORACLECURSOR is shown as below in the adapter service configurations

![image](https://aws1.discourse-cdn.com/techcommunity/original/3X/7/2/72fb1728d2e9cd6191032fa4cedd8e02adedab76.png)

The below screenshot depicts Output tab of the adapter service without the mapping of Output field of type OracleCursor

![image](https://aws1.discourse-cdn.com/techcommunity/original/3X/e/1/e1c9af0340de872d6964e68b314575f10c39d904.png)

**Step2**.  
Navigate to **ResultSet** tab and define the Result Set Index and select the appropriate Result Set Name as shown in the below screenshot

![image](https://aws1.discourse-cdn.com/techcommunity/original/3X/0/4/0490b506254147abdeb8c054405f8c2bfb102fa4.png)

Define the Column Name and map it to the appropriate **Result Set Name** from the drop down for the respective set it belongs too.

**Step3**.  
After defining/ configuring the Result Set Index and respective column names, it looks as below

![image](https://aws1.discourse-cdn.com/techcommunity/original/3X/7/a/7ae704a826a127f1cb906b71c9bd0249b3ecf7b3.png)

**Step4**.  
After defining all the Column Names and mapping it to respective Result Set Name of JDBC type OracleCursor , the OracleCursor fields are interpreted as a **documentList** and final Output of adapter service appears as below

![image](https://aws1.discourse-cdn.com/techcommunity/original/3X/7/9/795c7832f70d9e7e79d38e3ca3bb7d2c40c3492a.png)

[Read full topic](https://tech.forums.softwareag.com/t/handling-oracle-reference-cursor-as-output-of-jdbc-adapter-service/245720)
I have been using Python typing’s ‘NoReturn’ wrong
Tags: python
Published: 2023-04-15 23:41:09

---
title: I have been using Python typing’s ‘NoReturn’ wrong
published: true 
date: 2021-11-11 11:00:00 UTC
tags: python
canonical_url: https://neurowinter.com/python/2021/11/12/noreturn-mistake/
---

I am a huge fan of python’s new typing module which was introduced in version 3.5. The addition of this module gives us a range of tools to help people read and understand your code in the future.

Since I have started using typing I have been adding argument types, and return types to almost all of my public functions. One that keeps popping up is`NoReturn`, and as it turns out I have been using it wrong.

I had completely forgotten about Python’s implicit returns. Almost no function in python actually returns nothing… In my mind for what ever reason I thought that if I don’t explicitly return something then the `NoReturn` typing makes sense, however this is not the case.

Below is an example of a function that I _thought_ should be typed as `NoReturn`but was very wrong:

```
def foobar():
    print("BAZBAR")

```

The above function does not _explicitly_ return anything, but python will add an implicit return of `None` when it ends. You can see this by assigning the return value of that function to a variable eg: `rtn = foobar()` then see the type by running `type(rtn)`, you should get `<class 'NoneType'>` back! This is an example of python adding `return None` at the end of your function.

The goal of the `NoReturn` type is to signify that calling this function will end all further processing, it is the point of NO RETURN! This type should be used in functions that will raise an exception, or a function that ends the program, below are a few examples.

```
def raise_error() -> NoReturn:
    """
    Always raise an error.
    """
    raise RuntimeError("An Error occurred")
   
def quit_program() -> NoReturn:
   """
   Quit the process running this code.
   """ 
   import sys
   sys.exit()

```

I now need to go over 100s of lines of code, and fix this mistake! To fix this mistake, I will need to go though all the instances where I have put `NoReturn`and if in reality the function ends processing, then I will leave it as it is. In most cases though I will need to replace `-> NoReturn` with `-> None `.

I could have avoided this if I just RTFM a little better!

* * *

Links:

https://docs.python.org/3/library/typing.html#typing.NoReturn

* * *

Tags: Python, Typing, Mistakes
Add Google Calendar events created to Todoist as tasks
Tags: webmethods, integration, esb, cloudstreams
Published: 2021-11-18 13:11:00

---
title: Add Google Calendar events created to Todoist as tasks
published: true
date: 2021-11-11 10:59:57 UTC
tags: #webmethods, #integration, #esb, #cloudstreams
canonical_url: https://tech.forums.softwareag.com/t/add-google-calendar-events-created-to-todoist-as-tasks/245719
---

## Summary

This article describes a business use case to add the **Google Calendar** events created to **Todoist** as tasks.

## Pre-requisites

- User should have a working [webMethods.io](http://webmethods.io/)Integration tenant.

- User should have a working **Google Calendar** and **Todoist** account.

## Steps

1. Login to [webMethods.io](http://webmethods.io/)Integration tenant and create a Workflow.

2. Drag and drop the **Google Calendar** connector to the workflow palette.

3. Click the **Settings** to configure the **Google Calendar** connector. Select action as **Create Calendar Event** and add an account to authorize it.

4. In the next screen, provide the necessary inputs to create an event.

5. Skip testing the trigger, then click **Done**.

6. Drag and drop the **Todoist** connector to the workflow palette.

Learn how to configure the Todoist connector and how to map the appropriate fields from the Google Calendar by visiting the original article in the [Software AG Tech Community](https://tech.forums.softwareag.com/t/add-google-calendar-events-created-to-todoist-as-tasks/245719).
Interfy - The powerful front-end routing library.
Tags: inter, interfy, routing, javascript
Published: 2021-11-11 10:43:02

## Interfy

Interfy is an easy to use and learn Javascript library for robust client-side routing.

It's was created especially to be used in [apps created with Inter](https://github.com/DenisPower1/inter) but you can use it in any kind of app that requires a front-end routing.


**Interfy** is:

* Easy.
* light-weight and.
* enjoyable.

You can learn more about it click on [read tutorial](https://github.com/DenisPower1/interfy/blob/main/tutorial/pt/v2)
Best Automobile Spare Parts Manufacturer in India

Published: 2021-11-11 10:34:12

Being an industry leader, Sona Mandhira Private Limited (SMPL)’s prime focus is on serving the <a href="https://sonamandhira.com">Best Automobile Parts Manufacturer in India</a> as automotive aftermarket that manufactures innovative products, designed and engineered for efficiency and reliability. The brand adheres to the most stringent quality standards that are benchmarked by highly skilled and experienced professionals. 
The group has successfully achieved new milestones under the guidance of Ms. Mandhira Kapur, Managing Director, SMPL who has meticulously positioned SMPL as a brand that offers unmatched value to its consumers. As a dynamic leader, she has made a mark in the automotive aftermarket segment with her strong value system and innovative perspectives. The core focus of the brand is to relentlessly achieve the highest standards of safety, integrity and quality establishing SMPL as a brand that offers the range of finest products in the aftermarket segment.
Troubleshooting Kubernetes FailedAttachVolume and FailedMount
Tags: kubernetes
Published: 2021-11-11 10:29:39

You've been working with Kubernetes and sometime your stateful workloads fail. You regularly get **FailedAttachVolume** and **FailedMount** errors and you have no idea what's going on.

If you want to find out what's going on and how you can go about fixing quickly them, check [this](https://www.containiq.com/post/fixing-kubernetes-failedattachvolume-and-failedmount) out.
Day 34 of 100 Days of Code & Scrum: No Signal Found, Dead Internet
Tags: 100daysofcode, beginners, javascript, programming
Published: 2021-11-11 10:27:04

My main Internet connection was dead today. That really killed my productivity.

This blog post was sent using 4G mobile data. Thankfully, I have some offline resources like flashcards and e-books, so I could still somehow study a little bit. I also was kind of dizzy earlier in the morning and was stuck on bed for a while. I'm just going to put the `badday` label for today, one of those things I can't control.

Anyway, let's move on to my daily report...

## Yesterday

I worked on my hero banner for my website, and did some Scrum flashcards.

## Today

Here are the things I learned and worked on today:

### Next.js

- RIP.

### Scrum

- I did some practice flashcards for Scrum.
- reviewed some of the things I've learned before.

### Typescript

- I read whatever was on my offline cache...

I hope you all have Internet, because mine is dead.

Have a good day, everyone!

![Thank You Banner](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x9ayfxxxaz2g2hfcqbsk.png)

### Resources/Recommended Readings

- [Official Next.js tutorial](https://nextjs.org/learn/basics/create-nextjs-app?utm_source=next-site&utm_medium=nav-cta&utm_campaign=next-website)
- [The Typescript Handbook](https://www.typescriptlang.org/docs/handbook/intro.html)
- [The 2020 Scrum Guide](https://scrumguides.org/scrum-guide.html)
- [Mikhail Lapshin's Scrum Quizzes](https://mlapshin.com/index.php/scrum-quizzes/)

### DISCLAIMER

**This is not a guide**, it is just me sharing my experiences and learnings. This post only expresses my thoughts and opinions (based on my limited knowledge) and is in no way a substitute for actual references. If I ever make a mistake or if you disagree, I would appreciate corrections in the comments!

### Other Media

Feel free to reach out to me in other media!

<span><a target="_blank" href="https://www.rammina.com/"><img src="https://res.cloudinary.com/rammina/image/upload/v1638444046/rammina-button-128_x9ginu.png" alt="Rammina Logo" width="128" height="50"/></a></span>

<span><a target="_blank" href="https://twitter.com/RamminaR"><img src="https://res.cloudinary.com/rammina/image/upload/v1636792959/twitter-logo_laoyfu_pdbagm.png" alt="Twitter logo" width="128" height="50"/></a></span>

<span><a target="_blank" href="https://github.com/Rammina"><img src="https://res.cloudinary.com/rammina/image/upload/v1636795051/GitHub-Emblem2_epcp8r.png" alt="Github logo" width="128" height="50"/></a></span>