teleren/devto huggingface dataset:
SpringBoot – Upload/Download MultipartFile to FileSystem – Bootstrap 4 + JQuery Ajax
Tags: springboot, multipartfile, uploadfile, filesystem
Published: 2021-04-18 16:48:32

https://grokonez.com/spring-framework/spring-boot/multipartfile-create-spring-ajax-multipartfile-application-downloadupload-files-springboot-jquery-ajax-bootstrap

SpringBoot – Upload/Download MultipartFile to FileSystem – Bootstrap 4 + JQuery Ajax

In the tutorial, we guide how to build a SpringBoot web-application to Upload/Download MultipartFile to FileSystem using Bootstrap 4 & JQuery Ajax.

<!--more-->
<h2>Technologies</h2>
<ul>
<li>Java 8</li>
<li>Spring Tool Suite: Version 3.9.4.RELEASE</li>
<li>Spring Boot: 2.0.2.RELEASE</li>
<li>Bootstrap 4</li>
<li>JQuery Ajax</li>
</ul>
<h2>Goal</h2>
We create a SpringBoot project as below:

<img src="https://grokonez.com/wp-content/uploads/2017/07/SpringBoot-Upload-Download-MultipartFile-2-FileSystem-using-Bootstrap-4-JQuery-Ajax-project-structure.png" alt="SpringBoot-Upload-Download-MultipartFile-2-FileSystem-using-Bootstrap-4-JQuery-Ajax-project-structure" width="417" height="357" class="alignnone size-full wp-image-12828" />

-> Upload/Download Form:

<img src="https://grokonez.com/wp-content/uploads/2017/07/SpringBoot-Upload-Download-MultipartFile-2-FileSystem-using-Bootstrap-4-JQuery-Ajax-download-files.png" alt="SpringBoot-Upload-Download-MultipartFile-2-FileSystem-using-Bootstrap-4-JQuery-Ajax-download-files" width="684" height="420" class="alignnone size-full wp-image-12830" />
<h2>Practice</h2>
We create a SpringBoot project with below dependencies:

<pre><code class="language-html">&lt;dependency&gt;
	&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
	&lt;artifactId&gt;spring-boot-starter-thymeleaf&lt;/artifactId&gt;
&lt;/dependency&gt;
&lt;dependency&gt;
	&lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
	&lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
&lt;/dependency&gt;</code></pre>
<h3>FrontEnd</h3>
<h4>Upload Multipart-Form</h4>

More at:

https://grokonez.com/spring-framework/spring-boot/multipartfile-create-spring-ajax-multipartfile-application-downloadupload-files-springboot-jquery-ajax-bootstrap

SpringBoot – Upload/Download MultipartFile to FileSystem – Bootstrap 4 + JQuery Ajax
Application Performance Monitoring with Elastic APM Tool
Tags: elasticsearch, apm, monitoring
Published: 2021-04-18 16:36:21

## Introduction
Elastic APM is a powerful tool which can be used to monitor overall application health and performance. It enables us to drill down to each and every dependent internal api calls, databases calls etc. and reveals hidden secrets.

---

# Getting Started
## Required tools
> 1. Docker
> 2. elastic-apm-agent Java agent can be downloaded from : https://search.maven.org/search?q=a:elastic-apm-agent

Below steps can be followed to integrate application with APM tool and configure to start profiling.

docker-compose up -d below docker compose file

```
version: '3'
services:
      elasticsearch:
        image: docker.elastic.co/elasticsearch/elasticsearch:6.6.1
        ports:
          - "9200:9200"
      kibana:
        image: docker.elastic.co/kibana/kibana:6.6.1
        ports:
          - "5601:5601"
        depends_on:
          - elasticsearch
      apm-server:
          image: docker.elastic.co/apm/apm-server:6.6.1
          environment:
            - output.elasticsearch.hosts=["elasticsearch:9200"]
          ports:
            - "8200:8200"
          depends_on:
            - elasticsearch
```

At this point, ElasticSearch, Kibana and apm-server have been wired together and ready to be attached to your application.

Now, start the application with the javaagent and pointing to apm-server url

```
java -javaagent:/<path-to-jar>/elastic-apm-agent-<version>.jar \
     -Delastic.apm.service_name=my-application \
     -Delastic.apm.server_url=http://localhost:8200 \
     -Delastic.apm.secret_token= \
     -Delastic.apm.application_packages=<base package> \
     -jar <jar name>.jar
```

Here,
> apm.service_name → It can be the service name apm.server_url  → url to apm server apm.application_packages → package where  main class is present

## Configuration steps on Kibana
> 1. Goto : http://localhost:5601 (http://localhost:5601/)
> 2. Click on Add APM
> 3. Scroll down and click on Check APM Server Status
> 4. Scroll down and click on Check agent status
> 5. Click on Load Kibana objects
> 6. Launch APM

APM is now ready and integrated with the service at this moment. Now try to do some operations on the UI or run some controller tests to see the transaction in APM.

---

## References
https://www.elastic.co/solutions/apm
✌️
Programming in Clojure (Part 7 Concurrency)
Tags: clojure, tutorial
Published: 2021-04-18 16:21:40

This post covers concurrency in Clojure. This is a big topic. I start by discussing threads. Then I talk about different strategies for dealing with data that is shared among different threads.

###Concurrency
* [Threads](https://markm208.github.io/cljbook/chapter7/01/index.html)
* [Threaded poker](https://markm208.github.io/cljbook/chapter7/02/index.html)
* [refs and threads](https://markm208.github.io/cljbook/chapter7/03/index.html)
* [Atoms](https://markm208.github.io/cljbook/chapter7/04/index.html)
* [Poker with atoms](https://markm208.github.io/cljbook/chapter7/05/index.html)
* [Thread logging with agents](https://markm208.github.io/cljbook/chapter7/06/index.html)
* [Simpler concurrency](https://markm208.github.io/cljbook/chapter7/07/index.html)

###Call to Action
Problem 1
This lab asks you to create a Clojure program that will count how many primes are in a given range. Create a thread pool and have each thread check a single number in the range. If it finds a prime it will increase a counter (which should be an atom since it is shared by all of the threads). Look at the program above on Atoms as a starting point

###Comments and Feedback
You can find all of these code playbacks in my free 'book', [An Animated Introduction to Clojure](https://markm208.github.io/cljbook/). I am always looking for feedback so please feel free to comment here or to send me a message. You can follow me on twitter [@markm208](https://twitter.com/markm208).
Programming in Clojure (Part 6 Macros)
Tags: clojure, tutorial
Published: 2021-04-18 16:21:17

This post covers macros in Clojure. A macro specifies some code to be executed sort of like a function but it also allows some of that code to be replaced with values that come from the user. The code in a macro is kind of like a template that can be altered to suit the callers needs. With this powerful feature the language can be expanded to do things that the language inventor never thought to add. 

###Macros
* [Macros](https://markm208.github.io/cljbook/chapter6/01/index.html)
* [Set macros](https://markm208.github.io/cljbook/chapter6/02/index.html)

###Call to Action
Problem 1
Write a macro that takes in a grade earned on a student assignment (on a 0-100 scale) and some code to execute if the grade is a passing or failing.

```clojure
(defmacro eval-grade [grade if-passing if-failing] ...)
```

And use it to print or call a function based on the value of the grade

```clojure
(def users-grade 43)
(eval-grade users-grade (println "Passing") (println "Failing")) ;;"Failing"
(eval-grade users-grade (praise users-grade) (warning users-grade)) ;;call the warning function
```

###Comments and Feedback
You can find all of these code playbacks in my free 'book', [An Animated Introduction to Clojure](https://markm208.github.io/cljbook/). I am always looking for feedback so please feel free to comment here or to send me a message. You can follow me on twitter [@markm208](https://twitter.com/markm208).
Programming in Clojure (Part 4 Recursion)
Tags: clojure, tutorial
Published: 2021-04-18 16:21:02

This post covers recursion in Clojure. A recursive function is one that calls itself. Since every function call results in a stack frame being placed on the call stack, regular recursion runs the risk of 'blowing up the call stack' which is bad. Tail recursion, with `recur` is an efficient way to simulate recursion without the downsides.

###Tail recursion
These are examples of using recursion.
* [Tail Recursion](https://markm208.github.io/cljbook/chapter4/01/index.html)
* [Recursion and Fizz-Buzz](https://markm208.github.io/cljbook/chapter4/02/index.html)
* [Recursion and Square Roots](https://markm208.github.io/cljbook/chapter4/03/index.html)
* [Converting a String to an Integer in the Bases 2-16](https://markm208.github.io/cljbook/chapter4/04/index.html)
* [Mortgage Scheduler](https://markm208.github.io/cljbook/chapter4/05/index.html)

###Call to Action
Problem 1
Write a recursive function to reverse the letters of a string. 
```clojure
(reverse-string "Mark Mahoney") ;;returns "yenohaM kraM"
```
You may need to create a recursive 'helper' function that takes a different number of parameters than the non-recursive function or use the `loop` form. Make sure you use recursion with the `recur` form so that you do not 'blow the stack'.

Problem 2
Write a function that will join a series of strings together separated by another string. The function should create and return a new string. Use recursion with `recur`.
```clojure
(defn join [separator & parts]
   ;;your code here)

(join ", " "Mark" "Laura" "Buddy" "Patrick" "Willy") ;;"Mark, Laura, Buddy, Patrick, Willy"
```

Problem 3
Write a function that takes in an integer and converts it to a string. The user can specify the base that the string is in from 2-10. The program should use recursion and recur (either a recursive function or the loop form). 

###Comments and Feedback
You can find all of these code playbacks in my free 'book', [An Animated Introduction to Clojure](https://markm208.github.io/cljbook/). I am always looking for feedback so please feel free to comment here or to send me a message. You can follow me on twitter [@markm208](https://twitter.com/markm208).
Programming in Clojure (Part 3 Closures)
Tags: clojure, tutorial
Published: 2021-04-18 16:20:52

This post covers a feature of functions called 'closures'. A closure is a way to associate data permanently with a function.

###Closures
The first program shows how to bind data to a function.
* [Closures](https://markm208.github.io/cljbook/chapter3/01/index.html)

The second program shows a more complex example of using them.
* [Interest in an account](https://markm208.github.io/cljbook/chapter3/02/index.html)

###Call to Action
Problem 1
Write a function that returns a function. The Fibonacci numbers are a sequence of numbers that are generated by summing the previous two numbers together:
```
0 1 1 2 3 5 8 13 21 34 ...
```
Usually, the first two numbers are assumed to be 0 and 1. The returned function should use the specified first numbers in the sequence and print out all of the numbers up to the passed in one.

```clojure
(defn fibs-fn[firstFib secondFib] ...) ;;fill this in

(def another-fib (fibs-fn 10 15))
(another-fib 5) ;;print first 5 fibs: 10 15 25 40 65
```
###Comments and Feedback
You can find all of these code playbacks in my free 'book', [An Animated Introduction to Clojure](https://markm208.github.io/cljbook/). I am always looking for feedback so please feel free to comment here or to send me a message. You can follow me on twitter [@markm208](https://twitter.com/markm208).
TikTok Downloader | Download TikTok Videos without water, TikTok Videos To MP3
Published: 2021-04-18 16:20:37

<h2>What is TikTok Downloader? </h2>
TikTok Downloader is tool, that can help you in downloading unlimited tiktok videos for free. With help of <a href="https://tiktokdownloaders.com/tiktok-downloader/">TikTok Downloader</a>, you can also convert tiktok videos to mp3 within seconds. And best things is that you can do this for free without hurdle. 

<h2>Step by step instructions to utilize tiktok downloader</h2>

1. Duplicate the connect to the TikTok or Musically video you need to save. 

2. Glue the connection of the video into the info box on the landing page. 

3. Snap the "Get video" catch to start the download interaction. 

4. At the point when the cycle is finished, you will get a connect to save the TikTok video. 

Summary 

TikTok Downloader is an amazing on the web instrument for downloading recordings off TikTok. It is the awesome most effortless instrument online for anybody needing to save limitless TikTok recordings in a great MP4 design. Our video downloader permits you to download the first TikTok video or the video without a watermark. We don't simply uphold the download of recordings; we likewise support the download of TikTok recordings as sound documents in either MP3 or M4 design. 

To begin, simply place the connect to the <a href="https://www.tiktok.com/en">TikTok video</a> that you'd prefer to download in the info box above and click the red catch. Our workers will deal with the connection and concentrate the download joins for you. At that point click on the download catches to save the first video, without watermark video, or brief snippet to your gadget.
AdaptiveAvgPool2d in PyTorch
Tags: deeplearning, pytorch
Published: 2021-04-18 16:15:04

I had trouble understanding the `AdaptiveAvgPool2d` function in PyTorch.  The following examples helped me to teach myself better. Hopefully, somebody may benefit from this.    


# Example 1

```python
import torch
import torch.nn as nn
import numpy as np

m = nn.AdaptiveAvgPool2d((1))

x = np.array(
[
    [ 2. , 3.],
    [ 4. , 1.],
    
])

input = torch.tensor(x)
print(input)

output = m(input)
print(output)
print(torch.mean(input))
```

The output will be equal to torch.mean(input)

# Example 2 with a 3 x 3 x 3  tensor

```python
x = np.array(
[
    [
        [ 2. , 3. , 2.],
        [ 2. , 3. , 2.],
        [ 2. , 3. , 2.],
    
    ],
    
    [
        [ 1. , 4. , 5.],
        [ 1. , 4. , 5.],
        [ 1. , 4. ,  5. ],
    
    ],
    
    [
        [ 7. , 3. , 2.],
        [ 7. , 3. , 2.],
        [ 7. , 3. , 2.],
    
    ]

])
```

This is a 3 x 3  x 3 array

```python

input = torch.tensor(x)

m = nn.AdaptiveAvgPool2d((2))

output = m(input)

print(output)

```

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kgj93iaxv1pj74s030uq.png)
 
Let's investigate why the 1st element is 2.5   

We take a 2 x 2 tensor out of the 3 x 3 x 3 tensor and take the mean and see that it is 2.5

```python
x2 = torch.tensor(np.array([2. , 3. , 2. , 3.]))
torch.mean(x2)
```
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t8rxef2kvh1vw7cie79e.png)
 
## Example 3

We see that the 6th element is 4.5. How is this calculated?

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ih0u38c6uuikwqlaojvd.png)
 
We take the mean of the following section

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

```python
x3 = torch.tensor(np.array([ 4.0 , 5. , 4. , 5.]))
torch.mean(x3)
```

# Example 4   with a 4 x 3 x 3 tensor   

```python

x = np.array(
[
    [
        [ 2. , 3. , 2.],
        [ 2. , 3. , 2.],
        [ 2. , 3. , 2.],
    
    ],
    
    [
        [ 1. , 4. , 5.],
        [ 1. , 4. , 5.],
        [ 1. , 4. ,  5. ],
    
    ],
    
    [
        [ 7. , 3. , 2.],
        [ 7. , 3. , 2.],
        [ 7. , 3. , 2.],
    
    ],
    
    [
        [ 8. , 3. , 2.],
        [ 8. , 3. , 2.],
        [ 8. , 3. , 2.],
    
    ]

])

input = torch.tensor(x)
print(input)
print(input.shape)
```
This is a 4 x 3 x 3 tensor 

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

m = nn.AdaptiveAvgPool2d([1,1])
output= m(input)
print(output)
```
![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/k1qn2m7q67e96hy39937.png)

Let us explore why the first element is **2.3333**   

```python
x4 = torch.tensor(
    np.array( [ 2. , 3. , 2.,  2. , 3. , 2.,  2. , 3. , 2.])
                 )
print(torch.mean(x4))
```

![image](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4lck8u8gkwepfyur9el3.png)
Boolean Values
Tags: javascript, devops, beginners, tutorial
Published: 2021-04-18 16:11:21

#### Understanding Boolean Values
Another data type is the Boolean. Booleans may only be one of two values: true or false. 

Note: Boolean values are never written with quotes. The strings "true" and "false" are not Boolean and have no special meaning in JavaScript.
* Example:
```
function welcomeToBooleans() {
  return true;
}
welcomeToBooleans(); // will display true

function welcomeToBooleans() {
 return false; 
}
welcomeToBooleans(); // will display false
```
What Are ETF’s?
Published: 2021-04-18 11:37:18

An Exchange Traded Fund or ETF is a collection of stocks or financial securities that are traded on an exchange. You can buy ETFs if you have an equity brokerage account with your broker. By buying an ETF, you essentially get exposure to the constituent securities of the ETF. A Registered Investment Advisor (RIA) can choose different types of ETFs such as stock, bonds, commodities, currency, and index ETFs, etc. are available on the market.

The prices of ETFs depend on the prices of underlying securities and the intraday trading on the stock exchange. Wealth management software helps financial advisors and wealth managers to select ETFs for investment based on the specific criteria and goals of the client. For example, an RIA will select a low-cost index fund ETF for a client having a moderate-risk appetite and will select a bond ETF for a client with a low-risk appetite. 

ETFs can be divided into two categories based on how they are managed: actively managed ETFs, and passively managed ETFs. The fund manager actively buys and sells the underlying securities in an effort to achieve the desired returns, and hence the name actively managed ETFs. On the other hand, passively managed funds do not involve actively buying and selling of the underlying securities, rather the portfolio of shares is held in a constant proportion without changing the composition of the portfolio. The actively managed ETFs typically have a higher expense ratio due to the frequent buying and selling of securities, incurring transaction costs. The expense ratio, however, can be reduced with the help of the wealth management platform as the platform can do automatic portfolio rebalancing, allowing portfolio managers to make an optimal portfolio and rebalance portfolios at lower costs.

Financial advisors also need the best CRM platform for financial advisors to communicate and share different progress reports with clients, allowing the clients to see the updated position of their accounts. CRM platforms such as Junxure will nicely complement the wealth management platform such as AdvisorEngine.com and provide the necessary tools for building, analyzing, and managing the clients’ portfolios.

With the sheer number of ETFs available on the market, financial advisors do thorough research to determine what ETF to invest in and whether to invest in ETFs or not. ETFs provide an easy and cost-effective way to get exposure to a certain class of asset. Not only do ETFs provide upside potential, but ETFs also provide the necessary diversification to the portfolio as well as you can get exposure to a collection of securities just by owning a single ETF. A financial advisor can manage a large number of investors’ accounts using a wealth management platform that will track and automate the portfolio management tasks, enabling the financial advisor to focus on researching what ETFs to choose for a particular client. The financial managers can also invest in CRM platforms to find information about the risk and return profile while selecting ETFs.
How I can update the Activity's UI using lambdas for events?
Tags: help, android, java
Published: 2021-04-18 15:44:06

As I ask upon: https://stackoverflow.com/q/67150195/4706711

I have a class that I provide callbacks via lambdas. These lambdas provide callback functionality and update the Activity's UI.

In a nutshell I have the following class:

```
class MyProcess extends Runnable{
  
   Callback callback;
   Callback exceptionCallback;   

   public function setCallback(Callback callback){this.callback=callback;}
  
   public function setExceptionCallback(Callback callback){this.exceptionCallback = callback}

   public void doStuff()
   {
      try{
        // Some Logic there that performs Networking
        callback.call();
      }catch(Exception e){ exceptionCallback.call(e); }
   }

   public void run(){ this.doStuff(); }
}
```

And in my activity I do the following

```
 class MyActivity extends extends AppCompatActivity implements View.OnClickListener{
   MyProcess process;
   protected void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.my_activity);
       process = new MyProcess();
       process.setExceptionCallback((Exception e)->{                Log.e("MyApp",MyActivity.class+e.getMessage());
});
       Button submit = (Button)findViewById(R.id.connect_btn);
       submit.setOnClickListener(this);
       process.setCallback(()->{submit.setEnabled(true)});
  }
  @Override
  public void onClick(View v){

        Button submit = (Button)findViewById(R.id.connect_btn);
        submit.setEnabled(false);

        runOnUiThread(this.retriever);
    }
}
```

But the `runOnUiThread` does not allow me to perform networking. Therefore, do you have any Idea how I can run a thread that performs networking;
Let's Challenge You.
Tags: javascript, beginners, tutorial
Published: 2021-04-18 15:41:41

* Let's begin by giving you a problem to solve.

In Computer Science a queue is an abstract Data Structure where items are kept in order. New items can be added at the back of the queue and old items are taken off from the front of the queue.

* Write a function nextInLine which takes an array (arr) and a number (item) as arguments.

* Then Add the number to the end of the array, then remove the first element of the array.

* The nextInLine function should then return the element that was removed.
The function is written out for you here.
```
function nextInLine(arr, item) {
  // Only change code below this line

  
  return item;
  // Only change code above this line
}

// Setup
var testArr = [1,2,3,4,5];

// Display code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6));
console.log("After: " + JSON.stringify(testArr));
```
* Don't worry about the last bit of code in the console.log, you will learn as you go and I will be here to see it through.

* Here below, you will find the answer.
```
function nextInLine(arr, item) {
  // Only change code below this line
  var newArray = arr.push(item);
  var someArray = arr.shift();
  return someArray;
  // Only change code above this line
  
}

// Setup
var testArr = [1,2,3,4,5];

// Display code
console.log("Before: " + JSON.stringify(testArr));
console.log(nextInLine(testArr, 6));
console.log("After: " + JSON.stringify(testArr));
```
```
console will display 
Before: [1,2,3,4,5]
After: [2,3,4,5,6]
someArray will equal 1 (returned element that was removed)
```
Top 10 React projects for Resume 🚀🚀
Tags: javascript, devops, programming, codenewbie
Published: 2021-04-18 15:30:15

1. Facebook Clone
  
{% youtube B-kxUMHBxNo %}
2. Instagram Clone
{% youtube f7T48W0cwXM %}
3. Whatsapp Clone
{% youtube pUxrDcITyjg  %} 
4. Linkedin Clone
{% youtube QaYts9sPmcY %}
5. Amazon Clone
{% youtube RDV3Z1KCBvo %}
6. Spotify Clone
{% youtube pnkuI8KXW_8 %}
7. Netflix Clone
{% youtube 1TCw9wO1neA%}
8. Hotstar + Disney Clone
{% youtube  4pjpHUN28kk%}
9. Google Drive clone
{% youtube ljuCH6_jrYE %} 
10. Signal Clone 
{% youtube MJzmZ9qmdaE %}

__Do you want to Kick-start a career in Cyber Security and want to know how hackers hack in real life ☠️☠️__

Join Now 200+ Members already Joined 

https://t.me/infosecbugbounty