Web 开发者


Hello,我是邵壮 (Encore Shao), 一个 Ruby 开发者.
我们使用 Ruby on Rails 来构建Web应用程序!

Encore's Blog

Web 开发者 | 专注于WEB应用程序的软件开发人员
轻量实惠型VPS推荐 (Vultr)
服务器 2021-10-04 邵壮

VPS  - VULTR如果你也在苦苦寻找一个稳定且便宜的私有云服务器,我强烈推荐你使用 Vultr。从价格来讲,它和其他私有服务器一样,最低每个月5美元,但是它稳定性来我觉得是最好的。本人使用5年之久,0宕机!如果你在中国,我个人选择的东京机房,延迟可以减少到100以内,是一个不错的选择。在过去几年,他们也在全球设置了多个新的数据中心,应该会满足您在亚洲,欧洲的业务需求。且最新他们也在大力推广,通过已有用户的推荐链接注册即可获得100美元的优惠券,也就意味着你可以免费使用2年。看着就开心。如果你也心动了,可以点击这里  →  VULTR 进行注册。

Puppeteer - The easiest way to scrape websites with Puppeteer
开发 2021-09-21 Encore Shao

Puppeteer is a NodeJS library that gives us control over headless Chrome APIs. with Puppeteer, it is much easier to automate UI tests of your website.Simple to create a new js script (website.js) will easily way to scrape all websites by the puppeteer. const puppeteer = require("puppeteer"); // we're using async/await - so we need an async function, that we can run const scrape = async () =...

How to Use SSH Tunnel to connect remote database in Terminal
工作 2021-02-25 Encore Shao

use SSH Tunnel to connect remote database in PostgreSQLDue to special circumstances, we cannot open the DB port of the remote server. so we can only use SSH to do port forwarding to access the database. However, you can use some graphical interface tools, the principle is the same. Here, I will introduce how to use the terminal link. 1. Create the corresponding SSH configuration file ~/ssh.conf...

CrunchBase - A ruby wrapper for API v4
编码 2020-06-26 Encore Shao

crunchbase4  is a ruby wrapper based on Crunchbase version 4 API, which provides easy to get the API data by each endpoint. CrunchBase v4 documentMost of the time, CrunchBase site APIs will update their API endpoints and data structures every few years. I built CrunchBase V2, CrunchBase V3 before, For now, for our business, I need to rebuild the ruby wrapper for CrunchBase v4.I want to introduc...

PostgreSQL 10 Master-Slave Replication on Virtualbox
数据库 2020-05-30 Encore Shao

PostgreSQL 10 Master-Slave Replication on VirtualboxPreparationsNeeds to download tools[Virtualbox](https://www.virtualbox.org/)[Vagrant](https://www.vagrantup.com/)Discover Vagrant Boxes - Linux[Ubuntu 18.04.4 LTS](https://app.vagrantup.com/boxes/search)Two Vagrant boxesMaster IP:  192.168.33.11  –  read/writeSlave IP:   192.168.33.22   –  read-onlyPostgres Master ConfigurationDownload and ins...

URL Crawler - How to use BeautifulSoup to crawler the extra URLs
开发 2020-02-21 Encore Shao

Program: PythonPackage:  BeautifulSoupRecently, our client has requirements for collecting social ids from their public page. But, for me, I used Ruby as a default program a few years,  So I take some days to learned python and write a simple script to this. from bs4 import BeautifulSoup as soup  # HTML data structure from urllib.request import urlopen as uReq # Web client import re def ge...

Rails - Get "Unknown primary key for table" in PostgresSQL
开发 2020-02-20 Encore Shao

Error: ActiveRecord::UnknownPrimaryKey (Unknown primary key for table sources in model Source.)如何排查解决主键丢失问题问题的起因,是我们最近将生产服务器的数据导入本地数据库后,在Rails应用中做一些修改时得到的这个错误 (Unknown primary key for table)。个人猜测,主要是因为当在导入的时候,有人连接到数据库有所操作导致的。接下来,我们来看看如何排查和修复这个问题。1. 确认哪些表存在这样的情况,你可以使用下面的 SQL Query 得到丢失主键的表SELECT tab.table_schema,   tab.table_name FROM information_schema.tables tab   LEFT JOIN information_sche...

PostgreSQL - 在PSQL中友好的显示JSON原始数据
数据库 2020-02-07 邵壮

- PostgreSQL 11 - JSONB- Function: jsonb_pretty自从 PostgreSQL 9.4 开始,添加新的数据类型JSON Types. 对于传统的关系型数据库而言,可以支持以文档性存贮数据简直是太棒了。 这也就意味着我们不需要再借助其它文档行数据库来存贮这部分数据了。首先,让我来看看在PostgreSQL中jsonb类型的的数据是什么样子的。Table: bookscolumns: book_id: integer data: jsonb(encore@[local]:5432) [pg10] > select * from books;  book_id |                                                                       data ---------+---...

标签: PostgreSQL JSONB
Server - 在Ubuntu中将两个小的NVMe盘合并成一个盘
服务器 2020-01-24 邵壮

系统:Ubuntu 18.04数据库: PostgreSQL现状:生产服务数据大小为:1.9T本地数据库磁盘大小为:2T目标:可以将最新的备份数据导入本地数据库。然而我们有一个1T的NVMe的硬盘,所以,我们决定将两个硬盘然后合成一个盘。具体操作如下:Add DriveLVMrebootupgraderestore1. 关机插入硬盘, 开机后使用fdisk,可以查看硬盘分区,得到新插入硬盘的名称$ sudo fdisk -l /dev/nvme1n1 2. 卸载旧的数据盘sudo umonut /data3. 删除以前挂载的数据盘, 编辑: /etc/fstab- UUID=054333e6-c323-4faf-a54c-933d0cf83614 /data ext4 defaults 0 24. 删除分区 /dev/nvme0n1sudo fdisk /dev/nvme1n1...

标签: Linux Ubuntu
Javascript - 使用Async Functions实现一个简单的计时器
编码 2018-12-01 邵壮

ASYNC FUNCTIONasync function 声明用于定义一个返回 AsyncFunction 对象的异步函数。异步函数是指通过事件循环异步执行的函数,它会通过一个隐式的 Promise 返回其结果。但是如果你的代码使用了异步函数,它的语法和结构会更像是标准的同步函数。接下来,我们使用 Javascript 来实现一个简单的计时器:// Your browser must support async/await and speech synthesis var countdown, say, sleep; sleep = function(ms) {   return new Promise(function(resolve) {     return window.setTimeout(resolve, ms);   }); }; output...

标签: Javascript Coffee
This website uses cookies to ensure you get the best experience on our website.
Got it!