I've been working with a fairly simple animation, powered by Adobe Edge Animate, on my site for a while now. I didn't change anything to do with it for the longest time, but something's obviously happened, because now when i run the animation, i get
Uncaught TypeError: Object [object Object] has no method 'stringify' edge.2.0.0.min.js
from Chromes Console Log. I have no idea what this means, but it has something to do with the json. I'm not sure if my image is being loaded, but there's no reason it shouldn't be, since i never changed the path of it. Can somebody tell me what "Object [object Object]" is supposed to refer to?
Thanks!
P.S My animation setup is just the stage, with about 17 copies of an .svg that i use as a sprite sheet, plus some text. Every single object has animations that includes opacity, top, left, and height.
EDIT:
Here's what i get when i do a console.log(JSON);
In case you can't read it:
Native.initialize
$replaceChars: function (a){return JSON.$specialChars[a]||"\\u00"+Math.floor(a.charCodeAt()/16).toString(16)+(a.charCodeAt()%16).toString(16);
$specialChars: Object
decode: function (string,secure){if($type(string)!="string"||!string.length){return null;}if(secure&&!(/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(string.replace(/\\./g,"#").replace(/"[^"\\\n\r]*"/g,""))){return null;
encode: function (b){switch($type(b)){case"string":return'"'+b.replace(/[\x00-\x1f\\"]/g,JSON.$replaceChars)+'"';case"array":return"["+String(b.map(JSON.encode).clean())+"]";
__proto__: Object
Update:
I think i may have figured it out. In the preloader, i'm calling the dependent files with the full path, so i don't think they get called. But when i fix the path, i get that really annoying
Uncaught SyntaxError: Unexpected token <
These files get interpreted as text/html, so now those dependent .js files are full of my html.
(I'm using Sinatra, with a layout file).
Here's Chromes message:
Resource interpreted as Script but transferred with MIME type text/html: "http://127.0.0.1/bird_Animations_edgeActions.js".
This is how the preloader calls those files:
{load:"/bird_Animations_edge.js"},{load:"/bird_Animations_edgeActions.js"}.
Now my question is: How do i get these files to be transferred as scripts?
Edit:
Because i confused myself with that, the way Edge Animate works is that it gives you three .js files. One is focused on general stuff, making the object, creating the animations. The second is focused on actions, I.E clicking on an element. The third loads the previous two files, and every other files necessary for the whole page to work, plus some other stuff that i don't know. The third file is then called in the head tag of the page you want the animation to run, with a div in the body of that same page.
After so many edits, and awesome comments, i figured it out.
I was using the wrong path in the preloader, which is why stringify failed, it wasn't finding any object whatsoever.
Then, with the interpreted but transferred as error, it was because in my HKEY_CLASSES_ROOT\.js (regedit) the content type was set to text/html. Setting it to application/javascript fully fixed my problem. Thanks a ton for everyones help!
I had a similar problem. The root of this error can be from a bug in Mootools. Mootools before version 1.3.2 will override JSON object. You have to use a newer version of Mootools to solve the JSON.parse and JSON.stringify problem.
Related
This must be the most frustrating thing about working with Angular.
Why does Angular NOT tell you what HTML page there is a render error in? It just defaults to the route page and tells you nothing.
This time (Luckily) I know there's some random error on SomePage.html, because if I comment out the page, everything works fine, but for those times that I don't know what page the error is in, its TOTAL CHAOS of me commenting out random pages trying to find the needle in my haystack.
Why does this happen and is there a way to get more info out of angular!?
Just look at the nice and Clean Console window, not telling me anything. So useful. So great.
Edit: And I finally found the Error, it was literally just not having a doulbe '=' sign and instead I had 1.
*ngIf="someType = 'user'"
instead of
*ngIf="someType == 'user'"
How Dumb is this?
Okay so I found a way. Should probably have thought about this before.
Just run the debugger and you'll get exactly what the problem is.
I use MvxImageView with a binding to ImageUrls with the following format:
http://mysite/service/service.svc/rest/Image/flag/<picture size>/country/<Country ID>
an example would be:
http://mysite/service/service.svc/rest/Image/flag/48/country/104
http://mysite/service/service.svc/rest/Image/flag/48/country/141
which returns a 48x48 pixel image of the Swiss flag in png format for the first link and a Spanish flag for the second link.
Does MvxImageView or any of its helpers depend on a unique filenames including an file extension?
Or could even the "service.svc" be the problem and be interpreted as the filename?
According to the webserver logs the App doesn't even open the Url. When I tried with another picture from another server it worked perfectly fine.
EDIT:
On further investigation I've found out that the Accept Header of the request isn't accepted by my webservice. Can I add it somewhere?
So my Question transforms to: How can I override the MvxFileDownloadRequest class to add an accept header?
How can I override the MvxFileDownloadRequest class to add an accept header?
The only way to do this is to implement your own IMvxHttpFileDownloader implementation and to register it with IoC in place of the default one.
The source for the default one is https://github.com/MvvmCross/MvvmCross/blob/v3.1/Plugins/Cirrious/DownloadCache/Cirrious.MvvmCross.Plugins.DownloadCache/MvxHttpFileDownloader.cs and this question was similar - MvvmCross HTTP DownloadCache with authentication - if this is a common request, then happy to see this pushed back into MvvmCross core.
I have an SSRS 2008 report with a field that contains and is configured to render as HTML. Some of the text in this field may contain IMG tags, and the IMG tag is not among the tags SSRS natively supports within its HTML rendering extension.
I am trying to find a way to write a custom handler to hook into the processing of this field that will let me look at the raw HTML before the SSRS handler processes it, in the hopes of grabbing IMG tags, extracting the SRC URL and getting the raw bytes of an image to insert on the fly in a way SSRS will accept, yet retaining the HTML SSRS will render.
From what I've read and seen so far, if a field is marked to render as HTML, the SSRS processor grabs it and parses it entirely before any handler could modify it, meaning the IMG tag is (would be) discarded before I could do anything with it (or even know it was present). The only option I see is to turn off the HTML rendering entirely, thus losing the benefit of the tags SSRS can recognize.
EDIT: Per Jamie's response below, I'm beginning to think the "2nd half" of this issue may prove harder than I realized: Is it even possible to programmatically add an Image to an SSRS Report at runtime (obviously through code/custom assembly)? That is, I'd like to write some code that might look something like this (pseudocode)
'Conceptual Pseudocode I'd like to be able to write
'for dynamic addition of Image element in SSRS report
'Is this even possible?? Is there a documented Report
'object model??
Public Function AddImage(imageBytes() as Byte) as Image
Dim newImage as New Image()
newImage.SetBytes(imageBytes)
Report.Add(newImage)
return newImage
End Function
I'm hoping I'm just overlooking something simple that prevents me from grabbing the raw, unprocessed HTML, and someone else might be able to point me in the right direction on how to grab it.
EDIT: I have created and implemented this solution within the SSRS development environment and it works. WOOHOO :) It did require some hoop-jumping with creating a Single-Threaded Apartment thread to host the WebBrowser control, and to create a message pump, but it does work! **
As I was literally typing up the message to a co-worker that this issue was a non-starter, I did have a bit of an inspiration on a way to solve this problem. I know this post hasn't generated a great deal of response, but just in case someone else finds themselves in a similar problem, I'm going to share what I've implemented in a "petri dish" scenario that, provided I get all the code permission issues resolved, should allow me a decent solution to this problem.
With SSRS inability to handle an IMG tag insurmountable, I actually thought of an idea that took the HTML rendering away from SSRS entirely. To do this, I created custom code that hands off the HTML rendering to a WebBrowser control, then copies the rendered result as an image. It does the following:
Instantiates a WebBrowser control of a given width and height.
Sets the DocumentText property of that control to the HTML from TinyMCE
Waits for the DocumentText to completely render.
Creates a bitmap equal to the size of the control.
Uses the undocumented and presumably unsupported DrawToBitmap method of the WebBrowser to draw the rendered HTML to a bitmap.
Copies the Bitmap to an Image
Saves the Image as a .png file
Returns the path to the .png as the result of the function.
In SSRS, I plan to replace the erstwhile HTML text field with an external Image control that will then call the above method and render the image file. I may alter that to simply draw the image to the SSRS Image control directly, but that's a final detail I'll resolve later. I think this basic design is going to work. Its a little kludgey, but I think it will work.
I have some permissions issues to work out with the code that SSRS will allow me to call at runtime, but I'm confident I'll get those sorted out (even if I end up moving the code to a separate assembly). Once this is tested and working, I plan to mark this as the answer.
Thanks to those who offered suggestions.
I've done something similar with success: We had an HTML "Comment" field that was collected on a web form. For a particular report we wanted to truncate this field to the first 1000 characters or so, but preserve valid HTML.
So I created a C# .dll & class with a public function:
public static string TruncateHtml(string html, int characters)
{
...
}
(I used the HtmlAgilityPack for most of the HTML parsing, and to create and close off my new HTML string, while I kept track of the content length.)
Then I could call that code with the fully qualified path to the function in an SSRS expression:
=ReportHtmlHandler.HtmlTruncate.TruncateHtml(Fields!Comment.Value, 1000)
I could have added a calculated field to my dataset with this, but I was only using this value for one field, so I kept it at the field expression level.
All of this code gets called well before the HTML is processed or rendered by SSRS. I'm sure that any original IMG tag will be in the string.
This approach might work for you, possibly create a ExtractImg function which could be set as the source of an img on the report. I think some of the tricky bits for your requirement will be to handle multiple images as well as embedding the extracted img. But you might be able to do this simply with a external reference to an image. I haven't done much with external images in SSRS.
An MSDN blog entry on calling a custom dll from SSRS: http://support.microsoft.com/kb/920769
I declare my GLSL ES shader program within a HTML file, using this code:
<script id="shader-fs" type="x-shader/x-fragment">..shader-code..</script>
as seen in the learning WebGL examples. Everything works fine, but I dont understand why I should use the type attribute of the script tag. I want to know where the "x-shader/x-fragment" value is specified. Who does that.. the W3C, the Khronos Group or the browser developers? Can anybody help me? Tahnk you.
There is no official organization who specified that GLSL code should be put within a <script> tag of type "x-shader/x-fragment".
The only reason the GLSL code is placed within that <script> tag is because the tutorial writer decided his code would be cleaner if he placed the GLSL code within a <script> tag rather than a normal string.
However since WebGL takes in GLSL code as a string value, the author had to write a helper function called getShader(gl, id) to grab the script tag from the page and convert it into a javascript string, before passing it to WebGL.
The reason the author chose a type value of "x-shader/x-fragment" is because "x-shader/x-fragment" is not a known script type by the browser and thus would be safely ignored by the browser.
The idea is that the browser doensn't know the type 'x-shader/x-fragment'. Your code will work fine if you change the type to something else (like 'foo').
In other words there is no standard for how to store shader source code. But you will need it as a string when the shaders are compiled.
We have a web application that creates a web page. In one section of the page, a graph is diplayed. The graph is created by calling graphing program with an "img src=..." tag in the HTML body. The graphing program takes a number of arguments about the height, width, legends, etc., and the data to be graphed. The only way we have found so far to pass the arguments to the graphing program is to use the GET method. This works, but in some cases the size of the query string passed to the grapher is approaching the 2058 (or whatever) character limit for URLs in Internet Explorer. I've included an example of the tag below. If the length is too long, the query string is truncated and either the program bombs or even worse, displays a graph that is not correct (depending on where the truncation occurs).
The POST method with an auto submit does not work for our purposes, because we want the image inserted on the page where the grapher is invoked. We don't want the graph displayed on a separate web page, which is what the POST method does with the URL in the "action=" attribute.
Does anyone know a way around this problem, or do we just have to stick with the GET method and inform users to stay away from Internet Explorer when they're using our application?
Thanks!
One solution is to have the page put data into the session, then have the img generation script pull from that session information. For example page stores $_SESSION['tempdata12345'] and creates an img src="myimage.php?data=tempdata12345". Then myimage.php pulls from the session information.
One solution is to have the web application that generates the entire page to pre-emptively
call the actual graphing program with all the necessary parameters.
Perhaps store the generated image in a /tmp folder.
Then have the web application create the web page and send it to the browser with a "img src=..." tag that, instead of referring to the graphing program, refers to the pre-generated image.