I'm having trouble with socket.io not working on internet explorer 8 and 9.
Give this error:
'this.websocket' is null or not an object
socket.io.min.js line 2
I've set the WEB_SOCKET_SWF_LOCATION this way. It is part of Jquery $(document).ready
var WEB_SOCKET_SWF_LOCATION = 'http://photosandhomes.ca/static/WebSocketMain.swf';
var page_loadSock = io.connect('/page_load');
Thank you.
PS. Here's a live example
http://photosandhomes.ca/33harbour/
The problem was that I had "var WEB_SOCKET_SWF_LOCATION" in the code.
If you're having the same problem use "WEB_SOCKET_SWF_LOCATION" without the var in the global namespace.
I personally placed WEB_SOCKET_SWF_LOCATION into the socket.io.js file.
Related
Question edited:
I wrote a page with jquery-bootgrid data API.
Its should be calling with AJAX to my NancyFX REST API, but it isn't.
Client side:
I'm serving the bootgrid from a local repo:
<script src="~/scripts/jquery.bootgrid.min.js"></script>
Maybe I shouldn't be using the .min.js file but rather the open one for debugging? If so, could you walk me through what to do, or point me in the direction?
The page code is
...
data-toggle="bootgrid" data-ajax="true"
data-url="/cars/0" data-method="GET"
Server side:
I have the html page served by NancyFx and is seen ok, except for the grid which is empty. There's an API module with a breakpoint in Visual Studio (running on localhost), with the following:
Get["/cars/{status:int}?current={current}&rowCount={rowCount}"] = parameters => ...
This code is never called. How can I force the debugger to catch ANY call before the routing is checked, and show me what's coming into the server?
I'm using the chrome debugger.
The current URL is not valid by Nancy standards. We don't add query string params to the route.
You would want to write something along the lines of:
Get["/cars/{status:int}"] = parameters =>
{
var status = (int)parameters.status;
var current = (string)parameters.current.TryParse("");
var rowCount = (int)parameters.current.TryParse(10);
...
}
Along those lines. (written off the top of my head)
An alternative approach is to bind the request like so:
Get["/cars/{status:int}"] = parameters =>
{
var request = this.Bind<MyRequest>();
...
}
public class MyRequest
{
public MyRequest()
{
RowCount = 10;
}
public int Status {get;set;}
public string Current {get;set;}
public int RowCount {get;set;}
}
Changing the nancy to Get["/cars/{status:int}"] = parameters => did the trick of catching the request.
The ajax wasn't being called because I lost the JQuery first line...
$(document).ready(function() {
To get the current and rowCount you need to use
var current = (int)Request.Form["current"];
var rowCount = (int)Request.Form["rowCount];
By the way, the Get wasn't working (I think its a Bootgrid bug) so I changed it to POST.
The simplest way to debug any jQuery library is by using the in-built debugger, it's kinda difficult for me to use chrome for that , so I use Firefox but if you are habitual of chrome then use it, the functionality is almost the same, but with Firefox you can directly switch to the events associated with any element in the html (in the inspect section)
Once you get into the debugger, set the breakpoint and refresh the page either by F5 or Ctrl+F5 if you selected the valid breakpoint you can see all the values associated with every variable also with every function.
Secondly, use the step-in option in the debugger to see where the exact line is pointing, if it's refering to any other file it will pop open automatically in the debugger menu. Firefox's spider monkey is much good at debugging and relating codes (that's totally my opinion).
3- for the api calls, the reason for data not being processed or not displayed, very much lies within the structure of the library,(on what parameters the data is called/fetched/retrieved), for this try to use the "watch expressions" option in debugger and try implementing the code on loaded dom in console section with trigger on the node which you think is bugged or which should display the value.
I am actually trying to develop a Firefox extension using the high level apis, and specifically trying to avoid a panel to autohide when you pick a file or when you click outside of the panel itself.
Does somebody has an idea of how to do this?
I know that it is possible using XUL, so why is this not easy using the apis?
Thank you in advance for your answers.
This is the offical sdk method of doing it:
let myPanel = Panel({.....})
let { getActiveView }=require("sdk/view/core");
getActiveView(myPanel).setAttribute("noautohide", true);
Idea from
this
var toolbarbuttonPanel = doc.createElement('panel');
toolbarbuttonPanel.setAttribute('id', 'toolbarbutton-panel');
toolbarbuttonPanel.setAttribute('type', 'arrow');
toolbarbuttonPanel.setAttribute('noautohide', 'true'); // This is important
var toolbarbuttonLabel = doc.createElement('label');
toolbarbuttonLabel.setAttribute('value', 'toolbarbutton panel');
toolbarbuttonPanel.appendChild(toolbarbuttonLabel);
var mainPopupSet = document.querySelector('#mainPopupSet');
mainPopupSet.appendChild(toolbarbuttonPanel);
Then add this on sdk action/toggle button click:
toolbarbuttonPanel.openPopup(btn);
And Noitidart's comment
I'm using a Magento 1.4.1.1 install that I'm having issues with the javascript on a custom themed store.
For example, going to any product page (e.g. http://www.papakuraeducation.co.nz/index.php/teachers/magic-caterpillar-handwriting-casey-caterpillar-small-book.html) loads a Javascript file, which contains code which is supposed to scale down the .jpg file to fit the 'product-image' container it sits inside.
The relevent code seems to be around line #10279, which is causing a exception that $(imageEl).parentNode = null
Product.Zoom.prototype = {
initialize: function(imageEl, trackEl, handleEl, zoomInEl, zoomOutEl, hintEl){
this.containerEl = $(imageEl).parentNode;
this.imageEl = $(imageEl);
this.handleEl = $(handleEl);
this.trackEl = $(trackEl);
this.hintEl = $(hintEl);
(snipped...)
I've tried debugging it in Chrome and adding breakpoints, but tbh I'm not actually sure how to use this information to find the solution.
Any help in pointing me in the right direction would be greatly appreciated.
You have to add an ID to the <IMG> in question. This ID should than be fed into the following code-space:
product_zoom = new Product.Zoom('IMAGE_ID', 'track', 'handle', 'zoom_in', 'zoom_out', 'track_hint');
I am developing an application using Phonegap for Windows Phone 8.
I've used jQuery Mobile for interface design.
the $.mobile.changePage() is not working. The page is not being changed.
Is there any other way to change the page? Is there any other framework to design the interface for mobile?
$("#btnSearch").bind('click', function() {
showSpinner();
$.mobile.changePage("#pageSearch");
});
I think this problem is the same as in WP7 described here.
CHECK FOR PATH PROBLEM:
if($.mobile.path.getLocation("x-wmapp1:/app/www/index.html") != "x-wmapp1:/app/www/index.html")
{
console.log('there is path problem');
}
else
{
console.log('everything is OK with paths');
}
SOLUTION:
As described in github, problem is path on WP7 differs from other platforms. Basically on WP7 getLocation prints relative paths with double slashes, which causes this issue at first place. To fix, open jquery.mobile-1.3.1.js and refactor following:
- var uri = url ? this.parseUrl( url ) : location,
- hash = this.parseUrl( url || location.href ).hash;
+ var uri = this.parseUrl( url || location.href ),
+ hash = uri.hash;
and:
- return uri.protocol + "//" + uri.host + uri.pathname + uri.search + hash;
+ return uri.protocol + uri.doubleSlash + uri.host + uri.pathname + uri.search + hash;
After making this changes, check should display "everything is OK".
PS This is tested on WP7 and totally fixed my issue with $.mobile.changePage().
PS2 This issue is fixed at github version of jQuery, although I've just checked latest stable version(1.3.2) and unfortunately it is NOT fixed there.
Regards,
Hristo Todorov
I did have the paths problem mentioned in the answer above, but this didn't solve my problem. I discovered after a lot of trial and error that it was the protocol on the begining of the URL that was causing the problem.
A change page for "mypage.html" will send an Ajax request for
x-wmapp0://www/mypage.html
It needs to be just
www/mypage.html
I made a modifcation to the jQuery Mobile source to manipulate the string to cut off the protocol and now it works perfectly.
To apply the fix, in the un-minified jQuery Mobile js file, search for "$.ajax" and add the following just before it:
var parts = fileUrl.split("www/");
fileUrl = "www/" + parts[parts.length-1];
This actually removes "x-wmapp0://www/" and puts the "www/" back on again. Removing just "x-wmapp0://" does not always work because of the way jQuery Mobile works with urls, resulting in "www/www/..." in some cases.
This is confirmed to work with Cordova 3.1 and 3.3 with jQuery Mobile 1.3.2
I think the method was renamed to "pagechange"
http://jquerymobile.com/blog/2011/09/08/jquery-mobile-beta-3-released/#upgrade
Hey all, I've been trying to find the code that allowed me to capture an entire web page using the webbrowser1 control and i believe also a picturebox or 2.. but i am not able to find the code that i used a couple months ago! I've been goodgling until I'm all googled out!
If anyone knows of the code for VB6 then please post a link to it!.
Thanks,
David
Do you mean the HTML source? If so you can add a reference to the Microsoft HTML obj Library and;
Dim doc As MSHTML.HTMLDocument
set doc = YourWebBrowserCtrl.Document
msgbox doc.documentElement.outerHTML
However this will not return the exact source as at this point its been parsed by IE. (It also won't include doc type or anything else preceding the opening <html> tag.
If you do want the source, add an internet transfer control and just call .openURL to get the full content.
Dim DrawSize As New Size(1024, 768)
Using MyBrowser As New WebBrowser
MyBrowser.ScrollBarsEnabled = False
MyBrowser.Size = DrawSize
MyBrowser.Navigate("http://www.stackoverflow.com")
While MyBrowser.ReadyState <> WebBrowserReadyState.Complete
Application.DoEvents()
End While
Using myBitmap As New Bitmap(DrawSize.Width, DrawSize.Height)
MyBrowser.DrawToBitmap(myBitmap, New Rectangle(New Point(0, 0), DrawSize))
myBitmap.Save("C:\test.jpeg")
End Using
End Using