I am totally confused on how to host a Dynamic website created using PHP and MySQL in Amazon Cloud.
I went through Amazon S3 and I hosted a static website there!
Then I tried Amazon EC2 and I learned some aspects about the concept of VPC. I thought that the dynamic websites are hosting in Amazon Cloud using EC2. I followed some steps and they taught me how to launch a website using Drupal (But, I didn't want that …
我正在研究一个简单的java程序.它只是编译并执行另一个java程序.我正在使用Runtime.exec()函数进行编译和运行.编译没有问题.但是当它运行时,如果第二个程序需要输入来从键盘读取,我不能从主进程中提供它.我使用了getOutputStream()函数.但它无能为力.我会提供我的代码.
public class sam {
public static void main(String[] args) throws Exception {
try {
Process p = Runtime.getRuntime().exec("javac sam2.java");
Process p2 = Runtime.getRuntime().exec("java sam2");
BufferedReader in = new BufferedReader(
new InputStreamReader(p2.getInputStream()));
OutputStream out = p.getOutputStream();
String line = null;
line = in.readLine();
System.out.println(line);
input=input+"\n";
out.write(input.getBytes());
p.wait(10000);
out.flush();
}catch (IOException e) {
e.printStackTrace();
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的主程序(sam.java).
以下是sam2.java的代码
public class sam2 {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str;
System.out.println("Enter the …
Run Code Online (Sandbox Code Playgroud) 我正在使用Amazon SES.我正在尝试使用PHPMailer从我的PHP脚本发送电子邮件.
我已经验证了两个电子邮件ID,并尝试向此邮件ID发送邮件.但它会引发以下错误.
SERVER -> CLIENT: 220 email-smtp.amazonaws.com ESMTP SimpleEmailService-693939519 QEPGeLndQQq5vJ53VMXU
CLIENT -> SERVER: EHLO localhost
SERVER -> CLIENT: 250-email-smtp.amazonaws.com250-8BITMIME250-SIZE 10485760250- STARTTLS250-AUTH PLAIN LOGIN250 Ok
CLIENT -> SERVER: STARTTLS
SERVER -> CLIENT: 220 Ready to start TLS
CLIENT -> SERVER: EHLO localhost
SERVER -> CLIENT: 250-email-smtp.amazonaws.com250-8BITMIME250-SIZE 10485760250-STARTTLS250-AUTH PLAIN LOGIN250 Ok
CLIENT -> SERVER: AUTH LOGIN
SMTP NOTICE: EOF caught while checking if connected
SMTP connect() failed.
Mailer Error: SMTP connect() failed. …
Run Code Online (Sandbox Code Playgroud) 我有一个以下格式的文本文件:
Name Place Mobile
Jon Sam India 1234567890
Barack Obama USA 0987654321
Run Code Online (Sandbox Code Playgroud)
每个字段由制表符空格分隔.我想通过shell脚本提取每个字段.我使用以下代码:
while IFS= read -r var; do
echo $var | awk -F"\t" '{print $1,"->"$2,"->"$3}'
done < myfile
Run Code Online (Sandbox Code Playgroud)
我期待以下风格的输出:
Jon Sam->India->1234567890
Run Code Online (Sandbox Code Playgroud)
但它打印如下:
Jon Sam India 1234567890-> ->
Run Code Online (Sandbox Code Playgroud)
这意味着,不会发生分裂.我的计划有什么问题?
我有这个shell脚本变量var.它保留3个以新行分隔的条目.从这个变量var,我想提取2和0.078688.只是这两个数字.
var="USER_ID=2
# 0.078688
Suhas"
Run Code Online (Sandbox Code Playgroud)
这些是我试过的代码:
echo "$var" | grep -o -P '(?<=\=).*(?=\n)' # For extracting 2
echo "$var" | awk -v FS="(# |\n)" '{print $2}' # For extracting 0.078688
Run Code Online (Sandbox Code Playgroud)
以上都没有工作.这里有什么问题?如何解决这个问题?
我使用libsvm java包进行句子分类任务.我有3节课.每个句子都表示为大小为435的向量.vector_file的格式如下:
1 0 0.12 0 0.5 0.24 0.32 0 0 0 ... 0.43 0
第一个数字表示类标签,剩余部分是矢量.
以下是我如何制作svm_problem:
public void makeSvmProb(ArrayList<Float> inputVector,float label,int p){
// p is 0 to 77 (total training sentences)
int idx=0,count=0;
svm_prob.y[p]=label;
for(int i=0;i<inputVector.size();i++){
if(inputVector.get(i)!=0) {
count++; // To get the count of non-zero values
}
}
svm_node[] x = new svm_node[count];
for(int i=0;i<inputVector.size();i++){
if(inputVector.get(i)!=0){
x[idx] = new svm_node();
x[idx].index = i;
x[idx].value = inputVector.get(i);
idx++;
}
}
svm_prob.x[p]=x;
}
Run Code Online (Sandbox Code Playgroud)
参数设置:
param.svm_type …
Run Code Online (Sandbox Code Playgroud)