我是Ruby的初学者.我听说过关于Ruby的以下抱怨,并希望Stack Overflow社区可以解决所提出的每个问题.
我听过的关于Ruby的常见抱怨:
鉴于这些公认的基于意见的陈述,Ruby如何比Java更好?Ruby是否会成为企业和个人广泛使用的语言?
假设您创建了一个带有jar和一些依赖项的Java桌面应用程序,可能还有许可证文本文件.我知道有很多Ant任务可以生成安装程序,可执行文件和正确的Mac OS X应用程序,包括将它们打包为".dmg"文件.例如JarBundler和Launch4j
Maven是否存在类似的事情?
谢谢
我可以知道如何确定是否在JPanel中找到了某个组件?
boolean isThisComponentFoundInJPanel(Component c)
{
Component[] components = jPanel.getComponents();
for (Component component : components) {
if (c== component) {
return true;
}
}
return false;
}
Run Code Online (Sandbox Code Playgroud)
使用循环效率不高.有没有更好的方法?
我有一个带标签栏的简单应用程序,根据用户输入禁用一个或多个条形项.我知道我需要使用我尝试使用的UITabBarDelegate.但是,当我调用委托方法时,我得到一个未捕获的异常错误[NSObject doesNotRecognizeSelector].我不确定我是在做这件事还是我没有错过任何东西.有什么建议.
我现在拥有以下内容:
WMViewController.h
#import <UIKit/UIKit.h>
#define kHundreds 0
@interface WMViewController : UIViewController <UITabBarDelegate, UIPickerViewDelegate, UIPickerViewDataSource>{
}
@end
WMViewController.m
#import "WMViewController.h"
#import "MLDTabBarControllerAppDelegate.h"
@implementation WMViewController
- (IBAction)finishWizard{
MLDTabBarControllerAppDelegate *appDelegate = (MLDTabBarControllerAppDelegate *)[[UIApplication sharedApplication] delegate];
[appDelegate setAvailabilityTabIndex:0 Enable:TRUE];
}
MLDTabBarControllerAppDelegate.h
#import <Foundation/Foundation.h>
@interface MLDTabBarControllerAppDelegate : NSObject <UITabBarDelegate>{
}
- (void) setAvailabilityTabIndex: (NSInteger) index Enable: (BOOL) enable;
@end
MLDTabBarControllerAppDelegate.m
#import "MLDTabBarControllerApplicationDelegate.h"
#import "MyListDietAppDelegate.h"
@implementation MLDTabBarControllerAppDelegate
- (void) setAvailabilityTabIndex: (NSInteger) index Enable: (BOOL) enable
{
UITabBarController *controller = (UITabBarController *)[[[MyOrganizerAppDelegate getTabBarController] viewControllers ] …Run Code Online (Sandbox Code Playgroud) 我认为Spring注释应该在Grails环境中开箱即用,但我根本无法工作.我也尝试了afterProperties方法,它也没有用.
谁能发现错误?我需要做一些配置吗?
package dashboard
import javax.annotation.PostConstruct
class EmailJobSchedulerService
{
def grailsApplication
@PostConstruct
def init() {
def cronExpression = grailsApplication.config.emailAt8AmTrigger
println(cronExpression)
EmailSubscribersJob.schedule(cronExpression, new HashMap())
}
}
Run Code Online (Sandbox Code Playgroud) 这个星期我一直在努力学习Spring,JBoss,Maven,JPA和Hibernate,我玩得很开心.我对在类中注入资源的许多不同方法感到有些困惑.直到本周,我甚至不知道你可以以任何其他方式注入资源,而不是<property>在Spring XML配置中使用标记.
<bean id="catalogService" class="com.idbs.omics.catalog.service.CatalogService">
<property name="termDao" ref="termDao"></property>
</bean>
Run Code Online (Sandbox Code Playgroud)
当我开始尝试使用JPA时@PersistenceContext,我遇到了,但这似乎是一个非常公平的特殊情况.然后我开始阅读Spring的测试框架,我看到了第一个使用的示例,@Resource(name="catalogService")然后在Web服务示例中@Autowired崩溃了派对!
**The Question!**
Run Code Online (Sandbox Code Playgroud)
那么所有这些之间的区别是什么,是否有正确和错误的情况使用它们?我想我在这里寻找最好的做法.
干杯全都
假设您有以下java bean:
public class MyBean
{
private List<String> names = new ArrayList<String>();
public void addName(String name)
{
names.add(name);
fireNamesPropertyChange(name);
}
}
Run Code Online (Sandbox Code Playgroud)
您通常如何为集合实现属性更改事件?您是否尝试使用索引属性,这对于数组而言似乎比集合更多?
我正在开发一个应用程序,其中我将当前日期保存在数据库中但当我的应用程序以阿拉伯语运行时,当前日期格式更改为阿拉伯语.我的意思是日期格式应该像这样09/02/2010但数字转换阿拉伯语数字.即使我的应用程序运行阿拉伯语,我如何将它们转换回英文数字?
这是我的一个小测试课程.问题是它在每次测试运行后都没有回滚事务.我做错了什么?:)
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "/META-INF/catalog-spring.xml" })
@TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true)
public class TermTest
{
@Autowired
private CatalogService service;
@Rollback(true)
@Test
public void testSimplePersist()
{
Term term = new Term();
term.setDescription("Description");
term.setName("BirdSubject8");
term.setIsEnabled("F");
term.setIsSystem("F");
term.setTermType("TERM");
service.createTerm(term);
}
}
Run Code Online (Sandbox Code Playgroud)
和我的春天配置
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
<property name="persistenceUnitName" value="catalog2"></property>
</bean>
<bean id="catalogService" class="com.moo.catalog.service.CatalogService">
<property name="termDao" ref="termDao"></property>
</bean>
<bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
<bean id="transactionManager"
class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<tx:annotation-driven />
Run Code Online (Sandbox Code Playgroud)