teleren/devto huggingface dataset:
Software release using npm
Tags: opensource, npm, javascript, webdev
Published: 2022-11-10 00:31:16

Hi,

## Overview

This week I've been working on releasing my [tool](https://www.npmjs.com/package/simple-ssg1)using [npm](https://www.npmjs.com/).

To install the tool, run `npm i simple-ssg1`

## How to prepare your project for publishing

1) Sign up for npmjs
2) Make sure you have package.json file
3) Add README.md, so that users will be able to understand what is your project about and how to set it up.
4) run `npm publish`

Each time you need to update your package, you can run `npm version <update-type>`

### Update types

Each digit in the version (e.g. **2.3.0**) has it's own meaning:
 
1) First digit (2) means major release.

2) Second digit means minor change in the software(resetting last digit to 0)

3) Last digit means patch release.

### Reviewing the tool

It's very important that somebody checks how your tools works. One view is good, but multiple is better. Another people may find issues that you could never think of, because we all look at software from different perspectives.

It's very good when people try to break your tool to see how it's going to work in hard times. 

### Feedback and failures

It's crucial not to take feedback personally. We should thank people when they give us the feedback, because are literally pointing where we need to improve.

Mistakes and failures are part of project. I believe that if a project is going great and doesn't give you any challenges, then I would question this project :)

I know a lot of people love comfort and prefer easy things to complicated ones. However, do we grow personally and as developers? Problem-solving - that's what drives most of us. As for me, I genuinely enjoy resolving problems (even though they can 
drive me crazy).

### Part of community

It's a great feeling when you see your package in the npm publicly. You are feeling yourself as a part of a big community. People can use it all around the world and that makes you feel very useful :)
Review: Flask Web Development: Developing Web Applications with Python
Tags: books, programming, python, flask
Published: 2022-11-13 01:37:53

---
title: Review: Flask Web Development: Developing Web Applications with Python
published: true
date: 2022-11-10 00:18:00 UTC
tags: Books,programming,python,Flask
canonical_url: https://www.ericsbinaryworld.com/2022/11/09/review-flask-web-development-developing-web-applications-with-python/
---

[Flask Web Development: Developing Web Applications with Python](https://www.goodreads.com/book/show/18774655-flask-web-development) by [Miguel Grinberg](https://www.goodreads.com/author/show/95290.Miguel_Grinberg)  
  
My rating: [5 of 5 stars](https://www.goodreads.com/review/show/5022611525)  
  
  
_I read the second edition of the book_  
  
I’ve read lots of books covering web frameworks or GUI programming (both involve UI design and a different workflow where you’re often waiting for user input), but this one is one of the best I’ve ever read. While it’s traditional for a book to culminate in a blog or social media app (and this one does it too) there’s something about the way Grinberg writes that makes it so much more approachable. Also, something only more modern books can do, he has a github repo with all the code with commits that match different sections of the book.  
  
I feel incredibly confident that I’ll be able to write and debug flask applications after having read this book. Highly recommend if you’re a web programmer who is doing to work with the flask web framework.  
  
  
  
[View all my reviews](https://www.goodreads.com/review/list/4737124-eric-mesa)
Azure Policy - Find unused policies
Tags: azure, policy
Published: 2023-09-13 15:39:59

---
title: Azure Policy - Find unused policies
published: true
date: 2022-11-10 00:00:00 UTC
tags: Azure,Policy
canonical_url: 
---

Creating Azure policies is very easy, however it can be handy to know if all of your Azure policies are in use in your environment.

For this I created a very practical Resource Graph query

```
policyresources
| where type == "microsoft.authorization/policydefinitions"
| extend policyType = tostring(properties.policyType)
| where policyType == "Custom"
| join kind=leftouter (
    policyresources
    | where type == "microsoft.authorization/policysetdefinitions"
    | extend policyType = tostring(properties.policyType)
    | extend policyDefinitions = properties.policyDefinitions
    | where policyType == "Custom"
    | mv-expand policyDefinitions
    | extend policyDefinitionId = tostring(policyDefinitions.policyDefinitionId)
    | project associedIdToInitiative=policyDefinitionId 
    | distinct associedIdToInitiative) on $left.id == $right.associedIdToInitiative
| where associedIdToInitiative == ""
| join kind=leftouter(
    policyresources
    | where type == "microsoft.authorization/policyassignments"
    | extend policyDefinitionId = tostring(properties.policyDefinitionId)
    | project associatedDefinitionId=policyDefinitionId 
    | distinct associatedDefinitionId
) on $left.id == $right.associatedDefinitionId
| where associatedDefinitionId == ""
| extend displayName = tostring(properties.displayName)
| project id, displayName

```

You can find the resource graph query on my [github](https://github.com/wilfriedwoivre/azure-resource-graph-queries/tree/master/queries/policies/list-unused-policies).

In this Resource Graph query, we start by listing all the Azure Policies that are defined in your environment, and we will filter only on those that are _Custom_.

And then we will see if they are not assigned in an Initiative, or directly on an Azure scope, and retrieve our list of unnecessary Policies.

It is up to you afterwards to delete them if they are really of no use to you.

This new feature in Azure Resource Graph is very practical, and the tool is really useful for all things governance, and it is constantly evolving at Microsoft, which I think is a good thing. I can’t wait to be able to query Azure Role Assignments, and Azure AD objects (yes, that’s my wishlist for new features).
Dramatically Reducing Video File Size Using FFmpeg
Tags: ffmpeg, video
Published: 2023-09-09 01:12:49

---
title: Dramatically Reducing Video File Size Using FFmpeg
description: How to shrink a video so it’s small enough to upload.
published: true
date: 2022-11-10 00:00:00 UTC
tags: ffmpeg, video
canonical_url: https://michaeluloth.com/ffmpeg-reducing-video-file-size/
cover_image: https://res.cloudinary.com/ooloth/image/upload/c_scale,w_2160,f_auto,q_auto/v1668101610/mu/video-camera.jpg
---

Sometimes you want to upload a video, but you can’t because its file size is too large. When that happens, you can use `ffmpeg` to shrink the video size with one command.

## Steps to shrink a video file

1. If you’re on a Mac and haven’t already, install [Homebrew](https://brew.sh/):

2. Install `ffmpeg` using Homebrew (or [download ffmpeg](https://ffmpeg.org/download.html) for your OS):

3. Run `ffmpeg` on your file:

That’s it — I was able to shrink a 10-minute macOS screencast from `1.4 GB` to `148 MB` just by running that command and waiting 6 minutes.

## Where to go from here

This approach works best when your final video quality doesn’t need to be very high.

If you’re creating high-resolution content, you’ll want to dive deeper into `ffmpeg`’s [configuration options](https://ffmpeg.org/ffmpeg.html) or use a tool like [Handbrake](https://handbrake.fr/docs/en/1.5.0/) to help you select the quality you need.

## Related links

- [How to Reduce Video Size With FFmpeg](https://linuxhint.com/how-reduce-video-size-with-ffmpeg/) • John Otieno
New dotnet tool: SqlServerCoverage
Tags: dotnet, sql, coverage
Published: 2022-11-10 00:00:00

---
title: "New dotnet tool: SqlServerCoverage"
tags: dotnet, sql, coverage
published: true
published_at: "2022-11-10"
---

I've developed a tool inspired by the work of [GoEddie](https://github.com/GoEddie/SQLCover) that can collect and report coverage data of SQL code on a SQLServer database.
I've called it - not very creatively - [SqlServerCoverage](https://github.com/pitermarx/SqlServerCoverage).

## Quick start

1. Install dotnet tool:
```powershell
dotnet tool install sqlservercoverage.commandline -g
```

2. Start coverage session:
```powershell
$id = sql-coverage start --connection-string=$cnx --database=$db
```

3. Collect coverage:
```powershell
sql-coverage collect --connection-string=$cnx --id=$id --summary
```

4. Cleanup:
```powershell
sql-coverage stop --connection-string=$cnx --id=$id
```

## Details

This tool allows us to know how much of the stored procedures are covered by some action

It uses [XEvents](https://docs.microsoft.com/en-us/sql/relational-databases/extended-events/extended-events) on sql server to track which statements were used in the time a trace session was open.
Unfortunately Views, Scalar functions and inlined table functions are not trackable via this mecanism. Only Stored procedures, Triggers and Table Valued functions are tracked.

```powershell
$conn = "Data Source=.\SQLEXPRESS;Integrated Security=True"
$db = "DatabaseName"

# start a session and get the ID
$id = sql-coverage start --connection-string=$conn --database=$db
if ($LASTEXITCODE -ne 0) { throw $id }

# returns a list of session IDs on the server
sql-coverage list --connection-string=$conn

# now do some stuff on the database

# collect coverage data.
# export an html report, an opencover report, a sonar report and a console summary
$outputDirectory="somewhere"
sql-coverage collect --connection-string=$conn --id=$id `
  --html --opencover --sonar --summary --output=$outputDirectory

# manual cleanup is necessary to stop the XEvents session
# you can do this
sql-coverage stop --connection-string=$conn --id=$id
# or stop all sessions on the server
sql-coverage stop-all --connection-string=$conn
# or stop all sessions if the corresponding db does not exist anymore
sql-coverage stop-all --connection-string=$conn --only-missing-dbs
```

This is a sample summary from the console and attached is a sample HTML report


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7wu63po3kl004qh1lscr.png)

This is a screenshot of the terminal summary, created with [Spectre.Console](https://spectreconsole.net/)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7szz5zttkuxqcoa5s2ds.png)

The OpenCover xml report also exports the source objects that can then be used by [ReportGenerator](https://danielpalme.github.io/ReportGenerator/) to generate a report

It can also export on the [sonar generic coverage](https://docs.sonarqube.org/latest/analysis/generic-test/) format
3d-rendering from scratch
Published: 2022-11-09 23:54:46

[github.com/Atvaster/3d-render](url)
^^^
GO HERE FOR STUPID CODE



So far I have implemented:
* Initialize and edit canvas element
* 2d Line drawing
* Filling 2d triangles
* Project 3d points into 2d space
* Create wireframe models such as cube
* Animate wireframe

To do:
- Create/fix z-buffer
   - Implement proper interpolation for z values when filling 
     triangles
- Generally optimize code
- Introduce more complex shapes than cubes like spheres, pyramids, and planes(idk its complex for me)

##About blog
I may or may not update this blog every once in a while when I do something cool.
Obfuscate client side with WASM
Tags: webassembly, discuss
Published: 2022-11-09 23:49:06

I am very curious how effective obfuscation would be in a WASM binary, for example could it be possible to create a client side Auth system (yeah I know it's triggering), but can you realistically decompile, have you done it, I guess I'm saying is WASM a place to hide?
ML in Rust: smartcore
Tags: rust, machinelearning, webassembly, wasi
Published: 2022-11-09 23:28:53

---
title: ML in Rust: smartcore
published: true
description: smart algorithms in Rust
tags: rustlang, machinelearning, wasm, wasi
# cover_image: https://direct_url_to_image.jpg
# Use a ratio of 100:42 for best results.
# published_at: 2022-11-09 23:22 +0000
---

Hi,


Today we have released [version 0.3 of **smartcore**](https://github.com/smartcorelib/smartcore): a comprehensive library for machine learning and numerical computing. The library provides a set of tools for linear algebra, numerical computing, optimization, and enables a generic, powerful yet still efficient approach to machine learning.

We provide an easy and familiar API for ML practitioners to have an entrypoint into Rust but also a compact implementation of most popular machine learning algorithms to work with environments running Wasm32 and Wasi.

Easiest way to get the feeling are the [Jupyter Notebooks](https://github.com/smartcorelib/smartcore-jupyter/tree/main/notebooks) but also the [documentation](https://docs.rs/smartcore/latest/smartcore/).

Feel free to contribute or ask questions!
Cheers,
Lorenzo
SPVM::Numpy is released - Python/numpy porting to Perl
Tags: perl, spvm, python, numpy
Published: 2022-11-09 23:05:12

<a href="https://metacpan.org/pod/SPVM::Numpy">SPVM::Numpy</a> is released on CPAN.

This module is yet experimental stage. Methods will be added gradually.

The development can be seen at <a href="https://github.com/yuki-kimoto/SPVM-Numpy">SPVM::Numpy on Github</a>

```
use Numpy;
 
my $np = Numpy->new;
```

## What Is SPVM?

<a href="https://metacpan.org/pod/SPVM">SPVM</a> is a static typed language that can be used from Perl. <a href="https://metacpan.org/pod/SPVM">SPVM</a> is the essential part of the Python/numpy porting to Perl. If you haven't heard of Perl's SPVM, Please see also <a href="https://metacpan.org/pod/distribution/SPVM/lib/SPVM/Document/Language.pm">SPVM Language Specification</a>. 

## How potential dose SPVM have?

Growth is expected in the fields of Bio Tech, AI/ML, Apple/iPhone/iPad Apps, Google/Android Apps, IoT Device, Connected Car, Smart Device, Smart Home, etc.

This is because SPVM can produce an executable file that supports cross platforms and make easy to calculate arrays and bind C/C++ and GPU/cuda.

## This project really needs contributors, sponsors, investors.

This project really needs contributors. I am looking for contributors, sponsors, investors.
Functions in JavaScript
Tags: javascript
Published: 2022-11-09 23:04:35

Function in JavaScript is a set of statements that performs a particular task. We should call the function in order for it to execute.
_SYNTAX:_ We define function using **function** keyword. Then we name the function and open curly braces{}, in which the statements are written.
Let’s declare a very simple function:
function simpleFunction() {
	alert(“Hello World!”);
}
simpleFunction() // this will open a window in which will be written Hello World.

- There can also be _parameters_ in the function. The function definition lists the function parameters between parentheses (). When a function is called, _arguments_ are the values that are passed to it.
function anotherFunction(parameter1, parameter2) {
	console.log(parameter1 + parameter2);
}
then we call the function anotherFunction with the following arguments:
anotherFunction(“Explaining”, “ functions”); // the arguments “Explaining” and “ functions” are the values which are passed into the function above.

When function reaches to any return, it stops executing. In order to return something in functions, we should write it inside the function as follows:
var a = 1;
function sum() {
	var b = 3;
	return a+b;
}
The function sum returns a+b. However, there is no variable a inside the function. The function works like this: first it will try to find “a” in the function and if it does not find it, it will go up and search for it outside the function.

- One special thing for functions is that we can declare it once and reuse it. We can call it every time with different arguments and get different results.
- Each JavaScript function creates a new scope. The variables which are declared inside the function are not visible outside the function.
- There also exists function composition. We can have functions inside functions.
Variables
Tags: variables, javascript, programming, jsforbeginners
Published: 2022-11-09 22:56:44

Variable is a way to store data value to use it later. Variables can be declared using **var**, **let** and **const**. The **var** keyword is much older as compared to **let** and **const**, which were added to JavaScript in 2015. One of the main differences between **var** and **let** is that variables declared with **var** can be re-declared but variables defined with **let** cannot. Now **let** is used more than **var**.

Variables have names, which are created by the user. Name of the variable can contain letters, numbers, underscores and dollar signs but they cannot start with numbers 0 – 9. Names are also case sensitive which means that the same word with lowercase and uppercase are not the same.
Variables can contain different types of information: numbers, strings and booleans. These are the primitive data types in Javascript. String is used with double or single quotes and contains a group of characters. Boolean data type has two values – true and false.
Here is how variables are declared:
var name_student = “Astghik”;
let auaStudent = true;
const age = 18;

If we want to check the data type of “Astghik”, true or 18, we should use typeof() in the following way:
typeof(“Astghik”) – this will return string
typeof(true) – will return boolean
typeof(18) – will return number

When using the **const** keyword the variables cannot be changed but we can change the value of the variables declared with **let** or **var**. For example:
let course = “Intro to CS”;
but then we want to change the variable course, so we write:
course = “Intro to OOP”;
In this way we assigned a new value to the variable(assignment of the variable).

We can also do mathematical operations inside the variables:
let a = 5+6;
console.log(a); //this will return 11.
Javascript also understands the parenthesis, so if we write:
var b = 3*(2-1); // it will first do the operation inside the parenthesis and then the multiplication, so if we console.log it:
console.log(b) // we will get 3
Besides doing addition the “+” sign is also used to connect strings.
let my_name = “Astghik” + “ Aboyan”;
console.log(my_name) // returns Astghik Aboyan.
We can also connect strings with numbers. The “+” sign will first convert the number into a text and then add it to the string.
let student = “Ugrad” + 26;
console.log(student); // which returns Ugrad26

Scope determines the visibility of the variables. In JS, the variables are declared in local scope or in global scope.
Local variables are declared inside the function. They are not visible outside the function in which they were declared.
Global variables are variables that are defined outside of any function. They are visible from any point in the JavaScript code, and even within any function.
Var blogpost = “Hello”; // global variable
function print() {
	var topic = “variables”;
	alert(blogpost + topic); // can access to global and local variables
}
print();
alert(blogpost); // can access to global variable
alert(topic); // cannot access to local variable
Functions in JavaScript
Published: 2022-11-09 22:36:01

A function in JavaScript is a piece of code that is wrapped in a value and performs a certain task, just like in algebra. The function is running when those values are called. We use functions to give a name to a certain block of code and define it, after which execute it as many times as we want, by stating the connection between the input and the output. 

Functions in JavaScript are defined with the keyword function, followed by the name of that function, and followed by a parenthesis. Function names, just like variables, can only contain digits, letters, underscores, and the dollar sign. Inside the parenthesis may be written the parameter names, which are separated by commas. The values given to the functions are called arguments. Function arguments or parameters work as local variables inside functions. After the parenthesis add curly brackets for the code to be executed. That part is also called the body of the function. It should look something like this: 

function name(parameter1, parameter2, …, parameter(n)) { 
  the code that must be executed 
} 

JavaScript functions also have a scope. With each new function a new scope is created. As we already know, variables inside of a function are not accessible outside of it. However, when a variable is declared outside of the function, it becomes global, meaning that it can be used throughout the whole code.
JavaScript Functions
Published: 2022-11-09 22:09:49

In JavaScript, functions are a type of object that complete certain tasks. They produce an output for the input they are given by performing a calculation. You first need to create a function by declaring one. Functions must be given a name that specifies what they will be used for.

function add(...)

The parameters are placed inside parentheses written beside the name. The arguments are the values received by the function. A function must be executed or "called" to run the code inside. The visibility scope encompasses all the variables that can be accessed within a function. Code is run from top to bottom. The function stops executing once it reaches return. The return value is then given as the output. One of the ways we can use functions is to compute operations with variables. 

```
function add(a, b) {
  return a + b;
}
add(3, 5); 
```
JavaScript Variables
Published: 2022-11-09 22:09:29

Variables in JavaScript are for storing information. The information can be a number, object, string, Boolean value, etc. The name of a variable starts with a letter and can consist of one or more letters. There are 3 ways to declare variables in JavaScript: _var_, _let_, and _const_. Using the keyword _let_ means the value a variable holds can be changed at any time.

let str = "Hello World"

When declaring a variable with _const_ it is not subject to change. It cannot be reassigned later on, while _var_ and _let_ variables can. Additionally, _var_ variables are only available within the function they were declared in. The equal sign = is used to assign values. It can also be undefined if it does not have a value. 

var k = 5  

A block statement is made up of several statements. Accessibility or visibility of a variable depends on the scope. It is only possible to access function-scoped variable from inside a function, while block-scoped variables are accessible within the block they were declared in.  Local variables are declared inside a block. Global variables are declared outside one.