I have a Revit file and I am trying to extract geometry of it (OBJ file)(master view activated as I need space volumes)
I am calling GetDerivativeManifestAsync method from DerivativesApi class from Autodesk.Forge
await derivative.GetDerivativeManifestAsync(urn, derivativeUrn);
However I am getting System.OutOfMemoryException thrown from forge client.
Reason: Autodesk.Forge.Client.ApiException: Error calling GetDerivativeManifest: Exception of type 'System.OutOfMemoryException' was thrown.
Why does it happen and how can I solve it?
Thank you
It might mean that the OBJ file is too large for your computer to handle. Please use this API of Forge Dotnet SDK to check the file size:
IDictionary<string, string> headers = derivative.GetDerivativeManifestHeaders(urn, derivativeUrn);
long fileSize = Convert.ToInt32(headers["Content-Length"]);
Console.WriteLine ("\t size: " + fileSize); //!<<< in bytes
Related
Code:
contents = encryptedWebhookSecret[0].toString();
console.log(typeof contents);
console.log(contents);
const formattedName = kmsClient.cryptoKeyPath(PROJECT, 'global', KEYRING, KEY);
const kmsDecryptRequest = {
name: formattedName,
ciphertext: contents //encryptedWebhookSecret
};
console.log("Decrypting webhook secret...");
return kmsClient.decrypt(kmsDecryptRequest);
encryptedWebhookSecret is the result of a download() operation using #google-cloud/storage client. this returns a [Buffer], which I cast to a string. I log the encrypted string, it's value is correct. I can download the encrypted secret using gsutil from the command line and gcloud kms decrypt works fine.
This error seems like it is saying the string is not encoded properly (should it not be utf8?).
The values for PROJECT, KEYRING, and KEY have been double and triple checked and are correct.
Error:
ERROR: Error: invalid encoding at Error (native) at Object.decode (/user_code/node_modules/#google-cloud/kms/node_modules/#protobufjs/base64/index.js:105:19) at Type.DecryptRequest$fromObject [as fromObject] (eval at Codegen (/user_code/node_modules/#google-cloud/kms/node_modules/#protobufjs/codegen/index.js:50:33), <anonymous>:12:15) at Type.fromObject (/user_code/node_modules/#google-cloud/kms/node_modules/protobufjs/src/type.js:538:25) at serialize (/user_code/node_modules/#google-cloud/kms/node_modules/grpc/src/protobuf_js_6_common.js:70:23) at Object.final_requester.sendMessage (/user_code/node_modules/#google-cloud/kms/node_modules/grpc/src/client_interceptors.js:802:37) at InterceptingCall._callNext (/user_code/node_modules/#google-cloud/kms/node_modules/grpc/src/client_interceptors.js:418:43) at InterceptingCall.sendMessage (/user_code/node_modules/#google-cloud/kms/node_modules/grpc/src/client_interceptors.js:460:8) at InterceptingCall._callNext (/user_code/node_modules/#google-cloud/kms/node_modules/grpc/src/client_interceptors.js:424:12) at InterceptingCall.sendMessage (/user_code/node_modules/#google-cloud/kms/node_modules/grpc/src/client_interceptors.js:460:8)
EDIT: When I try using a base64 encoding, I get "TypeError: Key must be a buffer at TypeError (native) at new Hmac (crypto.js:93:16) at Object.Hmac (crypto.js:91:12) at isRequestValid (/user_code/index.js:81:8) at decryptWebhookSecret.then (/user_code/index.js:119:21)".
The Node client library requires that plaintexts and ciphertexts be submitted as Buffers. Which is easy enough-- you'll just do ciphertext: Buffer.from(contents) in your sample above.
The issue was that ciphertext needs to be base64 encoded.
I received the following error when downloading from Box server:
InnerException {System.ArgumentException: [net_WebHeaderInvalidControlChars]
Arguments:
Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.7.60408.0&File=System.Net.dll&Key=net_WebHeaderInvalidControlChars
Parameter name: name
at System.Net.Browser.ClientHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult)
at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClasse.<EndGetResponse>b__d(Object sendState)
at System.Net.Browser.AsyncHelper.<>c__DisplayClass1.<BeginOnUI>b__0(Object sendState)} System.Exception {System.ArgumentException}
Shown below is the code snippet.
using (HttpClient client = new HttpClient(handler) { MaxResponseContentBufferSize = Int32.MaxValue })
{
client.DefaultRequestHeaders.Add("Authorization", "Bearer " + accessToken);
try
{
var fileResponse = await client.GetAsync(requestUrl, HttpCompletionOption.ResponseHeadersRead);
if (fileResponse != null && fileResponse.StatusCode == System.Net.HttpStatusCode.OK)
return await fileResponse.Content.ReadAsByteArrayAsync();
else return null;
}
catch(Exception e)
{
System.Diagnostics.Debug.WriteLine("Error in getAsync, " + e.StackTrace);
return null;
}
}
Note that this only happens for files with Korean (non-English) filenames and corrupted files. For image files and non-corrupted files, I was able to download successfully. (Example of corrupted file is a word or ppt file that shows an error msg when opened).
Having the same issue in windows phone 8.
I tried
HttpResponseMessage response = await httpClient.SendAsync(requestMessage);
I tried
WebClient client = new WebClient();
client.OpenReadAsync(new Uri(url,UriKind.RelativeOrAbsolute));
I tried IRestResponse from RestClient
All resulting in exception with empty value and inner exception net_WebHeaderInvalidControlChars.
The problem was that the user agent passed from windows client was not recognized server side. As a result, one from the returned response headers, was making .Net to crash in a lower level and the response could not be processed.
Adding NativeHost as the recognized UserAgent fixed the exception
I try to load the AppxManifest at Runtime to read out the Version of the app. I fond this article:
http://tonychampion.net/blog/index.php/2013/01/examining-the-windows-store-apps-appxmanifest-at-runtime/#comments
I tried the line from the post:
var doc = XDocument.Load("AppxManifest.xml", LoadOptions.None);
But this will throw me the following exception:
{System.Xml.XmlException: An internal error has occurred.
at System.Xml.XmlXapResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn)
at System.Xml.XmlTextReaderImpl.FinishInitUriString()
at System.Xml.XmlTextReaderImpl..ctor(String uriStr, XmlReaderSettings settings, XmlParserContext context, XmlResolver uriResolver)
at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext)
at System.Xml.XmlReader.Create(String inputUri, XmlReaderSettings settings, XmlParserContext inputContext)
at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options)
at MyMedi.Src.Utilities.GetVersion()
at MyMedi.WindowsPhone.Test.Src.UtilitiesTest.Utilities_GetVersionTest()}
Can anyone tell me what I'm doing wrong?
Thanks
NPadrutt
I'm not sure why you'd want to, but you could try loading the document with the ms-appx:// uri schema in the file reference.
There's a much easier way to achieve your goal, though.
Package package = Package.Current;
PackageId packageId = package.Id;
PackageVersion version = packageId.Version;
var versionString = string.Format(
CultureInfo.InvariantCulture,
"{0}.{1}.{2}.{3}",
version.Major,
version.Minor,
version.Build,
version.Revision);
I am in the process of connecting to a custom RESTful API using Retrofit. I have testing communicating with the device/API via Curl and with some test Java code running on a non-Android system (mac os x). The curl and java commands return the expected response.
However, using retrofit, I am unsure if I am using an inadequate configuration in my RestAdapter (i.e. RestAdapter.Builder()) to talk to this device.
The error I am getting appears to be that the entire json contents is not returned and only the first 47 bytes or so. I expect this is a behavior of the device I'm talking to, and am curious if this means I need to implement an Asynchronous callback as described in the Retrofit API docs. Before I do this I wanted to get feedback from some who have more experience with Retrofit.
The error is as follows (sanitized for public consumption):
12-06 08:50:52.962 28267-1735/com.mycompany.project D/Retrofit? [ 12-06 08:50:52.972 28267: 1735 D/Retrofit ]
{"OBJECT1":{"#Version":1,"OBJECTARRAY1":[
12-06 08:50:52.972 28267-1735/com.mycompany.project D/Retrofit? <--- END HTTP (46-byte body)
12-06 08:50:52.982 28267-1735/com.mycompany.project W/System.err retrofit.RetrofitError: retrofit.converter.ConversionException: com.google.gson.JsonSyntaxException: java.io.EOFException: End of input at line 1 column 47
I am setting up the RestAdapter as such:
RestAdapter restAdapter = new RestAdapter.Builder()
.setServer(serverUrl)
.setClient(new OkClient(RestUtils.getHttpClient(3000, 3000, username, password)))
.setRequestInterceptor(new RequestInterceptor() {
#Override
public void intercept(RequestFacade requestFacade) {
requestFacade.addHeader("Accept", "application/json");
requestFacade.addHeader("Client-Id", "12345");
}
})
.setLogLevel(RestAdapter.LogLevel.FULL)
.build();
service = restAdapter.create(OBJECT1.class);
Any insight into this problem would be greatly appreciated. I understand this error is related to the java.io.EOFException, but have been unable to verify the contents I am getting returned from the device, except for the output shown above in the error. I am heavily leaning towards the async vs. sync being the issue, but am open to any recommendations.
Cheers!
CSVLoader loader = new CSVLoader();
loader.setSource(new File("));
Instances data = loader.getDataSet();
When i run above code in java , it's working fine.
But when i do the same thing in c# using the following code, it throws exception in line
weka.core.Instances instsOrg = csvLoader.getDataSet();
The exception message is" The type initializer for 'weka.core.converters.ConverterUtils' threw an exception"
string filename = "myCSVfile.csv"";
weka.core.converters.CSVLoader csvLoader = new weka.core.converters.CSVLoader();
csvLoader.setSource(new java.io.File(filename));
weka.core.Instances instsOrg = csvLoader.getDataSet();
weka.core.converters.ArffSaver saver = new weka.core.converters.ArffSaver();
saver.setInstances(data);
saver.setFile(new File("myCSVfile.arff"));
saver.writeBatch();
I have added weka.dll , IKVM.OpenJDK.Core.dll and IKVM.Runtime as references files.
Can anyone help me to get rid of this exception please???
Please reply as soon as possible :(