teleren/devto huggingface dataset:
Tech Book Club Reading List 2020
Tags: culture, learning, programming, books
Published: 2021-01-05 12:42:16

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

Last year the dev team at [NearSt](https://near.st) started a "tech book club". We started meeting once a week to spend 30 to 45 minutes discussing a book, talk or podcast we thought was interesting and vaguely (or directly) relevant to our team's activities. 

The below is an unordered list of the various resources we looked at in 2020. Some we liked, some we didn't. We definately didn't finish all the books either. However, they all provided great jumping off points for us to reflect on our team, roadmap, cultural attitudes and technical choices... and so forth. 

We found this a particularly good activity since the start of the pandemic, bringing us together to exercise our minds and kick start team discussions whilst working remotely.

So, in case any of these spark your interest... here's our 2020 list! 

- [Clean Code by R.C. Martin](https://www.amazon.co.uk/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882)
- [RubyConf 2017: Keynote - You're Insufficiently Persuasive by Sandi Metz](https://www.youtube.com/watch?v=VzWLGMtXflg)
- [JavaScript the Good Parts](https://www.oreilly.com/library/view/javascript-the-good/9780596517748/)
- [Thinking Fast and Slow by Daniel Kahneman](https://www.amazon.co.uk/Thinking-Fast-Slow-Daniel-Kahneman/dp/0141033576)
- ["The creative power of misfits" with Adam Grant](https://www.ted.com/talks/worklife_with_adam_grant_the_creative_power_of_misfits/transcript)
- [A Philosophy of Software Design by John Ousterhout](https://www.amazon.co.uk/Philosophy-Software-Design-John-Ousterhout/dp/1732102201)
- [I see your point, but... - Gleb Bahmutov on Testing and Cypress](https://www.youtube.com/watch?v=5XQOK0v_YRE)
- [AWS re:Invent 2019:Amazon DynamoDB deep dive: Advanced design patterns (DAT403-R1) ](https://www.youtube.com/watch?v=6yqfmXiZTlM) or [2018: Amazon DynamoDB deep dive: Advanced design patterns](https://youtu.be/HaEPXoXVf2k)
- [Tatiana Mac: “System of Systems” — Clarity 2019
](youtu.be/TzGfBV67Tac)
- [Rebel Thinking by Matthew Syed](https://www.amazon.co.uk/gp/product/B07CG9MVD1/ref=ppx_yo_dt_b_d_asin_title_o00?ie=UTF8&psc=1)
- [Testing Tradeoff Triangle by Paul Swail](https://serverlessfirst.com/testing-tradeoff-triangle/)
- [Debriefing Facilitation Guide by Etsy](https://extfiles.etsy.com/DebriefingFacilitationGuide.pdf)
- [Fueling system discovery with observability | Charity Majors (Honeycomb)](https://www.youtube.com/watch?v=M2IHEmObc2k)
- [The Psychological Effects of UseEffect - Sara Vieira](https://www.youtube.com/watch?v=Hca6DkWPyMg)
- [The Return of 'Write Less, Do More' by Rich Harris | JSCAMP 2019](https://www.youtube.com/watch?v=BzX4aTRPzno&t=1067s)
- [GOTO 2020 • Sustainable Software Engineering, Building Carbon-Efficient Applications • Asim Hussain](https://www.youtube.com/watch?v=OSM-785tnGM)
- [How to detangle and understand production - Liz Fong-Jones](https://youtu.be/s0wZFHNuzyc)
How do I create a drag-able floating view on iOS?
Tags: swift, ios
Published: 2021-01-05 12:41:03

Let ‘s see here the following steps for making a drag-able floating view

1. Add a UIView to the view controller in storyboard.

2. Put on pan gesture to the UIView which is just added to the view controller therefore the view become draggable.

3. Create an IBAction for the pan gesture by making a connection to the storyboard to the view controller’s source code file.

4. Set the type for the sender to UIPanGestureRecognizer.

Learn more with example here: https://rlogicaltech.medium.com/how-do-i-create-a-drag-able-floating-view-on-ios-e0e6733c2617
Create Contact Book
Published: 2021-01-05 12:39:10

Hi guys. From my second project, I created a contact book which helps you save details about people you know. For this project, I limited myself to 4 details of the contact: *Name, Phone, Email ID, Address*.

So, for the contact book. I needed to store my details somewhere, so this data can be easily retrievable. So, just like my previous project, I stored this data of contacts into a csv file *Contact_Book.csv*.  

Now, that I had the contact book set up, I needed to create three functions for the user to interact with the contact book. *create_new_contact, update_exisiting_contact, find_contact*.


In the function create_new_contact, 
I took in four values: *Name, Phone, Email ID, Address* and wrote it into the csv file. 

In the function retrieving_contact ,I took in two variables *finder_keys* and *finder_values* each of it is a set. The finder_keys contains the type of data i have. i.e. name,phone,etc. The finder_values contains the data i have in the same order the keys are in in finder_keys.I then iterated through each contact in the contact book and converted each string into an array.I then saw if each datum in the contact is the same as the datum i want for a particular type of data. If so, then i append this contact into a set containing all the contacts I want and in the ens it will return the contact.

In the function updating_existing_contact, i took in 4 sets of values, 
1) finder_keys: which contains the types of data i have to identify the contacts i want to update
2) finder_values: which contains the data i have to identify the contacts i want to update
3) tbc_keys: which contain the type of data i want to change for each contact
4) new_values: which contain the new values i want to put into the contact

I then wrote all the contacts I am not updating and the updated contacts into a new csv file and renamed that file to the original one.

In the function find_contact, i took in two sets of values, *finder_keys* and *finder_values*. Then i iterated through the csv file. And found if the value in the line and the position of each finder_key is the same as the corrospoding finder_value. If all the finder_values match with the contact. I append the contact into a set found_contact and return the set at the end.


I then created a user_interface to allow the contact book user to easily interact with the book. 

Finally, i unittested each of the functions using custom impits and custom outputs to ensure all were working well.
UI Dev Newsletter #38
Tags: webdev, html, css, javascript
Published: 2021-01-05 12:35:15

- [A font-display setting for slow connections](https://bit.ly/3n95maR)
Matt Hobbs explains all about font loading and which font-display option to use for slower connections.


- [Is Safari the next Internet Explorer?](https://bit.ly/3nbBydu)
Danny Guo compares Safari browser with Internet Explorer in terms of web features and implementations.


- [Big Review of Major UI Design Trends for Web and Mobile in 2020](https://bit.ly/3naC23R)
Marina Yalanska takes a look back at what was popular in UI/UX design for websites and mobile applications in 2020.


- [My stack will outlive yours](https://bit.ly/3hANg0i)
Steren Giannini explains why his stack requires no maintenance, has perfect Lighthouse scores, will never have any security vulnerability, and why it will outlive yours.


- [How to change border width on hover without affecting layout](https://bit.ly/3rZkD1E)
Alex Carpenter figures out how to use box-shadow to mimic the border width hover effect.


- [Houdini.how](https://bit.ly/38Tq7SR)
A community-driven gathering place for CSS Houdini worklets and resources.


- [2020: A round-up of all Codrops resources](https://bit.ly/3pJesN5)
A roundup of all Codrops resources of the year 2020.


- [ButtonBuddy](https://bit.ly/2KOvsmx)
Stephanie Eckles builds a tool that lets you learn what it takes to ensure your buttons or button-styled links have accessible contrast across all states and surfaces.



Happy coding!

[Subscribe to the newsletter here!](https://bit.ly/34155z3)
Why online coding is the future ✅
Tags: devops, cloud, webdev
Published: 2021-01-05 12:33:44

Google uses Cider internally. Cider is a custom browser code editor which mounts the enormous Piper file system and provides a super tight integration with internal review, build and testing tools.

Github recently announced Github Codespaces to jump directly into a working environment when looking at a repository. Gitlab recently announced their partnership with Gitpod, building their own opensource clone of VSCode, providing the same functionality as Codespaces since some time already.

But why all this? Simply put, desktop IDE’s do not scale up!
In times of microservices and cloud developers just have to work on more complex projects… faster 🤓

While it is clear for Google that a single desktop, no matter how powerful, can not handle the Google Dev environment alone, it becomes almost equally important for smaller companies to not spend months on setting up a development environment.

The next logical step?

Move the full development infrastructure (from dev to production) to the cloud and unlock the potential of tools that exceed the abilities of my desktop.

This is why we built Codesphere 🚀
Project Ideas for nodejs or MERN stack applications
Tags: help, node, javascript, webdev
Published: 2021-01-05 12:25:21

Hye, I have taught my self HTML, CSS, JavaScript, React, nodejs, express.js, mongodb and socket.io and have built some basic projects (included in the course). 
 I have not yet used my fresh skills for a personal project. It is not easy to be a self taught programmer. I think I have come so far and I don't want to just give up. I feel less motivated because I have not done any project on my own. I hope that you understand my position.
 Please give me some project ideas (such as APIs and other fullstack websites etc) in which I can implement skills mentioned above to improve my skills, challenge myself and eventually showcase these projects for my portfolio
 Also, after completing the projects, what should I do? Try to get a job at a software house or some intership etc, or try to work as freelancer? and also give me a reason for your answer. 
And at the end, any advice for me as a junior MERN stack developer?
This is my first ever post on this platform. I have read many usefull and amazing articles. I love dev.to communuty.
Spring Data Search 2.0.0 released
Tags: kotlin, java, github, webdev
Published: 2021-01-05 12:21:18

I'm happy to share with you the release **2.0.0** of [Spring Data Search](https://github.com/Kobee1203/spring-data-search).

This library allows to automatically expose endpoints in order to search for data related to Entities.

It provides an advanced search engine that can search on any Entity field, combine multiple criteria to refine the search, and even search on nested Entity fields.

{% github Kobee1203/spring-data-search no-readme %}

There are some new features, and some fixed bugs.
But above all there was a core refactoring to support different data access layers (JPA, MongoDB, ...).
Currently, there is only **JPA** supported (which was already supported by previous versions). But the next step is to add support to **MongoDB**.

This refactoring required some modifications in the APIs.
There is a page describing how to [migrate from 1.x to 2.x](https://github.com/Kobee1203/spring-data-search/blob/master/docs/migration/migrating-from-1.x-to-2.x.md).

![Query GIF](https://github.com/Kobee1203/spring-data-search/raw/master/docs/images/query.gif)

## Whats's new:
- Allow special keywords to be used as query values:
  - _CURRENT_DATE_: keyword representing the current date. Similar to the `current_date()` function in SQL.
  - _CURRENT_TIME_: keyword representing the current time. Similar to the `current_time()` function in SQL
  - _CURRENT_DATE_TIME_: keyword representing the current date time. Similar to the `current_timestamp()` function in SQL
- Application property `spring.data.search.default-alias-resolver.field-suffixes`: Comma-separated list of field suffixes to be removed in order to create a field's alias from the `com.weedow.spring.data.search.config.DefaultAliasResolver`. Default value is `Entity,Entities`
- Improved search on fields of `Map` type: You can use the special keys `key` or `value` to query the keys or values respectively. And now, you can query on the nested fields of the Objects representing by `key` or `value`
  - /search/person?`tasks.key.name=shopping`
  - /search/person?`vehicles.features.value.name=gps`

If you are interested and want to know more, please go to the [project page](https://github.com/Kobee1203/spring-data-search#spring-data-search) where you will find all the details.
Preview my html code in iframe
Tags: javascript, html, webdev
Published: 2021-01-05 12:19:34

I had an html file contains <img src="../asserts/example.png"/>

If I show this in iframe in new tab the image is not loading as image file not exists in source pane I had that file as base64 data

Is there any library to show html preview which works similar to browser window to show my  html code preview in javascript
Using npm link in Angular9+
Tags: angular, npm, library
Published: 2021-01-05 12:12:32

---
title: Using npm link in Angular9+
published: true
description: 
tags: Angular, npm, library
//cover_image: https://direct_url_to_image.jpg
---

When building an Angular library, 'npm link' can shorten the feedback loop between the library and the application. However, if you simply build the library and link it, it will throw errors when the project starts.This is  because the application is compiled in Ivy mode, so its dependencies i.e. the linked library, should be compiled in Ivy mode too.

Here is a solution:
1. Create a new `tsconfig.lib.ivy.json` in `project/PROJECT_NAME` with the following setting. This ensures that Ivy view engine is used to compile the project whereas the library build does not use Ivy.
```javascript
{
  "extends": "./tsconfig.lib.json",
  "angularCompilerOptions": {
    "enableIvy": true
  }
}
```
2. In the library's `angular.json`, add a new configuration `ivy` under `project->PROJECT_NAME->architect->build`.
```javascript
...
"configurations": {
  "production": {
    "tsConfig": "projects/PROJECT_NAME/tsconfig.lib.prod.json"
  },
  "ivy": {
    "tsConfig": "projects/PROJECT_NAME/tsconfig.lib.ivy.json"
  }
}
```

3. Update your package.json for easy access to the following commands:

```json
 "scripts": {
    ...
    "build:ivy": "ng build PROJECT_NAME --configuration=ivy"
  }
```

4. Run npm run build:ivy. This will build an Ivy-compatible library.

5. Run `cd dist/PROJECT_NAME`

6. Run `npm link`

7. In the project, run `npm link LIBRARY_NAME` to link to the library.

Now the library is linked to the project.

**Bonus tip**: Run npm run `build:ivy -- --watch` so that the library gets rebuilt on every code change.
How to update your database through django_rest_framework.
Tags: django, database
Published: 2021-01-05 12:11:53

Last week I came across questions on how to update your database through **REST API** reason is because most of them faced one issue or the other.

Here is a snippet that works via using a *decorator*
**views.py**
```python
from rest_framework.decorator import api_view
from rest_framework.response import Response
from .models import my_model
from .serializer import mySerializer

@api_view(['GET','PUT'])
def updateDb(request, pk):
    try:
        model = my_model.objects.get(pk=pk)
    except:
        return.Response('Not Found')
    if request.method == 'PUT':
        serializer = mySerializer(model, request.data)
        if serializer.is_valid():
            serializer.save()
            return Response ("Updated")
        else:
            return Response ("Failed")
    if request.method == 'GET':
        serializer=mySerializer (models)
        return Response (serializer.data)
   
```
Weekly Challenge 094
Tags: perl, perlweeklychallenge, theweeklychallenge
Published: 2021-01-05 12:07:42

[Challenge 094](https://perlweeklychallenge.org/blog/perl-weekly-challenge-094/)

# TASK #1 › Group Anagrams

## Task

You are given an array of strings `@S`.

Write a script to group [Anagrams](https://en.wikipedia.org/wiki/Anagram) together in any random order

## My solution

This is pretty straight forward. Read the list of words, group them into a hash with the letters ordered, and then display the values of the hash. Simples.

## Examples

```
» ./ch-1.pl opt bat saw tab pot top was
[ ("saw", "was"),
  ("bat", "tab"),
  ("opt", "pot", "top") ]

» ./ch-1.pl x
[ ("x") ]
```

# TASK #2 › Binary Tree to Linked List

## Task

You are given a binary tree.

Write a script to represent the given binary tree as an object and flatten it to a linked list object. Finally print the linked list object.

## My solution

Okay, confession time. When doing these challenges. I have two rules. 1) Never read people's solutions before doing my own, and 2) Don't use modules that aren't part of Perl core. Perl doesn't have a native linked list implementation, and therefore I am intentionally skipping half this task to get the end result.

This task is similar to last week's [second task](https://perlweeklychallenge.org/blog/perl-weekly-challenge-093/#TASK2). My code is largely copied from that. Instead of storing the paths, I add to the `@digits` array as I walk the path.

## Example

```
» ./ch-2.pl < example-1.txt 
1 -> 2 -> 4 -> 5 -> 6 -> 7 -> 3
```
Why whereHas is very slow ?
Tags: laravel
Published: 2021-01-05 12:07:08

Hello ,

let me fist show you a part of my code : 
````
case 'first_name':
                        $eml = ($rule == 'or')
                            ? $eml->orWhereHas('user', function ($q) use ($condition) {
                                $q->where(
                                    'first_name','ilike','%bra%'
                                )->withTrashed();
                            })
                            : $eml->whereHas('user', function ($q) use ($condition) {
                                $q->where(
                                     'first_name','ilike','%bra%'
                                )->withTrashed();
                            });
                        break;
````

The code above works but very slow , the sql output is  using  `EXISTS` :

time response 25 seconds !!!!

````
(...)
LEFT OUTER JOIN "work_regimes" 
ON              "wra1"."work_regime_id" = "work_regimes"."id" 
WHERE           EXISTS 
                ( 
                       SELECT * 
                       FROM   "users" 
                       WHERE  "emls"."user_id" = "users"."id" 
                       AND    "first_name"::text ilike ?) 
AND             "users"."is_activated" = ? 
AND             "emls"."deleted_at" IS NULL 
ORDER BY        "id" ASC
````
When I replace `EXISTS` by `IN` the response time is very very fast 0.3 second !

I replaced `whereHas` by `wherIn` but it's not working !
Sort by timestamps (month and year) in PostgreSQL
Tags: postgres, mysql, linux, sql
Published: 2021-01-05 12:01:27

Let's understand how we can sort by a non-timezone bound timestamp value, here we will call it `timestamp_x` in table `dev_to`;

```sql
select to_char("timestamp_x", 'Month YYYY') as "month", to_char("timestamp_x", 'YYYYMM') as "monthN" from dev_to
order by to_char("timestamp_x", 'YYYYMM');
```

Let's break the query is smaller chunks and understand whats happening:

* `to_char("timestamp_x", 'Month YYYY')` will convert `timestamp_x` into its Month and Year form, for example: January 2021.
* `to_char("timestamp_x", 'YYYYMM')` will again convert `timestamp_x` into its Month and Year form, but this time it will be numeric, for example: 202101.
* `order by to_char("timestamp_x", 'YYYYMM')` will order the data by year and month (in that order as well), for example: 

```
January 2021, August 2019, March 2020
```

will be sorted as:

```
August 2019, March 2020, January 2021
```

Hence, the final output will be sorted by both month and year as desired.
Things I don’t know as of 2021
Tags: development, programming, jobs, mentor
Published: 2021-01-05 12:20:20

---
title: Things I don’t know as of 2021
published: true
date: 2021-01-05 11:56:00 UTC
tags: development,programming,jobs,Mentor
canonical_url: https://craignicol.wordpress.com/2021/01/05/things-i-dont-know-as-of-2021/
cover_image: https://craignicol.files.wordpress.com/2021/01/wp-1609625215982.jpg?w=1200
---

# _Things I don’t know_

[Last time round, I stated the things I didn’t know](https://dev.to/craignicol/things-i-dont-know-as-of-2018-4f25). Whilst the technical list hasn’t changed much, there’s a new set of skills I want to talk about for this year, as these are the things I want to know.

## How to build a diverse team

I’ve worked in plenty of diverse teams, and I’m proud that we managed to build a team from all male to 50% female in the 2 years I was at my last job, but there was a lot of unique features about that job that makes it harder to replicate elsewhere. And some of the groundwork was laid before I joined.

## How to be a good mentor

I started [mentoring via coding coach last year](https://mentors.codingcoach.io/?name=Craig+Nicol), and I’ve had to tune my approach to each individual, but I’m still not sure the best questions to ask, and what’s the best structure. If I find out, I’ll share it here.

## How to get a sleep routine

Sleep is important. But between the existential crisis of a global pandemic, with the subsequent upheaval of work processes, and the constant desire to get more done, I don’t always timebox what needs to be done, and things fall, including my blog, and my fitness. I have thoughts on how to prioritise and plan better, but I can’t control for external factors.

## How to work remotely

Whilst I’ve been used to sort periods of working from home and working with teams spread across multiple offices, this COVID lockdown is different.

I’ve learned how to work asynchronously, but there’s no good replacement for the serendipity of a chat grabbing a coffee or over lunch. Whilst I’m cautious about returning, even when we can, I definitely look forward to seeing people in the flesh again. Even if we’re wearing masks.

## Is there a better way to work?

Whilst trying to find how to work _“like this, but over video”_, I’ve started looking at how properly remote-first companies do it, reading DHH and Reinventing Work, and thinking if there’s a better way of organising work completely. Asynchronous, pull-driven, self-organised. How do open-source and open-contribution (e.g. Wikipedia) work, and are there lessons we can learn there to make companies more effective, more value-driven and more scalable?