teleren/devto huggingface dataset:
External Properties in Spring
Tags: spring, java, properties
Published: 2020-10-03 20:54:58

#Fetching property values from the environment#

```java
@Configuration
public class DbConfig {
	Environment env;

	@Autowired
	public DbConfig(Environment env) {
		this.env = env;
	}

	@Bean
	public JdbcTemplate dataSource() {
		DriverManagerDataSource dataSource = new DriverManagerDataSource();
		dataSource.setDriverClassName(env.getProperty("db.driver"));
		dataSource.setUrl(env.getProperty("db.url"));
		dataSource.setUsername(env.getProperty("db.user"));
		dataSource.setPassword(env.getProperty("db.password"));
		JdbcTemplate jdbcTemplate = new JdbcTemplate();
	    jdbcTemplate.setDataSource(dataSource);
	    return jdbcTemplate;
	}
}
```

#app.properties file#
```properties
db.driver=com.mysql.jdbc.Driver
db.url=jdbc:mysql://localhost:3306/cas
db.user=root
db.password=123
```

#@PropertySource and @Value#
@PropertySource annotation adds properties from other files in addition to environment variables and system properties. You can use classpath, file or http prefixes.

```java
@Configuration
@PropertySource("classpath:/com/org/config/app.properties")
public class DbConfig {

	@Bean
	public JdbcTemplate dataSource(
			@Value("${db.driver}") String driver, 
			@Value("${db.url}") String url,
			@Value("${db.user}") String user, 
			@Value("${db.password}") String password) {
		DriverManagerDataSource dataSource = new DriverManagerDataSource();
		dataSource.setDriverClassName(driver);
		dataSource.setUrl(url);
		dataSource.setUsername(user);
		dataSource.setPassword(password);
		JdbcTemplate jdbcTemplate = new JdbcTemplate();
		jdbcTemplate.setDataSource(dataSource);
		return jdbcTemplate;
	}
}
```
Fix path reference
Tags: log
Published: 2020-10-03 20:48:10

It took me some minutes to realize the cause of the problem. The console showed `Uncaught SyntaxError: Unexpected identifier` at `scripts.js:1`. But the thing is nothing was wrong in scripts file. Even the line, 1 where the console was pointing the error to.

Going further inside the scripts file in browser's console, the only message was the error message from a `if` statement in case the data was not found. But that message was in another file.
After more or less 30 minutes, i found a dumb syntax error from where the `scripts.js`was being called.

As i was using the express middleware to watch for static files in the public folder, i suppose the express was reaching to the the folder and expecting a path then, if there was one, of course.

🔧 How it was set up
`server.use(express.static("public"))`

💬 How file was called
`<script src="./scripts.js"></script>`

❌ The error
`Uncaught SyntaxError: Unexpected identifier`

At this point, the framework was trying to access the path this way: folder/public./scripts.js

✅ The solution
`<script src="/scripts.js"></script>`

💡 How should it be avoided?
Understanding more about file paths and how to use them in Linux

Simply remove the dot from the path that was avoiding express to get to the script file.

💭 Conclusion
When you are new, almost everything seems very complex and it is hard to deconstruct your thoughts to know where and how every piece of code connect with each other, wich prevents you from having a more analytical thinking.

___

🏗 The project: https://github.com/rafaellimags/gym-manager
Fusion = real-time UIs in Blazor + consistent caching in .NET Core
Tags: dotnet, csharp, microservices, functional
Published: 2020-10-03 20:04:14

{% github servicetitan/Stl.Fusion %}

Repository's README.md describes what Fusion is and how it works. There is [a fair number of samples](https://github.com/servicetitan/Stl.Fusion.Samples) and [interactive tutorial](https://github.com/servicetitan/Stl.Fusion.Samples/blob/master/docs/tutorial/README.md):

![](https://raw.githubusercontent.com/servicetitan/Stl.Fusion.Samples/master/docs/img/Samples-Blazor.gif)

Please feel free to ask any questions in comments - I'm the author of this library.
Dart x Flutter MokuMoku Live Coding 04/10/2020 AM
Tags: dart, flutter, mokumoku, livecoding
Published: 2020-10-03 19:58:42

I 'm makeing something with Dart and Flutter while doing live coding on 04/10/2020 now

- not performance coding , not speed coding

# Live Coding Address

https://youtu.be/_qVvJBwieNY




# Code
https://github.com/kyorohiro/mokumoku03



# What is mokumoku

For the time being, people who are interested in a certain theme gather and do their own work. Just that.


＃ What is making

Image uploader at dart x flutter x firebase



# History

- Dart x Flutter MokuMoku Live Stream 05/09/2020
  
https://dev.to/kyorohiro/dart-x-flutter-mokumoku-live-stream-2020-09-05-30oa


- Dart x Flutter MokuMoku Live Stream 12/09/2020

https://dev.to/kyorohiro/todo-dart-x-flutter-mokumoku-live-coding-12-09-2020-bbm

- Dart x Flutter MokuMoku Live Stream 19/09/2020

https://dev.to/kyorohiro/dart-x-flutter-mokumoku-live-coding-19-09-2020-iec

- Dart x Flutter MokuMoku Live Stream 26/09/2020

https://dev.to/kyorohiro/dart-x-flutter-mokumoku-live-coding-26-09-2020-1icb


- Dart x Flutter MokuMoku Live Stream 04/10/2020

now



# Result

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

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

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

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

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



..

# Todo

..

# know-how

Write To In Discussion
- How to use http query paramter at flutter router
I have no passion anymore in my job and want to transition to a different position. I need some advice.
Tags: discuss, help, career, datascience
Published: 2020-10-03 19:56:10

Hello there!

I am a frequent lurker on this website, but today I want to ask you guys for some advice regarding the topic in the title and I am going to use a throwaway account because I want to stay anonymous.

For the past 2,5 years, I have been working as a QA Engineer/Test Automation Engineer. However, in the past months, I feel like this type of work is not suited for me. I feel stuck and I genuinely don't like doing this work anymore.

What I want to do is to transition into a different role within IT. I have been building projects, learning/experimenting with new frameworks/languages and I noticed I am interested in working with data science/machine learning. I have been checking out a lot of job postings, but a lot of them say I need to have a master's degree in computer science (or something related to it) and have some work experience. 

So I have been researching and I have roughly two choices:

- Pursuing a master degree (possibly parttime, though not sure if I am able to combine it with my job) and then try to apply for jobs related to data science/engineer/machine learning
- Learn the skills while working at my current job and get a job in the field I am interested in (in this case data science/machine learning)

So what advice do you guys have for me?

Some background that might help:
- Have a business bachelor degree
- Worked as freelance front end developer for 1.5 years
- Worked as a QA/Tester for 2.5 years
- Volunteer on managing a platform on AWS
- Lives in the Netherlands
Lets build a simple interpreter from scratch in python, pt.08: For loop
Tags: interpreter, fromscratch, python
Published: 2020-10-03 19:46:28

In this post we are implementing the 'for' loop:
```python
class Interpreter:
    def __init__(self):
        self.scope=[{}]
        self.loop_stack=[]
        
    # ...(previous code)...
    
    # 'For' loop is not much different from 'while' loop
    # for(inits; cond; increments) {block}

    def For(self,xs):
        self.loop_stack.append({"break":False,"continue":False})        
        _, inits, cond, increments, block = xs
        for x in inits: 
            self.eval(x)
        while self.eval(cond):
            if isinstance(block[0],list):
                for x in block:
                    self.eval(x)
                    if self.loop_stack[-1]["break"]:
                        self.loop_stack.pop()
                        return
                    if self.loop_stack[-1]["continue"]:
                        self.loop_stack[-1]["continue"]=False
                        break
            else:
                self.eval(block) 
            for x in increments:
                self.eval(x)
        self.loop_stack.pop()
        
code=[
    
    ["Set","sum",0],
    
    ["For", [["Set","i",0]], 
            ["Lt", ["Get","i"], 100], 
            [["Set","i", ["Add",["Get","i"], 1] ]],   
    [   
        
        ["Set","sum", ["Add",["Get", "sum"],["Get","i"]]],
        
        ["Print","i=",["Get","i"],", sum=",["Get","sum"]],
        
        ["If", ["Eq", ["Get", "i"], 10], 
             ["Break"],[]
        ],
        
        
    ]],
    
]
    
interpreter=Interpreter()

interpreter.run(code)
```
Output:
```
i=0, sum=0
i=1, sum=1
i=2, sum=3
i=3, sum=6
i=4, sum=10
i=5, sum=15
i=6, sum=21
i=7, sum=28
i=8, sum=36
i=9, sum=45
i=10, sum=55
```
[Link](https://github.com/smadeveloper/interpreter/blob/main/interpreter08-for-loop.py) to complete code.


[Part 9: Function,Call,Return](https://dev.to/smadev/lets-build-a-simple-interpreter-from-scratch-in-python-pt-08-function-call-return-1p55)
Can you help me please
Tags: html, css, php, javascript
Published: 2020-10-03 19:44:53

I am creating an English site, to work as a blog. I'm starting in the world of programming so I have a lot of doubts. Going straight to the point, I found it difficult to modify a line of HTML code, for example: my header, I use the same for all pages on the site, but when I change a line on a page I have to keep changing all pages and it takes a lot of time and is boring to do. There is some way to standardize the header, like creating a standard header and "call it" whenever I want, so I only modify the header once and it will work for all pages. I don't know if I was clear, I hope so. I try to do this with PHP, and calling the header. PHP through includes. But it did not work. When I run index.Php only the code appears and nothing else. As if the browser has not interpreted the code. Anyway, is there any way to do without PHP? Thanks
Alguém pode me ajudar? 
Published: 2020-10-03 19:37:47

Estou criando um site de inglês, para funcionar como um blogue. Estou iniciando no mundo da programação então estou com muitas dúvidas. Vou direto ao assunto, eu encontrei uma dificuldade ao modificar uma linha de código HTML, por exemplo:meu header, eu uso o mesmo para todas as páginas do site, porém quando vou alterar uma linha em uma página eu tenho que ficar alterando todas as páginas e isso demanda muito tempo e é chato de fazer. Tem alguma forma de padronizar o header, tipo criar um header padrão e "chama lo" quando eu quiser, assim eu só modifico o header uma vez e vai funcionar para todas as páginas. Não sei se fui claro, espero que sim. Eu tentei fazer isso com PHP, e chamando o header. PHP através do include. Mas não funcionou. Quando eu rodo o index.Php só aparece o código e nada mais. Como se o navegador não tivesse interpretado o código. Enfim, tem alguma forma de fazer sem PHP?
Lets build a simple interpreter from scratch in python, pt.07: Break, Continue
Tags: interpreter, fromscratch, python
Published: 2020-10-03 19:27:51

In this post we are implementing 'Break' and 'Continue': 

```python
class Interpreter:

    # Modified constructor:
    # loop_stack holds "break" and "continue" status of
    # inner loops:

    def __init__(self):
        self.scope=[{}]
        self.loop_stack=[]
        
    #....(previous code)....
    
    def Break(self,xs):
        self.loop_stack[-1]["break"]=True

    def Continue(self,xs):
        self.loop_stack[-1]["continue"]=True
        
    def While(self,xs):
        # New:
        self.loop_stack.append({"break":False,"continue":False})
        _ , cond , block = xs
        while self.eval(cond):
            if isinstance(block[0],list):
                for x in block:
                    # While evaluating block,
                    self.eval(x)
                    # If break is called, exit from python loop
                    if self.loop_stack[-1]["break"]:
                        self.loop_stack.pop()
                        return
                    # If continue is called, break this for loop :)
                    if self.loop_stack[-1]["continue"]:
                        self.loop_stack[-1]["continue"]=False
                        break
            else:
                self.eval(block)
        self.loop_stack.pop()


# This is AST, not for humans, this is for interpreters
# I think it is very readable :P

ast =[
    
    ["Set","i",0],
    
    ["While", ["Lt", ["Get","i"], 100], [
        ["Set","i",["Add",["Get","i"],1]],
        
        ["If", ["Eq", ["Get", "i"], 5], 
             ["Break"],[]
        ],
        ["Print",["Get","i"]],
        
    ]],
    
    ["Print",["Mul","-",40]],
    
    ["Set","i",0],
    
    ["While", ["Lt", ["Get","i"], 100], [       
        ["Set","i",["Add",["Get","i"],1]],

        ["If", ["Lt", ["Get", "i"], 95], 
             ["Continue"],[]
        ],
        ["Print",["Get","i"]],
        
    ]],    
    
    ["Print",["Mul","-",40]],
    
    ["Set","i",0],
    
    ["While", ["Lt", ["Get","i"], 100], [       

        ["Set","i",["Add",["Get","i"],1]],
        
        ["If", ["Gte", ["Get", "i"], 5], 
             ["Break"],[]
        ],        
        
        ["Set","j",0],

        ["While", ["Lt", ["Get","j"], 100], [       
            ["Set","j",["Add",["Get","j"],1]],

            ["If", ["Gte", ["Get", "j"], 5], 
                ["Break"],[]
            ],
            ["Print",["Mul",["Get","i"],["Get","j"]], ","],
        
        ]],
        
        ["Print"]
        
    ]],     
]
    
interpreter=Interpreter()

interpreter.run(ast)
```
Output:
```
1
2
3
4
----------------------------------------
95
96
97
98
99
100
----------------------------------------
1,2,3,4,
2,4,6,8,
3,6,9,12,
4,8,12,16,
```
[Link](https://github.com/smadeveloper/interpreter/blob/main/interpreter07-break-continue.py) to complete code.
 

[Part 8: For loop] (https://dev.to/smadev/lets-build-a-simple-interpreter-from-scratch-in-python-pt-08-for-loop-5gpd)
A WordPress Theme with Next.js
Tags: wordpress, nextjs, javascript, react
Published: 2020-10-03 19:26:32

---
title: A WordPress Theme with Next.js
published: true
description: Leveraging the community of WordPress and the versitility of JavaScript
tags: wordpress, nextjs, javascript, react
cover_image: http://wp.shannonreca.com/wp-content/uploads/2020/10/wpnext-blog-cover.jpg
---

# Why WordPress with Next.js?

At first glance this may seem a little off from a development side of things. WordPress is it's own platform as Next.js is it's own framework, why even combine to two? There a few reasons why I decided to proceed with this project and for specific use cases. 

## Use Case Specific to React Developers
* Redesigning a current WordPress site.
* Customer/Client wants a WordPress site.
* You wish to create a web app and choose WordPress as your admin UI.
* Already built admin functionality such as: users, plugins, etc; within WordPress.

## The Pros of WPNext Builder & Next.js

With the focus of React.js as your primary choice of development, WPNext Builder alongside Next.js, essentially allows you to quickly create and deploy React components to your site. Whether is a request from a client or a need you are trying to fulfill.

This kit relies on the WordPress API to access the content information. However, since this setup includes Next.js, the call gets made on the server-side allowing the page to render no differently than a typical WordPress site. It's a JS application layered on top of WordPress. You can use WordPress to create pages and post, while building a completely standalone web app and create WordPress admin pages to manage the web app features. The possibilities are really up to you.

The beauty of it is, it's all within the theme folder and it's easy to setup. If you ever decide to move away from it, you can quickly revert back to another basic WordPress theme. Just follow the [WPNext documentation](https://github.com/RecaMedia/wpnext-boilerplate) at my GitHub to properly install and begin use. I've provided some basic components along with some "out-the-box" .jsx modules to handle navigation and site header.

## This Project Will Continue to be Maintained

As I continue to use this theme kit, I'm constantly updating and improving it in hopes of streamlining the development process for future projects. I'm also looking to provide pre-built components that can easily be dropped in to existing sites using the WPNext Theme. Finally, I'm planning on releasing a step-by-step video tutorial from start to finish to help out junior developers.

With all this being said, if you happen to use this or any of my open source projects and would like to support my work, please visit my [GitHub Sponsor](https://github.com/sponsors/RecaMedia) page. Any support is greatly appreciated and helps me reach my goal of just working on projects I enjoy.

----

Originally posted on [ShannonReca.com](http://shannonreca.com/blog/a-wordpress-theme-with-next-js/)
How do you guys remember about things ?
Published: 2020-10-03 19:09:28

---
title: How do you guys remember about things ?
published: true
description: 
tags: 
//cover_image: https://direct_url_to_image.jpg
---
In our live of developer we have a lot of things to remember, how do we did that stuff the last time ? Why i did things like this ... etc

The things is that we can't remember everything so how do you guys keep tracks of theses kind of things ?

Personally i use keyword in, then when i need to remember how i did this things i search them on a search engine.

Recently i added on my website an API which allow me to save an URL and a "title" (in fact, keyword) then this database in indexed by ElasticSearch to recover what i need quickly.

How about you guys ?
Lets build a simple interpreter from scratch in python, pt.06: While loop
Tags: interpreter, fromscratch, python
Published: 2020-10-03 19:01:37

In this post we are implementing the 'while' loop:

```python
class Interpreter:

    # ....(previous code)....

    def While(self,xs):
        _ , cond , block = xs
        while self.eval(cond):
            if isinstance(block[0],list):
                for x in block:
                    self.eval(x)
            else:
                self.eval(block)
        
code=[
    
    ["Set","sum",0],
    
    ["Set","i",0],
    
    ["While", ["Lt", ["Get","i"], 100], [
        
        ["Set","i", ["Add",["Get","i"], 1] ],
        ["Set","sum", ["Add",["Get", "sum"],["Get","i"]]]
    ]],
    
    ["Print","sum(1..100) = ",["Get","sum"] ]
]
    
interpreter=Interpreter()

interpreter.run(code)
```
Output:
```
sum(1..100) = 5050
```
Link to complete code: [part6](https://github.com/smadeveloper/interpreter/blob/main/interpreter06-while.py)
Links: [Patreon](https://www.patreon.com/user?u=43357977) [Twitter](https://twitter.com/smadev_) 

[Part 7: Break and Continue](https://dev.to/smadev/lets-build-a-simple-interpreter-from-scratch-in-python-pt-07-break-continue-4jhk)
Building a Contact Form in Nuxt + Strapi: Backend
Tags: strapi, nuxt, javascript, vue
Published: 2020-10-03 18:52:20

Now that we built [the ContactForm Component in Vue + Nuxt](https://dev.to/cwraytech/part-8-building-our-contact-form-in-nuxt-and-strapi-frontend-4e3f), we need to make sure that there is an API endpoint to submit the form data to.

That is where we can dive into the Strapi Admin panel.

For me, I decided to call the content type "Message" for storing messages sent from the contact form.

In the Strapi Admin panel, I went to the Content-Types Builder plugin and added a new Content-Type called message.

Then, I added the fields for the message:
- name (Text field type)
- email (Email field type)
- phone (Text field type)
- message (Long text field type)

For now, that is all the information needed to collect from my form, but I could always add more details later.

![Screenshot of the Message Content Type](https://dev-to-uploads.s3.amazonaws.com/i/gsfstomxtk0p2zqft3qn.jpg)
<figcaption>Here is a screenshot of the Message Content Type in the Content Type Builder Plugin panel</figcaption>

Now, the only step left to do is make sure that anyone can submit a message to that endpoint.

To do that, we need to go to the Roles & Permissions panel in Strapi, and make sure that an unauthenticated user can "create" a message.

To do that, click the pencil icon on the "Public" Role, find the message content type, and make sure that the create option is selected.

![Screenshot of the public role permission settings.](https://dev-to-uploads.s3.amazonaws.com/i/djpt5aj106gdg825838f.jpg)
<figcaption>Above you can see a screenshot of what the public permissions should look like for message.</figcaption>

**You will want to make sure that none of the other options are selected because you do not want to expose the messages submitted to your app to the public.**


That is it! Once you save your settings, your contact forms in the frontend will be able to submit to your API via a POST request to /messages.

Please note, that permissions will have to be set again in the production environment.
Lets build a simple interpreter from scratch in python, pt.05: Defining variables
Tags: interpreter, fromscratch, python
Published: 2020-10-03 18:43:18

In this post we are defining variables and using them:

```python
class Interpreter:

    # Modified constructor: scope is list of dicts
    # First dict holds global variables, 
    # Last dict holds called function's scope variables

    def __init__(self):
        self.scope=[{}]
    
    # ....(previous code).... 
   
    # When we call Set we always create or update variable
    # in last scope: 

    def Set(self,xs):
        _, key, val = xs
        self.scope[-1][key] = self.eval(val)
    
    # When we call Get we first look into last scope(function scope),
    # if variable is not found then we look into first scope(globals)    
    def Get(self,xs):
        _, var = xs
        if var in self.scope[-1]:
            return self.scope[-1][var]
        elif var in self.scope[0]:
            return self.scope[0][var]
        raise Exception("error: variable not found: "+var)


code=[
    
    ["Set","answer",  ["Mul",6, 7],  ],
    ["Print", "Answer is: ", ["Get", "answer"] ]
]
    
interpreter=Interpreter()

interpreter.run(code)
```
Output:
```
Answer is: 42
```


[Part 6: While loop](https://dev.to/smadev/lets-build-a-simple-interpreter-from-scratch-in-python-pt-06-while-loop-51nf)
Data Exploration of women education in us 
Tags: python, machinelearning, jupyter
Published: 2020-10-03 18:22:36

this article is going to be extremely short since I will show only visuals and graphs from data-set I found on Kaggle where it highlights college majors women in us tend to enrol and finish. 

I will present the top 5 college majors women in us got their degree at. 


1- Health Professions 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/1o3bgayhxnpnixpdnj5f.png)
2- Education 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/tm7df4xok1okhhkg8cjk.png)

3- public Administration 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/kg47h5juli5oqsxz8dm0.png)
4- Foreign Languages
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/l5j21tn6axn4iqygqx92.png)
5- Psychology 
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/uzbtdj24luwwb3w9wqo1.png)

The full notebook can be found here :- https://www.kaggle.com/mohanedmashaly/data-exploration