Is it possible to register 2 extensions (file types) for a single MIME type? - registrykey

I have 2 file extensions that need to be associated with the one application. For example I am registering one like:
Registry.SetValue(HKEY_CLASSES_ROOT, ".xyz", "Content Type", "application/x-player", REG_SZ);
Registry.SetValue(HKEY_CLASSES_ROOT, "MIME\\Database\\Content Type\\application/x-player", "", "", REG_SZ);
Registry.SetValue(HKEY_CLASSES_ROOT, "MIME\\Database\\Content Type\\application/x-player", "Extension", ".xyz", REG_SZ);
Is it possible to register an additional extension to this mime type entry?

Related

How do I get display names from a custom field in Jira-python?

I am using the jira rest api in python (jupyter notebook) and want to get the display name of a custom field from Jira.
The custom attribute I am using represents Team Name in Jira. ex. 202 = "A Team", 204 = "The Brew Team", etc.
when I for loop I am able to get team id's but I'd like to get the display names ("A Team", "The Brew Team", etc.)
for item in project:
team = item.fields.customfield_26588
print(team)
Is there a way to get the actual display names from the custom field programatically?
Jira issue doesn't hold that information, jira instance does, since they associate the field with the issueType
you can get ALL the fields form the jira Instance, and match them against the ones in the issue with the id.
jira = JIRA(server=SERVER, basic_auth=(USER, PW))
issue_x = jira.issue("TEST-101")
all_the_fields = jira.fields()
for i in all_the_fields:
for xx in issue_x.raw['fields']:
if i["id"] == xx:
print(i)
Object of custom field looks like:
"customfield_1234": {
"required": false,
"schema": {...},
"name": "Name",
"allowedValues": [...]
}
If you want to have name of the custom field itself, you can get it from 'name' attribute of object.
So, in your code you need to use:
print team.name

how to use odata services to create model dynamically from manifest.json

I am very new to UI5, I am working on an application which requires me to create models based on the request made from the browser (client).
If I consume all the odata services beforehand & use them according to the request made, it will become too heavy unnecessarily.
is there any way, this can be done dynamically?
I think your question title and the question content might be contradictory so I am placing my suggestions separately.
how to use odata services to create model dynamically from manifest.json
In your manifest.json file, locate the "sap.app" section/property and then add a datasource as follows:
"dataSources": { //used data sources -> ui5-related information stored in sap.ui5 namespace (unique inside the app)
"modelalias": { //key is alias which is used below in e.g. sap.ui5 ...
"uri": "/sap/opu/odata/snce/PO_S_SRV;v=2/" , //mandatory; version is part of uri, e.g. ";v=2", default is 1
"type": "OData" , //OData (default)|ODataAnnotation|INA|XML|JSON
"settings": { //data-source-type-specific attributes (key, value pairs)
"odataVersion": "2.0" , //possible values: 2.0 (default), 4.0
"annotations": [ "equipmentanno" ], //filled e.g. for Smart Template
"localUri": "model/metadata.xml" //relative url to local metadata
"maxAge": 360 //time in seconds
}
}
To instantiate this model with the alias "mymodel", you can add an entry into the manifest.json under "sap.ui5" as follows:
"models": {
...
"mymodel": { //empty string "" is the default model
"preload": true; //indicator that the model will be created immediately after the manifest is loaded by component factory and before the component instance is created
"dataSource": "modelalias", //reference of dataSource under sap.app - only enhance it with more settings for UI5 if needed
"settings": {
}
}
},
Now the manifest file will instantiate "mymodel" based on your odata uri in "datasources" and then set the model onto your Component.js. So when your application starts, you can access the model in any controller using:
this.getOwnerComponent().getModel("mymodel")
If I consume all the odata services beforehand & use them according to
the request made, it will become too heavy unnecessarily. is there any
way, this can be done dynamically?
Your assumption is that creating a model will slow the app startup. This may not always be true since:
The model creation is very quick
Reading data is what takes time and model instantiation
ODataModels work asyncronously be default so calling .read or .write are operations that can be managed asynchronously
Special case: If you wish to pre-fetch all your data in advance (at startup) I would advise that you ensure that you utilize filters like $select, $top and $skip on your Gateway service to implement growing list like behavior.
Hope that helps you.
More information on manifest.json: Link
Growing List: Link
ODataModel Examples: Link

Are there any *standard* vocabularies that provide a descriptor for usernames/screennames/handles?

For example, consider a subset of the user data provided by the Twitter API:
{
"id_str": "6253282",
"screen_name": "twitterapi",
"name": "Twitter API"
}
Let’s say I want to model this information with JSON-LD. I can easily adapt most of this data using standards like:
JSON-LD’s built-in #id attribute
Schema.org’s name attribute
RFC 7565’s acct URI scheme
{
"#id": "acct:6253282#twitter.com",
"???": "twitterapi",
"http://schema.org/name": "Twitter API"
}
(The ??? is a placeholder for the descriptor I’m seeking.)
In short: are there any standard vocabularies that I could use to replace the ??? in the code snippet above?
The vocabulary FOAF¹ provides the nick property:
A short informal nickname characterising an agent (includes login identifiers, IRC and other chat nicknames).
¹ Note that this vocabulary is part of the JSON-LD Context http://www.w3.org/2013/json-ld-context/rdfa11:
"foaf": "http://xmlns.com/foaf/0.1/",

Web API OData ignore properties added by client-side

I get an error when I call Put to my server using WebApi Odata v4.
{
"error": {
"code": "",
"message": "The request is invalid.",
"innererror": {
"message": "job : The property 'test' does not exist on type 'Model.Temp'. Make sure to only use property names that are defined by the type.\r\n",
"type": "",
"stacktrace": ""
}
}
}
this error happens because the property "test" is not set in the Model "Temp". it is actually added by javascript, and only used in client-side
How do I make so that OData will just ignore properties that are not available in the Model ?
There is a way to deal with your scenario. It is not to ignore the properties, but to accept them by defining the entity type as an open type so that it can accept dynamic properties which are not defined in the model from the client and store them for future queries if necessary.
You can find the following tutorial for implementing an open type support: http://www.asp.net/web-api/overview/odata-support-in-aspnet-web-api/odata-v4/use-open-types-in-odata-v4

Desire2Learn Valence API Creating and updating sections?

I am working on integration with our university's SIS system and am stumbling a bit with the documentation related to creating and updating sections. http://docs.valence.desire2learn.com/res/enroll.html#Section.SectionData
I can use the route PUT /d2l/api/lp/(version)/(orgUnitId)/sections/ to create a default section named Section 1 with section code sec1 however when I try to update it or add an additional section with the routes: PUT /d2l/api/lp/(version)/(orgUnitId)/sections/(sectionId) (with the sectionId retrieved from my previous PUT) or POST /d2l/api/lp/(version)/(orgUnitId)/sections/
I am using the following block for my json data:
{
"Name": "Section 1d",
"Code": "Dan 101",
"Description": {
"Text": "",
"Html": ""
}
}
What am I missing in the syntax?
Thank You
The way you use the Valence Learning Framework API to create sections for course offerings is idiosyncratic. Assume you start with a blank course, that has no descendant org units (no sections, no groups, nothing):
GET /d2l/api/lp/1.3/orgstructure/113459
> {"Name": "Extensibility 106",
"Identifier": "113459",
"Type": {"Name": "Course Offering",
"Code": "Course Offering",
"Id": 3},
"Code": "EXT-106"}
GET /d2l/api/lp/1.3/orgstructure/113459/children
> []
Initialize course with section properties. The first thing you have to do is define the section properties for the course offering: what kind of sections do you want to create under the course offering? To create the section properties for the course offering, you use a SectionPropertyData block; here's one that says "I want this course to have 10 sections and to auto-enroll the students, randomly, into these sections" (EnrollmentStyle 2 corresponds to NumberOfSectionsAutoEnrollment):
{"AutoEnroll": true,
"EnrollmentQuantity": 10,
"EnrollmentStyle": 2,
"RandomizeEnrollments": true}
Now, to initialize the course with these settings, and have the first default section(s) created, we PUT that block to this route:
PUT /d2l/api/lp/1.3/113459/sections/
> [{"SectionId":113460,
"Name":"Section 1",
"Description":{"Text":"","Html":""},
"Enrollments":[]},
...
{"SectionId":113469,
"Name":"Section 10",
"Description":{"Text":"","Html":""},
"Enrollments":[]}
]
Notice that with this call, we've now created 10 sections as children of this course offering, and the back-end service has automatically generated names (and codes) for them.
Add a new section after the fact. Now suppose we want to add an eleventh section to this course. First, we need to use a SectionData block for the new section's properties:
{"Name": "Section 11",
"Code": "Sec11",
"Description": {"Content": "New Section Descr.", "Type": "Text} }
(Note: When you form this block to create the new section you have to use a RichTextInput type structure for the Description property. When you get the properties for a section back from the service, it writes the description using the RichText property instead. This is a common sticky point for devs new to the framework)
Then, you POST that block to this route:
POST /d2l/api/lp/1.3/113459/sections/
> {"SectionId":113470,
"Name":"Section 11",
"Description":{"Text":"Description","Html":""},
"Enrollments":[]}
You'll get back the properties for the newly created section.
Summary. So, "why PUT and then POST"? Yes, it is a bit confusing, but think of it this way:
The first use, of PUT, is to update the "section properties" attribute for a course offering (as a consequence, when a course offering's section properties are initially defined, as a side effect, the back-end creates the section org units needed to go along with those new settings).
The second use, of POST, is to create a new org unit (a new section), and assign it to the course offering.
It looks like your routes and your request are okay. Only one small change with the route. You need to use the RichTextInput field that is described in the documentation D2L Conventions
Basically instead of:
"Description": {
"Text": "",
"Html": ""
}
You need:
"Description": {
"Content": "",
"Type": "" (Either Text or Html)
}

Resources