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
| export const exportStudents = async (req, res, next) => { | |
| const createCsvWriter = require('csv-writer').createObjectCsvWriter; | |
| const studentRepository = AppDataSource.getRepository(Student); | |
| const students = await studentRepository.find(); | |
| const csvWriter = createCsvWriter({ | |
| path: 'out.csv', | |
| header: [ | |
| {id: 'id', title: 'id'}, | |
| {id: 'name', title: 'name'}, | |
| {id: 'birthday', title: 'birthday'}, |
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
| export const addStudent = async (req, res, next) => { | |
| const form = formidable({}); | |
| form.parse(req, async (err, fields, files) => { | |
| if (err) { | |
| next(err); | |
| return; | |
| } | |
| const newStudent = new Student() | |
| newStudent.name = fields.name | |
| newStudent.birthday = fields.birthday |
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
| diff --git a/node_modules/react-native/Libraries/Image/RCTUIImageViewAnimated.m b/node_modules/react-native/Libraries/Image/RCTUIImageViewAnimated.m | |
| index 21f1a06..2444713 100644 | |
| --- a/node_modules/react-native/Libraries/Image/RCTUIImageViewAnimated.m | |
| +++ b/node_modules/react-native/Libraries/Image/RCTUIImageViewAnimated.m | |
| @@ -272,6 +272,9 @@ - (void)displayDidRefresh:(CADisplayLink *)displayLink | |
| - (void)displayLayer:(CALayer *)layer | |
| { | |
| + if (!_currentFrame) { | |
| + _currentFrame = self.image; |
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 ws = require('ws'); | |
| const client = new ws('ws://localhost:81'); | |
| client.on('open', () => { | |
| // Causes the server to print "Hello" | |
| console.log('connection opened') | |
| client.send('Hello'); | |
| }); |
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
| // CHECKING LATENCY OR SPEED OF POST REQUEST TO SERVER | |
| const axiosTiming = (instance) => { | |
| instance.interceptors.request.use((request) => { | |
| request.ts = Date.now(); | |
| return request; | |
| }); | |
| instance.interceptors.response.use((response) => { | |
| const timeInMs = `${Number(Date.now() - response.config.ts).toFixed()}ms`; | |
| response.latency = timeInMs; | |
| return response; |
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
| BufferedImage img = ImageIO.read(new URL("https://upload.wikimedia.org/wikipedia/commons/thumb/d/d3/Microsoft_Account.svg/1024px-Microsoft_Account.svg.png")); |
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
| from PyPDF2 import PdfFileReader, PdfFileWriter | |
| from PyPDF2.pdf import PageObject | |
| writer = PdfFileWriter() | |
| reader = PdfFileReader(open("1.2.1.13 Lab - Research Computer Components.pdf",'rb')) | |
| for i in range(3): | |
| page = reader.getPage(i) | |
| writer.addPage(page) | |
| sup_reader = PdfFileReader(open("Week1_Introduction to Machine Learning and Toolkit.pdf",'rb')) |
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
| """ | |
| These codes demonstrate an implementation of a class-based python sql controller object | |
| Note: You need to have a MySQL Server installed either the stand-alone MySQL Server or through XAMPP to test these programs | |
| You also need to run pip install pymysql if you don't have the module installed yet | |
| There is no error handling in this sample. | |
| """ | |
| from pymysql_sqlcontroller import * | |
| controller = SQLController(host="localhost",port=3306,db="mydb",user="root",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
| """ | |
| These codes demonstrate how to perform a simple INSERT SQL Command on a Python program using PyMySQL | |
| Note: You need to have a MySQL Server installed either the stand-alone MySQL Server or through XAMPP to test these programs | |
| You also need to run pip install pymysql if you don't have the module installed yet | |
| """ | |
| import pymysql | |
| # Connection | |
| conn = pymysql.connect(host="localhost",port=3306,db="mydb",user="root",password="") | |
| print("Connection established sucessfully") |
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
| """ | |
| These codes demonstrate how to perform a simple UPDATE/DELETE SQL Command on a Python program using PyMySQL | |
| Note: You need to have a MySQL Server installed either the stand-alone MySQL Server or through XAMPP to test these programs | |
| You also need to run pip install pymysql if you don't have the module installed yet | |
| """ | |
| import pymysql | |
| # Connection | |
| conn = pymysql.connect(host="localhost",port=3306,db="mydb",user="root",password="") | |
| print("Connection established sucessfully") |
NewerOlder