我想从给定的HTML代码中提取纯文本.我尝试过使用regex并得到了
String target = val.replaceAll("<a.*</a>", "");.
我的主要要求是,我想删除之间的所有内容<a>和 </a>(包括链接名称).使用上面的代码时,所有其他内容也被删除.
<a href="www.google.com">Google</a> 这是Google链接
<a href="www.yahoo.com">Yahoo</a> 这是一个雅虎链接
在这里,我想删除之间的数值<a>和</a>.最终的输出应该
This is a Google Link This is a Yahoo Link
我有一张表,其中包含销售ID,产品代码和金额.有些地方的产品代码为空.我想显示Missing而不是null.下面是我的表.
salesId prodTypeCode amount
1 123 150
2 123 200
3 234 3000
4 234 400
5 234 500
6 123 200
7 111 40
8 111 500
9 1000
10 123 100
Run Code Online (Sandbox Code Playgroud)
我想显示每个prodTypeCode选项的总量.如果prodTypeCode为null,则应显示Missing.
select (CASE WHEN prodTypeCode IS NULL THEN
'Missing'
ELSE
prodTypeCode
END) as ProductCode, SUM(amount) From sales group by prodTypeCode
Run Code Online (Sandbox Code Playgroud)
以上查询给出错误.请建议我克服这个问题.我已经创建了一个SQLFIDDLE
我想计算Group by中值的百分比.我的表数据
salesId salesAmount productName salesTyp
------- ----------- ----------- --------
1 50.00 mouse online
2 100.00 mouse shop
3 150.00 mouse shop
4 50.00 mouse shop
5 100.00 keyboard shop
6 50.00 keyboard online
Run Code Online (Sandbox Code Playgroud)
Out put我想表现得像
productName totalamount percentageofonline
----------- ----------- ------------------
mouse 350 25.00
keyboard 150 50.00
Run Code Online (Sandbox Code Playgroud)
这里出售4只鼠标(商店3只,网上1只),所以百分比为25.00
,售出2个键盘(商店1个,网上1个),所以百分比为50.00
请帮我搞定.我已经为表结构创建了一个SQLFIDDLE.
任何人都可以告诉我输出变化的原因.
public class Demo {
public void demo()
{
Integer y = 567;
Integer x = y;
System.out.println(x + " " + y);
System.out.println(y == x);
y++;
System.out.println(x + " " + y);
System.out.println(y == x);
y--;
System.out.println(x + " " + y);
System.out.println(y == x);
}
public static void main(String args[])
{
Demo obj = new Demo();
obj.demo();
}
}
Run Code Online (Sandbox Code Playgroud)
输出:
567 567
true
567 568
false
567 567
False
Run Code Online (Sandbox Code Playgroud)
这就是为什么我得到最后的错误.
在我的d3.js条形图中,我希望X轴标签处于"垂直"状态.我在"水平"中获得标签,但问题是某些标签合并了.
<!DOCTYPE html>
<style>
body {
font: 10px sans-serif;
}
.axis path,
.axis line {
fill: none;
stroke: #000;
shape-rendering: crispEdges;
}
.bar {
fill: red;
}
.x.axis path {
display: none;
}
</style>
<body>
<script src="http://d3js.org/d3.v3.min.js"></script>
<script>
var margin = {top: 20, right: 20, bottom: 30, left: 40},
width = 960 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;
var x = d3.scale.ordinal()
.rangeRoundBands([0, width], .1);
var y = d3.scale.linear()
.range([height, 0]);
var xAxis = d3.svg.axis() …Run Code Online (Sandbox Code Playgroud) 我用Itext和创建PDF xmlworker.我的问题是我想在新页面中创建内容.以下是我的代码.
File file = new File("D:/PDFFiles/Sathesh.pdf");
FileOutputStream fos=new FileOutputStream(file);
Document doc=new Document(PageSize.A4, 50, 50, 70, 70);
PdfWriter pdfWriter=PdfWriter.getInstance(doc, fos);
doc.open();
XMLWorkerHelper worker=XMLWorkerHelper.getInstance();
String firstString="<table><tr><td>First Page</td></tr></table>" ;
String secondString="<table><tr><td>Second Page</td></tr></table>" ;
String final=firstString+secondString;
ByteArrayInputStream is = new ByteArrayInputStream(final.getBytes());
worker.parseXHtml(pdfWriter, doc, is);
doc.close();
fos.close();
Run Code Online (Sandbox Code Playgroud)
我希望firstString在第一页和secondString页面中.等待你的答复.
从AWS S3 bucket for WEB Application上载/下载文件所需的jar文件是什么.我试过下面的Jar文件,但仍然无法成功.
aws-java-sdk-1.10.26
aws-java-sdk-1.10.26-javadoc
aws-java-sdk-1.10.26-sources
aws-java-sdk-flow-build-tools-1.10.26
apache-httpcomponents-httpcore
apache-httpcomponents-httpclient
com.fasterxml.jackson.core
jackson-databind-2.2.3
jackson-annotations-2.2.3
httpclient-4.2
帮助我只添加所需的JAR文件.提前致谢.