小编Ale*_*lex的帖子

关闭HTML5中的标签

在HTML5中,关闭<br>标签仍然合适<br />吗?

这显然也适用于所有其他单个标签.我意识到这实际上并不会影响工作原理,但这里的最佳做法是什么?

someLines of txt <br>            // How you see a lot of people doing it
and then some <br />             // XHTML style! Should I still be doing this? 
ow im not done yet.. <br> </br>  // No one does this right? RIGHT?!
Run Code Online (Sandbox Code Playgroud)

html5

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

定义对象时的initComponent与构造函数

当我应该使用initComponent比较constructor

我一直在使用initComponent来扩展我的对象,但查看Ext.define的文档是使用构造函数来查看它们然后放置.有什么不同?

相比:

Ext.define('My.app.PanelPart2', {
    extend: 'My.app.Panel',
    constructor: function (config) {
        this.callSuper(arguments); // calls My.app.Panel's constructor
        //...
    }
});
Run Code Online (Sandbox Code Playgroud)

Ext.define('My.app.PanelPart2', {
    extend: 'My.app.Panel',
    initComponent: function (config) {
        Ext.apply(this, config);
        this.callParent(arguments);
    }
});
Run Code Online (Sandbox Code Playgroud)

我知道有些组件没有初始化(我正在看着你Ext.data.Store),这导致我只倾向于编写构造函数,因为这应该是通用的.

extjs extjs4

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

在sql中的聚合函数中捕获空警告

如何在sql 2008/2012中使用调试器来捕获记录中的空值?

看到:

drop table abc

create table abc(
a  int
)
go 
insert into abc values(1)
insert into abc values(null)
insert into abc values(2)

select max(a) from abc

(1 row(s) affected)
Warning: Null value is eliminated by an aggregate or other SET operation.
Run Code Online (Sandbox Code Playgroud)

现在可以通过以下方式纠正:

SELECT max(isNull(a,0)) FROM abc
Run Code Online (Sandbox Code Playgroud)

这很好,直到我进行200行查询与几个级别的嵌套,结果集2000奇数记录. - 然后不知道哪一列发出警告.

如何在SQL调试器中添加条件断点(或中断警告)?(如果可能的话)

sql sql-server-2008

14
推荐指数
1
解决办法
6604
查看次数

使用Javascript握手SQL服务器

我想尝试,作为一个学习的例外,让我的javascript与sql聊天.

var ws = new WebSocket("ws://127.0.0.1:1433");
Run Code Online (Sandbox Code Playgroud)

似乎不是一个封闭的端口,所以理论上应该工作.

我正在寻找如何与sql server握手,并与它聊天的细分.

一个正确方向的指针将非常感激
(甚至解释为什么它不起作用的原因.)

我想在Microsoft SQL 2008 R2上尝试这个.

javascript sql sql-server websocket

9
推荐指数
1
解决办法
2621
查看次数

如何导出模块中的服务?

如何从 angular 2 的模块导出服务?

这个想法是,当我导入另一个组件时,我希望导入与实际服务位置无关,应该是模块的责任来管理它

核心.module.ts:

import {
NgModule,
Optional, SkipSelf } from '@angular/core';
import { CommonModule } from '@angular/common';

import { MyApi } from './Api/myApi.service';

import { AuthenticationModule } from './authentication/authentication.module';

@NgModule({
imports: [
    CommonModule,
    AuthenticationModule
],
providers: [
    MyApi
],
exports: [MyApi, AuthenticationModule]
})
export class CoreModule {
constructor( @Optional() @SkipSelf() parentModule: CoreModule) {
    if (parentModule) {
    throw new Error(
        'CoreModule is already loaded. Import it in the AppModule only');
    }
}

}
Run Code Online (Sandbox Code Playgroud)

App.component.ts:

import { Router, ActivatedRoute …
Run Code Online (Sandbox Code Playgroud)

angular

8
推荐指数
1
解决办法
1万
查看次数

ExtJs听众

我想在我的配置对象上运行一个onload事件.

以下工作,除非我创建一个

config.listeners={..}
Run Code Online (Sandbox Code Playgroud)

(我想那就是我需要的?)来取代

this.onload({...});
Run Code Online (Sandbox Code Playgroud)

我甚至使用正确的配置?(我一般都不知道事件处理)

Ext.define('data.SimpleStore', {
extend: 'Ext.data.Store'
,constructor: function (config) {

    config.url=config.url||"afsud"; //If no call, we assume that url has been passed. Pass neither and be shot
    config.id=config.url+'Store';//call should be unique, else its another set of headaches. 
    //console.log(config);
    Ext.define(config.id+'M', { //for a painful reason, you cant have a store without a model
        extend: 'Ext.data.Model',
        fields: []//we figure these out anyways
    });
    config.root=config.root||'data';
    config.type=config.type||'json';
    config.proxy= config.proxy||{ //note if we override our proxy, then server.php might not work as …
Run Code Online (Sandbox Code Playgroud)

javascript extjs dom-events

7
推荐指数
1
解决办法
4万
查看次数

获取函数调用者的范围

我有一个函数在ExtJS的第1433行打破了.

var createDelayed = function(h, o, scope){
console.log(arguments); //logs undefined all round. 
    return function(){
        var args = Array.prototype.slice.call(arguments, 0);
        setTimeout(function(){
            h.apply(scope, args);
        }, o.delay || 10);
    };
};
Run Code Online (Sandbox Code Playgroud)

有没有办法从内部查看函数执行的行?

(因为它是第三方lib,我真的不能这样做

var me =this;
Run Code Online (Sandbox Code Playgroud)

和日志me)

javascript extjs

6
推荐指数
1
解决办法
1万
查看次数

sql中的速记IF语句

目前我有一个存储过程,它接受一个字符串

@vari as varchar(30)
if @vari is null 
    SELECT * FROM TABLE 
else 
    SELECT * FROM TABLE WHERE col = @vari
endif
Run Code Online (Sandbox Code Playgroud)

是否有任何方法可以内联if语句,从而不会因为1个参数而声明2个选择?

sql sql-server

5
推荐指数
1
解决办法
3167
查看次数

javascript中的布尔代数

在JS中有没有办法使用布尔代数?

例如,我想遍历一个包含true和false的数组,并将其简化为true或false.

用布尔代数做它似乎是一种优雅的方式来做到这一点......

[true,true,true,true] //would like to do a comparison that lets me  
//simply add the previous value to  the current iteration of a loop
// and have this return true

[false,true,true,true]//this on the other hand should return false
Run Code Online (Sandbox Code Playgroud)

javascript boolean-logic

4
推荐指数
3
解决办法
3478
查看次数

ExtJS vtype作为函数

有没有办法在值上测试vType,而不是在表单中?

例如,我有一个自定义vtype实现了ajax验证,但是我也想对电子邮件vtype运行它,所以我希望在我的自定义vtype中运行一些东西.

validate('abc@de.ce','email');
Run Code Online (Sandbox Code Playgroud)

extjs

4
推荐指数
1
解决办法
3266
查看次数