嗨我试图运行一个webapp,使用spring和jetty并显示以下错误:
2011-02-03 10:40:59.398::INFO: jetty-6.1.6
2011-02-03 10:41:00.637::WARN: Could not instantiate listener org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:375)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)
at org.mortbay.jetty.handler.ContextHandler.loadClass(ContextHandler.java:1013)
at org.mortbay.jetty.webapp.WebXmlConfiguration.initListener(WebXmlConfiguration.java:629)
at org.mortbay.jetty.webapp.WebXmlConfiguration.initWebXmlElement(WebXmlConfiguration.java:367)
at org.mortbay.jetty.webapp.WebXmlConfiguration.initialize(WebXmlConfiguration.java:289)
at org.mortbay.jetty.webapp.WebXmlConfiguration.configure(WebXmlConfiguration.java:222)
at org.mortbay.jetty.webapp.WebXmlConfiguration.configureWebApp(WebXmlConfiguration.java:180)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1213)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:509)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:447)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:117)
at org.mortbay.jetty.Server.doStart(Server.java:222)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:40)
at runjettyrun.Bootstrap.main(Bootstrap.java:121)
2011-02-03 10:41:00.962::INFO: Started SelectChannelConnector@0.0.0.0:8080
Run Code Online (Sandbox Code Playgroud)
任何的想法?谢谢
是否有一个单线轮来接收发电机并产生该发电机中的所有元件?例如:
def Yearly(year):
yield YEARLY_HEADER
for month in range(1, 13):
# How can I rewrite the following two lines?
for line in Monthly(month):
yield line
yield YEARLY_FOOTER
def Monthly(month):
yield MONTHLY_HEADER
for day in range(31): # Yes, this is wrong
yield 'Day %d' % day
yield MONTHLY_FOOTER
Run Code Online (Sandbox Code Playgroud)
也许有更好的方法来重写这整个方法?
我很好奇是否有人注意到Sunspot-Solr存在任何缩放问题.即使我删除了所有可搜索的参数,它本身只是反对原始类; 在我的本地加载还需要5到8秒,生产时需要4到5秒.
有没有人能够扩大太阳黑子 - 索尔?有哪些常见问题?
怎么能更深入地研究这个?
这是单个请求的Solr日志:
Solr Select (208.1ms) {:rows=>20, :start=>0, :q=>"*:*", :sort=>"score desc", :fq=>["type:Organization", "published_b:true", "updated_at_d:[2009\\-02\\-03T16\\:11\\:55Z TO *]"]}
Solr Select (5.5ms) {:rows=>20, :start=>0, :q=>"*:*", :sort=>"score desc", :fq=>["type:Organization", "published_b:true", "updated_at_d:[2009\\-02\\-03T16\\:11\\:55Z TO *]"]}
Solr Update (12.6ms) <?xml version="1.0" encoding="UTF-8"?><add><doc><field name="type">User</field><field name="type">ActiveRecord::Base</field><field name="id">User 2</field><field name="class_name">User</field><field name="first_name_s">Bob</field><field name="created_at_d">2009-09-28T21:00:27Z</field><field name="last_name_s">Marley</field><field name="email_s">bob.marley@gmail.com</field><field name="name_s">Bob Marley</field><field name="last_name_text">Marley</field><field name="first_name_text">Bob</field><field name="email_text">bob.marley@gmail.com</field><field name="name_text">Bob Marley</field></doc></add>
Solr Update (487.7ms) <?xml version="1.0" encoding="UTF-8"?><commit/>
Completed in 12632ms (View: 11633, DB: 228) | 200 OK [http://localhost/organizations/search]
Run Code Online (Sandbox Code Playgroud) 我已经将谷歌翻译栏添加到我们的网站,但由于主导航中的翻译比英语长,所以布局如何工作将一些链接推到下一行并开始掩盖其他元素.我有一些Javascript检测翻译栏是否正在使用,并使菜单和搜索框的包含div更宽,以补偿,虽然这确实影响布局,它远远优于覆盖页面的部分.
但是Chrome现在已经内置了浏览器的翻译,如果有人使用它,他们显然不会使用嵌入式版本,所以我无法检测到它来应用我的宽度修复.有没有办法检测Chrome的内置翻译是否被使用?
我有一个与select元素和jquery相关的问题.我当前有一个更改事件,所以当select元素值被更改时调用changeShippingForm函数,这工作得很好.
但我也希望在onload上触发change事件.我怎样才能做到这一点?
$(document).ready(function() {
$('#shippingType').change(changeShippingForm);
});
function changeShippingForm() {
// do some stuff
}
Run Code Online (Sandbox Code Playgroud) 什么应该是一个简单的问题是由于某种原因困扰我.我是MVC的新手,所以应该解释一下.
我在输入提交后尝试清除页面上的所有字段.
我已经看到下面的代码在示例中使用,但不知道放在哪里.我在PersonModel.vb中尝试过,它会抛出错误.我在我的存储库中尝试了它,我保留了我的子函数和函数,并且它每次都会在单词ModelState和ValueProvierResult上抛出错误.
ModelState.SetModelValue("Key", new ValueProviderResult(null, string.Empty, CultureInfo.InvariantCulture))
Run Code Online (Sandbox Code Playgroud)
有人可以提供一些建议让我清除页面上的字段(文本框)吗?我是MVC的新手,可以使用一些帮助.
谢谢
LW
这是代码....
<HttpPost(), MvcReCaptcha.CaptchaValidator()> _
Function Nominate(ByVal m As NominationModel, ByVal captchaValid As Boolean) As ActionResult
Dim db = New ChampionTrees.Common.DataAccess.ChampionTreesRepository With {.UserName = "SYSTEM"}
BindNominateDdls(db)
Dim addPost As Boolean = False
If (Request.Form("addNominator") <> Nothing) Then
m.People.Add(New PersonModel With {.Indicator = PersonIndicator.Nominator})
addPost = True
ElseIf Request.Form("addOwner") <> Nothing Then
m.People.Add(New PersonModel With {.Indicator = PersonIndicator.Owner})
addPost = True
Else
For Each f In Request.Form.Keys
If f.ToString.StartsWith("deletePerson") Then
Dim …Run Code Online (Sandbox Code Playgroud) 在我的服务中,我有一个受保护的构造函数@Inject和一个参数(提供者)@Nullable.任何想法,为什么我得到
com.google.inject.CreationException: Guice creation errors: 1) No implementation for [[service]] was bound.
?Guice是3.0pre1,@Nullable是我们的.
我读过(例如来自Martin Fowler)我们应该在OOP中的(短)方法中使用保护子句而不是单一返回.我也读过(从我不记得的某个地方)应尽可能避免使用else子句.
但我的同事(我在一个只有3个人的小团队中工作)迫使我不要在方法中使用多个返回,并尽可能使用else子句,即使else块中只有一个注释行.
这使我很难遵循他们的编码风格,因为例如,我无法在一个屏幕中查看方法的所有代码.当我编写代码时,我必须首先编写保护子句,然后尝试将其转换为具有多个返回的形式.
我错了,或者我应该怎么做?
我试图测试该属性从Service调用的返回获得它的值,但我在模拟服务调用时遇到问题.
这是我的财产:
public ICountry Country
{
get
{
if (_country == null)
{
ICountryService countryService = new CountryService();
_country = countryService.GetCountryForCountryId(_address.CountryId);
}
return _country;
}
}
Run Code Online (Sandbox Code Playgroud)
这是我尝试测试这个:
[TestMethod]
public void Country_should_return_Country_from_CountryService()
{
const string countryId = "US";
_address.CountryId = countryId;
var address = MockRepository.GenerateStub<Address>(_address);
var country = MockRepository.GenerateMock<ICountry>();
var countryService = MockRepository.GenerateStub<ICountryService>();
countryService.Stub(x => x.GetCountryForCountryId(countryId)).IgnoreArguments().Return(country);
Assert.AreEqual(address.Country, country);
}
Run Code Online (Sandbox Code Playgroud)
我一直收到错误,因为正在调用真正的countryService,而不是我的模拟.我正在使用MsTest和Rhino Mocks.我究竟做错了什么?
如何在MySQL中获得非常计数(*).
例如,在table1中我有1000万条记录,其中有重复记录.
我想从表中找出不同的计数(*).
我知道,我能做到
从table1中选择distinct*但是,我不想获取1000万条记录,甚至不想在其他表中插入不同的记录,例如,create table table2 select table*from table1
所以,请帮助我任何其他选择.
欢迎任何人的帮助
java ×2
asp.net-mvc ×1
clear ×1
coding-style ×1
field ×1
guice ×1
if-statement ×1
javascript ×1
jetty ×1
jquery ×1
mysql ×1
nullable ×1
performance ×1
python ×1
rhino-mocks ×1
solr ×1
spring ×1
sunspot ×1
translation ×1
unit-testing ×1
yield ×1