teleren/devto huggingface dataset:
Slideio - an open-source python library for reading of medical images
Tags: bioinformatics, python, computervision, imageanalysis
Published: 2020-07-05 09:37:06

Slideio is an open-source python module for the reading of medical images. It allows reading of whole slides as well as any region of a slide. Large slides can be effectively scaled to a smaller size. The module uses internal zoom pyramids of images to make the scaling process as fast as possible. Slideio supports 2D slides as well as 3D data sets and time series.
The library delivers raster as numpy array and compatible with many popular image analysis libraries such as opencv.
Currently, it supports reading of Aperio SVS and AFI files, Zeiss CZI files and generic formats. Soon coming drivers for the following formats:

PerkinElmer images
Leica SCN images
DICOM datasets
Leica lif images
and more …
Home page: HTTP://slideio.com
Source code: https://gitlab.com/bioslide/slideio
How to automatically add stuff to git messages
Tags: productivity, fun
Published: 2020-07-05 09:30:56

---
title: How to automatically add stuff to git messages
published: true
description: With a global message template you can quickly add co-authors (or cats) to all your commits
tags: productivity,fun
//cover_image: https://direct_url_to_image.jpg
---

Did you know you can customise the default git message template?

First create a file, `~/.gitmessage`.

Then run `git config --global commit.template ~/.gitmessage`.

Whatever you put in that file will be the default text opened in your editor when you start a commit message.

I found this useful because as a technical lead, I spend most of my coding time pair programming. Github has a nice feature where you can [add co-authors to your commits](https://github.blog/2018-01-29-commit-together-with-co-authors/). So my template contains a few `Co-authored-by` lines for people I work with, like this:

```
Co-authored-by: Fox Mulder <fox.mulder@fbi.gov>
Co-authored-by: Dana Scully <dana.scully@fbi.gov>
```

This way, I can quickly delete the lines I don't need when I write the message, rather than writing the `Co-authored-by` from scratch each time.

These lines are called "trailers" and go at the end of the message. They are not standardised but [there are various tools which interpret them](https://git.wiki.kernel.org/index.php/CommitMessageConventions).
Building COVID 19 India Realtime Tracker with Php & JSON API
Tags: javascript, php, html, css
Published: 2020-07-05 09:27:17

Hi dev peeps, Do you want to build your own <b><a href="https://thecodezine.com/covid19">Coronavirus live tracker India</a></b> Web App? If so, I have an open-sourced corona India realtime tracker script built originally by me which is easy to set up for a beginner as it is built-in pure Php, Javascript&amp; has no database.  The reason to open source an original script is: as a developer I want to help and people to fell in love with codes so that they can later build cool things.
![Corona Virus India Realtime tracker](https://dev-to-uploads.s3.amazonaws.com/i/idvy1aeaksd5yep0daz1.png)
<h2><b>Key Features:</b></h2>
<ul>
 	<li>Easy for a beginner to set up &amp; understand codes as it is built mainly in Php, Javascript, XML &amp; JSON.</li>
 	<li>Professional Corona Tracker Script.</li>
 	<li>Built Covid19india API so you don't have to update day to day data.</li>
 	<li>Gives Overall Indian States &amp; District Live Covid-19 Updates.</li>
 	<li>Graph &amp; Representation.</li>
 	<li>Dark Mode and Light mode setting to enhance site appearance.</li>
 	<li>Customized Google Translation available in Hindi, English &amp; Bengali.</li>
</ul>
<h3><b>Languages Used</b></h3>
<ul>
<li>Php</li>
<li>Javascipt</li>
<li>Html,Css</li>
</ul>

<b>Note:</b> I have used Covid-19India.org open-sourced JSON API to build this web
<h3><b>Code</b></h3>
{% replit @jupiterdv/Covid-19-India-Live-Tracker %}
<b>Disclaimer:</b> I used repl.it only for the purpose of displaying codes & some features might not work on its server. So, place the codes on your host to make every feature work rightly
<h3>Conclusion:</h3>
Please take special care while copying or writing the codes as it may make the script to not run properly. Also, share these codes with your friends so that they can also know how to build it. Thank you!
For Full featured Codes & lesson on this script go to <a href="https://thecodezine.com/free-covid-19-india-real-time-tracker-code/">The Codezine</a>. You can also check other webapp: <a href="https://thecodezine.com/tiktok/">Tiktok Video Downloader</a>.
A Comprehensive Guide to JavaScript - Part 3 - Objects
Tags: webdev, javascript, beginners
Published: 2020-07-05 09:19:32

## **Objects**

An object is a non-primitive data type. It is a collection of related data or functionality. These consists of several variables and functions which are called properties and methods of the object.
Example:
```javascript
var Student = {name: "Prajwal", age: "20"}; // Student object with two properties
```

Almost everything in javascript is an object. All javascript values such as Booleans, Strings, Numbers, Maths, Dates, Regular Expressions, Array and Functions are all objects. 

#### Creating an Object

* Using an object literal:
```javascript
var Car = {company: "Lamborghini", name: "Aventador", year: "2020"};
```
* Using *new* keyword:
```javascript
var Car = new Object();
Car.company = "Lamborghini";
Car.name = "Aventador";
Car.year = "2020";
```

#### Adding New Properties to an Object

* Dot notation
```javascript
Car.color = "royal blue"
```
* Bracket notation
```javascript
Car['color'] = "royal blue"
```

#### Deleting Properties from an Object

```javascript
delete Car.color;
```

#### Adding a Method to an Object

```javascript
Car.fullname = function() {
    return this.company + " " + this.name;
};
```

#### Built-In Constructors

* New Object object
```javascript
var a = new Object();
```

* New String object
```javascript
var a = new String();
```

* New Number object
```javascript
var a = new Number();
```

* New Boolean object
```javascript
var a = new Boolean();
```

* New Array object
```javascript
var a = new Array();
```

* New Regular Expression object
```javascript
var a = new RegExp();
```

* New Function object
```javascript
var a = new Function();
```

* New Date object
```javascript
var a = new Date();
```

#### Using *this* for Object References

The keyword *this* is used in javascript to refer to the properties of the current object.

```javascript
var Car1 = {name: "Lamborghini"};
var Car2 = {name: "Ferrari"};
function display() {
    console.log("Car name is: ", this.name);
}
Car1.display = display;
Car2.display = display;
Car1.display(); // Lamborghini
Car2.display(); // Ferrari
```

Objects play a very important role in javascript and I hope you've understood them well by now.

***Thank You!***
JavaScript Variables in Depth
Tags: javascript, webdev
Published: 2020-07-05 09:08:55

Hello All,

We all start at some point and end up somewhere else, I had been there and most of us still do this mistake.

Recently due to this outbreak and stuffs, I had started my old hobby of making video and sharing stuffs. As I strongly believe that knowledge gets stronger the more you share it.

So, I have started to make videos on JavaScript from Scratch.

{% youtube Oot8U8Z3wbQ %}

And this is the Part 1 of the video and more coming soon.

Hope this helps someone out there and I hope to get support from the community as I'm aiming to get that 1000 subscribers, so smash that subscribe button for me.

Comments are always welcomed.
Go - API Gateway + Lambda in Go
Tags: aws, go
Published: 2020-07-05 08:53:20

---
title: Go - API Gateway + Lambda in Go
published: true
description: 
tags: aws, golang, 
//cover_image: https://direct_url_to_image.jpg
---

Here is a sample that implements API with AWS API Gateway integrated Lambda in Go.

# Specification

* Endpoint: https://`<API ID>`.execute-api.ap-northeast-1.amazonaws.com/`<stage>`/`<Resource>`
* Http Method: GET
* Parameters: 
```json
{
    "text": "string"
}
```

# Lambda handler in Go

Define a struct that is used as arguments.

```go
package main

import (
	"context"
	"github.com/aws/aws-lambda-go/lambda"
	"github.com/pkg/errors"
)

// Ref: https://docs.aws.amazon.com/lambda/latest/dg/golang-handler.html

// Receive arguments as struct.
type Event struct {
	Text string `json:"text"`
}

func (e *Event) validate() bool {
	valid := true
	if e.Text == "" {
		valid = false
	}
	return valid
}

// Response
type Response struct {
	Message string `json:"message"`
}

// Lambda handler
func HandleRequest(ctx context.Context, event Event) (Response, error) {
	resp := Response{}

	if !event.validate() {
		return resp, errors.Errorf("need text.")
	}

	// Something to do you want here.
	resp.Message = "ok"

	return resp, nil
}

// Main
func main() {
	lambda.Start(HandleRequest)
}
```

# Integration Request - Mapping Templates

Add values to set to struct.
Here it has set `text`

```json
#set($allParams = $input.params())
{
    "text": "$input.params('text')",
    "body-json" : $input.json('$'),
...
}
```

# Response

Here is a response.

```json
{
    "message": "ok"
}
```

I have to write codes more💪
I have to write English more than that🥺
List Comprehensions in Python
Tags: python, coding, datastructure, programming
Published: 2020-07-05 08:53:09

List comprehensions provide a way to create lists, where each element will be derived from an operation applied to each member of another sequence or iterable or to create another a subsequence with elements that satisfy particular condition.


>####Use-case 1: Lets calculate squares of all numbers from 1 to 10

Without List Comprehension:

``` python
squares = []

for x in range(10):
    squares.append(x**2)

print squares
```

With List Comprehension:

List comprehension consists of square brackets containing an expression followed by a one or multiple for loops or if clauses. Now, lets calculate squares using list comprehension

``` python
squares = [x**2 for x in range(10)]
print squares
```


>####Use-case 2: If the resulting data is a tuple, the expression must be parenthesised.

Example: Lets fetch indices of matching elements from two lists. For example:
first_list = [2, 5, 6]
second_list = [5, 6, 1]
Output : [(1, 0), (2, 1)]

Without List Comprehension:

``` python
first_list = [2, 5, 6]
second_list = [5, 6, 1]

result = []

for i in range(len(first_list)):
    for j in range(len(second_list)):
        if first_list[i] == second_list[j]:
            result.append((i, j))

print result
```

With List Comprehension:

``` python
first_list = [2, 5, 6]
second_list = [5, 6, 1]

result = [(i, j) for i in range(len(first_list)) for j in range(len(second_list)) if first_list[i] == second_list[j]]

print result
```


>####Use-case 3: Nested list comprehension

Nested list comprehension is a list comprehension within another list comprehension just like nested for loops.

Lets take a popular example of flattening a 2D matrix:

matrix = [[1, 2, 3],
	  [4, 5, 6],
	  [7, 8, 9]]

Output: [1, 2, 3, 4, 5, 6, 7, 8, 9]

Without List Comprehension:
``` python
matrix = [[1, 2, 3], [4, 5], [6, 7, 8, 9]] 
result = []

for row in matrix:
	for val in row:
		result.append(val)

print result
```

With List Comprehension:
``` python
matrix = [[1, 2, 3], [4, 5], [6, 7, 8, 9]]

result = [val for row in matrix for val in row]

print result
```


`We can use multiple for loops or if clauses to achieve any result but list comprehensions make it very concise and readable.`

Happy Coding! 👨‍💻
What's everyone's choice of CSS framework and or methodologies  for creating bespoke designs fast? 
Tags: css, framework, tailwindcss, design
Published: 2020-07-05 08:34:31

Hi guys. I've been trying to work out the best workflow for creating custom CSS for my projects and it seems there's a lot of conflicting information out there. So I just thought I would ask the Dev community and see what you guys think. 

Most of my work is building completely bespoke site designs from a Figma or sketch file, either designed by myself or via a design agency.

 I often write my CSS from scratch, since that is what I'm used to and it tends to lead to lightweight, permormant and maintainable CSS. The downside is that it can take a really long time and I often find myself writing out a lot of similar CSS patterns project to project (especially for layout). There is also the problem of testing and responsivity that comes with this ground up approach. Another chunk of time involved in making sure it works cross-browser and across the spectrum of devices. I tend to use BEM as it keeps my CSS organised and very maintainable, but it just can be too slow sometimes. 

I've been playing with tailwind. I like that I can get a template together in no time, and that I know it will work on all browsers and that it will be responsive. Definitely a headstart. But I find the long utility class names in the markup ugly, then I often still need to introduce some additional CSS in to tweak it here and there. Which just seems clunky. 

I've tried other frameworks to help get a headstart on the CSS too, such as foundation. But then I often end up in specificity battles to get from a "foundation" looking site to make it into the custom design.

I don't mind being slow if it means I get it right. But I just wondered what process you guys use? Got any great workflows for building accurate designs in CSS super fast? Please share your ideas.
HOW TO DRIVE SALES AND REACH MORE CUSTOMERS WITH GOOGLE FOR YOUR RETAIL BUSINESS
Tags: digitalmarketing, searchengineoptimization, socialmediamarketing, retailmarketing
Published: 2020-07-05 08:32:06

Google is one of the most highly used search engines used by customers to make searches related to their needs and requirements. Online Retail is growing exponentially hence, it’s time that businesses focus on ways to make use of Google search optimization so as to increase their digital footprint and increase their brands’ online presence. Our white paper  and blog on Google for Retail show how business owners can make use to Google to Grow their online presence and a road map to enable ways to use Google features like online inventory management system that helps business owners display their product offerings to customers searching for similar products via the Google search feed. 

In this blog, you’ll learn how to meet your customer’s expectations at every step of their purchase cycle, from the beginning of their journeys to driving discovery, influencing purchase decisions, and ultimately, increasing your overall sales.

Learn more about us on https://www.prism-me.com/blog/how-to-drive-sales-and-reach-more-customers-with-google-for-your-retail-business/
Avirion Chronicles: Genealogy of the Great Crusaders devlog, July 5th '20
Tags: srpgstudio, alphadioproduction, avirionchronicles, game
Published: 2020-07-05 08:18:54

Hi guys! I upload some more sprites in this post as a sample of the ones I use in the game. I tend to update more in Instagram and Patreon, so if you want to, please check my posts there instead. Cheers!
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/tyud90lu2o9ix16hv6nd.gif)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/g6o9a2vn9fvbr5u77rcy.gif)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/p9xg3ele2curbnfdxz5j.gif)
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/6grqvyw08m4j1sf38b6o.gif)
Agnostic livereload with Entr
Tags: tool, cli, livereload, linux
Published: 2020-07-05 08:17:40

### Entr overview

Today, I would like to introduce you to the project [entr](http://eradman.com/entrproject/).
I discovered this project randomly a while ago, but I had been searching for a tool
like this for a while.

The goal of this tool is to provide a simple command which can launch
a specified command when some files are modified.
Concretely, this tool can be useful if you are searching for an alternative to
livereload, but not related to a specific language and not related to a full
blown [IDE](https://en.wikipedia.org/wiki/Integrated_development_environment)

### Example

I often use it to automatically launch tests for [Golang](https://golang.org/) projects I am
developping.

Imagine, I wish to test the following function in the
[`pkg.go`](/post/entr/pkg.go) file:

```golang
// Inc returns the op1 integer incremented by one unit
func Inc(op1 int) int {
	return op1 + 1
}
```

I wish to test it, with this test in [`pkg_test.go`](/post/entr/pkg_test.go):

```golang
func Test_Inc(t *testing.T) {
	actual := Inc(1)
	if actual != 2 {
		t.Errorf("Expecting: <2>, got <%d>", actual)
	}
}
```

I would launch my tests continuously with the following command:
```sh
find *.go | entr -c -s "go test ."
```

Here is a live preview of the result (using asciinema):

{% asciinema 345404 %}

At first, the test is not working, but as soon as the test file is updated, the
test is launched again.
The specificity here, is to use the `-c` flag, in order to clear the screen
before launching the new command.

You can find the full list of options [here](http://eradman.com/entrproject/entr.1.html)

### How does it work ?

In order to avoid [polling](https://en.wikipedia.org/wiki/Polling_(computer_science)),
`entr` uses file system events
([kqueue](http://man.openbsd.org/kqueue.2) with BSD,
[inotify](http://man.he.net/?section=all&topic=inotify) with Linux).

The full source code is available here: {% github github.com/eradman/entr no-readme %}

### How to get it ?

If you wish to install it, it's really easy, just use your Linux distribution package:

Ubuntu, Debian, Mint, ... :

```
$ apt install entr
```

Centos, ... :

```
$ yum install entr
```

MacOS : 

```
$ brew install entr
```
Recursion to update deeply nested objects
Tags: javascript, algorithms, coding, devlife
Published: 2020-07-05 08:10:34

As a developer, we usually come across a situation wherein we have to update a deeply nested array of objects. For example, say we have an object:

```js
[
	{
		name: 'abc',
		children: [
			{
				name: 'pqr',
				children: [
					{
						name: 'xyz',
						children: []
					}
				]
			}
		]
	},
	{
		name: 'bcd',
		children: [],
	}
]
```

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/kvjvw4ckej853rv2923w.jpg)
<span>Photo by <a href="https://unsplash.com/@hishahadat?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Shahadat Rahman</a> on <a href="https://unsplash.com/s/photos/javascript?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></span>

Now in the above array of objects, you have to update the object with the name='xyz', so there are different ways of solving this problem.

1. Search for some NPM packages or library which does this easily.
2. Create your method to get this done.


We will opt for option 2 where we are going to use Recursion to solve this problem. Say we know the value of object's key 'name' beforehand where we have to update the children array and we have the array of objects:- 

```js
let value = 'xyz';

let list = [
	{
		name: 'abc',
		children: [
			{
				name: 'pqr',
				children: [
					{
						name: 'xyz',
						children: []
					}
				]
			},
			{
				name: 'mno',
				children: [
					{
						name: 'qrs',
						children: []
					}
				]
			}
		]
	},
	{
		name: 'bcd',
		children: [],
	}
]

function formatData(arr) {
    arr.forEach(i => {
        if(_.isEqual(i.name, value)) {
            i.children = [...i.children, {
                name: 'New',
                children: []
            }]
        } else {
            formatData(i.children)
        }
    });
}

formatData(list)
```

Result is 
```js
[
   {
      "name":"abc",
      "children":[
         {
            "name":"pqr",
            "children":[
               {
                  "name":"xyz",
                  "children":[
                     {
                        "name":"New",
                        "children":[

                        ]
                     }
                  ]
               }
            ]
         },
         {
            "name":"mno",
            "children":[
               {
                  "name":"qrs",
                  "children":[

                  ]
               }
            ]
         }
      ]
   },
   {
      "name":"bcd",
      "children":[

      ]
   }
]
```
>Here we are iterating over the list and checking whether the current value matches any of the child element's 'name' value and if it does then we update the object or we recursively go inside the array of objects.

*What are your thoughts, do you think there is a better way of doing this, then please suggest!*

**Happy learning and coding !!**
Signup HTML file open in NodeJS server
Tags: javascript, node, server, npm
Published: 2020-07-05 08:09:22

**Hello Developers,**
In this Post, i will cover this following things :

* create a server in Nodejs
* how to use experss module
* how to open html file in nodejs server


##Step 1. Install NodeJS
##Step 2. run `npm init`
##Step 3. now we need to create a server

we have mainly two way 
1. create server with **http module (inside)**
2. create server with **express module (outside)**

i am goning to use **express module**. so we need to 

###Step 4. run this command `npm install express`

###Step 5. `npm install open`
> i am goning to use **open module** is using open web browser after server has connect


###Step 6. create a file `index.js` and write this code
![index.js](https://dev-to-uploads.s3.amazonaws.com/i/sdi2iksloh7htrhewzb4.png)
###Step 7. now create a html file `index.html`
![index.html](https://dev-to-uploads.s3.amazonaws.com/i/ma1rjtye35q5i1edg2c8.png)
>now question is how to open html file on nodejs server??
we have many way to do this...
we can use fs, http-server, express modules..
i am going to use **express module**. it's easy and popular.

###Step 8. replace this code
```
res.sendFile(`${__dirname}\\index.html`);
```
remove this code  `res.send('Welcome')`

one more thing 

###Step 9. add this script in package.json `"start": "node index.js"`
###Step 10. run this command `npm start`
![Output](https://dev-to-uploads.s3.amazonaws.com/i/wpbf7fmeuw9mnshrpdru.PNG)
if you want to download this code. i am sharing this code on github link [https://github.com/whovishnu/express-server-nodejs]

**ThankYou**