我有一个使用spring annotations extensivley的Web应用程序,我有我的proguard配置,如下所示:
-printmapping out.map
-dontoptimize
-keepdirectories
-renamesourcefileattribute SourceFile
-keepattributes Exceptions,SourceFile,LineNumberTable,*Annotation*
-adaptresourcefilenames **.xsd,**.wsdl,**.xml,**.properties,**.gif,**.jpg,**.png
-adaptresourcefilecontents **.xsd,**.wsdl,**.xml,**.properties,META-INF/MANIFEST.MF
-dontshrink
-keepclassmembernames class * {
java.lang.Class class$(java.lang.String);
java.lang.Class class$(java.lang.String, boolean);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keepclassmembers class * implements java.io.Serializable {
static final long serialVersionUID;
private static final java.io.ObjectStreamField[] serialPersistentFields;
private void writeObject(java.io.ObjectOutputStream);
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}
-keep @org.springframework.transaction.annotation.Transactional class *
-keep @org.springframework.stereotype.Service class *
-keep @org.springframework.stereotype.Controller class *
-keep @org.springframework.beans.factory.annotation.Autowired class …Run Code Online (Sandbox Code Playgroud) 我正在实现FOP使用XSLT和XML文件,我想保持单词之间的空白.
这是我的XML样子:
<lines>
<line1> My Creation </line1>
<line2> address one AAAAAAAAAAA</line2>
<line3> This is the address of creation</line3>
<lines>
Run Code Online (Sandbox Code Playgroud)
以下是以下形式的结果PDF:
My Creation
address one AAAAAAAAAAA
This is address of creation
Run Code Online (Sandbox Code Playgroud)
但我需要它像这样:
My Creation
address one AAAAAAAAAAA
This is the address of creation
Run Code Online (Sandbox Code Playgroud)
因此保留所有空间.我使用了以下行:
<xsl:preserve-space elements="*"/>
Run Code Online (Sandbox Code Playgroud)
但无济于事.
我用谷歌搜索解决方案,但徒劳无功.
任何帮助,将不胜感激.
我以编程方式设置scroolview的layoutparams时遇到异常.我已经尝试过但在执行此操作时遇到异常.这是代码:
sv = (ScrollView)findViewById(R.id.scrollView);
sv.setBackgroundColor(Color.TRANSPARENT);
ScrollView.LayoutParams layoutParams = new ScrollView.LayoutParams(
ScrollView.LayoutParams.MATCH_PARENT,
ScrollView.LayoutParams.MATCH_PARENT);
layoutParams.bottomMargin = 100;
layoutParams.setMargins(0, 0, 0, 100);
sv.setLayoutParams(layoutParams);
Run Code Online (Sandbox Code Playgroud)
这是错误日志:
09-23 12:13:20.666: E/AndroidRuntime(3284): Uncaught handler: thread main exiting due to uncaught exception
09-23 12:13:20.696: E/AndroidRuntime(3284): java.lang.ClassCastException: android.widget.FrameLayout$LayoutParams
09-23 12:13:20.696: E/AndroidRuntime(3284): at android.widget.RelativeLayout$DependencyGraph.findRoots(RelativeLayout.java:1291)
09-23 12:13:20.696: E/AndroidRuntime(3284): at android.widget.RelativeLayout$DependencyGraph.getSortedViews(RelativeLayout.java:1238)
09-23 12:13:20.696: E/AndroidRuntime(3284): at android.widget.RelativeLayout.sortChildren(RelativeLayout.java:279)
09-23 12:13:20.696: E/AndroidRuntime(3284): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:299)
09-23 12:13:20.696: E/AndroidRuntime(3284): at android.view.View.measure(View.java:7964)
09-23 12:13:20.696: E/AndroidRuntime(3284): at android.widget.RelativeLayout.measureChildHorizontal(RelativeLayout.java:569)
09-23 12:13:20.696: E/AndroidRuntime(3284): at android.widget.RelativeLayout.onMeasure(RelativeLayout.java:361)
09-23 12:13:20.696: E/AndroidRuntime(3284): at android.view.View.measure(View.java:7964)
09-23 12:13:20.696: …Run Code Online (Sandbox Code Playgroud) 我试图从mysql切换到Zend/TableGateway类.
我不知道是否有一种方法,类似于mysql_insert_id,得到最后插入行的自动增量ID.
谷歌搜索周围,我发现了一些答案,数据库适配器的指向lastInsertId(),但是,这种方法似乎ZF2不再可用.另外:insert方法的返回值返回一个布尔值,而不是ZF1中的最后一个id.
目前我正在使用一个丑陋的解决方法.请参阅下面的代码.
是否有更好/推荐的获取身份证的方式?
table_1 {
id: integer, primary key, autoincremented
content: text
}
table_2 {
table_1_id: integer
other_content: text
}
// using mysql
$sql = "INSERT INTO table_1 (content) VALUES ('some text')";
$result = mysql_query($sql);
// check omitted
$id = mysql_insert_id();
$sql = "INSERT INTO table_2 (table_1_id, other_content) VALUES ($id, 'other text')";
$result = mysql_query($sql);
// using Zend - this is the code, I am currently using
//*************************************************************
// get_last_insert_id emulation; works only if content is unique
private …Run Code Online (Sandbox Code Playgroud) lastinsertid zend-db last-insert-id zend-framework2 tablegateway
这是xml代码:
<LinearLayout
android:id="@+id/mainLayout"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".MainActivity"
android:orientation="vertical"
android:background="@color/black" >
<ScrollView
android:id="@+id/mainScrollView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/teal"
android:layout_weight=".50">
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
</LinearLayout>
</ScrollView>
<Button
android:id="@+id/addButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="+"
android:gravity="center"
android:layout_weight=".20"
/>
<TextView
android:id="@+id/totalHoursLabel"
android:text="Ore Totali"
android:background="@color/gray"
android:textColor="@color/red"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight=".10"
/>
<TextView
android:id="@+id/totalHoursView"
android:text="00:00"
android:background="@color/white"
android:textColor="@color/black"
android:gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight=".20"
/>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
我的问题是当我尝试将视图添加到ScrollView或他的内部LinearLayout时,我的程序崩溃了.
这是我的java代码:
super.onCreate(savedInstanceState);
LinearLayout ll = (LinearLayout) findViewById(R.id.linearLayout1);
TextView tv = new TextView(this);
tv.setText("testView");
tv.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
ll.addView(tv);
setContentView(R.layout.activity_main);
Run Code Online (Sandbox Code Playgroud)
如果我创建一个新的android项目这个代码(只有一个relativeLayout和xml文件中的其他所有空)工作正常.
我认为findViewById方法或我的xml文件存在一些问题. …
通过 angular 使用 nativescript 时,我无法通过 url 打开 chrome dev-tools:
chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=localhost:40000
我试图重新安装谷歌浏览器。删除 node_modules 文件夹、package-lock 文件,然后重新安装 npm。但无法解决问题
我有一个广泛使用spring注释的Web应用程序.我可以从spring注释切换回xml配置文件吗?包括控制器,等等.我需要配置文件的示例.
我在理解如何使用下面的代码实现DbSelect paginator时遇到了一些麻烦(现在它正在使用Iterator适配器,它不适用于ResultSet).
据我所知,它并不像我希望的那样直截了当.DbSelect期待一个Zend\Db\Sql\Select和一个适配器.适配器是一个非问题,可以使用以下方法检索:
$this->newsContents()->getAdapter()
Run Code Online (Sandbox Code Playgroud)
但我无法Select从我的TableGateway中获取一个对象而不重复我的查询代码.有没有简单的方法来解决这个问题?
NewsController.php
<?php
namespace News\Controller;
use Zend\Paginator\Paginator;
class NewsController extends \Application\Controller\WebsiteController
{
protected $newsTable;
protected $newsContents;
protected function newsTable()
{
return $this->getServiceLocator()->get('News\Model\NewsTable');
}
protected function newsContents()
{
return $this->getServiceLocator()->get('News\Model\NewsContentsTable');
}
protected function articleId()
{
return (int) $this->params()->fromRoute('id');
}
public function articleAction()
{
$article = $this->newsTable()->getArticle($this->articleId());
$pages = $this->newsContents()->getPages($this->articleId());
$paginator = new Paginator(new \Zend\Paginator\Adapter\Iterator($pages));
$paginator->setCurrentPageNumber($this->params()->fromRoute('page'));
return array(
'css' => 'news.css',
'article' => $article,
'paginator' => $paginator,
);
}
}
Run Code Online (Sandbox Code Playgroud)
NewsContentsTable.php
<?php
namespace …Run Code Online (Sandbox Code Playgroud) 嗨,我试图掌握Zend 2,我在表网关中的where子句有一些问题.
下面是我的表类:
//module\Detectos\src\Detectos\Model\OperatingSystemTable.php
namespace Detectos\Model;
use Zend\Db\TableGateway\TableGateway;
class OperatingSystemsTable
{
public function findOs($userAgent)
{
$resultSet = $this->tableGateway->select();
foreach ($resultSet as $osRow)
{
//check if the OS pattern of this row matches the user agent passed in
if (preg_match('/' . $osRow->getOperatingSystemPattern() . '/i', $userAgent)) {
return $osRow; // Operating system was matched so return $oses key
}
}
return 'Unknown'; // Cannot find operating system so return Unknown
}
}
Run Code Online (Sandbox Code Playgroud)
模型是这样的:
class Detectos
{
public $id;
public $operating_system;
public $operating_system_pattern; …Run Code Online (Sandbox Code Playgroud) 我想在我的验证课中获得ServiceLocator.我尝试从Controller实例获取它,但它返回null.
MyValidation.php
namespace Register\Validator;
use Zend\Validator\AbstractValidator;
use Register\Controller\RegisterController;
class MyValidation extends AbstractValidator {
/*
code...
*/
function isValid($value)
{
$controller = new RegisterController();
$sm = $controller->getServiceLocator();
$tableGateway = $sm->get('Register\Model\RegisterTable');
$tableGateway->myValidationMethod($value);
}
Run Code Online (Sandbox Code Playgroud)
}
Module.php
public function getServiceConfig()
{
return array(
'factories' => array(
'Register\Model\RegisterTable' => function($sm) {
$tableGateway = $sm->get('RegisterTableGateway');
$table = new RegisterTable($tableGateway);
return $table;
},
'RegisterTableGateway' => function ($sm) {
$dbAdapter = $sm->get('Zend\Db\Adapter\Adapter');
$resultSetPrototype = new ResultSet();
$resultSetPrototype->setArrayObjectPrototype(new RegisterUser());
return new TableGateway('table-name', $dbAdapter, null, $resultSetPrototype);
},
),
);
} …Run Code Online (Sandbox Code Playgroud) tablegateway ×4
android ×2
java ×2
layout ×2
scrollview ×2
spring ×2
zend-db ×2
annotations ×1
apache-fop ×1
lastinsertid ×1
nativescript ×1
proguard ×1
spring-mvc ×1
view ×1
whitespace ×1
xml ×1
xsl-fo ×1
xslt ×1