小编Luk*_*brt的帖子

流畅的模块名称更改

可以像教程中所示更改名称:

TypeScript.Definitions()
    .ForLoadedAssemblies()
    .WithFormatter((type, f) => "I" + ((TypeLite.TsModels.TsClass)type).Name)
Run Code Online (Sandbox Code Playgroud)

如何使用流畅的格式化程序更改模块名称?

typelite

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

将多个文件从linux文件夹上载到Azure Blob存储


现在在Linux VM中,我使用以下命令上传单个文件:
azure storage blob upload -q /folder/file.txt --container containerName

可以同时上传更多文件吗?(使用单个命令)

azure-storage azure-storage-blobs

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

如何在RxJava2中并行执行使用者?

我有一个关于RxJava2的问题.我想在固定线程池的不同线程中运行使用者以并行执行List结果.这是我的代码:

    List<String> letters = Lists.newArrayList("a","b","c","d","e","f","g");
    ExecutorService fixedThreadPool = Executors.newFixedThreadPool(letters.size());
    Observable.fromIterable(letters).observeOn(Schedulers.from(fixedThreadPool)).forEach(new Consumer<String>() {
        @Override
        public void accept(String data) throws Exception {
            System.out.println(data + " forEach, thread is " + Thread.currentThread().getName());
        }
    });
Run Code Online (Sandbox Code Playgroud)

我得到的结果是:

a forEach, thread is pool-1-thread-1
b forEach, thread is pool-1-thread-1
c forEach, thread is pool-1-thread-1
d forEach, thread is pool-1-thread-1
e forEach, thread is pool-1-thread-1
f forEach, thread is pool-1-thread-1
g forEach, thread is pool-1-thread-1
Run Code Online (Sandbox Code Playgroud)

但实际上我想要的是这个结果,每个消费者并行执行不同的线程:

a forEach, thread is pool-1-thread-1
b forEach, thread is pool-1-thread-2
c forEach, …
Run Code Online (Sandbox Code Playgroud)

java multithreading rx-java rx-java2

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

在MVC中不包含'GetEnumerator'的公共定义

我试图从2天开始解决这个问题.

错误是

编译器错误消息:CS1579:foreach语句无法对"mvc_ado.net_crud.Models.BusinessObject.ContactPerson"类型的变量进行操作,因为"mvc_ado.net_crud.Models.BusinessObject.ContactPerson"不包含"GetEnumerator"的公共定义

我的控制器

    public ActionResult List()
    {
        var model = ContactPersonManager.GetList();
        return View(model);
    }
Run Code Online (Sandbox Code Playgroud)

在我的模型中

 public static ContactPersonList GetList()
    {
        ContactPersonList tempList = null;
        using (var myConnection = new SqlConnection(AppConfiguration.ConnectionString))
        {
            var myCommand = new SqlCommand("uspContactPersonSelectList", myConnection) { CommandType = CommandType.StoredProcedure };
            myConnection.Open();
            using (var myReader = myCommand.ExecuteReader())
            {
                if (myReader.HasRows)
                {
                    tempList = new ContactPersonList();
                    while (myReader.Read())
                    {
                        tempList.Add(FillDataRecord(myReader));
                    }
                }
                myReader.Close();
            }
        }
        return tempList;
    }
Run Code Online (Sandbox Code Playgroud)

我的看法

    @foreach (var person in Model)
    {
        <ul>
            <li>
                @person.ID; …
Run Code Online (Sandbox Code Playgroud)

asp.net asp.net-mvc razor

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

暴露在Windows Phone 8.1 app MediaCapture下

我试图直接从我的Windows Phone 8.1商店应用程序中的相机捕获图片.

我已成功初始化MediaCapture设备并拍摄照片,但它们总是黑色或曝光方式.

有人能指出我如何让​​相机自动曝光,如果可能的话也引发焦点,因为当我打电话时遇到灾难性的失败photoManager.VideoDeviceController.FocusControl.FocusAsync()

c# media camera image-capture windows-phone-8

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

使用Deflate算法解压缩Span &lt;byte&gt;中的数据

我有一个解析二进制文件的代码。它用于Span<byte>在函数之间传递数据块,以避免不必要的内存分配。

简化示例:

class Reader {
    bool IsCompressed { get; set; }
    public byte[] Data { get; set; }

    function ReadOnlySpan<byte> ReadBlock() {
        ...
    }

    public function Read() {
        if (IsCompressed) {
            Data = ???
        } else {
             Data = ReadBlock.ToArray();
        }
}
Run Code Online (Sandbox Code Playgroud)

我可以使用解压缩数据Syste.IO.Compression.DeflateStream,但是此类仅接受Stream作为输入,因此我必须转换ReadOnlySpan<byte>为流,从而为分配内存byte[]

using(var stream = new MemoryStream(buffer.ToArray())) {
    using(var deflateStream = new DeflateStream(stream, CompressionMode.Decompress)) {
        Data = ... read from deflateStream
    }
}
Run Code Online (Sandbox Code Playgroud)

有什么方法可以传递ReadOnlySpan<byte>DeflateStream而不分配不必要的内存吗?还是有其他可以直接从中解压缩数据的库ReadOnlySpan<byte> …

c# .net-core c#-7.2

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

刷新网格视图时如何到达第 1 页?

我的网络表单中有一个 gridview。

例如,在我的搜索中,我到达了第 4 页,现在我需要刷新 gridview 并转到第 1 页。

我怎么做?

c# asp.net

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

按linq和EF分类

我有一个linq查询,里面是月份名称.我希望按月(1月,2月,3月,...)排序结果.

目前我有以下但它给了我和错误:

LINQ to Entities无法识别方法'System.DateTime Parse(System.String)'方法,并且此方法无法转换为存储表达式.

var shockValues = (from s in ctx.Shocks
                               where s.ID == id
                               orderby DateTime.Parse(s.MonthName)
                               select new 
                               {
                                   val = s.MonthName + "=" + s.ShockValue
                               });
Run Code Online (Sandbox Code Playgroud)

c# linq entity-framework

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