Tag: apache

Apache Lucene – 优化搜索

我正在开发一个使用SQL Server数据库的Java(使用Spring)的Web应用程序。 我使用Apache Lucene为我的Web应用程序实现搜索function。 使用Apache Lucene,在执行搜索之前,我创建了一个标题索引。 我这样做是首先从数据库中获取所有标题的列表。 然后我遍历标题列表并将其中的每一个添加到索引中。 每次用户搜索某些内容时都会发生这种情况。 我想知道是否有更好,更有效的方法来创建索引? 我知道我的方式非常低效,并且当标题列表很长时需要很长时间才能完成。 任何建议都将受到高度赞赏。 谢谢

使用Erfc函数:commons.apache.org库

我的问题很简单:我想在Java中使用错误函数Erfc(double)与Eclipse,但我不想实现它(因为它很复杂)。 所以,我发现了这个: http://commons.apache.org/proper/commons-math/apidocs/org/apache/commons/math3/special/Erf.html 这正是我想要的。 问题是我无法使用它。 因为它不是来自“docs.oracle.com”,所以我不能只导入它。 但不幸的是,我不能包括库并使用它也不是因为我从下载: http://commons.apache.org/proper/commons-math/download_math.cgi 不是.jar 有人知道如何“安装 – 使用”它吗? 我在英特尔®酷睿™i7-3610QM CPU @ 2.30GHz×8上使用Ubuntu 12.04,我的IDE是ecplipse。

使用Java中的Apache OAuth客户端2.0库生成授权代码和用户令牌的问题

我尝试使用Java中的Apache OAuth Client 2.0库自动化用户级令牌创建/生成过程(REST /授权授权代码)。 以下是我使用的代码,我从https://cwiki.apache.org/confluence/display/OLTU/OAuth+2.0+Client+Quickstart获取 , `/*Previous Codes & starting the below with Try/Catch*/ OAuthClientRequest request = OAuthClientRequest .authorizationLocation(“Authorization URL”) .setClientId(“ClientID”) .setRedirectURI(“Redirect URL”) .buildQueryMessage(); request.getLocationUri(); OAuthAuthzResponse oar = OAuthAuthzResponse.oauthCodeAuthzResponse(request); String code = oar.getCode(); /*Other Codes and starting the below with Try/Catch*/ OAuthClientRequest request = OAuthClientRequest .tokenLocation(“TokenEndPointURL”) .setGrantType(GrantType.AUTHORIZATION_CODE) .setClientId(“ClientID”) .setClientSecret(“ClientSecret”) .setRedirectURI(“REdirectURL”) .setCode(code)//Authorization Code from above […]

java中的Docx到Pdf转换器

以下代码不适用于Apache poi 3.16。 有人可以提供正确的解决方案,在我的项目中只有一些依赖使用 public void ConvertToPDF(String docPath, String pdfPath) { try { InputStream doc = new FileInputStream(new File(docPath)); XWPFDocument document = new XWPFDocument(doc); PdfOptions options = PdfOptions.create(); OutputStream out = new FileOutputStream(new File(pdfPath)); PdfConverter.getInstance().convert(document, out, options); System.out.println(“Done”); } catch (FileNotFoundException ex) { System.out.println(ex.getMessage()); } catch (IOException ex) { System.out.println(ex.getMessage()); } } 例外: Exception in […]

强制或生成jvm核心转储(IBM JVM)

可能重复: 我可以强制生成JVM崩溃日志文件吗? 如何在Java应用程序服务器上或一般情况下强制或生成JVM核心转储?

尝试使用Apache poi制作简单的PDF文档

我看到互联网上充斥着人们抱怨apache的pdf产品,但我在这里找不到我的特殊用法。 我正在尝试用apache poi做一个简单的Hello World。 现在我的代码如下: public ByteArrayOutputStream export() throws IOException { //Blank Document XWPFDocument document = new XWPFDocument(); //Write the Document in file system ByteArrayOutputStream out = new ByteArrayOutputStream();; //create table XWPFTable table = document.createTable(); XWPFStyles styles = document.createStyles(); styles.setSpellingLanguage(“English”); //create first row XWPFTableRow tableRowOne = table.getRow(0); tableRowOne.getCell(0).setText(“col one, row one”); tableRowOne.addNewTableCell().setText(“col two, row one”); […]