google-app-engine,mapreduce,yaml
After investigating this custom input reader I came across the allowed_old flag on reader_spec = _get_params(mapper_spec, allow_old=False) When set to False it requires all the input reader parameters to be a dictionary on the parameter input_reader on mapreduce.yaml Setting allowed_old to True lets you list all the parameters you need...
Like what @filmor said in the comments, LoadFile only loads the data into memory and does not provide an interface to the filesystem. Thus, edit a .yaml file, you must first edit the root node of the file and dump it back into the file like so: YAML::Node node _baseNode...
I had to create a symlink /etc/puppet/hiera.yaml -> /etc/hiera.yaml =)...
Don't put the default_flow_style=False then, does the complete opposite of what you want: >>> import yaml >>> yaml.safe_dump({'items': ['test', 'test2']}, default_flow_style=False) 'items:\n- test\n- test2\n' >>> yaml.safe_dump({'items': ['test', 'test2']}) 'items: [test, test2]\n' As for partial document formatting, you can do with custom representers, e.g.: class Items(list): pass def items_representer(dumper, data): return...
When you're looping through the map, you're just reading the keys with it->first. To read the values too, you need it->second: YAML::Node config = YAML::LoadFile(fileName); for (YAML::const_iterator it = config.begin(); it != config.end(); ++it) { std::string key = it->first.as<std::string>(); YAML::Node value = it->second; // here, you can check what type...
You can at least preserve the original flow/block style for the various elements with the normal yaml.dump() for some value of "normal". What you need is a loader that saves the flow/bcock style information while reading the data, subclass the normal types that have the style (mappings/dicts resp. sequences/lists) so...
This regex: ^\s*([^:]+)(:\s)(.*?)\s*$ Does what you want. Working Demo It is easiest to express in Perl. Given: $ echo "$tgt" location_id: 25 street: text: This is text: it contains colons In Perl: $ echo "$tgt" | perl -lne "print if s/^\s*([^:]+)(:\s)(.*?)\s*$/\1\2'\3'/" location_id: '25' street: '' text: 'This is text: it...
This would work: test.get('test-options', {}).get('ignore-dup-txn', None) ...
As already explained in other answers, on is considered a "truthy" value. This behavior is intentionally coded in Psych. The best solution to the problem, as explained by Arup Rakshit and Mikhail P, is to quote the value. However, given that your question asks for an alternative, here's an alternative....
The contents of the example yaml file are sequence of objects, so do it like this: package main import ( "fmt" "log" "gopkg.in/yaml.v2" ) type Config struct { Foo string Bar []string } var data = ` - foo: 1 bar: - one - two - three - foo: 2...
The Solution for the problem was to use with_dict. - name: pass values to script debug: "msg={{ item.value }}" with_dict: - "{{ object }}" ...
The problem is that you create an empty file. And the YAML parser returns false for an empty string: YAML.load('') #=> false Just set config_file to an empty hash if it is false: config_file = YAML.load_file(path_to_file) || {} ...
If you want the value as well as the error messages to "belong" to the key, you need to make a list of two items name: - Name - error: Please enter your name. or as another mapping with two items: name: value: Name error: Please enter your name. ...
The anchors (&some_id) and references (*some_id) mechanism is essentially meant to provide the possibility to share complete nodes between parts of the tree representation that is a YAML text. This is e.g. necessary in order to have one and the same complex item (sequence/list resp. mapping/dict) that occurs in a...
c#,python,parsing,yaml,yamldotnet
Most YAML parsers are build for reading YAML, either written by other programs or edited by humans, and for writing YAML to be read by other programs. What is notoriously lacking is the ability of parsers to write YAML that is still readable by humans: the order of mapping keys...
Finally I got it running. I have set the new routing file in my dev config: #app/config/dev/config.yml framework: # update routing router: resource: "%kernel.root_dir%/config/dev/routing.yml" And I imported the common routing in the dev routing by not using imports: - { resource: ../common/routing.yml } but this instead: #app/config/dev/routing.yml _common: resource: ../common/routing.yml...
I'm assuming that you are trying to load the :data_file passed into Bot.new, but right now you are statically loading a bot_data file everytime. You never mentioned about bot_data in the question. So if I'm right it should be like this : @data = YAML.load(File.read(options[:data_file])) Instead of : @data =...
You don't need a concatenation character, you can append the constant directly after the parameter. For example, for a service definition in services.yml: my.service: class: %my.service.class% arguments: - @logger, - %some_parameter%, - %parameter_url%?wsdl, ...
If you know the Perl structure, just use the YAML module to convert it to YAML. #!/usr/bin/perl use strict; use warnings; use YAML; my $struct = [ 'PROD_NAMEA' => [qw[ system myschema myschema2 myschema3 ]], 'PROD_NAMEB' => [qw[ system ]], ]; print Dump($struct); ...
Influenced by project requirements and the range of preferences amongst members in my team, option 1 will serve us best at this stage. Conforming to the standard HTTP methods will simplify and clarify my API There will be a single, consistent approach to cloning a resource. This outweighs the issue...
git,environment-variables,yaml,appveyor
Should be: - git tag -a release/%APPVEYOR_BUILD_VERSION% - git push origin release/%APPVEYOR_BUILD_VERSION% ...
java,spring,configuration,yaml,spring-boot
Is there a way to load resources from src/main/resources for tests? It works for me. Maybe your IDE is not copying changes to the output directory on save or something (I have heard IntelliJ users have to switch that feature on)?...
That's because the version value is a string and not a number. Just specifying 2.0 is interpreted as a number. Wrap it with quotes like "2.0" and it would work fine.
yaml,log4j2,rollingfileappender
I finally found the solution, was misusing the list Configuration: status: debug Appenders: Console: name: CONSOLE target: SYSTEM_OUT PatternLayout: Pattern: "%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" RollingRandomAccessFile: - name: PAYLOAD fileName: logs/payload.log filePattern: "logs/$${date:yyyy-MM}/payload-%d{MM-dd-yyyy}-%i.log.gz" PatternLayout: Pattern: "%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" Policies: SizeBasedTriggeringPolicy: size: 1 KB - name: APPLICATION...
You could create the roles as config parameters: // user_roles.yml parameters: seller_roles: [ROLE_A, ROLE_B, ROLE_C] And use them in the security config: // security.yml imports: - { resource: user_roles.yml } security: role_hierarchy: ROLE_SELLER: %seller_roles% ...
YAML.load(File.open(env_file)) Your YAML is returning a String not a Hash You need spaces between colon and value: LOAD_JS_FROM_AMAZON: no RACK_ENV: production S3_BUCKET_NAME: bucket_name S3_CMS_BUCKET_NAME: cms_bucket_name ...
Well, I've been working on a solution because nothing was what I wanted and everything was so complex I wanted to die... This solutions transforms a %something% string into the value for something. It works perfectly, this is an example root_path: /root script_path: "%root%/scripts" With this method, script_path will become...
YAML metadata are not passed to pandoc as arguments, but as variables. When you call pandoc on your MWE, it does not produce this : pandoc -o guide.pdf articheck_guide.md --toc --number-sections as we think it would. rather, it calls : pandoc -o guide.pdf articheck_guide.md -V toc:yes -V number-sections:yes Why, then,...
ruby-on-rails,ruby,internationalization,yaml
Have a look at the documentation under "Lazy Lookups". t('.active_notification') is only available within the corresponding view. Not if you call it, let's say in a javascript file or any other view...
python,event-handling,yaml,pyyaml
I can understand that the Events API scares you, and it would only bring you so much. First of all you would need to keep track of depth (because you have your top level complex sequence items, as well as "bar", "baz" etc. And, having cut the low level sequence...
convert the json object to map by using bellow code public class JsonToMap { public static Map<String, Object> jsonToMap(JSONObject json) throws JSONException, org.codehaus.jettison.json.JSONException { Map<String, Object> retMap = new HashMap<String, Object>(); if(json != JSONObject.NULL) { retMap = toMap(json); } return retMap; } public static Map<String, Object> toMap(JSONObject object) throws JSONException,...
As you can see from the docs, there is no option that configures the order of hashes. This is further confirmed by looking at dump_node and dump_hash in LibYAML/perl_libyaml.c.
I looked for an equivalent of the eval() PHP or Javascript function in Twig and found this SO question: Twig variables in twig variable. Here is the code from an answer by Berry Langerak which define a Twig filter: <?php /** * A twig extension that will add an "evaluate"...
According to this article: http://makandracards.com/makandra/24809-yaml-keys-like-yes-or-no-evaluate-to-true-and-false In order to use the strings ‘yes’ and ‘no’ as keys, you need to wrap them with quotes ...
ruby,for-loop,yaml,jekyll,liquid
I got this working by updating the data model and creating a nested loop: --- chapters: - title: "CHAPTER 1: LEADERSHIP" chapterList: - Lorem ipsum dolor sit amet, consectetuer adipiscing elit. - Aliquam tincidunt mauris eu risus. - Vestibulum auctor dapibus neque. - title: "CHAPTER 2: THE EXPERIENCE" chapterList: -...
Indentation is crucial for yaml files. If your yaml file as same as in the question, the output is totally correct. In order to achieve expected json, first you must fix your yaml file. In order to get your expected json output your yaml file should look like this. Singapoor:...
Figured it out, use bash -c example: command: bash -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8000" ...
Answer YAML::Syck (as YAML) expects hashref, not hash: print F YAML::Syck::Dump(\%c); Also LoadFile returns hashref, not hash: my $cfg = YAML::Syck::LoadFile($config); print Dumper $cfg; Other improvements First of all, you don't really need our here. Your %c means pretty much the same as %main::c. our creates the alias for the...
If you are just experimenting, there is a quick and dirty way to do this: class Hash def method_missing(name, *args) send(:[], name.to_s, *args) end end I wouldn't use that in production code though, since both method_missing and monkey-patching are usually recipes for trouble down the road. A better solution is...
javascript,yaml,syntax-checking,error-checking
Yes, using this YAML parsing library you can set up a try / catch statement to handle it. var isValid = true; try { yaml.safeLoad(input); } catch (e) { isValid = false; } // Use `isValid` to give feedback to the user. ...
symfony2,pdo,doctrine2,yaml,dbal
Instead of PDO constats, You shoul use their values in options: doctrine: dbal: connections: default: driver: %database_driver% host: %database_host% port: %database_port% dbname: %database_name% password: %database_password% charset: UTF8 options: 1010 : %private_key% 1011 : %public_cert% 1012 : %ca_cert% ...
Do this only if you're absolutely sure nobody can change your yaml file to inject something harmful: condition = YAML.load_file('abc.yaml')["entity1"]["condition"] condition = eval "\"#{condition}\"" ...
According to http://ruby-doc.org/stdlib-2.0.0/libdoc/json/rdoc/JSON.html You can use JSON.parse instead, which has an option symbolize_names. JSON.parse(File.read('data.json'), symbolize_names: true) ...
selenium,webdriver,yaml,codeception
So look like the problem is mistake in the module name, it should be WebDriver instead of Webdriver Try running with: modules: enabled: - WebDriver - AcceptanceHelper config: PhpBrowser: url: 'http://www.mywebsite.dev/' WebDriver: url: 'http://www.mywebsite.dev/' browser: firefox It should work....
You can get a Set<String> of the children. See ConfigurationSection, FileConfiguration FileConfiguration fc = getConfig(); // Get the config ConfigurationSection cs = fc.getConfigurationSection("maps"); boolean deep = false; for (String key : cs.getKeys(deep)) { //Key will be 01 } ...
I'm replacing the visit_Array method of the Psych::Visitors::YAMLTree class MyVisitor < Psych::Visitors::YAMLTree def visit_Array o super o.map { |i| i.respond_to?(:to_yaml) ? i.to_yaml : i } end end Then, I'm dumping the YAML this way: a = [MyObject.new("a"), MyObject.new("b")] visitor = MyVisitor.create visitor << a puts visitor.tree.yaml ...
import 'dart:io'; void main() { Process.run('pub', ['get'], runInShell: true, workingDirectory: 'dirWherePubspec.yaml_is') .then((ProcessResult results) { // ... }); } or alternatively Process.start(...)...
ruby,function,yaml,file-writing
Currently when you use File.write it takes your current working directory, and appends the file name to that location. Try: puts Dir.pwd # Will print the location you ran ruby script from. You can specify the absolute path if you want to write it in a specific location everytime: File.write("/home/chameleon/different_location/#{new_user["name"]}.yaml")...
The documentation specifically states: Metadata is processed as plain text, so it should not include MultiMarkdown markup. It is possible to create customized XSLT files that apply certain processing to the metadata value, but this is not the default behavior. I recall in one project of mine, I wanted the...
After some try and error I found the answer myself. it seems, that I used the wrong tag. The correct python code looks like this: def bool_constructor(self, node): value = self.construct_yaml_bool(node) if value == False: return '$false' else: return '$true' yaml.Loader.add_constructor(u'tag:yaml.org,2002:bool', bool_constructor) yaml.SafeLoader.add_constructor(u'tag:yaml.org,2002:bool', bool_constructor) ...
json,node.js,ssl,amazon-web-services,yaml
At line 10 there is a tab character. Deleting this tab should resolve the error you are receiving. When you copied the code from instructions from Amazon, it copied over a tab which will cause this problem. I encountered the same problem, if you go through the YAML file and...
To convert tabs to spaces use the commands below in the order below: :set noexpandtab :retab! :set expandtab :retab! I go this answer from watching this vim cast. Tidying Whitespace Vim can already detect the file type yaml so you can use that to replace all TAB's in your YAML...
The XML formant adds in a default <or> block that YAML doesn't. So the corresponding YAML format is: - preConditions: - or: - dbms: type: oracle - dbms: type: mysql ...
As jwodder said, it's valid. If you're using to_yaml (instead of to_nice_yaml) you have fairly old install of ansible, it's time to upgrade. Use to_nice_yaml It's possible to pass your own kwargs to filter functions, which usually pass them on to underlying python module call. Like this one for...
There isn't much to using YAML in Ruby. I think you only need to know two methods in here : YAML.load and YAML.dump. Assuming the file is file.yml with the contents you provided : # YAML is part of the standard library. require 'yaml' # YAML.load parses a YAML string...
mysql,sql,import,phpmyadmin,yaml
phpMyAdmin can create YAML as an export/dump format, but can't import them. Can you get the file as an SQL format, which is a more standard interchange format anyway? You can verify this in two ways; looking in libraries/plugins/import I don't see YAML listed, or going to the Import tab...
The simplest thing to do, if you know that that's the structure of your YAML, is: std::vector<Led_Yaml> leds = led_set["leds"].as<std::vector<Led_Yaml>>(); If you actually want to iterate through your sequence manually: for (auto element : led_set["leds"]) { Led_Yaml led = element.as<Led_Yaml>(); // do something with led } ...
We found that in the Tree mapping file, we had to name the left: and right: columns as lft: and rgt:, identically to the examples on the github repository for the yaml mappings. fields: lft: <---- type: integer nullable: false options: unsigned: false gedmo: - treeLeft rgt: <----- type: integer...
gdbm doesn't parse a file, it is permanent storage for key value pairs. The storage on disc can be larger than your memory (although your indices probably will have to fit). If you start with YAML, JSOON or INI files, you first have to parse that material and it all...
You cannot do what you want with multiple keys with the same name. YAML associative arrays, like Python dictionaries, must have unique keys, and duplicate keys must be ignored (perhaps producing a warning) or be treated as an error. See the YAML specification: It is an error for two equal...
You need to add a custom Constructor. However, in your case you don't want register an "item" or "item-list" tag. In effect, you want to apply Duck Typing to your Yaml. It's not super efficient, but there is a relatively easy way to do this. class YamlConstructor extends Constructor {...
If your input format is some unformatted SQL (no newlines and indent spaces), like you seem to have taken from the output (2) you will never automatically get nice output: import yaml sql = ("SELECT DISTINCT p.id_product, " "p.price AS price, " "sp.reduction AS discount, " "sp.reduction_type AS discount_type, "...
amazon-web-services,yaml,elastic-beanstalk,amazon-elastic-beanstalk
That file belongs in the .ebextensions folder and not in .elasticbeanstalk
php,yaml,typo3-flow,typo3-neos
maybe the code is like this: add this in your model <?php namespace Acme\YourPackage\DataSource; use TYPO3\Neos\Service\DataSource\AbstractDataSource; use TYPO3\TYPO3CR\Domain\Model\NodeInterface; class TestDataSource extends AbstractDataSource { /** * @var string */ static protected $identifier = 'acme-yourpackage-test'; /** * Get data * * @param NodeInterface $node The node that is currently edited (optional) *...
The 'plugin.yml' file must be placed in the main folder of the project. | Project ----| src/main/java | ----| eruverio.EruvPlg (Package) | ----| main.java | ----| main (class) | ----| src/main/resources | ----| plugin.yml | ----| pom.yml ...
Try - shell: > /home/developer/eclipse/eclipse -application org.eclipse.equinox.p2.director -noSplash -repository 'http://moreunit.sourceforge.net/update-site' -installIUs org.moreunit.feature.group Do not trust the editor or syntax highlighter. Let ansible tell you if there is a problem (Run it with -C flag to simulate a dry-run if u want). Also try replacing single with double quotes around the...
The problem indeed is the # in your string - for whatever reason. Though you can easily prevent the parsing error by using this trick: line="EMAIL='{{ email_address }}' {{ '#' }} Server notification email address enter only 1 address" ...
You have to set the following paramters to the dump function: explicit_start=True for the --- at the beginning of the output. default_flow_style=False to print the items separated in each line. import yaml a = ['item 1','item 2','item 3','item 4'] yaml.dump(a, explicit_start=True, default_flow_style=False) will give you '---\n- item 1\n- item 2\n-...
Last line isn't indented correctly. Make sure it looks like variables: - key: APP_ENV value: local Also check that all paths on host machine exist....
Your second solution is the right way to go about this. yaml-cpp deals with value types only, so if you want any sort of inheritance, you'll need to manually wrap your polymorphic type in a value type, as you've done.
Within your with block, you can write anything you want to the file. Since you just need a comment at the top, add a call to f.write() before you call ruamel: with open('test.yml', "w") as f: f.write('# Data for Class A\n') ruamel.yaml.dump( d, f, Dumper=ruamel.yaml.RoundTripDumper, default_flow_style=False, width=50, indent=8) ...
Your problem is that the two classes I had both operate on dicts, not lists. You want something that will work with lists: class blockseqtrue( list ): pass def blockseqtrue_rep(dumper, data): return dumper.represent_sequence( u'tag:yaml.org,2002:seq', data, flow_style=True ) Python lists are YAML sequences / seqs. Python dicts are YAML mappings/maps....
I think it should be closer to this: roles: - { role: postgresql, postgresql_users: [ { name: "dev_user", pass: "dev_pass", encrypted: "no" }, { name: "test_user", pass: "test_pass", encrypted: "no" } ], postgresql_databases: ['dev', 'test'], postgresql_user_privileges:[ { name: "dev_user", db: "dev", priv: "ALL" }, { name: "test_user", db: "test", priv:...
You can use with_subelements to loop through the server_aliases. The below snippet - name: Add a domain symlinks /tmp for server_name. debug: msg="{{ item.server_name }}" with_items: apache_vhosts - name: Add a domain symlinks /tmp for server_aliases. debug: msg="name - {{ item.0.name }} and serverAlias - {{ item.1 }}" with_subelements: -...
If you do not need the features of Json.NET, you can also use the Serializer class directly to emit JSON: // now convert the object to JSON. Simple! var js = new Serializer(SerializationOptions.JsonCompatible); var w = new StringWriter(); js.Serialize(w, o); string jsonText = w.ToString(); You can check two working fiddles...
Change type declaration to this: type AppYAML struct { Runtime string `yaml:"runtime,omitempty"` Handlers []map[string]string `yaml:"handlers,omitempty"` Env_Variables map[string]string `yaml:"env_variables,omitempty"` } ...
symfony2,service,configuration,yaml
As per the Symfony coding standards guide, dots are simply a separator used to group services but they have no actual significance in code. Often people will group related services, for example: image.loader image.converter image.viewer This indicates all the services are to do with images. Often people might group these...
python,networking,yaml,ansible,ansible-playbook
Finally figured it out, see example below. ~/vars/mail.yml --- nxos: - {hostname: testhost} interfaces: - {ACCESS: 'true', NVLAN: 'true', PC: 'true', TRUNK: 'true', accessVlan: '1', allowedVlans: 500-600, desC: serverhost-1005, intF: eth1/1, nativeVLAN: '56', pcNUM: '23'} - {ACCESS: 'true', NVLAN: 'true', PC: 'true', TRUNK: 'true', accessVlan: '1', allowedVlans: 500-600, desC: serverhost-1006,...
symfony2,internationalization,yaml
First of all it should be messages.en.yml as indicated by @xurshid29, but most important it should be <title> {% block title %} {{ 'base.title.homePage'|trans }} {% endblock %} </title> inside the template. The value passed to the trans filter must be a string but base.title.homePage|trans would be expanded to something...
You have mistyped this line: $form = $handleRequest($request); handleRequest is a method of $form that handles the POST request. It should be: $form->handleRequest($request); ...
Although Yaml rhymes with OCaml, there are no mature libraries for handling yaml in OCaml (to my personal opinion). As a first approximation I will start with ocaml-syck library. Another option is to write yaml parser yourself, as writing parsers in OCaml is really easy, especially with menhir.
As other answers stated, this is valid YAML. However, the structure of the document is specific to the application, and does not use any special feature of YAML to express tables. You can easily parse this document using YamlDotNet. However you will run into two difficulties. The first is that,...
Like @Coussinsky said, some values for your field "nom" are empty on your database. You could make this parameter to null if you want, or just change the empty values on your database....
You can achieve this using the mid-level parsing API: stream = Psych.parse_stream(yaml) document = stream.children[0] mapping = document.children[0] index = mapping.children.index {|x| x.is_a?(Psych::Nodes::Scalar) && x.value == 'type' } mapping.children[index + 1].value = "new type" puts stream.to_yaml Explanation This isn't possible using standard load/dump, since the label information is lost. What...
For an HTML output just us the <br> tag while if your output is a PDF or PDF presentation standard LaTeX code to break line given by \\ should work. Example --- title: 'A title I want to <br> split on two lines' author: date: output: ioslides_presentation --- For PDF...
So here was the syntax that worked for me users: ? *adminUser ? *adminUser2 The reason only the first user was being inserted into the Set was because the hash of the 2 objects were equal and so the second wouldn't get inserted, because to prevent duplicate items, the Set...
{% assign project = site.data.portfolio.projects | where: "name", "betimca" %} This returns an array with one element. If you want to get the element in project you can do : {% assign project = site.data.portfolio.projects | where: "name", "betimca" | first %} And now your page works....
This alone should have raised an error: settings['lev-0a']['lev-1a'].iteritems():. In your code, the value pointed to by ['lev-1a'] appears to be a list, not a dict, so calling iteritems() on it is very suspect. What you seem to have been looking for is something like: for dict1a in settings['lev-0a']['lev-1a']: print dict1a['key-a']...
Use a dash to start a new list element: models: - model: "a" type: "x" #bunch of properties... - model: "b" type: "y" #bunch of properties... ...
Assemble uses the yaml-frontmatter to read and strip off that little block of yaml at the start of each template. You can integrate this directly into your own build toolchain: Gulp with gulp-front-matter Grunt with grunt-matter (from assemble) ...
In your project posts add background and thumbnail variables myprojectpage.html --- front matter variables ... background: #ffffff thumbnail: images/myproject.jpg --- You can then use them in your loop : {% for post in site.categories['project'] %} <div class="project" style="background:{{post.background}};"> <h3 class="project__title">{{ post.title }}</h3> <img src="{{ site.baseurl }}/{{ post.thumbnail }}" alt="post.title"> <p...
c#,amazon-web-services,configuration,yaml,elastic-beanstalk
In the end I switched to using Json instead of YAML as, despite my YAML being validated by several online YAML testers, AWS still wouldn't accept it. It always had issues with the parameters passed to icacls. I also changed to a folder within the application App_Data folder as setting...
I think you're after either this: - foo: 1 bar: - one - two - three - foo: 2 bar: - one1 - two2 - three3 Which gives you this structure: [ { "foo": 1, "bar": [ "one", "two", "three" ] }, { "foo": 2, "bar": [ "one1", "two2", "three3"...
As @Maerlyn commeted, you should encapsulate your keys with quotes to avoid loosing preceding and following zeros. ...