teleren/devto huggingface dataset:
Drawing Paths for Xamarin.Forms
Tags: xamarinforms, mobile, design
Published: 2020-12-22 21:27:46

In the category of "did you know", Xamarin.Forms supports drawing primitive shapes and complex paths. For both, the Figma design tool is my choice lately to quickly copy the drawing code into Visual Studio to use in Xamarin.Forms XAML. Just about every design tool now has this "copy as svg" type of option.

{% youtube Q75npY6MToo %}

{% gist https://gist.github.com/davidortinau/baab1dfda67ec772933739e8b9ee9b50 %}

#### Resources:
* [Docs: Shapes & Paths](https://docs.microsoft.com/xamarin/xamarin-forms/user-interface/shapes/path)
* [Blog: Shapes & Paths](https://devblogs.microsoft.com/xamarin/xamarin-forms-shapes-and-paths/)

{% github davidortinau/BillDetailSample %}
Using StyleCop to boost my code reviews
Tags: codequality, dotnet
Published: 2020-12-22 21:27:02

#What is StyleCop?
StyleCop analyses C# source code to help enforce a set of style and consistency rules. This analysis helps teams to develop in a much more consistent way and improves the readability of the code base.

#Setting it up
* Copy the .editorconfig and stylecop.json files into the root of your solution
* Add the .editorconfig and stylecop.json files as Solution Items in Visual Studio
* Add the StyleCop.Analyzers NuGet package to all of the projects you want StyleCop to analyse
* Link to the stylecop.json file in all of the projects you want StyleCop to analyse
* Change the ‘Build Action’ property in the properties window to be set to ‘C# analyzer additional file’ for the stylecop.json files
* Edit the project file to set ‘TreatWarningsAsErrors’ to true. This is optional but it makes it clearer when the StyleCop rules are being violated

#Using StyleCop
If all of the above steps have been completed then the StyleCop analysers will run the next time the solution is built. When the ‘TreatWarningsAsErrors’ flag within your project file is set to true and the analysis fails then you will get a build failure. If the flag is set to false then you will be able to see the failures within the Warnings tab of the Errors window.

#My Rulesets
I have added the .editorconfig and stylecop.json files that I currently use below as there are some rules I don’t 100% agree. There are also some rules that I don’t agree with enough to force this onto anyone who has written their code that way. https://www.seanstride.co.uk/wp-content/uploads/2020/11/StyleCop.zip

If you would like to discuss my rulesets, or believe there are rules I have missed then please let me know in the comments section.

This post was originally posted on my blog here: https://www.seanstride.co.uk/using-stylecop-to-boost-my-code-reviews/
MongoDB: You're doing it wrong!
Tags: mongodb, database
Published: 2020-12-22 21:16:43

The main reason we use NoSQL, typically, MongoDB, is to store and query big data in a scalable way.


#### Document Reference Pattern.
When we think of modelling NoSQL in a RDBMS way, we'll need to reference documents in other collections to link or join 2 pieces of related data.

```json
// document in organization collection
{
   _id: "google",
   name: "Google"
}

// document in user collection
{
   _id: "john",
   name: "John Smith",
   organization_id: "google"

}

{
   _id: "jeff",
   name: "Jeff Brown",
   organization_id: "google"

}

```

So to find an organization and all the users in one query we need to use the aggregation framework:

```js
db.getCollection('organization')
.aggregate([
  {
    $match: { _id: "google"}
  },
  {
    $lookup: {
        from: "user",
        localField: "_id",
        foreignField: "organization_id",
        as : "users"
    }
  }
])
```

#### Result
```json
{
    "_id" : "google",
    "name" : "Google",
    "users" : [ 
        {
            "user_id" : "john",
            "name" : "John Smith",
            "organization_id" : "google"
        },
        {
            "user_id" : "jeff",
            "name" : "Jeff Brown",
            "organization_id" : "google"
        }
    ]
}
```

When using joins, our queries don't scale. The computation cost rises as data footprint increases.

#### Adjacency list pattern
Let's try the Adjacency list pattern for storing data:
Use **one** collection for all data. Let's call it "DATA"

```json
//organization document in DATA collection
{
    "_id": "org#google",
    "name": "Google",
}
{
    "_id": "org#microsoft",
    "name": "Microsoft",
}
{
    "_id": "org#apple",
    "name": "Apple",
}

//user document in DATA collection
{
   _id: "org#google#user#john",
   name: "John Smith"
}
{
   _id: "org#google#user#jeff",
   name: "Jeff Brown"
}
{
   _id: "org#apple#user#tim",
   name: "Tim Cook"
}
```

Let's try to find an organization and all the users in one query.

```js
db.getCollection('DATA').find({_id: {$regex: /^org#google/}})
```
The query finds all documents in the DATA collection starting where _id starts with "org#google"
#### Result

```json

{
    "_id" : "org#google",
    "name" : "Google"
}

{
    "_id" : "org#google#user#jeff",
    "name" : "Jeff Brown"
}

{
    "_id" : "org#google#user#john",
    "name" : "John Smith"
}
```
We can retrieve the same data without a join, without adding indexes, without using the aggregation framework
Date Basics
Tags: powershell, cli, shell
Published: 2020-12-22 21:14:39

Short post before Christmas: 

Calling Get-Date gives you a DateTime Object to work with:

```powershell
(Get-Date).GetType()
```

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

It is also possible to call Get-Date with a specific date string.
```powershell
Get-Date "01.01.1970"
```

To get a Date later than my specified date use the methods starting with Add.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/5kbaz5rnl8q3qvu9nb3u.PNG)

To get the Date a week from today simple type the following:

```powershell
(Get-Date).addDays(7).toString("dd.MM.yyyy")
```
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/upi0eoaxgpc1f8x32dyp.PNG)

To get the Date a week prior from today i need to use the addDays() method with a parameter of -7.

```powershell
(Get-Date).addDays(-7).toString("dd.MM.yyyy")
```
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6vnl5cvzisd55ofjcxwu.PNG)

How the date is printed into the shell you can control with the parameter value for the toString() Methode as seen in the two examples above.

If you want to check which day of the week the DateTime Object is set to, you can use the DayOfWeek Member.

```powershell
(Get-Date).DayOfWeek
```
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/st31uah19ikvhz857irg.PNG)
[astuce] Injection de dépendance existe depuis Joomla! 3.0.0
Tags: blog
Published: 2021-03-18 11:38:17

---
title: [astuce] Injection de dépendance existe depuis Joomla! 3.0.0
published: true
date: 2020-12-22 21:04:41 UTC
tags: Blog
canonical_url: 
---

![](https://coderparlerpartager.fr/images/dependency-injection-since-joomla-3-0-0.png)

Salut super joomlers!

 

Saviez-vous que l'injection de dépendance existait déjà depuis Joomla! 3.0.0 ?

Vous ne savez pas ce que c'est ?

En gros, l'injection de dépendance permet au développeur de ne pas créer des classes "en dur" un peu partout dans l'application,

mais plutôt "injecter" sa propre instance de la classe dont dépend le code utilisé.

C'est surtout intéressant dans le contexte des test unitaires ou la développeuse préfère injecter ses propres classes appélées "Tests Doubles" ou "Doublure de tests" 

Voici un exemple dans le coeur de Joomla!

Dans le fichier situé JPATH\_ROOT/libraries/src/Application/BaseApplication.php  cet exemple suppose que vous avez Joomla! 3.9.23 dernière version stable à la date de cet article.

![dependency injection since joomla 3 0 0](https://coderparlerpartager.fr/images/dependency-injection-since-joomla-3-0-0.png)
Building a Twitter Clone
Tags: twitter, design, architecture
Published: 2020-12-22 20:53:46

---
description: I saw a tweet about building a twitter clone being harder than you would think. So this of course started me thinking how I would go about building something like that.
---
I saw a tweet about building a twitter clone being harder than you would think. So this of course started me thinking how I would go about building something like that.

Ok so where would I start? First a few assumptions.

1) Development by a lone developer ie me
2) Tech stack will be dotnet and other tech I am familiar with
3) Database backend, probably SQL Server but I might use table storage for cost reasons should I try and actually build this. However if I design this well this should be something that could be swapped out as the system grows
4) User accounts on the system will be small as I can't imagine anyone ever signing up. Why sign up to a social media platform with no users?

##I guess the next question is what is Twitter?

A website that allows you to share 280 characters of text with your followers, allows you to follow other users updates and allows other user to follow your updates.

It also has an API that allow you to do almost everything that you can with the website.

Then there are of course mobile apps to consider but I am going to assume this is out of scope, however assuming a good enough API then this shouldn't be a problem for future development.

##First Steps

To start off with I would concentrate on the API, and then build a web client that makes use of the API.

So what would my MVP (minimum viable product) be?

1) User can authenticate with my API to get a token which allows access to other API endpoints
2) User can create a tweet
3) User can view own tweets
4) User can view tweets of another user
5) User can view tweets in their timeline
6) User can follow/unfollow other users
7) User can search for other users
8) User can search for keywords in tweets

I think that is probably sufficient to build my MVP for the API.

An interesting side note is that I could use the OAuth Twitter authentication to allow users to login to my twitter clone with the real twitter login details. However this makes no sense to me as we are essentially adding a dependency on the real twitter.

So what would I use for the frontend? I would start off with a Client Side Blazor frontend. Once I had a proof of concept that worked, I would think about styling and adding the UI elements that are familiar to twitter users.

The beauty of Client Side Blazor is that I can host cheaply in azure storage and distribute around the world via a CDN.

Due to the high number of times that follower and following count and other stats are queried I would consider storing these in the database and include a regular job to recalculate them so they don't get out of sync with the data.

Having said all of this I am very tempted to fire up Visual Studio and see how far I get, and what problems I encounter along the way.
Using Ansible to Manage Cluster Deployments
Tags: kubernetes, homelab, terraform, ansible
Published: 2020-12-22 20:42:40

In a [previous post](https://dev.to/mikeyglitz/terraforming-the-cluster-23md) I had covered how to deploy applications to a Kubernetes cluster using Terraform scripts.
I found Terraform scripts to be very useful in deploying resources
to a Kubernetes cluster. Terraform uses blocks of code to declare
cluster resources and specify configurations for the resources.
Terraform also provides a set of plugins which can be used to
provision multiple providers (Kubernetes, AWS, Azure, GCP, etc.).

# Drawbacks Using Terraform

I'm in the process of using scripts to provision resources and build-out a Kubernetes cluster.
As part of the cluster build-out, certain packages needed to be
installed to each node that was going to exist on the cluster.
[I had previously outlined a manual process](https://dev.to/mikeyglitz/building-the-cluster-revised-edition-2k5l) on how to build out the cluster.
This process has since moved into a pattern defined as configuration-as-code.
Additionally, certain namespaces needed to be created and populated before others could be rolled out.
[Specifying dependencies using Terraform](https://learn.hashicorp.com/tutorials/terraform/dependencies) alone could get messy.

# Ansible to the Rescue

I had previously worked with Ansible in past home-lab projects. After a little bit of research, I found that Ansible was capable of [running Terraform scripts](https://docs.ansible.com/ansible/2.7/modules/terraform_module.html).
Using the Terraform Ansible module, it is possible to define the Terraform project files as demonstrated below:

**terraform.tf**

```hcl
provider "kubernetes" {}
provider "helm" {}
```

**ingress.tf**

```hcl
resource "kubernetes_namespace" "ns_kong" {
  metadata {
    name = "kong"
  }
}

resource "helm_release" "rel_kong_ingress" {
  repository = "https://charts.konghq.com/"
  chart = "kong"
  name = "kong"
  namespace = "kong"
}
```

These files can be run inside of an Ansible role using the following Ansible script:

**ingress/tasks/main.yml**

```yaml
---
- name: Prepare Terraform Scripts
  environment:
    KUBECONFIG: "/home/{{ ansible_user }}/kubeconfig"
  block:
    - copy: src="{{ item }}" dest=terraform/ingress
      with_items:
        - terraform.tf
        - ingress.tf
    - terraform:
        project_path: terraform/ingress
        state: planned
        plan_file: plan.out
    - terraform:
        project_path: terraform/ingress
        state: present
        plan_file: plan.out
```

Additionally, variables can be specified to Terraform using a map under the `variables` parameter from the Terraform module:

```yml
- name: Deploy Terraform
  terraform:
    ...
    variables:
      tf_variable: "ansible-value"
```
Augmented Reality Advent Calendar
Tags: augmentedreality, ar, arkit, dotnet
Published: 2020-12-22 20:25:04

For this years [Festive Tech Calendar](https://festivetechcalendar.com/) (23rd December), for a "bit of fun" I attempted to create an Augmented Reality Advent Calendar. 

I initially thought I would place it on a detected surface, then I decided to *use my head* and go in a slightly different direction.. below is a video showing the result. 

It isn't quite finished as you'll be able to tell. But it is.. unique and you get the idea.

{% youtube jlRHFWKseIc %}

If you want to learn a bit more about how to use C# and Xamarin to create iOS Augmented Reality experiences, you can check out my website [XamarinArkit.com](https://xamarinarkit.com/) and my upcoming book on Amazon [.NET Developer's Guide to Augmented Reality in iOS](https://www.amazon.co.uk/gp/product/1484267699?pf_rd_r=QRH8ZFGQRQYNZ7F4XQCT&pf_rd_p=6e878984-68d5-4fd2-b7b3-7bc79d9c8b60&pd_rd_r=7519fec3-749f-407d-97fe-966463decd20&pd_rd_w=XJ7Xl&pd_rd_wg=358Cr&ref_=pd_gw_unk). 

-- Lee
Covtact: Contact diary with Style [Digital Ocean Hackathon]
Tags: dohackathon, react, css, javascript
Published: 2020-12-22 19:44:54

---
description: Build a contact diary / logging app for the DigitalOcean Hackathon: Getting stylish and design an UI in Figma.
---

## Project recap
During the DigitalOcean Hackathon 👨‍💻 I want to build an app which allows you to log with whom you had contact. This is so you can inform people if need be and stop further COVID-19 spreading.

As mentioned in the last post there is already a working Proof of Concept, hosted on DigitalOcean’s App platform, available: [Covtact](https://covtact.app). 

## Creating an UI

I‘m not too satisified with the current design. Honestly, design is not my strongest skill. So for this I jumped in Figma to brainstorm some ideas.

I ended up with a two column layout, one side for adding new contacts and one for displaying them. I choose a greenish main color, which is said to represent nature, health and hope. That‘s what‘s needed, isn‘t it? 😃


Now on to coding this UI, so I can share it. Maybe I will redo it again in the future, but for now I want to move on with this project. 💅✨

## Feedback?

There’s still work to be done, but the app is already useable. Try it out, [log your contacts](https://covtact.app) if you had any and help stop this pandemic. [Hint: It might become extra important during the holidays, please stay responsible in your actions]. 🙏

As always, tell me what you think about this project down in the comments, or let‘s connect on [twitter](https://twitter.com/kriswep)!
Add custom domain in a GitHub page with Cloudflare
Tags: github, tutorial, webdev, beginners
Published: 2020-12-22 19:38:18

Most of the time, a beginner git user’s big question is about how to attach a custom domain to a Github page. And it was the same for me also. But now it’s not and that’s why I’ve started writing to them about how you can use a custom domain in your Github page and add Cloudflare also. So, Let’s get started.

### **Step 1: Get a domain**
You need a domain to attach. Buy a domain from any good places like [Xeonbd](https://www.xeonbd.com/), [Godaddy](https://www.godaddy.com/), or any places that you like but make sure it supports a custom nameserver. I haven’t found any provider that doesn’t support custom nameserver but also I’d try to mention every bit of information.

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

### **Step 2: Set custom nameserver**
Your domain needs to point to the Cloudflare server. So, you need to update the nameserver of your domain’s default to below two and make sure the other nameserver’s field remains empty without the first two.
```
arnold.ns.cloudflare.com

pola.ns.cloudflare.com
```
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/nsxymvqe98fi2s2e9zss.png)

### **Step 3: Create a Cloudflare account and add domain**
If you don’t have a Cloudflare account create one. And from ‘add site’ add your domain in Cloudflare. Don’t worry it’s completely free.

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

### **Step 4: Update Domain’s DNS from Cloudflare**
Now you need to update your domain’s DNS from Cloudflare’s DNS Panel. For every entry, click on ‘Add record’, Select Type ‘A’, enter the domain name in the ‘Name’ field, and in the ‘IPv4 address’ field you need to add these four IPs like in the screenshots below. I collected the IP’s from GitHub’s documentation [here](https://help.github.com/en/github/working-with-github-pages/managing-a-custom-domain-for-your-github-pages-site).

```
185.199.108.153

185.199.109.153

185.199.110.153

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

### **Step 4: Finally add your domain to your GitHub page**
Go to your Github Repository and from the repository settings, go to Github Pages and there you will have an option for adding a custom domain like the picture below.

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

**It’s working!**

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

## **Conclusion**
So far, I’ve tried to show everything steps by step. If you liked my writing you can follow me here. Don’t forget to share your opinions in the discussion section below and also the questions if any.

---

### **📌 Featured in CodeNewbie's Twitter**
{% twitter 1354444324315017218 %}
Herramientas que tu universidad no quiere que sepas
Tags: free, ide, jetbrains, pycharm
Published: 2020-12-22 19:22:12

¿Sabías que por ser estudiante tienes acceso a herramientas de pago, que te ayudarán al desarrollo de tus proyectos, de forma gratuita y tu universidad no te ha dicho nada? Como lo oyes, cada vez más plataformas de pago tienen licencias gratuitas para el uso de estudiantes y en esta serie de posts te voy a hablar de algunas de las más interesantes.

En mi experiencia universitaria, he visto a gente en 2º y 3º de carrera usar todavía Netbeans, un IDE con sus limitaciones que nos obligaban a usar en 1º de carrera. Al menos, con el paso de los cursos ves cada vez a más gente utilizar Atom o Visual Studio Code, que te aportan más facilidades a la hora de programar.

Lo que no mucha gente conoce es que la empresa Jet Brains te regala licencias de todos sus IDEs sólo por ser estudiante. Sus IDEs normalmente son de pago y son utilizados por muchas empresas, siendo Pycharm, el IDE para Python, el más conocido. El soporte del lenguaje para el que está pensado cada uno es excelente y ya te viene con el debugger configurado para el lenguaje, por lo que ya no tienes excusas para no empezar a utilizar el debugger al depurar tu código. Además, es muy cómodo de utilizar, visualmente agradable y tiene una muy buena integración gráfica con Git por si aún no te manejas muy bien con sus comandos.

La única pega es que con Visual Studio Code o Atom tienes un mismo programa para todos los lenguajes de programación, mientras que con los IDEs de JetBrains, necesitas varios programas.

En conclusión, utiliza el entorno de desarrollo que más se adapte a ti, pero conoce las alternativas de las que dispones, sobre todo, si te las están regalando.
Learn Python and JavaScript before 2021
Published: 2020-12-22 19:18:03

I am the creator of 30DaysOfPython, 30DaysOfJavaScript, 30DaysOfReact, and JavaScript For Everyone. I will be teaching Python and JavaScript on December 23, 2020. The level is for absolute beginners. You may try it out. The duration of the lesson will be 3 - 4 hours.

Python @ 11:00 - 14:00 GMT 
JavaScript @ 16:00 - 19:00 GMT

Tomorrow's lesson link will be shared both on 30DaysOfJavaScript and 30DaysOfPython telegram group. Join the telegram group in advance to get the lesson link.

In addition, remember to Download python and install on your computer to just get started tomorrow. 

https://t.me/threedaysbootcamp
https://t.me/ThirtyDaysOfJavaScript
https://t.me/ThirtyDaysOfPython

#javascript #python #es6 #react #js #30daysofjavascript #30DaysOfPython
Setup Wordpress using Helm Chart on Kubernetes 
Tags: devops, kubernetes, docker, wordpress
Published: 2020-12-22 18:54:52

{% youtube 8hyXDFrWi9w%}


In this session on "Install wordpress using Helm Chart," we are going to see

1.Setup up Kubernetes cluster on GCP (Google Cloud Platform)
2.Add ‘/bitnami/wordpress’ wordpress repo
3.Setup User account along with Username and Password for WordPress
4.Install the WordPress helm chart
5.Troubleshooting any deployment and service inside the Kubernetes cluster