teleren/devto huggingface dataset:
How To Get Through Those Bad Projects
Tags: webdev, career, projects, clients
Published: 2018-11-20 14:19:36

---
title: How To Get Through Those Bad Projects
published: true
description: There comes a time in every developer's career when they have a project they can't stand. It sucks, but you can make it through it.
tags: #webdev, #careers, #projects, #clients
---

Every developer has that one project. The project that was so poorly planned, so poorly designed that it makes you wonder if this was the right career for you to begin with. If you work as a web developer for more than a few years, you're bound to get put on at least one project like that.

There's hope though. Every project comes to an end one way or another and you'll be able to put it behind you. In the meantime, there are a few ways you can make it easier to bare with.

- Remind yourself why you're working on this project.
 - A bad project can seem like it'll last forever. I had a particularly bad project a while ago that lasted two years and it gave me at least three grey hairs from the stress. In all honesty, the only thing that kept me going back to work was the pay check.
 - It's ok if money is a motivator. It's ok if you're trying to build up some experience so you can go somewhere better. Just remember why you are there right now because this bad project won't last forever.

- Remember that you can go somewhere else.
 - If the project is bad enough and your manager or senior developers are equally bad, it's ok to consider getting a new job. Right now the market for ***good*** web developers is huge and employers know it. Take advantage of it!
 - That's not to say every time you get a bad project you should quit your job. But if it gets to the point that you're in a toxic environment that goes beyond the project, it might be time to go.

- Remind yourself that it's temporary. 
 - Every project comes to an end whether it's good or bad. If the company or client you work for is a good one it'll probably be worth it to tough it out. I worked for an exceptional company and got put on a project with the worst possible client. But my manager always checked in and made sure I was ok.
 - It's hard to find places that actually care about you. So when you do, try your hardest to soldier through the bad projects because there's more good in the company than bad. Plus you'll be getting even more experience. Once you know how to handle a bad project, the good ones are even better.

Believe me, I know what a bad project can do to you. But a bad project can also do a lot for you. When it's time for a raise or a bonus and you've been trudging through it, you don't go unnoticed. Even if it doesn't feel like it, the people you work with and for are paying attention to how you handle this. It might not be a shining moment to you at the time, but it can turn out to be the best bad project you never would have asked for. 

<hr>

Hey! You should follow me on Twitter because reasons: https://twitter.com/FlippedCoding
How do you customize service workers for Angular 6+? I'm making use of Firebase, and it needs a service worker.
Tags: help, pwa, webdev, angular
Published: 2018-11-20 14:42:04

---
title: How do you customize service workers for Angular 6+? I'm making use of Firebase, and it needs a service worker.
published: true
description: How do you customize service workers for Angular 6+? I'm making use of Firebase, and it needs a service worker.
tags: help, pwa, webdev, angular
---

I'm using Ionic 4/Angular 6 with Firebase.

I enabled Angular with this command

`ng add @angular/pwa@v6-lts --project app`

It generated ngsw-config.json, which generates a service worker in production. But how do I add code to the service worker?

I'm adding Firebase to it, to make use of Firebase Cloud Messaging.
Graph databases 101
Tags: beginners, explainlikeimfive, database
Published: 2018-11-20 14:31:31

---
title: Graph databases 101
published: true
description: Manish R Jain masterfully explains graph databases so we can all grok them.
canonical_url: https://changelog.com/posts/graph-databases-101
tags: beginners, explainlikeimfive, databases
---

[Dgraph](https://dgraph.io/) founder [Manish R Jain](https://twitter.com/manishrjain) gave us an _excellent_ explanation of graph databases on [episode 322 of The Changelog](https://changelog.com/podcast/322). 

_(Thanks to listener [Evan Genest](https://twitter.com/MisterGenest) for highlighting this fact [on Twitter](https://twitter.com/MisterGenest/status/1063224954446069761).)_

I extracted that section from our trusty [episode transcript](https://changelog.com/podcast/322#transcript-34) for your reading pleasure:

> I think graphs are probably the simplest things to think about, really. People think about SQL tables - you have a row and you have some columns. Think of a graph as three columns where you have a subject, a predicate, and an object. If you put together a whole bunch of these things, you get a graph. A subject is essentially – think of it as an entity; a predicate is the relationship, and the object is either another entity, or a value.
>
> The subject could be, let’s say, me. The relationship might be “lives in” and object might be “San Francisco.” Or it could be me - the name is Manish, and that’s sort of like a property. So you just put together a whole bunch of these facts, or triples, and you get a graph.
>
> Then other people who live in San Francisco would have similar facts, and then you could run a graph query around “Hey, tell me all the people who live in San Francisco and who eat sushi.” So you pick up all the people who live in San Francisco, you intersect with people in the world who eat sushi - which are completely different facts. You didn’t create them as “This person lives in San Francisco AND eats sushi.” This is something that we’re doing on the fly. So you pick up all the people in San Francisco, you pick up all the people in the world who eat sushi, you intersect the two lists, and now you get people in San Francisco who eat sushi. Now you can take that result and say “Intersect it with all the people who have been to Japan.” You pick up another list of people who have been to Japan, intersect it with this, and now you get people who live in San Francisco, who eat sushi, and who have been to Japan.
>
> So the power of graphs is really in these joins that you can do, coming from just very simple facts.

Listen for yourself [starting at 30:09](https://changelog.com/podcast/322#t=30:09) or start right from the top: 

{% podcast https://dev.to/changelog/322-there-and-back-again-dgraphs-tale %}

Thanks, Manish! 💚💚💚
Even solo devs have a backup team of hundreds; Have you thanked them lately?
Tags: culture, gratitude, mindset, discuss
Published: 2018-11-20 13:50:41

Recently I listened to a podcast featuring [A.J. Jacobs](https://tim.blog/2018/11/05/a-j-jacobs/), author of [Thanks a Thousand: A gratitude journey](https://www.amazon.com/Thanks-Thousand-Gratitude-Journey-Books/dp/1501119923/). In it, A.J. ventures out to thank a thousand people who were responsible for his morning cup of coffee, including but not limited to: 

- The barista who served it to him. 
- The people who bag and sell the coffee. 
- The designer who made the logo. 
- The farmers in South America who harvest the beans. 
- The Pennsylvania steelworkers who manufacture the steel used in the machines the farmers use. 
- The person who invented the cardboard cup sleeve thing, which as it turns out is called a zarf.


Hearing about this journey made me think about all of the people that make my life possible, and how often they go unthanked. So, I wanted to try a similar exercise this week. 

All during Thanksgiving week, I’m taking the time to reach out to people who build and support the npm modules and rails gems I rely on daily. I work on a small team at my company, but the number of people who wrote at least one line of code in our project is in the hundreds, if not thousands. 

And to say thanks to you, for reading taking the time to read this so far. _(this was originally written as one of weekly letters. [Subscribe here if that sounds interesting to you.](https://glennstovall.com/newsletter/))_ I know that your time is valuable, and I’m grateful you spent a little bit of it listening to what I have to say.

And thanks to @BenHalpern for creating Dev.to. I'm grateful that you have created such a wonderful online community of developers. 

[Studies have shown that gratitude increases happiness](https://www.psychologytoday.com/us/blog/the-mindful-self-express/201511/how-gratitude-leads-happier-life), so you have another reason to be more grateful yourself. It’s ok it seems like that means you are doing it for selfish reasons, but it isn’t. It’s just how humans work. 

So during this holiday season, I have an ask: time some time to reflect on all that’s going well, all of the things that make your life better and be grateful. Tell the people who have helped you along the way how thankful you are for them. And share in the comments what you're thankful for this holiday season!
Is Angular dead ?
Tags: angular, frontend, javascript, framework
Published: 2018-11-20 13:50:29

---
title: Is Angular dead ?
published: true
description: What is the state of Angular at the end of 2018 ?
tags: angular, frontend, javascript, framework
---

Do you know [State of Javascript](https://2018.stateofjs.com/)? This is a famous survey about JavaScript language for JavaScript developers. This year, more than 20,000 JavaScript developers have participated to it.

It talks about JavaScript flavors, such as Ecmascript, TypeScript, Elm etc, mobile app tools, backend and **frontend** frameworks.

Let's take a look at this [last point](https://2018.stateofjs.com/front-end-frameworks/overview/). I assume you know React, Vue and Angular.

We can easily say that React is the most loved frontend framework, more than **80%** of developers *used it and would use again* or *would like to learn it*. It's about **70%** for VueJS.

Take a look at **Angular**: only **33%** in these categories and more than 60% *would not use it again* or *are not interested*. 

Whereas version 7 of the framework has been release [a month ago](https://github.com/angular/angular/releases), it seems that the Google framework is dying. 

Let's talk about reasons that could explain unpopularity of Angular framework in the comment section!
Self-testing configuration – the example.config story
Tags: net, code, aspnet, authentication
Published: 2018-11-20 12:14:30

---
title: Self-testing configuration – the example.config story
published: true
tags: .net,code,asp.net,authentication
canonical_url: https://craignicol.wordpress.com/2018/11/20/self-testing-configuration-the-example-config-story/
---

![Some halloween cakes reflected in a mirror](https://craignicol.files.wordpress.com/2017/11/dsc_0101.jpg?w=320&h=179)<figcaption>Mirror image</figcaption>

We’re all good developers and never store production secrets in our source code. We have to keep them somewhere though.

If you’re an ASP.Net developer and you [store your secrets in a separate file](https://www.michaelcrump.net/azure-tips-and-tricks113/), how do you check them on release?

In a previous job, we were building an application in AWS EC2, which meant we couldn’t sit on top of the lovely Azure Key Vault/secrets.json workflow, and instead used a secure file drop as part of the deployment. We had a couple of releases that failed because secrets that were available locally weren’t included in the release package, causing the website to fail to start. We didn’t have the nice logging provided by the .Net core configuration objects, so what we did was create configuration documentation in the form on an example.config file that contained all the keys we expected, and populated dummy values. On startup, we’d compare the list of keys in the example.config which did not contain any secrets, with the actual config, and fail the startup with a report of which keys were different so we had a very quick way of checking the config was in sync with expectations.
"Computer programmer," is a skill, not a job.
Tags: programming, discuss, productivity
Published: 2018-11-20 10:29:34

---
title: "Computer programmer," is a skill, not a job.
published: true
description: What is a Computer programmer really?
tags: programming, discuss, productivity
---
![img](https://thepracticaldev.s3.amazonaws.com/i/j7cjfvxo2yryv11q0zwe.jpeg)
*Photo by rawpixel on Unsplash*

I was recently reading a [book](https://www.amazon.co.uk/Understanding-Software-Kanat-Alexander-simplicity-programmer/dp/1788628810) regarding Software engineering and for the most part, I was reading the thoughts of myself when I started programming and progressed through my career by making lots of mistakes but learning new things.

One of the most poignant points of the books was this one:

> "Computer programmer," like "carpenter," is a skill, not a job.

That made me think because if you put in this perspective you can think that the output of the computer programmers job is measured by the quality of the product and not by other metrics like lines of code or commits pushed.

We are artisans that practice the skill of programming. Some may be good at this skill some not. But it's not the only skill in the world and certainly not the best one.

What do you think?
Insertion Sort Algorithm in Java
Tags: sortalgorithms, algorithms, insertionsort, java
Published: 2018-11-27 08:50:34

---
title: Insertion Sort Algorithm in Java
published: true
tags: Sort Algorithms,algorithms,insertion sort,java
canonical_url: https://www.code2bits.com/insertion-sort-algorithm-in-java/
---

Insertion sort is a sorting algorithm that builds the final sorted array (or list) one item at a time. The algorithm iterates over the list and removes the current element, finds the location within the sorted part of the list, and inserts it there. This process is repeated until the whole list is sorted.

### Algorithm Classification

The following table contains information about the analysis of the Insertion Sort algorithm. It defines the worst, average and best cases in terms of time complexity and also the worst case in space complexity.

| Attribute | Value |
| --- | --- |
| Class | Sorting Algorithm |
| Classification | Internal, In-place, Stable Algorithm |
| Data Structure | Array |
| Time Complexity: Best | Ω(n) |
| Time Complexity: Average | Θ(n<sup>2</sup>) |
| Time Complexity: Worst | O(n<sup>2</sup>) |
| Space Complexity: Worst | O(1) |

Please use the following [link](http://www.bigocheatsheet.com/img/big-o-cheat-sheet-poster.png) for an explanation on Big-O notation and what is good, fair and bad.

### Insertion Sort In Java

```java
public final class InsertionSort {
     
    public void sort(int[] collection) {
        if (collection != null) {
            insertionSort(collection);
        } else {
            throw new IllegalArgumentException("Input parameter for array to sort is null.");
        }
    } 
     
   
    private void insertionSort(int[] collection) {
        int arrayLength = collection.length;
         
        for (int unsortIndex = 1; unsortIndex < arrayLength;  unsortIndex++) {
            int newElement = collection[unsortIndex];
            int iterator = 0;
 
            for (iterator = unsortIndex; iterator > 0 && collection[iterator - 1] > newElement; iterator--) {
                collection[iterator] = collection[iterator - 1];
            }
            collection[iterator] = newElement;
        }
    }
}
```

#### Sample Code (GitHub)

The details of the InsertionSort class can be viewed [here](https://github.com/Code2Bits/Algorithms-in-Java/blob/master/sort/src/main/java/com/code2bits/algorithm/sort/InsertionSort.java).  
The details of the InsertionSort JUnit Test class can be viewed [here](https://github.com/Code2Bits/Algorithms-in-Java/blob/master/sort/src/test/java/com/code2bits/algorithm/sort/InsertionSortTest.java).

### Conclusion

The Insertion Sort algorithm forms part of a larger group of sorting algorithms. Learning through experience is the reason I created this post about the implementation of the Insertion Sort algorithm in Java. I have learned a lot about how others have solved the Insertion Sort algorithm in other languages including different implementations in Java.

The post [Insertion Sort Algorithm in Java](https://www.code2bits.com/insertion-sort-algorithm-in-java/) appeared first on [Code2Bits](https://www.code2bits.com).
Insertion Sort in Java
Tags: sortalgorithms, algorithms, insertionsort, java
Published: 2018-11-27 08:52:00

---
title: Insertion Sort in Java
published: true
tags: Sort Algorithms,algorithms,insertion sort,java
canonical_url: https://www.code2bits.com/insertion-sort-in-java/
---

Insertion sort is a sorting algorithm that builds the final sorted array (or list) one item at a time. The algorithm iterates over the list and removes the current element, finds the location within the sorted part of the list, and inserts it there. This process is repeated until the whole list is sorted.

### Algorithm Classification

The following table contains information about the analysis of the Insertion Sort algorithm. It defines the worst, average and best cases in terms of time complexity and also the worst case in space complexity.

| Attribute | Value |
| --- | --- |
| Class | Sorting Algorithm |
| Classification | Internal, In-place, Stable Algorithm |
| Data Structure | Array |
| Time Complexity: Best | Ω(n) |
| Time Complexity: Average | Θ(n<sup>2</sup>) |
| Time Complexity: Worst | O(n<sup>2</sup>) |
| Space Complexity: Worst | O(1) |

Please use the following [link](http://www.bigocheatsheet.com/img/big-o-cheat-sheet-poster.png) for an explanation on Big-O notation and what is good, fair and bad.

### Insertion Sort In Java

```java
public final class InsertionSort {
     
    public void sort(int[] collection) {
        if (collection != null) {
            insertionSort(collection);
        } else {
            throw new IllegalArgumentException("Input parameter for array to sort is null.");
        }
    } 
     
   
    private void insertionSort(int[] collection) {
        int arrayLength = collection.length;
         
        for (int unsortIndex = 1; unsortIndex < arrayLength;  unsortIndex++) {
            int newElement = collection[unsortIndex];
            int iterator = 0;
 
            for (iterator = unsortIndex; iterator > 0 && collection[iterator - 1] > newElement; iterator--) {
                collection[iterator] = collection[iterator - 1];
            }
            collection[iterator] = newElement;
        }
    }
}
```

#### Sample Code (GitHub)

The details of the InsertionSort class can be viewed [here](https://github.com/Code2Bits/Algorithms-in-Java/blob/master/sort/src/main/java/com/code2bits/algorithm/sort/InsertionSort.java).  
The details of the InsertionSort JUnit Test class can be viewed [here](https://github.com/Code2Bits/Algorithms-in-Java/blob/master/sort/src/test/java/com/code2bits/algorithm/sort/InsertionSortTest.java).

### Conclusion

The Insertion Sort algorithm forms part of a larger group of sorting algorithms. Learning through experience is the reason I created this post about the implementation of the Insertion Sort algorithm in Java. I have learned a lot about how others have solved the Insertion Sort algorithm in other languages including different implementations in Java.

The post [Insertion Sort in Java](https://www.code2bits.com/insertion-sort-in-java/) appeared first on [Code2Bits](https://www.code2bits.com).
HTTPS on static websites?
Tags: https, security
Published: 2018-11-20 08:39:58

---
title: HTTPS on static websites?
published: true
description: Do static websites require an HTTPS certificate?
tags: https,security 
---

# Do we require an HTTPS certificate for static sites?

There is this misconception that an HTTPS certificate is required only when collecting sensitive information like credit card data and personal information.

However Troy Hunt highlights in his demo how this could be far from the truth.

Also, if your idea is that this does not affect you in any way I strongly suggest you have a look at the demo.

https://www.troyhunt.com/heres-why-your-static-website-needs-https/
Why did you pick the avatar you use?
Tags: discuss
Published: 2018-11-20 07:27:10

---
title: Why did you pick the avatar you use?
published: true
description: 
tags: discuss
---
One of the things that fascinates me about social sites is the sheer variety and creativity of the images people use for their avatars.

I feel quite prosaic in having picked a photo that I hope feels friendly, shows people what I look like and reminds me of a happy day out walking with my family when I see it.

Does anyone want to share the story behind how they picked the picture they use?
How to print PDF document in C#
Tags: printpdffromcode, cpdf, netpdf
Published: 2018-11-20 06:50:55

---
title: How to print PDF document in C#
published: true
description: C# print PDF document, Spire.PDF
tags: print PDF from code,C# PDF, .NET PDF
---

Spire.PDF has a powerful function to print PDF document. This article shows how to print a PDF file using C# via the following print situation:

* Print PDF to default printer.
* Print PDF to virtual printer.
* Print PDF to a specified printer and select some pages in the PDF file to print.
* Print PDF in greyscale.
* Print Multiple PDF Pages per Sheet
* Print Single PDF Page to Multiple Sheets

Print PDF to default printer and print all the pages on the PDF document.
```csharp
PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile("Sample.pdf");
pdf.Print(); 
```    
               
Print PDF to virtual printer (Microsoft XPS Document Writer).
```csharp
PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile("Sample.pdf");
pdf.PrintSettings.PrinterName = "Microsoft XPS Document Writer";   
pdf.PrintSettings.PrintToFile("PrintToXps.xps");
pdf.Print();
``` 
      
Print PDF to a specified printer and select some pages in the PDF file to print.
```csharp
PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile("Sample.pdf");
//Set the printer 
pdf.PrintSettings.PrinterName = "HP LasterJet P1007";
//Only print the second and fourth page
pdf.PrintSettings.SelectSomePages(new int[] { 2,4 });
//Print the pages from 1 to 15
pdf.PrintSettings.SelectPageRange(1,15);
pdf.Print();
```

Print PDF in greyscale. 
```csharp
PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile("Sample.pdf");
pdf.PrintSettings.Color = false;
pdf.Print();
```
Print Multiple PDF Pages per Sheet. Uses can invoke the SelectMultiPageLayout(int rows, int columns) method of the PdfPrintSettings class to print multiple PDF pages per sheet of paper.

```csharp
PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile("Sample.pdf");
//Print two PDF pages per sheet
pdf.PrintSettings.SelectMultiPageLayout(1, 2);
pdf.Print();
```

Print Single PDF Page to Multiple Sheets. The SelectSplitPageLayout() method of the PdfPrintSettings class can be used when printing a large PDF page to multiple sheets. This method splits the PDF page to multiple pages according to the standard A4 paper size: 595pt*842pt.

```csharp
PdfDocument pdf = new PdfDocument();
pdf.LoadFromFile("Sample.pdf");
//Print the PDF page to multiple sheets
pdf.PrintSettings.SelectSplitPageLayout();
pdf.Print();
```
OO vs OLOO - what do you prefer
Tags: javascript, question
Published: 2018-11-20 06:50:32

---
title: OO vs OLOO - what do you prefer
published: true
description: Because of book series "You don't know JS" I am little confused and wanted to ask more experienced developers.
tags: javascript, question
---

Title says it all. In JS there are many ways to create something (allright, that rule is everywhere - not only in JS). What do you prefer? Is there any "live" examples of OLOO at your work? Looks clear to me, and there is no need to do the stuff with changing the prototypes. 

Maybe it is completely pointless to think about that problem. I want to get familiar with React, so I should just use class instead, but it's just something I can't stop thinking about