teleren/devto huggingface dataset:
شركة هلال الخليج للخدمات العامة
Tags: html
Published: 2020-11-07 21:24:25

شركة هلال الخليج للخدمات العامة
(نقل وفك وتركيب اثاث - تنظيف - مكافحة حشرات)

هلال الخليج هي أفضل شركة نجار وفك وتركيب اثاث. نقدم لك جميع الخدمات العامة مثل التنظيف ومكافحة الحشرات ونقل وفك وتركيب الاثاث بالرياض بأقل الأسعار وأفضل خدمة وجودة
<a href="https://hilal-alkhalij.com" >hilal-alkhalij.com</a>
<a href="https://hilal-alkhalij.com/%d9%86%d8%ac%d8%a7%d8%b1-%d8%a7%d9%8a%d9%83%d9%8a%d8%a7-%d8%a7%d9%84%d8%b1%d9%8a%d8%a7%d8%b6/" >نجار ايكيا الرياض</a>
<a href="https://hilal-alkhalij.com/%d9%86%d8%ac%d8%a7%d8%b1-%d8%aa%d8%b1%d9%83%d9%8a%d8%a8-%d8%ba%d8%b1%d9%81-%d9%86%d9%88%d9%85-%d8%a8%d8%a7%d9%84%d8%b1%d9%8a%d8%a7%d8%b6/" >نجار تركيب غرف نوم بالرياض</a>
<a href="https://hilal-alkhalij.com/%d9%86%d8%ac%d8%a7%d8%b1-%d9%81%d9%83-%d9%88%d8%aa%d8%b1%d9%83%d9%8a%d8%a8-%d8%ba%d8%b1%d9%81-%d9%86%d9%88%d9%85-%d8%a8%d8%a7%d9%84%d8%b1%d9%8a%d8%a7%d8%b6/" >نجار فك وتركيب غرف نوم بالرياض</a>
<a href="https://hilal-alkhalij.com/%d9%86%d8%ac%d8%a7%d8%b1-%d9%81%d9%83-%d9%88%d8%aa%d8%b1%d9%83%d9%8a%d8%a8-%d8%a7%d8%ab%d8%a7%d8%ab-%d8%a8%d8%a7%d9%84%d8%b1%d9%8a%d8%a7%d8%b6/" >نجار فك وتركيب اثاث بالرياض</a>
<a href="https://forsanelmadina.com/%d8%b4%d8%b1%d9%83%d8%a9-%d8%aa%d8%b9%d9%82%d9%8a%d9%85-%d8%a8%d8%a7%d9%84%d9%85%d8%af%d9%8a%d9%86%d8%a9-%d8%a7%d9%84%d9%85%d9%86%d9%88%d8%b1%d8%a9/" >شركة تعقيم بالمدينة المنورة</a>
<a href="https://t3kem.medium.com/%D8%B4%D8%B1%D9%83%D8%A9-%D8%AA%D8%B9%D9%82%D9%8A%D9%85-%D8%A8%D8%A7%D9%84%D9%85%D8%AF%D9%8A%D9%86%D8%A9-%D8%A7%D9%84%D9%85%D9%86%D9%88%D8%B1%D8%A9-0509668536-4e59696be823/" >شركة تعقيم بالمدينة المنورة</a>


شركة هلال الخليج
هدفنا الوحيد هو التميز فى ارضاء احتياجك لنا
حيث نوفر لك عملينا العزيز الجودة والدقة بأقل الاسعار والتكاليف
فنحن فى انتظارك
للتواصل معنا على الارقام
+966539405738
https://hilal-alkhalij.com/
An Easy Way to Calculate Duration in C#
Tags: csharp, dotnet
Published: 2020-11-07 21:10:15

For a project I'm currently working on, I needed to find a simple way to calculate the duration between two button presses. I considered using the stopwatch, or timer class, but I discovered a (in my opinion) better solution.

```csharp
public void OnStart()
{
    this.Start = DateTime.Now;
}

public void OnEnd()
{
    this.End = DateTime.Now;
}

public TimeSpan GetDuration()
{
    return this.End - this.Start;
}
```

The timespan is able to hold the difference between two datetimes despite the format, which is really cool.
What is the difference between display:none and visibility:hidden?
Tags: css, interview, frontend, junior
Published: 2020-11-07 20:24:55

If you are a frontend developer at the beginning of your career I’m sure you wonder how to prepare for your first interview. I’m going to focus on technical questions you may be asked and prepare answers for you. 

In this article, I’m going to explain to you a difference between display:none and visibility:hidden properties as this is one of the questions you may hear during an interview for a frontend developer position.

Let’s use the following example to visualize the difference.


![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ll41bk4wavfxgqoljrjg.jpg)

Here we have four cards and want to make Card 2 invisible. In general, both properties make it possible. 

If we use *__display:none__* property the result will be the following:

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/tog472p7xr6libn3izpg.jpg)

As you can see Card 2 is not visible anymore and the remaining cards changed their positions so the margin we defined for them can be maintained. 

Let’s check now what happens if we set the *__visibility:hidden__* for Card 2.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/d1o3wuxse5pzulio3bw5.jpg)

As you can see it’s also not visible anymore like in the previous case but its spot is empty and other elements didn’t change their positions. The margins of the Card 2 have been maintained and all elements around behave as it was still there. 

I hope it explains well the difference between those two properties but if you still have any questions let me know.
The need to monitor json data quality in the database
Tags: node, json, schema, data
Published: 2020-11-07 20:16:14

With the use of json-type data as an exchange model between applications within an information system, it is now more than necessary to check the quality of the data that circulates.

To avoid ending up with unusable data, I used the jsonschema library for example to check the consistency of the data circulating in an information system.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ajcvam1yx41ro4q07wtc.png)

From this principle emerges the need to have real-time monitoring tools which make it possible to verify the quality of the data present in an information system.

For this I developed a small prototype using nodejs, but this need to check the quality of the data that circulates also applies to xml and other type documents.

# current data consistency status
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/70yo05wg3tm59xl46opv.PNG)

# input data analyzed
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/04pq9ylb7zizr6hlkskw.PNG)

You can contribute, my github :
https://github.com/tkhadir


By this way we can imagine for example a mongodb plugin that can detect incoherent documents for some personal criteria, the same plugin can be used for the rest of nosql solutions database.

Thank you
How to secure and ensure the internet-facing application load balancer only allow traffic from CloudFront?
Tags: aws, cloudfront, security
Published: 2020-11-07 19:33:23

![Architecture Diagram](https://dev-to-uploads.s3.amazonaws.com/i/wxqojwrnurv7bo52n835.png)

For every created internet-facing load balancer in AWS, they will have a public hostname. At most of the situation, a CloudFront distribution will be sitting in front of the load balancer for caching the static content and accelerate the delivery. And a WAF web ACL may create along and associate with the CloudFront distribution to provide application security. Or some Lambda@Edge function may create for customizing the content on the CloudFront distribution.

And now the problem is if the public hostname of the load balancer was exposed to the internet, the hacker on the internet can be bypassing the web ACL at the CloudFront distribution to attack the application. The only way is to only allow inbound traffics from CloudFront distribution.

To achieve this restriction, for every inbound request, the CloudFront distribution will insert a custom header `X_Request_From_CloudFront` with a hash value when the request passing through, and next forward to the load balancer. And the load balancer will have another associated WAF web ACL, to validate if the `X_Request_From_CloudFront` custom header exists and matching the hash value. The web ACL will reject the request if the custom header not exists or the value does not match.

In order to hide the custom header `X_Request_From_CloudFront`, and its hash value from the client-side and server-side, the 'Drop invalid header fields' is required to enable in the load balancer. 

According to the document, [Load balancer attributes](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/application-load-balancers.html#load-balancer-attributes)

> Indicates whether HTTP headers with header fields that are not valid are removed by the load balancer (true), or routed to targets (false). The default is false. Elastic Load Balancing requires that message header names contain only alphanumeric characters and hyphens.

Since the custom header `X_Request_From_CloudFront` contains underscores, the load balancer will consider it as an invalid header and remove the custom header and its value when the request passing through, which means it only exists in the request between the CloudFront distribution and the load balancer.

## Reference
[Adding Custom Headers to Origin Requests](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/add-origin-custom-headers.html#add-origin-custom-headers-configure)
[Load balancer attributes](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/application-load-balancers.html#load-balancer-attributes)
Introduction to recursion (Part 1 Theory)
Tags: webdev, algorithms, javascript
Published: 2020-11-07 19:12:12

Have you ever heard the term recursion function!?

if you're a developer - and you are of course - the answer would be definitely YES!

maybe this term makes you a little bit confused or maybe scared (as I'm at the first sight ) but please calm down it's really easy and very helpful.

We're going to divide this talk into two parts

 **Theory** and **Practical**
 
#Theory.

In theory, we need to answer 3 questions What, Why, and How.

###WHAT?
ok, let's make it as simple as it indeed is.

Recursion is a "function calls itself".
Simply from the body of the function, we use the same function again over and over until reaches a certain result.

Yes, I've heard your question 😃
why would I make a function to call itself again and what the benefits of doing so?

Here we go to the next question

###WHY?
recursion as you already guessed (maybe not) is similar to loops.

But when you work with a large number of data (Objects, Numbers, etc.)
loops became a cumbersome process to our program and maybe break it, especially when you make two loops in the same process or loop inside a loop this consumes a lot of resources and slows down the process.

But we as developers always trying to make our code clean, fast, and as efficient as possible, Right?

In this situation recursion becomes handy.

we use it when we got a big number of data we need to loop inside it but you care about the time and readability and efficiency of your code, ok?

let's jump to the last question of **theory**

###HOW?
here's how it works, there are two parts recursion function must have to be a recursion

1-Different input:
we agreed that it's a "function calls itself" so it doesn't make sense to give the function the same input and expect to do a different thing so every time the function executed must have different input.

2-Base case:
because recursion function kinda loop,
and every loop must have a time where it stops and returns a value, or we're going to have an infinite loop.
the time we stop our recursion function is the base case of the function.
so when we say the base case of the recursion function it means the phase that stops and returns its result.

That's it for theory, I hope it was simple, and follow me for more ❤️

###The practical part here
https://dev.to/abd_elrahmanmo/introduction-to-recursion-practical-2odm]
GifBook JavaScript SPA w/Rails API 
Tags: javascript, rails, twilio
Published: 2020-11-07 19:11:22

After completing the JavaScript portion of Flatiron Schools engineering program and before we got to dive into the React framework we were tasked with building a SPA(Single Page Application) showcasing our newfound knowledge of the language. This application was required to utilize a pure JavaScript, HTML & CSS front end with a Rails API back end.

For my project, I decided on creating an app that would allow a user to search for GIFs utilizing the GIPHY API and store their favorites to their account. Additionally, through the use of the Twilio API, the user would be provided the ability to send a GIF via SMS text to their desired recipient. Below I walk through the surprisingly easy integration of what I thought would be the most difficult aspect of my app, SMS messaging via Twilio.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/7l9ggtlgoe4k3adhfaog.png)

The Twilio API can be easily integrated into a Rails application through the use of the Twilio Ruby helper library by installing the ‘twilio-ruby’ gem. After the gem was installed I integrated the Twilio client into my message model as a class method. In this method I needed to initialize the Twilio client and authenticate via the provided ‘account_sid’ & ‘auth_token’ I was given by Twilio. I was then able to call the ‘messages.create’ methods on the ‘client’ while passing in the associated arguments to include the phone number for the recipient, the message ‘body,’ and the associated URL for the GIF provided by the end-user.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/qr8ij649red7n2bs3m7s.png)

The ‘new_message’ class method gets called from the create action in the message controller when an associated POST fetch request is made by the user on the front end. The form on the front end captures the data passed in by the user via an event listener listening for the ‘submit’ event of the form. Once the event is triggered the parameters then get passed into the ‘create’ action in the Message controller via the ‘createMessage’ function in the main JavaScript file. This sequence of events then fires off the SMS message to the recipient.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/b44b9i0kxq2c4vhjhrq3.png)

Having never worked with Twilio before it was something I wanted to integrate into my app as I like to test my knowledge working with new systems and implementations that I am unfamiliar with. The integration of this feature was a last priority for me as I wanted the MVP up and running as quick as possible and I anticipated a lot more work then what was actually required to get it up and running. Thanks go to Twilio’s helper library, and ill be looking for something new and more difficult for the next project!

This article was migrated over from Medium. The original article can be found [here](https://medium.com/@jefftswisher/gif-book-f87e205064b7)
Custom Error Screen Instead of Default Crash Dialog — Android
Tags: android, java, kotlin, programming
Published: 2020-11-07 18:42:54

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/3qzn1mddkju7oc5ktzcm.png)

I don’t know about you but I feel very embarrassed when I deliver an app to tester or client for testing and it get crash. That moment is very painful for me.

I personally don’t like that crash alert dialog that appears when my app gets crash. So I found an interesting library that will show an error screen instead of an error dialog.

Let’s get started.

What I’m going to use:
* Kotlin
* Android Studio
* [Library](https://github.com/Ereza/CustomActivityOnCrash)

After creating a new project add this dependency in your `build.gradle(:app)`.

`implementation 'cat.ereza:customactivityoncrash:2.3.0'`

I am making my custom crash layout. Like this:

![layout](https://miro.medium.com/max/1000/1*NSCivDY6GYAS8EiahMPEZg.png)

> I downloaded this error image from [here](https://icons8.com/illustrations/illustration/pixeltrue-error).

{% gist https://gist.github.com/Mustufa786/0666c78f62beb2e28b2f9ebcc990c9f7 %}

Let’s do some coding part to catch the crash event and show custom screen instead of android default dialog.

{% gist https://gist.github.com/Mustufa786/b994befac1e55d8330343937fd71f8a9 %}

Now you need to make an application class that will register in the android manifest to register crash library globally in-app.

{% gist https://gist.github.com/Mustufa786/a92a4d47f8b288f18470785e67dcdec0 %}

Add this class in `AndroidManifest.xml` using `name` attribute.

![AndroidManifest.xml](https://miro.medium.com/max/1400/1*D4JvY_qoWzO9OQR_8lzJxQ.png)

Now moving towards `MainActivity.kt` to see this in action. We need to crash our app to see the crash screen. I am implementing a crashing code in my `onCreate` method.

```
var array = mutableListOf<String>()
array[0] = "Hello"
findViewById<TextView>(R.id.textView).text = array[1]
```

This will crash my app as this code will generate `IndexOutOfBoundException`.

Let’s run the app.

![final app](https://miro.medium.com/max/434/1*xQDZCptr2wjoxDQtJLQBFQ.gif)

Download Source code from [here](https://github.com/Mustufa786/CustomCrashActivity).
Strapi Starter Nuxt.js e-commerce
Published: 2020-11-06 13:57:35

---
title: Strapi Starter Nuxt.js e-commerce
published: true 
description: Bootstrap a simple e-commerce website using Strapi, Nuxt.js and Snipcart. In this starter, you'll be able to use all the latest features available in Strapi. 
tags: 
//cover_image: https://direct_url_to_image.jpg
---
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/n3x8kzldo64bd3212efk.png)

If you follow the content of our blog you are aware that Remi and I have embarked on the creation of starters. I created a [blog starter using Gatsby](https://strapi.io/blog/strapi-starter-gatsby-blog-v2) and Remi a [corporate site starter using Next.js](https://strapi.io/blog/strapi-starter-next-corporate-site) as well as a [portfolio starter using Gridsome](https://strapi.io/blog/strapi-starter-gridsome-portfolio). Well today I am glad to announce that an e-commerce starter using Nuxt.js and Snipcart has been published!

![Gif excited](https://media.giphy.com/media/UlqLDtI8Qc0j6/giphy.gif)

This starter is a simple e-commerce application on which you can buy dev stickers with an integrated shopping cart made by [Snipcart](https://snipcart.com/). Super easy to integrate, Snipcart offers you the possibility to sell products, downloads, or subscriptions online.

### Features in Strapi

- 1 Component
- 2 Collection types: Product, Category
- 27 Created products
- 6 Created categories
- Permissions set to `true` for product and category
- Responsive design using Tailwind css
- Slug system
- Publication system (draft & published)
- Role based access controls

### Features in Nuxt.js

- [@nuxt/strapi](https://strapi.nuxtjs.org/) module

### Payment service

This starter is using [Snipcart](https://snipcart.com/) which allows you setup a shopping cart on any website.
They wrote a [tutorial](https://snipcart.com/blog/strapi-nuxt-ecommerce-tutorial) teaching you how to create this website but selling cupcakes!

Payment will not work on localhost, we are redirecting you to this [tutorial](https://snipcart.com/blog/develop-a-snipcart-powered-website-locally-using-ngrok) if you want to test payment locally.

### Getting started

Clone the [repository](https://github.com/strapi/strapi-starter-nuxt-e-commerce)

```
git clone https://github.com/strapi/strapi-starter-nuxt-e-commerce.git
cd strapi-starter-nuxt-e-commerce
```

**Backend**

Install dependencies and run your server

```bash
# Using yarn
yarn install
yarn develop

# Using npm
npm install
npm run develop
```

**Frontend**

```bash
# Using yarn
yarn install
yarn develop

# Using npm
npm install
npm run develop
```

Nuxt.js server is running here => [http://localhost:3000](http://localhost:3000)

Enjoy this starter

If you liked this starter and want to develop a version of it with another frontend framework (Vue.js, Next.js or 11ty for example). Feel free to submit a Topic idea [here](https://github.com/strapi/community-content/issues/new?labels=Looking+for+author&template=submit-a-topic.md&title=%5BTOPIC%5D)!

Thank you for taking the time to read this blog post, I'll see you soon with a new starter (with Gridsome again) ;)
Enjoy this starter!
Day7 in #100daysofCode
Tags: webdev, javascript, css, devjournal
Published: 2020-11-07 18:38:35

So today I was learning and working with api with javascript to level up my work process in fetching api's in javascript. But it didn't end up well suddenly I had a issue with my api 403 Error and it went for a long time without showing me my valuable result. So I moved on to learn some new stuffs and made my day some what useful. But I'll circle back tomorrow to work with api and stuffs with javascript to become for flexible using any api's. And from now on I'll be posting quotes at the end of my journal for boosting up peoples motivation => and these quotes are from my project where I used and quote api to fetch me these quotes. If you guys wanna check check it out in my portfolio and I'm also gonna link the quote page directly here 👇https://niroshkumar072.github.io/Quote-generator/
So comment if you guys like my work with that. Peace out☮🕊

And today's thought is:

*Self-trust is the first secret of success.*
         -Ralph Waldo Emerson
Concise and type-safe scripting with kotlin
Tags: kotlin, scripting, automation
Published: 2020-11-07 18:32:44

---
title:  Concise and type-safe scripting with kotlin
published: true
description: Say goodbye to bash scripts
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/85eld9jo3r0dd9cjejao.jpg
tags: kotlin, scripting, automation

---

A kotlin script is a way to **compile** and **run** `Kotlin` code easily. 
Scripts are a powerful tool when you want to automate any kind of work. The most used languages for scripting tend to be `python` 
or `bash`/`shell` but, what if you could get the same task done with `Kotlin`?
But not just that. What if you had access to any java or kotlin library in your scripts?

With `Kscript` you can easily do that! Besides it also offers a lot of features.

- Scripts caching: Running the same script will be way faster the second time.
- Maven dependencies
- IntelliJ support
- Bootstrap header
- Check the [kscript repo](https://github.com/holgerbrandl/kscript) for the full feature set.

<br>

### Trying it out


Install it with [sdk man](https://sdkman.io): 

```bash
$ sdk install kscript
```

<p></p>
Now let's create a `.kts` file and try importing some libraries to create an embedded server:
```kotlin
#!/usr/bin/env kscript

@file:MavenRepository("bintray-ktor","https://dl.bintray.com/kotlin/ktor")
@file:DependsOnMaven("io.ktor:ktor-server-netty:1.2.6")

import io.ktor.application.*
import io.ktor.http.*
import io.ktor.response.*
import io.ktor.routing.*
import io.ktor.server.engine.*
import io.ktor.server.netty.*

println("starting server...")

val server = embeddedServer(Netty, port = 8080) {
  routing {
    get("/") {
      call.respondText("Hello World!", ContentType.Text.Plain)
    }
  }
}
server.start(wait = true)
```

Now, lets run it!
```
$ kscript kscript-server.kts
```

Open your browser on `localhost:8080/`

Cool, right?

But if you’re like me you probably do most of your work on the IDE. So, let’s try that now.

If you have Intelij Idea on your machine you can type 
``` bash
$ kscript --idea kscript-server.kts 
``` 
and it will generate a Gradle Kotlin project with all dependencies declared with the `@file` convention and add them to a Gradle file.

**#Protip**: If syntax highlighting is not working properly, just right click on the `build.gradle` file select `Import Gradle project`