我需要在我的应用程序中使用log4j的,但我不知道我怎样才能加载性能.Deafult属性文件说我应该把log4j.properties到/ WEB-INF/classes目录/文件夹,但在Eclipse中我看不到该文件夹,我不能创建它,因为它已经存在.我也无法将任何文件添加到该文件夹中.
这是我得到的错误:
log4j:WARN No appenders could be found for logger (DataNucleus.ClassLoading).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Run Code Online (Sandbox Code Playgroud)
所以,我怎么能得到Web应用程序加载log4j属性?
在Java中,我使用Scanner逐行读取文本文件,因此内存使用率非常低,因为只有一行在内存中一次.PHP中有类似的方法吗?
我有代码,ZipInputSream转换为byte [],但我不知道如何将其转换为inputstream.
private void convertStream(String encoding, ZipInputStream in) throws IOException,
UnsupportedEncodingException
{
final int BUFFER = 1;
@SuppressWarnings("unused")
int count = 0;
byte data[] = new byte[BUFFER];
while ((count = in.read(data, 0, BUFFER)) != -1)
{
// How can I convert data to InputStream here ?
}
}
Run Code Online (Sandbox Code Playgroud) 当我尝试下面的代码时,它只会打印空字符串.如何在此页面上获得产品最小销售数量?
目录/产品/ list.phtml
<?php echo $_product->getStockItem()->getMinSaleQty(); ?>
Run Code Online (Sandbox Code Playgroud) 这可能是一个愚蠢的问题,但PHPs数组$ _FILES有非常奇怪的格式,我以前从未使用过.有人能告诉我怎样才能以理智的方式迭代这个数组?我曾经习惯迭代对象或类似数组的对象,但这种格式对我来说非常奇怪.有没有办法像对象数组一样迭代这个数组?
( [attachments] =>
Array (
[name] => Array (
[0] => test1.png
[1] => test2.png
)
[type] => Array (
[0] => image/png
[1] => image/png
)
[tmp_name] => Array (
[0] => /tmp/phpmFkEUe
[1] => /tmp/phpbLtZRw
)
[error] => Array (
[0] => 0
[1] => 0
)
[size] => Array (
[0] => 9855
[1] => 3002
)
)
)
Run Code Online (Sandbox Code Playgroud) 我正在使用Cufon(http://wiki.github.com/sorccu/cufon/about)在我的网站上使用特殊字体.但是当我在CSS中应用行高时,它不会影响我的Cufon字体.但在IE中它确实有效.这种行为可能是什么原因?
我已经尝试根据本教程安装nhibernate,但它没有说我应该放置Cat.hbm.xml文件以及项目应该如何理解它的项目部分.
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
namespace="QuickStart" assembly="QuickStart">
<class name="Cat" table="Cat">
<!-- A 32 hex character is our surrogate key. It's automatically
generated by NHibernate with the UUID pattern. -->
<id name="Id">
<column name="CatId" sql-type="char(32)" not-null="true"/>
<generator class="uuid.hex" />
</id>
<!-- A cat has to have a name, but it shouldn' be too long. -->
<property name="Name">
<column name="Name" length="16" not-null="true" />
</property>
<property name="Sex" />
<property name="Weight" />
</class>
</hibernate-mapping>
Run Code Online (Sandbox Code Playgroud)
https://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/pdf/nhibernate_reference.pdf
我使用输入类型图像来显示我的自定义样式按钮,但由于某种原因IE8显示边框,即使我在CSS边框设置为none.在其他浏览器中,它根本没有显示边框.
input[type=image] {
margin: 0px;
padding: 0px;
border: none;
border-width: 0px;
border-style: none;
background-color: none;
}
Run Code Online (Sandbox Code Playgroud) 如果我想让我的Java程序能够接受插件,那么如何让Java插件使用核心程序类而不包含插件代码的所有代码?插件如何访问程序界面而不将其包含在自己的jar文件中?
这是我的hibernate配置,但由于某种原因,它无法加载我添加到的那些属性,<property name="hibernateProperties">并且log在启动时说INFO org.hibernate.cfg.Environment - hibernate.properties not found.
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
<bean id="myDataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName" value="org.hibernate.dialect.PostgreSQLDialect" />
<property name="url" value="jdbc:postgresql://localhost:5432/testdatabase" />
<property name="username" value="postgres" />
<property name="password" value="password" />
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" ref="myDataSource" />
<property name="packagesToScan" value="org.test"/>
<property name="hibernateProperties">
<value>
hbm2ddl.auto=create
hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
hibernate.show_sql=true
</value>
</property>
</bean>
<bean id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory" />
</bean>
</beans>
Run Code Online (Sandbox Code Playgroud)
编辑:完整日志:
2010-08-29 15:27:15,986 [main] INFO org.hibernate.cfg.annotations.Version - …Run Code Online (Sandbox Code Playgroud) java ×3
css ×2
php ×2
cufon ×1
file-upload ×1
fonts ×1
hibernate ×1
image ×1
input ×1
inputstream ×1
log4j ×1
magento ×1
magento-1.4 ×1
nhibernate ×1
plugins ×1
spring ×1