小编Ale*_*lex的帖子

在Windows上为Bitbucket设置SSH密钥

首先,我是git,repos和命令行的绝对菜鸟.我有Bitbucket的回购,我基本上希望能够通过gitbash推送到存储库,而无需每次都输入密码.

我有什么:

  • Bitbucket上的存储库,已经设置了代码.
  • 克隆存储库的本地目录.
  • 通过PuTTY生成的公钥和私钥.
  • 公钥通过Manage SSH keys页面添加到Bitbucket.

我现在如何使其工作,以便每次从gitbash终端推送时都不必输入密码?我正在使用Windows 10.

windows git ssh bitbucket

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

是否有一个替代getClass().getResource()的静态ImageIcon

好的,我有一个静态的ImageIcon,而Image却没有显示出来.在同一个程序中我使用其他ImagesIcon,但它们不是静态的,所以当我声明它们时,我这样做:

public ImageIcon blabla = new ImageIcon(getClass().getResource(blabla.png)); 
Run Code Online (Sandbox Code Playgroud)

但是,如果我声明一个ImageIcon静态我不能使用该行,因为无法从静态值访问getClass().现在这些图像没有显示出来:

public static ImageIcon blabla = new ImageIcon(blabla.png); 
Run Code Online (Sandbox Code Playgroud)

谢谢你的帮助!

public static ImageIcon networkOfflineIcon = new ImageIcon("Images/networkOfflineIcon.png");
public static ImageIcon networkIcon = new ImageIcon("Images/networkIcon.png");
protected static JMenuItem jmiRemote = new JMenuItem("  Remote", networkOfflineIcon);
//************************************************************************
public static void changeNetWorkStatus(boolean network_status)          
//************************************************************************
{
    if(network_status){
        Application.jmiRemote.setIcon(networkIcon);
        Application.jmiRemote.setText("NetWork Online/Remote is On");
        Application.lockScreenRemote();

    }else if(!network_status){
        Application.jmiRemote.setIcon(networkOfflineIcon);
        Application.jmiRemote.setText("NetWork Offline/Remote is Off");
        Application.unlockScreenRemote();
    }
}//DOESNT CHANGE THE IMAGE
//************************************************************************
Run Code Online (Sandbox Code Playgroud)

java static imageicon

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

正则表达式匹配未注释的行

所以我从JavaScript文件读取了一个字符串,它将具有:

...
require('some/path/to/file.less');
...
// require('some/path/to/file.less');
...
Run Code Online (Sandbox Code Playgroud)

我正在使用这个注册表:

requireRegExp = /require(\ +)?\((\ +)?['"](.+)?['"](\ +)?\)\;?/g
Run Code Online (Sandbox Code Playgroud)

抓住所有这些线.但是,我需要过滤掉评论的那些.

所以,当我跑

while( match = requireRegExp.exec(str) ){
...
}
Run Code Online (Sandbox Code Playgroud)

我将只获得以require开头的未注释行的匹配...

javascript regex

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

将属性转换为输入流?

在我们修改它之后,是否可以将Properties转换为InputStream.

这里有一些代码来澄清这个问题:

sftpConnection = new connectSFTP(host, user, pass, port);
Properties ssProperties = new Properties();
InputStream in = null;
try{
    in = sftpConnection.download(fileName, fileDirectory);
    ssProperties.load(in);
    //System.out.println("File Found");
    ssProperties.setProperty(key, value);
    sftpConnection.upload(<<Need the new InputStream here>>, fileDirectory);
    in.close();     
}
catch(Exception ex)
{
System.out.println("File Not Found"); 
} 
Run Code Online (Sandbox Code Playgroud)

java sftp properties

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

是否可以获取一个字符串并将其放入 System.in 中?

我想知道是否有办法采取String- 让我们说:

String str = "blabla";
Run Code Online (Sandbox Code Playgroud)

并做:

System.in.setText(str);   
Run Code Online (Sandbox Code Playgroud)

我知道这行不通——我想知道是否有办法做到这一点。然后发送相同的字符串。就像您在控制台中写入并按 一样Enter

这是一个带有服务器套接字的程序,我正在尝试通过端口发送String,以便其他应用程序知道如何处理它。

编辑: 我找到了一种方法,当用户在通过 System.in 发送的文本字段中写入时,将输入流重定向到文本字段。

import java.io.*;
import javax.swing.*;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;

public class TextfieldInputStream extends InputStream implements DocumentListener {

    private JTextField tf;
    private String str = null;
    private int pos = 0;

    public TextfieldInputStream(JTextField jtf) {
        tf = jtf;
    }

    @Override
    public int read() {
        //test if the available input has reached its end
        //and the EOS should be returned 
        if(str != …
Run Code Online (Sandbox Code Playgroud)

java string io port input

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

标签 统计

java ×3

bitbucket ×1

git ×1

imageicon ×1

input ×1

io ×1

javascript ×1

port ×1

properties ×1

regex ×1

sftp ×1

ssh ×1

static ×1

string ×1

windows ×1