yaml

How do you put html or xml into a yaml?

I would like to store html snippets inside a yaml file, what is the best way to do that? something like: myhtml: | <div> <a href="#">whatever</a> </div> ...

Calling initialize when loading an object serialized with YAML

Is it possible to force Ruby to call an initialize method when using YAML.load_file? I want to call the method in order to provide values for instance variables I do not serialize. I know I can factor the code into a separate method and call that method after calling YAML.load_file, but I was wondering if there was a more elegant way t...

rails - how to dynamically add/override wording to i18n yaml

as an example, i have a default english locale file "en.yml" with contents: en: messages: messages users: users now, there is a customer which wants messages to be named discussions in his product, but users should remain users. so what i want to do is to create "customer.en.yml" file en: messages: discussions which would ove...

Should I use YAML or JSON to store my Perl data?

I've been using the YAML format with reasonable success in the last 6 months or so. However, the pure Perl implementation of the YAML parser is fairly fidgety to hand-write a readable file for and has (in my opinion) annoying quirks such as requiring a newline at end of the file. It's also gigantically slow compared to the rest of my pr...

Doctrine YAML Data Fixture Question

where can i learn more abt creating database markup in yaml and data fixtures. i followed a tutorial and they create a relationship like so: under relations in both User and Car. my qn is why is 'type: many' in Car. can i have it in User instead (just curious)? abt data types. different database have different database support. i thou...

Is there a native YAML library for iPhone?

I'm considering using YAML as part of my next iPhone application, but I haven't been able to find an Objective-C library to use. The Wikipedia page for YAML mentions one, but the link is dead. Is there an Objective-C library that can parse YAML into native collection objects (NSArray, NSDictionary, etc...)? ...

pyyaml: dumping without tags

I have >>> import yaml >>> yaml.dump(u'abc') "!!python/unicode 'abc'\n" But I want >>> import yaml >>> yaml.dump(u'abc', magic='something') 'abc\n' What magic param forces no tagging? ...

Why do I get ARRAY(0x8470d6c) instead of a list from my YAML configuration?

I have this YAML file: name: Firas dirs: [/bin/, /home/phiras/] I am using YAML::Syck in perl to parse this file, and I have a problem with accessing dirs items. my code is: #!/usr/local/bin/perl use strict; use warnings; use YAML::Syck; use ConfigLoader; use Data::Dumper; my $conf = LoadFile("myconf.yml") || die("Error: Open conf...

JYAML: Serialize/deserialize nested/inner classes

First of all, Merry Christmas to everyone! Now to my question: Let's say I have the class Outer with some inner class Inner. As a field in Outer, I have a List<Inner>, which i then want to dump to a YAML file. I do this like so: Outer o = new Outer(); o.innerList = new ArrayList<Inner>(); o.innerList.add(new o.Inner()); ... Yaml.dump(o...

Using gsub to replace double slashes in Ruby

Hi, I am having some issues using gsub to replace double slashes. The problem is this: I built a small script to parse YAML files for a directory location, and then to use that to glob the files in that directory. Say this is the directory it finds: C:\Program Files\Adobe\Adobe Flash CS3\en\Configuration\ActionScript 3.0\Classes Thi...

Ruby 1.9, YAML, and string encodings: how to lead a life of sanity?

It seems to me that the YAML library that ships with ruby 1.9 is encoding-deaf. What this means is that when generating YAML, it'll take any string of bytes, and escape any byte sequence that doesn't output clean ASCII. That's lame, but acceptable. My problem is the other way around. When loading content from said YAML dump. In the ex...

Simpler than SQLite

Do you know any SQLite-like database that stores its data in easily readable plain text format (like multi-line json or yaml)? I'd like to store some data along with my project in version control system but if I use sqlite I can't merge data changes that occurred in different working copies. I don't want to use just some kind of config...

how to reference a yaml "setting" from elsewhere in the same yaml file?

I have the following yaml: paths: patha: /path/to/root/a pathb: /path/to/root/b pathc: /path/to/root/c How can i "normalise" this, by removing /path/to/root/ from the three paths, and have it as its own setting, something like: paths: root: /path/to/root/ patha: *root* + a pathb: *root* + b pathc: *root* + c Obviously...

ActiveRecord serialize using JSON instead of YAML

I have a model that uses a serialized column: class Form < ActiveRecord::Base serialize :options, Hash end Is there a way to make this serialization use JSON instead of YAML? ...

How to get the formatting options for the to_yaml method working on ruby 1.9.1 ?

According to the YAML documentation it's possible to pass a hash of options to the .to_yaml method. Currently when I pass the options as suggested by the documentation it's not working, the hash is being ignored. irb(main):001:0> require 'yaml' => true irb(main):002:0> user = { "1" => { "name" => "john", "age" => 44 } } user.to_yaml =>...

How do I access a python list from a django templatetag?

I have created a templatetag that loads a yaml document into a python list. In my template I have {% get_content_set %}, this dumps the raw list data. What I want to be able to do is something like {% for items in get_content_list %} <h2>{{items.title}}</h2> {% endfor %}` ...

Having a relation 1 to many on Doctrine but having 2 fields being the primary key on the other end

Hi ! Does anyone knows how can I have a relation 1 to many in doctrine but in this special way: in my principal table I have some fields, almnost none of them are fields which could have translations Table1: table_id <- primary key numeric_field1 numeric_field1 numeric_field3 now in my Table1_translations I have all the fields which ...

Simple structured data (INI, YAML, JSON, etc) editor application

I am looking for a standalone application that will allow administrators to easily edit data in a structured format that is easy to parse (INI, YAML, JSON, etc). Although I can find very complex and sophisticated XML editors, I can't find anything simple - all I want is an application that will read a simple file and allow admins to edit...

Best YAML editor for windows users?

I'm new to this language,is there an editor that can do indentation automatically? ...

YAML/JSON/XML which one to choice on IPhone for communication over RESTFul protocol?

I'm writing as simple application that comunicate with an external server. The server currently support yaml, xml and json. Which encoding is fastest on IPhone? Which has better support? What libraries do you suggest? ...