我正在使用Fedora 14,我安装并运行了MySQL和MySQL服务器5.1.42.现在我尝试以root用户身份执行此操作:
gem install mysql
Run Code Online (Sandbox Code Playgroud)
但我得到这个错误:
Building native extensions. This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/ruby.h
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
Run Code Online (Sandbox Code Playgroud)
这有什么不对?在安装ruby 1.8.7.和最新的rubygems 1.3.7.
我想更改iPhone屏幕上应用程序图标下方显示的名称.我使用Xcode 4,我有一个带键的目标:
我想要的是,我的项目名称例如是"test"但我希望拥有"MySuperApp".那么,哪里可以最好地改变它?我有可以改变的地方${PRODUCT_NAME}吗?
还有其他地方需要改变它吗?
我有一个UILabel,我用Interface Builder设置字体大小和字体名称.现在我必须在ViewController中读取两者的值.
我怎样才能做到这一点?
我使用Eclipse,然后用HTML5内容编写jsp文件.所以我有这样一行:
<div class="test" data-role="test123">
Run Code Online (Sandbox Code Playgroud)
在Eclipse中我收到警告:
Undefined attribute name (data-role)
Run Code Online (Sandbox Code Playgroud)
需要做什么才能再出现这些警告?在HTML5中,允许使用此属性(data-*),如下所示:http://ejohn.org/blog/html-5-data-attributes/
最好的祝福.
我在版本3.6.0中使用Hibernate,并且AnnotationConfiguration被标记为已弃用.
这是我的HibernateUtil.java类中的行:
sessionFactory = new AnnotationConfiguration().configure("/hib.cfg.xml").buildSessionFactory();
Run Code Online (Sandbox Code Playgroud)
什么是AnnotationConfiguration的替代品?
我有一个Spring MVC应用程序和JUnit测试与文件applicationContext.xml相结合的问题.
在我的JUnit测试类中,我写道:
final ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
service = (TestServiceImpl) context.getBean("testServiceImpl");
Run Code Online (Sandbox Code Playgroud)
我得到的错误是找不到aplicationContect.xml:
org.springframework.beans.factory.BeanDefinitionStoreException: IOException parsing XML document from class path resource [applicationContext.xml]; nested exception is java.io.FileNotFoundException: class path resource [applicationContext.xml] cannot be opened because it does not exist
Run Code Online (Sandbox Code Playgroud)
但它退出WEB-INF文件夹.在这里,您可以使用applicationContext.xml文件查看项目树:http: //img28.imageshack.us/img28/2576/treexp.png
那么,这里有什么问题?为什么JUnit测试不存在该文件?
提前谢谢你和最诚挚的问候.
我有一个日期时间格式的字符串:"YYYY-MM-DD HH:MM:SS".
我在我的源代码中使用它:
NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease];
[formatter setDateFormat:@"%e. %B %Y"];
NSString *test = [formatter stringFromDate:@"2010-01-10 13:55:15"];
Run Code Online (Sandbox Code Playgroud)
我想从"2010-01-10 13:55:15"转换为"2010年1月10日".但我的实施不起作用.
这有什么不对?
非常感谢提前和最诚挚的问候.
更新的源代码:
[NSDateFormatter setDefaultFormatterBehavior:NSDateFormatterBehavior10_4];
NSDateFormatter *formatter = [[[NSDateFormatter alloc] init] autorelease];
[formatter setDateFormat:@"%Y-%m-%d %H:%M:%S"];
NSString *test1 = [formatter stringFromDate:@"2010-01-10 13:55:15"];
NSDateFormatter *formatter1 = [[[NSDateFormatter alloc] init] autorelease];
[formatter1 setDateFormat:@"%d. %M4 %Y"];
NSString *test2 = [formatter1 stringFromDate:test1];
Run Code Online (Sandbox Code Playgroud) 我有一个带有Spring MVC的Java后端,我在我的域对象上以这种方式使用验证来获取电子邮件地址:
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
...
@NotNull
@Size(min = 1, max = 100)
@Pattern(regexp="^([a-zA-Z0-9\\-\\.\\_]+)'+'(\\@)([a-zA-Z0-9\\-\\.]+)'+'(\\.)([a-zA-Z]{2,4})$")
private String email;
Run Code Online (Sandbox Code Playgroud)
但是我得到了这些代码
Set<ConstraintViolation<Person>> failures = validator.validate(personObject);
...
Map<String, String> failureMessages = new HashMap<String, String>();
for (ConstraintViolation<Person> failure : failures) {
failureMessages.put(failure.getPropertyPath().toString(), failure.getMessage());
System.out.println(failure.getPropertyPath().toString()+" - "+failure.getMessage())
}
Run Code Online (Sandbox Code Playgroud)
我在控制台上得到这个:
email - must match "^([a-zA-Z0-9\\-\\.\\_]+)'+'(\\@)([a-zA-Z0-9\\-\\.]+)'+'(\\.)([a-zA-Z]{2,4})$"
Run Code Online (Sandbox Code Playgroud)
但我有电子邮件地址test@test.com,所以正则表达式不匹配.
所以我有两个问题:
提前感谢您的帮助和最诚挚的问候.
我有一个使用的iPhone应用程序UIImagePickerController.就像sourceType我一样
因此,用户可以从照片或相机照片中制作照片或从照片库中选择一张照片.
图像将显示在UIImageView中.如果用户关闭应用程序,则应保存图像.所以对于文本字段,我使用NSUserDefaults.我知道,使用NSData将图像保存在NSUSerDefaults中并不是一个好方法,所以我想将图像保存/复制到由我的应用程序控制的文件夹,类似于NSUserDefaults.
我怎样才能做到这一点?我想保存它,然后我可以将文件的路径写入我的NSUserDefaults并在应用程序启动时读取它.
提前谢谢你和最诚挚的问候.
我在最新版本2.4.8中使用DbUnit,我在单元测试中收到许多警告:
WARN : org.dbunit.dataset.AbstractTableMetaData -
Potential problem found: The configured data type factory
'class org.dbunit.dataset.datatype.DefaultDataTypeFactory'
might cause problems with the current database 'MySQL' (e.g. some datatypes may
not be supported properly). In rare cases you might see this message because the
list of supported database products is incomplete (list=[derby]). If so please
request a java-class update via the forums.If you are using your own
IDataTypeFactory extending DefaultDataTypeFactory, ensure that you override
getValidDbProducts() to specify the supported database products.
Run Code Online (Sandbox Code Playgroud)
所以我想我添加了这个(我使用MySQL数据库):
protected …Run Code Online (Sandbox Code Playgroud) iphone ×3
java ×2
spring-mvc ×2
annotations ×1
dbunit ×1
deprecated ×1
eclipse ×1
hibernate ×1
html5 ×1
ios ×1
junit ×1
mysql ×1
objective-c ×1
ruby ×1
rubygems ×1
uiimage ×1
validation ×1
warnings ×1