- 博客(222)
- 收藏
- 关注
转载 Fetch data from remote api / server side - full stack mern lynda.com (part 2)
app/index.jsimport express from 'express';import data from '../src/testData';const router = express.Router();router.get('/contests', (req, res) => { res.send({ contests: data.contests });...
2019-06-30 23:22:52 131
原创 【TLE与否】10123UVa不要歪——记忆化的重要性
参考了 http://www.cnblogs.com/staginner/archive/2011/12/21/2295362.html (他真是大神),然后自己写了一下。如果不用记忆化记下 行不通的状态转移路径(rest[st] == 0),就会超时!!!超时代吗:#include#include#includeconst int MAXD = 1100000;int bd
2017-09-28 17:02:23 187
原创 xml dom
https://www.w3schools.com/code/tryit.asp?filename=G7OC49VD1QII<!DOCTYPE html><html><body><div id='showCD'></div><script>displayCD(0);function displayCD...
2019-09-05 08:26:39 197
转载 Update req.user in session
I am using PassportJS with ExpressJS.I need to update the logged in user details. While I do update this in the DB, how do I update it in the session too so that request.user contains the updated us...
2019-07-31 02:05:36 237
转载 bootstrap - navbar interactive
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Com...
2019-07-19 02:01:40 236
转载 sample of .gitignore file
# Logslogs *.lognpm-debug.log*yarn-debug.log*yarn-error.log*.DS_Store# Runtime datapids*.pid*.seed*.pid.lock# Directory for instrumented libs generated by jscoverage/JSCoverlib-cov# C...
2019-07-09 09:22:44 142
转载 Using redis to implement a shopping basket
implementing basket using redisbin/www.js (so connectionis saved in config now and is globally available)#!/usr/bin/env node// Dependenciesconst http = require('http');const config = require...
2019-07-09 09:21:45 117
转载 MongoDB - name contest lynda.com
loadTestDataimport { MongoClient } from 'mongodb';import assert from 'assert';import config from './config';MongoClient.connect(config.mongodbUri, (err, db) => { assert.equal(null, err);...
2019-07-06 00:00:25 200
转载 Learning Full stack (MERN) --- lynda.com (part 1)
React to run project:npm run dev (for webpack to generate bundle.js)npm startimport React from 'react';import ReactDOM from 'react-dom';const App = (props) => { return ( &l...
2019-06-30 21:34:22 327
转载 socket.io
index.jssocket: a socket declared in client, and it's listening to client eventio: this is the server(msg from index.html to index.js, and then to index.js)const app = require('express')...
2019-06-28 23:43:03 137
转载 socket.io express (intro)
index.jsconst app = require('express')();const server = require('http').Server(app);const io = require('socket.io')(server);const port = 3000;server.listen(port, () => { console.log(`S...
2019-06-28 23:25:31 107
转载 create a server in Nodejs and express
NodejsNow let's see how to use the http module as a server.After we import it we use the create server callto create a server, no surprise there,and then use the listen method to run the servero...
2019-06-28 14:31:23 110
转载 Nodejs deployment and running in production
- [Narrator] As soon as your application is deployedto server and available to for real usersperformance becomes key, and this not only aboutthe user experience of individual users,but also cost eff...
2019-06-28 08:04:36 317
转载 Node js User authentication and file upload
bodyParserUser authenticationexpress-session:https://www.tutorialspoint.com/expressjs/expressjs_sessions.htmdocs:https://www.npmjs.com/package/express-session- [Instructor] Befo...
2019-06-28 06:56:44 210
原创 Learning projects lynda.com MERN
Ex_files_nodejs_expressjs (intro to express) Meetup app03_02Ex_files_advanced_express00_04Ex_files_databases_nodejs_dev (maxcoin & shopsy) I can't even run thisEx_fullstack_java...
2019-06-26 00:46:58 145
转载 max bitcoin value: mongoDB and request
// request is a module that makes http calls easierconst request = require('request');const MongoClient = require('mongodb').MongoClient;const dsn = "mongodb://192.168.99.100:37017";// Generic f...
2019-06-24 23:03:09 154
转载 MongoDB shell API vs MongoDB Nodejs driver API
insertOne as an example:shell: (Look under 'server' section)TheinsertOne()method has the following syntax:db.collection.insertOne( <document>, { writeConcern: <document&g...
2019-06-24 13:44:29 241
转载 Docker - get started
ref:https://docs.docker.com/machine/get-started/[Narrator] To get started with MongoDB,we first have to use Docker to downloadand run a container for it.Make sure that your Docker dae...
2019-06-23 08:24:52 434
转载 export default
This works:import {bar} from './foo';bar();// foo.jsmodule.exports = { bar() {}}And this works:import foo from './foo';foo.bar();// foo.jsexport default { bar() {}}So why doesn't...
2019-06-23 07:53:33 817
转载 Update dependency in package.json (Shopsy from lynda.com)
https://stackoverflow.com/questions/16073603/how-do-i-update-each-dependency-in-package-json-to-the-latest-versionnpm i -g npm-check-updatesncu -unpm installalso notice the change in "start...
2019-06-22 22:00:56 191
转载 MongoDB NodeJS (newer) (connect gets client containing db)
According to thechangelogfor 3.0 you now get a client object containing the database object instead:MongoClient.connect('mongodb://localhost:27017', (err, client) => { // Client returned...
2019-06-21 12:29:58 123
转载 MongoDB and NodeJS (some parts deprecated)
https://www.w3schools.com/nodejs/nodejs_mongodb.aspdbo.collection("tours").insertOne(myobj, callback) vsdb.collection("tours").insertOne(myobj, callback) [notice: url has database name or not)...
2019-06-21 02:21:18 125
转载 http PUT vs POST
https://restfulapi.net/rest-put-vs-post/REST – PUT vs POSTIt has been observed that many people struggle to choose betweenHTTP PUT vs POSTmethods when designing a system. Though,RFC 2616has...
2019-06-20 21:34:08 244
转载 MongoDB command line !!
(1) explore mongo shellmongodanother terminal: mongo>db>use learning_mongo // use learning_mongo as db>show dbs>db.cars.insert({"make": "subaru"}) // cars is collection, {"m...
2019-06-19 12:37:34 340
转载 MongoDB installation
-------------------------------------------------------------------------------------------------------------------------------------------------------------need node.jsthe following ...
2019-06-19 10:37:12 116
转载 Node js and express -- express generator
npm install -g --depth 0npm install -g express-generatorexpress -hexpress testprojectnpm installnpm startapp.js -- server/index.jslook at the routes folder-----------------------...
2019-06-19 06:57:28 119
转载 JS export modules - official docs + tut
express.RouterUse theexpress.Routerclass to create modular, mountable route handlers. ARouterinstance is a complete middleware and routing system; for this reason, it is often referred to as a “...
2019-06-18 20:24:24 152
转载 JDBC App learning by ex 2
public void writeProperties() throws IOException { Properties prop = new Properties(); prop.setProperty("dbUrl", "localhost"); prop.setProperty("dbUser", "username"); prop.setProperty("d...
2019-06-16 15:53:52 231
转载 Java Learning java by example lynda.com CML application
regexcollectionpublic<T>T[]toArray(T[]a)Parameters:a- the array into which the elements of the list are to be stored, if it is big enough; otherwise, a new array of the same r...
2019-06-16 13:23:27 550
转载 Django
For now, we'll look at the role of each of theseas an overview and we'll deepenour understanding as needed later.First, the apps file controls settings specific to this app.The models file ...
2019-06-12 05:31:21 446
转载 Express and node.js
npm install -g npm@latest- [Instructor] Differently than with other web languages,like for instance PHP that runs as a module in Apache,Node.js comes with a web server built in.So Express is...
2019-06-11 03:45:52 316
转载 Git - remove pushed file
If you deleted a file from the working tree, then commit the deletion:git commit -a -m "A file was deleted"And push your commit upstream:git push
2019-06-07 23:32:43 243
转载 Difference between “module.exports” and “exports” in the CommonJs Module System
moduleis a plain JavaScript object with anexportsproperty.exportsis a plain JavaScript variable that happens to be set tomodule.exports. At the end of your file, node.js will basically 'return'...
2019-06-07 03:17:38 128
原创 Learning full-stack Javascript MongoDB, react and node
Arrow func thisnode - index.jsexports.i = 'am exports'console.log(this); // {i: 'am exports'}let util = { f1: function() { console.log(this); }, f2: () => { ...
2019-06-07 02:15:31 152
转载 React
npm -install -g create-react-appnpm startLook at 02_03 for exercise back thenwhen you got a folder with package.json but without not json, run npm install to install dependency...
2019-06-05 05:36:53 124
转载 ECMAScript 6 - syntax
Let and alternative solution (nice example)<!DOCTYPE html><html><head> <style> section > div { height: 100px; width: 100px; background-color: red; float:...
2019-06-03 20:57:51 190
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人