teleren/devto huggingface dataset:
What are the most gruesome code review pitfalls you encountered?
Tags: discuss
Published: 2019-04-10 08:32:45

---
title: What are the most gruesome code review pitfalls you encountered?
published: true
tags: discuss
---

I surveyed more than 900 engineers [on their code review pitfalls](https://www.michaelagreiler.com/code-review-pitfalls-slow-down/). People mainly complain about time constraints and problems understanding the code change.

What are the most painful pitfalls you experienced and do you have ever had a horrendous experience with code reviews?
Coming Soon: Full-Stack Developer Profiles
Tags: jobs, maker, startup, showdev
Published: 2019-04-10 08:12:48

---
title: Coming Soon: Full-Stack Developer Profiles
published: true
description: 
tags:  jobs, maker, startup, showdev
---

Since my silent release February 2019 I did a bunch of improvements for my Job Board for Full-Stack Developers.

To mention some of them:

- Fast Filter for Skills (on top of the listing and clicking on a skill badge)
- Remote OK Filter
- Country Filter
- More quality Job's listed
- Complete Back-End for Job and Blog Administration

What I learned until now is, that Job Seekers mainly like my board, because of quality of jobs listed. My goal never was and never will be to have 150'000 jobs in our DB, where most of them are outdated or of bad quality. I list only the newest jobs and all of them are manually checked before being approved.

Now I want to go a step further. I want to offer Job Candidates to show up to qualified job recruiters with a well-prepared resume/candidate profile.
For recruiters we offer the possibility to get access to qualified candidate.

And all of this, as with the Job Positions, based on quality and not quantity. I will check and accept only real Full-Stack Developer Candidates and same for Recruiters, which can be qualified companies, recruiter agencies and head-hunters.

Read more about and register now for free:
https://fullstackjob.com/developer/profiles
Small RecyclerView XML feature
Tags: android, xml, view, recyclerview
Published: 2019-04-10 07:54:50

---
title: Small RecyclerView XML feature
published: true
description: Beginner recycler view XML tip, feature.
tags: Android, XML, view, recyclerview
---

Did you know, that you can set RecyclerView layoutManager directly in XML, instead of always set RecyclerView layoutManager in the code?

##Examples
Paste one of this attribute in your RecyclerView in XML.

For GridLayoutManager:
`app:layoutManager="android.support.v7.widget.GridLayoutManager"`

For LinearLayoutManager:
`app:layoutManager="android.support.v7.widget.LinearLayoutManager"`

And for StaggeredGridLayoutManager:
`app:layoutManager="android.support.v7.widget.StaggeredGridLayoutManager"`
TypeScript - get types from data using typeof
Tags: typescript, javascript, types
Published: 2019-04-10 07:49:54

---
title: TypeScript - get types from data using typeof
published: true
description: Some snippets how to create types based on initial data
tags: typescript, javascript, types
---

A great way to make sure the values you set to your variables matches what you would expect is to set specific types to them.

If you already have the data in a object or array. The following ways are great to create your types!

Lets say you have the following data:
```typescript
const data = {
  value: 123,
  text: 'text'
};
```
Then you can create a type bases on that using:
```typescript
type Data = typeof data;
// type Data = {
//   value: number;
//   text: string;
// }
```

You can do the same with nested objects:
```typescript
const data = {
  value: 123,
  text: 'text',
  subData: {
    value: false
  }
};
type Data = typeof data;
// type Data = {
//   value: number;
//   text: string;
//   subData: {
//     value: boolean;
//   };
// }
```

Since TypeScript 3.4 you can do the following if you have an array of strings (notice the `as const`):
```typescript
const data = ['text 1', 'text 2'] as const;
type Data = typeof data[number];
// type Data = "text 1" | "text 2"
```

It's also possible to get types from arrays with objects:
```typescript
const locales = [
  {
    locale: 'se',
    language: 'Swedish',
  },
  {
    locale: 'en',
    language: 'English',
  }
] as const;
type Locale = typeof locales[number]['locale'];
// type Locale = "se" | "en"
```

And it's also possible to get types from keys:
```typescript
const currencySymbols = {
  GBP: '£',
  USD: '$',
  EUR: '€',
}
type CurrencySymbol = keyof typeof currencySymbols;
// type CurrencySymbol = "GBP" | "USD" | "EUR"
```

A notice about `as const` vs using `<const>`. They both work the same but the `<const>` will fail in a .tsx-file (React).
```typescript
const data = ['text 1', 'text 2'] as const;
// is the same as
const data = <const>['text 1', 'text 2'];
```
What is an object?
Tags: beginners, tutorial, learning, devtips
Published: 2019-05-31 10:14:00

---
title: What is an object?
published: true
tags: beginners, tutorial, learning, devtips
canonical_url: https://www.codetips.co.uk/beginner/what-is-an-object/
---

> Objects are structured collections of data and methods.

 ![What is an object?](https://www.codetips.co.uk/content/images/2019/03/objects_wooden-drawers.jpg)

Like most things at this stage, we're not throwing all the information at you, so this is just a basic introduction. We've purposefully omitted all the complicated things until a later article.

<!--kg-card-begin: markdown-->

`Objects` are like arrays but instead of indexing the elements by incremental numbers it allows you to assign a `key` to each `value` you store, separated by a `,`.

<!--kg-card-end: markdown-->

So the basic [syntax](https://codetips.co.uk/beginner/what-is-syntax/) for declaring an object looks like this:

<!--kg-card-begin: markdown-->
```
object = {
    key1: value1,
    key2: value2,
    ...
}

```
<!--kg-card-end: markdown-->

Each **key-value-pair** behaves just like a [variable](https://codetips.co.uk/beginner/what-is-a-variable/). This is especially important when you think about what can be stored inside an `object`. It can be anything ranging from the basic [data-types](https://codetips.co.uk/beginner/what-is-a-data-type/), [Arrays](https://codetips.co.uk/beginner/what-are-arrays/), [Functions](https://codetips.co.uk/beginner/what-is-a-function/) and even other `objects`.

<!--kg-card-begin: markdown-->
```
object = {
    number: 1,
    float: 3.17,
    boolean: true,
    string: "Hello World",
    array: ["John Doe", 37, 1.95],
    object: {
        key: value,
    },
}

```
<!--kg-card-end: markdown-->

The whole concept of an object can be grasped easily when you imagine it as a big cupboard with labelled drawers.

Every time you put something in a draw (e.g. a handful of socks), you assign the draw a purpose (`socks`) by writing a label on it. With an `object` we assign a `key` instead of writing a label:

<!--kg-card-begin: markdown-->
```
object = {
    socks: ["red socks", "blue socks", "black socks"],
}

```
<!--kg-card-end: markdown-->

That way you can easily determine what is inside all of the drawers.

<!--kg-card-begin: markdown-->
```
object = {
    socks: ["red socks", "blue socks", "black socks"],
    tops: ["striped top", "plain top"],
    trousers: ["jeans", "tracksuit bottoms", "chinos", "suit bottoms"]
}

```
<!--kg-card-end: markdown-->
Day 11 - Quick Reminder Notification - 100 days 100 python scripts
Tags: python, productivity, beginners, career
Published: 2019-04-10 06:35:24

---
title: Day 11 - Quick Reminder Notification - 100 days 100 python scripts
published: true
description: Day 2 - Quick reminder notification
tags: python, productivity, beginners, career
cover_image: https://cdn-images-1.medium.com/max/1600/0*GEsDQGQ1BucUNW1g
series: 100 days 100 python scripts
---

####[Link to previous posts of the series](https://dev.to/ganesh/100-days-100-python-scripts-challenge-3fc)
##Day 11: notify_user 

A one-line script that notifies the user with the given title and message. Could be helpful to remind your daily tasks with the help of cron or schedule module from python

```python
import os,constants

# if you want the notification to be triggered at a specific time, user cron or schedule from python
# Though I prefer using Node-red for scheduling I am not gonna use other methods here.

os.system('notify-send "'+constants.NOTIFY_TITLE+'" "'+constants.NOTIFY_MESSAGE+'"')
```

Please Visit my Git Repo to check out all the previous day challenges.

[https://github.com/ganeshraja10/automated-python-scripts](https://github.com/ganeshraja10/automated-python-scripts)
Background image with gradient overlay in CSS
Tags: css, tutorial, beginners, webdev
Published: 2019-04-10 06:34:54

---
title: Background image with gradient overlay in CSS
published: true
description: Background images with overlay are very common UI feature. It will be seen more on Hero, Cards components.
tags: ['CSS', 'tutorial', 'beginners', 'webdev']
series: 'CSS Nuggets'
canonical_url: https://learnwithparam.com/blog/bacground-image-with-gradient-overlay-in-css/
---

> Follow me on [Twitter](https://twitter.com/learnwithparam), happy to take your suggestions on topics or improvements

Background images with overlay are very common UI feature. It will be seen more on Hero, Cards components.

There are several ways to achieve it. Most preferred way is to make use of CSS pseudo elements to assign a background color with proper opacity. This method doesn't need extra HTML elements and it works in all modern browsers.

## Background image with Overlay

```scss
.bg-img-overlay {
  width: 600px;
  height: 600px;
  position: relative;
  // Image as background
  background: url('https://unsplash.it/600x600') center center no-repeat;
  background-size: cover;

  &:before {
    // Pseudo element will only render if it has a content property
    content: '';
    // Overlay should occupy the full width and height of parent image container
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    // Overlay background-color
    background-color: #000000;
    // Overlay opacity, else overlay won't be transparent and show the image
    opacity: 0.6;
  }
}
```

{% codepen https://codepen.io/Param-Harrison/pen/yrgXvy %}

> Credits to [unsplash](https://unsplash.com) and their contributors for generously providing images

## Background image with gradient Overlay

Its same as above. Only change will be, `background-color` of the overlay need to be replaced with `background-image` with linear gradient.

```scss
.bg-img-overlay {
  background: ...;
  &:before {
    ...
    // Overlay background-color
    background-color: linear-gradient(to bottom right, #002f4b, #dc4225);
    ...
  }
}
```

{% codepen https://codepen.io/Param-Harrison/pen/EvEmmW %}

> Note: I have used `vw` and `vh` for width and height to make it look beautiful in codepen. You can change the image width and height property and see the example working for different sizes.

Its very simple and useful technique in creating many UI components 😎

> Note: This article was originally written for [my blog](https://learnwithparam.com/blog/bacground-image-with-gradient-overlay-in-css/). I am republishing it here for the amazing DEV community.
Kyle Simpson describes a paradigm shift in programming 
Tags: programming, beginners, codequality, continuouslearning
Published: 2019-04-10 06:17:18

---
title: Kyle Simpson describes a paradigm shift in programming 
published: true
description: 
tags: programming, beginner, code quality, continuous learning 
---

### this free video lecture is one of the best descriptions of coding I’ve ever seen. It also describes a fundamental shift in style we can make to improve software development as a whole. 

{% twitter 1115858817688965122 %}
LeetCode 7. Reverse Integer
Tags: java, math
Published: 2019-04-10 01:33:19

---
title: LeetCode 7. Reverse Integer
published: true
description: Solution + explanation for problem 7
tags: java, math
series: LeetCode in Java
---

```java
public int reverse(int x) {
    int rev = 0;

    while (x != 0) {
        int pop = x % 10;
        x /= 10;

        if (rev > Integer.MAX_VALUE / 10 || (rev == Integer.MAX_VALUE / 10 && pop > 7)) {
            return 0;
        }
        if (rev < Integer.MIN_VALUE / 10 || (rev == Integer.MIN_VALUE / 10 && pop < -8)) {
            return 0;
        }

        rev = rev * 10 + pop;
    }

    return rev;
}
```

Reversing an integer is similar to reversing String. We get the last digit `x % 10`  and add it to `rev`. We repeat this process until `x` is 0. The two if statements are used to prevent integer overflows.

_Time Complexity_: `O(log(x))`

_Extra Space_: `O(1)`

## A note on integer overflows

A integer occurs when the sum of `rev * 10 + pop` is greater/less than the maximum value (`Integer.MAX_VALUE`)/the minimum value(`Integer.MIN_VALUE`). So we need the check the values of `rev` and `pop`.

- If `rev > Integer.MAX_VALUE/10` or `rev < Integer.MIN_VALUE/10`, `rev * 10 + pop`   will overflow.
- If `rev == Integer.MAX_VALUE / 10`, `pop` must be less than or equal to 7 because  `2^32 - 1 % 10 == 7`.
- If `rev == Integer.MIN_VALUE / 10`, `pop` must be greater than or equal to -8 because  `-2^32 % 10 == 8`.
What excites you the most in tech right now? Please discuss
Tags: discuss, docker, serverless, cloud
Published: 2019-04-10 00:29:42

Having been in the IT industry, as a developer, since 2005 it's easy to think that I would by now think software development and different frameworks should start to feel old and that I would look at other things. 

Strangely enough, it doesn't. I'm actually more excited and keen on learning than ever. Let me explain what makes me excited and why and I would also love to hear what makes you excited and make you want to come to work in the morning or test something out in a hobby project

So here's my list:

- **DevOps**, this is a huge area but WOW am I excited. I've been in the business long enough to remember the dark days of it taking 1-2 weeks to set your machine up. You coded and tested things on Dev and/or Staging and of course, something was different in Production. Or you handed over some zip files and scripts to Ops and you didn't hear from them again until 3-4 weeks later or worse, oh boy that context switch was painful to try to remember what you coded and how to fix it :) With containers and being able to scale your apps with things like Kubernetes it feels like most of the pain is gone and focus is where it should be - deliver software

- **Cloud**, I have to admit, I wasn't always super pumped about it. In it's early days no one used it. Customers were suspicious and the Cloud Admin tools changed the appearance on almost a weekly basis. Now, however, everything has changed, large adaption, it has matured the things you can do with scaling, ML, Serverless, just amazing... 

- **Javascript**, and its ecosystem. Yes, a lot of people complain that some Javascript frameworks have less longevity than certain milk products ( it's funny cause it's true ). However, the rate of change, the language itself is evolving, the feeling of it being light-weight yet powerful. I love everything about it, the whole full stack.

- **Machine Learning**. The things you can do today with Machine Learning that wasn't possible a few years ago, because of the Cloud and other things. Machine Learning is available even for Developers with Cognitive Services and even then I want more.. I never thought I would say this but I want to know everything, even the Math behind it.

This many years as a Developer, I feel like a kid in a candy store, so many things...



That's my story, tell me yours?
Unsafe SQL functions in Laravel
Tags: php, laravel, security
Published: 2019-04-11 09:22:14

---
title: Unsafe SQL functions in Laravel
published: true
tags: php, laravel, security
canonical_url: https://stitcher.io/blog/unsafe-sql-functions-in-laravel
---

I recently learned that not all query builder functionality in Laravel is "safe". This means that user input shouldn't be passed directly to it, as it might expose your application to SQL injection vulnerabilities.

Continue reading on [https://stitcher.io/blog/unsafe-sql-functions-in-laravel](https://stitcher.io/blog/unsafe-sql-functions-in-laravel)
fix chrome flexbox layouts in chrome 72, 73+
Tags: tips, chrome
Published: 2019-05-05 17:33:04

---
title: fix chrome flexbox layouts in chrome 72, 73+
published: true
tags: tips,chrome
canonical_url: https://jagascript.com/fix-chrome-flexbox-layout-in-chrome-72-73/
---

Chrome 72 introduced a change in how flexbox element with `height: 100%` renders, that caused some strange product breakage from one day to another without any code change.

[![chrome-before-fix](https://jagascript.com/static/fc02cb35b46762ccb2e475c40e37bf2d/7f393/chrome-before-fix.png)](/static/fc02cb35b46762ccb2e475c40e37bf2d/7f393/chrome-before-fix.png)

The fix was simple but hard to find.flexbox elements with `height: 100%` now need to have `min-height` set, even 0 value is ok.

```
.list {
  display: flex;
}

.item {
  height: 100%;
  min-height: 0; /* add this */
}
```

[![chrome-after-fix](https://jagascript.com/static/15b2702193a9e6066cee1dfbc315be15/7c949/chrome-after-fix.png)](/static/15b2702193a9e6066cee1dfbc315be15/7c949/chrome-after-fix.png)

more info: [https://developers.google.com/web/updates/2019/01/devtools](https://developers.google.com/web/updates/2019/01/devtools)
Being Scientific with Gists : The Sharable Laboratory
Tags: git, beginners, devtips, go
Published: 2019-04-09 23:19:20

---
title: Being Scientific with Gists : The Sharable Laboratory
published: true
description: Gists Are Great for Tinkering, Performance Testing and Discussion. By using Gist Remotes, teams can create code variants with reproducible test results.
tags: git, beginners, devtips, go
---

Next time you create a post with code snippets--like here on dev.to or stackoverflow--consider sharing a working and buildable gist along with it.  By doing so, others can clone, reproduce your results, and commit new variants much more easily.

With the process below, your gist becomes a sharable laboratory. Since the gist contains all of the code variants and test cases, any team member can create a variant and run the tests against all existing variants. 

In the examples below, we were discussing performance differences between short Perl & Golang snippets, presumably doing the same thing.  The original variant had Perl code which was 90% faster.  We were later able to make the go code faster through the experiment process.

I saved the original into a gist, so I could make my changes and share the history easily without having to translate back into markdown. 

(this assumes you use gists, but if you're new to gists, here's the basics: 
[Creating Gists](https://help.github.com/en/articles/creating-gists)        )

## Obtaining the Remote
Once the gist is created
![](https://thepracticaldev.s3.amazonaws.com/i/eddu9e5rd9ks4r29grzu.jpg)


## Cloning

Clone as you would any remote
```
git clone git@gist.github.com:6dec6bd8acb816f946b823af1f780035.git
```


## Tagging the Test Variants
If you want to be meticulous, add tags for each variant 

In this case the original version is `v-control` and the change I made added IO buffering among other things

```
git tag v-control 2172
git tag v-buffering aaa9320
```

This way anyone can check out any variant--e.g with `git checkout v-control`--and your experiment precisely on their environment.


## Running Your Tests
Now the tests are in the repo, so anyone can run the tests with a simple clone and run `sh test-perl.sh `


## Conclusion
I love this example because it's a trivial workflow change that encourages collaboration and reproducible results--both important values on teams that I manage. 

Are there creative & non-obvious ways you're using common tools?  Share in the comments.
Net Core important Features implementation
Tags: aspcore, csharp, cors, entityframework
Published: 2019-04-09 23:12:52

---
title: Net Core important Features implementation
published: true
description: DotNet core common functionality code implementation
tags: aspcore, csharp, cors, entity framework 
cover_image: https://ardalis.com/wp-content/uploads/2017/05/aspnetcore-logo-591x360.png
---

As .Net core(version used here is 2.1) is becoming popular day by day, here are some projects I created which might come handy. (added comments in the code for better understanding). Whichever functionality you want to test just set those web API project as startup project and you are good to go.

Repository: https://github.com/jai00271/AspCoreGuide

# 1. Extending Service and cors implementation:

In this project, we moved all the service injection logic to a different class. We should avoid putting all service injection logic inside ConfigureServices method. Also when we are using .Net core with the client-side project like Angular or react we should take care of cors issue as well. 

Project Name: BasicProjectSetup
___
# 2. Log implementation:

This project contains an implementation of logging feature provided by default with .Net core.

Project Name: LoggingImplementation
___
# 3. Entity Framework implementation:

This project contains 2 things:

a. How to Entity framework with SQL server
b. Implementation via Repository design pattern

Nugets used: Microsoft.EntityFrameworkCore.SqlServer, Microsoft.EntityFrameworkCore.Tools (Project: EFImplementation.Repository)

Folder Name: EFImplementation

refer [this](https://www.learnentityframeworkcore.com/walkthroughs/aspnetcore-application) for more understanding of EF implementation in .Net core
___
# 4. Error handling:

This project contains 3 things:

a. Custom Log implementation by extending NLog.Extensions.Logging
b. Built in .Net core middleware implementation
c. Custom middleware implementation

Folder Name: Errorhandling

Nugets usd: NLog.Extensions.Logging(Project: LoggerService)
___
# 5. Implementing Swagger in Web API

This project contains swagger implementation. 

Project Name: SwaggerImplementation

Nuget used: Swashbuckle.AspNetCore(Project: SwaggerImplementation)
___
# 6. Working with XUnit Test Framework 

This project helps in understanding how XUnit framework works.

Folder Name: XUnitTest

Nuget used: Microsoft.AspNetCore.App(Project: Learn.UnitTest)
___

Repository: https://github.com/jai00271/AspCoreGuide

* Refernce article 

Code: https://code-maze.com
Cover Image: Image [source](https://ardalis.com/wp-content/uplo ads/2017/05/aspnetcore-logo-591x360.png)

Please share your valuable feedback, as it will help me write better :)
Django 2.2 polls app tutorial source code commit by commit
Tags: python, django, beginners, tutorial
Published: 2019-04-09 22:47:01

---
title: Django 2.2 polls app tutorial source code commit by commit
published: true
description: Source code for Django 2.2 "Writing your first Django app" official tutorial
tags: python, django, beginners, tutorial
---

TL;DR

I went through the famous Django "polls" app tutorial, and made it into a git repository which you can follow commit by commit:

GitHub link: [deployment-from-scratch/django-2.2-polls](https://github.com/deployment-from-scratch/django-2.2-polls)

Tutorial link: [Writing your first Django app](https://docs.djangoproject.com/en/2.2/intro/tutorial01/)

It's for Django 2.2.

Full Story:

Since the beginning of time (me wanting to leave PHP development) I was intrigued by Ruby on Rails and Django frameworks. I liked both for different reasons, but ended up doing mainly Rails because of Ruby the language (and living with a syndrome that I might made a mistake ever since).

Fast forward to 2019, and I am writing a book on [deploying web application](http://deploymentfromscratch.com) where I am trying to teach deployment of both Ruby *and* Python apps. There are pretty similar in that regards actually, but I needed some Python examples.

For this reason, I went to the Django site after many years (it's a lie, I keep watching Django space haha) and did the famous introductory tutorial of building "polls" app. I did it "commit by commit" so people can follow it easily while going through the tutorial.