小编cll*_*pse的帖子

Visual Studio 2008中的JavaScript智能感知

你有没有得到任何提示或黑客,以充分利用Visual Studio 2008中的JavaScript intellisense选项?

Visual Studio向我显示"名称空间"并使用文档功能(<param><summary>).我一直无法得到<return>文档功能.

现在,这一切都很好.但是,当我调用特权函数时,Visual Studio不知道它,因此我没有得到任何文档.

有没有什么方法可以将公共变量和特权函数暴露给Visual Studios智能感知功能,同时仍然使用私有成员创建对象?

javascript visual-studio-2008

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

SQL Server:动态where子句

问题:

Ajax建议 - 在食谱中搜索[ n ]成分.那就是:匹配多种成分的配方.

例如:SELECT Recipes using "flower", "salt"会产生:"Pizza", "Bread", "Saltwater"等等.

表:

Ingredients [
    IngredientsID INT [PK],
    IngredientsName VARCHAR
]

Recipes [
    RecipesID INT [PK],
    RecipesName VARCHAR
]

IngredientsRecipes [
    IngredientsRecipesID INT [PK],
    IngredientsID INT,
    RecipesID INT
]
Run Code Online (Sandbox Code Playgroud)

查询:

SELECT
    Recipes.RecipesID,
    Recipes.RecipesName,
    Ingredients.IngredientsID,
    Ingredients.IngredientsName
FROM
    IngredientsRecipes

    INNER JOIN Ingredients
    ON IngredientsRecipes.IngredientsID = Ingredients.IngredientsID

    INNER JOIN Recipes
    ON IngredientsRecipes.RecipesID = Recipes.RecipesID
WHERE
    Ingredients.IngredientsName IN ('salt', 'water', 'flower')
Run Code Online (Sandbox Code Playgroud)

我目前正在使用ASP.NET C#构建我的查询,因为该WHERE子句具有动态特性.

我咬了一下,我必须在我的代码层中构建查询,而不是使用存储过程/纯SQL,理论上应该更快.

你有没有想过如何将我的代码层中的所有逻辑移动到纯SQL,或者至少我如何优化我正在做的事情的性能?

我正在考虑临时表:

第一步 …

c# sql-server performance

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

ASP.NET 3.5版网站:文件"vwd.webinfo"究竟做了什么?什么是膨胀的web.config文件?

我正在运行Visual Studio Team Edition 2008.


当我创建一个新网站时,我得到一个我以前从未见过的新文件:vwd.webinfo.

该文件的内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<VisualWebDeveloper>
    <!-- Visual Studio global web project settings. -->
    <StartupServices>
        <Service ID="{3259AA49-8AA1-44D3-9025-A0B520596A8C}"/>
    </StartupServices>
</VisualWebDeveloper>
Run Code Online (Sandbox Code Playgroud)

我需要什么"全球网络项目设置"文件?它究竟做了什么?


也; 什么是膨胀的web.config文件?在标准的ASP.NET 2.0版网站项目中,web.config文件包含大约10行代码.但是在ASP.NET 3.5版网站项目中,它充满了各种奇怪的设置.

asp.net-3.5 visual-studio-2008

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

JavaScript minifyer,可以与ASP.NET应用程序的构建集成

灵感来自这个答案 ..你们可以指点我类似的东西 - 可以集成到构建脚本中,或者可能直接集成到Visual Studio中吗?

javascript asp.net build-automation minify

5
推荐指数
2
解决办法
299
查看次数

基于 window.location.href 的条件 URL 附加或重定向的 Javascript

我正在尝试制作一个书签,单击该书签时将检查当前选项卡/窗口的 URL,以查看它是否包含“char1”和/或“char2”(给定字符)。如果两个字符都存在,它将重定向到另一个 URL,对于另外两个字符,它将分别附加当前 URL。

我相信一定有一种比下面的更优雅的方式来说明这一点(到目前为止对我来说效果很好),但我对 Javascript 不太了解。我的(笨拙且重复的)工作代码(抱歉):

if (window.location.href.indexOf('char1') != -1 &&
    window.location.href.indexOf('char2') != -1)
{
    window.location="https://website.com/";
}
else if (window.location.href.indexOf('char1') != -1)
{
    window.location.assign(window.location.href += 'append1');
}
else if (window.location.href.indexOf('char2') != -1)
{
    window.location.assign(window.location.href += 'append2');
}
Run Code Online (Sandbox Code Playgroud)

完全符合我的需要,但是,嗯……至少可以说不太优雅。

有没有更简单的方法来做到这一点,也许使用变量或伪对象?或者更好的代码?

javascript url bookmarklet append conditional-statements

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

迷失在翻译中 - C#正则表达式使用JavaScript正则表达式

我在将我的工作C#正则表达式转换为JavaScript的正则表达式实现时遇到了一些麻烦.

这是正则表达式:

([a-z]+)((\d+)([a-z]+))?,?
Run Code Online (Sandbox Code Playgroud)

使用时"water2cups,flour4cups,salt2teaspoon"你应该得到:

[
    ["water", "2cups", "2", "cups"]
    ["flout", "4cups", "4", "cups"]
    ["salt", "2teaspoon", "2", "teaspoon"]
]
Run Code Online (Sandbox Code Playgroud)

......确实如此.在C#中.但不是在JavaScript中.

我知道各实现之间存在一些细微差别.为了让这个表达式在JavaScript中工作,我错过了什么?

更新

我正在使用正则表达式:

"water2cups,flour4cups,salt2teaspoon".match(/([a-z]+)((\d+)([a-z]+))?,?/g);
Run Code Online (Sandbox Code Playgroud)

javascript regex

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

在接口中定义类实现

你能在界面中定义类实现吗?

例如(伪代码警报!)......

interface IClass1
{
    String s { get; set; }

    // classes implementing this interface has to implement Class2 as "SubClass"
    Class2 SubClass;
}

interface IClass2
{
     Int32 i { get; set; }
}

class Class1 : IClass1
{
    String IClass1.s { get; set; }

    class IClass1.Class2 SubClass
    {
        Int32 IClass2.i { get; set; }
    }
}
Run Code Online (Sandbox Code Playgroud)

c# interface

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

LINQ和递归

考虑以下:

public class Box
{
    public BoxSize Size { get; set; }

    public IEnumerable<Box> Contents { get; set; }
}

Box FindBoxBySize(Box box, BoxSize size)
{
    Box _foundBox = null;

    Action<IEnumerable<Box>> _recurse = null;

    _recurse = new Action<IEnumerable<Box>>(boxes =>
    {
        foreach (var _box in boxes)
        {
            if (_box.Size == size)
            {
                _foundBox = _box;

                return;
            }

            if (_box.Contents != null) _recurse(_box.Contents);
        }
    });

    _recurse(box.Contents);

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

有没有什么方法FindBoxBySize()可以使用LINQ压缩?另外:欢迎评论我的代码.我没有做太多的递归,所以我可能在实现中遗漏了一些东西.

c# linq recursion

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

Sencha Touch - 需要嵌套列表示例

我需要一个简单的嵌套列表视图示例.有点像这样......

http://www.roosteronacid.com/mockup.png

当您单击某个项目时,您将转换(滑动)到包含另一个列表的下一个视图/卡片,并在顶部菜单中显示"后退"按钮.等等等等.

列表不一定要有三个级别.我想要一个例子,其中包括一个带有三个子项目的项目,以及一个带您直接进入"最终"视图的项目.

sencha-touch

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

将JPEG图像调整为固定宽度,同时保持纵横比不变

如何在保持纵横比的同时将JPEG图像调整为固定宽度?以简单的方式,同时保持质量.

c# aspect-ratio image-resizing

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