teleren/devto huggingface dataset:
windows 7 to windows 10 upgrade problems
Tags: window, os, upgrade
Published: 2020-01-14 19:37:37

ACTUALLY there are very few windows 7 to windows 10 upgrade problems but there are TWO bugs that can be killers 

1) if you have a DELL Latitude D630 with a 1280x800 LCD screen the windows 10 "add new user" popup comes up as 30x20 pixels - yes pixels in which you need to type a your new username and password and hints

2) ms windows one drive setup can use 100% cpu for up to 20 mins when you first login

see screenshots below (but you may need a magnifying glass)

![windows 10 add new user bug window is 40x30 pixels](https://res.cloudinary.com/osde8info/image/upload/v1579086721/winbug_ni34sw.png)

![windows 10 add new user bug window is 40x30 pixels](https://res.cloudinary.com/osde8info/image/upload/v1579086721/winbug2_rdggmy.png)

You might ask why spend so much time (because of the above bug it took 3 hrs to create a new user instead of 3 mins) on a 10 year old DELL D630 - well actually theres nothing wrong with it or its Intel Core 2 CPU

Yes the BIOS battery is dead-ish, yes the power battery is dead-ish, yes the BIOS doesnt work with SSD but everything else is fine and the DELL D630 models have a sought after (by netadmins esp) 9 pin RS232 connector on it AND a built in 3G modem (was a £200 option in 2010)

Ive upgraded its RAM to 4G (£60 from crucial.uk) and windows 10 is now running fine so if you see one online for between £10 - £40 think twice especially if it already has 4G RAM.
A Crystal Story: Simple Static File Server!
Tags: crystal, tutorial, webdev
Published: 2020-01-14 19:20:16

Maybe we need to serve the files for our great-awesome new client-side application 😎? Or Maybe we are building a static file server for fun 🍹🌴?

Well, it doesn't matter why, but we need a Static File Server ... and soon! Here we are going to see how easy is to build one using the [Crystal](https://crystal-lang.org) language! Yeah!!

# A Server object, s'il vous plait ☝️🎩

First we need to create a [HTTP Server](HTTP::Server) object. We may initialize this `server` object with an array of [handlers](https://crystal-lang.org/api/latest/HTTP/Handler.html) also known as [handler chain](https://crystal-lang.org/api/latest/HTTP/Server.html#handler-chain). When a request arrives to the server then it goes through the handler chain: each handler (having a specific purpose) will process the request and then it will forward the request to the next handler and so on and so on... 

For our static file server we are going to create a chain using:

### [HTTP::LogHandler](https://crystal-lang.org/api/latest/HTTP/LogHandler.html)
As the documentation says this is _a handler that logs the request method, resource, status code, and the time used to execute the next handler, to the given IO._

### [HTTP::ErrorHandler](https://crystal-lang.org/api/latest/HTTP/ErrorHandler.html)
This handler _invokes the next handler and, if that next handler raises an exception, returns with a 500 (Internal Server Error) status code._ 

### [HTTP::StaticFileHandler](https://crystal-lang.org/api/latest/HTTP/StaticFileHandler.html)
As the name says this handler is _a simple handler that lists directories and serves files under a given public directory._ In this case, the directory will be `./public`

And here is the code for creating the `HTTP::Server` object:

```crystal
server = HTTP::Server.new([
  HTTP::LogHandler.new,
  HTTP::ErrorHandler.new,
  HTTP::StaticFileHandler.new("./public"),
])

```

# Hey, `server`! Listen! 🤖🎧

Now that we have our `server` object, we need to specify the `port` to listen and to start listening! It's as easy as:

```crystal
server.bind_tcp 8081
server.listen
```

# And the final result is ... 🥁

```crystal
# file_server.cr
require "http"
 
path = "./public"
server = HTTP::Server.new([
  HTTP::LogHandler.new,
  HTTP::ErrorHandler.new,
  HTTP::StaticFileHandler.new(path),
])
 
address = server.bind_tcp 8081
puts "Listening on http://#{address} and serving files in path #{path}"
server.listen

```

To start the server 🚀

```terminal-session
$ crystal file_server.cr
Listening on http://127.0.0.1:8081 and serving files in path ./public
```

And that's it!! 
Now we have a file server running on `localhost`, port `8081`, serving files in the folder `./public`. 

Told you it was easy!! 😉

## Farewell and see you later.

**Coming next:** We are going to parameterize this static file server!
Stay tuned! 📻

👏 As always thanks to:
@bcardiff and @diegoliberman for reviewing this post and improving the code and text!!

_Photo by Jonathan Singer on Unsplash_
Typescript without Typescript
Tags: javascript, typescript, beginners
Published: 2020-01-14 16:04:06

---
title: Typescript without Typescript
published: true
description: 
tags: JavaScript, typescript, beginners
---

Typescript is fantastic. It will never be as sound as something like elm or Haskell, but it is what it is, and you should probably use it. The benefits of typescript itself can be read across the internet. This post isn’t the first or last to talk about typescript. What this post aims to achieve is showing how you can use typescript without having to fully commit to writing typescript yourself.

Although there are great projects like [parcel](https://parceljs.org/) and [tsdx](https://github.com/palmerhq/tsdx), setting up new (or even worse) or already-in-production apps to use typescript is not exactly easy. It takes time. Lots of confusing time.

### Setup

```shell
cd your-project #(or make new project)
npm init
npm install typescript --save-dev
npx tsc --init
```

Check out the options in the `tsconfig.json` file to get an understanding of the options.

After looking over `tsconfig.json`, make it look like this

```json
{
  "compilerOptions": {
    "allowJs": true,
    "checkJs": true,
    "strict": true
  }
}
```

Create `index.js`

```shell
touch index.js
```

Add some code to `index.js`

```javascript
function sumTwo(a, b) {
  return a + b
}
```

Now, if you're already using [vscode](https://code.visualstudio.com/), you will see where this is headed.

Run

```shell
npx tsc --noEmit
```

and you should see something like

```shell
λ npx tsc --noEmit
src/index.js:1:17 - error TS7006: Parameter 'a' implicitly has an 'any' type.

1 function sumTwo(a, b) {
                  ~

src/index.js:1:20 - error TS7006: Parameter 'b' implicitly has an 'any' type.

1 function sumTwo(a, b) {
```

## Closing

As you can see, without even having to fully invest in Typescript, you can still use it's compiler to help typecheck your code.

In future posts I want to also show:

- How you can interop with libraries
- How you can add types to your javascript files
- Awesome integration with vscode
Let's Build and Deploy a Website With Stackbit
Tags: jamstack, webdev
Published: 2020-01-14 19:19:34


[Stackbit](stackbit.com) makes building and maintaining modern websites easy. In this video, we'll take a look at how to get a website from zero to deploy using Stackbit.


{% youtube HQlRmpT6D-8 %}

Please don't forget to Share, Like and Subscribe :)
Day 5
Tags: kotlin, learning, challenge
Published: 2020-01-14 19:11:15

![Hello there](https://media.giphy.com/media/Nx0rz3jtxtEre/giphy.gif)

I hope you had a good weekend (and Monday) I didn't have the time to write the posts of this weekend but I did have the time to code...so there is day 5 !!

## Details
- Asked by: Dropbox
- Difficulty: Hard

## Problem

Implement an efficient string matching algorithm.

Given a string of length `N` and a pattern of length `k`, write a program that searches for the pattern in the string with less than `O(N * k)` worst-case time complexity.

If the pattern is found, return the start index of its location. If not, return `False`.

## My solution

Nothing really special about this one. Sadly, because of the ".length" I'm not under O(N*k).

```kotlin
/**
 * Search pattern into searchIn
 *
 * @param searchIn 
 * @param pattern substring to find in searchIn
 * @return start index in string of the pattern, null if not found
 */
fun find(searchIn: String, pattern: String): Int? {
    for (i in 0 until searchIn.length - pattern.length){
        for ((index, c) in pattern.withIndex()){
            if (searchIn[i + index] != c)
                break
            else if(index == pattern.length - 1)
                return i
        }
    }
    return null
}
```

Now I have a class, so see you tomorrow! :smiley:
Turning Bugs Into Features
Tags: healthydebate, debugging, discuss
Published: 2020-01-14 19:10:44

---
title: Turning Bugs Into Features
published: true
description: Can we really promote bugs into features?
tags: healthydebate, debugging, discuss
cover_image: https://thepracticaldev.s3.amazonaws.com/i/y5j43ruuo8cue2uku2nb.png
---

I was chuckling over MonkeyUser this morning...

![Monkey User: Fix](https://thepracticaldev.s3.amazonaws.com/i/y5j43ruuo8cue2uku2nb.png)

And then I got to thinking: can this ever be done *right*? Can you really promote a bug to a feature, but deliberately and usefully?

We often speak about bugs as if they're literal gremlin-like entities residing in our code, but they're usually just a flaw in our implementation logic. We meant to do X, we did Y instead.

What if some of those mistakes are really happy accidents?

![Abstruse Goose The Happy Programmer](https://thepracticaldev.s3.amazonaws.com/i/6pdz0moor7kk5x004get.png)

# Promote To Feature

The sort of bug I imagine as a candidate would have to be a [Bohr bug](http://catb.org/jargon/html/B/Bohr-bug.html) with a predictable, yet presently unexpected (and probably undesired) outcome.

For example, imagine a list view in a GUI. When you click on the `Add Item` button, you get another item...but the contents of the previously selected row are unexpectedly included. The user now has to remember to change all of those. Ugh! That's a bug.

The usual approach would be to rewrite the code for the `Add Item` button. But what if, instead, you *rename* the button and its code to `Duplicate Item` instead. **You promote the bug to a feature.** Then, you go back and define a brand new `Add Item` button that behaves as originally expected.

That's a painfully simple and obvious example, of course, but the idea is there. **How many sorts of these opportunities do we miss?**

# Potential Problems

At the same time, I see some potential issues if this is done wrong:

* The implementation of the bug-turned-feature would still need to be fully understood and tested. You don't want the new "feature" to have side-effects or develop other unexpected behaviors.

* Promoting non-deterministic bugs, such as [heisenbugs](http://catb.org/jargon/html/H/heisenbug.html) or [schroedinbugs](http://catb.org/jargon/html/S/schroedinbug.html), would result in poorly implemented (mis)features.

* One shouldn't use this approach to cover up actual mistakes. Take responsibility for bad code, even if you turn it around and make the most of it.

![CommitStrip: It's not a bug](https://thepracticaldev.s3.amazonaws.com/i/5cds0s7pectjuqg7a7a2.gif)

# Thoughts?

What do you think? Is this really a missed opportunity for improving code? What problems might exist? How should this be done for it to be successful, or should it be done at all?

---

<sub><sup>Comics from [MonkeyUser](https://www.monkeyuser.com/2020/fix/), [Abstruse Goose](https://abstrusegoose.com/467), and [CommitStrip](https://www.commitstrip.com/en/2017/04/03/its-not-a-bug/?).</sup></sub>
What are the top companies using blockchain in the FinTech sector?

Tags: blockchain, discuss
Published: 2020-01-14 19:09:19

In one of his interviews Sergey Nemesh, a CTO of Inn4science, said:
"In my opinion, top companies are those that make blockchain and cryptocurrencies, including [cryptocurrency wallet development] (https://www.inn4science.com/services/cryptocurrency-wallet-development/) and other infrastructure elements development, clear and user-friendly for millions of users around the globe, making it a part of their daily life and enhancing the whole Blockchain technology. I would single out the following companies: Ethereum, Bitfury, IBM, EOS. 

[Ethereum] (https://ethereum.org/) being a base of hundreds of other systems providing smart-contracts which is already transforming the world of business. 

[Bitfury] (https://bitfury.com/) which are developing microlights to improve transaction speed as well as frameworks for blockchain development.

IBM which developed [Hyperledger] (https://www.hyperledger.org/) - a landmark project which will influence the whole enterprise sector. 

I would say [EOS] (https://eos.io/) has a great idea of providing the first software for decentralized apps. But the implementation has not happened yet. In case of realizing of their idea we can easily call EOS one of the top companies in Blockchain sector, which will influence the whole industry.

Do you have other good examples? I need them for my essay. Thanks all of you!
AngularJS Recap in 2 Minutes
Tags: javascript, angular, webdev
Published: 2020-01-14 18:43:37

I recently got a new job 🎉 One of the first projects I am going to work on is build with AngularJS. I will for that reason look into the old framework. 

I have a few years back worked on projects build with AngularJS. It is not completely new to me. I will try to keep this article really short and more like an overview of the main topics. If I miss a important topic, then **please comment below**. 

## 2-Way Data Binding

[2-Way data binding](https://docs.angularjs.org/guide/databinding#data-binding-in-angularjs-templates) is the synchronization between the model and the view. When data in the model changes, the view reflects the change, and when data in the view changes, the model is updated as well.

```html
<input type="text" ng-model="hey">
<span>{{ hey }}</span>
```

## Directives

Directives are either an attribute `ng-` or a HTML tag `<custom>`, that tells the library to do something to a DOM element. Most of the [directives in AngularJS](https://docs.angularjs.org/api/ng/directive) are starting with `ng-` where *ng* stands for Angular.

## Expressions

Here we can access variables and functions from the scope. This could be interpolation bindings like `<span title="{{ header.title }}">{{ header.title }}</span>`.

## Modules

Modules are containers for the different parts of your app including controllers, services, filters and directives.

```js
var myAppModule = angular.module('myApp', []);
```

```html
<div ng-app="myApp">
    ...
</div>
```

## Controllers

This is here all the business logic behind views are being defined. The `$scope` in this example is basically the binding between the controller and the view. The `$scope` is a dependency and we need to add it as an array `['$scope', ...]`. It will work without adding `'$scope'` with an array `[...]`, but it can fail while minifying the AngularJS code.

```js
myApp.controller('WingardiumController', ['$scope', function($scope) {
    $scope.spell = 'Leviosa';
}]);
```

```html
<div ng-controller="WingardiumController">
    {{ spell }}
</div>
```

I know there is a lot more to AngularJS, but this is just a briefing of some main topics. Did I miss something extremely important? **Then please comment below.**
The DEV Team Just Got Bigger!
Published: 2020-01-14 18:34:49

---
title: The DEV Team Just Got Bigger!
published: true
description: 
tags:
cover_image: https://thepracticaldev.s3.amazonaws.com/i/97a2sge9bgapcn6szuep.png
---

We are so excited to welcome three new members to the DEV team: [Alex Smith](https://dev.to/atsmith813), [Michael Kohl](https://dev.to/citizen428), and [Pawel Ludwiczak](https://dev.to/pp). Alex and Michael are joining the team as developers, and Pawel is joining us as a product designer (though he knows how to code too)!

They all have unique backgrounds, and we're so happy that we get to benefit from their expertise and past experiences. You can learn more about Alex, Michael, and Pawel by reading their introduction posts. 

{% link https://dev.to/atsmith813/new-year-new-opportunity-same-me-i-ve-joined-the-dev-team-47k8 %}

{% link https://dev.to/citizen428/i-joined-the-dev-team-213b %}

{% link https://dev.to/pp/hello-world-20j5 %}

![ninja-turtle-high-five](https://media.giphy.com/media/10LNj580n9OmiI/giphy.gif)

Please give them a warm welcome!
Hello World!
Tags: meta
Published: 2020-01-14 18:30:29

(What a cliché for a post title on DEV...)

It is my pleasure to announce that I've just joined DEV team as [another](https://dev.to/lisasy/dev-product-design-6pf) Product Designer 🎉.

## Paweł + DEV?

I should actually start with: _Hi, my name is Paweł Ludwiczak, I'm a product designer based in Poland._

Okey, done.

Now a bit more interesting stuff... I've spent almost 4 years of my career as Product Designer at Stack Overflow so working for DEV kinda feels like home for me. But at the same time it's gonna be fun, fresh and new adventure because of its completely different approach for treating the community itself AND for the type of content served here.

Fun fact is that I've started my career as frontend developer doing some _PSD2HTML_ slicing (hey, this was a job back in a day!) and then also quite actively building internets using WordPress. Fun times! But I believe this experience taught me how to design products that are actually doable and not only looking good on Dribbble.

> Should Designers Code? 

**Yes.**

### Also...

When I don't move pixels around I'm a full-time dad (slap me in the face if I ever talk too much about parenting). Besides that, I have a pretty boring life and I absolutely enjoy that fact.

## Where you can find me?

- [Twitter](https://twitter.com/ludwiczakpawel)
- [Dribbble](https://dribbble.com/ludwiczakpawel)
- I'll be posting here on DEV as well, since _writing more_ is one of my 2020 resolutions.

---

I'm extremely excited for being able to work on DEV and to help enhance its usability and user experience. And obviously to make things pretty 👨‍🎨
New Year, New Opportunity, Same Me: I've Joined the DEV Team!
Tags: career, meta, news
Published: 2020-01-14 18:09:24

What better way to ring in the new year than a fresh start with an amazing team at DEV? I'm very excited to announce that I have joined the DEV team as a Software Engineer!

# Why I joined DEV
My greatest passions are teaching and community. DEV is very much the ideal intersection of both.

Coming from (in many ways) a non-traditional background, I was very fortunate to have a couple of really good mentors to help welcome me into the community when I first got started with Software Engineering. Since then, I've always had this burning desire to give back and help others to land the same or better opportunities than what was available to me.

Further building on the community, I love that DEV is open-source. After dipping my toes into the open-source world by writing a [Ruby gem to perform technical analysis on security prices](https://github.com/intrinio/technical-analysis), I was eager to contribute more and DEV is a fantastic community to contribute to.

In short, I'm hoping my skills and my unique background will be a value-add to the DEV team and the DEV community as a whole. I'm stoked to get started!

# A quick bit about me
A borderline cold brew coffee addict and a Florida native currently residing in Los Angeles, California, my name is Alex and it's a pleasure to e-meet you. If I had to describe a "personal mission statement", I'd say that mine is to provide others with opportunities - especially if it helps them move up the so-called socio-economic ladder.

While I've been doing Software Engineering for a few years, I actually started my career in Finance and I used to work on Wall Street. I'm always excited to learn new languages and I have varying levels of experience in several languages including Ruby, JavaScript, Python, Elixir, Java, and C#.

If you ever have any questions, comments, or just want to chat, feel free to reach out!

*In the spirit of the new year, my resolution/biggest goal for 2020 is to rescue a dog. Feel free to hold me accountable to this in any way you see fit (including, but not limited to, endless pictures and memes of dogs)* 😀
Improve your Github Actions security
Tags: github, security, node
Published: 2020-01-14 18:09:19

Just before Christmas, Julien Renaux published a [thought provoking article](https://julienrenaux.fr/2019/12/20/github-actions-security-risk/) on the risks of using GitHub actions that you don’t own.  You can read the whole thing, but Julien provides a summary for us at the top:

> TL;DR: Using GitHub actions with branch names or tags is unsafe. Use commit hash instead.

I agree with Julien that using arbitary actions is a risk, but as always it’s a compromise between security and making life easy for ourselves. Specifying a commit hash each time we want to upgrade could become painful very quickly, especially if you’re using a large number of actions.

With that in mind, I thought about how we could solve the problem with automation and came up with the following solution.

## pin-github-action

`pin-github-action` is a command line tool that allows you to target any commit reference, be it a `branch`, `tag` or `sha` whilst pinning to a specific `sha` in your actions.

It works by looking for any `uses` step in your workflows and replacing it with a `sha` and a comment.

```yaml
actions/checkout@master
```

Becomes

```yaml
actions/checkout@db41740e12847bb616a339b75eb9414e711417df # pin@master
```

This allows us to depend on a specific `sha` whilst still knowing what the original pinned version was. If we run the tool again, it will look up the latest `sha` for `master` (whether it’s a `sha`, `tag` or `branch`, in that order) and update the workflow to use that `sha`.

> If you're interested in learning more about Actions, check out [Building Github Actions](https://michaelheap.com/building-github-actions/?utm_source=devto&utm_campaign=pin-github-actions) to learn how to build your own custom actions in any language

## Using `pin-github-action`

The tool is written in Node, which means you’ll need to install it with `npm`.

```yaml
npm install -g pin-github-action
```

> If you get a permissions error, you may need to run `sudo npm install` instead

Once it’s installed, you provide the tool with a workflow file and it takes care of the rest.

```yaml
pin-github-action /path/to/.github/workflows/your-name.yml
```

If you’re using any private actions, you’ll need to provide the tool with a GitHub access token that can read the relevant repository

```yaml
GH_ADMIN_TOKEN=<your-token-here> pin-github-action /path/to/.github/workflows/your-name.yml
```

## Contributing

If you’re interested in reading the code or contributing the project, the source is available [on GitHub](https://github.com/mheap/pin-github-action)
It's Alive! A Django Shiv app - Building SaaS #23
Tags: python, django, saas
Published: 2020-01-14 18:02:44

{% youtube Z29teoL_hdg %}

In this episode, we made Ansible pull down the Django Shiv app from S3 during deployment.  Then we knocked out some kinks in the process to get the app working.

Show notes for this stream are at [Episode 23 Show Notes](https://www.mattlayman.com/building-saas/its-alive-django-shiv-app/).

To learn more about the stream, please check out [Building SaaS with Python and Django](https://www.mattlayman.com/building-saas/).