MVC - JSON.stringify not working when publishing app to IIS7 - json

During my debugging phase everything with JSON.stringify(editedRows) was working fine on my local development server. I deployed my app to an IIS7 server and JSON.stringify(editedRows) stopped working when I browsed to the site. When I logged onto the server to launch the app from IIS, JSON.stringify(editedRows) worked. I looked over some posts, but nothing seem to solve this issue. Has anyone run into this issue? Thank you.
$('#SaveJobs').on('click', function () {
var editedRows = getEditedRows(); // get rows from a grid
alert('Before JSON'); // I see this alert
var json = JSON.stringify(editedRows);
alert('After JSON'); // I do not see this alert and my browser keeps waiting
});

well I added a reference to the json2.js script, which I did not have in my library of scripts and it worked. I am still confused on why it was working on my dev machine and when I logged onto the server without this library. I am using IE 10 and my other JS libraries are below. If somebody with more knowledge on this subject know please post it below. Thank you!
"~/Scripts/jquery-{version}.js",
"~/Scripts/jquery-ui-{version}.js",
"~/Scripts/json2.js",
"~/Scripts/jquery.event.drag.js"

Related

Add notification to Windows notification center without displaying it on screen

I am building an Electron app featuring a custom Notification feature where html5 divs appear and disappear as needed on a frameless, transparent, always-on-top window.
It works great, but: I still like the Windows notification center itself, and would like to have the option to see the past notifications there, without actually displaying them on screen with the HTML5 api.
I have tried:
Looking into the HTML5 api for an option to not show a notification, or to .hide() it right away: no luck. The only method that comes close is .close(), and it removes the notification from the center as well.
Looking into packages like node-notifier, but none of the used notification dependencies offer a way to completely hide a notification.
While I mentioned Node, I will also accept any lower-level API/binding that would allow me to do this.
Thanks in advance.
With the help of #treckstar in comments, I have found a way to do what I wanted using:
NodeRT
The ToastNotification.SuppressPopup attribute
Despite a handful of troubles building NodeRT and using electron-rebuild, here's a working PoC:
const { XmlDocument } = require('#nodert-win10-rs4/windows.data.xml.dom');
const {
ToastNotification,
ToastNotificationManager
} = require('#nodert-win10-rs4/windows.ui.notifications');
const localImage = path.join(__dirname, 'icon.png');
const template = `
<toast launch="app-defined-string">
<visual>
<binding template="ToastGeneric">
<image id="1" placement="appLogoOverride" hint-crop="circle" src="${localImage}"/>
</binding>
</visual>
</toast>
`;
const xml = new XmlDocument();
xml.loadXml(template);
const toast = new ToastNotification(xml);
const notifier = ToastNotificationManager.createToastNotifier("com.myapp.testnotif");
toast.suppressPopup = true;
notifier.show(toast);
May this help whoever comes across the same highly-specific problem.
In addition to what #MadWard shows in the PoC, the suppressPopup key is really the main player of the solution.
As I was going through tons of examples and electron code I kept hitting roadblocks due to random SDK versions and libraries of things I had installed. For example, the package electron-windows-notifications, which uses NodeRT was failing to load my preload.js because the Windows 10 SDK I had installed (build 15063) needed nodert-win10-cu instead of what was being used in most solutions by default nodert-wind10-au.
SDK
Known As
Windows Version
npm Scope
Windows 10, Build 17134
April 2018 Update (Redstone 4)
1803
npmjs.com/org/nodert-win10-rs4
Windows 10, Build 16299
Fall Creators Update (Redstone 3)
1709
npmjs.com/org/nodert-win10-rs3
Windows 10, Build 15063
Creators Update (Redstone 2)
1703
npmjs.com/org/nodert-win10-cu
Windows 10, Build 14393
Anniversary Update (Redstone 1)
1607
npmjs.com/org/nodert-win10-au
Windows 10, Build 10586
Threshold 2
1511
npmjs.com/~nodert-win10
EDIT: I forgot to include the more specific steps I took getting electron-windows-notifications dependency files on this GitHub issue here. Basically everything from Python, broken node-gyp, and missing .winmd files.
Lastly Electron 14+ and NodeRT have an issue where you will need to make sure to have app.allowRendererProcessReuse = false and like the readme file says, to make sure this is running in the main.js file.
Hopefully this helps someone along the way, as I had never used Electron before until today and had learned a ton thanks to other peoples help.

Autodesk Forge Configurator Inventor - Azure deployment problem

I have troubles with deploying an app to Azure.
I started with https://github.com/Autodesk-Forge/forge-configurator-inventor repo. I managed to run it locally with no errors. I am able to login, upload my own zipped files, change parameters, export pdf and download it. Everything is fine. Now i want to publish app to azure.
App is currently running so You can check it out: https://pjk-config.azurewebsites.net
WHAT IS WRONG: I cannot upload any models after login. No error is displayed. If I make change in wrench or wheel model and update it, I won't happened either.
What I did:
created azure account,
changed callback url to my app (in my situation: "https://pjk-config.azurewebsites.net/"),
I changed WebApplication.Program.cs by removing the UseKestrel() statement ( please check that)
{
webBuilder.UseStartup<Startup>();
var port = Environment.GetEnvironmentVariable("PORT");
// If deployed to a service like Heroku, need to listen on port defined in the environment, not the default one
if (!string.IsNullOrEmpty(port))
{
webBuilder.UseUrls("http://*:" + port);
Log.Logger.Information($"PORT environment variable defined to:{port}");
}
});
appsettings:
inviteonlymode - false
embedded mode - false
publisher settings: (but I see polling in output so I think something is missing)
"CompletionCheck": "Callback",
"CallbackUrlBase": "https://pjk-config.azurewebsites.net"
I deployed through VS 2019 with WebApplication right click - publish using this reference:
https://learn.microsoft.com/en-us/visualstudio/deployment/quickstart-deploy-to-azure?view=vs-2019
If you need any additional info just let me know. I am fighting with this almost 30 days by my own. I am beginner and this is my first question on this page so I apologize for lack of precise information about my problem. Just tell me what you need and I will send it over.
thank you for your effort and help. I figured out how to deploy to azure and be able to run without bugs. It was about callback. In my situation Callback URL at my apps>Autodesk Forge should be https://myapp.azurewebsites.net (no slash at the end) and in the appsettings.json i went with that:
"Publisher": {
"CompletionCheck": "Polling",
"CallbackUrlBase": "https://myapp.azurewebsites.net/"
Notice the slash at the end.
Probably the next step will be changing CompletionCheck to Callback.
App is running and I can work on inventor part.
Thanks!

Permission issue for appium chrome borwser

I am implementing an appium test on remote android driver, with chrome browser for loading urls.
Some of the Urls are pdfs, and chrome asks to store those files. and appears that chrome doesnt have access to filesystem to store those files, which results in a dialog like below.
Please help me pass that dialog without any manual inputs.
Upon clicking continue, it will load actual permissions dialog from Android.
Here is my code initialize appium capabilities
DesiredCapabilities caps = DesiredCapabilities.android();
caps.setCapability("appiumVersion", "1.9.1");
caps.setCapability("deviceName","Samsung Galaxy S9 Plus HD GoogleAPI Emulator");
caps.setCapability("deviceOrientation", "portrait");
caps.setCapability("browserName", "Chrome");
caps.setCapability("platformVersion", "8.1");
caps.setCapability("platformName","Android");
caps.setCapability("autoAcceptAlerts", true);
caps.setCapability("autoGrantPermissions", true);
caps.setCapability("chromedriverArgs", "--allow-file-access-from-files");
caps.setCapability("maxDuration", 10000);
and this is the snippet I use to load a Url
driver.navigate().to("http://kmmc.in/wp-content/uploads/2014/01/lesson2.pdf");
autoGrantPermission also doesnt work in this case because chrome is already installed. Appium team has already rejected this issue -
https://github.com/appium/appium/issues/10008
Please help!
Indeed I had very hard time finding out the solution, but eventually I found a workaround.
The best workaround would have been reinstalling the chrome package. I tried that, but I could not start chrome after reinstalling it, as I had no access to shell, and chromedriver complained. So I left that track.
I tried getting hold of adb command or mobile:changePermissions but for that you need to use server flag --relaxed-security while starting the server, and saucelabs doesnt provide any handy interface to start the server with this flag.
The last resort, I found a solution here - https://stackoverflow.com/a/51241899/4675277 . But just that was not sufficient, because it helped me fix chrome alert, but later on it popped up with another alert with allow and deny, for which another solution in the same question helped me. So this is the code I eventually used -
driver.navigate().to("http://kmmc.in/wp-content/uploads/2014/01/lesson2.pdf");
String webContext = ((AndroidDriver)driver).getContext();
Set<String> contexts = ((AndroidDriver)driver).getContextHandles();
for (String context: contexts){
if (context.contains("NATIVE_APP")){
((AndroidDriver)driver).context(context);
break;
}
}
driver.findElement(By.id("android:id/button1")).click();
contexts = ((AndroidDriver)driver).getContextHandles();
for (String context: contexts){
if (context.contains("NATIVE_APP")){
((AndroidDriver)driver).context(context);
break;
}
}
driver.findElement(By.id("com.android.packageinstaller:id/permission_allow_button")).click();
((AndroidDriver)driver).context(webContext);
This helps allow all permissions required.

Strange Angular PWA Service worker behaviour when deployed

This issue has taken up all my day, and I can't figure out whats going on
I can see that my service worker is registered , however "sometimes" when I click offline in developer tools the ServiceWorker for my domain just disappears!!
But this is the main problem when I reload the app I see the following behaviour.
You can see the ngsw.json is loaded twice and the main.js is loaded 3 times! main.d3ae2084xxxx && main.bbe5073dxxxx && then main.d3ae2084xxxx again!
If I inspect the response of both ngsw.json requests you can see that both show main.d3ae2084xxxx as the correct version of main.js but it still loads main.bbe5073dxxxx...
First ngsw.json request
Second ngsw.json request
Whats even more frustrating is the actual loaded version is the previous main.bbe5073dxxxx...!!!!
If anyone has any ideas how this can be happening please let me know.
Update... So found out about this excellent little endpoint
https://you-app-url/ngsw/state
This will give you lots of debug information about your service worker.
In my case this
Driver state: EXISTING_CLIENTS_ONLY (Degraded due to failed
initialization: Hash mismatch (cacheBustedFetchFromNetwork):
https://dev-xxxx.net/main.eb8468bb3ed28f02d7c2.js: expected
b5601102b721e0cf777691d327dc965d40d1c96e, got
83c18fdb4a5942c964a31c119a57e0b8e16fe46e (after cache busting)
So looks like this is going to be a CDN issue of some sort in my case, will update with an answer when I know for sure.
You've probably resolved this by now, but I had the same issue which turned out to be due to the CDN (Cloudflare in my instance) was optimising the content.
In Cloudflare the key option is 'Auto minify' that needs to be disabled.

Quintus to Android

I have tried to Google and read the Quintus wiki but no solution. Why does quintus platformer need server to run? Because this I can't use phonegap nor cocoonjs to convert my project to android game. Is there a better HTML5 2d game engine that I can use without server? Or what can I do to get quintus run as android application?
So I finally managed to get the game running with little bit of help, so I am answering here for myself. To get the game running on Android phone you need to quote some code.
Try commenting out this code from your quintus.js file and try again. I was facing a similar issue, commenting out this code resolved it:
if(document.location.origin === "file://" || document.location.origin === "null") {
if(!Q.fileURLAlert) {
Q.fileURLAlert = true;
alert("Quintus Error: Loading assets is not supported from file:// urls - please run from a local web-server and try again");
}
return errorCallback();
Then compile it with CocoonJS Webview+ and install debug.apk to get the game running.