the code success but why have error messege? - error-messaging

const drumBox = document.querySelectorAll(".drumBox");
const numDrum = () => {
for (let i = 0; 1 < 5; i++) {
drumBox[i].addEventListener("click", () => {
alert("i've got click");
});
}
};
numDrum();
i just want to know, Why does an error message appear in the console?, the code accually run without error.

Related

Office Outlook 365 Addin SSO API Permission

Is there some one who can really help here?
I can't get anything from sso.getGraphData in the office addin generated from Yeoman generator.
Here is my code in ssoauthhelper.js:
export async function getGraphData() {
try {
let bootstrapToken = await OfficeRuntime.auth.getAccessToken({ allowSignInPrompt: true });
let exchangeResponse = await sso.getGraphToken(bootstrapToken);
if (exchangeResponse.claims) {
// Microsoft Graph requires an additional form of authentication. Have the Office host
// get a new token using the Claims string, which tells AAD to prompt the user for all
// required forms of authentication.
let mfaBootstrapToken = await OfficeRuntime.auth.getAccessToken({ authChallenge: exchangeResponse.claims });
exchangeResponse = sso.getGraphToken(mfaBootstrapToken);
}
if (exchangeResponse.error) {
// AAD errors are returned to the client with HTTP code 200, so they do not trigger
// the catch block below.
documentHelper.writeDataToOfficeDocument("response");
handleAADErrors(exchangeResponse);
} else {
/*const response = await sso.makeGraphApiCall(exchangeResponse.access_token);
documentHelper.writeDataToOfficeDocument(response);*/
const _EndPoint = "/me/messages";
const _UrlParams = "?$select=receivedDateTime,subject,isRead&$orderby=receivedDateTime&$top=10";
const response = await sso.getGraphData(exchangeResponse.access_token, _EndPoint, _UrlParams);
documentHelper.writeDataToOfficeDocument(response);
sso.showMessage("Your data has been added to the document.");
}
} catch (exception) {
if (exception.code) {
if (sso.handleClientSideErrors(exception)) {
fallbackAuthHelper.dialogFallback();
}
} else {
sso.showMessage("EXCEPTION: " + JSON.stringify(exception));
}
}
}
the code in documentHelper.js:
function writeDataToExcel(result) {
/*return Excel.run(function (context) {
const sheet = context.workbook.worksheets.getActiveWorksheet();
let data = [];
let userProfileInfo = filterUserProfileInfo(result);
for (let i = 0; i < userProfileInfo.length; i++) {
if (userProfileInfo[i] !== null) {
let innerArray = [];
innerArray.push(userProfileInfo[i]);
data.push(innerArray);
}
}
const rangeAddress = `B5:B${5 + (data.length - 1)}`;
const range = sheet.getRange(rangeAddress);
range.values = data;
range.format.autofitColumns();
return context.sync();
});*/
return Excel.run(function (context) {
const sheet = context.workbook.worksheets.getActiveWorksheet();
const rangeHeadings = sheet.getRange("A1:D1");
rangeHeadings.valueTypes = [["ReceivedDateTime", "subject", "Read?", "ID"]];
const _Contents = result.value;
for (let i = 0; i < _Contents.length; i++) {
if (_Contents !== null) {
let _TempArr = [];
_TempArr.push(_Contents[i].receivedDateTime);
_TempArr.push(_Contents[i].subject);
_TempArr.push(_Contents[i].isRead);
_TempArr.push(_Contents[i].id);
let _Data = [];
_Data.push(_TempArr);
const _rangeaddress = `A${2 + i}:D${2 + i}`;
const _rangedata = sheet.getRange(_rangeaddress);
_rangedata.values = _Data;
}
}
rangeHeadings.format.autofitColumns();
return context.sync();
});
}
When i run the add-in, it does not proceed after GET/ auth? as shown in below image.
Here are my permission in the Azure APP Registration:
I can't understand what is really happening. When i click on the button in the sideloaded task pane, nothing is sent from the Graph API as shown in the command prompt image. I am really grateful, if someone could point out where the error is.
I have defined the scopes in my manifiest file as well.
Please help.

How to get gif frames using Node GraphicsMagick/ImageMagick

How to get gif frames using node gm?
Example on PHP
$frames = new \Imagick( 'image.gif' )->coalesceImages();
https://github.com/aheckmann/gm
https://github.com/aheckmann/gm/issues/512
gm("./image.gif").identify(function (err, val) {
let frames_count = val.Scene.replace(/\d* of /, "");
for(let i = 0; i < frames_count; i++) {
let path = `./frame${i}.png`;
this.selectFrame(i).write(path, function () {
console.log(arguments[3]);
});
}
});

Angular 2 and the function $interval

How I can rewrite in Angular2 and Dart this code in angular1:
$interval(function () {
if($scope.carouselIndex < $scope.showcases.length -1){
$scope.carouselIndex = $scope.carouselIndex + 1;
} else {
$scope.carouselIndex = 0;
}
}, properties.delay);
I've tried in this way but didn't work:
carouselIndex = 0;
for(int i=0; i<contents.size(); i++){
if(carouselIndex < contents.length -1){
setTimeout(function() {
carouselIndex = carouselIndex + 1;
}, 1000);
} else {
carouselIndex = 0;
}
}
Any idea?
Thanks
You could try the Observable.interval method:
Observable.interval(properties.delay).subscribe(() => {
if (this.carouselIndex < this.showcases.length - 1) {
this.carouselIndex = this.carouselIndex + 1;
} else {
this.carouselIndex = 0;
}
});
An event will be triggered each time the delay is reached. So the callback defined when subscribing will be called accordingly.
In your case, you tried to mix a synchronous loop with asynchronous processing with the setTimeout function.
You can use the Timer class for this:
Timer _timer;
someFunc() {
_timer = new Timer.periodic(const Duration(milliseconds: 1000 /*properties.delay*/),
(_) {
if (this.carouselIndex < this.showcases.length - 1) {
this.carouselIndex = this.carouselIndex + 1;
} else {
this.carouselIndex = 0;
}
});
// to stop the periodic execution use
// _timer.cancel();
}

get id3 tags ActionScript

I need to get the id3 tags of tracks that are located on the user's computer.
var song_sound:Sound;
function ID3Tag(path:String)
{
song_sound = new Sound();
var _soundURL:URLRequest = new URLRequest(path);
song_sound.load(_soundURL);
song_sound.addEventListener(Event.ID3, readID3);
}
function readID3(event:Event):void
{
trace(song_sound.id3.artist+" "+song_sound.id3.album);
}
function directorySelected(directory:File):void
{
//var count:int = 0;
if (directory.isDirectory)
{
var files:Array = directory.getDirectoryListing();
for (var i:int = 0; i < files.length; i++)
{
if (files[i].isDirectory)
{
directorySelected( files[i] );
}
else
{
ID3Tag(files[i].nativePath);// DOES NOT WORK
}
}
}
}
After starting I get an error:
Error #2044: Unhandled IOErrorEvent:. text=Error #2032: Stream Error.
at P_1_fla::MainTimeline/ID3Tag()[P_1_fla.MainTimeline::frame1:29]
at P_1_fla::MainTimeline/directorySelected()[P_1_fla.MainTimeline::frame1:54]
at P_1_fla::MainTimeline/directorySelected()[P_1_fla.MainTimeline::frame1:50]
at Function/<anonymous>()[P_1_fla.MainTimeline::frame1:22]
But if you call the function like this:
ID3Tag("D:\\Music\\2013 Killswitch Engage - Disarm The Descent (Special Edition)\\01 The Hell In me.mp3");
then it works.
What's the problem?

1151: A conflict exists with definition i in namespace internal

im new in action scripts and flash, i need some help with this code i couldnt find whats wrong with it, it gives this error:1151: A conflict exists with definition i in namespace internal.(var i:Number = 0;)
stop();
menu_item_group.menu_item._visible = false;
var spacing:Number = 5;
var total:Number = menu_label.length;
var distance_y:Number = menu_item_group.menu_item._height + spacing;
var i:Number = 0;
for( ; i < total; i++ )
{
menu_item_group.menu_item.duplicateMovieClip("menu_item"+i, i);
menu_item_group["menu_item"+i]._x = menu_item._x;
menu_item_group["menu_item"+i]._y = i * distance_y;
menu_item_group["menu_item"+i].over = true;
menu_item_group["menu_item"+i].item_text.text = menu_label[i];
menu_item_group["menu_item"+i].item_url = menu_url[i];
menu_item_group["menu_item"+i].onRollOver = function()
{
this.over = false;
}
menu_item_group["menu_item"+i].onRollOut = menu_item_group["menu_item"+i].onDragOut = function()
{
this.over = true;
}
menu_item_group["menu_item"+i].onRelease = function()
{
getURL(this.item_url);
}
menu_item_group["menu_item"+i].onEnterFrame = function()
{
if( this.over == true ) this.prevFrame();
else this.nextFrame();
}
}
thanks for your help!
Check your code. The variable i has been declared in the code already.

Resources