teleren/devto huggingface dataset:
Filters with Dependency Injection in ASP.NET CORE
Tags: aspnetcore, csharp, dotnet
Published: 2019-03-18 06:18:36

---
title: Filters with Dependency Injection in ASP.NET CORE
published: true
description: A simple intro on using Filters with DI 
tags: ASP.NET CORE, CSharp, dotnet
---

Recently I wanted to add a logger to a custom authorization filter(which was not the best idea) but I didn't want to new up an instance inside the filter, I wanted DI to handle all of that for me.  

I did some digging and came across the **TypeFilterAttribute**, **ServiceFilterAttribute** and the **IFilterFactory**.

##**IFilterFactory**

IFilterFactory interface allows you to create an instance of your filter by implementing the CreateInstance method inside your filter.
When MVC invokes a filter, it first tries to cast it to an IFilterFactory. If that cast succeeds, it then calls the CreateInstance method.

{% gist https://gist.github.com/XhantiMda/b6b86576847e1acc51ab501fca15ed2c %}
  <figcaption>An example of a filter implementing IFilterFactory</figcaption>

##**TypeFilter & ServiceFilter**



The **ServiceFilterAttribute** implements the IFilterFactory. IFilterFactory exposes the CreateInstance method for creating an IFilterMetadata instance. The CreateInstance method loads the specified type from the container.
Filters used with the ServiceFilterAttribute need to be registered with the container.

{% gist https://gist.github.com/XhantiMda/7ed858c8508493f83213308151197365 %}
<figcaption>An example of registering a filter.</figcaption>



{% gist https://gist.github.com/XhantiMda/98b75a045ec7f9604c22b09b6fb71b81 %}
<figcaption>An example of how the ServiceFilterAttribute can be used</figcaption>

The **TypeFilterAttribute**  is similar to the **ServiceFilterAttribute**, but its type isn't resolved directly from the DI container. It instantiates the type by using Microsoft.Extensions.DependencyInjection.ObjectFactory.

This means that types referenced using the **TypeFilterAttribute** don't need to be registered with the container first and the **TypeFilterAttribute** can optionally accept constructor arguments for the type.

When using the **TypeFilterAttribute**, setting IsReusable is a hint that the filter instance may be reused outside of the request scope it was created within. The framework provides no guarantees that a single instance of the filter will be created. Avoid using IsReusable when using a filter that depends on services with a lifetime other than singleton.

{% gist https://gist.github.com/XhantiMda/00de12552d8bb5d31c8c4ab0a0e8fddb %}
<figcaption>An example of how the TypeFilterAttribute can be used</figcaption>

The sample code can be found [here](https://github.com/XhantiMda/FilterDI)
Handling Angular environments in continuous delivery
Tags: angularcli, continuousintegrati, continuousdelivery, angular
Published: 2019-03-21 21:03:30

---
title: Handling Angular environments in continuous delivery
published: true
tags: angular-cli,continuous-integrati,continuous-delivery,angular
canonical_url: https://medium.com/@kevinkreuzer/handling-angular-environments-in-continuous-delivery-eeaee96f0aae
---

#### Combining the ideas from continuous delivery with Angular

![](https://cdn-images-1.medium.com/max/1024/1*GwZECMd7QT95owEwzhG5fg.png)

In non-trivial business applications, we nowadays often encounter a continuous delivery setup with multiple stages.

Each stage has its configuration to access environment specific peripheral systems. To do so, we need to deal with stage based configurations.

The Angular CLI already comes with some build in concepts to handle different environments.

But, how reliable are they in a continuous delivery environment? 🤔

[Find out more...](https://blog.angularindepth.com/handling-angular-environments-in-continuous-delivery-eeaee96f0aae)
Heroku tips
Tags: heroku
Published: 2019-03-18 07:00:22

---
title: Heroku tips
published: True
description: 
tags: Heroku
---

# Tips I found using [Heroku](www.heroku.com) with Masonite


To display the versions of application release.
```sh
$ heroku releases -a {appname}

```

To rollback to a version.
```sh
$ heroku rollback v53 -a {appname}
```

<!--
```
```
-->
How to render common webpage elements to all pages?
Tags: javascript, discuss, html, node
Published: 2019-03-18 06:03:31

---
title: How to render common webpage elements to all pages?
published: true
description: 
tags: #js #discuss #html #nodejs
---
How to render common web page elements such as NAVBAR, FOOTER, to every page when I am just using HTML, CSS & JS?
I will be not following the DRY principal if I just copy paste elements to every page.
Any ideas?
AssemblyScript - Webassembly with Typescript
Tags: html, javascript, typescript, webassembly
Published: 2019-03-18 05:11:04

---
title: AssemblyScript - Webassembly with Typescript
published: true
description: We look into creating a web assembly using typescript build and run in a webpage.
tags: html, JavaScript, typescript, webassembly
---

{% youtube 3KuDtqFxvRg %}
Moving my Blog
Tags: datascience, machinelearning, python
Published: 2019-03-18 04:54:42

---
title: Moving my Blog
published: True
description: 
tags: #datascience, #machinelearning, #python
---
I'm moving all my blogs to my personal website from now on, you could check the site [here] (https://yogeswaran.home.blog/)
Using Masonite as microservice
Tags: masonite, api
Published: 2019-03-03 16:06:57

---
title: Using Masonite as microservice
published: true
description: One simple approach of how we use Masonite as a microservice to our core server.
tags: masonite, API
---

We have a big project built on top of `Django` and now we started to break it on a few minor parts to be easy to maintain, update and scale.

So we decided to build some of the microservices with `Masonite` which is a good python framework and has almost all that we need built-in and ready to use.

So, how to integrate it, without need change much of our current logic?

We decided to basically consume it as a Rest API and built a small SDK that we override our code.

For sample:

```python
class User(models.Model):
    # ...
    def get_user_documents(self):
        from documents.model import Document
        return Document.objects.filter(owner=self)
```

We know the above relation can be reached with `related_name` but as we had lots of implementations, it ends on some cases in a cyclic import, so on this sample case, we will use this approach.

So we moved all the documents of users to a new microservice because there we can scale the document server as we need and also improve it without the need to update the core server.

How we changed the class above?

```python
class User(models.Model):
    # ...
    def get_user_documents(self):
        return DocumentsMS().get_user_documents(user_id=self.id)
```

And on our `DocumentMS` class, we have few classes that consume the REST API, for sample:

```python
import requests
import json


class DocumentMS:
    def get_user_documents(user_id: int):
        url = "https://......"
        headers = {} # security token header
        querystring = {
            "user_id": user_id
        }

        response = requests.request("GET", url, headers=headers, params=querystring)
        return json.loads(response.text)
        
```

All of the codes we just wrote is for sample purposes and give you a simplistic way to use microservices along with your core server without the need to change your logic.

We normally use this for all implementations and then we dive deep as each situation needs.

I hope this gives you the north to how you can use microservices in an easy way.

On the next article I will show how we can create a small API to response the calls we just wrote.
The Joy of Testing
Tags: testing, productivity, happiness, programming
Published: 2019-03-18 03:59:06

---
title: The Joy of Testing
published: true
description: Write tests. Not because the bloggerverse told you to, but because it just feels good.
tags: testing, productivity, happiness, programming
cover_image: https://thepracticaldev.s3.amazonaws.com/i/xpizc7gbvce85sm640xq.jpg
---

Unit testing is great because it helps us make better software. A good test suite will catch bugs, maintain stability, measure performance, and more.

Yet to be honest, those aren’t the reasons I like testing so much. I like writing tests because it just feels great to run them. Sometimes I catch myself watching the [Amatino API](https://amatino.io) test suite running, not because I need test changes, but because I simply want to watch it run.

{% youtube YKFqV-pIqAI %}

At upper left, we have the HTTP returns for the public-facing API. At lower left, the internal API. At right, the list of successful tests marching downwards.

It is the closest I can be to watching the machine think. All the thousands of lines of code, the weeks of agonising over tough problems, the frustrations of insidious bugs, the joys of successful output. All distilled into a real-time ballet of virtual machines, database queries, http requests, and code execution that I can see with my own eyes.

Write tests. Not because the bloggerverse told you to, but because it just feels good.
Hello Hexo - also new home for blog?
Tags: blogging, hexo
Published: 2019-03-21 12:22:07

---
title: Hello Hexo - also new home for blog?
published: true
tags: blogging,hexo
canonical_url: https://blog.kritner.com/2019/03/17/Hello-Hexo-also-new-home-for-blog/
---

Greetings from Hexo and a markdown file!

Lately I’ve been thinking a bit about why I’ve been attempting to blog more.

There were a few reasons for my attempts to blog:

- Help people through teaching
- Help myself through teaching
- Perhaps make a little money by producing content
- Build some of my “brand”
- Become a better writer
 

In the past few months, I feel like I have accomplished something from most of those points, except the make money part - but I thought that was just an added bonus either way.

Through Medium, I had received a few dollars here and there for my posts, but it did not end up covering the cost of the Medium membership, much less the additional cost of filing an additional tax form on the piddly income that came in.

I don’t have much time before I gotta get the toddler in the bath, so I’ll make this quick. I’ve decided to give Hexo a shot, and perhaps I’ll cross post to medium (but I will definitely still be posting to dev.to).

I’m waiting on a dev.to export so I can (hopefully) more easily migrate to Hexo; additionally I’ll need to update some canonical links everywhere.

Welp. That’s about it!

Oh… do code snippets work out of the box with Hexo?


```cs
public void DoStuff(int numberOfStuffsToDo)
{
 var count = 0;

 // Do things that are neat
 while (true) 
 {
  count++;

  if (count == 10) 
  {
   return;
  }
 }
}
```

Got some google analytics action going on as well.

More to come?! Hope so!

Hexo logo by: [https://github.com/hexojs/logo](https://github.com/hexojs/logo)
React Border Wrapper
Tags: react, border, wrapper, javascript
Published: 2019-03-18 01:37:48

---
title: React Border Wrapper
published: true
description: React Component Library that allows embedding elements in a div's borders
tags: React, Border, Wrapper, Javascript
---

[![React Border Wrapper Logo](https://metroxe.github.io/react-border-wrapper/react_border_wrapper_logo.png)](https://github.com/Metroxe/react-border-wrapper)

React Border Wrapper is a new component library that allows the embedding of react elements within the borders of a div. There is a playground that allows editing each of the props and creating a design that works best for your website. Check it out and leave a star on the repo!

Repo: [https://github.com/Metroxe/react-border-wrapper](https://github.com/Metroxe/react-border-wrapper)
Playground: [https://metroxe.github.io/react-border-wrapper/](https://metroxe.github.io/react-border-wrapper/)

[![React Border Wrapper Example](https://metroxe.github.io/react-border-wrapper/react_border_wrapper_example.png)](https://github.com/Metroxe/react-border-wrapper)
Template Design Pattern [Behavioral]
Tags: concepts, designpattern, designpatterns, programming
Published: 2019-03-21 19:29:11

---
title: Template Design Pattern [Behavioral]
published: true
tags: concepts,Design Pattern,Design Patterns,programming
canonical_url: https://itscoderslife.wordpress.com/2019/03/18/template-design-pattern-behavioral/
---

 **Context** : The template method pattern is useful when you need to allow third parties to provide or replace some steps of an algorithm while other parts remain fixed.

- The fixed functionality is provided by the base type and can be overwritten.
- The base type can provide so-called hook methods.
- The hook methods may have default or empty implementations in the base type.
- Clients can extend or override the behavior provided by the hook methods.
- The hook operations get called at specific points.

The template method pattern allows extensions only at these predefined point so that clients can override certain steps of an algorithm without modifying its original structure.

> The template method allows specific steps in an algorithm to be replaced by clients without modifying its original structure.

The template method defines the steps of an algorithm and allows some of the required steps to be modified.

Example: An employee of the organisation. The employee class would be the base template class. This template class will define hooks like  **check-in, break, work, check-out** etc., with default implementations for them. Then there will be subclasses like Trainee, Software Developer, Lead, Architect, Manager. The **work**  hook can be overridden by each subclass as per their job needs.

Unlike the strategy, this pattern is not about replacing the entire algorithm, but rather about changing certain steps of an algorithm. The fixed functionality is kept in the base type and cannot be modified by subclasses or conforming types. For the steps that can vary, there are extension points also known as hook operations.

_Don’t use this pattern if you need to allow changing the entire algorithm. For the latter, use the strategy pattern instead._
Day 3 Learning Javascript
Tags: beginners
Published: 2019-03-18 00:08:40

---
title: Day 3 Learning Javascript
published: true
description: A beginner's journey in Javascript
tags: #beginner
---

Varying Variables.

I'm not even sure if variables are still commonplace in Javascript, as I've heard some conflicting information, but nonetheless I'm learning about it anyway.

I like it so far as it's a simple way to store any and all Javascript types. I used them (along with the *prompt* and *alert* methods) to create a simple calculator program. It works fine, but I'm definitely missing some additional features that I'm sure I'll learn more about as I move further along.

But one thing is clear...I'm already thinking about all the cool things I can do with Javascript once I learn more. Oh the possibilities.....
Writing CSS-in-JS in a Gatsby Project
Tags: gatsby, react, cssmodules, styledcomponents
Published: 2019-03-18 15:56:04

---
title: Writing CSS-in-JS in a Gatsby Project
description: How CSS-in-JS libraries like CSS Modules and Styled Components make it easier to safely add and remove styles in a Gatsby project.
canonical_url: https://michaeluloth.com/gatsby-writing-css-in-js/
tags: gatsby, react, cssmodules, styledcomponents
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/dayw3adggkgdnx7yh9rw.png
series: Up & Running with Gatsby
published: true
---

This is the eighth video in our [beginner series](https://www.youtube.com/watch?v=jAa1wh5ATm0&list=PLHBEcHVSROXQQhXpNhmiVKKcw72Cc0V-U) exploring GatsbyJS and how to use it to easily build performant apps and websites.

In this video, we explore CSS-in-JS and how libraries like CSS Modules and Styled Components can make it easier to add and remove styles from your project.

Check out the video below or [view the entire playlist](https://www.youtube.com/watch?v=jAa1wh5ATm0&list=PLHBEcHVSROXQQhXpNhmiVKKcw72Cc0V-U) on YouTube. 

Enjoy! 🎉📺

{% youtube RwUn0Trhyyk %}
[solution] Afficher contenu masqué après installation de Joomla4.0-dev
Tags: solution, joomla4, installation, hiddencontent
Published: 2019-07-28 22:13:46

---
title: [solution] Afficher contenu masqué après installation de Joomla4.0-dev
published: true
tags: solution,joomla4,installation,hiddencontent
canonical_url: 
---

Vous aussi qui aimez être à la pointe de la technologie, vous avez dû essayé d'installer Joomla! 4.x-dev sur votre ordinateur.

Mais vous avez peut-être eu le même souci que moi. Que ce soit dans l'admin ou sur la partie site les modules ne s'affichent pas.

Pourtant il n'y a pas d'erreur. Une requête SQL à la rescousse! La voici:

 

`UPDATE `#__modules` SET `publish_down` = '0000-00-00 00:00:00' WHERE 1=1;`

`UPDATE `#__content` SET `publish_down` = '0000-00-00 00:00:00' WHERE 1=1;`

 

A priori, la seconde requête n'est pas nécessaire mais juste au cas où les articles ne s'afficheraient pas vous pouvez executer la seconde requête.

Pour ce faire, vous pouvez utiliser des outils comme phpMyAdmin, adminer, Sequel Pro, HeidiSql ou encore MySQL Workbench.

 

A bientôt les Joomlers de l'extrême!
How do you price yourself?
Tags: discuss
Published: 2019-03-17 23:09:15

---
title: How do you price yourself?
published: true
description: 
tags: discuss
---

I wanted to post this as a general advice thread to beginners, including myself, who might be new to the field. As someone who is a freshman in college for computer science, I just got accepted into one of my first large, paid projects. This could be more of a discussion post for other career fields, but I figured, to those who were once a beginner, how did you price yourselves when you first started? What is something that you would change, if you could go back?
Desktop Software with PyQt
Tags: python, pyqt
Published: 2019-03-17 21:32:19

---
title: Desktop Software with PyQt
published: true
description: python, pyqt
tags: python, pyqt
---
PyQt is a module that can be used to make desktop software with Python. It's a binding for the Qt framework. These will work on all operating systems: OS X, Linux and Windows.

You can build a lot of cool stuff  with PyQt. It's not just GUI (graphical user interface), it's also databases (SQL), Networking and other stuff. 

<img src="https://pythonprogramminglanguage.com/wp-content/uploads/2017/06/pyqt-video-300x241.png" alt="pyqt">  

Some software made with Qt are Konqueror, kde, falkon, k3b, kazam and many others. 

read more: https://pythonprogramminglanguage.com/pyqt/
Help!!!!, My place of work encourages LAZINESS
Tags: work, productivity, potentials, career
Published: 2019-03-17 20:46:16

---
title: Help!!!!, My place of work encourages LAZINESS
published: true
description: 
tags: Work, Productivity,Potentials,Career
---
How do I cope with a work environment that slows me down?
How can I increase productivity in an environment that rewards laziness?

Hmmmm, these questions have been on my mind for a while now, coincidentally a friend of mine asked me the second question today. 

This  means that some of us are working in places where our potentials are under utilized. 
It might be more appropriate to use the caprion: "How do i cope at a work place that under utilizes my potentials?"

My answer to this question should is for  two categories of people.
1. I am in a position to change things.
2. I don't have control over anything. 

If you fall under the first category ,you probably occupy a leadership position or a position where you can influence decisions made at your place of work. 
You should start by Talking 🤗🤗🤗🤔, oh yes TALKING .
You need to talk to your colleagues, managers, heads of departments e.t.c.
Point out the issues you discovered and the solutions you propose. 
I propose the following solutions 
1. Reward diligence and hard work openly.
2. Reduce incentives for laziness.
3. Keep talking about hard work and diligence.
4. Gradually take disciplinary actions against laziness.
5. Encourage and motivate people to put in their all.
6. Be careful about the whole process , so that you won't trigger rebellion....... 

Thank you for reading upto this point,you are awesome. Please visit [my blog] (https://www.kilosele.com/help!!!!!!!!!,-my-place-of-work-encourages-l-a-z-i-n-e-s-s) for for the concluding part of this post
Test splitting with Jest on CircleCI
Tags: circleci, jest, testing
Published: 2019-03-17 19:34:32

---
title: Test splitting with Jest on CircleCI
published: true
description: How to set up test splitting on the CircleCI platform
tags: circleci, jest, testing
---

One of our customers asked on Twitter, "How do I setup test splitting on [CircleCI](https://circleci.com/) with [Jest](https://jestjs.io/en/)?"

This is briefly explain in the [CircleCI docs](https://circleci.com/docs/2.0/parallelism-faster-jobs/#running-split-tests), but I can see where it could be confusing.

I'm not the best writer, so I will let my code do the talking. This should serve as a good exercise in code documentation as well.

A portion of my `package.json`
```
  "scripts": {
    "test": "jest",
  },
  "jest": {
    "reporters": [
      "default",
      "jest-junit"
    ]
  },
  "jest-junit": {
    "outputDirectory": "test_results/junit"
  }
```

My `.circleci/config.json` file
```
version: 2
jobs:
  build:
    parallelism: 3
    docker:
      # I want to make sure I know exactly what version I'm using
      - image: circleci/node:10.15.3

    working_directory: ~/repo

    steps:
      - checkout

      # Npm CI uses the package-lock.json file to ensure exact versions
      # This prevents changes and compromised upstream dependencies
      # from changing your project. It wipes the node_modules directory
      # so there is no need for a dependencies cache here.
      - run: npm ci

      # First we save the split test file names into an env
      # Then we pass that to jest
      - run:
          name: Run Jest tests using test splitting
          command: |
            TESTFILES=$(circleci tests glob "test/**/*.test.js" | circleci tests split --split-by=timings)
            npm test $TESTFILES

      - store_test_results:
          path: test_results

      - store_artifacts:
          path: test_results
          destination: test_results
```

Hope this helps!
Dipanshu Sharma 
Tags: dipanshusharma
Published: 2019-03-17 19:18:23

---
title: Dipanshu Sharma 
published: true    
description: About Dipanshu Sharma    
tags: #dipanshusharma
---

About Dipanshu Sharma

With a view of the future of marketing and location technology as seemingly limitless as the horizon from xAd’s headquarters from the 60th floor of One World Tower in New York City, Dipanshu Sharma leads the fast-growing, 400+ employee company, backed by over $116 million in venture funding from Eminence Capital, Institutional Venture Partners (IVP), Softbank Capital, Palisades Growth Capital, W Capital, Silicon Valley Bank and in November took a strategic investment from Microsoft Ventures.