teleren/devto huggingface dataset:
Awesome way to convert every type to Boolean on JavaScript
Tags: javascript, webdev
Published: 2022-10-23 03:04:35

Compare between two variables on JavaScript maybe the thing that every developer has done on their daily work but there is a cool and faster way that you can impress your colleague on doing convert variable to Boolean.

## Reverse logical
We are all see the used of reverse logical logic (!) in all of our code base. In JavaScript, this symbol will convert every type into Boolean and then reverse the logic of its operation.

## What happen if you use “!!”?
This is tricky now! As I said earlier, JavaScript will cast every operation into Boolean when we attach it with “!”  symbol. And when we attach another “!” logical expression here, we are doing the reverse of reverse of the logical operation thus we converting variable into Boolean type without changing variable context.

Some examples when we only use one “!” logical expression:
```JavaScript
!'' // true
!{} // false
!0 // true
!1 // false
![] // false
!undefined // true
!null // true
```

As you can see on above code, the logical of values were converted into Boolean and then be reversed it conditional evaluation.

So here is what happen when we use two “!” logical expressions:
```JavaScript
!!'' // false
!!{} // true
!!0 // false
!!1 // true
!![] // true
!!undefined // false
!!null // false
```

You can see that the values were converted into Boolean but not changing its conditional expression thus we have success convert the value into Boolean and keep it logical.

Thank you for reading and see you in other articles.
Show upcoming meetings for a Microsoft 365 user
Tags: javascript, microsoftgraph, beginners, webdev
Published: 2022-10-24 09:34:19

---
title: Show upcoming meetings for a Microsoft 365 user
published: true
date: 2022-10-24 09:33:00 UTC
tags: javascript,microsoftgraph,beginners,webdev
canonical_url: https://blog.mastykarz.nl/show-upcoming-meetings-user-microsoft-365/
---

![Show upcoming meetings for a Microsoft 365 user](https://blog.mastykarz.nl/assets/images/2022/10/upcoming-meetings-graph-banner.png)

Learn how you can build a simple personal assistant in under 10 minutes that'll show a Microsoft 365 user the meetings they have left for the day.

## Show upcoming meetings for a Microsoft 365 user

Recently, I published an article on freeCodeCamp that shows you [how you can build in **just 10 minutes** a simple personal assistant that shows upcoming meetings for the signed-in user](https://www.freecodecamp.org/news/how-to-show-upcoming-meetings-for-a-microsoft-365-user/).

![Browser window with a web page showing upcoming meetings for a Microsoft 365 user](https://blog.mastykarz.nl/assets/images/2022/10/upcoming-meetings-graph.png)

Showing upcoming meetings is a common scenario when integrating Microsoft 365 in work applications. It shows you how to get information from the user's calendar and check their availability for a particular time slot. And it's also a great way to get started with building apps on Microsoft 365.

The tutorial shows you the basics of setting up auth in a single-page app and using the Microsoft Graph JavaScript SDK to connect to the Microsoft Graph API. It also demonstrates working with calendar views and formatting dates.

Give it a try, and I'm looking forward to hearing what you think.
Keep your email safe on github
Tags: git, github, privacy
Published: 2022-10-25 13:28:05

I recently decided to take a trip to the spam box in my email, I didn't expect much to be there. Until I saw a single email that stood out.
The email was as follows:
> Hey
>I was just on your Github (went down a Wednesday morning rabbit hole and came up in Monaco Editor stargazers) and loved the profile.
> [Insert product advertisement here]

I was like "oh cool product, but not interested" in my head. But then something didn't felt right; how did this person send an email to my personal email, which isn't publicly visible on my github. I checked my account and it was private, I then thought it may be my portfolio that's linked there, but no. Maybe my twitter but also no.
Then it dawned on me. Git commits has your email.
I immediately did some quick research online and git apparently keeps your email when you commit, so I checked my local environment and what did I find, my personal email. I don't know how or when I gave it my personal email but its there.
So here's what I did and I feel like you should do your self if you commit to github or any public repository and value your privacy, based on [this page from github](https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-email-preferences/setting-your-commit-email-address#setting-your-email-address-for-every-repository-on-your-computer) you should change your email using the command bellow on any machine from where you commit:
```shell
git config --global user.email "YOUR_EMAIL"
```
Where the `YOUR_EMAIL` bit should be the noreply email github provides, it should be some where in your [email settings](https://github.com/settings/emails) in your account.
I hope you find this post informative and if you have any thoughts or insights in this matter do comment bellow. Thanks for reading.
Day-19 of Machine Learning:
Tags: beginners, machinelearning, tensorflow, neuralnetwork
Published: 2022-10-25 18:09:18

Day-19 of Machine Learning:
I. Basic template of TensorFlow implementation:

#### 1. construct the network

```python
model = Sequential(
    [               
        tf.keras.Input(shape=(400,)),    #specify input size
        
        Dense(25, activation='sigmoid'), 
        Dense(15, activation='sigmoid'), 
        Dense(1,  activation='sigmoid')  
        
       
    ], name = "my_model" 
)                            

```
Keras Sequential model and Dense Layer with sigmoid activations.

#### 2. loss function

```python
model.compile(
    loss=tf.keras.losses.BinaryCrossentropy(),
    optimizer=tf.keras.optimizers.Adam(0.001),
)

```
Here for **binary classification**, BinaryCrossentropy() is used. We can also use MeanSquareError() for Linear regression.

#### 3. gradient descent to fit the weights of the model to the training data

```python
model.fit(
    X,y,
    epochs=20
)

```

---

II. Got to know about different Activation

##### - Linear Activation:
Activation **a = g(Z) = Z** 
          where Z = W.X + b 
**Output y** might be an Integer number **(+ve/-ve)**

##### - Sigmoid Activation:
Activation **a = g(Z) = 1 / (1 + e ^ (-Z))**. 
**Output y** might be **0 or 1 i.e binary classification**

##### - ReLU Activation (Rectified Linear Activation):
Activation **a = g(Z) = max (0, Z)**.
**Output y** will be any **Whole number**

---

III. How to choose Activation?
We can choose different activation within a Neural Network for separate layers and activations can be chosen accordingly requirement and goal of the Neural Network. However some recommendations are,
- A neural network with many layers but no activation function is not effective. A Neural network with **only linear activation** is the same as **no activation function**.
- ReLU are often use than Sigmoid activation. It is because firstly **ReLU is a bit faster as it does less computation (max of 0 and Z)** than sigmoid which does exponential then inverse and so on. Secondly Gradient Descent goes slow for flat and ReLU goes flat in one place whereas Sigmoid in 2 places.
- Use **ReLU** instead of Linear Activation in **Hidden layers**.
2022 State of Java Ecosystem Report by New Relic
Tags: java, devops
Published: 2022-10-25 20:05:20

Hey, Java community 👋 

I’m Daniel with New Relic. I wanted to share a [2022 State of the Java Ecosystem Report](https://newrelic.com/resources/report/2022-state-of-java-ecosystem?utm_source=devto&utm_medium=community&utm_campaign=global-fy-23q3-java_community_outreach) that New Relic recently published using data gathered in January 2022 from millions of anonymized applications that provided performance data.

One highlight we found is that Java 11 is the new standard. More than 48% of applications are now using Java 11 in production with Java 8 a close second, capturing 46.45% of applications using the version in production.

The goal of this report is to provide context and insights into the state of the Java ecosystem today. The following categories were examined:


➡️ The most used version in production
➡️ The most popular vendors
➡️ The rise of containers
➡️ The most common heap size configurations
➡️ The most used garbage collection algorithms


**Take a look at more highlights and the state of the Java ecosystem [here](https://newrelic.com/resources/report/2022-state-of-java-ecosystem?utm_source=devto&utm_medium=community&utm_campaign=global-fy-23q3-java_community_outreach).**🤓

---

_Join the [New Relic Slack community](https://get.newrelic.com/MzQxLVhLUC0zMTAAAAGHlVlC-d2ZVCwNLc_hpcLD836-j2gmD6sZkxkygeaaSTPg-4QlmIY6omb5Gt1rHHzeU1xsqJc=) to continue the conversation with hundreds of other developers using New Relic._

_Not an existing New Relic user? [Sign up for a free account](https://newrelic.com/signup/?utm_source=devto&utm_medium=community&utm_campaign=global-fy23-q3-dev_to_techupdates) to get started!_
Install Docker engine to a development Linux box - easy way
Published: 2022-10-25 21:21:31

This method should only be used in development boxes not in production scenarios according to docker official documentation. Also validate the script before executing. You should not run this script to upgrade your existing docker engine, it may cause issues.

` curl -fsSL https://get.docker.com -o get-docker.sh
 sudo sh get-docker.sh`

I found it really easy to get up and running for testing with docker on my raspberry pi4 running on Ubuntu 20.04.


References:
https://docs.docker.com/engine/install/ubuntu/
Learning about SSG features with Docusarus
Published: 2022-10-27 02:54:53

This week I worked with Docasaurus to learn about another popular SSG to improve my SSG.

# Installing Docasaurus

Docasaurus wasn't to difficult to install and allows you to edit a document and immediately see the changes online. Setting it up was as simple as using the ```npm init docusaurus@latest my-website classic``` Replacing my-website with the name of your site. After wards I uploaded my Docasaurus site on GitHub Pages. [Page](https://p-dr0zd.github.io/pdrozdSSG-Docusaurus/)

# Features I Added

[eefb760](https://github.com/P-DR0ZD/pdrozd-ssg/commit/eefb760a5620a5ee753c23b25800561e46333c0f)

[Issue Markdown](https://github.com/P-DR0ZD/pdrozd-ssg/issues/14)
Full Markdown Support Complete Markdown Support with the Help of [Python-Markdown/markdown](https://github.com/Python-Markdown/markdown) I wanted to finally Add full markdown support.

[Issue Tags](https://github.com/P-DR0ZD/pdrozd-ssg/issues/15)
HTML Tags. I added Meta Tags for Description and tags for Robots which tells search engines which pages to show and not show. 

# Whats Next

Next I want to add
- Choosing Output Directory 
- CSS support
My Hacktober Experience
Tags: programming, beginners, opensource, hacktoberfest
Published: 2022-10-30 06:15:07

October, also known as Hacktober for devs, is a really awesome month. Hacktoberfest is a very good oppurtunities for beginners to start their open source journey. Open source is a really fun ride to begin. 
I participated in hacktoberfest as well as a hackathon this month and also a opensource event. 
This was kind of my first exeprience for all of these.  

## Hacktoberfest
This year, it was my first hacktober. I made some basic contributions in few open source repos. Thats the beauty of hacktoberfest. Even beginners are welcome. Even simplest of the simplest contributions are appreciated. Even if most people do it for swags, still its a nice motivation for beginners to start. 
I completed my 4 contribution just in few days and also received the holopin badges. They look pretty cool to be honest. Here is my holopin board.

**Live Holopin Board (This may be changed with different badges if viewed at a later date):**
[![@dilutewater's Holopin board](https://holopin.me/dilutewater)](https://holopin.io/@dilutewater)

**Static version:**
![holopin static](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7sidokei2y8y894bh2od.png)



## Hackathon

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


So this month, our college organized a hackathon as well. I decided to participate in it. This was my first ever hackathon. It was quite fun and I also learned a lot. I had an awesome team to work with. 
We were not even looking to win any prize this time. However after completing we think we can win the replit track prize. But the results for the track are still not out. We are still waiting for 1it.

## DelhiFOSS event

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


I also attended the DelhiFOSS event hosted by FOSS United. It was also very very fun and informative. Met many awesone peoples there. Learned a lot. 



Attending all these events was really fun. I learned and enjoyed a lot. Met many new people. 

You can also follow me on twitter for regular updates.
Twitter: [https://twitter.com/notnotrachit](https://twitter.com/notnotrachit)
How to install Masonite On Windows
Tags: python, masonite, webdev, tutorial
Published: 2022-10-28 15:27:35

The [Masonite](https://masoniteproject.com/) Framework is a modern and developer-centric Python web framework. This framework works hard to be fast and easy from installation to deployment so developers can go from concept to creation as quickly and efficiently as possible.

In this tutorial, I will show you how to install masonite 3.0 and set up a masonite project on a Windows computer
This tutorial assumes that you understand the basics of python and pip commands

## Requirements

1. Python 3.6+
2. The latest version of OpenSSL
3. Pip3

## How to install masonite
The first thing to do is to open your command prompt and navigate to the directory where you want to get it installed.
```
cd c:\my\masonite\directory
```
Once in this folder, create a new folder for your masonite project. and change directory to it

```
mkdir my_app
cd my_app
```
One optional step you can go through is activating your virtual environment. You can use a virtual environment if you don’t want to install all of masonite’s dependencies on your systems Python.

```
python -m venv venv
.\venv\Scripts\activate
```

## Installing Masonite
Now we can install Masonite using the pip command. This will give us access to masonite’s craft command, which we can use to finish the installation steps for us. you can do so by running:

```
pip install masonite
```
Once Masonite installs you will now have access to the `craft` command-line tool. The craft command will become your best friend during your development.

You can ensure Masonite and craft are installed correctly by running:
```
craft
```
You should see a list of a few commands like `install` and `new`

Creating our Project
From the commands you saw above, we will be using `new` command to create our project. To create a new project, just run:

```
craft new
```
This will also run `craft install` which will install our dependencies.

This will get the latest Masonite project template and unzip it for you. We need to go into our new project directory and install the dependencies in our `requirements.txt` file

Now that Masonite has been successfully installed, there will be more commands available in the craft. You can check it out by running

```
craft
```

## Running The Server
Our setup is complete; all that is left to do is to run our server and view our new masonite-powered Website in the Browser. So we get that done by running:

```
craft serve
```
The command will prepare everything for us and provide an address we can use to view our new website in the browser.

> **Note!**
> When coming to your address in the command prompt, do not use `CTR + c` as it will stop the server that is currently running. Instead, highlight, right-click, and copy the address.

![masonite demo project](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i3dejtbuor3ocudsb6bp.png)

That is it. You have set up your first website with masonite. Feel free to add your comments for further discussion.
Stripe, FastAPI, Bootstrap 5 - Free eCommerce
Tags: stripe, fastapi, bootstrap5, ecommerce
Published: 2022-10-29 09:24:09

---
title: Stripe, FastAPI, Bootstrap 5 - Free eCommerce
published: true
description: Simple eCommerce powered by FastAPI and Stripe that uses a modern Bootstrap 5 design - Open-source project.
tags: stripe, fastapi, bootstrap5, ecommerce
cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wg2tqct1k6txz60zu4vp.jpg
canonical_url: https://www.admin-dashboards.com/free-ecommerce-fastapi-stripe-bootstrap-5/
---
Hello Coders!

This article presents a simple **eCommerce** starter powered by [Stripe, FastAPI](https://github.com/app-generator/ecommerce-fastapi-stripe) (for the backend logic), and **Bootstrap 5** (for styling). `The goal of this starter is to help programmers bootstrap fast a decent and secure eCommerce solution with minimal effort`. Being **open-source** and released under the MIT license, the codebase can be easily extended, incorporated in commercial projects, or used in eLearning activities. 

> *Thanks for reading!*

- 👉 [FastAPI & Stripe eCommerce](https://github.com/app-generator/ecommerce-fastapi-stripe) - source code
- 👉 Ask for [support](https://appseed.us/support/) (just in case)

A strong point of this project is the UI Kit provided by `Creative-Tim`, a well-known agency, that released the design for free. [Soft UI Design](https://www.creative-tim.com/product/soft-ui-design-system?AFFILIATE=128200),  comes with 50+ components and reusable widgets for at least a decent eCommerce project.

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

---

## ✨ Product Highlights

This mini eCommerce loads the products from JSON files saved in the templates directory and build dynamic pages based on this minimal information.

- ✅ Backend: **FastAPI**
- ✅ Payments: **Stripe**
- ✅ Design: [Soft UI Design](https://www.creative-tim.com/product/soft-ui-design-system?AFFILIATE=128200) (free version)
- ✅ Deployment: **Docker**
- ✅ Secure by default: No database is used
- ✅ MIT license

The minimal information required for a product definition can be found below:

```json
{
    "name": "Air ZOOM Pegasus",
    "price": 499,
    "currency": "usd",
    "short_description": "A workhorse built to help ..(truncated)..",
    "full_description": "A workhorse built to help power ..(truncated).."
}
```

{% embed https://github.com/app-generator/ecommerce-fastapi-stripe %}

If your workstation has Docker installed, the product can be started via a single command typed in the terminal (make sure you're at the root of the sources).

```bash
$ docker-compose up --build 
```

Once this command finishes the execution, the app should be up & running in the browser. 

![FastAPI & Stripe - Open-Source eCommerce.](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/oy2nlszqg177xlxllex0.png)

---

> `Thanks for reading!` For more resources and support, please access:

- 🚀 Free [support](https://appseed.us/support/) via Email & Discord
- 👉 Other [tools](https://appseed.us/developer-tools/) and [free apps](https://appseed.us/apps/open-source/) provided by AppSeed
Kafka Vs RabbitMQ
Tags: kafka, rabbitmq, beginners, difference
Published: 2022-10-29 16:12:42

## Distribution
**Kafka** consumers get distributed through topic partitions. Each consumer consumes messages from a specific partition at a time.
There are a number of consumers present for each **RabbitMQ** queue instance. These consumers are known as Competitive consumers as they compete with one another for consuming the message. But, the message can be processed just once.

## High Availability
With the help of zookeeper, it manages the state of the **Kafka** cluster and supports high availability.
Through clustering and high available queues provides high-performance data replication. Thus, **RabbitMQ** also provides high availability.

## Performance
**Kafka** can process millions of messages in a second with less number of the hardware.
**RabbitMQ** can also process millions of messages within a second, but it needs more number of the hardware.

## Replication
There are replicated brokers available in **Kafka**, which works when the master broker is down.
Here, queues are not automatically replicated. The configuration is mandatory.

## Multi subscriber
Multiple consumer types can subscribe to many messages to **Kafka**.
In **RabbitMQ**, although messages are routed to various queues, only one consumer from a queue can process the message.

{% embed https://youtu.be/Y2R8s8-MMBg %}

## Message Protocols
**Apache Kafka** supports primitives such as int8, int16, etc. and binary messages.
**RabbitMQ** supports any standard queue protocols such as STOMP, AMQP, HTTP, etc.

## Message Ordering
In **Kafka** Message ordering is present inside the partition only. It guarantees that either all fail or pass together.
**RabbitMQ** maintains the order for flows via a single AMQP channel. In addition, it also reorders the retransmitted packets inside its queue logic that will prevent the consumer from resequencing the buffers.

## Message lifetime
**Kafka** contains a log file that prevents all messages anytime.
Since **RabbitMQ** is a queue, messages once consumed are removed, and the acknowledgment is received.

## Architecture
Highly scalable pub/sub distributed messaging system. It has brokers, topics, partitions, and topics within the **Kafka** cluster.
A general-purpose pub/sub message broker. Its architecture varies from Kafka as it consists of queues.

## Use Cases
**Kafka** is mainly used for streaming the data.
The web servers mainly use **RabbitMQ** for immediate response to the requests.

## Transactions
**Kafka** supports those transactions that exhibit a read-process-write pattern performed to/from Kafka topics.
**RabbitMQ** does not guarantee atomicity even when the transaction indulges only a single queue.

## Language
**Apache Kafka** is written in Scala with JVM.
**RabbitMQ** is written in Erlang.

## Routing Support
**Kafka** supports complex routing scenarios.
**RabbitMQ** does not support complex routing scenarios.

## Developer Experience
With high growth, **Kafka** led to a good experience. ~~But, it only supports Java clients.~~
**RabbitMQ** carries mature client libraries that support Java, PHP, Python, Ruby, and many more.