我试图将阿拉伯字母插入mysql数据库,但它只存储"????".我使用DBCP连接mysql数据库,这里是数据源:
<Resource name="jdbc/view_db"
auth="Container"
type="javax.sql.DataSource"
username="root"
password=""
autoReconnect="true"
testOnBorrow="true"
validationQuery = "SELECT 1"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/view_db"
maxActive="50"
maxIdle="10"/>
Run Code Online (Sandbox Code Playgroud)
如何在DBCP配置中设置UTF-8编码或如何使用(useUnicode = yes characterEncoding = UTF-8)?
我在android中从这个URL播放实时流
到目前为止,我已经设法在videoView中播放视频,问题是视频在23秒后完全停止,所以我使用了videoview方法setOnCompletionListener(...)以便再次启动视频,但是,这提供了糟糕的体验观众,因为它每23秒停一次并重新开始,也会错过几帧.
所以我的问题是"如何在播放当前缓冲视频的同时制作videoView缓冲视频的下一部分.
这是我的代码
public class TvActivity extends Activity {
// Declare variables
ProgressDialog pDialog;
VideoView videoview;
// Insert your Video URL
String VideoURL = "";
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Get the layout from video_main.xml
setContentView(R.layout.videoview_main);
// Find your VideoView in your video_main.xml layout
videoview = (VideoView) findViewById(R.id.VideoView);
// Execute StreamVideo AsyncTask
VideoURL = "http://ns3622101.ip-149-202-201.eu:8000/live/fr443500/75019pa/286.ts";
// Create a progressbar
pDialog = new ProgressDialog(TvActivity.this);
// Set progressbar title
pDialog.setTitle("Video Streaming ");
// Set …Run Code Online (Sandbox Code Playgroud) 我试图让google gauge指针移动,但它没有移动,我设置了动画配置,因为它假设在var选项中设置,例如duration:1000和easing:'inAndOut',我在Google API中是n00b所以为了我的无知尝试.
谁能帮我.这是我正在使用它的教程链接.代码工作但部分工作,仪表指针应该缓慢移动到它的最大值,但是,在我的情况下,它不会工作.这是代码.
<html>
<script type='text/javascript' src='https://www.google.com/jsapi'></script>
<script type='text/javascript'>
google.load('visualization', '1', {packages:['gauge']});
google.setOnLoadCallback(drawChart);
function drawChart() {
var data = google.visualization.arrayToDataTable([
['Label', 'Value'],
['Match',80],
]);
var options = {
width: 440, height: 140,
greenFrom: 70, greenTo: 100,
yellowFrom:50, yellowTo: 70,
redFrom:0, redTo: 50,
minorTicks: 5,
animation:{
duration: 1000,
easing: 'inAndOut',
},
majorTicks : ['0','10','20','30','40','50','60','70','80','90','100']
};
var chart = new google.visualization.Gauge(document.getElementById('chart_div<%=id%>'));
chart.draw(data, options);
clearChart();
}
</script>
</html>
Run Code Online (Sandbox Code Playgroud) 我正在使用Lucene为PDF文档建立索引,我使用Eclipse indigo作为IDE,并且将tomcat7作为servlet容器,问题是当我为文档建立索引并希望保存原始文档以供以后下载时,但是将eclipse放在了临时目录中而不是我选择的目录。
这是我在做什么。
我的web.xml中有此参数
<context-param>
<description>Location to store uploaded file also the location of files to be indexed</description>
<param-name>file-upload</param-name>
<param-value>
folder\
</param-value>
</context-param>
Run Code Online (Sandbox Code Playgroud)
然后像这样在servlet init()方法中调用它
filePath = getServletContext().getRealPath("") + File.separator + getServletContext().getInitParameter("file-upload");
Run Code Online (Sandbox Code Playgroud)
简而言之,我正在尝试将文档存储在项目内名为“搜索”的“文件夹”目录中,但是eclipse会将其存储在这样的临时位置:
C:\Users\Solid\Dropbox\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\Search\folder\ir_overview.pdf
Run Code Online (Sandbox Code Playgroud)
但是实际路径是这样的:
C:\Users\Solid\Dropbox\workspace\Search\WebContent\folder
Run Code Online (Sandbox Code Playgroud)
任何想法如何解决这个问题?
今天是2013-02-25,但为什么这段代码会返回2013-03-25?
String currentDate = new SimpleDateFormat("yyyy MM dd hh mm ss").format(new java.util.Date());
System.out.println("current Date "+currentDate);
StringTokenizer token = new StringTokenizer(currentDate);
Calendar cal = Calendar.getInstance();
cal.set(Integer.parseInt(token.nextToken()),
Integer.parseInt(token.nextToken()),
Integer.parseInt(token.nextToken()),
Integer.parseInt(token.nextToken()),
Integer.parseInt(token.nextToken()),
Integer.parseInt(token.nextToken()));
String calenderDate = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(cal.getTime());
System.out.println("calender date "+calenderDate);
cal.add(Calendar.MONTH, -1); // set to one month ago
String pastDate = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").format(cal.getTime());
System.out.println("past Date "+pastDate);
Run Code Online (Sandbox Code Playgroud)
出去
当前日期2013 02 25 04 56 26
日历日期2013-03-25 04:56:26
过去日期2013-02-25 04:56:26