小编Dav*_*ill的帖子

static()方法(没有任何decleration)

我有以下课程:

public abstract class A()
{
   public static final SomeString = null;

   static()
   {
       SomeString = "aaa";
   }
}
Run Code Online (Sandbox Code Playgroud)

何时调用此静态方法以及如何调用?

创建这样的静态方法(没有名称/返回类型)的目的是什么?

java static initializer static-initialization

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

在命令行上向类路径添加多个jar

我正在运行Ubuntu并希望通过包含多个jar文件从终端执行Java文件.

我的所有罐子都包含在tha jar文件夹中.

我试过了

javac -cp jar/A.jar: jar/B.jar: jar/C.jar: jar/D.jar MyFile.java
Run Code Online (Sandbox Code Playgroud)

我得到以下错误.

javac: invalid flag: jar/B.jar:
Usage: javac <options> <source files>
use -help for a list of possible option
Run Code Online (Sandbox Code Playgroud)

任何人都可以指导如何在类路径中使用多个jar?

java terminal ubuntu command-line jar

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

没有表单的Django用户创建

我正在为我们的应用程序构建分析平台.

要创建可以访问分析平台的用户,我选择不使用djangos用户模型的应用程序中的现有用户.然后我计划为所选用户创建一个django用户,这样我就可以使用内置身份验证的djangos.

我已经看到了许多使用表单创建django用户的示例,但是我没有在文本框中写入电子邮件,而是从搜索列表中选择应用程序中的现有用户.

因此,我不认为我可以使用表单,并想知道我应该如何创建用户?

我打算将用户选择的id和密码发送给用AJAX创建用户的视图.

python django

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

哪个对象/控件用于在Apple Watch应用程序中水平滚动?

我正在创建一个苹果手表应用程序,并希望使用uiscrollview在iPhone上水平滚动.

哪个对象/控件用于在Apple Watch应用程序中水平滚动?

xcode objective-c ios apple-watch

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

如何在命令行中使用感叹号作为字符串的一部分?

我想使用字符串搜索功能执行一些 Hadoop 映射缩减作业。

该命令如下所示:

hadoop search "asdcg!sfdf"
Run Code Online (Sandbox Code Playgroud)

然后就会显示

zsh: event not found:sfdf

我尝试替换“!” 与“^!” 或“^^!”,并且仍然有相同的结果。

有人能帮我解决这个问题吗?谢谢。

string hadoop

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

用Java编写的Floyd-Steinberg算法

我正在尝试用Java实现Floyd Steinberg算法,使用java.awt.image.BufferedImage.

我使用了这里描述的算法 和自定义调色板,我希望得到或多或少与维基百科示例中相同的图像(或者由Gimp生成的图像)​​,但是我得到了一个非常不同的版本.

你可以看到我得到的东西

在此输入图像描述

我显然缺少一些东西(输出图像的颜色不属于我的调色板),但我无法弄清楚是什么.

我做错了什么?

这是代码:

import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.image.IndexColorModel;
import java.io.File;
import java.io.IOException;

public class FloydSteinbergTest {

private static final Color[] PALETTE = new Color[]{
        new Color(221, 221, 221),
        new Color(19, 125, 62),
        new Color(179, 80, 188),
        new Color(107, 138, 201),
        new Color(177, 166, 39),
        new Color(65, 174, 56),
        new Color(208, 132, 153),
        new Color(64, 64, 64),
        new Color(154, 161, 161),
        new Color(46, 110, 137),
        new Color(126, 61, 181),
        new Color(46, …
Run Code Online (Sandbox Code Playgroud)

java algorithm image-processing java-2d

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

在C中的Windows机器上进行开发时,为什么会出现include <windows.h>错误?

我是C的新手,我正在尝试编译使用外部库的代码.因此,我按照这些步骤链接库.但是在第一个

gcc -c -Wall -Werror -fpic PICASO_SERIAL_4DLIBRARY.C
Run Code Online (Sandbox Code Playgroud)

我明白了

PICASO_SERIAL_4DLIBRARY.C:1:0: error: -fpic ignored for target (all code is position independent) [-Werror]
#include <windows.h>


cc1plus.exe: all warning being treated as errors
Run Code Online (Sandbox Code Playgroud)

另外,#上面有一个箭头.我试着用搜索引擎,但我只能发现这是一个Linux的问题,不是Windows一个(我开发在Windows现在)和我跟着这些步骤来安装gcc.编制其他小项目也是有效的.

任何人都知道,为什么这不起作用?

c windows gcc

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

在listview onclick中从数据库获取Id

我有这个类,它从数据库中获取数据并显示在列表视图中.

有没有办法从数据库中获取Id并烘烤它?

现在吐司正在回归: android.database.sqlite.SQLiteCursor@4180c088

 public class AndroidSQLite extends Activity { 

 private SQLiteAdapter
 mySQLiteAdapter;

 @Override
 public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
     setContentView(R.layout.main);
     ListView listContent = (ListView)findViewById(R.id.contentlist);

     mySQLiteAdapter = new SQLiteAdapter(this);
     mySQLiteAdapter.openToRead();

     Cursor cursor = mySQLiteAdapter.queueAll();
     startManagingCursor(cursor);

     String[] from = new String[]{SQLiteAdapter.KEY_NOME,SQLiteAdapter.KEY_ID};
     int[] to = new int[]{R.id.text,R.id.id};

     SimpleCursorAdapter cursorAdapter =
      new SimpleCursorAdapter(this, R.layout.row, cursor, from, to);

     listContent.setAdapter(cursorAdapter);

     listContent.setOnItemClickListener(new OnItemClickListener() {
         public void onItemClick(AdapterView<?> parent, View view, int position,
                 long id) {
                //GET ID FROM DATABASE
                Toast.makeText(getBaseContext(), parent.getItemAtPosition(position).toString(), Toast.LENGTH_LONG).show();
                //THIS TOAST IS RETURNING …
Run Code Online (Sandbox Code Playgroud)

database android android-listview

0
推荐指数
1
解决办法
3212
查看次数

quickfix/j SessionSettings仅加载文件配置中的最后一个会话

当我尝试使用配置文件的URL调用SessionSettings的构造函数时,它只加载文件中存在的最后一个会话.

我试过打印我的代码从配置文件中读取的内容,但我得到了这个:

[DEFAULT]
StartTime=00:00:00
EndTime=23:59:59
ReconnectInterval=5
TargetCompID=Server
SenderCompID=Client
DataDictionary=C:\config\FIX42.xml
HeartBtInt=30
FileStorePath=C:\logsBadisInitiatorStore
UseDataDictionary=Y
FileLogPath=C:\logsBadisInitiator
[SESSION]
StartTime=00:00:00
ConnectionType=acceptor
EndTime=23:59:59
BeginString=FIX.4.2
SocketAcceptPort=9878
TargetCompID=server1
SessionName=badisAcc289
SenderCompID=client1
SocketAcceptAddress=localhost
UseDataDictionary=N
Run Code Online (Sandbox Code Playgroud)

但我的配置文件包含更多:

[default]
FileStorePath=data
SenderCompID=Client
TargetCompID=Server
FileLogPath=C:\logsBadisInitiator
StartTime=00:00:00 
EndTime=23:59:59
HeartBtInt=30
ReconnectInterval=5
UseDataDictionary=Y
DataDictionary=C:\config\FIX42.xml
FileStorePath=C:\logsBadisInitiatorStore

[session] 
SessionName=badisAcc2
BeginString=FIX.4.2
SenderCompID=client1
TargetCompID=server1
ConnectionType=acceptor
SocketAcceptPort=9878
SocketAcceptAddress=localhost
StartTime=00:00:00
EndTime=23:59:59
UseDataDictionary=N

[session] 
SessionName=test211
BeginString=FIX.4.2
SenderCompID=client1
TargetCompID=server1
ConnectionType=initiator
SocketConnectPort=9878
SocketConnectHost=localhost
StartTime=00:00:00
EndTime=23:59:59
UseDataDictionary=N

[session] 
SessionName=badisAcc3
BeginString=FIX.4.2
SenderCompID=client1
TargetCompID=server1
ConnectionType=acceptor
SocketAcceptPort=9878
SocketAcceptAddress=localhost
StartTime=00:00:00
EndTime=23:59:59
UseDataDictionary=N

[session] 
SessionName=badisAcc4
BeginString=FIX.4.2
SenderCompID=client1
TargetCompID=server1
ConnectionType=acceptor
SocketAcceptPort=9878
SocketAcceptAddress=localhost
StartTime=00:00:00
EndTime=23:59:59 …
Run Code Online (Sandbox Code Playgroud)

java quickfix fix-protocol quickfixj

0
推荐指数
1
解决办法
865
查看次数

无法使用 System.cmd 从 Elixir 中运行curl 命令

我只是尝试使用 Elixir 运行特定格式的curl 命令。

$ curl -w "@config/curl-format.txt" -o /dev/null -s "http://wordpress.com/"
0.004, 0.017, 0.000, 0.017, 0.000, 0.029, 0.029
Run Code Online (Sandbox Code Playgroud)

直接从终端运行命令效果很好。


这就是我在 Elixir 中尝试做的事情:

args = ["-w config/curl-format.txt", "-o /dev/null", "-s", "http://wordpress.com"]
result = System.cmd("curl", args, [])
Run Code Online (Sandbox Code Playgroud)

但我得到:

{" config/curl-format.txt", 23}
Run Code Online (Sandbox Code Playgroud)

而且结果和上面不一样。

curl command system elixir

0
推荐指数
1
解决办法
696
查看次数

以编程方式编译.java文件

我想要什么?

我想创建一个程序,可以将.java文件编译为.class文件,就像在本网站上完成一样: 创新网站

我有什么问题?

  • 有没有可以用来做这个的图书馆?
  • 我在哪里可以获得这个图书馆?
  • 如果没有这个库,那我该怎么办呢?

java compilation

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