teleren/devto huggingface dataset:
Centering Elements in CSS3
Tags: css, webdev
Published: 2021-02-22 20:13:32

### Introduction 

Hello! Today I will cover different cases for centering elements in CSS3.


#### What we mean by centering?

Centering an element inside a parent element.

> Note: The width of the centered element must be less than the width of the container (parent) element, so we can center it.

### The cases that we will discuss:

1- Centering Block Elements.
2- Centering Non-block Elements.

### Centering Block Elements.

Block elements are the element in which the display property is set to **block**.

#### A. Horizontal Center.

For block elements, we can use the **margin: 0 auto** trick. 

Basically, it sets the margin of the top and bottom to zero, and when the left and the right margins have the same value: **auto**, it means that the margins are distributed equally on both sides of the elements. That makes the element centered.

The width by default is set to auto, and auto for block elements is 100%, so we should change it.

#### Example:
{% codepen https://codepen.io/abdelrahmandeghedy/pen/LYbzqLR %}

#### B. Vertical Center.

This method can be used for both vertical and horizontal centering.

We will use the **absolute positioning**.

First, we set a reference point, which is the top-left point of the parent element, by setting the parent element’s positioning to **relative**.

Second, Shift the current element 50% right, and 50% down.

> Shifting works with respect to the top-left point of the element, but we wanted to shift the element from its center.

To fix the previous problem, we shift the element 50% (of its total width) to the left, and 50% (of its total height) to the top by using the **transform** property.

#### Example:

{% codepen https://codepen.io/abdelrahmandeghedy/pen/YzprBex %}

### Centering Non-block Elements.

By non-block elements, we mean **text** inside an element, **inline** element, or **inline-block** element.

#### A. Center Horizontally.

We treat inline, and inline-block elements as text with respect to the parent element.

For a horizontal center, we will use **text-align: center** in the **parent** element.

#### Example: 

{% codepen https://codepen.io/abdelrahmandeghedy/pen/bGBozKQ %}

#### B. Center Vertically.

Change the **line-height** of the **parent** to be equal to the height of the parent.

Then, change the **vertical-align** of the **child** to be **middle**, and the **line-height** of the **child** to be **normal**.

#### Example:

{% codepen https://codepen.io/abdelrahmandeghedy/pen/poNWGZX %}

That's it for today! I really hope that you learned from it. Tell me about your thoughts in the comments.
CoinSpot or Coinbase: Which crypto exchange is suitable for Australians ?
Tags: coinbase
Published: 2022-02-22 20:05:42

---
title: CoinSpot or Coinbase: Which crypto exchange is suitable for Australians ?
published: true
date: 2021-02-22 19:37:28 UTC
tags: Coinbase
canonical_url: https://coinmarketbag.com/?1
---

Founded in 2013, CoinSpot has grown over the years to become Australia’s biggest cryptocurrency exchange. It rose to prominence as one of the most user-friendly and secure crypto platforms as it makes buying, selling and storing cryptocurrency simpler for investors.  Meanwhile, U.S.-based Coinbase is one of the biggest crypto exchanges available in the world. Formed …

<!-- YARPP List -->
### Related posts:

1. [Australians can buy crypto from their BANK #Bitcoin #Ethereum #Elrond #NextEarth #Crypto](https://coinmarketbag.com/australians-can-buy-crypto-from-their-bank-bitcoin-ethereum-elrond-nextearth-crypto/ "Australians can buy crypto from their BANK #Bitcoin #Ethereum #Elrond #NextEarth #Crypto")
2. [یک دلار بخر صد میلیون دلار ببر | ارز Feg چالش 100 میلیون دلاری | Feg token Suitable for investment](https://coinmarketbag.com/%db%8c%da%a9-%d8%af%d9%84%d8%a7%d8%b1-%d8%a8%d8%ae%d8%b1-%d8%b5%d8%af-%d9%85%db%8c%d9%84%db%8c%d9%88%d9%86-%d8%af%d9%84%d8%a7%d8%b1-%d8%a8%d8%a8%d8%b1-%d8%a7%d8%b1%d8%b2-feg-%da%86%d8%a7%d9%84%d8%b4/ "یک دلار بخر صد میلیون دلار ببر | ارز Feg چالش 100 میلیون دلاری | Feg token Suitable for investment")
3. [Your review of the safe exchange coin safex enjin coinspot](https://coinmarketbag.com/your-review-of-the-safe-exchange-coin-safex-enjin-coinspot/ "Your review of the safe exchange coin safex enjin coinspot")
Simple Analytics iOS widget with Scriptable app
Tags: ios, javascript, widgets
Published: 2021-02-22 19:37:27

![example widget picture](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6f8tnbxjhomqj2couyn5.jpg)

Today I quickly build an iOS widget to see my page views and visitors on my iPhone. Since I don't always want to start my laptop to see my current website stats in Simple Analytics I created this widget based on an example widget I found in the [Scriptable](https://scriptable.app) app. The great thing about Scriptable is that uses the [JavaScript Core](https://developer.apple.com/documentation/javascriptcore) of iOS. This means that a lot of features of ES6 are available to use. You can find a documentation in the Scriptable app or at [docs.scriptable.app](https://docs.scriptable.app). 
Since it would be very tedious to write code on the small touchscreen, I wrote the code on my laptop and then pasted it on my phone. 

Without further ado here are the installation steps.

## How to install
1. Load the scriptable app for your device
1. Copy the content of the [getSimpleAnalyticsStats.js](https://github.com/niklasmtj/simple-analytics-widget/blob/main/getSimpleAnalyticsStats.js) file on GitHub and fill in the first 3 lines of the file with your apiKey, userId and the domain you want to track. You can get your keys in your account settings https://simpleanalytics.com/account
1. Try to run the script and see if everything works.
1. Go back to your home screen and trigger the "jiggle-mode"
1. Now add scriptable and choose your newly created script as the script to run
1. Have fun with your Simple Analytics iOS widget

The GitHub repository can be found [here](https://github.com/niklasmtj/simple-analytics-widget/).

Thank you for reading,
Niklas

---

This post and more you can find on [niklasmtj.de](https://niklasmtj.de)
Open Source Home Automation
Tags: opensource
Published: 2021-02-22 19:22:51

Home Assistant is a home automation platform that puts local control and privacy first. The open-source project is powered project by a worldwide community of tinkerers and DIY enthusiasts. It is the perfect companion to run on a Raspberry Pi or a local server.

{% github https://github.com/home-assistant/core %} 

## Demo

Watch Paulus Schotsen (creator of home-assistant) share how you can quickly set up your open-source using the Home Assistant Blue + Web Components.

{% youtube NbGySeknK94 %}

## Open Source Fridays

Come along to our Open Source Friday live streams. We go live on the [GitHub Twitch Channel](https://github.community/t/attended-making-twitch-bots-that-talk-to-the-github-api-let-s-chat/159453/2) most Fridays. Join the [Meetup Group](https://www.meetup.com/GitHub-Virtual-Meetup/) to stay up to date and see the topics each week.
Water the plants complete solution with full logic in O(n), 28 days solution .(java)
Tags: java
Published: 2021-02-22 19:22:23



Water the plants complete solution with full logic in O(n), 28 days solution of GFG.(java)


input = [2,3,4,-1,2,0,0,-1,0]
output [-1]
input = [-1,-1,2,2,0,0]


















//code 
import java.util.*;
class ONE {
    int min_sp(int gal[], int n)
    {
        int arr[] = new int [n];
        Arrays.fill(arr, -1);
        for (int i=0;i<n;++i)
        {
            // System.out.println("its n "+n);
            if (gal[i]==0)
            {
                // System.out.println("its arr[i] "+arr[i]);
                arr[i]=Math.max(arr[i],i);
                continue;
            }
            if (gal[i]!=-1)
            {
                int k=i+gal[i];
                // System.out.println("its k "+k);
                // int j=max (0,i-gal[i]);
                int j=Math.max(0,i-gal[i]);
                // System.out.println("its j "+j);

                for(int sp = j;sp<=Math.min(n,k);++sp)
                    {if(sp==n)
                continue;
                    arr[sp]=Math.max(k,arr[sp]);}
            }
        }
        int c =0,i=0;
        while(i<n)
        {
            // System.out.println("its i and n "+i+" "+n);
            // System.out.println("its i and n "+i+" "+arr[i]);

            if (i==-1||arr[i]==-1)
            return -1;
            ++c;
            i=arr[i]+1;
        }
        return c;

    }




public static void main(String[] arr)
{
    //  Scanner in = new Scanner(System.in);
    int gal[] ={2,3,4,-1,2,0,0,-1,0};
    ONE s = new ONE();
    int n=gal.length;
    System.out.print(s.min_sp(gal,n));
}
}
Responsive Image gallery with CSS animation effect
Published: 2021-02-22 19:18:59

The responsive Image gallery is made with HTML and CSS. It is very useful while creating a gallery. A gallery in a website or portfolio looks great and attract more people. 
<a rel="nofollow" href="https://codewithbishal.com/example/responsive-image-gallery">View it on our website(Responsive gallery)</a>
View More :
<ul>
<li><a rel="nofollow" href="https://codewithbishal.com/example/how-to-create-animated-navigation-bar">How to create Navbar using Javascript</a></li>
<li><a rel="nofollow" href="https://codewithbishal.com/example/how-to-create-an-accordion-with-html-css-and-javascript">How to create accordion using JavaScript</a></li>
</ul>
At first, on our webpage, there is a preview of our responsive gallery, then there are a few QNA and an overview of the blog. There is a button to copy and Download the codes (HTML and CSS). You can also try it on our website.

You can view and copy and download the source code files through the link given below. <a rel="nofollow" href="https://codewithbishal.com/example/responsive-image-gallery">View and Download Source Code</a>
i want to be a Dev
Tags: webdev, blog, html, programming
Published: 2021-02-22 19:17:27

Ok, I am going to start writing this blog about my intention to become a web developer.
I couldn't go to university, my family is poor and I had to start working after high school.
Although in my country (Argentina), the University is free, I could not due to my first years of work with my parent, as an assistant in painting jobs in buildings and houses.

So, since I always liked technology, I decided to learn Web Development and become a programmer.
I did some free courses on UDEMY and Youtube, until two months ago I started a coding Bootcamp, the cheapest I found.

Although the bootcamp is not bad, it is somewhat diffuse and at the same time confusing the way of teaching of the teacher.
So I will continue there but I also started doing other courses on YouTube and doing tutorials building guided web pages on YouTube.

At the moment I am studying at the Bootcamp for two hours a day (they are classes recorded live) and one hour to follow tutorials on YouTube.

I trust Bootcamps, but the huge amounts of money they charge for it don't seem honest to me.

So ... I'll try to spend whatever is fair, and learn with free resources.
Let's Learn .NET - Web API - Free Live Stream Event
Tags: beginners, dotnet, webdev, csharp
Published: 2021-02-22 19:16:07

Let's Learn .NET is a new monthly beginner series that walks through the fundamentals of using C# and .NET. This month, jumpstart your experience building Web APIs with .NET! Come learn about what Web APIs are, why you need them, and how to build them with C# and ASP.NET Core. This fun, beginner's series will teach you all about the fundamentals of everyday technologies and how you can master them using C# and .NET.

{% youtube BEJI2fy8MpA %}

## When
Friday, February 26th at 8:30 AM - 10:30 AM Pacific

## Where

Streaming live for FREE on [Microsoft Learn TV](https://docs.microsoft.com/learn/tv/?WT.mc_id=dotnet-13135-jasingl). Sign-in, ask questions, and learn how to build Web APIs with C# live.

## What
Come learn something new and leave with something that we all built, together, live with experts. Here is the agenda for the event:

Introductions (5 mins):
- Meet the team!

Fundamentals (10 mins):
- Pre-requisites & installation
- Why are Web APIs important?

Workshop I (35 mins):
- [Learn all about RESTful APIs](https://docs.microsoft.com/learn/modules/use-apis-discover-museum-art/?WT.mc_id=dotnet-13135-jasingl)

Q&A (10 mins):
- Get your questions answered live!

Workshop II (35 mins):
- [Create a Web API with ASP.NET Core](https://docs.microsoft.com/learn/modules/build-web-api-aspnet-core?WT.mc_id=dotnet-13135-jasingl)

Q&A (10 mins):
- Get your questions answered live!

Open Discussion (10 mins):
- Let's discuss the learnings and what else is on your mind.

## RSVP Today
Head to [aka.ms/letslearndotnet](https://aka.ms/letslearndotnet) to RSVP today!

## Looking for more?
[Join the Cloud Skills Challenge on Microsoft Learn](https://aka.ms/letslearnchallenge)!  

APIs are essential for serving data to your applications. Complete the modules in the Let's Learn .NET - Web API challenge to get started creating, consuming and publishing API apps. New to C#? We've also included some starter content related to .NET development with C#.
Plan of Attack
Tags: codenewbie, pseudocode, planning
Published: 2021-02-22 19:11:29

*// PSEUDOCODE*
*//input*
*List of numbers*

*Sort the numbers in the list so that they’re in order.*
*Loop through the list to leave out a number in the list*
*Then add the remaining numbers to get the sum*
*Place all of the sums in a separate array*
*Filter the new sum array to identify the min and max sum’s*

*//output*
*Min and max sum of the list of numbers*

This is pseudocode from a hackerrank challenge I was working on with a couple of cool cats from the coding community I joined.  __Pseudocode__, for those who don't know, is a __methodology to represent the implementation of an algorithm__.  In this session, I really learned the importance and aid of pseudocoding. In the words of one of my friends Rashad, _"It's good to use pseudocode.  Your code start's to flow better."_

This was very true and I struggled for a long time on how to properly use pseudocode.  A really great tip he gave me was first, to start with the __input__ & __output__ of what you're trying to achieve. Afterward, you only have to fill in the middle.  Being rather specific was important in detailing what your pseudocode entails.  Another small but important detail was in the order of placing the input and output.  This small detail helped me see, even clearer, how useful pseudocoding was.  

By placing the input, the data that the algorithm is manipulating, at the top of my pseudocode, then placing the output at the bottom and writing the details of what the algorithm will be doing in the middle.  This gave my pseudocode the structure of an actual function.  Afterward, it was just a matter of plugging in and deciding which methods needed to be used to achieve what it was I was trying to achieve.
Should we cover Program.cs?
Tags: c, netcore3, integrationtests, csharp
Published: 2021-02-22 18:53:31

---
title: Should we cover Program.cs?
published: true
description: 
tags: c#, netCore3,integrationTests, csharp
//cover_image: https://direct_url_to_image.jpg
---
How do You include or should We tests the main entry (Program.cs) on the on your .Net Core web API?
Serverless background tasks with OpenJS Architect - Part 2
Published: 2021-02-22 18:30:49

## @scheduled example
Another common background task is `@scheduled` functions. These functions are invoked on a schedule defined in the `app.arc` file. These functions are good for cleanup tasks or kicking off other kinds of health checks. Let's make a new project and add a `@scheduled` function. 

The first thing we will need is a fresh Architect project. We can create one directly from the terminal. 

```bash
npm init @architect ./arc-scheduled-app
cd arc-scheduled-app
npm install @architect/functions
```

Now we can open up the `app.arc` file and add a scheduled function to the manifest. 

```arc
# app.arc

# your project namespace
@app 
arc-scheduled-app

# http functions and routes
@http
get /

# scheduled functions listed by name and rate
@scheduled
daily rate(1 day)
```

Architect looks for the function named `daily` in the `src/scheduled/daily` folder. So let's go ahead and write one. 

```javascript
exports.handler = async function scheduled (event) {
  console.log(JSON.stringify(event, null, 2))
  return
}
```

When this function is deployed, it is registered to an AWS CloudWatch Event. The event will trigger this function to handle the event payload coming into it. It should be treated as something that happens in the background of your main application to handle work on a regular and periodic cycle. 

Let's take a look at the generated `sam.json` to see how the resource will be created. 

From the terminal, run `arc deploy --dry-run` and take a look at `sam.json` in the project's root directory. Here we can see the CloudFormation that will generate the rule and the trigger.

```json
"DailyScheduledEvent": {
      "Type": "AWS::Events::Rule",
      "Properties": {
        "ScheduleExpression": "rate(1 day)",
        "Targets": [
          {
            "Arn": {
              "Fn::GetAtt": [
                "DailyScheduledLambda",
                "Arn"
              ]
            },
            "Id": "DailyScheduledLambda"
          }
        ]
      }
    },
```
This shows that the function is a scheduled event with a rate of being invoked once a day. The rate expression starts when the rule is created at the time of deployment. If you need more fine grained control over the timing, then you'll have to write a Cron expression. For more information about schedule rules, follow the [AWS documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html)

## Stay tuned
In the next part we will look at using Queues with OpenJS Architect!
Using Third Party Libraries with WayScript's Code Editors
Tags: python, java, javascript, tutorial
Published: 2021-02-22 18:30:21

Introduction
------------

In today’s article, we are going to use WayScript to import libraries in different programming languages. In fact, it's about the requirements of each programming language. When you want to use each language, there are some specific libraries to be precise.  
It's easy to reference it when you are programming normally. However, with WayScript, there is always a file somewhere you can put the name of the libraries as dependencies and WayScript will automatically download it.

Prerequisites
-------------

Here are some content you might find useful:

*   [Working with JavaScript](https://docs.wayscript.com/library/modules/javascript)
*   [Working with Python](https://docs.wayscript.com/library/modules/python)
*   [Working with Java](https://docs.wayscript.com/library/modules/java)

Python, Java and JavaScript
---------------------------

While working with WayScript and writing a script, you can have access to the current directory of the project.  
WayScript provides JavaScript, Python, and Java modules to write scripts. Add all the modules and I’ll show you how to add dependencies for the scripts.

![Adding Scripts](https://wayscript.com/blog_img/176/1.png)

After adding the modules, you can see the editors of each language. And if you look closely in the files system, you can see the files which we’ll use to write the dependencies of each project. If you want to add dependencies, these requirements as you would in a pip Requirements File, using the Requirements File Format.

![Adding Python Scripts](https://wayscript.com/blog_img/176/2.png)

If you want to add dependencies, you can use the format you would for an npm-install command. Just write the dependencies in the js.dependencies file.

![Adding JavaScript Scripts](https://wayscript.com/blog_img/176/3.png)

WayScript uses Maven to install dependencies. Declare these dependencies as you would any mvn dependency, in the format of groupId:artifactId:version. You can add these dependencies in the java.dependencies file.

![Adding Java Scripts](https://wayscript.com/blog_img/176/4.png)

Conclusion
----------

Questions about this script or anything else? Join our [Discord](https://discord.gg/VWbXSbj). We're always around to help. If you want to work with the full script template, just find it [here.](https://wayscript.com/user/mangabo_kolawole/xWm7LlX3)

[](https://wayscript.com/user/mangabo_kolawole/xWm7LlX3)
Ruby Class vs Object
Tags: rails, object, class
Published: 2021-02-22 17:56:27

I once was asked in an interview what the difference between a class and an object is and of course, I froze! So, I wanted to talk about it a little bit.

A class describes the contents of the objects that belong to it. I can define a class like this 
```ruby
class Blog
end
```
Once a class is created you can create a new object that will belong to the Blog class. 

Objects can be strings, integers, symbols etc. Every object has a class and classes define objects. I can create an object like this 
```ruby
myblog = Blog.new
```

So basically the class is like the blueprint. I can have a blog class and it will have properties or attributes such as content and title, and if I created an object from the Blog class called myblog then that object would have a content title and attributes. 

I hope this helps!
Build Native Mobile Apps with Python (BeeWare)
Tags: python, mobile, beeware
Published: 2021-02-22 18:13:59

{% youtube tyh165h_PhU %}

You can build mobile applications with Python? Absolutely. At Python Frederick's October 2018 presentation, [Bob Marchese](https://github.com/bobm123) showed us how to use [BeeWare](https://pybee.org/), a suite of tools for building mobile apps (among other things).

Bob's presentation material are available on the [Python Frederick talks repository](https://github.com/python-frederick/talks/blob/master/2018-10-beeware/BeeWareTalk.pdf) on GitHub.