Where is the source for parses ACL? - node.js

I'm looking at the parse server that was released, and looking at the spec I see a reference to methods:
equal(object.getACL().getReadAccess(user), true);
equal(object.getACL().getWriteAccess(user), true);
equal(object.getACL().getPublicReadAccess(), false);
equal(object.getACL().getPublicWriteAccess(), false);
ok(object.get("ACL"));
I searched the repo and I don't see any ACL related classes and I couldn't find a relevant library in package.json that it might be using.
Where is it getting this functionality from?
Reference:
https://github.com/ParsePlatform/parse-server/blob/master/spec/ParseACL.spec.js

It comes from the parse package in NPM. See here for the method definition: https://github.com/ParsePlatform/Parse-SDK-JS/blob/37f433152031cdb5c782d12fbcead2c97c49e0cf/src/ParseObject.js#L862
And here is the full ParseACL file: https://github.com/ParsePlatform/Parse-SDK-JS/blob/37f433152031cdb5c782d12fbcead2c97c49e0cf/src/ParseACL.js

Related

How to map custom report ts file from node library in playwright.config.ts?

I came across custom report feature in Playwright(node js). I would like to use the custom-reporter.ts class from the external node library installed.
Please help me to know, How to map that file in Playwright.config.ts?
(playwright.config.ts)
config = {
reporter: './node_modules/mylibrary/report/lib/my-reporter'
}
It works, but i am not sure whether this approach is adviceable or not.

Botbuilder how to use default locale strings in case namespace hasn't defined it

I am using the botbuilder framework. I have defined several namespaces for the dialogs I have created, such as help or default. For all of these I have also created json files in my locale/en/ directory, and all is well.
However, I have a few sentences that are very common, and I don't feel like copying those over to each of the individual namespaces. I have tried using index.json as a 'fallback' in case the namespace file doesn't define the string. But it doesn't work for me. Contrary to what the documentation seems to suggest.
/locale
/en
/help.json
/default.json
/index.json <-- Doesn't work
/dialogs
/help.js
/default.js
bot.js
Say I have the following library in help.js, that :
lib = new builder.Library('help')
lib.dialog('/', (session) => {
session.send('custom_cancel')
}
module.exports = lib
The library is used in bot.js:
bot.library(require('./dialogs/help'))
And index.json has this content:
{
"custom_cancel": "My custom cancel"
}
Whereas help.json is empty:
{}
Because help.json does not have custom_cancel, the bot will actually send custom_cancel as the string.
Again. I can copy paste the strings to both locations and there is no more problem. But that seems like an ugly solution to me.
I have tried the more explicit version, which seems to help in more cases, but I am not fully convinced yet.
session.localizer.gettext(session.preferredLocale(), 'custom_cancel')
You can use the third argument for the namespace. It seems that '' will point to the index.json file.

sails generate <something>: where are the docs on 'generate'?

sails generate controller <name> and model and api and others.
What are the others? What are the options? What are the commandline options?
Insert here the obligatory "I've websearched high and low" but the only thing I can come up with is github entries for individual generators in various states of ignorement.
So, abstractly, where's the documentation on the generate command?
The default generators shipped with Sails are documented here, in the command line interface section of the reference section of the Sails documentation. Where options are accepted I believe this section of the documentation references them, with sails new having the most option usage options.
At the time of writing they include new, api, model, controller, adapter, and generator.
More community created generators can be added, generally by modifying the .sailsrc file to include npm package. Here's an example from the sails-auth docs.
{
"generators": {
"modules": {
"auth-api": "sails-auth"
}
}
}
If you want to know more about making your own generators and what goes into that you'd probably want to check out the sails-generate-generator repo and docs.

Default config.xml?

On this page of the documentation, at the bottom, it says:
You can find full examples of Sphinx-4 configuration file in sources. For example, check the file
sphinx4/src/apps/edu/cmu/sphinx/demo/transcriber/config.xml
Well, I looked, and there is no config.xml in that directory, and there is no such file in any of the other folders inside of demo either.
So where can one find a default config file to use to get started with?
If I just do Configuration configuration = new Configuration();, would that be good enough to start with?
I recently found out that what you suggest is not enough. Take a look at the latest code on the Github repository. There is a default.config.xml file at https://github.com/cmusphinx/sphinx4/tree/master/sphinx4-core/src/main/resources/edu/cmu/sphinx/api, and the path to it is set in the Context class in package edu.cmu.sphinx.api:
public Context(Configuration config)
throws IOException, MalformedURLException
{
this("../sphinx4/sphinx4-core/src/main/resources/edu/cmu/sphinx/api/default.config.xml", config);
}

Autoloading a class in Symfony 2.1

I'm porting a Symfony 1.2 project to Symfony 2.x. I'm currently running the latest 2.1.0-dev release.
From my old project I have a class called Tools which has some simple functions for things like munging arrays into strings and generating slugs from strings. I'd like to use this class in my new project but I'm unclear how to use this class outside of a bundle.
I've looked at various answers here which recommend changing app/autoload.php but my autoload.php looks different to the ones in the answers, maybe something has changed here between 2.0 and 2.1.
I'd like to keep my class in my src or app directories as they're under source control. My vendors directory isn't as I'm using composer to take care of that.
Any advice would be appreciated here.
Another way is to use the /app/config/autoload.php:
<?php
use Doctrine\Common\Annotations\AnnotationRegistry;
$loader = require __DIR__.'/../vendor/autoload.php';
$loader->add( 'YOURNAMESPACE', __DIR__.'/../vendor/YOURVENDOR/src' );
// intl
if (!function_exists('intl_get_error_code')) {
require_once _DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs/functions.php';
$loader->add('', __DIR__.'/../vendor/symfony/symfony/src/Symfony/Component/Locale/Resources/stubs');
}
AnnotationRegistry::registerLoader(array($loader, 'loadClass'));
return $loader;
Just replace YOURNAMESPACE and YOURVENDOR with your values. Works quite well for me, so far.
You're correct, I stumbled upon the changes in autoload from 2.0 to 2.1. The above code works fine with the latest version, to which I upgraded my project ;-)
For a simple case like this the quickest solution is creating a folder (for example Common) directly under src and put your class in it.
src
-- Common
-- Tools.php
Tools.php contains your class with proper namespace, for example
<?php
namespace Common;
class Tools
{
public static function slugify($string)
{
// ...
}
}
Before calling your function do not forget the use statement
use Common\Tools;
// ...
Tools::slugify('my test string');
If you put your code under src following the proper folder structure and namespace as above, it will work without touching app/autoload.php.

Resources