guid

Get random number of rows from SQL Server table

时光怂恿深爱的人放手 提交于 2019-12-10 13:58:07
问题 I am trying to get 5 random number of rows from a large table (over 1 million rows) with a fast method. So far what I have tested with these SQL queries: Method 1 Select top 5 customer_id, customer_name from Customer TABLESAMPLE(1000 rows) order by newid() This method estimated I/O cost is 0.0127546 so this is very fast (index scan nonclustered) Method 2 select top 5 customer_id, customer_name from Customer order by newid() This method's sort estimated I/O cost is 117.21189 and index scan

Is “null this” an acceptable use of extension methods? [closed]

≡放荡痞女 提交于 2019-12-10 12:47:01
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . So, I really enjoy using extension methods.. maybe a bit too much. So, I'm going to ask about my latest enjoyment to ensure that I'm

What are the chances of getting the same GUID in 1 billion iterations?

守給你的承諾、 提交于 2019-12-10 12:31:33
问题 I am working on a project where I need to generate approximately 1 billion GUIDs. I know GUIDs are not guaranteed to be unique but are unique almost all of the time. If I generated a billion GUIDs, what is the probability that there will be a match? 回答1: http://blogs.msdn.com/b/oldnewthing/archive/2008/06/27/8659071.aspx The .NET GUID consists of 60 bits of timestamp, 48 bits of computer identifier, 14 bits of uniquifier, and six bits are fixed So the UUID probability quoted by Oscar does not

组织架构的一些常用方法

送分小仙女□ 提交于 2019-12-10 11:00:26
根据子元素的id获取所有父级的guid // 逆序,获取当前部门的所有父元素的guid function getParentsId(arr, PK_Guid) { var idArr = []; var fns = function(arr, PK_Guid){ for (item of arr) { if (item.PK_Guid == PK_Guid) { idArr.push(item.PK_Guid); break; } if (item.ChildNode && JSON.stringify(item.ChildNode).match(PK_Guid)) { idArr.push(item.PK_Guid); } if (item.ChildNode) { fns(item.ChildNode, PK_Guid); } } } fns(arr, PK_Guid, arr[0]) return idArr; } 数据结构: var data = [{ PK_Guid:'1a', name:'1', ChildNode:[ {PK_Guid:'11b',name:'11'}, {PK_Guid:'12b',name:'12', ChildNode:[ {PK_Guid:'121c',name:'121', ChildNode:[ {PK_Guid:'1211d',name:

php实现大文件上传分片上传断点续传

微笑、不失礼 提交于 2019-12-10 09:48:20
前段时间做视频上传业务,通过网页上传视频到服务器。 视频大小 小则几十M,大则 1G+,以一般的HTTP请求发送数据的方式的话,会遇到的问题:1,文件过大,超出服务端的请求大小限制;2,请求时间过长,请求超时;3,传输中断,必须重新上传导致前功尽弃; 解决方案: 1,修改服务端上传的限制配置;Nginx 以及 PHP 的上传文件限制 不宜过大,一般5M 左右为好; 2,大文件分片,一片一片的传到服务端,再由服务端合并。这么做的好处在于一旦上传失败只是损失一个分片而已,不用整个文件重传,而且每个分片的大小可以控制在4MB以内,服务端限制在4M即可。 前端 Web前端可使用HttpUploader6的大文件上传控件6;官网地址: http://t.cn/EyI6vHh <div class="section section6 section5"> <div class="part1"><a href="javascript:;" target="_blank" class="part1__btn">批量删除</a><span class="part1__txt"><em class="part1__num" id="upload_num">0</em>个视频,共 <em class="part1__num" id="upload_size">0M</em></span></div>

How can I find all the Guids in some text?

六眼飞鱼酱① 提交于 2019-12-10 09:43:17
问题 I've got a bunch of web page content in my database with links like this: <a href="/11ecfdc5-d28d-4121-b1c9-1f898ac0b72e">Link</a> That Guid unique identifier is the ID of another page in the same database. I'd like to crawl those pages and check for broken links. To do that I need a function that can return a list of all the Guids on a page: Function FindGuids(ByVal Text As String) As Collections.Generic.List(Of Guid) ... End Function I figure that this is a job for a regular expression. But

Is there a tool which detects duplicate interface GUIDs?

一曲冷凌霜 提交于 2019-12-10 02:49:59
问题 This is a typical copy-paste error: if some Delphi code containing interface declarations with GUIDs is copy-pasted, Delphi will not complain and compile code which re-uses the same GUID in different places. The "Supports" function works with interfaces based on their GUID, so errors are possible. Is there a 'quality assurance' tool available (Peganza or the Delphi Sonar plugin maybe) which can detect them? 回答1: If you're on a unix/mac try this - or if you have cygwin on your PC find . -name

Should I Use Path.GetRandomFileName or use a Guid?

百般思念 提交于 2019-12-10 02:30:39
问题 I need to generate unique folder names, should I use Path.GetRandomFileName or just use Guid.NewGuid? Guids say they are globally unique, GetRandomFileName does not make such a claim. 回答1: I think both are equally random, the difference being that Path.GetRandomFileName will produce a 8.3 filename (total of 11 characters) so is going to have a smaller set of unique names than those generated by Guid.NewGuid . 来源: https://stackoverflow.com/questions/22625677/should-i-use-path-getrandomfilename

How to use the objectGUID get a DirectoryEntry?

旧巷老猫 提交于 2019-12-09 19:17:54
问题 I know ,we can get a DirectoryEntry like this: string conPath = "LDAP://10.0.0.6/DC=wds,DC=gaga,DC=com"; string conUser = "administrator"; string conPwd = "Iampassword"; DirectoryEntry de = new DirectoryEntry(conPath, conUser, conPwd, AuthenticationTypes.Secure); and we can change a user's password like this: DirectorySearcher deSearch = new DirectorySearcher(); deSearch.SearchRoot = de; deSearch.Filter = String.Format("sAMAccountName={0}", "xumai"); SearchResultCollection results = deSearch

Using both a GUID and an auto-incrementing integer

走远了吗. 提交于 2019-12-09 15:58:56
问题 I've been investigating the use of GUIDs as primary keys in databases. So far, the pros seem to outweigh the cons. However, I see one point where GUIDs may not be what I want. In my application, users should be able to identify objects based on a user-friendly ID. So, for example, if they want to get a specific product without typing in the full name, they can use the product's ID. GUIDs aren't easy to remember for something like that. The solution I've been thinking about is to use both a