Finding a download URL from the NuGet OData feed - nuget

What's the trick for deriving a download URL given an entry in the Packages table in the OData data set?

< content type="application/zip" src="SOME-URL" />

Under the <entry/> node, look for a <content/> node which contains 2 attributes type and src. The src attribute contains the download url. You could use LINQ to XML to get it. Seems easy, right? Oh, and remember to append an XNamespace to the XName when using LINQ to XML to query the nodes.

Related

Jaspersoft REST API folder traversing, XML PDF extraction

Currently trying to extract an XML document that returns all the files in a particular folder, after which I can return the XML document containing files in a given folder. In the below JPG, I want to extract files from folder '02_17_2018', which is a sub-folder under '/LatestJLIPDFs' using the Jaspersoft REST API (see image below).
Basically, I'm trying to match the query http://(host):(port)/jasperserver[-pro]/rest_v2/resources?(parameters) with the Jaspersoft REST API to get to the '02_17_2018'. I've tried several different parameters, none of which seem to work. Here is a list of attempted parameters,
folderURI=/LatestJLIPDFs/02_17_2018&type=file
folderURI=/02_17_2018&type=file
folderURI=/LatestJLIPDFs&type=file&q=02_17_2018
folderURI=LatestJLIPDFs/02_17_2018&type=folder&q=02_17_2018
among many more attempts. Any hints to how the files in '02_17_2018' can be extracted?
I think your problem is related to parameter name folderURI. In the documentation, it looks like folderUri.
Let's try to write it in camel case as in my example:
http://localhost:8080/jasperserver-pro/rest_v2/resources?folderUri=/public&type=file&recursive=false

how to find path of a node under /etc/tags in AEM?

I want to search a tag under /etc/tags in AEM programmatically.
for ex:
folder structure is like
/etc/tags/
uder tags there are multiple tags
1.20101/ate2
2.73883
3.44qqiw
4.222
if i want to search ate2 i should get /etc/tags/20101/ate2.
You can use QueryBuilder API to query it.
Sample Query would be
type=cq:Tag
path=/etc/tags
nodename=ate2
Sample SQL2 Query for the same would be
select * from [cq:Tag] as s where ISDESCENDANTNODE('/etc/tags') AND NAME(s)='ate2'
One solution is write the query as suggested by rakhi, other is to utilize TagManager API that provides you lot of methods to search tags and once you get Tag instance you could get path from it. Javadocs for TagManager can be found here and for Tag here
For reference you could look at the code here. One thing to keep in mind in case you end up using this approach you will need to work by creating a system user to get ResourceResolver instead of calling resolverFactory.getAdministrativeResourceResolver(null), refer to article here

How to get file name from Sharepoint Asset Library

How can I get the file name of an image from a SharePoint 2013 Asset Library?
I am trying to write a JQuery/REST snippet to search a subset of images within the library, based on their other column values and display them. I would use FileLeafRef in case of a Document Library, but I couldn't find an equivalent field in Asset Library.
I so far tried the following, neither returns file name:
https:///crm/_api/Web/Lists/GetByTitle('Publication%20List')/items?select=File/Name&expand=File
https:///crm/_api/Web/Lists/GetByTitle('Publication%20List')/items?select=FileLeafRef
There is a typo in your example, in particular $ symbol is missing for $select and $expand query options (more details).
The following rest endpoints demonstrate how to retrieve file name from Assets library:
1) Using FileLeafRef property:
/_api/web/lists/getByTitle('<list title>')/items?$select=FileLeafRef
2) Using File/Name property:
/_api/web/lists/getbytitle('<list title>')/items?$select=File/Name&$expand=File
3) Using Folder/Files property:
/_api/web/getfolderbyserverrelativeurl('<list url>')/files?$select=Name
I believe that yt's still FileLeafRef for an Asset Library. Any chance you could put the relevant code in your question?
Here's the rest endpoint for FileLeafRef:
/_api/web/lists/getByTitle('<list title>')/items?$select=FileLeafRef
Alternatively you could always use the File Name property:
/_api/web/lists/getByTitle('<list title>')/items?$select=File/Name&$expand=File

How to read .net assembly's meta data table

I'm reading Jeffery Richter's book "CLR via C#". He mentioned the CLR metadata table contains TypeRef and MemberRef section.
I want to build a call graph by reading these MemberRef and TypeRef information. What is the best way to do so? After a search, I found somebody read the file directly using PE/CLR file format. Somebody use native IMetaDataImport. I wonder if there is any .net built-int classes or 3rd party libraries to do so?
Thanks!
If you want to see metadata you can use ILDasm.exe.
Example: ILDasm.exe D: \ MyTestAsm.dll
Next: view -> meta info -> we Show!
If you want to receive data from the code, you can research 3rd party library Mono:
http://www.mono-project.com/docs/tools+libraries/libraries/Mono.Cecil/
MetaData it is part of IL-code. If you want to see Il code you can see this:
How to get access to embedded assembly's metadata using IMetaDataDispenser.OpenScope?

How to map urls?

I would like to map pages such domain/content/myProject/home.html to domain/home.html. /content/myProject/ is not needed. I have the following code:
String newpath = getResourceResolver().map(page.getPath());
this does not change anything. newpath is stay page.getPath()
how to solve this issue?
Answering as this question as it remains unanswered. Here is an example of how the etc mappings should look like:
Trick is you add 2 entries to sling:internalRedirect as / and /content/example/
AEM first tries to resolve resources with first entry '/'. So non page URLs like /etc/designs, /content/dam etc will be addressed by the first entry. If it is unable to resolve using the first one, it uses the second entry to resolve the page.
This is also the adobe recommended way for URL shortening compared to other techniques like apache redirect.
You need to create map in etc.Then Resource Resolver will take care of trimming the path .
CREATING MAPPING DEFINITIONS IN AEM
In a standard installation of AEM you can find the folder:
/etc/map/http
This is the structure used when defining mappings for the HTTP protocol. Other folders (sling:Folder) can be created under /etc/map for any other protocols that you want to map.
Configuring an Internal Redirect to /content
To create the mapping that prefixes any request to http://localhost:4503/ with /content:
Using CRXDE navigate to /etc/map/http.
Create a new node:
Type sling:Mapping
This node type is intended for such mappings, though its use is not mandatory.
Name localhost_any
Click Save All.
Add the following properties to this node:
Name sling:match
Type String
Value localhost.4503/
Name sling:internalRedirect
Type String
Value /content/
Click Save All.
This will handle a request such as:
localhost:4503/geometrixx/en/products.html
as if:
localhost:4503/content/geometrixx/en/products.html
had been requested.
You can refer here for further documentation http://docs.adobe.com/docs/en/cq/5-6-1/deploying/resource_mapping.html