teleren/devto huggingface dataset:
First Impressions of Test Driven Development (TDD)
Tags: devjournal, career, testing, codenewbie
Published: 2021-01-25 20:43:15

_This post was originally published on January 25, 2021 on [my blog] (https://alexlsalt.github.io/blog)._

Pssst! I send weekly newsletters about the self-taught coding journey and my own coding adventures (and misadventures!)  [Sign up here! >>](https://ladies-code-collective.ck.page/e53b5fca44)

-------

Today I spent two and a half hours pair programming with a teammate who really helped me with a big (for me) refactor and walked me through a session of writing tests on an accompanying spec (or test file).

We covered the basics of Test Driven Development (aka TDD, and also something I feel like you hear about all the time as a self-taught developer, but literally never have the opportunity to learn or use, so I’m grateful to be learning about it now).

Basically, you need to write a test before you even write your function, and you need to get the test to pass by the simplest means necessary. Like, really basic “get the function to return true by literally returning true in the function” kinda thing.

Once your tests are passing, that’s when you can go ahead and start widening the scope of the function by writing another test to check and then writing the corresponding code to ensure that *that* part of the test passes.

Interesting stuff and definitely something new to get used to!

In any case, I can see how powerful it’ll be as I continue to use it, but for now, I need to keep practicing and writing tests.
Don’t Make Me Tap Twice
Tags: debugwithme, tipstricks
Published: 2021-02-04 16:58:21

---
title: Don’t Make Me Tap Twice
published: true
date: 2021-01-25 20:24:46 UTC
tags: DebugwithMe,TipsTricks
canonical_url: https://mrmurphy.dev/dont-make-me-tap-twice/
---

I've started rough work on a new app for digital "[morning baskets](https://pambarnhill.com/homeschool-morning-basket/)". While I just used Expo when starting Storytime (another app I have in-progress), I decided to give the famous [Ignite boilerplate from Infinite Red](https://github.com/infinitered/ignite) a chance. In short, it's fantastic. In just a few days of side-work time I've almost completed a fully-functioning minimum viable product (MVP) of this new app.

But I quickly ran into that annoying situation where you're editing a text field, and you want to press the "submit" button, but you've gotta tap it twice so that the keyboard gets dismissed before you can progress.

![](https://mrmurphy.dev/wp-content/uploads/2021/01/two_taps.gif)

Thanks to a [detailed blog post](https://medium.com/react-native-training/todays-react-native-tip-keyboard-issues-in-scrollview-8cfbeb92995b) I found a quick solution. In a project generated by Ignite 6.x, we can open up `app/components/screen/screen.tsx` and find the place where `ScrollView` is used:

```
...
<ScrollView
    style={[preset.outer, backgroundStyle]}
    contentContainerStyle={[preset.inner, style]}
>
    {props.children}
</ScrollView>
...

```

All we have to do is add `keyboardShouldPersistTaps="handled"` to the props of `ScrollView`.

```
...
<ScrollView
    style={[preset.outer, backgroundStyle]}
    contentContainerStyle={[preset.inner, style]}
    keyboardShouldPersistTaps="handled" // <- Here!
>
    {props.children}
</ScrollView>
...

```

This instructs the scrollview to dismiss the keyboard if it receives a tap gesture which none of its children have handled, but to leave the keyboard alone if one of the children in the view handles the event. In my case, I navigate right after the button click, and this action dismisses the keyboard automatically anyway. So it resolves the problem for me!

![](https://mrmurphy.dev/wp-content/uploads/2021/01/one_tap.gif)
Laravel Startup
Tags: laravel
Published: 2021-01-25 20:21:43

Hi guys,
Today I learn about how to install laravel and how to create a project.
Learn about routes.
I also learn how to pass values from route to blade.php file
then I learn about @if @endif @unless and @php syntax.
I know it's not too much but I try to increase this learning day-by-day.
Combining strict order with massive parallelism using Kafka
Tags: apachekafka, microservices, java, eventsourcing
Published: 2021-01-25 19:36:21

_Getting the best of both worlds_

Having been involved in several large-scale Kafka projects for different clients across a broad range of industries, I have heard my fair share of questions on Apache Kafka — ranging from the fundamental to the esoteric. One question that never seems to go out of fashion is: _How can you maintain strict order, yet still process records in parallel?_

And it's a fair question. Strict order assumes linearizability, the very notion of which seems to contradict with the objectives of parallelism.

![One does not simply process ordered records in parallel](https://i.imgflip.com/3k02ub.jpg)

# Partial and total order
We will start by exploring the notion of _order_. 

As expected of an event-streaming platform, Kafka **preserves the order of published records, providing those records occupy the same partition**. In order to understand what this means in practice, one needs to explore the architecture of Kafka topics, and the underlying sharding mechanism — partitions.

[Read the rest of the article on Medium](https://codeburst.io/combining-strict-order-with-massive-parallelism-using-kafka-83dc1ec9be03).
Unhyped comparison of Blockchain Platforms
Tags: cosmos, blockchain, bitcoin, ethereum
Published: 2021-02-02 05:40:16

---
title: Unhyped comparison of Blockchain Platforms
published: true
date: 2021-01-25 19:30:00 UTC
tags: cosmos,blockchain,bitcoin,ethereum
canonical_url: https://medium.com/coinmonks/unhyped-comparison-of-blockchain-platforms-679e122947c1
---

[![](https://cdn-images-1.medium.com/max/1776/1*tJjn395YNAyY7Y0Ldsjxgw.png)](https://medium.com/coinmonks/unhyped-comparison-of-blockchain-platforms-679e122947c1?source=rss----721b17443fd5---4)

Each blockchain platform has a different set of capabilities, but you might not see clearly which platform will suit your needs or…

[Continue reading on Coinmonks »](https://medium.com/coinmonks/unhyped-comparison-of-blockchain-platforms-679e122947c1?source=rss----721b17443fd5---4)
Extreme Programming (XP) in SDLC, Phases of Extreme Programming (XP).
Tags: beginners, testing, devops, tutorial
Published: 2021-01-25 18:58:23

What is the **Extreme Programming (XP)**?
Extreme Programming (XP) is an agile method for software development that aims to produce software of higher quality and to increase the development team's quality of life.

*The life cycle of XP consists of five phases*:

1. **Exploration.**
2. **Planning.**
3. **Iterations to Release.**
4. **Productionizing.**
5. **Maintenance and Death.**
![Copy of Post 11](https://dev-to-uploads.s3.amazonaws.com/i/13377t54wpoxch5wr5cw.png)

**Exploration:** 
The **clients write out the story cards that they want in the first release to be included**. Around the same time, the project team is familiar with the methods, technologies, and activities they are going to use in the project.
Depending mostly on how familiar the technology is to the programmers, **the exploration phase takes from a few weeks to a few months.**
![Copy of Post 11(1)](https://dev-to-uploads.s3.amazonaws.com/i/uf6mxn79lktpf0vx9bdl.png)
 
**Planning:**
Its primary role is to **set targets and some iterative cycles for the entire project**. His vision of the product is customer tales, formulated by the client. In the **release schedule, the developers estimate and prioritize them.** The work on translating them into tasks starts after that.

**Iterations to Release:**
Includes several iterations of the systems before the first release. Each takes one to four weeks to implement. **The first iteration creates a system with the architecture of the whole system.**
This is achieved by selecting the stories that will enforce building the structure for the whole system. **The customer decides the stories to be selected for each iteration.**
At the end of the last iteration, **the system is ready for production.** 

**Productionizing:**
It needs further testing and checking of the system's output before the system can be released to the client. **New improvements can still be found, even if they are included in the latest version**, the decision has to be taken.

**Maintenance and Death:**

*Maintenance Phase:* The XP project must both **keep the system running in development after the first release** is produced for user use, while still developing new iterations.

*Death phase:* If the client **does not have any stories** to be introduced anymore. In other ways, the **device also meets consumer requirements.**
A webhook delivery SaaS
Tags: devops, startup, saas, webhook
Published: 2021-01-25 18:53:14

Hey everyone, 

[Today we are launching Gowebhook](www.bit.ly/gowebhooks)! Gowebhook is a webhooks as a service provider (WaaS). This is just a fancy way of saying that we provide software to help you deliver your webhook events to end user endpoints.

Gowebhook was founded by senior engineers who worked on building the webhook delivery system at Stripe. After experiencing just how much brainpower and engineering resources, as well as continued maintenance and operations effort it took to support a first class developer experience around webhooks ourselves, we could not believe that there was no clear market leader providing a first class webhooks delivery experience as a service.

We interviewed engineers and managers at various high growth startups and all of them had built their own webhook delivery system in house. Some of them said they Googled for a solution but couldn’t find one that seemed comprehensive enough.

As we hopped from interview to interview, we kept hearing that engineering leaders want very similar things from their webhook delivery system: retries, event configuration, reliability, security, idempotency, ability to test, etc. Some companies put together hacky, temporary solutions piling up with problems they’ve been procrastinating on fixing because they are unable to dedicate more engineering resources to providing a first class experience. 

Some companies have been gotten so used to dealing with poor webhooks providers and just assume that events will fail without retries. Users are delighted by even the most simple user experience features like the ability to configure which event goes to which endpoint because they are so used to working with unreliable, bare bones webhook providers. We think that every single startup should not have to build webhooks from the ground up themselves. 

It takes a considerable amount of resources to build and operate a first class webhook delivery system at scale and unless your product uses webhooks in some unique differentiated way, we want to help your developers save the time and effort they would need to put into running such as system so they can focus on the core product.

DM us on Twitter [@gowebhook](www.twitter.com/gowebhook) if you have any feedback or would like to use this product! You can also check us out at [www.bit.ly/gowebhooks](www.bit.ly/gowebhooks)
COVID-19 Gameathon in India from Feb 12 - Mar 12, 2021
Tags: gamedev, gameathon, hackathon, covid
Published: 2021-01-25 18:47:22

Imagine building something that solve the issues faced by people during the pandemic. A GAME that changes how people fight and overcome COVID.

AngelHack and HEART Hyderabad are hosting the biggest virtual Gameathon, sponsored by the US Consulate at Hyderabad, to enable you to join hands and build innovative games that battles the issues faced by the everyone during this pandemic.

Register now and make a team of 3-5 members to build a game that acts as an effective and accessible tool to the public in raising awareness and helping people to stay safe.

###CHALLENGES you'll solve###

####Raising Awareness####
Combating misinformation and sharing important knowledge made public by scientists and doctors around the world
####Frontline Scenarios####
Identifying solutions in effect all over the world and their varying degree of effectiveness can help distinguish between the rights and wrongs
####Prevention Measures####
Showcasing preventive measures and how they work. Explaining the idea can get more people on board
####Spread and Control####
Visualization of the spread of the virus and the effectiveness of various measures undertaken to control it can provide novel insight into government rules

###DETAILS###
Virtual hackathon: You could be located anywhere across India
Event Dates: February 12th - March 12th, 2021

###PRIZES###
1st Place: Rs. 1,00,000
2nd Place: Rs. 75,000
3rd Place: Rs. 50,000
HEART Choice Award: Rs. 50,000

Register and get started: [https://covidgameathon.com/](https://covidgameathon.com/?source=AHDEVTO)
Why do I hate external things in programming?
Tags: watercooler, productivity
Published: 2021-01-25 18:46:59

I've noticed that I can be very not productive because I hate using external things (usually tools).

For example, I have a bit of a distaste, or at the very least, feel sour when using, or looking at build tools.


Why is this though? Is this a common fear (at first)? And what causes it?
Github Easter Egg
Tags: github, git, productivity, job
Published: 2021-01-25 18:31:25

Today I found one of Github's Easter Eggs.

Go to Github and create a Repository with your username as the Repository's name

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

As the Instructions say, create this repository with a Readme.md file and make it public.

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

Now you can have a Profile with more information about yourself!

Happy Coding
Solve Leetcode Problems and Get Offers From Your Dream Companies | 
Problem 202. Happy Number(Easy)
Tags: algorithms, programming, career, codenewbie
Published: 2021-01-25 18:26:13

Problem 202. **Happy Number** (Leetcode Easy)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/hm1h2n3j5m2vsh63y0f9.png)

In this series, I am going to solve Leetcode medium problems live with my friend, which you can see on our youtube channel, Today we will do Problem Problem 202. **Happy Number**.

A little bit about me, I have offers from **Uber** India and **Amazon** India in the past, and I am currently working for **Booking.com** in Amsterdam.

## Motivation to Learn Algorithms
{% medium https://medium.com/leetcode-simplified/solve-leetcode-problems-and-get-offers-from-your-dream-companies-2786415be0b7 %}
**Problem Statement**

Write an algorithm to determine if a number `n` is happy.

A happy number is a number defined by the following process:

* Starting with any positive integer, replace the number by the sum of the squares of its digits.
* Repeat the process until the number equals 1 (where it will stay), or it **loops endlessly in a cycle** which does not include 1.
* Those numbers for which this process **ends in 1** are happy.

Return `true` if `n` is a happy number, and `false` if not.

**Example 1:**
`
Input: n = 19
Output: true
Explanation:
12 + 92 = 82
82 + 22 = 68
62 + 82 = 100
12 + 02 + 02 = 1
`
**Example 2:**

`Input: n = 2
Output: false`

## Youtube Discussion

{% youtube p57WkjyidSg %}

`
**Solution**

This is a basic recursion based problem. We need to replace a number with the sum of the square of its digits. We need to repeat this process until the number becomes 1 or it loops endlessly in a cycle. In the case of reaching 1, we should return true else false.

So to keep track of all the last encountered numbers we can use a HashSet and then we can keep checking if our current number is present in that HashSet or not. If it is present , then we immediately terminate the method and return false , else we keep on finding the sum of square of it’s digits.

The following is the [Java code](https://medium.com/javarevisited/10-free-courses-to-learn-java-in-2019-22d1f33a3915) for the given problem.
{% gist https://gist.github.com/sksaikia/3f46f77373b1618e7b701cc0a12c38fb.js %}
The [C++ code](https://medium.com/javarevisited/top-10-courses-to-learn-c-for-beginners-best-and-free-4afc262a544e) is given below.
{% gist https://gist.github.com/sksaikia/95d6dbfba5c118c8f9ee29c341e71b42.js %}
The code for this problem can be found in the following repository.
{% github webtutsplus/LeetCode %}
CSS Aspect Ratio
Tags: beginners, css, design, tutorial
Published: 2021-01-25 18:17:04

Aspect ratio is an interesting problem. How do you tackle it with CSS? Especially if you don't know the dimensions you're dealing with. CSS has a new property on the way to deal with this. We'll give this a _very_ quick look. And then, let's take a look at other ways you can handle this that currently have better browser support.

## `aspect-ratio`

CSS has a new property on the way. It's for _prescribing_ aspect ratio to an element 🙌

And it's as straightforward as

```css
.element {
  aspect-ratio: 16 / 9;
}
```

It's important to note that this property prescribes an aspect ratio. Our elements won't respect it if we define both a height and width for an element.

The [support isn't quite there yet](https://caniuse.com/mdn-css_properties_aspect-ratio) though.

Here's a [demo](https://codepen.io/jh3y/pen/OJRYmGr) to play with. It _should_ work in Chrome 88+.

{% codepen https://codepen.io/jh3y/pen/OJRYmGr %}

And here's a screencast.

{% youtube HLXneQgvCp0 %}

## The `padding` Trick

If you don't know the dimensions of your content but your content has a constrained width, you can use this. The trick is to wrap your content in a container and pad that container out using `padding-bottom`. You then absolutely position your element into that container.

```css
.wrap {
  overflow: hidden;
  padding-bottom: 56.25%
  position: relative;
  width: 100%;
}
.element {
  position: absolute;
  height: 100%;
  left: 0;
  object-fit: cover;
  top: 0;
  width: 100%;
}
```

The trick here is to work out the correct padding for your desired aspect ratio.

If the ratio was `16:9`, the padding required is 56.25%. We can work this out with

```css
aspect ratio height / aspect ratio width
```

For example, `9 / 16 = 56.25`.

{% codepen https://codepen.io/jh3y/pen/abmgRZe %}

This works because of the absolute positioning. We are letting the browser determine what height the container should be.

## Use CSS Variables

The last way works if you know one of the dimensions for your element. We can use CSS variables and `calc` to make CSS work out the element size for us. This is the gist of it.

```css
--aspect-ratio: calc(16 / 9);
--width: 400px;
--height: calc(var(--width) * var(--aspect-ratio));
```

You could swap that around so the width is being calculated. Or, you might use the aspect-ratio variable scoped when you need it.

```css
.element {
  width: 160px;
  height: calc(160px * var(--aspect-ratio));
}
```

This way has a lot of possibilities. And it's down to your design how you'd go about using this approach.

{% codepen https://codepen.io/jh3y/pen/MWjMzwW %}

And here's a [walkthrough](https://egghead.io/lessons/css-use-css-variables-to-maintain-the-aspect-ratio-for-an-element) using it.

* * *

## That's it!

That's a look at different ways to handle aspect ratio with CSS. The new way looks like it's going to be a great addition and will save us some styles.
SparkyLinux 5.13 XFCE Review
Tags: linux, debian, archlinux, laptops
Published: 2021-01-25 18:12:11

Since the introduction of Ubuntu around 2005 I have been a Linux user of various distro's, most of them based on Debian and Arch. 

In 2017 I had my first taste of SparkyLinux but I was not too impressed with the distro at the time. Two weeks ago I gave the distro another try and I must admit that my experience was a lot better. For this review I installed version 5.13 XFCE. I was actually quite impressed by the straight forward installation process, the clean startup and slick desktop.

Sparky is not too packed with tools and applications, but everything is there to get the average and more advanced user started. In this respect, Sparky is somewhere between bare-bone Debian and MX Linux, a very balanced and favorable position in my opinion.

I installed Sparky on several 3 to 8 years old laptops with 1.4+ GHz CPU's without any problems. In contrast, the latest Manjaro got stuck during installation on a few Lenovo's apparently due to graphics driver problems, which was one of the reasons for me to try Sparky.

The XFCE desktop may seem somewhat outdated to some, but it is highly customizable and with the Window compositor turned on it can still be a very attractive working environment. Add to that the modern look of the Sparky6 appearance and window theme and you have a firm Windows 10 competitor.

On some of the laptops I replaced Windows 8 and it was a relief to see how much faster Sparky booted and shut down. Performance was much better also compared to Windows 10.

Having been a Linux user for some 15 years, I know from experience that almost no distro is without problems; sooner or later you will run into some issue, often hardware related. That said, in my experience Debian and Arch based distro's usually do very well relatively speaking. SparlyLinux is another good Debian based example with the Contrib and Non-Free repositories turned on by default, which allows for a very nice and balanced Linux experience.
Day 17, 18, 19, 20, 21 of #100DaysOfCode 🤖🦾
Tags: 100daysofcode, webdev, programming
Published: 2021-01-25 18:09:42

### Made an online version of my resume using Gatsby.js

### Check out the [Repo](https://github.com/rahi-khan/resume) and [Demo](https://resume.rahikhan.vercel.app)

![resume.gif](https://cdn.hashnode.com/res/hashnode/image/upload/v1611598340595/YVDq0y51t.gif)