undo

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

霸气de小男生 提交于 2019-11-29 15:39:33
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'm not sure I can use UndoManager for repeat chosen operation however. My first thoughts were to extend

“[NSBigMutableString substringWithRange:]: Range {0, 10} out of bounds; string length 9” error with Undo

早过忘川 提交于 2019-11-29 14:01:46
My app crashes when I try to do undo on UISearchBar . In my app I have code to prevent entering a '%' sign on the search bar and for doing this it replaces a % to @"" in textDidChange method as below: - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText { self.searchBar.text = [searchText stringByReplacingOccurrencesOfString:@"%" withString:@""]; } So if I type text "abc%xyz", the final text visible on search bar would be 'abcxyz'. No when I click undo, I see 'xyz' gets cleared and I still see 'abc' on the search bar instead of clearing 'abcxyz' all at one go. Now if

WPF快速入门系列(5)——深入解析WPF命令

怎甘沉沦 提交于 2019-11-29 12:19:32
一、引言   WPF命令相对来说是一个崭新的概念,因为命令对于之前的WinForm根本没有实现这个概念,但是这并不影响我们学习WPF命令,因为设计模式中有命令模式,关于命令模式可以参考我设计模式的博文: http://www.cnblogs.com/zhili/p/CommandPattern.html 。命令模式的要旨在于把命令的发送者与命令的执行者之间的依赖关系分割开了。对此,WPF中的命令也是一样的, WPF命令使得命令源(即命令发送者,也称调用程序)和命令目标(即命令执行者,也称处理程序)分离 。现在是不是感觉命令是不是亲切了点了呢?下面就详细分享下我对WPF命令的理解。 二、命令是什么呢?   上面通过命令模式引出了WPF命令的要旨,那在WPF中,命令是什么呢?对于程序来说,命令就是一个个任务,例如保存,复制,剪切这些操作都可以理解为一个个命令。即当我们点击一个复杂按钮时,此时就相当于发出了一个复制的命令,即告诉文本框执行一个复杂选中内容的操作,然后由文本框控件去完成复制的操作。在这里,复杂按钮就相当于一个命令发送者,而文本框就是命令的执行者。它们之间通过命令对象分割开了。如果采用事件处理机制的话,此时调用程序与处理程序就相互引用了。   所以对于命令只是从不同角度理解问题的一个词汇,之前理解点击一个按钮,触发了一个点击事件,在WPF编程中也可以理解为触发了一个命令

In Chrome undo does not work properly for input element after contents changed programmatically

夙愿已清 提交于 2019-11-29 11:12:42
In Chrome, I noticed that undo does not work properly for input element after the contents of the element has been changed programmatically. Although I get different behaviours for different browsers, they're not as bad as Chrome. FF20 good IE9 some support (undo stack cleared when input loses focus) Safari5 some support (undo stack cleared when input loses focus) Chrome26 unreliable For example, a script that trims spaces (see also jsfiddle below) type some spaces before "hello!", click outside the input element click on the input element and press Ctrl-Z now the text is gone (in Chome)

how to implement undo/redo operation without major changes in program

左心房为你撑大大i 提交于 2019-11-29 09:09:29
问题 Hi I'm about to add new functionality to application which I'm currently writting. I need to write a undo/redo fnctionality. However 90% of our application is ready and I don't know what is the best way to implementing this functionality without affectig(too much ) code which has been already created. 回答1: There aren't many details here. However, Undo/Redo functionality is typically handled via some variation of the Command Pattern. Depending on your architecture, this could be a simple

Oracle重建Undo表空间

旧时模样 提交于 2019-11-29 08:06:59
一台开发机的空间不够了,想挪也没地方挪,检查了一下,UNDOTBS01.DBF文件比较大了,有8个多G,决定重建一下回收。 原来的UNDO表空间名字是UNDOTBS1,DB版本是10G 1.新建一个新的UNDO表空间 C:\Documents and Settings\Administrator>sqlplus "/as sysdba" SQL*Plus: Release 10.2.0.1.0 - Production on 星期四 3月 28 14:59:37 2013 Copyright (c) 1982, 2005, Oracle. All rights reserved. 连接到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production With the Partitioning, OLAP and Data Mining options SQL> create undo tablespace undotbs2 datafile ‘E:\oracle\product\oradata\orcl\undotbs02.dbf’ size 10M 2.切换到新的UNDO SQL> alter system set undo_tablespace=’UNDOTBS2′ scope

华三设备模拟配置校园网双出口(策略路由)

匆匆过客 提交于 2019-11-29 07:31:52
博文目录: 一、策略路由是什么? 二、配置H3C双出口 1、配置NAPT 2、配置NATserver将内网telnet功能发布到外网 3、配置Easy-IP 4、配置策略路由 一、策略路由是什么? 它与单纯依照IP报文的目的地址查找路由表进行转发不同,策略路由是一种依据用户制定的策略进行路由选择的机制。策略路由是在路由表已经产生的情况下,不按照路由表进行转发,而是根据需要,依照某种策略改变其转发路径的方法。 路由策略的操作对象是“路由”信息,主要通过对路由的过滤和对路由属性或参数的设置来间接影响数据转发。策略路由的操作对象是“数据包”,主要通过设定的策略直接指导数据的转发。 策略路由通常分为两种: IP单播策略路由 IP组播策略路由 不管是单播策略路由还是组播策略路由,其配置都需要做两方面的工作:一是定义哪些需要使用策略路由的报文;二是为这些报文指定路由,这可以通过对一个Route-policy的定义来实现。 本博文案例中涉及单播策略路由,下面对单播策略路由做分析。 IP单播策略路由可以分为接口策略路由和本地策略路由两种。 接口策略路由:在接口视图下配置(应用于报文到达的接口上),作用于到达该接口的报文。 本地策略路由:在系统视图下配置,对本机产生的报文进行策略路由。 策略路由可用于安全、负载分担等目的。对于一般转发和安全等方面的使用需求,大多数情况下使用的是接口策略路由。 二

什么是WAL?

佐手、 提交于 2019-11-29 07:20:28
什么是WAL? https://www.cnblogs.com/hzmark/p/wal.html 原来数据库与消息中间件 用的是相同的模式 都是基于 顺序写的性能优于 离散写 series 强于scatter 在写完上一篇《Pull or Push》之后,原本计划这一片写《存储层设计》,但是临时改变主意了,想先写一篇介绍一下消息中间件最最基础也是最核心的部分:write-ahead logging(WAL)。 什么是WAL "In computer science, write-ahead logging (WAL) is a family of techniques for providing atomicity and durability (two of the ACID properties) in database systems."——维基百科 在计算机领域,WAL(Write-ahead logging,预写式日志)是数据库系统提供原子性和持久化的一系列技术。 在使用WAL的系统中,所有的修改都先被写入到日志中,然后再被应用到系统状态中。通常包含redo和undo两部分信息。 为什么需要使用WAL,然后包含redo和undo信息呢?举个例子,如果一个系统直接将变更应用到系统状态中,那么在机器掉电重启之后系统需要知道操作是成功了,还是只有部分成功或者是失败了

Undo previously seeded data in Rails

淺唱寂寞╮ 提交于 2019-11-29 06:22:35
I have seeded a row of data to my table by editing db/seed.rb file and executing rake db:seed command. Unknowingly, I put some wrong information in to that row. So I want to remove the previously added row of data. Is there any rake command for the same like rake db:rollback for rake db:migrate . There are a couple of aspects to this: 1: You want to change the seed data when no other data is present in the database: You should simply redo the rake db:seed after updating the seed.rb file. Make sure you have MyModel.delete_all before you try to add anything to that model. 2: You want to change

Undo/redo with a UITextView (iOS/iPHone)

谁说我不能喝 提交于 2019-11-29 04:16:42
问题 I have a view where a UITextView always has focus. What I want to do is extend the built-in undo/redo behavior to support undo/redo for when I programmatically set the text (e.g., for when I clear it, by setting it to @""). Since only the firstResponder gets undo/redo events, I thought I'd simply use the UITextView's undoManager property to create my invocations. e.g., // Before clearing the text... [[self.myTextView.undoManager prepareWithInvocationTarget:self] undoClear:self.myTextView.text