teleren/devto huggingface dataset:
Typescript : Variables
Tags: typescript, javascript, codenewbie, angular
Published: 2020-09-14 19:47:53

This post is the second part of the series Learn Typescript and we will be about all the nitty gritty of variables in TypeScript. 
### What are Variables?
A variable is a temporary data container that stores a value in memory while the application is running.
### Declaring a Variable
I am going to start by covering the archaic var that is supported in TypeScript and describes the cost of using this old school way of  declaring variables. I will also talk about how you can maximize the declaration with let and const as alternatives.
#### Declaring a Variable with ``var``
Starting with var. This has been the way to define variables since the inception of JavaScript. However, the release of ES6 brought the declarations let and const, which fixed many of the drawbacks caused by var in previous versions of ECMAScript. 

One issue with var is that the location of a variable makes it unpredictable. A variable declared using var is function-scoped when declared inside a function, but global-scoped when declared outside of a function. Also, var does not stop you from redefining the same variable, which overrides the initial declaration or initialization.
```
function varFunction(){     
    var x = "111";    
    if(true){             
        var x = "999"; // Variable x redefined   
    }     
    console.log(x); 
}
varFunction();
```
> Note that not declaring the variable x would result in TypeScript signaling that it ``Cannot find name x``.

#### Declaring with ``let``
The keyword let comes to the rescue by setting the lifespan of the variable at the block where it was declared that the variable is accessible only in the scope in which it was declared.

For example, if you declare a variable with let within an if statement, the variable will not be accessible as soon as the execution leaves the if block. This rule is true for a function, a loop, and a class. In the case of loops, if you are defining a for loop and you define the iterative i, this one should use let which allows modifying its values while being only available for the loop.
#### Declaring with ``const``
The keyword const (short for constant) is similar to let in terms of the scope of its lifespan. However, it can only be initialized once: in its declaration. The restriction is powerful because it not only syntactically indicates that the purpose is not to change its value, but TypeScript will also ensure that no value can be set. It’s important to understand that if you have a constant object, the value of that object cannot change.

```
const x: string = "111";
x = "this won't compile";
```
> Note: The above code is expected to throw an error as explained
VS Code Extensions
Tags: vscode, discuss, productivity, webdev
Published: 2020-09-14 19:45:25

Hi Everyone, i am sharing some useful extensions you can use for vs code to increase your productivity.

Code Runner - Run Code Snippet or Code File for Multiple Languages, Such as C, C++, Java, JavaScript, Python, Ruby, .NET, R, PowerShell, TypeScript, Scala, Go and all most every other language you can imagine, also you can add custom commands. 

Code Spell Checker - As the name suggests it is a basic spell checker which helps catch comman spelling errors, works well with typescript.

Prettier - This one is kinda cool 😎, enforces a consistent style, wrapping code whenever necessary.

GitLens - Visualize code authorship at a glance, seamlessly navigate and explore Git repositories.

TODO Highlight - Highlight TODO, FIXME and other annotations within your code.

What Extensions do you use? Please share them in the comments.
Vue FullCalendar Bottleneck
Tags: laravel, vue, fullcalendar
Published: 2020-09-14 19:33:13

Wow! Ok, I learned something new today. One of my users was having issues logging into my site on their mobile device and they would always get a blank white screen and nothing would happen. I walked them through a handful of steps and I couldn't get it to work for them. When I accessed their account through my phone it worked just fine, but what we figured out is that there was a bottleneck of data and it was preventing the page from loading, except when I was on my phone because I was on my wifi. Oh, the joys. Anyway, here is how we fixed it.

#The Problem
- This user has a lot of data that loads on their dashboard upon initial login. For instance, they have a calendar, and the calendar loads all their events (800 to be exact). That was one of the problems, instead of loading just the current month events, I was loading all events.

On our `<full-calendar />` component we were adding events via a prop like below.
```
:events="events.records"
```
This `events.records` was querying the database for all events and I found a better way!

#The Solution
When adding events to your `<full-calendar />` component, you have multiple ways to do it. I was doing it via an array in an events object, instead what you want to do is add the events via a JSON feed and I'll explain why but check out the snippet of code below, this is how it's done.
```
eventSources: [
        {
          url: '/test_events',
          method: 'GET',
          failure: function() {
            alert('there was an error while fetching events!');
          },
          color: 'yellow',   // a non-ajax option
          textColor: 'black' // a non-ajax option
        },
]
```
And we can use that in our component like such 
`<full-component :event-sources="eventSources" />`. When you use a JSON feed like this it automatically adds a start and end query parameter to the URL which allows you to query the data based on those two parameters this way your only getting what you need. Here's what the URL would look like.
`https://localhost/calendar_events?start=2020-08-30T00%3A00%3A00-04%3A00&end=2020-10-11T00%3A00%3A00-04%3A00`

Now, instead of running this query:
```
$events = $request->user()->events()->get();
return response()->json($events);
```
Which would return all results, we can run this query:
```
$start = $request->start;
$end = $request->end;
$events = $request->user()->events()->whereBetween('start', [$start, $end])->get();

return response()->json($events);
```
Which only returns results based on the given parameters.

#Conclusion
When using Laravel make sure to use the Laravel debug bar package in order to help you catch stuff like this. Hopefully, this article helps someone out in the future from making this same mistake and if you know of a way to improve this even more please let me know in the comment below.
Fourth Month Update
Tags: javascript, webdev, codenewbie, beginners
Published: 2020-09-14 19:22:22

---
title: Fourth Month Update
published: true
description: 
tags: javascript, webdev, codenewbie, beginners
---

My fourth month with web development has a interesting start to it. I am very much enjoying the advance web developer course. The concepts are more interesting than in the basic web developer course. Finally starting to learn about more complex technologies such as AJAX XHR, Fetch, jQuery and Axios. I have a lot more hands on projects in front of me that I can not wait to play with.
Angular Form Control Aggregation
Tags: angular, validation, typescript
Published: 2020-09-14 19:21:58

**New Discovery**
Use ngModel instead!
{% link https://dev.to/jwp/angular-validation-using-ngmodel-55gf %}


Previous Articles have shown the value of using Form Controls in an Angular form. Validation being the most important, and secondly migrating to the Immutable model of the Angular Architecture. 

**What about Aggregation of Form Controls?**
As the tutorials all show the Form Control is introduced as a field level validation scheme. Assume a person object definition:

```typescript
 class Person{
  lastName:string;
  middleName:string;
  firstName:string;
}
```
We would create Form Controls like this:
```typescript
controls = {
  lastName: new FormControl(this.person.lastName, ...),
  middleName: new FormControl(this.person.middleName, ...),
  firstName : new FormControl(this.person.firstName,...)
}
```
This works great but forces us to set each field value separately! The validation routines running on each change.  We still want that to happen, but wouldn't it be nicer to just assign a new person object with all of the fields, responding? Let's take a look:

```typescript
let fcPerson = new FormControl(this.person);
controls={
  lastName : new FormControl(fcPerson.value.lastName, ...),
  middleName : new FormControl(fcPerson.value.middleName, ...),
  firstName : new FormControl(fcPerson.value.firstName, ...)
}
```
By doing this, we now have the ability to set the person object like this; which ripples all the changes.

```Typescript
fcPerson.setValue(this.person);
```
Aggregation of all the person fields into one object this.person!  Also note that the GUI side doesn't need any reference to the new fcPerson form control! It lives in secret.

**Warning**
Watch out for improper parent control binding! Take this example:
```typescript
new FormControl(fcPerson.value.lastName <- No Intellisense here
```
If we don't exactly spell the fieldName properly (and intellisense doesn't work for this) the results will be a null value.


JWP2020
Zolaxis Patcher Injector APK v1.0 Download free for Android
Tags: abbasitv
Published: 2020-09-14 18:59:04

Hi the crowd of the APK profit, https://apkprofit.com/ I trust you individuals are doing incredible today I am back with another valuable application for our games sweetheart who consistently attempts to mess around on android cell phone' so at any rate the name of the instrument is Zolaxis Patcher Injector on the off chance that you are playing the versatile legend boycott, at that point this application is helpful for you, you have seen that the majority of the portable legend player change bearing the with the skins, these highlights required premium, 

Zolaxis Patcher Injector is the device that will let you get all the liberated from cost without spending any sort of single penny. on the off chance that you are the new player and face challenges in playing the game then this application is extremely valuable for you we have seen that it isn't moved toward the purchase the top notch skins for another player, yet the Zolaxis Patcher Injector gives you these highlights liberated from cost, 

you can us the Zolaxis Patcher Injector for getting the superior skins and character.it doesn't have any kind of connection with the game. 

highlights of the Zolaxis Patcher Injector: 

uphold skins 

kaja>starlight>epic>elite. 

Estes>backup>epic>special>epic. 

Anela>backup>specail>epic>spcial>starlight. 

Tank skins 

khufra>backup>elite>special>epic>luffy. 

uranus>backup>special>Epic>special>magma. 

Grock>backup>Elite>epic>starlight>epic. 

johnuon>backup>Epic>elite>hoyywheel. 

franco>special>starlight>special>epic. 

Assasin skins 

Gusion. 

fanny. 

Selena. 

lancelet 

hayabusa. 

helcur. 

natalia. 

ling. 

MN skins 

Granger. 

lesiey. 

claude. 

Moskov. 

Hanabi. 

Miya. 

Bruno. 

Irithel. 

Contender skins 

Jawhead. 

roger. 

Alucard. 

x.borg. 

Badang. 

Mage skins 

valir. 

kagura. 

odette. 

Aurora 

Harith. 

lunox. 

nana. 

Harley. 

Instructions to introduce and utilize: 

To begin with, of all, you need to download the APK document of the Zolaxis Patcher Injector on your android cell phone. 

Go to setting empower the obscure wellspring of your android cell phone. 

Program your record discover the APK document that you introduce. 

at the point when you click on the introduce button it will take a couple of mints to introduce, when the establishment cycle is finished. 

lunch and begin utilizing it obviously. 

End: 

at last! Zolaxis Patcher Injector is an extraordinary application so as to get the excellent skins and character free of cost.if you are the aficionado of playing the versatile legend prohibition on your android this application is extremely useful for you.at last remember to impart to your companion for more most recent application and games
https://apkprofit.com/zolaxis-patcher-injector-apk-v1-0-download-free-for-android/
What do you do to give yourself a break from coding?
Tags: discuss, productivity, rest, hobbies
Published: 2020-09-14 18:56:36

---
title: What do you do to give yourself a break from coding?
published: true
description: 
tags: discuss, productivity, rest, hobbies
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/yo9unwotn07ll83vcj37.jpg
---

As a developer, it is easy to enter a loop where you spend the whole week coding all the time and not taking the necessary time to rest.

Since last year, I started working on several projects aside from my main job and it also required me to keep learning a lot of stuff. Right after it, the pandemic started and, as I was completely isolated, I included more and more code-related tasks on my routine. This experience has got to a point where my anxiety crises were hitting hard and making me unable to work, learn and enjoy my life properly.

So I decided to include different activities on my routine and force myself to take care of my work/life balance. That is when I started playing some online games more often and I created a [Twitch channel](https://www.twitch.tv/progamerdor) to share it with everybody.


What about you? Do you also struggle with it?
Share your experiences and workarounds with me!
My first post on Dev community
Tags: codenewbie, javascript, webdev, firstyearincode
Published: 2020-09-14 18:56:07

###Hello Dev community.
I am **Raphael Ejeogo**,
An undergraduate student of The University of Port Harcourt,
I am from Nigeria and currently living in Lagos. 

An aspiring web developer i just officially started my journey in the programming world, i hope to earn a lot from this community and also be guided by people that was once in the position i am right now. 
i am open for any and all assistance i can get from this community that will help me get to that stage where i can call myself a programmer.
Thank you all for having me here it's a great honour to be part of this community although i wouldn't call myself a full member yet as i am still just starting my journey.
Solution to algorithms exercise
Tags: computerscience, algorithms, leetcode, puzzler
Published: 2020-09-14 18:52:03

So here are solutions. To make it easier to read, I'll repeat tasks here. All tasks start with the same statement:

You have an array with integers sequence from 1 to 1000:

```
[1, 2, 3, 4, 5, ..., 1000]
```

# 1. Easy

An item with value `x` was removed, so the array became like:

```
[1, 2, 4, 5, ..., 1000]
```

Then the array was shuffled. How to find `x` in `O(n)` time and `O(1)` memory?

## Solution
Just sum up all items and subtract the result from 500500 (a sum of integers from 1 to 1000 inclusively).

# 2. Harder
An item with value `x` was replaced with `x - 1` so the array became like:

```
[1, 2, 2, 4, 5, ..., 1000]
```

Then the array was shuffled. Again, you need to find `x` in `O(n)` time and `O(1)` memory.

## Solution
Just summing up all elements won't give anything — it'll always be 500499. Is there a way to “amplify” values, so 3–1 will impact the result differently than 495–1? Yes, there is one, and it's just squaring items.

Indeed, {% katex inline%}x{% endkatex %} was replaced with {% katex inline%}x - 1{% endkatex %}, which means the result — sum of squares — gets less than expected value by

{% katex %}
d = x^2 - (x - 1)^2 = \newline
= x^2 - x^2 + 2x - 1 = \newline
= 2x - 1
{% endkatex %}


To find {% katex inline%}d{% endkatex %}, subtract actual squares sum from expected value — sum of squares of 1 to 1000 which is 333,833,500. Then,

{% katex %}
x = {d + 1 \over 2}
{% endkatex %}

Yes, it's that simple!

# 3. Hard
An item with value `x` was replaced with `y` where `y` is any integer from `1` to `1000`, so the array became like

```
[1, 2, 9, 4, 5, ..., 1000]
```

The array was shuffled, and your task again is to find `x` and `y` in `O(n)` time and `O(1)` memory.

## Solution
Summing up values or squares won't give anything but what if we do both? We can substitute {% katex inline%}y{% endkatex %} with {% katex inline%}x - k{% endkatex %} where {% katex inline%}k{% endkatex %} is any integer, possibly negative. To find {% katex inline%}k{% endkatex %} we sum all items and subtract the result from 500500 which immediately gives {% katex inline%}k{% endkatex %}. Then we may use a formula similar to one from 2nd problem:

{% katex%}
d = x^2 - (x - k)^2 = \newline
= x^2 - x^2 + 2kx - k^2 = \newline
= 2kx - k^2 = \newline
= k(2x - k),
{% endkatex %}


where {% katex inline%}d{% endkatex %} is the difference of expected and actual squares sum.

And finally,

{% katex%}
x = {1 \over 2} \left( {d \over k} + k \right)
\newline
y = x - k
{% endkatex%}

# Hope you enjoyed solving these problems!
Whiskey Wednesday - Episode #8 - Content Creation
Tags: podcast
Published: 2020-09-14 18:38:40

---
title: Whiskey Wednesday - Episode #8 - Content Creation
published: true
description: 
tags: podcast
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/298wnozwth32rhhrfxh1.jpg
---

## Whiskey Wednesday - 2020 September 9th

#### Episode #8 - Content Creation

Whether it’s blog posts, video courses, live streams, or books - content creation is BIG, also for developers.

📺 [Watch it on Youtube](https://www.youtube.com/watch?v=N6eShctTwxo)

{% spotify spotify:episode:48fjNuaZVB50ygM5R5jaeu %}
Various security Apps : catalog in jpeg
Tags: devops, beginners, marketing
Published: 2020-09-14 18:23:11

I found this below image on Twitter. I / my company no way associated with any of these apps.

You can use alternative.to to find open-source or related FOSS.

Please download / zoom image.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/8l7w18l99kvh5gnm9mdg.jpeg)

https://twitter.com/JMonteagudoE/status/1305393331967582209?s=20
How to run any Jenkins Job from the Command Line
Tags: programming, devops, jenkins, bash
Published: 2020-09-14 18:13:35


For the last 2 years, My small team has been working with a lot of Jenkins environments and has to run a bunch of Jenkins jobs. Eventually, it got us so tired of using the browser every time and we decided to make life easier and to develop a tool that will help us get rid of these browser things

Either this is familiar to you or if you just would like to simplify your work, then let me take you through a guide on how to get started

## Jenkins-job-cli
This is an open-source CLI tool written in GO to run any Jenkins Job/Build from the Command-line/Terminal: [https://github.com/gocruncher/jenkins-job-cli](https://github.com/gocruncher/jenkins-job-cli). 


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

### Installation

Fetch the [latest release](https://github.com/gocruncher/jenkins-job-cli/releases) for your platform:

#### Linux

```bash
sudo wget https://github.com/gocruncher/jenkins-job-cli/releases/download/v1.1.0/jenkins-job-cli-1.1.0-linux-amd64 -O /usr/local/bin/jj
sudo chmod +x /usr/local/bin/jj
```

#### OS X brew

```bash
brew tap gocruncher/tap
brew install jj
```
#### OS X bash
```bash
sudo curl -Lo /usr/local/bin/jj https://github.com/gocruncher/jenkins-job-cli/releases/download/v1.1.0/jenkins-job-cli-1.1.0-darwin-amd64
sudo chmod +x /usr/local/bin/jj
```

### Configure Access to Multiple Jenkins

```bash
jj set dev_jenkins --url "https://myjenkins.com" --login admin --token 11aa0926784999dab5  
```
where the token is available in your personal configuration page of the Jenkins. Go to the Jenkins Web Interface and click your name on the top right corner on every page, then click "Configure" to see your API token. 

In case, when Jenkins is available without authorization:
```bash
jj set dev_jenkins --url "https://myjenkins.com"  
```

or just run the following command in dialog execution mode:
```bash
jj set dev_jenkins
```


### Shell autocompletion

As a recommendation, you can enable shell autocompletion for convenient work. To do this, run following:
```bash
# for zsh completion:
echo 'source <(jj completion zsh)' >>~/.zshrc

# for bash completion:
echo 'source <(jj completion bash)' >>~/.bashrc
```
if this does not work for some reason, try following command that might help you to figure out what is wrong: 
```bash
jj completion check
```

### Examples
```bash
# Configure Access to the Jenkins
jj set dev-jenkins

# Start 'app-build' job in the current Jenkins
jj run app-build

# Start 'web-build' job in Jenkins named prod
jj run -n prod web-build

# makes a specific Jenkins name by default
jj use PROD  
```

So, I hope you find this tool helpful. I would be pretty happy, if you haven't already, please [check it out](https://github.com/gocruncher/jenkins-job-cli) and let me know what you think or what problems did you face.
Follow Along - Building a DApp on Ethereum
Tags: solidity, blockchain, ethereum
Published: 2020-09-14 18:05:46

---
title: Follow Along - Building a DApp on Ethereum 
published: true
description: Follow along as I build a Decentralized Application (DApp) on Ethereum using Solidity.
tags: solidity, blockchain, ethereum
//cover_image: https://direct_url_to_image.jpg
---

I've been working on a side project to get more familiar with Ethereum and programming with Solidity. 

I'm capturing my thoughts and learnings in my git commits, and I thought others starting with blockchain may benefit from following along.

https://github.com/patrickodacre/cryptoquest/commits/master
The .NET Docs Show: Managing the dot.net website
Tags: dotnet, aspnet, webdev, dotnetdocsshow
Published: 2020-09-14 17:54:08

---
title: The .NET Docs Show: Managing the dot.net website
published: true
description:  The .NET Docs Show is joined by Maíra Wenzel for a deep dive into the dot.net website.
tags: dotnet, aspnet, webdev, dotnetdocsshow
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/utdvfhpjm84h9ekjwv7u.png
---

In this episode of [The .NET Docs Show](https://dotnetdocs.dev), Maíra Wenzel (<a href="https://twitter.com/mairacw" target="_blank">@mairacw</a>) joins the hosts in a #LiveShare to migrate the dot.net website to `enable` nullable context, and to fix actual bugs. As part of this week's #CheckUp, we shared a tutorial on the subject - [migrate existing code with nullable reference types](https://aka.ms/nullable-references).

The #HallwayTrack with Maíra was awesome! We compared performance of .NET Core 3.1 to .NET 5 with the dot.net website, that sees over 13 million page views per month. Maíra demonstrated improvements for monitoring and auditing accessibility, as well as what tech stack is used:

- Migrated from ASP.NET Core MVC to ASP.NET Core Razor Pages
- Adding in ASP.NET Core Blazor
- Sprinkled with React
- Azure App Services
- Azure App Insights

{% youtube nFROvRwDCmk %}

If you liked this video and would like to see some more of our .NET content, please subscribe to our [The .NET Docs Show YouTube Channel](https://www.youtube.com/channel/UCvtT19MZW8dq5Wwfu6B0oxw) and [follow us on Twitter](https://twitter.com/dotnetdocsshow).

# #CheckUp

- [Tutorial: Migrate existing code with nullable reference types](https://aka.ms/nullable-references)

# Useful links

- [Maíra's URL list](https://www.theurlist.com/the-dot-net-docs-show-maira-wenzel-dotnet)
- [The .NET Docs Show](https://dotnetdocs.dev)
Theory of joining several images in 1 for performance over the network
Tags: javascript, html, webdev, webassembly
Published: 2020-09-14 17:44:25


I've been thinking about a site that makes several requests on the network to search for images. do you think that if you fused these multiple images into just 1 it would be faster? The goal is to go through the network just once to get all the images.