小编Nic*_*sen的帖子

CSS通过舷窗看到

我正在尝试使用CSS创建一个"舷窗".当我说舷窗时,我的意思是让屏幕的一部分透视,这样你就可以看到舷窗后面的东西就是这样.

通过将身体的背景颜色设置为与前景颜色相同,我能够获得我想要的效果,然后使用具有圆形渐变的舷窗图像,中间为白色,边缘为黑色,只要所有页面上的内容都是相同的颜色.这不是我想要的,因为我想在屏幕后面使用颜色或任何东西.

我想出了这个:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <title>Test See Through Mouse</title>
    <script type="text/javascript" src="jquery-1.4.1.js"></script>
    <style type="text/css">
        * { margin: 0; padding: 0; }
        html, body { height: 100%; background-color: green; }
        #cover { height: 100%; width: 100%; top: 0; position: fixed; background: url(porthole.png) no-repeat; }
    </style>
</head>
<body>
    Hi, I am behind the scenes content.  Hi, I am behind the scenes content.  Hi, I am behind the scenes content.
    <!-- repeated enough times to fill …
Run Code Online (Sandbox Code Playgroud)

html javascript css

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

Java Webservice将null对象返回到.net客户端

任何人都能弄清楚我的问题是......

我正在从.Net客户端调用Java Webservice(Axis 1.4)的web方法.该方法返回一个Map对象,如果我从Axis客户端调用它工作正常,但在我的c#代码中它总是为null.

这是WSDL:

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="urn:http.service.enlaces.portlet.ext.com" xmlns:intf="urn:http.service.enlaces.portlet.ext.com" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="http://model.enlaces.portlet.ext.com" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:http.service.enlaces.portlet.ext.com">

<wsdl:types>

<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xml.apache.org/xml-soap">
<import namespace="urn:http.service.enlaces.portlet.ext.com"/>
<import namespace="http://model.enlaces.portlet.ext.com"/>
<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<complexType name="mapItem">
   <sequence>
 <element name="key" nillable="true" type="xsd:anyType"/>
 <element name="value" nillable="true" type="xsd:anyType"/>
   </sequence>
</complexType>
<complexType name="Map">
   <sequence>
   <element maxOccurs="unbounded" minOccurs="0" name="item" type="apachesoap:mapItem"/>
   </sequence>
</complexType>   
</schema>
 </wsdl:types>

<wsdl:message name="getFoldersAndBookmarksRequest" />
<wsdl:message name="getFoldersAndBookmarksResponse">
    <wsdl:part name="getFoldersAndBookmarksReturn" type="apachesoap:Map" />
</wsdl:message>

<wsdl:portType name="BookmarksEntryServiceSoap">
<wsdl:operation name="getFoldersAndBookmarks">
      <wsdl:input name="getFoldersAndBookmarksRequest"  message="intf:getFoldersAndBookmarksRequest" />
      <wsdl:output name="getFoldersAndBookmarksResponse" message="intf:getFoldersAndBookmarksResponse" />
    </wsdl:operation>
  </wsdl:portType>

<wsdl:binding name="Portlet_Bookmarks_BookmarksEntryServiceSoapBinding" type="intf:BookmarksEntryServiceSoap">
    <wsdlsoap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc" …
Run Code Online (Sandbox Code Playgroud)

.net java web-services

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

使用jQuery触发按键...并指定按下了哪个键

我想有一个输入元素(type = text)或textarea元素,通过触发特定的击键动态验证.这将用于中文拼音输入,例如:

用户在输入元素中键入"ma2".keydown事件触发每次击键,2永远不会出现.相反,当用户按下"2"时,"a"将收到音调标记,如下所示:"á".最后,用户将输入:"má".

这可以通过使用$(element).val()读取和更改整个输入值来实现,但是,当输入元素具有焦点并且通过调用.val("something")设置其值时,光标移动到结尾的文字.这在大多数情况下工作正常,因为用户只是在字段的末尾继续键入,但我希望这在所有情况下都能正常工作.

...此问题的另一个解决方案是获取/设置光标在输入或textarea元素中的位置.但是,我不认为这在javascript中是可行的.


所以,雷米肯定是在正确的轨道上.触发按键不允许我输入特殊字符而不会有很多麻烦.相反,我捕获keydown事件并设置输入/ textarea的值,然后移动插入符号.

我没有找到任何有关插入jQuery的插入符号的好处,但以下内容确实打破了我的问题.当它稳定时,我会发布一个指向我最终拼音输入代码的链接.它现在非常接近.

http://blog.vishalon.net/Post/57.aspx http://demo.vishalon.net/getset.htm

javascript jquery triggers keypress

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

使用带有IEnumerable <T>的Html.EditorFor

我有一个自定义类:

public class Person
{
    public String Name { get; set; }
    public Int32 Age { get; set; }
    public List<String> FavoriteFoods { get; set; }

    public Person()
    {
        this.FavoriteFoods = new List<String>();
        this.FavoriteFoods.Add("Jambalya");
    }
}
Run Code Online (Sandbox Code Playgroud)

我把这个类传递给我的强类型视图:

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

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

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

    <h2>Create</h2>

    <% using (Html.BeginForm()) { %>
        <%= Html.LabelFor(person => person.Name) %><br />
        <%= Html.EditorFor(person => person.Name) %><br />
        <%= Html.LabelFor(person => person.Age) %><br />
        <%= Html.EditorFor(person …
Run Code Online (Sandbox Code Playgroud)

asp.net-mvc asp.net-mvc-2

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

如何在注册新帐户时要求asp.net表单身份验证发送验证邮件?

我刚刚建立了一个新的ASP.NET MVC网站,我想更改它以强制用户通过单击电子邮件中的验证链接来验证他们的电子邮件地址.我用尽可能多的搜索词来搜索答案,但我想我从来没有打过正确的答案.

我开始玩会员对象,看看我能拿出什么,我确实看到你可以切换IsApproved,所以我将默认值设置为false.之后我注册了一个新用户并且没有收到任何电子邮件(正如我预期的那样),但它也记录了我当前会话的情况.然而,这就是重点.

是否有用于发送验证电子邮件的内置机制或者我需要实现的内容?

asp.net-mvc forms-authentication email-validation

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

重构以删除try/catch

关于重构这个问题的好方法的任何想法,以便我的代码行为相同,但没有整个抛出和捕获我自己的异常?

public Int32 ChooseNextColor(Int32 numColors)
{
    int? nextColor = null;

    while (nextColor == null)
    {
        Console.Write("Please enter your next color selection: ");
        string input = Console.ReadLine();

        try
        {
            nextColor = Convert.ToInt32(input);
            if (nextColor > numColors || nextColor < 0) 
                throw new ArgumentOutOfRangeException();
        }
        catch
        {
            nextColor = null;
            Console.WriteLine("Unrecognized input: " + input);
            Console.WriteLine("Please enter a value between 0 and " + numColors + ".");
        }
    }

    return (nextColor.Value);
}
Run Code Online (Sandbox Code Playgroud)

编辑:try/parse方法正是我正在寻找的.

为了回应约翰的标题编辑 - >我应该发布更多的信息开始,这本来是"一起摆脱try/catch是最好的".所以考虑到这一点,我改变了标题.

c# refactoring exception-handling

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

如何实例化一个大的不可变类型?

我有一个类型,有大约40个属性(所有值类型),代表我的业务的一种交易.此类的实例对应于我的数据库中的一行.我想保持我的类不可变,因为它只会用于读取操作,但我不知道如何在初始化期间设置40个属性.

通常我对不可变类型使用构造函数初始化,但我想避免编写带有40个参数的构造函数.我的房产的安装人员目前是私人的,但我愿意以足够的理由改变.是否有一种常见的方法来处理这种情况或更好的方法来解决问题?

c# instantiation immutability

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

具有多种文化的MVC十进制分隔符

我正在使用具有多种文化的应用程序,当我将culture'pt'更改为'en'时,小数分隔符将更改为.有办法修复小数分隔符?

谢谢.

.net globalization asp.net-mvc

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

为什么C#不允许在析构函数上使用访问修饰符?

我正在为一个小项目创建一个简单的类,并决定只为快速impl添加一个析构函数而不是使用IDisposable,每当有一个带有访问修饰符的析构函数时,我就遇到了编译器错误.

public class MyClass
{
    public ~MyClass()
    {
        // clean resources
    }
}
Run Code Online (Sandbox Code Playgroud)

我尝试过公共,私有,受保护和内部.没有访问修饰符,它工作正常.由于这篇文章显示 ~destructor本质上是一个受保护的Finalize函数的合成糖,因此我觉得奇怪的是你不能在析构函数上使用至少受保护的东西.文章确实说"无法调用析构函数.它们会被自动调用." 这是如何强制执行该行为的?

我最后只是实现IDisposable了,但我很好奇...... 还有其他原因你不能在析构函数上放置访问修饰符吗?

c# destructor access-modifiers

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

使用jQuery交换类

我可以使用jQuery将输入字段中的某些类(.a)替换为我表中的另一个(.b)吗?

<table id="myTable">
<tr>
    <td>Field 1</td>
    <td><input type="text" class="a"></td>
</tr>
<tr>
    <td>Field 2</td>
    <td><textarea class="a"></td>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)

jquery

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