- 浏览: 802654 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (360)
- Java (101)
- JPA/Hibernate (10)
- Spring (14)
- Flex/BlazeDS (37)
- Database (30)
- Lucene/Solr/Nutch (0)
- Maven/Ant (25)
- CXF/WebService (3)
- RPC/RMI/SOAP/WSDL (1)
- REST (6)
- TDD/BDD/JUnit (1)
- Servlet/JSP (2)
- AI/MachineLearning (3)
- Resource (1)
- 字符编码 (2)
- OOA/OOPS/UML (5)
- DesignPattern (8)
- 算法与数据结构 (11)
- Web&App Server (13)
- 并发&异步&无阻塞 (7)
- Entertainment (4)
- JavaScript/ExtJS (45)
- CodeStyle&Quality (1)
- svn/git/perforce (8)
- JSON (2)
- JavaScriptTesting (4)
- Others (6)
- RegularExpression (2)
- Linux/Windows (12)
- Protocal (2)
- Celebrities (1)
- Interview (1)
- 计算机语言 (1)
- English (2)
- Eclipse (5)
- TimeZone/时区 (1)
- Finance (1)
- 信息安全 (1)
- JMS/MQ (2)
- XSD/XML/DTD (3)
- Android (4)
- 投资 (3)
- Distribution (3)
- Excel (1)
最新评论
-
qdujunjie:
如果把m换成具体的数字,比如4或者5,会让读者更明白
m阶B树中“阶”的含义 -
java-admin:
不错,加油,多写点文章
关于Extjs的mixins和plugin -
xiehuaidong880827:
你好,我用sencha cmd打包完本地工程后,把app.js ...
ExtJS使用Sencha Cmd合并javascript文件为一个文件 -
KIWIFLY:
lwpan 写道inverse = "true&qu ...
Hibernate中什么时候使用inverse=true -
luedipiaofeng:
good
消除IE stop running this script弹出框
1. Be careful when defining uid property in your class
if you defined a uid property in your class (in regardless of its type, no matter what type it is), you will certainly find something wrong in your application soon, such as you cannot select some rows in List control and nodes in Tree control, why do we have this kind of strange issue when we don’t see any compiler error and runtime error, the reason is because flex data provider controls use a unique identifier (UID) to track data items, flex can automatically create and manage UIDs, but if you own class has uid property, flex will use the class defined uid, when the value of uid property in your object is not unique, then you will get above described strange issue.
By the way, you can use logger. debug ("selected object's uid:"+UIDUtil.getUID(selectedObject)); to check the uid value of your selected object.
Please see the following section for more details about uid in flex.
2. Data providers and the uid property
Flex data provider controls use a unique identifier (UID) to track data items. Flex can automatically create and manage UIDs. However, there are circumstances when you must supply your own uid property by implementing the IUID interface, and there are circumstances when supplying your own uid property improves processing efficiency.
Because the Object and Array classes are dynamic, you normally do not do anything special for data objects whose items belong to these classes. However, you should consider implementing the IUID if your data object items belong to custom classes that you define.
Note: When Flex creates a UID for an object, such as an item in an ArrayCollection, it adds the UID as an mx_internal_uid property of the item. Flex creates mx_internal_uid properties for any objects that are dynamic and do not have bindable properties. To avoid having Flex create mx_internal_uid properties, the object class should do any of the following things: have at least one property with a [Bindable] metadata tag; implement the IUID interface; or have a uid property with a value.
If Flex must consider two or more different objects to be identical, the objects must implement the IUID interface so that you can assign the same uid value to multiple objects. A typical case where you must implement the IUID interface is an application that uses paged collections. As the cursor moves through the collection, a particular item might be pulled down from the server and released from memory repeatedly. Every time the item is pulled into memory, a new object is created to represent the item. If you need to compare items for equality, Flex should consider all objects that represent the same item to be the same "thing."
More common than the case where you must implement the IUID interface is the case where you can improve processing efficiency by doing so. As a general rule, you do not implement the IUID interface if the data provider elements are members of dynamic classes. Flex can automatically create a uid property for these classes. There is still some inefficiency, however, so you might consider implementing the IUID interface if processing efficiency is particularly important.
In all other cases, Flex uses the Dictionary mechanism to manage the uid, which might not be as efficient as supplying your own UID.
The IUID interface contains a single property, uid, which is a unique identifier for the class member, and no methods. Flex provides a UIDUtil class that uses a pseudo-random-number generator to create an identifier that conforms to the standard GUID format. Although this identifier is not guaranteed to be universally unique, it should be unique among all members of your class. To implement a class that uses the UIDUtil class, such as a Person class that has fields for a first name, last name, and ID, you can use the following pattern:
package {
import mx.core.IUID;
import mx.utils.UIDUtil;
[Bindable]
public class Person implements IUID {
public var id:String;
public var firstName:String;
public var lastName:String;
private var _uid:String;
public function Person() {
_uid = UIDUtil.createUID();
}
public function get uid():String {
return _uid;
}
public function set uid(value: String):void {
// Do nothing, the constructor created the uid.
}
}
}
You do not need to use the UIDUtil class in a case where the objects contain a uniquely-identifying field such as an employee ID. In this case, you can use the person's ID as the uid property, because the uid property values uniquely identify the object only in the data provider. The following example implements this approach:
package
{
import mx.core.IUID;
[Bindable]
public class Person implements IUID {
public var employee_id:String;
public var firstName:String;
public var lastName:String;
public function get uid(): String {
return employee_id;
}
public function set uid(value: String): void {
employee_id=value;
}
}
}
Note: Object cloning does not manage or have a relationship with UIDs, so if you clone something that has an internal UID you must also change that internal UID. UIDs are stored on mx_internal_uid only for dynamic Objects. Instances of data classes that implement IUID store their UIDs in a uid property, so that is the property that must be changed after cloning.
3. Some guys who suffering from this problem
This has cost me a lot of time. If you implement a custom ValueObject which has a public property called uid (which was actually an user id in my app) and all of the items in the list have the same user id this will lead into serious problems. There should be at least a compiler warning or something that assigning uid can lead to problems if it isn't unique for all items. I searched about 2 hours for this entry.
An alternative to implementing iuid in order to have multiple objects as equal, is to check for the existence of an object in memory before instantiating it. A simple factory method that updates instead of creates when appropriate will do the job. Often a primary key for the database table will serve the purpose to identify the equal object.
It might be useful to use a database primary key as a light weight iuid, but I have not yet tried this because the value of my primary keys change from a negative number to a positive one when the row is inserted in the database.
if you defined a uid property in your class (in regardless of its type, no matter what type it is), you will certainly find something wrong in your application soon, such as you cannot select some rows in List control and nodes in Tree control, why do we have this kind of strange issue when we don’t see any compiler error and runtime error, the reason is because flex data provider controls use a unique identifier (UID) to track data items, flex can automatically create and manage UIDs, but if you own class has uid property, flex will use the class defined uid, when the value of uid property in your object is not unique, then you will get above described strange issue.
By the way, you can use logger. debug ("selected object's uid:"+UIDUtil.getUID(selectedObject)); to check the uid value of your selected object.
Please see the following section for more details about uid in flex.
2. Data providers and the uid property
Flex data provider controls use a unique identifier (UID) to track data items. Flex can automatically create and manage UIDs. However, there are circumstances when you must supply your own uid property by implementing the IUID interface, and there are circumstances when supplying your own uid property improves processing efficiency.
Because the Object and Array classes are dynamic, you normally do not do anything special for data objects whose items belong to these classes. However, you should consider implementing the IUID if your data object items belong to custom classes that you define.
Note: When Flex creates a UID for an object, such as an item in an ArrayCollection, it adds the UID as an mx_internal_uid property of the item. Flex creates mx_internal_uid properties for any objects that are dynamic and do not have bindable properties. To avoid having Flex create mx_internal_uid properties, the object class should do any of the following things: have at least one property with a [Bindable] metadata tag; implement the IUID interface; or have a uid property with a value.
If Flex must consider two or more different objects to be identical, the objects must implement the IUID interface so that you can assign the same uid value to multiple objects. A typical case where you must implement the IUID interface is an application that uses paged collections. As the cursor moves through the collection, a particular item might be pulled down from the server and released from memory repeatedly. Every time the item is pulled into memory, a new object is created to represent the item. If you need to compare items for equality, Flex should consider all objects that represent the same item to be the same "thing."
More common than the case where you must implement the IUID interface is the case where you can improve processing efficiency by doing so. As a general rule, you do not implement the IUID interface if the data provider elements are members of dynamic classes. Flex can automatically create a uid property for these classes. There is still some inefficiency, however, so you might consider implementing the IUID interface if processing efficiency is particularly important.
In all other cases, Flex uses the Dictionary mechanism to manage the uid, which might not be as efficient as supplying your own UID.
The IUID interface contains a single property, uid, which is a unique identifier for the class member, and no methods. Flex provides a UIDUtil class that uses a pseudo-random-number generator to create an identifier that conforms to the standard GUID format. Although this identifier is not guaranteed to be universally unique, it should be unique among all members of your class. To implement a class that uses the UIDUtil class, such as a Person class that has fields for a first name, last name, and ID, you can use the following pattern:
package {
import mx.core.IUID;
import mx.utils.UIDUtil;
[Bindable]
public class Person implements IUID {
public var id:String;
public var firstName:String;
public var lastName:String;
private var _uid:String;
public function Person() {
_uid = UIDUtil.createUID();
}
public function get uid():String {
return _uid;
}
public function set uid(value: String):void {
// Do nothing, the constructor created the uid.
}
}
}
You do not need to use the UIDUtil class in a case where the objects contain a uniquely-identifying field such as an employee ID. In this case, you can use the person's ID as the uid property, because the uid property values uniquely identify the object only in the data provider. The following example implements this approach:
package
{
import mx.core.IUID;
[Bindable]
public class Person implements IUID {
public var employee_id:String;
public var firstName:String;
public var lastName:String;
public function get uid(): String {
return employee_id;
}
public function set uid(value: String): void {
employee_id=value;
}
}
}
Note: Object cloning does not manage or have a relationship with UIDs, so if you clone something that has an internal UID you must also change that internal UID. UIDs are stored on mx_internal_uid only for dynamic Objects. Instances of data classes that implement IUID store their UIDs in a uid property, so that is the property that must be changed after cloning.
3. Some guys who suffering from this problem
This has cost me a lot of time. If you implement a custom ValueObject which has a public property called uid (which was actually an user id in my app) and all of the items in the list have the same user id this will lead into serious problems. There should be at least a compiler warning or something that assigning uid can lead to problems if it isn't unique for all items. I searched about 2 hours for this entry.
An alternative to implementing iuid in order to have multiple objects as equal, is to check for the existence of an object in memory before instantiating it. A simple factory method that updates instead of creates when appropriate will do the job. Often a primary key for the database table will serve the purpose to identify the equal object.
It might be useful to use a database primary key as a light weight iuid, but I have not yet tried this because the value of my primary keys change from a negative number to a positive one when the row is inserted in the database.
发表评论
-
Panel高度为0但里面的组件依旧显示
2013-04-24 14:34 1118解决办法: 把Panel中的内容组件用<s:Scroll ... -
约束布局constraint layout
2013-03-01 14:02 1851约束布局constraint layout要点: 1)只有支持 ... -
根据屏幕分辨率动态调整组件大小
2013-02-22 17:34 1550将代码写在组件的preInitialize事件监听器里面 简化 ... -
设置Flex组件的尺寸大小
2013-02-21 16:17 1574深红色部分标明了需注意的地方 另外要注意组件和容器的生命周 ... -
Flex minWidth minHeight
2013-02-04 16:17 1560minWidth 这个值并不是给组件自己用的,而是给组件的父容 ... -
ActionScript遍历绑定(BindProperty,BindSetter,ChangeWatcher)
2013-02-01 10:11 2494注意: 为防止内存益处,记得调用watcherInstance ... -
Flex程序适应不同屏幕尺寸和分辨率(滚动条)
2013-01-31 15:02 9860FlashBuilder编译后自动生成的xx.html里面定义 ... -
FlexContext, FlexClient,FlexSession
2013-01-15 15:05 2418使用了BlazeDS后,可以从FlexContext中获取一系 ... -
防止RemoteObject批处理AMF消息
2013-01-14 17:01 1311问题描述: 如果你在短时内调用同一个java对象上的两个方法, ... -
自动检测http和https的RemoteObject
2013-01-13 10:30 1812package { import util.Bro ... -
flex浏览器相关辅组类
2012-12-06 13:39 1282package util { import flash. ... -
Flex可变参数带来的问题
2012-12-06 13:34 1524当你在flex的方法中用了可变参数后,你会发现这些参数传到ja ... -
flex如何通过类名称实例化对象
2012-11-30 13:52 2766Getting the class from an objec ... -
flexlib的treeGrid用法
2012-11-30 13:46 1322为了使用treeGrid,通常你需要定义自己的DataDesc ... -
自定义flex tree的DataDescriptor
2012-11-30 13:42 1439public class EnvironmentDataDes ... -
关于Boolean类型在flex与java中间传递的问题
2012-11-30 13:38 1283/** *为简化,只列举两个字段 */ publi ... -
给Flex的Tree赋值方式(XML和ArrayCollection)
2012-11-30 09:33 40581)方式一,mxml内嵌xml数据赋值方式,Embedded ... -
Custom Alert
2012-11-26 19:21 0<?xml version="1.0&qu ... -
Flex服务端分页
2012-11-14 17:00 1084Structure: model event ... -
Flex可携带数据的Aler组件(DataCarriableAlert)
2012-11-14 16:52 1363package component.alert { ...
相关推荐
全英文的魔电书,对留学生比较有帮助,在ccebook下载的不知各位大侠赏不赏脸。。。
is fi rst illustrated through real-life analogy. Corresponding Java language constructs are introduced in an integrated fashion to demonstrate the programming required to simulate the real-world ...
### 深度视觉类比生成 (Deep Visual Analogy-Making) #### 摘要 本文探讨了深度视觉类比生成技术,这是一种重要的图像理解任务,不仅涉及识别单个图像中的内容,还涉及到图像间的关联及生成相关图像。近年来,深度...
and engage with professionals in online forums to stay updated on the latest trends and technologies in the JAVA field."例如:“我经常参加行业活动,阅读文章和博客,并在在线论坛中与同行交流,以保持对...
这是论文Visual Attribute Transfer through Deep Image Analogy的原文,内含有小编本人的理解与注释,谨以此分享个人经验和向广大大牛请教,如有错误,请不吝指出,万分感谢!
类比日志查看器 日志查看器,可以解析日志文件并流式传输C#,Python,Java和其他应用程序的日志。 您还可以实现自己的解析器或请求为其他日志添加新的解析器内容一般的类比日志查看器是Windows操作系统的多用途日志...
标题中的"Analogy-0.1-py3-none-any.whl.zip"是一个压缩文件,它包含了一个名为"Analogy-0.1-py3-none-any.whl"的Python软件包。这种格式通常用于分发Python的第三方库。下面将详细解释相关知识点。 1. **Python ...
这些插件可以无缝集成到Analogy中,为音乐制作增添无尽的创意选项。例如,portaudio_x86.dll是PortAudio库的一个组件,用于跨平台的音频输入和输出,它确保了Analogy与其他VST插件的兼容性。 此外,Analogy的GUI...
使用python实现的patchmatch算法,该代码主要实现补丁匹配算法,有两个patchmatch代码:PatchMatch.py??和PatchMatch_Bidirectional.py。最后一个用于代码DeepImageAnalogy
"Analogy.LogViewer.PowerToys" 是一个专为开发者设计的工具,用于解析和查看应用程序的日志文件。这个工具基于C#编程语言开发,旨在帮助IT专业人士和开发者更有效地理解和诊断软件运行时的问题。在日志分析过程中,...
and an analogy to Al, we estimate the coupling constant to be of order 1. Together with high phonon frequencies, which we estimate via zone-center frozen phonon calculations to be between 300 and 700 ...
纽伊姆 (NUI) 梅努斯大学源代码。 2014 年 12 月 12 日 ... ROS 生成和 ROS 评估工具包含在各自的文件夹中。 请使用 GenerateROS.html 查找 GenerateROS 程序的相关帮助文件和 ROS 评估工具的 rosat.html。
By analogy to Turing's enrichment of finite-state machines with an infinite memory tape, the addition of external memory to RNNs creates a "Neural Turing Machine." #### Practical Applications and ...
词类比 话题 给定三个词a,b和c,我们将必须生成下一个词d,以使a和b之间的关系与c和d之间的关系相同。 结果 这是单词嵌入的一些例子 学分 1.该存储库基于设置,。 2.杰弗里·彭宁顿(Jeffrey Pennington),理查德...
本文提出了一种通用框架,用于高效地进行二维与三维面部表情模拟(Facial Expression Analogy)。该框架的目标是为计算机动画专业人士提供一种工具,将任意来源面部的表情映射到任意目标面部上。在过去的研究中,...
使用直方图类比进行深层色彩转移 图:各种源图像和参考图像对上的颜色转移结果。为了可视化,参考图像被裁剪为与其他图像相同的尺寸。 该存储库包含以下论文的官方PyTorch实现: 李俊勇,孙亨锡,李健熙,李钟hy,...
Analogy Log服务器支持以下实时数据: Windows事件日志(可在服务器设置中配置)任何实现Proto文件的gRPC客户端(目前已经完全实现了C#,Python和JAVA(Poc)客户端)存在以下模块:努吉特版本描述主要类比日志...
Deep Image Analogy的基本思想是通过学习两个图像对之间的底层结构关系,然后将这种关系应用到第三个图像上,以实现视觉效果的转移。这种方法通常包括三个主要步骤:特征提取、关系学习和结果合成。在特征提取阶段,...
visual and inertial sensors.We term this estimation task visual-inertial odometry (VIO), in analogy to the well-known visual-odometry problem. We present a detailed study of EKF-based VIO algorithms, ...