三味的小站

PGSQL COPY命令导入/导出数据

PGSQL中可使用COPY命令来导入/导出数据,这里以CSV文件为例。 导出数据 SQL Shell执行: COPY table_name (col1,col2,col3) TO 'path_name.csv' CSV HEADER; 如果表格使用了分表,需使用select获取数据: COPY (s

三味线 Published on 2020-05-14

Python发送邮件

#!/usr/bin/python # -*- coding: UTF-8 -*- import smtplib from email.mime.text import MIMEText from email.header import Header # 第三方 SMTP 服务 mail_host

三味线 Published on 2020-04-27

js forEach中的continue,break

Lodash 中的 forEach 函数 var array = ["a", "b", "c", "d"]; _.forEach(array, function (item) { if (item == "a") { return true; // continue

三味线 Published on 2020-03-27

js中写文件到远程共享文件夹(SmbFile|net use|mount.cifs)

重构代码时遇到的问题,原Java代码用的SmbFile及相关库,现在要改在js中实现; 1. Windows下可以使用net use命令 net use <local_dir> <remote_dir> <password> /user:<username> net use Z: \\10.3.3

三味线 Published on 2020-02-09

PGSQL UPSERT使用

PG 9.5开始支持的特性,根据约束,存在则更新,不存在则插入; 使用某字段约束: INSERT INTO distributors (did, dname) VALUES (8, 'Anvil Distribution') ON CONFLICT (did) DO UPDATE SET dname

三味线 Published on 2020-01-14

CentOS连接Sql Server 驱动安装

一、使用微软的 Microsoft ODBC Driver for SQL Server sudo su #Download appropriate package for the OS version #Choose only ONE of the following, corresponding

三味线 Published on 2020-01-03

js 字符串作为函数运行

1. new Function var test = new Function("(function(){console.log('hello!')})()"); 会在外面再包一层函数,获取不到返回值: 2. eval var test = eval("(

三味线 Published on 2019-08-05

QTableView文字换行

使用QStyledItemDelegate代理手动绘制文字 #ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QStyledItemDelegate> class QTableView; clas

三味线 Published on 2019-07-17

Qt Debug重定向到文本控件

Qt中可以将qDebug()输出的信息重定向通过窗口控件输出; 定义一个MsgHandlerWapper类用于转接消息: // msghandlerwapper.h #ifndef MSGHANDLERWAPPER_H #define MSGHANDLERWAPPER_H #include <QtC

三味线 Published on 2019-06-24

QGraphicsItem中添加控件

1. 直接添加到Scene QGraphicsScene *scene = new QGraphicsScene; QLineEdit *lineEdit = new QLineEdit("Hello"); QGraphicsProxyWidget *proxy = scene->AddWidget

三味线 Published on 2019-06-20
Previous Next