Sunday, 28 November 2021

Catch events from printer in Windows

The printer has a print queue where are documents prepared for printing that were sent to the printer from a few computers.

I'd like to write a code in Python that runs on the server and checks for printer events. Especially when the document has finished successfully printing, I'd like to catch this event and get information about the document

  • document name
  • number of pages
  • format (A4, A3, etc.)
  • was it colorful or black and white
  • time of finish printing

Could you help me bounce off?

I already studied this question but I can't figure out what I need from it.



from Catch events from printer in Windows

How do I change the theme in an AnyChart React tag cloud?

I am creating a tag cloud word cloud using the React library from AnyChart. How do I change the color theme of it? The answer found here doesn't seem to work:

import React from "react";
import ReactDOM from "react-dom";
import AnyChart from "anychart-react";
import anychart from "anychart";
anychart.theme("coffee");

var data = [
  { x: "learning", value: 80 },
  { x: "includes", value: 56 },
  { x: "lists", value: 44 },
  { x: "meaning", value: 40 },
  { x: "useful", value: 36 },
  { x: "different", value: 32 },
  { x: "grammar", value: 28 },
  { x: "teaching", value: 24 },
  { x: "example", value: 20 },
  { x: "thing", value: 12 }
];

// create a chart and set the data
var chart = anychart.tagCloud(data);
//chart.theme = anychart.palettes.coffee;

ReactDOM.render(
  <AnyChart width={800} height={600} instance={chart} title="Column chart" />,
  document.getElementById("root")
);

Full demo is here



from How do I change the theme in an AnyChart React tag cloud?

AngularFire getIdToken(true) not refreshing token

I have an angularfire authentication service which works absolutely fine - except it wont refresh the token.

My refresh code:

firebase.auth().currentUser.getIdToken(true).then((token: string) => {
    const newUser = { token: token }; // new user details in brief
    this.user.next(newUser);
});

calls the firebase service just fine and gives a response, but it only returns the current token and doesn't refresh the token - so it still logs out of the app after 1 hour.

I have read a multitude of issues regarding getIdToken but none which specifically address a token not refreshing.

I made a stackblitz: https://stackblitz.com/edit/angular-ivy-uvcdz7?file=src/app/app.component.ts so you can see the code in full (though it doesn't work for some reason, but also because I cant work out how to connect the project to firebase via SB)

edit

To help there are some other odd behaviours I dont expect, for example in my ngOnInit I have...

this.fAuth.onAuthStateChanged((state) => {
    console.log(state);
})

which does nothing when I log in or out - no message to say the state has changed. None of these functions which I expect to trigger when things change in the authentication seem to do anything.

edit 2

As added info, before I added the bounty I did a full and painful update of Angular and AngularFire, so now Angular is v13 and AngularFire is 7.2.0 to see if this would make any difference, but it did not, the getIdToken still provides no refresh of the token.



from AngularFire getIdToken(true) not refreshing token