This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project xmlns="http://maven.apache.org/POM/4.0.0" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.javaxp</groupId> | |
<artifactId>TestExport</artifactId> | |
<packaging>jar</packaging> | |
<version>1.0-SNAPSHOT</version> | |
<name>TestExport</name> | |
<url>http://maven.apache.org</url> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xlsxwriter | |
import mysql.connector | |
def fetch_table_data(table_name): | |
# The connect() constructor creates a connection to the MySQL server and returns a MySQLConnection object. | |
cnx = mysql.connector.connect( | |
host='localhost', | |
database='schema', | |
user='user', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mysql.connector | |
# The connect() constructor creates a connection to the MySQL server and returns a MySQLConnection object. | |
cnx = mysql.connector.connect( | |
host="localhost", | |
database="schema", | |
user="root", | |
password="password" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.javaxp</groupId> | |
<artifactId>project-name</artifactId> | |
<packaging>jar</packaging> | |
<version>1.0-SNAPSHOT</version> | |
<name>project-name</name> | |
<url>http://maven.apache.org</url> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def write_file(): | |
print("Writing a file..") | |
try: | |
f = open("my_file.txt", "a") | |
for num in range(100): | |
f.write("Line " + str(num) + "\n") | |
f.close() | |
except Exception: | |
print("Could not write to file") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import App from './App'; | |
import * as serviceWorker from './serviceWorker'; | |
import {Provider} from 'react-redux'; | |
import AppStore from "./AppStore"; | |
ReactDOM.render(<Provider store={AppStore}><App/></Provider>, document.getElementById('root')); | |
serviceWorker.unregister(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {createStore, applyMiddleware} from 'redux'; | |
import AppReducer from "./AppReducer"; | |
import thunk from 'redux-thunk'; | |
const AppStore = configureStore(); | |
function configureStore() { | |
return createStore(AppReducer, applyMiddleware(thunk)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const initialState = { | |
name: '', | |
response: '' | |
}; | |
export default function AppReducer(state = initialState, action) { | |
const newState = Object.assign({}, state); | |
switch (action.type) { | |
case 'UPDATE_NAME': | |
newState.name = action.name; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios'; | |
class AppApi { | |
static sayHello(name) { | |
return new Promise((resolve, reject) => { | |
const url = 'http://localhost:8080/sayhello'; | |
axios.get(url, { params: { name: name } }).then(response => { | |
console.log(response); | |
resolve(response.data); | |
}).catch(error => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import AppApi from './AppApi'; | |
export function updateName(name) { | |
return { type: 'UPDATE_NAME', name }; | |
} | |
function loadResponse(response) { | |
return { type: 'LOAD_RESPONSE', response }; | |
} |