How can I refer one YAML file from another? - yaml

I have a YAML file, which I want to refer into a different YAML file. Is this possible, if yes, if someone can help me with the syntax or examples? Would be great help

Each YAML document is self-contained and thus cannot refer to any external data or resource. YAML doesn't even know the concept of files; YAML documents are contained in a stream which might be a file, a network socket, anything.
Various YAML users employ various techniques to refer to outside content, like OpenAPI's $ref or Ansible's and Helm's preprocessing with templating engines. However all those features are only supported in their respective environments and are not YAML features.
If you are in control of the code loading the YAML file, you can of course implement your own method. If you are not in control of the code loading the YAML file, all you can do is either depend on whatever features the loading code offers, or manually preprocess your YAML with some templating engine to produce a single merged YAML file which you then hand over to the loading code.

Related

Is it possible using sphinx to link to a specific URL using the :class: role?

I'm using Sphinx to document a python package that wraps a proprietary API that wasn't documented using Sphinx as far as I can tell. The API documentation provides useful information, but the URL's are not in a format that sphinx can automatically generate links for. Is it possible to mark a string semantically as a class, while specifying the link target by hand?
I tried:
:class:`Class <https://api.documentation/some/path/to_class_constructor.htm>`_
but this raises a WARNING: Mismatch: both interpreted text role prefix and reference suffix.. Then I also tried
:class:`Class <https://api.documentation/some/path/to_class_constructor.htm>`
which doesn't raise a warning, but doesn't generate a hyperlink either.
As per Steve Piercy's comment below, the sphinx.ext.extlinks extension keeps the documentation a little cleaner, but it looses its semantic meaning, which I would prefer to keep.
Is it possible to somehow show the text references a class, and at the same time links to the external API documentation?

Go Lang mysql html comments

I would like to create a mysql form for comments and display them as well in html.
I am able to use the MySQL package to read out data in the terminal but am struggling to output on the html/template engine any pointers welcome.
If I understand your question correctly, you are looking for a way to create dynamic webpages that have user input. You are going to need to learn some HTML/CSS to make it look nice (Even if you do use templates you can find online).
In terms of generating the dynamic content, Golang provides a builtin templating library [http://golang.org/pkg/text/template/]. Or if you like, you can look into other templating languages like Mustache or Handlebars, which have libraries in Go if you want to go that route.
For collecting user input, you're going to want to create a form that POSTs the data to a particular endpoint of your server. In making your server, I would look into both Golang's net/http package, which is fully featured, or you could look into Gorilla, another Go library that has a lot of nice features for making more powerful webapps and such.
A couple resources for you to check out:
https://golang.org/doc/articles/wiki/
http://www.gorillatoolkit.org/
Hope this helps!
Thanks I have understanding to do this with php and html I'm just trying to translate over too go Lang for the submitting and rendering out from mysql. I will look at creating a simple go form using the template engine.

PDF Creation from a word template

I have this requirement:
Generate a Word document from template using poi.jar. The generated doc will have dynamic values as well as the formatting needed.
Convert the generated doc as it is to PDF. I don't want to apply any formatting again while generating the PDF.
Is there any open source Java API available to do this?
OpenOffice.org offers an API that can do the job for you.
Please note that this question has been answered many times on StackOverflow (and over the web), see this answer for example.

why using xml files in form validation in server side?

what is the benefit from using xml files in server side validation, in struts, for example, XML files are used in validation, here's an example http://www.vaannila.com/struts-2/struts-2-example/struts-2-validation-using-xml-example-1.html, and other practise to put all forms specification into XML file and parse it once then cashe the resulted object in order to use it in another time without the need to parse XML file again "the concept of lazy initialization". I want to know why using XML??
1) It's a file that can be configured easily without recompiling the application much the same as an app.config file
2) Advantage over app.config is that this validation file is specific to a single task, reducing the risk that would be incurred if the main app.config was edited and updated.
So basically you can now if you like put a GUI editor in front of the xml file and provide a means for administrators to modify the contents in a live environment.
Storing the data in a database would give you similar benefits, but it's a rather heavy weight solution to the problem.

Which template engine and Ajax framework/toolkit can load templates from JAR files?

Which Template-Engine and Ajax-Framework/-Toolkit is able to load template information from JAR-Files?
If you mean server-side template engines, you can get Velocity to load its templates from the classpath (which includes JAR files). Check out the section "Configuring the Resource Loaders (template loaders)" in the Developer Guide.
Take a look at http://www.ztemplates.org which is simple and easy to learn. This one allows you to put all related templates, javascript and css into one jar and use it transparently. Means you even have not to care about declaring the needed javascript in your page when using a provided component, as the framework does it for you.

Resources