问题列表 - 第32009页

jQuery方法是否是流畅编程的一个例子?

我对JavaScript/jQuery有些新意,但是当我看到方法链接的例子时,它立刻让我感到很熟悉.像LINQ其它接口做同样的事情,其中​​一组方法的返回类型是一样的,因为他们所操作的类型(TweetSharp确实非常类似的东西).这是流畅编程的一个例子吗?我读到的关于jQuery的大部分内容都说其他库已经"借用"了这种方法链接的想法 - 这个想法是否源于jQuery?

jquery fluent-interface method-chaining

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

简单的递归问题

假设我们有一个简单的递归.

int x(int a){
   if(a<10)
     x(a+1);
    else
      !STOP!
    b++;
return b;
}
Run Code Online (Sandbox Code Playgroud)

Globaly:

int b=0;
Run Code Online (Sandbox Code Playgroud)

在主要我们可以有这样的事情:

  int p=x(1);
Run Code Online (Sandbox Code Playgroud)

有没有办法停止递归,使p为0,这意味着永远不会执行"b ++".

如果你能告诉我一些表达而不是!停止,我将不胜感激!

但是,我不想要这样的东西,我只是想停止递归,就像休息一样; 在while()循环中执行...:

int ok=0;
  int x(int a){
       if(a<10)
         x(a+1);
        else
          ok=1;
      if(ok==0)
        b++;
    return b;
    }
Run Code Online (Sandbox Code Playgroud)

如果对这个问题有任何不清楚的地方,那就问问吧.

c++ recursion

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

StringLengthAttribute和本地化文本

以下代码是从MSDN中获取的:http://msdn.microsoft.com/en-us/library/system.componentmodel.dataannotations.stringlengthattribute.aspx

[MetadataType(typeof(ProductMetadata))]
public partial class Product
{

}

public class ProductMetadata
{

    [ScaffoldColumn(true)]
    [StringLength(4, ErrorMessage = "The ThumbnailPhotoFileName value cannot exceed 4 characters. ")]
    public object ThumbnailPhotoFileName;

}
Run Code Online (Sandbox Code Playgroud)

如何将本地化文本(例如:从资源文件中)应用于错误消息?

.net c# data-annotations

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

Struts2 JQuery如何做onchange ajax

假设我有这样的sj:autocompleter:

<sj:autocompleter  id="idDistributor" 
name="idDistributor" 
list="%{idDistributorList}"  label="ID
Distributor"  indicator="indicator" />
Run Code Online (Sandbox Code Playgroud)

当值改变时,我想将细节值传递给其他文本字段,如下所示:

<sj:textfield label="Nama Distributor" id="namaDistributor" name="namaDistributor" required="true"/>
Run Code Online (Sandbox Code Playgroud)

其值将从struts back bean(FormAction)中检索.

我怎么能这样做?

非常感谢提前.

Mr.K

java jquery struts2

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

使用MySQL后端开发C#项目的最佳方法是什么?

所以我正在使用C#2010 Express并想知道使用MySQL后端开发C#项目的最佳工具集是什么?我知道如果您在C#中使用SQL Server Compact版本,它将允许您直接从IDE访问数据库.是否有类似的方法将开发与远程MySQL数据库集成?

另外,MySQL是一个多功能的解决方案,可以用C#编写程序吗?我希望建立一个单独的PHP网站(一个报告门户)来访问MySQL数据.我喜欢一直开源,但似乎C#是创建我正在尝试创建的应用程序的最佳应用程序(用于数据输入的触摸屏界面).

c# mysql

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

线程是否为应用程序添加了大量开销?

随着我的应用程序的成熟,我发现自己越来越多地使用线程.到现在为止,我必须拥有大约25个线程,所有线程都在做重要的事情,并在交响乐中一起工作.

不过我注意到我的应用程序大约占15.5MB左右.与浏览器(+/- 35MB)相比,我觉得非常安全,但我确实注意到我的应用程序的常驻大小不断增加.

问题是,添加线程需要多少开销?

我也想知道synchronized关键字是否会遇到越来越多的延迟与每个新的线程存在?

谢谢!

java multithreading android

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

将Drop从.NET应用程序拖放到Explorer

我希望为用户提供将应用程序中的网格和其他控件中的文件拖放到资源管理器中的功能.那个好的样品/物品?

.net explorer drag-and-drop

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

优化F#字符串操作

我刚学习F#并且已经将C#扩展方法库转换为F#.我目前正在基于下面C#实现来实现一个名为ConvertFirstLetterToUppercase的函数:

public static string ConvertFirstLetterToUppercase(this string value) {
    if (string.IsNullOrEmpty(value)) return value;
    if (value.Length == 1) return value.ToUpper();
    return value.Substring(0, 1).ToUpper() + value.Substring(1);
}
Run Code Online (Sandbox Code Playgroud)

F#实现

[<System.Runtime.CompilerServices.ExtensionAttribute>]
module public StringHelper
    open System
    open System.Collections.Generic
    open System.Linq

    let ConvertHelper (x : char[]) =  
        match x with
            | [| |] | null -> ""
            | [| head; |] -> Char.ToUpper(head).ToString()
            | [| head; _ |] -> Char.ToUpper(head).ToString() + string(x.Skip(1).ToArray())

    [<System.Runtime.CompilerServices.ExtensionAttribute>]
    let ConvertFirstLetterToUppercase (_this : string) =
        match _this with …
Run Code Online (Sandbox Code Playgroud)

string f#

6
推荐指数
2
解决办法
2927
查看次数

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

NSFetchedResultsController刷新重新获取?

我想使用不同的谓词从我的NSFetchedResultsController重新获取数据,该谓词使用布尔值设置.如何刷新NSFetchedResultsController以获取一组新数据?

- (void)refreshFetchedResultsController {
    NSLog(@"refreshFetchedResultsController");

    NSError *error = nil;
    if (![[self fetchedResultsController] performFetch:&error]) {
        UIAlertView *alert = [[UIAlertView alloc]
                              initWithTitle:NSLocalizedString(@"Error loading data",
                                                              @"Error loading data")
                              message:[NSString stringWithFormat:



                                   NSLocalizedString(@"Error was: %@, quitting.", @"Error was: %@, quitting."),
                                   [error localizedDescription]]
                          delegate:self
                          cancelButtonTitle:NSLocalizedString(@"Cancel", @"Cancel")
                          otherButtonTitles:nil];
    [alert show];
}
Run Code Online (Sandbox Code Playgroud)

}

哪个叫

- (NSFetchedResultsController *)fetchedResultsController {
    if (_fetchedResultsController != nil) {
        NSLog(@"i was executed.");
        return _fetchedResultsController;
    }
    NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
    TapAppDelegate *appDelegate = (TapAppDelegate *)[[UIApplication sharedApplication] delegate];
    NSManagedObjectContext *managedObjectContext = appDelegate.managedObjectContext;
    NSEntityDescription *entity …
Run Code Online (Sandbox Code Playgroud)

iphone core-data

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