Doesn't XTK support query parameters (especially with periods) in file names? - xtk

I'm using edge XTK by directly including http://get.goXTK.com/xtk_edge.js in my html.
Following code snippet shows how I'm referring to files on my server in XTK.
var skull = new X.mesh();
skull.file = 'http://myserver.com/stls/skull.stl?accessingUserId=dave#ibm.com&accessCode=8999';
As you can see, my file uri's have query parameters, which have periods in them. In such cases, XTK fails with error message:
com&accessCode=8999 file format is not supported.
It looks like XTK forgot to consider that file uri's can have query params with periods.
If it is a bug, would you please consider fixing it before release 8.
If I'm doing something wrong, can you please point me in the right direction.
Thank you.

Haha, you're right.. it doesn't work but you could use the following:
var skull = new X.mesh();
skull.file = 'http://myserver.com/stls/skull.stl?accessingUserId=dave#ibm.com&accessCode=8999&skull.stl';
basically just append another '&.stl' to the query.
we just split the url using the last dot to get the extension.. any proposition for a better solution is welcome.

Related

Google Data Studio - Custom Field REGEXP_EXTRACT

I am trying to use the REGEXP_EXTRACT custom field to pull a portion of my URL using the page dimension in Google Data Studio and cannot figure it out. The page url structure is similar to this -
website.forum.com/webforms/great_practiceinfo_part2.aspx?function=greatcoverage
I'd like to only extract the middle section "great_practiceinfo_part2". I've tried many different formulas, but nothing seems to work. Does the page dimension work in this scenario? Any help would be much appreciated.
Thanks
It seemed to work fine in Google Sheets when I =REGEXEXTRACT(A3,B3) using your string, website.forum.com/webforms/great_practiceinfo_part2.aspx?function=greatcoverage for A3 and the regex \/([^\/]*?)\.aspx\? for B3. I'm guessing you just need to learn more about how to make your regex pattern making string.

content empty when using scrapy

Thanks for everyone in advance.
I encountered a problem when using Scrapy on Python 2.7.
The webpage I tried to crawl is a discussion board for Chinese stock market.
When I tried to get the first number "42177" just under the banner of this page (the number you see on that webpage may not be the number you see in the picture shown here, because it represents the number of times this article has been read and is updated realtime...), I always get an empty content. I am aware that this might be the dynamic content issue, but yet don't have a clue how to crawl it properly.
The code I used is:
item["read"] = info.xpath("div[#id='zwmbti']/div[#id='zwmbtilr']/span[#class='tc1']/text()").extract()
I think the xpath is set correctly and I have checked the return value of this response and it indeed told me that there is nothing under this directory. Results shown here:'read': [u'<div id="zwmbtilr"></div>']
If it has something, there should be something between <div id="zwmbtilr"> and </div>.
Really appreciated if you guys share any thoughts on this!
I just opened your link in Firefox with NoScript enabled. There nothing inside the <div #id='zwmbtilr'></div>. If I enable the javascripts, I can see the content you want. So, as you already new, it is a dynamic content issue.
Your first option is try to identify the request generated by javascript. If you can do that, you can send the same request from scrapy. If you can't do it, the next option is usually to use some package with javascript/browser emulation or someting like that. Something like ScrapyJS or Scrapy + Selenium.

GetFullUrl doesn't return the complete url - sitecore

I am trying to get a fully qualified url, here is the code
string path = string.Format("/sitecore/shell/Applications/Content%20Manager/default.aspx?id={0}&la={1}&fo={0}", contentItem.ID, contentItem.Language);
string fullPath = Sitecore.Web.WebUtil.GetFullUrl(path);
text = text.Replace("$itemUrl$", fullPath);
This returns something like this http://cp.localsite/sitecore/shell/Applications/Content%20Manager/default.aspx?id={DC6B4AE0-929D-4F19-97F4-825796A30781}&la=en&fo={DC6B4AE0-929D-4F19-97F4-825796A30781}
This is generated like a link till ?id= from the id it looks like a normal text. How can i resolve this.I want clickable url for the content. I really appreciate any help.
Thanks.
could you please give a bit more context around what you are trying to achieve. The described behavior is correct, but it is obviously not what you were hoping to achieve.
UPDATED:
Looks like you are on the right track, the only thing i noticed is that you could really get away with just using the fo querystring to get to the right item, you could also use the other ones mentioned here Custom email notification with link - sitecore to get more specific.
For the reason the url being cut off at the id= is that the text parser probably does not like the curly brakets - try encoding the URL and see if that works.
text = HttpUtility.UrlEncode(text);

What is the intended purpose of CSV files in POSTman?

I've seen no clear documentation on using CSV. What is the intended purpose - to read in variables?
For example, i'd like to run this many times with different vars. Does CSV files let me do this? The problem is that i cant see what my actual requests are in the collection window - i can only see the request with the var name, right?
localhost/api/{{var}}
Yes, you can do this with the CSV. If your csv was
var,name
1,name
2,name2
In collection runner if you iterate twice with localhost/api/{{var}}, the urls would be the following
localhost/api/1
localhost/api/2
Let me know if I haven't explained this well and I can add a little more detail a bit later.

Not visualizing ASCII STL file correctly

My problem seems similar to Not able to visualize a loaded data , but I have no console errors and I have already added the '-allow-file-access-from-files' flag to my Chrome Browser. Here's my Java coding,
window.onload = function() {
var r = new X.renderer3D();
r.init();
pros = new X.mesh();
pros.file = 'file:///C:/Users/Nathan/Downloads/JB Farmer STL ACII.stl';
pros.caption = 'Prosthetic';
r.add(pros);
r.render();
};
Should I "play around" with with camera position, I know I have to do that in Three.js.
Maybe the model needs normals? I'm not sure if it does or not. I haven't worked with 3D modeling, besides Three.js.
Update: Ummmm, I'm not sure what is going on with this, but I realized that XTK generated 2 canvases . I looked at the first two Lessons and they have one.
^ Now eliminated the extra canvas, must have copied a piece and that was in there.
For the moment, the loader of xtk doesn't seem to be done for local. I mean : it uses an XMLHttpRequest (XHR) to get the file with a GET request. First of all the request must be sent to something that can handle it (a server or localhost emilated by Wamp or equivalent). Then let's imagine if one broswer, no matter what one, allows XHR on a file at client side by his url, and imagine I'm a pirate and you come on my website. I know Windows well, I know in C:/Windows/System32 there always is a file where I can find your personals data. What do I do ? An XHR ! You've been hacked. It's a story but you see the idea.
That's why the only ways allowed by browsers to access local files are HTML5 File API & HTML5 Drag&Drop API (unfortunately...). Actualy a way to go through that limitation is having binary code at the client side (flash, java applet). The client is the only one who can ask to open a file or drop a file, so the browser is sure there won't be any security failure because of him.
So you should test it with something like Wamp and access your file with an url like "http://localhost/.../myfile.stl" or the relative url "/.../myfile.stl", or do the following if you realy want local files.
A few weeks ago I wrote my own parser for a private format for xtk and from local file, it worked well, I just used HTML5 APIs to read the file and get a String or BinaryArray from it and then wrote a parser that transformed it in a X.mesh. So I think the best would be to extend the X.loader for HTML5 file APIs, or like me to manualy load the file.
The following jsFiddle from Haehn helps : here !
What happens if you modify the filename with no space?
JB Farmer_STL_ACII.stl instead of JB Farmer STL ACII.stl