Inconsitent decoding of image URL via 'URL.createObjectURL()' - blob

I have a WinJS app where the user can choose via a dropdown menu, to view one of several images.
During the dropdown's onchange event, I'm using:
URL.createObjectURL(file, { oneTimeOnly: true })
To generate a URL which I set as a html <img> element's src property.
Whilst this works 'some' of of the time, the behaviour is very inconsistent a high proportion of the time, I get the error:
DOM7009: Unable to decode image at URL: 'blob:7743DB87-59F8-4750-B3A2-3505518CA7CB'.
Obviously the blob URL varies.
This doesn't seem related to the actual image, as during testing I'm only using 3 images (all of which will load at times) but all three of them won't load at other times.
Am I using the wrong approach here? or could something else be the problem? any thoughts greatly appreciated.

Related

XHR request pulls a lot of HTML content, how can I scrape it/crawl it?

So, I'm trying to scrape a website with infinite scrolling.
I'm following this tutorial on scraping infinite scrolling web pages: https://blog.scrapinghub.com/2016/06/22/scrapy-tips-from-the-pros-june-2016
But the example given looks pretty easy, it's an orderly JSON object with the data you want.
I want to scrape this https://www.bahiablancapropiedades.com/buscar#/terrenos/venta/bahia-blanca/todos-los-barrios/rango-min=50.000,rango-max=350.000
The XHR response for each page is weird, looks like corrupted html code
This is how the Network tab looks
I'm not sure how to navigate the items inside "view". I want the spider to enter each item and crawl some information for every one.
In the past I've succesfully done this with normal pagination and rules guided by xpaths.
https://www.bahiablancapropiedades.com/buscar/resultados/0
This is XHR url.
While scrolling the page it will appear the 8 records per request.
So do one thing get all records XPath. these records divide by 8. it will appear the count of XHR requests.
do below process. your issue will solve. I get the same issue as me. I applied below logic. it will resolve.
pagination_count = xpath of presented number
value = int(pagination_count) / 8
for pagination_value in value:
url = https://www.bahiablancapropiedades.com/buscar/resultados/+[pagination_value]
pass this url to your scrapy funciton.
It is not corrupted HTML, it is escaped to prevent it from breaking the JSON. Some websites will return simple JSON data and others, like this one, will return the actual HTML to be added.
To get the elements you need to get the HTML out of the JSON response and create your own parsel Selector (this is the same as when you use response.css(...)).
You can try the following in scrapy shell to get all the links in one of the "next" pages:
scrapy shell https://www.bahiablancapropiedades.com/buscar/resultados/3
import json
import parsel
json_data = json.loads(response.text)
sel = parsel.Selector(json_data['view']) # view contains the HTML
sel.css('a::attr(href)').getall()

How to add a custom image (<xh:img>) to PDF

We would like to add an image to our PDF in Orbeon. We explorered different tags and came up with tag. This worked the way we wanted but this tag keeps the PDF from building. We don't get any (visible) errors but a time-out occurs after couple of seconds.
To cross check: PDF build fine without the xh:img tag.
I was wondering what other options do we have. I thought about a PDF template but we would like to give the form author the option to choose his/hers own jpg from a web resource.
This is on 43PE.
User error yet we didn't change much after all.

dgrid's OnDemandGrid keeps sending requests to the server

I have an OnDemandGrid setup to display product data (called parts) for a project i am working on. I currently have only two entries in the product database.
My OnDemandGrid is setup with only the basic options: store, and columns. I am hoping it will be a virtual scrolling grid. the store was setup as a JsonRest store, with Cache
what happens when i open up the page and startup the grid is, the grid keeps sending requests to the server for data continuously - approximately 2 requests per second.
I also realize that for a grid with only two rows, it has a scrollbar on the right. when i try to use this scrollbar to scroll, I find that the grid seems to flicker and reset itself. many times.
I suspect the virtual scroll feature is doing something funky, somehow not acknowledging that there are only two entries. can some one help me out in this? am willing to provide more details should that be necessary.
Here is my code by the way:
require(["dgrid/OnDemandGrid", "dojo/store/Memory", "dojo/store/Cache"], function(OnDemandGrid, Memory, Cache){
var partsCache = new Memory();
App.Store.parts = new Cache(partsMaster, partsCache);
var grid = new OnDemandGrid({
store: App.Store.parts,
columns: {
name:'Part Name',
part_no:'Part Number'
},
}, "grid");
grid.startup();
})
partsMaster is a JsonRest store defined earlier (global at the moment - taking the grid for a spin) in the code. I've done some tests to safely determine that JsonRest is not the issue.
here is a screenshot of the grid currently (note the existence of the scrollbar):
Any help is appreciated!
EDIT: attached is a screen shot of the first request response header from chrome:
Based on the screenshot it looks like your response is not including the Content-Range header, which is what dojo/store/JsonRest uses to inform itself of the total number of results in the set. While I'm not sure that alone will cause your infinite-querying problem, it will definitely cause a problem.
The Content-Range header should look like e.g. Content-Range: items 0-24/500 (assuming 500 was the total number of items in the result set).
See http://dojotoolkit.org/reference-guide/1.9/quickstart/rest.html for more information on how JsonRest expects services to behave.
If this doesn't completely solve the problem, I'd also be curious to verify that the response body is indeed yielding the correct subset of results.
Edit: based on interaction I had on a dgrid issue today, the issue could be that your service is actually returning the incorrect number of results based on the query. See these comments on #691.

Modifying photosphere on website thing

What i am trying to do is to use a photosphere on my website so that it shows up on full screen as a website cover page. The problem is the the code to embed a photosphere in a webpage given here by google
https://developers.google.com/photo-sphere/web/
lets only the photosphere size to be hardcoded as
displaysize="600,400"
what ever the values but its still hardcoded. What i want is that it gets adjusted to the screen of the user and gets displayed in the whole browser window. Any one got an idea how to pull it off? I didn't find any stuff about 'photosphere on web' other than the google link i gave above.
Indeed the API is currently designed to take static values. I think it's a good point that users might want to set the dimensions to 100% and let it resize dynamically.
I put it on the TODO list and will try to get to it shortly.
In the meantime, one work around is the following: After the viewer loads you will find an iframe on the page which contains it. You can change it's dimensions dynamically to your liking and the viewer should adapt.
The API provided by Google wraps the whole photosphere in layers of iFrames.
You can use the API to request a certain photosphere but only use the response to parse it for the values you need. Then you create your own request and the result can be shown fullscreen.
An example link is this
I created this link dynamically from the JSON response from the elements
media$group media$content 0 url
Hope it helps.
Can't you take the raw image and just use webgl to project it on the inside of a sphere?

Any way to predefine an image for flattr-things?

Is there any possibility to manually define an image for flattered things?
Or are there plans by the devs to implement this?
Specify the image using Open Graph metadata in the page that is submitted, like you do for eg. Facebook: http://ogp.me/
If you're using WordPress or such there's likely a plugin that you could use.
I just checked the API and there seems to be no way of defining the image upfront. Not with an auto-submit URL and not with the create-thing request.
Only thing I could find is once you created a thing, you can edit it using this URL:
https://flattr.com/thing/edit/<thing-id>
The form has a text field that is labeled Change image by providing an url. (will take some time to update). Enter a URL to an image.
I tried it and it took about 30 secs to update.