用户只能编辑自己的帖子,因此我使用以下内容检查用户是否可以输入编辑表单:
def edit
@post = Load.find(:first, :conditions => { :user_id => session[:user_id], :id => params[:id]})
rescue ActiveRecord::RecordNotFound
flash[:notice] = "Wrong post it"
redirect_to :action => 'index'
end
Run Code Online (Sandbox Code Playgroud)
但它不起作用,任何想法我做错了什么?
我有一个表tbl_sky有2个属性name和model我会使用Hibernate注释等;
@Entity
@Table(name="tbl_sky")
public class Sky implements Serializable {
private String name;
private String model;
private String status;
@Id
public String getName() {
return name;
}
.
.
.
Run Code Online (Sandbox Code Playgroud)
但是我需要添加一个status在表中不存在但在类中需要的属性.我如何声明该属性,以便我在我的类中但不在我的db-table中?
所有帮助表示赞赏.
我想尝试用PHP从图像中读取一些文本.
所以,如果我有这样的图像:

如何将"Some text"文本提取到字符串中.
所有的帮助和建议表示赞赏.
我正在寻找以逗号分隔的字符串中删除重复值的最快方法.
所以我的字符串看起来像这样;
$str = 'one,two,one,five,seven,bag,tea';
Run Code Online (Sandbox Code Playgroud)
我可以将字符串爆炸到值然后进行比较,但我认为它会很慢.那么preg_replace()会更快吗?任何人都使用这个功能吗?
我想在下面的代码中延迟执行:
$("#myName").val("Tom");
///delay by 3s
$("#YourName").val("Jerry");
//delay by 3s
$("#hisName").val("Kids");
Run Code Online (Sandbox Code Playgroud) 列出1000多个目录和子目录中文件名的最快方法是什么?
编辑; 我使用的当前代码是:
import java.io.File;
public class DirectoryReader {
static int spc_count=-1;
static void Process(File aFile) {
spc_count++;
String spcs = "";
for (int i = 0; i < spc_count; i++)
spcs += " ";
if(aFile.isFile())
System.out.println(spcs + "[FILE] " + aFile.getName());
else if (aFile.isDirectory()) {
System.out.println(spcs + "[DIR] " + aFile.getName());
File[] listOfFiles = aFile.listFiles();
if(listOfFiles!=null) {
for (int i = 0; i < listOfFiles.length; i++)
Process(listOfFiles[i]);
} else {
System.out.println(spcs + " [ACCESS DENIED]");
}
}
spc_count--;
} …Run Code Online (Sandbox Code Playgroud) 我有一个扩展ListActivity的Intent.在我onCreate填充列表适配器后的方法中,我registerForContextMenu(getListView());用来注册上下文菜单.
现在它正在工作,上下文菜单有其原始功能; 单击并按住某个项目后,将打开上下文菜单.
我可以一键打开上下文菜单(无需按住列表)吗?
所有帮助表示赞赏.
我REPLACE在oracle中使用函数来替换我的字符串中的值;
SELECT REPLACE('THE NEW VALUE IS #VAL1#','#VAL1#','55') from dual
Run Code Online (Sandbox Code Playgroud)
所以这可以替换一个值,但是20+以上,我应该使用20+ REPLACE功能还是有更实用的解决方案.
欢迎所有想法.
建议使用基于php的Web应用程序框架来构建电子商务网站?
是否有特定于电子商务的框架,包括支付处理,用户帐户等?
谢谢B
php ×3
java ×2
activerecord ×1
android ×1
annotations ×1
bash ×1
contextmenu ×1
directory ×1
duplicates ×1
e-commerce ×1
frameworks ×1
hibernate ×1
image ×1
javascript ×1
jquery ×1
oracle ×1
replace ×1
shell ×1
string ×1