i have a yaml file that contains data related to particular device. i want to search for nodes, key/value pairs and retrieve values and then write them to oracle database. how to do that? here is examle:
---
-device:
-printers:
location: 176.12.43.11
description: hp printer
i want to retrieve that data with similar below c# code:
YamlNode node = YamlNode.FromFile("C:\\test\\test.yaml");
YamlMapping mapping = new YamlMapping("device.printers.location");
var value = mapping.Value;
i've already searched for solutions, but didn't find any, there is not much info and detailed documentation about yaml.net . ahh yes, i wan't to retrive data to c# app.
there is .net library for yaml, that seems less documented and i didn't find solution to my problem. thanks in advance
Related
I'm new to both UniData and Uniobjects so if I ask something that obvious I apologize.
I'm trying to write a tool that will let me export contacts from our ERP (Manage2000) that runs on UniData (v. 6.1) and can then import them into AD/Exchange.
The primary issue I'm having is that I don't know which fields (columns?) in the table (file?) are for what. I know that that there is a dictionary that has this information in it but I'm not sure how to get what I want out of it.
I found that there is a command LIST.METADATA in the current UniData documentation from Rocket but it seems that either the version of UniData that we are using is so old that it doesn't have this command in it or it was removed from the VOC file for some unknown reason.
Does anyone know how or have any tips to pull out the structure of a table so that I can know which fields are for what data?
Thanks in advance!
At TCL:
LIST DICT contact.master
Please note that the database file name (EX: contact.master) is case sensitive. I don't have a UniData instance at the moment to provide an example output. However, it should be similar to Universe's output:
Field......... Type & Field........ Conversion.. Column......... Output Depth &
Name.......... Field. Definition... Code........ Heading........ Format Assoc..
Number
AMOUNT.WEBB A 1 MR22 Amt WEBB 10R M
PANDAS.COST A 3 MD2Z Pandass Cost 10R M
CREDIT.EXP.DT A 6 D4/ Cred Exp Date 10R M
For the example above, you can generally tell the "data type" of the field by looking at the conversion code. "D4/" is the conversion code for a date. "MD2Z" is a numeric conversion code, which we can guess is for monetary amounts. I'm glossing over the power of conversion codes, so please make sure to reference Rocket's documentation for these codes to truly understand what these fields would output. If you don't have the documentation in front of you, you can also reference this site:
http://www.koretech.com/kr_help/KU2/30/en/KMK_Prog_Conversions.htm
If you wanted to use UniObjects and C# to retrieve the field names in a file, you could use the following code:
UniCommand fieldSelectCommand = activeSession.CreateUniCommand();
fieldSelectCommand.Command = "SELECT DICT contact.master";
fieldSelectCommand.Execute();
UniSelectList resultList = activeSession.CreateUniSelectList(0);
String[] allFieldNames = resultList.ReadListAsStringArray();
Having answered your question, I would also like to make a recommendation that you check out Rocket's U2 Toolkit for .NET if you're mostly going to be selecting data from the database instead of reading and manipulating individual records:
http://www.rocketsoftware.com/products/rocket-u2-toolkit-net
Not only does it present an ADO.NET way of accessing the database, it also has a better performance version of the UniObjects library under the U2.Data.Client.UO namespace.
The Dictionary, in my opinion, is a recommendation of how the schema should behave. However, there are cases when it's not 100% accurate. You could run "LIST CONTACT.MASTER TOXML TO MYFILE.XML" which would create an xml file what you could parse.
See https://u2devzone.rocketsoftware.com/accelerate/articles/u2-xml/u2-xml#section-0 for more information.
I want to read the ULS of Sharepoint, and Filter Items by its Level (Exception,Unexpected,Critical) to display a linechart of errorcount in a certain timeinterval.
Google just showed me a bunch of ways to add new Entries or get a specific Entry.
So - I need to parse each logfile on my own or is there a built-in way I am missing here?
Maybe the best approach is to look into the Code of Sharepoint LogViewer and extract what I need?
If you use SP2013 check SPULSRetriever class
usage:
var entries = new SPULSRetriever(forwardCheckTimeInMinutes, maxEntries, DateTime startTime).GetULSEntries(new Guid(correlationId));
For SP2010 you can check answer to this question
I want to read through a xaml file, and find all the lines with 'Annotation.AnnotationText' and get specific data from that line.For example, this line:
<prwab:Branch Condition="{x:Null}" sap2010:Annotation.AnnotationText="testing information " ContinuouslyExecute="False" CreatedBy="System Administrator" CreatedOn="2013-02-23T14:51:28.1555955-05:00" DisplayName="Failure" EnableValidationRule="False" sap:VirtualizedContainerService.HintSize="160,234" ID="ab91dec8-1976-491e-91eb-58e073a69d16" IsReportable="False" LastModifiedBy="System Administrator" LastModifiedOn="2013-02-23T14:51:28.1555955-05:00" MediaRecord="[MediaRecord]" SystemName="CollectDigitsActivity1 Failure6" Timeout="10000" Type="Voice">
I want find all the lines with 'AnnotationText' in my xaml file, and get information like text = 'testing information', id = 'ab91dec8-1976-491e-91eb-58e073a69d16' , created date and lastmodified date.
I have 0 knowledge in this area and I don't know where to start and which method should I use. Thanks for helping!
XAML is just a specific flavour of XML. You will need to use XML parsing to read the file into an object that you can process in this manner. I recommend Linq to XML for this (look at XDocument class to get started), specifically as finding values by XName using a specific namespace as you will need to for the "sap2010" namespace is very easy.
You can then easily parse and extract the information you are looking for using those classes.
I made a form that basically displays information about different vendors from an XML file that I was given. The XML file is retrieved from a class that I created, called VendorsDB.cs. On my form, I have a Previous and Next button that I want to display the next vendor or the previous vendor (Vendor1, Vendor2...) but I have no idea what method to use. I know I have to use a loop but I'm not sure as to how to code the loop. I've just started programming with C# so I'm really lost. Any help would be greatly appreciated!
Your question is missing alot of information, but what im seeing is that you need to do some work with XML.
I suggest you look into Linq To XML which enabled you to query tags and attributes with query syntax.
A very simple query good look like this:
// Load the xml from the specified path
var xml = XDocument.Load(#"LocationOfXml");
// Query the first element with a "MyXmlTag" as name
var someAttribute = xml.Descendants().FirstOrDefault(x => x.Name == "MyXmlTag");
The query language is far richer than this simple query. Read up and im sure you'll be able to get it working asap.
I would like to create a C# program to write, read, query xml file. I am very new to xml using C#. Can anyone please help me..
specifically i want to do this:
<streets>
<street1>
<house1 no=1 color=red/>
</street1>
<street2>
<house2 no=2 color=blue/>
</street2>
</streets>
I want to read this xml file and print all the houses and their properties.
I want to append to this xml file any new houses
I want to query where any specific house is located.
Can anyone please help me in this?
You can use LINQ. Please have a look at this article: http://www.codeproject.com/Articles/24376/LINQ-to-XML. Hope this help!
If you are interested in creating an application to create some data on 'House' and want to have the capabilities of editing/updating, adding and removing such data, and also want to store it in XML, then it is simple. Here I am considering that you are not very interested to know the exact metadata of the XML and the XML need not be following some predefined schema.
For such a requirement I worked sometime back and you may look at this for the same:
http://www.geekays.net/post/2011/03/24/XML-Data-Storage-and-XmlSerializer-The-easy-data-store.aspx