teleren/devto huggingface dataset:
Type Conversion in C#
Tags: csharp, tutorial, dotnet, beginners
Published: 2020-08-24 15:16:55

_C# is a language with many types such as ints, strings and too many others to fit in this sentence 😅 Sometimes while working in C# you'll find yourself needing to convert between these types so, this blog will tell you all you need to know about type conversion in C#._

---

There are three ways that types are converted in C#:

### 1. Implicit Type Conversion

Implicit type conversion occurs automatically by the compiler when you are converting between types where no data loss can occur. For example if you are converting an 'int' to a 'long', the C# compiler will do this automatically. This is because, the 'long' data type can hold values up to 9223372036854775807 which is much larger than the maximum value the 'int' data type can store (2147483647). Since there is no chance for data loss, the variables can be casted automatically as shown bellow:

```csharp
// implicit type conversion as ints are smaller than longs.
int a = 1;
long b = a;
```

### 2. Explicit Type Conversion

Explicit type conversion is used where data loss is possible. This type conversion is not automatically done by the compiler as it warns you that data loss may occur. Therefore you need to explicitly tell the compiler that you recognize that data loss may occur but you still want to go through with the conversion anyway. This process is also referred to as casting. An example of explicit type conversion is shown below:

```csharp
// explicit type conversion with no data loss.
long c = 1;
int d = (int)c;

// explicit type conversion with data loss.
// overflow occurs as value of e is too large to be stored in variable f.
long e = 1000000000000000000;
int f = (int)e;
```

### 3. Converting Between Non Compatible Types

Some types in C# cannot be implicitly or explicitly converted between one another. A popular example of this is converting a string to an int as shown bellow:

```csharp
string s = "123";
int i = (int)s;

/* the following compiler error is shown:

Cannot convert type 'string' to 'int' [PlaygroundUI]csharp(CS0030)

*/
```

In times like this where you need to convert from a string to another primitive type, you can instead use methods made available in the 'Convert' .NET Core library. You can also use methods available in the primitive type itself. Examples of using these methods are shown below:

```csharp
// conversion using the Parse() method in the primitive types:

int i = int.Parse("123");

bool b = bool.Parse("true");

// conversion using the methods in the 'Convert' class:

int convertedInt = Convert.ToInt32("123");

bool convertedBool = Convert.ToBoolean("true");

// ... more methods available for all other primitive types.
```

## To Conclude...

I hope this blog helped you understand how type conversion works in C#. Thanks for reading! 😄
Faven - A web tool to help you generate favicons
Tags: showdev, javascript, css
Published: 2020-08-24 15:01:13

{% github https://github.com/22mahmoud/faven %}

Hey Guys, 

I've created a tool to help you generate favicons in the 
browser without your data sent to a server. 

web app: [faven.netlify.app](http://faven.netlify.app)


I build this tool to discover new tech 
- [alpinejs](https://github.com/alpinejs/alpine) a minimal frontend library to help you manipulate the dom. I find it very helpful on small apps, and landing pages. 

- comping [alpinejs](https://github.com/alpinejs/alpine) with [tailwindcss](https://github.com/tailwindlabs/tailwindcss/) make my prototyping, and development faster. 

- use [snowpack](https://github.com/pikapkg/snowpack/) for fast development and use web modules on production without bundle since my project is small.
Robot Framework - Run tasks using GithubActions
Tags: actionshackathon, robotframework, rpa
Published: 2020-08-24 14:53:30

Submission for the [DEV: GitHub Actions For Open Source](https://dev.to/devteam/announcing-the-github-actions-hackathon-on-dev-3ljn) 🍕🍝🥕

### My Workflow

Continuous Integration (CI) workflow for running [Robot Framework](https://robotframework.org/) RPA (Robotic Process Automation) tasks. 

Task (this is not implemented using actions) searches recipe from [foodie.fi](https://www.foodie.fi/) site and returns the number of search results. GitHub Action workflows handle following:

* Basic CI (running tests for Pull Requests, commits to the main branch, and manually)
* Recipe Bot: When someone opens an issue to a GitHub project, recipe search is triggered, Bot closes the issue, and posts number of results as a comment. Bot is implemented using existing Action [Issue matching auto-closer](https://github.com/marketplace/actions/issue-matching-auto-closer).


### Submission Category: 

Maintainer Must-Have


### Link to Code

{% github laojala/rpa_challenge %}


### Additional Resources / Info

See also my other submission that implements similar CI for a Robot Framework project: [Robot Framework - Configure CI using GitHub Actions](https://dev.to/laojala/robot-framework-ci-demo-274o). Both of these projects are intended as an example for someone who is building CI that runs Robot Frameworks tests/tasks.
Visualizing the progress of a refactoring into a Hexagonal Architecture using jQAssistant
Tags: architecture, jqassistant, refactoring, visualization
Published: 2020-08-24 14:53:29

In my last project, we decided to refactor the inner structure of one of our services into a Hexagonal Architecture. It was clear that this was no task that could be done within a couple of days. During this long-running refactoring, we wanted to make our progress visible. Where are we now? What did we already have achieved? What do we still have to do? In [my blog post](https://www.innoq.com/en/blog/visualizing-progress-of-refactoring-into-hexagonal-architecture-using-jqassistant/), I describe the approach we took and how it helped us with our task.
Install this extension and see the change immediately without having to refresh
Tags: html, beginners, codenewbie
Published: 2020-08-24 14:48:10


<br>
Refreshing a page like every 2 seconds is just so annoying and tiring BUT there's this extension in visual studio code editor that can save both your time and energy.
Just go to extension section ( as shown in the pic below )and search for "<b>live preview</b>".
<img src="https://dev-to-uploads.s3.amazonaws.com/i/3o3pqa1p2b1kmuqc9t4i.jpg">

<br>
There are bunch of "live preview" extensions, you can download whichever you want but the one that I use is called "Live Server Preview".
It's pretty easy to use , just press <em>F1</em> in vs code and type <em>show live server preview</em> , a localhost server will be opened in vs code ( like in a pic below) And now every time you save the file you will see the change immediately (without needing to refresh)
<img src="https://dev-to-uploads.s3.amazonaws.com/i/faeoo6xtku93msomkcms.jpg">

<br>
<br>
<i>Hope this was helpful for you guys</i> ^^
What's the output?
Tags: javascript, quiz, webdev, beginners
Published: 2020-08-24 14:36:08

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

**Thanks for reading 💙**  
Follow **@codedrops.tech** for daily posts.  
[Instagram](https://www.instagram.com/codedrops.tech/) ● [Facebook](https://www.facebook.com/codedrops.tech/)

Micro Learning ● Web Development ● Javascript ● MERN stack  
**www.codedrops.tech**
Microservices Interview Questions & Answers 
Tags: microservices, beginners
Published: 2020-08-24 14:31:24

If you're looking for Microservices Interview Questions for Experienced or Freshers, you are at the right place. There are a lot of opportunities for many reputed companies in the world. According to research, Average Salary for Microservices Engineer is approximately $85,500 PA. So, You still have an opportunity to move ahead in your career in Microservices. Mindmajix offers Advanced Microservices Interview Questions 2020 that helps you in cracking your interview & acquire dream career as Microservices Engineer.

Microservices Interview Questions and Answers

Q1) What is Spring Cloud in the realm of Microservices?

It is that kind of a feature in the realm of Microservices which would provide integration with the outside systems. It is also known as a short-lived Microservices framework that has the ability to build applications in a quick fashion. Moreover, it plays an important function in Microservices as it is associated with finite amounts of processing of data.

Q2) Shed light on the architecture of Microservices

It is that kind of an architecture that facilitates the avoidance of huge application implementation for a large system. It is associated with the providence of loose coupling that takes place between various collaborating procedures. On the other side, it has the ability to run in an independent manner under various types of situations.

Q3) Describe the way in which you can set up service discovery


Although a large number of ways are there in setting up service discovery, you have to use Eureka created by Netflix. This is usually a very hassle-free process that is not heavy on the application. Also, it can suit a variety of applications which is quite good.

Q4) What do you mean by Eureka in the realm of Microservices?

Eureka is also known as the Netflix Service Discovery Server. This uses Spring Cloud and is most often known as the most used setup to start service discovery. It is also not that heavy on the application development process. This is the reason that it is quite popular among the developers of today.

Q5) Shed light on the ways by which you can access a RESTful Microservices

These are the following ways with the help of which you can use a RESTful Microservice.

With the use of the load-balanced rest template
With the use of multiple Microservices, you can easily use a RESTful template
If you have been given a large number of RESTful templates, then always make sure that you use the right one

If you want to read more click here: https://bit.ly/2QmYb0S
4 ways to inject secrets into an application
Tags: devops, kubernetes, security, secrets
Published: 2020-08-24 14:27:40

Most applications require secrets, for example to connect to a database, communicate with another application using tokens or certificates, define an admin password…

Dealing with this is often a headache. Even when you have a proper secret management tool, it's sometimes a nightmare to inject the secrets into the application where it needs to be used.

# The 4 ways

## First way: build time

This is probably the worst way to do it.

Examples:
- Build a WAR file, or a Docker image or any artifact with a configuration file that contains the secret in plain text.

Pros:
- Your deployment tool does not need permissions to decrypt the secrets.

Cons:
- Your whole artifact becomes a secret;
- You have to rebuild and redeploy when you want to renew a secret.

## Second way: deploy time

Examples:
- Give a Continuous Deployment pipeline access to a secrets store an let it inject the secrets in the application's configuration files;
- Give a Continuous Deployment tool, like ArgoCD, access to a secrets store an let it inject the secrets in the application's configuration files.

Pros:
- You don't have to rebuild when you want to renew a secret.

Cons:
- Your deployment tool needs permissions to retrieve and decrypt the secrets;
- You have to redeploy when you want to renew a secret.


## Third way: start time

Examples:
- Use Kubernetes [Secret Store CSI drivers](https://github.com/kubernetes-sigs/secrets-store-csi-driver) to inject secrets as volumes or secrets;
- Use HashiCorp [Vault](https://www.vaultproject.io/) as a secret store and [Vault Agent Injector](https://www.vaultproject.io/docs/platform/k8s/injector) as an *init* container to create configuration files before the application starts.

Pros:
- Your deployment tool does not need permissions to decrypt the secrets;
- You don't have to redeploy when you want to renew a secret.

Cons:
- You need to restart your application when you want to renew a secret.

## Forth way: run time

Examples:
- AWS instance profiles;
- HashiCorp Vault as secret store and Vault Agent Injector in *sidecar* mode.

Pros:
- You can renew your secret without even having to restart your application, allowing a dynamic secrets mechanism.

Cons:
- You probably need to adapt your application (or not if you already use an SDK that supports it).

# Conclusion

Do you know any more ways to inject secrets in your applications? Let me know in the comments!
Actions Hackathon Journey
Tags: actionshackathon, github, reward, githubactions
Published: 2020-08-24 14:20:48

So GitHub and Dev have partnered and released the new Github Actions Hackathon where you need to create a Github action that is useful to the open-source community. There are many topics like IoT or Deployments etc. but there is an option (Wacky Wildcards) where you're free to express your own ideas and build a solution. 

###Idea
So basically my idea is to reward the opensource contributors based on there commits and pull requests.

So the flow goes like this.
whenever an creator opens an open-source project they set rewarding points to the project as a secret and adds this GitHub action into his project. From there on whenever a contributor makes a pull request he is rewarded with those number of points which were set by the creator. 

For storing the points I firstly thought of rewarding some cryptocurrency token but it involves the contributor to own a crypto wallet and many other problems. So to tackle this problem I have created a small Node application that keeps track of user and his points and then based on those points he can be rewarded. 

This my first online hackathon and I'm excited to see how this works for me. 

Contributions are highly encouraged
{% github saitejach127/ActionsHackathon %}
How Movie Theaters Make Money- The Building an Indie Business
Tags: podcast
Published: 2020-08-24 14:04:46

[Listen Here](https://baib-podcast.com/movie-theaters.html)

In this episode, some fun facts about the podcasts after 18 months. The shortest episode, the most downloaded episode, my biggest fan are a few to be heard on the episode.

**Show Notes:**
[Revenue Research](https://revenueresearch.co/)
[Episode Page](https://baib-podcast.com)
[Buy the book I wrote](https://blog.openpodcast.xyz/podcast-book/)
Plain English for Beginners
Tags: writing, beginners, opensource
Published: 2020-08-24 14:03:20

***Plain English is clear and concise English.***

Technical writing is different from creative writing. The goal of technical documentation is to make complex technical information easy to understand. Hence, Plain English is an important aspect of technical writing. It makes your document more accessible, consistent, and readable.

## Why Plain English?

* English is not the first language for many people. **More people can understand** Plain English compared to sophisticated English.

* Plain English is **easier to translate**. Common English words and phrases are more likely to have equally common counterparts in other languages.

* Plain English is **easier to comprehend**. Readers can focus on understanding the technical concept instead of decoding the sentence.

## Basics of Plain English

### Full Stops *instead of* Commas

* Use short sentences whenever possible.
* Avoid combining more than 2 sentences with a comma.

### Active Voice *instead of* Passive Voice.

For example, prefer

> "X() reads a new file"

over

> "A new file is read by X()"

### Cut the Adjectives

Most adjectives do not convey relevant information. For example,

> "This well-written function reads a new file"

can be shortened to

> "This function reads a new file"

Get to the point quickly and stick to the point.

### Inclusive Language and Biases

* Avoid using pronouns altogether. If you need to, then:
  * use "they" instead of "he" or "she", and
  * "folks" or "people" or "everyone" instead of "girls" or "guys". See [heyguys.cc](https://heyguys.cc).
* Avoid racist terms like "blacklist", "master", "slave", etc.
* Avoid phrases like "it's as simple as...", "this is an easy step...", etc. What is *easy* for one person, may not be *easy* for someone else[1]. Let's not discourage learners by using these terms.
* Actively check for biases in your writing. For example, sample names may have gender or racial biases depending on the context. As humans, we may never be completely unbiased. It is still important to educate ourselves and keep trying.

### Avoid Jargon, use Common Words

Technical documentation has a lot of technical jargon. Let's not add more. One way to reduce jargon is to get feedback from a diverse range of readers.

Note that *slangs* are also jargon.

## Extra Tips

### Planning

It is good practice to plan a document before you start writing. Think about the following:
* Intended audience
* Scope of the document
* Broader context

### Structure

Start with a rough structure. Try to split each concept into a distinct section. Clear structure and headings improve readability.


### Style Guides

Style guides are standards to help maintain consistency in documentation. Consider adopting a style guide for your technical writing projects, even personal blogs.

---

*[1] I have used "easy" in this blog post. But, note that I'm using it in a comparative context. I say: Understanding Plain English is "easier than" understanding sophisticated English.*
Best calendar solution for Jekyll?
Tags: discuss, webdev, help
Published: 2020-08-24 13:44:16

Can anyone advise a calendar solution to display events? 

__Use case__
To conveniently show our developer meetups and let folks easily add their chosen meetups to their personal calendars.

I can just embed a Google calendar widget, but some fellow devs use Apple calendar or outlook, etc.

I like eventable.com - it is exactly what I want, but their backend is very slow and times-out making it mostly unusable =(

I use Jekyll for the website.

Thanks!
Question about mind shift in developer teams
Tags: productivity, challenge, motivation, help
Published: 2020-08-24 13:43:04

About a year ago I joined a new company and quickly started to realize, that there is room for improvement in the community -especially regarding knowledge exchange between the developers.

So I tried to initialize a Hackathon, which was quite okay but after that, there were no further interest in this topic.

I eventually founded  "Guilds" with some other colleagues, where we either try to figure out actual problems we could solve to be more productive, or we just exchange experience and make presentations about interesting topics we'd like to share.

We have guilds like "Architecture", "Coding Standards", "Testing", "Backend Devs", "Frontend Devs", "DevOps".

While the start was really good and productive (finding topics we want to discuss and find pain points each developer has at the moment). It now shifted in a way, that there are alway the same 5 colleagues who are motivated to talk in this guilds and to work something out for the next sessions.

All the other attendees are more like the typical members in a group work. (They just listen and think it's very important what we are doing **but never want to contribute to anything)**

*Note: We are currently 12 developer teams with approx. 40 developers in total.* 

So my question to you is, did you ever have a similar problems at a company?

Did you find a solution to improve the mindset of your colleagues?

Thanks in advance :) 

Marcel
Database realated help 😓
Tags: database, postgres, help
Published: 2020-08-24 13:28:17

I am making a multi-restaurant appliances and everything is done but I think it'll not might not scale.

## Problem

I have GEO Location (Latitude and Longitude) of user and Restuarant. I am listing all restaurants within 3 Kilometres. I have tested on small scale and it worked but I am worried, what would happen when there will be 100,000 Restuarant. 

If User ask for nearby Restaurants then I will filter from 100,000 Restuarant. To filter I'll calculate distance between user GEO Location to all 100,000 restuarant. 

I don't know if I'm thinking right or wrong? What would be the possibile solution?
Blocking twitter trolls (2): Blocking fancams
Tags: twitter, tweepy, python
Published: 2020-08-24 13:15:14

Earlier this year, a kpop translation account started running a script that blocks all trolls who post fancam under their tweets. We can now restrict who can leave a reply under our tweet but the feature is limited.

If you're running a big account that provides content, you don't want to block all conversations under your tweet because after all, not all people are trolls. If you only want to reduce the number of trolls, in this case people who post fancam (related or not), this script is the answer. Another case of use of this script is if you want to read the conversations under a tweet WITHOUT having to go through all those fancam posts.

This is what this script does: blocking all people who post fancam (video) under a certain tweet. You'll need a Twitter developer account (apply [here](https://developer.twitter.com/en/apply/user.html)) with 'Read and Write permission'.

Paste the link to the tweet then run the script. Full script can be found on [my github](https://gist.github.com/azukacchi/99ab7cda0871c6719f5e33bd351ecfb1).


{% gist https://gist.github.com/azukacchi/99ab7cda0871c6719f5e33bd351ecfb1 %}
UI Dev Newsletter #19
Tags: css, html, javascript
Published: 2020-08-24 13:05:21

- [5 most annoying website features I face as a blind person every single day](https://bit.ly/31p3x1H)
Holly Tuke describes the five most annoying inaccessible web elements she faces as a blind screen reader user every day and how to fix them.

- [A CSS-only, animated, wrapping underline](https://bit.ly/3gmhX73)
Nicky Meuleman explains in detail how to create eye-catching, animated link underlines using only CSS.

- [Create a line break while maintaining inline status](https://bit.ly/3aRMQz3)
Andy Bell shows how to create a line break after an inline element while retaining that inline element’s inline status using pseudo-element magic.

- ["Offering Options for mailto: and tel: Links"](https://bit.ly/2QjQQyZ)
Chris Coyier introduces the mailgo JavaScript library which displays popup when you click on mailto or tel links with some useful options.

- [Highlighting great user experiences on the mobile web](https://bit.ly/32iCvIB)
New Chrome will display the “Fast Page” label on mobile for pages that have optimized against web performance metrics that are most representative of a user’s overall experience.

- [5 lessons from 50 days of CSS art](https://bit.ly/3hnZZSY)
Suzanne Aitchison shares findings of CSS during her project of creating CSS art pieces.

- [Why "Skip Nav" Link is important!](https://bit.ly/32dYksI)
Raja Jaganathan shows how to use and create a “Skip Nav” link.

- [Capture node screenshots via Elements panel context menu](https://bit.ly/2QhGWOt)
Google Chrome allows you to take a screenshot of an element by right-clicking the element and select “Capture node screenshot”.

Happy coding!

[Subscribe to the newsletter here!](https://mentor.silvestar.codes/reads#newsletter)