我在Zend Project中创建了一个模块(person).然后在该模块中创建了一个控制器(PersonController.php).然后在该控制器中创建了一个动作(addAction).但是当我使用http://myproject.dev/person/person/add它时它什么也没显示.
http://myproject.dev/指向我的zendproject的公共文件夹,因此当我使用http://myproject.dev/它时成功显示索引页面.但它不适用于我的模块.
我在某处看到我们必须配置application.ini和Bootstrap.php告诉zend我们的模块目录,但我不知道如何.这些陈述是什么?
我当前的目录是这样的:
zendproject|
|-> application
|-> models
|-> modules
|-> person
|->controllers
|-> PersonController.php
Run Code Online (Sandbox Code Playgroud) 我已就此事完成了所有研究.我知道Google认为这是毫无意义的,开发人员知道事实并非如此.我也知道没有已知的解决方法,但我知道我接近制作一个.用户DougW发布了此代码:
public class Utility {
public static void setListViewHeightBasedOnChildren(ListView listView) {
ListAdapter listAdapter = listView.getAdapter();
if (listAdapter == null) {
// pre-condition
return;
}
int totalHeight = 0;
for (int i = 0; i < listAdapter.getCount(); i++) {
View listItem = listAdapter.getView(i, null, listView);
listItem.measure(0, 0);
totalHeight += listItem.getMeasuredHeight();
}
ViewGroup.LayoutParams params = listView.getLayoutParams();
params.height = totalHeight + (listView.getDividerHeight() * (listAdapter.getCount() - 1));
listView.setLayoutParams(params);
}
}
Run Code Online (Sandbox Code Playgroud)
几乎完成了我的工作.但是当我尝试它时,我在listItem.measure(0,0)行得到一个NullPointer异常.listItem本身已初始化,但该方法仍会抛出异常.请告诉我如何解决这个问题.
这是我的代码:
public class ExpenseReportsActivity extends Activity {
private ListView lvReports;
private ExpenseReportListAdapter adapter; …Run Code Online (Sandbox Code Playgroud) 我有以下类结构:
public class Result
{
protected int Code {get; set;}
protected List<string> Messages {get; set;}
protected Result ();
public static Result Success (int code, List<string> messages)
{
Result result= new Result();
result.Code=code;
result.Messages=messages;
return result;
}
}
public class ResultWithName: Result
{
protected ID {get; set;}
protected ResultWithName ()
{
}
public static ResultWithName Success (int code, List<string> messages, string name)
{
ResultWithName result= new ResultWithName();
result.Code=code;
result.Messages=messages;
result.Name=name;
return result;
}
}
Run Code Online (Sandbox Code Playgroud)
如果只有一个静态方法,但是有几个静态方法,问题就可以了,我感兴趣的是如何使用更清晰优雅的代码.谢谢
我想从C应用程序监视目录中的新文件.但是,我对修改过的文件不感兴趣,只对新文件感兴趣.目前我正在使用readdir/stat用于此目的:
while ( (ent = readdir(dir)) != NULL ) {
strcpy(path, mon_dir);
strcat(path, "/");
strcat(path, ent->d_name);
if ( stat(path, &statbuf) == -1 ) {
printf( "Can't stat %s\n", ent->d_name );
continue;
}
if ( S_ISREG(statbuf.st_mode) ) {
if ( statbuf.st_mtime > *timestamp ) {
tcomp = localtime( &statbuf.st_mtime );
strftime( s_date, sizeof(s_date), "%Y%m%d %H:%M:%S", tcomp );
printf( "%s %s was added\n", s_date, ent->d_name );
*timestamp = statbuf.st_mtime;
}
}
}
Run Code Online (Sandbox Code Playgroud)
知道如何在不保留文件列表的情况下检测Linux和Solaris 10上新创建的文件吗?
干杯,
马丁.
我正在编写一个使用SSL的应用程序.因此,我有一个虚拟密钥库和一个我想要提供给客户的虚拟信任库.是否有任何默认文件夹将它们放入我的发行版中?例如docs,lib,bin等.通常将密钥库放在服务器上的位置通常是客户端放置的信任库?
谢谢
我们的内部存储库(Artifactory)现在包含稳定版本以及内部库的SNAPSHOT版本.
对于稳定版本,从存储库中下载任何内容从未出现过问题.
但是,当我添加-SNAPSHOT时,Maven声称无法找到依赖项,即使它最明确地存储在存储库中.
如果我在本地构建和部署依赖项(即进入我的本地存储库),所有工作都正常.
基本上,这有效:
<dependency>
<groupId>com.example</groupId>
<artifactId>ourlibrary</artifactId>
<version>1.0.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
这不是:
<dependency>
<groupId>com.example</groupId>
<artifactId>ourlibrary</artifactId>
<version>1.0.1-SNAPSHOT</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
即使两个版本都以相同的方式构建并且(正如我可能告诉的)正确地部署到存储库.
错误:
Missing:
----------
1) com.example:ourlibrary:jar:1.0.1-SNAPSHOT,
Try downloading the file manually from the project website.
Then, install it using the command:
mvn install:install-file -DgroupId=com.example -DartifactId=ourlibrary -Dversion=1.0.1-SNAPSHOT, -Dpackaging=jar -Dfile=/path/to/file
Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=com.example -DartifactId=ourlibrary -Dversion=1.0.1-SNAPSHOT, -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
Path to dependency:
1) com.example:product:war:2.0.0-SNAPSHOT
2) com.example:ourlibrary:jar:1.0.1-SNAPSHOT,
Run Code Online (Sandbox Code Playgroud)
虽然这听起来类似于这个问题,但到达那里的决议并不适用于我的情况.
任何有关这个问题的见解将不胜感激.
编辑
使用-X运行(如John V.所建议)显示以下内容: …
随机轨道/红宝石问题为一个nooby,非常感谢.
困惑于第二个'?' 意思是在行:
@page ||= params[:page].blank? ? 1 : params[:page].to_i
Run Code Online (Sandbox Code Playgroud)
在init.rb文件中,FILE真正做了什么?
require File.join(File.dirname(__FILE__), "rails", "init")
Run Code Online (Sandbox Code Playgroud) 所以我想像这样转换字符串:
"Bloke %s drank %5.2f litres of booze and ate %d bananas"
Run Code Online (Sandbox Code Playgroud)
与 .Format 或 .AppendFormat 方法等效的 C#
"Bloke {0} drank {1,5:f2} litres of booze and ate {2} bananas"
Run Code Online (Sandbox Code Playgroud)
抱歉,我不确定 C# 版本是否正确,但你明白了。解决方案不必是完美的,但可以涵盖基本情况。
谢谢&BR-马蒂
c ×2
c# ×2
java ×2
.net ×1
android ×1
artifactory ×1
exception ×1
file ×1
filesystems ×1
include ×1
keystore ×1
linux ×1
listview ×1
maven-2 ×1
module ×1
monitoring ×1
php ×1
prolog ×1
python ×1
python-3.x ×1
ruby ×1
scrollview ×1
solaris ×1
ssl ×1