- 博客(34)
- 问答 (1)
- 收藏
- 关注
原创 如何在nginx下部署vue 项目
vim /etc/nginx/nginx.conf server { root /home/xxxx/home/; location /home { try_files $uri $uri/ @router; index index.html; } lo...
2020-04-14 20:35:06
255
原创 一个JAVA的链表
public class ListNode { public int e; public ListNode next; private ListNode head; public ListNode(int e, ListNode next) { head = this; this.e = e; this.next = next; } public ListNod...
2020-02-14 18:28:41
180
原创 JS队列的一种实现方式
class LoopQueue { constructor(capacity) { this.data = []; this.data.length = capacity; this.front = 0; this.tail = 0; this.size = 0; } getSize() {...
2020-01-25 19:31:00
209
原创 Javascript数组
class Array { constructor() { this.data = []; } //数组是否为空 isEmpty() { return this.data.length == 0; } //获得数组元素的个数 getSize() { return this.data.lengt...
2020-01-24 19:27:08
108
原创 二分搜索树
package com.sun.refect;import java.util.LinkedList;import java.util.Queue;/** * @author sun 二分搜索樹 * @param <E> */public class BST<E extends Comparable<E>> { private class ...
2019-12-30 14:13:33
93
原创 JS 策略模式
class A{ buy(){ console.log("Buy A") }}class B{ buy(){ console.log("Buy B") }}class C{ buy(){ console.log("Buy C") }}const a = new A();a.buy()...
2019-11-27 14:30:56
117
原创 JS 桥接模式
class Color{ constructor(name){ this.name = name }}class Shape{ constructor(name,color){ this.name = name this.color = color } draw(){ console.l...
2019-11-27 14:19:47
190
原创 JS 原型模式
const prototype = { getName(){ return this.first+ ' - '+this.last; }, say(){ console.log('hello') }}const x = Object.create(prototype)x.first = "张三"x.last = "李四"...
2019-11-27 14:13:00
176
原创 Java 链表删除某一元素
package com.linkedlist;public class ListNode { public int val; public ListNode next; public ListNode(int x) { val = x; } public ListNode(int[] arr){ ...
2019-11-26 15:16:26
545
原创 Java 链表
package com.linkedlist;public class LinkedList<E> { private class Node{ public E e; public Node next; public Node(E e,Node next){ this.e = e; this.next = next; } public ...
2019-11-25 15:41:42
88
原创 Java 线程安全发布对象
package com.singleton;/** * @author sun * 懒汉模式 * 非线程安全 */public class SingletonExample { private SingletonExample(){ } private static SingletonExample instance = null; public static S...
2019-11-25 08:55:13
129
原创 Java 线程安全性
原子性 可见性 有序性package com.atomic;import java.util.concurrent.CountDownLatch;import java.util.concurrent.ExecutorService;import java.util.concurrent.Executors;import java.util.concurrent.Semaphore...
2019-11-24 19:47:23
97
原创 Java 队列 循环队列
package com.queue;/** * 动态数组 * @param <E> */public class Array<E> { private E[] data; private int size; // 构造函数,传入数组的容量capacity构造Array public Array(int capacity){ ...
2019-11-24 10:34:45
144
原创 Java 栈的实现
package com.stack;public class Array<E> { private E[] data; private int size; // 构造函数,传入数组的容量capacity构造Array public Array(int capacity){ data = (E[])new Object[capaci...
2019-11-23 17:33:36
138
原创 JS状态模式
class State{ constructor(color){ this.color = color } handle(context){ console.log(`turn to ${this.color} light`) context.setState(this) }}class Context{ ...
2019-11-23 10:22:47
156
原创 JS观察者模式与NodeJS自定义事件
class Subject{ constructor(){ this.state = 0; this.observers = []; } setState(state){ this.state = state; this.notifyAllObservers(); } getState(){...
2019-11-23 09:03:30
180
原创 JS观察者模式
class Subject{ constructor(){ this.state = 0 this.observers = [] } getState(){ return this.state } setState(state){ this.state = state this...
2019-11-22 09:31:03
86
原创 JS代理模式
class ReadImg{ constructor(fileName){ this.fileName = fileName this.loadFromDisk() } display(){ console.log("display..............."+this.fileName) } loadF...
2019-11-21 11:35:42
90
原创 Android Handler的使用
package com.example.handler_01;import androidx.appcompat.app.AppCompatActivity;import android.os.Bundle;import android.os.Handler;import android.widget.TextView;public class MainActivity exte...
2019-11-20 11:22:33
202
原创 JS适配器模式
class Adaptee{ specificRequest(){ return "德国标准插头" }}class Target{ constructor(){ this.adaptee = new Adaptee() } request(){ let info = this.adaptee.speci...
2019-11-20 09:11:17
90
原创 JS单例模式
class SingleObject{ constructor(){ this.name = "sun" } login(){ console.log('login............') } setName(name){ this.name = name } getName(){ ...
2019-11-20 08:39:37
84
原创 JS工厂模式的例子
class Person{ constructor(name,age){ this.name = name; this.age = age; } eat(){ console.log(`I am ${this.name} eat `) } speak(){ console.log(`My nam...
2019-11-19 10:05:30
166
原创 使用Java8的javascript引擎
import java.io.File;import java.io.FileNotFoundException;import java.io.FileReader;import javax.script.Invocable;import javax.script.ScriptEngine;import javax.script.ScriptEngineManager;import jav
2017-09-29 19:05:04
475
原创 因式分解
public class Test { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int number = sc.nextInt(); int n = 2; int Indexes = 0; while
2017-09-07 20:59:02
440
原创 Python MySQLdb
#-*- coding:utf-8 -*-'''Created on 2017年9月6日@author: Administrator'''import MySQLdbconn=MySQLdb.connect(host="localhost",user="root",passwd="root",db="mydb",charset="utf8")# sql = "create table Per
2017-09-06 16:59:04
143
原创 GoTo 递归
#include <stdio.h>#include <string.h>void ListFile(){ int a = 10; goto cc; cc: a=a-1; printf("a=%d,已经减一\r\n",a); if(a>0){ goto cc; }}int main()
2017-09-03 20:28:39
412
原创 Python抽象工厂模式实现
# -*- coding:utf-8 -*-'''Created on 2017.9.3@author: dell'''#注意 python动态的语言 类的属性不一定的被实例所共享 class Item(object): caption = '' def __init__(self,caption): print "Item caption "+cap
2017-09-03 20:06:56
369
原创 python知识点
def prints_params(*params): print params# prints_params('Test!')# prints_params(1,2,3,4,5,6,7)def prints_params2(title,*params): print title print params# prints_params2("Params: ",1,2,3,
2017-07-03 02:39:08
126
原创 struts2自定义类型转换器
前台jsp页面<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%> <%@ taglib uri="/struts-tags" prefix="s"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitiona
2017-07-02 22:12:46
191
原创 Java8函数式编程
package example;import java.awt.Event;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.util.EventListener;import java.util.function.BinaryOperator;import javax.swi
2017-07-02 17:16:27
378
1
原创 FlyWeight模式
public interface Shape { void draw();}public class Circle implements Shape { private String color; private int x; private int y; private int radius; public Circle(String color)
2017-05-25 12:38:38
202
原创 Java工厂模式
定义一个创建对象的接口public interface Shape { void draw();}子类实现接口public class Rectangle implements Shape{ @Override public void draw() { System.out.println("Inside Rectangle :: Draw()");
2017-05-24 13:52:26
262
原创 欢迎使用优快云-markdown编辑器
BootStrap代码: <!-- <code></code> 表示内联的方式的显示 就是以一整行的方式显示--> <!-- 例子 <代表"<" >代表">" --> <p> <code> <html> <head> </head
2017-05-24 13:21:24
205
原创 JavaScript变量对象的深入
什么是变量对象 变量对象是执行的上下文相关的作用域的对象先引出第一个关键词全局对象全局对象是预定义对象 通过全局对象可以访问其他所有的预定义对象的函数,属性。在顶层的Javascript中可以使用的this关键字我们可以看到this 的全局对象的是windowthis 是全局对象的但也是Object实例化的一个对象可以看到this是顶层对象 还可以做例子:
2017-05-24 13:05:12
170
空空如也
js中 ()=>{} 是什么写法
2017-11-12
TA创建的收藏夹 TA关注的收藏夹
TA关注的人