teleren/devto huggingface dataset:
Time Management: My Tips and Tricks
Published: 2020-04-17 18:11:11

I always considered myself someone who was really good at working from home. During my years in ecommerce, I was on-call at all hours of the day and would frequently get calls at 3am when errors would be found around 6am eastern time by customers or midnight when we pushed our code live. In a profession whose job can be entirely completed online, I only really valued the in-person setting of work because it allowed me to see my colleagues and discuss and plan our next steps. In a post-COVID world, I am definitely beginning to doubt these assumptions and realize that to compensate I have found I need to implement my own structure to be successful.

One of the initial challenges I found with WFH has stemmed from time management. Full disclosure: I am on the job hunt as my primary task as I graduated from school in February right when the pandemic was taking off. Before the pandemic, I was commuting to a WeWork space daily and working with a few colleagues from my graduating class in software engineering. There was structure here and, importantly, there was variety in how I could pursue my work. I could dedicate an entire day working on a collaborative project or I could complete a grab bag of tasks related to my career search. Now that work is entirely remote however, if I focus on just one task during a day, I find myself seeing the day run together.

https://gph.is/2jccsAD

The options on what I can do each day are already limited and the best way to combat this in my humble opinion is to make a schedule. My favorite has been to schedule in 2-2.5 hour increments and generally looks like a variation of the following:

-7:30-8:30 Its time to run with the dogs
-8:30-11 I will code or refactor some of my side-projects
-11-1 will be dedicated to look for jobs I fit and apply to them
-1-1:30 Lunch
-1:30-4 Complete algorithms on LeetCode
-4-5 Watch instructional videos

Another scheduling task that helps me be successful is actually scheduling my non-work goals. I hate feeling like I don't know what day of the week it is, so my wife and I put up a whiteboard in the kitchen with our daily work goals and non-work tasks. For instance, I have dedicated this week to  using the old bricks that came with our house and completing a pathway through our garden. Just having another physical project ever day after work helps me be more productive during the day.

Finally, I make sure I have a hard scheduled stop. I end every day at 5 o'clock and make sure I don't put it work after this point and also do not pursue non-work tasks when it is the middle of the work day. I have a dedicated work room so I change my mindset when I get inside and I know that the only thing I can do in there is work.
Write assertions for Java LocalDate/LocalDateTime with AssertJ library
Tags: java, tutorial, testing
Published: 2020-04-17 19:36:00

---
title: Write assertions for Java LocalDate/LocalDateTime with AssertJ library
published: true
description: 
tags: java, tutorial, testing
cover_image: https://images.pexels.com/photos/2565919/pexels-photo-2565919.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940
---

Hello! This post explores most common situations on asserting Java date/time entities using AssertJ library.

## Common date/time assertions

This section presents assertion methods to assert _LocalDateTime_ instances, introduced since Java 8.

### LocalDateTime is before

Techincally, to check that the given _LocalDateTime_ entity is before another one, it is possible to use two approaches:

* Create predicate that uses _isBefore_ built-in method
* Use _isBefore_ assertion

Take a look on the code snippet below, which demonstrates both cases:

```java
@Test
public void beforeTest(){
    LocalDateTime date = LocalDate.of(1992, 2, 14).atStartOfDay();
    assertThat(date).matches(d -> d.isBefore(LocalDateTime.now()));
    assertThat(date).isBefore(LocalDateTime.now());
}
```

### LocalDateTime is after

Likewise with the previous situation, to assert that the given date/time object is after another, it is possible to follow two ways:

* Create predicate that uses _isAfter_ built-in method
* Use _isAfter_ assertion

This code presents both approaches:

```java
@Test
public void afterTest(){
    LocalDateTime now = LocalDateTime.now();
    LocalDateTime after = now.plusDays(10);
    assertThat(after).matches(d -> d.isAfter(now));
    assertThat(after).isAfter(now);
}
```

### LocalDateTime is equal to another DateTime

When it comes to validation of equality, you have to remember that _LocalDateTime_ contains information both about date and time. However, AssertJ allows to check only date entry, ignoring time information. We can summarize equality assertions as following:

* Use _isEqualTo_ assertion, which checks both date and time
* Create predicate that utilizes _isEqual_ implementation of LocalDateTime entites
* Select method that will compare only date and ignore time entry: _isEqualToIgnoringHours_, _isEqualToIgnoringMinutes_, _isEqualToIgnoringNanos_, _isEqualToIgnoringSeconds_.

Consider the following code snippet below, which shows mentioned approaches:

```java
@Test
public void equalsTest(){
    LocalDateTime date1 = LocalDate.of(2013, 3, 5).atStartOfDay();
    LocalDateTime date2 = date1.plusHours(12).plusMinutes(30);
    assertThat(date1).isEqualToIgnoringHours(date2);
    assertThat(date1.plusHours(12)).isEqualToIgnoringMinutes(date2);
    assertThat(date1.plusHours(12).plusMinutes(30)).isEqualTo(date2);
    assertThat(date1).matches(d -> d.isEqual(date2.minusHours(12).minusMinutes(30)));
}
```

## Source code

You can find the full source code for this post in [this github repository](https://github.com/mednikoviurii/mednikov-datastructures). If you have questions regarding this post, don't hesitate to contact me. Have a nice day!
How to use styles when publishing a react component to npm?
Tags: help, react
Published: 2020-04-17 19:19:05

Hey folks,
I'm a newbie to react and this is my first time publishing to npm. I created a react component and wanted to put on the npm registry.

I used `create-react-library` to build the component and published it to npm. Everything functions perfectly fine when I install my new npm package as a dependency in another react app, but there is no CSS applied to the component

Below image shows my folder structure
https://dev-to-uploads.s3.amazonaws.com/i/nkcwo2a2kd9v1p5mrizy.png

How do I enable/apply styles for the package?

Here's the npm package for reference
https://www.npmjs.com/package/react-step-progress

Thanks
Would you use redux or another state management in 2020?
Tags: discuss, react, webdev
Published: 2020-04-17 19:12:22

Hi everyone,

I am interested to know if in your react workflow would you use Redux or another state management in 2020?

If you are using something else why are you using it, because it has a smaller footprint and boilerplate or because it is new?

Update: I am considering to try state machines for my project [xstate](https://xstate.js.org/docs/) - not scalable(need more research)

Also, it seems that redux wrappers are on the rise so:
- [rematch](https://github.com/rematch/rematch)
- [easy-peasy](https://github.com/ctrlplusb/easy-peasy)

If anyone wants to add more to this discussion please feel free to do so.

Thanks in advance for all participants to this discussion
The cons and pros of creating a drag and drop page builder from scratch? (React, Vue, Angular)
Tags: discuss, webdev
Published: 2020-04-17 19:08:04

Hi everyone,

Would you build a drag and drop page builder from scratch or would you go with an open-source solution?

Do you have any concerns regarding the updates with an open-source solution?

How would you store the generated code in json or html? (if you build your own solution)

Thanks for any experiences you can share about implementing something like this.
New Feature: Response Templates!
Tags: changelog, meta
Published: 2020-04-17 19:06:16

I'm excited to announce a new feature we've been working on: response templates!

This feature was first requested by our community moderators.  They explained that they were regularly finding themselves running into situations where they would need to reply with a similar type of comment.  For instance: welcoming a new member, explaining the usage of a tag, describing how a site mechanic works, or providing any other type of similar constructive feedback. We’re even providing a special option that allows trusted moderators to reply as [Sloan](https://dev.to/sloan), our community mascot.

However, using response templates isn’t just for moderators.  _All community members_ can take advantage of the feature to help save time when posting comments.  Hopefully this new functionality helps you save time if you find yourself frequently sharing similar tips, posting a list of resources, etc.

To set your response templates, you can visit your [settings page.](https://dev.to/settings/response-templates)

How exactly do you use a response template? In a comment form, you'll see a new "document" button. Click that, and it will show your response templates available to use:

![](https://dev-to-uploads.s3.amazonaws.com/i/4qusfosiuq1r77foto8l.png)

Once you click insert, it will paste the template into the comment form. If you have something written already, it will ask you if you want to overwrite it.

Next up, we'll be adding this feature to help support our tag moderators as they make [tag adjustments](https://dev.to/tag-moderation).

As always, we're open to suggestions on how to make improvements here. Please feel free to [open an issue](https://github.com/thepracticaldev/dev.to/issues/new/choose) if you have any comments or questions, or leave a comment on this post.

Happy coding! ❤️
Ember Meeting - Conference calls with notes
Tags: twiliohackathon, python, webdev
Published: 2020-04-17 19:04:09



Meetings and conference calls are a part of what makes any project successful. When you are dealing with team members that are working remotely (like we all seem to be doing recently) keeping your calls short and your notes updated is critical to staying on track. Having spent my fair share of time on these calls I have always thought of ways that it could be improved and optimized for better results. 


## What I am building
### Ember Meeting

Projects and ideas are like a fire, they require attention to keep going. Embers are small piece of a dying fire, give this ember some fuel and you can build a bonfire. 

Ember Meeting is the result of the frustration that I suffered as a conference host and user. It combines a conference call control panel with a note taking application.

## Features
- Live participants feed
- Conference controls
  - Mute/unmute all guests
  - End the conference
  - Record the call
- Meeting agenda
- Create meeting notes from agenda
- Send summary of the call and notes via email
- One click mobile dial into conference 



![Ember_Meeting](https://dev-to-uploads.s3.amazonaws.com/i/puhbs876tdx88nw1wt8n.png)


## How I am builing it 
- Python
- Flask
- Bootstrap
- Twilio Conferences
- Twilio Caller ID
- Twilio SendGrid

## Designing a web interface

My goal is to build something that is easy to use. I connect to a lot of calls while on my phone (sometimes while walking the dog). Being able to manage the calls that I am hosting from my mobile device is a must have feature. Using the bootstrap feature makes sure that this will be responsive across platforms and screen sizes. Using Bootstrap and font awesome made building touch friendly UI elements quick. 

### Agenda
![Agenda](https://dev-to-uploads.s3.amazonaws.com/i/dftcp7gig6vqhq91qasw.png)
Staying on topic is important to make sure that you meeting is completed in a timely fashion. The call agenda allows for creating and assign call topics to the responsible user. Once you have your agenda ready to can copy all items to your notes field and use it as a template to create your meeting minutes.

### Participants
![Participants_Feed](https://dev-to-uploads.s3.amazonaws.com/i/1wtw42mlcy8njxyaz48k.png)
Shows a live feed of who is on the call with caller ID and label support.

### Meeting Controls
![Meet_controls](https://dev-to-uploads.s3.amazonaws.com/i/gpsbmyro3x69w8hwxguc.png)
Uses bootstrap buttons to control the conference call.


### Notes and action items
![Notes](https://dev-to-uploads.s3.amazonaws.com/i/rj9pu0agh4a2am8cs46r.png)
The notes field allows for quick call notes to make sure you are not missing anything important. Action items allows for quick bullet points as to the next steps you need to take.
Quick thought on Crystal
Tags: crystal, languages, programming
Published: 2020-04-17 18:56:39

So I just realized something about the Crystal language...

It has the most "magic" I've seen in a compiled language. Usually magic features in programming languages show up in scripting languages. I'm talking about things like [monkey patching](https://stackoverflow.com/questions/5626193/what-is-monkey-patching) and I usually get too fancy and dig myself a massive hole with that kind of stuff.

Here's some Crystal magic I just discovered in my live stream:

```crystal
get "/" do
  key_value_pairs = [] of {String, String}
  db.each do |key, value|
    key_value_pairs << {key, value}
  end
  render "src/views/index.ecr"
end
```

That renders a template, and makes sure that `key_value_pairs` is available in it. Most languages can do that, so it's nothing special.

Crystal's magic is that if you try and use `key_value_pairs` wrong - like as a `HashMap` - the compiler will yell. If you try to use a variable that you didn't pass to the template, the compiler will yell as well. Magic!

>If you're, this magic was brought to you by [macros](https://crystal-lang.org/reference/syntax_and_semantics/macros.html)

Mad props for fitting this kind of magic into a compiled language!
Hello-world
Tags: hello
Published: 2020-04-17 18:53:20

``` javascript

module.exports = () => {
  con$o.woodlog(`
    Hello, I am new here and I (was) a front-end developer. I prefer space over tab, and 2 spaces over 4 spaces. I am shy and am glad to be here, can't wait to meet new guys. Merci!
  `);
}


```
The most complete bad word dataset on the internet, and using it in my Python application
Tags: database, python, sql
Published: 2020-04-17 18:46:49

We published the most complete bad word dataset on the internet. I wrote a blog post about importing our bad-words dataset to DoltHub and using it in a simple python application called chat-bot-profanity-filter.  

Check out the blog here: https://www.dolthub.com/blog/2020-04-16-f-you-in-4-languages/ 

As I mention in the conclusion, if you find any bad words we're missing, email me katie@liquidata.co and I will give you write permissions to contribute!
Crystal Fridays!
Tags: programming, crystal, livestream, screencast
Published: 2020-04-17 18:43:15


If you've been following my [Twitch](https://twitch.com/arschles) you've probably seen that I'm doing "Crystal Fridays" live streams for the past few weeks.

>Catch me every Friday at 10am US Pacific time [on Twitch](https://twitch.tv/arschles)

## What is Crystal Fridays?
The premise is simple. I live code writing apps in [Crystal](https://crystal-lang.org). Currently I'm working on [cprox](https://github.com/arschles/cprox) - a simple URL shortener that's implemented with a [little persistent key-value store](https://github.com/CodeSteak/Nuummite).

>If you don't know about Crystal, it's a language that looks like Ruby but it's _compiled_. I'm really enjoying it and I encourage you to check it out if you have a spare moment.

## Join me!
If you're interested in participating in Crystal Fridays, come watch me live code:

- **When: 10am US Pacific Time**
- **Where: [twitch.tv/arschles](https://twitch.tv/arschles)**
    - Tip: you can use [time.is/compare](https://time.is/compare) to find out what time that is in your time zone

## Recordings

I record every Crystal Fridays stream and upload it to [YouTube](https://www.youtube.com/playlist?list=PLd5PS0DQ17GBxMQ78nmowkAxilgS_LrNB), so you can catch up if you miss one.

Videos should be up shortly after each stream.
The largest number problem
Tags: javascript
Published: 2020-04-17 18:22:48

Today I'm sharing a simple solution to the [largest number problem](https://leetcode.com/problems/largest-number/) on Leetcode.

The problem statement asks us to sort a given list of positive integers such that it forms the largest possible number, returning it as a string. 
In the examples provided, we  see that with the input ``[10,2]`` the expected output is ``"210"`` and with ``[3,30,34,5,9]`` it's ``"9534330"``.

At first glance, I thought that the default dictionary ``sort()`` we get for "free" in JS and the Array ``reverse()`` method would do the trick because of the implicit type coercion that often surprises people. See, if we have an array ``nums = [10, 2]``, then ``nums.sort()`` will output ``[ 10, 2]`` because Javascript compares "10" to "2" as strings, not as numbers. This means that ``nums.sort().reverse().join('')`` outputs ``"210"`` which is in fact the ~~droid~~ largest number we are looking for.

There's a catch though, the largest number possible from an array of integers isn't the same as the array lexicographically sorted in descending order. For instance, ``nums = [3, 10, 2, 1, 100]`` once sorted, reversed and formatted into a string returns ``"32100101"`` but the highest possible number is ``"32110100"``!  

Here's what I came up with: 

```js
var largestNumber = function(nums) {
  if (Math.max(...nums) == 0) return '0';   

  const res = nums.map(String).sort((a, b) => {
    if (a.length !== b.length) {
      const aStr = a + b;
      const bStr = b + a;
      return bStr - aStr;
    }
    return b - a;
  }).join('');
    
  return res;    
};
```

//Runtime: 60 ms, faster than 91.89% 
//Memory Usage: 35.3 MB, less than 100.00%
NRWL-NX Quick Introductions
Tags: nrwl, nx, nrwlnx, nxtutorials
Published: 2020-04-17 18:20:30

<b>What is NX ?</b>
Nx(Narwhal extension) is not a replacement of angular CLI, it is just an extension for the Angular CLI implementing monorepo-style development. It is an open-source toolkit created by Ex Googlers at a company called Narwhal for enterprise applications. It is also a collection of runtime libraries, linters, and code generators, which is helping large teams build better with Angular.

<b>NX Workspace</b>
A NXworkspace contains our Angular applications and libraries we create. Nx is not a replacement of Angular CLI, it just adds some extra capabilities to Angular CLI, so finally we can say an Nx workspace is an Angular CLI workspace.

<b>Creating a New Nx Workspace</b>
npx create-nx-workspace@latest workspacename --preset=angular //Using npx
npm init nx-workspace workspacename --preset=angular //Using npm init
yarn create nx-workspace workspacename --preset=angular // For Yarn

<b>Conclusion</b>
Like NX workspace, with Angular CLI also we can add different types of projects to a single workspace. This is great, but it is not sufficient to enable the monorepo-style development. Nx adds an extra layer of tooling to make this possible. Click here to learn full version of <a href="https://www.tutorialslogic.com/blogs/nrwl-nx">NX Tutorials</a>
About Us !
Published: 2020-04-17 18:12:45

It was in February 2018 that Codelots started its Journey towards becoming one of the leading Software Development Company. Codelots was established with the objective of providing expert Software Development Services to Businesses across the globe, irrespective of its Size and Industry Vertical. Right from the very beginning, We had a clear vision- To build a team of committed and reliable people who can assist Businesses in their Digital Transformation Journey by helping develop innovative and revenue-generating Software Solutions. In a single sentence, Codelots Technologies can be summed up as a Custom and Full-Fledged Software Development Services Company providing expert Offshore Software Developers who work along the lines of the Company’s core Beliefs and Principles.
How to enhance a retail website with AI
Tags: AI, vision, Microsoft
Published: 2020-04-17 18:08:53

I had a great time last week presenting for [Global AI Community: On Virtual Tour](https://live.globalai.community/), a continuous 30-hour series of online presentations on applications of AI from around the globe.

My talk, [Using Pre-Built AI to Solve Business Challenges](https://live.globalai.community/#talk-193797) was all about how developers can add AI capabilities to applications, even without in-depth knowledge of building AI models, using only APIs provided by [Azure Cognitive Services](https://docs.microsoft.com/azure/cognitive-services/?WT.mc_id=devto-blog-davidsmi). In the talk, I provide and end-to-end example of adding a shop-by-photo feature to the storefront for a hardware retailer's website, and using reinforcement learning to dynamically select the featured departments for engagement.

I also spent several minutes explaining the inner workings of computer vision systems, and how convolutional neural networks work. Even if you don't have to use deep learning directly, I think it's important to at least have a sense of what's going on under the hood, so you can know how things can go wrong, and how to fix things if they do.

{% youtube PR0QoCEcG3E %}

We've also provided a complete collection of Resources related to the talk, including all of the slides, demo scripts, data, and even a single-click Deploy to Azure button to provision a working version of the AI-enabled website. You can [explore the GitHub repository here](https://aka.ms/AIML20repo), and if you have any feedback, GitHub issues are welcome!
How to string.reverse('javascript')
Published: 2020-04-17 18:05:57

As I preparing for upcoming technical interviews after some research, reversing a string is one of the common challenges.

reverse() is a built-in function included with the most recent javascript versions. The alone word says that it will reverse all elements within a given array.

######Challenge
`Given a string, return a new string with the reversed order of characters`


###Solution 1
In order to reverse a string with reverse(), we can use a method to reverse string into an array first, call reverse() method on it and turn it back into the string. Take a look at the flow diagram below with the result code.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/8ylup7uufcakgxr0ge26.png)
There is also a version where you can chain all three methods together.

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


###Solution 2
Here we will use for...of loop, it loops through a block of code a number of times. I will be using the syntax that was introduced with [ES2015](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/for...of)

Let's take a look at the diagram again and result.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/ap4okxdur7ow478r55vm.png)
So after I create an empty variable, I will declare a temporary variable that is redeclared every single time through this loop of character, then keyword *of*, string, in this case, *str* is object whose iterable properties are iterated(all characters of string). 
So we're going to iterate through each character of string one by one and set each character equal to this temporary variable character.
We then take that character added on to the start of the string reversed and then after the entire for loop we return the string reversed.

Iteration behind a scene 

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

*Hint!* If you need to loop through every so many-elements within the array, then you do have to go back to using a for loop or even a while loop for that matter. 

There are plenty more ways how to reverse strings in Javascript. I found these two easy to understand and use.