undo

Undo changes in an arrayList

安稳与你 提交于 2019-12-22 20:14:09
问题 I've an ArrayList of Line Objects called 'lines'. I made my own line class to draw lines with some constraints. It involves selecting two points in a panel and a line is drawn connecting the two points. Everytime a line is created, it is added to the 'lines'. The lines are drawn in a panel. The paint function in my panel looks like this: public void paintComponent(Graphics g){ super.paintComponent(g); for(final Line r:lines){ r.paint((Graphics2D)g); } } And everytime two points are clicked on

How to use NSUndoManager with a UIImageView or CGContext

拈花ヽ惹草 提交于 2019-12-22 08:45:00
问题 I have an app that uses cgcontext to draw things onto a UIImageView that the user draws using touch events, and I want to be able to undo the drawings made by the user. Edit: I am trying to use my touchesBegan to save theUIImage at the begining of a touch to the NSUndoManager And then how do I use it to undo using a UIAlertView. Meaning, I want to call a method from my UIAlertView that undo's then another that will redo, but I don't know how to accomplish this. Please help 回答1: I write

Disable Chrome's text input undo/redo (CTRL+Z / CTRL+Y)

对着背影说爱祢 提交于 2019-12-21 16:57:23
问题 i'm currently developing a web application and i encounter a problem. As you might know or not, chrome has a feature that gives <input> (especially text inputs) an "undo" function when you hit CTRL+Z and "redo" with CTRL+Y it may seem like a good feature in normal websites, but currently i'm making an image editor that also uses those keyboard shortcuts (CTRL+Z & CTRL+Y). in my app i also have a text input, so when i change the text input's content and then hit CTRL+Z to undo the changes in

Can a `range.insertNode` be undone using browser's undo, in a contenteditable div?

ε祈祈猫儿з 提交于 2019-12-21 12:23:44
问题 I am working on a contenteditable div to make a simple RichText-Editor. One of the requirement I have is to be able insert html chunk at cursor postion on a button event. I was able to get that part working fine by using range , selection , range.insertNode(nodeHTML) or range.pasteHTML(nodeHTML) based on browser. But I couldn't get two things, which ideally I would like to have To be Able to undo the inserted node, using browser's undo. Somehow, browser ignores above actions. To move the

Autotools: how to cleanup files created by “./configure” in lighttpd project?

风流意气都作罢 提交于 2019-12-21 06:48:54
问题 I'm trying out lighttpd for an embedded Linux project. I got the latest source package and started writing a master Makefile encapsulating all configure, compile, install (for testing) etc stuff. And vice-versa, I want to cleanup every step. After the cleanup there should be no generated files anymore. This is important for repetitive testing. I wonder if there is a way to do a complete cleanup of what ./configure generated? I'm not familiar with autotools in details. Any hints? 回答1: I

Command Pattern for undo/redo in paint application

廉价感情. 提交于 2019-12-20 14:41:34
问题 I would like to implement undo/redo in a small paint application. It seems the Command Pattern fits the use nicely, but I am unsure how to best implement it. As I understand the pattern, it is necessary to include in each command: The details of the paint operation for purposes of redo (e.g. Line -> start & end points, free form line -> GeneralPath ) The state of the component prior to the change for undo. In this case, that will be a small snapshot image of the area affected by the command.

What is difference between 'git reset --hard HEAD~1' and 'git reset --soft HEAD~1'?

前提是你 提交于 2019-12-20 08:27:23
问题 I tried to undo my commit in git. Is it dangerous to use git reset --hard HEAD~1 ? What is the difference between different options for git reset ? 回答1: git reset does know five "modes": soft, mixed, hard, merge and keep. I will start with the first three, since these are the modes you'll usually encounter. After that you'll find a nice little a bonus, so stay tuned. soft When using git reset --soft HEAD~1 you will remove the last commit from the current branch, but the file changes will stay

【转帖】分布式事务之解决方案(XA和2PC)

China☆狼群 提交于 2019-12-20 07:30:51
分布式事务之解决方案(XA和2PC) https://zhuanlan.zhihu.com/p/93459200 ​ 博彦信息技术有限公司 java工程师 3. 分布式事务解决方案之2PC(两阶段提交) 针对不同的分布式场景业界常见的解决方案有2PC、TCC、可靠消息最终一致性、最大努力通知这几种。 3.1. 什么是2PC 2PC即两阶段提交协议,是将整个事务流程分为两个阶段,准备阶段(Prepare phase)、提交阶段(commit phase),2是指两阶段,P是指准备阶段,C是提交阶段。 举例 :张三和李四好久不见,老友约起聚餐,饭店老板要求先买单,才能出票。这时张三和李四分别抱怨近况不如意,囊肿羞涩,都不愿意请客,这时只能AA。只有张三和李四都付款,老板才能出票安排就餐。但由于张三和李四都是铁公鸡,形成两尴尬的一幕 : 准备阶段 :老板要求张三付款,张三付款。老板要求李四付款,李四付款。 提交阶段 :老板出票,两人拿票纷纷落座就餐。 例子中形成两一个事务,若张三或李四其中一个拒绝付款,或钱不够,店老板都不会给出票,并且会把已收款退回。 整个事务过程由事务管理器和参与者组成,店老板就是事务管理器,张三、李四就是事务参与者,事务管理器负责决策整个分布式事务的提交和回滚,事务参与者负责自己本地事务的提交和回滚。 在计算机中部分关系数据库如Oracle

Undo Segment/Undo Retention

自作多情 提交于 2019-12-20 07:14:51
undo_retention简单定义,就是最多数据的最少保留时间。AUM模式下,undo_retention参数用于事务commit后undo数据保留的时间。单位为秒。这是个no guarantee的限制。也就是,若空间足够,他只是个‘花瓶’;当可用空间不足而又有事务需要回滚空间,则这些数据依然会被覆盖。这个行为可能会导致ORA-01555错误,这些数据被记忆的时间可用v$undostat里面的字段TUNED_UNDORETENTION来查询。 UNDO主要用于以下方面: 1.在执行rollback语句的时候rollback事物 2.恢复数据库 3.提供读一致性 4.为oracle flashback query提供支持 5.使用oracle flashback特性恢复数据库逻辑失败 一般来讲事物的undo信息存储在回滚段中,事物的undo信息一直存在,直到一个commit或者rollback语句执行。自动回滚段管理允许DBA指定oracle数据库保留多久的commit之后的undo信息。防止在长时间的查询产生ora-01555:snapshot too old.通过设置UNDO_RETENTION参数来达到这个目的,默认是900s(15min).可以设置这个参数保证数据库保留undo日志的时间.设置UNDO_MANAGEMENT = AUTO参数就可以设置自动管理回滚段特性。

Undofile independent of the Vim version

谁说胖子不能爱 提交于 2019-12-20 06:31:18
问题 I'm using the Vim 7.3 feature undofile the following way: if version >= 703 set undofile set undodir=$HOME/.vim/undo set undolevels=1000 set undoreload=10000 endif I am using the same .vimrc and the same files (within a cloud storage) on different machines which do not support Vim 7.3 but use the old 7.2 version which does not support undofile out of box. Is there a solution for the 7.2 version compatible with the 7.3 undofile? 回答1: version check Because persistent undo was introduced with