为什么要使用.toString(32)而不是.toString(36)?(Why use .toString(32) and not .toString(36)?)
好奇:
很多人会使用
[Number].toString(32)
方法来执行生成会话ID之类的操作,例如:public class SessionID{ private static SecureRandom ran = new SecureRandom(); public static String next() { return new BigInteger(130, ran).toString(32); } }
我还看到它用于将散列密码的字节转换为字符串格式。 但为什么不使用
.toString(36)
? Base 32不包括z,y,x或w,那么使用它的原因是什么? (猜测与32 = 2 ^ 5有关,但我会感谢更好的答案。)Curious:
A lot of people will use the
[Number].toString(32)
method to do things like generate session IDs, e.g. something like:public class SessionID{ private static SecureRandom ran = new SecureRandom(); public static String next() { return new BigInteger(130, ran).toString(32); } }
I've also seen it used for translating bytes of hashed passwords to a string format. But why not use
.toString(36)
? Base 32 does not include z,y,x, or w, so what's the reasoning behind using it? (Guessing something to do with 32 = 2^5, but I'd appreciate a better answer.)
原文:https://stackoverflow.com/questions/29183818
最满意答案
众所周知,iOS由于存在性能问题而无法
background-attachment: fixed
背景(通过background-attachment: fixed
)。 您可以在这里阅读更多内容: https : //stackoverflow.com/a/23420490/1887218您可以执行一种解决方法,并将背景添加到具有
position: fixed
集的全屏包装器。 见这里: https : //stackoverflow.com/a/12770538/1887218iOS is known to not keep backgrounds fixed (via
background-attachment: fixed
) due to supposed performance issues. You can read more here: https://stackoverflow.com/a/23420490/1887218You can do a workaround, and add the background to a full-screen wrapper, that has
position: fixed
set. See here: https://stackoverflow.com/a/12770538/1887218
相关问答
更多-
删除ios safari中点击的链接上的灰色背景(remove grey background on link clicked in ios safari / chrome / firefox)[2022-11-26]
Webkit具有以下特定的样式属性: -webkit-tap-highlight-color 。 复制自: http : //davidwalsh.name/mobile-highlight-color - /* light blue at 80% opacity */ html { -webkit-tap-highlight-color: rgba(201, 224, 253, 0.8); } /* change it for a div that has a similar backgroun ... -
尝试在背景上使用固定定位。 默认情况下,您使用的背景(而不是重复/实体,否定问题)将被定位为绝对背景。 所以高度可以达到100%,但背景仍保持在同一位置。 这可以通过在css对象的末尾添加以下内容来完成: background-attachment: fixed; 编辑: 创建一个额外的div来容纳渐变。 使用BODY限制固定定位的使用。 因此,在您的情况下,您可以简单地将.animated-gradient移动到没有子节点的div,并使用固定定位。 Try using fixed positioning ...
-
由于自己碰到问题,我做了一系列测试。 这个问题与大小,宽度,透明度或repeat-x没有关系,它是INTERLACING。 将图像加载到图像编辑器中,并将隔行扫描保存为OFF ,它应该可以工作。 From testing and learning, and the use of photoshop. The problem that I saw with the use of png files that were used for background images, would turn black. ...
-
修复iOS Safari中不需要的重新定位的背景图片?(Fixed Background Image Causing Unwanted Repositioning in iOS Safari?)[2024-01-27]
请尝试下面的代码。 我稍微改变了你的代码,并删除了不必要的和无效的css规则。 html, body { height: 100%; width: 100%; margin: 0; padding: 0; } .sitebg { position: absolute; top: 50%; left: 50%; width: 2000px; height: 2000px; margin: -1000px 0 0 -1000px; background: url ... -
Safari不会在没有html背景颜色设置的情况下在身体上显示BG(Safari Won't Show BG on the body without a html background color set)[2022-05-18]
在另一个客户端站点上发生相同的问题后,我能够找出问题所在。 我仍然不确定这是否是Safari中的错误,但问题如下: 当使用_的(下划线)WordPress启动主题和Modernizr时,主题中的默认css是在html元素本身上放置一个clearfix(不是故意的)。 由于某种原因,在Safari中将html元素的伪元素(之前和之后)设置为显示表会导致html元素本身覆盖页面上的所有内容(默认设置为白色)。 你可以在github页面上查看这个门票https://github.com/Automattic/_s ... -
不确定,但你只需要尝试单行: background: url('img/bg_small.jpg') no-repeat top center #000; 顶部中心只是对齐,所以它会粘在设备的顶部并自动居中。 希望它有助于normaly为我工作。 Not sure but have u tryede just single line it like: background: url('img/bg_small.jpg') no-repeat top center #000; the top center ...
-
你是否尝试设置按钮的尺寸以适合图像? 图像是否被裁剪或模糊(因为它正在调整大小)? 你有没有玩过UIView的contentMode属性的按钮? 如果你这样做,你尝试增加/减少一个像素的宽度或高度? 即使它的尺寸完全是图像,我有时也会有模糊的按钮。 添加或删除多余的像素有时会有所帮助。 I finally resolved this by creating a 3x3 px image with the background color as the button's color and a 1 px bo ...
-
在身体上设置的背景图像上切断的问题 - iOS / Safari(issue with cut off on background image set on body - iOS/Safari)[2021-12-23]
众所周知,iOS由于存在性能问题而无法background-attachment: fixed背景(通过background-attachment: fixed )。 您可以在这里阅读更多内容: https : //stackoverflow.com/a/23420490/1887218 您可以执行一种解决方法,并将背景添加到具有position: fixed集的全屏包装器。 见这里: https : //stackoverflow.com/a/12770538/1887218 iOS is known t ... -
这个问题的解决方案其实很简单,有两种方法可以解决。 如果您可以控制Content.html,那么只需将div#ScrolledArea宽度CSS更改为: width: 1px; min-width: 100%; *width: 100%; 基本上这里的想法很简单,您将width设置为小于视口(在这种情况下为iframe宽度),然后用min-width: 100%覆盖以允许实际width: 100%默认情况下为哪个iOS Safari覆盖。 *width: 1 ...
-
尝试删除“修复”,因为它可能导致iOS问题: background: url('../img/slide/contact_background.jpg') no-repeat center center; 这应该适用于Android和iOS浏览器。 这里有更多的信息(简短的测试表明它在iOS8中并不是更好): 如何复制在iOS上修复的背景附件 Try removing "fixed" since it's probably causing the problem with iOS: background: ...