Send custom event from one module to another module (Parsley) - actionscript-3

I have created a modular application. I have two modules, for example Module1 and Module2.
I have loaded these modules in my application. I am using Parsley in my application. I have loaded separate different context builder in both modules.
But when I am dispatching event from Module1, I am able to listen that event in that Module1 but I am trying to listen that event in another Module2. I am not able to listen that event in that Module2 through Parsley. Please help me.

I think it has something to do with you loading 2 different contexts for each module. Art gave out a really good tutorial on the matter: Art's Flex Notes - Nested Contexts.

I had done it by settings same application domain of all the modules...

Related

How do I track down the source definition of a custom hook event in a Mediawiki extension?

Here's an example:
https://phabricator.wikimedia.org/diffusion/EPFM/browse/master/?grep=BeforeFreeTextSubst
A Mediawiki extension where Hooks::run( 'PageForms::BeforeFreeTextSubst', ...) gets invoked but there's no other record or trace of where it's defined. If there was some mapping of strings/names to functions it would be registered somewhere else, and if it was a function name it should show up somewhere else.
I'm seeing this with a few other function hook events.
There isn't any "source definition" other than where the hook is run from. That is where the hook is defined; it may or may not actually be hooked onto anywhere. All the hook definition is is a name and a set of parameters that are passed to hook callbacks.
To help find out where the hook is actually used, you can use the (new) codesearch tool:
https://codesearch.wmflabs.org/extensions/?q=BeforeFreeTextSubst
(It looks like this one is not used by any extension that is in Wikimedia source control.)
Are you trying to find the functions that get called when the hook is run? The situation is a bit chaotic there. There are two mechanisms for defining hooks:
the $wgHooks global (this is the normal way of registering hooks);
and the Hooks::register method (sometimes used for registering hooks dynamically).
$wgHooks is normally set via the extension.json file, but can be set dynamically, too.
The quickest way to find out what hooks are registered is to run maintenance/shell.php and type in $wgHooks. This will miss hooks registered via the other method, and hooks which are conditionally registered (e.g. only for API calls), but it still works 99% of the time. Otherwise, you'll have to grep for it, as Sam said.

What order to you need to call stub, replace and fixture with Web Component tester

I am starting to build a test suite for some of the elements in my app. At the top level I have a <my-app> element and in its template it uses a <my-session element to contol user logon and an <iron-media-query> element to define how long a string to use in the app header.
In order to get better control of the behavior of these two, and am building special test versions of them and using the replace('my-session').with('test-session') approach to alter them. I will also use the stub function to control the interaction with the test suite.
I have read completely through the docs on the polymer web site, but I cannot find out if you have to use replace and stub before or after you call fixture.
Can someone advise
I eventually found the answer
Both have to be called before the fixture is instantiated. The reason being is that stub changes the prototype element (ie after its been created but before its stamped into the dom, so its needs to do it before the fixture).
The replace function actually adds an entry into a map for use when the fixture is instantiated. So again it needs to be called before the fixture call.
As of today, the latest release of web-components-tester doesn't contain a fix that allows this to work on on highly nested elements (for instance I was trying to test my app level element and the app-toolbar in the app-header-layout was not being expanded when replace had been used) but the fix is in the master. As a temporary measure I copied the master version of browser.js into the copy in use in the bower_componenents/web-component-tester directory.
I think there is still a bug in some very complex layouts. I had a paper-toast with a dom-if template inside its content which I was trying to replace with a test version to act as a mock, which also had the tag in its template. This didn't work

How do I create a Processing library that adds a new function to the language?

I want to create a Processing library that adds a single function to Processing. A single command. How do I do this?
So I want to be able to write on Processing this:
void setup() {
drawMyCustomShape()
}
In a way that drawMyCustomShape will be on my custom library implementation.
Thanks!
Note: this question is not about creating a new library in processing. Is about creating a library that exports one new command (so you can using without caring of the container class instance).
First of all, are you sure you really need to create an entire library? You could just add that class to your sketch without needing to deploy it as a library. If you're worried about clutter, just put it in its own tab.
If you really need to create a library, then there are three tutorials that you need to read:
Library Overview
Library Basics
Library Guidelines
But basically, you need to create a Java project (in an IDE like eclipse, or with a basic text editor and the command line) that uses Processing as a library. That's where you'd put your MyLibrary class. You'd then export it as a .jar file, and then import that .jar file into Processing. You would then be able to use your class exactly like you can use any other Processing library.
Your proposed setup has some other issues (how are you going to access the sketch variable from the static function?), but I'd suggest treating them as separate questions after you get the basics in place.
It sounds like you are actually looking to create your own extension of the Processing library, as in actually change the core jar file.
You can extend the actual Processing library by forking off of its main branch on Github. By writing your function drawMyCustomShape into the actual core in the forked version, you can then build the Processing Development Environment from your copy of the code. Using that particular copy of the PDE, you could do what you're describing.
Once you compile this build, you could actually distribute this copy of the PDE to your college students. They would be able to use your function as if nothing were changed. (I'm guessing that this is for an intro-level class at the college level, so that's why you would have to hide implementation from your students?)
Here's some links to get you started:
Processing github
Instructions for building the PDE from source
So, finally I found the most adequate answer for my case.
The solution for this is to implement a new Processing Mode that extends the builtin Java Mode. To include static members to the main processing program you will need to add a new static import to the ones that processing adds to your code.
You can do this by forking the Mode Template for 3.0 that #joelmoniz created from #martinleopold:
https://github.com/joelmoniz/TemplateMode/tree/3.0-compatibility
There is a good tutorial here:
http://pvcresin.hatenablog.com/entry/2016/03/17/210135
Why is the most adequate solution? : I think this is the best way to achieve new static methods in processing code and ensure an easy distribution! You just have to set the mode folder in your sketchbook/modes folder. If I were to fork processing it would be a big deal to prepare distributions for all operative systems and also to keep update with main project.
My particular solution:
To add my static imports into Processing I implemented a custom mode where I overrode the PdePreprocessor class which wraps the processing code with all the Java procesing code. So, the idea was to add more imports to the imports that the PdePreprocessor generates on the generated Java source.
In my custom PdePreprocessor I overrode the getCoreImports method to add my custom methods. I did this here because I consider the new imports are part of the core of my custom mode. You could also achieve this by overriding writeImports method.
In order to use my PdePreprocessor implementation I had to overrode the following classes:
Commander
JavaBuild
JavaEditor
JavaMode
JavaEditor
I had to implement a new JavaBuild which preprocesses the Sketch with my custom PdePreprocessor. And also use my custom JavaBuild in all the places where the Processing Java Mode instances the build class. Please share with us if there is a better way to do what I did.
Here is the github for my solution: http://github.com/arypbatista/processing-inpr/

Form in a Joomla Module

Is it a good idea to put a none-AJAX form into a Joomla module and process the form not in a component's controller but in the module itself? Is there a cooking recipe for this?
That's completely fine.
Components shouldn't use used to process a modules data, unless the module has been specifically developed to be part of the component.
Take com_users for example. This component is used to do all processing for registration, login, logout, profile and reminder/reset of passwords. The login module then simply displays the form and performs a few checks.

How load and access yii2 modules dynamically in Frontend?

I have module stored in /common/modules/gopay/GopayModule.php and I am dynamically loading it via Yii::$app->setModule('gopayModule', ['class' => '\common\modules\gopay\GopayModule']); in CommonController which is child of yii\web\Controller and parent of all my FE and BE controllers.
I did not put any configuration for module into config files as Im loading it dynamically.
How can I access this module from frontend, so that it creates application based on FE config and so on? What decides which part of Yii2, BE or FE should be called when calling module route? Traditional routes as /index.php?r=gopayModule/default/index or /gopayModule/default/index are not working even when url manager is none.
thx :)
:D easy peasy, I was setting module late, I changed code to load/set module in my CommonRequest class init() method and everything working like a charm, so logically I need to load module before UrlManager is processing URL ;-)