使用泛域名解析和Laravel路由实现用户自定义子域名

前段时间看到有人给简书提供的建议里有一条是希望简书能够提供用户自定义子域名功能。作为一个攻城狮,自然就开始想到自己能够怎么实现这个功能,于是马上联想到了“泛域名解析”功能。再加上之前录制《Laravel 入门之路由》这门课程的时候,提到过的子域名路由这个功能,马上就想到了针对用户自定义域名的解决方案。

阅读剩余部分 -

Peterson算法中turn(will_wait)变量的作用

最近在操作系统上学习了Peterson算法,其使用了3个变量就实现了纯软件的线程同步,即两个线程的标记变量c1, c2以及一个turn变量。
但是对于其为什么要使用第三个变量还不是很了解,今天特意研究了一下,终于发现了第三个变量的作用。


阅读剩余部分 -

PAT 1052 Linked List Sorting (25)

题目要求

A linked list consists of a series of structures, which are not necessarily adjacent in memory. We assume that each structure contains an integer key and a Next pointer to the next structure. Now given a linked list, you are supposed to sort the structures according to their key values in increasing order.

阅读剩余部分 -

PAT 1051 Pop Sequence (25)

题目要求

Given a stack which can keep M numbers at most. Push N numbers in the order of 1, 2, 3, ..., N and pop randomly. You are supposed to tell if a given sequence of numbers is a possible pop sequence of the stack. For example, if M is 5 and N is 7, we can obtain 1, 2, 3, 4, 5, 6, 7 from the stack, but not 3, 2, 1, 7, 5, 6, 4.

阅读剩余部分 -

PAT 1048 Find Coins (25)

题目要求

Eva loves to collect coins from all over the universe, including some other planets like Mars. One day she visited a universal shopping mall which could accept all kinds of coins as payments. However, there was a special requirement of the payment: for each bill, she could only use exactly two coins to pay the exact amount. Since she has as many as 105 coins with her, she definitely needs your help. You are supposed to tell her, for any given amount of money, whether or not she can find two coins to pay for it.

阅读剩余部分 -