Angular2 Web Workers and importScripts - import

I've been trying to code an Angular2 component with web workers, but I'm having trouble importing code for the worker thread. Here's the start of my component's code:
import {Component} from 'angular2/web_worker/worker';
import {platform} from "angular2/core";
import {WORKER_APP_PLATFORM, WORKER_APP_APPLICATION} from 'angular2/platform/worker_app';
In loader.js, I call importScripts in the following way:
importScripts( "https://code.angularjs.org/tools/system.js",
"https://code.angularjs.org/2.0.0-beta.0/web_worker/worker.dev.js",
"https://code.angularjs.org/2.0.0-beta.0/angular2.min.js",
"../../../../node_modules/reflect-metadata/Reflect.js");
I've verified that loader.js executes, but when I run the application, I get errors stating that "angular2/web_worker/worker", "angular2/core", and "angular2/platform/worker_app" can't be found. Do I need to import different dependencies in loader.js?

Related

firebase/flutter - App Check debug provider in an emulator

I try to get a local debug token according to the instructions, but I don't see any in the console. I implemented this code as given. Is it maybe because the release and debug app-check don't work at the same time?
Guide: https://firebase.google.com/docs/app-check/android/debug-provider?hl=en#java_1, Point 3 doesn't work for me
MainActivity.java
import com.google.firebase.FirebaseApp;
import com.google.firebase.appcheck.FirebaseAppCheck;
import com.google.firebase.appcheck.playintegrity.PlayIntegrityAppCheckProviderFactory;
import com.google.firebase.appcheck.debug.DebugAppCheckProviderFactory;
FirebaseApp.initializeApp(/*context=*/ this);
FirebaseAppCheck firebaseAppCheck = FirebaseAppCheck.getInstance();
firebaseAppCheck.installAppCheckProviderFactory(PlayIntegrityAppCheckProviderFactory.getInstance());
firebaseAppCheck.installAppCheckProviderFactory(DebugAppCheckProviderFactory.getInstance());
build.gradle
implementation 'com.google.firebase:firebase-appcheck-debug:16.1.1'
is there maybe another way to get the local debug token so i can add it in the firebase console?

PackageDescr incompatibility - Drools migration from 5.5.0 to 6.2.0

We are migrating Drools from 5.5.0 to 6.2.0. I am not able to figure compatible usage of org.drools.compiler.lang.descr.PackageDescr which is implementing org.kie.internal.definition.KnowledgeDescr. We get an instance of PackageDescr from DrlParser.parse and then creating a org.drools.io.Resource using org.drools.io.ResourceFactory.newDescrResource(KnowledgeDescr) and argument here is of type org.drools.definition.KnowledgeDescr which is not the same KnowledgeDescr that PackageDescr implemented above. We are not switching to KIE API as of now but using Knowledge Legacy Adapter only. What is the replacement for this issue to be fixed?
Usage example:
import org.drools.builder.KnowledgeBuilder;
import org.drools.builder.KnowledgeBuilderConfiguration;
import org.drools.builder.KnowledgeBuilderFactory;
import org.drools.builder.ResourceType;
import org.drools.io.ResourceFactory;
import org.drools.compiler.lang.descr.PackageDescr;
KnowledgeBuilderConfiguration builderConf = ...
PackageDescr pkg = ...
KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(builderConf);
// Compilation error in this line
kbuilder.add(ResourceFactory.newDescrResource(pkg), ResourceType.DESCR);

How to import a custom AWS rule

I'm trying to import a rule that looks like this in AWS:
enter image description here
I tried a command like this but it fails:
terraform import aws_security_group_rule.ke_ingress_icmp sg-0af205c29967e5084_ingress_icmp_-1_-1_0.0.0.0/0
aws_security_group_rule.ke_ingress_icmp: Importing from ID "sg-0af205c29967e5084_ingress_icmp_-1_-1_0.0.0.0/0"...
aws_security_group_rule.ke_ingress_icmp: Import prepared!
Prepared aws_security_group_rule for import
aws_security_group_rule.ke_ingress_icmp: Refreshing state... [id=sg-0af205c29967e5084_ingress_icmp_-1_-1_0.0.0.0/0]
Error: Cannot import non-existent remote object
I'm not sure how to represent protocol="Destination Unreachable" and port range="fragmentation required, and DF flag set" in the import command. Does anyone have any ideas?

Using react-router w/ brunch/babel

I'm attempting use react-router in my brunch/babel setup. In my app.js I have:
import React from "react"
import ReactDOM from "react-dom"
import { Router, Route, Link } from "react-router"
This however gives me:
Uncaught Error: Cannot find module "history/lib/createHashHistory" from "react-router/Router"
When looking at the referenced line I see:
var _historyLibCreateHashHistory = require('history/lib/createHashHistory');
When inspecting the app.js that's generated via brunch I see:
require.register('history/createBrowserHistory', function(exports,req,module) {
...
});
How do I go about fixing this so that createBrowserHistory gets imported properly?
The module history is listed as a peer dependency by react-router, which means that you need to install it yourself through the command npm install history --save.

Scala http client for large files

I need to write an HTTP client that will periodically download (and dump on disk) files that are much larger than the available memory.
What's the most appropriate strategies and HTTP client libraries for this task?
A plus for libs without bulky dependencies like Akka.
I found a reasonable solution that does not require adding any external dependencies. Only Scala/Java standard libraries.
import sys.process._
import java.net.URL
import java.io.File
new URL("http://download.thinkbroadband.com/1GB.zip") #> new File("/tmp/1gb.zip") !!
Bonus: add some headers and conditional get to the request
import sys.process._
import java.net.URL
import java.io.File
val url = new URL("http://download.thinkbroadband.com/1GB.zip")
val conn = url.openConnection
conn.setRequestProperty("Accept","text/json")
conn.setIfModifiedSince(new Date().getTime - 1000*60*30)
url #> new File("/tmp/1gb.zip") !!