teleren/devto huggingface dataset:
Grid based full page showcase layout
Tags: codepen
Published: 2019-12-10 14:37:44

<p>Trying to visualise an idea I had in this pen of a series of images that fill the screen in either columns or rows depending on resolution. Could be used as a splash homepage for some kind of design oriented site and could be combined with a responsive menu in the smallest resolution. Kind of works on non-grid supporting browsers but it's not overly pretty there.</p>

{% codepen https://codepen.io/abeeken/pen/rNaeaXm %}
Daily Challenge #134 - Rice and Chessboard Problem
Tags: challenge
Published: 2019-12-10 14:35:22

---
title: Daily Challenge #134 - Rice and Chessboard Problem
published: true
series: Daily Challenge
description: A fun puzzle with exponents.
tags: challenge
---
I'm not sure how many of you are familiar with the ancient rice and chessboard problem ([Wikipedia](https://en.wikipedia.org/wiki/Wheat_and_chessboard_problem) calls it wheat for some reason) but here's a quick recap for you: a young person asks, as compensation, only 1 grain of rice for the first square, 2 grains for the second, 4 for the third, 8 for the fourth and so on, always doubling the previous.

Your task is pretty straightforward: Write a function that, given an amount of grain, calculates to which square one needs to land on to reach at least that amount of grain. 

As usual, a few examples might be way better than thousands of words from me:
`squaresNeeded(grain) === chessboard square`
`squaresNeeded(0) === 0`
`squaresNeeded(1) === 1`
`squaresNeeded(2) === 2`
`squaresNeeded(3) === 2`
`squaresNeeded(31) === 5`

Input is always going to be valid/reasonable: a non negative number.

**Test Cases:**
`squaresNeeded(128) === ?`
`squaresNeeded(4000000) === ?`
`squaresNeeded(32768) === ?`


Good luck, happy coding!
***
_This [challenge](https://www.codewars.com/kata/5b0d67c1cb35dfa10b0022c7) comes from GiacomoSorbi on CodeWars. Thank you to [CodeWars](<https://codewars.com/>), who has licensed redistribution of this challenge under the [2-Clause BSD License](<https://opensource.org/licenses/BSD-2-Clause>)!_

_Want to propose a challenge idea for a future post?  Email **yo+challenge@dev.to** with your suggestions!_
Micro Frontends Architecture - The future of frontend development
Tags: microfrontends, webdev, vue, react
Published: 2019-12-10 14:26:15

In the last years, **microservices** have exploded in popularity, and many companies are using them to avoid the limitations of large, monolithic backends.

But today many companies continue to struggle with monolithic frontend codebases.

**Micro Frontends come to help!**

##What are Micro Frontends?
The term Micro Frontends extends the concepts of microservices to the frontend world.
With Micro Frontends we can think about a website or web app as a composition of features which are owned and developed by independent teams.
Each team develop its features independently.
When I say Independently, I mean also using **different technology stacks** if the teams prefer.

To see a practical example and find out which big companies are already using this architecture, read the full article on Medium 👇

{% medium https://medium.com/notonlycss/micro-frontends-architecture-1407092403d5 %}
Cryptocurrencies 
Published: 2019-12-10 14:24:28

cryptocurrencies 

https://bulwarkcrypto.com
bitkincoin.com
limracoin.com
vulcanocoin and many more

Hello,

I have been working in the Blockchain industry since past 6+ years and has trained 100+ blockchain professionals.Currently i lead a team of 10 professionals to build the best blockchain solutions. With thousands of satisfied clients and his never ending hunger for exploring new technologies.
I am looking forward to work on your this project. Thank you
Acelere a sua carreira em programação com o AceleraDev!
Tags: challenge, career, hiring, theycoded
Published: 2019-12-10 13:52:00

Tornar a educação tecnológica financeiramente acessível, disponível em todos os lugares e orientada às necessidades de mercado - este é o grande objetivo da Codenation!

Por isso, criamos o AceleraDev - programa de capacitação em tecnologia - e a plataforma Codenation, onde o aprendizado está centralizado.

Todas as edições do AceleraDev abordam uma tecnologia em específico, são gratuitas aos participantes e têm uma empresa apoiadora, dando bolsas de estudos e com intenção de contratar os destaques da turma (algumas das empresas que já apoiaram: QuintoAndar, Guiabolso, Serasa Consumidor, Escale, Loadsmart, Magazine Luiza, entre outras).

No vídeo a seguir, você poderá ter uma prévia de como funciona uma edição presencial do AceleraDev!

Acesse o vídeo: https://youtu.be/5gD2zeEqAQs

Ficou com vontade de participar? Acesse nosso site e confira quais acelerações estão com inscrições abertas no momento!
Is Unit Testing Overrated? 
Tags: discuss, testing
Published: 2019-12-10 13:35:20

Throughout my career, I've come across a lot of colleagues who think unit testing is overrated. This bugged me because I love unit tests. I believe they form the backbone of your [test automation strategy](https://www.simform.com/test-automation-strategy/). 

However, I later realized that this was due to the reason that a lot of them weren't doing it right! Once they started doing it right and saw the difference between unit tests and several other tests, things started changing. Especially what type of tests to perform at required places, a lot of them got to know the difference between beginning things without the real execution and understanding it through personal experiences. 

Anyways, if you're one of those who think unit tests aren't worth the attention they get, think twice. Here are my three primary reasons for which I won’t underestimate unit testing in my test automation strategy. 

**1. The proactive need:**

Detecting the bugs at the very initial phase is one such proactive step. A lot of software and apps are built without knowing the bugs residing at their quiet corner and turning out to be massive disasters later. 

For avoiding such potholes, unit testing works as the backbone of automation testing. For the organization’s building highly scalable software products, it is hard-earned efforts getting veined if the detection of bugs happens at the critical stages. 

Unit testing does the early detection of bugs, which profits the overall project development and puts the organization’s efforts into optimizing the process with less time and better quality. 

**2. The AAA pattern:** 

Unit testing follows the strict AAA pattern stating Arrange, Act, and Assert section. These three sections regularly work for arranging the collaborator modules, preparing for the results that can be observed, and checking whether the result is matching the expectations. 

Unit testing has this distinct pattern for making test code easier since it better separates the testing stuff and related steps. It predominantly helps in performing regression testing smoothly. 

**3. Refactoring & flexibility:**

Developers won’t find it difficult to implement the changes in existing code because of the refactoring facility of automated unit testing. Test automation allows the developers to update the software without impacting the design and overall quality of the software. 

Again, it keeps everyone informed by pointing out the bugs in separated modules. Even novice developers can understand the code. Not to mention the quick fixing quality of unit test automation, which makes software products favorable to the users. 

What has been your experience with unit tests? I'd love to know. Connect on Twitter [@HirenDhaduk_](https://twitter.com/HirenDhaduk_) to carry this conversation or comment below.
Matt's Tidbits #46 - Scratch files
Tags: mattstidbits, android, androidstudio, tidbittuesday
Published: 2019-12-10 13:17:44

[Last week I wrote about creating a private token class.](https://medium.com/@matthew.b.groves/matts-tidbits-45-creating-a-private-token-class-49a03c9b6e69) This time I wanted to share a neat feature I recently learned about to help facilitate experimental development!

Every week I receive a copy of the Android Weekly email, which contains many articles about the latest trends in Android development. If you don’t subscribe to it already, you can sign up here:
https://www.androidweekly.net

In a recent issue, I read a very interesting article describing Android Studio’s support for Scratch files. This really useful feature allows you to add experimental code that doesn’t pollute your Git repo, yet still has access to all of the libraries/code in your project! I’ve found this really helpful in being able to experiment with new code that I just want to try out or know I’m going to throw away — with the convenience of not having to create a new sample project or risk accidentally checking it in.

Jetbrains has more information on this feature here: https://www.jetbrains.com/help/idea/scratches.html

Perhaps most impressively, Scratch files have an interactive mode where you’re able to preview code output on the fly in the editor — in addition to being able to run and debug the code too.

The original article that inspired this tidbit is: https://zdominguez.com/2019/11/21/scratch-files.html

I encourage you to try this feature out, and let me know in the comments what other interesting use cases you come up with for this! And, please follow me on Medium if you’re interested in being notified of future tidbits.

Interested in joining the awesome team here at Intrepid? [We’re hiring!](https://www.intrepid.io/careers)

*This tidbit was discovered on December 6, 2019.*
Convert Specific String to Binary. 
Tags: python
Published: 2019-12-10 13:09:07

Many people they tend to forget the basics of converting things from a specific data types to another data type like converting from integer to Binary or characters to Binary. 

Is important to use Convertions especially when dealing with AI and ML.

Eg:
```python
   a = 8
   binary_form = format(int(a), 'b')
   print(str(binary_form), end='') 
```

Result:

```
   1000
```

The built-in function format() is used to format string using a controlled by specifier. If want to learn more about this go to:https://www.programiz.com/python-programming/methods/built-in/format

The syntax is:
```python
    format(value, spec='') 
```

Now we have dealt with converting integer to Binary. 

But now we are going to deal with converting characters to Binary this will help with Creating chatbot using binary algorithm I am about to drop soon. 

Let's say we have a sentence 'hello world' and want to convert it Binary so our bot can find a perfect response that is smart.

Text: hello world
>Step 1: convert the phrase to a list of individual characters

```python
   hello_world = 'hello world'
   char_list = [x for x in hello_world]
   #There are many ways to do this but
   #you can use any ways. 
   #I believe this is not the best
   #way to convert to character list
   print(char_list)
```
Results:
```
   ['h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd'] 
```

>Step 2: Convert each character to an integer using built-in function ord()

```python
   #Create a temporary list to store 
   #integers
   temp = list()
   
   #now loop in the list of chars
   for character in char_list:
       temp.append(ord(character))
   
   print(temp)
```
Results:
```
 [104, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100]
```

>Step 3: Convert each element in to binary

```python
   #we need a second temp list
   #lets call it temp2
   temp2 = list()
   for digit in temp:
       bin_format = format(digit, 'b')
       temp2.append(bin_format)
   print(temp2)
```
Result:
```
['1101000', '1100101', '1101100', '1101100', '1101111', '100000', '1110111', '1101111', '1110010', '1101100', '1100100']
```

I shared this post to understand the process behind convert character to Binary. I know this may not be the best solution but it got the job done. Now is up to you to find yourself the best solution
How to: effectively test DB, debug in production & create game day tests
Tags: todayilearned, database, testing
Published: 2019-12-10 13:05:30

*TL;DR notes from articles I read today.*

### [The big bad guide on database testing](http://bit.ly/344kSLx)

- Check for data mapping, ACID properties and data integrity of your DB, and ensure they implement your business logic accurately.
- The most common test techniques are transactions for the ACID properties, checks of keys and indices, parameters and results of stored procedures, evaluation of triggers and field constraints, etc. 
- Stress testing and performance testing are critical too. 
- SQL queries are the most reliable way to qualitatively test apps with low or medium complexity.
- Use a database testing tool that considers the business, data access and UI as well as the database itself.  

*[Full post here](http://bit.ly/344kSLx), 8 mins read* 

---

### [7 debugging techniques to speed up troubleshooting in production](http://bit.ly/357888b) 
- Remove or automate all the configuration needed to run the app by taking advantage of containerization and aiming for zero configuration. 
- Don’t fall into the tech stack soup trap. The fewer technologies or ‘right tools’ you use, the better, to avoid a pile of dependencies.
- Use 80% of your logging for 20% of your most important code (the parts used the most).
- Make it simple and quick to replicate customer issues. Use a tool to import only the records needed from the production database to your machine.
- Place breakpoints in obvious places in the application, with one easily locatable method per UI event.  

*[Full post here](http://bit.ly/357888b), 7 mins read*

---

### [Four steps to creating effective game day tests](http://bit.ly/2EemFU1)

Game Day tests deliberately trigger failure modes in production systems to practice response to unpredictable situations. 
- List all potential failure scenarios. Consider which parts of your infrastructure are completely safe, what are your blind spots, what happens if a server runs out of space or in case of a DNS outage or DDOS attack.
- Create a series of experiments to anticipate how things will break - what side effects may be triggered, whether alerts will be correctly dispatched, whether downstream systems may be affected.
- Test your human systems. Consider how team members need to interact when an incident unfolds. 
- Address the gaps and patch any holes you find. Check which hypotheses held up in practice and which ones did not. Establish a plan to correct these and run a new game day test to check whether your hypotheses are now valid. 

*[Full post here](http://bit.ly/2EemFU1), 6 mins read* 

---

*[Get these notes directly in your inbox every weekday by signing up for my newsletter, in.snippets().](https://mailchi.mp/appsmith/insnippets?utm_source=devto&utm_medium=post08&utm_campaign=is)*
⚡ Why Engineers need to master Data Structures and Algorithms ?
Tags: webdev, career, beginners
Published: 2019-12-10 11:56:31




![Common Data structures and Algorithms](https://cdn-images-1.medium.com/max/3000/1*jE8PaPEJCHa204hLgIX9Jg.jpeg)

You people may have heard some people saying that “There’s no need to learn DS and Algos” or “They are just waste of time” and similar things.

And I personally believed in the same thing. That’s why I didn’t pay too much attention to DS in my University time.

But going forward, I noticed that some of my colleagues and friends who were good at those concepts were more better at understanding of different concepts and quickly grasped frameworks and libraries than me.

*What is the reason ?*

Because most concepts in Computer Science are same. Terminologies mostly mean the same thing. What changes is the syntax and a bit of terms which are specific.

Let us see :

**Why on earth you as an Engineer should know DS and Algos ?**

## 1. In-Depth Understanding of Data :

![](https://cdn-images-1.medium.com/max/3600/1*QBZ2huXkUAbz5zAj1yr5PQ.jpeg)

You know computers deal with data and we as Engineers do the same. Data is bread and butter of our life. We cannot neglect it. Engineers with good understanding of DSA are good at managing, sorting and storing data. They know efficient techniques needed to do any operation on data. They know which pattern to follow when making data driven applications.

## 2. Better Understanding of ‘new’ frameworks :

![](https://cdn-images-1.medium.com/max/2000/1*k7pnp9i5TxvYWZiac3CbXQ.jpeg)

In the modern world of programming, we daily see a number of frameworks coming in and going out. The person with a good command on Data Structures and Algos is better in grasping the concepts. On the other hand a person, who doesn’t have enough knowledge will master one framework and then may not be able to port the same concepts to a new framework.

## 3. Programming Paradigms & Architectural Decisions :

![](https://cdn-images-1.medium.com/max/2000/1*CVjIAGomT5qzoGpIGkqZ9A.jpeg)

A person with better understanding of Core CS concepts has an edge over his counterparts in decision making and architecture. He know whether he has to go with Reactive Programming or FP. Whether this particular problem needs Singelton pattern or Factory design. That thing is important too.

Now it’s your turn!
 
**What do you think of Data Structures and Algorithms ?**
**How it’s expertise can help Engineers at work ?**
**How Engineers can be more proficient in DS ?**

Leave your comment below!

Thank you for reading! 🙏

Don’t hesitate to follow me.

I regularly write about tech, data science, startups and innovation at work.
Patterns to refactor thick ActiveRecord models
Tags: rails, activerecord, ruby, decorators
Published: 2019-12-10 11:32:47

There are several ways to refactor your thick `active record` models, but in this post, we will be talking only about one pattern which has helped me a lot in taking out responsibilities from the model.

This pattern is known as the [Decorator Pattern](https://en.wikipedia.org/wiki/Decorator_pattern).

In simple terms, this pattern is about adding responsibility to an object at runtime.

Let's see an example to understand this pattern in Rails context.

Suppose you have a `project` model with different types of projects like `in-house` projects and `third-party` projects. A project can be started if certain conditions are met, otherwise it should not start and the condition for starting a project depends on its type.

How would we go about writing this logic?

One approach is to define a `start` method in the `project` model and check the type of project and then make a decision whether to start the project or not.

```ruby
# project.rb
class Project < ApplicationRecord
  def start
    if type == 'in-house'
      # do checking whether the project can be started or not for an in-house project
    elsif type == 'third-party'
      # do checking whether the project can be started or not for third-party project
    end
  end
end
```

But there is one problem with this approach, it will violate the `open-closed` principle when new project types will come. Moreover, it will also make the `project` model thick with more project types.

So what can we do about it?

We can move the logic for the start method to another object and just wrap the `project` object with this object to check whether the project can be started or not.

This pattern will not solve the `open-closed` violation(more on that in a later post...) but it will help in making the project model a bit thin.

To do that first we have to define a `decorate` method in the `project` model.

```ruby
# project.rb
def decorate(klass = ProjectDecorator)
  klass.new(self)
end
```

And then, we would obtain the decorated project object by calling this method from wherever we wanted to check whether we can start the project or not.

```ruby
# project_start_service.rb
def execute
  project.start if project.decorate.can_start?
end

#project_decorator.rb
class ProjectDecorator < BaseDecorator
  def can_start?
    if type == 'in-house'
      # check start constraint for in-house project
    elsif type == 'third-party'
      # check start constraint for third-party project
    end
  end
end
```

In the above example, we are checking whether we can start the project or not from the `project_start_service.rb` by calling `project.decorate.can_start?`, the `can_start?` method is defined on the `project decorator` and contains the logic of checking whether to start the project or not.

With the above pattern, we would be able to move out related responsibilities out of our model. This would improve the `readability` and these small decorator objects will have only a single well defined responsibilities.
Dancing Skeletons
Tags: devops, architecture
Published: 2019-12-10 11:21:18

<i>This post originally appeared on [jhall.io](https://jhall.io/posts/dancing-skeletons/).</i>

You're building a complex piece of software. Then it comes time to deploy, so you spend a couple weeks stuffing it into a Docker container or a .deb or .rpm package, and debugging the build and deployment process. Then you add some sort of monitoring or logging, set up email or SMS alerts to tell you when it crashes, and probably a dozen other things to make it "production ready."

After I ran through this whole process a few times, I developed a better approach.

Today I learned that approach is a pattern. And it has a name.  (I guess those two are roughly synonymous.  A pattern is only a pattern once it has a name, and once something has a name, it becomes a pattern--even if it's only ever existed once, or even zero times... but I digress.)

Not only does it have a name. It has a great name, and I just want to share it.

# The Dancing Skeleton

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/7uevq6tbrrk2yrgihb7w.jpg)

Dan North, in [this video](https://www.youtube.com/watch?v=EauykEv_2iA&t=57m2s) explains that a Dancing Skeleton is a big, elaborate Enterprise "Hello, World" application.

I actually started a project at my last job called "Hello World" based on this exact principle. The idea is, you build an app, complete with logging, alerting, API calls, front-end widgets, deployment scripts, CI/CD pipelines, and all.  But it doesn't do anything. It's just a skeleton app.

It's a dancing skeleton!

Once the skeleton is complete, the useful bits are added later. And then your software is always deployable and always working in its intended production environment. It's enables continuous delivery from day 1. YAY!

Now that I know this name, my next such Enterprise "Hello, World" project will be much more creatively called "dancing skeleton", of course!
this video really helped me on learning
Tags: html, beginners
Published: 2019-12-10 11:12:12

this video really helped me on learning HTML as a beginner in web development, if you are an absolute beginner do well to check out this video. am about learning css guys😍😍🥳🤩😎👻✌
Click on the link to watch video on YouTube 
👇👇👇
https://youtu.be/Q5OEwVmyjXo