我正在尝试通过Spring的@Configurable注释w/@Resource在需要注入的字段上使用自动依赖注入.这涉及一些设置,比如将spring-agent.jar传递给我的JVM.有关详细信息,请参见此处.
它主要起作用.当我的Tomcat启动时,我看到AspectJ init消息,我的User对象自动获取FileService引用等.
问题是有时它不会发生.它似乎是完全随机的; 有时我启动并且不会注入依赖项,有时它们是.我以前遇到过@Transactional在我的用户上的问题,因为它造成了冲突,我相信代理.我正在使用JPA,因此我的用户标有@Entity,所以我现在最好的猜测是这会产生冲突.我读过你不能自动代理代理.为了抵消冲突,我在网上找到了一些关于排除CGLIB和javassist的注释,这些注释是Hibernate(我的JPA impl)使用的.
线索:
我怎么能弄清楚出了什么问题?是否有人使用@Configurable和JPA?为什么我的dependencyCheck = true在没有实际注入依赖项时抛出错误?
实体
@Entity
@Configurable(dependencyCheck = true)
@NamedQueries( { @NamedQuery(name = "User.findAll", query = "SELECT user FROM User user"),
@NamedQuery(name = "User.findByEmail", query = "SELECT user FROM User user WHERE user.email = :email") })
public abstract class User extends BaseModel {
private static final long serialVersionUID = 7881431079061750040L;
@Id
@GeneratedValue(strategy = GenerationType.TABLE)
private Long id;
@Column(unique = true, nullable = …Run Code Online (Sandbox Code Playgroud) 当我在Microsoft SQL Server Manager Studio中创建新的VARCHAR列时,默认为50长度.这个长度有一些特殊含义吗?如果理论上我可以选择30到70之间的长度,那么对于2的幂(如32或64,在这种情况下)的默认值是不是更好?
在使用文件属性时,Railo在哪里存储文件?
即
<cflog file="mylogfile" text="SOME ALERT HERE">
Run Code Online (Sandbox Code Playgroud)
Web Administrator中的"标记引用"没有给出指示,也没有http://wiki.getrailo.org/wiki/3-1-Tags:CFLog
我想知道我们进行重构并证明其合理性的原因.我看到很多人对重构的想法感到不满.重构被描述为:
前期设计不足的结果.
无纪律的黑客行为
一种危险的活动,不必要地冒着破坏稳定的工作代码的风险
浪费资源.
导致我们重构代码的负责任的原因是什么?
我在这里也发现了一个类似的问题- 经常是你应该重构的,它没有提供重构的原因.
我有这样的结构....
UITableViewController -> UITableViewCell -> UIView
Run Code Online (Sandbox Code Playgroud)
我需要在UIView中访问HashTable(NSMutableDictionary)UITableViewController
有没有办法只从ViewCell访问ViewController(使用[ViewCell superview]显然不会工作)....我需要通过AppDelegate使用[[UIApplication sharedApplication] delegate]?
谢谢!
我们有一个客户端应用程序需要向服务器发送消息以进行各种通知.为了使客户端可以偶尔运行,我将采用消息队列方法.队列处理将从队列中取出消息并调用Web服务,将其置于另一个队列中以最终进行处理.这个问题是关于客户环境的; 服务器环境已经确定.
我不想使用MSMQ,因为我们无法控制所有客户端PC以正确安装/配置和保护MSMQ,并且由于用于调查MSMQ队列内容的工具质量,支持更具挑战性.SQL Server 2005 Express位于所有计算机上,用于存储应用程序的数据.
我目前有两个选项:
ThreadPool.QueueUserWorkItem这些消息由针对每种消息类型配置的处理程序进行处理.所有System.Transactions.TransactionScope这些只有在成功处理后才会从持久队列中删除.我对服务总线的经验很少(我仍然没有真正获得服务总线术语)所以我更关心学习曲线,而不是写一些更简单的东西,以我需要的方式满足我的要求(部署是一个重要的考虑因素.
有人有想法吗?
在Apple的BubbleLevel示例中,他们实现了一个+ initialize方法.他们说:
在类接收任何其他消息之前调用+ initialize,因此它是设置应用程序默认值的好地方
但是当我尝试在UIApplicationDelegate协议文档中查找它时,他们甚至没有提到+ initialize方法.我应该知道更多"隐藏"的方法吗?如果它们没有出现在协议或类的文档中,我怎么能找到它们?Os是从其他地方继承的吗?我怎样才能从哪里找到?
假设我想要一个带有任何数字的方法,是否有可以使用的基类(或其他一些概念)?
据我所知,我必须为所有不同的数字类型(Int32,Int16,Byte,UInt32,Double,Float,Decimal等)进行重载.这看起来非常乏味.或者使用类型"对象"并抛出异常,如果它们不可转换或可分配给double - 这是非常糟糕的,因为它意味着没有编译时间检查.
更新: 好的感谢您的评论,你是对的Scarecrow和Marc,实际上宣称它为Double实际上除了Decimal以外的所有人都适用.
所以我正在寻找的答案是Double - 它在这里就像一个基类,因为大多数数字类型都可以分配给它.(我猜Decimal不能分配给Double,因为它可能会变得太大.)
public void TestFormatDollars() {
int i = 5;
string str = FormatDollars(i); // this is OK
byte b = 5;
str = FormatDollars(b); // this is OK
decimal d = 5;
str = FormatDollars(d); // this does not compile - decimal is not assignable to double
}
public static string FormatDollars(double num) {
return "$" + num;
}
Run Code Online (Sandbox Code Playgroud) 我是QAbstractItemDelegate的子类.这是我的代码.欢迎提出建议:
QWidget *ParmDelegate::createWidget(Parm *p, const QModelIndex &index) const {
QWidget *w;
if (index.column() == 0) {
w = new QLabel(p->getName().c_str());
} else {
if (p->isSection())
return NULL;
w = p->createControl();
}
return w;
}
QWidget *ParmDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const {
cout << "createEditor called" << endl;
Parm *p = reinterpret_cast<Parm*>(index.internalPointer());
QWidget *retval = createWidget(p, index);
retval->setFocusPolicy(Qt::StrongFocus);
retval->setParent(parent);
return retval;
}
void ParmDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const {
QRect rect(option.rect);
editor->setGeometry(QRect(QPoint(0,0), rect.size())); …Run Code Online (Sandbox Code Playgroud) 我的代码
#!/bin/bash
for (( c=0; c<=1127; c++ ))
do
id = 9694 + c
if (id < 10000); then
wget http://myurl.de/source/image/08_05_27_0${id}.jpg
else
wget http://myurl.de/source/image/08_05_27_${id}.jpg
fi
done
Run Code Online (Sandbox Code Playgroud)
我只能得到
./get.sh: line 5: 10000: No such file or directory
--2009-05-06 11:20:36-- http://myurl.de/source/image/08_05_27_.jpg
Run Code Online (Sandbox Code Playgroud)
没有号码.
更正后的代码:
#!/bin/bash
for (( c=0; c<=1127; c++ ))
do
id=$((9694+c))
if (id -lt 10000); then
wget http://myurl.de/source/image/08_05_27_0${id}.jpg
else
wget http://myurl.de/source/image/08_05_27_${id}.jpg
fi
done
Run Code Online (Sandbox Code Playgroud)
甚至更好:
for i in $(seq 9694 10821) ; do
_U=`printf "http://myurl.de/source/image/08_05_27_%05d.jpg" $i`
wget $_U
done
Run Code Online (Sandbox Code Playgroud) iphone ×2
.net ×1
annotations ×1
bash ×1
c# ×1
c++ ×1
cfml ×1
cocoa-touch ×1
java ×1
jpa ×1
qt ×1
qt4 ×1
railo ×1
refactoring ×1
servicebus ×1
spring ×1
sql ×1
string ×1
types ×1
uikit ×1
uitableview ×1
varchar ×1