小编mod*_*diX的帖子

从数组中删除最后一项

我有以下数组.

var arr = [1,0,2];
Run Code Online (Sandbox Code Playgroud)

我想删除最后一个元素,即2.

我使用arr.slice(-1);但它没有删除该值.

javascript arrays slice

388
推荐指数
18
解决办法
48万
查看次数

如何在C#中将对象转换为Dictionary <TKey,TValue>?

如何将动态对象转换为Dictionary<TKey, TValue>C#我该怎么办?

public static void MyMethod(object obj)
{
    if (typeof(IDictionary).IsAssignableFrom(obj.GetType()))
    {
        // My object is a dictionary, casting the object:
        // (Dictionary<string, string>) obj;
        // causes error ...
    }
    else
    {
        // My object is not a dictionary
    }
}
Run Code Online (Sandbox Code Playgroud)

.net c# dictionary object

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

IsDebuggingEnabled和Debugger.IsAttached之间有什么区别

System.Web.HttpContext.Current.IsDebuggingEnabled和之间有什么区别System.Diagnostics.Debugger.IsAttached吗?

如果是这样,除了一个仅用于Web应用程序而另一个用于所有类型的项目这一事实之外,还有哪些确切的区别?

.net c# asp.net

16
推荐指数
2
解决办法
7324
查看次数

Google Chrome不会在移动设备上播放HTML5视频

我在最新版Chrome中的Android手机上播放视频时遇到问题.在像Puffin浏览器这样的其他浏览器中,视频正在播放.出于测试目的,我尝试了所有常见格式:

mp4
<br />
<video autoplay="autoplay" loop="loop" onended="this.play()"><source src="http://clips.vorwaerts-gmbh.de/VfE_html5.mp4" type="video/mp4" /></video>
<br />
webm
<br />
<video autoplay="autoplay" loop="loop" onended="this.play()"><source src="http://clips.vorwaerts-gmbh.de/VfE.webm" type="video/webm" /></video>
<br />
ogg
<br />
<video autoplay="autoplay" loop="loop" onended="this.play()"><source src="http://clips.vorwaerts-gmbh.de/VfE.ogv" type="video/ogg" /></video>
Run Code Online (Sandbox Code Playgroud)

https://codepen.io/anon/pen/ozpVNP

CodePen的QR码

在手机上预览

根据Mozilla的第一个视频,即MP4中的H.264 + AAC应该播放.我还考虑了这篇文章,并尝试通过JavaScript播放视频,并试图删除type第一个video标签上的属性但没有成功.

如何在Chrome on Mobile上运行?

html video html5 google-chrome

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

无法启动程序'http://localhost/Default.aspx'.VS2010

我不能再从Visual Studio 2010启动我的网站了.

有几天我无法使用F5在Web浏览器中启动我的项目.当我通过键入相同的URL'http ://localhost/Default.aspx ' 直接打开我的Web应用程序时,everthing工作正常.

当我运行项目(F5)时,一个新的webbrowser启动,但几秒钟后它就卡住了,Visual Studio会给出一个错误对话框:


Microsoft Visual Studio

无法启动程序' http://localhost/Default.aspx '.


当我在发布模式下运行项目时,它会产生一个额外的错误:


Microsoft Visual Studio

以下模块是在启用优化或没有调试信息的情况下构建的:

C:\ WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\root\6552bec6\694bce32\assembly\dl3\8c9bd8d8\fb1d75cb_af26cc01\[name] .Presentation.DLL

要调试此模块,请将其项目构建配置更改为调试模式.要禁止显示此消息,请禁用"如果启动时没有用户代码,则调用警告"选项.


我已经修复,删除并重新安装了Visual Studio 2010,我尝试使用不同的浏览器(包括Chrome和Firefox),使用不同的aspnet_regiis.exe选项等.

什么都没有帮助,是的,现在我被困在头上拉头发......

任何人都知道如何解决这个问题?

debugging release visual-studio-2010

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

"ReferentialConstraint中的依赖属性映射到存储生成的列." 在持久计算列上(EntityFramework DB优先)

我基于SQL Server中的实现表继承一文,在我的SQL-Server中实现了一个模拟表继承构造.

除了使用简单的1到0 ... 1关系之外,您还可以为类型表创建另一个约束,该类型表列出了基表的所有可能子类型,如"建模一对一约束"一节中的文章中所述.

每个子表都包含一个TYPE字段,该字段具有ComputedColumnSpecification,其持久化编号表示类型表中类型的ID.由于TYPE字段是约束的一部分,因此它将确保只能为基础数据集创建一个子节点.

为了更好地理解,我创建了一个示例数据库,用于描述匹配的ASP.NET解决方案的问题.要在本地环境中复制该问题,请在执行此脚本之前创建名为"PLAYGROUND"的数据库:

USE [PLAYGROUND]
GO
/****** Object:  Table [dbo].[USER] ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[USER](
    [ID] [int] IDENTITY(1,1) NOT NULL,
    [TYPE__ID] [int] NOT NULL,
    [Enabled] [bit] NOT NULL,
    [Username] [nvarchar](32) NOT NULL,
    [Password] [nchar](32) NOT NULL,
    [Email] [nvarchar](255) NOT NULL,
 CONSTRAINT [PK_USER] PRIMARY KEY CLUSTERED 
(
    [ID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) …
Run Code Online (Sandbox Code Playgroud)

c# asp.net entity-framework sql-server-2012 entity-framework-6

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

为netstandard Xamarin.Forms项目生成WCF客户端代理

我创建了一个带有netstandard2.0目标库而不是共享库或PCL库的Xamarin.Forms项目.到目前为止,这编译和工作.我正在使用Visual Studio 2017社区的up2date版本.

我还创建了一个WCF服务,它将托管在Windows本身(而不是IIS)上.我已将app.config配置为提供元数据交换端点:

<?xml version="1.0"?>
<configuration>
    <startup>
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
    </startup>
    <system.serviceModel>
        <services>
            <service behaviorConfiguration="MM.Server.ServiceServerBehavior" name="MM.Server.ServiceServer">
                <endpoint address="net.tcp://localhost:8730/MMServer/" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IServiceServer" bindingName="NetTcpBinding_IServiceServer_EndPoint" contract="MM.Contracts.IServiceServer">
                    <identity>
                        <dns value="localhost"/>
                    </identity>
                </endpoint>
                <endpoint address="http://localhost:8731/MMServer/mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
                <host>
                    <baseAddresses>
                        <add baseAddress="net.tcp://localhost:8730/MMServer/"/>
                    </baseAddresses>
                </host>
            </service>
        </services>
        <behaviors>
            <serviceBehaviors>
                <behavior name="MM.Server.ServiceServerBehavior">
                    <serviceMetadata httpGetEnabled="true" httpGetUrl="http://localhost:8731/MMServer/mex" />
                    <serviceDebug includeExceptionDetailInFaults="true"/>
                </behavior>
            </serviceBehaviors>
        </behaviors>
        <bindings>
            <netTcpBinding>
                <binding name="NetTcpBinding_IServiceServer" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" transactionFlow="false" transferMode="Buffered" transactionProtocol="OleTransactions" hostNameComparisonMode="StrongWildcard" listenBacklog="10" maxBufferPoolSize="2147483647" maxBufferSize="2147483647" maxConnections="10" maxReceivedMessageSize="2147483647">
                    <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="16384"/>
                    <reliableSession ordered="true" …
Run Code Online (Sandbox Code Playgroud)

wcf slsvcutil xamarin .net-standard

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

如何正确显示使用plist文件在iPhone/iPad上安装应用程序时的图标和进度?

我正在开发一个自己的AppStore网站,该网站为公司托管各种企业应用程序.到目前为止,一切都有效,除了在Apple设备上下载应用程序的建议方式.

问题是,我没有归档与从官方Apple AppStore安装的应用程序相同的效果.在安装应用程序之前,我没有在主屏幕上看到应用程序的图标,并且在应用程序下载时我看不到任何进度,只有在应用程序安装完成后才会看到.下载和安装应用程序本身的工作原理.

当选择将应用程序下载到他/她的iPhone时,会重定向到itms链接,如下所示:

itms-services://?action=download-manifest&url=https://example.org/appdistribution/iOS/myApp/meta.plist
Run Code Online (Sandbox Code Playgroud)

我的meta.plist文件如下所示:

<plist version="1.0">
    <dict>
        <key>items</key>
        <array>
            <dict>
                <key>assets</key>
                <array>
                    <dict>
                        <key>kind</key>
                        <string>software-package</string>
                        <key>url</key>
                        <string>https://example.org/appdistribution/iOS/myApp/app.ipa</string>
                    </dict>
                    <dict>  
                        <key>kind</key> 
                        <string>display-image</string>  
                        <key>needs-shine</key>  
                        <true/> 
                        <key>url</key>
                        <string>https://example.org/appdistribution/iOS/myApp/icon.png</string>
                    </dict> 
                </array>
                <key>metadata</key>
                <dict>
                    <key>bundle-identifier</key>
                    <string>com.sample-company.myApp</string>
                    <key>bundle-version</key>
                    <string>3.0.0</string>
                    <key>kind</key>
                    <string>software</string>
                    <key>title</key>
                    <string>MyApp</string>
                </dict>
            </dict>
        </array>
    </dict>
</plist>
Run Code Online (Sandbox Code Playgroud)

这是应用程序下载时的外观:

下载没有显示图像的应用程序

这是应用程序安装时的样子:

安装没有显示图像的应用程序

安装完成后,会出现图标.

我尝试了几种图像分辨率,如57x57,72x72,100x100和256x256.我在iPhone和iPad上测试过它.我怀疑下载过程中缺少的进度是由于图像无法加载而导致的后续错误.

真正奇怪的是,我可以发誓以前曾经工作过.这看起来很琐碎,但我不确定这是由什么引起的.有没有好的例子可行?

xml info.plist plist ios ipa

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

动态拟合单元格宽度后,禁止按钮组中的按钮换行

根据MetalFrog对这个问题的回答,我试图将单元宽度与其内容相符:

tr td.fit {
width: 1%;
white-space: nowrap;
}
Run Code Online (Sandbox Code Playgroud)

在这里看得很好(jsfiddle).但是,通过将一个twitter-bootstrap按钮组添加到应该适合其内容宽度的单元格,按钮将仍然在它们之间包裹.jsfiddle.

如何防止我的按钮被包裹?我仍然希望将它们排成一行.

编辑 我想保持表格宽度100%,因此删除1%宽度的单元格不是一个解决方案..btn-group > .btn只要标签标签之间有空隙,即使不需要但可以接受,从引导程序中移除浮动也会在我的按钮之间留出空间.

html css css-tables twitter-bootstrap twitter-bootstrap-3

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

云连接器无法在设备上加载JSON数据

我们的客户已将其系统更改为SAP,并希望应用程序通过SAP界面显示数据.我们决定使用SAPUI5框架+ WebIDE来开发应用程序,因为它提供了非常好的控件种类,具有可靠的MVC设计以及用于SAP界面的易于使用的云连接器.

我们已经配置了这样的连接器:

新app.json

{
  "welcomeFile": "/webapp/index.html",
  "routes": [
    {
      "path": "/resources",
      "target": {
        "type": "service",
        "name": "sapui5",
        "entryPath": "/resources"
      },
      "description": "SAPUI5 Resources"
    },
    {
      "path": "/test-resources",
      "target": {
        "type": "service",
        "name": "sapui5",
        "entryPath": "/test-resources"
      },
      "description": "SAPUI5 Test Resources"
    },
    {
      "path": "/mynews",
      "target": {
        "type": "destination",
        "name": "MyNews_CMS",
        "preferLocal": true
      }
    }
  ],
  "sendWelcomeFileRedirect": true
}
Run Code Online (Sandbox Code Playgroud)

这是我们在component.js中的测试调用:

try {                                                                               
  $.get("/mynews/?json=2", function(data, status) {                                                                                 
    alert("success: " + JSON.stringify(data));                                                                              
  }).fail(function(arg1) {                                                                                 
    alert("error: " + JSON.stringify(arg1));                                                                               
  });                                                                           
} …
Run Code Online (Sandbox Code Playgroud)

cordova hana sapui5

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