Getting started

The docs are completely bereft of a 'getting started' section. How is anyone who is not overly familiar with the matter supposed to use this?
This lib looks awesome, I have experience with elm, ramda, lodash/fp but I still have no clue how to use it.

Am I supposed to use sanctuay during compile- or runtime.
How does it relate to build-systems like webpack?
What is a sanctuary module? Does it replace commonjs modules?
How do I create a simple, type-checked String -> String function?

I'm not trying to be overly whiney, but nothing on the website tells me what it really does.
Docs by example would be a good practice here.
In the meantime, playing around with the CLI

Also, how does it relate to ramda, except that it's stricter? Where is lens or converge?

What is z referring to?

Hello @FranzSkuffka, thank you for highlighting these issues. I'll do my best to provide answers to your questions and when things become clearer, maybe you can provide your thoughts on how we can improve the documentation for future newcomers.

Am I supposed to use sanctuay during compile- or runtime

Sanctuary is a standard library of sorts. You can use it like you would Ramda or Lodash, the only difference being that there is an optional way to configure it before using.

How does it relate to build-systems like webpack?

No relation.

What is a sanctuary module? Does it replace commonjs modules?

I'm not sure what you are referring to. Usually when we talk about "module" (like the return value from create) we are referring to the exports object from commonjs (node) modules.

How do I create a simple, type-checked String -> String function?

Sanctuary itself does not provide a way to do this. If you are interested in defining your own type-checked functions, you are looking for sanctuary-def.

The docs are completely bereft of a 'getting started' section
Also, how does it relate to ramda, except that it's stricter?

#377 Adds a section to the README which should serve as somewhat of an introduction to users already familiar with Ramda. Some of your questions are answered by this text.

What is Z referring to?

Z is the name of the export from sanctuary-type-classes. Most of the occurrences of Z in the sanctuary documentation are links to the appropriate documentation in sanctuary-type-classes. Which occurrence got you wondering? We may have forgotten to link it.

Thank you very much for clearing this up.

Might I ask which occurrence got you wondering?

I was just browsing through the issues and assumed there is some kind of convention. I think in the particular instance I remember, Z was referring to the fantasyland standard library.
I will keep following this project and try everything out.
If I need lenses or the sort, I should just use https://github.com/fantasyland/fantasy-lenses, is that correct? Is it compatible with sanctuary?

Another question:
Why is this ok: S.fromMaybe(['nuffin'], S.tail([])) but not S.pipe(S.tail, S.fromMaybe(['nuffin']))?
What am I missing?

The error message should give you some idea about what's going on. Let's examine it:
1.  pipe :: Array Function -> a -> b
2.          ^^^^^^^^^^^^^^
3.                1
4.
5.  1)  tail :: List a -> Maybe (List a) :: Function, (??? -> ???)
6.
7.  The value at position 1 is not a member of ‘Array Function’.

Line 1 shows us the type signature of pipe: Array Function -> a -> b.
Line 2 underlines the constraint which has been violated
Line 3 assigns a reference to the underlined part, so we can show the actual types at each of the underlined constraints
Line 5 shows the actual type which was encountered at reference 1, namely: a Function of type List a -> Maybe (List a).
Line 7 explains that the actual type is incompatible with the Array Function constraint.
So in other words: You provided a Function where we expected an Array of Function. This probably happened because you assumed the S.pipe signature to be the same as R.pipe. However, Sanctuary avoids using variadic functions, and therefore S.pipe takes an Array.

Like lodash/fp. Cool.

If you decide to continue using the library, and have any further questions, you might also try asking them in the Gitter channel. Generally the response there comes faster.

Thank you for raising these issues, @FranzSkuffka. We currently assume new users will bring with them functional programming knowledge from Clojure, Elm, Haskell, PureScript, or another functional language. I'd like Sanctuary to be approachable to those coming from one of the _ libraries or even from vanilla JavaScript. A dedicated document at https://sanctuary.js.org/getting-started/ may be warranted.
Thank you for the helpful and detailed responses, @Avaq! :clap:

I subscribe to this issue.
A getting started, or some kind of manual is very necessary. Usually opening a project's page and being directly confronted to the API is very scary. A small document in form of initial steps and some examples will help even the most senior developers.
Regards

I wholeheartedly agree, @danielo515. I hope to get to this in the coming months. :)

I think having a searchable docs page like ramda's https://ramdajs.com/docs would be very helpful for newcomers as well (LIKE ME)

I was looking for some functional style API for JS, I've read a book and implemented few Monads by myself, so I have some basic idea. But honestly after few hours I have totally no Idea how could I use Sanctuary, it this only a specification, can I use it in real JS programs....
In my case I'm already using Ramda, the only thing that I'm missing there is null-checking and error handling. So I just wanted to add Sanctuary Types to it, like: https://github.com/sanctuary-js/sanctuary-either. Honestly based on this documentation I have no Idea how would I even start....
I'm not talking here about a whole book, but few working code examples would really help. Something like that: https://github.com/ramda/ramda-fantasy/blob/master/docs/Maybe.md

Thanks for sharing your experience, @maciejmiklas, and welcome to the community! :wave:
I suggest watching Programming Safely in an Uncertain World, then solving the challenge yourself, with vanilla JavaScript and with Sanctuary. The challenge is contrived, certainly, but dealing with untyped input is very much a practical concern.
You might like to share a link to code you are rewriting in terms of algebraic data types, on Gitter perhaps. :)

Thanks - I will look into it. My project is on github, but I do not have something "useful" yet.

@maciejmiklas Sanctuary was really valuable to me when I developed a CLI. The CLI does some complicated things like streaming files over websockets. Sanctuary-def helped me tuck types into place by building custom types. Then I added unit tests that would allow me to verify that everything fits together at development-time (not compile-time but when the tests are run).
This saved heaps of time. I did not make a lot of use of sanctuary itself but used it as a basis for development. I added Fluture into the mix to deal with async operations. I find the error messages a lot more helpful than typescript and the system to be more sound, flexible and idiomatic.
CliMsg.mjs
export const WriteOperationSymbol = "WriteOperation";
export const WriteOperationSymbolType = $.NullaryType("WriteOperation")(
    "WriteOperation"
)([])(data => data === "WriteOperation");

export const IdType = $.NullaryType("IdType")("IdType")([])(
    data => typeof data === "string" && data.length >= 9
);

export const PayloadType = $.RecordType({
    type: WriteOperationSymbolType,
    data: Operation.WriteOperationType
});

export const MsgType = $.RecordType({
    id: IdType,
    payload: PayloadType
});

export const SocketType = $.NullaryType("SocketType")("SocketType")([])(
    socket => !!socket.emit
);

export const fromOperation = def("fromOperation")({})([
    Operation.WriteOperationType,
    MsgType
])(fileOperation => {
    const id_ = id();
    const msg = {
        id: id_,
        payload: { type: WriteOperationSymbol, data: fileOperation }
    };
    return msg;
});

var pendingOperations = {};

export const emit = def("emit")({})([
    MsgType,
    $.Maybe(SocketType),
    Future($.Error)(MsgType)
])(msg => socket =>
    F.Future((reject, resolve) => {
        if (S.isJust(socket)) {
            const s = S.maybeToNullable(socket);
            s.emit("msg", msg);
            resolve(msg);
            return () => "";
        }
        resolve(msg);
        return () => "";
    })
);

dev.mjs

export const addToTransactionLog = def("addToTransactionLog")({})([
    Operations.WriteOperationType,
    $.Any,
    $.Any
])(operation => transactionLog => {
    transactionLog[operation.path] = hasha(operation.contents);
    return transactionLog;
});
export const removeFromTransactionLog = def("removeFromTransactionLog")({})([
    Operations.WriteOperationType,
    $.Any,
    $.Any
])(operation => transactionLog => {
    delete transactionLog[operation.path];
    return transactionLog;
});
export const isInTransactionLog = def("isInTransactionLog")({})([
    Operations.WriteOperationType,
    $.Any,
    $.Any
])(operation => transactionLog => {
    const isThere = transactionLog[operation.path] == hasha(operation.contents);
    return isThere;
});

const handleMsg = socket => async ({ payload, id }) => {
    try {
        console.log("\n[msg]", id);
        if (payload.type == "WriteOperation") {
            await F.promise(
                Operations.executeWrite(process.cwd())(payload.data)
            );
            transactionLog = addToTransactionLog(payload.data)(transactionLog);
            socket.emit("msgok", { id });
        } else {
            throw `msg type ${payload.type} not supported`;
        }
    } catch (err) {
        console.log(err);
        socket.emit("msgerr", { id, err: err.toString() });
    }
};

Operation.mjs
// Define file system operations to send over the wire
import { def, $, S, F, Future, log } from "./fp.mjs";

// helpers for modifying and generating paths
import * as Path from "path";
import hasha from "hasha";
import slugify from "slugify";

// -- TYPES --

// A local path starts with '/'
const LocalPathType = $.NullaryType("LocalPathType")("LocalPathType")([])(
    data => {
        return typeof data === "string" && data.startsWith("/");
    }
);

// this one starts with root>
const AgnosticFilePathType = $.NullaryType("AgnosticFilePathType")(
    "AgnosticFilePathType"
)([])(data => {
    return typeof data === "string" && data.startsWith("root>");
});

// buffer | string
export const FileContentsType = $.NullaryType("FileContentsType")(
    "FileContentsType"
)([])(data => {
    return (
        typeof data === "string" ||
        data instanceof Buffer ||
        data instanceof ArrayBuffer
    );
});

// Is it a file as in the browser API
const FileType = $.NullaryType("FileType")("FileType")([])(data => {
    return data instanceof File;
});

// Is it a file as in the browser API
const ArrayBufferType = $.NullaryType("ArrayBufferType")("ArrayBufferType")([])(
    data => {
        return data instanceof ArrayBuffer;
    }
);

// the write data to send over the wire
export const WriteOperationType = $.RecordType({
    path: AgnosticFilePathType,
    contents: FileContentsType
});

// the read location to send over the wire
// QUESTION: does this even have a use case
const ReadOperationType = $.RecordType({
    path: AgnosticFilePathType
});

// -- IMPLEMENTATION --

// API
const executeWrite_ = cwd =>
    F.encaseP(async ({ path, contents }) => {
        const localPath = localize(cwd)(path);
        await F.promise(ensureDir(localPath));
        return await fs.promises
            .writeFile(localPath, contents)
            .then(() => path);
    });

export const executeWrite = def("executeWrite")({})([
    LocalPathType,
    WriteOperationType,
    Future($.Error)(AgnosticFilePathType)
])(executeWrite_);

const executeRead_ = cwd => ({ path }) => readFileWithFs(localize(cwd)(path));

const readFileWithFs = def("readFileWithFs")({})([
    LocalPathType,
    Future($.Any)($.Buffer)
])(F.encaseP(path => fs.promises.readFile(path)));

export const executeRead = def("executeRead")({})([
    LocalPathType,
    ReadOperationType,
    Future($.Error)($.Buffer)
])(executeRead_);

const toString = def("toString")({})([$.Buffer, $.String])(buffer =>
    buffer.toString()
);

// An uploaded file gets hashed to prevent collisions.
const makeWriteOperationFromUiFileUpload_ = file => {
    const combine = ([fileHash, fileBuffer]) => {
        const parts = slugify(file.name, {
            lower: true,
            replacement: "-"
        }).split(".");
        const ext = parts[parts.length - 1];
        const base = "root>assets";
        const fileName = [...[parts.slice(0, -1)], fileHash, ext].join(".");
        return { path: [base, fileName].join("/"), contents: fileBuffer };
    };

    const addHash = buffer => F.both(hash(buffer))(F.resolve(buffer));
    return F.map(combine)(F.chain(addHash)(readFileWithFileReader(file)));
};

export const makeWriteOperationFromUiFileUpload = def(
    "makeWriteOperationFromUiFileUpload"
)({})([FileType, Future($.Error)(WriteOperationType)])(
    makeWriteOperationFromUiFileUpload_
);

// We need to cut off the local path to make things agnostic
const makeWriteOperationFromLocalFileAddition_ = cwd => path => {
    const readOp = readFileWithFs(path);
    const agnosticPath = "root>" + path.slice(cwd.length + 1);
    const bake = buf => ({ path: agnosticPath, contents: buf });
    return F.map(bake)(readOp);
};

export const makeWriteOperationFromLocalFileAddition = def(
    "makeWriteOperationFromLocalFileAddition"
)({})([LocalPathType, LocalPathType, Future($.Error)(WriteOperationType)])(
    makeWriteOperationFromLocalFileAddition_
);

// For the browser
export const readFileWithFileReader = def("readFileWithFileReader")({})([
    FileType,
    Future($.Error)($.Buffer)
])(
    F.encaseP(
        file =>
            new Promise((resolve, reject) => {
                var reader = new FileReader();
                reader.addEventListener("loadend", function() {
                    resolve(reader.result);
                });
                reader.readAsArrayBuffer(file);
                return function() {
                    reader.abort();
                };
            })
    )
);

export const arrayBufferToString = def("arrayBufferToString")({})([
    ArrayBufferType,
    $.String
])(buf => {
    const enc = new TextDecoder();
    return enc.decode(buf);
});

// helpers

const hash = def("hash")({})([FileContentsType, Future($.Void)($.String)])(
    F.encaseP(async data => {
        try {
            return await hasha.async(data, { algorithm: "md5" });
        } catch {
            return await hasha.async(data.toString(), { algorithm: "md5" });
        }
    })
);
// window.hash = x => F.promise(hash(x))

export const localize = def("localize")({})([
    LocalPathType,
    AgnosticFilePathType,
    LocalPathType
])(cwd => path => {
    const withoutPrefix = path.slice(5);
    return Path.join(cwd, withoutPrefix);
});

const ensureDir = def("ensureDir")({})([
    LocalPathType,
    Future($.Error)($.Null)
])(
    F.encaseP(async path => {
        const dir_ = path
            .split("/")
            .slice(0, -1)
            .join("/");
        const dir = dir_ === "" ? "/" : dir_;
        try {
            await fs.promises.mkdir(dir);
            return;
        } catch (e) {
            if (e.code == "EEXIST") {
                return;
            } else {
                throw e;
            }
        }
    })
);

Using zora for testing I slowly evolve code from unit tests into usable modules:
compile.mjs
/**
 * A declarative file system.
 * Works like VDOM
 */

import { def, log, F, S, $, Future } from "../src/fp.mjs";
import * as Operation from "../src/Operation.mjs";
import { test } from "zora";
import * as FileSystem from "../src/FileSystem.mjs";
import hasha from "hasha";

const packageName = "";
const packageURL = "";

export const LazyType = (name, type) =>
    $.NullaryType(`${packageName}/${name}`)(`${packageURL}#${name}`)([])(x =>
        $.test($.env, type(), x)
    );

export const LazyDirectorySpecType = LazyType(
    "DirectorySpecType",
    () => DirectorySpecType
);

export const FileSpecType = $.RecordType({
    name: $.String,
    value: Operation.FileContentsType
});
export const DiffSummaryType = $.RecordType({
    missingInReplica: $.Array($.String),
    missingInPrimary: $.Array($.String),
    differingSharedFiles: $.Array($.String),
    identicalSharedFiles: $.Array($.String)
});

export const DirectoryOrFile = $.Either(LazyDirectorySpecType)(FileSpecType);

export const DirectorySpecType = $.Array1(DirectoryOrFile);

const ComparisonResultType = $.Either(DiffSummaryType)($.Null);

const compare = def("compare")({})([
    $.String,
    $.String,
    Future($.Error)(ComparisonResultType)
])(pathPrimary =>
    F.encaseP(async pathReplica => {
        // read all files in both folders
        const filesPrimary = (
            await FileSystem.listFiles(pathPrimary)
        ).map(path => path.replace(pathPrimary, ""));
        const filesReplica = (
            await FileSystem.listFiles(pathReplica)
        ).map(path => path.replace(pathReplica, ""));

        const checkPath = async pathOfFileInPrimary => {
            if (filesReplica.indexOf(pathOfFileInPrimary) > -1) {
                const hashInPrimary = await hasha.fromFile(
                    pathPrimary + pathOfFileInPrimary
                );
                const hashInSecondary = await hasha.fromFile(
                    pathReplica + pathOfFileInPrimary
                );
                return S.Just(
                    S.Pair(pathOfFileInPrimary)(
                        hashInPrimary == hashInSecondary
                    )
                );
            } else {
                return S.Nothing;
            }
        };
        const checkProcesses = filesPrimary.map(checkPath);
        const shared = S.justs(await Promise.all(checkProcesses));
        const missingInReplica = filesPrimary.filter(
            path => !(filesReplica.indexOf(path) > -1)
        );
        const missingInPrimary = filesReplica.filter(
            path => !(filesPrimary.indexOf(path) > -1)
        );
        console.log("filesPrimary", filesPrimary);
        console.log("filesReplica", filesReplica);
        console.log("shared", shared);
        console.log("missingInPrimary", missingInPrimary);
        console.log("missingInReplic", missingInReplica);
        const differingSharedFiles = S.map(S.fst)(S.reject(S.snd)(shared));
        const identicalSharedFiles = S.map(S.fst)(S.filter(S.snd)(shared));
        const isInSync =
            missingInPrimary.length === 0 &&
            missingInReplica.length === 0 &&
            differingSharedFiles.length === 0;
        if (isInSync) {
            return S.Right(null);
        } else {
            const diffSummary = {
                missingInPrimary,
                missingInReplica,
                differingSharedFiles,
                identicalSharedFiles
            };
            return S.Left(diffSummary);
        }
        // normalize file paths and match them
        // aggregate
        // rebase file paths and their hashes
    })
);

test("compare matching directories", async t => {
    const compareOperation = compare("./tests/fixtures/matching-directories/a")(
        "./tests/fixtures/matching-directories/b"
    );
    const result = await F.promise(compareOperation);
    t.ok(S.isRight(result));
});

test("compare matching directories", async t => {
    const expected = {
        differingSharedFiles: ["/samename"],
        identicalSharedFiles: ["/justfine"],
        missingInPrimary: ["/bar", "/baz"],
        missingInReplica: ["/foo"]
    };
    const compareOperation = compare(
        "./tests/fixtures/different-directories/a"
    )("./tests/fixtures/different-directories/b");
    const result = await F.promise(compareOperation);
    console.dir(result);
    if (S.isLeft(result)) {
        console.log(result.value);
        t.equals(result.value, expected);
    } else {
        t.ok(false);
    }
});

I just stumbled over these two blog series that introduce fantasy-land in detail and find them really helpful:

James Sinclair's Things I wish someone had explained about functional programming
Tom Harding's Fantas, Eel, and Specification

I also wasn't aware of daggy which makes it easy to create sum types.


KHKT Feature Requests

[ ] Generate a 3D view of a real world object from 8 images.
[ ] Use CSG to create a 3D object constructor.
[ ] Add internationalization.
[ ] Export presentation to GIF and HTML. Be bold and do not try to integrate this awesome project into PowerPoint.
[ ] Sample presentation to showcase the project.

Closed because I failed miserably.


Add the missing file for testing miniscripts

When moving from integration tests repo to cargo test, I forgot to
add the test file for miniscript tests from cpp.

Lol, oops, good catch.

You Acked a different commit, but I took the liberty to merge this as it was only adding test code.


When camera is not available eventually Home Assistant will be unresponsive

Description
I had one camera that was unavailable (unplugged). The integration was trying to connect each time, eventually rendering Home Assistant unresponsive.
Reproduction Steps

Disconnect a cam
Watch logging
Home Assistant hangs

Expected behavior
Home assistant still functioning
If applicable, add error logs.
No response
Device Firmware
1.1.16
Using stream component
Yes
Does camera work via official integrations?
N/A
Camera has all attributes filled out in developer tools
Yes
HASS Environment
Docker on ubuntu
Search for similar issues
Yes
Additional information
No response

Is this still an issue with the latest version? Integrations should not be able to affect the whole Home Assistant instance.
Are there any errors in the log?


hover problem when another element appears over hovered one

Are you requesting a feature or reporting a bug?
it's a bug
What is the current behavior?
In situation when I have an element with hover effect showing another element on top of it there are two different behaviours:

In case when I'm running with lower test speed than 1:

hover action works but after actually hovering the element testcafe waits anyway the whole timeout for the hovered element to appear just to pass when timeout finishes
last assertion isn't passing because "under" element appears to be visible when actually it's not

In case when I'm running at full speed (but not always):

hover action is performed (mouse shows over the element) but after that I get the error that this element is not visible

What is the expected behavior?
this test should pass, and hover action shouldn't check for hovered element visibility after it's already hovered over because something could show up over it. Another thing is that hovered element sometimes is found visible when it's actually not, it shouldn't happen.
How would you reproduce the current behavior (if this is a bug)?
run code below
Provide the test code and the tested page URL (if applicable)
Tested page URL:
Test code
import { Selector } from 'testcafe';

fixture('hover')
.page('https://jsfiddle.net/s0mnL71L/');

const under = Selector('.under');
const over = Selector('.over');
const frame = Selector('[name="result"]');

test('succeed to hover', async (t) => {
  await t
    .expect(frame.visible).eql(true)
    .switchToIframe(frame)
    .expect(over.visible).eql(false)
    .expect(under.visible).eql(true)
    .hover(under)
    .expect(over.visible).eql(true)
    .expect(under.visible).eql(false);
});

Specify your

operating system: macOS 10.12.6
testcafe version: 0.17.0
node.js version: 8.2.1

Hi @mkubrycz,
The visible option works in the following way:

it's false in the following cases:
-- display style is none;
-- visibility style is hidden;
-- element has a width or height that is equal zero.
it's true in other cases.

For now there is no API to check whether an element overlapped by another element or not. We have a separated issue for that and discuss possible ways to resolve it: https://github.com/DevExpress/testcafe/issues/1186#issuecomment-319979607
It would be nice if you add your opinion there.

hover action works but after actually hovering the element testcafe waits anyway the whole timeout for the hovered element to appear just to pass when timeout finishes

I'll describe how does TestCafe work here. If an action target element is under some other element TestCafe waits for a timeout if it's became visible (it can't be some kind of animation or a big loading panel for example). If the element is not visible after a timeout TestCafe clicks on the point of the page where the element is located. We don't throw an error because of the following reason. For some cases it's ok when the target element is overlapped (for example it can be a floating transparent element that is located under the mouse cursor or it can be some placeholder). The current TestCafe behavior allows to handle these cases. If the target element is overlapped unexpectedly and you try to click on it the next action/assertion should be failed since the click doesn't perform expected behavior. For example, there is a button that shows a popup. In the test you click on the button and check that the popup is shown (or perform some action with the popup). If the button is overlapped the next step after button click will be failed.
If you'd like to click on an overlapped element you can set a timeout for it to 0.
With all this I've modified a test a it works stable and properly on my side:
import { Selector } from 'testcafe';

fixture('hover')
.page('https://jsfiddle.net/s0mnL71L/');

const under = Selector('.under', { timeout: 0 });
const over = Selector('.over');
const frame = Selector('[name="result"]');

let i = 10;

while(i--)
test('succeed to hover', async (t) => {
  await t
    .expect(frame.visible).eql(true)
    .switchToIframe(frame)
    .expect(over.visible).eql(false)
    .expect(under.visible).eql(true)
    .hover(under)
    .expect(over.visible).eql(true)
    .expect(under.visible).eql(true);
});

Thank you @AlexanderMoskovkin for reply.
Since I've posted this issue I was still investigating, and it came to my attention that there's different behavior causing this. I thought the problem was that something is on top of my target element but it really was that my element from underneath is being hidden when the one on top is showing and this actually causes hover action to fail.
I've updated the fiddle: https://jsfiddle.net/s0mnL71L/1/
please run the same test code on this one
my problem is that testcafe is hovering over this element but since it disappears at the same moment it's failing to find it after performing an actual hover action.

@mkubrycz , I understand the problem now. It works properly in 0.16.2 but was broken in 0.17.0. I'll try to fix it in the 0.17.1


Avoid cycleway on wrong side

Here is a normal cycleway https://www.openstreetmap.org/way/368002781
And here a way with cycleway:right but from south to north: https://www.openstreetmap.org/way/195743153
So a route should go the normal cycleway but currently prefers the wrong cycleway:right: https://graphhopper.com/maps/?point=40.810383%2C-73.953674&point=40.765266%2C-73.982792&vehicle=bike

The cycleway:right should only be treated as a cycleway in one direction, and as a regular road in the other direction.
Which direction has the cycleway depends on which side of the road is used for driving, the direction of the way, and the setting of the bicycle:oneway key.


Incorporating better scenario/example including more than 1 month and financial close is being performed and what if financial period close is not performed.

The current example explains the scenario of the initial month. Assuming after the Inventory period closure at month end and further transactions are posted to the following month, how the recalculation and cost adjustment will be performed? Will it take the closed period financial receipt transaction or will it take the closing period financial qty and cost, then look for the financial receipt transaction posted in the open period and then post the cost adjustment?
[Enter feedback here]

Document Details
⚠ Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

ID: f1abe8f7-5e41-bdbe-dee5-df5080c09ea7
Version Independent ID: 33016833-3701-1deb-afdf-6cf0b77688ac
Content: Weighted average date with Include physical value and marking - Supply Chain Management | Dynamics 365
Content Source: articles/supply-chain/cost-management/weighted-average-date.md
Service: dynamics-365-supply-chain
GitHub Login: @JennySong-SH
Microsoft Alias: yanansong

Bug 776119 has been logged to address this issue.


Compatibility issues with google-api-python-client 2.0+

we have been using google-api-python-client 2.0+ for a while now.
I tried to upgrade to endpoint2.0, both libraries have dependency on oauth2client.
Is this a know issues or is there any work around.

Any update on update to supported libraries. We can't downgrade other libraries to use this package. is there any chance on ETA when this can be fixed?

Can you please explain the difficulty? I can't find a google-api-python-client 2.0+; all I can find is google-api-python-client 1.6.4.
google-api-python-client 1.6.4 requires oauth2client>=1.5.0,<5.0.0dev, while the Endpoints frameworks require  oauth2client>=2.0.0,<4.0.0dev. oauth2client 3.0.0 would seem to satisfy both requirements.

Did you see the fix on https://github.com/cloudendpoints/endpoints-management-python/issues/21 ? Does that fix the issue for you?

I figured the issue, the library is not compatible with oauth2client 4.0.0, I figured it out after a day.
I used the oauth2client 3.0.0 that worked.
I was already using oauth2client 4.0.0, I installed endpoint 2.3 with pip, it installed smoothly and added apitools latest version which has:
from oauth2client import locked_file
ImportError: cannot import name locked_file

Yes, you have to be very careful about which versions you use. Unfortunately, some of these libraries are not actively in development, but we do not have the resources at this time to switch to newer libraries. If you stick to the versions specified by our requirements, you should be fine.


Error when training a supervised linear classifier on EuroSAT from a pre-trained SeCo model

I encountered error when running this script:
python main_eurosat.py --data_dir data/eurosat --backbone_type pretrain --ckpt_path checkpoints/seco_resnet50_100k.ckpt
Traceback (most recent call last):
  File "main_eurosat.py", line 89, in <module>
    trainer.fit(model, datamodule=datamodule)
  File "/home/chandler_doloriel/.conda/envs/seasonal-contrast/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 510, in fit
    results = self.accelerator_backend.train()
  File "/home/chandler_doloriel/.conda/envs/seasonal-contrast/lib/python3.7/site-packages/pytorch_lightning/accelerators/accelerator.py", line 57, in train
    return self.train_or_test()
  File "/home/chandler_doloriel/.conda/envs/seasonal-contrast/lib/python3.7/site-packages/pytorch_lightning/accelerators/accelerator.py", line 74, in train_or_test
    results = self.trainer.train()
  File "/home/chandler_doloriel/.conda/envs/seasonal-contrast/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 532, in train
    self.run_sanity_check(self.get_model())
  File "/home/chandler_doloriel/.conda/envs/seasonal-contrast/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 731, in run_sanity_check
    _, eval_results = self.run_evaluation(max_batches=self.num_sanity_val_batches)
  File "/home/chandler_doloriel/.conda/envs/seasonal-contrast/lib/python3.7/site-packages/pytorch_lightning/trainer/trainer.py", line 643, in run_evaluation
    output = self.evaluation_loop.evaluation_step(batch, batch_idx, dataloader_idx)
  File "/home/chandler_doloriel/.conda/envs/seasonal-contrast/lib/python3.7/site-packages/pytorch_lightning/trainer/evaluation_loop.py", line 171, in evaluation_step
    output = self.trainer.accelerator_backend.validation_step(args)
  File "/home/chandler_doloriel/.conda/envs/seasonal-contrast/lib/python3.7/site-packages/pytorch_lightning/accelerators/gpu_accelerator.py", line 73, in validation_step
    return self._step(self.trainer.model.validation_step, args)
  File "/home/chandler_doloriel/.conda/envs/seasonal-contrast/lib/python3.7/site-packages/pytorch_lightning/accelerators/gpu_accelerator.py", line 65, in _step
    output = model_step(*args)
  File "main_eurosat.py", line 39, in validation_step
    loss, acc = self.shared_step(batch)
  File "main_eurosat.py", line 46, in shared_step
    logits = self(x)
  File "/home/chandler_doloriel/.conda/envs/seasonal-contrast/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "main_eurosat.py", line 29, in forward
    logits = self.classifier(feats)
  File "/home/chandler_doloriel/.conda/envs/seasonal-contrast/lib/python3.7/site-packages/torch/nn/modules/module.py", line 727, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/chandler_doloriel/.conda/envs/seasonal-contrast/lib/python3.7/site-packages/torch/nn/modules/linear.py", line 93, in forward
    return F.linear(input, self.weight, self.bias)
  File "/home/chandler_doloriel/.conda/envs/seasonal-contrast/lib/python3.7/site-packages/torch/nn/functional.py", line 1690, in linear
    ret = torch.addmm(bias, input, weight.t())
RuntimeError: mat1 dim 1 must match mat2 dim 0

Hi,
I encountered the same issue, which comes from the model initialisation in main_eurosat.py. It is hard-coded for in_features=512, corresponding to the dimension of the feature vector provided by a pre-trained resnet18 encoder. In the case of resnet50, this output vector is of dimension 2048. Hence, you can modify the line 83 from:
model = Classifier(backbone, in_features=512, num_classes=datamodule.num_classes)
to
model = Classifier(backbone, in_features=2048, num_classes=datamodule.num_classes)
Hope it helps.
Xavi


get_account_history with wring information

Expected behavior
Receive the next 10 posts after 12240294 block using  {"id":1,"method":"get_account_history","params":["augustol","12240294","10"]}
Actual behavior
Receiving the posts with lower block number
How to reproduce
if you try {"id":1,"method":"get_account_history","params":["augustol","12240294","10"]}
you will see that the first result has a lower block number is higher than 12240294
 [
    [568, {
      "trx_id": "ef27af0ff7d09f98e02160352ec1c926021a98f0",
      "block": 12233137,
      "trx_in_block": 10,
      "op_in_trx": 0,
      "virtual_op": 0,
      "timestamp": "2017-05-25T08:35:18",
      "op": ["custom_json", {
        "required_auths": [],
        "required_posting_auths": ["augustol"],
        "id": "follow",
        "json": "[\"follow\",{\"follower\":\"augustol\",\"following\":\"sarasate\",\"what\":[\"blog\"]}]"
      }]
    }]

Here are the parameters for get_account_history:
      /**
       *  Account operations have sequence numbers from 0 to N where N is the most recent operation. This method
       *  returns operations in the range [from-limit, from]
       *
       *  @param from - the absolute sequence number, -1 means most recent, limit is the number of operations before from.
       *  @param limit - the maximum number of items that can be queried (0 to 1000], must be less than from
       */
      map<uint32_t, applied_operation> get_account_history( string account, uint64_t from, uint32_t limit )const;

(It paginates by sequence numbers, not by block numbers!)

thanks @roadscape , and what should I use as sequence number? what does it mean?

If an account has had 5k operations, the sequence numbers would be 0 to 4999.
You can call get_account_history account -1 1000 to get the latest 1000 items, and you should see the sequence numbers in the response to keep paginating further back.


add sign in with google option

Add a 'Sign in with Google' option to enhance user authentication. This feature will allow users to log in using their Google accounts, improving convenience and streamlining the sign-in process.

Please assign this issue to me i can solve it. Please assign it under gssoc-24extd and hacktoberfest accepted


Static files inserted into the article weren't found

The feature image of the article and the icon-font of the blog were not loaded correctly.

See how to solve this problem here:https://github.com/Misiur/buster/issues/3
I have solved about everything under the help of Misiur except the RSS, but everything else look fine.


Feat: Xcm filter

Added future Transaction types for XCM
Filter by XCM
Moved <OperationFilter /> to features

Task linked: CU-862kbavtt Update Operations filter for cross-chain transfers


[BUG] SourceCache.Sort does not update on data or comparer change

Describe the bug
When using SourceCache.Sort( Observable<IComparer<>> ) , only first value from observable is being used, following values are ignored. Also, data is not sorted correctly upon insert
Seems the issues is
QueryWhenChanged<TObject, TKey, TValue> uses Cache<TObject, TKey> that does not handle data changes except add and remove.

Cache<TObject, TKey>.Clone(IChangeSet<TObject, TKey> changes) ignores ChangeReason.Moved changes by design, and changing comparer & data produces these changes;

I've tried to set resetThreshold to 1 to trigger reset on each comparer change, but it produces 0 changes and cache does not update.

Steps To Reproduce
static void Main( string[] args )
{
      SourceCache<int, int> test = new SourceCache<int, int>( _=>_.GetHashCode() );

      test.AddOrUpdate( 1 );
      test.AddOrUpdate( 3 );
      test.AddOrUpdate( 2 );

      var sort = Observable.Interval( TimeSpan.FromSeconds( 1 ) )
                             .Select( i =>
                                      {
                                        if( i % 2 == 0 )
                                        {
                                          return SortExpressionComparer<int>
                                           .Ascending( _ => _ );
                                        }

                                        return SortExpressionComparer<int>
                                         .Descending( _ => _ );
                                      } );

      test.Connect( )
          .Sort( sort )
          .ToCollection( )
          .Subscribe( ints => { Console.WriteLine( string.Join( ",", ints.Select( _=>_.ToString() ) ) ); } );

      Console.ReadLine( );
}

Produces :
1,2,3
1,2,3
1,2,3
 static void Main( string[] args )
    {
      SourceCache<int, int> test = new SourceCache<int, int>( _=>_  );

      test.AddOrUpdate( 1 );
      test.AddOrUpdate( 4 );
      test.AddOrUpdate( 2 );

      test.Connect( )
          .Sort(SortExpressionComparer<int>.Ascending( _ => _ ) )
          .ToCollection( )
          .Subscribe( ints => { Console.WriteLine( string.Join( ",", ints.Select( _=>_.ToString() ) ) ); } );

      test.AddOrUpdate( 3 );

      Console.ReadLine( );
    }

Produces :
1,2,4
1,2,4,3
Expected behavior

Expected output to change from 1,2,3 to 3,2,1 and back
Expected <IP_ADDRESS>

Environment

OS:       Windows 10
Device:   PC
Version:  6.13.19
Working Version:  6.13.19

Additional context
SourceList is behaving as expected
static void Main( string[] args )
    {
      SourceList<int> test = new SourceList<int>( );

      test.Add( 1 );
      test.Add( 3 );
      test.Add( 2 );

      var sort = Observable.Interval( TimeSpan.FromSeconds( 1 ) )
                             .Select( i =>
                                      {
                                        if( i % 2 == 0 )
                                        {
                                          return SortExpressionComparer<int>
                                           .Ascending( _ => _ );
                                        }

                                        return SortExpressionComparer<int>
                                         .Descending( _ => _ );
                                      } );

      test.Connect( )
          .Sort( sort )
          .ToCollection( )
          .Subscribe( ints => { Console.WriteLine( string.Join( ",", ints.Select( _=>_.ToString() ) ) ); } );

      Console.ReadLine( );
    }

Produces:
1,2,3
3,2,1

SortedChangeSet contains SortedItems, that can be used to populate QueryWhenChanged.Run result,
I've made quick hack to test it and it achieves desired result, but there has to be better solution
if( changes is SortedChangeSet<TObject, TKey> change )
{
    cache.Clear(  );
    foreach( var pair in change.SortedItems )
    {
        cache.AddOrUpdate( pair.Value, pair.Key );
    }
}
else
{
    cache.Clone(changes);
}

ToSortedCollection() was introduced to solve this problem. Have you tried it?

I did   .ToCollection( ) to make the simplest example possible, but I'll keep it in mind, thank you.
I've encountered this behavior binding SourceCache to GUI through BindingList and finding out sorting did not work as expected, so I've made additional observer to see the collection as-is and it did show that collection was not modified.
Do you have any advice how to deal with binding issue ?
I have quite straightforward setup
_cache.Connect( )
          .AutoRefreshOnObservable(Reevaluator )
          .Filter(FilterObservable)
          .Sort(SortObservable)
          .ObserveOn( RxApp.MainThreadScheduler )
          .Bind( _display_list )
          .Subscribe( )
          .DisposeWith( this );

but it's not working with SourceCache, only with SourceList

Nevermind, I found out the reason binding was not working as expexted -- i've passed observable as
IObservable<IChangeSet<Key, Value>>, not as  IObservable<ISortedChangeSet<Key, Value>> and it used extension with adapter without move handling,
Sorry that i've bothered you, I'm closing the issue


nixos/test-driver: accept non-\w* filenames

Description of changes
What the code was trying to do was helpfully add a directory and extension if none were specified, but it did this by checking whether the filename was composed of a very limited character set that didn't even include dashes.
With this change, the intention of the code is clearer, and I can put dashes in my screenshot names.
Things done

Built on platform(s)

[x] x86_64-linux
[ ] aarch64-linux
[ ] x86_64-darwin
[ ] aarch64-darwin

[ ] For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
[ ] Tested, as applicable:

NixOS test(s) (look inside nixos/tests)
and/or package tests
or, for functions and "core" functionality, tests in lib/tests or pkgs/test
made sure NixOS tests are linked to the relevant packages

[ ] Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
[ ] Tested basic functionality of all binary files (usually in ./result/bin/)
23.05 Release Notes (or backporting 22.11 Release notes)

[ ] (Package updates) Added a release notes entry if the change is major or breaking
[ ] (Module updates) Added a release notes entry if the change is significant
[ ] (Module addition) Added a release notes entry if adding a new NixOS module

[x] Fits CONTRIBUTING.md.

@ofborg test login


Venn chart

Hi all,
could someone help with such questions?
1 is it possible to increase the distance between bubbles on the Venn chart diagram by code?
2 could we add somehow custom text below bubbles?
thank you!

Can you move this to discussions?


Update meta.yaml and workflow to fetch git tag on master

Summary of changes (Bug fix, feature, docs update, ...)
The value for the git tag is now fetched from the environment and passed into the conda recipe for the conda build.
This ensures that the conda build on the master branch works as expected when the master is tagged instead of devel.

Please check if the PR fulfills these requirements

[x] Closes #946  (Replace xxxx with the Github issue number)
[x] Tests added and passed if fixing a bug or adding a new feature
[x] Added any new requirements to requirements.txt and recipes/meta.yaml
[x] Documentation and tutorials updated/added

Thanks Matt for your detail review and suggestions. As of changes required in current PR, I have updated those. And generated a separate issues to apply for enhanced workflow.


new resource for azure: azurerm_synapse_workspace

Ii would like to add the resources that are attached to synapse analytics:
terraform resource:  azurerm_synapse_workspace
https://azure.microsoft.com/en-us/pricing/calculator/
supporting resources:

azurerm_synapse_private_link_hub
azurerm_synapse_spark_pool
azurerm_synapse_sql_pool
azurerm_synapse_managed_private_endpoint

this is what i found in the cloudpricing database:
> db.products.distinct("service", {"vendorName": "azure", "service": {$regex: "synapse", $options: "i"} });
[ "Azure Synapse Analytics" ]
> db.products.distinct("productFamily", {"vendorName": "azure", "service": "Azure Synapse Analytics"})
[ "Analytics" ]
> db.products.distinct("attributes.productName", {"vendorName": "azure", "service": "Azure Synapse Analytics", "productFamily": "Analytics" });
[
        "Azure Synapse Analytics Data Flow - Compute Optimized",
        "Azure Synapse Analytics Data Flow - General Purpose",
        "Azure Synapse Analytics Data Flow - Memory Optimized",
        "Azure Synapse Analytics Log and Time Series Query",
        "Azure Synapse Analytics Managed VNET",
        "Azure Synapse Analytics Multi-Cluster SQL Pool",
        "Azure Synapse Analytics Pipelines",
        "Azure Synapse Analytics Reservation",
        "Azure Synapse Analytics SQL Disaster Recovery Storage",
        "Azure Synapse Analytics SQL Provisioned DWU",
        "Azure Synapse Analytics SQL Provisioned Disaster Recovery Storage",
        "Azure Synapse Analytics SQL Provisioned Storage",
        "Azure Synapse Analytics SQL Storage",
        "Azure Synapse Analytics Serverless SQL Pool",
        "Azure Synapse Analytics Storage",
        "Azure Synapse Analytics Dedicated SQL Pool",
        "Azure Synapse Analytics Serverless Apache Spark Pool - Memory Optimized"
]

from what I know from synapse, these products/costs are usage based for the workspace:
"Azure Synapse Analytics Data Flow - Compute Optimized",
"Azure Synapse Analytics Data Flow - General Purpose",
"Azure Synapse Analytics Data Flow - Memory Optimized",
"Azure Synapse Analytics Storage",
"Azure Synapse Analytics Pipelines",
"Azure Synapse Analytics Serverless Apache Spark Pool - Memory Optimized"
"Azure Synapse Analytics Data Flow - Compute Optimized",
"Azure Synapse Analytics Data Flow - General Purpose",
"Azure Synapse Analytics Data Flow - Memory Optimized",
azurerm_synapse_sql_pool -> "Azure Synapse Analytics Dedicated SQL Pool"

so i have been searching in the pricing for synapse and found the following for the data flows:
         Name                                      Monthly Qty  Unit  Monthly Cost

         azurerm_synapse_workspace.example
         ├─ Serverless SQL pool size (first 10TB)           10  TB           $0.00
         ├─ Serverless SQL pool size                         2  TB          $10.00
         ├─ Data flow - general purpose                    730  hour       $195.45
         ├─ Data flow - compute optimized                  730  hour       $145.47
         └─ Data flow - memory optimized                   730  hour       $251.86

the dataflow numbers need to be multiplied by the number of vcores and instances

145.47 * 8 * 1  = 1,163.76 but how do I multiply the price when it comes back as vcore per hour?
db.products.find({"vendorName": "azure", "service": "Azure Synapse Analytics", "productFamily": "Analytics", "region": "westeurope", "attributes.productName": "Azure Synapse Analytics Data Flow - Compute Optimized" }).pretty()
{
        "_id" : ObjectId("606c625838ebcb6d079a3aee"),
        "productHash" : "05749a529c3a4b1501b2419665ce51ec",
        "attributes" : {
                "effectiveStartDate" : "2021-03-01T00:00:00Z",
                "productId" : "DZH318Z0CGNF",
                "productName" : "Azure Synapse Analytics Data Flow - Compute Optimized",
                "serviceId" : "DZH3194T4H8H",
                "serviceFamily" : "Analytics",
                "skuName" : "vCore",
                "armSkuName" : "",
                "meterId" : "825e2f6c-9c7e-55ad-b649-54a0e02655cc",
                "meterName" : "vCore"
        },
        "productFamily" : "Analytics",
        "region" : "westeurope",
        "service" : "Azure Synapse Analytics",
        "sku" : "DZH318Z0CGNF/0015/825e2f6c-9c7e-55ad-b649-54a0e02655cc",
        "vendorName" : "azure",
        "prices" : [
                {
                        "priceHash" : "05749a529c3a4b1501b2419665ce51ec-60fc60896424f2f0b576ec5c4e380288",
                        "purchaseOption" : "Consumption",
                        "unit" : "1 Hour",
                        "USD" : "0.199272",
                        "effectiveDateStart" : "2021-03-01T00:00:00Z",
                        "startUsageAmount" : "0"
                }
        ]
}

Thanks for the awesome investigation! I haven't dug into this service's pricing yet but here's how I think we can handle the cost calc:
		Name:           "Data flow - general purpose",
		Unit:           "hours",
		UnitMultiplier: schema.HourToMonthUnitMultiplier,
		HourlyQuantity: decimalPtr(numberOfCores),

Is the number of cores coming from the usage file or is there a way to detect that from Terraform? If it's the usage file, are all 3 types of Data flow always applicable? In general, we try to only show applicable prices to reduce the noise for users, so:

If all 3 are always applicable, and there's no usage file: show all 3 but with the usual "cost depends on usage" method.
If all 3 are always applicable, and there's a usage file: show all 3 but the ones that have usage should show cost, the others should show price.
If only one applies for a resource instance, then we should show "Data flow (general purpose)" since there's only one applicable data flow cost component and the bit in brackets is meta data.

these dataflow components are activities inside https://docs.microsoft.com/en-us/azure/data-factory/control-flow-execute-data-flow-activity#type-properties so they can all be active at some point depending on your usage of synapse. what I can do is show a general message:
" Data flow - Monthly cost depends on usage: between $0.0228 and $0.0321 per hour

i tried your suggestion but it makes the overview a bit weird:
return &schema.CostComponent{
		Name:           name,
		Unit:           "hour",
		UnitMultiplier: schema.HourToMonthUnitMultiplier,
		HourlyQuantity: decimalPtr(vCores),

the costs match the calculator but the quantity isn't matching
 +
        + Name                                      Monthly Qty  Unit  Monthly Cost
        +
        + azurerm_synapse_workspace.example
        + ├─ Serverless SQL pool size (first 10TB)           10  TB           $0.00
        + ├─ Serverless SQL pool size                         2  TB          $10.00
        + ├─ Data flow - general purpose                      8  hour     $1,563.62
        + ├─ Data flow - compute optimized                    8  hour     $1,163.75
        + └─ Data flow - memory optimized                     8  hour     $2,014.92
        +
        + OVERALL TOTAL                                                   $4,752.28

that 8 hour should be 730 hour

I think we can use the units "vCPU" instead of "hours", we do something similar for azurerm_function_app.

" Data flow - Monthly cost depends on usage: between $0.0228 and $0.0321 per hour "

Unfortunately we don't support ranges yet (it'll require some schema changes to our JSON too), and given that all 3 could be active at any point, showing 3 cost components makes sense.

@dgcaron heads-up that the contributing docs have been updated as we released the new Cloud Pricing API yesterday: https://github.com/infracost/infracost/pull/882/files
Please let us know how you get on as I'm sure we have lots to improve...

sorry about the slow progress on this one but the pricing structure appears to have changed during my holiday. checkout this twitter thread about my findings:
https://twitter.com/dgcaron/status/1427345352844251141

@alikhajeh1 how do i handle these auto scale settings?

do it take the min or max or is there a different way of solving this?

@dgcaron I'd add a node_count usage file param and if that's not set, use the min_node_count. We don't yet support a range in the output.
Also, FYI @xeger is prototyping a feature that enables the CLI to hit the cloud vendor APIs to get actual counts so longer term that could be used to set the node_count automatically.

so i added the spark pool resource and the output looks like this:

the vCore hour thing might be a bit confusing (ok, it IS), but it is consistent with what Microsoft is saying in their docs:

in order to get to the right costs, you need to convert the node_size into the number of vCPU it represents. the calculator is incomplete as there are more options when you configure using the portal. I'll open a PR at TF to add these bigger node_sizes.
then multiply that by the number of instances that are in the cluster and multiply that by the number of hours the cluster is actually running.
i also included the temporary free hours that are valid until the 31st of December this year and subtract those from the total calculated vcore-hours. we do need to drop this at the moment these free hours are no longer valid. should we open a separate ticket for that when this PR is finished?

@dgcaron that's awesome! I'll review the PR in the next day or two. Re the free hours, sure that works. We've been ignoring the free tiers as it's not possible to tell what counts as free for a given IaC project since we might not be seeing all resources in an account (which is usually how the free tiers are applies, not on a per-resource basis, but for the resources that have a free per-resource tier, then what you've done makes sense)

Many thanks @dgcaron! The PR is merged and the associated docs PR is here, it'll go live in next week's release.

Thank you for the patience and guidance!


Add lock root directory function

my google drive have 2 drives: one for myself , another for google group drive (shared drive).
I want to lock root directory, and set parameters： default_root_id: 'shareddriveid'.   But anyone can switch to any drive when I add a shared drive  as root directory.

i found it : return ""
async listDrive() {
return "";
}


The size_hint in HttpBody can change behavior when making GET requests with bodies

This is a subtle one! Bodies for GET requests are ignored, unless the HttpBody::size_hint provides an exact size, in which case they are transmitted. The size_hint should not affect behavior in this way, AIUI.
I was using the general Client::request API to pass through a request that happened to be a GET with a body.

Hmmm, so you have a custom type implementing size_hint that returns a possible range instead of an exact size, is that right? It does seem that if you declare there is some size hint, it should mean the body should be sent with a transfer-encoding: chunked header. Is that what you'd expect as well?

I have a custom type that, depending on the situation, may return the default size hint (unbounded), or else an exact size. My surprise was that for a GET request, the size hint affected whether the body was sent at all. I would expect that if Hyper drops the body when making GET requests, it would so so in all cases, regardless of the size hint for the body.

I see, I'm starting to remember now. So, while very rare, it's legal to send a body with a GET. So hyper settled on these rules, currently:

If there's a content-length or transfer-encoding header explicitly, that wins.
If the body has an exact size, we'll send a content-length.
Otherwise, we'll assume you didn't mean to implicitly send a transfer-encoding body, which would possibly be empty and thus the server will find it weird.

Roger that! Thanks for the clarification. If this is intended behavior, I wonder if it could be added to documentation, in case others trip over the same issue.

I think this is subtly related to https://github.com/hyperium/hyper/issues/2427


Century, RISM Siglum not in admin interface

Currently, one cannot add or edit Century or RISM Siglum objects via the django admin panel:

Before I make changes to make them display: Is this by design, or is this an oversight? Are we confident that Centuries and RISM Sigla are all correct as they are currently, and that the project manager will never need to add new ones?

I'm not sure why they are not added to the admin interface. They are present in the old Cantus "taxonomy manager", so I think they should be added to the admin interface.


Repository

I can't seem to find a repository with the jbender artifact.
Have I missed something obvious?

We have not (yet) uploaded this archive to Maven. For now you would have to build it locally.


Added Private DNS Zone Group

Reference:
https://www.terraform.io/docs/providers/azurerm/r/private_endpoint.html#private_dns_zone_group

LGTM 👍 🚢

Thank you @catay


Payment for 3bot deployer

In case of failure developments for 3bot, and the user decides to remove the deployment as it is not working, he will lose his money.
As a suggestion
Option A

any pool will be created for 3bot should be named <3bot name>-<instance name>
in case of failure, it should search for pools that starts his 3bot name, then get the deployed instance for this pool
if the instance is exist, then keep it and create a new pool for the new development. If it is not exist, then take this pool and extend it to complete the expiration time, then rename the pool to the new instance.

Problem: in case of creating a new instance with less expiration time than that in the pool, we can't stop the deployment in time and the user will lose some money.
Option B

we have a funded wallet
when the user wants to create an instance, we can create a pool for this instance from this wallet for an hour
then he can extend it later

Problem: users can abuse this , also complex for users
Option C

we have a funded wallet
when the user wants to create an instance, we can transfer his tokens to this wallet, then creates a pool and an instance from this wallet
can be refunded in case of failure from this wallet

Problem: we will lose some tokens for every failure, too many transactions
Enhancement can be done for A, C options

use scheduler to handle the expiration.
it will introduce more complexity in the design.

TL, DR

we have a funded wallet with 3bot deployer
when the user wants to create an instance, we can create a pool for this instance from this wallet for 15 mins from this wallet.
then in success case, it will be asked for extending in the same chatflow. And in case of failure, he will be refunded from the explorer for the failure from extending the pool.
also in case of later failure, 3bot can be removed and reuse its pool.

will be implemented according this adr: https://github.com/threefoldtech/js-sdk/blob/development/docs/architecture/decisions/0007-payment-for-3bot-deployer.md

initializing

payment & finishing

final expiration

Verified
commit: 1418d60220a01fdb7045d51f30f0ed385d1c17f2
branch: development

Still in deploying steps, and deployed for 15 mins.

Extending in the same deploying steps.

After extending and payment.


reduction_factor as a float

it would be useful if the reduction_factor was simply a float..
int(hidden_size/reduction_factor)
For example, you currently can't specify a reduction factor of 1.5 or 2.5
I have experimented with some of my own proprietary models yielding an optimum with a reduction factor of 2. (as opposed to 1 or 3)
Values of less than one could expand, which I would think would be unusually beneficial.

Yes, this totally makes sense. In case you already implemented and experimented with the change, I'd be happy for a PR from your side (please use the develop branch as base). Otherwise, we'll look into it.


Device count

I have 13 thermostats installed but it seems the integration is only ever showing 10 of them.

Apparently the api returns only first 10 by default. But it can be changed fortunately. I will edit this when I touch the codebase next time

@Tvinn-zz: I think I fixed it. Please update the integration, and try to add again

Yes indeed you did, awesome! Now all devices are found.
Also, great job with the integration, been looking for something like this for a while and discovered it today.


Refactor config passing

Over time we've begun passing the generic control.Options struct pretty much everywhere in the codebase. While this makes it simple to thread values all through the stack, it makes it difficult to

make fine-grained behavior changes to config values
understand what operation/service/data types are controlled by what config parameters
understand when config info is initialized at runtime

Furthermore, some exported functions take the Options struct directly meaning that it's now exposed to SDK users in multiple places
Other places in the code take config parameters even though they have access to the config struct, making it even more difficult to determine where config info is coming from and how it's being used
After more attempts to refactor a small part of this, I think it's more sensible to move towards a system where packages control their own config structs and callers are responsible for arranging the data properly when calling them. This allows for package-level isolation (reduces PR size for config changes) while still allowing some amount of flexibility since we have existing structs/wiring for passing config info down the stack. It also helps isolate SDK users from an ever-growing set of internal config values that we may or may not want them to have access to
We should also more carefully isolate config info on a per-operation basis. This means that every operation should take a separate config struct and only options related to that operation should be present in the struct. We should no longer assume that Connect and Init can take and configure all config parameters

#4736 is related


use hasOwnProperty

Weird bug, we were hitting prototype methods on certain objects - namely 'watch' on firefox. Could also have been triggered by 'constructor' or similar on other browsers, guess we were just lucky we didn't. This should fix it - thanks!

semver patch
closes https://github.com/yoshuawuyts/wayfarer/issues/58
resolves https://github.com/webcompat/web-bugs/issues/5699
cc/ @jongacnik could you verify this fixes your issues?

Coverage remained the same at 97.222% when pulling debeaa5db93071c87b007b1a4342ef1b7feb6eaa on hasownprop into 040bd3ae9857b6b2258aa75af08e41e5e8518add on master.

v6.5.1

@yoshuawuyts yep, working great.

yay!
On Mon, Apr 17, 2017 at 8:31 PM Jon Gacnik<EMAIL_ADDRESS>wrote:

@yoshuawuyts https://github.com/yoshuawuyts yep, working great.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/yoshuawuyts/wayfarer/pull/59#issuecomment-294552950,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACWlepHuDU5HV8hoJMpMAarTS6VwzGuzks5rw6_5gaJpZM4M_UXg
.


ItemReorder: onDragStart / onDragEnd events.

Short description of the problem:
Trying to find a way to disable swipe for ion-menu during active reordering. ionDragStart / ionDragEnd events would be very helpful.
Which Ionic Version? 2.x

Hello, thanks for using Ionic! You can use this method in MenuController to disable and enable menu swiping. Would that work for you use case?

thanks for the reply! yeah, I know how to disable menu swipe, but I need to disable it on dag start and enable back on drag end. so the problem is I can't find drag start event.

Hello, sorry for the misunderstanding! So the correct way to do this would be to listen to the reorder variable and when that is true disable drag and when it is false enable drag. Thanks for using Ionic!

Hey @jgw96, sorry, but this is not what I was asking ( Will try to explain with more details.
So the original problem in the our app: it has list with reorder="true" attr, and also it has menu on the right side. When user starts dragging it can make the menu to show accidently. So I want to disable swipe for menu (through this method when drag starts. But I can't find a way to know when the drag starts. So I expect the template to be smth like this:
<ion-item-group reorder="true" (ionOnDragStart)="disableMenuSwipe()">

Thanks!

Hey, @jgw96,  did you have a chance to look at my last comment?


Reset confirm button

A button that asks to confirm the reset.
Ex. ''Are you sure want to reset your balloons?''

This feature is implemented in #74


Example of how to use UpsertManyAsync ?

Can you offer an example of how to implement UpsertManyAsync in code ?

There is no UpsertMany in the underlying LiteDb but Upsert (and therefore UpsertAsync) can accept a IEnumerable, which I assume is the equivalent functionality
I have added a unit test to demonstrate this functionality https://github.com/mlockett42/litedb-async/blob/cfefdf4b9fdd92470badbf273c83cd967e52d3d9/litedbasynctest/Database/Upsert_Many_Tests.cs


Big error in quickstart documentation

import biosppy
import numpy as np
import pyhrv.tools as tools
from opensignalsreader import OpenSignalsReader

# Load sample ECG signal & extract R-peaks using BioSppy
signal = OpenSignalsReader('./samples/SampleECG.txt').signal('ECG')
signal, rpeaks = biosppy.signals.ecg.ecg(signal, show=False)[1:3]

# Compute NNI
nni = tools.nn_intervals(rpeaks)

pyhrv.tools.nn_intervals() takes in rpeaks (array): R-peak times in [ms] or [s].
The problem is that the rpeaks parameter returned by biosppy.signals.ecg.ecg() does NOT contain R-peak times in [ms] or [s], instead it contains the integer indices of the R-peaks.
Our research team had been working with faulty HRV calculations for half a year before we just now noticed the issue...

Hi @jdevoldere,
thank you very much for using pyHRV and my apologies for this unfortunate and undesirable situation. Thank you for alerting for this issue so that other users could be aware of that and I hope that you were still in time to catch this error for your results.
You are correct, there is indeed a key error in the presented sample codes that appears to occur across multiple samples in pyHRV.
I am providing below the correct code which computes the R-peak locations based on the indices and the time vector provided by biopsy:
import biosppy
import numpy as np
import pyhrv.tools as tools
from opensignalsreader import OpenSignalsReader

# Load sample ECG signal & extract R-peaks using BioSppy
signal = OpenSignalsReader('./samples/SampleECG.txt').signal('ECG')
t, signal, rpeaks = biosppy.signals.ecg.ecg(signal, show=False)[:3]

# Compute NNI
nni = tools.nn_intervals(t[rpeaks])

I will correct the sample codes with the next update. My apologies and thanks for the alert!


fix: update name don't need to re-render the inline editor when creating a new trigger

Description
update the name will update the formdata.intent. Then the formdata.intent will update the luOption and luOption will trigger the inline editor re-render. The monaco-editor will have two requests when re-rendering.
In this PR use placeholder to fix the luoption and avoid the editor to re-render.

Task Item
closes #3967

Screenshots

Coverage increased (+0.006%) to 56.747% when pulling d9ba2552b32cbed600e63e0a33cd3628ecfab550 on lei9444:createTrigger into 28942a6fc443e0379df4c81f83130038e95b0e8e on microsoft:main.


Question: Can Lila be used with BanksiaGUI?

I have tried to add lila as an engine for BanksiaGUI, but I haven't been able to figure out how to configure it. Banksia returns an error "This engine doesn't support the selected protocol".

For me it works fine. UCI protocol works correctly, so there's no reason to fail in Banksia.
Alex

@AlexBrunetti can you please share how you configured it? thank you

Well, here there is only a jar file, Banksia can't run directly a jar file. You should write a batch file, call it for example lila.bat and write into it: java -jar "Lila 3.0.1 64-bit.jar" (or whatever name has your .jar file). Then install into Banksia lila.bat. Obviously you should have Java installed in your machine.
Alex

Ha ha... I have tried setting the command to "java -jar lila_3.jar" and hoped it will work. Next I tried the sh file and that still did not work. This is very odd.
My file:
#!/usr/bin/env bash
SCRIPTDIR=$(dirname "${BASH_SOURCE[0]}")
/usr/bin/java -jar "$SCRIPTDIR/lila_3.jar"

What happens if you launch the script in your shell (not from Banksia)?
Alex

It displays what I'd expect: Lila 3.0.1 by StylexTV

So it's only a matter of how to call the script in Banksia under Linux. I cannot help anymore but I can suggest you to join talkchess.com and ask in the forum, there're many Linux users there.
Alex

I have a clue what might be happening... the env in which Banksia runs the script might not be initialized completely. Sure go ahead an close this.


[Jakarta] kogito-apps: SpringBootTrustyExplainabilityEnd2EndIT failing

repo/branch: kogito-apps:2.x
Tests failing:

org.kie.kogito.it.trusty.SpringBootTrustyExplainabilityEnd2EndIT.doTest

Error message:
Container startup failed

Stacktrace:
No relevant stacktrace ...

@radtriste Is this ticket still valid, please?

I guess not


Vagrant File

We can have a Vagrant file. That would make the setup one step easy.
May be we can mark it as enhancement.

Vagrantfiles are not required for creating Docker Machine as docker-machine does that task. All the configuration needs to be done using that script.


New ODE solvers: Dopri8 and Tsit5

This PR introduces new ODE solvers from diffrax, each having its own motivation:

Dopri8: to have very accurate solutions for demanding tolerances (probably for float64). It may also serve as a reference to compare fidelities between other solvers.
Tsit5: as a replacement to Dopri5, the ODE community says it's more efficient. I tested on a few examples, it is indeed slightly better (by a few % in speedup). We should keep Dopri5 though if we want to also compare eye-to-eye with QuTiP.

Sources:

Patrick Kidger diffrax doc > https://docs.kidger.site/diffrax/usage/how-to-choose-a-solver/
Christopher Rackauckas blog > https://www.stochasticlifestyle.com/comparison-differential-equation-solver-suites-matlab-r-julia-python-c-fortran/

I also propose to reduce the default rtol/atol to match the default precision (float32), the current default is a bit low compared with machine precision.
We're only missing implicit solvers (for stiff problems), see https://linear.app/dynamiqs/issue/DYN-159/add-implicit-ode-solvers.

Quick comparison of Tsit5 and Dopri5 on mesolve
Lossy oscillator:
import dynamiqs as dq
from jax import numpy as jnp

for n in [32, 64, 128]:
    print(f'=== n={n}')
    a = dq.destroy(n)
    delta = 1.0 * 2 * jnp.pi
    alpha0 = 2.0
    kappa = 1.0 * 2 * jnp.pi / 4
    H = delta * dq.dag(a) @ a
    Ls = [jnp.sqrt(kappa) * a, jnp.sqrt(kappa) * a]
    y0 = dq.coherent(n, alpha0)
    tsave = jnp.linspace(0, 1.0, 11)

    dq.mesolve(H, Ls, y0, tsave, solver=dq.solver.Tsit5()).ysave.block_until_ready()
    %timeit dq.mesolve(H, Ls, y0, tsave, solver=dq.solver.Tsit5()).ysave.block_until_ready()
    dq.mesolve(H, Ls, y0, tsave, solver=dq.solver.Dopri5()).ysave.block_until_ready()
    %timeit dq.mesolve(H, Ls, y0, tsave, solver=dq.solver.Dopri5()).ysave.block_until_ready()

=== n=32
16.8 ms ± 58 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
17.6 ms ± 23.8 µs per loop (mean ± std. dev. of 7 runs, 100 loops each)
=== n=64
37.6 ms ± 22.9 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
39 ms ± 52 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
=== n=128
47.8 ms ± 30 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
52.1 ms ± 28.7 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)

Cat inflation:
for n in [32, 64, 128]:
    print(f'=== n={n}')
    a = dq.destroy(n)
    alpha = 2.0
    k2 = 1.0
    H = dq.zero(n)
    Ls = [jnp.sqrt(k2) * (a @ a - alpha**2 * dq.eye(n))]
    y0 = dq.coherent(n, 0.0)
    tsave = jnp.linspace(0, 1 / k2, 11)
    dq.mesolve(H, Ls, y0, tsave, solver=dq.solver.Tsit5()).ysave.block_until_ready()
    %timeit dq.mesolve(H, Ls, y0, tsave, solver=dq.solver.Tsit5()).ysave.block_until_ready()
    dq.mesolve(H, Ls, y0, tsave, solver=dq.solver.Dopri5()).ysave.block_until_ready()
    %timeit dq.mesolve(H, Ls, y0, tsave, solver=dq.solver.Dopri5()).ysave.block_until_ready()

=== n=32
71.1 ms ± 38.2 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
75.6 ms ± 84.7 µs per loop (mean ± std. dev. of 7 runs, 10 loops each)
=== n=64
293 ms ± 544 µs per loop (mean ± std. dev. of 7 runs, 1 loop each)
305 ms ± 238 µs per loop (mean ± std. dev. of 7 runs, 1 loop each)
=== n=128
1.38 s ± 1.71 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)
1.45 s ± 1.02 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

Right, thanks for the clarifying comment. Is it correct that if you set a fairly low rtol/atol, Dopri5 will make extremely small steps and probably Dopri8 is better suited? I guess that's what I meant. From diffrax doc: « If you need accurate solutions at tight tolerances then try diffrax.Dopri8. ».

Are there any in diffrax?

Yes! See the issue description 😉


test(connector): add pg-sink compatible test

I hereby agree to the terms of the RisingWave Labs, Inc. Contributor License Agreement.
What's changed and what's your intention?
array only supports smallint, integer, bigint, real, double precision, varchar type now.

Checklist

[ ] I have written necessary rustdoc comments
[ ] I have added necessary unit tests and integration tests
[ ] I have added test labels as necessary. See details.
[ ] I have added fuzzing tests or opened an issue to track them. (Optional, recommended for new SQL features #7934).
[ ] My PR contains breaking changes. (If it deprecates some features, please create a tracking issue to remove them in the future).
[ ] All checks passed in ./risedev check (or alias, ./risedev c)
[ ] My PR changes performance-critical code. (Please run macro/micro-benchmarks and show the results.)

[ ] My PR contains critical fixes that are necessary to be merged into the latest release. (Please check out the details)

Documentation

[ ] My PR needs documentation updates. (Please use the Release note section below to summarize the impact on users)

Release note
If this PR includes changes that directly affect users or other significant modifications relevant to the community, kindly draft a release note to provide a concise summary of these changes. Please prioritize highlighting the impact these changes will have on users.

Is
array only supports smallint, integer, bigint, real, double precision, varchar type now.
a known issue?
if not, please create an issue for kernel and doc respectively

Is
array only supports smallint, integer, bigint, real, double precision, varchar type now.
a known issue?

https://github.com/risingwavelabs/risingwave/blob/main/java/connector-node/risingwave-connector-service/src/main/java/com/risingwave/connector/deserializer/StreamChunkDeserializer.java#L187-L202


fix: use moveDirectory instead of os.Rename

os.Rename could not move file/dir across different devices
close #1
Signed-off-by: STRRL<EMAIL_ADDRESS>

Thanks for your PR, have you tested in your machine?

And there is a lot of os.Rename operation inside cli. We may also consider migrate them in to the new method. @5kbpers

Thanks for your PR, have you tested in your machine?

yes! It works on my local machine.

@STRRL released, you can use lets upgrade to upgrade cli to latest v0.2.43

It seems lets upgrade also used os.Rename, so I failed to upgrade. 🤣🤣🤣

I would try to upgrade lets manaully.

f**k, is seems its urgent to change all of the os.Rename

@STRRL fixed in v0.2.44,you can use install script again to force upgrade your cli version


There is a repeated build error in the construction process of the consumption queue and index

Please describe the issue you observed:
If DuplicationEnable is true, repeated construction is allowed, so there is no need to judge that reputFromOffset is greater than comfirmOffset.
If DuplicationEnable is false, repeated construction is not allowed, so it is necessary to judge whether reputFromOffset is less than comfirmOffset.

Same as above.

Please tell us about your environment:

RocketMQ 4.8.0

if DuplicationEnable is true,

no judge : maybe a lot of reput io would do, that's a resource waste
do judge : no waste


Compability with Alpine.js

Describe the solution you'd like
Have ability to integrate Choices with Alpine.js like Vue do.

Include your select item in a div like this
and add on select item
x-ref="your_id"
Works also with livewire

@greenwebsas, I am trying to get this to work with Alpine and Livewire. Would you be ok to share your code?

I have another issue when trying to use choices with livewire. When i changing value in choices select, livewire property gets {value: 1} except of simple 1

I had the same problem. did you get the solution? @Briareos17

I have the same issue with alpinejs. Have anyone managed to solve this?
Reported in separate issue #1222


drawio: 13.3.5 -> 13.3.9

Motivation for this change
Changelog:
https://github.com/jgraph/drawio-desktop/releases/tag/v13.3.9
Things done

[x] Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
Built on platform(s)

[x] NixOS
[ ] macOS
[ ] other Linux distributions

[ ] Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
[ ] Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
[x] Tested execution of all binary files (usually in ./result/bin/)
[ ] Determined the impact on package closure size (by running nix path-info -S before and after)
[ ] Ensured that relevant documentation is up to date
[x] Fits CONTRIBUTING.md.

Builds and runs on my nixos machine.


Ensure proper pattern was found and printed

I'm not sure this is correct, but haven't had a chance to check. If the entity is unrecognized, will it pass through the entity? And would this PR change that behavior?

@leethomason It doesn't change the behavior, it adds a check that for every case the code decides it sees a character that must be converted to an entity it actully finds and performs a suitable conversion.

Sounds good - I need to add some test cases around this.

@leethomason That's hardly possible. The internals are not exposed and cannot be manipulated. Unless something is broken by altering the code the assert will never fire.

You are correct; it doesn't preserve correctly. Adding the assert.


Is there a startup guide?

I configure my email server but never received emils to confirm new accounts

As a workaround you can register and modify EmailConfirmed property of a user directly in DB


Change in string formats during copy_to and collect operations on a cluster

I am trying a few simple steps to copy flights data into Spark and then collect it back (using nycflights13 data). Repeating the exact same steps on my local connection to Spark (on Mac), and also on an EMR cluster. The results are different, and problematic in case of cluster. Not sure where/how this change happens.

Steps on Mac Spark:

> head(nycflights13::flights$origin)
[1] "EWR" "LGA" "JFK" "JFK" "LGA" "EWR"
> copy_to(sc, flights, "flights_s", overwrite = TRUE)
> flights_tbl <- tbl(sc, 'flights_s')
> f <- flights_tbl %>% collect
> head(f$origin)
[1] "EWR" "LGA" "JFK" "JFK" "LGA" "EWR"

Steps on the EMR Cluster:

> head(nycflights13::flights$origin)
[1] "EWR" "LGA" "JFK" "JFK" "LGA" "EWR"
> copy_to(sc, flights, "flights_s", overwrite = TRUE)
> flights_tbl <- tbl(sc, 'flights_s')
> f <- flights_tbl %>% collect
> head(f$origin)
[1] "\"EWR\"" "\"LGA\"" "\"JFK\"" "\"JFK\"" "\"LGA\"" "\"EWR\""

Notice how the values of origin column has been modified in second case.

Thanks @fereshtehRS, we should fix this one before the CRAN checkpoint. Pushing a fix...

Thanks @javierluraschi. Works fine in new version.

Thanks for checking this.


Bug: watch mode does not work since 2.8.0-dev.20180314

TypeScript Version:  2.8.0-dev.20180316

Search Terms:
Code
tsc -w
Expected behavior:
Starting compilation in watch mode...
Compilation complete. Watching for file changes.
Actual behavior:
Starting compilation in watch mode...
and no files generated
Playground Link:
Related Issues:

I tried 2.7.2, it works fine.

Besides, CPU keep highly occupied.
2.8.0-dev.20180318 has the same issue, too.

2.8.0-dev.20180308 works fine.
this issue start from 2.8.0-dev.20180314.

Do you have a sample project we could take a look at at all that exhibits this behavior?
@sheetalkamat @RyanCavanaugh perhaps issues you're looking into might be be related here.

https://github.com/taoqf/sample
this will do.
it works fine if I remove dependence webpack-stream, or do not import symbols from another lib.
It doesn't matter if not-exist exist or not.

@taoqf What are the exact steps you are following.
Here is what I did with your sample project
c:\github\sample>node c:\TypeScript\built\local\tsc.js -w --preserveWatchOutput
[09:24:12] Starting compilation in watch mode...

src/sample.ts:1:1 - error TS6133: 'fun' is declared but its value is never read.

1 import { fun } from 'not-exist';
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/sample.ts:1:21 - error TS2307: Cannot find module 'not-exist'.

1 import { fun } from 'not-exist';
                      ~~~~~~~~~~~

src/sample.ts:3:7 - error TS6133: 'no' is declared but its value is never read.

3 const no = 'fd-w000001';
        ~~

[09:24:13] Compilation complete. Watching for file changes.

Ran ````npm install``` after this from another command prompt. There is no additional output since there is no change in program with those installs..
Changed no to no2 and I see new errors being presented as:
[09:26:02] File change detected. Starting incremental compilation...

src/sample.ts:1:1 - error TS6133: 'fun' is declared but its value is never read.

1 import { fun } from 'not-exist';
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/sample.ts:1:21 - error TS2307: Cannot find module 'not-exist'.

1 import { fun } from 'not-exist';
                      ~~~~~~~~~~~

src/sample.ts:3:7 - error TS6133: 'no2' is declared but its value is never read.

3 const no2 = 'fd-w000001';
        ~~~

[09:26:02] Compilation complete. Watching for file changes.

New outputs are also generated correctly and don't see any impact on cpu cycles.
Is there something I am missing.

Update I added changed code to import from webpack-stream and it looks like error isn't being reported correctly and looking into it.. though it seems like it isn't just watch mode issue since it happens without --watch
c:\github\sample>node c:\TypeScript\built\local\tsc.js
======== Resolving module 'webpack-stream' from 'c:/github/sample/src/sample.ts'. ========
Explicitly specified module resolution kind: 'NodeJs'.
Loading module 'webpack-stream' from 'node_modules' folder, target file type 'TypeScript'.
Directory 'c:/github/sample/src/node_modules' does not exist, skipping all lookups in it.
Directory 'c:/github/sample/node_modules' does not exist, skipping all lookups in it.
Directory 'c:/github/node_modules' does not exist, skipping all lookups in it.
Directory 'c:/node_modules' does not exist, skipping all lookups in it.
Loading module 'webpack-stream' from 'node_modules' folder, target file type 'JavaScript'.
Directory 'c:/github/sample/src/node_modules' does not exist, skipping all lookups in it.
Directory 'c:/github/sample/node_modules' does not exist, skipping all lookups in it.
Directory 'c:/github/node_modules' does not exist, skipping all lookups in it.
Directory 'c:/node_modules' does not exist, skipping all lookups in it.
======== Module name 'webpack-stream' was not resolved. ========
======== Resolving module 'not-exist' from 'c:/github/sample/src/sample.ts'. ========
Explicitly specified module resolution kind: 'NodeJs'.
Loading module 'not-exist' from 'node_modules' folder, target file type 'TypeScript'.
Directory 'c:/github/sample/src/node_modules' does not exist, skipping all lookups in it.
Directory 'c:/github/sample/node_modules' does not exist, skipping all lookups in it.
Directory 'c:/github/node_modules' does not exist, skipping all lookups in it.
Directory 'c:/node_modules' does not exist, skipping all lookups in it.
Loading module 'not-exist' from 'node_modules' folder, target file type 'JavaScript'.
Directory 'c:/github/sample/src/node_modules' does not exist, skipping all lookups in it.
Directory 'c:/github/sample/node_modules' does not exist, skipping all lookups in it.
Directory 'c:/github/node_modules' does not exist, skipping all lookups in it.
Directory 'c:/node_modules' does not exist, skipping all lookups in it.
======== Module name 'not-exist' was not resolved. ========
src/sample.ts:3:1 - error TS6133: 'fun' is declared but its value is never read.

3 import { fun } from 'not-exist';
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/sample.ts:3:21 - error TS2307: Cannot find module 'not-exist'.

3 import { fun } from 'not-exist';
                      ~~~~~~~~~~~

src/sample.ts:5:7 - error TS6133: 'no2' is declared but its value is never read.

5 const no2 = 'fd-w000001';
        ~~~

It like is the same issue like https://github.com/Microsoft/vscode/issues/45952#issuecomment-375377996
try this.
npm i -g cnpm
cnpm i
./node_modules/.bin/tsc -w --preserveWatchOutput

If I install node_modules use npm i, it will be ok.
see cnpm

Followed your steps and yet dont see issue with cpu or reporting error or file generation?
c:\github\sample>npm i -g cnpm
npm WARN deprecated<EMAIL_ADDRESS>If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0
C:\Users\shkamat\AppData\Roaming\npm\cnpm -> C:\Users\shkamat\AppData\Roaming\npm\node_modules\cnpm\bin\cnpm
+<EMAIL_ADDRESS>added 778 packages in 38.879s

c:\github\sample>cnpm i
/ [1/2] Installing<EMAIL_ADDRESS>unsupported<EMAIL_ADDRESS>›<EMAIL_ADDRESS>›<EMAIL_ADDRESS>›<EMAIL_ADDRESS>›<EMAIL_ADDRESS>Package require os(darwin) not compatible with your platform(win32)
<EMAIL_ADDRESS>optional install error: Package require os(darwin) not compatible with your platform(win32)
√ Installed 2 packages
√ Linked 294 latest versions
√ Run 1 scripts
Recently updated (since 2018-03-16): 7 packages (detail see file c:\github\sample\node_modules\.recently_updates.txt)
√ All packages installed (327 packages installed from npm registry, used 27s, speed 572.18kB/s, json 296(4.01MB), tarball 11.21MB)

c:\github\sample>node_modules\.bin\tsc --w --preserveWatchOutput
[10:38:07] Starting compilation in watch mode...

======== Resolving module 'not-exist' from 'c:/github/sample/src/sample.ts'. ========
Explicitly specified module resolution kind: 'NodeJs'.
Loading module 'not-exist' from 'node_modules' folder, target file type 'TypeScript'.
Directory 'c:/github/sample/src/node_modules' does not exist, skipping all lookups in it.
File 'c:/github/sample/node_modules/not-exist.ts' does not exist.
File 'c:/github/sample/node_modules/not-exist.tsx' does not exist.
File 'c:/github/sample/node_modules/not-exist.d.ts' does not exist.
Directory 'c:/github/sample/node_modules/@types' does not exist, skipping all lookups in it.
Directory 'c:/github/node_modules' does not exist, skipping all lookups in it.
Directory 'c:/node_modules' does not exist, skipping all lookups in it.
Loading module 'not-exist' from 'node_modules' folder, target file type 'JavaScript'.
Directory 'c:/github/sample/src/node_modules' does not exist, skipping all lookups in it.
File 'c:/github/sample/node_modules/not-exist.js' does not exist.
File 'c:/github/sample/node_modules/not-exist.jsx' does not exist.
Directory 'c:/github/node_modules' does not exist, skipping all lookups in it.
Directory 'c:/node_modules' does not exist, skipping all lookups in it.
======== Module name 'not-exist' was not resolved. ========
src/sample.ts:1:1 - error TS6133: 'fun' is declared but its value is never read.

1 import { fun } from 'not-exist';
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/sample.ts:1:21 - error TS2307: Cannot find module 'not-exist'.

1 import { fun } from 'not-exist';
                      ~~~~~~~~~~~

src/sample.ts:3:7 - error TS6133: 'no' is declared but its value is never read.

3 const no = 'fd-w000001';
        ~~

[10:38:08] Compilation complete. Watching for file changes.

[10:39:26] File change detected. Starting incremental compilation...

src/sample.ts:1:1 - error TS6133: 'fun2' is declared but its value is never read.

1 import { fun2 } from 'not-exist';
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

src/sample.ts:1:22 - error TS2307: Cannot find module 'not-exist'.

1 import { fun2 } from 'not-exist';
                       ~~~~~~~~~~~

src/sample.ts:3:7 - error TS6133: 'no' is declared but its value is never read.

3 const no = 'fd-w000001';
        ~~

[10:39:26] Compilation complete. Watching for file changes.

Could you please try Linux? I use this on Debian, they have different behavior.

I was able to get this to repro on linux and have a repro. I have rough idea where this is coming from but working on getting exact repro so i can fix it correctly. Thanks.

Will this be fixed in next published version?

Thanks, I've tried version 2.9.0-dev.20180330, it's OK now.


Add a Travis job to build from this repo to the github.io repository

The link between this repo (/docs) and the github page repository needs to be done as soon as there is a new HEAD on master of this repository.
Problem: the github.io repo is not available to Travis.

Done!


WIP: Transformation to UUIDs

Let's do the UIDs as requested in #12 without waiting for #13 ...
@rwwh, sorry that we might have discussed this time ago, but could you please look at following questions:

What alphabet should we use? Is abcdefghijkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ good idea? Should we also include numbers? (It shouldn't be problem to make alphabet bigger in the future, but making it smaller would be problem.)
What attributes should be made deprecated after switching to uids (questionpointer, questionid, answerid, namespace, ...)?

We are going to think this thru during https://github.com/DataStewardshipPortal/dsp-common/issues/16

Merged... now will switch to UUIDs as described in #12

[ ] Include UUIDs in schema
[ ] Generate initial UUIDs for current KM
[ ] Change schema (precondition, questionpointer, crossref) to use UUIDs
[ ] Refactor links with UUIDs

It should be ready for merging... no more plain IDs (that can be computed by hierarchy), just UUIDs!


eval encoding with magic comment still not correct

This is something not quite right even after #1639:
code = "# encoding: UTF-8\na = 'é'; puts a; a.encoding".b
p code.encoding
p eval(code)

This prints out:
#<Encoding:ASCII-8BIT>
é
#<Encoding:ASCII-8BIT>

Looking in debugger it appears like perhaps encoding from Loader is getting set to ASCII-8BIT and not pragma encoding?

And it also works fine with Prism.parse on TruffleRuby (using FFI):
$ ruby -Ilib -rprism -e 'r = Prism.parse "# encoding: iso-8859-1\na = %{é}; puts a; a.encoding", encoding: Encoding::BINARY; p r.source.source.encoding'
#<Encoding:ISO-8859-1>
$ ruby -Ilib -rprism -e 'r = Prism.parse "a = %{é}; puts a; a.encoding", encoding: Encoding::BINARY; p r.source.source.encoding'
#<Encoding:ASCII-8BIT>

Although encoding: "BINARY" doesn't work for the FFI backend, it needs encoding: Encoding::BINARY, probably we should fix that.
So not quite sure where is the bug, but it doesn't seem to be in Prism C code because serialization gets it right too.
Another way to show it:
$ ruby -Ilib -rprism -e 'p Prism.dump "# encoding: iso-8859-1\na = %{é}; puts a; a.encoding", encoding: Encoding::BINARY'
"PRISM\x00\x13\x00\x00\nISO-8859-1\x02\x01\x00\x00\x16\x01\x02\b\f\n\x00\x00\x00r\x00\x00\x00\x03w\x17\x1D\x01\x01\x89\x17\x1D\x03`\x17\t\x01\x00\x17\x01\x8A\e\x05\x00\x01\e\x02\x1D\x02\x01\x1F\x01\x01\x1D\x02\x19\x01\x13\"\x06\b\x00\x00\x02\x01\"\x04\x00\x05'\x01\x00\x01^'\x01\x01\x00\x00\x00\x13*\n\x00^*\x01\x01\x00\x01+\x01\x03\x01,\b\x00\x00\x00\x00\x17\x00\x00\x00\x01\x00\x00\x00\"\x00\x00\x00\x04\x00\x00\x00,\x00\x00\x00\b\x00\x00\x00\x00"

You did not run my reproduction code as you changed the encoding:
3.3.0 ~/work/gems/yarp main 1034% ruby -Ilib -rprism -e 'r = Prism.parse "# encoding: iso-8859-1\na = 'é'; puts a; a.encoding", encoding: "BINARY"; p r.source.source.encoding'
#<Encoding:ISO-8859-1>
3.3.0 ~/work/gems/yarp main 1035% ruby -Ilib -rprism -e 'r = Prism.parse "# encoding: utf-8\na = 'é'; puts a; a.encoding", encoding: "BINARY"; p r.source.source.encoding'
#<Encoding:ASCII-8BIT>

So seems to be something with UTF-8?  Not sure.

Ah right, sorry, I changed it to avoid any confusion with the default encoding but indeed it matters here.

More of a self-note, but this doesn't affect TruffleRuby because TruffleRuby already looks for the magic encoding comment before passing the source code to Prism, and so already knows it's UTF-8 and pass that as metadata, so the binary encoding is never seen by Prism for this case.