小编Mik*_*oud的帖子

在另一个powerTip中有一个jQuery powerTip吗?

构架

目的

我想拥有powerTip另一个内心powerTip.

目前的结果

第一个tip(tip1)显示正常但第二个(tip2)根本不显示.工作的CSS tip2,底部边框显示和所有,但当你滚动它时,powerTip将不会显示.

HTML

<p>
    Blah blah blah blah blah
    <span data-powertiptarget="tip1">Blah</span>
    and more blah blah blah.
</p>

<div id="tip1" class="tooltip-div">
    <p>
        Email: <a href="mailto:me@somebody.com">me@somebody.com</a><br/>
        <span data-powertiptarget="tip2">Nomenclature</span>: Blah
    </p>
</div>

<div id="tip2" class="tooltip-div">
    Nomenclature: blah blah blah blah.
</div>
Run Code Online (Sandbox Code Playgroud)

CSS

.tooltip {
    border-bottom: 1px dashed #333333;
}

.tooltip-div {
    display: none;
}

#powerTip {
    text-align: left;
}

#powerTip a {
    color: …
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery

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

在编写DataSet扩展时,DataRow构造函数不可访问?

我想写一对夫妇的扩展,转换UniDataSetsUniRecordsDataSetDataRow,但我得到以下错误,当我尝试编译.

由于其保护级别,'System.Data.DataRow.DataRow(System.Data.DataRowBuilder)'无法访问

有没有办法解决这个问题,还是应该放弃这种方法并采用不同的方式?

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Data;
    using IBMU2.UODOTNET;

    namespace Extentions
    {
        public static class UniDataExtentions
        {
            public static System.Data.DataSet ImportUniDataSet(this System.Data.DataSet dataSet, IBMU2.UODOTNET.UniDataSet uniDataSet)
            {
                foreach (UniRecord uniRecord in uniDataSet)
                {
                    DataRow dataRow = new DataRow();
                    dataRow.ImportUniRecord(uniRecord);
                    dataSet.Tables[0].ImportRow(dataRow);
                }

                return dataSet;
            }

            public static void ImportUniRecord(this System.Data.DataRow dataRow, IBMU2.UODOTNET.UniRecord uniRecord)
            {
                int fieldCount = uniRecord.Record.Dcount();

                // ADD COLUMS
                dataRow.Table.Columns.AddRange(new DataColumn[fieldCount]);

                // ADD ROW …
Run Code Online (Sandbox Code Playgroud)

c# extension-methods system.data

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

共享程序集中的Attribute上的TypeLoadException

更新时间10月29日11月7日MST

奇怪的是,如果我将属性从ComponentModel文件夹移回Common项目的根目录,代码工作正常.在为InflowHealth.Common.ComponentModel命名空间重构所有引用之后,我无法想象可能引用旧命名空间的内容.

这几乎就像有一些引用隐藏在一些不是基于代码而是运行时和动态的地方,但我确实在查看所有查找结果时都看不到它InflowHealthErrorContext.

更新19:33 MST 11/6

有趣的是,当我注释掉使用自定义属性继承路由的行并使用默认路由时,它仍然会爆炸.更令人感兴趣的是,在重构它并将其移动到文件夹(和命名空间)之前,它正在寻找的命名空间InflowHealth.Common.InflowHealthErrorContextAttribute 实际上是旧的FQN ComponentModel.

更新07:42 MST 11/6

我相信我已经确定该问题与我用来继承操作的另一个自定义属性有关.此属性添加到HttpConfiguration以下内容中:

public static void MapInheritedAttributeRoutes(this HttpConfiguration config)
{
    config.MapHttpAttributeRoutes(new InheritanceDirectRouteProvider());
}
Run Code Online (Sandbox Code Playgroud)

该属性的实现非常简单:

public class InheritanceDirectRouteProvider : DefaultDirectRouteProvider
{
    protected override IReadOnlyList<IDirectRouteFactory> GetActionRouteFactories(HttpActionDescriptor actionDescriptor)
    {
        return actionDescriptor.GetCustomAttributes<IDirectRouteFactory>(true);
    }
}
Run Code Online (Sandbox Code Playgroud)

看来继承此InflowHealthErrorContext属性会导致问题,但我不确定问题究竟是什么.我试过了:

  • 删除,Inherited = false以便它可继承的.
  • 删除AllowMultiple = true只是因为配置错误.

那些没有改变错误.


原始邮政

我在Common一些Web API应用程序共享的程序集中有一个非常简单的属性.这很简单,我只是无法弄清楚会导致这个异常的原因.

我试图在此收集Fusion日志,但它没有记录它们.

这是Attribute:

using …
Run Code Online (Sandbox Code Playgroud)

.net c# attributes asp.net-web-api

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

停止DefaultMembershipProvider的EF数据库初始化

团队,我有一个我正在部署的ASP.NET MVC应用程序.当我部署它时,应用程序工作正常,但是当我调用Membership.CreateUser它时,最终尝试创建数据库,即使它已经存在.CreateMembershipEntities由于数据库已经存在,我需要做什么才能使它不会尝试调用?

我试过Database.SetInitializer一个什么都不做的初始化程序,我已经尝试删除defaultConnectionFactory了Web.config - 我目前没有选择.

我期待着你的帮助!

UPDATE

我昨天刚刚发现,它试图创建数据库的原因是因为主机服务器不允许连接查询sysdatabases,因此数据库永远不存在,因此总是试图创建它.看来我可能不得不回到老式的AspNet会员提供商那里,并且还要远离EF代码的第一个模型.

<rant> 从更个人的角度来说,我想让微软知道,谢谢你!这个代码第一个模型适用于部署在您拥有的服务器上的应用程序 - 但是将它们放在云中(无论如何都是这样)并且您运气不好.干得好微软!为什么不尝试实际连接到数据库以查看它是否存在?!?如果连接成功,它必须存在 - 否则我猜它没有. </rant>

membership-provider entity-framework-4.1 asp.net-mvc-4

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

使用IValueConverter进行动态样式绑定

我试图App.xaml在加载用户控件时动态设置一个样式,并且由于某些原因它没有应用样式(即没有发生错误,它只是没有应用样式).

我确定这是因为我已经定义了绑定错误,但是我无法弄清楚我需要采取哪些不同的方法才能让它发挥作用.

App.xaml风格

我追求的风格是RunningTitleBlock,它包含了我在下面的代码示例中包含的其他几种风格.

<Style TargetType="Label">
    <Setter Property="Margin" Value="4"/>
</Style>

<Style TargetType="Label"
       BasedOn="{StaticResource {x:Type Label}}"
       x:Key="HeaderBlock">
    <Setter Property="FontSize" Value="16"/>
    <Setter Property="FontWeight" Value="Bold"/>
    <Setter Property="Foreground" Value="White"/>
</Style>

<Style TargetType="Label"
       BasedOn="{StaticResource ResourceKey=HeaderBlock}"
       x:Key="TitleBlock">
    <Setter Property="Foreground" Value="Black"/>
</Style>

<Style TargetType="Label"
       BasedOn="{StaticResource ResourceKey=TitleBlock}"
       x:Key="RunningTitleBlock">
    <Setter Property="Background">
        <Setter.Value>
            <LinearGradientBrush StartPoint="0.0, 0.5"
                                 EndPoint="1.0, 0.5">
                <GradientStop Color="White" Offset="0.0"/>
                <GradientStop Color="Green" Offset="1.0"/>
            </LinearGradientBrush>
        </Setter.Value>
    </Setter>
</Style>
Run Code Online (Sandbox Code Playgroud)

绑定用户控件

我试图Binding绑定到值转换器返回的值.

Style="{DynamicResource ResourceKey={Binding Path=MonitoringType, Converter={StaticResource TSConverter}}}"
Run Code Online (Sandbox Code Playgroud)

MonitoringTypes枚举

public enum MonitoringTypes
{
    Running,
    Failed,
    Paused, …
Run Code Online (Sandbox Code Playgroud)

wpf custom-controls

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

从MVC HttpPost向jQuery返回错误

我在控制器中有一个方法,如下所示:

[HttpPost]
public void UnfavoriteEvent(int id)
{
    try
    {
        var rows = _connection.Execute("DELETE UserEvent WHERE UserID = (SELECT up.UserID FROM UserProfile up WHERE up.UserName = @UserName) AND EventID = @EventID",
            new { EventID = id, UserName = User.Identity.Name });
        if (rows != 1)
        {
            Response.StatusCode = 500;
            Response.Status = "There was an unknown error updating the database.";
            //throw new HttpException(500, "There was an unknown error updating the database.");
        }
    }
    catch (Exception ex)
    {
        Response.StatusCode = 500;
        Response.Status = ex.Message; …
Run Code Online (Sandbox Code Playgroud)

.net c# error-handling jquery asp.net-mvc-4

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

使用带有<%@ Register%>的空TagPrefix

虽然我可以在页面顶部成功完成此操作:

<%@ Register TagPrefix="me" Namespace="MyNamespace" %>
Run Code Online (Sandbox Code Playgroud)

然后使用这样的类:

<Usercontrol:DataRowTextBox ...>
    <Regexes>
        <me:RegularExpressionValidatorItem Type="USPhoneNumber" />
        <me:RegularExpressionValidatorItem Type="InternationalPhoneNumber" />
    </Regexes>
</Usercontrol:DataRowTextBox>
Run Code Online (Sandbox Code Playgroud)

我真的很想这样做:

<%@ Register TagPrefix="" Namespace="MyNamespace" %>
Run Code Online (Sandbox Code Playgroud)

这样我以后可以这样使用它:

<Usercontrol:DataRowTextBox ...>
    <Regexes>
        <RegularExpressionValidatorItem Type="USPhoneNumber" />
        <RegularExpressionValidatorItem Type="InternationalPhoneNumber" />
    </Regexes>
</Usercontrol:DataRowTextBox>
Run Code Online (Sandbox Code Playgroud)

但这给了我错误:

'tagprefix'属性不能是空字符串.

是不是有办法注册一个空,TagPrefix所以它可以在没有该前缀的情况下全局使用?

同样的概念,如果我可以做到正确,那么将有Usercontrol希望适用于前缀.

.net c# asp.net

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

动态搜索数组

我正陷入两难境地,我正在尝试创建一个"动态"搜索数组的函数,在这种情况下是我的会话数组,但它应该适用于任何数组.现在这不是我的问题,我的问题是动态地允许这样做......

这就是我所拥有的

public static function get($search = 'First/Second/Third') {    
    $explode = explode('/',$search);
    $count = count($explode);
    if ($count == 1)
        if (isset($_SESSION[$explode[0]]))
            return $_SESSION[$explode[0]];
    elseif ($count == 2)
        if (isset($_SESSION[$explode[0]][$explode[1]]))
            return $_SESSION[$explode[0]][$explode[1]];
    elseif ($count == 3)
        if (isset($_SESSION[$explode[0]][$explode[1]][$explode[2]]))
            return $_SESSION[$explode[0]][$explode[1]][$explode[2]];
}
Run Code Online (Sandbox Code Playgroud)

所以我想说我有一个数组:

 array('First' => array('Second' => array('Third' => 'TEST VALUE'));
Run Code Online (Sandbox Code Playgroud)

现在我想打电话

$value = get('First/Second/Third');
Run Code Online (Sandbox Code Playgroud)

然后将"Test Value"作为$ value变量的值返回.

在这种情况下它可以工作,但它不是动态的,我希望它能够处理甚至10层深的阵列,而不添加越来越多的线....

那么也许有人在这里比我聪明:)

谢谢!!

php arrays

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

ASP.net中的字符串比较(C#)

我正在编写与ASP.net Web服务连接的Android应用程序(C#,3.5)

android应用程序将用户的"登录"信息发送到Web服务,以验证用户是否已注册.

这是[WebMethod]收到请求的人:

[WebMethod]
public SigninPerson signin(SigninPerson SIPerson)
{
    SigninPerson Temp = new SigninPerson(0, "", "", "", "");
    LinqToSQLDataContext DataBase = new LinqToSQLDataContext();
    var Person = (from a in DataBase.Persons
                  where a.Email == SIPerson.E_Mail &&
                      a.Password.Equals(SIPerson.Password,StringComparison.Ordinal)
                  select new SigninPerson
                  {
                      Person_Id = a.Person_Id,
                      F_Name = a.First_Name,
                      L_Name = a.Last_Name,
                      E_Mail = a.Email,
                      Password = a.Password
                  });
    if (Person.Any() == true)
    {
        Temp = Person.FirstOrDefault();
    }
    return Temp;
}
Run Code Online (Sandbox Code Playgroud)

SigninPerson 是一个保存用户信息的类,如名字,姓氏,密码....

问题出在密码比较中.它接受了所有的案件

例如:

如果存储在DataBase中的某人的密码是"ABD",并且用户输入"abd"作为密码,则应用程序接受它!(不区分大小写 !!!)

如何解决这个问题呢?

.net c# linq string-comparison

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

Task.Run没有像我想象的那样异步运行?

我有一个导入操作,我想在另一个线程上执行,希望UI立即响应.所以,我开始沿着这条路走下去并创建了一个这样的动作:

[HttpPost]
public async Task<RedirectToRouteResult> ImportAsync(HttpPostedFileBase file)
{
    var importsRoot = Server.MapPath("~/App_Data/Imports");
    var path = Path.ChangeExtension(Path.Combine(importsRoot, Guid.NewGuid().ToString()), "txt");

    if (!Directory.Exists(importsRoot))
    {
        Directory.CreateDirectory(importsRoot);
    }

    file.SaveAs(path);

    // start the import process
    await ImportManager.Instance.StartImport(User.Identity.Name);

    return RedirectToAction("Index");
}
Run Code Online (Sandbox Code Playgroud)

ImportManager现在有两个目的:

  1. 处理导入.
  2. 通过SignalR通知所有客户输入状态.

StartImport方法如下所示:

public async Task StartImport(string user)
{
    string[] files;

    var importRoot = HttpContext.Current.Server.MapPath("~/App_Data/Imports");
    var processingRoot = HttpContext.Current.Server.MapPath("~/App_Data/Processing");
    var processedRoot = HttpContext.Current.Server.MapPath("~/App_Data/Processed");

    lock (lockObj)
    {
        //  make sure the "Processing" folder exists
        if (!Directory.Exists(processingRoot))
        {
            Directory.CreateDirectory(processingRoot);
        }

        //  find all …
Run Code Online (Sandbox Code Playgroud)

c# asynchronous async-await asp.net-mvc-5

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