Bridge.net support for thread C#

Desk Link : https://deck.net/f3a132eb6c60d59e1f96c058651a9310
trying to convert c# to JS using bridge.net but failed as system.threading is not fully supported in Bridge as in C#.
Please have a look on deck link.

This would be nice, but unfortunately true multithreading is extremely difficult to accomplish using ECMA/Javascript.
The newest webstandards does support multiple threads, but only through WebWorker's. These workers run in true OS threads, but to avoid having to deal with race-conditions, deadlocks and other concurrency issues normal to multithreaded applications, it was decided that the webworkers shall run in a totally seperare context with no access to shared variables or the DOM. The only way to communicate to/from workers is by posting events. See more info about them here:
https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers
In C#/.NET it is assumed that all threads have direct access to all data, and that it's up to the programmer to prevent concurrency issues. Hence the System.Threading.Thread and WebWorker philosophies are directly incompatible by concept.
I'm not sure if threading actually could be faked either. I guess it could be possible by rewriting Bridge. NET to maintain task scheduling, and then implement some sort of automatic generated cooperative threading system. This would be interesting, but I'm not sure the results would be any good, and it could make apps unnecessary complex for no good reason except direct portability (with sideeffect). In fact rewriting/porting the applications to not use threads would be much better.
You should note that the .NET Task- pattern (async/await) operates in a similar singlethreaded mode like that. Putting your operations into tasks may ease the porting.
An interesting fact is that the WebWorker approach discussed above is actually quite similar to the AppDomain concept in .NET that has the exact same concept of no datasharing. Data has to be copied between appdomains using serialization, or marshalled using MarshalByRef. This exact same behaviour could be implemented in a future version of Bridge.NET using WebWorkers. In some cases where you need to do CPU intensive tasks related to communication with the webserver without affecting the UI that would be great, then just serialize the result and post it to the main javascript thread when it's completed to update the webpage.

Web workers is good but in worker we can't access direct to page components
Also we can't access to bridge library, so the threads in bridge is imposible
So we can just write Javascript for webworker
Otherwise i think we can make thread in js standalone, it's possible via make code tracer, but I don't know about performance
So you right, now async task is best way and so optimum in js and bridge c# also

@miladsadeghi72 Actually you can use Bridge.NET inside webworkers, altough you need to load the Bridge js again inside the webworker. But like you say you cannot access the DOM or the scope from the main thread. Hence you're not limited to pure js.
It's the very same concept as AppDomain in .NET. If you want to post data from the worker to the main thread or vice versa you need to serialize the data (NewtonsoftJSON or your own serializer). And you need to implement MarshalByRef to communicate with reference types across the app domains (which are actually webworkers).
But webworkers will never help implementing Bridge Thread identical to .NET threads, so kinda offtopic.

Just because we can't do multi-threading the exact same way as standard .NET doesn't mean we shouldn't add some sort of Web Worker support. Perhaps we could implement the support with a class that can be inherited and instantiated to create a new worker with Bridge.NET. We could have override methods for onmessage or whatever, and just let any attempts to cross the Web Worker border throw some kind of Web Worker Exceptions.
Bridge.NET could create the Web Worker using a blob url so it can change details at runtime.
How feasible does this sound do you think? Am I off my rocker?

@athendrix You are right, this is possible and not very hard to do. I considered doing it myself to speed up the UI when handling larger XML data, but postponed it.
One could use the WebWorker class to implement the AppDomain model later. Those two models are very fundamentally compatible, by having the same restrictions.


PowerRename not showing file names in window

Microsoft PowerToys version
0.67.1
Installation method
Chocolatey
Running as admin
No
Area(s) with issue?
PowerRename
Steps to reproduce

In Explorer, Open a folder with more than 20 files
Press Ctrl+A to select all files
Right click on one of them, and select "PowerRename"

✔ Expected Behavior
PowerRename window shows the full list of filenames on the window, to enable renaming them in batches
❌ Actual Behavior
PowerRename window opens, but with no file names in the window.

Other Software
No response

I have exactly the same problem


Tiles can't be rendered when not using the default 8080 port.

The mod cannot request information from the server when not using the default 8080 port.
Communication between the server plugin and the client mod to make sure the correct port is used would be the preferred fix if possible, otherwise a port config setting would be needed.
Full log here for completeness, errors starting at line 268
https://mclo.gs/Owl7ZPF#L268

Did you set the correct address and port in your plugin config.yml?
Example:
settings:
  web-address: http://localhost:8080
  language-file: lang-en.yml
  debug-mode: false

yup, I also tried <IP_ADDRESS> instead of localhost
web-address is currently set to: "http://localhost:20000"
internal-webserver.bind and .port are <IP_ADDRESS> and 20000 respectively (web version works fine)
I also did a server restart, a client restart and a clearing of the pl3xmap folder on the client between changes
Setting the web-address to: "http://localhost:8080" and internal-webserver.bind and .port to <IP_ADDRESS> and 8080 respectively had it work fine

I just used localhost as an example. It has to be the web address you put into your browser... It must be reachable from the client ;)

I thought <IP_ADDRESS> would've worked...
Thanks :P


share blog button

Resolves #684
👽🤟

@barrotbake The reason the check failed for this PR is because of a formatting error. This can be resolved by committing the changes made after running npm run format. Can you let me know if you'd like me to go ahead and format and then merge the PR?

Hey @EthanThatOneKid yeah you can go ahead and run it and merge. Thanks so much!


Fongo upsert for non-existing document seems to write the document incorrectly

See also: http://stackoverflow.com/questions/33869208/fongo-upsert-for-non-existing-document-seems-to-write-the-document-incorrectly
I'm trying to upsert a document in Fongo, but I get different results when using Fongo itself or Mongo. My documents are identified by a set of two fields (let's say a compound key), so in the Java code I do the following:

@Override
public boolean insertOrUpdate(SomeMessage message) throws SQLException {
    collection.updateOne(
        message.getIdQuery(),
        new Document()
            .append("$set", new Document()
                .append(message.getSubtype().name(),
                        message.asMongoDocument())
                .append(FIELD_LAST_UPDATED, new Date())
            ),
        new UpdateOptions().upsert(true)
    );
    return true;
}

where collection is a MongoCollection object and the getIdQuery() method produces the following document:

public Document getIdQuery() {
    return new Document()
        .append("$and", Arrays.asList(new Document[]{
            new Document().append("id1", getId1()),
            new Document().append("id2", getId2())
        }));
}

When writing to real Mongo (FongoRule(true)), I get the expected document from Mongo:

{
  "_id":{
    "$oid":"5652e2668f02dbf09c03ed0a"
  },
  "id1":234,
  "id2":123,
  "subdocument":{...},
  "lastUpdated":{
    "$date":1448272664564
  }
}

but from Fongo itself (FongoRule()) I seem to get a completely different one:

{
  "_id":{
    "$oid":"5652e4d83727549eb6833bf3"
  },
  "$and":[
    {
      "id1":123
    },
    {
      "id2":234
    }
  ],
  "subdocument":{...},
  "lastUpdated":{
    "$date":1448273112379
  }
}

My expectation is that, given that the document does NOT exist, the Db created a new document with the compound it and insert the sub-document. Mongo does it, fongo doesn't. Seems a bug to me, but maybe I'm doing the AND query the wrong way and somehow Mongo is smart enough to understand what I really wanted?
I'm using Fongo version 2.0.3 and Mongo driver version 3.0.4 (3.1.1 doesn't seem to work with Fongo) with a local installation of Mongo 3.0.7.

Hi, can you check against the v3 branch ?


About section

In the about section information is not fully updated. Should we update it?

Without any doubts we should :-)

should i leave c beyls name?


Deadlines for component instances

We want to be able to set deadlines for component instances so that we don't have to recompile during experimentation.

Will need to figure out how this will work in the META since the component instance only has indirect references to the original component and its timers/ports and their attributes.

We may want to change to not have Component Instance be a meta-type; if we allow components in the deployment model; we can say that the user should create the component by dragging it in from the tree browser and selecting instance.  This would allow properties to be inherited and also overridden.

With respect to creating an instance of a component, we'd have to figure out how to determine the original component's name, since the user can rename the component instance we'd lose track of the name of the component library required for it.  Additionally there are some deployment specific concerns that would need to be moved from the current Component Instance to the Component (e.g. SchedulingScheme, EnableLogging, and LogingUnit).  Probably need to discuss this further.

The only missing dependency now is the resolution of https://github.com/rosmod/rosmod-actor/issues/3 before we can close this issue.


Calling functions in template instantiations

See https://github.com/microsoft/cadl/issues/462
Here we have a problem that KeysOf and ParentKeysOf are distinct types that we process twice. It would be nice if we could write:
alias ParentKeysOf<T> = KeysOf<Parent<T>>

However, we don't have currently have a way to author Parent<T>. We have a JS function exported getParentResource but we don't have a way to call it. It would be nice if we somehow could.
Brainstormed options
1. Allow calling exported functions in type references.
alias ParentKeysOf<T> = KeysOf<getParentResource(T)>

This seems very powerful, but I have some concerns:

Tooling: I once had a bug where I offered all exported functions in type reference completion and it got quite cluttered:

Caching: I think it would be nice if we could cache these calls in the same way that template instantiations are cached so that you can do complex computation only once for a given set of type arguments.

2. Allow calling exported functions using template instantiation syntax
alias ParentKeysOf<T> = KeysOf<getParentResource<T>>

Here the < > parses this as a template instantiation, and when we resolve getParentResource to a function, we call it with the type arguments, and cache it like any other template instantiation. This solves the caching, but not the completion noise.
3. Explicit template to function bridge
alias Parent<T> is getParentResource(T);

I struggled with the syntax here so consider this a straw-man. I want something that is different than alias =. I first had model is but realized it would be useful if this could return a non-model, and then realized it really is equivalent to a templated alias! But if we use alias = we are really back to (1). The idea here is that you can make a 1:1 between an alias and a function. So I landed at alias is but I don't like it.
But syntax aside this solves the intellisense pollution and allows for idiomatic type (Pascal cased, noun) and function (camel case, verb) names.
4. Explicit opt-in of functions as templates
export function $$Parent(program: Program, type: Type) {
   return getParentResource(program, type);
}

Here we borrow from decorators and have some way to opt a function into becoming a template on the Cadl side. Straw man: $ is a decorator $$ is a template. This also solves the intellisense pollution. It could further allow one fewer declaration if you imagine having getParentResource implementation inlined into $$Parent.

I am worried about establishing yet another naming convention, in part because it makes things more confusing in projection-or-cadl-function land. We're potentially looking at 4 classes of functions IIUC:

Decorators
Templates (e.g. things which return structures) like Parent.
Utility functions that may be called from CADL (e.g. things which return useful values) like getAddedOn.
JS functions not intended to be called from CADL.

For syntax options for declaring 2 (and maybe 3) I think we should consider alignment with future function and decorator declaration syntax. E.g. I would expect something like this to work:
dec fn @parent(parentType) {
  self.state.set("parentType", parentType);
}

fn getParent(parentType) {
  return self.state.get("parentType");
}

alias Parent<T> = getParent(T);

(And maybe the alias form ensures instantiation caching happens on the cadl side? I dunno)
There are a couple more options we could consider (not mutually exclusive):
5. JS functions are exported only from package.json main, and not imported into cadlMain
It's up to the library author to split their implementation code such that they only export things into cadl that they intend to be called from cadl.
6. Use namespaces, e.g. require that cadl-callable things have a namespace
If a function doesn't have a namespace, it doesn't get bound. Not sure if it's ever good to have an un-namespaced function so this is maybe ok?
7. Bind into cadl based on signature
Any function which takes program (or later, context) as first parameter is bound in cadl. A quick-and-dirty regexp on the toString of the function may be sufficient here?

Great points.
I think requiring that Cadl callable things have a namespace is reasonable no matter what else we do. It seems like we would never recommend putting such things outside a Cadl namespace and unlike in .cadl, I have no real concern about adding one line of boilerplate to get started with JS interop.
I also think binding on signature is reasonable. I would really like to avoid regexes though. I think maybe it makes sense to go after signature help first so that we have more typing metadata available about functions and decorators. It's possible that with good typing we won't clutter tooling with option 1 (functions in type references) as we could only show functions that return a type in type reference completion. And then alias = as the way to cache the call and give it a nice type name seems fine. We can further use this typing to make it an error to call a function that doesn't return a type in a type reference.
So that's how I'm now leaning. It seems the most expressive. And maybe if we go after signatures first then it will be clearer if that's the right direction. I've been meaning to write up some options for decorator and function signatures since the dev doc proposal left that as a follow-up design discussion to be had. I'll try to have that up soon.

Funny, I thought #5 was the simplest and might end up obviating other approaches.

Maybe I don't understand, but 5 seems like something that helps fix the completion cluttering, but isn't a full alternative. It still needs to be paired with something like 1, 2 or 3 so that I have a way to invoke the functions for these scenarios, right?
I may be over-reacting to the current mess of seeing all helper functions, but it still would seem valuable to me if we didn't offer to complete functions that don't return types in a context where only a type can go. That said, that is harder. Maybe we can try 1 + 5, and then use typing later on when it comes online for signature help to make completion smarter?

I kind of like option 2 combined with some of Brian's suggestions, but I was afraid this was "let's definite Typescript functions in cadl" which it's not, so I'm okay with any outcome. Definitely seems like this would be useful, and I agree that the cluttering of helper functions is very unfortunate.


fix: Dispatch PR plugin tests for forks

Example of it working with a PR from MeltyBot's fork to my fork: https://github.com/WillDaSilva/meltano-hub/pull/2
Closes #969

After this has been merged, I'll delete MeltyBot's fork of the Hub repository.

@WillDaSilva this looks good to me!
The only question I'd have is if there are any risks of us automatically running CI jobs on forks, not saying that there is but that I actually dont know what the risks are (you probably know more than me). In the past I asked about how we can run CI tests for taps in meltanolabs and I heard some people say that we've skipped tests that are from forks, or require a manual trigger from someone on the team. I definitely want to have the tests run on forks because the majority of the failures will come from community contributors who are less familiar with the schemas/structure of files but I also wouldnt want us to expose ourselves to risk.
What do you think? I'd probably defer this review back to engineering cc @aaronsteers @cjohnhanson @rwfeather .

The only question I'd have is if there are any risks of us automatically running CI jobs on forks [...]

@pnadolny13 The test dispatch job runs on pull_request_target events, which are executed in the context of the base branch of the pull request. This prevents users from changing the workflow definition to do malicious things, as they'd have to get those workflow updates merged into e.g. main in our repository before they could actually run it.
See also https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
We should consider any files from a fork to be untrusted input, and not run any code from a fork without verifying it first. Fortunately the test dispatch need only parse some yaml files, which should not pose any considerable risk. Then we run the test command, which may have vulnerabilities (not that I've thought of any yet), but malicious users can already leave comments in our repository to trigger the test command, so there's no additional risk from letting the test dispatcher do it.


Sort not working

Just downloaded and installed but no sort arrows are appearing in my column headings and clicking on a column does not invoke a sort.
Inside the  tag I have:
<script src="dist/js/bootstrap-sortable.js"></script>
<script src="dist/js/moment.min.js"></script>
<link rel="stylesheet" href="dist/css/bootstrap-sortable.css">
There are other js and css files inside the dist folder that are working OK
My <table> tag is:
<table class="table table-striped table-bordered table-condensed sortable">
It has <thead> and <tbody> tags.
The <tbody> html is created by a php script when the page is loaded:
<tbody>
<?php include 'memberships-GetList.php'; ?>
</tbody>
Could that be what is causing the problem?

If your table is created dynamically after the page load, you have to call
$.bootstrapSortable(bool); afterwards
Just downloaded and installed but no sort arrows are appearing in my column
headings and clicking on a column does not invoke a sort.
Inside the tag I have:
There are other js and css files inside the dist folder that are working OK
My
tag is:
It has
and tags.
The
html is created by a php script when the page is loaded:

Could that be what is causing the problem?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/drvic10k/bootstrap-sortable/issues/94, or mute the
thread
https://github.com/notifications/unsubscribe/ADlKS55w3ZrFoj5dmjoIVbfqCwIlz9eCks5qHcIZgaJpZM4Iryqk
.

Thanks.  Not a js expert so not sure how to do that. Could you give me som eexample code and where it should go in my html file?
Pete

sorry for late response, did you solve the problem?
I have no experience with php unfortunatelly, co I cannot give you any advice on this issue

Yes, figured it out.
Thanks,
Pete


feat: untimed parts

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

This is a new feature.

What is the current behavior? (You can also link to an open issue here)

All playable parts are counted towards show time and as-played time - unless they are "invalid" or "floated", which renders them unplayable.

What is the new behavior (if this is a feature change)?

A Part can be marked as "untimed" which will keep them playable, but cause them to:

not trigger blueprints "firstTake" callback

not set startedPlayback on a playlist when they are taken, the startedPlayback will be set once a not-"untimed" part is taken

not count towards segment time budget

there will be a countdown to the end of an "untimed" part (unless it's expectedDuration is 0) and the "On Air In" counter will also be affected by the duration of an "untimed" part.

Other information:

Status

[ ] Code documentation for the relevant parts in the code have been added/updated by the PR author
[ ] The functionality has been tested by the PR author
[ ] The functionality has been tested by NRK

Codecov Report

Merging #512 (8c815ea) into release34 (0e68b3c) will increase coverage by 33.51%.
The diff coverage is n/a.

:exclamation: Current head 8c815ea differs from pull request most recent head 7dc4cf0. Consider uploading reports for the commit 7dc4cf0 to get more accurate results

@@               Coverage Diff               @@
##           release34      #512       +/-   ##
===============================================
+ Coverage      66.48%   100.00%   +33.51%
===============================================
  Files            250         2      -248
  Lines          15064        32    -15032
  Branches        3515         9     -3506
===============================================
- Hits           10015        32     -9983
+ Misses          4883         0     -4883
+ Partials         166         0      -166

Impacted Files
Coverage Δ

meteor/server/api/ingest/http.ts

meteor/server/api/playout/cache.ts

meteor/lib/api/pubsub.ts

meteor/server/migration/1_18_0.ts

meteor/lib/api/shapshot.ts

meteor/server/security/lib/credentials.ts

meteor/server/migration/1_7_0.ts

...eor/lib/collections/RundownBaselineAdLibActions.ts

meteor/server/api/showStyles.ts

meteor/server/migration/0_24_0.ts

... and 235 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0e68b3c...7dc4cf0. Read the comment docs.