小编ash*_*ish的帖子

具有最大行的Java JXL异常

我正在从我的矢量创建一个excel表,其中包含127923条记录,当我尝试输入记录时,我会遇到异常.

jxl.write.biff.RowsExceededException: The maximum number of rows permitted on a worksheet been exceeded
    at jxl.write.biff.WritableSheetImpl.getRowRecord(WritableSheetImpl.java:1214)
    at jxl.write.biff.WritableSheetImpl.addCell(WritableSheetImpl.java:1151)
    at com.ibm.database.excel.WriteExcel.addLabel(WriteExcel.java:176)
    at com.ibm.database.excel.WriteExcel.write(WriteExcel.java:76)
    at com.ibm.database.excel.FileGenerator.generateExcel(FileGenerator.java:13)
    at com.ibm.database.taxoreader.TaxonomyReader.main(TaxonomyReader.java:46)
Run Code Online (Sandbox Code Playgroud)

我知道因为excel表不允许超过65536条记录,但是我的代码我试图创建一个新的表单,每次我达到60000标记,但它不起作用.任何人都可以告诉我,我做错了什么.这是我的代码.

public void write (Vector list) throws IOException, WriteException{
    int k=0,row=0,column=0;
    WritableFont times10pt = new WritableFont(WritableFont.TIMES, 10);
    // Define the cell format
    times = new WritableCellFormat(times10pt);
    // Lets automatically wrap the cells
    times.setWrap(true);
    TaxonomyBean bean= null;
    File file = new File("Test.xls");
    WorkbookSettings wbSettings = new WorkbookSettings();
    wbSettings.setLocale(new Locale("en", "EN"));
    WritableWorkbook workbook = Workbook.createWorkbook(file, wbSettings);  
    WritableSheet …
Run Code Online (Sandbox Code Playgroud)

java jxl

3
推荐指数
1
解决办法
9498
查看次数

语言构造的含义是什么,不能通过变量函数调用?

可能重复:
PHP中的语言构造和"内置"函数有什么区别?

我已经读过在php编程书中"Language construct such asecho()andisset()can not be called through variable function" 是什么意思呢?

php

3
推荐指数
1
解决办法
334
查看次数

如何将文本移动到JButton的底部

我有一个使用以下代码创建的JButton.

JButton button = new JButton ( "Document",appletRec.getIcon()) ;
button.addActionListener ( this ) ;                    
button.setOpaque                 ( true ) ; //changed false from true.
button.setFocusPainted           ( true ) ; //changed false from true.
button.actAsLink                 ( true ) ;
button.setHighlightForeground    ( Color.blue ) ;
button.setVerticalTextPosition   ( SwingConstants.BOTTOM ) ;
button.setVerticalAlignment      ( SwingConstants.TOP ) ;
button.setHorizontalTextPosition ( SwingConstants.CENTER ) ;
Run Code Online (Sandbox Code Playgroud)

但我的按钮看起来像这样 在此输入图像描述

我想将文本移动到按钮的底部.任何建议都高度赞赏.

java layout icons swing jbutton

3
推荐指数
1
解决办法
2540
查看次数

"使用布尔文字进行平等测试" - 测试布尔值和使用==之间的差异

我正在使用Code Pro来查看我的应用程序代码,并使用以下消息报告该工具:

警告:使用布尔文字进行相等性测试

对于此代码:

boolean valid;
if(valid == true)
Run Code Online (Sandbox Code Playgroud)

可以使用以下方法修复:

if(valid) 
Run Code Online (Sandbox Code Playgroud)

我有两个问题:

  1. 这只是一个很好的编码实践吗?
  2. 在内存优化或性能优化方面还有其他好处吗?

java coding-style codepro

3
推荐指数
1
解决办法
1078
查看次数

如何在eclipse中的所有java文件中添加一行

我不确定这是否可行,但我有一个旧的java应用程序项目,其中包含1000多个java文件.我正在尝试将log4j支持添加到需要我添加的应用程序中

public static Logger logger = Logger.getLogger(MyClass.class.getName());
Run Code Online (Sandbox Code Playgroud)

在每个文件中.

我有什么方法可以使用eclipse执行操作.我试过source->format但是不允许我添加这一行.我是否必须打开每个文件并添加该行?

java eclipse

3
推荐指数
1
解决办法
2647
查看次数

基于Java语言规范的String Literal的澄清

它在Java语言规范中提到

字符串文字总是String类型(§4.3.3).行终止符在打开"和结束匹配之前"之后出现是编译时错误.

如§3.4所述,字符CR和LF从不是InputCharacter; 每个被认为构成LineTerminator.

但我可以创建并运行以下语句

 public class StringOperation {
        public static void main(String ...args){
            String first = "\n";
            System.out.println(first);
        }

    }
Run Code Online (Sandbox Code Playgroud)

我没有看到任何错误.感谢所有的见解.

java

3
推荐指数
1
解决办法
82
查看次数

swagger 正在添加上下文根两次

我正在使用 swagger 3.0.0-SNAPSHOT 和 spring-data-rest。我的应用程序属性文件中有上下文配置

server.servlet.context-path=/sample/

我的swagger配置如下:

@Configuration
@EnableSwagger2WebMvc
@Import({springfox.documentation.spring.data.rest.configuration.SpringDataRestConfiguration.class})
public class SwaggerConfig {
    @Bean
    public Docket api(){
        return new Docket(DocumentationType.SWAGGER_2)
                .select()
                .apis(RequestHandlerSelectors.any())
                .paths(PathSelectors.any())
                .build();
    }
}
Run Code Online (Sandbox Code Playgroud)

我正在访问我的 swagger ui http://localhost:8080/sample/swagger-ui.html

招摇中的所有终点看起来像

http://locahost:8080/sample/sample/getHello

http://locahost:8080/sample/sample/getName

http://locahost:8080/sample/sample/getAge

这些网址应该是

http://locahost:8080/sample/getHello

http://locahost:8080/sample/getName

http://locahost:8080/sample/getAge

如何避免大肆向端点添加额外的上下文根

我的 RestController 看起来像

 @RestController
public class HelloController {
    @RequestMapping("/hello")
    public String getHello(){
        return "Hello";
    }

    @RequestMapping("/name")
    public String getName(){
        return "Sample Name";
    }

    @RequestMapping("/age")
    public Integer getAge(){
        return 37;
    }
}
Run Code Online (Sandbox Code Playgroud)

我已经通过一个示例项目确认了这种情况在每种情况下都会发生

swagger spring-boot

3
推荐指数
1
解决办法
4391
查看次数

如何更改maven项目中的源

我的 Maven 项目遇到奇怪的错误。当我编译项目时,我收到以下异常

[ERROR] (use -source 5 or higher to enable for-each loops)
[ERROR] /home/ashish/code/arena/JUnit/src/main/java/com/tutorial/junit/controller/DefaultController.java:[14,15] error: generics are not supported in -source 1.3
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.0.2:compile (default-compile) on project junit: Compilation failure
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:213)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) …
Run Code Online (Sandbox Code Playgroud)

java eclipse maven

2
推荐指数
1
解决办法
4519
查看次数

Angular JS表创建问题

我刚刚开始学习Angular JS,我正在尝试使用ng-repeat创建一个8X8表.我无法获得8个表头.所有表头都在一列中.这是我的代码.

<table border="1px solid black">
      <tr ng-repeat="k in [0,1,2,3,4,5,6,7,8]">
        <th>
          column
        </th>
      </tr>
      <tr ng-repeat="i in [0,1,2,3,4,5,6,7,8]">
        <td ng-repeat="j in [0,1,2,3,4,5,6,7,8]">
          [{{i}},{{j}}]
        </td>
      </tr>
    </table>
Run Code Online (Sandbox Code Playgroud)

这是我的代码的输出.我不确定为什么会这样.

在此输入图像描述

html-table angularjs

2
推荐指数
1
解决办法
2188
查看次数

flask.cli.NoAppException:无法在模块“flaskr”中找到 Flask 应用程序或工厂。使用 "FLASK_APP=flaskr:name 指定一个

我正在使用 Flask 和来自http://flask.pocoo.org/docs/1.0/tutorial/factory/ 的教程构建一个 python web 应用程序。我正在从父目录运行烧瓶,但出现以下错误。

(venv) E:\python-code\python-web>flask run
 * Serving Flask app "flaskr" (lazy loading)
 * Environment: development
 * Debug mode: on
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 294-690-396
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
127.0.0.1 - - [16/Mar/2019 13:10:43] "GET /hello HTTP/1.1" 500 -
Traceback (most recent call last):
  File "e:\python-code\python-web\venv\lib\site-packages\flask\_compat.py", line 35, in reraise
    raise value
  File "e:\python-code\python-web\venv\lib\site-packages\flask\cli.py", line 95, in find_best_app
    module=module.__name__
flask.cli.NoAppException: Failed to find …
Run Code Online (Sandbox Code Playgroud)

python flask

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