我正在构建一个简单的rails应用程序,当我加载主页时,我得到:
Completed 500 Internal Server Error in 59ms
ActionView::Template::Error (different prefix: "c:/" and
"D:/workspaceRor/jrpappthree/ ssets/stylesheets"
(in D:/workspaceRor/jrpappthree/app/assets/stylesheets/custom.css.scss)):
2: <html>
3: <head>
4: <title><%= full_title(yield(:title)) %></title>
5: <%= stylesheet_link_tag "application", media: "all" %>
6: <%= javascript_include_tag "application" %>
7: <%= csrf_meta_tags %>
8: <%= render 'layouts/shim' %>
Run Code Online (Sandbox Code Playgroud)
我的宝石文件
gem 'rails'
gem 'bootstrap-sass'
gem 'bcrypt-ruby'
gem 'faker'
gem 'will_paginate'
gem 'bootstrap-will_paginate'
gem 'pg'
group :development, :test do
gem 'mysql2'
gem 'annotate'
end
# Gems used only for assets and not required
# …Run Code Online (Sandbox Code Playgroud) 我使用 Spark 2.1。
输入 csv 文件包含如下所示的 unicode 字符
在解析这个 csv 文件时,输出如下所示
我使用 MS Excel 2010 查看文件。
使用的Java代码是
@Test
public void TestCSV() throws IOException {
String inputPath = "/user/jpattnaik/1945/unicode.csv";
String outputPath = "file:\\C:\\Users\\jpattnaik\\ubuntu-bkp\\backup\\bug-fixing\\1945\\output-csv";
getSparkSession()
.read()
.option("inferSchema", "true")
.option("header", "true")
.option("encoding", "UTF-8")
.csv(inputPath)
.write()
.option("header", "true")
.option("encoding", "UTF-8")
.mode(SaveMode.Overwrite)
.csv(outputPath);
}
Run Code Online (Sandbox Code Playgroud)
如何获得与输入相同的输出?
我想要不.来自gmail帐户的最近未读邮件.为此,我在我的Ubuntu系统中安装了IMAP并尝试了一些PHP iMAP功能.这是我到现在为止所尝试的.
/* connect to gmail */
$hostname = '{imap.gmail.com:993/imap/ssl}INBOX';
$username = 'user@gmail.com';
$password = 'user_password';
/* try to connect */
$inbox = imap_open($hostname,$username,$password) or die('Cannot connect to Gmail: ' . imap_last_error());
Run Code Online (Sandbox Code Playgroud)
现在我说明我的所有尝试.注意 - 我已经通过向测试电子邮件ID发送新邮件尝试了每次尝试
Attempt_1:使用imap_search()
$recent_emails = imap_search($inbox,'RECENT');
if ($recent_emails)
echo count($recent_emails);
else
echo "false return";
imap_close($inbox);
Run Code Online (Sandbox Code Playgroud)
现在Attempt_1的输出是"错误返回";
尝试_2:使用imap_mailboxmsginfo()
$check = imap_mailboxmsginfo($inbox);
if ($check)
echo "Recent: " . $check->Recent . "<br />\n" ;
else
echo "imap_check() failed: " . imap_last_error() . "<br />\n";
imap_close($inbox);
Run Code Online (Sandbox Code Playgroud)
这里的输出是Recent:0,而我已经向这个id发送了2封新邮件
Attempt_3:使用imap_status()
$status = imap_status($inbox, …Run Code Online (Sandbox Code Playgroud) 我有一个CreateFTPConnection类,它创建一个FTPS连接.使用此连接,传输文件.这是TransferFile类的代码
public class TransferFile
{
private CreateFTPConnection ftpConnection;
private FTPSClient client;
public TransferFile(CreateFTPConnection ftpConnection) {
this.ftpConnection = ftpConnection;
this.client = ftpConnection.getClient();
}
public void transfer(Message<?> msg)
{
InputStream inputStream = null;
try
{
if(!client.isConnected()){
ftpConnection.init();
client = ftpConnection.getClient();
}
File file = (File) msg.getPayload();
inputStream = new FileInputStream(file);
client.storeFile(file.getName(), inputStream);
client.sendNoOp();
} catch (Exception e) {
try
{
client.disconnect();
}
catch (IOException e1) {
e1.printStackTrace();
}
}
finally
{
try {
inputStream.close();
}
catch (IOException e) {
e.printStackTrace();
}
} …Run Code Online (Sandbox Code Playgroud) 在Maven项目中,我使用PowerMock-easymock来运行jUnit测试用例.但在做"mvn clean install"时,我的输出低于输出值.
运行TestSuite测试运行:2,失败:0,错误:0,跳过:0,已过去时间:0.621秒
结果:
测试运行:2,失败:0,错误:0,跳过:0
但我还有很多其他测试用例.这是pom.xml的一部分
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.easymock</groupId>
<artifactId>easymock</artifactId>
<version>3.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-easymock-release-full</artifactId>
<version>1.4.12</version>
<type>pom</type>
</dependency>
Run Code Online (Sandbox Code Playgroud)
如果我删除,PowerMock依赖并执行"mvn clean install",所有测试用例都运行正常.但我必须使用PowerMock.如何解决这个问题?
请参阅以下代码
class TestToString
{
public static void main(String args[])
{
CheckToString cs = new CheckToString (2);
CheckToString c = new CheckToString (2);
if( cs.equals(c))
System.out.println(" Both objects are equal");
else
System.out.println(" Unequal objects ");
}
}
class CheckToString
{
int i;
CheckToString ()
{
i=10;
}
CheckToString (int a)
{
this.i=a;
}
}
Run Code Online (Sandbox Code Playgroud)
输出: 不等的对象
但我期待输出会是
两个对象都是平等的
我明白这两个对象有不同的反馈,
System.out.println(cs); //com.sample.personal.checkToString@19821f
System.out.println(c); //com.sample.personal.checkToString@addbf1
Run Code Online (Sandbox Code Playgroud)
但我问,为什么他们有不同的推荐?而在下面的例子中,对象具有相同的存储位置.
Integer a = new Integer(2);
Integer b = new Integer(2);
System.out.println(a); //2
System.out.println(b); //2
Run Code Online (Sandbox Code Playgroud)
我将用户定义类的对象与预定义类的对象进行比较.似乎用户定义类的对象与Integer类的对象的行为相同,其值超过-128到127.为什么这两种情况的引用都不同?(对于Integer类,其值在-128到127之间,对于用户定义的类不同)