我完全糊涂了...我发誓这是昨天工作的......我今天早上醒来,我的所有表格停止在我的项目中工作.
所有表单都有一个"onsubmit"函数返回false,因为它是一个ajax调用,所以表单永远不会发送.
经过大量测试后,我将问题简化为这段代码:
<html>
<head>
<script type="text/javascript">
function sub()
{
alert ("MIC!");
return false;
}
</script>
</head>
<body>
<form method = "post" id = "form1" onsubmit = "return sub()">
input: <input type="text" name="input1" >
<a href="#" onClick="document.getElementById('form1').submit();">button</a>
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我会发誓,这种方法很完美,但今天也不起作用:D
为什么我按下表格发送的按钮?
我知道这是一个全新的问题,但我被困住了
谢谢 !
我在web.config的live配置中编写了以下转换.
<system.webServer>
<rewrite xdt:Transform="Insert">
<rules>
<rule name="httpsrewrite">
<match url=".*" />
<serverVariables>
<set name="SERVER_PORT" value="443" />
<set name="HTTPS" value="on" />
</serverVariables>
<action type="None" />
</rule>
</rules>
</rewrite>
</system.webServer>
Run Code Online (Sandbox Code Playgroud)
我的web.config中没有元素.
转换不起作用.我所有的其他转换(替换为elmah和连接字符串)工作正常.
asp.net-mvc web-config asp.net-mvc-4 xdt-transform web.config-transform
我一直在努力解决MS Dynamics CRM Online插件中的错误.(见下文).它似乎发生在随机时间,但更有可能在活动高时发生.我已经验证并且没有尝试/捕获 - 继续问题,因为例外情况表明.并且没有成员参考OrganizationService Kept,因为这篇文章建议:
https://community.dynamics.com/crm/f/117/t/138785.aspx
有谁知道导致这个问题的原因,或者如何解决这个问题?
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
<ErrorCode>-2147220911</ErrorCode>
<ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<Message>There is no active transaction. This error is usually caused by custom plug-ins that ignore errors from service calls and continue processing.</Message>
<Timestamp>2014-09-10T00:30:02.6905225Z</Timestamp>
<InnerFault>
<ErrorCode>-2147220911</ErrorCode>
<ErrorDetails xmlns:d3p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<Message>There is no active transaction. This error is usually caused by custom plug-ins that ignore errors from service calls and continue processing.</Message>
<Timestamp>2014-09-10T00:30:02.6905225Z</Timestamp>
<InnerFault i:nil="true" />
<TraceText i:nil="true" />
</InnerFault>
<TraceText>
Run Code Online (Sandbox Code Playgroud) Task03Entities.Entites entities = new Task03Entities.Entites();
// Creat a object for my entites class
Task03BAL.BAL bal = new Task03BAL.BAL();
// creat a object of BAL to call Get Data Method
List<Task03Entities.Entites> entitiesList = new List<Task03Entities.Entites>();
// make a list of class Entities
entitiesList = bal.GetData(entities);
// store data in list
ViewState.Add("Products", entitiesList.ToArray());
// use view state to store entitieslist
Task03Entities.Entites[] entitiesArray =(Task03Entities.Entites[])ViewState["Products"];
List<Task03Entities.Entites> ViewStateList =new List<Task03Entities.Entites(entitiesArray);
// so now ViewStateList contain entitieslist data
// Now the Problem which i am facing …Run Code Online (Sandbox Code Playgroud) 为什么我不能在生产服务器中使用$ {basedir} nlog.config?如果我使用fileName="${basedir}/logs/${shortdate}.log",nlog不会记录消息信息,但是如果我改为类似fileName="C:/logs/${shortdate}.log"它会记录消息信息
我的nlog.config:
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<targets>
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
layout="${longdate} ${uppercase:${level}} ${message}" />
</targets>
<rules>
<logger name="*" minlevel="Trace" writeTo="f" />
</rules>
</nlog>
Run Code Online (Sandbox Code Playgroud)
控制器:
public class HomeController : Controller
{
private static Logger logger = LogManager.GetCurrentClassLogger();
public ActionResult Index()
{
logger.Debug("Test NLog");
return View();
}
}
Run Code Online (Sandbox Code Playgroud) 我应该在try中放入多个语句然后捕获所有可能的异常,还是应该只在try语句中放入一个语句?
例:
try {
MaybeThrowIOException();
MaybeThrowFooBarException();
return true;
} catch (IOException e) {
// ...
} catch (FooBarException e) {
// ...
}
Run Code Online (Sandbox Code Playgroud)
要么
try {
MaybeThrowIOException();
} catch (IOException e) {
// ...
}
try {
MaybeThrowFooBarException();
} catch (FooBarException e) {
// ...
}
return true;
Run Code Online (Sandbox Code Playgroud) 是否可以将搜索变量传递到我在网站上嵌入的Google自定义搜索引擎?我可以让搜索引擎工作,但我无法通过POST传递一个术语(它来自网站其他页面上的搜索按钮)
我试图破解我在这里找到的代码:http://code.google.com/apis/ajax/playground/?exp = search#hello_world
这就是我到目前为止......($ q是我传给它的术语)
<script type="text/javascript">
google.load('search', '1', {language : 'en'});
function OnLoad()
{
var customSearchControl = new google.search.CustomSearchControl('***my key****');
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
customSearchControl.draw('cse');
searchControl.execute("$q");
}
google.setOnLoadCallback(OnLoad);
</script>
Run Code Online (Sandbox Code Playgroud)
谢谢
我正在尝试将Sorm用于游戏框架项目.我正在使用使用Scala 2.10的2.1版本.问题是我的课程不被Sorm认可,我得到了ClassNotFoundException
这是我用过的:
package models
case class User(val name: String)
object Db extends Instance (
entities = Set(Entity[User]()),
url = "jdbc:h2:mem:test"
)
Run Code Online (Sandbox Code Playgroud)
在我的控制器中:
import models.{Db,User}
object Application extends Controller {
def index = Action {
Db.save(User("test")) // Error at this line
Ok("saved")
}
}
Run Code Online (Sandbox Code Playgroud)
例外情况:
play.api.Application$$anon$1: Execution exception[[ClassNotFoundException: models.User]]
at play.api.Application$class.handleError(Application.scala:279) ~[play_2.10.jar:2.1-RC1]
at play.api.DefaultApplication.handleError(Application.scala:373) [play_2.10.jar:2.1-RC1]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$10$$anonfun$apply$27.apply(PlayDefaultUpstreamHandler.scala:296) [play_2.10.jar:2.1-RC1]
at play.core.server.netty.PlayDefaultUpstreamHandler$$anonfun$10$$anonfun$apply$27.apply(PlayDefaultUpstreamHandler.scala:294) [play_2.10.jar:2.1-RC1]
at play.api.libs.concurrent.PlayPromise$$anonfun$extend1$1.apply(Promise.scala:110) [play_2.10.jar:2.1-RC1]
at play.api.libs.concurrent.PlayPromise$$anonfun$extend1$1.apply(Promise.scala:110) [play_2.10.jar:2.1-RC1]
Caused by: java.lang.ClassNotFoundException: models.User
at java.net.URLClassLoader$1.run(URLClassLoader.java:366) ~[na:1.7.0_09]
at java.net.URLClassLoader$1.run(URLClassLoader.java:355) ~[na:1.7.0_09]
at java.security.AccessController.doPrivileged(Native …Run Code Online (Sandbox Code Playgroud) 有没有办法在Microsoft CRM 2011中通过插件创建非活动记录?我可以使用setStateRequest类和IOrganizationService.Execute方法来更改现有记录的状态/状态.由于此方法需要记录Id,因此不能在新记录上使用.
是否可以立即创建非活动记录,还是必须创建新的活动记录并在创建后将其停用?
直接设置状态/状态(即使是新记录)
EntityToSave["statecode"] = new OptionSetValue(state);
EntityToSave["statuscode"] = new OptionSetValue(status);
Run Code Online (Sandbox Code Playgroud)
导致错误:
2 is not a valid status code for state code ProductState.Active on product
Run Code Online (Sandbox Code Playgroud) 在我的程序中,我想使用带有两个键的Map(整数).我的第一个想法是以某种方式将整数连接成一个字符串,例如:
String key = k1.toString()+"-"+k2.toString();
Run Code Online (Sandbox Code Playgroud)
这个解决方案对我来说不太好看:1)丑陋; 2)慢(处理数字作为文本).
我在stackoverflow上发现了其他方法.它们基于将整数封装在一个类中 - 一个目的类(MyKey)或更通用的一个(Pair).
我尝试运行一些速度测试,我的虚拟解决方案似乎是最快的.在第一次拍摄之后,我尝试将转换整数字符串封装在一个新类(MyString)中,并针对此解决方案运行测试.
地图定义是:
Map<Pair<Integer,Integer>,String> map1 = new HashMap<>();
Map<MyKey,String> map2 = new HashMap<>();
Map<String,String> map3 = new HashMap<>();
Map<MyString,String> map4 = new HashMap<>();
Run Code Online (Sandbox Code Playgroud)
测试结果是(多次运行,似乎稳定):
map: put+get=total
1: 52+154=206
2: 29+77=106
3: 23+49=72
3: 17+55=72
Run Code Online (Sandbox Code Playgroud)
带字符串的解决方案更快.搜索时直接连接字符串键的速度更快,输入时速度更慢.
我的问题是:
1)为什么String的解决方案更快?(一次调用hashCode()?)
2)是否有任何理由不应该使用String的解决方案?
附加信息:
地图中的记录数约为6000.
测试试图获得许多未使用密钥的值.它可以改变测试结果吗?
在我的程序中,我生成布尔值[N]的排列,其中M值为真.有一次,我得到某些N,M的结果; 我想把它们存放在我需要它们的情况下.
这里是我的示例中使用的完整的类代码:
class Pair<L,R> {
private final L left;
private final R right;
public Pair(L left, R right) {
this.left = left;
this.right = right;
}
public L getLeft() …Run Code Online (Sandbox Code Playgroud) 我想在CRM中创建联系人后发送通知电子邮件.
为此,我编写了以下代码..但它抛出了"Invalid Party object type 9"的异常.我搜索它但找不到合理的帮助
谢谢
代码:
//Defining Activity Parties (starts)
Entity Fromparty = new Entity("activityparty");
Entity Toparty = new Entity("activityparty");
//set partyid
Toparty["partyid"] = new EntityReference("contact", ContactGuid.Id);
Fromparty["partyid"] = new EntityReference("team", ConsumerTeam.Id);
//create email entity
Entity Email = new Entity("email");
Email["from"] = new Entity[] { Fromparty };
Email["to"] = new Entity[] { Toparty };
Email["subject"] = "Account Login Information";
Email["description"] = PopulateBody(UserName,Password);
Email["directioncode"] = true;
Email["regardingobjectid"] = new EntityReference("contact", ContactGuid.Id);
Guid EmailID = Service.Create(Email);
//Sending email
SendEmailRequest reqSendEmail …Run Code Online (Sandbox Code Playgroud) 我有两个事务调用相同的程序/报告.我想基于用于在其中运行的t代码来分支程序的行为.如何在ABAP代码中获取原始事务的名称?或者,我需要使用不同的方法吗?
我的 CRM 实例中有一个自动编号插件。基本上,前缀是当前年份。所以我希望它像这样工作,如果年份不是当前年份,则用当前年份更新它。
new_prefix是包含年份的字段,如果与当前年份不同,我需要更改该年份。该插件目前可以使用,我只是想更改年份(如果年份不同)。这也一直告诉我代码太多而细节太少。
using Microsoft.Xrm.Sdk;
using Microsoft.Xrm.Sdk.Client;
using System.Xml.Linq;
using System;
using System.Linq;
using System.Globalization;
namespace UGKCK.CRM.PlugIns
{
public class AutoNumbering : IPlugin
{
#region Secure/Unsecure Configuration Setup
private string _secureConfig = null;
private string _unsecureConfig = null;
public AutoNumbering(string unsecureConfig, string secureConfig)
{
_secureConfig = secureConfig;
_unsecureConfig = unsecureConfig;
}
#endregion
public void Execute(IServiceProvider serviceProvider)
{
ITracingService tracer = (ITracingService)serviceProvider.GetService(typeof(ITracingService));
IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
IOrganizationServiceFactory factory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = factory.CreateOrganizationService(context.UserId);
OrganizationServiceContext orgService = new OrganizationServiceContext(service); …Run Code Online (Sandbox Code Playgroud)