teleren/devto huggingface dataset:
Why is SSE commonly used in linear regression?
Published: 2023-02-26 00:37:42

SSE (sum of squared errors) is commonly used in linear regression because it has some desirable mathematical properties and is relatively easy to optimize using techniques like gradient descent.

One reason SSE is used is because it is a squared error metric. Squaring the errors has a few benefits. First, it makes the errors positive, which means that errors in both directions (i.e., overpredictions and underpredictions) are treated equally. Second, it penalizes large errors more heavily than small errors. This is desirable because we typically care more about reducing large errors than small errors.

Another reason SSE is used is because it leads to a convex optimisation problem. In other words, the cost function has a single global minimum that can be found using gradient descent or other optimization techniques. This is important because it guarantees that the optimisation algorithm will converge to the optimal solution.

Finally, SSE is easy to work with mathematically. The cost function is differentiable, which means that we can calculate its gradient (i.e., the partial derivatives of the cost function with respect to the weights and bias) analytically. This makes it possible to use optimization techniques like gradient descent to find the optimal values of the model parameters.

In addition to SSE, other types of errors used in machine learning include:

Mean Absolute Error (MAE): This measures the absolute differences between the predicted values and the actual values. MAE is less sensitive to outliers compared to SSE.

Root Mean Squared Error (RMSE): This measures the square root of the average of the squared differences between the predicted values and the actual values. RMSE is used when the errors follow a normal distribution.

Mean Absolute Percentage Error (MAPE): This measures the absolute percentage difference between the predicted values and the actual values. MAPE is commonly used in forecasting and time series analysis.

R-squared (R2): This measures the proportion of the variance in the dependent variable that is explained by the independent variables. R2 ranges from 0 to 1, where 1 indicates a perfect fit.

The choice of error metric depends on the type of problem and the nature of the data. Some errors are more appropriate for certain types of data, while others may be more robust to outliers or more intuitive to interpret. It is important to choose the appropriate error metric that aligns with the problem and evaluate the model's performance using that metric.
Learning JavaScript with Scrimba - A Beginners Journey
Tags: javascript, beginners, scrimba
Published: 2023-02-26 00:28:17

I began my self-taught JavaScript journey 1-2 months ago... If online learning is even called "self-taught" these days. 
I started my journey at CBT Nuggets and spent 3-4 weeks there. There is a beginner JavaScript course that builds an absolutely amazing foundation, covering 100's & 1000's of different functions and methods amongst other things. I did start to find this course a little too theory heavy. No one could retain all of the information they drill into you; and sometimes sitting through 15-minute video after 15-minute video of different functions and methods can start to feel like a grind.

Then one day I was in bed trying to fall asleep and decided to get in some JS learning via YouTube. I found my chosen video very engaging and followed the link below to the Scrimba website.

I immediately started to enjoy the free "Learn JavaScript" module. At this stage I had stumbled around on GitHub as I wanted to continue my JS projects at work, during my lunchbreaks.
Within a day on Scrimba I was now connecting all of my accounts, eg. Scrimba, Netlify, Figma, GitHub, Twitter & no longer felt like a fumbling noob, but like I had been taught to use these tools like a professional, by a professional.
And that is the story of the course. Every step of the module was very engaging, and I really feel like I have retained all of the knowledge. The learning format is better than anything I have experienced including face-to-face learning.(except maybe that 1 year 10 maths teacher)

At the end of the course, I was faced with the final solo project. My biggest challenge yet. The CSS was a struggle at times, however Scrimba had given me the confidence to 'google it out'- I went from feeling stuck in the mud to making the elements look identical to the Scrimba version... With the CSS & HTML out of the way, I had saved the JS for last. I absolutely breezed through the JS. 

After letting my girlfriend test out my new web app (as I excitedly asked her to do with all 8-9 'big' Scrimba projects) - I joked about her work PC being filled with my homemade Chrome Extensions. We had a laugh and then actually started talking about what would be practical; and now I have my first big, completely solo project in mind. And I absolutely believe I can do it professionally and somewhat easily.

10/10 great course. Halfway through I knew I would purchase a paid subscription; and I will commence my next module once I finish this post.

_**@Per Harald Borgen "Take Your Arguments Outside".**_ That will stick with me forever, absolutely brilliant teaching.
Functions, methods, arguments, parameters, template strings, event listeners, buttons, inputs, for loops, if statements - they just flow out of my hands now. I can't wait to consume more content and become employable. I can feel it getting closer by the day.
Free Software For Storing Various Code Snippets For All Teams
Tags: codenewbie, code, snippets, storage
Published: 2023-02-25 23:56:42

Hi Developers,

I would like to share my efforts of developing a free and easy, open source software, for storing various code snippets, documents, tasks, knowledge base etc. for all teams.

I have uploaded this software now, to my sourceforge project repository here: https://sourceforge.net/projects/easy-team-document-software/

Please share this news with all your friends and colleagues, so that they can get benefited as well. 

Thanks.

Best Regards,

Nathan S.R.
Variable Declaration in JavaScript
Tags: beginners, javascript, programming, tutorial
Published: 2023-02-25 23:34:10

In JavaScript, variables are declared using the keywords `const`, `let`, and `var`. Each of these keywords has different ways of handling variable scope, meaning each is used in different situations.

## const 💪
It is used to declare variables that will not change throughout the software life cycle. Once a value is assigned to a constant variable, it cannot be reassigned.

```js
const PI = 3.14;
PI = 3; // TypeError: Assignment to constant variable.
```

**Advantages**:
* Variables declared with `const` are safe and cannot be accidentally reassigned.
* Variables declared with `const` are easier to track, since they will always have the same value.

**Disadvantages**:
* Variables declared with `const` cannot be changed later, which can be a problem if you need to update the value of a variable.


## let 🤗
It is used to declare variables that may change during the software life cycle. Unlike `const`, you can reassign values to variables declared with `let`.

```js
let count = 0;
count = 1;
```

**Advantages**:
* Variables declared with `let` can be reassigned throughout the program, which means that you can update their values at any time.
* Variables declared with `let` are easier to read, since they show that the variable may change over time.

**Disadvantages**:
* If not handled properly, excessive use of variables declared with `let` can make the code difficult to read.

## var 👴
This is the oldest form of declaring variables in JavaScript. Unlike `const` and `let`, variables declared with `var` have a function scope.

```js
function exampleFunction() {
  var message = 'Hello world';
  console.log(message);
}

console.log(message);
```

**Advantages**:
* Variables declared with `var` have a function scope, which means that they can be accessed from anywhere within the function in which they are declared.

**Disadvantages**:
* Variables declared with `var` can be declared in the same function, which can lead to errors and code maintenance problems.
* If a variable is declared with `var` outside a function, it will become a global variable, which can be dangerous in large programs.

## Conclusion
In summary, each keyword has a specific use in JavaScript. `const` is used to declare variables that won't change throughout a program's lifecycle, `let` is used to declare variables that can change over time, and `var` is primarily used in older versions of JavaScript. Overall, it's recommended to use `const` and `let` instead of `var` to ensure safer and more readable code.
Man needs Art
Tags: design
Published: 2023-02-25 23:22:28

Since the earliest times, human beings have felt a deep need to express themselves through art and drawing. From the earliest cave paintings to modern digital designs, art has played a vital role in our lives.

One reason for this is that art allows us to communicate complex ideas and emotions in a way that words cannot. A picture can convey a feeling or tell a story in a way that words simply cannot match. This is why art has been used throughout history to express ideas, beliefs, and cultural values.


![Man needs Art](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bmocypuepkr05s9gtzr6.jpg)

Art also allows us to connect with our inner selves and explore our emotions. Whether we are creating art ourselves or enjoying the work of others, art has the power to evoke strong emotions and inspire us to reflect on our own experiences.

Finally, art is a form of human expression that can be enjoyed by everyone. It transcends language, culture, and social boundaries, allowing people from all walks of life to connect and share in the beauty of creative expression.

In short, the need to express ourselves through art and drawing is a fundamental part of what makes us human. It allows us to communicate complex ideas and emotions, connect with our inner selves, and share in the beauty of creative expression.
Day 1: Leetcode | 121. Best Time To Buy And Sell Stock Solution
Tags: javascript, algorithms, datastructure, programming
Published: 2023-02-25 22:39:54

> Difficulty: Easy Language: JavaScript

**Problem Description**
You have given an array of prices where prices[i] is the price of a given stock on the ith day.

You want to maximize your profit by choosing a single day to buy one stock and choosing a different day in the future to sell that stock.

Return the maximum profit you can achieve from this transaction. If you cannot achieve any profit, return 0.



![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6cvnhp9qluuh04jlaxih.png)

**_Explanation 1:_** Buy on day 2 (price = 1) and sell on day 5 (price = 6), profit = 6–1 = 5.

Note that buying on day 2 and selling on day 1 is not allowed because you must buy before you sell.

**_Explanation 2:_** In this case, no transactions are done and the max profit =0.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/poc0dqxnzvb2e93zd7op.png)

**Brute Force Solution — O(n²)**
To solve this problem, first, we use a Brute force algorithm approach. we will try all possible profits we can get from the given values and pick the highest one


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vvnoned6llo7f54ydwnr.png)

**_Failed time complexity: O(n²)_**
The input size is 10⁵ so that the nested loop will cause TLE(time limit exceed).

**Better Solution — O(n)**
We can go through all of the prices and we can instead keep track of the minimum price and subtract it from the selling prices like so.


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eraqmnws2ia381wh1npu.png)

**_Complexity analysis_**

Time complexity: O(n)*Space complexity: O(1)*

This solution works great!
Heroku Cloudflare https
Published: 2023-02-25 22:35:36

Let say you own a domain `sholi.app` this short article explain how you configure https://www.sholi.app behind Cloudflare to communicate with app running under [Heroku](heroku.com)

step 1. In [Cloudflare](https://www.cloudflare.com/) **add a new site** (Add Site button). Fill in the domain name (`sholi.app`). 

step 2 In next step Cloudflare will tell you what are the NS records. Go to your domain provider (Godaddy, Porkbun, Route53,...) and **change domain NS** to this value 

step 3. in Heroku app dashboard go to app's Settings "Domains" section **add a domain** `www.sholi.app`  and copy the DNS Target value (needed in step 5)

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/p6hb7x29vsqy2d7vfsx6.png)

step 4. in Heroku app dashboard app's Settings in "SSL Certificates" create certificate for domain 


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ca0rtzm3xyw65sf7kg6b.png)


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/82x8tj2knxsznu2joror.png)


step 5. in Cloudflare domain's DNS settings update **DNS Records**:

- **A** Record `@` (root) point to ` 174.129.25.170` ([wwwizer](http://wwwizer.com/naked-domain-redirect))
- **CNAME** Record `www` point to DNS Target from step 3

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ry99qds58cvd3ldi1x8o.png)


step 6. in Cloudflare domain's SSL settings  **set strict cert**

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/od4tth1jn2b1yy62rfvj.png)


step 7. in Cloudflare domain's SSL settings **set https always on**


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eisn7n0l68ql2em26sqe.png)



curl https://www.sholi.app


Links:

* [Alternative article](https://pradiptagitaya.medium.com/setup-heroku-custom-domain-https-cloudflare-21baf6ad4596)
Set up Jenkins with HTTPS
Tags: jenkins, devops, https, linux
Published: 2023-02-25 22:26:04

Here is a quick guide on how to set up Jenkins with HTTPS. There are numerous guides available, already. And I read some of them. But two things struck me odd. First, some guides want you to change the central systemd file for Jenkins (instead of an override file) and secondly, they want you to create a JKS file (instead of PKCS #12).

So, my words of warning: Never overwrite files in `/etc/systemd/system`. These files are manged by your system and package manager. If you want to add or change settings for Jenkins, use [/etc/systemd/system/jenkins.service.d/override.conf](https://www.jenkins.io/doc/book/system-administration/systemd-services/). JKS is a proprietary format. [PCKS #12](https://en.wikipedia.org/wiki/PKCS_12) on the other hand, is an [industry standard](https://en.wikipedia.org/wiki/PKCS) and also the default keystore format since Java 9!

### Generate SSL certificate

First, you'll need a certificate. You can create one with openssl:

     openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out jenkinns.pem

Naturally, if you already have a certificate, you do not need to create a new one. But you'll have to convert it to a PKCS #12 file.

Continuing with the example above, you'll have to merge the files `key.pem` and `jenkins.pem` in a PKCS #12 keystore:

    openssl pkcs12 -inkey key.pem -in jenkins.pem -export -out jenkins.p12

Finally, put the file `jenkins.p12` somewhere accessible to Jenkins. I put it in `/var/lib/jenkins`.

    sudo mv ./jenkins.p12 /var/lib/jenkins
    # I assume you run Jenkins with default settings. If you run it with a different user, you'll have to adapt the 'chown', of course!
    sudo chown jenkins:jenkins /var/lib/jenkins/jenkins.p12

### Enable HTTPS in Jenkins service

With a new and shiny keystore in place, tell Jenkins how to use it. Create the file `/etc/systemd/system/jenkins.service.d/override.conf` and put the following content in it.
    
    [Service]
    Environment="JENKINS_HTTPS_PORT=8443"
    Environment="JENKINS_HTTPS_KEYSTORE=/var/lib/jenkins/jenkins.p12"
    Environment="JENKINS_HTTPS_KEYSTORE_PASSWORD=<your-password>"

Now, restart the Jenkins service.

    sudo systemctl daemon-reload
    sudo systemctl restart jenkins.service 

### All done

Accessing `https://localhost:8443` now should give you the Jenkins login page, but with a valid and secure https connection.
Add variable to an object smart
Published: 2023-02-25 22:18:25

Sometimes we need to add to an object a variable which can contain value or be undefined. 

```js
const city = undefined // can be string or undefined

const person = {
  name: 'Harry',
}
```

In JavaScript we can do it easily, just by writing the variable name inside an object. But it has one problem. Now the object has two keys despite this variable being undefined.

```js
const person = {
  name: 'Harry',
  city,
}

console.log(person) // { name: 'Harry', city: undefined }
console.log(Object.keys(person)) // [ 'name', 'city' ]
```

Of course we can check it manually in an if block and add it only if it contains a value.

```js
const person = {
  name: 'Harry',
}

if (city) {
  person.city = city
}
```

But I will show you a more elegant way.

We can use a mix of the spread operator and ternary operator inside an object. If the variable has data we merge the object with the needed variable, if not we merge an empty object, so the object remains clear.

```js
const city = undefined // can be string or undefined

const person = {
  name: 'Harry',
  ...(city ? {city} : {}),
}

console.log(person) // { name: 'Harry' }
console.log(Object.keys(person)) // [ 'name' ]
```

Subscribe to know more tips about JavaScript.
Roles of Log in Weibo by Phone number.
Published: 2023-02-25 21:32:29

When you couldn't log in Weibo by phone number, try the below way.


If your number start from
`(+81)080~`

You should input like this.
`008180~`

The points are

- Append 00 to the head.

- Input 80 instead of 080.
Are You Making These Common Empathy Mistakes in Your Pull Request Reviews?
Published: 2023-02-25 21:29:36

Welcome to the third article of my series on stress management in the software industry. In this article, we will take a closer look at the approaches, mistakes, and best practices for reducing stress as pull requests through the lens of a reviewer.

[Read more...](https://admirlive.medium.com/are-you-making-these-common-empathy-mistakes-in-your-pull-request-reviews-5643e833d07e?source=friends_link&sk=c29db93de534325b8cca6d12ccc38275)
JavaScript Tutorial Series: Function expressions
Published: 2023-02-25 21:11:50

In a previous post, we've learned what are functions, their syntax and why they're used. If you need a refresher please refer to this lesson [JavaScript Tutorial Series: Functions.
](https://dev.to/fullstackjo/javascript-tutorial-series-functions-5568)

In this post we're going to explain what function expressions are through some examples.

## What are function expressions
Function expressions are a strong and useful component of JavaScript. They allow programmers to define functions in a flexible manner, allowing the creation of reusable and dynamic code.

A function expression's fundamental objective is to define a function as a value that can be assigned to a variable or used as an argument by another function. This is distinct from a function declaration, which uses the function keyword to define a named function.

Let's look at an example.

```JavaScript
const greetings = function(username) {
  console.log(`Hello, ${username}!`);
};
```
In this example, a variable called `greetings` is given the function expression. The greeting is logged to the console using this function, which takes a parameter `username`.

## Anonymous functions
Function expressions have the advantage of allowing the creation of anonymous functions, which is when a function is only needed once or acts as a callback.

```JavaScript
const numbers = [10, 20, 30, 40, 50];
const square = numbers.map(function(number) {
  return number * number;
});

console.log(square); //[100,400,900,1600,2500]
```
In this example an array of numbers is used as the input for the map function. An anonymous function is passed as the second argument to the map function, and it returns the square of each number it receives from the array.

## Creating higher-order functions
It is also possible to create higher-order functions using function expressions. These are the functions that accept arguments from other functions and return arguments as their output. [JavaScript Tutorial Series: Higher order functions](https://dev.to/fullstackjo/javascript-tutorial-series-higher-order-functions-507b).

```JavaScript
function repeat(func, nTimes) {
  for (let i = 0; i < nTimes; i++) {
    func();
  }
}

const greet = function() {
  console.log("Greetings");
};

repeat(greet, 3);
/*
Greetings
Greetings
Greetings
*/
```
In this example, the repeat function's first argument is a different function `func`, and its second argument is the number of times the function should be repeated `nTimes`. The `func` function is then called a specified number of times by the repeat function. The repeat function receives an argument from the greet function, which is defined using a function expression.

_Do not forget to try these snippets while reading their explanations to get a better grasp of the concept_
Appache-Age
Tags: appache, appacheage, bitnine, internship
Published: 2023-02-25 21:10:14

I am working as a software engineering intern at Bitnine in which i am contributing to Appache-Age Project.I will be posting more of my stuff related to my internship and projects for now. So, i will start with the basic introduction of the Appache-Age project.

Apache AGE (A Graph Extensions) is an open-source extension of the popular PostgreSQL database management system, designed to support the storage and querying of graph data. In this blog post, we will explore some of the key features and benefits of Apache AGE, and discuss why it is a valuable tool for working with graph data.

One of the key benefits of Apache AGE is its seamless integration with PostgreSQL. This means that users can leverage the powerful relational database capabilities of PostgreSQL, while also taking advantage of the specialized features of a graph database. This integration makes it easy to store and query complex graph data in a familiar and flexible environment.

Another key feature of Apache AGE is its support for the open-source Cypher query language, which was originally developed for the Neo4j graph database. Cypher provides a powerful and intuitive way to query graph data, using a syntax that is designed specifically for graph patterns and relationships. Apache AGE supports most of the Cypher language syntax, making it easy for users familiar with Neo4j to transition to Apache AGE.

Apache AGE also offers a number of performance optimizations for graph data, such as indexing and caching strategies, that can help to speed up query execution and improve overall system performance. These optimizations are designed to take advantage of the unique characteristics of graph data, such as its highly connected nature and complex relationships.

In addition to its performance benefits, Apache AGE also offers a number of features for managing and visualizing graph data. For example, users can take advantage of built-in functions for graph traversal, pathfinding, and community detection. There are also a number of tools available for visualizing graph data, including tools for building interactive graphs and exploring graph patterns.

Overall, Apache AGE is a powerful and flexible tool for working with graph data, offering seamless integration with PostgreSQL, support for the Cypher query language, and a range of performance optimizations and visualization tools. Whether you are working with complex social networks, biological data, or other types of graph data, Apache AGE is a valuable tool for exploring and analyzing relationships, patterns, and insights in your data.