teleren/devto huggingface dataset:
Write a script to identify an anagram
Tags: challenge
Published: 2018-02-01 16:19:44

---
title: Write a script to identify an anagram
published: true
cover_image: https://cl.ly/2O2t1m0k0L0j/Image%202018-02-01%20at%2011.18.33%20AM.png
description: Use an algorithm to identify if two strings are an anagram for each other.
tags: challenge
---

Inspired by [this tweet](https://twitter.com/fermatslibrary/status/958700402647674880) from the always awesome [Fermat's Library](https://twitter.com/fermatslibrary).


{% tweet 958700402647674880 %}

## Challenge

In the language of your choice, **write a script that will determine if two strings are an anagram for each other**.  You can use the approach outlined in the tweet, or — for bonus points — come up with your own solution 🤓.

Via [Wikipedia](https://en.wikipedia.org/wiki/Anagram):

> An anagram is word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.

For our challenge, we'll use the strict definition — each letter **must** be used exactly once.


**Expected Behavior**:
```javascript
isAnagram(stressed, desserts) // TRUE
isAnagram(happy, sad) // FALSE
```

Have fun!
JSX on the Backend?!
Tags: discuss, showdev, jsx, react
Published: 2018-02-01 15:22:08

---
title: JSX on the Backend?!
published: true
tags: discuss, showdev, jsx, react
---

Hi!

Recently I had an idea how to improve the development experience when creating NodeJS servers (in particular, with express). But first I would like to explain some problems I see with barebones express apps:

1) lack of  API documentation. You need to learn/integrate Swagger or API Blueprint to get proper API docs
2) lack of automatic input/output validation. With JavaScript, it's a bit hard to control if everything is properly typed. You need to write validation yourself or employ some validator libs or JSON schema validators.
3) low discoverability. No easy way to generate client code with types and validation.

What I thought would be cool is to have a standard format to define all aspects of a server with HTTP API. This format should be simple and not entirely new. So I thought that JSX is excellent for this. With JSX a typical server looks like this:

```jsx
<Service
  id="hello-world-service"
  port={3000}
  version="0.1.0"
  contact="orkon"
  tags={['node', 'service']}
  endpoint="http://dev.server.at.home"
>
  <Middleware use={require('./middleware/logger')} />
  <Group name="Hello" description="All routes related to saying Hello">
    <Route
      description={'Generates a message in the format "Hello :who!"'}
      path="/hello/:who"
      method="get"
      handler={require('./handlers/getHello')}>
      <Request>
        <PathParameter name="who" type="string" />
      </Request>
      <Response schema={require('./schemas/getHello.res.json')} />
    </Route>
  </Group>
</Service>
```

```js
const server = getExpressServer(compile(__dirname + '/definition.jsx'));

server.listen(3000, () => {
  console.log('server started');
});
```

The cool things I see about it:

- easy to read (especially if you are familiar with JSX/React)
- easier to compose different APIs
- connects implementation with documentation
- allows generating input/output validators thanks to JSON Schema
- allows generating proper API docs
- allows discovering how to invoke the service
- hides the underlying framework (it can be express, koa, etc.)
- behind the JSX it is just plain JS classes/objects, so the use of JSX is optional

Project URL: https://github.com/OrKoN/api-express

Do you think it's a good idea?
Level up with the Awesome Leadership and Management List
Tags: leadership, management, techculture, showdev
Published: 2018-02-01 14:51:11

---
title: Level up with the Awesome Leadership and Management List
published: true
description: 
tags: leadership, management, tech culture, showdev
---

Whether you're an experienced tech manager, a newbie, or an engineer who wants to take a leadership role in your team, you'll find plenty of inspiration and new ideas at the [Awesome Leadership and Management List](https://github.com/LappleApple/awesome-leading-and-managing). Find pages of links to resources on culture, hiring/interviewing, retention, transitioning to leadership and much more. Feel free to make a pull request with your favorites after reviewing the [Contributing.md](https://github.com/LappleApple/awesome-leading-and-managing/blob/master/CONTRIBUTING.md).
Keeping the Footer at the Bottom with CSS-Grid
Tags: grid, footer, css
Published: 2018-02-01 11:50:26

---
title: Keeping the Footer at the Bottom with CSS-Grid
published: true
tags: grid, footer, css
---

![Title-Image](https://thepracticaldev.s3.amazonaws.com/i/bjqfoz0sunpyyu34th8p.jpg)

At some point in a project, one gets annoyed by the footer hovering right under the header, because there is no content yet to fill up the space. There also may be some really short pages (like the 404), which might not be long enough to fill the whole browser.

Keeping the footer at the browser's bottom just got a little bit easier with CSS-Grid. It's possible to go with some CSS-trickery, Flexbox or JS, but the Grid-solution is the most elegant and simple in my opinion.

Please note that this is only supported in modern browsers, as of this writing. The good thing is, that this method won't break anything for older browsers.

The HTML-Structure will be as follows:

```html
<html>
	<body>
		<article>
			<header>
			</header>
			<main>
			</main>
			<footer>
			</footer>
		</article>
	</body>
</html>
```

This is probably a bit simplified in comparison to some real-world-projects. It's important to keep the main content-area (main) and the footer (footer) in the same parent-element.

```css
html, body {
	width: 100%;
	height: 100%;
}

article {
	min-height: 100%;
	display: grid;
	grid-template-rows: auto 1fr auto;
    grid-template-columns: 100%;
}
```

The important bit is the "grid-template-rows"-property. Here we tell the browser, that we want the first child-element of "article" to be just as high as it naturally is ("auto"). The second should be one [fr](https://www.w3.org/TR/css3-grid-layout/#fr-unit) high, which means it will get as high as possible, since there's no other fr-item in there. The third child will be of natural height. again.

Don't forget to set the html- and body-elements to be of 100% height, or else your grid-container won't fill up the entire browser.

Here's the working example on CodePen.

{% codepen https://codepen.io/niorad/pen/RQPgqV %}

In case you didn't know: CSS-Grid is now supported on every modern browser. It's a convenient way to define page-layouts and so much more. Go check out Wes Bos' [free course](https://cssgrid.io/) on the topic.

**EDIT:**
You can achieve the same thing with Flexbox. If you need the feature today (Jan 2018), this would be a wider supported way. Check out Dominik Weber's article ["Keeping the footer at the bottom with CSS Flexbox"](https://dev.to/domysee/keeping-the-footer-at-the-bottom-with-css-flexbox-5h5f)

**UPDATE:**
Firefox 52 supports Grid, but it's buggy, especially for this case. The elements are not keeping their natural heights. So if you need to support FF52, use the Flexbox-Solution.
Explain Activity Lifecycle Like I'm Five
Tags: explainlikeimfive, android
Published: 2018-02-01 11:43:08

---
cover_image: https://thepracticaldev.s3.amazonaws.com/i/dp1gzzi5wuk2lklmtylx.jpg
title: "Explain Activity Lifecycle Like I'm Five"
published: true
tags: explainlikeimfive, android
---
New Productivity Features in Updated dbForge SQL Complete v5.8
Tags: sqlintellisense, sqlformatter, sqlcomplete, sqlcodeformatter
Published: 2018-02-01 09:34:04

---
title: New Productivity Features in Updated dbForge SQL Complete v5.8

published: yes
description: Devart, a recognized vendor of professional database management software for developers and DBAs, announced the release of dbForge SQL Complete v5.8 with new productivity features, such as Result Grid Aggregates, Find in Results Grid, Execution warnings, CRUD generator, and much more.

tags: sql intellisense, sql formatter, sql complete, sql code formatter

---
Compiling Box2D from source for Codeblock using mingw and cmake
Tags: box2d, mingw, cmake, codeblock
Published: 2018-02-01 08:34:12

---
title: Compiling Box2D from source for Codeblock using mingw and cmake
published: true
description: 
tags: box2d,mingw,cmake,codeblock
---
# Compiling Box2D Static Lib
## 1. Getting the sauce
Get the latest Box2D release from [github link](https://github.com/erincatto/Box2D/releases) as the zip form.

Unzip it and put into any directory you like.

## 2. Modifying some stuff
Open `Box2D > CMakeLists.txt`, as below :

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

Then remove this few lines including glui, freeglut and test bed into the compilation, so that you won't need to add them in, as below :

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

Then save it.

Then head to `Box2D > Box2D > CMakeLists.txt`, add this line on top :

```
cmake_minimum_required(VERSION 3.10)

```
You can change to your version of cmake also.

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

## 3. Configure Cmake and generating
Open cmake-gui and set the source and target path, following your box2d directory :
![alt text](https://thepracticaldev.s3.amazonaws.com/i/kco68mfmde3vyi2eu0nn.png)

Then, click `Configure`.

Select `CodeBlocks - MinGW Makefiles` .
![alt text](https://thepracticaldev.s3.amazonaws.com/i/pvchism2n0iq5d0xhdgm.png)

Click okay, then you might see something like this and some errors :
![alt text](https://thepracticaldev.s3.amazonaws.com/i/taf1bbjhzpms0bczvo0o.png)

Just ignore them and click `Configure` again. You should see it getting configuration done like this :

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

If its done, just click `Generate` there. A `Generating done` will be logged out.

## 4. Compiling
Then go to `Box2D > Build`,

Spawn a terminal there and run `mingw32-make`

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

Wait until it finished running.

Then go to `Box2D > Build > Box2D`, you will find `libBox2D.a` there, as below : 

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

## 5. Using it with CodeBlock

1. Put `libBox2D.a` into `MinGW > lib`.
2. Copy `Box2D > Box2D`, the `Box2D folder` inside `root Box2D directory` into `MinGW > include'.
3. Then in CodeBlock, open `Settings > Compiler > Linker Settings > Add Library` and Select `MinGW > lib > libBox2D.a`.

## 6. Setup is done :)
Test it out, here is a test cpp from my uni course [gist](https://gist.github.com/MutatedBread/3b88095b334d8fdd1fce5c5a4b5c2011).

## 7. Why am I doing this
I am just merely trying to challenge myself to compile it and not following instructions.

## 8. Test ?
I tested the compiled lib with a uni provided cpp along with sfml, somehow it works without glui and freeglut.

                    ¯\_(ツ)_/¯
nuster - A web caching proxy server based on HAProxy 
Tags: showdev, devops, opensource, linux
Published: 2018-02-01 07:59:55

---
title: nuster - A web caching proxy server based on HAProxy 
published: true
description: 
tags: showdev,devops,opensource,linux 
---

Hi all, I have created a web caching proxy server [nuster](https://github.com/jiangwenyuan/nuster), please give it a try and star:)


Introduction
============

Nuster is a simple yet powerful web caching proxy server based on HAProxy.
It is 100% compatible with HAProxy, and takes full advantage of the ACL
functionality of HAProxy to provide fine-grained caching policy based on
the content of request, response or server status, such as,

 * request url: cache only if the request url equals to X
 * request query: cache only if the request query contains X and equls to Y
 * cookie: cache only if cookie contains X and equls to Y
 * response header: cache only if the response contains header X equals to Y
 * rate: cache only if the request rate is greater than X
 * etc, any combination of above


Performance
===========

Nuster is very fast, some test shows nuster is almost three times faster than 
nginx when both using single core, and nearly two times faster than nginx and
three times faster than varnish when using all cores.

See [detailed benchmark](https://github.com/jiangwenyuan/nuster/wiki/Performance-benchmark:-nuster-vs-nginx-vs-varnish)


Installation
============

Download
--------

Download stable version from [releases](https://github.com/jiangwenyuan/nuster/releases) page
for production use, otherwise git clone the source code.

Build
-----

```
make TARGET=linux2628
make install
```

> use `make TARGET=linux2628 USE_PTHREAD_PSHARED=1` to use pthread lib

See [HAProxy README](README) for details.

Docker
------

```
docker pull nuster/nuster
docker run -d -v /path/to/nuster.cfg:/etc/nuster/nuster.cfg:ro -p 8080:8080 nuster/nuster:1.7.9.3
```

See usages, FAQ, examples on [Github](https://github.com/jiangwenyuan/nuster/blob/master/README.md)
Any Tips on Increasing Bus Factor?
Tags: discuss
Published: 2018-02-01 07:51:22

---
title: Any Tips on Increasing Bus Factor?
published: true
description: 
tags: discuss
---

The "bus factor" is a measure of a project, the term holds the question "what would happen if someone on the team (specific or not) is hit by a bus?". Will the project go on as usual, barely survive, or is there knowledge that is compartmentalized in such a way that if you take someone down everything will come crashing down?

On our team, despite daily scrum meetings, we feel that once tasks are assigned people on the team can't easily take over for a member who was run over (or went on vacation, for that matter).

How do you keep up your bus factor?
Do you?
Nice Tips?

Share it all!
Blockchain and Blockstack: Saving the Internet's Future
Tags: blockchain, blockstack, javascript
Published: 2018-02-01 07:31:40

---
title: "Blockchain and Blockstack: Saving the Internet's Future"
published: true
description: Exploring the Blockchain, Implementing a Simple Version, and Defining why Blockstack Will Save the Internet
tags: Blockchain, Blockstack, Javascript
---
Exploring the Blockchain, Implementing a Simple Version, and Defining why Blockstack Will Save the Internet: 

https://medium.com/@shmuel.lotman/what-the-heck-is-blockchain-and-lets-blow-up-the-internet-part-1-8b91656a2abf

https://medium.com/@shmuel.lotman/what-the-heck-is-blockchain-and-lets-blow-up-the-internet-part-2-5b3a09f58f36

https://medium.com/@shmuel.lotman/what-the-heck-is-blockchain-and-lets-blow-up-the-internet-part-3-1610d626184f
TIL: psql with VSCode
Tags: todayilearned, psql, sql, vscode
Published: 2018-02-01 22:57:00

---
title: "TIL: psql with VSCode"
published: true
tags: til, psql, sql, vscode
canonical_url: http://www.geekytidbits.com/2018/02/01/til-psql-with-vscode.html
---

I was catching up on my Feedly yesterday and ran across [Postgres Hidden Gems](http://www.craigkerstiens.com/2018/01/31/postgres-hidden-gems/) by Craig Kerstein. There are some really neat things in that list! One thing that caught my eye was this one:

> @l\_avrot – The fact that we can use vim editor in psql

Really? I didn’t know that. Tell me more. So I Googled a bit and of course another post from Craig titled [How I Work With Postgres – Psql, My PostgreSQL Admin](http://www.craigkerstiens.com/2013/02/13/How-I-Work-With-Postgres/) popped up. Here, he explains how to use `\e` in psql to “allow you to view and edit your last run query in your editor of choice”. That sounds really useful, especially when working with longer, more involved queries.

My “editor of choice” is [VSCode](https://code.visualstudio.com/) and when I attempted to use `\e` with my `EDITOR` var set to “code” it did not work. The current query was not passed to VSCode and when saving the file from VSCode, nothing got sent back to psql.

More Googling and fiddling and I found that I needed to add the `-w` parameter when launching VSCode so that it would “Wait for the files to be closed before returning.”, per the `--help` output. Also, I learned that you can use `PSQL_EDITOR` to set the editor specific to psql, which I prefer because I like keeping `EDITOR` set to vim for varios shell things. Editing SQL, however, I would much prefer to do in VSCode rather than vim, thank you very much. So, now I have the following environment variable defined in my .zshrc:

```
export PSQL_EDITOR="code -w"
```

Now when I enter `\e` from psql, VSCode launches with the contents of my current or last executed query and saving the file results in psql executing the query. Awesome!
Building a Simple API with AdonisJS [NodeJS]
Tags: node, beginners, showdev, javascript
Published: 2018-02-01 02:13:36

---
title: Building a Simple API with AdonisJS [NodeJS]
published: true
description: AdonisJS is an MVC Framework for NodeJS. Learn many of the basics by creating a simple API.
tags: node, beginners, showdev, javascript
cover_image: https://thepracticaldev.s3.amazonaws.com/i/bjaavykej9t5fkyd3hdy.png
---

> Subscribe to my YouTube channel for [more tutorials on working with VueJS and AdonisJS -- an MVC framework for NodeJS](https://www.youtube.com/channel/UCF5w1QdWroWOoxxXMgp88AQ?sub_confirmation=1)!

If you've never heard of AdonisJS before, you're in for a treat. Fans of Laravel will especially love this framework. 


---
**TL;DR**

I've completed my first tutorial series on creating a simple API using AdonisJS -- an MVC framework for Node.

In the series I cover the following:
- using the Adonis CLI to quickly create a project and important files
- routing
- database migrations
- CRUD operations on a MySQL db via Lucid ORM and the Query Builder
- Middleware

Throughout the course I walk you through the documentation and even some source code so you will be armed with the understanding to excel on your own.

I also provide a cheatsheet on Github with many suggestions on how you can challenge yourself to learn even more.

{% youtube 5wzcRtrRVd4 %}

* [View the series here](https://www.youtube.com/watch?v=5wzcRtrRVd4&list=PLoCq0WM_wHG-rFQEsShMQkgGcTO1Hmnvx).
* Find the [cheatsheet here](https://gist.github.com/patrickodacre/31590fa7ef9983a94444fba90cc63ec3).

---


When I first began planning a personal project last year, I knew I wanted to use Node, but I was not looking forward to working with so many different libs to get what I needed -- Express, Knex, Nodemailer, Passport, etc. 

It's not that I thought it would be especially difficult putting all those together; I know many others work with just that stack.

What I really wanted, though, was all those things in a nice neat bundle to make things less tedious.

I'm very happy I found AdonisJS.

Please have a look at the course and let me know what you think. Any and all constructive feedback is appreciated. I found the whole process very challenging, and I look forward to getting better at creating tutorials like this.

Likes and subscribes on YouTube would be great. You can also sign up for the email list on my site if you want to get notified when new tutorials are added.

Thanks!
Quick Javascript Tips 1: Easiest way to get enter key event with jQuery.
Tags: javascript, beginners, webdev
Published: 2018-02-01 01:40:28

---
title: "Quick Javascript Tips 1: Easiest way to get enter key event with jQuery."
published: true
cover_image: https://thepracticaldev.s3.amazonaws.com/i/rg46xepu8jedj8gjcj41.jpeg
description: Learn to get enter event the easiest way
tags: javascript, beginners, webdev
---

This the first of a series of quick tips that I’m using on the day-to-day coding with Javascript. 

This one is about something really not cool that is getting the enter key event.

Let’s assume you have to build a search bar at the top of a website. 

To make a search the user should press enter or click on the search button. That sounds easy. Since I’m using jQuery it’s something like this.

```javascript
$('input').on('keypress', (event)=> {
        if(event.which === 13){
            //Do Something
        }
});
```

That basically says: when the user types on the input, if the key he pressed has the code 13 (usually the enter key) do something. 

If you test it on chrome it’ll work just fine. But when you test on an Android device, hell will come to earth: every key has code 229!

![alt text](https://thepracticaldev.s3.amazonaws.com/i/a0olu51o12j02rwh33we.jpeg "HellCameToEarth")
*Every key has code 229!!*

But don't despair! Here’s the thing: 229 is the key event that the browser emits when it’s processing what the user typed, and **that happens a lot on Android because of auto-correct**. 

Because the auto-correct is processing the event to foresee what the user is typing, this piece of code won’t work because it’s always getting code 229 instead of each of the Key’s individual code... That’s not cool.

But to overcome this you can do the most native option with the widest support of every browser. 

Wrap your search bar in a **form** tag.

**Really simple and easy.**

Just put everything inside a form tag...

```html

<form>
    <input type="text">
    <button type="submit">
	Search!
    </button>
</form>
```

...and deal with the submit event to do what you want!


```javascript
$('form').on('submit', (event)=>{
	event.preventDefault();
	// Do what you want here
	// In this case get input value
	// Do a search
	// Redirect to results page
});
```

Don’t forget to preventDefault(), so the page won’t refresh since it’s the native behavior. Also remember to put the button inside the form, so it will submit your data!

That’s it. This my first attempt to teach something so I hope I was able to tell it in a clear way.

See you in Quick Tip 2.
Tools for Unit Testing
Tags: python, beginners, unittesting, tutorial
Published: 2018-02-01 00:44:55

---
title: Tools for Unit Testing
published: true
description: Unit testing isn't bad! Here are some tools to streamline the process.
tags: python, beginners, unit testing, tutorial
---

I see far too many young developers neglect unit testing citing reasons as *"they take too much time"* or *"they're unnecessary, my app works"*. Experienced developers understand the importance of writing thorough tests and how much time they save in the long run.

Younger developer should be aware of the tools that exist to expedite the process, such as test coverage reporting and framework extensions. Check out the following video tutorial for properly unit testing a flask web application. I introduce invaluable python tools such as **unittest**, **flask-testing** and **nose2**. Would love to hear about your favorite workflow tools for writing unit tests!

{% youtube 0NsoUV-LTLc %}
Content personalization and recommendation machine learning in a Docker
Tags: machinelearning, devtools, docker
Published: 2018-01-31 23:16:30

---
title: Content personalization and recommendation machine learning in a Docker
published: true
description: Machine learning dev tools inside Docker containers for learning use behaviors and making decisions  
tags: machine learning, dev tools, Docker
---

https://blog.machinebox.io/introducing-suggestionbox-personalization-and-recommendation-machine-learning-in-a-docker-b9d69f937716
GitHub Project:  TestLog (Ruby)
Tags: ruby, testing, opensource
Published: 2018-01-31 22:33:16

---
title: "GitHub Project:  TestLog (Ruby)"
published: true
description: Ruby TestLog
tags: ruby, testing, opensource
---
I have spun off some code from my GitHub project <a href="https://github.com/BurdetteLamar/RubyTest#rubytest">RubyTest</a> to form a (much) smaller project <a href="https://github.com/BurdetteLamar/TestLog#testlog">TestLog</a>.

README.md (at the link) describes the feature set.

I will be making this into a Ruby gem soon.

(Comments totally welcome:  here, or in an Issue on the project.)