No results for query of Soundcloud API under iOS - iphone

When using the SC.get() function of the Soundcloud API instead of a result I receive a "HTTP Error: 0". The same codes is working under Android and in the browser (with same origin policy disabled).
This is the part of the code:
SC.initialize({client_id : "[myclientID]" ,redirect_uri:"[myURI]"});
SC.get('/resolve', {url : '[myURL]'}, function(track, error) {
if (error) alert('Error: ' + error.message);
trackImg[l] = track.artwork_url;
trackID[l] = track.id;
...
});
The URLs are white-listed as external hosts within the projects .plist and the Cordova.plist (the project is still running under phonegap 1.7.0). There is no warning in the Xcode console about blocked URLs..
Strangely enough the app was working fine a couple of weeks ago. The only thing I found changed was that the callback.html for the redirect URI got deleted but I created a new one.

Related

PWA not working correctly offline. Uncaught (in promise) TypeError: Failed to fetch

I am trying to convert a simple webpage I have into a PWA in case the site it uses goes down.
I think I have done the majority of the work. The page is installable on my phone and passes all the Chrome lighthouse tests. But I get the following warning,
Web app manifest meets the installability requirements
Warnings: Page does not work offline. The page will not be regarded as installable after Chrome 93, stable release August 2021.
I also get the following warning and error in console,
The FetchEvent for "https://dannyj1984.github.io/index.html" resulted in a network error response: the promise was rejected.
Promise.then (async)
(anonymous) # serviceWorker.js:30
serviceWorker.js:1 Uncaught (in promise) TypeError: Failed to fetch
There is then a warning saying the site cannot be installed as does not work offline. I have read the chrome dev article which says from the chrome release in Aug21 apps that dont work offline wont be installable. But I am stuck on which part of my fetch is causing an issue. The code in my service worker is,
const TGAbxApp = "TG-ABX-App-v1"
const assets = [
//paths to files to add
]
self.addEventListener("install", installEvent => {
installEvent.waitUntil(
caches.open(TGAbxApp).then(cache => {
cache.addAll(assets)
})
)
})
self.addEventListener('fetch', function(event) {
event.respondWith(
caches.match(event.request)
.then(function(response) {
// Cache hit - return response
if (response) {
return response;
}
return fetch(event.request);
}
)
);
});
The above code for the fetch part of the service worker I took from Google and as I understand it, it first checks if there is data in the cache stored on install, if not it will request it from the network.
https://developer.chrome.com/blog/improved-pwa-offline-detection/
From Chrome 89 March 2021, it gives a warning if this check does not pass:
The installed service worker fetch event returns an HTTP 200 status code (indicating a successful fetch) in simulated offline mode.
So, in your case, the service worker should return a cached 'index.html' when fetch(event.request) is failed.
I've had the same problem. I re enabled the cache through the developer console->network. fixed

host more than one app under one website entry in IIS

i have created sample rest service which just return xml
its work fine in my development environment
[RouteAttributes(UriTemplate = "{appname}/adfsapi/mex")]
public class SAMLMexRouteHandler : IRouteHandler
{
}
where app name will be change, and my url
http://localhost:64219/test/adfsapi/mex
till here everything fine
but when i hosting app to IIS
than trying to call my rest service url
http://localhost:8089/testapp1/adfsapi/mex
its throwing 404 not found error .
any suggestion which step i am doing wrong.
Thanks
i solved the issue by converting to application for every directory .
and my URI will be like this -
[RouteAttributes(UriTemplate = "adfsapi/mex")]
public class SAMLMexRouteHandler : IRouteHandler
{
}

gcloud deploy function error code 3

I'm doing the tutorial of basic fulfillment and conversation setup of api.ai tutorial to make a bot for facebook messenger, and when I try to deploy the function with the command:
gcloud beta functions deploy testBot --stage-bucket testbot-e9bc4.appspot.com --trigger-http
(where 'testBot' is the name of the project and 'testbot-e9bc4.appspot.com' is the bucket_name, I thought..)
It return the following error message:
ERROR: (gcloud.beta.functions.deploy) OperationError: code=3, message=Source code size exceeds the limit
I've searched but not found any answer, I don't know where is the error.
this is the JS file that appear in the tutorial:
/
HTTP Cloud Function.
#param {Object} req Cloud Function request context.
#param {Object} res Cloud Function response context.
*/
exports.helloHttp = function helloHttp (req, res) {
response = "This is a sample response from your webhook!" //Default response from the webhook to show it's working
res.setHeader('Content-Type', 'application/json'); //Requires application/json MIME type
res.send(JSON.stringify({ "speech": response, "displayText": response
//"speech" is the spoken version of the response, "displayText" is the visual version
}));
};
Make sure you are in the correct directory where your go code resides before executing gcloud beta functions deploy testBot --stage-bucket testbot-e9bc4.appspot.com --trigger-http command.
I was working in the express project. In my case, I mistakenly installed the #google/storage package in devDependencies instead of dependencies. I unable to notice as I tested the project in debug mode using mocha. So in debug, it is able to find that package in devDependencies but on deploy function, it tries to find in dependencies in package.json but unable to find there.
Open command prompt at the location where index.js was created and run the above gcloud command.

LOAD Runner Internal server 500 issue (REST API)

I am trying to run REST API from Load Runner but unable to do it. Every times its throws below exception
Action.c(4): Error -26612: HTTP Status-Code=500 (Internal Server Error) for "http://ipaddress/LoyaltyApi/api1/loyaltycard/linkcard", Snapshot Info [MSH 1 1] [MsgId: MERR-26612]
My code :
Action()
{
lr_think_time(10);
web_custom_request("LinkCards",
"URL=http://ipaddress/LoyaltyApi/api1/loyaltycard/linkcard",
"Method=POST",
"Resource=0",
"EncType=application/json",
"Mode=HTTP",
"BodyFilePath=linkcards.json",
LAST);
return 0;
}
I have tested the same URL with POST parameter in POSTMAN and it's working fine without any issue.
I am very new in this technology so unable to solved the issue. Please help.
I am very new in this technology....
Assuming your management has moved you to this role, have they provided you with training on the tool and a mentor for a period of time. If not they have set you up for failure.

Eclipse base HTML5 Websocket and GlassFish

Env for project: -
Eclipse 3.6 (Eclipse-jee-helios) + HTML5 + JavaScript + Websocket + (grizzly) Glassfish 3.1.1
I have deployed sample project and able to run using GF.
When i try to connect websocket it always call onClose.
I tried: -
asadmin set configs.config.server-config.network-config.protocols.protocol.http-listener-1.http.websockets-support-enabled=true
GF 3.1.1 supports web socket (Downloaded from http://glassfish.java.net/downloads/3.1.1-final.html)
Browser like safari and Google Chrome supports websocket (i am using latest browser and checked with http://websocket.org/echo.html URL)
Java Script:-
var webSocket;
$(document).ready(
function() {
**var URL = "ws://localhost:8080/SampleGF/WebSocketChatServlet";**
//Tried using and lot of combination of URLS
var URL = "ws://localhost:8080/";
var URL = "ws://localhost:8080/SampleGF";
var URL = "ws://localhost:8080/SampleGF/WebSocketChatServlet";
webSocket = new WebSocket(URL);
//alert("WebSockets are " + (window.WebSocket ? "" : "not ") + "supported");
webSocket.onopen = function(event) {
alert("OPEN")
}
webSocket.onmessage = function(event) {
var $textarea = $('#messages');
$textarea.val($textarea.val() + event.data + "\n");
$textarea.animate({
scrollTop : $textarea.height()
}, 1000);
}
webSocket.onclose = function(event) {
alert("CLOSE")
}
});
function sendMessage() {
var message = $('#username').val() + ":" + $('#message').val();
webSocket.send(message);
$('#message').val('');
}
i have used ChatSocket.java, WebSocketChatServlet.java, ChatApplication.java as it is from below link: -
http://java.dzone.com/articles/creating-websocket-chat
i have added servlet-api.jar in my project library.
Ref. Link: - http://tech.amikelive.com/node-269/eclipse-quick-tip-resolving-error-the-import-javaxservlet-cannot-be-resolved/
Web.xml: -
I have added servlet and servlet-mapping as below:
servlet
description WebSocketChatServlet description
servlet-name WebSocketChatServlet servlet-name
servlet-class org.trivadis.websocket.servlet.WebSocketChatServlet servlet-class
servlet
servlet-mapping
servlet-name WebSocketChatServlet servlet-name
url-pattern /WebSocketChatServlet url-pattern
servlet-mapping
I am not sure what i am doing wrong....
How can i check URL i am using is correct or not for websocket.
GF location is D:\glassfish3\glassfish for my project.
Project location D:\workspace\SampleGF
Another reason: -
Even I tried WAR sample from below link: -
http://jarvana.com/jarvana/search?search_type=project&project=grizzly-websockets-chat
WAR File Name: -grizzly-websockets-chat-1.9.45.war
I have imported above war file in Eclipse and deployed it on glassfish 3.1.1 server. After running it application always call onclose event.
I have executed below command: -
asadmin set configs.config.server-config.network-config.protocols.protocol.http-listener-1.http.websockets-support-enabled=true
and I am using browser like safari and Google Chrome supports websocket (i have tested it with below link http://websocket.org/echo.html URL)
Can anyone help me out…..
It's been months since I tried to run published sample-code against grizzly. I may be out of date, but it didn't work when I tried it. The guy who published the sample eventually admitted problems in the discussion posts below his article. Since I haven't tried it since, I don't know whether it's been fixed yet; i.e. I don't have confirmation that grizzly works yet. (If someone knows of a working sample, I'm as interested as you are.)
In the mean time, you can try this alternative for running your client code. You can even check what you're doing against the free downloadable JavaScript code if you wish.
http://highlevellogic.blogspot.com/2011/09/websocket-server-demonstration_26.html
If you get your code to work against this server, then try again with grizzly. I'll be interested in the results.