when I put the "input length" function and call it on the browser it responds to show that it's working but as soon as I attempt running the full code it gives me an error
Related
I have a Laravel application with Vue js and until a while ago it was working perfectly. Now when I go to any page that uses Vue js this error appears: [Vue warn]: Error in render: "SyntaxError: Unexpected token u in JSON at position 0".
When I reload the page by clearing the cache (Control + Shift + R on Mac OS) it works again, but when I update without this command the error appears again.
PS: I didn't do any package updates for both laravel and npm, it just stopped working out of nowhere.
Try this in the console:
JSON.parse(undefined)
Here is what you will get:
Uncaught SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse (<anonymous>)
at <anonymous>:1:6
In other words, your app is attempting to parse undefined, which is not valid JSON.
There are two common causes for this. The first is that you may be referencing a non-existent property (or even a non-existent variable if not in strict mode).
window.foobar = '{"some":"data"}';
JSON.parse(window.foobarn) // oops, misspelled!
The second common cause is failure to receive the JSON in the first place, which could be caused by client side scripts that ignore errors and send a request when they shouldn't.
Make sure both your server-side and client-side scripts are running in strict mode and lint them using ESLint. This will give you pretty good confidence that there are no typos.
Sometime it is becaseu of this let data = JSON.parse(this.response); so try to change it to
let data = JSON.parse(this.responseText);
I really did was change this.response to this.responseText
I have a shiny app that runs a monte carlo simulation with 500 replications. To do this, I use a for loop and call a function from another package to run the simulation, and then I save the data. The shiny app then produces the results using renderTable.
It is possible that the user could mistakenly enter something that would cause one or more of the replications to fail to converge, triggering a stop in the function I'm calling. If this happens, there is nothing to render in a table. In R, I get a nice error message from the package telling me that the model failed to converge. However, in Shiny, the app just force closes.
I'm currently using tryCatch and showNotification to display this notification in the app (see below):
observeEvent(input$go,
tryCatch({
simulation_results()
},
error = function(err){
showNotification(paste0(err), type = 'err')
})
)
It works well, but the problem is that it causes the app to take 6x longer to run (it goes from ~1.5 min to ~10 min). I think this is because it's trying to catch and show the notification from every individual replication in the for loop. The app also still does close; it just displays the error first (which I do appreciate).
Is there a [faster] way to get shiny to print error messages from the console instead of closing the app?
I was thinking of validate, but I don't know how it would work - what I really need is something like
validate(need("no error message in the console")). I tried using validate(need(simulation_results(),geterrmessage()) to see if it would simply print the last error message if there were no simulation results, but the app shuts down once it gets to the stop error in the function.
Also, I'm using flexdashboard if that changes anything.
So, originally I was trying to use the chrome tabs api on my new tab extension, (which has the tabs permission) in order to move the current tab one space backward (to the left), When I tried entering chrome.tabs.move(with all my data in here), it said no matching signature
I have tried playing around with console logging and rereading the api page
Here is the API Page: https://developer.chrome.com/extensions/tabs#method-move
chrome.tabs.getCurrent(
function(currentTab){
chrome.tabs.move(currentTab.id, currentTab.index-1);
}
);
I expected it to run and the current tab to moved but I got this message:
index.html:1 Error handling response: TypeError: Error in invocation of tabs.move([integer|array] tabIds, object moveProperties, optional function callback): No matching signature.
at :3:23
You are calling the chrome.tabs.move() function incorrectly.
As documented on the page you linked, the second argument must be an object containing index and (optionally) windowId properties, e.g.
chrome.tabs.move(currentTab.id, { 'index': currentTab.index - 1 })
I successfully completed the "Let's make a map" tutorial and now want to make a world map. However, all examples I tried (a couple from mbostock) only display background graphics in chrome and firefox. I get the following error in firebug:
SyntaxError: JSON.parse: unexpected character
return JSON.parse(request.responseText);
in d3.v3.js but I assume it starts with the following code in the index.htm:
queue()
.defer(d3.json, "world-110m.json")
.defer(d3.tsv, "world-country-names.tsv")
.await(ready);
The call d3.json of "world-110m.json" seems to produce the error. I have found nothing about this error on the internet -- I'd appreciate some help.
I've got a search results form in my Access client which uses the trick of being a form opened in acDialog mode. If the user cancels the search the form closes itself, if the user selects one of the search items, the form writes the result into an unbound field and then makes itself not visible.
The calling code will suspend (because of the acDialog mode) until either of the two events described in the previous paragraph happen. The calling code checks to see if the form is still loaded - when it knows a search item has been requested, so it retrieves the item from the form and then closes it. If the form was already not loaded, we assume the cancel route was chosen.
the search results datasource is a select statement "SELECT * FROM details ORDER BY ..."
This trick has worked for a while in the code where "details" is a linked table to another Access database
I am porting to SQL Server, and the details table is now dynamically linked at startup to the correct SQL Server instance. Using the following connection string
ODBC;driver=SQL Server;SERVER=ROO\SQLEXPRESS;DATABASE=Test_DB;UID=my_app;PWD=xxxx;
(Passwords etc changed to protect the innocent)
When Access exits the application (AND ONLY THEN) - if the path through the code has resulted in using the visible = false trick then it exits with an error message. There is no error message if there is an application exit where the path has been through the search form but the form closed itself before returning.
The error message is:
Cannot access database because of Error [Microsoft][ODBC Driver Manager] Data source
name not found and no default driver specified
and will now Exit.
I need to find out precisely why this is happening and stop it.
I solved the problem with a work around. I created a global variable for the form result and then always closed the search result form itself. The underlying routine that was trying to pick up the result just uses the global variable.
This proved that making a Dialog box invisible to retrieve results is not reliable - the problem disappeared as soon as I changed it.