teleren/devto huggingface dataset:
AoC Day 10: The Stars Align
Tags: adventofcode, discuss
Published: 2018-12-10 05:18:38

---
title: "AoC Day 10: The Stars Align"
published: true
description: "Day 10: Stars and velocity vectors combine to write us messages in the sky."
cover_image: https://thepracticaldev.s3.amazonaws.com/i/na1sm461liiha3ihr8qd.png
tags: adventofcode, discuss
series: Advent of Code
---

On [Day 10](https://adventofcode.com/2018/day/10), the stars are aligning to send us messages.  It's not a proper Advent of Code until we've had a vector problem, and I'll be honest that, as I started reading the prompt, I was thinking, "Oh, no problem!  Vector math!  I'm a mechanical engineer!  I love vector math!"

And then.

```
......................
......................
......................
......................
......#...#..###......
......#...#...#.......
......#...#...#.......
......#####...#.......
......#...#...#.......
......#...#...#.......
......#...#...#.......
......#...#..###......
......................
......................
......................
......................
```

Head -> Desk.

OK, back to my consistent state of "not sure how we're going to do this."  But that's what makes it fun!  Right?  Right?  I'm excited to see your solutions.
Write better code: Day 6 - Merge Meetings times
Tags: challenge
Published: 2018-12-10 02:23:01

---
title: Write better code: Day 6 - Merge Meetings times
published: true
tags: challenge
---

This post originally appeared on Arjun Rajkumar's blog. Arjun is a [web developer based in Bangalore, India.](https://www.arjunrajkumar.in) 

--


### Day 6: Question 1

Write a method merge_ranges() that takes an array of multiple meeting time ranges and returns an array of condensed ranges.

```
For example, given:
[[0, 1], [3, 5], [4, 8], [10, 12], [9, 10]]
Output -> [[0, 1], [3, 8], [9, 12]]

```

Do not assume the meetings are in order. The meeting times are coming from multiple teams.

Write a solution that's efficient even when we can't put a nice upper bound on the numbers representing our time ranges. Here we've simplified our times down to the number of 30-minute slots past 9:00 am. But we want the method to work even for very large numbers, like Unix timestamps. In any case, the spirit of the challenge is to merge meetings where start_time and end_time don't have an upper bound.

-

If you want to follow along, feel free to post your answers in the comment. 

My answers are in the comments.
[This problem is from InterviewCake.](https://www.interviewcake.com/question/ruby/merging-ranges?section=sorting-searching-logarithms&course=fc1)
#TIR: Microservices Design Guide
Tags: microservices, tir
Published: 2018-12-10 00:07:10

---
title: #TIR: Microservices Design Guide
published: true
description: 
tags: Microservice, tir
cover_image: https://cdn-images-1.medium.com/max/800/1*FYrICPQmw3ebh70oswdA6g.png
---

[link-->](https://medium.com/platform-engineer/microservices-design-guide-eca0b799a7e8)

Read a nice post for micro service.
Building Good Habits
Tags: productivity, career, habits
Published: 2018-12-09 23:10:25

---
title: Building Good Habits
published: yes
description: Building habits is how we become better
tags: #productivity #career #habits
---

Building good habits is the key to building a more intentional life. We begin by defining the kind of person we want to be. If we intend to become a better developer, we must define what that means to us. I like the exercise I picked up at a Stephen Covey seminar I once attended. Imagine yourself at your wake (or some end of life celebration) and choose a number of people to speak. Who would they be and what would you want them to say about you? That becomes the blueprint for the type of person you want to become.  For example, let’s imagine that you chose your kids to speak and say that you were the best parent in the world. One of your goals would then be to become a better parent.

Unfortunately, goals are not enough. How do you get there? One way is to build habits that shape your behavior. To become a better parent, one habit you could define is to spend at least 15 minutes talking with your kids every day. Just talking. Nothing else. That may not seem like much but over years of time, your kids would remember that they talked to you every day of their lives. That would make a powerful impact.

Let’s say that you want to become a better software developer. What does that mean to you? Who would speak for you and what would they say? Would it be your manager or co-worker or customer or someone else? Would that person say that you were smart, clever, fast, or a great mentor? Depending on who says what about you would define what a better software developer means to you and that it is what is important. I’ll talk more about building good software developer habits in a future post.
A short summary of how the Domain Name System (DNS) works
Tags: sciencetech, dns, domain, howto
Published: 2018-12-31 13:30:22

---
title: A short summary of how the Domain Name System (DNS) works
published: true
tags: Science & Tech,dns,domain,howto
canonical_url: 
---

![](https://i1.wp.com/www.fatosmorina.com/wp-content/uploads/2018/12/what-is-a-dns-server.png?fit=676%2C338&ssl=1)<figcaption>Image source: keycdn.com</figcaption>

Domain Name System (DNS) is something that we rely on quite a lot. You even got here to read this article with the help of a DNS who helped you find this article on the internet. Knowing what it is and the ways it finds the pages that are shown in a browser can be considered as something quite mysterious, but that does not have to be the case. The [author of a lot of great open source projects](https://www.fatosmorina.com/get-trending-github-projects-chrome-tab-githunt/), Kamran Ahmed, has recently published a short and helpful representation on the basics of DNS.

He compared the way DNS works with our phones: We use our phones to call someone after we have their numbers. Similarly, we can visit a website only after we type in the browser address bar the domain which or the IP address.

Here is the actual image that [Kamran](http://twitter.com/kamranahmedse) has published in a recent [article](https://medium.com/@kamranahmedse). I hope you find it useful in refreshing up your knowledge or learn something that you may have not learned in the past.

![](https://i1.wp.com/www.fatosmorina.com/wp-content/uploads/2018/12/DNS.png?fit=633%2C1024&ssl=1)

The post [A short summary of how the Domain Name System (DNS) works](https://www.fatosmorina.com/a-short-summary-of-how-the-domain-name-system-dns-works/) appeared first on [Fatos Morina](https://www.fatosmorina.com).
#TIR: Build a Simple Persistent Key-Value Store in Elixir, using Logs - Part 1
Tags: elixir, tir
Published: 2018-12-09 19:38:45

---
title: #TIR: Build a Simple Persistent Key-Value Store in Elixir, using Logs - Part 1
published: true
description: 
tags: elixir, tir
cover_image: https://www.poeticoding.com/content/images/2018/12/Screenshot-2018-12-01-at-01.13.20.png
---

[link-->](https://www.poeticoding.com/build-a-simple-persistent-key-value-store-in-elixir-using-logs-part-1/)

Today I read it from Awesome Elixir Newsletter. Nice for learning Elixir.

```elixir
def lookup(key) do
  GenServer.call(__MODULE__, {:lookup, key})
end

def handle_call({:lookup, key}, _from, index_map) do
  {:reply, get_key_offset_size(key, index_map), index_map}
end

defp get_key_offset_size(key, index_map) do
  case Map.get(index_map, key) do
    {_offset, _size} = offset_size -> {:ok, offset_size}
    nil -> {:error, :not_found}
  end
end
```
A month of Flutter: extract post item widget
Tags: flutter, refactorit, tutorial
Published: 2018-12-09 19:32:01

_Originally posted on [bendyworks.com](https://bendyworks.com/blog/a-month-of-flutter-extract-post-item-widget)._

[Yesterday](https://bendyworks.com/blog/a-month-of-flutter-a-list-of-posts) I created the `PostList` widget to display multiple posts at once. It contained the code for rendering both the list and the individual items. As the rendering logic for the individual items is going to get more complex, I'm going to extract the item rendering code into a `PostItem` widget.

There aren't any feature changes in this refactor, but the `PostItem` lays the groundwork for adding the code to render the image, name, date, etc. That complexity should be contained within this new widget.

~~~dart
class PostItem extends StatelessWidget {
  const PostItem();

  @override
  Widget build(BuildContext context) {
    return Card(
      child: Container(
        height: 300.0,
        child: const Center(
          child: Text('Prim Birb'),
        ),
      ),
    );
  }
}
~~~

One of the issues I see in some flutter tutorials is having widgets that are overly complex. Widgets that contain to much functionality are hard to read and test, and should be broken up into smaller widgets.

The code for `PostsList` is now much more concise:

~~~dart
class PostsList extends StatelessWidget {
  const PostsList();

  static const List<int> _items = <int>[0, 1, 2];

  @override
  Widget build(BuildContext context) {
    return ListView(children: _itemList());
  }

  List<PostItem> _itemList() {
    return _items.map((int index) => const PostItem()).toList();
  }
}
~~~

Separating the code into multiple widgets makes unit testing easier. Tests for how a `PostItem` renders content can be contained within `post_item_test.dart` and `posts_list_test.dart` only has to test that `PostItems` are rendered.

Tests for `PostItem`:

~~~dart
testWidgets('Renders a post', (WidgetTester tester) async {
  // Build our app and trigger a frame.
  await tester.pumpWidget(const MaterialApp(
    home: PostItem(),
  ));

  expect(find.byType(Card), findsOneWidget);
  expect(find.text('Prim Birb'), findsOneWidget);
});
~~~

Tests for `PostsList`:

~~~dart
testWidgets('Renders list of posts', (WidgetTester tester) async {
  // Build our app and trigger a frame.
  await tester.pumpWidget(const MaterialApp(
    home: PostsList(),
  ));

  expect(find.byType(PostItem), findsNWidgets(2));
});
~~~

## Code changes

- [#19 Add PostItem widget](https://github.com/abraham/birb/pull/19)
- [#21 Refactor PostItem list method](https://github.com/abraham/birb/pull/21)
TIGL3D DevLog 15+16: Containers, energy balls, releasing alpha
Tags: gamedev, unity3d, devlog
Published: 2018-12-09 19:24:59

---
title: TIGL3D DevLog 15+16: Containers, energy balls, releasing alpha
published: true
description: These updates cover even more last minute additions before releasing an alpha demo.
tags: gamedev, unity, devlog
cover_image: https://thepracticaldev.s3.amazonaws.com/i/hje5zq5857jkev20q2ye.gif
---
These two devlog updates for [The Indie Game Legend 3D](http://indiegamelegend.com/) from July and August 2018 cover even more last minute additions to the game based on feedback and iteration before finally releasing an alpha demo to the world:

{% youtube Ap60YZ9aZLg %}

{% youtube HqlFB1MYIpw %}

Early access is in two days! [Wishlist on Steam](https://store.steampowered.com/app/844440/The_Indie_Game_Legend_3D/)
Crypto Notepad
Tags: csharp, windows, aes, encryption
Published: 2018-12-09 19:02:59

---
title: Crypto Notepad
published: true
description: Simple editor for Windows with encryption features
tags: csharp, windows, aes, encryption
cover_image: https://i.imgur.com/RJihoQS.png
canonical_url: https://github.com/Sigmanor/Crypto-Notepad/releases/latest
---

[`Official website`](https://crypto-notepad.github.io) | [`Download`](https://github.com/Sigmanor/Crypto-Notepad/releases/latest) | [`Source code`](https://github.com/Sigmanor/Crypto-Notepad) | [`Documentation`](https://github.com/Sigmanor/Crypto-Notepad/wiki/Documentation)

Notepad-like simple text editor for Windows, where files are saved and loaded encrypted with AES algorithms.

[![screenshot](https://i.imgur.com/rqfKzNX.gif)](https://github.com/Crypto-Notepad/Crypto-Notepad/wiki/Documentation#screenshots)

## Features

* Including all the features of the default Windows Notepad
* Integrate with windows context menu
* Drag and Drop support
* Detecting links in editor
* Сustomizable editor 
* Сustomizable encryption options (hash algorithm, key size, password iterations)  
* Associate own file type with application
* Portable

## System requirements

* Windows Vista SP2 and higher
* .NET Framework 4.5
Accessible form inputs for keyboard users
Tags: webdev, a11y, codesnippets
Published: 2018-12-09 18:16:20

---
title: Accessible form inputs for keyboard users
published: true
description: Accessible form inputs for keyboard users
tags: web dev, accessibility, code snippets
---

We're all guilty of doing `outline:none`, without giving it much thought, for getting rid of those *ugly* blue outlines of our form control elements such as buttons and input fields. But if we are considering to make our website more accessible which we DEFINITELY should, the first suggestion we'll read in any of the accessibility checklist is to NEVER do `outline:none` because then it becomes nearly impossible for keyboard users to navigate through our website.

So how do we overcome this problem?
Simple. Give some proper styles to the `outline` such as `outline: 2px solid your_choice_of_colour` and you won't get the default outline styles anymore!

But if we are willing to take an extra step to first identify (or at least try to) the keyboard user and only show those outlines (styled or un-styled) to them and the rest can go on about their lives without ever knowing them outlines!

Here's how we can do that -

First identify if the user has hit the `tab` key and if they did add a class to your `body`.

``` javascript
function handleTab(e) {
    if (e.keyCode === 9) { // "hey I am a keyboard user"
        document.body.classList.add('user-tabbing');
        window.removeEventListener('keydown', handleTab);
    }
}

window.addEventListener('keydown', handleTab);
```

Second, add your specific styles and voila!

``` css
body button:focus,
body input:focus,
body select:focus,
body textarea:focus {
    outline: 2px solid yellow;
}

body:not(.user-tabbing) button:focus,
body:not(.user-tabbing) input:focus,
body:not(.user-tabbing) select:focus,
body:not(.user-tabbing) textarea:focus {
    outline: none
}

```

What are some of your tips for making the web more accessible for all?
Botnet in good approach
Tags: security
Published: 2018-12-09 18:12:49

---
title: Botnet in good approach
published: true
description: Botnet on good sides
tags: security
---
![](https://thepracticaldev.s3.amazonaws.com/i/z287lwqnpkxsdbecp7xb.png)

### Robot Network a.k.a Botnet
known as malcious ware due it work controlling massive amount of computation resources with a distrubance to system host and without consent from owner with it agents -- a Botnet part in your pc. Botnet using client-server tier, use client or agent in form a script or compiled code and server a web service.

Usually, a bad botnet serve malcious feature like spreading method , DDOS, even credential harvesting tool bundle at once with the agent. Nah , you said make botnet do goodness ? of course.

let changing the something on it, we change it to facilitate us to administrate or ease use computation resource in a bundle, like if botnet used by others to control you resource with harming act, why you not make you own botnet to control you resource with beneficial feature. Such a remote your pc to backup, track you phone when you forget it, or watering plant using arduino which integrated with your Botnet server. In a browser , make great task simple.

this maybe done like system administrator with no data centers. just your home and you IoT.

##### References:

https://github.com/malwaredllc/byob/tree/master/byob
https://github.com/citronneur/rdpy
https://github.com/sweetsoftware/Ares
Previewing dev.to's Upcoming Night Mode
Tags: meta
Published: 2018-12-09 18:03:30

---
title: "Previewing dev.to's Upcoming Night Mode"
published: true
description: Night Mode has been a long requested feature of the site. Everyday, we inch closer to making this a reality thanks to the power of open-source collaboration.
cover_image: https://thepracticaldev.s3.amazonaws.com/i/nzbg4d1m3hty56lm92h3.png
tags: meta
---

{% github https://github.com/thepracticaldev/dev.to/issues/134 %}

Night Mode has been a long requested feature of the site. For people like me, dark themes are better than light themes because they put less strain on the eyes, especially in dark environments (thus its name). ~~It also makes me look hip and edgy.~~ The implementation of a Night Mode has been in the backlog for quite some time now until last month when @rkichenama submitted a [pull request](https://github.com/thepracticaldev/dev.to/pull/1104) to finally get the ball rolling. Since then, he has been working closely with the dev.to team to refine the CSS styles of the upcoming Night Mode.

Unfortunately, the CSS styles have not been finalized yet. It is continually being worked on by the contributors. _(Shout out to [@rkichenama](https://dev.to/rkichenama)!)_ At its current state, most of the styles are simply inverted colors of the original styles. Profile pictures are also gray-scaled. But it's a start nonetheless! Something is better than nothing. I am grateful for the efforts being made on this feature. _(Shout out to [@rkichenama](https://dev.to/rkichenama) again!)_

However, that doesn't mean we can't test it right now. Yup, you heard me right. We can test a "beta" version of the Night Mode right here, right now. And it isn't too difficult to activate, too! 🎉

# How do I activate Night Mode?
As of writing this article, there is no way to activate Night Mode through the settings. The only way to test it is by manually altering the class of the `<body>` tag with the [DevTools](https://developers.google.com/web/tools/chrome-devtools/).

There are many ways to do this. You can use the [Elements panel of the DevTools](https://developers.google.com/web/tools/chrome-devtools/css/#classes) to manually add the `night-theme` class to the `<body>` tag.

You can also use the [Console panel of the DevTools](https://developers.google.com/web/tools/chrome-devtools/console/get-started) to programmatically add the `night-theme` class to the `<body>` tag with JavaScript. Personally, I prefer this way because it's literally one line of code you have to enter into the console.

```javascript
document.body.className = 'night-theme';
```

To exit Night Mode, simply reload the page.

_Voila!_ It may be startling at first, but at least we can test it now. Don't forget to give suggestions and **constructive** feedback in [this pull request](https://github.com/thepracticaldev/dev.to/pull/1104). _(One last shout out to [@rkichenama](https://dev.to/rkichenama)!)_ Or if you can, review the code for yourself and make your own changes. Any contribution is most welcome.

_Let's help make Night Mode a reality!_
I made a fetch-wrapper for making graphql api calls!
Published: 2018-12-09 03:51:11

(https://thepracticaldev.s3.amazonaws.com/i/712x78426cyq8kj5ab3c.png)
---
title: I made a fetch-wrapper for making graphql api calls!
published: false
description: An overview of a fetch-wrapper for making graphql queries that I built.
tags: graphql, javascript, node, fetch
---

The other day, I was playing around with GraphQL queries for a side-project that I'm building, when I realized that eventually - I'm gonna need to make calls to that API on the client-side. My first instinct was to look around for a way to do it using fetch, because I *love* the fetch API. However the way to do it using fetch is kinda gross, if I'm being honest. The first answer I found on stack overflow, showed it like this:

<small>note that, for the examples, an example API that I created is used</small>

```javascript

fetch('https://csb-xpwq1o2824-xravvsjkul.now.sh/', {
    method: "POST",
    body: JSON.stringify({query: "query {items{title}}"})
})

```

Now, that's pretty nasty-looking. You could make it better with some variables, maybe a template string, something like this:

```javascript
const url = "https://csb-xpwq1o2824-xravvsjkul.now.sh/";
const query = {
    query: `
        query{
            items{
                title
            }
        }
    `
}
const body = JSON.stringify(query);

fetch(url, {
    method: "POST",
    body
})

```

Now while that **may** look satisfying, it didn't feel like a healthy-enough balance between the feel of fetch, and graphql. So I created a function that did just that for me. I realized how useful this could be to other developers, so I wrapped it up in an npm module, and published it. I call it `jraph`, <strike>and it works like this</strike> and thanks to a comment from @qm3ster, it now works like this:

```javascript
import { jraph } from "jraph";

let jql = jraph(
    "https://csb-xpwq1o2824-xravvsjkul.now.sh/",
    {
        method: "POST"
    }
);

let result = 
    jql`{
      items{
        title
        info
      }
    }`
```

I making a major update to the syntax that I think that graphql fans of the world will love.

If you like it, you can check it out on npm, [here](https://www.npmjs.com/package/jraph)!

Have a great day guys!
Outlook Notifications made easy !
Tags: python, outlook, github, opensource
Published: 2018-12-09 16:08:31

---
title: Outlook Notifications made easy !
published: true
description: 
tags: #python , #outlook , #github , #opensource 
---

Hi guys,

I made a simple script that monitors your Outlook inbox and notifies on the receipt of any new emails or meeting requests. Criticisms and suggestions are welcome !


https://github.com/boudhayan-dev/OutlookNotify
Page Navigation for Ruby Gem markdown_helper
Tags: ruby, markdown, github, discuss
Published: 2018-12-09 14:54:40

---
title: Page Navigation for Ruby Gem markdown_helper
published: true
description: 
tags: #ruby #markdown #github #discuss
---
As you may have seen, I've put up an updated <code>markdown_helper</code> gem.

Now I'm thinking that the next feature will be "page navigation."

In this feature, the input is a series of markdown pages.  The output is those same pages, but now each with links to the previous and next pages.

I have a thus-linked [TesterTour](https://github.com/BurdetteLamar/RubyTest/blob/master/examples/github/TesterTour.md#tester-tour) over in my project [RubyTest](https://github.com/BurdetteLamar/RubyTest#rubytest).  (It's built by a rakefile, not by <code>markdown_helper</code>.)

The question is:

- **How is the series of pages to be specified?**

Some possibilities:

- Pages are identified by links on an overview markdown page (like the Tester Tour above).

- Pages are identified by URLs listed in a non-markdown page.

- Pages are identified by simply all being in a particular directory.  There would also need to be a list of some sort to specify the order.

I'm leaning toward the first above.

So, Rubyists, what's your pleasure?

- One (or more) of the above?
- Something else?

Let me know.
sockjs_test_server_nwjs – SockJS test server on NW.js
Tags: node, javascript, sockets, server
Published: 2018-12-09 14:51:56

---
title: sockjs_test_server_nwjs – SockJS test server on NW.js
published: true
tags: node,javascript,sockets,server
canonical_url: 
---

“[sockjs\_test\_server\_nwjs](https://github.com/jalbam/sockjs_test_server_nwjs)” is just a simple [SockJS](https://github.com/sockjs) server running on [Node.js](https://nodejs.org/) but using [NW.js (formerly node-webkit)](https://nwjs.io/) to provide a simple visual interface for testing purposes. It was made on 29th July 2016 (approximately).

![](http://joanalbamaldonado.com/blog/wp-content/uploads/2018/12/sockjs_screenshot.gif)<figcaption>Screenshot</figcaption>

The default listening port is set to _9999_ but can be modified easily.

It comes with a self-extracting single-file binary for Windows 32-bit (using [7zip](https://www.7-zip.org/links.html)‘s SFX) that runs on Windows XP with SP2 (Service Pack 2) minimum and also on newer Windows versions as Windows 10 (generated with [Web2Executable](https://github.com/jyapayne/Web2Executable)) but also includes the source code so it can be ported to other platforms supported by [NW.js](https://nwjs.io/) easily.

It can be found on GitHub: [https://github.com/jalbam/sockjs\_test\_server\_nwjs](https://github.com/jalbam/sockjs_test_server_nwjs)