teleren/devto huggingface dataset:
On .NET Episode: Clustering in Orleans
Tags: dotnet, microservices, clustering, orleans
Published: 2021-06-17 18:23:29

Using Microsoft Orleans you can build applications that scale from a single on-premises server to globally distributed and highly-available in the cloud.

In this episode, Reuben Bond joins Cecil to explain to us how we can use the builtin clustering feature in Orleans and how it works in the background.

{% youtube okBWuR5AnBY %}

If you liked this video and would like to see some more of our .NET content, please subscribe to our [.NET Developers YouTube Channel](https://www.youtube.com/channel/UCvtT19MZW8dq5Wwfu6B0oxw).


## Useful Links
<ul>
<li><a href="https://dotnet.github.io/orleans/" target="_blank">Orleans Homepage</a></li>
<li><a href="https://github.com/ReubenBond/hanbaobao-web" target="_blank">Orleans sample application with Kubernetes hosting</a></li>
<li><a href="https://channel9.msdn.com/Shows/On-NET/Building-real-applications-with-Orleans" target="_blank">Building real applications with Orleans</a></li>
<li><a href="https://dotnet.github.io/orleans/docs/host/heterogeneous_silos.html" target="_blank">Heterogenous Silos</a></li>
<li><a href="https://www.youtube.com/watch?v=KhgYlvGLv9c" target="_blank">Orleans at Microsoft</a></li>
<li><a href="https://github.com/OrleansContrib" target="_blank">OrleansContrib</a></li>
</ul>
# Javascript Project
Tags: javascript, ruby, rails
Published: 2021-06-17 18:11:23

For my Rails project, I created an application that would allow users who registered as patients to ask medical questions to physicians. Users who register as physicians can answer these questions. 
							 
For my Javascript Project, I used this language to add the ability for my patient users to see an index of all of the questions that they have asked as well as a show page which displays all of the details of that question as well as all of the responses that this question has received. This allows the user to quickly find information that is relevant to them and quickly flip back and forth between questions as they do not have to leave their own personal user show page. 
							 
The user can also ask a new question in order to receive help from the online physicians. To do this, they are directed to a new question form which when submitted displays all of the information submitted as a new question. This confirms to the user that their question was submitted and lets them review all of the information that they physician will see again without leaving the page. These features enhance the user experience by displaying results more quickly and reducing the number of clicks that the user has to perform.
# Single Table Inheritance vs. Polymorphic Association
Tags: ruby, rails, design
Published: 2021-06-17 18:07:40

For my Ruby on Rails project, I needed to choose a setup so that two different users could access the application. I chose a single table inheritance because my two users shared most of the same data. The table would also be small and not accessed by other tables. Searching becomes more time consuming when the table is large and has many nil values. 

One user acts as a patient and is able to send messages to physician users. Their profile is simple and consists of a name, email address and password. The other user is a physician and has the same data as a patient as well as an NPI number that is unique to each physician as well as their specialty.  

The application allows patients to submit medical questions for physicians to answer. The single table inheritance design setup allows for all users to inherit from the user class reducing and streamlining the code.
How do you like to learn programming languages?
Tags: discuss, watercooler, coding
Published: 2021-06-17 18:07:18

Coders learn a lot in their early stages, and they continue to do so every day, but there are a variety of ways to learn.

Some people do it *by Reading Documentation first* some prefer to *watch online tutorials* and some learn by *making some project*.

Let me know what methods you have used to learn new things, and how you went about it.

### My Methods
I enjoy project-based learning.
Eventually, we all have to implement the things, which is different from remembering syntax.

> The more projects I build, the more I learn.
# Sinatra Project - Electronic Medical Record
Tags: sinatra, ruby
Published: 2021-06-17 18:05:44

For my Sinatra project, I developed an application that would function as an electronic medical record.  Medical records provide clear, easy access to patient data. This allows clinicians to have up to date access in order to make clinical decisions. 

This application allows patients to log in to view their medical history and active medical problems that their physician is working on. Physicians are able to add patients,  and edit their medical history and problems. 

Validating the data entered into the database and ensuring that only physicians have editing access were big challenges for this project. 


```
  validates :username, :presence => true, :uniqueness => true
  validates :npi, :presence => true, :uniqueness => true, length: { minimum: 10 }
  validates :password, :presence => true, length: { minimum: 5 }
	
```


The above code was entered into the physician model. This way every new physician entry must have a unique username, password, and an NPI number. The NPI number is a unique number that physicians are assigned for their work. 

I included a helper method that will tell whether a user is currently logged in:

```
helpers do
		def logged_in?
			session[:id] != nil
		end
end

```


This method checks whether it a user is logged in for pages only to be viewed by users. Pages to allow editing and creating patients are only accessible due to code that checks is the current session id is equal to the physician id. This protects the integrity of the data and improves the user experience by only showing the user links and fields that are relevant to them.
Quick Introduction to namespaces in C++
Tags: cpp, namespace, tutorial, programming
Published: 2021-06-17 15:43:43

As someone who writes C++ code often, I see (and use) the `keyword` `namespace` frequently and I think it is worth knowing what this `keyword` is all about.

A `namespace` is a region that provides a `scope` to the `identifiers` (the names of functions, variables, etc) inside it. `namespaces` are used to organize code into `logical groups`. All `identifiers` in the `namespace` scope are visible to one another. 

The `identifiers` in the `namespace` can be accessed by bringing those said `identifiers` into the current scope by [`using`](https://dev.to/guptaaastha/quick-introduction-to-using-in-c-4n73) or utilizing fully qualified names. 

```cpp
using namespace std;
// the namespace std is now in scope
string my_string;

std::string my_string
// fully qualified name
```

#### Declaring `namespace` and `namespace members`
A `namespace` declaration is generally done in a header file as following:

```cpp
// my_namespace_declaration.h

namespace my_own_namepsace
{
    void func_one();
    int func_two();
}
```

The members of this `namespace` can then be brought into `scope` of any other file by fully qualified names or the `using` directive. (If you want to know more about `using`, checkout [this](https://dev.to/guptaaastha/quick-introduction-to-using-in-c-4n73) article by me)

```cpp
// other_file.cpp

#include"my_own_namepsace.h"
using namespace my_own_namepsace;

my_own_namepsace::func_one();
// fully qualified names are to be used
// even when bringing the namespace in 
// scope with using directive
```

Code in a header file that uses `identifiers` from other `namespaces` should always use the fully qualified `namespace` name to avoid ambiguity. [This](http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rs-using-directive) isocpp core guideline puts more light.   

#### Nested namespaces

`namespaces` can be nested. A nested namespace has unqualified access to its parent's members however the parent members do not have unqualified access to the nested namespace (unless it is declared as [inline](https://en.cppreference.com/w/cpp/language/namespace#:~:text=An%20inline%20namespace%20is%20a,many%20situations%20(listed%20below).)).

#### The std namespace

All C++ standard library types and functions are declared in the `std namespace` or the various namespaces that are nested inside `std` which makes it one of the most common `namespaces` to be encountered.

This article is a short introduction and if you want to know more about `namespaces`, I encourage you to head over [here](https://en.cppreference.com/w/cpp/language/namespace).

Thanks for giving this article a read and I'll see you in the next one 😄

>PS: This is an article in my series **Quick Introduction to *a concept* in C++**. You can find all the articles in this series [here](https://dev.to/guptaaastha/quick-introduction-to-a-concept-in-c-15n6).
SMTP error 
Published: 2021-06-17 18:04:25

Bonjour, j'ai un soucis quand je veux envoyer un email. J'a un warning qui apparaît avec ceci comme message que dois-je faire ? J'ai  cherché partout sur internet.... Je suis chez Free voici mon fichier .ini                            [mail function]
; For Win32 only.
;SMTP = localhost
SMTP = smtp.free.fr
smtp_port = 25

; For Win32 only.
; http://php.net/sendmail-from
sendmail_from = "batiste.blactot1@free.fr"

Warning: mail(): SMTP server response: 550 5.7.1 Spam Detected - Mail Rejected. Please see our policy at: http://postmaster.free.fr/#spam_detected.
🛒 Shopping for obscure libraries
Tags: typescript, java, help
Published: 2021-06-17 17:47:58

I need to convert Java into Typescript...

Wired but true, I'm looking for a way to generate type definitions from Java, both the stdlib and custom stuff in .jar archives for use in Rhino 🦏😬

Its a long shot, but do you have any ideas or old code that does this?
#Refactoring Command-Line Interface Project 
Tags: ruby
Published: 2021-06-17 17:18:08

Recently I needed to refactor an application that I had written for the first project in my coding bootcamp. This was a scraper that collected data from an urgent care website to give the user the first available appointment time at their desired location. 
    The CLI no longer scraped the appropriate data due to some changes to the site. To correct this, many of the changes only required modifications to the data returned to get it to display properly. The office phone number was displaying information in addition to the phone number that was not relevant. This just required adding on the gsub method to remove the data that I did not want to display. 


```
office.phone_number = office_details.css('a[href]').text.gsub("Get DirectionsBook Urgent Care AppointmentBook COVID-19 TestBook Telemed Appointment", " ")
```

   What made scraping easier on the new site was that the urgent care center information was now displayed in one column instead of two. I no longer needed to create two arrays and zip them together which had been very time consuming. 
   The site is designed to list the current available appointment times on the same page that lists each individual urgent care center. The site currently lists the next available time as "Invalid client specified". Previously I had been scraping the information off a second url which now did not work. Now the desired information was actually contained on each sites individual page in a dropdown menu contained in a iframe.
     To get this information I wrote code to scrape the url for each individual urgent care centers site off the main page and stored it in a variable called url. I then passed this variable into a new method called get_waittime. The scraper then does to this new url and uses the waitir gem to wait until the element that identifies the iframe is loaded on the site. 

```
def get_waittime(url) 
    @@new_browser = @@browser
    @@town_page = @@new_browser.goto(url)
    js_doc = @@new_browser.div(id: 'left-area').iframe.wait_until(&:present?)
    @wait_time = js_doc.button(data_id: "timeSelector").text.gsub("\n", " ")
    Urgentcare::Office.all[0].next_available = @wait_time
  end
```

   The next available wait time is then stored in a variable which can be added to the office object and displayed to the user.
LightDM Web Greeter updated!
Tags: linux, lightdm, showdev
Published: 2021-06-17 17:14:50

LightDM is a light display manager for Linux, which have lots of different greeters/themes to choose. One of these greeters is the previously known as **lightdm webkit2 greeter**, then named [lightdm web greeter](https://github.com/Antergos/web-greeter), a greeter that allows theming with web technologies like HTML and JavaScript.

Sadly, this greeter was abandoned as [Antergos team](https://github.com/Antergos) didn’t have time to develop their distro. The latest version, **2.2.5** uses an outdated WebKit engine, which could cause some new web technologies to not work in the greeter. Also, the Debian package is not working, a shame.

Luckily, Antergos team were developing a **3.0.0** version, getting rid of WebKit and using the QtWebEngine, based on Chromium, with Python. So, I decided to update some things about this greeter based on this pre-release.

## Whither
[Whither](https://github.com/Antergos/whither) is the “new” tool that **3.0.0** would be using, developed by Antergos, allows to create web applications in a similar way to Electron.js, but in Python.

## Web Greeter
So, I’m here to introduce a new pre-release. You can install it from the [GitHub Repository](https://github.com/JezerM/web-greeter). Though, you need to install the [whither sdk](https://github.com/JezerM/whither) to run it.

### Changes
- Command line arguments support, such as `—-help`, `—-theme`, `—-debug` and others
- Some fixes with the LightDM API, as power functions didn’t work
- Man pages updated
- Every local request is made through `web-greeter:/` url scheme
- WebKit no longer here. Replaced with Chromium
- Some API changes. **2.2.5** deprecated functions and globals were removed

If you are using LightDM, I recommend you to use this greeter, try some themes and create your own!

Use the [Glorious theme](https://github.com/manilarome/lightdm-webkit2-theme-glorious) by **Manilarome**~ It’s glorious.
![Glorious theme gif](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tso91g1na404900gju1r.gif)
What is Web Scraping Weather Data using Scrapy
Published: 2021-06-17 17:12:18

Scrapy is one of the most accessible tools that you can use to scrape and also spider a website with effortless ease.

Today let's see how we can scrape weather data from the internet.

Here is the URL we are going to scrape https://weather.com/en-IN/weather/tenday/l/6d031a57074ba2aebf48f086cb118df52748edf41d9c624fd95329c6e070754d which provides a 10-day forecast for San Fransisco.

https://youtu.be/sLit-DrtXqA
What is new in Tailwind version 2.2?
Published: 2021-06-17 17:10:43

Tailwind CSS version 2.2 was just released today. This update brings many great new features to Tailwind CSS. This update is mostly focused on improving and expanding the JIT capabilities, but it’s also bringing some new features to the regular Tailwind version. Let’s dive in, to discover what’s new!

https://www.themes.dev/blog/what-is-new-in-tailwind-css-version-2-2/
How To Be A Successful Web Crawling And Data Mining Agency?
Published: 2021-06-17 17:10:19

Web crawling and scraping is a lot about the ability to tame the chaos, and a lot of it is not under your control. Websites change code, change their navigation, put up restrictions, may even IP block you if you are not using rotating proxies like Proxies API, the network speeds go up and down. These are just the realities in the world of web scraping, and here are some questions you can ask your web scraping agency and notice how comfortable they are with the challenges they pose. Are they vague, struggling for clear answers, or are they ready for you and even impressed that you asked them these questions? So here they are:

a. Ask them about the kinds of projects they have done and show you some examples of actual websites crawled, the challenges they posed, and how they overcame them. Ask them if they have an Upwork profile. If they are on Upwork, the most important I look for is a combination of high ratings (4.5 and above), enough experience (total hours worked), and a near 100% completion rate. You don’t want an agency abandoning your work midway ever. Read the customer reviews to get an idea of the vibe the team has with its customers.

b. The combination of skill sets — Web crawling is not just about coding; there will be a fair bit of manual work and wrangling with data. You can check the kind of skills they have in their team.

c. It’s ideal if they have listed web crawling or web scraping as a part of the leading service description. Like these guys:

d. Ask them about what measures will they take to overcome restrictions like CAPTCHAs, rate limits, code changes, etc.

e. Go for the Jugular — Ask them how they will deal with a situation where the website IP blocks them.

f. Ask them about what checks and measures have you built in to know if the web crawler is working as it should.

g. What framework do they use to build on top of and why? 

You don’t want them reinventing the wheel from scratch. It will not go well. Frameworks like Scrapy offer abstractions to control concurrency support multiple spiders, CSS selectors for scraping, automatic link extractors, cookies support, etc.

h. Also, ask them about how they will get data that is rendered by Javascript.

The author is the founder of Proxies API, a proxy rotation API service.
How JS Works ? Part 1
Tags: javascript, webdev, programming
Published: 2021-06-17 17:03:03

**JavaScript** is one of the most powerful language on the planet today. From being a scripting language in 90's , today it has reached [space](https://www.reddit.com/r/spacex/comments/gxb7j1/we_are_the_spacex_software_team_ask_us_anything/) 🚀.

In Order to better understand the language , I have gone through multiple blog posts and videos and have prepared a Reference Guide , which could be a quick refresher guide on JS Concepts. 

Below is the guide on JS Core Concepts , will soon publish another for the advanced concepts as well.

Click [here](https://www.flipbookpdf.net/web/site/4e1595f77bef4298f6184c1296901db8bc0b686b202106.pdf.html) to read the guide.

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zxs5ra83h3fstfl2y29e.png)

---
JS Array method polyfills
Tags: javascript
Published: 2021-06-17 16:46:56

### [**Array.prototype.map()**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)

  The map() method creates a new array populated with the results of calling a provided function on every element in the calling array.

  ```js
  Array.prototype.myMap = function(callback) {
    if (typeof callback !== 'function') {
      throw new TypeError(callback + ' is not a function');
    }

    const obj = Object(this);
    let newArr = new Array(this.length);
    let i = 0;

    while (i < obj.length) {
      if (i in obj) {
        newArr[i] = callback.call(this, obj[i], i, obj);
      }
      i++;
    }

    return newArr;
  }
  ```

### [**Array.prototype.filter()**](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)

  The filter() method creates a new array with all elements that pass the test implemented by the provided function.

  ```js
  Array.prototype.myFilter = function(callback) {
    if (typeof callback !== 'function') {
      throw new TypeError(callback + ' is not a function');
    }

    const obj = Object(this);
    let newArr = new Array(obj.length);
    let i = 0, actualLen = 0;

    while (i < obj.length) {
      if (i in obj) {
        if (callback.call(this, obj[i], i, obj)) {
          newArr[actualLen++] = obj[i];
        }
      }
      i++;
    }

    newArr.length = actualLen;

    return newArr;
  }
  ```

### [Array.prototype.reduce()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce)

  The reduce() method executes a reducer function (that you provide) on each element of the array, resulting in a single output value.

  ```js
  Array.prototype.myReduce = function(...args) {
    if (typeof args[0] !== 'function') {
      throw new TypeError(args[0] + ' is not a function');
    }

    const obj = Object(this);
    let i = 0;
    let result;

    if (args.length > 1) {
      result = args[1];
    } else {
      result = obj[i++];
    }

    while (i < obj.length) {
      if (i in obj) {
        result = args[0].call(this, result, obj[i], i, this);
      }
      i++;
    }

    return result;
  }
  ```

> The above polyfills are only meant for implementation purpose, the one provided on MDN are definitely better and one should not use their own polyfills over the API's methods. Thanks for reading :)
Getting current BitClout Price using BitClout API
Tags: python, bitclout, api
Published: 2021-06-17 16:40:41

Getting the BitClout price is really a must needed data since calculation of coin price, market cap, Total USD locked etc. is  dependent on the current BitClout price.

The workaround to get the current BitClout price in USD is really easy! All you need is to do a GET request to `https://api.bitclout.com/get-exchange-rate` to get the price of BitClout in BitCoin and then make a GET request to `https://api.coindesk.com/v1/bpi/currentprice.json` to get the current price of BitCoin in USD!

You are all set now!
Just multiply the **Bitcoin price in USD** with **BitClout price in Bitcoin** and you have the current price of BitClout!

Here is a working code in python.

```python
import requests
def getBitCloutPrice():  # return BitClout price in USD
  response = requests.get("https://api.coindesk.com/v1/bpi/currentprice.json")
  data = response.json()
  bitcoin_price = float(
  data["bpi"]["USD"]["rate"].replace(",", ""))  # Bitcoin price in USD

  r = requests.get("https://api.bitclout.com/get-exchange-rate")
  bitclout_in_bitcoin = (
            int(r.json()["SatoshisPerBitCloutExchangeRate"]) * 0.00000001
        )  # Bitclout price in Bitcoin
  bitclout_price = bitcoin_price * bitclout_in_bitcoin  # Bitclout price in USD
       
  return bitclout_price

if __name__ == "__main__":
  print(getBitCloutPrice())
 ```

If you want to learn more about the price of BitClout and how it is actually calculated check out [Tijn's Formula ](https://price.tijn.club/)

If you like the article don't forget to let us know in the comments or maybe give a shout to [DevsClout](https://bitclout.com/u/DevsClout) ? You can also join DevsClout [discord server](https://discord.gg/4tCW2C8WhQ) to chat with more devs who are building awesome projects on BitClout! 
We would love to hear back from you!