teleren/devto huggingface dataset:
Security Testing using BDD Security
Tags: security, testing, todayilearned
Published: 2019-10-14 09:44:04

BDD-Security is a security testing framework that uses Behaviour Driven Development concepts to create self-verifying security specifications.

The framework is essentially a set of Cucumber-JVM features that are pre-wired with Selenium/WebDriver, OWASP ZAP, SSLyze and Tennable's Nessus scanner.

It tests Web Applications and API's from an external point of view and does not require access to the target source code.

OWASP ZAP- OWASP ZAP is an open-source web application security scanner. It is intended to be used by both those new to application security as well as professional penetration testers. 
SSLyze- SSLyze is a Python tool that can analyze the SSL configuration of a server by connecting to it. 
Nessus Scanner- Nessus is a proprietary vulnerability scanner developed by Tenable.

Steps to use this:
1. Clone this project from here: https://github.com/continuumsecurity/bdd-security/

2. Clone RopeyTasks a vulnerable web application that we can run locally. ropeytasks is a simple web application that is deliberately built with a number of included security vulnerabilities. These include: Blind HQL injection, XSS, CSRF, Case insensitive passwords, No SSL, Lack of HttpOnly and secure flags on session cookies. 
https://github.com/continuumsecurity/RopeyTasks

from command prompt run this: java -jar ropeytasks.jar

After executing the above commands, open your browser at http://localhost:8080 and you should be seeing the login form of the RopeyTask application.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/b5h0orxa186mxmo9nmn1.png)

Login to the application with any of the below Credentials:
admin/password
bob/password
alice/password

2. Update Config.xml file with Chrome Driver path and application URL.
<baseUrl>@insert url here@</baseUrl>

<class>@package name for application specific steps here@</class>

<zapPath>@insert path to zap folder and direct it the batch file when running locally e.g. C:\Automation\SecurityTesting\bdd-security\zap@</zapPath>

3. Feature files can be found here: \bdd-security\src\test\resources\features

4. Execute the program.
> cd bdd-security
> gradlew -Dcucumber.options="--tags @authentication --tags ~@skip" test

5. Sample result from zap scan.
After the scan is done, aside from the usual cucumber report, a comprehensive html report will be generated. The report will state the description alert, Common Weakness Enumeration CWE ID, Web Application Security Consortium WASC ID, recommended solutions etc.

![Alt Text](https://thepracticaldev.s3.amazonaws.com/i/pm5zd6yq48u7ntc87yvy.png)

References: 
1. https://github.com/continuumsecurity/bdd-security/wiki
2. https://iriusrisk.com/open-source/
Creating indexes in PostgreSQL isn't always idempotent
Tags: todayilearned, postgres
Published: 2019-10-14 08:29:30

---
title: Creating indexes in PostgreSQL isn't always idempotent
published: true
description: 
tags: todayilearned, postgres
---

Usually, when you call `CREATE INDEX` in Postgres, you expect the index to be created, or an error to be raised. However, if you are doing each of these:-

- Creating a UNIQUE index
- The data is not unique
- Creating the index CONCURRENTLY

An index will be created, but be INVALID. From the documentation:-

> If a problem arises while scanning the table, such as a deadlock or a uniqueness violation in a unique index, the CREATE INDEX command will fail but leave behind an “invalid” index.

[Source](https://www.postgresql.org/docs/current/static/sql-createindex.html#SQL-CREATEINDEX-CONCURRENTLY)
Python Filter Function
Tags: pythontutorials, filterinpython, python, pythonfilterfuncti
Published: 2019-11-02 05:25:02

---
title: Python Filter Function
published: true
date: 2019-10-14 07:58:55 UTC
tags: Python Tutorials,filter() in python,python,python filter functi
canonical_url: https://pythongeeks.net/python-tutorials/python-filter-function/
---

Python `filter()` function constructs an iterator from elements of an iterable for which a function returns true. We can understand <g id="350" data-gr-id="350">that </g>`filter`<g id="350" data-gr-id="350"> <g id="349" data-gr-id="349">will</g></g> test every element of iterators to be true or not.

**A Quick Example**

```
marks = [5, 7, 2, 8, 9]
def is_pass_test(x):
  if m < 5:
    return False
  else:
    return True
passes = filter(is_pass_test, marks)
print(list(passes))

# Result: [7, 8, 9]
```

![Python Filter Function, quickly filter your data in Python](https://i2.wp.com/pythongeeks.net/wp-content/uploads/2019/10/berlin_germany-wallpaper-1920x1080.jpg?resize=640%2C360&ssl=1)<figcaption>Quickly filter your data in Python.<br> (Berlin – Source: <a href="http://wallpaperswide.com/">Wallpapers Wide</a>)</figcaption>

### Definition and Usage

The Python `filter()` syntax is as follows:

```
filter(function, iterable)
```

- function: The function will be executed for each element of iterable.
- iterable: The iterable to be filtered.

### Python Filter Examples

#### **Example 1: Using lambda function with filter()**

We can make above example a lot shorter by using `lambda` with `filter()`

```
marks = [5, 7, 2, 8, 9]
passes = filter(lambda x: x > 5, marks)
print(list(passes))

# Result: [7, 8, 9]
```

You don't know what <g id="8" data-gr-id="8">is </g>`lambda`<g id="8" data-gr-id="8">,</g> don't worry, read our article to understand it ([What's lambda syntax in Python](https://dev.to/thepythongeeks/python-lambda-function-3pfd-temp-slug-2323806))

#### **Example 2: Passing None function to filter()**

```
datas = [5, False, '', True, 'Filtered', None]
passes = filter(None, datas)

print(list(passes))

# Result: [5, True, 'Filtered']

```

In this example, we passed None as a function parameter. However it is not a real None value, it means a default function. In this case, a default function equal to `lambda x: x`

### References

As our goal to build a short and understandable tutorial. However, in case you would like to learn deeper, you should read below references:

- From [Python Official Document](https://docs.python.org/3/library/functions.html#filter)
- From [Python Tips Book](https://book.pythontips.com/en/latest/map_filter.html#filter)

The post [Python Filter Function](https://pythongeeks.net/python-tutorials/python-filter-function/) appeared first on [Python Geeks](https://pythongeeks.net).
introduction and features of scala
Tags: scala, devops, hiring, tutorial
Published: 2019-10-14 07:48:01

Scala is a general-purpose, object-oriented programming language. It provides support to functional programming. It also helps in avoiding bugs in complex applications. In this article, you get to know about Scala and what is Scala used for?

Scala is a programming language invented in the year 2003 by Mr. Martin Odersky and his team. Scala released publicly in 2004 on the Java platform. The name Scala is a blend of scalable and languages. That signifies it designed to grow with the demands of its users.


1. Scala is a Robust and High-Caliber programming language.
2. It is also capable to outrun the speed of the fastest existing programming 
   languages.
3. it’s a compiler-based and a multi-paradigm language.
   Which makes it compact, fast and efficient.
4. Scala uses Java Virtual Machine(JVM) for compilation.
   Firstly Scala Compiler compiles the Scala code and generates the byte code for 
   the same.
5. After that, it transferred to the Java Virtual Machine to generate the Output.
   Platforms And Compilers

Scala runs on the Java Platform(JVM). So it is compatible with all the existing Java programs. Even its compatibility with JAVA makes it well-suited to Android development. Because Android applications typically write in Java and translate from Java bytecode into Dalvik bytecode when packaged.

Let’s talk about some Scala compilers:-



Scala.js:-

1. Scala.js is a Scala compiler.
2. It compiles to JavaScript.
3. Scala.js compiler makes it possible to write Scala programs that can run in 
   web browsers and also in Node.js.
4. The compiler was in development since 2013. But launched in 2015 with the 
   version name(v0.6).

Scala native:-

1. Scala native is also a Scala compiler.
2. That mainly targets the LLVM compiler infrastructure to create executable 
  code.
3. It uses a lightweight managed runtime. Its first release was 0.1 on 14 March 
   2017.
4. The motive behind developing scala native is being faster than JIT compilation 
   for the JVM.
5. It achieved by eliminating the initial runtime compilation of code and also 
   providing the ability to call native routines directly.

Key Features Of Scala

1. In Scala, there are no static variables or methods. Scala uses singleton 
   object, which is essentially class with only one object in the source file.
2. Here you don,t require to mention data type and function return type 
   explicitly. Scala is enough smart to deduce the type of data.
3. In Scala evaluation is lazy by default. Scala evaluates expressions only when 
   they are required.
4. Scala provides a standard library that includes the actor model. So you can 
   write concurrency control.
5. Higher-order functions are the function that either takes a function as an 
   argument or returns a function.

let's get some brief about scala how it is different from others. https://codersera.com/blog/what-is-scala-used-for-a-brief-overview/#19--scala-vs-other-languages--
How do I use this "react-filter-search" library with REDUX Actions in REACT?
Tags: react, redux, javascript
Published: 2019-10-14 07:45:05

How do I use this library with Redux Actions in React App?
[react-filter-search](https://www.npmjs.com/package/react-filter-search)


```
//
/*-Other Imports-*/
//
import FilterResults from 'react-filter-search';
 
class App extends Component {
  constructor(props) {
    super(props);
    this.state = {
      data: [],
      value: ''
    };
  }
  componentWillMount() {
    fetch('https://jsonplaceholder.typicode.com/users')
      .then(response => response.json())
      .then(json => this.setState({ data: json }));
  }
  handleChange = event => {
    const { value } = event.target;
    this.setState({ value });
  };
  render() {
    const { data, value } = this.state;
    return (
      <div>
        <input type="text" value={value} onChange={this.handleChange} />
        <SearchResults
          value={value}
          data={data}
          renderResults={results => (
            <div>
              {results.map(el => (
                <div>
                  <span>{el.name}</span>
                  <span>{el.email}</span>
                </div>
              ))}
            </div>
          )}
        />
      </div>
    );
  }
}
```
[Express] React as a View Template Engine?
Tags: react, javascript, express, challenge
Published: 2019-10-14 07:31:28

---
title: [Express] React as a View Template Engine?
published: true
description: It is possible to use React as a view template engine of Express. In this article, I'll explain it with a working example repository.
tags: react,javascript,express,challenge
cover_image: https://thepracticaldev.s3.amazonaws.com/i/qdbdfcorfwr0pm6tfnnt.png
---

## Updated (2019/10/29)

Thanks to kind advisors, lots of bugs are fixed and new features are added:

- `v0.2.6` - [fix] the cache problem
- `v0.3.0` - [new] support for hot reloading when `process.env.NODE_ENV !== production`
- `v0.3.1` - [fix] lots of bugs
- `v0.4.2` - [new] support for [emotion](https://emotion.sh)
- `v0.5.5` - [new] support for [material-ui](https://material-ui.com)
- `v0.5.6` - [new] support for [styled-components](https://www.styled-components.com)
- `v0.6.1` - [new] support for [NestJS](https://nestjs.com)
- `v0.7.0` - [new] [ssr.config.js](https://github.com/saltyshiomix/react-ssr#configuration-ssrconfigjs)
- `v0.8.0` - [new] [dynamic Head](https://github.com/saltyshiomix/react-ssr#dynamic-head)

## Intro

Have you ever thought about using React as a view template engine?

> If I could use React as a real view, a view template engine of Express.
>
> But it may be difficult because React is a component oriented library, and it must be bundled by webpack or rollup and so on...

## Imagine This!

### package.json

```json
{
  "scripts": {
    "start": "node server.js"
  }
}
```

### server.js

```js
const app = express();

app.get('/', (req, res) => {
  const message = 'Hello World!';
  res.render('index', { message });
});

app.listen(3000, () => {
  console.log('> Ready on http://localhost:3000');
});
```

### views/index.jsx

```jsx
import React from 'react';

export default function Index({ message }) {
  return <p>{message}</p>;
}
```

It's wonderful, isn't it?

Simple enough to learn and use it.

## Please Try This! And Tell Me Your First Impression!

```zsh
# installation
$ git clone https://github.com/saltyshiomix/react-ssr-starter.git
$ cd react-ssr-starter
$ yarn (or `npm install`)

# development mode
$ yarn dev (or `npm run dev`)

# production mode
$ yarn start (or `npm start`)
```

{% github:https://github.com/saltyshiomix/react-ssr-starter %}

## About @react-ssr/express

{% github:https://github.com/saltyshiomix/react-ssr %}

## Conclusion

> May the code be with you.

Thank you for all!!!

Dear,
[Devmates.co] Candy Crash 📈Bloomberg
Tags: challenge
Published: 2019-10-14 07:30:26

Hello👋, 
*My name is [Alex](https://twitter.com/alexwawl) and I'm maker of [Devmates.co](https://devmates.co).* 😊

*We are resolving daily coding problems which asked by top tech companies together. We share our solutions, give some help if anyone stuck, support each other and just hangout together in the internet.* 🍻☕️💬

*I get this problem from our members or just searching them in the internet(leetcode forums, Glassdoor, teamblind, etc.). Sometimes this problem can be very easy, sometimes too 👷‍♂️hard, everything depends on skills but we are trying to resolve all of them and Have Fun.*  🙌 

Today I want to share problem which was asked by 📈Bloomberg.

#####Problem:
Given a string, reduce the string by removing 3 or more consecutive identical characters. You should greedily remove characters from left to right.

#####Example:
  __Input__: "aaabbbc"
  __Output__: "c"
  __Why?__:
  1. Remove 3 'a': "aaabbbc" => "bbbc"
  2. Remove 3 'b': "bbbc" => "c"

  __Input__: "aabbbacd"
  __Output__: "cd"
  __Why?__:
  1. Remove 3 'b': "aabbbacd" => "aaacd"
  2. Remove 3 'a': "aaacd" => "cd"

  __Input__: "aabbccddeeedcba"
  __Output__: ""
  __Why?__:
  1. Remove 3 'e': "aabbccddeeedcba" => "aabbccdddcba"
  2. Remove 3 'd': "aabbccdddcba" => "aabbcccba"
  3. Remove 3 'c': "aabbcccba" => "aabbba"
  4. Remove 3 'b': "aabbba" => "aaa"
  5. Remove 3 'a': "aaa" => ""

  __Input__: "aabbccddeeedcba"
  __Output__: ""
  __Why?__:
  1. Remove 3 'e': "aabbccddeeedcba" => "aabbccdddcba"
  2. Remove 3 'd': "aabbccdddcba" => "aabbcccba"
  3. Remove 3 'c': "aabbcccba" => "aabbba"
  4. Remove 3 'b': "aabbba" => "aaa"
  5. Remove 3 'a': "aaa" => ""
Reactjs portfolio project
Tags: react, javascript, beginners, node
Published: 2019-10-14 07:20:09

I have been learning Reactjs for the past few months. During that time I have gone through the react documentation, read articles, watched youtube videos and did a Udemy course - basically some the things beginners do. Although I have experience in web development mainly in Django, Python, and JavaScript(JQuery). After all this, I have decided to work on my own project to further improve my skills.

I chose to make An expense tracker built using MongoDB, Expressjs, React, and Nodejs - MERN stack. It will have user authentication, CRUD, I will include analytics with charts, filtering based on days, weeks, etc. I will also make the admin dashboard and Automatic testing.

The question is, would this be considered a small or medium-sized portfolio project.
kitsune - simplifying serverless application development
Tags: kitsune, serverless, webdev
Published: 2019-10-14 07:12:06

Have been working on kitsune over last 2 years, with a mission to enable web developers to be able to build full stack #serverless applications without having to learn how to program, configure or deploy cloud components. 

kitsune provides a simple HTML-based declarative programming syntax to web developers. This enables them to focus on user experience and not worry about full stack architecture. The kit-compiler generates the serverless architecture for your application when you build your project.

I just launched kitsune's app-development-kit in #github:

https://github.com/GetKitsune/application-development-kit

The project is #opensource as building a programming language for the cloud is not a simple task. I need the help of the developer community to help me build this.
Ruby as a game
Published: 2019-10-14 06:49:03

https://www.bloc.io/ruby-warrior#/

Ruby warrior is a game created by Bloc.io with the programming language, Ruby, and is a game that you, the user, has to code out the instructions for your character. It's a very interesting program that teaches people how to learn to code in a fun and interactive way. After creating your character, your hero is sent into the battlefield with all the appropriate gear but your hero can't think for himself. It is up to you to tell him what to do. In order for that to happen, you have to type out the commands in the text box below. Your hero will do as commanded but his life is in danger if you can't tell him the right things to do. You have to code out the instructions using the Ruby language and learn how to guide your hero past the waves of monsters. This is something that I find unique because coding isn't all fun when you first start. It can be very stressful to take in all this new information and train your brain to think in a different way. A person that's new to programming would find this game very enjoyable while learning how to code at the same time. You will get a sense of what programming is and at the same time, enjoy the process.
Bank's Transformation Through Kubernetes  
Tags: kubernetes, cloudnative, devops, digitaltransformation
Published: 2019-10-14 06:17:23

---
title: Bank's Transformation Through Kubernetes  
published: true
description: This is how Italy's Biggest Bank is Embracing Kubernetes
tags: kubernetes, cloudnative, devops, digital transformation 
cover_image: https://thepracticaldev.s3.amazonaws.com/i/yi0pxvhmccdwyf1g5pf5.png
---

##Italy's biggest traditional bank is embracing Kubernetes?

###A conventional bank running its real business on such a young technology? 

No way, are you kidding me?

Nope, I am not kidding.  Italy's banking group, Intesa Sanpaolo, has made this transition.

These are banks who still run their ATM networks on 30-year-old mainframe technology, and embracing the hottest trend & tech is nearly unbelievable. Even though ING, the banking and financial corporation, changed the way the banks were seen by upgrading itself with Kubernetes and DevOps practices very early in the game, there was still a stigma with adopting Kubernetes in the highly regulated and controlled environments like Healthcare, Banks, etc.

The bank's engineering team came up with an initiative strategy in 2018 to throw away the old way of thinking and started embracing the technologies like microservices, container architecture, and migrate from monolithic to multi-tier applications. It was transforming itself into a software company, unbelievable. 

Today the bank runs more than 3,000 applications. Of those, more than 120 are now running in production using the new microservices architecture, including two of the 10 most business-critical for the bank.

Read the full case here: [How hot is Kubernetes? Even traditional banks are transforming to embrace it](https://www.techrepublic.com/article/how-hot-is-kubernetes-even-traditional-banks-are-transforming-to-embrace-it/)
WEB375 Week 6
Tags: mariadb, mysql, database, servers
Published: 2019-10-13 00:27:08

This week we learn how to set up a MySQL Database Server, including the database management systems (DBMS) architecture. These technologies are not directly visible to the client, but without databases and programming languages, websites would be very limited/static. Databases provide organized ways to store and manage information.

The following are the clients of a DBMS:
* The database administrator needs to access the database to perform maintenance and should have access from the local machine and LAN. Although it is possible to provide access from outside the company's LAN, this may create security issues.
* The web server must access the database to construct dynamic web pages when responding to requests from its own web clients. Developers for the website must access the database while developing and maintaining the web applications, but this is often done through the web server.

S set up a basic MySQL server by logging in as admin and stopping all firewalls. I made sure the MySQL packages were installed and checked for errors. Secured the installation by changing the root password, removing anonymous users and disabled remote login. I connected into mariadb. Created a new database table with employees and wages. 

 ![MariaDb Example](https://sylviacastro.co/payrollsystem/mariadb.png)
best practices in publishing npm package
Tags: help, javascript, npm, typescript
Published: 2019-10-14 05:24:20

I am working on this side project [fcal](https://github.com/5anthosh/fcal)

I want to release it as npm package , but I also want it to act as cli.

Should I create another npm package for cli or npm package acts as (both) cli and module ?

I am new to nodejs environment and learning best practices

thanks !
Starting a Journal
Tags: devjournal, worktrial
Published: 2019-10-14 05:18:46

---
title: Starting a Journal
published: true
description: I'm looking for a work trial placement and write my experiences here 
tags: journal, worktrial
---

I'm trying to return to work using work trial and need to find an employer that would need a part-time worker and is willing to support my re-habilitation. In order to motivate myself I have decided to start a journal to keep track of my learning. If only feedback is if I find a job or not, I will not learn much.

I will write about software development technology and practices here. 
I will write about business side in [my linkedin](https://www.linkedin.com/in/juha-autero-49631/)
How to Split Screens in vim
Tags: vim
Published: 2019-10-14 05:10:16

---
title: How to Split Screens in vim
published: true
description: Have you ever found yourself going through a long file in `vim` and wishing you could split your screen?
tags: vim,
cover_image: https://thepracticaldev.s3.amazonaws.com/i/w2a6b30bpd3u447pl71b.gif
---

Have you ever found yourself going through a long file in `vim` and wishing you could split your screen?  Perhaps you want to make some comparison with a chunk at the top of file with something in the middle.  With a few keystrokes you can do exactly that.

Split Horizontally
==================

![Horizontal Screen Split](https://thepracticaldev.s3.amazonaws.com/i/6r47ayduk76x2xcq84ym.gif)

To split the screen horizontally:
a.) Hit `CTRL` + `w` 
b.) and then `s`.

If you want to navigate between the screen:
a.) Hit `CTRL` + `w` 
b.) and then `w`.  

To exit out of one of the screen:
a.) Go into command mode (i.e. hit `ESC`)
b.) and quit as usual: `:q`. 

Split Vertically
================

![Vertical Screen Split](https://thepracticaldev.s3.amazonaws.com/i/w2a6b30bpd3u447pl71b.gif)

To split the screen vertically, much like splitting horizontally:
a.) Start by hitting `CTRL` + `w`
b.) but then hit `v` (instead of `s`).  

Navigating between the split screens is the same (`CTRL` + `w` + `w`). 

Though horizontal splitting works great.  I find vertical splitting to be the most useful.

Combine Both
============

![Vertical and Horizontal Screen Splitting](https://thepracticaldev.s3.amazonaws.com/i/n5kol21nue3nzv5plmhd.gif)

Why choose?  It is possible to combine both horizontal and vertical screen splitting as well.