Peiyuan Qi

To Infinity and Beyond

  • Home
  • Blog
  • Topic
  • Story
  • Tech
Archive Find More

Peiyuan Qi

To Infinity and Beyond

  • Home
  • Blog
  • Topic
  • Story
  • Tech

Understand backlog Argument in listen() Command of Linux

2017-04-25

In linux system, backlog specify the accepted queue size (the number of established status packets). If the accepted queue is full, further SYN RECEIVED packets will be ignored. If you are using TCP, then TCP will simply resend this packet, for the sender does not receive ACK. But for UDP, you will deal with it in another way.

For further reading, here is a good blog post.

  • backlog
  • Network
  • socket
  • Tech

VIEW THE POST >>

How to Mask Multiple Keys in Swift 3

2017-04-19

When you need to use CGEvent to create Quartz Event to mimic keyboard input for your macOS program, if you need to mimic the function of shift, control, command, option, then you need to set flag for CGEvent instance’s flag property. Meanwhile, if you want to set more than one flag, then you should or the rawvalue of flag together.

The example is shown here:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
let opt1d = CGEvent(keyboardEventSource: src, virtualKey: kVK_Option), keyDown: true)
let opt1u = CGEvent(keyboardEventSource: src, virtualKey: kVK_Option), keyDown: false)
let opt2d = CGEvent(keyboardEventSource: src, virtualKey: kVK_Command), keyDown: true)
let opt2u = CGEvent(keyboardEventSource: src, virtualKey: kVK_Command), keyDown: false)
let opt3d = CGEvent(keyboardEventSource: src, virtualKey: kVK_ANSI_D), keyDown: true)
let opt3u = CGEvent(keyboardEventSource: src, virtualKey: kVK_ANSI_D), keyDown: false)

var flagRaw : UInt64 = 0

switch keys[0] {
case "kVK_Command":
flagRaw = CGEventFlags.maskCommand.rawValue
case "kVK_Shift":
flagRaw = CGEventFlags.maskShift.rawValue
case "kVK_Control":
flagRaw = CGEventFlags.maskControl.rawValue
case "kVK_Option":
flagRaw = CGEventFlags.maskAlternate.rawValue
default:
break
}
switch keys[1] {
case "kVK_Command":
opt3d?.flags = CGEventFlags(rawValue: CGEventFlags.maskCommand.rawValue | flagRaw)
case "kVK_Shift":
opt3d?.flags = CGEventFlags(rawValue: CGEventFlags.maskShift.rawValue | flagRaw)
case "kVK_Control":
opt3d?.flags = CGEventFlags(rawValue: CGEventFlags.maskControl.rawValue | flagRaw)
case "kVK_Option":
opt3d?.flags = CGEventFlags(rawValue: CGEventFlags.maskAlternate.rawValue | flagRaw)
default:
break
}

opt1d?.post(tap: loc)
opt2d?.post(tap: loc)
opt3d?.post(tap: loc)
opt3u?.post(tap: loc)
opt2u?.post(tap: loc)
opt1u?.post(tap: loc)
  • iOS
  • macOS
  • swift3
  • Tech

VIEW THE POST >>

How to Use MultipeerConnectivity Framework

2017-04-11

Here is a great tutorial about how to establish the connection using MultipeerConnectivity framwork. Updated in 2017.2

https://www.ralfebert.de/tutorials/ios-swift-multipeer-connectivity/

  • iOS
  • MultipeerConnectivity
  • Swift
  • Tech

VIEW THE POST >>

”当好人袖手旁观时,邪恶就会胜利“

2015-12-04

近来看了一本亚马逊的网播剧,The Man in the High Castle,想来也是高考以后除了GOT看的唯一一本美剧了,为其质量感叹的同时也决定为其做一个小评。额评论也称不上,毕竟是没有看过萝卜忑之卖基的故事,不过这书中文版已然买了许久让其积灰多月,自然也应该让我沾了些许评论的灵气吧。。 more >>

  • Humanity
  • Movies
  • Sci-Fi
  • Society
  • Topic

VIEW THE POST >>

We Are Still Pioneers

2015-08-14

2014.11

2015.10.16 Updated

在Discrete考试之前又温习了一遍。。

感觉最害怕的还是那种大家都放弃了的感觉。电影的设定背景其实离现在很远,但是经历科技爆炸之后,人们却迎来了科技退步,于是八十年代美国乡村风光让人感到一种就在现在的亲切感。。更是令人感到害怕。

有的时候明知道要失败,那是否还要继续斗争下去,还是go gentle into that night呢? more >>

  • Movies
  • Interstellar
  • Topic

VIEW THE POST >>

How to Set WordPress on Your Own VPS

2015-08-12

 

Since this is my first post, so I would like to write something for WordPress.

First, I assume you have an ubuntu 14.04 on your vps.

Then under the guideline in Initial Server Setup with Ubuntu 14.04 and then the guideline in How To Install Linux, Apache, MySQL, PHP (LAMP) stack on Ubuntu 14.04 and then How To Install Wordpress on Ubuntu 14.04.

Quite easy right?

But you may find that you cannot update or download things on WordPress.

So second you need to change the permission of your web server:

sudo chown -R www-data:www-data your-wordpress-directory

and then you can do anything you want on WordPress!

 

However, your friends might complain that they cannot receive the registration email from your blog. The reason is that you do not set the mail server on your VPS.

Here is an easy way for you to send registration emails from your VPS without doing some tedious things if you just want your WordPress can send out emails.

Just Go To Plugins and add a SMTP setting plugin. QUITE EASY RIGHT?

For the recommendation, I use Configure SMTP right now.

 

P.S. if you do not want the link of the WordPress be directly your IP, then you can create sub-folder under the initial folder (for me it is /var/www/html)

  • WordPress
  • Tech

VIEW THE POST >>

« Prev1…678
© 2021 Peiyuan Qi
Hexo Theme Yilia by Litten
  • Archive
  • Find More

tag:

  • 想法
  • 年度总结
  • 年度展望
  • Data Structure
  • Algorithm
  • Design Patterns
  • Computer Architecture
  • Computer System
  • Literature Notes
  • Computer Graphics
  • gRPC
  • AWS EKS
  • JOS
  • OS
  • Git
  • Submodule
  • Hackthon
  • Datathon
  • iOS
  • macOS
  • swift3
  • WordPress
  • Objective Oriented
  • perl
  • perl module
  • Programming
  • MultipeerConnectivity
  • Swift
  • Java
  • Interview
  • Open Source Mano
  • Google Cloud
  • Tutorial
  • PAKE
  • passwords
  • DBA
  • Percona
  • Tail Latency
  • Quotation
  • Humanity
  • History
  • The Italian Wars
  • backlog
  • Network
  • socket
  • 大学
  • VPS
  • Internet
  • Movies
  • Sci-Fi
  • Society
  • Spain
  • 微信
  • 公众号
  • 场景描写
  • 架空世界
  • 加州
  • 枪法
  • 组装AR
  • Play
  • Writing Practice
  • 读书笔记
  • 联邦党人文集
  • Flash Fiction
  • Alternate History
  • 杂谈
  • 实习
  • 职业
  • Scene
  • 感悟
  • 时事
  • 共情
  • 政治
  • 科研
  • 时代
  • 人物
  • 呓语
  • 舆论
  • 契约
  • 道德
  • 合同
  • 找工作
  • Interstellar
  • cpp
  • Programing Language
  • Belief Propagation
  • Distributed Systems

    缺失模块。
    1、请确保node版本大于6.2
    2、在博客根目录(注意不是yilia根目录)执行以下命令:
    npm i hexo-generator-json-content --save

    3、在根目录_config.yml里添加配置:

      jsonContent:
        meta: false
        pages: false
        posts:
          title: true
          date: true
          path: true
          text: false
          raw: false
          content: false
          slug: false
          updated: false
          comments: false
          link: false
          permalink: false
          excerpt: false
          categories: false
          tags: true
    

  • Subscribe Newsletters
  • Ticco's Website
  • Eugen's Website
  • WYM's Website
  • Ouyu's Website
  • Tripack's Blog
  • Nathan's Website
  • Walden's Blog
  • Wenxian's Blog
  • Alex's Website
  • Magry's Blog