小编Jam*_*s Z的帖子

如何在浏览器中打开文件而不是使用 ASP.NET WebApi 下载?

我当前的代码如下,仅下载文件。如何在浏览器中查看所有文件类型?

[HttpGet]
    //[NoCacheHeader()]
    [Route("api/image/files")]
    public HttpResponseMessage GFiles(string ImageName)
    {
        var response = Request.CreateResponse(HttpStatusCode.OK);
        var path = "~/Image/" + ImageName;

            path = System.Web.Hosting.HostingEnvironment.MapPath(path);
            var ext = System.IO.Path.GetExtension(path);

            var contents = System.IO.File.ReadAllBytes(path);

            System.IO.MemoryStream ms = new System.IO.MemoryStream(contents);

            response.Content = new StreamContent(ms);

            //

            response.Content.Headers.ContentDisposition = new System.Net.Http.Headers.ContentDispositionHeaderValue("attachment");
            response.Content.Headers.ContentDisposition.FileName = ImageName;
            //

            response.Content.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("Image/" + ext);
            return response;

    }
Run Code Online (Sandbox Code Playgroud)

browser file view download angular

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

Possible bug in Unity3D?

显然,在 Unity3D 更新后,我无法再从一个场景切换到另一个场景。我不知道这是否是由于更新造成的问题,但目前,当我单击一个应该将我送回另一个场景的按钮时,我收到此错误。

ArgumentException: method return type is incompatible
System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method, Boolean throwOnBindFailure) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Delegate.cs:190)
System.Delegate.CreateDelegate (System.Type type, System.Object firstArgument, System.Reflection.MethodInfo method) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Delegate.cs:276)
UnityEngineInternal.NetFxCoreExtensions.CreateDelegate (System.Reflection.MethodInfo self, System.Type delegateType, System.Object target) (at /Users/builduser/buildslave/unity/build/Runtime/Export/WinRT/NetFxCoreExtensions.cs:11)
UnityEngine.Events.InvokableCall..ctor (System.Object target, System.Reflection.MethodInfo theFunction) (at /Users/builduser/buildslave/unity/build/Runtime/Export/UnityEvent.cs:149)
UnityEngine.Events.PersistentCall.GetRuntimeCall (UnityEngine.Events.UnityEventBase theEvent) (at /Users/builduser/buildslave/unity/build/Runtime/Export/UnityEvent.cs:447)
UnityEngine.Events.PersistentCallGroup.Initialize (UnityEngine.Events.InvokableCallList invokableList, UnityEngine.Events.UnityEventBase unityEventBase) (at /Users/builduser/buildslave/unity/build/Runtime/Export/UnityEvent.cs:610)
UnityEngine.Events.UnityEventBase.RebuildPersistentCallsIfNeeded () (at /Users/builduser/buildslave/unity/build/Runtime/Export/UnityEvent.cs:776)
UnityEngine.Events.UnityEventBase.PrepareInvoke () (at /Users/builduser/buildslave/unity/build/Runtime/Export/UnityEvent.cs:812)
UnityEngine.Events.UnityEvent.Invoke () (at /Users/builduser/buildslave/unity/build/Runtime/Export/UnityEvent_0.cs:53)
UnityEngine.UI.Button.Press () (at /Users/builduser/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:36)
UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at /Users/builduser/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:45)
UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler …
Run Code Online (Sandbox Code Playgroud)

c# debugging error-handling unity-game-engine

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

在pandas中匹配列匹配的另一个数据帧中替换NaN值的正确方法

我是pandas的新手,并试图用df2替换列值(NaN),列值匹配.并面临以下错误.

df1
unique_col  |  Measure
944537          NaN
7811403         NaN 
8901242114307     1 

df2
unique_col  |  Measure
944537           18
7811403          12 
8901242114307    17.5



df1.loc[(df1.unique_col.isin(df2.unique_col) &
                       df1.Measure.isnull()), ['Measure']] = df2[['Measure']]
Run Code Online (Sandbox Code Playgroud)

我有两个数据帧,有300万条记录,并且在执行以下操作时遇到以下错误:

ValueError:无法从重复轴重新索引

python numpy pandas

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

无法在 Xamarin Forms 中安装应用程序?

我开发了一个简单的应用程序Xamarin forms。它在我的电脑上的 android 模拟器上正常运行。

我已经存档了 android 项目并为其生成了 apk,但是它没有安装在我的 android 手机中。错误信息是

安装应用程序失败

我在构建应用程序和归档时主要使用默认配置值。

只有这些是我更改的配置:

  1. 内部Android Option 选中Use Shared the runtime
  2. Linking更改noneSdk assemblies only.
  3. Configuration调试并且平台是活动的(任何CPU)。虽然我尝试安装包含所有三个值的应用程序, Debug, Release, Active(Debug)但没有安装它们。

这里有什么问题吗?

xamarin.android xamarin xamarin.forms

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

sonarQube 报告错误 - 使字段瞬态或可序列化

运行声纳分析后,我遇到了错误,我收到错误

使“getPreAHistFlt”成为瞬态或可序列化的“

我们如何解决这个问题?

代码片段:

package com.sanju.p1; 
//webfault and namespace
@WebFault(name = "getPreAHistFlt", targetNamespace = "http://www.getPreAuthorizationHistory") 
public class getPreAHistFltMsg extends Exception { 

    private com.sanju.p2.GetPreAHistFlt getPreAHistFlt;   // showing bug here 
//constructors
    public getPreAHistFltMsg() { 
        super(); 
    } 

    public getPreAHistFltMsg(String message) { 
        super(message); 
    } 

    public getPreAHistFltMsg(String message, Throwable cause) { 
        super(message, cause); 
    } 

    public getPreAHistFltMsg(String message, com.sanju.p2.GetPreAHistFlt getPreAHistFlt) { 
        super(message); 
        this.getPreAHistFlt = getPreAHistFlt; 
    } 

    public getPreAHistFltMsg(String message, com.sanju.p2.GetPreAHistFlt getPreAHistFlt, Throwable cause) { 
        super(message, cause); 
        this.getPreAHistFlt = getPreAHistFlt; 
    } 

    public com.sanju.p2.GetPreAHistFlt getFaultInfo() { 
        return this.getPreAHistFlt; …
Run Code Online (Sandbox Code Playgroud)

java serialization sonarqube sonarlint

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

在 Codeigniter 中的 php 7.2 中出现错误“未定义函数 mcrypt_create_iv()”

我得到以下错误

错误 - 2018-10-01 12:05:23 --> 严重性:错误 --> 异常:调用未定义的函数 mcrypt_create_iv() /var/www/html/application/controllers/api.php 331

在 AWS EC2 ubuntu 16(Php 7.2、Nginx、codeigniter 3.1.9)上部署应用程序

codeigniter-3 php-7.2

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

可以在php文件中调试Javascript吗?

我试图找到调试php文件中的javascript代码的方法.我在php文件中嵌入了很多javascript代码.

我可以在XDebug的帮助下使用netbeans调试php代码.我也可以使用chrome或firefox等浏览器在html或js文件中单独调试javascript.

我想要的是调试php文件中的javascript代码,如果可能的话.我相信很多人会使用嵌入了php文件的javascript.我个人不喜欢它,但我必须继续努力.我知道我可以在js文件中单独编写代码,然后可以使用浏览器进行调试,但是代码很多,需要时间进行分离.

如果有可能,我可以在这里建议我一个方法.

javascript php debugging

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

无法将 NodeMCU 与 Firebase 连接,因为控制台显示设置/编号失败:每次

无法将 NodeMCU 与 Firebase 连接,因为控制台显示设置 /number 失败:每次 Firebase 上也没有更新。

还是我应该更换云服务器?

    #include <ESP8266WiFi.h>
    #include <FirebaseArduino.h>

    // Set these to run example.
    #define FIREBASE_HOST "example.firebaseio.com"
    #define FIREBASE_AUTH "token_or_secret"
    #define WIFI_SSID "SSID"
    #define WIFI_PASSWORD "PASSWORD"

    void setup() {
      Serial.begin(9600);

      // connect to wifi.
      WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
      Serial.print("connecting");
      while (WiFi.status() != WL_CONNECTED) {
        Serial.print(".");
        delay(500);
      }
      Serial.println();
      Serial.print("connected: ");
      Serial.println(WiFi.localIP());

      Firebase.begin(FIREBASE_HOST, FIREBASE_AUTH);
    }

    int n = 0;

    void loop() {
      // set value
      Firebase.setFloat("number", 42.0);
      // handle error
      if (Firebase.failed()) {
          Serial.print("setting /number failed:");
          Serial.println(Firebase.error()); …
Run Code Online (Sandbox Code Playgroud)

arduino firebase nodemcu esp8266

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

Bootstrap 4响应间距(填充)不起作用

我想在我的父div ID(关于我们)内提供80px的上下填充和0的左右填充。因此,我尝试了引导程序4的响应间隔(填充),即py-80,但在这里不起作用。

<div id="about-us" class="py-md-80">
  <div class="container text-center">
    <h3 class="display-5 text-capitalize">about us</h3>
    <p class="text-muted">Divide have don't man wherein air fourth. Own itself 
     make have night won't make. 
     A you under Seed appear which good give. Own give air without fowl move the 
     dry first 
    heaven fruit, dominion she'd won't very all.</p>
    <img src="./imgs/signature.jpg" alt="signarure" class="img-responsive">
  </div>
</div>
Run Code Online (Sandbox Code Playgroud)

html5 bootstrap-4

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

有没有办法停止firebase云函数的运行实例——它进入了无限循环

我有一个云函数,它有一些这样的代码:

exports.functionName = functions.https.onCall((data, context) => {
    //some logic
    b().then(function(otherData){
       //further logic
       resolve(otherDataModified)
    });
});

b = () => {
    if(someError){
      b();
      resolve(); //This is where i made the mistake, this should be returned after b has completed
    }else{
      resolve();
    }
}
Run Code Online (Sandbox Code Playgroud)

现在的问题是,在意识到错误之前我已经两次调用了这个函数,这导致函数 b 进入无限循环,虽然请求已经完成并解决了,我向用户显示了错误,但有两个函数是不断运行到后台,我看不到实际停止执行此操作的选项。

还尝试用正确的逻辑更新函数,新的运行都正常工作,但这次运行完全挂断,如果不检查会导致我产生大量资源计费。

在此处输入图片说明

在此处输入图片说明

firebase google-cloud-functions

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