teleren/devto huggingface dataset:
Secure code review: Part 8 - Statically testing
Tags: security, codequality, codenewbie
Published: 2020-08-17 06:12:58

Code reviews are hard to do well. Particularly when you’re not entirely sure about the errors you should be looking for! The DevSecOps approach pushes security testing left so that vulnerabilities can be found and fixed earlier, in the design, development, or CI/CD stages of the workflow. It’s always a good idea to check for security issues in code that you review. In case you don’t know what to look for, check out this series to give you pointers for your next code reviews!

## Statically test your source code, automatically
A static code analysis tool or linter is a very powerful tool for developers. By statically looking at the code you and your team wrote, you can point out a number of things like programming errors, bugs, stylistic errors, and suspicious constructs. With this bug and error detection, a linter can, in many cases, also indicate if a security-related bug slipped into your source code. Depending on the static tool you use and the ecosystem you are operating in, a static code analyzer can point out issues like SQL injections and code vulnerabilities.


### Linters
Linters can be very useful but will produce a lot of false positives. Since all linters are rule-based and not looking at the full context of your code, there will be a bunch of cases where a linter will flag your code as a bug or a security issue while this is not the case. Nevertheless, if you fine-tune the ruleset, a linter can prevent nasty mistakes. Although these tools can be used in a lot of different forms —  for, example, manually with a command-line instruction or as part of an IDE — the best way is to automate these processes as much as possible. For instance, as part of your build process, or maybe when a new pull request is submitted to your repository.

Either way, automation is key. Well-known static code analyzers you can use are SonarSource (with a free and open source tier) and Veracode. However, depending on your context, you might need a more specific one. Check this [list of static code analyses tools](https://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis) for both language-specific and multi-language solutions that may fit your needs. If you don’t have automatic static code analyzer in place, you can either use it during your manual code review or, even better, automate it in your process so people can catch obvious problems even sooner. 

## Want to know more
Check the complete [Secure code review cheat sheet](https://snyk.io/blog/secure-code-review/)
Case Study - Bright-Interactive 
Tags: brightinteractive, assetmanagement, automationtesting, testing
Published: 2020-08-17 05:52:29

About Bright-Interactive:

Bright-Interactive is award-winning, feature-rich, intelligent digital asset management software that makes managing brand media seamless, whatever the size of the organization.

Customer’s digital files are centrally stored and are secure, searchable, and easily accessible by anyone you choose – fast.
Challenges faced:

As any company Bright-Interactive ensuring the quality of the production application remained high, i.e. as free from defects as possible. They primarily wanted to eliminate laborious manual testing of the application in staging before pushing code changes to production as manual testing was time-consuming Customers were noticing defects on production. While the team supported a variety of different test automation functions, they never had enough time to invest in automating the User Interface level testing. The team considered Selenium and experimented with it.

The Solution:

Bright-Interactive believes that everyone on the team should be able to write tests and own code quality. Bright-Interactive’s R&D team members analyzed different tools in the market and picked up CloudQA quickly, using it for frontend test automation coverage.

Bright-Interactive was able to create a UI regression suite that gave the team confidence knowing when developers have ‘broken’ existing functionality so they could fix it as soon as possible while allowing them to add, expand, and grow without investing a ton of resources into their UI test automation. The regression test suite is extremely valuable for the app development team as it serves as a safety net they can rely on when they make changes that break things.

Bright-Interactive is now working to leverage CloudQA to not only help with code-coverage but run various test cases in production, thus giving us an app-level production monitoring to mitigate production malfunctions, above & beyond code regressions.

The Results:

Bright-interactive’s team ran for quite some time by doing UI level testing manually. To keep up with customer demands meanwhile, without slowing down their daily releases.

Earlier Bright Interactive would occasionally have a regression at the UI level that forced the team to stop working and go back and fix the issues. Now the team can find the problems quickly and react to them faster, giving them more coverage without slowing down the development pace.

Now with CloudQA they can create tests at a faster pace and can be created by developers and non-developers. Now the quality of the product is maintained, increased in deployment velocity, and greater customer satisfaction. To know more, visit https://cloudqa.io/ or email us at info@cloudqa.io.
Liman için eklenti geliştirme
Tags: limanmys, eklenti
Published: 2020-08-17 05:45:59

Önceki yazılarımızda Liman'da bulunan eklentilerin genel yapısını anlatmıştık.  [Buradan](https://dev.to/liman/liman-eklenti-yapisi-3jep) ulaşabilirsiniz. Bu yazımızda ise eklenti içerisinde nasıl geliştirmeler yapacağımızı anlatacağım.

Örnek olarak sunucu adını veren bir eklenti yazalım. 

İlk olarak yeni bir eklenti oluşturalım. *Sistem Ayarları > Eklenti > Yeni* diyerek eklenti oluşturma modal'ına ulaşabilirsiniz. Ardından eklenti ismini belirleyerek eklentiyi oluştururuz.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/hh1n82bj870zfx58fasb.JPG)

Bu eklentide iki adet dosya kullanılacaktır. Bunlardan biri index.blade.php front-end kodlarını içerecek. Diğer dosya ise back-end kodlarını içerecek olan functions.php dosyasıdır.

Aşağıda *index.blade.php* dosyasının içeriğini görmektesiniz.

```
<div id="hostname"></div>

<script>
    showSwal('{{(__("Yükleniyor"))}}','info',2000);
    let form = new FormData();
    request('{{API('hostname')}}',form,function (response) {
        json = JSON.parse(response),
        $('#hostname').html(json.message);
    },function(error){
        $('#hostname').innerHTML = "Hata oluştu";
    });
</script>

```

İlk olarak oluşturulan div hostname'in yazdırılacağı yerdir. Javascript kodlarında ise bulunan showSwal Limanın hazır fonksiyonlarından biridir. Gerekli parametreleri verip istediğimiz swalı oluşturmamızı sağlamaktadır. Ardından bir form oluşturulmaktadır. Eğer back-end kısmına bir veri yollamak istersek `form.append("deger",deger);` şeklinde veriyi back-end'e form ile yollayabiliriz. Şimdilik biz boş yollayacağız. 

Sonrasında bir request gönderilir. Bu request back-end de bulunan *hostname* adlı fonksiyona gidip oradaki işlemler sonucu döndürülen cevabı response değişkeni olarak geri almaktadır. Değişken json olarak geldiğinden önce parse edilmektedir. Sonrasında gelen sonuç hostname adlı div'e yazdırılmaktadır.

Aşağıda *functions.php* dosyasının içeriğini görmektesiniz.

```
<?php 
    function index(){
        return view('index');
    }

    function hostname(){
        return respond(runCommand("hostname"),200);
    }
?>
```
*index* fonksiyonu index.blade.php'yi döndüren bir fonsiyondur. *hostname* fonksiyonu ise runCommand fonksiyonu ile sunucunun hostname'ni öğrenip döndürmektedir. runCommand fonksiyonu Limanın fonksiyonlarındandır. Bu fonksiyon sayesinde sunucuda linux komutlarını çalıştırabilmekteyiz. 

Sonuç olarak aşağıdaki çıktıyı vermektedir.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/48xron190wub5sk2hdyv.JPG)
What should a Microsoft Learn Student Ambassador follow?
Tags: computerscience
Published: 2020-08-17 05:36:13

Here are some key points that every #MSFT Learn Student Ambassador should follow:

-> Learn more about the latest technologies and particularly Microsoft technologies.

To learn about the latest technologies and particularly Microsoft technologies Microsoft Learn is the resource for an MSLA and It is a free, online training platform that provides interactive learning for Microsoft products and more.
Here's the link- https://lnkd.in/dwCq27R

-> Grow your skills and build a reputation as a tech insider

-> Host tech events, workshops, and hackathons
You can also consider what technology skills your peers and fellow students would love to learn. You can also download some ready-to-go content from Major League Hacking and use it as a workshop in a box with all the materials needed to get started.

Here's the link- https://localhost.mlh.io/

You can also use some resources from Microsoft Learn- https://lnkd.in/dCpJZp2

-> Build and grow a community of students on-campus and online.

Feel free to add more in the comment section. Thanks for reading!
How to Develop Your MLM Platform with Smart Contract?
Published: 2020-08-17 05:25:18

_**Are you planning to start a Smart Contract Based MLM Platform in 2020?**_

Ever since the rise of bitcoin and other cryptocurrencies, the use of Multi-Level Marketing or MLM can be seen as of the significant and lucrative business models for investors as well.

Cryptocurrency and MLM are the two words that are taking the world by a storm, and so there are as many business opportunities for entrepreneurs and investors to dive in. Cryptocurrency MLM Platform with Smart Contract can be a good source of income for business but make sure to do research first before launching a Smart Contract MLM Platform.

_**Wondering How to Start an MLM Platform With Smart Contract In 2020? Well, This guide is all you need to get started.**_

Some of you may be well known about MLM Business, but for the one who is starting it for the first time, we have covered everything from scratch. (i.e What is MLM? to Smart Contract-Based MLM Software). So don’t miss any of these below to get a complete overview of How to Start MLM Business with Smart Contract?

**What is Smart Contract Based MLM?**

When MLM Platforms are Used with Smart Contract, it automates the processes performed on the MLM platform and reduces the effort of humans and also helps to solve the issue of mistrust among the users which was a great inefficiency in Traditional MLM. Thus Smart Contract based MLM business allows gaining trust among users while enhancing transparency.

**Read More on How to Launch your own [Smart Contract Based MLM Platform](https://www.employcoder.com/smart-contract-based-mlm-platform-development)**
Building Github Actions from the terminal
Tags: actionshackathon, github, terminal, githubactions
Published: 2020-08-17 05:20:48

[Instructions]: # (To submit to the GitHub Actions x DEV Hackathon, please fill out all sections.)


### My Workflow
Generally, most of the time, I will be re-using my Github actions from one project to another. So I needed a tool to re-use existing Github actions from my other projects. Hence I created a CLI tool called `github-actions-builder` to create / copy-paste my Github actions across various projects.



## Install

```
npm install github-actions-builder
```

## Usage

```
github-actions-builder
```

There are 3 modes of choosing workflow:
* Choose from Starter Templates
* Copy existing workflow
* Setup a Custom Workflow

### Choose from Starter Templates
This will help you to choose the pre-defined templates from 
[actions/starter-workflows](https://github.com/actions/starter-workflows) based on categories like `Automation`, `CI`, etc.,

![choose-workflow-demo](https://github.com/rajasegar/gab/raw/master/choose-demo.gif)

### Copy existing workflow
This will help you to copy existing workflows from various repositories either yours or others. All you need to do is to give the repo info in the form of:
`<user-name>/<repo-name>` and choose the workflow you want to copy.

![copy-workflow-demo](https://github.com/rajasegar/gab/raw/master/copy-demo.gif)

### Setup a Custom Workflow [BETA]
This will ask a series of questions to setup your workflow.
This is still a Work-In-Progress, it will not give exhaustive options to setup your workflow.

![custom-workflow-demo](https://github.com/rajasegar/gab/raw/master/custom-demo.gif)


### Submission Category: 

- Maintainer Must-Haves

### Yaml File or Link to Code

{% github github.com/rajasegar/gab %}
File Explorer Hack wish we know it Earlier ~_^
Tags: computerscience
Published: 2020-08-17 05:19:52

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/bi22kgmpecttuxua2w8s.jpg)

### Note:
**Hello Reader's I know this Post is very small and most of the people knew it, but i am new to the dev.to & this is my first Post so let's dive into the hack :)**

_This is For Windows User's only !!!_

Windows User's when working with CMD or PowerShell they need to remember the path of the projectFolder or directory name or path name where the files are located.

Most developers use CD(change directory ) command to shift to the particular folder & some guys prefer copy the path name and pasting it in the terminal Window. So this post is for you guys.

Yess !!! we can directly open CMD/PowerShell without opening the 
CMD app / PowerShell app

let me show you...

### Step-1 -Open the project/directory in File Explorer
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/iftblhw2r87tbe7z9q0k.png)

### Step-2 - Select the Path of the FS(file structure)

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/beuero3miffnrj96mu2h.png)

### Step-3 - Clear the Path and Type CMD/PowerShell

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/3szsluabhzao1n4ya2cl.png)

### Volia Succesfully opened CMD

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/cx29uc2fzx6ify6cj1ys.png)

Thank You for Reading this :) ❤
OpenPGP proof
Published: 2020-08-17 04:51:25

This is an OpenPGP proof that connects [my OpenPGP key](https://keyoxide.org/382908bd497bfb0043f278710ef3f47de7d77529) to [this dev.to account](https://dev.to/mdkcore). For details check out https://keyoxide.org/guides/openpgp-proofs

[Verifying my OpenPGP key: openpgp4fpr:382908bd497bfb0043f278710ef3f47de7d77529]
i made clone of dev.to part-2
Tags: react, node, rails
Published: 2020-08-17 04:10:37

![Navbar clone of dev.to](https://dev-to-uploads.s3.amazonaws.com/i/v84krakv0y15tsaejxxx.PNG)

[LINK to repo](https://github.com/Meenachinmay/dev.to-card-ui-react-tailwindcss.git)

yesterday i tried to make clone the card ui component of dev.to homepage. 
so today i tried to clone the navbar of dev.to

please have a look and let me know your thoughts about it.
today i used a bit of extra css instead of tailwindcss because i wanted to get that border and shodow effect for the search input of navbar, just like dev.to
and i did it.

thanks lets meet with another part with new ui component clone.

**and if you want to watch me doing this and wanna follow along please let me know in the comment.**
Стало известно, где в России самый дешевый бензин


Published: 2020-08-17 03:44:13

Смотрите также
"Рейтинг строится на основе ранжирования субъектов РФ по объему бензина марки АИ-92, который может приобрести житель на среднюю в регионе зарплату", - говорится в сообщении агентства. Исследование показало, что больше всего бензина могут позволить себе жители Ямало-Ненецкого автономного округа.
Rails where AND, OR
Published: 2020-08-17 03:41:20

---
title: Rails where AND, OR
published: true
description: 
tags: 
//cover_image: https://direct_url_to_image.jpg
---

Take care of difference between 'or' and 'and'.

```ruby
a = User.where(phone: nil).or(User.where(phone: '')).to_sql
b = User.where(phone: [nil, '']).to_sql
a == b #=> true
a # => "SELECT `users`.* FROM `users` WHERE (`users`.`phone` = '' OR `users`.`phone` IS NULL)"

c = User.where(phone: nil).where(phone: '').to_sql
a == c #=> false
c # => "SELECT `users`.* FROM `users` WHERE `users`.`phone` = '' AND `users`.`phone` IS NULL"
```
Roguelike Browser Boilerplate is coming
Tags: gamedev, javascript, html, roguelike
Published: 2020-08-17 03:32:38

I've been working hard this month on a new template project to help you make your own roguelike game. It's called Roguelike Browser Boilerplate and it includes basically everything you need to get your browser based roguelike game started. The annoying stuff like title screens, menus, touch input, sound effects, mobile device testing, dependencies, and tileset graphics integration are all taken care of, all you gotta do is turn up with your ideas and start coding.

I'm just putting the finishing touches on this and I'm gonna release it at the end of the week.

Ok, back to coding! \o/

PS If you want to be notified of the release sign up to the list at https://infinitelives.github.io/

PPS You can pre-order here: https://chr15m.itch.io/roguelike-browser-boilerplate

{% youtube 28dvHfd4fIU %}
Solving Lowest Common Ancestor in a Binary Search Tree
Published: 2020-08-17 03:03:15

![Binary Search Tree](https://dev-to-uploads.s3.amazonaws.com/i/j4wr7blsowqt17onmjmk.png)

Above is a binary search tree. We start with a head node, in this situation, the head node is 8. Each node that is added afterwards will either go to the left or the right of the 8, depending on whether it is larger or smaller. You can see how the tree breaks down. 

The question we will be answering now is finding the lowest shared ancestor between two nodes. Some examples with this image would be: 1 & 6 have the lowest common ancestor of 3 and 4 & 7 having a lowest common ancestor of 6. 

We'll be solving this with a recursive solution. Although recursion may seem intimidating, once you see the solution, it will make sense and seem simple. 

![findLCA](https://dev-to-uploads.s3.amazonaws.com/i/gb0k9fjlo4n7tqbpi8zh.png)

The arguments being passed in are the head node of the tree, num1, and num2. If both numbers are larger than the value of the head node, then we will recursively call the function with node.right being passed in now instead of the head. If both numbers are smaller, then we will recursively call the function with node.left as the node. If both the numbers are on each side of the node, then we know we have reached the lease common ancestor.

So in our example, we pass in head node with value of 8, the number 4, and number 7. So our first time we call findLCA, we will check where 4 & 7 compare to 8. Both numbers are less than 8, so we will recursively call findLCA with the arguments node.left, which has a value of 3, 4, and 7. We'll do another check and see that 4 & 7 are both larger than 3, so we will do another recursive call of findLCA. This time it will be called with node.right, which is now 6, and our two original numbers 4 and 7. In this function call, we will compare 4 & 7 to 6. Well now the numbers fall on either side of 6. So we know that we can return 6 at this point.

Finally, we will see that our function returns 6.
Day 77 : #100DaysofCode - Meetings & FreeCodeCamp
Published: 2020-08-17 02:56:53

Today, I had the opportunity to discuss Chapter 5 of the<a href="https://eloquentjavascript.net/index.html"> Eloquent JS book</a>. The chapter focused on Higher-Order Functions and I learned a lot about Javascript functions, methods on scripts and arrays. I look forward to learning more with my book club. 

In addition, I had my first meeting with a group for the project that I saw on Twitter:

{% twitter 1294242368561074178 %}

I am very excited for the new project and to collaborate with an amazing and creative group of individuals. 

Lastly, I worked on two freecodecamp lessons. I have worked on freecodecamp before, but never finished freecodecamp. I want to review the basics as I go into Javascript section of my bootcamp and what better way to do that then to use freecodecamp. 

My codepens can be found <a href="https://codepen.io/SincerelyBrittany/pen/NWNNJWe">here</a> and <a href="https://codepen.io/SincerelyBrittany/pen/awqdVM">here</a>. 

As always, thanks for reading!

Sincerely, 
Brittany 

Song of the day:
{% youtube TOrnUquxtwA %}
Benford's Law Calculator
Tags: showdev, react, javascript
Published: 2020-08-17 02:36:26

Benford's Law is a little known law that observes first digits in a naturally occurring data set. I just recently found out about it after watching episode four ("Digits") of the Netflix original series *Connected*. The law states that given a set of data, the first digits do not display a uniform distribution, but instead are arranged in a way that the digit "1" occurs most often, followed by "2", "3", etc.

Per [Wikipedia](https://en.wikipedia.org/wiki/Benford%27s_law)
> "It has been shown that this result applies to a wide variety of data sets, including electricity bills, street addresses, stock prices, house prices, population numbers, death rates, lengths of rivers..."

Because of this, Benford's Law has been used to detect anomalies and fraud.

I found this fascinating and wanted to build a calculator to test it on my own.

Using React and a little bit of [Recharts](http://recharts.org/en-US/) I created an app that lets you input data, grab the first digits, calculate the percent of occurrence, and outputs the data to a chart.

[Play around with the app here](https://benfords-law.netlify.app/).
![Screenshot of Benford's Law Calculator](https://dev-to-uploads.s3.amazonaws.com/i/dtjq41ey953aupkeqqs1.PNG)
[View source](https://github.com/john-rock/benfords-law) 

I highly recommend taking a look into Benford's Law yourself. It's one of those mind-boggling pieces of information that makes you question everything you've learned.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/gms0004jdgnlw301cuz9.gif)

*Cover photo by Ian Panelo from Pexels*
Disable GateKeeper macOS
Tags: macos, tips, gatekeeper
Published: 2020-08-17 02:35:43

To prevent malware from accessing your Mac, Apple enables **GateKeeper** by default, only allowing you to install and run applications from the App Store or identified Developers (Adobe, Microsoft, etc.).

For example, with **GateKeeper** enabled when you run `sqlplus` the first time, it will show you the following message.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/w5tplx22nzbokpilrm0x.png)

To enable it you must go to the System Preferences and click on **Always Allow**.

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/wajxnl7icpbu2dzf8eqg.png)

As developers, this can become a problem when using terminal applications, then to be able to install and run all kinds of applications, we need to disable **GateKeeper**.

_**Important:**_ _Only disables **GateKeeper** temporarily during a project or work session, not permanently._

**Let's begin:**

1. In terminal run the following command.
    ```toml
    sudo spctl --master-disable
    ```

2. To verify that **GateKeeper** is disabled, go to System Preferences, and you should see the following.
  ![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/78ocwz78wsqggoroxf0e.png)

    All options are displayed _"App Store"_, _"App Store and identified developers"_ and _"Any Site"_.

3. Select the **Any Site** option.

That's it, now you can install and run any application. 😃

If you want to enable **GateKeeper** back, I will show you how to do it in this link.