我正在尝试使用以下代码:
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import javax.mail.*;
import javax.mail.internet.*; // important
import javax.mail.event.*; // important
import java.net.*;
import java.util.*;
public class servletmail extends HttpServlet {
public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
PrintWriter out=response.getWriter();
response.setContentType("text/html");
try {
Properties props=new Properties();
props.put("mail.smtp.host","localhost"); // 'localhost' for testing
Session session1 = Session.getDefaultInstance(props,null);
String s1 = request.getParameter("text1"); //sender (from)
String s2 = request.getParameter("text2");
String s3 = request.getParameter("text3");
String s4 = request.getParameter("area1");
Message message =new MimeMessage(session1);
message.setFrom(new InternetAddress(s1));
message.setRecipients(Message.RecipientType.TO,InternetAddress.parse(s2,false));
message.setSubject(s3);
message.setText(s4); …Run Code Online (Sandbox Code Playgroud) 当我尝试使用JavaMail API发送邮件时收到此错误.我确信用户名和密码是100%正确的.我正在连接的Gmail帐户是一个旧帐户,因为他们说它需要时间来处理新帐户.
DEBUG SMTP RCVD: 535-5.7.1 Username and Password not accepted. Learn more at
535 5.7.1 http://mail.google.com/support/bin/answer.py?answer=14257 x35sm3011668
wfh.6
javax.mail.SendFailedException: Sending failed;
nested exception is:
javax.mail.AuthenticationFailedException
at javax.mail.Transport.send0(Transport.java:218)
at javax.mail.Transport.send(Transport.java:80)
at Main.(Main.java:41)
at Main.main(Main.java:51)
这是我的代码:
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
public class Main
{
String d_email = "abc@gmail.com",
d_password = "pass",
d_host = "smtp.gmail.com",
d_port = "465",
m_to = "abc@gmail.com",
m_subject = "Testing",
m_text = "testing email.";
public Main()
{
Properties props = new Properties();
props.put("mail.smtp.user", d_email);
props.put("mail.smtp.host", d_host); … 有没有办法在javascript中将图像转换为二进制数据,反之亦然.
我正在尝试使用这个github api获取repo的所有贡献者.
如果我没有错,它还告诉我,如果有一个回购的贡献者超过500,它只提供500个,其余的被标记为匿名.
出于性能原因,只有存储库中的前500个作者电子邮件地址将链接到GitHub用户.
这个repo linux内核有5k +贡献者,根据api,我应该通过api获得至少500个贡献者.
当我做 curl -I https://api.github.com/repos/torvalds/linux/contributors?per_page=100
我只得到3页(per_page = 100)所以我得到> 300个贡献者.(查看"链接"标题)
有没有办法获得回购的所有贡献者(5000+)?
HTTP/1.1 200 OK
Server: GitHub.com
Date: Thu, 19 Nov 2015 18:00:54 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 100308
Status: 200 OK
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 56
X-RateLimit-Reset: 1447958881
Cache-Control: public, max-age=60, s-maxage=60
Last-Modified: Thu, 19 Nov 2015 16:06:38 GMT
ETag: "a57e0f74fc68e1791da15d33fa044616"
Vary: Accept
X-GitHub-Media-Type: github.v3
Link: <https://api.github.com/repositories/2325298/contributors?per_page=100&page=2>; rel="next", <https://api.github.com/repositories/2325298/contributors?per_page=100&page=3>; rel="last"
X-XSS-Protection: 1; mode=block
X-Frame-Options: deny
Content-Security-Policy: default-src 'none'
Access-Control-Allow-Credentials: true
Access-Control-Expose-Headers: ETag, Link, …Run Code Online (Sandbox Code Playgroud) 任何人都能解释一下这条线在JavaMail API中的含义吗?
props.put("mail.smtp.host", host);
Run Code Online (Sandbox Code Playgroud)
它用于设置邮件服务器,但我不明白.
我必须在我学校的一个项目中实现"服务绑定".
我刚刚从w3schools.com学习了WSDL.我开始知道"WSDL"是.我知道WSDL,但我没有做任何事情.我想用它去实用.我不知道该怎么做.
从哪里开始?我知道还有其他事情需要学习,我不知道他们是什么.
在获得"实用"方面我需要一些帮助.它只是在我的脑海里,我不知道如何实现它.
我正在尝试将AspectJ与Intellij一起使用.我已经启用Aspectj在的IntelliJ插件,Spring AOP/@Aspectj 和Support Aspectj我已经设置了ajc编译器Setting -> java compiler -> ajc.
我收到此错误消息.
AspectJ Support
IDEA was unable to find AspectJ compiler .jar among plugin dependencies.
Please fix <aspectj-maven-plugin> in '/home/manoj/stuff/moghul/Git_backend/dropwizard/pom.xml' and re-import a project,or set compiler manually via Settings | Compiler | Java Compiler.
Run Code Online (Sandbox Code Playgroud)
这是我的pom.xml
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-core</artifactId>
<version>3.1.0</version>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-graphite</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
<groupId>io.dropwizard.metrics</groupId>
<artifactId>metrics-annotation</artifactId>
<version>3.1.2</version>
</dependency>
<dependency>
<groupId>io.astefanutti.metrics.aspectj</groupId>
<artifactId>metrics-aspectj</artifactId>
<version>1.1.0</version>
</dependency>
<dependency> …Run Code Online (Sandbox Code Playgroud) 可能重复:
在PHP中提取JSONP结果集
我得到了以下格式的回复.我在如何进入"插件"变量并访问其中的其他变量时遇到麻烦.我使用过json_decode(),但我无法访问变量.
Plugin
(
{
"plugin_a":"abc",
"plugin_b":"abc",
"plugin_c":"abc"
}
)
Run Code Online (Sandbox Code Playgroud)
我试过了
$a = json_decode($json,true);
echo $a['plugin_a'];
Run Code Online (Sandbox Code Playgroud)
我没有任何输出.
echo var_dump($json); 给我
string 'Plugin({
"plugin_a":"abc",
"plugin_b":"abc",
"plugin_ce":"abc" })'
Run Code Online (Sandbox Code Playgroud) 这是在输入位置时得到纬度和长度的代码.我相信我的代码根据我的知识正确.但是我在进入一个地方后得到一个空白页面.
这是代码:
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var url="http://maps.googleapis.com/maps/api/geocode/json?address=";
var query;
var sensor="&sensor=false";
var callback="&callback=?";
$("button").click(function(){
query=$("#query").val();
$.getJSON(url+query+sensor+callback,function(json){
$('#results').append('<p>Latitude : ' + json.results.geometry.location.lat+ '</p>');
$('#results').append('<p>Longitude: ' + json.results.geometry.location.lng+ '</p>');
});
});
});
</script>
</head>
<body>
<input type="text" id="query" /><button>Get Coordinates</button>
<div id="results"></div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)