teleren/devto huggingface dataset:
Replicating Azure SQL DB Instances on the fly for SaaS apps
Tags: csharp, azure, sql, saas
Published: 2020-09-04 16:33:31

If you are building a multi-tenant application on Azure, you may have to spin up Azure Sql instances on the fly when onboarding new tenants. I felt this would be a fairly common use case, but to my surprise, I failed to find any articles relating to this exact topic. After going through a number of different articles, I am compiling my learnings here with the hope that someone else will find this post useful.

First off, you need an Azure SDK, and not just any SDK, a ‘management’ SDK. You will find it [here] (https://www.nuget.org/packages/Microsoft.WindowsAzure.Management.Sql/) 

The first task, as you may have guessed, is Authentication.

```csharp
var authContext = new AuthenticationContext(<authority>); //"https://login.microsoftonline.com/"
var credential = new ClientCredential(<appId>, <appSecret>);
var authResult = await authContext.AcquireTokenAsync(<resource>, credential); //“https://management.azure.com/”
var token = new TokenCredentials(authResult.AccessToken, "Bearer");
```
Once you receive an authentication token, you can move to the next step: instantiating a SqlManagementClient.

```csharp 
SqlManagementClient mgmtClient = new SqlManagementClient(credentials);
mgmtClient.SubscriptionId = <subscriptionId> 
```

I have a database already set up which contains some common data which all tenants need access to. The objective is to replicate this database every time a new tenant is added to the platform.
In order to achieve this, we will need to provide an identifier for the existing database along with the resource group, server, service tier, and Sku information for the new Database to be created. 

```csharp
client.Databases.CreateOrUpdate(resourceGroup, server, dbName, new Database(
                location: <location>, //centralus
                sku: new Sku(<skuName>, <tier>), //S0 , Standard
                createMode: "Copy",
                <sourceDatabaseId>)) // /subscriptions/.../resourceGroups/.../providers/Microsoft.Sql/servers/.../databases/<DB name>
```

The CreateOrUpdate method will return a Database from which you can retrieve the database name or resource ID as required.  

And there you have it, how easy was that ? Took me a good few hours to figure it out 😅
A Fun Friday Accomplishment!
Tags: devjournal, womenintech
Published: 2020-09-04 16:30:55

_This post was originally published on September 4, 2020 on [my blog] (https://alexlsalt.github.io/blog)._

Happy Friday, all! I'm really excited today because I woke up to a fun email from my podcast hosting service that my podcast, The Ladies Code Collective Podcast, has reached 500 downloads!

![Banner celebrating 500 downloads for podcast](https://dev-to-uploads.s3.amazonaws.com/i/rjlrntofy705071lzeoi.png)

500 downloads! I was elated at 250 a few weeks ago, and now 500!

Celebrate every win - big or small. Consistent efforts over time ultimately lead to big things, and I'm here for it every step of the way!

Hope your weekend is fantastic! Do something nice for yourself, why doncha? :)

----------


P.S. Did you know I have a podcast with new episodes each Wednesday? Go listen [right over here >>] (https://www.ladiescodecollective.com/podcast)

![The Ladies Code Collective Podcast cover art](https://dev-to-uploads.s3.amazonaws.com/i/e9bnxljvfrdjeti7fvbr.png)
Singer ETL + Airflow + Django + Docker: The last frontier
Tags: django, docker, airflow, singer
Published: 2020-09-04 16:06:58

Hello guys, this is my first post here. I'm a web development full stack engineer and I have at least 7 years working with Django, since its 1.5 version. 

This year, on this COVID's crisis, I continued working (because the show must go on), and my team and I, found an interesting problem which I want to share with the world in order to be helpful with another developer, who like us, can face a similar problem.

I want to share two articles I published on medium in which I talk about my experience working with these tools.

This first one is about why we did this and the second is the fun and interesting part.

1) **Building our Tower of Babel: Django + Singer ETL + Airflow for all audiences**: https://medium.com/talpor/building-our-tower-of-babel-django-singer-etl-airflow-for-all-audiences-d58dee35a512

2) **Django + Singer ETL + Airflow: blood, sweat and Docker**: https://medium.com/talpor/django-singer-etl-airflow-blood-sweat-and-docker-4b3aaa5dd0dd

I hope you can enjoy them as I did writing them :)!
How Do You Choose SEO Services For Small Business
Published: 2020-08-31 06:55:04


Every business requires publicity irrespective of its dimension or size. Whatever is the kind of a business, you have to support it with requisite promotional backup. You've to keep the development of the company by establishing suited SEO service, that is necessary within the web advertising world. It's correct that a small company has to feature in the existing naturally competitive market with utmost challenges because of restrictive budget allocation on the publicity account. Despite the hurdle, you've to produce a position within the market through sufficient SEO so you're able to bring guests for the business of yours. When you glance at the chance to avail such solutions, you read many packages which are provided by famous and large service providers.

The majority of the bundles are beyond the access of regular business community. You've to understand that most of <b>seo services for small business</b> owners are operated by individual promoter and are mainly family companies with limited financial resources readily available for the marketing campaign. In a nutshell, business people require optimum returns on the purchase. If perhaps you're a small business operator and endure the identical state of affairs, you've to arrange the publicity process tactfully by engaging SEO solutions which focus on small charges.

You've to search the internet thoroughly to identify right sort of SEO professionals. You'll certainly find many skilled individuals, who're capable of supplying just as effective program for the improvement of the small businesses with a negligible cost. The price of performance is constantly on the low aspect in comparison to the prevailing market rates of SEO services. You have the judicious and complete support of the advertising of the company in internet. It's incredibly appropriate when you require localized SEO support. For example, a floral shop in Carolina needs guests from the vicinity getting possible business. The SEO company occupies the optimization function on a principal keyword like as," Carolina flower shop" or maybe "Flowers Carolina". It's very common for a person to find flowers in Carolina with that keyword phrases. When the search is pronounced with the regular keyword, your site needs to be apparent on the opening page over the computer screen to expect potential buyers or potential visitors. You might have to spend fifty dolars monthly for such localized optimization labor to the SEO specialist for a single keyword seo work. It suits several small business owners as a result of the dimensions of the investment as well as the ideal return on the exact same. This ought to stay in the minds of business owners that are small while choosing the SEO services because of the development of company.

<h3>Web Settlor Pvt Ltd.</h3>


Contact Email: Info@websettlor.com
Phone: +91-9045888855
Address: Shop No.- 50, B Block, V.S Tower, Sector 3, Central Park Rd, Avas Vikas, Colony, Sikandra, Agra, Uttar Pradesh 282007
Map: https://goo.gl/maps/CfvFd3UDn6cwMeey8
Accept your mistakes!
Tags: management
Published: 2020-09-04 16:04:19

Hey People!
Are you doing a job?
Are you able to accept your mistakes?
If yes, then it's quite good, it will help you to grow asap.
People who don't accept their mistakes and blame other persons or give some excuses like -

1) He/she is older they won't get it.
2) My colleagues/friends/boss isn't worth it, they won't help me.
3) Why should I ask someone junior/senior to me (our ego).
4) let it be I'll do it later.
5) If I asked him/her/them what will they think about me.

Just tell your brain "STOP GIVING EXCUSES START WORKING ON YOUR MISTAKES" that would be much better.
Trust me, these things will show your attitude towards the things. Our official nature should be always good and positive. As you are spending a lot of time with your colleagues, yes sometimes there is a lot of misuse, misunderstandings, and problems for these things. But if you are correct on your side nothing will have an impact on you. Truth always wins.l
Stay positive in every situation, whatever it is don't leave your kindness, truth. There are the possibilities that you may get failure somewhere in your path but just because of this don't let yourself down, also you'll be noticed by this attitude towards others and definitely, people will give you a different position in their eyes and heads, people will respect this positive attitude.

I always follow these things and try that everyone around me does that it helps me in my workaholic life. If I do some mistakes I will accept in front of everyone without any fear, I know it's difficult. But if I didn't do that then simply I have to put it on someone else which is not correct right? But I can work on this and make it better in any way I can.

You should learn from your juniors & senior too. You must have heard that sometimes children teach us a good lesson.
"BE IT ANY AGE, ALWAYS BE A LEARNER' 👍
JavaScript currying 2 - Tacit programming (Point-free style)
Tags: javascript, typescript
Published: 2020-09-04 16:03:27

Tacid programming (i.e., Point-free style) is a programming paradigm, where function definition does not refer to the function arguments. Function declaration, on the other hand, requires any formal parameters to be declared. Every point-free function has its closure scope. The closure is created at the function creation time - when the function is invoked. Every form of the curried function is a form fo higher-order-function

```js
const add = (a) => (b) => a + b;
const incrementByOne = add(1); // partially applied function
incrementByOne(9); // => 10
```

When we create `incrementByOne` with function call `add(1)`, the `a` parameter from `add` function get fixed to `1` inside the returned function that gets assigned to `incrementByOne` function. When we call `incrementByOne` function with `b` parameter fixed to `9` function application completes, and returns the sum of `1` and `9`.

```js
// Another example of point-free style function
const g = (n) => n + 1;
const f = (n) => n * 2;
const h = (x) => f(g(x));
h(20); // => 42
```
kotlin learning notes Ⅲ——extend
Tags: kotlin
Published: 2020-09-04 16:03:24

#Constructor
##sub-class have primary constructors
If the subclass has a primary constructor, the base class must be initialized immediately in the primary constructor.
```
open class Person(var name : String, var age : Int){// base class

}

class Student(name : String, age : Int, var no : String, var score : Int) : Person(name, age) {

}

// test
fun main(args: Array<String>) {
    val s =  Student("Runoob", 18, "S12346", 89)
    println("name： ${s.name}")
    println("age： ${s.age}")
    println("number： ${s.no}")
    println("scpre： ${s.score}")
}
```
output:
```
name： Runoob
age： 18
number： S12346
score： 89
```
####sub-class have no primary constructors
If the subclass does not have a primary constructor, the base class must be initialized with the super keyword in each secondary constructor, or proxy for another constructor. When initializing a base class, you can call different constructors of the base class.
```
class Student : Person {

    constructor(ctx: Context) : super(ctx) {
    } 

    constructor(ctx: Context, attrs: AttributeSet) : super(ctx,attrs) {
    }
}
```
**example**
```
/**base class**/
open class Person(name:String){
    /**secondary constructor**/
    constructor(name:String,age:Int):this(name){
        //initialize
        println("------super class secondary constructor-------")
    }
}

/**sub-class extends Person class**/
class Student:Person{

    /**secondary constructor**/
    constructor(name:String,age:Int,no:String,score:Int):super(name,age){
        println("-------sub-class secondary constructor---------")
        println("name： ${name}")
        println("age： ${age}")
        println("number： ${no}")
        println("score： ${score}")
    }
}

fun main(args: Array<String>) {
    var s =  Student("Rango", 18, "S12345", 89)
}
```
output
```
------super class secondary constructor-------
------sub-class secondary constructor-------
name： Rango
age： 18
number： S12345
score： 89
```
#override
In the base class, when you use fun to declare a function, the function defaults to final decoration and cannot be overridden by subclasses. If subclasses are allowed to override the function, you need to manually add open to decorate it, and the subclass override method uses the override keyword
example
```
/**super class**/
open class Person{
    open fun study(){       // allow overridden
        println("I am Person Clss")
    }
}

/**sbuclass extend Person class**/
class Student : Person() {

    override fun study(){    // override function
        println("I am student class")
    }
}

fun main(args: Array<String>) {
    val s =  Student()
    s.study();

}
```
output
```
I am student class
```
Deploy any web app to Vercel
Published: 2020-09-04 15:58:06

Here is a quick and simple guide to deploy any web app to Vercel (previously known as Zeit).

### The Flow

* Using [Docusaurus](https://docusaurus.io/) which makes it easy to maintain Open Source documentation websites.
* [Vercel](https://vercel.com) account
* Deploy the web app with Vercel

### Assumption
* I'll assume that you already have a web app in place, if not then create a new web app which acts as a documentation website. 

#### Step 1: Getting started

In order to create a web-app with [Docusaurus](https://docusaurus.io/)
* Create a **directory** and navigate inside to the directory.
* Run `npx docusaurus-init`. This will create a web project in the following structure

```
<directory-name>
├── Dockerfile
├── docker-compose.yml
├── docs
│   ├── doc1.md
│   ├── doc2.md
│   ├── doc3.md
│   ├── exampledoc4.md
│   └── exampledoc5.md
└── website
    ├── README.md
    ├── blog
    │   ├── 2016-03-11-blog-post.md
    │   ├── 2017-04-10-blog-post-two.md
    │   ├── 2017-09-25-testing-rss.md
    │   ├── 2017-09-26-adding-rss.md
    │   └── 2017-10-24-new-version-1.0.0.md
    ├── core
    │   └── Footer.js
    ├── package.json
    ├── pages
    │   └── en
    │       ├── help.js
    │       ├── index.js
    │       └── users.js
    ├── sidebars.json
    ├── siteConfig.js
    ├── static
    │   ├── css
    │   │   └── custom.css
    │   └── img
    │       ├── favicon.ico
    │       ├── oss_logo.png
    │       ├── undraw_code_review.svg
    │       ├── undraw_monitor.svg
    │       ├── undraw_note_list.svg
    │       ├── undraw_online.svg
    │       ├── undraw_open_source.svg
    │       ├── undraw_operating_system.svg
    │       ├── undraw_react.svg
    │       ├── undraw_tweetstorm.svg
    │       └── undraw_youtube_tutorial.svg
    └── yarn.lock
```

* Navigate to `website` folder inside the `root directory`.

* Run `yarn start` or `npm start`. This should bring up the server and launches the web app on `localhost:3000`. Example website should be up and running.

#### Step 2: Building

* Considering all the changes are done, now is the time to build the app. This can be done by using `yarn build` or `npm build`.
* `vercel` in your fav terminal to log in.

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

* You will then receive an email, verify that and you are now logged in.

#### Step 3: Deploying
* Navigate to `/build/<website-name>`
* `vercel` to finally start deploying
* Follow the simple on-screen instructions to deploy it. 

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

#### Step 4: Chill out and enjoy
Since you have deployed your web-app, its time to enjoy and start exploring something else.

Reply in the comments if you enjoy this read or any suggestions to improve.
10 Award-Winning Designs for Your Inspiration
Tags: webdev, career, motivation, ui
Published: 2020-09-04 15:54:30

---
title: 10 Award-Winning Designs for Your Inspiration
published: true
description: 
tags: webdev, career, motivation, ui
canonical_url: https://blog.madza.dev/10-award-winning-designs-for-your-inspiration
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/dbcxrut5wf91b373zvrg.png
---
Here I've compiled a list of some of my favorite designs that push the boundaries of possibilities in web development.

These are all award-winning websites for their creativity and complexity and are pretty resource-demanding by all means :) 

1 - [The New Mobile Workforce](http://thenewmobileworkforce.imm-g-prod.com/)

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

2 - [Mav Farm](https://mav.farm/mavfarm)

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

3 - [Moment Zero](https://moment-zero.com/)

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

4 - [Dogstudio](https://dogstudio.co/)

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

5 - [Blues Design](https://www.blues-d.co.jp/)

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

6 - [Lusion](https://lusion.co/)

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

7 - [Resn](https://resn.co.nz/)

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

8 - [Active Theory](https://activetheory.net/home)

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

9 - [VOID](http://void.hi-res.net/)

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

10 - [Pioneer Corn](https://go.pioneer.com/cornrevolution#)

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

<hr>

I hope you enjoyed the read!

Feel free to follow me on [Twitter](https://twitter.com/madzadev), [LinkedIn](https://www.linkedin.com/in/madzadev/), [Hashnode](https://hashnode.com/@madza) and [DEV](https://dev.to/madza) for more!
JavaScript currying
Tags: javascript, typescript
Published: 2020-09-04 15:50:08

Currying is when a function returns another function until arguments are fully supplied. A curried function can take multiple arguments, but only one at a time. A partially applied function is a function which has been applied to some, but not yet all of its arguments. In other words, a curried function is a function that has some arguments fixed inside its closure scope. Every curried function returns a partially applied function, but not every partially applied function results from a curried function.

Given a function with `n` parameters, the curried version will take one argument at a time and return a function that takes the next argument and so on. The last function returns the result of applying the function to all of its arguments.
simpleBrowser project
Tags: swift, hackingwithswift, beginners
Published: 2020-09-04 15:46:48

Hi.

Today I've done small project with hackingwithswift.com
https://www.hackingwithswift.com/read/4/6/wrap-up
But, i couldn't pull it to github...
All 3 challenge I had done.
May be tomorrow i'll pull it to github and share here.
Bootstrap 5 Responsive Shopping Cart Widget
Tags: css, html, webdev, weeklyui
Published: 2020-09-04 15:38:59

This Widget is used on the eCommerce website to show products for sale. So here we made a responsive Shopping cart Widget in bootstrap 5 with the help of CSS and bootstrap components.

In this Widget, we used a simple grid and bootstrap card component with the helper class of bootstrap 5. Also, we modify bootstrap classes and use our own custom class on the responsive side. To make responsive we used CSS media quires with the required CSS properties we used. Also, we used media quires to make this Widget mobile-friendly.

Make it yours now by using it, downloading it, and please share it.

[Get Source Code](https://w3hubs.com/bootstrap-5-responsive-shopping-cart-widget/)
How to efficiently download thousands of files?
Tags: help, bash, devops
Published: 2020-09-04 13:27:05

Hello.

I need to copy ~40,000 files from a server to my computer, and I'm wondering what is the best approach to solve this problem.

# using `scp`

* slow
* consume lots of bandwidth

# using `rsync`

* slow
* consume less bandwidth
* can resume copy after a network problem

# using `tar` then `scp`

* less slow
* consume less bandwidth

# using `tar` then `rsync`

* less slow
* consume less bandwidth
* can resume copy after a network problem

# using `tar` then `split` then `parallel` with `scp`

* fast
* consume less bandwidth

# using `tar` then `split` then `parallel` with `rsync`

* fast
* consume less bandwidth
* can resume copy after a network problem

----

I think I will opt for the last one, but what would you do in my case?

----

**Edit:** bash commands for using `tar` then `split` then `parallel` with `rsync`:

*Prerequisite: Install parallel and remove warning:*
```bash
sudo apt install parallel && echo "will cite" | parallel --citation &>/dev/null
```

```bash
# on server
tar cfz files.tar.gz ~/path/to/folder/
split -b 20M files.tar.gz fragment_

# on local machine
cat $(ssh host@server ls -1 fragment_*) | parallel rsync -z host@server:{} .
cat frament_* > files.tar.gz
tar xvf files.tar.gz
```

----

**Edit 2:** I used a simple rsync command, since it can compress files on the fly and handle restart from where the transfer stopped.

Since rsync always use the max bandwidth available it isn't a bottleneck that can be solved with `parallel`.
Middleware and model binding in Mezon Router
Tags: php, router, laravel, symfony
Published: 2020-09-04 15:38:56

Hi all! According to this [issue](https://github.com/alexdodonov/mezon-router/issues/2) I have implemented feature request. As you can see it was abou model binding.

Let's see how it works.

You can register your own middleware wich will be called before the route handler will be executed. This middleware can transform common parameters $route and $parameters into something different.

Here is the example:

```php
$router = new Router();
$router->addRoute('/user/[i:id]', function(string $route, array $parameters){
    $userModel = new UserModel();
    $userObject = $userModel->getUserById($parameters[$id]);

    // use $userObject for any purpose you need
});
```

Quite simple, but you can register middleware wich will do all dirty job:

```php
$router = new Router();
$router->addRoute('/user/[i:id]', function(UserObject $userObject){
    // here we get $userObject directly
    // use use it in any way we need
});
$router->registerMiddleware('/user/[i:id]', function(string $route, array $parameters){
    $userModel = new UserModel();
    $userObject = $userModel->getUserById($parameters[$id]);
    return $userObject;
});
```

And here we get model binding.

# Learn more

More information can be found here:

[Twitter](https://twitter.com/mezonphp)
[Mezon Framework](https://github.com/alexdodonov/mezon)

## It will be great if you will [contribute](https://github.com/alexdodonov/mezon-router) something to this project. Documentation, sharing the project in your social media, bug fixing, refactoring, or even [submitting issue](https://github.com/alexdodonov/mezon-router/issues) with question or feature request. Thanks anyway )