小编Eri*_*ase的帖子

在angular2快速入门指南中打开带有lite-server的非默认浏览器

在遵循Angular 2快速入门指南的TypeScript版本之后,我想知道是否可行,如果是,如何配置lite-server以启动默认浏览器以外的浏览器.

似乎lite-server将采用命令行args,通过它提供服务yargs.argv.并且似乎yargs将尝试基于相当常见的标准来解析命令行args(即,如果令牌以a开头--,它表示参数名称,否则是参数值)来获取argv.lite-server将尝试使用open它从中获取的属性argv,这最终是通过[启动进程的其中一个节点包]启动浏览器.点开?xdg -open?不确定,对我来说并不是真的那么重要,只要我的假设(基于查看其中几个过程发射器)是正确的,他们都可以选择接受定义要启动的过程的参数.如果省略,将使用默认浏览器,因为要打开的文件类型是html,这就是发生的情况.

如果所有这些都是正确的,或至少是它的要点,那么似乎我只需要指定--open chrome,例如(假设chrome在我的PATH工作 - 在win机器上工作),在lite定义的命令的末尾package.json.

所以像......

"scripts": {
    "tsc": "tsc",
    "tsc:w": "tsc -w",
    "lite": "lite-server",
    "lite:c": "lite-server --open chrome",
    "lite:f": "lite-server --open firefox ",
    "start": "concurrent \"npm run tsc:w\" \"npm run lite\" "
},
Run Code Online (Sandbox Code Playgroud)

如果这看起来很麻烦,我道歉,但我不会在计算机上,我可以测试这几天,我需要知道我是否有答案,可以停止研究这个:).谢谢!

launching node.js angular

19
推荐指数
2
解决办法
2万
查看次数

将ng-bootstrap集成到ASP.NET Core JavaScript Services(Angular)项目中

我使用ASP.NET 2.0核心的JavaScript服务,并试图整合NG-引导.

我安装了ng-bootstrap:

npm install --save @ng-bootstrap/ng-bootstrap

我把它添加到webpack.config.vendor.js:

...
const treeShakableModules = [
    '@angular/animations',
    '@angular/common',
    '@angular/compiler',
    '@angular/core',
    '@angular/forms',
    '@angular/http',
    '@angular/platform-browser',
    '@angular/platform-browser-dynamic',
    '@angular/router',
    '@ng-bootstrap/ng-bootstrap',  // <-- down here
    'zone.js',
];
...
Run Code Online (Sandbox Code Playgroud)

我添加NgbModule到我的导入app.module.shared.ts:

...
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
...
@NgModule({
    declarations: [
        AppComponent,
        ...
    ],
    imports: [
        CommonModule,
        NgbModule.forRoot(),  // <-- this guy
        HttpModule,
        FormsModule,
        RouterModule.forRoot([
            ...
        ])
    ]
})
export class AppModuleShared {
}
Run Code Online (Sandbox Code Playgroud)

我清理解决方案并运行: …

asp.net-core ng-bootstrap asp.net-core-2.0 angular asp-net-core-spa-services

12
推荐指数
1
解决办法
670
查看次数

如何以编程方式关闭vscode.window的showInformationMessage框

我刚刚开始学习vscode扩展,我想知道是否有一种简单的方法以编程方式关闭通过生成的信息消息框vscode.window.showInformationMessage().如果你想重现,我在这里开始使用WordCount演示,在复制/粘贴后extension.ts,如教程中所述,我做了一些修改,activate()就像这样......

export function activate(context: ExtensionContext) {
    let wordCounter = new WordCounter();
    let wcTimeout = null;
    let setWCTimeout = function() {
        clearWCTimeout();
        wcTimeout = setTimeout(clearWCTimeout, 1000);
    };
    let clearWCTimeout = function() {
        if (wcTimeout !== null) {
            clearTimeout(wcTimeout);
            wcTimeout = null;
            // clear/hide the message box here, but how?
        }
    };

    let disposable = commands.registerCommand('extension.sayHello', () => {
        wordCounter.updateWordCount();
        setWCTimeout();
        vscode.window
            .showInformationMessage(wordCounter._getWordCount(window.activeTextEditor.document).toString())
            .then(clearWCTimeout);
    });

    // Add to a list of disposables …
Run Code Online (Sandbox Code Playgroud)

typescript visual-studio-code vscode-extensions

8
推荐指数
2
解决办法
1133
查看次数

XSD 正则表达式:空字符串或其他内容

我正在尝试通过 C# 或 js 强制执行在 SEC 的 EDGAR 模式中找到的 XSD 正则表达式。

\n\n

我有以下 XSD 简单类型:

\n\n
<xs:simpleType name="ACCESSION_NUMBER_TYPE">\n    <xs:restriction base="xs:token">\n        <xs:pattern value="[*]{0}|[0-9]{1,10}\\-[0-9]{1,2}\\-[0-9]{1,6}"/>\n    </xs:restriction>\n</xs:simpleType>\n
Run Code Online (Sandbox Code Playgroud)\n\n

它恰好来自 eis_Common.xsd,包含在 zip 文件中,您可以从SEC 的 EDGARLink 在线页面下载。可以在 eis_ABS_15GFiler.xsd 中找到几乎重复的定义,但该类型的限制的基础是xs:string

\n\n
<xs:simpleType name="ACCESSION_NUMBER_TYPE">\n    <xs:restriction base="xs:string">\n        <xs:pattern value="[*]{0}|[0-9]{1,10}\\-[0-9]{1,2}\\-[0-9]{1,6}"/>\n    </xs:restriction>\n</xs:simpleType>\n
Run Code Online (Sandbox Code Playgroud)\n\n

对于上面的模式,我认为允许空白或空值。我将上述模式翻译为两个子句,通过 OR 组合在一起。第一个子句 ( [*]{0}) 匹配...

\n\n
\n

唯一成员为星号 \xe2\x80\x93 的字符类 CM Sperberg-McQueen

\n
\n\n

...零次,这意味着空字符串或空 XML 节点值。第二个子句匹配 ( [0-9]{1,10}\\-[0-9]{1,2}\\-[0-9]{1,6})“一到十位数字,连字符,一到两位数字,连字符,一到六位数字”。

\n\n

但是 SEC 拒绝与上述简单类型对应的具有 null 或空值的 XML 节点。

\n\n

在我的方法中,这一特殊模式是个例外。对于我测试过的每个其他简单类型(通过正则表达式模式在 SEC 的 EDGAR …

javascript c# regex xml xsd

3
推荐指数
1
解决办法
2780
查看次数