teleren/devto huggingface dataset:
Math101 for Competitive Programming
Tags: codenewbie, programming
Published: 2020-05-16 10:28:24

---
cover_image: https://cdn.dribbble.com/users/3809802/screenshots/6827845/school_life.png
---

Many of us are trying to do something productive in this Quarantine. This Article is one of them which is gonna help you out of “**Fear of Starting Competitive Programming**”.
In this Article we will discuss the essential needs of Math Knowledge for Starting Competitive Programming.

Table of Content:
1. Birthday Paradox Problem
2. Modular Arithmetic Properties
3. Inclusion Exclusion principle and programming applications


## 1. Birthday Paradox:
Birthday Paradox actually states. How many people must be there in a room to make the probability p% that at-least two people in the room have same birthday?. Naive solution is the by finding p(different) and subtracting from 1 equaling it to p(same). After solving you will get the N. Instead of that you can simply use the formula which is actually derived from the above equation is
```
sqrt(2*365*log(1/(1-p)))
```

## 2. Modular Arithmetic Properties:
In competitive programming, Modular Arithmetic Properties are essential tools in solving big number problems. In the Problem statement when they ask to print solution in mod(107+9). It not as sample as it seems. You might get large number before applying mod to it. To simplify, You need have idea on Modular Arithmetic Properties
```
( a + b ) mod p
```
When they ask to add sum of two large numbers which get overflow after adding.
Use this Formula
```(a+b) mod p = ((a mod p) + (b mod p))mod p```

```(a*b) mod p```

Same case here but when they said to multiply and which result might end up overflow. Use this Formula
```(a*b) mod p = ((a mod p)*(b mod p))mod p```

## 3. Inclusion Exclusion principle and programming applications:
The principle of inclusion-exclusion says that in order to count only unique ways of doing a task, we must add the number of ways to do it in one way and the number of ways to do it in another and then subtract the number of ways to do the task that are common to both sets of ways.

And Also Worth Mentioning
L.C.M and G.C.D code
You can see all the code here in 
{% github maheshthedev/Comp_Programming_Guide no-readme %}
Load Credentials using IAM Role Programmatically
Tags: aws, iamrole, ec2, credentials
Published: 2020-05-16 10:27:40

This repository contains guidelines to call AWS API Gateway’s endpoint from EC2 instance using a node.js and python scripts. The scripts need to send sign requests to the endpoint, so therefore it needs AWS credentials. For security and automation purposes, AWS credentials are not provided as environment variables instead a role has been assigned to the EC2 instance, which allows EC2 to access the API Gateway Endpoint. In this story, I will explain how to load the credentials programmatically using node.js and python scripts.

## Details

Follow the step by step guidelines provided in the README.md of this [repository](https://github.com/aliartiza75/load-credentials-from-iam-role) for implementation details.

## Final Thoughts

I hope that you liked this story, please give feedback regarding anything that can be improved.
Light and dark theme in Flutter with themeMode
Tags: showdev, flutter, design, tutorial
Published: 2020-05-16 09:59:59

---
title: Light and dark theme in Flutter with themeMode
published: true
description: Without complexity, using built-in features.
tags: showdev, flutter, design, tutorial
cover_image: https://res.cloudinary.com/arthurdenner/image/upload/v1594144443/posts/light_dark_themes.png
---

Flutter has built-in support to light and dark themes.

The `MaterialApp` widget has a property called [themeMode](https://api.flutter.dev/flutter/material/MaterialApp/themeMode.html). If we specify the `darkTheme` and `theme` properties, we can use `themeMode` to control it. The property defaults to `ThemeMode.system`, which will use the correct theme based on the device's settings.

But what if we want to enable the user to change it and persist their change? We can use [`theme_mode_handler`](https://github.com/arthurdenner/theme_mode_handler)!

{% github arthurdenner/theme_mode_handler no-readme %}

With this package, we can accomplish the task and have total control on _where_ to persist the user's choice: SharedPreferences, Hive, Firebase... anywhere.

## Usage

- Create a class that implements the `IThemeModeManager` interface:

```dart
class MyManager implements IThemeModeManager {
  @override
  Future<String> loadThemeMode() async {
    // Load from wherever you want...
  }

  @override
  Future<bool> saveThemeMode(String value) async {
    // Save wherever you want...
  }
}
```

- Import the `ThemeModeHandler` widget, wrap `MaterialApp` with it and pass an instance of the manager to it:

```dart
import 'package:theme_mode_handler/theme_mode_handler.dart';

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return ThemeModeHandler(
      manager: MyManager(),
      builder: (ThemeMode themeMode) {
        return MaterialApp(
          themeMode: themeMode,
          darkTheme: ThemeData(
            brightness: Brightness.dark,
            // other properties...
          ),
          theme: ThemeData(
            brightness: Brightness.light,
            // other properties...
          ),
          home: MyHomePage(title: 'Flutter Demo Home Page'),
        );
      },
    );
  }
}
```

- Change `themeMode` with:

```dart
ThemeModeHandler.of(context).saveThemeMode(value);
```

- Get the current `themeMode` with:

```dart
ThemeModeHandler.of(context).themeMode;
```

## Notes

- The package allows us to set the default `themeMode` in case we want to force the light or dark theme by default;

Check out an example repo [here](https://github.com/arthurdenner/theme_mode_handler/tree/master/example).

If you're using a different solution or have any suggestions to improve this example, feel free to share it in the comments.

---

I hope you enjoyed this post and follow me on any platform for more.
Flask Application CI/CD using Travis CI, Github Actions, and Heroku
Tags: cicd, flask, travicci, heroku
Published: 2020-05-16 10:24:41

This story provides guidelines on how to configure CI/CD pipeline for a Flask Application using Travis CI, Github Actions, and Heroku.

The detailed guidelines are provided in the README.md of this [repository](https://github.com/aliartiza75/flask-cicd-using-travis-heroku).
Join Me for 100 Days of Pure CSS
Tags: css, html, webdev, codepen
Published: 2020-05-16 10:23:15

Today marks the start of the [Scottish 100 Days Project]([https://www.100daysscotland.co.uk/](https://www.100daysscotland.co.uk/)), the mission of which is to:

> give anyone, regardless of age or ability, the framework and permission to get creative. It challenges you to pick your creative outlet and relies on your willingness to work to achieve a creative boost.

This year will be my first time participating in something like this, and I thought I'd invite you all to follow along / join in!

## What I'll be doing

The aim of the project is to encourage creativity, and I'll tell you now I am not in any way an artist 😂

Lots of project participants will be drawing, painting, crafting... and I'll be... coding! I'll be creating one CodePen a day with an image made completely in plain ol' CSS.

## Why??? 

All work and no play...

Like a lot of us, I have a lot of side hustles. I spend a huge amount of time improving my knowledge of web accessibility, maintaining my site [Up Your A11y](https://www.upyoura11y.com), and contributing to open source projects. I do all that stuff because I'm interested in it, and feel super driven to do those things, but at the same time it is kind of hard work sometimes! I have a roadmap of "things I want to do" and sometimes... just sometimes... it can start to feel a little like a second job.

So the 100 Days challenge is my way of re-focusing my brain on what got me into tech in the first place - coding is fun! This challenge is purely an exercise in enjoyment 😄

I'm hoping that doing it will be a nice little break in more serious things, and an opportunity to just do something silly and fun with code.

## Follow along - or join me!

I kicked off my 100 days challenge with a little CSS image inspired by my workmate's current mouse problems - I mean who could deny this little cutie a place in their home??

{% codepen https://codepen.io/aitchiss/pen/MWaGBKZ %}

I'll continue to add my work to [my CodePen collection](https://codepen.io/collection/AeyMRz) each day, and I'll be tweeting them out from [@s_aitchison](https://twitter.com/s_aitchison) as I go. Feel free to follow along!

Even better, if you like you could join me! Part of the fun of the 100 Days challenge is you can do it from anywhere - if you do decide to give it a go let me know; I'd love to follow your progress and be inspired by you 😄
How to create users in RabbitMQ
Tags: rabbitmq, usercreation, howtocreateusersinrabbitmq, roles
Published: 2020-05-16 10:15:54

Previously we have learned about <a href="https://onlinetutorials.tech/rabbitmq-exchange-in-details/">RabbitMQ Exchanges</a>, <a href="https://onlinetutorials.tech/rabbitmq-queues-in-detail/">RabbitMQ Queues</a> and <a href="https://onlinetutorials.tech/how-to-bind-rabbitmq-queue-to-exchange/">How to bind Exchanges with Queue</a>s. It is time to learn <a href="https://onlinetutorials.tech/how-to-create-users-in-rabbitmq">how to create user in RabbitMQ</a> with different different Roles.</p>
<p><strong>Followings are the set of Role Tags in RabbitMQ:</strong>
<p><strong>Followings are the set of Role Tags in RabbitMQ:</strong></p>
<ul>
<li>Admin</li>
<li>Monitoring</li>
<li>Policymaker</li>
<li>Management</li>
<li>Impersonator</li>
<li>None</li>
</ul>
<h2>Monitoring in RabbitMQ:</h2>
<p>If any user has this Tag or Role then user can monitor all connections, channels and node related information.</p>
<h2>Policymaker in RabbitMQ:</h2>
<p>If any user has this Tag or Role then user can manage all the policy and parameters for <strong>VHOST(</strong><em>only for which they have access</em><strong>).</strong></p>
<h2>Management in RabbitMQ:</h2>
<p>If any user has this Tag or Role then user can access web management plugin.</p>
<h2>Administrator in RabbitMQ:</h2>
<p>If any user has this Tag or Role then user can manage each and everything in RabbitMQ.</p>
<ul>
<li>Manager users</li>
<li>VHOST</li>
<li>Permission</li>
<li>Close other user&#8217;s connections</li>
<li>Manage policies</li>
<li>etc</li>
</ul>

<a href="https://onlinetutorials.tech/how-to-create-users-in-rabbitmq/" target="_blank" rel="dofollow">Click here to learn more about how to create users in RabbitMQ</a>
I made a website for you to share your pronouns
Tags: webdev, showdev
Published: 2020-05-16 09:56:11

##What are pronouns? 

What do they mean? How do I use them? **How do I share my pronouns with other people?**

I made a [website](https://genderev.com/pronouns) to answer these questions.

There's a [famous](http://www.pronouns.failedslacker.com/) website that does something similar to this called the [Pronoun Dressing Room](http://www.pronouns.failedslacker.com/), but I wanted to design a better solution: it is not at all optimized for mobile and doesn't include the pronouns [I](https://genderev.com/pronouns?first=v&second=v&third=v%27s&fourth=v%27s&name=Ender) [use](https://genderev.com/pronouns?first=Ender&second=Ender&third=Ender%27s&fourth=Ender%27s&name=Ender).

Those were my two main motivations for redesigning the Pronoun Dressing Room, but I also just wanted a version that was more lean. The Pronoun Dressing Room uses some complex grammar terminology that many users would not understand, and I wanted to make something for people of every reading level.

[Try it here!](https://genderev.com/pronouns) Try new pronouns and share new or old ones!
An Intro to Materialize CSS
Tags: html, css, materializecss, frameworks
Published: 2020-05-16 09:09:12

Hey Devs !! ☺️ Welcome !!
How's everything? Good!

#Getting Started with Materialize CSS

If you’re in love with Google’s Material design, Materialize CSS is a framework you’ll enjoy & it follows the famous 12-column grid format established by Bootstrap.

##Ways to use Materialize:

* [Local Installation] (https://materializecss.com/getting-started.html) − Download & include it in your HTML code .

* [CDN Based Version] (https://materializecss.com/getting-started.html) − Access Directly from the Content Delivery Network (CDN).
###[cdnjs.cloudflare.com] (https://cdnjs.com/)
![ CDN ](https://dev-to-uploads.s3.amazonaws.com/i/cwl038sjt5r0lai3o0ll.png)
                 provides content for the latest version.

Here I'll add my Insta Post,If You Like it Give ❤️ !!
{% instagram CAN9xlMpCTb %}
💜 Thank You for Reading 🙌
Be Happy 😊 & Always Smile 😇

Add ME on [Instagram](https://www.instagram.com/TsrCodes) | [Facebook](https://www.Facebook.com/TsrCodes) |[Twitter](https://www.twitter.com/TsrCodes) | [Youtube](https://www.youtube.com/channel/UCb9J-aPbN-WQ7eE4WU6yXcg)
Extending Prolog - TerminusDB Discussion #10
Tags: prolog, logic, programming, talks
Published: 2020-05-16 08:54:20

---
title: Extending Prolog - TerminusDB Discussion #10
published: true
description: Every week the TerminusDB core team get together to hear a talk led by one of our members. The discussions are always very interesting, so we thought we'd share. This week we have our CTO talking Extending Prolog.
tags: Prolog, logic, programming, talks
---
Every week the TerminusDB core team get together to hear a talk led by one of our members. The discussions are always very interesting, so we thought we'd share. This week we have our CTO talking Extending Prolog.
Embedded database vs Client-Server database (on the same host) performance?
Tags: discuss, sql, database
Published: 2020-05-16 08:47:18

What if the web server itself acts as a mutable database? (Not ephemeral like Heroku.)

What if data is pre-queried inside memory to rely on backend-language filtering?

What if multiple files of NoSQL are used (like NeDB, because there is no real JOIN anyway)? What if NoSQL is already composed of multiple files (like LevelDB)? Also, what impacts the performance of JOINs?

What about array indexing, not to mention I don't know much about virtual table?
TIME🧐 TO TEST YOUR CODING KNOWLEDGE
Published: 2020-05-16 08:30:31

TIME🧐 TO TEST YOUR KNOWLEDGE

🔰 TIME IS LIMITED 🔰
- SUBMIT YOUR CODE AS EARLY AS POSSIBLE -

Link: https://bit.ly/3cFONPs

Getting CERTIFICATE doesn't certify you as a CODER. You need to PRACTICALLY APPLY it. If you think you are a CERTIFIED CODER then BEAT THIS CHALLENGE and SHOWCASE YOUR SKILLS. 

If you can't TEST YOUR SKILLS then your CERTIFICATE is of NO USE 🧐😏.

"Try and fail, but never fail to try!"
- Jared Leto

🤔  Question:
You are Berlin, the second-in-command of the Royal Mint of Spain heist. You are well trained in various things along with your fellow robbers, and you learn all the details of the heist. You have taken over the Royal Mint of Spain and are ready to implement your plan for the heist. But before that, you need to transfer all the confidential data of the Royal Mint to the Professor.                                                                                                                     Write a script to automate the data transfer using Python or JavaScript.

Make sure the script is properly documented(using comments within the script). 

For more Click This👉: https://community.letsupgrade.in/question/5eb9637aea41b003c05addc5
Simple CSS trick to create a smooth scrolling effect
Tags: ux, design, webdev, html
Published: 2020-05-16 08:12:24

We use different jquery library or write plain vanilla javascript to achieve a smooth scrolling effect.

**jQuery Syntax**:

```javascript
//Smooth scrolling with links
$('a[href*=\\#]').on('click', function(event){     
    event.preventDefault();
    $('html,body').animate({scrollTop:$(this.hash).offset().top}, 500);
});

// Smooth scrolling when the document is loaded and ready
$(document).ready(function(){
  $('html,body').animate({scrollTop:$(location.hash).offset().‌​top}, 500);
});
```
I love CSS. And I wonder can we achieve this effect by using just CSS properties. Then I encounter this native CSS feature `scroll-behavior`.

The `scroll-behavior` property in CSS allows us to define whether the scroll location of the browser jumps to a new location or smoothly animates the transition when a user clicks a link that targets an anchored position within a scrolling box.

If you click a `#hash` link, the native behavior is for the browser to change focus to the element matching that ID. The page may scroll, but the scrolling is a side effect of the focus changing.

**Example**
```css
html {
  scroll-behavior: smooth;
}
```

It also has a different syntax,
```css
/* Keyword values */
scroll-behavior: auto;
scroll-behavior: smooth;

/* Global values */
scroll-behavior: inherit;
scroll-behavior: initial;
scroll-behavior: unset;
```

Just take a look at a sample HTML

```html
<nav>
  <a href="#page-1">1</a>
  <a href="#page-2">2</a>
  <a href="#page-3">3</a>
</nav>
<div class="scroll-container">
  <div class="scroll-page" id="page-1">1</div>
  <div class="scroll-page" id="page-2">2</div>
  <div class="scroll-page" id="page-3">3</div>
</div>
```

CSS
```css
html {
    scroll-behavior: smooth;
}
```
***
### **Browser compatibility**
![Browser compatibility for smooth scroll](https://nirajanbasnet.com.np/uploads/caniuse-smooth-scroll.png)

---

##**Conclusion**
👏👏 By coming this far I hope you can use this awesome CSS smooth scrolling effect. So, I suggest you give it a try on your project and enjoy it! 

Feel free to share your thoughts and opinions and leave me a comment if you have any problems or questions.


Till then,
**Keep on Hacking, Cheers**
Need Of Modern Businesses- Cloud-Based Business Automation Solutions

Published: 2020-05-16 08:06:04

World is progressing towards innovation, automation and digitalization. Each industry is exploiting automation to great extent. It reduces the human efforts, saves time, and brings a lot of accuracy. But What is Business automation? How businesses are exploiting these new technologies? Why should businesses adapt it?

**Business Process Automation-**
Business Process Automation alludes to the automation of complex business processes smoothen data flow to ease the complicated task and track it. Generally, humans are not perfect at data organization and keep track of workflow processes. This may reduce the efficiency. Hence business automation comes to the focus to effectively carry out business processes and data management. Some businesses might be using some level of business process automation. Cloud based business automation is one of them that provides web based services to help you by binding your team together and managing business. Does cloud-based business automation really need? Let us see.

**Need Of Cloud-Based Business Automation Solutions-**
Cloud-based BPA tools are simple to learn for beginners. Most of them has a proper documentation and training available to get started. Also they are  easy to deploy, and take a load off your IT infrastructure. Here we are going to discuss the reasons to adopt cloud based automation solution.

*1. Allows Remote Work-*
Cloud-based automation tools allow team members to work from anyplace. As these tools are cloud based, it is easy to access the information and inputs that need to be processed without missing any deadlines. This can be effectively carried out without consistent emails or what’sapp messages. Managers can analyze the status of tasks regardless of the location of employees. Remote employees can interact with team and avoid miscommunication and hence increase productivity.

*2. Can Involve The Entire Team-*
Sometimes it requires multiple teams to collaborate for a specific task to carry out. A cloud based business automation tool gets the multiple teams involved in a task at necessary steps. A business development team needs to collaborate with client, and managers too. Information by the business development team would then be used by the manager’s development team to complete the requirements. Also, manager can monitor the assigned tasks to relevant developers and so on.

*3. Reduces Human Error-*
Generally humans make a lot of mistakes due to the lack of efficiency, frustrated mood, forgetting nature and so on. Starting from an arithmetic mistake in calculations to forgetting the complete task or mis-classifying the documents, there are many important things that may go wrong if done manually. A simple workflow automation tool can fix such a large number of problems.

Know more at- [https://solaceinfotech.com/blog/need-of-modern-businesses-cloud-based-business-automation-solutions/]
How to create a docker image for any Java project
Tags: docker, java, microservices
Published: 2020-05-16 08:00:42

So you have finally decided to move to micro-services architecture or may be you have just decided that you want to run your application to run in a Kubernetes cluster. May be your requirement is to use cloud services like AWS, GCP, AZURE, etc … to scale immediately as per demand. Or may be … just may be you are here to learn how to convert your existing java application into a docker image so that it can be containerized by whoever wants it.
Whatever may your requirement there is no denying that tech world is moving toward cloud and containerizing your application is one of the easiest and most efficient way to start your journey towards cloud infrastructure.

What is Docker ?
Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and deploy it as one package.
In a way, Docker is a bit like a virtual machine. But unlike a virtual machine, rather than creating a whole virtual operating system, Docker allows applications to use the same Linux kernel as the system that they're running on and only requires applications be shipped with things not already running on the host computer. This gives a significant performance boost and reduces the size of the application. [1]
In this Article i will show how you can configure a java application with maven to generate a docker image that contains all the dependencies and configurations. I will be using a very simple spring application written in Java 8 for demonstration. I will also be using fabic8 maven-docker-plugin to automate the image generation process.

For detailed steps follow the article here:

[how to create a docker image for any java project](https://medium.com/@ankitech/how-to-create-a-docker-image-for-any-java-project-b0a90490faa)

Please feel free to share your thoughts and idea on the article. Also it will be great help if you have some feedback so i can improve the article further. 

Feel free to fork me on Github. [https://github.com/ankitech/](https://github.com/ankitech/)

Article repository:
[https://github.com/ankitech/spring-docker-setup](https://github.com/ankitech/spring-docker-setup)
wk 1 assignment
Published: 2020-05-16 07:45:54

When was Swift introduced?
It was introduced at Apple's 2014 Worldwide Developers Conference (WWDC) with version Swift 1.0.

For what platforms is Swift used as the primary programming language?
Swift is a general-purpose, multi-paradigm, compiled programming language developed by Apple Inc. for iOS, iPadOS, macOS, watchOS, tvOS, Linux, and z/OS. Swift is designed to work with Apple's Cocoa and Cocoa Touch frameworks and the large body of existing Objective-C code written for Apple products.

Which were the primary goals when developing Swift? 
to be safe, fast and expressive.