How do I visualize a remote, url accessible vtk file in XTK? - xtk

Does anyone have an example of rendering a remote file in XTK (https://github.com/xtk/X)? Is this currently possible?
I tried swapping in a URL for the file location, like so:
// load a .vtk file
var skull = new X.object();
skull.load('https://s3.amazonaws.com/surfaces/skull.vtk');
No luck though... Any ideas?
UPDATE:
AWS now supports CORS on S3! Just took a little patience: http://docs.amazonwebservices.com/AmazonS3/latest/dev/cors.html

In general this should work!
Maybe it is a cross-origin error - it could be a simple fix on the remote server (the one hosting the .vtk file) like described here:
http://en.wikipedia.org/wiki/Cross-origin_resource_sharing

Related

Unable to PUT big file (2gb) to aws s3 bucket (nodejs) | RangeError: data is too long

I scouted trough all of the internet and everybody gives out different advice but none of them helped me.
Im currently trying to simply send file.buffer that gets send to my endpoint directly to aws bucket.
im using PutObjectCommand have correctly entered all the details in but there's apparently problem with me using simple await s3.send(command) because my 2.2gbs video is way too big.
i get this error when attempting to upload said file to cloud.
RangeError: data is too long at Hash.update (node:internal/crypto/hash:113:22) at Hash.update (C:\Users\misop\Desktop\sebi\sebi-auth\node_modules\#aws-sdk\hash-node\dist-cjs\index.js:12:19) at getPayloadHash (C:\Users\misop\Desktop\sebi\sebi-auth\node_modules\#aws-sdk\signature-v4\dist-cjs\getPayloadHash.js:18:18) at SignatureV4.signRequest (C:\Users\misop\Desktop\sebi\sebi-auth\node_modules\#aws-sdk\signature-v4\dist-cjs\SignatureV4.js:96:71) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) { code: 'ERR_OUT_OF_RANGE', '$metadata': { attempts: 1, totalRetryDelay: 0 } }
I browsed quite a lot,there's lots of people saying that i should be using presigned url,i did try however if i do await getSignedUrl(s3,putCommand,{expires:3600}); then i do get generated url but there's not PUT send to cloud. when i read little more into it getSignedUrl is just for generating signed url therefore there's no way for me to use Put command there so im not sure how to approach this situation.
Im currently working with :
"#aws-sdk/client-s3": "^3.238.0",
"#aws-sdk/s3-request-presigner": "^3.238.0",
Honestly i've been testing lots of different ways i saw online but i wasnt successful following even amazon's official documentation where they mention these thing and i trully dont want to implement multipart upload for smaller than 4 ~ 5gbs of videos.
I'll be honored to hear any advice on this topic, thank you.
Get advice on how to implement simple video upload to aws s3 because of my many failed attempts on doing so since there's lots of information and vast majority doesnt work.
The solution to my problem was essentially using multer's s3 "addon" that had s3 property and had pre-done solution.
"multer-s3": "^3.0.1" version worked even with file that have 5gbs and such. solutions such as using PutObject command inside presigned url method or presigned-post methods were unable to work with multer's file.buffer that node server receives after its being submitted.
If you experienced same problem and want quick and easy solution. use this Multer-s3 npm

Serverless Image Handler - How to set subfolder as root

Hi i got the Serverless Image Handler up and running (using this template: https://docs.aws.amazon.com/solutions/latest/serverless-image-handler/deployment.html). Deployment worked fine, all good.
I pointed it to my already existing bucket "MyBucket", and i can do image rescaling and stuff when placing images into that bucket.
However we have all our images in a subfolder to that bucket, called "cloudfront_assets".
So after assigning my CNAME to the new cloudfront distribution, i am stuck with having to reference my images like this:
https://subdomain.mydomain.com/cloudfront_assets/image.jpg
instead of
https://subdomain.mydomain.com/image.jpg
I tried editing the cloudfront disitrbutions origin settings, and set "Origin Path" from /image to things like /cloudfront_assets or /image/cloudfront_assets.
It fixed the path issue, so i didnt have to write the "/cloudfront_assets/" before the image, but regardless of what i set, the image rescaling stopped working.
What is the correct way to do this?
Please help, currently stuck at the moment
Set the log level to debug in the lambda function in order to see whats happening, but it only says its getting "access denied" as far as i can tell
The handler supports a rewrite functionality that allows you to modify the url, that is likely to be the simplest way to achieve it:
https://docs.aws.amazon.com/solutions/latest/serverless-image-handler/appendix-b.html
Basically, you can rewrite all url's to always append /cloudfront_assets/, similar to how the example rewrites to add /fit-in/
Rewriting something like .* should catch pretty much everything. As the code is python based, you should use python regexp syntax.
The underlying code for the function can be found in the github repos: https://github.com/awslabs/serverless-image-handler/blob/master/source/image-handler/lambda_rewrite.py

WireMock returns image that's corrupt

I've recorded a mock through WireMock that contains an image in the body. When I try to get the stub using Postman the response back is an image that won't load and the size of the content is roughly 20-50% larger than when I get the same image from the production server. In Google Chrome it says Resource interpreted as Document but transferred with MIME type image/jpeg.
I can't tell if this is an underlying issue with Jetty or WireMock. I read some related chatter on the user group about images being returned incorrectly, but I've tried the suggestion of removing the mapping stub and just keeping the __file - no luck. This seems like an encoding issue, but I don't know how to debug it further.
If you can hang in there until next week we're putting the finishing touches on a brand new recorder and I've been specifically working through the encoding issues the current recorder suffers from.
Meanwhile, you might want to try turning off gzip in your client code.

Display ".doc" ".docx" in browser

My users can upload their CV and this CV should be seen by any employer.
My problem is that my client want this CV to appear in the web browser without any download.
PDF work fine but doc & docx don't.
I've tried to use both gem ("docx" and "doc_ripper") but each one can just handle basic thing (table won't work ...)
The cv is attached to one user and stored on Amazon with Dragonfly
I've try the google view : http://googlesystem.blogspot.be/2009/09/embeddable-google-document-viewer.html
But as I do : user.cv_file.remote_url(expires: 5.minutes.from_now)
The url doesn't work anymore (this solution only work if the document is public)
I thought to make a second field which have the cv_file convert as a pdf if it's not.
Any possibilities to give a public permission to aws file for 2-3 min (time to render it with google view tool)
Thanks.
I assume you are talking about a file stored on S3. To make a file on S3 temporarily public you can generate a pre-signed URL with an expiration date/time: http://docs.aws.amazon.com/AmazonS3/latest/dev/ShareObjectPreSignedURL.html
I've used the gem htmltoword a few times now and it's done a good job from that end of the translations.
I did a quick search and there are a few promising gems that might help you out here - converting the resumes from Word (.doc, .docx) into an format that you can get to HTML for your views (perhaps storing this converted content in a DB table/column?).
Word docx_converter
Google Groups discussion of the issue
ydocx
docx
Thanks for answering but after many research, I finally found :
https://view.officeapps.live.com/op/view.aspx?src=
which work as well as the pdf reader from browser.
Be sure to have a public url for the file you want to display

Upload Photos using Silverlight - Ria Services

i'm trying to find a good exemple on uploading and downloading images using solely Silverlgith + Ria Services, i tried to find some but i failed, please any help would be appreciated.
thank you all in advance
I just found some useful walk trough here and make sure to read follow-up that improves the save process and used image
We did it by saving the images on disk (not in a DB) - like this:
Upload image:
Write a Domain Service with an operation like void UploadJPGImage(string uniqueName, byte[] jpgBytes). This needs to be marked with the attribute for ClientAccess. The (server-side) implementation saves the image on the disk.
for the uniqueName, we generate a GUID client-side
Download image:
HTTP Handler - write an HTTP handler for downloading the image using a URL containing the unique name parameter passed by the client when uploading the image
Or, one could write a Domain Service operation, like byte[] DownloadJPGImage(string uniqueName)