小编ale*_*lum的帖子

有没有办法在Rails控制台内的输出上实现类似grep的功能

在shell中,我可以做到

$ cat name_of_file_with_a_lot_of_text | grep "What I am looking for"
Run Code Online (Sandbox Code Playgroud)

在Rails控制台内部,我可以实现类似的功能,例如当我运行命令并且输出很大时,尤其是数据库查询.

我知道将它输出为YAML,但这不是我想要的.

谢谢.

ruby console grep ruby-on-rails

9
推荐指数
1
解决办法
5114
查看次数

ExceptionConverter:java.io.IOException:文档没有页面.我正在使用iText

当我执行以下代码

File f = new File("c:/sample.pdf");
PdfWriter.getInstance(document, new FileOutputStream(f));
document.open();
System.out.println("opening the document..");
PdfPTable headerTable=new PdfPTable(9);
PdfPCell cellValue = new PdfPCell(new Paragraph("Header 1"));
cellValue.setColspan(1);
headerTable.addCell(cellValue);
cellValue = new PdfPCell(new Paragraph("Header 2"));
headerTable.addCell(cellValue);
cellValue = new PdfPCell(new Paragraph("Header 3"));
headerTable.addCell(cellValue);
cellValue = new PdfPCell(new Paragraph("Header 4"));
headerTable.addCell(cellValue);

PdfPTable subHeaderTable = new PdfPTable(3);
PdfPCell subHeadingCell = new PdfPCell(new Paragraph("Header 5"));
subHeadingCell.setColspan(3);
subHeaderTable.addCell(subHeadingCell);
subHeaderTable.addCell("Sub heading 1");
subHeaderTable.addCell("Sub heading 2"); 
subHeaderTable.addCell("Sub heading 3");

headerTable.addCell(subHeaderTable);

document.add(headerTable);
document.close();
Run Code Online (Sandbox Code Playgroud)

我得到以下异常.请帮忙

ExceptionConverter: java.io.IOException: The document has no pages. …
Run Code Online (Sandbox Code Playgroud)

java itext

6
推荐指数
1
解决办法
4万
查看次数

java程序输出的说明

我遇到了以下程序

class Boolean {  
  public static void main(String argv[]) {  
    boolean x;  
    x = 4.4f == 4.4;  
    System.out.println(x);  
  }  
} 
Run Code Online (Sandbox Code Playgroud)

以下程序的输出是 false

但是,如果我们以下列方式编写程序,那么

class Boolean {  
    public static void main(String argv[]) {  
      boolean x;  
      x = 4.5f == 4.5;  
      System.out.println(x);  
    }  
}
Run Code Online (Sandbox Code Playgroud)

在这种情况下输出是 true

有人可以解释一下为什么吗?

java boolean

5
推荐指数
1
解决办法
1071
查看次数

禁用Glassfish 3.1中的所有计划

如何在Glassfish 3.1上的项目中禁用所有调度程序(@Schedule annotated)
也许有一些配置条目可以执行此操作?
我的项目中有大约20个带调度程序的EJB,如果我想测试/修复一个小东西,我不希望所有/某些计时器启动.

schedule ejb-3.1 glassfish-3

5
推荐指数
1
解决办法
1181
查看次数

如何使用pdfbox提取文本内容的字体样式?

我正在使用pdfbox库从pdf文件中提取文本内容.我可以提取所有文本,但找不到提取字体样式的方法.

java pdfbox

4
推荐指数
1
解决办法
1万
查看次数

标签 统计

java ×3

boolean ×1

console ×1

ejb-3.1 ×1

glassfish-3 ×1

grep ×1

itext ×1

pdfbox ×1

ruby ×1

ruby-on-rails ×1

schedule ×1