今天碰到一个诡异的问题:
新同事安装完毕FlashBuilder4,作为插件版安装完毕后,启动Eclipse,极为异常, 无法import已有project.
询问才知他使用的是Eclipse 3.7,如果没有记错, 应该是下一版本(4.6)才能支持Eclipse 3.7。
不过FlashBuilder 4.5 并未发布独立的插件版本,不知4.6会否发布插件版了,我还是比较喜欢作为插件版安装到Eclipse中。
When I try to install some plugins for my eclipse, there always some error like:
An error occurred while uninstalling
session context was:(profile=epp.package.java,
phase=org.eclipse.equinox.internal.provisional.p2.engine.phases.Uninstall,
operand=[R]org.apache.commons.lang 2.3.0.v200803061910 –>
[R]org.apache.commons.lang 2.3.0.v201005080501,
action=org.eclipse.equinox.internal.p2.touchpoint.eclipse.actions.UninstallBundleAction).
Error while loading manipulator.
Error while loading manipulator.
At first, I think maybe it’s because my proxy set up. but after try my times, I think maybe because my eclipse has been changed.
So I download a pure eclipse, and I can install the plugins now.
Then I check the config file of Eclipse(eclipse.ini), it has been modifed, and just few paramerters like: xms, xmx…I think it’s just because the config. and here is a bug page:https://bugs.eclipse.org/bugs/show_bug.cgi?id=325757(some one think it’s a bug)
And my solution is:
Check your eclipse config file(eclipse.ini), make sure it’s correct, see: http://wiki.eclipse.org/FAQ_How_do_I_increase_the_heap_size_available_to_Eclipse%3F
随着FlashBuilder4.5的发布, 用户组里堆满了关于移动开发的帖子, 关于AIR能否火起来, AIR性能的问题, 暂不考虑, 没有调查没用应用就没有发言权. 但如果本身应用是基于Flex的, 很多类库或UI都可以复用, 在这种情况下如果要做移动应用, 那选择AIR无疑能够节省大量时间.
基于浏览器的Flex应用根标签为Application;
基于AIR的桌面应用为WindowedApplication; Android应用则为ViewNavigatorApplication.
由于Android应用也是基于AIR的, 所以与Flex或桌面AIR开发并无很大差异, 不同的只是在View切换上.
1. 应用入口类型为: ViewNavigatorApplication
2. 具体页面的类型为:View;
1. 创建ViewNavigatorApplication
在ViewNavigatorApplication中有一个property为: private var _firstView:Class, 可定义应用启动后的默认View; 同时用一个navigator, 负责切换View.
2. 创建View: 使用View组件或继承spark.components.View类创建组件;
3. 切换View: 在View中使用navigator.popView();切换到前一页面, 或使用navigator.pushView(DetailsView, list.selectedItem);切换到下一页面, 并可在切换时传递data(navigator中有一个NavigationStack, 故名思意, Stack, pop/push, 先入后出)
4. 获得View切换时的数据: 在view中直接使用data即可获得.
>>点此浏览源代码(托管于Google Code)<<
svn checkout http://androidhelloworldinflex.googlecode.com/svn/trunk/ androidhelloworldinflex-read-only
适用情景: 假如有一组相关的算法, 客户需要从中动态选择一个来使用. 譬如: 学校中的新生分班, 有按照成绩分班, 按照性别分班, 按照住宿类型分班等等. (当然实际情况中的分班考虑因素会更复杂一些)
最简单的方法是一个Method, 通过判断类型进行相应操作. 但这样做的是这个Method会巨大无比, 不易维护. 因此我们可使用Strategy模式, 会多一些Interface或Class, 但会降低耦合, 拥有更佳的可扩展性.
负责进行分班的主体类包含IClassEnrollStrategy的一个Instance, 对于这个Instance可以使用以下方式注入:
1. 使用Constructor注入到ClassEnroll中, 可在ClassEnroll中增加一个Constructor:
ClassEnroll(strategy:IClassEnrollStrategy)
2. 使用Setter注入. ClassEnroll中对strategy的Setter方法:
setStrategy(strategy:IClassEnrollStrateStrategy)
3. 在ClassEnroll使用工厂模式创建IClassEnrollStrategy实例.
Those days I’m looking a new job related to Java and Flex… Seems that this is a popular interview question, I event didn’t encounter it in the ACE. But I was asked more than 3 times.
Talk about overloading in OOPS:
Overloading is between the methods with the same name, If two methods of a class (whether both declared in the same class, or both inherited by a class, or one declared and one inherited) have the same name but signatures that are not override-equivalent, then the method name is said to be overloaded.
ActionScript 3 support overriding, But why it is not support overloading?
It’s a good question, and can be the answer of what’s the difference between Java and Flex?
Based on the Standard ECMA-262 (ECMAScript Language Specification), Action Script does not implement the overloading. and every method in the class is a Function object(property)
Since AS doesn’t support overloading, what can you do to implement the overloading?
As I known, Basically there are three way to handle the overload requirement:
1. Using optional parameters, such as:
getUser(userID:int = –1, userName: String = null):User {..}
2. Using rich parameters:
getUser(…args):User{
if(args.length == 0) {
return null;
}else if (args.length…)….
}
3. Using Object as the parameters, like:
getUser(arg: Object):User {
if(arg is String) {
return …. get user by the userName;
} else {
if (arg is int) {
return …get user by the userID;
}//end of if.
}
According those codes, you can see those methods all need very clear comments, and not easy for other to use them. in the comment we need to tell others the parameters type or sequence.
In fact, Since the AS does not support the overloading, and the comments need be very very clear, and usually, there will be two public methods: getUserByID(), getUserByName(), maybe a private or protected method using the above 3 ways to do the get user job.
// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.