uuid

Is a UUID “URL safe”?

岁酱吖の 提交于 2019-11-30 01:07:28
问题 Is a UUID URL safe? I want to use it as an alternate ID yet perhaps allowing access to the record as the ID in the URL. While I can use Ruby’s SecureRandom.urlsafe_base64(27) to obtain a random base64-encoded string of the same length, a UUID looks cleaner. 回答1: Yes. A UUID consists of only hexadecimal characters (a–f, 0–9) plus a hyphen (-). As per RFC 3986 (URI Syntax) §2.3, hyphen and hexadecimal characters are included in those explicitly unreserved: Characters that are allowed in a URI

Linux故障-CentOS7系统firewall报错"Error: INVALID_ZONE"

五迷三道 提交于 2019-11-30 00:03:29
文章目录 系统版本 故障现象 系统日志 分析 相关软件版本 解决办法 可选办法 系统版本 CentOS Linux release 7.1.1503 (Core) 故障现象 [root@server1 ~]$firewall-cmd --list-all Error: INVALID_ZONE [root@server1 ~]$systemctl status firewalld.service firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled) Active: active (running) since 一 2019-05-27 14:33:00 CST; 23h ago Main PID: 5483 (firewalld) CGroup: /system.slice/firewalld.service └─5483 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid 5月 27 14:33:00 server1 systemd[1]: Started firewalld - dynamic firewall daemon

java文件断点上传

落花浮王杯 提交于 2019-11-29 23:33:02
1 ,项目调研 因为需要研究下断点上传的问题。找了很久终于找到一个比较好的项目。 在 GoogleCode 上面,代码弄下来超级不方便,还是配置 hosts 才好,把代码重新上传到了 github 上面。 https://github.com/freewebsys/java-large-file-uploader-demo 效果: 上传中,显示进度,时间,百分比。 点击【 Pause 】暂停,点击【 Resume 】继续。 2 ,代码分析 原始项目: https://code.google.com/p/java-large-file-uploader/ 这个项目最后更新的时间是 2012 年,项目进行了封装使用最简单的方法实现了 http 的断点上传。 因为 html5 里面有读取文件分割文件的类库,所以才可以支持断点上传,所以这个只能在 html5 支持的浏览器上面展示。 同时,在 js 和 java 同时使用 cr32 进行文件块的校验,保证数据上传正确。 代码在使用了最新的 servlet 3.0 的 api ,使用了异步执行,监听等方法。 上传类 UploadServlet @Component("javaLargeFileUploaderServlet") @WebServlet(name = "javaLargeFileUploaderServlet",

Oracle 生成uuid,查询uuid

。_饼干妹妹 提交于 2019-11-29 23:17:11
如果还没有创建表,那么使用下面的方式创建就可以了。 create table testuu( id varchar2(2000) default sys_guid(), name varchar2(2000)) ; 如果已经创建了表,那么先保证你原有的主键ID没有任何实际的业务意义,要修改的话使用下面的方法。 alter table testuu modify id default sys_guid() ; update testuu set id = sys_guid (); Oracle新建系统表时,要求主键为32位uuid,猜测Oracle肯定会提供相关的函数。 翻阅相关文档,果然发现Oracle提供的函数 sys_guid() 用于获取32位uuid,简单使用为 select sys_guid() from dual; 该函数返回32位的uuid为大写,可以使用 lower(sys_guid()) 转为小写. Oracle中生成跨系统的唯一识别符UUID非常方便,比生成序列还简单,直接用sys_guid()就行, 例如 select sys_guid() from dual 会产生一个跟MAC地址、生成时间相关的一个32位16进制的随机数。 数据类型是 raw(16) 有32个字符。 它的生成机制足以保证全球所有系统产生的海量guid重复可能性非常小

Laravel str_random() or custom function?

て烟熏妆下的殇ゞ 提交于 2019-11-29 22:09:44
Is the Laravel str_random() function random enough so that I can use it for IDs? For example: str_random(32); This produces a random string of length 32 made up of alphanumeric characters [a-zA-z0-9] (62 characters in total). Which equates to 2272657884496751345355241563627544170162852933518655225856 possibilities. However, my question is, is this going to be good enough? Or should I consider using UUIDs or another custom function. str_random ( Str::random() ) tries to use openssl_random_pseudo_bytes which is a pseudo random number generator optimized for cryptography, not uniqueness. If

Is there a method to generate a standard 128bit GUID (UUID) on the Mac?

和自甴很熟 提交于 2019-11-29 21:33:47
Is there a built in function equivalent to .NET's Guid.NewGuid(); in Cocoa? My desire is to produce a string along the lines of 550e8400-e29b-41d4-a716-446655440000 which represents a unique identifier. UUIDs are handled in Core Foundation, by the CFUUID library. The function you are looking for is CFUUIDCreate . FYI for further searches: these are most commonly known as UUIDs, the term GUID isn't used very often outside of the Microsoft world. You might have more luck with that search term. Some code: For a string UUID, the following class method should do the trick: +(NSString*)UUIDString {

总结:优秀设计技巧整理

喜你入骨 提交于 2019-11-29 21:31:17
1、查询接口设计 入参:以tag的方式,如propertyKey,propertyValue 解释: propertyKey即查询的条件字段是什么?sn?uuid?ip? propertyValue即条件值,如果是uuid的话,条件值是xxxx-xxxx-xxxx-xxxx 后端sql:where 1 = 1 and propertyKey = propertyValue 2、 来源: https://my.oschina.net/weiweiblog/blog/3107048

how to use UUID in Django

拜拜、爱过 提交于 2019-11-29 20:54:16
I am trying to get unique IDs for my Django objects. In Django 1.8 they have the UUIDField. I am unsure how to use this field in order to generate unique IDs for each object in my model. Here is what I have for the UUIDField import uuid from django.db import models class MyUUIDModel(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) class Person(models.Model): ... unique_id = MyUUIDModel() I can reproduce the id for the UUID model, but everytime I do I get the exact same id. :(. For Example: person = Person.objects.get(some_field = some_thing) id =

generate UUID of long type

怎甘沉沦 提交于 2019-11-29 20:05:43
问题 Please give me sample code to generate UUID of long type in java without using timestamp. Thanks 回答1: A real UUID is 128 bits. A long is 64 bits. This is not just pedantry. UUID stands for Universal Unique IDentifier. The "universal uniqueness" of the established UUID schemes are based on: encoding a MAC address and a timestamp, encoding a hash of a DNS name and a timestamp, or using a 122 bit random number ... which is large enough that the probability of a collision is very very small. With

How to make a Type 5 UUID in Java?

吃可爱长大的小学妹 提交于 2019-11-29 18:26:00
问题 In python, to make a Type 5 UUID we can simply do: import uuid print uuid.uuid5(uuid.NAMESPACE_URL, 'my string') Looking through the java documentation for java.util.UUID, I don't see how to do it. First off, type 5 isn't mentioned. They do have a Type 3, but the signature is: nameUUIDFromBytes(byte[] name) Static factory to retrieve a type 3 (name based) UUID based on the specified byte array. How can we make a Type 5 UUID in Java? 回答1: You can implement it yourself by following the code