const solanaWeb3 = require("@solana/web3.js");
const solanatoken = require("@solana/spl-token");
var wallet = solanaWeb3.Keypair.generate();
console.log("public key...", wallet.publicKey);
console.log("secret key...", wallet.secretKey);
console.log("secret key...", JSON.stringify(wallet.secretKey.toString()));`enter preformatted text here`
Run Code Online (Sandbox Code Playgroud)
我有
public key... PublicKey {
_bn: <BN: b5ec974285759f4004555c6890e045a4ce857c6a056895d77dd209c054e76556>
secret key... "211,55,244,72,160,174,33,152,24,226,97,172,91,91,47,3,148,83,99,188,150,111,153,248,253,237,31,223,194,194,199,0,181,236,151,66,133,117,159,64,4,85,92,104,144,224,69,164,206,133,124,106,5,104,149,215,125,210,9,192,84,231,101,86"
Run Code Online (Sandbox Code Playgroud)
我怎样才能得到private key,比如
kNykCXNxgePDjFbDWjPNvXQRa8U12Ywc19dFVaQ7tebUj3m7H4sF4KKdJwM7yxxb3rqxchdjezX9Szh8bLcQAjb
用于幻影钱包?文档:https ://solana-labs.github.io/solana-web3.js/classes/Keypair.html
我想在 Vaadin 中创建一个自定义组件。但我没有从组件类扩展它,而是尝试如下
公共类 MyMapComponent 扩展 LMap 实现 Component { }
我收到错误为
getId()' in 'com.vaadin.ui.AbstractComponent' clashes with 'getId()' in 'com.vaadin.flow.component.Component'; attempting to use incompatible return type.
Run Code Online (Sandbox Code Playgroud)
如何解决这个错误?实现这一目标的最佳方法是什么?
我的方向正确吗?我想将 LMap 添加为 Vaadin 14 中的组件。由于 v-leaflet 不支持 Vaadin 8 以上版本,因此我正在尝试 MPR,我试图将 LMap 添加为 vaadin 流中的组件。
小新到Java 8风格;
我们可以通过在 Java 8 API 中包含所有空检查来为以下语句编写代码有多有效
search.getResource()
.getResults().get(0).getCustomer().getPhoneNumber()
Run Code Online (Sandbox Code Playgroud)
我试过如下:(我觉得到处都是 Optional 有点奇怪)
List<Result> results = search.getResource().getResults();
Optional<Result> optionalResult = Optional.of(results).orElse(new ArrayList<>()).stream().findFirst();
if(optionalResult.isPresent() && Optional.of(optionalResult.get().getCustomer()).isPresent()) {
Source source = Optional.of(optionalResult.get().getCustomer()).get();
Optional<List<Customer>> customers = Optional.of(source.getCustomers());
if(customers.isPresent() && customers.get().stream().findFirst().isPresent() &&
Optional.of(customers.get().stream().findFirst().get().getPhoneNumber()).isPresent())
dest.setNumber(Integer.parseInt(customers.get().stream().findFirst().get().getPhoneNumber())));
}
Run Code Online (Sandbox Code Playgroud)
你能不能给我建议一个更好的方法。谢谢!
乍一看,这个问题似乎非常基本且简单,但我在编写有效的解决方案时仍然遇到了一些困难。这个想法是编写一个函数,该函数将两个生成器作为输入并生成每个列表的一项。如果任一列表为空,它将生成剩余列表的每个项目。例子:
list(alternate("abcdefg", [1, 2, 3, 4])) == ["a", 1, "b",2, "c", 3, "d", 4, "e", "f", "g"]
Run Code Online (Sandbox Code Playgroud)
什么样的工作,但看起来很丑:
def alternate(xs1, xs2):
xs1 = iter(xs1)
xs2 = iter(xs2)
while xs1 and xs2:
try:
yield next(xs1), next(xs2)
except StopIteration:
for x1 in xs1:
yield x1
for x2 in xs2:
yield x2
Run Code Online (Sandbox Code Playgroud)
特别是我想避免在一开始就将输入转换为迭代器。我尝试使用 2 个简单的 for 循环,但这显然只返回每个列表的最后一个值,因为一个 for 循环在另一个循环开始之前完成。这不是一个解决我的问题的问题,我而是在寻找一些代码来提高编写代码的技能!
我正在尝试一个有关继承的示例程序(我是初学者,我为我的代码中的愚蠢错误道歉)。我观察到的是,我在创建对象时(在构造函数中)传递的参数,当它们被输入到变量中时,变量的值不知何故最终为 0。以下是我的代码:
class Box
{
double length, width, height, vol;
Box(double l, double b, double h)
{
length = l;
width = b;
height = h;
}
Box(Box obj)
{
obj.length = length;
obj.width = width;
obj.height = height;
}
Box(double l)
{
length = width = height = l;
}
Box()
{
length = width = height = 0;
}
double volume()
{
vol = length * width * height;
return vol;
}
}
class WeightBox extends Box
{ …Run Code Online (Sandbox Code Playgroud) 我正在尝试将 UTC 时间转换为当地时间,包括夏令时。夏季,当地时间(斯德哥尔摩)应该比 UTC 早 2 小时,但当我用 Java 转换它时,它只增加了 1 小时。
public class TimeConverter {
public static void main(String[] args) throws ParseException {
getLocalTime("2:36:10 AM");
}
public static String getLocalTime(String utcTime) throws ParseException {
DateFormat utc = new SimpleDateFormat("hh:mm:ss a");
utc.setTimeZone(TimeZone.getTimeZone("UTC"));
Date date = utc.parse(utcTime);
DateFormat local = new SimpleDateFormat("HH:mm:ss");
local.setTimeZone(TimeZone.getDefault());
System.out.println(utc.getTimeZone());
System.out.println(local.getTimeZone());
System.out.println("UTC TIME\t" + utcTime);
System.out.println("LOCAL TIME\t" + local.format(date));
return local.format(date);
}
}
Run Code Online (Sandbox Code Playgroud)
输出:
sun.util.calendar.ZoneInfo[id="UTC",offset=0,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
sun.util.calendar.ZoneInfo[id="Europe/Stockholm",offset=3600000,dstSavings=3600000,useDaylight=true,transitions=143,lastRule=java.util.SimpleTimeZone[id=Europe/Stockholm,offset=3600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=3600000,startTimeMode=2,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=3600000,endTimeMode=2]]
UTC TIME 2:36:10 AM
LOCAL TIME 03:36:10
Run Code Online (Sandbox Code Playgroud) MacBook:~ apple$ `hashcat -m 22000 capture.hccapx wordlist.txt`\nhashcat (v6.2.5) starting\n\nwordlist.txt: No such file or directory\n\nStarted: Thu *** ** 14:36:23 ****\nStopped: Thu ** ** 14:36:23 ****\n\nMacBook:~ apple$ `hashcat -m 22000 -a3 capture.hccapx "?d?d?d?d?d?d?d?d`\nhashcat (v6.2.5) starting\n\n* Device #2: This device's local mem size is too small.\n\nOpenCL API (OpenCL 1.2 (May 7 2020 00:10:14)) - Platform #1 [Apple]\n====================================================================\n* Device #1: Intel(R) Core(TM)2 Duo CPU P8600 @ 2.40GHz, 2016/4096 MB (512 MB allocatable), 2MCU\n* Device #2: GeForce 320M, skipped\n\nMinimum password length supported by kernel: 8\nMaximum …Run Code Online (Sandbox Code Playgroud) java ×3
blockchain ×1
generator ×1
hashcat ×1
java-8 ×1
javascript ×1
localtime ×1
private ×1
private-key ×1
python ×1
solana ×1
utc ×1
vaadin ×1
vaadin14 ×1