Is there any way to tell which PouchDB plugins are currently loaded? - plugins

The title pretty much says it all.
Is there any way to get a list of loaded PouchDB plugins? Or failing that, is there any way to check if a specific plugin is loaded?

Pouchdb just adds plugins to its prototype, so if you don't mind seeing some built-ins:
> location.href
"http://nolanlawson.github.io/pouchdb-find/"
> Object.getOwnPropertyNames(PouchDB.prototype)
Array[11]
0: "constructor"
1: "query"
2: "viewCleanup"
3: "replicate"
4: "sync"
5: "upsert"
6: "putIfNotExists"
7: "createIndex"
8: "find"
9: "getIndexes"
10: "deleteIndex"
length: 11
__proto__: Array[0]
> "find" in Object.getOwnPropertyNames(PouchDB.prototype)
true

Related

Flash Messages TYPO3 6 to 7 update

I used the following syntax in an TYPO3 6 exbase extension before migrating to 7:
$this->flashMessageContainer->flush();
$this->flashMessageContainer->getAllMessagesAndFlush();
$this->flashMessageContainer->add(Tx_Extbase_Utility_Localization::translate('undefined error', $this->extensionName));
In my new code I would use:
$this->addFlashMessage(\TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('undefined error', $this->extensionName));
But I always get this error:
Fatal error: Call to a member function getFlashMessageQueue() on a
non-object in /srv/www/typo3_src-7.6.32/typo3/sysext/extbase/Classes/Mvc/Controller/AbstractController.php on line 190
Any ideas about this behaviour?
Thanks and best regards,
Chris
(Disclaimer: TYPO3 v7.6 reached end-of-life and is not maintained anymore)
In order to understand what's going on, let's have a look into the source code (referring to the error message you posted, checking AbstractController.php)
$this->controllerContext->getFlashMessageQueue()->enqueue($flashMessage);
https://github.com/TYPO3/TYPO3.CMS/blob/TYPO3_7-6/typo3/sysext/extbase/Classes/Mvc/Controller/AbstractController.php#L190
$this->controllerContext = $this->buildControllerContext();
https://github.com/TYPO3/TYPO3.CMS/blob/TYPO3_7-6/typo3/sysext/extbase/Classes/Mvc/Controller/AbstractController.php#L238
Thus, my assumption(!) is, that you override public function processRequest(...) in your application specific controller without invoking parent::processRequest(...) leading to the situation that $this->controllerContext is not initialized.

capybara: mysterious 'element at X no longer present in the DOM'

I have written cucumber test scenario's that are tested with webkit and a firefox driver. In firefox the tests all pass, but with webkit one of them fails with error
Element at 40 no longer present in the DOM (Capybara::Webkit::NodeNotAttachedError)
/home/r/project/share/support/actions.rb:64:in `block (2 levels) in follow_link_in_new_tab'
/home/r/project/duplo/share/support/actions.rb:10:in `with_scope'................
This happens during the execution of a routine that is triggered by test step 'When I follow "Linkname". Strangely enough, most of the times this code works perfect, but in one case I get this 'no longer present error'.
The routine performs this:
res = find( 'a', text: text, visible: true)
if ((res[:target] || '') == '_blank')
#win = window_opened_by { res.click }
else
res.click
end
I found out that if I change this to
find( 'a', text: text, visible: true).click
the message disappears and the scenario passes the test. Who can help me understanding what can be the problem here. Why is this failing when the find result is assigned to a variable and why is it only failing in only few situations?
I use ruby 2.4.0 and capybara-webkit 1.2.0
thanks, Ruud
You don't indicate exactly which line is generating the error (which one is line 64), however the error indicates that you're still using an element after it has been removed from the page, either by JS deleting the element or a new page being loaded.
Additionally the visible: true option really shouldn't be needed since that is normally the default value for the visible option (unless you've changed it which is a terrible idea when testing software, not as bad if just scraping sites)
Also - capybara-webkit 1.2.0 was released in July 2014 -- You REALLY want to update that to the latest release if you're testing anything even slightly modern, as well as probably updating your ruby to at least the latest 2.4.x release.

How to use getHeaderContribution() in wicket 6.x or 7.x?

I have code like below,
add(CssPackageResource.getHeaderContribution("css/$/styles.css?v=1.1".replace("$", reqLocale)));
I am trying to upgrade it into 6.x , but am unable to use getHeaderContribution() method,
Can you suggest me how can I change above code?
You can override renderHead(IHeaderResponse response) of your page/component and insert the following code there:
response.render(CssHeaderItem.forReference(new CssResourceReference(YourWebPage.class, String.format("css/%s/styles.css?v=1.1", reqLocale))));
The css file path should then be relative to YourWebPage.
Detailed migration path can be found here in the Wiki pages.
Step 1:
https://cwiki.apache.org/confluence/display/WICKET/Migration+to+Wicket+1.5#MigrationtoWicket1.5-HeaderContribution
Step 2:
https://cwiki.apache.org/confluence/display/WICKET/Migration+to+Wicket+6.0#MigrationtoWicket6.0-IHeaderResponse,includingdecoratorsandfilters

Serach Node using Query Builder In AEM?

i need to get some asset node use Query Builder How I search i am gving folder path
1 :/content/dam/assets/en_us/myDatas/c02442188
2: /content/dam/assets/en_us/myDatas/c02442189
3: /content/dam/assets/ar_sa/myDatas/c02442170
4: /content/dam/assets/spanish/myDatas/c02442171
5: /content/dam/assets/spanish/B/c02442172
from thse asset
i need to get only 1,2,3,4
which means 'myDatas' folder contains.
need to get this nodes using query builder
i started query builder like this
path=/content/dam/assets
type=sling:Folder
path=/content/dam/assets
type=sling:Folder
nodename=myDatas*

Unexpected end of input in CoffeeScript

I've started a little game in CoffeScript using canvas.
My problem is this error:
coffee -c -o lib/ src/
/src/interface.coffee:8:48: error: unexpected end of input
#ctx.clearRect 0, 0, #size[0], #size[1]
^
I've rewrote it many times but it still don't want to compile.
Here is the code:
class Interface:
constructor : (id) ->
#canvas = document.getElementById "#{id}"
#ctx = #canvas.getContext "2d"
#size = [#canvas.width, #canvas.height]
clear : () ->
#ctx.clearRect 0, 0, #size[0], #size[1]
Oh, and can someone tell me what exactly this error means?
Thank you in advance.
Its the colon after Interface. An easy way to debug that error for future reference:
Step 1: paste problem code into the 'Try CoffeeScript' part of the coffeescript website to repro the error.
Step 2: erase or comment-out lines until the error goes away and the code compiles
Step 3: the last line you erased was the error.
Step 4: find the error(s) in that line and fix.
Step 5: repeat as necessary.
This is how I figured out what the problem was. This process also works well for the 'Unmatched Outdent' error.