小编smo*_*oak的帖子

有没有办法禁用jquery DataTables的初始排序?

我正在使用jquery DataTables插件.从他们的文件:

如果启用了排序,则DataTables将在初始化时执行第一次排序.您可以使用此变量定义执行排序的列以及排序方向.aaSorting数组应包含一个数组,用于最初排序的每列,包含列的索引和方向字符串('asc'或'desc').

是否可以启用排序但在初始化时禁用此第一次排序?我目前正在进行初始排序服务器端并需要排序功能,但不需要这种初始排序功能.

jquery jquery-datatables

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

ASP.net缓存绝对到期不起作用

我在HttpContext.Cache中存储一个整数值,绝对到期时间为5分钟.但是,在等待6分钟(或更长时间)之后,整数值仍然在缓存中(即,即使绝对过期已经过去,它也永远不会被删除).这是我正在使用的代码:

public void UpdateCountFor(string remoteIp)
{
    // only returns true the first time its run
    // after that the value is still in the Cache
    // even after the absolute expiration has passed
    // so after that this keeps returning false
    if (HttpContext.Current.Cache[remoteIp] == null)
    {
        // nothing for this ip in the cache so add the ip as a key with a value of 1
        var expireDate = DateTime.Now.AddMinutes(5);
        // I also tried:
        // var expireDate = DateTime.UtcNow.AddMinutes(5); 
        // …
Run Code Online (Sandbox Code Playgroud)

asp.net caching c#-4.0 asp.net-mvc-3

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

如何指定每个flavor buildType sourceSets?

我有两种版本的应用程序,每个应用程序都有自己的谷歌地图(v1)密钥用于调试和发布(总共4个密钥).所以我想知道我是否可以根据buildType和productFlavor指定sourceSets.从本质上讲,我想知道如何实现这样的目标:

src
??? debug
?   ??? flavor1
?       ??? res
?           ??? values
?               ??? gmaps_key.xml
??? release
?   ???flavor1
?       ??? res
?           ??? values
?               ??? gmaps_key.xml
Run Code Online (Sandbox Code Playgroud)

gradle将使用src/<currentBuldType>/<currentProductFlavor>/*其sourceSet的一部分.

基本上我希望它这样,如果我跑gradle assembleFlavor1Debug这将包括所有下src/main/*,src/flavor1/*和src/debug/flavor1/*.

我的build.gradle非常简单:

buildscript {
    repositories {
        mavenCentral()
    }   

    dependencies {
        classpath 'com.android.tools.build:gradle:0.5.0'
    }   
}

apply plugin: 'android'

android {
    compileSdkVersion 8

    productFlavors {
        flavor1 {
            packageName 'com.flavor1'
        }
        flavor2 {
            packageName 'com.flavor2'
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

有什么想法吗?或者更好的方法呢?

android gradle

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

使用msbuild 4.0时,aspnetcompiler的版本错误

我正在尝试在自定义msbuild文件中使用AspNetCompiler任务来预编译asp .net 4.0网站.但是,当我跑:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe custom.msbuild /t:PrecompileWeb
Run Code Online (Sandbox Code Playgroud)

它使用v2.0.50727 aspnet_compiler.有没有办法强制它使用v4.0.30319 aspnet_compiler?我问的原因是因为我收到了这个错误:

ASPCONFIG: Unrecognized configuration section system.web.extensions.
Run Code Online (Sandbox Code Playgroud)

但是,如果我跑:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_compiler.exe -p .\My.Web.Site -f .\.PRECOMPILATION -v /
Run Code Online (Sandbox Code Playgroud)

它运行正常,这是有道理的,因为我在web.config中使用system.web.extensions而2.0 aspnet_compiler不知道那是什么.

msbuild msbuild-task

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