teleren/devto huggingface dataset:
Registering as a Share Target with the Web Share Target API
Tags: pwa, share
Published: 2019-04-12 11:08:53

---
title: Registering as a Share Target with the Web Share Target API
published: true
tags: pwa, share
canonical_url: https://paul.kinlan.me/registering-as-a-share-target-with-the-web-share-target-api/
---

Pete LePage introduces the Web Share Target API and the the availability in Chrome via an origin trial

> Until now, only native apps could register as a share target. The Web Share Target API allows installed web apps to register with the underlying OS as a share target to receive shared content from either the Web Share API or system events, like the OS-level share button.

[Read full post](https://developers.google.com/web/updates/2018/12/web-share-target?utm_source=feed&utm_medium=feed&utm_campaign=updates_feed).

This API is a game changer on the web, it opens the web up to something that was only once available to native apps: Native Sharing. Apps are silos, they suck in all data and make it hard to be accessible across platforms. Share Target starts to level the playing field so that the web can play in the same game.

The Twitter Mobile experience has Share Target [already enabled](https://mobile.twitter.com/manifest.json). This post was created using the Share Target I have defined in my sites ‘admin panel’ [manifest.json](https://paul.kinlan.me/share/share-manifest.json) - it works pretty well, and the minute they land file support I will be able to post any image or blob on my device to my blog.

Very exciting times.

Read the linked post to learn more about the time-lines for when this API should go live and how to use the API.
Not Dev, not Ops, what are we?
Tags: anonymous, devops, career, discuss
Published: 2018-12-06 18:51:26

---
title: Not Dev, not Ops, what are we? 
published: true
tags: anonymous, devops, career, discuss
---

_This is an anonymous post sent in by a member who does not want their name disclosed. Please be thoughtful with your responses, as these are usually tough posts to write. Email sloan@dev.to if you'd like to leave an anonymous comment._

Some background for reference:

I'm a long time "ops" guy, who codes web apps for fun. I spent a large part of my career as manager of an ops team that managed apps, but not hosts. We partnered with infra to set up servers to our specs, mount storage, and open ports. We where given credentials to provision the machine. We handled the day to day support operations for the applications. I was lucky enough to be a part of a grass roots movement to implement DevOps before it became a buzzword.

From there I did some consulting and bounced around for a few years. Then I was offered the opportunity to manage a Site Reliability Engineering team. This was a new concept for me, but after doing some research, It wasn't anything new for me. 

A couple years in there is one blazing truth. We are not a SRE team. I work for a large company with a micro service architecture, around 300 services in total. Ops teams are not integrated with development teams. I'm now trying to re-tool my team to better fit the company needs.  

My proposal is our team of eight works with product owners to understand the portfolio of applications under their domain. We would help to make sure things like graceful degradation, and observability are being considered along with functional features. We would help build monitors and alerts, and work tightly with our 24/7 noc. We would build and manage alerting and incident management tools for our noc, be level 2 support, and severe level incident managers. We would also be responsible for unplanned production changes, lake feature flags, cache flushes, and adhoc batching jobs. 

We are not positioned to take part in things like infrastructure architecture, or server management. We are more dev facing that infra ops. There is a need there, and a great opportunity. I see a lot of similarities on the team I used to manage in the first paragraph up there. Is anyone aware of a team structure, or concept similar to this? I'm looking for examples or resources to help set direction.  

TL;DR Are there any devs who are aware of a team that "manages" and supports their apps in production, but isn't a traditional operations team?
AoC Day 7: The Sum of Its Parts
Tags: adventofcode, discuss
Published: 2018-12-07 05:10:14

---
title: "AoC Day 7: The Sum of Its Parts"
published: true
description: "Day 7: We are tasked with putting together Santa's sleigh!"
tags: adventofcode, discuss
cover_image: https://thepracticaldev.s3.amazonaws.com/i/8u8tuahkm2g38mthrta6.png
series: Advent of Code
---

[Day 7](https://adventofcode.com/2018/day/7)!  I wasn't able to complete yesterday's challenge in time, but I'm going to keep working and hopefully get caught up this weekend.  Nevertheless, Advent waits for no DEV, and we must press onwards.

Today, we get the exciting task of putting together Santa's sleigh, and it doesn't seem like the instructions are quite up to IKEA's standards.  They even provide us with a neat example graph!  [Di-graph](https://mathinsight.org/definition/directed_graph)?  More like *die*-graph, amirite?  

Just kidding, this should be fun!  Good luck!
Profiling: check how long it takes to run a Python script
Tags: python, builtin, profiling
Published: 2018-12-07 08:55:18

---
title: Profiling: check how long it takes to run a Python script
published: true
tags: python,built-in,profiling
canonical_url: https://flaviabastos.ca/2018/12/07/profiling-check-how-long-it-takes-to-run-a-python-script/
---

From [Python’s official documentation](https://docs.python.org/3/library/profile.html): “A _profile_ is a set of statistics that describes how often and for how long various parts of the program executed.”

Python’s standard library provides two implementations of the same profiling interface: _cProfile_ and _profile_ but I always go with cProfile for short scripts because you can invoke it at run time like so (no import required!):

```
python3 -m cProfile foo.py
```

The output provides you the total runtime and also a break down by call type, which can be very helpful when you are looking for ways to optimize a script.

cProfile example output:

```
         131 function calls in 0.001 seconds Ordered by: standard name ncalls tottime percall cumtime percall filename:lineno(function) 1 0.000 0.000 0.001 0.001 loops.py:4(<module>) 1 0.000 0.000 0.001 0.001 loops.py:4(multiple\_loops) 1 0.000 0.000 0.001 0.001 {built-in method builtins.exec} 58 0.001 0.000 0.001 0.000 {built-in method builtins.print} 1 0.000 0.000 0.000 0.000 {method 'disable' of '\_lsprof.Profiler' objects} 40 0.000 0.000 0.000 0.000 {method 'insert' of 'list' objects} 29 0.000 0.000 0.000 0.000 {method 'join' of 'str' objects}
```

> The post [Profiling: check how long it takes to run a Python script](https://wp.me/pa0b0y-1M) was originally published at [flaviabastos.ca](https://flaviabastos.ca/)
Php Artisan Tinker Database Commands
Tags: laravel
Published: 2018-12-07 04:09:46

---
title: Php Artisan Tinker Database Commands
published: true
description: Php Artisan Tinker Database Commands
tags: ;laravel
---

Here you can check some important Php Artisan Tinker Database Commands

[Php Artisan Tinker Database Commands](https://therichpost.com/php-artisan-tinker-database-commands-which-makes-life-easy)

Thank you,

TheRichPost.com
A month of Flutter: initial theme
Tags: flutter, design, tutorial
Published: 2018-12-07 01:37:12

_Originally published on [bendyworks.com](https://bendyworks.com/blog/a-month-of-flutter-initial-theme)._

I don't have a full theme designed yet but I am planning on going in a clean and minimalist direction. So let's take the current default design and clean it up a little.

![Screenshot of default Material Design](https://thepracticaldev.s3.amazonaws.com/i/s00n8a3140iywc037265.png)

There are a couple of changes to the code for this theme cleanup. The first we'll cover is changing the [status bar](https://material.io/design/platform-guidance/android-bars.html#status-bar) and [navigation bar](https://material.io/design/platform-guidance/android-bars.html#android-navigation-bar) colors. The [`SystemChrome`](https://docs.flutter.io/flutter/services/SystemChrome-class.html) change will go in the `main` function. We'll also have to import `services` to get access to `SystemChrome`.

~~~dart
import 'package:flutter/services.dart';

void main() {
  runApp(MyApp());

  SystemChrome.setSystemUIOverlayStyle(
    const SystemUiOverlayStyle(
      statusBarColor: Colors.white,
      systemNavigationBarColor: Colors.white,
      systemNavigationBarDividerColor: Colors.black,
      systemNavigationBarIconBrightness: Brightness.dark,
    ),
  );
}
~~~

_Note that a full restart of the app is needed for the system UI color changes._

The next change is customizing the [theme](https://flutter.io/docs/cookbook/design/themes) on `MaterialApp`. These changes disable the debug banner, tell `MaterialApp` to be in `light` [brightness mode](https://docs.flutter.io/flutter/material/ThemeData/brightness.html), and set a few colors to white. The title is also changed to just `Birb`.

~~~dart
MaterialApp(
  debugShowCheckedModeBanner: false,
  title: 'Birb',
  theme: ThemeData(
    brightness: Brightness.light,
    primaryColor: Colors.white,
    scaffoldBackgroundColor: Colors.white,
  ),
  home: const MyHomePage(title: 'Birb'),
);
~~~

The next change is to center the title of the `AppBar` and remove it's `elevation` (shadow).

~~~dart
AppBar(
  title: Center(
    child: Text(widget.title),
  ),
  elevation: 0.0,
),
~~~

And the final change is to update and center the placeholder text. This will eventually turn into a widget to display when there are no images to show.

~~~dart
const Center(
  child: Text('No Birbs a birbing'),
)
~~~

Now we have this nice clean base theme to continue building on.

![Screenshot of new clean design](https://thepracticaldev.s3.amazonaws.com/i/3xx2r0u71k2o32ley9lg.png)

If you want to learn more about theming Flutter apps, check out the [Building Beautiful UIs with Flutter](https://codelabs.developers.google.com/codelabs/flutter/index.html) codelab.

## Code changes

- [#15 Implement a clean theme](https://github.com/abraham/birb/pull/15)
Using SDL2: Drawing Rectangles
Tags: cpp, sdl
Published: 2018-12-07 00:52:38

Along with the new 2D hardware accelerated API in SDL2, we can draw primitive shapes like rectangles. Two functions, `SDL_RenderDrawRect()` and `SDL_RenderFillRect()` are functions that can be used to draw rectangles on the screen. The difference between the two will be discussed later.

Both of these functions take a pointer to an `SDL_Rect` for its position and dimensions. Because both are apart of the hardware rendering API, each takes a pointer to an `SDL_Renderer`.

`SDL_RenderDrawRect()` draws the outline of a rectangle while `SDL_RenderFillRect` draws a rectangle filled.

Before we draw any rectangles to the screen, we can change the color it will use with `SDL_SetRenderDrawColor()` which takes four arguments:

* An `SDL_Renderer`
* Red value from 0-255
* Green value from 0-255
* Blue value from 0-255
* Alpha value from 0-255

Reusing the `Application` class from before the Pong series, we have the following code:

```cpp
void Application::draw()
{
    SDL_RenderClear(m_window_renderer);

    SDL_Rect rect;
    rect.x = 250;
    rect.y = 150;
    rect.w = 200;
    rect.h = 200;

    SDL_SetRenderDrawColor(m_window_renderer, 255, 255, 255, 255);
    SDL_RenderDrawRect(m_window_renderer, &rect);

    SDL_SetRenderDrawColor(m_window_renderer, 0, 0, 0, 255);

    SDL_RenderPresent(m_window_renderer);
}
```

Compile and run.

![](https://thepracticaldev.s3.amazonaws.com/i/8vdbwjci9po4iqiy60og.png)

For the filled version is just as simple:

```cpp
void Application::draw()
{
    ...
    SDL_RenderFillRect(m_window_renderer, &rect);

    ...

    SDL_RenderPresent(m_window_renderer);
}
```

Compile and run.

![](https://thepracticaldev.s3.amazonaws.com/i/rcpqracoec9u8m9lyrtp.png)

In addition to rectangles, SDL2 supports two other primitives. Namely, lines and points.

We will take a look at both quickly.

`SDL_RenderDrawLine()`:

* `SDL_Renderer`
* x value for the beginning point
* y value for the beginning point
* x value for the end point
* y value for the end point

`SDL_RenderDrawPoint()`:

* `SDL_Renderer`
* x value for the position
* y value for the position

## What's next

For the next post, we will learn how to manipulate the viewport to render certain parts of the world.

Github repository: https://github.com/Noah11012/sdl2-tutorial-code
First Adventure in Malware Data Science
Tags: malware, python, datascience
Published: 2018-12-07 00:48:05

---
title: First Adventure in Malware Data Science
published: true
description: A small detail missed causes a deeper dive into an introductory chapter and concept
tags: malware, python, data science
cover_image: https://thepracticaldev.s3.amazonaws.com/i/yfjcj874fgg5zsarixfh.png
---

I haven’t been a software developer for very long, but I enjoy it. In my day job I do backend work in Flask, but I was looking for an exciting project to work on at home, something that would stretch my skills and teach me some new things. And maybe let me get a little dirty. Since I was a teen I’ve been fascinated by Malware. However, it’s a curiosity I haven’t explored as much as I’d like. So when No Starch Press had a sale I found and pre-ordered Malware Data Science by Joshua Saxe and Hillary Sanders.

I just started reading chapter 4, and I’m enjoying it so far. Maybe I’ll write a review when I’m done. In the meantime, I’d like to blog real quick about a small issue I had working through chapter 2, and how I fixed it (it was my problem, not the authors’).

All the authors’ code is in python2.7, and I’m more used to 3. No big deal though, right? I’m a professional, I can suss this out. No, this wasn’t my problem. 

What I had missed when a small detail when I downloaded the sample code and malware files. The zip file is entitled *malware_data_science_entrypoints_redacted.zip*

The task in chapter 2 I was attempting was to print out decompiled malware, starting at the entrypoint’s address. I completed my port of their python script (it was dodgy putting parentheses into that print statement) and ran it. And nothing happened.

What did I do wrong, I wondered? I checked the file. I read through the readme on pefile’s github. I checked capstone’s documentation. I was doing everything right. I went so far as to download the authors’ helpful Ubuntu vm, with all the code and data on it already. It worked there. But not on my fedora vm.

This frustrated me for far longer than it should have. I don’t remember when ‘entrypoints_redacted’ caught my eye, but I felt a little silly then. I altered my script a little to print out the entrypoint’s address, and it is adorably named 0xcc00ffee. When you feed this address to the disassembler you get nothing, as that address (it’s an offset, right?) is very large (3 and a half gb) and the size of the file itself is almost 631k.

I ran their vm and printed out the entrypoint address from there. Lowly 0x121ba (or 74170 in python). Entered that into my script and voila, I got disassembled code. It’s not exactly what the book says it should be, but it is exactly what the working code on the authors’ vm says it is, so I guess I did something right. 

I’m looking forward to digging deeper in this book.
Prettyplan: an open-source Terraform formatting tool for devs
Tags: devops, tools, opensource, showdev
Published: 2018-12-06 22:46:58

---
title: Prettyplan: an open-source Terraform formatting tool for devs
published: true
description: Making your terraform plans easier to read
tags: devops, tools, opensource, showdev
---

*tl;dr: prettyplan is an online tool where you can paste in your output from `terraform plan` and see it presented in an easy-to-read tabulated format. [It is available here](https://chrislewisdev.github.io/prettyplan/)!*

I'm not sure how many people here use [Terraform](https://www.terraform.io/) - a popular infrastructure-as-code tool - but if you have, you may have run into trouble before when trying to read its command-line output when working with large projects.

The default output that Terraform provides to let you know what changes it will make is pretty good, but in some cases it can be quite difficult to read... for example, consider trying to read what has changed here:

![terraform console output](https://thepracticaldev.s3.amazonaws.com/i/gu0wpyqp3ph3ibl3ehpt.png)

To help with this, I created prettyplan: a small web app that parses your Terraform output and presents it in a much easier to read tabulated format. It's been a fun project to work on and one that I hope can help other devs too.

With prettyplan, the previous example looks like this instead:

![prettyplan formatted output](https://thepracticaldev.s3.amazonaws.com/i/pe3y2b8moy0ibfwpodm8.png)

Which (at least to me) looks a lot nicer and easier to manage! So if you've found yourself reading through that kind of console output before, give it a shot. :)

#Contributions

If prettyplan is useful to you and you're interested in contributing, getting started and making changes is quite simple as the project is currently all vanilla JS with no dependencies or build (with the exception of some unit tests that run on commit). I welcome any improvements that people think could be made!
JavaScript Fatigue 
Tags: javascript, webdev, programming, coding
Published: 2018-12-06 22:01:20

---
title: JavaScript Fatigue 
published: true
description: 
tags: #javascript #webdev #programming #coding
---

![alt text](https://thepracticaldev.s3.amazonaws.com/i/hrtsu29s04yqkilbxrw8.jpg)

<h3>What is JavaScript fatigue?</H3>

While researching about JavaScript it came to my attention the term **JavaScript Fatigue**; over the last months I have spend a lot of time researching on the different related JavaScript topics and for sure I am not alone in this task, it looks that every time I need to learn or understand something new about this topic it takes me to different routes (which I have enjoyed).
 
**JavaScript Growth**

JavaScript fatigue is the result of the JavaScript ecosystem growth, its extenuating and continually growth popularity and the demand of Full-Stack developers as well as the different coding bootcamps educating and teaching to code has impacted the use, application, and need to learn not just about JavaScript but the tools that can enhance the development of apps and websites.

**Too Many Tools and Frameworks**

You can virtually build anything using JavaScript, well, yes! But with the help of ES6, jQuery, React, Redux, Webpack, Babel, TDD, JEST, Git, async, OOP, functional-style, npm, Node.js, Yarn, SQL, NoSQL, Graph databases, MongoDB, Angular, etc., etc, etc.

Using the different frameworks and libraries that better fit to the app or development you are working on will enhance your code workflow.  Even though you can do a lot with plain vanilla JavaScript, HTML, and CSS; modern JavaScript provides you with a huge choice of tools that will enrich your development.

It can look overwhelmed specially for beginners at first (including me) but understanding the way the different tools and libraries work will set you apart from the crowd during the job hunt and as professional.

**Benefit**

The benefit of using the different tools and frameworks is that some are boiler-plate libraries that you can use without restrictions or no need to change to much from the original.

**Conclusion** 

JavaScript is the ecosystem of many other tools, frameworks and libraries, so the importance of been up-to-date with these technologies requires you to be attentive to all the different updates and changes around these tools if you want to use the most recent and new additions while developing your apps or when collaborating with other developers.
Init
Published: 2018-12-06 21:15:25

---
title: Init
published: true
description: 
tags: 

---

I decided recently that I need to expand my digital footprint. My reasoning for this decision is straightforward: at some point in the indeterminate future, I may need to produce *important content* and I would want people to engage with it. However, if I don't spend the time building a following, then this potential *important content* will go the way of much of the content on the internet: the three followers I fux with on Twitter will form a short thread full of inside jokes in response to the tweet containing the link. When trees are always falling in the forest, we very quickly develop auditory fatigue. If a tree wants to be heard falling, it must cultivate an audience, so here we are.

However, building a digital footprint presents its own challenges. Chief amongst these is that it requires content that a large number of people find interesting. I have found it nigh on impossible to predict the things that a large number of people will find interesting.

Generally appealing content ruled out, the other option I have instead is content that **I** would find interesting. On this front I am plagued by three things. First, what do I have to add to the conversation that someone else has not already said in some better variation? Second, I can be lazy to the point of stupor and I am very good at finding justifications for my laziness. Finally, there is something that bothers me deeply about the mercenary and transactional nature of *being* online. Further, I am wary of the ways performance engenders changes to the self. 

A more cynical person than I could argue that all interaction is ultimately reducible to transactional performance. Instead, I will settle for the less cynical but still spicy take that all *online* interaction is ultimately transactional performance (I am aware of the tension between this statement and the decision to publish this post online, but I did not create the rules of *online*, I only live by them. Also I make no claims to ideological purity; colour me hypocrite if you want bro, whatevs **¯\\_(ツ)_/¯**). 

Of the three things I have listed, the greatest barrier to entry is my laziness so this post is my way of addressing that problem in **this moment**. I cannot say what will happen in all of the moments to come, it may very well be my last post. As to what new insights I can add to the conversation, I have decided, at least for the sake of these posts, that it don't matter man! As long as I am adequately satisfied with the product. Which brings be to the last point, the mercenary blah-blah of it all. My solution here is that I don't have one, but I will share (ha! see!) more as my thinking around the issue evolves.

I will be writing about whatever I feel I should write about. A lot of it will be mild, but I hope to fit in 

In exchange for my eternal thanks kind persons, I beseech you all: bestow upon me whatever engagement quanta this site-web has to offer.
Recommend:illustration How does Unicorn work?
Tags: ruby, rails, unicorn, tir
Published: 2018-12-06 20:45:16

---
title: Recommend:illustration How does Unicorn work?
published: true
description: 
tags: ruby, rails, unicorn, tir
---

The color diagram is great for read.

![](https://upload-images.jianshu.io/upload_images/12938683-db2573b40a25e08e.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

[link-->](https://translate.google.com/translate?hl=&sl=auto&tl=en&u=https%3A%2F%2Fruby-china.org%2Ftopics%2F37868)

I have a question, does Node and Go need a standalone app server?

The article has an auto generated directory, hope Devto provide this directory function in the future, it's great for read long post.
Can you help us with a quick poll?
Tags: tools, development, poll
Published: 2018-12-06 19:11:29

---
title: Can you help us with a quick poll?
published: true
description: Quick Developer Tools Poll
tags: tools, development, poll
---

Hey Community!

We are trying to understand better which developer tools we cannot live without and we were hoping to see what you think! Would you mind take a quick 4 question polls to help us out?

https://airtable.com/shrddwxzTt107HSut

Thank you!
-- Your friends at CheckGit