有点困惑,基本的春季mvc应用程序有这个:
APP-config.xml中
<context:component-scan base-package="org.springframework.samples.mvc.basic" />
Run Code Online (Sandbox Code Playgroud)
并且mvc-config.xml具有:
<!-- Configures the @Controller programming model -->
<mvc:annotation-driven />
Run Code Online (Sandbox Code Playgroud)
你真的需要两个吗?
对于组件扫描,这是否意味着如果我没有放入正确的包路径,我的@Controller和@Service标记将无效? 如果我需要多个包,我只是复制该条目吗?
我尝试只使用mvc:annotation-driven但是没有用,我不得不将com.example.web.controllers放在component-scan xml节点中以使其工作.
好吧,我当然可以使用一些IndexOf,甚至是Split(),但我想我会把它作为一个性能预告片.
我有数据 - 比如100K的这些 - 在LastName,FirstName Mi中我需要将它设为FirstName Mi Lastname.
我认为SubString/IndexOf(',')可以完成这项工作,但希望有一个更优雅/高性能的建议.
有更好的想法吗?
我发现目标iOS 4的iPhone应用程序崩溃了,这取决于构建类型.
调试器给了我很多东西,它停止了
UIViewController *result = [self factory](self);
Run Code Online (Sandbox Code Playgroud)
使用EXC_BAD_ACCESS.self是一个继承自NSObject的类(如下所示为NSObjectInheritor).僵尸已启用.我尝试factory用以下结果改变方法三种方法.
这在调试和临时构建中都崩溃了......
- (FactoryMethod) factory;
{
return [^ UIViewController * (NSObjectInheritor *newThing)
{
return [[ViewControllerClass alloc] initWithStuff:(boolValue ? foo : bar)];
} autorelease];
}
Run Code Online (Sandbox Code Playgroud)
这适用于调试版本,但在ad hoc中崩溃...
- (FactoryMethod) factory;
{
return [^ UIViewController * (NSObjectInheritor *newThing)
{
if(boolValue)
{
return [[ViewControllerClass alloc] initWithStuff:foo];
}
else
{
return [[ViewControllerClass alloc] initWithStuff:bar];
}
} autorelease];
}
Run Code Online (Sandbox Code Playgroud)
这既适用于调试也适用于ad hoc,但非常难看和冗余:
- (FactoryMethod) factory;
{
if(boolValue)
{
return [^ UIViewController * (NSObjectInheritor *newThing) …Run Code Online (Sandbox Code Playgroud) 假设我有一个用于添加/编辑产品的表单(字段'user'是我的用户的外键),它是从两个单独的视图函数触发的 - 添加/编辑:
def product_add(request):
userprofile = UserProfile.objects.get(user=request.user)
if request.method == 'POST':
form = ProductAddForm(request.POST, request.FILES,)
if form.is_valid():
form.save(user=request.user)
else:
form = ProductAddForm()
return render_to_response('products/product_add.html', {
'form':form, 'user':request.user,
}, context_instance=RequestContext(request))
def product_edit(request, id):
product = get_object_or_404(Product, id=id, user=request.user)
if product.user.id!=request.user.id:
raise Http404
if request.method == 'POST':
form = ProductAddForm(request.POST, request.FILES, instance=product)
if form.is_valid():
form.save(user=request.user)
else:
form = ProductAddForm(instance=product)
return render_to_response('products/product_edit.html', {
'form':form, 'user':request.user,
}, context_instance=RequestContext(request))
Run Code Online (Sandbox Code Playgroud)
表单的save方法如下所示:
def save(self, user, *args, **kwargs):
self.instance.user = user
post = super(ProductAddForm, self).save(*args, **kwargs)
post.save() …Run Code Online (Sandbox Code Playgroud) 我想获得Android设备VRAM大小.
是否有从该计划中获取的方法?
我正在使用Java 1.6为Mac编写Java Swing应用程序.我已经阅读了许多教程,指导您如何更好地将Java应用程序与OS X集成,但有一件事我无法工作.我无法显示应用程序名称(Mac菜单栏中的第一个粗体菜单项).默认情况下,显示主类的完全限定类名,我无法更改它.
该网站说您必须设置以下属性:
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "AppName");
Run Code Online (Sandbox Code Playgroud)
但这不起作用(我运行10.6,所以可能属性名称改变了?).
当我在XCode中创建一个新的Java项目(我通常使用Eclipse)时,这个名字会以某种方式神奇地被设置!(它以一个可运行的样板应用程序启动你)我已经在XCode项目周围查看了这是如何完成的,但我无法理解它!
我的猜测是,如果你将Java应用程序包装在Mac*.app包中,它只设置应用程序名称,但是想知道是否有人知道答案.谢谢.
编辑:有趣的是,如果我将应用程序打包在一个可运行的JAR文件中,它会设置应用程序名称,但如果我从Eclipse运行它,则不会.
从字符串中删除这些标记的最佳方法是什么,以准备传递给eval()?
例如.字符串可以是这样的:
<?php
echo 'hello world';
?>
Hello Again
<?php
echo 'Bye';
?>
Run Code Online (Sandbox Code Playgroud)
显然str_replace不起作用,因为中间的两个php标签需要在那里(第一个和最后一个需要删除)
在XLSX文件(Excel 2007)中的工作表的XML中,具有等于"s"的"t"属性的单元格标签是字符串类型.需要通过sharedStrings文档查找并转换c中的value标记.但是,有些单元格的s ="237"并且根本没有t属性.value标签有一个像39448这样的整数,它与sharedStrings文档无关.Excel中显示的值是日期1/1/2008.
s属性在XLSX中的ac标记中表示什么?
未知的价值
<c r="B47" s="237">
<v>39448</v>
</c>
Run Code Online (Sandbox Code Playgroud)
共享字符串值
<c r="C47" t="s">
<v>7</v>
</c>
Run Code Online (Sandbox Code Playgroud) 我正在使用Hibernate JPA.
假设我有这些类:
AbstractPerson
|--> ConcreteEmployee
|--> ConcreteCustomer
Run Code Online (Sandbox Code Playgroud)
有没有办法让具体类具有独立的ID?
我正在使用InheritanceType.TABLE_PER_CLASS.