轮询,选择并“将阻止”(poll, select and “would block”)
我正在学习关于
poll
,select
和类似的功能,而且我一直很担心陈述“会阻止”(在我正在阅读的关于为Linux构建驱动程序以及在poll
和select
手册页上阅读的这本书中)。 我真的不明白这一点。 什么会被阻止? 读/写文件描述符的过程? 读/写操作本身,就是说当前进程正在读/写时,没有其他进程能够读/写该文件?如果这是一个愚蠢的问题,我很抱歉,但我很难在任何地方找到这个问题的答案。
I am learning about
poll
,select
and similar functions and I am constantly bothered by the statement "would block" (which shows up both on the book I am reading about building drivers for Linux and also on the man pages ofpoll
andselect
). I don't really get this. What would be blocked? The process which is reading/writing to a file descriptor? The reading/writing operation itself, in the sense that no other process would be able to read/write to that file when the current process is reading/writing on it?I am sorry if this is a stupid question but I am having a difficult time finding the answer for this question anywhere.
原文:https://stackoverflow.com/questions/12568412
最满意答案
如果它是自然生成的,你可以将slug反向映射到相应的ID,只要记住这一点:
在增加你的ID变量之前,你可以确保它增加的条目还没有被输入与该ID相对应的slug的人填充,如果这种情况只是不断增加ID列直到你找到一个新的唯一值。
You could do the reverse mapping of the slug to the corresponding ID it would occupy if it was naturally generated, just keep this in mind:
Before increasing your ID variable you can make sure the entry it would increase to is not already populated by someone who entered a slug which corresponds to that ID, if that's the case just keep incrementing the ID column until you find a new unique value.
相关问答
更多-
维基是你的朋友 基本上,使用较短名称的网站作为占位符,例如bit.ly。 然后,bit.ly生成用户提供的密钥,随机生成的密钥不重复。 有35个字符选项和8个左右的值,做数学。 这是很多可能的钥匙。 如果一个url等于之前存在的密钥,那么我记得在某个地方阅读他们重用的密钥。 他们并不真正使用特定的编程语言,他们只是使用一个简单的URL重定向,这可以用我相信的HTML来完成。 Wiki Is Your Friend Basically, a website with a shorter name is use ...
-
我一直都做错了。 正确的方法是创建Credential对象并使用setAccessToken()方法设置Access令牌。 public static Urlshortener newUrlshortener() { Credential credential = new Credential(); credential.setAccessToken("{accessToken}"); return new Urlshortener.Builder(new UrlFetchTran ...
-
Google URL Shortener统计日期字段的时区是多少?(What is the timezone for Google URL Shortener stats date fields?)[2023-08-01]
我相信那些都是相对的。 因为day是请求时间前24小时。 我刚刚在上午10:45点击缩短的网址进行了快速测试,点击立即显示在图表上。 I believe those are are all relative. As in day is the 24 hours leading up to the time of the request. I just did a quick test by clicking on a shortened URL at 10:45am and the click showed ... -
没有数据库的URL缩短器(URL shortener with no database)[2022-07-05]
最后,如果你是一个简短的链接,你只需要生成一个适当易读的唯一代码(尝试省略类似的字母/数字,如零和'o',以防一些可怜的bugger实际上必须输入它)和关联在某种形式的商店中使用原始URL的代码。 虽然我可以理解为什么你不想使用数据库,但在很多方面它都是完美的存储形式,特别是如果你看一个专用的键/值存储,如Cassandra , Redis , MongoDB等。如果你处于一个不熟悉的领域,一个简单的“传统”SQL数据库可能是一个简单的第一步。) Ultimately if you're after a s ... -
如果它是自然生成的,你可以将slug反向映射到相应的ID,只要记住这一点: 在增加你的ID变量之前,你可以确保它增加的条目还没有被输入与该ID相对应的slug的人填充,如果这种情况只是不断增加ID列直到你找到一个新的唯一值。 You could do the reverse mapping of the slug to the corresponding ID it would occupy if it was naturally generated, just keep this in mind: Bef ...
-
URL Shortener PHP(URL Shortener PHP)[2023-08-22]
你意思是? RewriteEngine On RewriteCond %{THE_REQUEST} ^(GET|HEAD)\ /(index\.php)?\?id=([0-9]+)([^\ ]*) RewriteRule ^ /%3?%4 [L,R=301] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([0-9]+)/?$ /?id=$1 [L,QSA] You mean? ... -
使用google url shortener重定向的通用链接(universal links with redirects using google url shortener)[2022-03-12]
您完全正确:为此,Google需要将您的应用添加到他们的apple-app-site-association文件中。 不幸的是,即使Google 想要这样做也是不可能的,因为Apple在该文件上设置了128 kb的大小限制。 集成App Indexing SDK是一个很好的想法,但也没有解决这个问题。 你需要的是像Branch.io这样的(免费)服务(完全披露:我在分支团队中)。 这是专为您正在尝试完成的工作而设计的,并负责您遇到的所有内务处理任务。 您将能够创建品牌短URL,将您带到您的应用程序(如果已安 ... -
基本上,支持bit.ly和其他URL缩短程序的应用程序可以告诉您自己是谁,从而使用自定义域适当缩短URL。 Basically, apps that are supporting bit.ly and other URL shorteners can tell who you are and thus shorten the URL appropriately using a custom domain.
-
您可以使用URI模块 ,然后使用正则表达式来解析第一个www。 喜欢 def host(url) uri = URI.parse(url) uri.host.sub(/^www./, '') end You can use the URI module and then use a regexp to parse out the first www. Like def host(url) uri = URI.parse(url) uri.host.sub(/^www./, ...
-
Mathias URL缩短(Mathias URL shortener)[2023-12-18]
您询问的脚本就在那里,因此您可以从该页面快速创建短URL。 提示将询问您要缩短的URL,而第二个会自动缩短您已经使用的页面。 给他们一个去:) The scripts you're asking about are there so you can quickly create a Short URL from that page. The prompt will ask you what URL you want to shorten, whilst the second one will automat ...