teleren/devto huggingface dataset:
Why i won't use React Hooks
Tags: javascript, react
Published: 2019-01-21 03:29:42

---
title: Why i won't use React Hooks
published: true
description: Why i won't use React Hooks
tags: javascript, reactjs
---

I'm passionate about ReactJS, because of its declarative programming model.

That means, in React,

```
view = function(state)
```

That's why i never mess React Component with side-effects, like ajax request or state.

With separate function for behaviour, you can easily reuse, unit test, and package it.

With React Hooks, what i have to do is to mess side-effects within the component.

It's not good to me.
It's not simple to debug.
It's not simple to reuse the behaviour.
It's not easy to unit test the behaviour.

That's why i would say NO to React hooks, because i prefer simplicity to magic.
I'm a simple developer, not a magician trying to understand wtf is going on with my production code.
Suggest.rb - tells you which method does the thing you want to do
Tags: githunt, ruby
Published: 2019-01-21 01:46:00

---
title: Suggest.rb - tells you which method does the thing you want to do
published: true
description: 
tags: githunt, ruby
cover_image: https://thepracticaldev.s3.amazonaws.com/i/t18jxeafezswly1bbjl8.png
---

I came across this project the other day and thought it was an interesting way to augment learning and using Ruby.

Suggest gives objects two extra methods; `what_returns?` and `what_mutates?`. Both methods take a result that you are interested in and return the methods you could call on the object to get that result.

For example:

```ruby
require 'suggest'

[1,2,3].what_returns? 1
=> [:first, :min]
```

I can see this being useful when you're tooling about in `irb` and you're sure that there is a method that does the thing you want but you can't remember it. It could save a trip to search the docs and could even suggest better methods than the one you were thinking of.

Check it out on GitHub:

{% github jbodah/suggest_rb %}
Switching to OpenSUSE. I have a few questions.
Tags: linux, help, opensuse, discuss
Published: 2019-01-21 00:57:41

---
title: Switching to OpenSUSE. I have a few questions. 
published: true
description: 
tags: Linux, help, opensuse, discuss
---

I am currently planning to switch from my MacBook Pro to a dell XPS 13. My preference is to go Linux and I have been a long time Ubuntu user. However, this time I want to try OpenSUSE given all the good reputation it has in the dev community. I have a few questions in this matter. 

1. How is the driver support for Dell XPS 13?
2. Which package manager should I use?
3. I have always used gnome. Should I switch to KDE?
4. Any anecdotes from fellow devs would really help me with the setup. 

Your comments will really help me with my transition.
2.5 months "on the bench"
Tags: personalnews, productivity, coding, programming
Published: 2019-01-21 00:38:38

---
title: 2.5 months "on the bench"
published: true
description: 
tags: personalnews, productivity, coding, programming
---

The last 3 of 4 tags for this articles are misleading; this is about *lack of* all of those.  Since I started a new job 2.5 months ago, I have been "on the bench" the entire time, and have not written A SINGLE CHARACTER OF CODE!!

For some reason I never thought of the analogy to sports, despite being a fan, until I read the [urban dictionary entry](https://www.urbandictionary.com/define.php?term=On%20the%20bench), which likens it to "waiting for (your) turn to go out and play", while "some of the team are on the field playing".  The page is spot on in other ways, at least as far as I'm concerned, i.e. "consultants understandably become worried that nobody wants their skills if left on the bench for too long."

Maybe the latter explains my continued flurry of activity on Github this month: ![](https://thepracticaldev.s3.amazonaws.com/i/uf2f3y0612x0ogrpe80j.PNG)
  

When (if?) my work starts the skills I've been informed are required will look great on my resume.  The holidays are great too, 10 a year instead of 6 or 7 like so many American jobs offer, typically none from Jan 1st until late May.  For instance, I have tomorrow off, though in a way, how will I be able to tell the difference ;)
Open Build Service- Contributing on a project
Tags: openbuildservice, linux, contributing, opensource
Published: 2019-10-28 09:54:10

---
title: Open Build Service- Contributing on a project
published: true
date: 2019-01-21 00:00:00 UTC
tags: openbuildservice,linux,contributing,foss
canonical_url: https://foursixnine.io/blog/2019/01/21/Open-Build-Service-Contributing-on-a-project.html
---

Here at SUSE we heavily use [Open Build Service](http://openbuildservice.org), and often while collaborating on a project (In my case, [openQA](https://openqa.opensuse.org)) one has to add a new package as a dependency from time to time, or has to do a backport for an older SLE or openSUSE Leap release

It boils down to the following steps, in this case I wanted to change the project to build against SUSE:SLE-12-SPX:Update instead of SUSE:SLE-12-SPX:GM which is a [build target](https://en.opensuse.org/openSUSE:Build_Service_supported_build_targets) that will get the updates while the GM doesn’t, all this, because I wanted to add openvswitch to the project, so that we could use new features in our openQA deployments.

To do this, after setting up the obs account, it boils down to:

1- Branch your project 2- [Link](https://en.opensuse.org/openSUSE:Build_Service_Concept_project_linking) your packages 2- Modify the project metadata if needed 3- Modify the project config if errors related to multiple choices appear (PostgreSQL will be there for sure!) 4- Grab a cup of coffee/tea/water and do [some reading](https://en.opensuse.org/openSUSE:Build_Service_Tips_and_Tricks) while waiting for the build

```
# Branch the project
osc branch devel:openQA:SLE-12

# Link the new package
osc linkpac openSUSE:Factory openvswitch
# More and more packages will say that their dependencies cannot be resolved, this is
# you might spend some time here adding bunch of dependencies :)
osc linkpac openSUSE:Factory dpdk devel:openQA:SLE-12
osc linkpac openSUSE:Factory python-six devel:openQA:SLE-12
```

By this point you might get error messages on the webUI stating that:

```
$a_package: have choice for $conflicting_package needed by $a_package: $options
```

As an example, it might happen that you see postgres-server there, having postgres96-server and postgres94-server as `$options`, you’ve got to choose your destiny!.

When you find this, it’s time to edit the project configuration:

```
# Since
osc meta prjconf devel:openQA:SLE-12 -e
# An editor will open and you will be able to change stuff
# Remember that you need write permissions on the project!
...
Prefer: postgresql96-devel
Prefer: postgresql96-server
Prefer: python-dateutil
...
```

Modify the project metadata to use :Updates instead of :GM, and change architectures if you need to do so.

```
# same as before: An editor will open, and you will be able to edit stuff
 osc meta prjconf devel:openQA:SLE-12 -e
  <repository name="SLE_12_SP4">
    <path project="SUSE:SLE-12-SP4:Update" repository="standard"/>
     <arch>x86_64</arch>
    <arch>aarch64</arch>
    <arch>ppc64le</arch>
  </repository>
```

After this, a project rebuild will take place, sit down and give some more reading :)
About Perl and mismatched binaries
Tags: perl, binaries, upgrades, cpan
Published: 2019-10-28 09:54:06

---
title: About Perl and mismatched binaries
published: true
date: 2019-01-21 00:00:00 UTC
tags: perl,binaries,upgrades,cpan
canonical_url: https://foursixnine.io/blog/2019/01/21/perl-binaries-are-mismatched.html
---

# The horror

You happen to update your system (In my case, I use Tumbleweed or Gentoo) and there’s new version of Perl, at some point there’s the realization that you’re using [local::lib](https://metacpan.org/pod/local::lib), and the pain unfolds: A shell is started, and you find a dreaded:

```
Cwd.c: loadable library and perl binaries are mismatched (got handshake key 0xdb00080, needed 0xdb80080)
```

Which means: that the module (Cwd in this case) is not compatible (Because it’s an [XS module](http://modernperlbooks.com/mt/2009/05/perl-5-and-binary-compatibility.html)) with your current version of perl, installed on your system: Likely it was compiled for a previous version, leadin to those [binaries mismatching](https://rt.perl.org/Public/Bug/Display.html?id=133440)

## Don’t panic!

In the past, I used to reinstall my full local::lib directory, however after hanging out and asking few questions on #toolchain on irc.perl.org, I got to write (or rather hack, an ugly hack) a quick perl script to walk the [local::lib](https://github.com/foursixnine/stunning-octo-chainsaw/blob/master/ll-walker.pl) packages that were installed already, only looking at the specified directory… it worked well, gave me the list of what I needed so I could reinstall later, however Grinnz pointed me to his [perl-migrate-modules](https://bit.ly/2CwLXvb) script, to which after chatting a bit, he added the `from` switch, which allows people to reinstall all the modules that were present in an old local::lib directory:

## The light

```
# Migrate modules from an old (inactive) local::lib directory
$ perl-migrate-modules --from ~/perl5-old/lib/perl5 /usr/bin/perl
```

Hope you find it useful :)
How is it done – A gradient border with a single element
Tags: css
Published: 2019-01-21 12:39:41

---
title: How is it done – A gradient border with a single element
published: true
tags: css
canonical_url: https://www.stefanjudis.com/blog/how-is-it-done-a-gradient-border-with-a-single-element/
---

It took me a while to figure out how [CSS Tricks](https://css-tricks.com/design-v17/) do these fancy looking gradient borders in their new redesign. And because I want to sharpen my design skills I made a sketch explaining how it works.

*Partially related: [background clip is configurable for every background gradient separately](https://www.stefanjudis.com/today-i-learned/background-clip-is-configurable-for-every-background-gradient-separately/)*.

You can play around with it on [CodePen](https://codepen.io/stefanjudis/pen/oJrRjp?editors=1100).

![Graphical explanation on how CSS tricks creates the illusion of gradient borders with one pseudo element and several gradients](//images.ctfassets.net/f20lfrunubsq/4LJE9xCoaLPUkjX2QFGtFN/42591ed6eee1a73515cf8343bd0c0633/gradient-border-small.jpg)
New Year, New Interface!
Tags: startup, learntocode, release
Published: 2019-01-20 21:56:56

---
title: New Year, New Interface!
published: true
description: We've been hard at work on a new tab-based interface. It's up, and here's why we're so excited! 
tags: startups,learntocode,release
canonical_url: https://next.tech/blog/new-year-new-interface
cover_image: https://thepracticaldev.s3.amazonaws.com/i/7jf1o7ed2sty3s7fuuk9.png
---

At Next Tech we’re are incredibly excited to announce the release of our tab-based interface! This enables any interface component (e.g. a web browser or terminal) to be placed in any section (or “pane”) of the interface. This means a terminal can be loaded next to a code file, a full GUI viewer can be alongside a SQL display, and so forth.

Previously, each pane could only support a single component. So if you wanted a code editor, terminal, and web browser, you needed a three pane layout. This worked well for introductory use cases but as we’ve pushed further into serving developers as well as beginners with learning materials, we found this approach to be a major limitation. For example, when teaching a web framework, a terminal is only required to run a command or two. So having to keep it on the screen taking space away from a code editor and web browser led to an unnecessarily squashed layout.

Here’s what that might have looked like before:

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


And here’s what it would look like now:

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


Note that the GUI and terminal tabs are now located side-by-side in a two pane layout versus requiring a three pane layout to accommodate the identical use case.

Now the large number of interface elements we support and the new ones we’re creating can be mixed and matched in hundreds of ways. The option to open a new tab can also be left to the learner versus pre-configured.

Currently, we support the following tab types:

* Editable code and text files
* Terminals with or without root access
* Web browsers for any port
* GUI displays with X support
* SQL result tables
* Python graphic displays for Skulpt programs
* Media files such as images and videos

We believe wholeheartedly that providing a traditional IDE loaded with menus does a disservice to learners and anyone working on a project. At the same time, a box that simply runs code isn’t useful either. So this interface, like others we have built, was designed carefully, one piece at a time to ensure it is powerful yet simple for anyone to use.

We’ve already put this interface to good use with a number of our courses on programming, web development, database design, and machine learning. We’re now offering a $9 a month subscription to access our courses, and you can [get started free for a week](https://next.tech/register)!

If you’d like to learn more about how to build your own courses with this interface atop Next Tech, we’d love to [hear from you](https://next.tech).
Testing "install" and "update" flows in chrome extensions
Tags: chromeextension, javascript, flashpost, testing
Published: 2019-01-20 19:30:14

---
title: Testing "install" and "update" flows in chrome extensions
published: true
description: Testing chrome extension wrt install and update flows may become tricky and there is a way to test in development mode. Let's walk through the steps in this tiny post
canonical_url: https://blog.gokatz.me/test-install-update-flow-chrome-extensions
tags: #chromeextension #javascript #flashpost #testing
---

_Originally posted in [my personal blog](https://blog.gokatz.me/test-install-update-flow-chrome-extensions) : [https://blog.gokatz.me](https://blog.gokatz.me)_ 

This is a very tiny post pointing out to an existing chrome app development guide about testing chrome extension with respect to install and update flows. These testing may become tricky because during the development stage we use [**Unpacked extensions**](https://developer.chrome.com/extensions/getstarted#manifest). With this method, we may not get to test the actual install and update flows as the related event will not be fired. 

For instance, it's hard to test the *permission* flow when using the unpacked extension. We might include new permission into our manifest and need to test before pushing into the web store. 

There is a way to test such scenarios. We can pack the extension locally (into a `.crx` file) and install our actual extension from a local file (using `.crx` format of the extension). So that, the chrome will treat it as a normal install. Thus, we can test all the install as well as update workflows. 

This [section of the chrome extension development guide](https://developer.chrome.com/extensions/permission_warnings#view_warnings) walk through the process of:

* Creating a `.crx` file (extension source) and `.pem` file (private key) for your extension 
* Installing the `.crx` file into Chrome
* Simulating the update process using the `.pem` file. If the extension is loaded without a `.pem` file, it will be acted as a new install and if we load with an existing `.pem` file, the loaded `.crx` file will be treated as an update to an existing  extension (if exists)

This section will be focused on the permission part we saw as an example. Hope this helps in deploying your extension with confidence. 

**Bonus Note:**

Always have a staging build for your extension such as a separate webstore extension [visible only to testers](https://developer.chrome.com/webstore/publish#publishing-to-test-accounts). Publish new builds to the test extension before making it live. I bet it will save you from a ton of awkwardness. It helped me a lot 😉
How to get index from a JSON object with value: javascript
Tags: javascript, findindex, objectindex
Published: 2019-01-20 18:41:06

---
title: How to get index from a JSON object with value: javascript
published: true
description: How to get index from a JSON object with value
tags: javascript, findindex,object index
---

In modern browsers you can use findIndex:

```
var students = [
 {id: 100 },
 {id: 200},
 {id: 300},
 {id: 400},
 {id: 500}
];
var index = students.findIndex(std=> std.id === 200);
```

But this function is not supported by even not so old versions of a few browser as well as in IE (EDGE supports it). So below is a workaround using [javascript](https://anjandutta.com/javascript-es6-default-parameter/):
You can use either `Array.forEach` or `Array.find` or `Array.filter`

```
var students = [
 {id: 100 },
 {id: 200},
 {id: 300},
 {id: 400},
 {id: 500}
];
var index = -1;
var needle = 200;
var filteredRes = students.find(function(item, i){
 if(item.id === needle){
 index = i;
 return i;
 }
});
console.log(index, filteredRes);
/*Result: 1 Object { id: 200 }*/
```
This method takes little more overhead as it loops through the whole object to search for the match. So, for lengthy JSON data, this method is not suggested(even though it gets the work done).
Be The One Who Ships
Tags: startup, learning, products, software
Published: 2019-01-20 18:38:54

---
title: Be The One Who Ships
published: true
description: Simple strategies to never lose sight of the most important weapon at your disposal — shipping
tags: startup, learning, products, software
canonical_url: https://vinthanedar.com/2019/01/17/teams-that-ship/
cover_image: https://thepracticaldev.s3.amazonaws.com/i/x3zi3u0tonkg1ogk52xi.jpg
---

As hackers, engineers, entrepreneurs, and side-project doers, we tend to be perfectionists. We care about the work product we put out there, and want to make sure we showcase our best work.

However, most of us likely have half-done (abandoned) projects, ideas we have that never seem to get off the ground, or projects that move so slowly that we might as well have never started. I've been there numerous times myself.

It's not that we can't quite see the problem - perfection is the enemy of good enough. This is especially true when there are time and resource constraints.

I documented some of what we did right and pitfalls we avoided in the past year and a half of shipping product at my startup.

You may relate to these, and I hope you catch yourself the next time you find yourself committing one of these (unforced) errors, and course correct your way to *done* sooner.

I originally posted this to my personal blog here - [https://vinthanedar.com/2019/01/17/teams-that-ship/](https://vinthanedar.com/2019/01/17/teams-that-ship/)

Hope you enjoy reading it and would love to hear about your experiences!

tl;dr

Whether it's a side project, or building software at your company:

**Build and preserve momentum like your life depends on it**
*Keep moving forward one bit at time, no matter how minor the step may be.*

**Progress > Polish** 
*It is a vastly better approach to circle back to make something better, but after having gone to battle with it.*

**Be your own customer**
*Dog-food your product to enable faster progress.*

**Beware of rabbit-holes. They are the plague.** 
*Be ruthless in doing things that need to be done, not the things you want to do.*
Announcing TwitterOAuth 1.0
Tags: opensource, twitter, php, announcement
Published: 2019-01-20 18:27:08

The [TwitterOAuth PHP library](https://twitteroauth.com), the easiest way to integrate the Twitter API with your app, has hit a long overdue milestone: **1.0**.

You can install 1.x with [composer](https://getcomposer.org) now:

~~~bash
composer require abraham/twitteroauth '^1'
~~~

1.x will now be maintained in the [v1](https://github.com/abraham/twitteroauth/tree/v1) branch and will only get security and major bug fixes going forward. 1.x will also be the last version to support PHP before 7.2.

Development of 2.0 has started, you can checkout the goals on GitHub:

{% github https://github.com/abraham/twitteroauth/issues/686 %}
TIL: window.setImmediate() has gone
Tags: javascript, browser
Published: 2019-01-20 17:34:41

---
title: TIL: window.setImmediate() has gone
published: true
description: Alternative of window.setImmediate()
tags: JavaScript, Browser
---

`window.setImmediate` was non-standard browser API to execute given function as soon as possible in another JavaScript context.
But Chrome removed this.

```
VM237:1 Uncaught ReferenceError: setImmediate is not defined
```

The alternative is `window.queueMicrotask()`, which was defined by WHATWG as standard spec.

https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#microtask-queuing

```js
window.queueMicrotask(() => console.log('this code runs as soon as possible!'));
```
Configure OpenVPN Access Server on Azure
Tags: vpn, cloud, azure, security
Published: 2019-01-20 17:21:24

---
title: Configure OpenVPN Access Server on Azure
published: true
description: Configure OpenVPN Access Server on Azure
tags: vpn, cloud, azure, security
---
A VPN, or virtual private Network, is a secure tunnel between two or more devices. VPN is used to protect private web traffic from snooping, interference, and censorship.

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

Why should we use a VPN?
On the one hand, to protect us from monitoring of our ISP, on the other hand, we can protect our Internet traffics in an open WLAN Hotspot like in a Cafe.

With Azure, we can easily set up an OpenVPN and use it privately.

On medium, I wrote a tutorial how to set up an OpenVPN Access Server on Azure.

You can find it here:
https://medium.com/@evgenijrenke/configure-openvpn-access-server-on-azure-6e6120bacddf
React or Angular for enterprise?
Tags: discuss, webdev, javascript, typescript
Published: 2019-01-20 16:32:21

---
title: React or Angular for enterprise?
published: true
description: Let's discuss which is better for big projects, Angular or React?
tags: discussion,webdev,javascript,typescript
cover_image: https://thepracticaldev.s3.amazonaws.com/i/odqqcwbwqlkl4uwk5os4.jpg
---

I recently had a discussion with colleagues about React vs. Angular for enterprise applications. I'd like to bring this discussion to the dev.to community as well.

The core arguments were:

1. React comes with less built-in tools than Angular. Therefore, React setups need to complement vanilla React by installing open-source dependencies. This makes the on-boarding of new developers to a project built with React more difficult, as any unknown dependencies need to be learned first. Whereas Angular has necessary concepts and tools built-in, which Angular developers already know and therefore have a quicker on-boarding to a new project.

2. Angular uses Typescript by default and is built with Typescript in mind. React isn't. Certain patterns in React are hard or cumbersome to type correctly. As Typescript is generally preferred over JS in enterprise projects, Angular is the better choice.

🤔💭 **What are your thoughts on this?** 🤔💭
Build your own {{insert technology here}}
Tags: githunt, build, learning
Published: 2019-01-20 16:01:39

---
title: Build your own {{insert technology here}}
published: true
description: Build your own X, a series of tutorials
tags: githunt, build, learning
cover_image: https://github.com/danistefanovic/build-your-own-x/raw/master/feynman.png
canonical_url: https://piraces.dev/posts/build-your-own-insert-technology-here/
---

Hello, I just want to show the community this awesome repo that consists in a series of different tutorials about how to build your own database, git, network stack, shell, docker... and many more!

Sure it's worth a ⭐️!

**Check it out:**

{% github danistefanovic/build-your-own-x %}


*"What I cannot create, I do not understand."*

― Richard P. Feynman

Happy coding!