小编Tor*_*ups的帖子

如何使用.NET 2.0将PDF文件作为二进制文件流式传输到浏览器

我正在寻找一种方法,使用.NET 2.0(二进制)将PDF文件从我的服务器流式传输到浏览器.

我正试图从服务器路径中获取现有的PDF文件,并将其作为二进制文件推送到浏览器.

.net

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

如果我使用WCF w/forms auth,php或java客户端将如何进行身份验证?

我有一个通用的概念证明WCF服务,它使用表单身份验证来保护访问.当我的客户端是.NET时,一切都很棒(下面的vb代码)

Dim client As SupplierServiceClient = New SupplierServiceClient()
client.ClientCredentials.UserName.UserName = "xxxx@xxx.xx.xx"
client.ClientCredentials.UserName.Password = "password"

Dim SupplierList As List(Of Supplier) = client.GetSuppliers()
Run Code Online (Sandbox Code Playgroud)

但是我希望这可以与任何可以执行SOAP 1.1/1.2的人互操作 - 如何连接PHP或Java客户端?

我的WCF web.config列在下面(fyi)

<system.serviceModel>
    <services>
        <service name="SampleApplicationWCF.Library.SupplierService" behaviorConfiguration="NorthwindBehavior">
            <endpoint address="" name="wsHttpSupplierService" contract="SampleApplicationWCF.Library.ISupplierService" binding="wsHttpBinding" bindingConfiguration="wsHttp"/>
            <endpoint address="https://server/SampleApplicationWCF/SupplierService.svc/Basic" name="basicHttpSupplierService" contract="SampleApplicationWCF.Library.ISupplierService" binding="basicHttpBinding" bindingConfiguration="basicHttp"/>
            <endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex"/>
        </service>
    </services>
    <bindings>
        <wsHttpBinding>
            <binding name="wsHttp">
                <security mode="TransportWithMessageCredential">
                    <transport/>
                    <message clientCredentialType="UserName" negotiateServiceCredential="false" establishSecurityContext="true"/>
                </security>
            </binding>
        </wsHttpBinding>
        <basicHttpBinding>
            <binding name="basicHttp">
                <security mode="TransportWithMessageCredential">
                    <transport/>
                    <message clientCredentialType="UserName"/>
                </security>
            </binding>
        </basicHttpBinding>
    </bindings>
    <behaviors>
        <serviceBehaviors>
            <behavior name="NorthwindBehavior"> …
Run Code Online (Sandbox Code Playgroud)

.net security wcf interop

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

如何在WPF中动态添加详细信息行?

我能想到的唯一例子是html - 如果你动态添加一个TR w /一个colspan + div,其中包含详细信息(可编辑),例如点击之前的TR

我正试图找到XAML,想看看是否有人能指出我这个古怪的要求正确的方向.

wpf xaml

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

如何在没有ViewData的情况下绑定Html.DropDownList(强类型视图)

我似乎无法找到一篇好的博客文章,其中展示了如何在没有魔术字符串"ViewData"的情况下将模型绑定到视图(使用强类型视图是我正在尝试的方法)

有没有人知道我需要在下面改变什么来直接将它绑定到我的模型?

视图

<%@ Page Language="VB" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage(Of IEnumerable (Of MvcApplication1.Category))" %>
<asp:Content ID="aboutContent" ContentPlaceHolderID="MainContent" runat="server">
    <%=Html.DropDownList("CategoryList")%>
</asp:Content>
Run Code Online (Sandbox Code Playgroud)

调节器

Function Index() As ActionResult
    Dim list As New List(Of Category)
    list.Add(New Category With {.CategoryID = 1, .CategoryName = "Test1"})
    list.Add(New Category With {.CategoryID = 2, .CategoryName = "Test2"})

    Return View()
End Function
Run Code Online (Sandbox Code Playgroud)

编辑

VB中的最终解决方案如下所示,感谢您的响应!

调节器

Function Index() As ActionResult
    Dim id As Integer = 1
    Dim ProductObject As Product = mProductService.GetProductById(id)

    Return View(ProductObject)
End Function
Run Code Online (Sandbox Code Playgroud)

视图

<%=Html.DropDownList("Category", New SelectList(Model.Categories, "CategoryID", "CategoryName"))%> …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc strongly-typed-view drop-down-menu

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

如何使用jQuery将classClass添加到表中每个tr中的第一个td

我正在尝试在特定类中的tr内的第一个td中添加一个类.但由于某种原因,它只将此类添加到第一个tr中的第一个t - 而不是每个tr中的第一个td

$("#appendTD").find("#gridFormInformation").children(0).children().each(
                function() {
                    if ($("#appendTD").find('tr').filter(function() { return $(this).attr('class') == 'ui-widget-content ui-subtblcell'; }).children("td:eq(0)").addClass("leftbord"));
                }
            );
Run Code Online (Sandbox Code Playgroud)

但是当我通过删除""td:eq(0)来改变上面的内容时,它会将这个类添加到每个tr中的每个td ......所以我做错了什么?

下面的标记示例

<td id="appendTD">
  <table id="gridFormInformation">
    <tbody>
      <tr><th>1</th><th>2</th><th>3</th></tr>
      <tr class="ui-widget-content ui-subtblcell"><td>1</td><td>2</td><td>3</td></tr>
      <tr class="ui-widget-content ui-subtblcell"><td>1</td><td>2</td><td>3</td></tr>
      <tr class="ui-widget-content ui-subtblcell"><td>1</td><td>2</td><td>3</td></tr>
    </tbody>
  </table>
</td>
Run Code Online (Sandbox Code Playgroud)

html jquery html-table jquery-selectors

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

LINQ to SQL是否支持POCO?

如果我想使用一个对象并利用LINQ to SQL,我需要添加什么(如果有的话)我的实体类以确保我的应用程序可以与数据存储进行通信?(在这里不要讨论存储库模式,因为我只是在寻找业务对象中需要的内容)

linq-to-sql

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

你能在objective-c中完成某种形式的依赖注入吗?

目前我在需要的时候直接硬编码另一个对象,我希望能够通过init方法接受这个(我假设?).在下面的代码中,我在viewDidLoad方法中创建了一个新的HatService,出于可测试性/耦合的原因,我不想这样做.

- (void)viewDidLoad
{
    [super viewDidLoad];
    HatService* hatService = [[HatService alloc] init];
    [hatService getHatById:self];
}
Run Code Online (Sandbox Code Playgroud)

第一个问题 - 如何在objective-c中完成?第二个问题 - 我应该担心这个还是做到这一点?

更新

这是我开始的,但我似乎从来没有在运行时遇到第一个init方法.我已经在界面中声明了 - 我错过的任何其他内容都允许我覆盖此init方法并注入服务依赖项?

注意 - 当我自己创建对象时,我可以手动点击这个,但是当appDeleage完成工作时我没有看到它(如果app委托创建这个对象而不调用我的init方法?)

-(id)initWithHatService:(HatService *)service
{
  if (self = [super init])
  {
    [self setService:service];
  }
  return self;
}

-(id)init
{
  HatService* hatService = [[HatService alloc] init];
  return [self initWithHatService:hatService];
}
Run Code Online (Sandbox Code Playgroud)

dependency-injection objective-c

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

如何在objective-c中隐藏键盘

我有一个带文本框和UIButton的简单视图.当我单击UIButton时,我只想隐藏当前在视图中的键盘.这是一个简单的委托我可以添加到控制器或更复杂的东西?

在SO上已经存在的答案中,我还没有找到一个对此上下文有完整解决方案的答案.任何帮助都会很棒!

cocoa-touch

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

如何将复杂的日期字符串转换为datetime java

我需要将以下字符串放入日期时间

星期六,2011年5月21日21:31:35 GMT

到目前为止,我正在做以下事情,但我不确定解析它的有效格式.任何帮助,将不胜感激!

SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
Date date = df.parse("Sat, 21-May-2011 21:31:35 GMT");
Run Code Online (Sandbox Code Playgroud)

先感谢您

java formatting datetime

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

如何在ListBox ItemTemplate中按钮单击期间识别哪个itemSelected

我有一个包含一个简单按钮的ItemTemplate.当我单击此按钮时,我需要一种方法来识别单击的行以拉出绑定到列表框的项目.

XAML

        <ListBox Name="DemoBox" SelectionChanged="listBox_SelectionChanged">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid Height="150">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="400"/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Grid Height="120" Grid.Column="0">
                            <Grid.RowDefinitions>
                                <RowDefinition Height="60"/>
                            </Grid.RowDefinitions>
                            <TextBlock
                                    Grid.Row="0"
                                    Text="{Binding SomeObjProperty}"/>
                        </Grid>
                        <Grid Height="120" Grid.Column="1" Margin="0,-12,0,0">
                            <Button Click="ShowStuffOnMap_Click">
                                <Button.Background>
                                    <ImageBrush ImageSource="images/arrow.png"/>
                                </Button.Background>
                            </Button>
                        </Grid>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
Run Code Online (Sandbox Code Playgroud)

点击处理程序

    private void ShowStuffOnMap_Click(object sender, RoutedEventArgs e)
    {
        //sender is the button so ...
    }
Run Code Online (Sandbox Code Playgroud)

先感谢您

data-binding windows-phone

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