undo

my.cnf参数说明

試著忘記壹切 提交于 2019-12-01 01:32:21
MySQL 5.7数据库参数优化 连接相关参数 max_connections: 允许客户端并发连接的最大数量,默认值是151,一般将该参数设置为500-2000 max_connect_errors: 如果客户端尝试连接的错误数量超过这个参数设置的值,则服务器不再接受新的客户端连接。可以通过清空主机的缓存来解除服务器的这种阻止新连接的状态,通过FLUSH HOSTS或mysqladmin flush-hosts命令来清空缓存。这个参数的默认值是100,一般将该参数设置为100000。 interactive_timeout: Mysql关闭交互连接前的等待时间,单位是秒,默认是8小时,建议不要将该参数设置超过24小时,即86400 wait_timeout: Mysql关闭非交互连接前的等待时间,单位是秒,默认是8小时,建议不要将该参数设置超过24小时,即86400 skip_name_resolve: 如果这个参数设为OFF,则MySQL服务在检查客户端连接的时候会解析主机名;如果这个参数设为ON,则MySQL服务只会使用IP,在这种情况下,授权表中的Host字段必须是IP地址或localhost。 这个参数默认是关闭的 back_log: MySQL服务器连接请求队列所能处理的最大连接请求数,如果队列放满了,后续的连接才会拒绝

MySQL InnoDB如何保证事务特性

Deadly 提交于 2019-11-30 22:28:50
如果有人问你“数据库事务有哪些特性”?你可能会很快回答出原子性、一致性、隔离性、持久性即ACID特性。那么你知道InnoDB如何保证这些事务特性的吗?如果知道的话这篇文章就可以直接跳过不看啦(#^.^#) 先说结论: redo log重做日志用来保证事务的持久性 undo log回滚日志保证事务的原子性 undo log+redo log保证事务的一致性 锁(共享、排他)用来保证事务的隔离性 重做日志 redo log 重做日志 redo log 分为两部分:一部分是内存中的重做日志缓冲(redo log buffer),是易丢失的;二部分是重做日志文件(redo log file),是持久的。InnoDB通过Force Log at Commit机制来实现持久性,当commit时,必须先将事务的所有日志写到重做日志文件进行持久化,待commit操作完成才算完成。 InnoDB在下面情况下会将重做日志缓冲的内容写入重做日志文件: master thread 每一秒将重做日志缓冲刷新到重做日志文件; 每个事务提交时 当重做日志缓冲池剩余空间小于1/2时 为了确保每次日志都写入重做日志文件,在每次将日志缓冲写入重做日志文件后,InnoDB存储引擎都需要调用一次fsync(刷盘)操作。但这也不是绝对的。用户可以通过修改innodb_flush_log_at_trx

Is fast (repeated) undo possible in emacs?

不羁岁月 提交于 2019-11-30 17:31:14
I use emacs and I have a problem with it's undo. (Sorry, maybe this is a stupid question, but I did not find anything about it in the internet, whilst it should be a basic functionality of any editor). To invoke each undo step I need to press 'Ctrl-x' and then 'u'. But if I have done 200 steps and I wish to undo them, my hand and fingers get horrible pain from repeating 'Ctrl-x' and then 'u' 200 times, to say nothing that this operation takes about 5 minutes. In Microsoft Word, for example (and also in many other editors) undo is Ctlr-Z, but you can press and hold Ctlr-Z and multiple undo

How can I “undo” the programmatic insertion of text into a textarea?

房东的猫 提交于 2019-11-30 17:17:40
I have a textarea and a button. Clicking the button causes text to be inserted into the textarea. Is there a way to allow a user to press Ctrl/Cmd+z to undo the insertion of text and revert the textarea to its previous state? I think the easiest approach to leverage browser's undo stack instead of capturing events. To do this you need to use different codes for different browsers. Luckily out of all major browsers only Firefox has a different approach. // http://stackoverflow.com/a/9851769/529024 // Opera 8.0+ var isOpera = (!!window.opr && !!opr.addons) || !!window.opera || navigator

mysql并发控制——数据多版本

北城余情 提交于 2019-11-30 16:52:15
内容提取自 58沈剑公众号:架构师之路 1、共享锁和排他锁 因为普通锁不能并发,所以出现了共享和排它锁 共享锁(Share Locks,记为S锁),读取数据时加S锁 排他锁(exclusive Locks)修改数据时加X锁 兼容互斥表 S X S 兼容 互斥 X 互斥 互斥 这种情况下,如果写数据的任务没有完成,数据不能被任务读取的。这回阻塞读取任务。 画外音:对应到数据库,可以理解为,写事务没有提交,读取相关数据的select会被阻塞 2、数据多版本 核心原理: 1)写任务发生时,将数据克隆一份,以版本号区分 2)写任务操作新克隆的数据,直至提交;(提交时覆盖原来版本?提交方式有待思考) 3)并发读任务可以继续读取旧版本的数据,不至于阻塞 3、redo,undo,回滚段 在进一步介绍InnoDB如何使用“读取旧版本数据”极大提高任务的并发度之前,有必要先介绍下redo日志,undo日志,回滚段(rollback segment)。 为什么要有redo 日志? 数据库事务提交后,必须将更新后的数据刷到磁盘上,以保证ACID特性。磁盘 随机写 性能较低,如果每次都刷盘,会极大影响数据库的吞吐量。 优化方式是,将修改行为先写到redo日志里(此时变成了 顺序写 ),再定期将数据刷到磁盘上,这样能极大提高性能。 画外音:这里的架构设计方法是, 随机写优化为顺序写 ,思路更重要。

Hibernate, save the previous state of an object

帅比萌擦擦* 提交于 2019-11-30 16:05:00
问题 Is there any generally accepted, proven-to-work way using hibernate, that keeps a history of an entitys changes in the database? We need to keep track of quite some objects and we want to be able to undo changes to objects. I tried using the interceptors of hibernate, but the old state of the object is only available when doing merge() . Mostly we do update() or saveOrUpdate() though... I'm currently letting warp-persist together with Guice manage the session. 回答1: I've done this with an

一些常见的MySQL配置

耗尽温柔 提交于 2019-11-30 15:05:22
目录 配置 参考 配置 [mysqld] port = 3306 socket = /mysql/log/mysql_3306.sock # mysql的目录(即mysql的文件所在目录) # basedir = /mysql/mysql_basedir # mysql中存放数据的目录 datadir = /mysql/data # mysql的日志目录 log_error = /mysql/log/error.log # pid文件所在目录 pid-file = /mysql/log/mysql_3306.pid # mysqld程序在启动后将在给定UNIX/Linux账户下执行; mysqld必须从root账户启动才能在启动后切换到另一个账户下执行; mysqld_safe脚本将默认使用–user=mysql选项来启动mysqld程序。 # user = root # 配置mysql绑定地址,配置为0.0.0.0可以使该机器所有IP访问 bind-address = 0.0.0.0 # mysql标记,一般使用IP最后一位,不可重复 server-id = 1 # 打开binlog log-bin = mysql-bin # binlog的前缀名 log-bin-index = master-bin.index # 更改服务器的校验规则,默认为utf8mb4_general

How to handle touch outside the view in Android?

限于喜欢 提交于 2019-11-30 15:04:42
问题 I've found implementation of "Undo Bar" used in Gmail application for Android. "UndoBar" is basically a View that is displayed on top of the layout. Unfortunately it's not complete - it has no functionality of dismissing bar by touching screen outside the bar. I've implemented FrameLayout that overrides onInterceptTouchEvent to handle bar dismissing but touching Action Bar does nothing. Is there any way to handle such events from Action Bar? Below there is an Image with "UndoBar"shown. What I

How to handle touch outside the view in Android?

我是研究僧i 提交于 2019-11-30 13:07:34
I've found implementation of "Undo Bar" used in Gmail application for Android. "UndoBar" is basically a View that is displayed on top of the layout. Unfortunately it's not complete - it has no functionality of dismissing bar by touching screen outside the bar. I've implemented FrameLayout that overrides onInterceptTouchEvent to handle bar dismissing but touching Action Bar does nothing. Is there any way to handle such events from Action Bar? Below there is an Image with "UndoBar"shown. What I want to achieve to handle touch in Action bar represented by red dot. Try to override

Extending Swing's UndoManager to provide repeat and multiple undo/redo

◇◆丶佛笑我妖孽 提交于 2019-11-30 09:43:09
问题 I've been tasked with adding undo/redo/repeat functionality to an application. I'm currently investigating whether I can use Swing's UndoManager. Apart from the usual undo and redo buttons, I need to provide the ability to undo or redo multiple edits at once (drop down UI like MS Office), and repeat a chosen edit. I believe I can use UndoManager for multiple undo and redo. It provides methods for multiple undo and redo. To build the UI, I can extend UndoManager to expose the edits it holds. I