fabiochiu/medium-articles huggingface dataset:
TokenEcho Smart Contract Audit Report
By: Polly Traore
Tags: Audit, Hashex, Security, Report, Smart Contracts

HashEx was commissioned by TokenEcho team to perform an audit of TokenEcho token smart contracts. The audit was conducted between April 22 and April 23, 2021.

The audited smart contract is deployed to Binance Smart Chain (BSC) at 0xb646EB2146e770bF1c675C54969C7830A57A88E9.

The audited contract is a BEP20 token for BSC based on ERC20 and Ownable contracts by OpenZeppelin.

The purpose of this audit was to achieve the following:

● Identify potential security issues with smart contracts.

● Ensure that the smart contract’s functions perform as intended.

Information in this report should be used to understand the risk exposure of smart contracts, and as a guide to improving the security posture of smart contracts by remediating the issues that were identified.

Contracts overview

TokenEcho.sol

Implementation of BEP20 token standard [1], which is the extended ERC20 token for BSC. TokenEcho is the OpenZeppelin’s ERC20 with the implementation of the getOwner() function and added pure website() function .

Found issues

#01 General recommendations: Low severity

For the gas-saving purpose the following procedures may be performed:

functions name(), symbol(), decimals(), totalSupply(), balanceOf(), transfer(), transferFrom(), allowance(), approve(), increaseAllowance(), decreaseAllowance(), renounceOwnership(), transferOwnership() should be declared external.

Conclusion

Reviewed contract is deployed at 0xb646EB2146e770bF1c675C54969C7830A57A88E9 in BSC. The audited contract is a BEP20 token made with standard OpenZeppelin templates with minor modifications.

No critical or high severity issues were found.

Audit includes recommendations on code improvement.

References

1. BEP20: Tokens on Binance Smart Chain

HashEx website: https://hashex.org

LinkedIn https://www.linkedin.com/in/dmitrymishunin/
Rangers Protocol Progress Report
By: Rangers Protocol
Tags: Nft, Evm, Rangersprotocol, Blockchain, Report

In July, Rangers Protocol completed the deployment and launch of its testnet and concluded the BlueStone connection. At the same time, the development of the Rangers Protocol Claim website and the related documents for the Rangers Protocol smart contract interaction were announced to be fully prepared. The chain browser is under intense development.

In August, Rangers Protocol strengthened the transformation of Rangers Engine, including completing functional coverage tests and fixing several bugs, including:

· Fixing the problem of symbols appearing garbled when querying NFT data

· Fixing the problem of occasional accuracy errors of floating-point numbers when querying FT main chain tokens

· Optimizing the storage performance of ETH and USDT main chain tokens

In addition, the development of the Rangers Protocol chain browser has been completed. With 95% of it being completed so far, it has entered the acceptance check stage. Rangers Protocol development documentation is being improved.
PERI Finance Report — August 2021
By: Peri Finance
Tags: Announcements, Peri, Report, Cryptocurrency, Monthly Report

Welcome to PERI Finance’s report section! In August, Peri Finance team achieved many goals and this report provides details of dApp development progress and community updates. Please check the details by clicking underlined sentences below.

Protocol Updates

PERI dApp Integrated on Binance Smart Chain

PERI Finance has integrated with Binance Smart Chain(BSC) to maximize cross-chain functionality with EVM compatibility. Through this integration, PERI staking dApp allowed the BEP-20 based PERI holders to stake their PERI. Also, PERI Finance reopened the PERI/BNB trade pair on Pancakeswap, please check the detailed guide below:

PERI Finance LP Rewards Program

On 5th August, PERI Finance has started the ‘Liquidity Provider Rewards Program’. Users can earn a percentage share of the pool that users provided liquidity.

Launched Staking dApp on Ethereum Mainnet

PERI staking dApp has opened dApp on Ethereum Mainnet. Through this integration, the ERC-20 Based PERI holders do not have to transfer their PERI to Polygon or BSC network using their bridges.

Also, PERI Finance opened the liquidity rewards program for $PERI token for UniSwap LP(Liquidity Pool) providers with ETH/PERI trade pair.

Events/Community Activities

Trading Competition with Gate.io

We had a trading competition event with the Gate.io exchange. The overall amount of reward was more than $15,800, and we held various events such as net-buy competition, airdrop for deposit users, Twitter giveaway, AMA, etc.

AMA Events with Widespread Communities
Black Ocean weekly report 30 August — 05 September 2021
By: Fly X Bo Official Channel
Tags: Bo, Vrm, Fly, Report, Weekly

Black Ocean weekly report 30 August — 05 September 2021

I. FLy token and Black Ocean news for the week

Community news

• Gained 290 newcomers on the Global Community chat;

• Indonesian community chat gained a total of 1 409 newcomers;

• Thai community chat gained more than 1 997 newcomers;

• Philippine community chat gained more than 20 newcomers;

• Chinese community chat gained 32 newcomers;

• The total amount of BSC birtday celebration participants was 73 users in Twitter;

• The CV Summit discussion with Vladimir Demin participation is viewed by 4 200 users.

Fly token news

1. Staking news:

• The total amount of staked tokens increased to 779 132 FLy tokens;

To join to staking:

2. FLy signals news:

• The profit was calculated for each group of signals:

- BTC/USDT 3,26%;

- ETH/USDT 11,1%;

- ADA/USDT 26,1%;

The total profit for all pairs is for %40,46.

3. Launchpad:

• All IDO participants for DNFT project got 75% refund.

VRM Research

1. CV Labs Conference in Zug;

2. No, Dogecoin is no longer “A joke”;

3. The step-by-step instruction to participate in IDO;

4. Fresh inflation data overshadowed powell’s speech at Jackson Hole Symposium. Investors see crypto as new safe haven.

VRM Education

New service, which will provide community with market research and coin analysis, is launched. Sign up here.

II. FLy token and Black Ocean plans for the future (general steps):

1. Technical plans:

• Black Ocean x FLy brands will be shifted to BO and FLyECO.

o BO will provide regulated and compliant customers with crypto-fiat dark pool solutions under strict KYC/AML policies.

o FLyECO will concentrate on DeFi, GameFi, NFT and trading solutions for retail customers all over the World.

• FLyECO includes:

o FLyLaunchpad

o FLyFarming

o FLyStaking

o FLyBridge

o FLyDEX with unique trading-related solutions, such as actively managed pools (Coming soon)

o FLyNFTStore for auctions and p2p buying and selling NFT collectables (Coming soon)

o FLyGames is GameFi for crypto lovers and NFT believers (Coming soon)

o FLyDarkPool for crypto exchanges (Coming soon)

o FLyDAO (Coming soon)

• From the 1st of October, all relationships with FLyECO will be facilitated only through the FLy token.

2. Marketing plans:

1. Adding a new trading pair (BNB/USDT) for FLySignals service;

2. Implementation of a new design for the FLy token and Black Ocean websites;

3. Creating a YouTube channel;

4. Taking part in the Gate.io AMA on the September 8th;

5. Searching for new IDO projects.
Black Ocean weekly report 23 – 29 August 2021
By: Fly X Bo Official Channel
Tags: Bo, Vrm, Fly, Report, Weekly

Black Ocean weekly report 23 – 29 August 2021

I. FLy token and Black Ocean news for the week

Community news

• Gained 250 newcomers on the Global Community chat;

• Indonesian community chat gained a total of 977 newcomers;

• Thai community chat gained more than 800 newcomers;

• Philippine community chat gained more than 60 newcomers;

• Chinese community chat gained 58 newcomers;

• IDO of DNFT project gained 584 participants.

Fly token news

1. Staking news:

• The total amount of staked tokens increased to 318 983 FLy tokens;

• The total amount of newcomers increased to 30 users.

To join to staking:

2. FLy signals news:

• Each group of signals got the separate channel:

- BTC/USDT;

- ETH/USDT;

- ADA/USDT.

3. Launchpad:

• IDO of DNFT project collected a total amount of deposited USDT for 133 344 USDT.

4. Partnerships:

• FLy and VRM signed the strategic partnership with Bitget platform.

VRM news

• The new design of website is implemented. Try it here

VRM Research

1. How to protect your money when investing in an IDO?;

2. World Democracy and Roles of Dollar and Bitcoin to Weather Chaos;

3. As BTC and ETH recovering towaeds their 2021 highs, the time for altcoins rapidly aproaching.

II. FLy token and Black Ocean plans for the future (general steps):

1. Technical plans:

• Black Ocean x FLy brands will be shifted to BO and FLyECO.

o BO will provide regulated and compliant customers with crypto-fiat dark pool solutions under strict KYC/AML policies.

o FLyECO will concentrate on DeFi, GameFi, NFT and trading solutions for retail customers all over the World.

• FLyECO includes:

o FLyLaunchpad

o FLyFarming

o FLyStaking

o FLyBridge

o FLyDEX with unique trading-related solutions, such as actively managed pools (Coming soon)

o FLyNFTStore for auctions and p2p buying and selling NFT collectables (Coming soon)

o FLyGames is GameFi for crypto lovers and NFT believers (Coming soon)

o FLyDarkPool for crypto exchanges (Coming soon)

o FLyDAO (Coming soon)

• From the 1st of October, all relationships with FLyECO will be facilitated only through the FLy token.

2. Marketing plans:

1. Adding a new trading pair (BNB/USDT) for FLySignals service;

2. Implementation of a new design for the FLy token and Black Ocean websites;

3. Taking part in the Mask campaign to celebrate the BSC network birthday;

4. Taking part in the CV Summit;

5. Running the AMA session with CEO Andrei Grachev and Chairman Vladimir Demin to discuss results for last months work and plans for brands developping.
DigitalBits Foundation Appoints Serial Entrepreneur Daniele Mensi As New Managing Director
Tags: Bitcoin, Blockchain, Report, Cryptocurrency, Foundation

DigitalBits Foundation Appoints Serial Entrepreneur Daniele Mensi As New Managing Director DigitalBits Follow Sep 2 · 2 min read

The DigitalBits Foundation is pleased to announce the appointment of Daniele Mensi to its team as the Managing Director. Daniele Mensi is an Italian serial entrepreneur, holding MsC in engineering and business education at INSEAD and Oxford Said Business School.

Michael Gord, the former Managing Director of the DigitalBits Foundation, will transition to the role of Managing partner of the GDA XDB Venture Fund, a newly formed venture fund focused on supporting the growth and expansion of the DigitalBits ecosystem through investments in companies leveraging the DigitalBits blockchain.

After a successful year at the DigitalBits Foundation, Michael Gord says, “It’s been a tremendous pleasure building the team and establishing the foundation. We have seen the ecosystem evolve globally and achieve rapid growth over the past year. I am excited to welcome Daniele as he takes on his new role as managing director of the Foundation, as I commence my new chapter in the DigitalBits ecosystem through the formation of the GDA XDB Venture Fund.”

Daniele brings over 20 years of experience to the DigitalBits Foundation, having served in various roles in technology, finance, and telecommunications. Daniele began his career in the tech team that launched the first-ever 3G Network rollout. In 2016, he became the international CEO and VP Growth of the cloud communication platform company Ubiquity, rebranded Kaleyra, and helped lead its path towards its IPO onto the NYSE (KLR). He was instrumental in establishing the company’s product-market-fit with the vision to install this API messaging provider on top of all of the major Cloud CRMs globally.

Daniele has also co-founded multiple blockchain companies, as well as the very first Oxford Blockchain Foundation. He introduced a new blockchain chapter across worldwide mobile operators (MEF), and built a new decentralized finance business framework as well as portfolio companies with Blockcerts Blockchain worldwide. Daniele was also instrumental in helping to facilitate the recently announced blockchain-centric partnership between AS Roma and Zytara Labs.

“Covid has shown us that big brands need to embrace new technologies to remain competitive in this fast moving digital world. The DigitalBits blockchain provides this technology to empower such brands in building a never-imagined-before class of high valuable digital assets. It is with great honor that I join the DigitalBits Foundation team to support the growth of the ever growing branded economy,” noted Daniele Mensi.
The 48 Year Late Fee Is Waived
By: M.G. Siegler
Tags: Music, Library, Life, Bob Dylan

“As a recent retiree, I am taking the opportunity to turn my attention to some of the many vignettes of life that by dint of career and family have been neglected these many years. In that context, I am returning with this letter an overdue item (by my count, approximately 17,480 days overdue as of this writing)… it’s quite late, and I’m quite sorry!”

— So Simon, who is now 62, in a letter sent along with the Bob Dylan album (“Self Portrait”) he’d borrowed as an eighth-grader. Yes, he mailed it back to the library 48 years late. Also:

Simon also included a $175 check — “a tithe, if you will,” he said, or about 10% of what the dime-a-day late fee in effect in July 1973 would have added up to.

Also, the library, which incidentally in Cleveland, Ohio, right near where I grew up (and So Simon currently lives in San Francisco, where I write this right now), declined to cash the check:

Sara Philips, manager of the University Heights, Ohio, branch of Heights Libraries, said the library no longer collects late fees. “We’re grateful that Mr. Simon returned the record,” she said on the library’s website. “I said we can now call it even.”

Just a great little story.
A Short Ode to the Library. On moving to Montreal there were…
By: Aigul'S Blog
Tags: Montreal, Libraries, Public Libraries, Books

The Temple of Books and Stuff, also known as La Grande Bibliotheque

On moving to Montreal there were several obvious essential things to be done — finding a long-term abode, getting a local phone number, learning how to use the metro and other highly sophisticated tasks. However, whilst I was still browsing the interwebs from the scorching heat of Thailand, I’ve found another thing that someone pointed out as important and to be done soon — registering with a library. Much amused, I’ve added that to my to do list.

As luck would have it, I had barely enough time to go through some of the tasks on that list after landing here before the manure hit the windmill, as it were, and COVID was upon us. I soon found a few bookstores that still functioned online, but the idea of a library kept resurfacing in my mind. Thus, when I found out that one can register and read some of the books online, I proceeded to do just that. In fact, I registered with two libraries (BANQ and Bibliothèque de Montréal) as there were some volumes unavailable in one or another. I’ve thoroughly enjoyed using this service. Sometime later, as the number of new COVID cases diminished slightly the BANQ (Bibliothèque et archives nationales du Québec, combined library and national archives) was able to provide some of the services, one of which was putting a book on hold online and then drop for a visit to pick it up and I was finally let in. Even though browsing of shelves was not yet permitted, I couldn’t help but to be smitten. Thus went my affair with BANQ for a month or two.

Views from central staircase

So, when visitors were finally allowed to browse the shelves I was enraptured. The six levels of all sorts of knowledge! They even have video-games there! Now, this might be a regular feature of life in a big city for people who are used to it but I had to make a list and exercise restraint and not to borrow the maximum allowed number of books just because I can.

The variety is astounding to the degree that I’ve found books in Russian by rather popular, if not too sophisticated author (in Russian these type of books are called unkindly but somewhat truthfully “toilet read”). I’ve found everything I’ve wanted to read and more!

What had also surprised me, apart from multitudes of choice, was that it seems to be a popular establishment. There are always strings of people of all ages coming and going, with stacks of books, CDs or other material. The library provides small carts so that kids can carry their favourites themselves, which some of them even do. It pleased my book-besotted brain no end.

What do I read now? I’ve finally got my hands on “Algorithms to Live By: The Computer Science of Human Decisions by Brian Christian and Tom Griffiths.
Braiding Sweetgrass: Indigenous Wisdom, Scientific Knowledge, and the Teachings of Plants
By: Usfws Conservation Library
Tags: Literature, Authors, Books, Libraries, Read

Poster for America’s Wild Read October 2021 with head and shoulders image of author and image of book cover for Braiding Sweetgrass: Indigenous Wisdom, Scientific Knowledge, and the Teachings of Plants. Graphics: Richard DeVries/USFWS

The USFWS Conservation Library is excited to announce our fall book selection, Robin Wall Kimmerer’s Braiding Sweetgrass: Indigenous Wisdom, Scientific Knowledge, and the Teachings of Plants. Kimmerer is a State University of New York (SUNY) Distinguished Teaching Professor, indigenous scientist, writer, and mother who shares with us lessons from nature, like the striking beauty of asters and goldenrods, strawberries, pecan and maple trees, and sweetgrass. She holds a BS in Botany from SUNY, an MS and PhD in Botany from the University of Wisconsin and is the author numerous scientific papers on plant ecology, traditional knowledge and restoration ecology. Her writing has appeared in The Washington Post, The New York Times, and Los Angeles Times.

Braiding Sweetgrass was voted a New York Times Bestseller and the “Best Essay Collection of the Decade” by Literary Hub, as well as a Reading Recommendation for Fall from Food Tank. Intertwining of science, spirit, and story, Kimmerer offers this beautiful “braid of stories meant to heal our relationship with the world” as she shares on her background of being both a botanist and member of the Citizen Potawatomi Nation, she embraces the notion “that plants and animals are our oldest teachers.” Her lens on the natural world is one full of gratitude, reciprocity, and a widened ecological consciousness to give back and be kind to the earth.

For FWS employees, you can access an eBook of Braiding Sweetgrass via this link. Please log in via VPN or access while on the network to authenticate. FWS employees may also email megan_burdi@fws.gov to borrow a print copy as available. For the general public, Braiding Sweetgrass can be found at your local library or book store.

On Tuesday, November 16th at 3 PM ET, we are hosting a Book Discussion via Zoom open to all. There will also be a list of discussion questions posted soon if you’d like to go through those as you read.

Brought to you by the USFWS Conservation Library, America’s Wild Read is a virtual book club where we aim to inspire you to connect with the outdoors and nature through literature. We hope you will read along with us as we feature various conservation books every quarter — contemporary, traditional, new, and classic.
Flutter: Interesting packages, part 2.
By: Samuel Wahome
Tags: Flutter, Libraries, Flutter Ui, Flutter App Development, Code

Ever worked on an app and you needed to display fuzzy timestamps that showed when a post was created or updated, how long ago a comment was added etc. Well, look no further, as this library is bundled together to solve that very urgent need. Of course, you could replicate the functionality of this library within your code, but in case you prefer to automate to save time, then this library is definitely a worthy recommendation.

2. flutter_staggered_grid_view

Think about a staggered grid view and an app such as Pinterest immediately pops in mind. Need that staggered grid view feel, then this library is definitely for you. I was actually a bit surprised that the Flutter framework doesn’t pack this by default, but it does have the default grid view that is also customizable. And in case you do need a bit of help implementing this library(the docs are very articulate by the way), then this article should be of much help.

3. connectivity_plus

Need a way to discover and watch the network state of your Flutter application, then this library is definitely for you. This would definitely be useful where you need to inform users whenever their internet connection is lacking. This nifty library can even tell the difference between a mobile and WiFi connection. If you do need any help integrating this library into your application, then this video should be of much help.

4. shared_preferences

Need to persist simple data in your application such as whether an app user has viewed a specific page route, then this library should definitely meet your programming needs. Caution, however, needs to be observed as not to store critical data using this library.

5. tab_indicator_styler

In the event you do need to style your Flutter TabBar, then this library is definitely a worthy recommendation. It has three different styles of tab indicators, which are all very customizable, hence making delivering beautiful UI nearly child’s play.

6. simple_animations

With Flutter being a UI framework, animations are definitely at its core. If you ever need to create custom animations that are tested and enterprise-ready, then this library is definitely a worthy recommendation.

7. path_provider

Does your application need to have the ability to retrieve locations from the file system, such as when you are accessing a PDF, image, video, etc? Then this library is definitely what you need, and a worthy recommendation at that too.

8. animated_text_kit

Ever needed visually appealing text animations? Then this library is definitely what you need. With over nine different types of animations to choose from plus the ability to make your custom text animations, then this feature-packed library is definitely a worthy recommendation.

9. shimmer

Need an easy way to add a shimmer effect in your application? Well, look no further as this library has your back. In the event you do need help incorporating it into your application, then this article should be of much help.
Task.WhenAll vs Parallel.Foreach
By: Mortaza Ghahremani
Tags: Asynchronous, C Sharp Programming, Net Core, Parallel Computing, Multithreading

What is the difference between Task.WhenAll and Parallel.Foreach when you have multiple tasks to run concurrently?

Both of them are a way to implement multiple concurrent task execution. But with some differences that specify where each of them fit to be used.

I’d like to start with a sample to describe this difference in practice. Suppose that we have a method comprised of one HTTP call and then one store command in the database. We want to execute multiple tasks of this request concurrently.

public async Task Foo(Request request)

{ var result = await httpService.Send(request);



await repository.Store(result);

}

So for executing multiple calls of the Foo method concurrently we can use these ways in .Net Core :

Parallel.ForEach(requests, async request =>

{

using (var sendScope = service.CreateScope())

{

var callService = sendScope.ServiceProvider.GetRequiredService<ICallService>();

await callService.Foo(request);

}

});

Also, it is possible to use Task.WhenAll for doing that:

var tasks = requests.Select(async request =>

{

using (var sendScope = service.CreateScope())

{

var callService = sendScope.ServiceProvider.GetRequiredService<ICallService>();

await callService.Call(request);

}

}); await Task.WhenAll(tasks);

I have executed both of them on my laptop with the below characteristics:

Cori7 Intel 6700 HQ CPU (2.60 GHz 8 CPU), 16 GB DDR4 RAM

So I’ve captured these results from different executions:

Each Number 100–15000 in Left Side Shows the number of Concurrent Tasks

The above picture shows how long it takes to execute in milliseconds for the specified number of Concurrent tasks of the Foo Method.

There are two important points in the above execution result :

At first, the Parallel.Foreach has a faster execution time in comparison with Task.WhenAll .

The second point is when concurrent tasks get more than 8000, Parallel.Foreach encounter with failed statues.

So, In Conclusion, Although Parallel.Foreach has faster execution time, but Task.WhenAll has higher scalability. It means that by increasing the request load the Task.WhenAll Handles it without any failure.

Don’t confuse scalability vs speed, Although Parallel.Foreach is better in speed but has lower scalability in comparison with Task.WhenAll to respond to a high load of concurrent requests.

This result comes from the fact that Task.WhenAll has designed to handle concurrent I/O bound Tasks with higher scalability as it uses asynchronous non-blocking way to share threads to handle concurrent requests.

But, on the other hand, Parallel itself is synchronous. So it is beneficial to use it in CPU bound logics to get better performance.
What is the difference between .NET core and .NET Framework?
By: Rlogical Techsoft.Pvt.Ltd
Tags: Aspnet, Aspnet Development, Net Core, Aspnetcore, Net Core 5

What is Microsoft .NET 5?

Microsoft’s .NET 5 has some major changes that can significantly affect your organization.

.NET Framework is a better choice if you:

Do not have time to learn new technology.

Need a stable environment to work in.

Have nearer release schedules.

We are already working on an existing app and extending its functionality.

Already have an existing team with .NET expertise and building production-ready software.

Do not want to deal with continuous upgrades and changes.

Building Windows client applications using Windows Forms or WPF

What is NET Core?

NET Core is a new version of. NET Framework, which is a free, open-source, general-purpose development platform maintained by Microsoft. It is a cross-platform framework that runs on Windows, macOS, and Linux operating systems.

.NET Core is a better choice if you:

Want to target your apps on Windows, Linux, and Mac operating systems.

Are not afraid of learning new things.

Are not afraid of breaking and fixing things since .NET Core is not fully matured yet.

A student who is just learning .NET.

Love open source.

The following Features through may help you make your decision.

Features & Winners

Feature: A high-performance and scalable system without UI

Winner: .NET Core is much faster.

Feature: Docker containers support

Winner: Both, but .NET Core is born to live in a container.

Feature: Heavily rely on the command line

Winner: NET Core has better support.

Feature: Cross-platform needs

Winner: .NET Core

Feature: Using Microservices

Winner: Both, but .NET Core is designed to keep today’s needs in mind.

Feature: User interface centric Web applications

Winner: .NET Framework is better now until .NET Core catches up.

Feature: Windows client applications using Windows Forms and WPF

Winner: .NET Framework

Feature: Already have a pre-configured environment and systems

Winner: .NET Framework is better.

Feature: Stable version for an immediate need to build and deploy

Winner:.NET Framework has been around since 2001. .NET Core is just a baby.

Feature: Have existing experienced .NET team

Winner:.NET Core has a learning curve.

Feature: Time is not a problem. Experiments are acceptable. No rush to deployment.

Winner:.NET Core is the future of .NET.

Are you looking for ASP.NET Development Services? Rlogical Techsoft’s ASP.NET app development services lead to developing responsive, scalable, and futuristic enterprise-critical apps using the .NET Framework and other Microsoft products.
From REST to gRPC with ASP.NET Core
By: Carlos Lisandra
Tags: Software Engineering, Rest Api, Software Development, Net Core, Software

the image comes from here

Currently we have most applications that follow the REST standard. Although REST is fast, gRPC performs much better with higher traffic volumes (see here).

Let’s start

Let’s take the example api that comes in the dotnet tools webapi template: “WeatherForecast”

dotnet new sln -o rest-grpc-demo

cd rest-grpc-demo

mkdir src

cd src

dotnet new webapi -o WeatherForecast.WebApi

dotnet sln ..\..\rest-grpc-demo.sln add WeatherForecast.WebApi.csproj

We need now to create a proto with the request “GET” and with the output object WeatherForecast

public class WeatherForecast

{

public DateTime Date { get; set; }

public int TemperatureC { get; set; }

public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);

public string Summary { get; set; }

}

Outside the “src” folder we will create a new one called protos, this is where we will put all our proto files.

dotnet new proto -o protos\Weather -na WeatherForecast

With this command we will create a proto file with the namespace we want.

Now we add the so-called GET, for example, with the name GetWeather

And add the message result

How to configure your application to accept both types of requests

Only need to configure kestrel in your Program.cs

With this configuration, all REST calls will go through port 5000 but gRPC will use port 5001:

And add the services to Startup

I extract to interface the WeatherService to use it in the WeatherController as a unique repository of data.

You can see the complete application on my github
Stateful Serverless workflows with Azure Durable Functions
By: Théo Rémy
Tags: Messaging, Net Core, Serverless, Azure Durable Functions, Azure

Within the Notifications team at ASOS, we are responsible for sending out service emails and push notifications to customers. All the important updates related to your order, your return or your account go through us in the form of events published by other teams across the business. We then use that data to build custom notifications at scale. The volumes we deal with represent an average of 20 notifications sent per second on a normal day which can go up to 100 per second during peak periods.

One of the technical challenges we have had to tackle over the past year was building a service able to aggregate different types of events together in order to inform ASOS customers about their returns. These events are all owned by different teams and are published independently. Each one of them holds valuable information, such as which items were returned, as well as the refund transaction details.

Each day, more than 100k email notifications are sent to ASOS customers, informing them about their return, thanks to Durable Functions. 🚀

As you may know, Azure Functions provides a simple and efficient way to run small pieces of code that can be triggered in various ways (Timer trigger, Http trigger, Blob trigger, etc.) and achieve a single task. They are serverless, meaning that you will not have to worry too much about the infrastructure behind it. However they are stateless, so you cannot link multiple functions together easily and out-of-the-box.

So how to solve this problem? What about the infrastructure, scalability, concurrency, cost and availability? Surely Azure must have something up its sleeve…
How to Develop File Uploader with Angular + .NET Core
By: Bilal Rifas
Tags: Web Development, JavaScript, Angular, Typescript, Net Core

Today we are going to develop a most important part of all common applications when making user registration forms.

Applications sometimes asks us to upload files in it. How can we achieve the same implementation on our application as well. In this article we are going to use Angular + .NET Core for file uploader application development.

Uploading files is an integral part of most projects. However, when considering a file upload method, you should carefully assess the needs of your project. You can manually upload files using Angular components, like FormData, HttpClientModule, and reactive forms. Each of these components will serve different purposes.

Photo by Sincerely Media on Unsplash

Use Cases

There are several use cases we could use file uploading. These are common places developers has developed file uploading. Such use cases are below:

Instructor

Upload lecture presentations

Post lecture outline to students (& give hard copy)

Upload Syllabus

Post content for next week

Post readings each week

Post course material at beginning of semester

Students

Upload assignments for submission

Upload personal files, such as pictures, for sharing

Upload course notes, articles, presentation slides, PDFs, etc. for sharing

Instructional Designer

Post material on course site for the instructors

Advanced Upload
Reissue JSON Web Token (JWT) with Sliding Expiration using ASP.NET Core (C#)
By: Munesh Kumar
Tags: Slidingexpiration, Net Core, Aspnetcore, Jwt, Jwt Token

I’ll be going straight to the point on how to reissue a JSON Web Token (JWT) when it is close to expiration. The best thing is you can do this without any huge development effort. I assume here that you’ve configured JWT Bearer Auth. There are already many articles on implementing JWT Bearer Auth.

What is Sliding Expiration?

Sliding expiration resets the expiration time for a valid authentication token if a request is made and more than half of the timeout interval has elapsed. If the token expires, the user must re-authenticate.

We’ll add our own custom Sliding Expiration Middleware into the request pipeline of ASP.NET Core application.

Middleware is generally encapsulated in a class and exposed with an extension method.

You can read more about writing custom ASP.NET Core middleware here.

Consider the following SlidingExpirationMiddleware.cs class. We read Authorization header on each request and make sure that this is an authenticated request. If more than half of timeout interval has elapsed then we reissue a JWT token with a new expiration and send it back in the Set-Authorization header.

Obviously our client code needs to know that an updated JWT token may be returned in Set-Authorization header of any of our API responses.

The following extension method exposes the middleware through IApplicationBuilder .

Now finally let’s call the middleware from Startup.Configure

That’s it… We’re done here.

There are other approaches as well like using Refresh Tokens etc. But I guess other approaches requires a bit of development and management effort. Wasn’t this approach easier..? I’d love to hear any improvement/feedback :)

Happy Coding !
How to work easily with MongoDb !
By: Amirhosein Ahmadzadeh
Tags: Facade, Net Core, Mongodb

Easy use of MongoDb in .NET Core

You may have worked with MongoDb in .Net Core. There is a good C#driver named MongoDB.Driver .

When It’s come to choosing the right database, There are many factors and situations that you should care about them but in this article I will not to talk about them.

In short, I would like to say if you are looking for something like Entity Framework to work with NoSql, You are choosing the wrong way.

There are many differences between SQL and NoSql and you know this.

However, when We want to implement the web project that work with database, We need the structure to manage database connections (something like DbContext).

Probably You need to create mongo collection based on your code dynamically.

I made a Nuget package called MongoDriver.Facade to meet these needs.

Actually MongoDriver.Facade makes it easy for you to work with MongoDb through an interface named MongoDbContext.

MongoDbContext manages client connection to database. Also, it automatically creates database and collections (with their configuration) based on your models.

So, Lets look at a sample :

First, We create an API projcet :

Go to File > New > Project. Select the ASP.NET Core Web Application project type, and select Next. Name the project BooksApi, and select Create. Select the .NET Core target framework and ASP.NET Core 5.0. Select the API project template, and select Create.

Then, Install the package with Install-Package command :

Via package manager:

Install-Package MongoDriver.Facade -Version 1.0.3

Via .NET CLI:

dotnet add package MongoDriver.Facade --version 1.0.3

Then, Add MongoSettings section to appsettings.json:

appsettings.json

Register the MongoDriver.Facade:

Startup.cs

Now, We add the Book entity(collection):

Book.cs

We create the BookService like this :

BookService.cs

Then you register BookService per scope :

services.AddScoped<BookService>();

Finally Add BooksController:

BooksController.cs

For testing api, You can run the following command for inserting books in the Book Collection:

db.Book.insertMany([{'Name':'Design Patterns','Price':54.93,'Category':'Computers','Author':'Ralph Johnson'}, {'Name':'Clean Code','Price':43.15,'Category':'Computers','Author':'Robert C. Martin'}]);

Then, You should see this:

Books Result

Furthermore, You can see the source code in github repository :

https://github.com/amirhosseinsaloot/mongo-driver-facade

happy coding 😊 !
Static members do not get garbage collected through Depedency Injection
By: Sami C.
Tags: Static, Net Core, C Sharp Programming, Dependency Injection

TLDR

Static members do not get garbage collected, even if the AddScoped<MyService> lifetime is used. This means that the static variable will keep the same value for every HTTP request made to the service.

My colleague had a question about a static variable maintaining state when a new HTTP call accessed the service. .NET Core has built in Dependency injection.

For information on using dependency injection in applications other than web apps, see Dependency injection in .NET.

This is how our service was registered in the startup.cs:

services.AddScoped<MyService>();

Notice that we’ve used the scoped. When we take a look at the definition of a scoped service.

In apps that process requests, scoped services are disposed at the end of the request.

Take a look at the following code

Since we’ve used a scoped service, our dictionary should always be empty when a new request gets made to loadData(), but this is not the case. The first call to the service will result in a Console.WriteLine(‘Dictionary is empty’), the successive calls will result in dictionary is full. The reason for this behavior is the ‘static’ keyword. Static variables will never get garbage collected as long as the class exists. Therefor, the static keyword will override the Scoped service lifetime defined in our startup.

Enjoy!
Be Careful About Regex Performance Trap
By: Rico 技術農場
Tags: Net Core

規則運算式相信大家都很熟，實務上也很常見，像是比對 Email、身分證..等，Regex類別具有不可變和執行緒安全特性，所以可以在任何執行緒建立並且共用，大部分情況比對文字相當快速，不過寫法上差異對效能還是有明顯不同。

影響比對效能大致有三點，1.考慮輸入來源、2.避免重複物件實體化、3.編譯模式不一定效能永遠好。

如果輸入文字非常彈性，而且幾乎符合我們的規則運算式模式，且也依賴大量回溯(Backtracking)演算法，該演算法算是規則運算式的核心能力，可讓運算式功能強大且靈活，並且比對非常複雜的模式。 但同時，這項強大功能需付出相當的代價。回溯經常是影響規則運算式引擎之效能最重要的一項因素，當然我們也可以不要進行回溯的線性比對，如果規則運算式倚賴回溯，建議設定逾時間隔。

針對上面三點，我簡單測試驗證電子郵件地址來看看寫法不同的效能差異。

private string[] addresses = { "A@rico.com", "a!@rico.com" }; //string[] addresses = { "AAAAAAAAAAA@rico.com", // "AAAAAAAAAAaaaaaaaaaa!@rico.com" }; private readonly static Regex _regex = new Regex(@"^[0-9A-Z]([-.\w]*[0-9A-Z])*$", RegexOptions.IgnoreCase); private readonly static Regex _regexCompiled = new Regex(@"^[0-9A-Z]([-.\w]*[0-9A-Z])*$", RegexOptions.IgnoreCase | RegexOptions.Compiled); [BenchmarkCategory("CallMatchWitnNew"), Benchmark(Baseline = true)] public void CallMatchWitnNew() { var pattern = @"^[0-9A-Z]([-.\w]*[0-9A-Z])*$"; var regex = new Regex(pattern, RegexOptions.IgnoreCase); foreach (var address in addresses) { var isMatch = regex.IsMatch(address); } } [BenchmarkCategory("CallMatchWitnNewCompiled"), Benchmark()] public void CallMatchWitnNewCompiled() { var pattern = @"^[0-9A-Z]([-.\w]*[0-9A-Z])*$"; var regex = new Regex(pattern, RegexOptions.IgnoreCase | RegexOptions.Compiled); foreach (var address in addresses) { var isMatch = regex.IsMatch(address); } } [BenchmarkCategory("CallMatchWithoutNew"), Benchmark()] public void CallMatchWithoutNew() { var pattern = @"^[0-9A-Z]([-.\w]*[0-9A-Z])*$"; foreach (var address in addresses) { var match = Regex.Match(address, pattern, RegexOptions.IgnoreCase); var isMatch = match.Success; } } [BenchmarkCategory("CallMatchWithStatic"), Benchmark()] public void CallMatchWithStatic() { foreach (var address in addresses) { var isMatch = _regex.IsMatch(address); } } [BenchmarkCategory("CallMatchWithStaticCompiled"), Benchmark()] public void CallMatchWithStaticCompiled() { foreach (var address in addresses) { var isMatch = _regexCompiled.IsMatch(address); } }

結果

我們可以看到，CallMatchWitnNewCompiled函式執行時間最久(3,656,653.2 ns)且須分配大量記憶體(20180 B)，該函式中寫法也滿常見，另外，最常見CallMatchWitnNew和CallMatchWithoutNew函式中寫法雖然都比CallMatchWitnNewCompiled來的好，但建議還是使用CallMatchWithStaticCompiled函式寫法，不僅執行時間最快(451.6 ns)、記憶體分配最小(0)，而且也不會建立新物件(Gen0為空直)。

P.S:有興趣的朋友可自行修改輸入來源，有什麼其它發現歡迎留言分享。

RiCo技術學院:實戰課程和多種組合包限時優惠中

RiCo技術空間

Reference:

Regex Class

Best practices for regular expressions in .NET

.NET regular expressions

Backtracking in Regular Expressions
Are You Secretly Running a Social Enterprise?
By: Brian Roland
Tags: Purpose, Social Entrepreneurship, Leadership, Startup, Social Enterprise

Are You Secretly Running a Social Enterprise?

Photo: Guduru Ajay bhargav/Pexels

My first “real job” was in an outside sales role. My boss gave me a lot of freedom and creative control. I was surrounded by great people, and I quickly grew into a leadership position with a lot of responsibility. But in a few short years, I couldn’t figure out why I was working so hard.

Ultimately, when times got tough, making “good money” wasn’t motivating enough for me.

So, in 2006, my brother and I launched Abenity.com to bring Fortune 500 perks to companies of any size. From the beginning, we knew we wanted our business to stand for something more than the products and services we would deliver. We wanted to work for something bigger than our product, bigger than our services, and bigger than industry.

That type of thinking was a novel idea in 2006. For context, that was the same year Blake Mycoskie was inspired in Argentina to launch Tomorrow’s (Tom’s) Shoes with a “buy a pair, give a pair” business model. At the time, the world of corporate philanthropy was more of a reactive financial response to charitable needs than a proactive mission, driven by the company’s DNA. That’s what charities are for, right?

“We wanted to work for something bigger than our product, bigger than our services, and bigger than industry.”

We wanted to build our business with a greater purpose and to make a measurable impact for our cause with every dollar we earned. So we took a leap of faith and structured our charitable ambitions around a single, unshakeable concept… math.

Before we made our first dollar, we committed 15% of net earnings toward the biggest problem we could think of — extreme poverty. We labeled our Social Mission “Perks With Purpose” and began sponsoring children through World Vision in alignment with the United Nations’ #1 Goal — eradicating extreme poverty for all people everywhere by 2030.
Building a Better Business Through Diversity, Equity and Inclusion
By: Caitlin Kealey
Tags: Hiring, Diversity, B Corp, Social Enterprise, Inclusion

We are working to recognize our unconscious biases and find ways to address them. It’s not an easy road, and it’s one that we are walking carefully. In our last round of hiring we realized that we needed to do more than just lightly update and reuse the old job description, as it was laden with potentially problematic language and overreaching requests.

Here’s a quick checklist for the next time you go out to hire. It’s by no means exhaustive, but it includes a few things we’ve been working on at MediaStyle to build a more inclusive process.

Always post the job.

When you rush to hire friends of friends, you are making your pool quite narrow. Quick hires are rarely diverse hires.

Be mindful of your words.

Research shows that the language in a job description affects who applies. For example, words like “rock star” and “ninja” that emphasize assertiveness may discourage women from applying.

Meet candidates where they are.

In addition to reaching out on our usual social channels, we post and advertise in different spaces and ask for help from organizations outside our typical networks. Hire Immigrants Ottawa and OSCIO are two that we’ve been working with to build relationships in the past few months.

Use a blind hiring process.

When we vet candidates, only one person sees the names, which are removed before we rank applicants.

Let people know you are inclusive.

We’ve added the following language to our job listings: “MediaStyle promotes the principles of anti-oppression and adheres to the tenets of the Ontario Human Rights Code. We encourage applications from people of all genders, races, ethnic origins, religions, abilities and sexual orientations. We strive to reduce unconscious bias throughout our hiring process.”

Hire outside your comfort zone.

We often look at applicants’ passions and extracurriculars outside work. We don’t just want eight people who have the same degree from the same school.

The work doesn’t stop when hiring is done. Unconscious bias requires constant checks. Examine everything from your onboarding process to your workflow to how you handle team meetings and lunches to find ways to improve.

Inclusion isn’t an end point but a journey.
What is a Syntropic Enterprise?. Syntropic enterprise = an undertaking…
By: Christine Mcdougall
Tags: Change, Transformation, Syntropic Enterprise, Social Enterprise, Buckminster Fuller

Language matters.

From Etymology a Social Enterprise is;

An undertaking devoted to or relating to home life, others, living together with others.

Is this the right name for enterprises committed to a world with a future?

I see many enterprises calling themselves social enterprises when really what they are doing is incremental or translational change.

You might have heard of the second law of thermodynamics, entropy, which is the gradual running down of the energy of Universe.

Entropic enterprise is business-as-usual. Extraction to extinction, exploitation, colonisation. Eventually the ouroboros eats its tail. No amount of money can buy life on a disintegrated planet. When Walmart doesn’t pay its workers enough money to buy its goods, then they have hit an end zone. When Jeff Bezos pays zero tax from $11Billion profit and his factory workers pay more tax in their monthly salary than the entire Amazon company pays, then we have entropy by business design.

What we need from enterprise is transformational change into something better than. And we need this as the complimentary pair to our current business-as-usual entropic model.

I propose instead to elevate a word that I first encountered via Buckminster Fuller.

Entropy has a complimentary phase, which Bucky designated as syntropy.

Syntropy means going to states of higher order.

Syntropic enterprise = an undertaking that enables a higher order. By nature it evokes gravity (attraction) and coherence towards an eternally regenerative Universe.