小编Cha*_*hau的帖子

使用SQLite如何索引CREATE TABLE语句中的列?

如何在CREATE TABLE语句中索引列?表格看起来像

command.CommandText =
    "CREATE TABLE if not exists file_hash_list( " +
        "id    INTEGER PRIMARY KEY, " +
        "hash  BLOB NOT NULL, " +
        "filesize INTEGER NOT NULL);";
command.ExecuteNonQuery();
Run Code Online (Sandbox Code Playgroud)

我希望filesize是索引,并希望它是4个字节

sqlite

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

Linq:长列表中的列表列表

我有一个类型的对象,A它由一个类型为的对象列表组成B:

class A { list<B> Alist;}
class B { string C; string D;}
Run Code Online (Sandbox Code Playgroud)

在我的程序中,我有一个A对象列表:

list<A> listOfA = computeAList();
Run Code Online (Sandbox Code Playgroud)

我想选择C该列表中的所有字符串.我希望以下陈述能给我我想要的结果; 它返回一个包含C's 的列表列表:

var query = from objectA in listOfA
            select objectA.Alist.FindAll(x => x.C.Length > 0).C;
Run Code Online (Sandbox Code Playgroud)

有没有办法获得所有的单一列表C

c# linq

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

使ExtJS 4网格内容可选

ExtJS 4(Sencha)中的网格默认情况下不允许选择内容.但我想让这成为可能.

我试过这个网格配置:

viewConfig: {
    disableSelection: true,
    stripeRows: false,
    getRowClass: function(record, rowIndex, rowParams, store){
        return "x-selectable";
    }
},
Run Code Online (Sandbox Code Playgroud)

使用这些css类(基本上针对我在Chrome中可以看到的每个元素):

/* allow grid text selection in Firefox and WebKit based browsers */

.x-selectable,
.x-selectable * {
                -moz-user-select: text !important;
                -khtml-user-select: text !important;
    -webkit-user-select: text !important;
}

.x-grid-row td,
.x-grid-summary-row td,
.x-grid-cell-text,
.x-grid-hd-text,
.x-grid-hd,
.x-grid-row,

.x-grid-row,
.x-grid-cell,
.x-unselectable
{
    -moz-user-select: text !important;
    -khtml-user-select: text !important;
    -webkit-user-select: text !important;
}
Run Code Online (Sandbox Code Playgroud)

我知道你可以覆盖Ext 3中的网格行模板,如下所示,但我不知道如何在Ext 4中做同样的事情:

templates: {
    cell: new Ext.Template(
    '<td class="x-grid3-col x-grid3-cell x-grid3-td-{id} x-selectable …
Run Code Online (Sandbox Code Playgroud)

javascript extjs extjs4

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

ExtJS ComboBox下拉宽度比输入框宽度宽?

有没有办法将ExtJS(版本4)ComboBox的下拉菜单的宽度设置为宽于实际输入框的宽度?

我有一个comboxbox,我希望大约200px,但我在结果下拉列表上分页,宽度甚至不足以显示所有分页栏的控件.

这是我创建组合的代码:

var add_combo = Ext.create('Ext.form.field.ComboBox', 
    {
        id              : 'gbl_add_combo',
        store           : Ext.create('Ext.data.Store',
        {
            remoteFilter : true,
            fields : ['gb_id', 'title'],
            proxy  : 
            {
                type        : 'ajax',
                url         : 'index.php/store/get_items',
                reader      : 
                {
                    type            : 'json',
                    root            : 'records',
                    totalProperty   : 'total',
                    successProperty : 'success'
                },
                actionMethods : 
                {
                    read    : 'POST',
                    create  : 'POST',
                    update  : 'POST',
                    destroy : 'POST'
                }
            }
        }),
        listConfig:
        {
            loadingText: 'Searching...',
            emptyText: 'No results found'
        },
        queryMode       : 'remote',
        hideLabel       : true, …
Run Code Online (Sandbox Code Playgroud)

javascript user-interface combobox extjs extjs4

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

如何在ExtJs 4中获取REST响应消息?

我正在构建ExtJs 4的RESTFul Store示例.当Add或Delete请求失败时,我希望我的脚本显示REST服务器提供的错误.我已设法获取请求的成功状态(请参阅下面的代码),但我如何获得响应提供的消息?

商店:

    var store = Ext.create('Ext.data.Store', {
    model: 'Users',
    autoLoad: true,
    autoSync: true,
    proxy: {
        type: 'rest',
        url: 'test.php',
        reader: {
            type: 'json',
            root: 'data',
            model: 'Users'
        },
        writer: {
            type: 'json'
        },
        afterRequest: function(request, success) {
            console.log(success); // either true or false
        },
        listeners: { 
            exception: function(proxy, response, options) {

                // response contains responseText, which has the message
                // but in unparsed Json (see below) - so I think 
                // there should be a better …
Run Code Online (Sandbox Code Playgroud)

rest extjs extjs4

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

如何在Ext Js中自动选择(显示)组合框的第一个值?

这是我的组合框

{
    xtype: 'combo', 
    fieldLabel: LANG.LOGIN_LANG,
    id : 'lang', 
    store: [
        ['tr','Türkçe'],
        ['ru','???????'],
        ['en','English']
    ],
    mode: 'local',
    triggerAction: 'all',
    selectOnFocus:true
},
Run Code Online (Sandbox Code Playgroud)

combobox extjs extjs3

16
推荐指数
3
解决办法
5万
查看次数

XML异常:无效字符

我正在开发一个小项目,它从一个长期运行的应用程序接收字符串形式的XML数据.我正在尝试将此字符串数据加载到XDocument(System.Xml.Linq.XDocument)中,然后从那里执行一些XML Magic并为数据报告创建xlsx文件.

有时,我收到包含无效XML字符的数据,并且在尝试将字符串解析为a时XDocument,我收到此错误.

[System.Xml.XmlException]消息:'?',十六进制值0x1C,是无效字符.

由于我无法控制远程应用程序,因此您可以期待任何类型的角色.

我很清楚XML有一种方法可以将字符放在其中,例如类似的&#x1C东西.

如果可能的话,我会非常喜欢保留所有数据.如果没有,那就不要了.


我已经考虑过以编程方式编辑响应字符串,然后返回并尝试重新解析如果抛出异常,但我尝试了一些方法,但它们似乎都没有成功.

谢谢你的想法.

代码就是这样的:

TextReader  tr;
XDocument  doc;

string           response; //XML string received from server. 
... 
tr = new StringReader (response);   

try
{
    doc = XDocument.Load(tr);
}
catch (XmlException e)
{
    //handle here?
}
Run Code Online (Sandbox Code Playgroud)

c# xml linq-to-xml

13
推荐指数
3
解决办法
3万
查看次数

如何在json-store中添加记录

var store = new Ext.data.JsonStore({
    id:'jfields',
    totalProperty:'totalcount',
    root:'rows',
    url: 'data.php',  
    fields:[{ name:'jfields' },
            { name:'firstyear' , mapping :'firstyear' , type:'float' },
            { name:'secondyear', mapping :'secondyear',    type:'float' },
            { name:'thirdyear' , mapping :'thirdyear' , type:'float' },
            { name:'fourthyear', mapping :'fourthyear',    type:'float' },
            { name:'fifthyear' , mapping :'fifthyear' ,    type:'float' } ]

    }                                                    
});
Run Code Online (Sandbox Code Playgroud)

我想要的是在这个商店的最后添加数据,但我完全困惑,我做的是我添加以下代码但不工作.

listeners: {
    load : function(){
        BG_store.add([{"jfields":"Monthly","firstyear":22.99,"secondyear":21.88,"thirdyear":21.88,"fourthyear":22.99,"fifthyear":21.88}]);
    }
}
Run Code Online (Sandbox Code Playgroud)

但我不认为我的概念已被清除,请任何机构以某种方式表明如何做到这一点.

extjs

12
推荐指数
3
解决办法
5万
查看次数

包装在IFrame中的网页限制?

我正在开发一个网页,我们的客户希望通过将我的页面包装在iframe(跨域)中来插入他们的网站.我不需要与父母互动或了解iframe之外的任何内容.

我正在使用HTML,CSS,JavascriptWebservices.

问:我如何限制内部的iframe相比,如果我的网页是在外面跑的iframe

javascript iframe cross-domain

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

ExtJS:使用"记住我"功能登录

我正在尝试使用非常常见的"记住我"功能创建一个简单的登录窗口.登录验证是完成AJAX样式的,因此浏览器将不记得我的输入.

我的方法是使用内置state功能,但如何使用它会让我感到困惑.

Ext.state.Manager.setProvider(new Ext.state.CookieProvider({
    expires: new Date(new Date().getTime()+(1000*60*60*24*7)), //7 days from now
}));

...

{
    xtype: 'textfield',
    fieldLabel: 'User name',
    id: 'txt-username',
    stateful: true,
    stateId: 'username'
}, {
    xtype: 'textfield',
    fieldLabel: 'Password',
    id: 'txt-password',
    inputType: 'password',
    stateful: true,
    stateId: 'password'
}, {
    xtype: 'button',
    text: 'Validate',
    stateEvents: 'click'
}
Run Code Online (Sandbox Code Playgroud)

我知道我必须实现该getState方法,但是在哪个组件上(我的猜测是在两个文本域中)?我没有意识到的另一件事是,按钮上的click事件如何连接到我的textfields的状态属性?

ajax state login extjs remember-me

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