Outlook addin with office.js giving Host error with code 5000 for item.sendAsync()

I’m trying to send an email using the Outlook’s office.js API’s item.sendAsync() method which triggers on custom send button added on taskpane from a task pane add-in. However, I’m getting a Host Error with the following response:

{
  "code": 5000,
  "message": "The operation is not supported.",
  "name": "Host Error"
}

Here is the code snippet I am using

item.sendAsync((result) => {
    if (result.status === Office.AsyncResultStatus.Succeeded) {
        document.getElementById('review-message').innerHTML = 
            '<p class="ms-font-xs" style="color: green;">✅ Email sent successfully via sendAsync!</p>';
        
        // Close task pane after short delay
        setTimeout(() => {
            if (window.close) {
                window.close();
            }
        }, 2000);
    } else {
        console.error('sendAsync failed:', result.error);
        const error = result.error;
    }
});

I am using it on Outlook for Mac (version 16.102)
Also I have added below permission in mainfest.xml

  <Permissions>ReadWriteMailbox</Permissions>

I want to acheive below functionality in my addIn

  1. Display email data on taskpane also having custom send button
  2. send from custom send button available in taskpane (so above code snippet is triggered on button click)

How to trigger an event at a specific time (10 minutes later) without setTimeout, Redis, or cron?

I have an API where the status of a user changes.
After exactly 10 minutes of the status change, I need to send an email to that user.

Constraints:

I cannot use setTimeout or setInterval (not reliable, won’t survive server restarts).

I don’t want to use Redis-based schedulers (like Bull, Agenda, etc.).

I don’t want to use cron jobs.

The event must fire only once (no duplicate sends).

I want to keep server load minimal.

Example flow:

User’s status is updated at 12:00.

At 12:10, system should automatically send them an email.

What are the best alternatives for this scenario?

Should I handle this inside the database (delayed execution, scheduled events)?

Or is there a pattern for “delayed single execution” without timers/cron/Redis?

I’m using Node.js (Sequelize + MySQL) but open to general solutions.

What I tried:

First, I tried using setTimeout in Node.js to delay the email send by 10 minutes.

setTimeout(() => sendEmail(userId), 10 * 60 * 1000);

But this fails if the server restarts or scales horizontally (timers are lost).

Then I looked into node-cron and Redis-based schedulers like Bull/Agenda.
These work, but I want to avoid running extra schedulers/Redis to reduce server load and complexity

When setting pattern property from a string in JavaScript, how to preserve the backslashes?

Related to Properly simulate “pattern” attribute with javascript:
How do I set an input pattern using JavaScript?

when I try element.pattern = 'aS' (as a trivial example), then the pattern ends up in aS (with the backslash being removed).
The same happens with

element.pattern = `aS`

Of course I could double the backslash, but I’d like to create the javascript using a string constant that is used in CGI’s textfield({-pattern => PATTERN}).

A bit like this:

#...perl part to create initial HTML element...
textfield(-pattern => PERL_PATTERN, ...);

#...creating JavaScript to add or remove pattern dynamically
element = document.getElementById(...);
if (...)
    element.pattern = `${PERL_PATTERN}`;
else
    element.removeAttribute('pattern');

I’d like to avoid something ugly as

use constant PERL_PATTERN => 'aS';
use constant JAVASCRIPT_PATTERN => PERL_PATTERN =~ s/\/\\/gr;

to duplicate the pattern, but with backslashes doubled.
Is there a way to keep the backslash in JavaScript?

Web animation using gsap

I want to recreate the svg animation using gsap as shown here:

[Before]
(https://i.sstatic.net/7oXflNxe.png)

on hover

you can check out orginal animation on their official website : https://www.rejouice.com/ below there is marque container you can pan left or right till you see the clock card

Can anyone tell me exactly how to create this animation using gsap I am pretty confused right now.

I dont know how to animate svg components just want to learn it

Turning certain google ad keywords on/off every hour

I am trying to write a google ads script where for two specific keywords, I turn them both ON and then both OFF in alternating hours for six weeks in a specific country. All users should be able to see these ads when the keywords are on, and no users should be able to see them when they are off. So the rhythm should be:

Monday
00:00 – 00:59 Keywords ON
01:00 – 01:59 Keywords OFF
02:00 – 02:59 Keywords ON

Tuesday
00:00 – 00:59 Keywords OFF
01:00 – 01:59 Keywords ON
02:00 – 02:59 Keywords OFF

And so on. If this routine is followed, Monday on week 2 should start with keywords OFF from 00:00 – 00:59 and so on.

I only have some javascript experience and am totally new to google ads specifically, so I’m a bit afraid of just implementing my script without prior consulting someone else. It also feels needlessly complicated as of right now. Here’s what I have so far:

function main() {
  var account = AdsApp.currentAccount();
  var tz = account.getTimeZone();

  // only run for austria accounts
  if (tz !== "Europe/Vienna") {
    Logger.log("Not Austria (" + tz + "), exiting.");
    return;
  }

  // define start date
  var startDate = new Date(2025, 0, 1); // Example: Jan 1, 2025
  var today = new Date();
  
  // get "today" in account time zone
  var todayStr = Utilities.formatDate(today, tz, "yyyy-MM-dd");
  var todayLocal = new Date(todayStr); // midnight local

  // days since start
  var msPerDay = 1000 * 60 * 60 * 24;
  var daysSinceStart = Math.floor((todayLocal - startDate) / msPerDay) + 1;

  // odd days start ON, even days start OFF
  var startingOn = (daysSinceStart % 2 === 1);

  // current hour in AT
  var hour = parseInt(Utilities.formatDate(today, tz, "H"), 10);

  // flip every hour
  var isOn = (hour % 2 === 0) ? startingOn : !startingOn;

  Logger.log("Day " + daysSinceStart + " (startingOn=" + startingOn + 
             "), hour " + hour + " → " + (isOn ? "ON" : "OFF"));

  // select keywords by label
  var selector = AdsApp.keywords()
    .withCondition("LabelNames CONTAINS 'EXPLabel'");

  var keywords = selector.get();
  while (keywords.hasNext()) {
    var kw = keywords.next();
    if (isOn && kw.isPaused()) {
      kw.enable();
      Logger.log("Enabled: " + kw.getText());
    } else if (!isOn && !kw.isPaused()) {
      kw.pause();
      Logger.log("Paused: " + kw.getText());
    }
  }
}

Is it possible to get warnings with event listeners? [closed]

I’ve implemented a temporary debug dialog for a web page which displays any error messages using an event listener:

window.addEventListener("error", function (event) {
        $('#debugDialogModalBody').append('<h5>' + event.error + '</h5>');
        $('#debugDialogModalBody').append('<p>' + event.error.stack.replace(/n/g, '<br/>') + '</p>');
});

I am now trying to catch any warning messages to append to the dialog, but it appears that there are no event types which correspond to warnings. Is it possible to get any warnings through event listeners, or do I need to find these using any other method?

I am converting a XYFlow component from JavaScript to typescript but getting a type error

I am trying to add a context menu component to my React flow app so when you right click on a node a context menu shows up next to it. I am using React Flow and have been trying to convert the
example they give in JavaScript to typescript.

the context component works with no errors, but after I add this logic for positioning the menu, I am getting this error message Type 'void' is not assignable to type 'string | number | undefined'. The expected type comes from this index signature.

this is my App.tsx

import { ReactFlow, type Node,  useNodesState, addEdge, useEdgesState,  type Edge } from '@xyflow/react';
import {Controls, Background, BackgroundVariant} from '@xyflow/react'
import ContextMenu, { type Menu } from './ContextMenu';
import React from 'react'
import { useCallback, useRef, useState} from 'react';
import ExtendableNode from './extendable-node'


 const nodeTypes = {
  extendableNode: ExtendableNode 

};
 
const initialNodes: Node[] = [
  {
    id: '1',
    position: {x: 10, y: 10},
    data: {label: "default label"
    },
    type: 'extendableNode',

  }
  
];
 
const initialEdges: Edge[] = []
//const NewNodeId = () => `randomnode_${new Date()}`


function Flow() {

  const [nodes, setNodes , onNodesChange] = useNodesState(initialNodes);
  const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges);
  const [menu,  setMenu] = useState<Menu | null>(null);
  const ref = useRef<HTMLDivElement | null>(null);



  const onNodeContextMenu = useCallback(
    (event: React.MouseEvent, node: { id: string }) => {
      // Prevent native context menu from showing
      event.preventDefault();

      // Calculate position of the context menu so it doesn't get rendered off screen

      const pane = ref.current?.getBoundingClientRect();
      if (pane) {
        setMenu({
          id: node.id,
          top: event.clientY < pane.height - 200 ? event.clientY : false,
          left: event.clientX < pane.width - 200 ? event.clientX : false,
          right: event.clientX >= pane.width - 200 ? pane.width - event.clientX : false,
          bottom: event.clientY >= pane.height - 200 ? pane.height - event.clientY : false,
        });
      }
    },
    [setMenu],
  );

  // Close the context menu if it's open whenever the window is clicked.
  const onPaneClick = useCallback(() => setMenu(null), [setMenu]);

  return (
    <div className="h-screen w-screen p-8 bg-gray-50 rounded-xl">
      <ReactFlow
        nodes={nodes}
        nodeTypes={nodeTypes}
        onNodesChange={onNodesChange}
       onPaneClick={onPaneClick}
       onNodeContextMenu={onNodeContextMenu}
  
        fitView>
           {menu && <ContextMenu onClick={onPaneClick} {...menu} />}
        <Background color="#ccc" variant={BackgroundVariant.Cross} />
       
      
        <Controls/>
        </ReactFlow>
      
    
      
    </div>
  );
}
export function App() {
  return <Flow />;
}


This is the interface


import  {type FC, useCallback } from 'react';
import { useReactFlow, type Node } from '@xyflow/react';


interface ContextMenuProps  {
    id: string;
    top: number;
    left: number;
    right: number;
    bottom: number;
    [key: string]:  string | number | undefined ;

}


const ContextMenu: FC<ContextMenuProps> =  ({
        id,
        top,
        left,
        right,
        bottom,
        ...props

}) =>

{
  const { getNode, setNodes, addNodes, setEdges } = useReactFlow();
  const duplicateNode = useCallback(() => {
    const node: Node | undefined  = getNode(id)!;
    if(node) {
    const position = {
      x: node.position.x + 50,
      y: node.position.y + 50,
   
 };
    addNodes({
      ...node,
      selected: false,
      dragging: false,
      id: `${node.id}-copy`,
      position,
    });
    }
  }, [id, getNode, addNodes]);

  const deleteNode = useCallback(() => {
    setNodes((nodes) => nodes.filter((node) => node.id !== id));
    setEdges((edges) => edges.filter((edge) => edge.source !== id));
  }, [id, setNodes, setEdges]);



  return (
    <div
      style={{ top, left, right, bottom }}
      className="context-menu"
      {...props}
    >
      <p style={{ margin: '0.5em' }}>
        <small>node: {id}</small>
      </p>
      <button onClick={duplicateNode}>duplicate</button>
      <button onClick={deleteNode}>delete</button>
    </div>
  );    
}
export default ContextMenu;
export type Menu = {
  id: string;
  top: number | boolean;
  left: number | boolean;
  right: number | boolean;
  bottom: number | boolean;


};

I know typescript has strict expectations around being explicit with return types so I tried to add the onclick to the index signature.

interface ContextMenuProps  {
    id: string;
    top: number;
    left: number;
    right: number;
    bottom: number;
    onClick: ()=> void;
    [key: string]:  string | number | undefined | (()=>void);

}

that then lead to another error type '() => void'.The expected type comes from property 'onClick' which is declared here on type 'IntrinsicAttributes & ContextMenuProps'*

I feel I must have made a glaring mistake that I am missing.

How to add transparent as a shield to prevent click on a video [closed]

Please how can i place a transparent element over a video on the page where it’s embedded. I want the transparent to act as a shield element to intercept the clicks. This prevents the clicks from having an effect on the video. The video is hosted on wistia.

I have zero knowledge on coding, and i am using free Elementor version. please i need help.
Here is the page i want to edit
https://www.bloghoursstudio.com/demo-class/

I found some codes:

.yourDiv {pointer-events: none;} but i dont know how to use it correctly

Have problem in transform from EPSG:3857 to EPSG:3395

const transformCoord = function (_, z, x, y) {
  const zoomStr = "L" + (z - 2).toString().padStart(2, "0");
  const { lng, lat } = this.map.unproject({ x, y });
  const convertLnglat = proj4("EPSG:3857", "EPSG:3395", [lng, lat]);
  const convertedObj = this.map.project(convertLnglat);
  const xStr =
    "C" + Number(Math.round(convertedObj.x)).toString(16).padStart(8, "0");
  const yStr =
    "R" + Number(Math.round(convertedObj.y)).toString(16).padStart(8, "0");
  return `/${zoomStr}/${yStr}/${xStr}`;
};

I’m using maplibre-gl map engine. i can’t get the right tile when switch from EPSG:3857 to EPSG:3395. it looks the the only difference is the y value.

any help is appreciat

Use placeholders and $wpdb->prepare(); found $sql

I create my custom plugin and test in plugin check plugin but it give me error like
Use placeholders and $wpdb->prepare(); found $sql

// Execute

$sql = "SELECT {$found_rows} p.ID AS course_id, X.*,IF(X.status = %s AND uim.meta_value IS NOT NULL, uim.meta_value, X.status) AS status FROM ( SELECT ui.* FROM `{$stepup_lms_user_items}` ui  LEFT JOIN `{$stepup_lms_user_items}` uix    ON ui.item_id = uix.item_id AND ui.user_id = uix.user_id    AND ui.user_item_id < uix.user_item_id  WHERE uix.user_item_id IS NULL) X {$join}   {$where}    {$limit}";

        // Only the dynamic value goes through prepare
        $rows = $db->wpdb->get_results(
                $wpdb->prepare( $sql, 'finished' )
        );

Also I write query inside $wpdb->prepare(); then it give another error like

Use placeholders and $wpdb->prepare(); found interpolated variable {$found_rows} at "SELECT {$found_rows} p.ID AS course_id, X.*,IF(X.status = %s AND uim.meta_value IS NOT NULL, uim.meta_value, X.status) AS status FROM (tSELECT ui.*tFROM {$stepup_lms_user_items} uitLEFT JOIN {$stepup_lms_user_items} uixtON ui.item_id = uix.item_idtAND ui.user_id = uix.user_idtAND ui.user_item_id < uix.user_item_idtWHERE uix.user_item_id IS NULL) X {$join}t{$where}t{$limit}"

But It is not solve.

Please help me

Thanks in advance.

I try bellow links

I refer wordpress document https://make.wordpress.org/core/2022/10/31/postponed-to-wp-6-2-escaping-table-and-field-names-with-wpdbprepare/

also view other resource https://github.com/WordPress/WordPress-Coding-Standards/issues/2442

I want to resolve my ERROR and warning in Plugin Check plugin.

Where is first view file in Symfony?

I am new in Symfony and I start to create basic MVC project. When I create project and run it I see welcome page. In laravel this file is in views/welcome.blade.php. In symfony where is this file.

How to get array_splice from upper to lower?

When I run the following code, I’m receiving this output:

PHP
PHP What
PHP What is
PHP What is PHP

However I want to receive the following output:

PHP What is PHP
PHP What is
PHP What
PHP

What thing needs to change to extract values from Upper to Lower

<?php
// Horje.Com
$stringSentence = 'PHP What is PHP';
$stringSentence = preg_replace('/s+/', ' ', $stringSentence);
$buffer = '';
$count = 1;
$length = strlen($stringSentence);
for ($i = 0; $i < $length; $i++) {
    if ($stringSentence[$i] !== ' ') {
       $buffer .= $stringSentence[$i];
    } else {
        //echo ' '.$count++.' '.$buffer.'&lt;/br&gt;';
        $pieces = explode(" ", $stringSentence);
        $first_part = implode(" ", array_splice($pieces, 0, $count++));
        echo ''.$first_part.'</br>';
        $buffer = '';
    }
}

$pieces = explode(" ", $stringSentence);
$first_part = implode(" ", array_splice($pieces, 0, $count++));

echo ''.$first_part.'';

I keep getting “Failed to open stream: Permission denied” and changing permissions on the folder does not work

I am switching from Windows to Linux (Fedora), and I keep getting this error in my Laravel project that I did not have on Windows:

enter image description here

It’s apparently related to permissions, but running these commands doesn’t fix the issue:

sudo chmod -R 777 /var/www
sudo chmod -R 777 storage/
sudo chown -R apache:apache /var/www/
sudo chmod -R 777 /var/www/html/cursos/victor-robles/master-fullstack/api-rest-laravel/storage/framework/views/

I have checked if permissions have been set properly with ls -la and this is what I get:

api-rest-laravel folder:

drwxr-xr-x. 1 apache apache    402 Sep 18 10:51 .
drwxrwxrwx. 1 apache apache     56 Sep 18 02:02 ..
drwxr-xr-x. 1 apache apache     52 Aug 18 22:33 app
-rwxrwxrwx. 1 apache apache    425 Apr 15 08:24 artisan
drwxr-xr-x. 1 apache apache     50 Aug 18 22:33 bootstrap
-rwxrwxrwx. 1 apache apache   2462 Aug 18 23:27 composer.json
-rwxrwxrwx. 1 apache apache 299734 May  1 13:24 composer.lock
drwxr-xr-x. 1 apache apache    204 Aug 18 22:33 config
drwxr-xr-x. 1 apache apache    102 Aug 18 22:33 database
drwxr-xr-x. 1 apache apache     24 Aug 18 22:33 docs
-rwxrwxrwx. 1 apache apache    258 Apr 15 08:24 .editorconfig
-rwxrwxrwx. 1 apache apache   1139 Sep 18 02:20 .env
-rwxrwxrwx. 1 apache apache   1084 Apr 15 08:24 .env.example
-rwxrwxrwx. 1 apache apache    186 Apr 15 08:24 .gitattributes
-rwxrwxrwx. 1 apache apache    286 Apr 15 08:24 .gitignore
-rwxrwxrwx. 1 apache apache    354 Apr 15 08:24 package.json
-rwxrwxrwx. 1 apache apache   1173 Apr 15 08:24 phpunit.xml
drwxr-xr-x. 1 apache apache     78 Aug 18 22:33 public
-rwxrwxrwx. 1 apache apache   3932 Apr 15 08:24 README.md
drwxr-xr-x. 1 apache apache     20 Aug 18 22:33 resources
drwxr-xr-x. 1 apache apache     36 Aug 18 22:33 routes
drwxr-xr-x. 1 apache apache     32 Aug 18 22:33 storage
drwxr-xr-x. 1 apache apache     46 Aug 18 22:33 tests
drwxr-xr-x. 1 apache apache    596 Aug 18 22:34 vendor
-rwxrwxrwx. 1 apache apache    331 Apr 15 08:24 vite.config.js

api-rest-laravel/storage

drwxr-xr-x. 1 apache apache  32 Aug 18 22:33 .
drwxr-xr-x. 1 apache apache 402 Sep 18 10:51 ..
drwxr-xr-x. 1 apache apache  68 Aug 18 22:33 app
drwxr-xr-x. 1 apache apache  70 Aug 18 22:33 framework
drwxr-xr-x. 1 apache apache  42 Aug 18 22:33 logs

api-rest-laravel/storage/framework

drwxr-xr-x. 1 apache apache   70 Aug 18 22:33 .
drwxr-xr-x. 1 apache apache   32 Aug 18 22:33 ..
drwxr-xr-x. 1 apache apache   28 Aug 18 22:33 cache
-rwxrwxrwx. 1 apache apache  119 Apr 15 08:24 .gitignore
drwxr-xr-x. 1 apache apache   20 Aug 18 22:33 sessions
drwxr-xr-x. 1 apache apache   20 Aug 18 22:33 testing
drwxrwxrwx. 1 apache apache 4052 Sep 18 02:24 views

I have also tried restarting apache with sudo systemctl restart httpd several times but nothing works.

Please, any ideas?

prevent PHP from using ellipses (…) in the paths of INCLUDE statements in error messages

I have a .php page that generates a Fatal error:

...
#2 [path1]/header.php(22): include('/Library/WebSer...') 
#3 [path2]/index.php(4): include('/Library/WebSer...')
...

(where I’ve substituted [path#] for the path to files in the traceback) and in both, the file being included is truncated and presented as "/Library/WebSer..." with ellipses instead of the full path and most importantly, without the file_name.

Based on PHP – Stop displaying full path in errors, I take it that once upon a time PHP did not do this, i.e., when reporting an error, it gave the full path, including the file_name, but maybe I’m misunderstanding this 11 year old question and answer.

I’ve looked through all of the php.ini directives at https://www.php.net/manual/en/ini.list.php, and don’t see one that addresses what I want, i.e., I want the full path, including file_name, displayed instead of a truncated path with ellipses at the end like “include(‘/Library/WebSer…’)”.

Is there way to force display of the full path in the “include()”?

Thank you.

i am creating a ecom website using vite react [closed]

i have various product cards and when i add an item to cart , i want the text and icon of add to cart should change to go to cart by checking if that item is in the cart or not,but the function is returning false everytime even the item has been added to the cart, when i am creating a custom cart it is working properly

findProductInCart code below

export const findProductInCart = (cart, id) => {
    const result = cart?.length > 0 && cart.some((product) => product.id === id);

    return result;
};

button text logic

<button onClick={() => onCartClick(product)}>
    {isProductInCart ? (
         <>
             <ShoppingCartCheckoutOutlinedIcon />
             Go to Cart
         </>
     ) : (
         <>
             <ShoppingCartOutlinedIcon />
             Add to Cart
         </>
     )}
</button>

Add to cart Logic

const { cart, cartDispatch } = useCart();
  const navigate = useNavigate();
  const isProductInCart = findProductInCart(cart, product.id);

  const onCartClick = (product) => {
    !isProductInCart
      ? cartDispatch({
          type: "ADD_TO_CART",
          payload: { product },
        })
      : navigate("/cart");
  };