I have implemented creation of subcommunities using IBM SBT 1.0.2.20140527-1807 against IC 4.5 (thanks for heavy API changes from 1.0.1 :-/ ) and want to update a freshly created subcommunity with a nice "content" containing some HTML with links to some content inside this community. Thus I must first create the subcommunity and afterwards update the "content" attribute, because I need some data not yet present before successful creation.
The way I do this is basically as follows:
(1) Create subcommunity [proven successful, and it IS a subcommunity now]
(2) Fetch the new subcommunity using CommunityService.getCommunity(communityUuid) [proven successful]
(3) execute community.setContent(string) [no errors]
(4) execute CommunityService.updateCommunity(community) [no errors]
The REST request created and sent for CREATE is:
POST /communities/service/atom/community/subcommunities?communityUuid=8ea4ff45-ef58-4c9b-b131-def2d3e233f7
The XML data sent is:
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns:snx="http://www.ibm.com/xmlns/prod/sn">
<title type="text">mytitle</title>
<content type="html">mycontent</content>
<category term="community" scheme="http://www.ibm.com/xmlns/prod/sn/type"></category>
<category term="mytag"></category>
<snx:communityType xmlns:snx="http://www.ibm.com/xmlns/prod/sn">private</snx:communityType>
</entry>
The REST request created and sent for UPDATE is:
PUT /communities/service/atom/community/instance?communityUuid=ae63bedf-98f2-45d4-ad6a-4dfd1f3a58d7
The XML data sent is:
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns:snx="http://www.ibm.com/xmlns/prod/sn">
<title type="text">mytitle</title>
<content type="html">mycontent</content>
<category term="community" scheme="http://www.ibm.com/xmlns/prod/sn/type"></category>
<category term="mytag"></category>
<snx:communityType xmlns:snx="http://www.ibm.com/xmlns/prod/sn">private</snx:communityType>
<snx:communityUuid xmlns:snx="http://www.ibm.com/xmlns/prod/sn">ae63bedf-98f2-45d4-ad6a-4dfd1f3a58d7</snx:communityUuid>
<id>http://communities.ibm.com:2006/service/atom/community/instance?communityUuid=ae63bedf-98f2-45d4-ad6a-4dfd1f3a58d7</id>
</entry>
Afterwards the content is indeed updated -- but the community is not a subcommunity any more, but a regular top level community.
Why is that?
What can I do about it?
For the impatient: I have found the root cause, and in some circumstances this offers the possibility for a workaround.
The root cause is that the Community representation in IBM SBT SDK (Java) currently (as of July 2014) does not offer a "parent community URL" element.
http://www-10.lotus.com/ldd/appdevwiki.nsf/xpDocViewer.xsp?lookupName=IBM+Connections+4.5+API+Documentation#action=openDocument&res_title=Community_entry_content_ic45&content=pdcontent says that a community XML representation has a <link rel="http://www.ibm.com/xmlns/prod/sn/parentcommunity" type="application/atom+xml" href="..." /> element (where href is the atom/instance URL, not the "community URL" with html/communityview) if it represents a subcommunity, which is ignored on PUT/POST -- but:
THIS IS NOT TRUE:
In fact this element is REQUIRED on PUT to keep a community's "sub community" nature on change. And worse: If it is broken, it cannot be "repaired": Because of other limitations for subcommunities, an existing community cannot be changed to become a subcommunity of another top level community. Subcommunities can only be CREATED (and kept, of course).
What I have done to work around that pitfall is to subclass Community and some other classes to extend the XML marshal/unmarshal mechanisms in SBT SDK to cope with parent community URLs. If you know what you're doing everything is fine, but if you want generic code which simply does not break subcommunities, you must also READ ALL COMMUNITIES as if they may be subcommunities. If you don't, you won't see this information and write back the community as top level community.
Thus it is better to wait if you can :-(
I expect IBM to extend the implementation of Community and related classes by a parent community URL field. What I am curious about is how they will deal with the fact that the complete Atom feed URL is required, including the server address and the parent community UUID. I took the q&d way and changed the community URL as returned by parentCommunity.getCommunityUrl(), but this eventually does not take into account the various AUTH variants.
IBM SBT SDK 1.1.0 of Jul 17, 2014, seems to be out. At least it is available in Maven central.
This is the better answer of course but will require several code adjustments if you have built code on top of internal structures due to some internal refactorings.
Related
I have followed the example here for adding a custom lexicon to my speech SSML. However, it is being ignored. I tried it with my own lexicon and also with the sample. At first the sample seemed to work, but when I removed the lexicon it still expanded out BTW as "By the Way" so it appears it was having no impact for the sample either.
For reference, here is the sample code used to create the lexicon
<?xml version="1.0" encoding="UTF-8"?>
<lexicon version="1.0"
xmlns="http://www.w3.org/2005/01/pronunciation-lexicon"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/2005/01/pronunciation-lexicon
http://www.w3.org/TR/2007/CR-pronunciation-lexicon-20071212/pls.xsd"
alphabet="ipa" xml:lang="en-US">
<lexeme>
<grapheme>BTW</grapheme>
<alias>By the way</alias>
</lexeme>
<lexeme>
<grapheme> Benigni </grapheme>
<phoneme> bɛˈniːnji</phoneme>
</lexeme>
</lexicon>
And here is the sample SSML (in which the lexicon is ignored)
<speak version="1.0" xmlns="http://www.w3.org/2001/10/synthesis"
xmlns:mstts="http://www.w3.org/2001/mstts"
xml:lang="en-US">
<voice name="en-US-JennyNeural">
<lexicon uri="MY_PATH_TO/customlexicon.xml"/>
BTW, we will be there probably at 8:00 tomorrow morning.
Could you help leave a message to Robert Benigni for me?
</voice>
</speak>
I have tried accessing the lexicon from local storage as well as from a site hosted by Azure App Service. I also looked to see if the Javascript had any sort of "addLexicon" method within SpeechConfig or SpeechSynthesizer, but I couldn't find anything. Anyone have any ideas why this isn't working and what I need to do to fix it?
According to Microsoft, a path to the lexicon on your local machine does not work. It must be hosted on the web somewhere. If you have any app service plan, this is extremely lightweight (it's just hosting an XML file) so you can just create a new app service to host it. Of course if you have other methods to expose files via web uri that should work fine too.
Also, I was having issues with the hosted files using sapi alphabet. The alphabet abbreviation in the documentation is incorrect. It should be x-microsoft-sapi, not just sapi. Once I corrected that I was able to get both ipa (which is correct as ipa) and sapi lexicons working when hosted on a remote server.
I'm trying to improve our workflow with some XML-configuration files we use in a Visual Studio Solution. I figured I'll start with explaining what I'm trying to accomplish and then explain some of my ideas that I've tried for several hours without success.
The Problem
I'm working with a system where the data model is configured in a database, the models are also stored on disk using xml-files, these are then synced during startup of the app. Here's part of the stuff that are synced:
Data Types
All data types lives in one XML configuration file per data type and each has some properties like Name and Key. All data types are configured in the same folder, example: /config/dataTypes
Example
textString.config
<?xml version="1.0" encoding="UTF-8" ?>
<DataType Key="a45c9a94-09d7-4df9-85e6-d6930abc6c12" Name="Textstring">
textArea.config
<?xml version="1.0" encoding="UTF-8" ?>
<DataType Key="b104788f-4e2f-4592-9387-8b3861bd8046" Name="Textarea">
Entity Types
Think of these as models with X number of properties, each property is configured and connected to a Data Type.
Example
customer.config
<?xml version="1.0" encoding="UTF-8" ?>
<Entity>
<Properties>
<Property Name="Firstname" TypeKey="a45c9a94-09d7-4df9-85e6-d6930abc6c12" />
<Property Name="Lastname" TypeKey="a45c9a94-09d7-4df9-85e6-d6930abc6c12" />
<Property Name="Description" TypeKey="b104788f-4e2f-4592-9387-8b3861bd8046" />
</Properties>
</Entity>
My end goal is to provide intellisense when editing a Entity Type so that I'll get all the Data Types as suggestions when entering the "TypeKey" property of the Property element. Preferably showing the Name of the data type in the dropdown list and when choosing it adding the guid as value for the TypeKey-property. I would also like to show the Data Types name when hovering the GUID with the mouse (or in some other way).
As you can imagen during the process with a project new data types can be added so the intellisense needs to be dynamic based on the files in the data types-folder.
I should also mention that these configuration files also can be edited from a UI in the application and I don't have control over how they are serialized, hence - there is no XML namespace in the files, they look like in the examples above.
We also have multiple different VS-solutions with different setups of Data Types and Entity Types. So we need individual intellisense in each project.
What I've tried
My first idea was to create a VS-extension that creates a dynamic XML Schema XSD-file based on the files in the data types folder. The VS would then pick up and use the XSD for XML-files in the Project, turns out that this only works with a namespace configured (remember, I can't add namespaces since I don't control the external app).
To get around this it worked to manually add the schema-file to the XML file while editing the file. (Like this: https://learn.microsoft.com/en-us/visualstudio/xml-tools/how-to-select-the-xml-schemas-to-use?view=vs-2019). The problem with this is that it needs to be done for each xml-file and the setting is not stored.
I then started to play with the VS extension possibilities to try to automatically configure this Schema to a XML-file that is opened. Turns out I had a really hard time to get the "configuration object" that is pushed to the Properties Browser when the XML file is opened. I managed to get a event-handler setup that was triggered when the XML files as getting "focus" but I was stucked trying getting the properties from the Properties Browser.
I also tried another approach with a custom "code completion"-extension but it made the UI feel very "cluttered" while editing.
After spending about 10 hours playing around with this I feel I don't really have a good path to a solution as my experience with VS-extensions is not that extensive.
I would love to get some feedback and ideas on how to approach this problem, since the XSD is different from each project if I go down the "dynamic" path we can't use the global VS settings since each project has different data types hence needs different allowed values for the TypeKey property.
One approach that I'm thinking about is to use a generic XSD (allowing all values for the TypeKey) in the Global Schema Cache for Visual Studio and create a "code completion"-feature for just the TypeKeys.
Any thoughts and pointers in the right direction would be very much appreciated.
I am working with a FHIR server that has Customized member in the resource.
Say if we receive a Patient with the following
xml = "<Patient xmlns='http://hl7.org/fhir'><hasSuperPower></hasSuperPower></Patient>";
How do I add the extra tag support in the FHIR .NET API so I can work with this Customized Resource? (so that the Deserilizer can process it and put it in a Patient Object.)
I have read from Mirjam Baltus 's post that the Model classes can be enhanced because they are all declared as "Partial class". Does
this mean I have to work with the FHIR API source code and add my own Partial class there and then re-compile it?
Would there be a way that I can just use the DLL from Nuget without have to touch the source code?
Why would you use a customized element rather than the standard extension element? Adding custom elements in this way is not compliant with the standard, won't work with any of the public test servers, won't interoperate with other FHIR systems and won't work with the reference implementations. Have you looked at the extensibility portion of the spec?
I've answered this in the Google forum as well, and agree with Lloyd.
If you receive a Patient with a <hasSuperPower> tag, that is not a FHIR compliant Patient.
FHIR has an excellent way to communicate data that doesn't fit in any of the standard fields, called extensions. If you use these, there is no need to write extra code to handle non-FHIR resources, and you can just use the existing libraries without having to change anything to them.
The superpower ability could look like this, and be FHIR compliant:
<Patient xmlns="http://hl7.org/fhir">
<extension url="http://mirjams.example.org/fhir/StructureDefinition/super-patient">
<valueBoolean value="true"/>
</extension>
</Patient>
I'd also like to point out this blog by Brian Postlethwaite about custom resource properties: https://brianpos.com/2018/05/03/code-generation-fhir-custom-resources/
I am using the Bing Search API in Windows Azure Marketplace (i.e., the API that replaces the old Bing 2.0 API, that expires on 1st August 2012). The Migration Guide provided by Microsoft states:
If there are no more pages of results, the /feed/link[#rel=’next’] property will no longer appear [...].
However, it seems that this is not always the case. For example, a News query for "Roger Federer" does not contain a link element:
Request: https://api.datamarket.azure.com/Data.ashx/Bing/Search/News?Query=%27"Roger+Federer"%27
Response:
<feed xmlns:base="https://api.datamarket.azure.com/Data.ashx/Bing/Search/News"
xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices"
xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"
xmlns="http://www.w3.org/2005/Atom">
<title type="text">"Roger Federer"</title>
<subtitle type="text">Bing News Search</subtitle>
<id>https://api.datamarket.azure.com/Data.ashx/Bing/Search/News?Query='"Roger Federer"'</id>
<rights type="text"/>
<updated>2012-07-26T15:43:03Z</updated>
<entry>
<!-- ... -->
</entry>
<!-- ... -->
</feed>
Nevertheless, there are more news: https://api.datamarket.azure.com/Data.ashx/Bing/Search/News?Query=%27"Roger+Federer"%27&$skip=50
Does anybody know where the problem might be? (Or where there is reliable documentation for the API?)
One thing to do is to update your BingSearchContainer.cs - I found there was an older version when I first started using it that caused me all sorts of problems like this. When I updated a lot of things started working.
I think the problem is that the BingSearchContainer is "fixing" your query and messing you up. Try the following:
Then try to do the query without the " marks. It will probably succeed and return results.
Try to use ' instead, you will probably get some results.
I think the container is escaping all your queries as a single phrase match by default. So just adding a search will work. Now when you really do have two phrases you need to search for... That I can't get working yet either.
I cannot reproduce this anymore: the response now contains a link element.
I suppose the Bing guys have fixed the problem in the meantime.
Is there a way to get an MSDN search bar in Firefox which will autocomplete .Net class and member names (and preferably also Win32 API methods) and take me directly to the MSDN page?
Google toolbar with Shift+Enter (I'm feeling lucky) will usually go directly to the msdn page for a .Net class, but it doesn't have targeted autocomplete. Also, since I'm too lazy to type site:msdn.microsoft.com, it doesn't always take me to MSDN. (eg, Graphics)
There are several msdn search providers available.
This search plugin (from the list flyfishr64 linked to) works quite well (suggestions and everything).
You could create a bookmark with a wildcard %s and the msdn keyword by using the following url for the bookmarked page:
http://social.msdn.microsoft.com/search/en-us/?query=%s
Now in the address bar, when I type "msdn StringBuilder" it brings me to this result page: http://social.msdn.microsoft.com/search/en-us/?query=StringBuilder
I did the same with the stackoverflow keyword and the http://stackoverflow.com/questions/tagged/%s url.
EDIT: as #AgentConundrum pointed out, using the http://www.google.com/search?hl=en&safe=off&q=%s%20site:msdn.microsoft.com url will restrict Google search to the msdn.microsoft.com site.
I ended up editing this search plugin from Shog9's answer and changing the search URL to Google's I'm Feeling Lucky.
Here's the XML:
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<!-- Created on Thu, 07 Jan 2010 15:11:13 GMT -->
<ShortName>MSDN</ShortName>
<Description>Search MSDN documentation</Description>
<Url type="text/html" method="get" template="http://www.google.com/search?hl=en&q={searchTerms}+site%3Amsdn.microsoft.com&btnI=I"/>
<Url type="application/x-suggestions+json" template="http://services.social.microsoft.com/search//Data/AutoCompleteTerms?t={searchTerms}&b=Msdn&l=en-US&m=10&rf=oss10"/>
<Image width="16" height="16">http://mycroft.mozdev.org/updateos.php/id0/msdn_schnore.ico</Image>
<Developer>Schabse Laks</Developer>
<InputEncoding>UTF-8</InputEncoding>
<moz:SearchForm>http://social.msdn.microsoft.com/Search/en-US/</moz:SearchForm>
<Url type="application/opensearchdescription+xml" rel="self" template="http://mycroft.mozdev.org/updateos.php/id0/msdn_schnore.xml"/>
</OpenSearchDescription>