I have installed udpipe and it successfully installed but other functions of the same is not working properly - udpipe

library(udpipe)
x <- udpipe("His speech about marshmallows in New York is utter bullshit", "english")
Downloading udpipe model from https://raw.githubusercontent.com/jwijffels/udpipe.models.ud.2.5/master/inst/udpipe-ud-2.5-191206/english-ewt-ud-2.5-191206.udpipe to C:/Users/Lokesh Payasi/OneDrive/Documents/english-ewt-ud-2.5-191206.udpipe
This model has been trained on version 2.5 of data from https://universaldependencies.org
The model is distributed under the CC-BY-SA-NC license: https://creativecommons.org/licenses/by-nc-sa/4.0
Visit https://github.com/jwijffels/udpipe.models.ud.2.5 for model license details.
For a list of all models and their licenses (most models you can download with this package have either a CC-BY-SA or a CC-BY-SA-NC license) read the documentation at ?udpipe_download_model. For building your own models: visit the documentation by typing vignette('udpipe-train', package = 'udpipe')
trying URL 'https://raw.githubusercontent.com/jwijffels/udpipe.models.ud.2.5/master/inst/udpipe-ud-2.5-191206/english-ewt-ud-2.5-191206.udpipe'
Something went wrong
Error in utils::download.file(url = url, destfile = to, mode = "wb") :
cannot open URL 'https://raw.githubusercontent.com/jwijffels/udpipe.models.ud.2.5/master/inst/udpipe-ud-2.5-191206/english-ewt-ud-2.5-191206.udpipe'
Error in udpipe_load_model(object) :
File C:/Users/Lokesh Payasi/OneDrive/Documents/english-ewt-ud-2.5-191206.udpipe containing the language model does not exist
Tried every possible ways given on the net.

Related

How to install GSDML file via Siemens TIA openness API into TIA project?

Updating with very useful info using guidance from mrsargent
I am trying to automate following steps in C# (Visual Studio) with following steps:
run and connect to TIA portal
create project
install GSDML device files
add PLC and single device as per GSDML
design application relationship between product and PLC (cpu)
I tried to use OpenNess Demo Application for the same but I am unable to step through the code and there is no option in the Demo GUI to install GSDML files in the same.
I tried to write the following code as per documentation for CAX import of GSDML file but faced errors as described below:
Code:
using
(TiaPortal tiaPortal = new TiaPortal(TiaPortalMode.WithoutUserInterface))
{
Console.WriteLine("TIA Portal has started");
ProjectComposition projects = tiaPortal.Projects;
Console.WriteLine("Opening Project...");
DirectoryInfo dinfo = new DirectoryInfo(#"C:\projects\TestProjects\");
string unixTimestamp = Convert.ToString((int)DateTime.Now.Subtract(new DateTime(1970, 1, 1)).TotalSeconds);
string prj_name = "Prj_" + unixTimestamp;
Project project = null;
try
{
project = projects.Create(dinfo, prj_name);
}
catch (Exception)
{
Console.WriteLine(String.Format("Could not open project {0}", projectPath.FullName));
Console.WriteLine("Demo complete hit enter to exit");
Console.ReadLine();
return;
}
CaxProvider caxProvider = project.GetService<CaxProvider>();
if (caxProvider != null)
{
// GETTING ERROR OVER HERE
// {"Error when calling method 'Import' of type 'Siemens.Engineering.Cax.CaxProvider'.\r\n\r\nThe path of the import file 'C:\\Gaurav\\GSDML-xxxxxxxx.xml' with the extension '.xml' is invalid.\r\n"}
caxProvider.Import(
new FileInfo(#"C:\GSDML-xxxx.xml"),
new FileInfo(#"C:\ProjectImport_Log.log"),
CaxImportOptions.MoveToParkingLot
);
}
Console.WriteLine(String.Format("Project {0} is open", project.Path.FullName));
// IterateThroughDevices(project);
project.Close();
Console.WriteLine("Demo complete hit enter to exit");
Console.ReadLine();
}
Following error is observed:
{"Error when calling method 'Import' of type 'Siemens.Engineering.Cax.CaxProvider'.\r\n\r\nThe path of the import file 'C:\GSDML-xxx.xml' with the extension '.xml' is invalid.\r\n"}
Yes this is a difficult thing to do. However it is possible. First you need proper documentation that is a little difficult to find. The manual is very detailed and good found here
You need the import the GSD file as a CAx that is found page 939 of the documentation.
//Access the CaxProvider service
Project project = tiaPortal.Projects.Open(...);
CaxProvider caxProvider = project.GetService<CaxProvider>();
if(caxProvider != null)
{
// Perform Cax export and import operation
}
To create this CAx (an xml document) you need to look starting at page 988 of this manual. It will tell you how to configure. It is far too much to explain and list in this forum but the documentation does a good job of explaining after you read it 5 times ;)
It is probably best to read this entire import/export section in order to get a full understanding of how to do this. Hope this helps!

Is it possible to access/downlad glb or gltf models from Decentraland?

I have created a dummy scene using dcl init & dcl start and imported a few models from one of their github repositories.
I created a small script which creates a scene, imports those models into the scene and console logs the list of models I imported into the scene:
...
const trashCan = addToScene("trashCan", "models/Trash_Can.glb", new Transform({
position: new Vector3(0.2, 0.2, 0.2),
rotation: new Quaternion(0, 0, 0, 1),
scale: new Vector3(1, 1, 1)
}));
trashCan.addComponent(
new OnPointerDown((): void => {
console.log("Downloadable entities:");
// console.log(engine.entities);
for (let k in engine.entities) {
// console.log(engine.entities[k])
// console.log(engine.entities[k].components)
const shape = engine.entities[k].components["engine.shape"]
const transform = engine.entities[k].components["engine.transform"]
if (shape) {
// console.log(engine.entities[k].components["engine.shape"].data)
console.log(" name: " + shape.src)
}
if (transform) {
console.log(" position: " + transform.position)
}
}
})
)
...
The script gives me access to some model metadata i.e. modes' path in the project and their transform matrices in the scene:
I was wondering whether it is possible to access/download the 3D models.
Could it be possible to have access to those 3D models, maybe GET them? Does anybody know if Decentraland prohibits such practices? AFAIK they're using the Unity engine.
Just doing a GET on one of the models in the scene doesn't seem to be successful:
Could this be possible to achieve?
EDIT:
After the answer from #cachius, following his suggestion, I was able to find the following:
unity.data(#1) file is a UnityWebData1.0 file which can be decompressed using UnityPack as described here:
from unitypack.utils import BinaryReader
SIGNATURE = 'UnityWebData1.0'
class DataFile:
def load(self, file):
buf = BinaryReader(file, endian="<")
self.path = file.name
self.signature = buf.read_string()
header_length = buf.read_int()
if self.signature != SIGNATURE:
raise NotImplementedError('Invalid signature {}'.format(repr(self.signature)))
self.blobs = []
while buf.tell() < header_length:
offset = buf.read_int()
size = buf.read_int()
namez = buf.read_int()
name = buf.read_string(namez)
self.blobs.append({ 'name': name, 'offset': offset, 'size': size })
if buf.tell() > header_length:
raise NotImplementedError('Read past header length, invalid header')
for blob in self.blobs:
buf.seek(blob['offset'])
blob['data'] = buf.read(blob['size'])
if len(blob['data']) < blob['size']:
raise NotImplementedError('Invalid size or offset, reading past file')
import os
f = open('unity.data', 'rb')
df = DataFile()
df.load(f)
EXTRACTION_DIR = 'extracted'
for blob in df.blobs:
print('extracting # {}:\t{} ({})'.format(blob['offset'], blob['name'], blob['size']))
dest = os.path.join(EXTRACTION_DIR, blob['name'])
os.makedirs(os.path.dirname(dest), exist_ok=True)
with open(dest, 'wb') as f:
f.write(blob['data'])
The extracted data folder contains one or more .unity3d files which can be further unpacked using AssetStudio, however the tool looked a bit buggy/unstable to me, not sure how reliable it is.
From what I've discovered this contains much of the scene helper entities, but not the models. The models are downloaded separately in gltf format(#2). One can just download the file and import it using Blender.
So it seems that the gltf models are located in http://127.0.0.1:8001/content/contents/ and the files are renamed. I was unable to retrieve the metadata regarding the exact contents of http://127.0.0.1:8001/content/contents yet, so I'll keep digging.
Access
Have a look if the models appear as requests in the Network tab. If so you can right click and 'Copy as curl' to download them in the command line by adding > model.glb. This way you apply the same headers and parameters as the client.
Legality
There seems to be an important distinction between content provided by them vs content provided by users. Relevant sections from their Terms, legalese edited for clarity:
1. Acceptance of Terms
The Decentraland Foundation holds the rights over the DCL Client, the Desktop Client, the SDK 5.0, the Marketplace, the Builder, the Command Line Interface, DAO, and the Developers’ Hub which are referred to herein as the "Tools".
12. Proprietary Rights
12.1 All rights of the Tools are owned by the Foundation. Except as authorized in Section 13, you agree not to copy, modify, distribute, perform, display or create derivations based on the Tools. The visual interfaces, graphics including all art and drawings associated with and the the code and data of the Tools, excluding the Content submitted by Users, are owned by the Foundation. ... You agree that any "purchase" of LAND does not give you rights to the art and drawings associated with the Tools and content therein other than those expressly contained in these Terms. And that you do not have the right to reproduce the Foundation Materials without the Foundation’s written consent.
13. Open Source License.
13.1 Grant of Copyright License.
Each Contributor grants to you a copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
13.3 Redistribution.
You may reproduce and distribute copies or derivations in any medium, with or without modifications, and in Source or Object form, provided that you meet the following conditions:
modifications shall not infringe the Privacy and Content Policies, nor allow their infringement or of Section 12.3 and require any further Contributor to abide by these limitations;
any modifications can only take place until six (6) months have elapsed since the release to the general public;
you must give any other recipients a copy of this License;
you must cause any modified files to carry prominent notices stating that you changed the files;
you must retain in any derivations all copyright, patent, trademark, and attribution notices from the Source
if the Work includes a "NOTICE" text file, then any derivation must include a copy of the attribution notices in it. ...
You should reach out to them or their community directly on Discord Twitter Reddit Telegram or GitHub and add results here.

The PDFViewer is not showing the content while downloading is possible

I am trying to use a PDFViewer in a SAPUI5 application, something like the following sample app.
When I try to use this component in Google chrome it will not load the data, however it is possible to download the PDF itself and it shows the url works and file is available.
If I open it in Firefox or IE it works!
I discussed the problem here with SAP OpenUI5 team. Finally we understood the problem is not the UI5 library and the problem is inside of our ABAP implementation that provides download link for the PDF file from SAP Document Management System (SAP DMS).
We finally found the solution and discovered why the pdf that we try to show from our SAP DMS is downloadable while it is not shown in the pdf viewer inside the modern browsers like Chrome or Firefox.
The source for the solution can find here.
The below two changes are different from normal implementation that can be found in most of the tutorials in the internet:
The header value must be changed to Inline;filename= instead of outline;filename.
Call the method /IWBEP/IF_MGW_CONV_SRV_RUNTIME=>Set_header to set the header.
Finally we have the following ABAP code in SAP systems for downloading files form document management system (SAP DMS).
"Logic for Download the files from Document Managmenet System
DATA: ls_lheader TYPE ihttpnvp,
ls_stream TYPE ty_s_media_resource,
ls_entity TYPE zgw_odata_document_file.
CONSTANTS: lc_headername TYPE string VALUE 'Content-Disposition',
lc_headervalue1 TYPE string VALUE 'inline; filename="',
lc_headervalue2 TYPE string VALUE '";'.
* "Get the name of the Entity
DATA(lv_entity_name) = io_tech_request_context->get_entity_type_name( ).
CASE lv_entity_name.
WHEN 'DocumentFile'.
DATA(lo_document_file) = NEW zcl_gw_odata_document_file( ).
lo_document_file->read_stream(
EXPORTING
it_key_tab = it_key_tab
IMPORTING
es_stream = ls_entity ).
ls_lheader-name = lc_headername.
ls_entity-file_name = escape( val = ls_entity-file_name format = cl_abap_format=>e_url ).
ls_lheader-value = lc_headervalue1 && ls_entity-file_name && lc_headervalue2 .
set_header( is_header = ls_lheader ).
ls_stream-mime_type = ls_entity-mimetype.
ls_stream-value = ls_entity-binfile.
copy_data_to_ref( EXPORTING is_data = ls_stream
CHANGING cr_data = er_stream ).
WHEN OTHERS.
ENDCASE.

Accessing Raw Gamer Profile Picture

I am using the new XBox Live API for C# (https://github.com/Microsoft/xbox-live-api-csharp) for official access through a UWP app.
I am able to authenticate fine and reference the XBox Live user in context.
SignInResult result = await user.SignInAsync();
XboxLiveUser user = new XboxLiveUser();
Success! However, I can't seem to find an appropriate API call to return XboxUserProfile or XboxSocialProfile. Both of these classes contain URLs to the player's raw gamer pics. After reviewing MSDN documentation and the GH library it isn't clear to me how this is achieved. Any help is greatly appreciated.
The below sample should work if you meet the following pre requisits:
Reference the Shared Project that contains the API from your project and don't reference the "Microsoft.Xbox.Services.UWP.CSharp" project
Copy all source code files from the "Microsoft.Xbox.Services.UWP.CSharp" project into your project
Include the Newtonsoft.Json NuGet package into your project
Steps 1 & 2 are important as this allows you to access the "internal" constructors which otherwise would be protected from you.
Code to retrieve the profile data:
XboxLiveUser user = new XboxLiveUser();
await user.SignInSilentlyAsync();
if (user.IsSignedIn)
{
XboxLiveContext context = new XboxLiveContext(user);
PeopleHubService peoplehub = new PeopleHubService(context.Settings, context.AppConfig);
XboxSocialUser socialuser = await peoplehub.GetProfileInfo(user, SocialManagerExtraDetailLevel.None);
// Do whatever you want to do with the data in socialuser
}
You may still run into an issue like I did. When building the project you may face the following error:
Error CS0103 The name 'UserPicker' does not exist in the current
context ...\System\UserImpl.cs 142 Active
If you get that error make sure you target Win 10.0 Build 14393.

How do I view and collect real time GTFS from a feed

I have experience using the static GTFS files which define the operating model for a specific public transport network. However my city has just release a real time feed for the bus locations and other status updates for the network.
My question is, how should I view this feed in real time and record the feed into a database. The link to the real time feed is as follows: https://gtfsrt.api.translink.com.au/
The GTFS-realtime spec now includes code samples for parsing GTFS-realtime data in a variety of languages:
https://developers.google.com/transit/gtfs-realtime/code-samples
It's a good place to start when it comes to parsing GTFS-realtime data in your favorite language.
I needed to install google's protocol buffer, then compile the gifts-realtime.proto with the protocol buffer to generate code which can then read the API source.
Install Nugget Package Google.Protobuf
PM> Install-Package Google.Protobuf -Version 3.4.1
private FeedMessage _feedMessage;
using (MemoryStream protobufMemoryStream = new MemoryStream())
using (Stream protobufStream = await _httpClient.GetStreamAsync("", "http://gtfs.ovapi.nl/new/vehiclePositions.pb"))
{
protobufStream.CopyTo(protobufMemoryStream);
protobufMemoryStream.Position = 0;
_feedMessage = Serializer.Deserialize<FeedMessage>(protobufMemoryStream);
}
In _feedMessage you have deserialize GTFS RealTime Model to persist data into database.