我正在使用system.js和systemjs builder来创建一个dist
文件夹,其中包含我的angular2应用程序的所有打包的javascript文件.
它工作得非常好,除了它不包括以下文件,这些文件目前静态包含在index.html中:
如何强制systemjs构建器包含这些依赖项?
库-bundle.js:
var SystemBuilder = require('systemjs-builder');
var builder = new SystemBuilder();
builder.loadConfig('./systemjs.config.js').then(function() {
return builder.bundle(
'app - [app/**/*]', // build app and remove the app code - this leaves only 3rd party dependencies
'dist/libs-bundle.js'
);
}).then(function() {
console.log('library bundles built successfully!');
});
Run Code Online (Sandbox Code Playgroud)
APP-bundle.js
var SystemBuilder = require('systemjs-builder');
var builder = new SystemBuilder();
builder.loadConfig('./systemjs.config.js').then(function() {
return builder.bundle(
'app - dist/libs-bundle.js', // build the app only, exclude everything already included in …
Run Code Online (Sandbox Code Playgroud) 在我的QT应用程序的主窗口中,我使用a std::shared_ptr
来保存指向我的网络服务实例的指针,该实例管理到多个客户端的所有连接.现在,我必须将此指针传递给多个子窗口,以便它们可以与客户端进行通信.
我是否最好std::shared_ptr
在主窗口和子窗口中使用成员变量并在创建子窗口时传递它,或者更好地使用a std::unique_ptr
并将原始指针传递给子窗口,因为主窗口无论如何都会比子窗口更长?
非常感谢!
我想将vuetify选项卡组件简单地用作导航控件
<v-tabs dark fixed icons centered>
<v-tabs-bar class="cyan">
<v-tabs-slider color="yellow"></v-tabs-slider>
<v-tabs-item router :to="{name: 'election/admin', id: this.$route.params['id']}">
Overview
</v-tabs-item>
</v-tabs-bar>
</v-tabs>
Run Code Online (Sandbox Code Playgroud)
但是,似乎没有工作.我认为该to
属性除了router
应该工作取代href?
我遇到了我的应用程序Object doesn't support the property or method 'matches'
在 IE 中显示错误的问题,这就是为什么我将以下内容添加到我的polyfills.ts
文件中:
if (!Element.prototype.matches) {
Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
}
Run Code Online (Sandbox Code Playgroud)
但是,从 angular6 升级到 angular7(或者更有可能是因为我将 typescript 模块更新为 3.1.3)后,我现在收到错误
TS2339:类型“元素”上不存在属性“msMatchesSelector”
在构建应用程序时。问题是什么?
我有一个休息端点/Products/latest
,如果没有产品,它会返回 204,以及以下通用角度服务:
getFromAPI(url: string) {
const params = new HttpParams();
return this.http
.get(url, { params: params })
.catch((err: HttpErrorResponse) => {
console.error(`Backend returned code ${err.status}, body was: ${err.error}`);
return Observable.of([]);
});
}
Run Code Online (Sandbox Code Playgroud)
和
getFromAPI() {
return this.masterService.get('/Products/latest').map((res: Response) => {
if (res.status === 204) {
return Observable.of([]);
} else {
return res;
}
});
}
Run Code Online (Sandbox Code Playgroud)
但是,当服务产生 204 代码时,我收到以下错误:
类型错误:无法读取 null 的属性“状态”
这怎么会发生?如果 API 以 204 响应,为什么整个响应为空?
我正在尝试将AVLTree实现转换为堆样式数组,并且在泛型方面存在一些问题:
public class MyAVLTree<K extends Comparable<? super K>, E> implements
OrderedDictionary<K, E> {
class AVLNode implements Locator<K, E>{
// ...
}
// ....
public Locator<K,E> [] toBSTArray() {
AVLNode[] bArray = new AVLNode[size];
makeArray(root, 0, bArray); // recursion
return bArray;
}
}
Run Code Online (Sandbox Code Playgroud)
在该行AVLNode[] bArray = new AVLNode[size];
我得到以下错误:
"无法创建MyAVLTree.AVLNode的通用数组"
我不明白我做错了什么.有帮助吗?
我正在尝试将Spring Data集成到我们的Vaadin项目中.所以我尝试运行以下使用相同技术的示例代码:
https://github.com/henrikerola/vaadin-spring-boot-todo
我唯一改变的是我添加了jetty,因为我们需要将它用于我们的项目.
不幸的是,在jetty:run
我收到以下异常后:
Exception in thread "main" java.util.ServiceConfigurationError:
org.apache.juli.logging.Log: Provider org.eclipse.jetty.apache.jsp.JuliLog not a subtype
我的pom.xml看起来像这样:
<?xml version="1.0" encoding="UTF-8"?>...
<modelVersion>4.0.0</modelVersion>
<groupId>org.test</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.2.3.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<start-class>demo.DemoApplication</start-class>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-spring-boot-starter</artifactId>
<version>1.0.0.beta2</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-bom</artifactId>
<version>7.4.2</version>
<type>pom</type>
<scope>import</scope>
</dependency> …
Run Code Online (Sandbox Code Playgroud) 我正在生成正弦波并将其发送到SDL音频缓冲器以生成声音.可以使用键盘的箭头键更改幅度和频率等所有参数.
现在,问题在于当我改变频率时,我会听到"划痕".我理解为什么会发生这种情况:当我在函数本身发生变化时继续迭代我x
的f(x)
时候,我得到一个完全错误的值.但我没有看到或理解如何通过相移来解决这个问题.
任何提示如何开始?
#include "WaveGenerator.h"
#include <thread>
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm> // std::min
int main(int argc, char* argv[]){
WaveGenerator* wg = new WaveGenerator();
int i;
std::cin >> i;
return 0;
}
int graphThreadFunc(void *pointer){
WaveGenerator* wg = (WaveGenerator*)pointer;
wg->init();
return 0;
}
// SDL calls this function whenever it wants its buffer to be filled with samples
// length = 2048
void SDLAudioCallback(void *data, Uint8 *buffer, int length){
uint8_t *stream = (uint8_t*)buffer; …
Run Code Online (Sandbox Code Playgroud) 我正在将一个Cell
对象数组绑定到PrimeNG DataTable:
html的:
<p-dataTable [value]="_cells" [responsive]="true" [globalFilter]="gb">
<p-column field="id" header="id" sortable="true"></p-column>
<p-column field="name" header="name" sortable="true" ></p-column>
</p-dataTable>
Run Code Online (Sandbox Code Playgroud)
.TS:
ngOnInit() {
var self = this;
// Capture the id in the URL
this._route.params.subscribe(params => {
self._stationId= params['id'];
this._dataService
.GetAllCells(self._stationId)
.subscribe((data:Cell[]) => this._cells = data,
error => alert(error),
() => console.log('Retrieved cells'));
});
}
Run Code Online (Sandbox Code Playgroud)
所以我发现dataTable有一个reset()
清除排序/过滤/选择状态的方法.每当URL参数更改并且正在加载新数据时,我都需要调用它.
但是如何引用dataTable并从reset()
方法内部调用ngOnInit()
方法?
我正在尝试并行执行一项长期运行的任务。由于某种原因,它不会完成并且永远悬挂。
import multiprocessing as mp
class PartitionedResult(object):
index = 0
P = []
def __init__(self, index, P):
self.index = index
self.P = P
def longRunningTask(index, output):
P = []
for i in range (0, 1000):
print(i)
P.append(i)
print("I'm done!")
output.put(PartitionedResult(index, P))
return
def main():
output = mp.Queue()
processes = [mp.Process(target=longRunningTask, args=(x,output,)) for x in range(4)]
for p in processes:
p.start()
for p in processes:
p.join()
results = [output.get() for p in processes]
print("This never shows up")
if __name__ == '__main__': …
Run Code Online (Sandbox Code Playgroud) angular ×3
c++ ×2
java ×2
arrays ×1
audio ×1
generics ×1
javascript ×1
jetty ×1
math ×1
maven ×1
primeng ×1
python ×1
python-3.x ×1
sdl ×1
shared-ptr ×1
spring ×1
systemjs ×1
typescript ×1
unique-ptr ×1
vaadin ×1
vuejs2 ×1
vuetify.js ×1
waveform ×1