teleren/devto huggingface dataset:
Text over Background Image with Viewport Width (vw)
Tags: css, html, website, design
Published: 2021-04-12 16:13:57

# Plan
Many time we show texts over images. We will define three background images and then write text above (top, middle and bottom) it.

# Basic Structure
Our site will contain a table with 3 column. Each will contain a background image with text above it.
```
<style type="text/css">
	table{
		width: 100%;
	}
	tr{
		width: 100%;
		vertical-align: top;
	}
</style>
<table>
	<tr>
		<td>
			<p>Road to Heaven</p>
		</td>
		<td>
			<p>Road to Heaven</p>
		</td>
		<td>
			<p>Road to Heaven</p>
		</td>
	</tr>
</table>
```

# Background image
Let's add the background image first.
```
td{
		background-image: url("https://images.unsplash.com/photo-1526512340740-9217d0159da9?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1545&q=80");
		background-repeat: no-repeat;
		background-size: 100%;
		text-align: center;
}
```

# Text above image
Also let's design the text a bit.
```
p{
		font-size: 2vw;
		padding: 20px;
	    background-color: #000000b5;
	    border: 1px solid #ffffff;
	    border-radius: 15px;
	    color: white;
	    text-shadow: 0px 1px #eff1f4;
}
```

# Position the text
Now we will position 1st text on top, 2nd text in middle and 3rd text on bottom.
```
td:nth-child(1) p{
	  margin-top: 0vw;
	  margin-bottom: 40vw;
}
td:nth-child(2) p{
	  margin-top: 20vw;
	  margin-bottom: 20vw;
}
td:nth-child(3) p{
	  margin-top: 40vw;
	  margin-bottom: 0vw;
}
```

# Result
Let's see the result in different screen widths.
## 1200px
![1200px](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2xbhjzzj2vdqyvkyt76k.png)
## 800px
![800px](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p67ql45j3rq350htpcz1.png)
## 400px
![400px](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bi2huuoxufgkw0sa9xrh.png)

# Full Code
```
<style type="text/css">
	table{
		width: 100%;
	}
	tr{
		width: 100%;
		vertical-align: top;
	}
	td{
		background-image: url("https://images.unsplash.com/photo-1526512340740-9217d0159da9?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=1545&q=80");
		background-repeat: no-repeat;
		background-size: 100%;
		text-align: center;
	}
	p{
		font-size: 2vw;
		padding: 20px;
	    background-color: #000000b5;
	    border: 1px solid #ffffff;
	    border-radius: 15px;
	    color: white;
	    text-shadow: 0px 1px #eff1f4;
	}
	td:nth-child(1) p{
	  margin-top: 0vw;
	  margin-bottom: 40vw;
	}
	td:nth-child(2) p{
	  margin-top: 20vw;
	  margin-bottom: 20vw;
	}
	td:nth-child(3) p{
	  margin-top: 40vw;
	  margin-bottom: 0vw;
	}
</style>
<table>
	<tr>
		<td>
			<p>Road to Heaven</p>
		</td>
		<td>
			<p>Road to Heaven</p>
		</td>
		<td>
			<p>Road to Heaven</p>
		</td>
	</tr>
</table>
```
Calling by value & by reference in Python
Tags: python, algorithms, database, machinelearning
Published: 2021-04-12 15:38:45

Hello folks,

### Let's test the following functions:

```python

def double(arg):
    """ This function takes 'arg' object and multiply it by 2. """
    print('Before: ',arg)
    arg = arg * 2
    print('After: ',arg)

# Calling the function
flist = [10,20]
double(flist )
print('Original : ',flist )

```
The output will be like this:

Before:  [10, 20]
After:  [10, 20, 10, 20]
Original:  [10, 20]

This means that the `arg` object passed to the function by value, and it's changed only within the function suite.
_Put in your consideration that **Python** allow pass by value and pass by reference._

### Second function

```python

def change(arg):
    """ This function takes 'arg' object and add '30' to it. """
    print('Before: ',arg)
    arg.append(30)
    print('After: ',arg)

# Calling the function
slist = [10,20]
change(slist)
print('Original: ',slist)

```
The output will be like this:

Before:  [10, 20]
After:  [10, 20, 30]
Original:  [10, 20, 30]

This means that the `arg` object passed to the function by reference, and it's changed within the function suite and in the original object (simply it is passed by address).

### Let's explain what happens here...

As Python allow the two types of passing objects, why the above functions behave in different ways?


In Python if the passed object is **Mutable** like lists, dictionaries, and sets are always passed into a function by reference.

and for **immutable** like strings, integers, tuples are always passed into a function by value.

But it seems that there is an **Error** with the interpreter.

### To understand what happened

Remember that in the first function `double` the arg object changed using _assignment statement_ , so what happened that the right side of the assignment statement is executed and a new object created with value of arg * 2, then assigned to `arg` with only the function suite, However the original object still exits in the calling code.

On the other hand, because using `.append()` both lists in the function suite and the calling code affected by the append() function because both refer to the same object.

This explains what happened.

I hope this small article has been helpful.

Thanks
How to Create a Checkers Board Game in AR in 15 Minutes or Less [Tutorial]
Tags: tutorial, unity3d, gamedev, augmentedreality
Published: 2021-04-12 15:36:52

Looking to create a checkers board game in AR? This demo checkers board game application created with Unity, AR Foundation, and echoAR is a great place to start. The full demo can also be found on echoAR’s [GitHub](https://github.com/echoARxyz/Unity-ARFoundation-echoAR-demo-Board-Game).

![1.gif](https://cdn.hashnode.com/res/hashnode/image/upload/v1618241302415/1B25yFfQR.gif)

# Register

* Don’t have an API key? Make sure to register for FREE at [echoAR](https://console.echoar.xyz/#/auth/register).

# Setup

* Clone the [Unity+ARFoundation with echoAR](https://github.com/echoARxyz/Unity-ARFoundation-echoAR-example) example code.
* Follow the instructions on our [documentation page](https://docs.echoar.xyz/unity/adding-ar-capabilities) to [set your API key](https://docs.echoar.xyz/unity/adding-ar-capabilities#3-set-you-api-key).
* [Add the 3D assets](https://docs.echoar.xyz/quickstart/add-a-3d-model) and their medatada from the [Models](https://github.com/echoARxyz/Unity-ARFoundation-echoAR-demo-Board-Game/blob/master/Models) folder to the console.
* Overwrite the existing *Assets/echoAR/echoAR.cs* script with the new *[echoAR.cs](https://github.com/echoARxyz/Unity-ARFoundation-echoAR-demo-Board-Game/blob/master/Scripts/echoAR.cs)* file.
* Overwrite the existing *Assets/echoAR/CustomBehaviour.cs* script with the new  *[CustomBehaviour.cs](https://github.com/echoARxyz/Unity-ARFoundation-echoAR-demo-Board-Game/blob/master/Scripts/CustomBehaviour.cs)* file.
* Overwrite the existing *Assets/AR Foundation/Scripts/PlaceOnPlane.cs* script with the new *[PlaceOnPlane.cs](https://github.com/echoARxyz/Unity-ARFoundation-echoAR-demo-Board-Game/blob/master/Scripts/PlaceOnPlane.cs)* file.
* Copy the entire *[Resources](https://github.com/echoARxyz/Unity-ARFoundation-echoAR-demo-Board-Game/blob/master/Resources)* folder to *Assets/echoAR/*.

![2.jfif](https://cdn.hashnode.com/res/hashnode/image/upload/v1618241490751/s1EBJXvCH.jpeg)

# Run

* [Build and run the AR application](https://docs.echoar.xyz/unity/adding-ar-capabilities#4-build-and-run-the-ar-application).

![3.jfif](https://cdn.hashnode.com/res/hashnode/image/upload/v1618241521983/QujdUyB1fu.jpeg)

# Learn more

Refer to our [documentation](https://docs.echoar.xyz/unity/) to learn more about how to use Unity, AR Foundation, and echoAR.

# Support

Feel free to reach out at support@echoAR.xyz or join our [support channel on Slack](https://go.echoar.xyz/join).

![4.jfif](https://cdn.hashnode.com/res/hashnode/image/upload/v1618241569501/3B7ErSemz.jpeg)

> echoAR (http://www.echoAR.xyz; Techstars ’19) is a cloud platform for augmented reality (AR) and virtual reality (VR) that provides tools and server-side infrastructure to help developers & companies quickly build and deploy AR/VR apps and experiences.

![5.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1618241582513/oaDKL-s5L.png)
Multiline flag in regex
Tags: regex, regularexpression, beginners, webdev
Published: 2021-04-12 15:36:46

```js
const str = `
1. Bread
2. Apples
3. Milk
`;

const regex = /^\d\./gm;
console.log(str.match()); // [ '1.', '2.', '3.' ]
```

`m` flag enables to match at the start and end of every line.
The regex matches lines that start with __number followed by comma__

---

**Thanks for reading 💙**  
Follow **@codedrops.tech** for daily posts.  
[Instagram](https://www.instagram.com/codedrops.tech/) ● [Twitter](https://twitter.com/codedrops_tech) ● [Facebook](https://www.facebook.com/codedrops.tech/)

Micro-Learning ● Web Development ● Javascript ● MERN stack ● Javascript  
**[codedrops.tech](https://www.codedrops.tech/)**
How to Index Q&A Data With Haystack and Elasticsearch
Tags: python, deeplearning, machinelearning, datascience
Published: 2021-04-12 15:27:08

{% youtube Vwq7Ucp9UCw %}

The second video in 'Building a Stoic Q&A App' - here we're setting up Elasticsearch and Haystack to store the data (Meditations) ready for retrieval when we ask our app questions.
Part 2 video of pair programming with Perl and Mojolicious
Tags: perl, pairprogramming, mojolicious
Published: 2021-04-12 16:11:07

---
title: Part 2 video of pair programming with Perl and Mojolicious
published: true
date: 2021-04-12 15:20:13 UTC
tags: Perl,pairprogramming,Mojolicious
canonical_url: https://phoenixtrap.com/2021/04/12/part-2-video-of-pair-programming-with-perl-and-mojolicious/?utm_source=rss&utm_medium=rss&utm_campaign=part-2-video-of-pair-programming-with-perl-and-mojolicious
series: Live-coding a web app in Perl and Mojolicious
---

Gábor and I made some headway Sunday on his course management app, converting our config reader into a helper, writing some tests and logging, and stubbing out the login email flow. How the time flew! You can [check out the video on PerlMaven.com](https://perlmaven.com/course-management-app-in-mojolicious-2) along with related links.
HAProxy Basic Login Authentication
Tags: cloudopz, devops, haproxy, rest
Published: 2021-04-12 15:19:25



### - In haproxy config, there is no limit to the number of http-request statements per instance so we can add the rules to request basic login to the site but whitelist specials IPs

---

## 🚀 **Setup HAProxy config which contains basic login to access the dashboard and allow access for special resource IP**

- Generate haproxy encrypted password

```
printf "thepassword" | mkpasswd --stdin --method=sha-256
```

- Modify [haproxy.cfg](https://github.com/vumdao/haproxy-basic-auth/blob/master/haproxy.cfg) which allow access for requests from source `18.69.61.21` but requires login for others

```
userlist AuthUsers
        user haproxyreport password $5$3VeorK1XxvgRseQ$VBkOPCY2enWZsas.C6X9Iif0FPHDknXXXXXXXXX

frontend fe-verify
        bind *:443 ssl crt /etc/certs

        acl haproxy_report hdr(host) haproxy-report.cloudopz.co

        http-request set-header X-Forwarded-Proto https if { ssl_fc }
        use_backend haproxy-report-backend if haproxy_report

# haproxy-report-backend
backend haproxy-report-backend
        acl authorized http_auth(AuthUsers)
        acl nagios src 18.69.61.21
        http-request allow if nagios
        http-request auth realm haproxyreport if !authorized
        server haproxy-report 127.0.0.1:1800
```

**More about haproxy**
- [How To Set HTTP-Request Header In Haproxy](https://dev.to/vumdao/how-to-set-http-request-header-in-haproxy-48bd)
- [How To Block IP Addresses In HAProxy](https://dev.to/vumdao/how-to-block-ip-addresses-in-haproxy-3f84)
- [HAProxy With Resolvers In Case Of AWS Application LoadBalancer](https://dev.to/vumdao/haproxy-with-resolvers-in-case-of-aws-application-loadbalancer-d1n)
- [Use GoAccess To Analyze HAProxy Logs](https://dev.to/vumdao/use-goaccess-to-analyze-haproxy-logs-2m51)

[Reference](https://www.haproxy.org/download/2.4/doc/configuration.txt)

<h3 align="center">
  <a href="https://dev.to/vumdao">:stars: Blog</a>
  <span> · </span>
  <a href="https://github.com/vumdao/">Github</a>
  <span> · </span>
  <a href="https://vumdao.hashnode.dev/">Web</a>
  <span> · </span>
  <a href="https://www.linkedin.com/in/vu-dao-9280ab43/">Linkedin</a>
  <span> · </span>
  <a href="https://www.linkedin.com/groups/12488649/">Group</a>
  <span> · </span>
  <a href="https://www.facebook.com/CloudOpz-104917804863956">Page</a>
  <span> · </span>
  <a href="https://twitter.com/VuDao81124667">Twitter :stars:</a>
</h3>
Salesforce: Pardot
Tags: salesforce
Published: 2021-04-12 15:10:06

*Salesforce has so much terminology it can be a bit overwhelming in the beginning. I am starting a series of short posts to help me learn the definitions.*

-----

###
**Pardot**
###
is a business-to-business (B2B) marketing automation platform. It includes email automation, targeted email campaigns, lead management, and tracking customer behavior.

Salesforce acquired Pardot in 2013 as part of the ExactTarget acquisition. Radian6, Buddy Media, and ExactTarget are part of the Salesforce marketing cloud.
My first go at Metaprogramming
Tags: ruby, rails, metaprogramming
Published: 2021-04-12 14:47:39

I have been a Rails programmer for the past 3 years after transitioning from PHP and Laravel. 
So for part of the last 3 years, I had been programming Rails but in a PHP way. I had been trying to get a deeper understanding of things and how to do things better. I recently picked up and read Metaprogramming Ruby 2; Program like the Ruby Pros. Which contains some interesting ideas especially if you have never done this before.

I have recently started a new job that allows me to be more creative with how I solve problems, one of the tasks that I have picked involves handling daily cut-offs for orders.

I had in my head a plan that I wanted a class that I could call with methods e.g after_monday_cutoff? The old me would have written these methods by hand individually.

But I took the chance to look at how this could be done dynamically. This may not be the correct or best way of doing this so please let me know if it can be refactored. 

I first created a class that sets a CUT_OFF constant from the setting yml. I am doing to_i here as it is a string.

I then use an array of days which I go over each and pass the day to the defined_method which will then create a method for each of the days
```
class Cutoff
  class << self
    CUT_OFF = Settings.cut_off.to_i
    %w[monday tuesday wednesday thursday friday saturday sunday].each do |day|
      define_method "after_cutoff_on_#{day}?" do
        now = Time.zone.now
        (now.send("#{day}?") && now.hour >= CUT_OFF)
      end
    end

    %w[monday tuesday wednesday thursday friday saturday sunday].each do |day|
      define_method "before_cutoff_on_#{day}?" do
        now = Time.zone.now
        (now.send("#{day}?") && now.hour < CUT_OFF)
      end
    end
  end
end
```

This code produces methods like.

```
def after_cutoff_on_monday?
  now = Time.zone.now
  (now.monday? && now.hour >= CUT_OFF)
end
```

This is probably not the best use of metaprogramming or indeed the best way of doing this. But it proved to me that something that I thought was complicated can be broken down and used in simpler places and could be a easy in into this new way of programming.
I'm Diving In...
Tags: ikigai, choosetochallenge, discovery
Published: 2021-04-12 14:45:02

I've been telling myself I need to get out of my comfort zone and learn something new, well at least even just challenge myself to apply a new skill somewhere. This has been a constant battle within me for 5 years now and today I stumbled upon some very interesting courseware from Coderslang {% twitter 1330858823783952388 %} and they way they've packaged the course made me dive straight in. My approach is I wanna unlearn the much I know about JS and take each lesson a fresh. That's my plan for the next 100 days. 

I hope I will be able to keep this daily log of my lessons so that I can track my progress and hopefully inspire others like me to learn something.
Sintatra (Ruby)
Published: 2021-04-12 14:29:16

---
title: Sintatra (Ruby)
published: true
description: 
tags: 
//cover_image: https://dev-to-uploads.s3.amazonaws.com/uploads/articles/it90f2d49esdm5oj2u2m.jpg
---

I have completed a Sinatra project with Ruby. It's important to note that Sinatra is just a gem. It's a library of code that developers wrote to allow us to build lightweight web applications quickly.

Web applications, even simple Sinatra ones, tend to require a certain degree of complexity. For example, your application might have multiple routes, route-handlers, and configurations. To handle this, Sinatra is more commonly used through the Modular Sinatra Pattern (over the classical, single-file app.RB pattern). 

In my experience writing endpoints in Sinatra, it took me some time to understand how the views interacted with the controllers and models. I was used to writing SQL and very complex queries however I did not anticipate the complexity of MVC. Breaking my idea down into the simplest example also helped as well building a basic CRUD web application. I'm looking to expand on what I have built thus far with rails. After completing this project I learned that I also should spend more time learning about sessions and params.

Here's a link to my attendance Sinatra project below if you would like to check it out:


https://github.com/Sharifdesigns22/Sinatra/tree/master
How microservices fit into DevOps
Tags: devops
Published: 2021-04-12 14:40:52

DevOps practices have a simple principle. It focuses on breaking down huge problems into smaller ones and handling them in order of preference as a team. Likewise, Microservices also operate through small teams and make one functional change at a time. Besides, microservices can easily adjust the scaling without impacting the resource allocations for the remaining system. This simply indicates that the blend of [DevOps and microservices](https://bit.ly/3uISJaK) in the development process is the fastest way to enhance the output of your teams. 

**Microservices and DevOps are bringing transformation together**

An architecture based on microservices initiates change that is well-accepted by the ones who are involved in the process of creating modern applications. They experience a sudden increase in productivity and realize that it becomes easy and quick to deliver flexible and scalable solutions.
ĐỊNH VỊ XE MÁY GÒ VẤP
Published: 2021-04-12 14:31:05

Chỉ Cần Alo là có kỹ thuật đến lắp ĐỊNH VỊ XE MÁY GÒ VẤP uy tín, Lắp đặt dấu kín bí mật, Sản phẩm mới nhất năm 2021. Chúng tôi không lắp bình ắc quy xe máy, vị trí này dễ bị phát hiện. Lắp tận nơi bảo hành tận nơi.

Có phải bạn đang muốn lắp THIẾT BỊ ĐỊNH VỊ XE MÁY GÒ VẤP nhưng không biết đơn vị nào cung cấp uy tín ? sản phẩm nào chất lượng ? Bạn muốn lắp đặt dấu kín, bảo mật thông tin theo dõi một cách cá nhân. Đến với chúng tôi bạn hoàn toàn yên tâm về điều đó.

Định Vị Xe Máy Gò Vấp
- Lắp Định Vị Xe Máy Để Giám Sát Con Em Đi Học tại quận Gò Vấp
- Lắp Định Vị Xe Máy Để Giám Sát Nhân Viên.
- Lắp Định Vị Xe Máy Để Giám Sát Cá Nhân Vợ Chồng.

Chúng tôi hiểu được nhu cầu của quý khách khi Lắp Thiết Bị Định Vị Xe Máy Tại Quận Gò Vấp , Vậy nên chúng tôi đã tìm hiểu để đưa ra thị trường sản phẩm tốt nhất cho quý khách hàng.

Quận Gò Vấp Phía đông giáp quận Bình Thạnh và Quận 12, Phía nam giáp các quận Phú Nhuận và Tân Bình.

.Ngoài nạn trộm cắp , nhiều cá nhân có nhu cầu theo dõi cá nhân, thiết bị định vị là một giải pháp. Để đáp ứng các giải pháp này chúng tôi xin giới thiệu đến quý khách các sản phẩm sau đây:
https://dinhvixemay.org/lap-dinh-vi-xe-may-tai-quan-go-vap-tphcm.html
How to use margin in a Styled Component inside Styled Component?
Tags: react
Published: 2021-04-12 14:28:28

Margin doesn't work when i have styled component inside styled component in react native. I need that specific way **styled(StyledBody)**.

```
import React from 'react';
import styled from 'styled-components/native';
import { Text, View } from 'react-native';

export default function HelloWorldApp() {
  return (
    <>
      <StyledBody2>
        <Text>Hello, world!1</Text>
      </StyledBody2>

      <Text>Hello, world!2</Text>
    </>
  );
}

const StyledBody = styled.View`

`;

const StyledBody2 = styled(StyledBody)`
  //it doesn't work
  margin: 20px;
`;

```
Things you should consider while using StackOverflow!
Tags: productivity, programming, beginners, webdev
Published: 2021-04-12 14:20:12

We developers love StackOverflow. Life as a developer would have been so hard without it. I know it has saved you many times as it has saved me over the years.

But, be a bit careful while using the solutions from stack overflow directly. 

Take the following points into consideration while using solutions from it.

## 1. The time when the question was answered
Being in tech, things change at a drastic rate. The time when the question was answered is very important because the solution might have been the best back in say, 2015 according to the tech stack at that time. 

But maybe in 2020 or 2021, a better solution could exist with improvements in the tech stack and new versions. The solution in 2015 and 2020 or 2021 could be significantly different.

## 2. Accepted answers are not always the best ones
Don't think that the accepted answer is the best one. No, it does work that way. Maybe, the unaccepted answer could be more good and optimal. This could happen because the better answer was posted after the accepted answer.
So, the next time you are on StackOverflow, don't just copy the accepted answer.
Spend time scrolling through all the answers.

## 3. Some comments are GOLD
Some comments just below the answers tell you more than the answer itself. It could be right from correcting the answer to pointing out why we should not use it. Sometimes, the comments explain the code better than the original author. Look out for such comments, they are life-saving.

## 4. Do not downvote, if you did not understand the answer
Don't just downvote someone because a lot of other people have. It's very easy to put someone down. Only downvote if you understand the shortcomings of the code or if you know the potential side effects it could have.

## 5. Be responsible while answering
Don't blindly answer questions! You need to be responsible enough to tell the good points, bad points, better solutions (if exists), and justify why you are giving this as an answer.

Thank you for reading.
Let us know your thoughts in the comments below.

Follow us on Instagram for more
https://www.instagram.com/the.ninja.programmer
How to improve the Clicks per Second rate?
Tags: cps, clickspersecond, cpstest
Published: 2021-04-12 14:14:22

CPS rate can be affected by the speed of your internet connection, as well as the efficiency of your device. However, to achieve the best CPS it is recommended to use a PC, such as a laptop or desktop computer.

You can use the <a href="https://cps-test.net">click speed test</a> to refine your skills and improve your mouse click speed and achieve a higher score over time.

Here are the different methods to improve CPS click speed:

1. Regular Clicking: You can train yourself to improve your mouse click speed by working on your regular clicking as part of conducting daily routine tasks such as editing documents, web browsing, and so on. Regular clicking typically produces a CPS score of 3-6 clicks per second with practice.

2. Jitter Clicking: This is a more challenging but more effective way to improve your CPS rate. A more advanced method, involves shaking the arm and wrist muscles to click the mouse as fast as possible. This creates a vibration in the hand that is known as the jitter effect. This can produce a CPS rate between 10 and 14 CPS.

3. Butterfly Clicking: An even faster technique, butterfly clicking can produce a click speed of 15 to 25 CPS.

4. Drag Clicking: Drag clicking is one of the fastest clicking techniques, with click speeds from 25 up to an incredible 100 CPS. This technique involves moving your finger from the top to the edge of the mouse button so that when you move your finger it stimulates mouse clicks.