Sylius Standard 1.7 Fixtures: Where is the list of available options? - documentation

How do you get the list of available options in sylius_fixtures.yaml? I can't find documentation of that anywhere. There must be a list somewhere: when I try to use an "illegal" parameter, there's an error message that lists all the available parameters for that particular node:
> Unrecognized option "menu_taxon" under "channel.custom.my-channel".
> Available options are "account_verification_required", "
> base_currency", "code", "color", "contact_email", "currencies",
> "default_locale", "default_tax_zone", "enabled", "hostname", "lo
> cales", "name", "shop_billing_data", "skipping_payment_step_allowed",
> "skipping_shipping_step_allowed", "tax_calculation_strategy",
> "theme_name".
It would be more practical to have a complete list rather than generate an error on purpose every time.

Executing bin/console debug:container --tag=sylius_fixtures.fixture will list all configured fixtures.
Docs about fixtures configuration: https://docs.sylius.com/en/latest/components_and_bundles/bundles/SyliusFixturesBundle/custom_fixture.html#configurable-fixture
Docs about the built-in fixtures: https://docs.sylius.com/en/latest/book/architecture/fixtures.html#what-data-is-loaded-by-fixtures-in-sylius

Related

Pa11y actions reference / documentation

How do you enter values to match a name="" attribute, or class=""? I'm guessing that # is referring to id="" only? If HTML ID attributes are not available there needs to be a way to match other attributes or the element itself.
Is there a reference for how to use actions?
actions: [
'set field #login_field to abc',
'set field #password to defghi',
'click element #password"',
'wait for url to be http://github.com'
],
From the documentation that you linked (emphasis mine):
This allows you to click an element by passing in a CSS selector. This action takes the form click element .
[...]
You can use any valid query selector, including classes and types.
You should be able to use any valid CSS selector, including IDs, classes, and more complex CSS selectors. For example, to click on an element with class="myClass" you could use:
{
"actions": [
"click element .myClass",
"wait for path to be /foo"
]
}
Running pa11y using the --debug flag should help you understand if the actions are working correctly. For an example like the one above you should be able to see an output similar to this:
Welcome to Pa11y
> Running Pa11y on URL https://www.example.com/
[...]
> Running actions
> Debug: Running action: click element .myClass
> Debug: ✔︎ Action complete: click-element
> Debug: Running action: wait for path to be /foo
> Debug: ✔︎ Action complete: wait-for-url
> Finished running actions
[...]
> Debug: Document title: "Foo"
No issues found!
I found the actions reference, although the documentation is very limited for this project. Selectors seem limited to IDs as far as I can tell, not much good if there aren't any. I was hoping for Selenium-type selectors inc Xpath.
Pa11y Documentation - Actions

Making a Google BigQuery from Python on Windows

I am trying to do something which is very simple in other data services. I am trying to make a relatively simple SQL query and return it as a dataframe in python. I am on Windows 10 and using Phython 2.7 (specifically Canopy 1.7.4)
Typically this would be done with pandas.read_sql_query but due to some specifics with BigQuery they require a different method pandas.io.gbq.read_gbq
This method works fine unless you want to make a Big Query. If you make a Big Query on BigQuery you get the error
GenericGBQException: Reason: responseTooLarge, Message: Response too large to return. Consider setting allowLargeResults to true in your job configuration. For more information, see https://cloud.google.com/bigquery/troubleshooting-errors
This was asked and answered before in this ticket but neither of the solutions are relevant for my case
Python BigQuery allowLargeResults with pandas.io.gbq
One solution is for python 3 so it is a nonstarter. The other is giving an error due to me being unable to set my credentials as an environment variable in windows.
ApplicationDefaultCredentialsError: The Application Default Credentials are not available. They are available if running in Google Compute Engine. Otherwise, the environment variable GOOGLE_APPLICATION_CREDENTIALS must be defined pointing to a file defining the credentials. See https://developers.google.com/accounts/docs/application-default-credentials for more information.
I was able to download the JSON credentials file and I have set it as an environment variable in the few ways I know how but I still get the above error. Do I need to load this in some way in python? It seems to be looking for it but unable to find is correctly. Is there a special way to set it as an environment variable in this case?
You can do it in Python 2.7 by changing the default dialect from legacy to standard in pd.read_gbq function.
pd.read_gbq(query, 'my-super-project', dialect='standard')
Indeed, you can read in Big Query documentation for the parameter AllowLargeResults:
AllowLargeResults: For standard SQL queries, this flag is
ignored and large results are always allowed.
I have found two ways of directly importing the JSON credentials file. Both based on the original answer in Python BigQuery allowLargeResults with pandas.io.gbq
1) Credit to Tim Swast
First
pip install google-api-python-client
pip install google-auth
pip install google-cloud-core
then
replace
credentials = GoogleCredentials.get_application_default()
in create_service() with
from google.oauth2 import service_account
credentials = service_account.Credentials.from_service_account_file('path/file.json')
2)
Set the environment variable manually in the code like
import os,os.path
os.environ['GOOGLE_APPLICATION_CREDENTIALS']=os.path.expanduser('path/file.json')
I prefer method 2 since it does not require new modules to be installed and is also closer to the intended use of the JSON credentials.
Note:
You must create a destinationTable and add the information to run_query()
Here is a code that fully works within python 2.7 on Windows:
import pandas as pd
my_qry="<insert your big query here>"
### Here Put the data from your credentials file of the service account - all fields are available from there###
my_file="""{
"type": "service_account",
"project_id": "cb4recs",
"private_key_id": "<id>",
"private_key": "<your private key>\n",
"client_email": "<email>",
"client_id": "<id>",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "<x509 url>"
}"""
df=pd.read_gbq(qry,project_id='<your project id>',private_key=my_file)
That's it :)

Get the JDBC Providers for the Cell using wsadmin

I am trying to list the jdbcprovider list at cell scope but it also list the jdbcproviders at node and server scope, how to get rid off the providers at node and server scope from the list?
AdminConfig.list('JDBCProvider', AdminConfig.getid( '/Cell:CellV70A/'))
output:
'"DB2 Universal JDBC Driver Provider(cells/CellV70A/nodes/nodename|resources.xml#JDBCProvider_1302300228086)"\n"DB2 Universal JDBC Driver Provider(cells/CellV70A|resources.xml#JDBCProvider_1263590015775)"\n"WebSphere embedded ConnectJDBC driver for MS SQL Server(cells/CellV70A|resources.xml#JDBCProvider_1272027151294)"'
If you look at the help for the AdminConfig.list command:
wsadmin>print AdminConfig.help('list')
WASX7056I: Method: list
...
Method: list
Arguments: type, scope
Description: Lists all the configuration objects of the type named
by "type" within the scope of the configuration object named by "scope."
...
It says "within the scope". Since node and server-scoped JDBCProviders are within the scope of the cell, they are returned by your command. If you list all JDBCProviders at cell scope using the Admin Console and then look at the Command Assistance, you'll see something like:
Note that scripting list commands may generate more information than is displayed by the administrative console because the console generally filters with respect to scope, templates, and built-in entries. AdminConfig.list('JDBCProvider', AdminConfig.getid('/Cell:MyCell/'))
So you'll need to filter your return list similarly. You could throw together a very simple script to do so:
jdbcProviders = AdminConfig.list('JDBCProvider', AdminConfig.getid('/Cell:MyCell')).split('\r\n')
for jdbcProvider in jdbcProviders:
if "/nodes/" or "/servers/" in jdbcProvider:
continue
print jdbcProvider

getting a "need project id error" in Keen

I get the following error:
Keen.delete(:iron_worker_analytics, filters: [{:property_name => 'start_time', :operator => 'eq', :property_value => '0001-01-01T00:00:00Z'}])
Keen::ConfigurationError: Keen IO Exception: Project ID must be set
However, when I set the value, I get the following:
warning: already initialized constant KEEN_PROJECT_ID
iron.io/env.rb:36: warning: previous definition of KEEN_PROJECT_ID was here
Keen works fine when I run the app and load the values from a env.rb file but from the console I cannot get past this.
I am using the ruby gem.
I figured it out. The documentation is confusing. Per the documentation:
https://github.com/keenlabs/keen-gem
The recommended way to set keys is via the environment. The keys you
can set are KEEN_PROJECT_ID, KEEN_WRITE_KEY, KEEN_READ_KEY and
KEEN_MASTER_KEY. You only need to specify the keys that correspond to
the API calls you'll be performing. If you're using foreman, add this
to your .env file:
KEEN_PROJECT_ID=aaaaaaaaaaaaaaa
KEEN_MASTER_KEY=xxxxxxxxxxxxxxx
KEEN_WRITE_KEY=yyyyyyyyyyyyyyy KEEN_READ_KEY=zzzzzzzzzzzzzzz If not,
make a script to export the variables into your shell or put it before
the command you use to start your server.
But I had to set it explicitly as Keen.project_id after doing a Keen.methods.
It's sort of confusing since from the docs, I assumed I just need to set the variables. Maybe I am misunderstanding the docs but it was confusing at least to me.

Indexing queries in Railo

I went to the Web Administrator > Services > Search.
I manually create a collection with:
name "articoli"
path (a fake one, e.g. /tmp)
Italian language
Then in my indexer template:
<cfquery name="qry">
SELECT * FROM articoli
</cfquery>
<cfindex action="update"
collection="articoli"
key="artid"
type="custom"
title="artcod"
query="qry"
body="artdes" />
Result: collection articoli is undefined
Any ideas? Other ways for indexing with RAILO+Lucene?
EDIT:
I am using Railo 3.3 (old version). Is this kind of indexing available?
Checking the Railo source for v3.3 indicates that the error "collection articoli is undefined" will occur if the collection named doesn't exist - a simple search reveals only one instance of a "collection X is undefined" error message).
This suggests that either the name does not match what you typed into the web administrator, or that you created the articoli collection in a different web administrator to where you are running the code.