terça-feira, 30 de março de 2010

Context root

Quando se cria um Flex Project informando que será utilizado o BlazeDS mantendo a maioria das opções com seus valores default ao testar uma chamada de um RemoteObject pode dar erro de envio.
Isto acontece porque em Project > Properties > Flex Server está com a opção Context root igual o conteúdo da opção Content folder que foi informada no wizard de criação do seu Flex Project.
Esta opção deve ser mudada para ficar igual a mesma opção da aba Web Project Settings.

Lembre-se que o services-config.xml normalmente terá a variável {context.root} que é trocada no momento da compilação pelo conteúdo de Context root da aba Flex Server, ocasionando o erro numa chamada de um RemoteObject pois deveria estar o valor da outra aba.

Procurando no Adobe Bug System encontrei este bug relatado nos seguintes links:
FB-26246 Context Root variable set incorrectly
FB-11617 The context root is not set correctly when creating a J2EE + WTP project

Quem quiser votem, lembre-se que quanto mais votos mais irá chamar a atenção do Flex Team.

quarta-feira, 24 de março de 2010

Aprendendo Flex 4

Agora que o Flex 4 foi liberado é hora de aprender o que mudou nesta nova versão, até então não tinha baixado nenhuma versão beta pq o tempo é pouco e sempre pode mudar alguma coisa até a versão final.

Veja abaixo alguns sites que me ajudaram ou que estão me ajudando e espero que ajudem vocês também:
Adobe - Flex Developer Center
As 10 Maiores Mudanças no Flex 4
Novo Flex 4 (Gumbo)
New Features in FlashBuilder 4
Flash Builder 4; Uma análise mais a sério!
What's new in Flash Builder 4
What's new in Flex 4
Differences between Flex 3 and Flex 4
Introducing skinning in Flex 4
A brief overview of the Spark architecture and component set
Spark layouts with Flex 4

segunda-feira, 22 de março de 2010

quinta-feira, 4 de março de 2010

Histórias das Bolsas de Valores

Um assunto que me atrai muito são as histórias das bolsas de valores: catástrofes financeiras, crash de 1929, mania das tulipas, bolhas financeiras, história de operadores de mercado, etc.

Este tipo de leitura ajuda a mostrar alguns aspectos da personalidade humana como o efeito manada e também mostram que crises ou bolhas financeiras sempre existiram e sempre existirão.

Abaixo uma relação de livros nessa linha:

terça-feira, 2 de março de 2010

Modules

Estou estudando sobre módulos (Flex 3 Developer Guide) e fiz um resumo dos tópicos que achei importantes para melhor fixação e abaixo estou disponibilizando este resumo.

About modules

Modules
are SWF files that can be loaded and unloaded by an application. They cannot be run independently of an application, but any number of applications can share the modules.
The main application, can dynamically load other modules that it requires, when it needs them.

Benefits of modules
  • Smaller initial download size of the SWF file.
  • Shorter load time due to smaller SWF file size.
  • Better encapsulation of related aspects of an application.

A module is a special type of dynamically loadable SWF that contains an IFlexModuleFactory class factory. This allows an application to load code at run time and create class instances without requiring that the class implementations be linked into the main application. Modules are similar to Runtime Shared Libraries (RSLs) in that they separate code from an application into separately loaded SWF files. Modules are much more flexible than RSLs because modules can be loaded and unloaded at run time and compiled without the application.

Creating ActionScript-based modules

If your module does not include any framework code, you can create a class that extends ModuleBase. If you use the ModuleBase class, your module will typically be smaller than if you use a module based on the Module class because it does not have any framework class dependencies.

Reducing module size

Module size varies based on the components and classes that are used in the module. By default, a module includes all framework code that its components depend on, which can cause modules to be large by linking classes that overlap with the application’s classes.

To reduce the size of the modules, you can optimize the module by instructing it to externalize classes that are included by the application. The result is that the module includes only the classes it requires, while the framework code and other dependencies are included in the application.

To externalize framework classes with the command-line compiler, you generate a linker report from the application that loads the modules. You then use this report as input to the module’s load-externs compiler option. The compiler externalizes all classes from the module for which the application contains definitions. This process is also necessary if your modules are in a separate project from your main application in Flex Builder.

1. Generate the linker report and compile the application:
mxmlc -link-report=report.xml MyApplication.mxml

2. Compile the module and pass the linker report to the load-externs option:
mxmlc -load-externs=report.xml MyModule.mxml

Note: If you externalize the module’s dependencies by using the load-externs or optimize option, your module might not be compatible with future versions of Adobe Flex.

Note: At Flash Builder this process can be performed in Project > Properties > Flex Modules.

ModuleManager and ModuleLoader

The ModuleManager manages the set of loaded modules, which are treated as a map of Singletons that are indexed by the module URL. The ModuleLoader class is a thin layer on top of the ModuleManager API that is intended to act similarly to the mx.controls.SWFLoader class for modules that only define a single visual UIComponent. The ModuleLoader class is the easiest class to use when implementing a module-based architecture, but the ModuleManager provides greater control over the modules.

When you load a module, Flex ensures that there is only one copy of a module loaded, no matter how many times you call the loadModule() method for that module.

Using the ModuleLoader class to load modules

Setting the target URL of a ModuleLoader object triggers a call to the loadModule() method. This occurs when you first create a ModuleLoader object with the url property set. It also occurs if you change the value of that property.

If you set the value of the url property to an empty string (""), the ModuleLoader object unloads the current module.

Using the ModuleManager class to load modules

To use the ModuleManager to load a module in ActionScript, you first get a reference to the module’s IModuleInfo interface by using the ModuleManager getModule() method. You then call the interface’s load() method.

Finally, you use the factory property of the interface to call the create() method and cast the return value as the module’s class.

import mx.events.ModuleEvent;
import mx.modules.ModuleManager;
import mx.modules.IModuleInfo;
public var info:IModuleInfo;

private function initApp():void {

info = ModuleManager.getModule("ColumnChartModule.swf");
info.addEventListener(ModuleEvent.READY, modEventHandler);
// Load the module into memory. Calling load() makes the
// IFlexModuleFactory available. You can then get an
// instance of the class using the factory's create() method.
info.load();
}

private function modEventHandler(e:ModuleEvent):void {
// Add an instance of the module's class to the display list.
vb1.addChild(info.factory.create() as ColumnChartModule);

}

You do not need to call the unload() method when adding and removing modules using the IModuleInfo class. You just need to set the IModuleInfo instance to null.

Module domains

By default, a module is loaded into a sibling domain of the current application domain. You can specify a different application domain by using the applicationDomain property of the ModuleLoader class. Because a module is loaded into a child domain, it owns class definitions that are not in the main application’s domain. For example, the first module to load the PopUpManager class becomes the owner of the PopUpManager class for the entire application because it registers the manager with the SingletonManager. If another module later tries to use the PopUpManager, Adobe ® Flash® Player throws an exception. The solution is to ensure that managers such as PopUpManager and DragManager and any other shared services are defined by the main application (This technique also applies to components). Typically, this is done by adding the following to a script block:

import mx.managers.PopUpManager;

import mx.managers.DragManager;

private var popUpManager:PopUpManager;

private var dragManager:DragManager;


Because a Flex module must be in the same security domain as the application (SWF) that loads it, when you’re using modules in an AIR application any module SWF must be located in the same directory as the main application SWF or one of its subdirectories, which ensures that like the main application SWF, the module SWF is in the AIR application security sandbox.

By default, modules do not share the main application’s StyleManager, however. They have their own instances of the IStyleManager2 class. As a result, modules can define their own styles. For example, style properties set on a Button control in one module are not applied to the Button control in another module or to the main application.


See also:
Gerenciamento de memória e tamanho dos arquivos em grandes aplicativos utilizando o Modules do Flex 2.0.1
Module unload doesn't competely unload a module (SDK-12025)

Organizando Favoritos

Estou organizando os meus favoritos no FireFox e como sempre sincronizei os meus favoritos de casa com o trabalho e vice-versa de uma forma braçal perguntei para os meus colegas se não conheciam um add-on que deixasse esse sincronismo mais automático, me recomendaram, então o Xmarks. Para usar ele é criada uma conta free onde é possível consultar seus favoritos pela internet ou em qualquer máquina com este addon através do sincronismo dos favoritos.

Percebi também que possuía muitos favoritos duplicados e "quebrados". Para facilitar o trabalho de identificar estes favoritos criei uma classe java a qual deixo disponível.

segunda-feira, 1 de março de 2010

Freelancer / Remoto - Alerta

Quem não gostaria de fazer um freelancer ou trabalhar full-time de forma remota no conforto de seu lar?
Acredito que a maioria de nós.
Neste mundo globalizado e com as ferramentas atuais isto se tornou possível.

Este post, não é para discutir as vantagens e desvantagens do trabalho remoto, já existem vários sites por aí sobre o assunto, venho aqui somente como alerta para não caírem no conto do vigário. Cada vez mais se houve falar aqui ou ali de pessoas que prestaram serviços para empresas, algumas se dizem dos Estados Unidos, que prometem mundos e fundos e acabaram a ver navios.

Fica aqui o alerta, quando forem se candidatar a uma vaga destas tentem pegar maiores informações, só ter um site bonito não resolve, veja se tem informações na mídia sobre esta empresa, se for no Brasil e perto de vocês tentem marcar uma entrevista local, no escritório da empresa, se for no exterior e tiverem algum conhecido nesta região peça a esta que verifique o endereço (às vezes são fictícios).
Uma outra boa dica é entrar em contato privado com pessoas de confiança da comunidade Flex para ver se elas conhecem a empresa.

Da mesma maneira que a globalização e a internet deixou o mundo menor, fazendo empresas e pessoas más intencionadas chegarem até nós, através das mesmas ferramentas podemos nos proteger destas pessoas.

Investiguem primeiro, da mesma maneira que há emrpesas confiáveis utilizando esta nova forma de contratação também há aquelas que se beneficiam da distância para agirem de má fé.