小编Mea*_*een的帖子

解压缩时“找不到中央目录末尾签名”

当我双击解压缩文件时,出现错误

2:no such file or directory 
Run Code Online (Sandbox Code Playgroud)

之后,我打开终端并使用以下命令,但得到以下结果:

unzip /Users/mahesh/Desktop/maheshapp.zip 
Archive:  /Users/mahesh/Desktop/maheshapp.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of /Users/mahesh/Desktop/maheshapp.zip or
        /Users/mahesh/Desktop/maheshapp.zip.zip, and cannot find /Users/mahesh/Desktop/maheshapp.zip.ZIP
Run Code Online (Sandbox Code Playgroud)

macos unzip osx-yosemite

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

从内存流中读取存储的PDF

我正在使用C#和SQLServer 2012开发数据库项目.在我的一个表单中,我有一个PDF文件,其中包含一些存储在表中的其他信息.这是成功的,但当我想检索存储的信息时,我有一个显示PDF文件的问题,因为我无法显示它,我不知道如何显示它.

我读过一些文章说它无法用内存流中的Adobe PDF查看器显示,有什么办法吗?

这是我从数据库中检索数据的代码:

            sql_com.CommandText = "select * from incoming_boks_tbl where [incoming_bok_id]=@incoming_id and [incoming_date]=@incoming_date";
            sql_com.Parameters.AddWithValue("incoming_id",up_inco_num_txt.Text);
            sql_com.Parameters.AddWithValue("incoming_date", up_inco_date_txt.Text);
            sql_dr = sql_com.ExecuteReader();
            if(sql_dr.HasRows)
            {
                while(sql_dr.Read())
                {
                    up_incoming_id_txt.Text = sql_dr[0].ToString();
                    up_inco_num_txt.Text = sql_dr[1].ToString();
                    up_inco_date_txt.Text = sql_dr[2].ToString();
                    up_inco_reg_txt.Text = sql_dr[3].ToString();
                    up_inco_place_txt.Text = sql_dr[4].ToString();
                    up_in_out_txt.Text = sql_dr[5].ToString();
                    up_subj_txt.Text = sql_dr[6].ToString();
                    up_note_txt.Text = sql_dr[7].ToString();
                    string file_ext = sql_dr[8].ToString();//pdf file extension
                    byte[] inco_file = (byte[])(sql_dr[9]);//the pdf file
                    MemoryStream ms = new MemoryStream(inco_file);
                    //here I don't know what to do with memory stream file data and where …
Run Code Online (Sandbox Code Playgroud)

.net c# pdf memorystream

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

Applicationhost.config未显示更改

我们在Microsoft Azure中托管了一个Web服务器.它是Windows Server 2008 R2 Datacenter版本,64位.

对于在此计算机上托管的网站,我需要更改applicationhost.config文件.但是,我最近对IIS所做的更改未显示在配置中.我添加了一个新的应用程序池,并将该特定网站添加到该应用程序池中.我重新启动了网站,文件的"修改日期"已更新,但应用程序池不存在.

现在我正在编辑文件C:\Windows\System32\inetsrv\config,但也有一个C:\Windows\SysWOW64\inetsrv\Config,但后者几个月没有更新.

我看错了文件吗?变更是否立即保存?我是否需要完全重启IIS而不仅仅是相关网站?

iis application-pool windows-server-2008 applicationhost

4
推荐指数
2
解决办法
3564
查看次数

为什么Parallel.ForEach改变了它的线程文化?

今天我遇到了一个我无法解释的奇怪现象.在gridview中有一个包含多个行的网页,需要将其逐个保存到数据库和XML文件中.我最终使用了一个Parallel.ForEach,因为行之间没有关系,所以它们可以独立执行.代码基本上是这样的:

        Parallel.ForEach(gvWithData.Rows.Cast<GridViewRow>(), row =>
        {
            if (row.RowType == DataControlRowType.DataRow)
            {
                    // do some logic and stuff...
                    var type = new Object { ... };

                    // save to the database
                    type.Save();

                    // retrieve the saved item from the database again
                    //  since we need some autoincrement values from the db
                    var typeAfterSave = TypeManager.GetFromDb();

                    // create a custom XML from the object
                    XmlManager.CreateXml(typeAfterSave);
                }
            }
Run Code Online (Sandbox Code Playgroud)

为什么这个代码在我Parallel.ForEach用一个好老的替换时会有任何不同之处,foreach我什么都不做呢?

不同之处在于,在第一种情况下创建XML的文化与第二种情况不同,我没有丝毫的线索.

有什么建议?

c# asp.net cultureinfo parallel.foreach

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

指定 Swagger 记录的 API

我是 swagger 的新手,并安装并运行了它,但它获取的 API 文件比预期的要多得多。我一直在寻找一种方法来指定记录了哪些 API。

swagger asp.net-core

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

什么是Microsoft单元测试替代InlineData或TestCase属性?

除Microsoft之外的单元测试框架具有使用属性添加输入参数和预期结果的选项.

例如,

NUnit有

[TestCase(12,4,3)]
Run Code Online (Sandbox Code Playgroud)

和xUnit有

[InlineData(5, 1, 3, 9)]
Run Code Online (Sandbox Code Playgroud)

微软的方法是什么?

c# unit-testing vs-unit-testing-framework

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

classList.toggle 不起作用

每次单击 div 元素时,我尝试在 SVG 元素上使用 jQuery 切换 cssclass。

根据我的阅读,使用 SVG 元素执行此操作存在问题,这种方法是一种解决方案:

$("#div1").click(function() {
    $("#svg1").classList.toggle("clicked");
});`
Run Code Online (Sandbox Code Playgroud)

然而,这不起作用。所以我认为这是由于在此函数中使用了 SVG 元素。但是当用 div 元素替换所述 SVG 元素时,如下所示:

$("#div1").click(function() {
    $("#div2").classList.toggle("clicked");
});
Run Code Online (Sandbox Code Playgroud)

尽管函数中没有 SVG 元素,但该类仍然不会切换。

jquery svg toggleclass

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

iTextSharp复选框具有值,但未显示为已选中

我需要使用iTextSharp编辑PDF文件。我有一个单选按钮和复选框,如下所述。

我想要以下内容:如果我在单选按钮上打了一个勾号,则该复选框必须显示为选中状态。

在代码中,单选按钮具有一个值,但是当我第一次打开PDF文件时,未选中该复选框。

当我再次在单选按钮中放置一个复选标记时,它变为可见。

这是我的代码;

PdfReader pdfReader = new PdfReader(pdfTemplate);
PdfStamper pdfStamper = new PdfStamper(pdfReader, new FileStream(newFile, FileMode.OpenOrCreate)); 
AcroFields pdfFormFields = pdfStamper.AcroFields;
pdfFormFields.SetField("4a.0", "1"); // radio button
pdfFormFields.SetField("4a.1", "1"); // checkbox
pdfFormFields.SetField("4a.2", "2010"); // text box 
Run Code Online (Sandbox Code Playgroud)

c# pdf checkbox itext

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

重复使用DateTime.Today是否会对性能产生影响?

重复使用DateTime.Today是否会对性能产生负面影响?将值保存到变量中是否更有效?

我正在编写一些函数,这些函数将根据今天的日期计算一个新日期。为此,我经常使用DateTime.Today。我想知道将值保存在变量中并在DateTime.Today上使用该变量是否更有效,还是没有区别?

    public static DateTime GetFirstDateInThePast()
    {
        var calculatedYear = DateTime.Today.Year;
        var calculatedMonth = DateTime.Today.Month < 7 ? 1 : 7;
        var day = 1;

        return new DateTime(calculatedYear, calculatedMonth, day);
    }
Run Code Online (Sandbox Code Playgroud)

        public static DateTime GetFirstDateInThePast()
    {
        var today = DateTime.Today;

        var calculatedYear = today.Year;
        var calculatedMonth = today.Month < 7 ? 1 : 7;
        var day = 1;

        return new DateTime(calculatedYear, calculatedMonth, day);
    }
Run Code Online (Sandbox Code Playgroud)

c# performance datetime

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

Unity是否将脚本编译为c ++?

Unity是否将C#脚本编译为C ++?
通常,在Unity中运行游戏如何工作?

c# c++ game-engine unity-game-engine

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