teleren/devto huggingface dataset:
Improved debugging of Angular component tests in Jest
Tags: frontenddevelopment, javascript, testing, angular
Published: 2019-11-13 16:02:56

---
title: Improved debugging of Angular component tests in Jest
published: true
date: 2019-11-13 09:20:44 UTC
tags: frontend-development,javascript,testing,angular
canonical_url: https://blog.angularindepth.com/improved-debugging-of-angular-component-tests-in-jest-ac035e521763
---

#### with @angular-extensions/pretty-html-log

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

Good tests are the backbone of every application. They are crucial to the success of our project. Therefore it’s no surprise that Angular is designed with testing in mind and provides us with a lot of testing utils.

By default, the Angular CLI generates a project with Karma as a test runner and Jasmine as a testing framework. However, today, many people move away from this default stack and start to use Jest.

There are various motivations to do so. Most commonly, it’s due to better performance and stability. Jest is way faster than Karma. It can run tests in parallel and doesn’t have to start a browser because it uses a JavaScript implementation of a DOM called jsdom.

While jsdom is fast, it also impedes debugging.

[Find out how to improve debugging your component tests](https://blog.angularindepth.com/improved-debugging-of-angular-component-tests-in-jest-ac035e521763)
C#8 changes to using
Tags: csharp
Published: 2019-11-13 08:16:16

The 'using' block has been a mainstay in c# since the beginning.

C-SharpCorner has a nice desciption:
_To allow the programmer to explicitly perform these clean-up activities, objects can provide a Dispose method that can be invoked when the object is no longer needed. The using statement in C# defines a boundary for the object outside of which, the object is automatically destroyed. The using statement is exited when the end of the "using" statement block or the execution exits the "using" statement block indirectly, for example - an exception is thrown._

Here is an example...
```c#
using System;

namespace ConsoleApp2
{
    class DisposableObject : IDisposable
    {
        public void Dispose()
        {
            Console.Write("disposing ");
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            TextUsing();
        }

        static void TextUsing()
        {
            using (var myObj = new DisposableObject())
            {
                for (var i = 0; i < 10; i++)
                {
                    Console.Write($"{i.ToString()} ");
                }
            }
        }
    }
}

```
Output: _0 1 2 3 4 5 6 7 8 9 disposing_

The Dispose method on our myObj object gets called when the using block completes.  Lets be explicit here - it's when execution reaches the closing curly braces of the using block.

The using block has been this way forever.  But things are changing in C#8.0.  Your existing code will behave exactly as it always has.  But C#8.0 doesn't require curly braces at all.

Example time...
```c#
static void TextUsing()
{
   using var myObj = new DisposableObject();
            
   for (var i = 0; i<10; i++)
   {
      Console.Write($"{i.ToString()} ");
   }
} 
```
Output: _0 1 2 3 4 5 6 7 8 9 disposing_

As you can see, we can now declare an object using 'using' and there is no need for curlies.  The Dispose method will be called when myObj's scope completes.  Which in this case is at the end of the method.  I like this change.  I always felt the curlies made it look like our code had multiple paths.  As I mentioned, you can still use the curlies if you want to explicitly dispose of your object.  But the vast majority of the time it can wait for the end of the current scope.

One final example...
```c#
static void TextUsing()
{
   for (var i = 0; i<10; i++)
   {
      Console.Write($"{i.ToString()} ");
      using var myObj = new DisposableObject();
   }
}
```
Output: _0 disposing 1 disposing 2 disposing 3 disposing 4 disposing 5 disposing 6 disposing 7 disposing 8 disposing 9 disposing_

The scope of the using state here is the for loop.  Therefore Dispose is called on every loop.  To achieve this in C#7.0 would require an extra level of curly brace depth.  

It's not an earth shattering addition to the language, but I like it.
Do you still use IBM Lotus Notes/Domino?
Tags: explainlikeimfive, discuss
Published: 2019-11-13 08:15:16

I`m writing an article for [Aspose.Email](https://products.aspose.com/email?utm_source=https://dev.to/artyomgazizyanov/can-you-share-your-thoughts-about-ibm-lotus-notes-domino-4g66&utm_medium=email) about the increasing amount of migrations from Lotus Notes/Domino.
Have you ever used it before?
Have you ever migrated from Lotus Notes/Domino to other services like SharePoint, etc.?

Please share your thoughts in the comments below! 👇👇👇
More About Node; Router() Is Pretty Dope
Tags: node, noderouter, routernode
Published: 2019-11-13 07:55:32

---
title: More About Node; Router() Is Pretty Dope
published: true
description: I've done two mediocre at best posts about Node and why it's used. Now I want to explore a built-in tool that makes it great and highlights how Node's built-ins serve its intended uses well; Router().
tags: #NodeJS, #NodeRouter, #RouterNode
---

#####In an earlier post I talked about why people use Node with express and referenced some web snooping I'd done to make most of my claims. Well now I'm back with a little more meat to fatten my claims as to be honest I feel like Node has not disappointed yet. Maybe I just want to justify my time spent learning it. Anyway, Node's built-in Router Object is pretty great.
Shoutout to [Udemy](https://www.udemy.com/)....and [Flatiron](https://flatironschool.com/) too I guess ¯\_(ツ)_/¯?

###Router()™ MakesIt Simpler
One of the first web apps I made was a Ruby on Rails Single Page App(SPA)ˇ. It had a views folder that handled all my pages, then a routes.rb file that outlined all the routes. It was oddly the most frustrating part of setting up ruby apps half of the time. Its convoluted unlike a lot of other aspects of Ruby best practices in my opinion. Anyway the routes were always a hassle to set up and their order was generally an issue and it constantly felt redundant and repetitive. Well Node is less so and arguably "Super Streamlined Sawcesome....Sauce®". 

- Router turns a convoluted Routing process in Ruby into a one-stop-shop part of the function that processes the request. It turns three steps into one. 

- Router makes processing parameters a breeze. Routers Class methods include easy to use parameter management functions like [express.Router().param()](http://expressjs.com/en/5x/api.html#app.param) Also, unlike Ruby with the potential for malicious code to be passed through as parameters, Node with express's parameters are fairly secure (dont quote me on that. It's my assumption as of yet).

- Router makes Node with express do what it was intended to do. The compartmental yet minimalistic nature of Router lends itself well to a highly scalable efficient Web App.



ˇI will literally reference this as SPA in later blog posts without defining the acronym first. Watch Out! Madman on the loose! Whaaaaaa!

  | ヽ(。_°)ノ |!!!!
The carbon footprint of your website
Tags: performance, green
Published: 2019-11-13 07:29:03

---
title: The carbon footprint of your website
published: true
description: How badly are you destroying the future?
tags: performance, green
---

Stumbled across this website https://www.websitecarbon.com/ which measures the carbon footprint of your website. 

I've always believed in lightweight, efficient websites to deliver content. I firmly believe in not using client-side JS unless absolutely necessary because not everyone has an Internet Telephone Professional Maximum on a 4g connection.

I ranted about this and riled up the community about this subject here

{% link https://dev.to/quii/the-web-i-want-43o %}

Here's how my website scores

![quii.dev is 96% cleaner than other websites tested](https://i.imgur.com/R4z2WDh.png)

What's your score?

Given the huge amount of evidence pointing to how website performance effects users _and_ the environment, what are you going to do about it?

For more on this check out the slides of this excellent talk https://twitter.com/hanopcan/status/1187675166236643329
Cover images of DEV Posts Aren't Visible!? 🤔
Tags: meta, devto, issue
Published: 2019-11-13 07:21:09

---
title: Cover images of DEV Posts Aren't Visible!? 🤔
published: true
description: 
tags: meta , devto , issue
cover_image: https://thepracticaldev.s3.amazonaws.com/i/3s96sct8mdttnfljyrzl.png
---

Few minutes ago I posted a #Showdev post, but I was kinda shocked when the cover image of that post was not visible, when I checked other posts on DEV, My post was not only effected , no cover image was Visible!

{% twitter 1194512107737243648 %}

I checked again , the original image URL was working fine. Problem seems to be with Cloudinary!

**UPDATE #1** : Seems like cover image is visible on Desktop but not on Mobile.

Please Let me know if I'm the only one seeing this issue? Can you see this post's Cover?
Packaging is not an architecture or few words about Monolith
Tags: architecture, beginners
Published: 2019-11-13 07:03:52

---
title: Packaging is not an architecture or few words about Monolith
published: true
description: Why monolith is not monolith
tags: #discuss #architecture #beginners
---

Every day appearing new articles promoting microservices and mentioning monolith applications as old fashioned, non-fancy, bad overall, etc.

All these articles silently ignoring one extremely simple, obvious but extremely inconvenient (for those who promotes microservices) fact: monolith is not an architecture.

__Monolith is just application packaging option.__

Architecture of packaged application can be any, from rusty "Spring Boot+JPA" to reactive [clustered nanoservices](https://dev.to/siy/nanoservices-or-alternative-to-monoliths-and-microservices-12bb). Even microservices can be packaged this way easily. Obviously, differences in architecture will result to differences in performance and scalability characteristic of the application. Comparing architecture to packaging option is like comparing sandwiches to lunch boxes.
Distinguish Babel and Webpack
Tags: javascript
Published: 2019-11-13 06:55:34

---
title: Distinguish Babel and Webpack
published: true
description: 
tags: javascript
---

Sometimes I still confuse about Babel and Webpack, so I noted this for reference reason
### Babel
- Not all new feature of JS support by all browsers, Babel compile source code to version which can work on any browser

### Webpack
- It is a bundler for JS and static files. It packs many files, modules into a few files
- It also has some function like code-splitting, lazyloads help make our's app more effective
- It also allows we can write custom packing logic with "loader" plugin


### Summary
Usually, in the modern web application, Babel and Webpack used together
Progressive Web App as Share Target on Android
Tags: progressivewebapp, sharetarget, sharesheet
Published: 2020-04-17 04:54:37

---
title: Progressive Web App as Share Target on Android
published: true
date: 2019-11-13 06:35:00 UTC
tags: progressive web app,share target,sharesheet
canonical_url: http://english.catchen.me/2019/11/progressive-web-app-as-share-target-on.html
---

I built a PWA (Progressive Web App) to trace shortened URL back to its original URL. (You can find it [here](https://traceurl.catchen.app/).) I don’t want to copy a URL and paste it into my app. I want to use the Android’s [sharesheet](https://developer.android.com/training/sharing/send) to send any link in Chrome straight to my app. How do I do that?

 

Google provides [good documentation](https://developers.google.com/web/updates/2018/12/web-share-target) on this. We need to add a `share_target` section in `manifest.json` and then declare that our PWA can act as a share target. Most of the properties in this section can be thought of as attributes on a `<form>` element with the same name. For example, `{ "action": "/share", "method": "POST" }` is like `<form action="/share" method="POST">`.

 

`params` subsection let us change parameter names if we already have a convension of naming search parameters in GET requests or form fields in POST requests. Otherwise, we can keep them in their original names. One caveat is Android doesn’t use `url` parameter so when sharing a URL it comes through the `text` parameter. In my app I need to coalesce these two parameters to get the input from the user.

 

Is there more? Yes! Twitter makes a great PWA and we can check their [`manifest.json`](https://twitter.com/manifest.json). Here’s the beautified version of the `share_target` section:

 
```
"share_target": { "action": "compose/tweet", "enctype": "multipart/form-data", "method": "POST", "params": { "title": "title", "text": "text", "url": "url", "files": [{ "name": "externalMedia", "accept": [ "image/jpeg", "image/png", "image/gif", "video/quicktime", "video/mp4"] } ] }}
```
 

It has a `files` subsection under the `params` section. This is part of the [Web Share Target Level 2](https://wicg.github.io/web-share-target/level-2/#sharetargetfiles-and-its-members). We can accept files from sharesheet and we can assign a file to different parameter name based on MIME type or file extension. My app doesn’t need this capability but it’s good to know what’s possible.

 

If you like my post, you can subscribe through [email](https://chen.cat/subscribe-to-blogs) or [RSS/Atom](http://feedproxy.google.com/CatChen/English). That makes sure you won’t miss my future posts.

 ![](http://feeds.feedburner.com/~r/CatChen/English/~4/1vs6yymgdnQ)
ScrapeGen – Tool for generating Python scrapers A simple python tool that generates a requests/bs4 based web scraper
Tags: posts, scraping
Published: 2020-03-26 13:32:04

---
title: ScrapeGen – Tool for generating Python scrapers  A simple python tool that generates a requests/bs4 based web scraper
published: true
date: 2019-11-13 06:14:59 UTC
tags: Posts,scraping
canonical_url: http://blog.adnansiddiqi.me/scrapegen-tool-for-generating-python-scrapers/
---

![html scraping](http://blog.adnansiddiqi.me/wp-content/uploads/2019/11/html-min.jpg)

OK, so I was kind of bored last week so thought of coming up something anyway, even if it is [useless](https://www.ted.com/talks/simone_giertz_why_you_should_make_useless_things?language=en). So, I allocated a few hours and came up with ScrapeGen.

## What is ScrapeGen?

It is a simple Python-based command-line tool that generates python web scrapers based on rules and details entered in a YAML file. When it runs, it generates a new file. Rules turned to separate functions which then are called to main parsing method. View the Demo:

<iframe width="560" height="315" src="https://www.youtube.com/embed/S2-I28XCKGA" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="allowfullscreen"></iframe>

## Why is needed?

Such kind of tool could be good for companies who write so many parses and hardcode the rules within the Py files. Imagine the rule is changed and you gotta write it again. What if you just change the rule in YAML and the scraper starts working? Sounds cool, right?

The tool is available on [Github](https://github.com/kadnan/ScrapeGen)
YSPKA #2: gRPC
Tags: yspka, grpc, microservices
Published: 2019-11-13 05:28:20

Do you have micro services running? Do you use REST for communicating between them? Then maybe you should have a look at [gRPC](https://grpc.io/):

_A high performance, open-source universal RPC framework_

gRPC lets you define services and how the data should look like when calling and receiving replies from them. To define services you use something called [Protocol buffers](https://developers.google.com/protocol-buffers/) which is created by Google.

After you have defined the services gRPC generates client and server code, so you can implement the services and access the services from clients. 

gRPC has support for a lot of programming languages, and in Visual Studio 2019, there's project templates for creating gRPC projects.

Try it out the next time you are creating a new service.
Using Slack Webhook
Tags: linux, database, aws, bash
Published: 2019-11-13 05:11:02


### What do you learn in this post?

- You will learn how to create a Shell script.
- You will learn how to backup up your database by a script.
- You will learn how to automate your script by specif time of day.
- Also, you will learn how to send a message to your Slack channel programmatically. 

### Overview

Just imagine that you have a Slack channel, and you wanted to get notified when something happened in your Linux/Unix machine.  For instance, getting back up of something, or checking disk usage, monitor the network/process, or whatever you want to do in that machine manually. In this case, I assume you want to get a database backup and send a process success or failure message to your one of your Slack channels. Before to start this, you need to have a Slack account. The goal of this post is to take a backup every day and send a message to your Slack channel. Before to start this you need to have [Slack](https://slack.com/get-started)


### Create Script

- Create your `script.sh` file in your machine.
- Make your script executable by `chmod u+x script.sh`
- Add your logic to it. For this case to get backup of MySQL database with `mysqldump`.


```bash

#!/bin/sh

date=`date +%Y%m%d`

mysqldump -h localhost -u root -p pass --single-transaction --quick databasename > jeff/backup/databse${date}.sql

if [ "$?" -eq 0 ]
then
    echo " Script is running - ${date}" >> jeff/dbbackup.log
     curl -X POST -H 'Content-type: application/json' --data '{"channel":"#<your channel name>","text":"<your message here>"}' https://<your-slack-chanel>.slack.com/services/hooks/<your hooks key>
else
    echo "Script failed to run on ${date}" >> jeff/dbbackup.log
    curl -X POST -H 'Content-type: application/json' --data '{"channel":"#<your channel name>","text":"<your message here> "}' https://<your-slack-chanel>.slack.com/services/hooks/<your hookks key>
fi

```

You need to modify the `<your message here>`, `<your channel name>`, `<your hooks key` with your custom message and Slack webhooks' key. Where to get the key? follow next step


### Create Slack Webhook

- Create a [Slack account](https://slack.com/get-started) and channel if you don't have it.

- Create a [Slack App](https://api.slack.com/apps/new). Follow [this](https://api.slack.com/messaging/webhooks) steps.


### Add script to Cron jobs.
If you want to schedules a command or script on your server to run automatically at a specified time and date, please read the end of my [last post](https://dev.to/jeffshomali/how-to-backup-sync-all-of-your-dotfiles-with-github-e1c).


Good luck 😉
What are you learning?
Tags: javascript, beginners, computerscience, discuss
Published: 2019-11-13 04:12:36

I thought it might be fun to discuss what I'm focused on learning for the month of November. When I first graduated from Flatiron, I made a post-bootcamp curriculum of things to learn over the following months. But since then, I've found myself slowly drifting away from that laundry list. This is partly because of feedback from other developers, along with my struggle retaining and applying certain topics. 

So my priorities have shifted to **learning JavaScript well**.

Since my program focused on teaching a little of everything (rather than going deep in any one thing), there's still a lot to do before I can feel confident with JavaScript. That's why it's the perfect time to recalibrate my initial curriculum (IC) for the next few months. 

####In November, the IC has me scheduled to:
- wrap up learning Express
- create a React Admin Panel
- start a project using the MERN stack
- among other things

####Current status:
- I'm still learning fundamental computer science principles
- I'm still building a strong foundation in vanilla JavaScript
- I'm still exploring express

####Goals for the next 3 months:
- Work on challenging  projects (rather than tutorials)
- Deploy my projects and maintain them
- Start testing in every project

These are more general goals. So the next step will be to break them down into measurable steps to track week to week.

Realizing that knowing a bit of everything wasn't getting me very far, I quickly decided to focus on JavaScript, because I liked the language. Check out [this great video by Fireship](https://www.youtube.com/watch?v=FSs_JYwnAdI&t=12s) on how JavaScript works under the hood.
9 exemplos de email marketing de aniversário para inspiração – 2019
Tags: design, email, marketing
Published: 2019-11-19 01:44:41

---
title: 9 exemplos de email marketing de aniversário para inspiração – 2019
published: true
date: 2019-11-13 04:09:13 UTC
tags: Design,email,marketing
canonical_url: https://marquesfernandes.com/2019/11/13/9-exemplos-de-email-marketing-de-aniversario-para-inspiracao-2019/
---

Esse tipo de campanha pode até ser clichê mas lembrar o aniversário de seu cliente mostra que você se importa gerando uma oportunidade de manter ou renovar a comunicação com seu cliente oferecendo um cupom de desconto, brinde ou até mesmo um simples parabéns já funciona.

Segundo um estudo realizado pela Unidade de [_Marketing Services Global da Experian_](http://www.experian.com/blogs/marketing-forward/) campanhas de aniversário tem taxas maiores que emails promocionais em 481% transação, 342% em taxa de receitas e 179% em cliques únicos.

## Gifs e mais gifs…

O uso de gifs traz um tom alegre e descontraído para seu e-mail, mas cuidado use com moderação para não exagerar na informalidade.

### [AME](https://www.amedigital.com/)

![AME Email Marketing Aniversário](https://marquesfernandes.com/wp-content/uploads/2019/11/email_ame_2019.gif)

### [Curriculum](https://www.curriculum.com.br/)

![Curriculum Email Marketing Aniversário](https://marquesfernandes.com/wp-content/uploads/2019/11/curriculum.gif)

## [Pi Investimentos](https://www.vemprapi.com.br/)

![PI Investimentos Email Marketing Aniversário](https://marquesfernandes.com/wp-content/uploads/2019/11/email_pi.gif)

## Clean, simples e objetivo!

Aquela velha história de menos é mais nunca erra.

### [Monetus](https://monetus.com.br/)

![Monetus Email Marketing Aniversário](https://marquesfernandes.com/wp-content/uploads/2019/11/image.png)

### [Banco Inter](https://www.bancointer.com.br/)

![Banco Inter Email Marketing Aniversário](https://marquesfernandes.com/wp-content/uploads/2019/11/image-1.png)

### [Rico](http://rico.com.vc)

![Rico Email Marketing Aniversário](https://marquesfernandes.com/wp-content/uploads/2019/11/image-2.png)

## Design arrojado

Investir um tempinho em seu design demonstra carinho e preocupação com o cliente.

### [Submarino](https://www.submarino.com.br/)

![Submarino Email Marketing Aniversário](https://marquesfernandes.com/wp-content/uploads/2019/11/image-3.png)

### [Movida Seminovos](https://www.movidaseminovos.com.br/)

![Movida Seminovos Email Marketing Aniversário](https://marquesfernandes.com/wp-content/uploads/2019/11/image-4.png)

### [Remessa Online](https://www.remessaonline.com.br/)

![Remessa Online Email Marketing Aniversário](https://marquesfernandes.com/wp-content/uploads/2019/11/image-5.png)

O post [9 exemplos de email marketing de aniversário para inspiração – 2019](https://marquesfernandes.com/2019/11/13/9-exemplos-de-email-marketing-de-aniversario-para-inspiracao-2019/) apareceu primeiro em [Henrique Marques Fernandes](https://marquesfernandes.com).