问题列表 - 第20725页

霍夫曼编码的实际应用是什么?

我被告知霍夫曼编码被用作无损数据压缩算法,但我也被告知真实数据压缩软件使用霍夫曼编码,因为如果密钥分散不够分散,压缩文件甚至可能比orignal更大文件.

这让我想知道哈夫曼编码是否存在任何实际应用?

compression algorithm huffman-code

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

在.NET成员资格中使用List类型的配置文件属性

我正在开发一个需要提供身份验证以及角色和配置文件管理的C#Webservice.我需要每个配置文件都有一个List类型的属性.web.config中的配置文件部分如下所示:

<profile defaultProvider="MyProfileProvider" enabled="true">
  <providers>
    <remove name="MyProfileProvider"/>
    <add connectionStringName="MySqlServer"
      applicationName="MyApp"
      name="MyProfileProvider"
      type="System.Web.Profile.SqlProfileProvider" />
  </providers>
  <properties>
    <add name="Websites" type="System.Collections.Generic.List&lt;String&gt;" serializeAs="Binary"/>
  </properties>
</profile> 
Run Code Online (Sandbox Code Playgroud)

但是,当我启动webservice并尝试访问该属性时,它返回以下错误:

System.Configuration.ConfigurationErrorsException:尝试加载此属性的类型导致以下错误:无法加载类型'System.Collections.Generic.List <String>'.(C:\ Projects\MyProject\web.config第58行)---> System.Web.HttpException:无法加载类型'System.Collections.Generic.List <String>'.

有没有办法为此目的使用通用集合?

c# membership web-services asp.net-membership asp.net-profiles

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

将EnumSet存储在数据库中?

因此,在C++/C#中,您可以创建标记枚举以保存多个值,并且在数据库中存储单个有意义的整数当然是微不足道的.

在Java中你有EnumSets,它似乎是一种在内存中传递枚举的好方法,但是你如何将组合的EnumSet输出到一个整数来存储呢?还有另一种方法来解决这个问题吗?

java flags

18
推荐指数
5
解决办法
8289
查看次数

.net用于创建移动软件的概念是什么?

我知道在java中我们使用j2me来开发移动软件..NET中的等价物是什么?学习它的最佳方法是什么?我还可以为初学者提供书籍推荐吗?

.net mobile compact-framework

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

无法获得连接工厂客户端

我收到了这个错误: ERROR/MapActivity(258): Couldn't get connection factory client

一切都很好,突然之间,怎么会发生这种情况?我知道我的api键很好,因为一个月我一直在使用它.怎么突然它没有向我展示地图活动,并在logcat中发布错误?

android google-maps google-maps-android-api-1

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

ASP.Net MVC将多个参数传递给视图

在ASP.Net MVC中,我想根据renderview查询字符串参数呈现不同的局部视图.

因此,为用户提供选择按缩略图或详细信息查看产品的工具.

我可以访问控制器中的所选参数,但我不知道如何或者,如果我应该将它与产品列表一起传递给视图,那么视图可以实现逻辑来决定显示哪个部分视图?

public ActionResult Products(string id, int? renderview)
{
    var products = productRepository.GetProducts(id).ToList();
    return View("Products", products);
}



<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<MLBWebRole.Models.Product>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Products
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<h2>Products</h2>

<p>This is the Products page</p>

<p><a href="?renderview=0">thumbnails</a>&nbsp;<a href="?renderview=1">details</a></p>


 <% if (renderview == 1)
     {%>
    <% Html.RenderPartial("ProductsDetailList"); %>
<% }
else
 { %>
<% Html.RenderPartial("ProductsThumbnailList"); %> 
  <% } %>

</asp:Content>
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc views partial-views

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

如何自定义JAXB对象列表到JSON的序列化?

我正在使用Jersey为服务器组件创建REST Web服务.

我想在列表中序列化的JAXB注释对象如下所示:

@XmlRootElement(name = "distribution")
@XmlType(name = "tDistribution", propOrder = {
    "id", "name"
})
public class XMLDistribution {
    private String id;
    private String name;
    // no-args constructor, getters, setters, etc
}
Run Code Online (Sandbox Code Playgroud)

我有一个REST资源来检索一个看起来像这样的发行版:

@Path("/distribution/{id: [1-9][0-9]*}")
public class RESTDistribution {
    @GET
    @Produces("application/json")
    public XMLDistribution retrieve(@PathParam("id") String id) {
        return retrieveDistribution(Long.parseLong(id));
    }
    // business logic (retrieveDistribution(long))
}
Run Code Online (Sandbox Code Playgroud)

我还有一个REST资源来检索所有发行版的列表,如下所示:

@Path("/distributions")
public class RESTDistributions {
    @GET
    @Produces("application/json")
    public List<XMLDistribution> retrieveAll() {
        return retrieveDistributions();
    }
    // business logic (retrieveDistributions())
}
Run Code Online (Sandbox Code Playgroud)

我使用ContextResolver来自定义JAXB序列化,当前配置如下:

@Provider
@Produces("application/json")
public class …
Run Code Online (Sandbox Code Playgroud)

serialization json jax-rs jaxb jersey

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

Bash - 如何调用父shell中声明的函数?

我正在编写一个调用父shell中声明的函数的bash脚本,但它不起作用.

例如:

$ function myfunc() { echo "Here in myfunc" ; }
$ myfunc
Here in myfunc
$ cat test.sh 
#! /bin/bash

echo "Here in the script"
myfunc
$ ./test.sh 
Here in the script
./test.sh: line 4: myfunc: command not found
$ myfunc
Here in myfunc
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,脚本./test.sh无法调用该函数myfunc,是否有某种方法可以使该函数对脚本可见?

unix bash shell

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

Emacs/AUCTeX:在当前未打开的文件上运行命令

我使用AUCTeX在Emacs中编辑我的LaTeX文件.要编译,我按C-c C-c,将运行pdflatex root,如果root.tex文件显示在当前缓冲区中.

但是,如果我希望它pdflatex在当前缓冲区中未显示的文件上运行呢?

例如,我正在编辑包含的.tex文件chapter2.tex,然后按C-c C-c.我希望它运行的命令仍然是pdflatex root,因为chapter2.tex它只是包含在中root.tex.

我怎样才能做到这一点?

lisp emacs latex auctex

18
推荐指数
2
解决办法
4393
查看次数

如何比较两个日期?

我有三个日期:(1)previousDate(2)currentDate(3)nextDate,我想检查currentDate是否晚于上一个日期,早于nextDate.我怎么做?

iphone objective-c nsdate

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