尝试在JavaMail中使用NTLM连接到Exchange服务器.我可以连接到SMTP,但不能连接到IMAP.我还可以使用相同的主机/用户名/密码,帐户类型="IMAP",端口143,ssl = false,身份验证= NTLM,域名=""通过OS X Mail.app应用程序进行身份验证.
连接代码:
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.Store;
import java.util.Properties;
public class NTLMTest {
public static void main(String[] args) throws Exception {
final String host = "example.com";
final String user = "bob";
final String password = "password";
final Properties properties = new Properties();
Session session = Session.getDefaultInstance(properties);
session.setDebug(true);
// SMTP CONNECT
final Transport transport = session.getTransport("smtp");
transport.connect(host, user, password);
System.out.println("SMTP Connect successful");
// IMAP CONNECT
final Store store = session.getStore("imap");
store.connect(host, user, password);
System.out.println("IMAP Connect …
Run Code Online (Sandbox Code Playgroud) 我的可调整大小的JScrollPane的内容具有最小宽度.如果JScrollPane小于此宽度,则应显示水平滚动条.如果它大于此宽度,则视口内容应展开以填充整个视口.
看起来像一个简单的概念,我有一些工作,但感觉就像一个黑客:
import javax.swing.*;
import java.awt.*;
import java.awt.event.ComponentAdapter;
import java.awt.event.ComponentEvent;
public class SSBTest {
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
final Component view = new MyView();
final JScrollPane jScrollPane = new JScrollPane(view);
jScrollPane.addComponentListener(new ComponentAdapter() {
@Override
public void componentResized(final ComponentEvent e) {
final Dimension minimumSize = view.getMinimumSize();
final int width = Math.max(minimumSize.width, jScrollPane.getViewport().getWidth());
view.setPreferredSize(new Dimension(width, minimumSize.height));
}
});
showInDialog(jScrollPane);
}
});
}
private static void showInDialog(final JScrollPane jScrollPane) {
final JDialog dialog = …
Run Code Online (Sandbox Code Playgroud) FireBase似乎支持来自Facebook,Twitter,Google和GitHub的基于OAuth的身份验证.那个不同的OAuth提供商怎么样?如果存在通用的"OAuth"选项,那么除了指定API密钥和秘密之外,您还需要指定其他任何信息.
是否可以使用FireBase现有的基于OAuth的身份验证模块,而无需为FireBase自行定制OAuth身份验证模块,可能是从"内置"OAuth机制中分离出来的?哪一个最通用,如果是这样的话?
我有两个以下DTM-s:
dtm <- DocumentTermMatrix(t)
dtmImproved <- DocumentTermMatrix(t,
control=list(minWordLength = 4, minDocFreq=5))
Run Code Online (Sandbox Code Playgroud)
当我实现这个时,我看到两个相同的DTM-s,如果我打开它dtmImproved
,就会有3个符号的单词.为什么minWordLength
参数不起作用?谢谢!
> dtm
A document-term matrix (591 documents, 10533 terms)
Non-/sparse entries: 43058/6181945
Sparsity : 99%
Maximal term length: 135
Weighting : term frequency (tf)
> dtmImproved
A document-term matrix (591 documents, 10533 terms)
Non-/sparse entries: 43058/6181945
Sparsity : 99%
Maximal term length: 135
Weighting : term frequency (tf)
Run Code Online (Sandbox Code Playgroud) 我需要在Java中使用IntervalTree或RangeTree,并且无法找到具有工作删除支持的实现.
在sun.jvm.hotspot.utilities.IntervalTree中有一个内置的,但RBTree超类中的deleteNode方法指出:
/**
* FIXME: this does not work properly yet for augmented red-black
* trees since it doesn't update nodes. Need to figure out exactly
* from which points we need to propagate updates upwards.
*/
Run Code Online (Sandbox Code Playgroud)
尝试从树中删除节点最终会抛出异常:
节点的最大端点未正确更新
delete
在sun.jvm.hotspot.utilities.IntervalTree的子类中正确实现功能有多难?或者是否有另一个Interval Tree实现已经正确实现了这个?
目前我只是在擦除树并在每次删除时重新填充它,这远非理想(注意:在RBTree中设置DEBUGGING = false会大大加快速度).
编译java文件时在IntelliJ项目上出现此错误.没有列出特定的源文件,但它失败并出现此错误.
删除以下编译器标志可修复错误:
-source 1.5 -target 1.5
Run Code Online (Sandbox Code Playgroud)
但是,由于我们的目标是Java 5,因此需要将它们放在那里.是否存在try/catch
导致此错误的特定代码(可能是块)?
2013-10-15 16:21:50,556 [26947209] INFO - ompiler.BackendCompilerWrapper - JSR/RET are not supported with computeFrames option
java.lang.RuntimeException: JSR/RET are not supported with computeFrames option
at org.objectweb.asm.Frame.a(Unknown Source)
at org.objectweb.asm.MethodWriter.visitJumpInsn(Unknown Source)
at org.objectweb.asm.MethodAdapter.visitJumpInsn(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at org.objectweb.asm.ClassReader.accept(Unknown Source)
at com.intellij.compiler.impl.javaCompiler.BackendCompilerWrapper$ClassParsingThread.a(BackendCompilerWrapper.java:893)
at com.intellij.compiler.impl.javaCompiler.BackendCompilerWrapper$ClassParsingThread.run(BackendCompilerWrapper.java:846)
at com.intellij.openapi.application.impl.ApplicationImpl$7.run(ApplicationImpl.java:386)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:680)
at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:130)
Run Code Online (Sandbox Code Playgroud) 我的 Ionic 5 应用程序想要发送推送通知。我能找到的唯一指南是在 Ionic + Angular 应用程序中使用带有 Firebase 的推送通知
为什么需要 Firebase?我可以在没有 Firebase 的情况下发送推送通知吗?
反正我试过这个设置。我没有走多远。
该指南有以下代码:
// Request permission to use push notifications
// iOS will prompt user and return if they granted permission or not
// Android will just grant without prompting
PushNotifications.requestPermission().then( result => {
if (result.granted) {
// Register with Apple / Google to receive push via APNS/FCM
PushNotifications.register();
} else {
// Show some error
}
});
Run Code Online (Sandbox Code Playgroud)
但是,Typescript 抱怨正确的方法requestPermissions()
不是requestPermission()
.
在 XCode …
push-notification apple-push-notifications ionic-framework capacitor
我正在使用JTextPane来编辑HTML.当我在GUI组件中输入换行符并在JTextPane上调用getText()时,我得到一个带换行符的字符串.如果我然后创建一个新的JTextPane并传入相同的文本,则忽略换行符.
为什么在输入换行符时JTextPane不插入<br>标签?这有一个很好的解决方法吗?
JTextPane test = new JTextPane();
test.setPreferredSize(new Dimension(300, 300));
test.setContentType("text/html");
test.setText("Try entering some newline characters.");
JOptionPane.showMessageDialog(null, test);
String testText = test.getText();
System.out.println("Got text: " + testText);
// try again
test.setText(testText);
JOptionPane.showMessageDialog(null, test);
testText = test.getText();
System.out.println("Got text: " + testText);
Run Code Online (Sandbox Code Playgroud)
样本输出:
<html>
<head>
</head>
<body>
Try entering some newline characters.
What gives?
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我意识到我可以在调用setText之前将换行符转换为HTML换行符,但这也会在HTML和BODY标记之后转换换行符,并且看起来很愚蠢.
我看到很多关于 Vue + Typescript 组件类的相互矛盾的文档。
在哪里定义属性?在此处@Component
概述的注释中?作为此处概述的带注释的实例属性?@Prop
在哪里初始化定义的属性?在构造函数中?在字段级属性定义中?
是否有这些东西的明确的、最新的参考资料或最新的示例应用程序?
这是我现在所拥有的:
<template>
<div class='contacts'>
<b-form @submit="search">
<b-form-group>
<b-form-input v-model="q"></b-form-input>
</b-form-group>
<b-button type="submit" variant="primary">Search</b-button>
</b-form>
<b-table :items='contacts'></b-table>
</div>
</template>
<script lang="ts">
import {Component, Prop, Vue} from 'vue-property-decorator'
@Component
export default class Contacts extends Vue {
constructor(options: any) {
super(options);
this.q = 'dummy data';
this.contacts = [{
'id': 1,
'first_name': 'Lukas',
'last_name': 'Stigers',
'email': null,
'gender': 'Male',
'phone': '776-878-7222'
}, {
'id': 2,
'first_name': 'Dari',
'last_name': 'Matkin',
'email': …
Run Code Online (Sandbox Code Playgroud)