I have been experiencing an issue recently with a Google Script code I wrote to update a few Chromebooks' organization units.
Here is a portion of the code that I am running:
let admin = AdminDirectory.Chromeosdevices.get("my_customer", active_deviceid[serial_index])
admin.annotatedAssetId = device_ID.toString()
admin.annotatedLocation = name
admin.orgUnitPath = _location_(device_ID).toString().toUpperCase()
AdminDirectory.Chromeosdevices.update(admin, 'my_customer', active_deviceid[serial_index])
Once the script executes I get the following error:
GoogleJsonResponseException: API call to directory.chromeosdevices.update failed with error: Invalid Input: Inconsistent Orgunit id and path in request - 11006550017573025, /1 SCHOOLS/COVID LOANERS
What is strange is that if I comment or remove "admin.orgUnitPath = location(device_ID).toString().toUpperCase()" the script will run fine. It seems the orgUnitPath is causing this error.
I tried the following:
Removing the first slash "/"
Do only 1 Chromebook
Remove and reapply the AdminDirectory
Run previous scripts that were used to change the OrgUnitPath
Added quotes on the beginning and end of the OrgUnitPath
Converted the path to String with toString()
used Stript() function to eliminate any empty spaces
All the above attempts failed to fix this issue. I will also include an image of an error I am getting from a previous script I made that used to work about a year ago that also changes the OrgUnitPath.
Does anyone know how to fix this issue?
Thanks in advance.
For some reason there has been a change that now requires the orgUnitId in addition to the orgUnitPath.
So before you run AdminDirectory.Chromeosdevices.update you need to obtain the orgUnitId and update that property
var orgUnitPathStr = "/Tech Dept/Storage"
admin.orgUnitId = AdminDirectory.Orgunits.get("my_customer",orgUnitPathStr.substring(1)).orgUnitId;
//substring(1) above removes the first slash in the orgUnitPath, which is required for this method
Credit for hints:
https://github.com/taers232c/GAMADV-XTD3/issues/225
Related
<script type="module" id="user-code">
try {
someUnknownReference;
} catch (error) {
console.log(error) // correct
console.log(error.toString()); // incorrect
console.log(error.stack.toString().split('\n')); // incorrect - line number and filename is wrong
}
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LmpzIl0sIm5hbWVzIjpbImxrc2xrcyJdLCJtYXBwaW5ncyI6IkFBQUFBLE1BQU0iLCJmaWxlIjoiYnVuZGxlLmpzIiwic291cmNlc0NvbnRlbnQiOlsibGtzbGtzIl19
</script>
I'm building a browser based code editor using Babel. All is working well, however I can't for the life of me extract the line number and file name out of the errors that happen during run time.
The example above is a simplified version of what I'm doing. I'm injecting a string into a script tag e.g scriptTag.innerHTML = bundledCode;
The first console.log prints exactly what I want to parse e.g it has the file name and correct line number which it gets from the sourcemap
ReferenceError: someUnknownReference is not defined
at index.js:1
However, as soon as I try to do anything with the error e.g the second console.log, I lose the line number and file name.
ReferenceError: someUnknownReference is not defined
My guess is maybe it's losing the reference to the sourcemap when we try to parse the object?
Thanks in advance for any help!
I think Chrome console is automatically consuming source maps to provide the correct error msg if you're console logging the error. Not if you're grabbing the actual string. Do you need something like this: https://www.npmjs.com/package/sourcemapped-stacktrace?
I am new to machine learning and I was following this blog on how to write a model with mobilenet.
I managed to convert the .h5 file model and tried to implement it
on my web app.
Unfortunately, when I try to load the JSON model I get this error:
Uncaught (in promise) Error: Provided weight data has no target
variable: block1_conv1_2/kernel.
Screenshot of the error on a browser
I converted the .h5 model in the command line like so:
tensorflowjs_converter --input_format keras model.h5 ConvertedModel/
The code to load the model in the browser, I followed this blog
let model;
async function loadModel(name) {
$(".progress-bar").show();
model = undefined;
model = await tf.loadModel(`ConvertedModel/model.json`);
$(".progress-bar").hide();
}
To see the code of the model please refer to the blog link.
But below is a screenshot of how the model is compiled.
Model compilation
Dependencies:
Tensorflow 1.13.1
Python 3.6.0
tensorflowjs 1.0.1
Any help to fix this would be appreciated. Thank you so much.
It seems you've encountered this error where an extra suffix has been added to some of your weights.
You can work around this issue by manually removing these extra suffixes from your model.json:
block1_conv1_2/kernel
should instead be:
block1_conv1/kernel
The 'Error in clip' bug has now been fixed so I'm not too sure why you've received this one, but once again you can work around this by manually editing the model.json, and changing every instance of:
{"type":"ndarray", "value":6}
to
6
I am trying to use the beanshell script posted here to get the path of the jmx that is being run in my jmeter test - Access to JMeter script path
It is working and if I log the output of the path when set by beanshell or view the variables with the debugger I get the path to the script displayed as I expected -
c:\my\path\to\script
but when I then try to pass that variable into sendKeys, the slashes "\" are being removed so -
c:mypathtoscript
And this doesn't work so I am unable to attach/upload my file..
Sure I am missing something stupid
Thanks
Needed to user vars.put to put the JMeter UDV value into a Javascript variable, then use javascript concatenate to link it all together.
There are at least 2 ways to get this done without using Beanshell:
Call FileServer methods from WebDriver Sampler:
someElement.sendKeys(org.apache.jmeter.services.FileServer.getFileServer().getBaseDir())
Get the value from JMeterVariables
var vars = org.apache.jmeter.threads.JMeterContextService.getContext().getVariables()
someElement.sendKeys(vars.get('homepath'))
Example full code:
WDS.sampleResult.sampleStart()
WDS.browser.get('http://ya.ru')
var searchInput = WDS.browser.findElement(org.openqa.selenium.By.id('text'))
//directly access function from JavaScript
searchInput.sendKeys(org.apache.jmeter.services.FileServer.getFileServer().getBaseDir())
//alternative way - getting the value from JMeter Variables
var vars = org.apache.jmeter.threads.JMeterContextService.getContext().getVariables()
searchInput.sendKeys(vars.get('homepath'))
WDS.sampleResult.sampleEnd()
Comprehensive information on accessing JMeter API classes from WebDriver Sampler and few more tips and tricks: The WebDriver Sampler: Your Top 10 Questions Answered
I have a Django web app which has various instances of ck-editor instances on a web page.By using on blur event I am saving whole of data of the instance in the database -
{% for editor in editors %}
CKEDITOR.appendTo("{{editor.ck_id}}" ,
{
on: {
blur: function(event){
var data = event.editor.getData();
console.log("data of {{editor.ck_id}} is " + data);
var request = $.ajax({
url: "/editor/save/",
type: "GET",
data: {
content : data,
content_id : "{{editor.ck_id}}"
},
dataType: "html"
});
}
}
}
// "{{editor.data}}"
);
CKEDITOR.instances['{{editor.ck_id}}'].insertHtml("{{editor.data}}");
Here ck_id and data are the two database fields of ckeditors.Now suppose I write this on one instance of ckeditor -
Tony Stark
When I lose focus on that instance then on blur event is fired and I use 'getData()' to get the html data of that instance.
<p>Tony Stark</p>
is saved into the database.On the python interpreter now when I fetch editor's data it shows -
<p>Tony Stark</p>
which is obvious.
Now When I re start the server and set the data of every ck-editor instance again then this exception is raised -
Uncaught SyntaxError: Unexpected token ILLEGAL
I know why this is happening - due to this -
CKEDITOR.instances['ck_1'].insertHtml("<p>Tony Stark</p>
");
The data which I sent by fetching from database was -
<p>Tony Stark</p>
and it somehow got converted to above mentioned text with illegal tokens.I have tried to use setData() but with no result. Do I need to encode/decode this HTML or something?
Now my question is how to again reset data to a ck-editor instance which I fetched from it and stored in database. I have posted this question on several forums but many people have got no clue of what I am asking?
Is there anyone here who has tried to do same thing and have succeeded in it?
Thanks
PS: Adrian Ghiuta solution seems to be working but there is just problem. When the editor is loaded first time then in google chrome's debugger inserted line is seen as -
"<p>Tony Stark</p>"
which is rendered due to line "{{editor.data|safe}}".But when I change my editor's content to just
Tony
then in database
<p>Tony</p>
is being saved but when I restart the server it does not render and throws this error
Unexpected ILLEGAL TOKEN
due to this -
"<p>Tony</p>
"
Here ending double quotes are in the next line.But during initial data loading it was on the same line.Might this be causing be any problem?
Because my chrome console shows error at that position.
I will add some images to show the condition.
Initial loading -
Initial console -
Editor after editing -
Error being shown after restarting server and reloading editors -
Console -
You can see how error is thrown at line where double quotes are at the next line.Do I to escape html or something?
Sorry for my naivety but I do not have much command over HTML.
I searched around, and couldn't find an answer to my question. I'm very new at coding, and at work, we have an application that current names that are logged in, and what they are doing.
Recently, they have changed from jquery 1.4.1 to jquery 1.8.3. Ever since then, I cannot get the results to process correctly, because of the following error;
"Unable to get value of the property 'split': Object is null or undefined"
I have the code setup to grab the results and split them;
function processAgents(xData, status) {
var avail = xData.responseText.split("|")[0];
var acw = xData.responseText.split("|")[1];
var total = xData.responseText.split("|")[2];
var breaks = xData.responseText.split("|")[3];
var pending = xData.responseText.split("|")[4];
The application is setup to open as an HTA file which opens up the PHP script.
Any help would be appreciated, please let me know if I left anything out!
Thanks!
EDIT 1
I did some more investigating, and it looks like I'm not getting data from my process request. This is how it is currently setup
function updateAgents() {
var ts1 = new Date().getTime();
$.ajax({
url: "http://SERVER/AgentSrc.php?x=" + ts1,
complete: processAgents
I'm not sure if this is processing correctly since they went to jquery 1.8.3.
EDIT 2
So after looking into it more, it doesn't appear that the script is getting the data from the server, even though I have access. If I make a local file and put the information in it, it will pull the information and split it, but if I point to the path of the file on the server, it won't get the information. But the strange thing is, if I run it using jquery 1.4.1, it pulls the data fine, but can't display it. But with 1.8.3, it doesn't allow me to pull it from the server.
thanks again!
This will give some clarity
xData.responseText.toString().split("|")[0];
(split is part of string not jQuery)
Here is a possible explanation: in earlier versions of jQuery, ajax calls returned an xmlHttpRequest (XHR) object. Recent versions return a promise (jqXHR) instead.
See this page for more details.