JAVA

JAVA

jquery ajaxSubmit实现文件上传

rogertong 发表了文章 • 1 个评论 • 126 次浏览 • 2018-05-17 08:43 • 来自相关话题

<script src="js/jquery.form.js"></script>http://plugins.jquery.com/form/
http://malsup.github.io/jquery.form.jsfunction createDialog(o) {
var load = ;
load.push(
'<ul>'
+'<form enctype="multipart/form-data" method="post" id="fileForm" name="fileForm""><ul>'
+ '<li><label>所属法人机构 </label><span><input type="text" name="orgBlon" data-name="orgBlon" value="' + o.orgBlon + '" ' + o.disabled + '/></span></li>'
+ '<li><label>申请柜员号 </label><span><input type="text" name="appUser" data-name="appUser" value="' + o.appUser + '" ' + o.disabled + '/></span></li>'
+ '<li><label>实际申请人 </label><span><input type="text" name="operUser" data-name="operUser" value="' + o.operUser + '" ' + o.disabled + '/></span></li>'
+ '<li><label>申请编号 </label><span><input type="text" name="appId" data-name="appId" value="' + o.appId + '" ' + o.disabled + '/></span></li>'
+ '<li><label>用印识别码 </label><span><input type="text" name="verCod" data-name="verCod" value="' + o.verCod + '" ' + o.disabled + '/></span></li>'
+ '<li><label>标题 </label><span><input type="text" name="appTitle" data-name="appTitle" value="' + o.appTitle + '" ' + o.disabled + '/></span></li>'
+ '<li><label>印章类型id </label><span><input type="text" name="sealTypeid" data-name="sealTypeid" value="' + o.sealTypeid + '" ' + o.disabled + '/></span></li>'
+ '<li class="max"><label>文件上传</label><span><input type="file" name="myfiles" data-name="myfiles" value="' + o.myfiles + '" /></span></li>'
+ '<li><label>文件类型 </label><span><input type="text" name="fileType" data-name="fileType" value="' + o.fileType + '" ' + o.disabled + '/></span></li>'
+ '<li><label>电子文档格式 </label><span><input type="text" name="efileForm" data-name="efileForm" value="' + o.efileForm + '" ' + o.disabled + '/></span></li>'
+ '<li><label>文件名称 </label><span><input type="text" name="fileName" data-name="fileName" value="' + o.fileName + '" ' + o.disabled + '/></span></li>'
+ '<li><label>页数 </label><span><input type="text" name="pagNum" data-name="pagNum" value="' + o.pagNum + '" ' + o.disabled + '/></span></li>'
+ '<li><label>盖章页 </label><span><input type="text" name="sealPage" data-name="sealPage" value="' + o.sealPage + '" ' + o.disabled + '/></span></li>'
+ '<li><label>用章次数 </label><span><input type="text" name="useSealNum" data-name="useSealNum" value="' + o.useSealNum + '" ' + o.disabled + '/></span></li>'
+ '<li><label>摘要 </label><span><input type="text" name="appComment" data-name="appComment" value="' + o.appComment + '" ' + o.disabled + '/></span></li>'
+ '<li><label>凭证ID </label><span><input type="text" name="chnId" data-name="chnId" value="' + o.chnId + '" ' + o.disabled + '/></span></li>'
+ '<li><label>付款人账号 </label><span><input type="text" name="payAcc" data-name="payAcc" value="' + o.payAcc + '" ' + o.disabled + '/></span></li>'
+ '<li><label>凭证种类 </label><span><input type="text" name="chnTpye" data-name="chnTpye" value="' + o.chnTpye + '" ' + o.disabled + '/></span></li>'
+ '<li><label>凭证号 </label><span><input type="text" name="chnCode" data-name="chnCode" value="' + o.chnCode + '" ' + o.disabled + '/></span></li>'
+ '<li><label>金额 </label><span><input type="text" name="chnMoney" data-name="chnMoney" value="' + o.chnMoney + '" ' + o.disabled + '/></span></li>'
+ '<li><label>凭证种类 </label><span><input type="text" name="chnTpye" data-name="chnTpye" value="' + o.chnTpye + '" ' + o.disabled + '/></span></li>'
+ '<li><label>凭证日期</label><span><input type="text" name="chnDate" data-name="chnDate" value="' + o.chnDate + '" ' + o.disabled + '/></span></li>'
+ '<li class="sumbit"><button type="button" class="btn btn-warning">保存</button><button type="button" class="btn btn-reset close">取消</button></li>'
+ '</ul></form>'
);
$.tooltip({className: "sysUser", title: o.title, content: load.join('')});

var _obj = $(".sysUser"), _control = $(":input", _obj), _button = $("button:first", _obj);
// $.select(api.user.select, _control.eq(3),o.rolCode);
_button.on("click", function () {
var form = $("form[name=fileForm]");
var options = {
type:'post',
url:'http://localhost:8080/1/base/addBusSealInfo',
success:function(data){
alert('Success loading XML document');
},
error:function(data){
alert('Error loading XML document');
}
};

form.ajaxSubmit(options);
//$("#fileForm").submit();
});
}


@RequestMapping(value = "/addBusSealInfo", produces = "text/javascript;charset=utf-8", method = RequestMethod.POST)
@ResponseBody
@ResponseStatus(code=HttpStatus.OK,reason="success")
public Map<String, Object> addBusSealInfo(
BusSealInfoDto busSealInfoDto,@RequestParam("myfiles") MultipartFile files) throws Exception {
pSealBusInfoService.addBusSealInfo(busSealInfoDto,files);

Thread.currentThread().sleep(1000);//毫秒

HashMap<String, Object> map = new HashMap<String, Object>();
map.put(message, "");
return map;
}









form提交数据的同时还可以通过data传字符串数据 ..........

$.tooltip({className: "sysUser", title: o.title, content: load.join('')});

var _obj = $(".sysUser"), _control = $(":input", _obj), _button = $("button:first", _obj);
// $.select(api.user.select, _control.eq(3),o.rolCode);
// 选择图片修改page信息,
$("body").on('change','#upImgs', function (e) {
upFile.mUpload(e,'#upimgs');
});

_button.on("click", function () {
var form = $("form[name=fileForm]");
var _parms = $.paramsCollection(_obj);
//图片页码信息
_parms.fileInfo = upFile.toSize('#upimgs');
console.log(_parms);
var options = {
type:'post',
url:'http://localhost:8080/1/base/addBusSealInfo',
data:{"a1":JSON.stringify(_parms)},
success:function(data){
$.tooltip({result: data.message, content: data.message});
viewDataTable();
// alert('Success loading XML document');
},
error:function(data){
alert('Error loading XML document');
}
};

form.ajaxSubmit(options);
//$("#fileForm").submit();
});


var upFile = {
mUpload: function(e,dm){
var m_file = e.target.files;
$(dm).find('.img-item').remove();
var li='';
for(var i=0;i<m_file.length;i++){
var z = m_file[i];
var reader = new FileReader();
reader.readAsDataURL(z);
// console.log(z.name);
reader.onloadend = (function(i){
return function(){
console.log();
console.log(i);
li = '<p class="img-item"><i>'+ i.name +'</i><em><input type="text" placeholder="">页</em></p>';
$(dm).append(li);
};
})(z);
};
},
toSize: function (e) {
var imgdata = ;
$(e+ ' .img-item').each(function () {
var _this = $(this);
var page = _this.find('input').val();
var name = _this.find('i').text();
imgdata.push({
'fileName': name,
'sealPage': page
});
});
return imgdata;
}
};[/i]














  查看全部
Screenshot-51.png
<script src="js/jquery.form.js"></script>
http://plugins.jquery.com/form/
http://malsup.github.io/jquery.form.js
function createDialog(o) {
var load = ;
load.push(
'<ul>'
+'<form enctype="multipart/form-data" method="post" id="fileForm" name="fileForm""><ul>'
+ '<li><label>所属法人机构 </label><span><input type="text" name="orgBlon" data-name="orgBlon" value="' + o.orgBlon + '" ' + o.disabled + '/></span></li>'
+ '<li><label>申请柜员号 </label><span><input type="text" name="appUser" data-name="appUser" value="' + o.appUser + '" ' + o.disabled + '/></span></li>'
+ '<li><label>实际申请人 </label><span><input type="text" name="operUser" data-name="operUser" value="' + o.operUser + '" ' + o.disabled + '/></span></li>'
+ '<li><label>申请编号 </label><span><input type="text" name="appId" data-name="appId" value="' + o.appId + '" ' + o.disabled + '/></span></li>'
+ '<li><label>用印识别码 </label><span><input type="text" name="verCod" data-name="verCod" value="' + o.verCod + '" ' + o.disabled + '/></span></li>'
+ '<li><label>标题 </label><span><input type="text" name="appTitle" data-name="appTitle" value="' + o.appTitle + '" ' + o.disabled + '/></span></li>'
+ '<li><label>印章类型id </label><span><input type="text" name="sealTypeid" data-name="sealTypeid" value="' + o.sealTypeid + '" ' + o.disabled + '/></span></li>'
+ '<li class="max"><label>文件上传</label><span><input type="file" name="myfiles" data-name="myfiles" value="' + o.myfiles + '" /></span></li>'
+ '<li><label>文件类型 </label><span><input type="text" name="fileType" data-name="fileType" value="' + o.fileType + '" ' + o.disabled + '/></span></li>'
+ '<li><label>电子文档格式 </label><span><input type="text" name="efileForm" data-name="efileForm" value="' + o.efileForm + '" ' + o.disabled + '/></span></li>'
+ '<li><label>文件名称 </label><span><input type="text" name="fileName" data-name="fileName" value="' + o.fileName + '" ' + o.disabled + '/></span></li>'
+ '<li><label>页数 </label><span><input type="text" name="pagNum" data-name="pagNum" value="' + o.pagNum + '" ' + o.disabled + '/></span></li>'
+ '<li><label>盖章页 </label><span><input type="text" name="sealPage" data-name="sealPage" value="' + o.sealPage + '" ' + o.disabled + '/></span></li>'
+ '<li><label>用章次数 </label><span><input type="text" name="useSealNum" data-name="useSealNum" value="' + o.useSealNum + '" ' + o.disabled + '/></span></li>'
+ '<li><label>摘要 </label><span><input type="text" name="appComment" data-name="appComment" value="' + o.appComment + '" ' + o.disabled + '/></span></li>'
+ '<li><label>凭证ID </label><span><input type="text" name="chnId" data-name="chnId" value="' + o.chnId + '" ' + o.disabled + '/></span></li>'
+ '<li><label>付款人账号 </label><span><input type="text" name="payAcc" data-name="payAcc" value="' + o.payAcc + '" ' + o.disabled + '/></span></li>'
+ '<li><label>凭证种类 </label><span><input type="text" name="chnTpye" data-name="chnTpye" value="' + o.chnTpye + '" ' + o.disabled + '/></span></li>'
+ '<li><label>凭证号 </label><span><input type="text" name="chnCode" data-name="chnCode" value="' + o.chnCode + '" ' + o.disabled + '/></span></li>'
+ '<li><label>金额 </label><span><input type="text" name="chnMoney" data-name="chnMoney" value="' + o.chnMoney + '" ' + o.disabled + '/></span></li>'
+ '<li><label>凭证种类 </label><span><input type="text" name="chnTpye" data-name="chnTpye" value="' + o.chnTpye + '" ' + o.disabled + '/></span></li>'
+ '<li><label>凭证日期</label><span><input type="text" name="chnDate" data-name="chnDate" value="' + o.chnDate + '" ' + o.disabled + '/></span></li>'
+ '<li class="sumbit"><button type="button" class="btn btn-warning">保存</button><button type="button" class="btn btn-reset close">取消</button></li>'
+ '</ul></form>'
);
$.tooltip({className: "sysUser", title: o.title, content: load.join('')});

var _obj = $(".sysUser"), _control = $(":input", _obj), _button = $("button:first", _obj);
// $.select(api.user.select, _control.eq(3),o.rolCode);
_button.on("click", function () {
var form = $("form[name=fileForm]");
var options = {
type:'post',
url:'http://localhost:8080/1/base/addBusSealInfo',
success:function(data){
alert('Success loading XML document');
},
error:function(data){
alert('Error loading XML document');
}
};

form.ajaxSubmit(options);
//$("#fileForm").submit();
});
}
Screenshot-52.png
@RequestMapping(value = "/addBusSealInfo", produces = "text/javascript;charset=utf-8", method = RequestMethod.POST)
@ResponseBody
@ResponseStatus(code=HttpStatus.OK,reason="success")
public Map<String, Object> addBusSealInfo(
BusSealInfoDto busSealInfoDto,@RequestParam("myfiles") MultipartFile files) throws Exception {
pSealBusInfoService.addBusSealInfo(busSealInfoDto,files);

Thread.currentThread().sleep(1000);//毫秒

HashMap<String, Object> map = new HashMap<String, Object>();
map.put(message, "");
return map;
}
Screenshot-1.png


6117c743539244c4a8b8ee8713aaf624.gif


form提交数据的同时还可以通过data传字符串数据
 ..........         

$.tooltip({className: "sysUser", title: o.title, content: load.join('')});

var _obj = $(".sysUser"), _control = $(":input", _obj), _button = $("button:first", _obj);
// $.select(api.user.select, _control.eq(3),o.rolCode);
// 选择图片修改page信息,
$("body").on('change','#upImgs', function (e) {
upFile.mUpload(e,'#upimgs');
});

_button.on("click", function () {
var form = $("form[name=fileForm]");
var _parms = $.paramsCollection(_obj);
//图片页码信息
_parms.fileInfo = upFile.toSize('#upimgs');
console.log(_parms);
var options = {
type:'post',
url:'http://localhost:8080/1/base/addBusSealInfo',
data:{"a1":JSON.stringify(_parms)},
success:function(data){
$.tooltip({result: data.message, content: data.message});
viewDataTable();
// alert('Success loading XML document');
},
error:function(data){
alert('Error loading XML document');
}
};

form.ajaxSubmit(options);
//$("#fileForm").submit();
});
Screenshot-5.png
var upFile = {
mUpload: function(e,dm){
var m_file = e.target.files;
$(dm).find('.img-item').remove();
var li='';
for(var i=0;i<m_file.length;i++){
var z = m_file[i];
var reader = new FileReader();
reader.readAsDataURL(z);
// console.log(z.name);
reader.onloadend = (function(i){
return function(){
console.log();
console.log(i);
li = '<p class="img-item"><i>'+ i.name +'</i><em><input type="text" placeholder="">页</em></p>';
$(dm).append(li);
};
})(z);
};
},
toSize: function (e) {
var imgdata = ;
$(e+ ' .img-item').each(function () {
var _this = $(this);
var page = _this.find('input').val();
var name = _this.find('i').text();
imgdata.push({
'fileName': name,
'sealPage': page
});
});
return imgdata;
}
};[/i]

Screenshot-6.png


Screenshot-3.png


Screenshot-2.png

 

报告一个Java VM运行异常

rogertong 发表了文章 • 7 个评论 • 225 次浏览 • 2018-05-04 12:13 • 来自相关话题

/usr/tomcat/apache-tomcat-7.0.81/bin/catalina.sh run
Using CATALINA_BASE:   /root/.IntelliJIdea2017.2/system/tomcat/Unnamed_pSeal
Using CATALINA_HOME:   /usr/tomcat/apache-tomcat-7.0.81
Using CATALINA_TMPDIR: /usr/tomcat/apache-tomcat-7.0.81/temp
Using JRE_HOME:        /usr/lib/jvm/java-1.8.0-openjdk
Using CLASSPATH:       /usr/tomcat/apache-tomcat-7.0.81/bin/bootstrap.jar:/usr/tomcat/apache-tomcat-7.0.81/bin/tomcat-juli.jar
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x000000fff4004000, pid=4565, tid=1099316752880
#
# JRE version: OpenJDK Runtime Environment (8.0_60-b32) (build 1.8.0_60-rc27-b32)
# Java VM: OpenJDK 64-Bit Server VM (25.60-b24 mixed mode linux-mips64 compressed oops)
# Problematic frame:
# C  0x000000fff4004000
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /usr/tomcat/apache-tomcat-7.0.81/bin/hs_err_pid4565.log
Could not load hsdis-mips64.so; library not loadable; PrintAssembly is disabled
Compiled method (c2)     306    2             java.lang.String::equals (81 bytes)
 total in heap  [0x000000000024a050,0x000000000024a938] = 2280
 relocation     [0x000000000024a170,0x000000000024a190] = 32
 main code      [0x000000000024a190,0x000000000024a720] = 1424
 stub code      [0x000000000024a720,0x000000000024a760] = 64
 metadata       [0x000000000024a760,0x000000000024a770] = 16
 scopes data    [0x000000000024a770,0x000000000024a860] = 240
 scopes pcs     [0x000000000024a860,0x000000000024a910] = 176
 dependencies   [0x000000000024a910,0x000000000024a918] = 8
 nul chk table  [0x000000000024a918,0x000000000024a938] = 32
Compiled method (c2)     306    2             java.lang.String::equals (81 bytes)
 total in heap  [0x000000000024a050,0x000000000024a938] = 2280
 relocation     [0x000000000024a170,0x000000000024a190] = 32
 main code      [0x000000000024a190,0x000000000024a720] = 1424
 stub code      [0x000000000024a720,0x000000000024a760] = 64
 metadata       [0x000000000024a760,0x000000000024a770] = 16
 scopes data    [0x000000000024a770,0x000000000024a860] = 240
 scopes pcs     [0x000000000024a860,0x000000000024a910] = 176
 dependencies   [0x000000000024a910,0x000000000024a918] = 8
 nul chk table  [0x000000000024a918,0x000000000024a938] = 32
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#
Disconnected from server





  查看全部
/usr/tomcat/apache-tomcat-7.0.81/bin/catalina.sh run
Using CATALINA_BASE:   /root/.IntelliJIdea2017.2/system/tomcat/Unnamed_pSeal
Using CATALINA_HOME:   /usr/tomcat/apache-tomcat-7.0.81
Using CATALINA_TMPDIR: /usr/tomcat/apache-tomcat-7.0.81/temp
Using JRE_HOME:        /usr/lib/jvm/java-1.8.0-openjdk
Using CLASSPATH:       /usr/tomcat/apache-tomcat-7.0.81/bin/bootstrap.jar:/usr/tomcat/apache-tomcat-7.0.81/bin/tomcat-juli.jar
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x000000fff4004000, pid=4565, tid=1099316752880
#
# JRE version: OpenJDK Runtime Environment (8.0_60-b32) (build 1.8.0_60-rc27-b32)
# Java VM: OpenJDK 64-Bit Server VM (25.60-b24 mixed mode linux-mips64 compressed oops)
# Problematic frame:
# C  0x000000fff4004000
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /usr/tomcat/apache-tomcat-7.0.81/bin/hs_err_pid4565.log
Could not load hsdis-mips64.so; library not loadable; PrintAssembly is disabled
Compiled method (c2)     306    2             java.lang.String::equals (81 bytes)
 total in heap  [0x000000000024a050,0x000000000024a938] = 2280
 relocation     [0x000000000024a170,0x000000000024a190] = 32
 main code      [0x000000000024a190,0x000000000024a720] = 1424
 stub code      [0x000000000024a720,0x000000000024a760] = 64
 metadata       [0x000000000024a760,0x000000000024a770] = 16
 scopes data    [0x000000000024a770,0x000000000024a860] = 240
 scopes pcs     [0x000000000024a860,0x000000000024a910] = 176
 dependencies   [0x000000000024a910,0x000000000024a918] = 8
 nul chk table  [0x000000000024a918,0x000000000024a938] = 32
Compiled method (c2)     306    2             java.lang.String::equals (81 bytes)
 total in heap  [0x000000000024a050,0x000000000024a938] = 2280
 relocation     [0x000000000024a170,0x000000000024a190] = 32
 main code      [0x000000000024a190,0x000000000024a720] = 1424
 stub code      [0x000000000024a720,0x000000000024a760] = 64
 metadata       [0x000000000024a760,0x000000000024a770] = 16
 scopes data    [0x000000000024a770,0x000000000024a860] = 240
 scopes pcs     [0x000000000024a860,0x000000000024a910] = 176
 dependencies   [0x000000000024a910,0x000000000024a918] = 8
 nul chk table  [0x000000000024a918,0x000000000024a938] = 32
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#
Disconnected from server

Screenshot-26.png

 

龙芯以后的开发语言会是什么?

admin 回复了问题 • 2 人关注 • 1 个回复 • 234 次浏览 • 2018-05-02 15:56 • 来自相关话题

IDEA Debug中

rogertong 发表了文章 • 0 个评论 • 120 次浏览 • 2018-04-28 13:43 • 来自相关话题

在loongnix龙芯电脑上开发的第一个web项目接近尾声了,遇到的问题基本都能克服,SVN DB2都用上了





 
在loongnix龙芯电脑上开发的第一个web项目接近尾声了,遇到的问题基本都能克服,SVN DB2都用上了

Screenshot-25.png

 

设置MySQL最大连接数

rogertong 发表了文章 • 0 个评论 • 111 次浏览 • 2018-04-16 11:46 • 来自相关话题

https://jingyan.baidu.com/arti ... .html

MySQL实现序列(Sequence)并在Mybatis里使用

rogertong 发表了文章 • 0 个评论 • 106 次浏览 • 2018-04-16 11:24 • 来自相关话题

https://blog.csdn.net/sinat_19 ... 69789

Firefox上使用Web接口测试工具Poster

rogertong 发表了文章 • 0 个评论 • 108 次浏览 • 2018-04-13 17:42 • 来自相关话题

https://www.cnblogs.com/fnng/p/5797121.html?utm_source=tuicool&utm_medium=referral

Firefox使用Poster插件发送post请求 
https://www.cnblogs.com/xxyfhjl/p/4074186.html
  查看全部

Java识别简单的数字验证码

rogertong 发表了文章 • 0 个评论 • 131 次浏览 • 2018-03-22 11:07 • 来自相关话题

package util; import java.awt.Graphics; import java.awt.Image; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.File; import java.io.InputStream; import javax.imageio.ImageIO; import javax.media.jai.JAI; import javax.media.jai.RenderedOp; /** * 数字验证码识别器(用于识别xxx系统的图片验证码) * <p> * 算法如下: 分析验证码图片结构,将其分隔成4个独立的数字图片,把四个独立的数字图片处理成单色位图。 * 把单色位图转换为0、1数组,然后分别和0-9的字模进行匹配,得到图片上的数字信息。 * * @author huangyuanmu * @version 1.0 2009-7-7 * @since JDK 1.5.0_8 */ public class NumberVerificationCodeIdentifier { static { System.setProperty("com.sun.media.jai.disableMediaLib", "true"); } // 数字模板 0-9 static int value = { // num 0; {0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0}, // num 1 {0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0}, // num2 {0, 0, 1, 1, 1, 1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, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0}}; /** * 识别图像 * * * @param byteArray * @return * @throws Exception * @author huangyuanmu 2009-7-14 */ public static String recognize(byte byteArray) throws Exception { InputStream is = new ByteArrayInputStream(byteArray); BufferedImage image = ImageIO.read(is); return recognize(image); } /** * 识别图像 * * @author huangyuanmu 2009-7-14 * @param image * @return * @throws Exception */ public static String recognize(BufferedImage image) throws Exception { StringBuffer sb = new StringBuffer(""); BufferedImage newim = new BufferedImage[4]; if (null == image) { throw new RuntimeException("iamage为null"); } // 将图像分成四块,因为要处理的文件有四个数字。 newim[0] = generateSingleColorBitMap(image.getSubimage(2, 1, 8, 11)); newim[1] = generateSingleColorBitMap(image.getSubimage(11, 1, 8, 11)); newim[2] = generateSingleColorBitMap(image.getSubimage(20, 1, 8, 11)); newim[3] = generateSingleColorBitMap(image.getSubimage(29, 1, 8, 11)); for (int k = 0; k < 4; k++) { int iw = newim[k].getWidth(null); int ih = newim[k].getHeight(null); int pix = new int[iw * ih]; // 因为是二值图像,这里的方法将像素读取出来的同时,转换为0,1的图像数组。 for (int i = 0; i < ih; i++) { for (int j = 0; j < iw; j++) { pix[i * (iw) + j] = newim[k].getRGB(j, i); if (pix[i * (iw) + j] == -1) pix[i * (iw) + j] = 0; else pix[i * (iw) + j] = 1; } } // 得到像匹配的数字。 int r = getMatchNum(pix); sb.append(r); } return sb.toString(); } /** * 把单色位图转换成的0、1数组和字模数组进行比较,返回匹配的数字 * * @author huangyuanmu 2009-7-7 * @param pix * @return */ private static int getMatchNum(int pix) { int result = -1; int temp = 100; int x; for (int k = 0; k <= 9; k++) { x = 0; for (int i = 0; i < pix.length; i++) { x = x + Math.abs(pix - value[k][i]); } if (x == 0) { result = k; break; } else if (x < temp) { temp = x; result = k; } } return result; } /** * 把彩色图像转换单色图像 * * @author huangyuanmu 2009-7-7 * @param colorImage * @return */ private static BufferedImage generateSingleColorBitMap(Image colorImage) { BufferedImage image = new BufferedImage(8, 11, BufferedImage.TYPE_BYTE_GRAY); Graphics g = image.getGraphics(); g.drawImage(colorImage, 0, 0, null); g.dispose(); RenderedOp ro = JAI.create("binarize", image, new Double(100)); BufferedImage bi = ro.getAsBufferedImage(); return bi; } /** * 测试 * * @author huangyuanmu 2009-7-7 * @param args */ public static void main(String args) throws Exception { String s = recognize(ImageIO.read(new File("/root/IdeaProjects/java_pdf_demo/src/main/resources/9335.jpg"))); System.out.println("识别结果 " + s); } }[/i]
  查看全部
Screenshot-39.png


Screenshot-40.png


package util; import java.awt.Graphics; import java.awt.Image; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.File; import java.io.InputStream; import javax.imageio.ImageIO; import javax.media.jai.JAI; import javax.media.jai.RenderedOp; /** * 数字验证码识别器(用于识别xxx系统的图片验证码) * <p> * 算法如下: 分析验证码图片结构,将其分隔成4个独立的数字图片,把四个独立的数字图片处理成单色位图。 * 把单色位图转换为0、1数组,然后分别和0-9的字模进行匹配,得到图片上的数字信息。 * * @author huangyuanmu * @version 1.0 2009-7-7 * @since JDK 1.5.0_8 */ public class NumberVerificationCodeIdentifier { static { System.setProperty("com.sun.media.jai.disableMediaLib", "true"); } // 数字模板 0-9 static int value = { // num 0; {0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0}, // num 1 {0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0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, 1, 1, 0}, // num9 {0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0}}; /** * 识别图像 * * * @param byteArray * @return * @throws Exception * @author huangyuanmu 2009-7-14 */ public static String recognize(byte byteArray) throws Exception { InputStream is = new ByteArrayInputStream(byteArray); BufferedImage image = ImageIO.read(is); return recognize(image); } /** * 识别图像 * * @author huangyuanmu 2009-7-14 * @param image * @return * @throws Exception */ public static String recognize(BufferedImage image) throws Exception { StringBuffer sb = new StringBuffer(""); BufferedImage newim = new BufferedImage[4]; if (null == image) { throw new RuntimeException("iamage为null"); } // 将图像分成四块,因为要处理的文件有四个数字。 newim[0] = generateSingleColorBitMap(image.getSubimage(2, 1, 8, 11)); newim[1] = generateSingleColorBitMap(image.getSubimage(11, 1, 8, 11)); newim[2] = generateSingleColorBitMap(image.getSubimage(20, 1, 8, 11)); newim[3] = generateSingleColorBitMap(image.getSubimage(29, 1, 8, 11)); for (int k = 0; k < 4; k++) { int iw = newim[k].getWidth(null); int ih = newim[k].getHeight(null); int pix = new int[iw * ih]; // 因为是二值图像,这里的方法将像素读取出来的同时,转换为0,1的图像数组。 for (int i = 0; i < ih; i++) { for (int j = 0; j < iw; j++) { pix[i * (iw) + j] = newim[k].getRGB(j, i); if (pix[i * (iw) + j] == -1) pix[i * (iw) + j] = 0; else pix[i * (iw) + j] = 1; } } // 得到像匹配的数字。 int r = getMatchNum(pix); sb.append(r); } return sb.toString(); } /** * 把单色位图转换成的0、1数组和字模数组进行比较,返回匹配的数字 * * @author huangyuanmu 2009-7-7 * @param pix * @return */ private static int getMatchNum(int pix) { int result = -1; int temp = 100; int x; for (int k = 0; k <= 9; k++) { x = 0; for (int i = 0; i < pix.length; i++) { x = x + Math.abs(pix - value[k][i]); } if (x == 0) { result = k; break; } else if (x < temp) { temp = x; result = k; } } return result; } /** * 把彩色图像转换单色图像 * * @author huangyuanmu 2009-7-7 * @param colorImage * @return */ private static BufferedImage generateSingleColorBitMap(Image colorImage) { BufferedImage image = new BufferedImage(8, 11, BufferedImage.TYPE_BYTE_GRAY); Graphics g = image.getGraphics(); g.drawImage(colorImage, 0, 0, null); g.dispose(); RenderedOp ro = JAI.create("binarize", image, new Double(100)); BufferedImage bi = ro.getAsBufferedImage(); return bi; } /** * 测试 * * @author huangyuanmu 2009-7-7 * @param args */ public static void main(String args) throws Exception { String s = recognize(ImageIO.read(new File("/root/IdeaProjects/java_pdf_demo/src/main/resources/9335.jpg"))); System.out.println("识别结果 " + s); } }[/i]
 

官方的 openjdk 1.8 怎么实现支持 mips64el ?

aoqi 回复了问题 • 2 人关注 • 1 个回复 • 327 次浏览 • 2018-03-12 14:46 • 来自相关话题

为什么在openJDK的官网上只有port:mips,而没有port:loongson呢

aoqi 回复了问题 • 4 人关注 • 4 个回复 • 340 次浏览 • 2018-03-12 14:24 • 来自相关话题

条新动态, 点击查看
loongnix

loongnix 回答了问题 • 2017-02-14 14:50 • 5 个回复 不感兴趣

Fedora21上Java程序JFrame的toFront()方法无效?

赞同来自:

附:marco软件包的升级过程,供开发者参考

下载:
https://mirrors.aliyun.com/fedora/releases/22/Everything/source/SRPMS/m/marco-1.10.0-2.fc22.src.rpm
... 显示全部 »
附:marco软件包的升级过程,供开发者参考

下载:
https://mirrors.aliyun.com/fedora/releases/22/Everything/source/SRPMS/m/marco-1.10.0-2.fc22.src.rpm

编译: $ rpm -hvi marco-1.10.0-2.fc22.src.rpm
$ cd ~/rpmbuild/SPECS

以管理员身份运行:
# yum build-dep marco

以普通用户身份运行:
$ rpmbuild -ba marco.spec

以管理员身份运行:
# cd ../RPMS/mips64el
# yum install marco-1.10.0-2.fc21.loongson.mips64el.rpm 测试:
重启机器,重新登录,再运行示例java程序,一切正常。

龙芯以后的开发语言会是什么?

回复

admin 回复了问题 • 2 人关注 • 1 个回复 • 234 次浏览 • 2018-05-02 15:56 • 来自相关话题

官方的 openjdk 1.8 怎么实现支持 mips64el ?

回复

aoqi 回复了问题 • 2 人关注 • 1 个回复 • 327 次浏览 • 2018-03-12 14:46 • 来自相关话题

为什么在openJDK的官网上只有port:mips,而没有port:loongson呢

回复

aoqi 回复了问题 • 4 人关注 • 4 个回复 • 340 次浏览 • 2018-03-12 14:24 • 来自相关话题

编译java-1.8.0-openjdk,龙芯的新版本 SRPM 。结果失败……

回复

aoqi 回复了问题 • 3 人关注 • 2 个回复 • 409 次浏览 • 2018-03-12 13:58 • 来自相关话题

e674a0c272aec81c388192c1e0c1732e

回复

mips64el 回复了问题 • 2 人关注 • 1 个回复 • 118 次浏览 • 2018-03-01 22:48 • 来自相关话题

纯java的开发工具还是太慢

回复

wlxn 回复了问题 • 2 人关注 • 1 个回复 • 259 次浏览 • 2017-09-29 13:17 • 来自相关话题

Fedora21上Java程序JFrame的toFront()方法无效?

回复

loongnix 回复了问题 • 2 人关注 • 5 个回复 • 524 次浏览 • 2017-02-20 13:25 • 来自相关话题

关于龙芯扩展指令gsorn/gsandn的请教

回复

Fool 发起了问题 • 1 人关注 • 0 个回复 • 281 次浏览 • 2017-02-17 15:36 • 来自相关话题

jquery ajaxSubmit实现文件上传

rogertong 发表了文章 • 1 个评论 • 126 次浏览 • 2018-05-17 08:43 • 来自相关话题

<script src="js/jquery.form.js"></script>http://plugins.jquery.com/form/
http://malsup.github.io/jquery.form.jsfunction createDialog(o) {
var load = ;
load.push(
'<ul>'
+'<form enctype="multipart/form-data" method="post" id="fileForm" name="fileForm""><ul>'
+ '<li><label>所属法人机构 </label><span><input type="text" name="orgBlon" data-name="orgBlon" value="' + o.orgBlon + '" ' + o.disabled + '/></span></li>'
+ '<li><label>申请柜员号 </label><span><input type="text" name="appUser" data-name="appUser" value="' + o.appUser + '" ' + o.disabled + '/></span></li>'
+ '<li><label>实际申请人 </label><span><input type="text" name="operUser" data-name="operUser" value="' + o.operUser + '" ' + o.disabled + '/></span></li>'
+ '<li><label>申请编号 </label><span><input type="text" name="appId" data-name="appId" value="' + o.appId + '" ' + o.disabled + '/></span></li>'
+ '<li><label>用印识别码 </label><span><input type="text" name="verCod" data-name="verCod" value="' + o.verCod + '" ' + o.disabled + '/></span></li>'
+ '<li><label>标题 </label><span><input type="text" name="appTitle" data-name="appTitle" value="' + o.appTitle + '" ' + o.disabled + '/></span></li>'
+ '<li><label>印章类型id </label><span><input type="text" name="sealTypeid" data-name="sealTypeid" value="' + o.sealTypeid + '" ' + o.disabled + '/></span></li>'
+ '<li class="max"><label>文件上传</label><span><input type="file" name="myfiles" data-name="myfiles" value="' + o.myfiles + '" /></span></li>'
+ '<li><label>文件类型 </label><span><input type="text" name="fileType" data-name="fileType" value="' + o.fileType + '" ' + o.disabled + '/></span></li>'
+ '<li><label>电子文档格式 </label><span><input type="text" name="efileForm" data-name="efileForm" value="' + o.efileForm + '" ' + o.disabled + '/></span></li>'
+ '<li><label>文件名称 </label><span><input type="text" name="fileName" data-name="fileName" value="' + o.fileName + '" ' + o.disabled + '/></span></li>'
+ '<li><label>页数 </label><span><input type="text" name="pagNum" data-name="pagNum" value="' + o.pagNum + '" ' + o.disabled + '/></span></li>'
+ '<li><label>盖章页 </label><span><input type="text" name="sealPage" data-name="sealPage" value="' + o.sealPage + '" ' + o.disabled + '/></span></li>'
+ '<li><label>用章次数 </label><span><input type="text" name="useSealNum" data-name="useSealNum" value="' + o.useSealNum + '" ' + o.disabled + '/></span></li>'
+ '<li><label>摘要 </label><span><input type="text" name="appComment" data-name="appComment" value="' + o.appComment + '" ' + o.disabled + '/></span></li>'
+ '<li><label>凭证ID </label><span><input type="text" name="chnId" data-name="chnId" value="' + o.chnId + '" ' + o.disabled + '/></span></li>'
+ '<li><label>付款人账号 </label><span><input type="text" name="payAcc" data-name="payAcc" value="' + o.payAcc + '" ' + o.disabled + '/></span></li>'
+ '<li><label>凭证种类 </label><span><input type="text" name="chnTpye" data-name="chnTpye" value="' + o.chnTpye + '" ' + o.disabled + '/></span></li>'
+ '<li><label>凭证号 </label><span><input type="text" name="chnCode" data-name="chnCode" value="' + o.chnCode + '" ' + o.disabled + '/></span></li>'
+ '<li><label>金额 </label><span><input type="text" name="chnMoney" data-name="chnMoney" value="' + o.chnMoney + '" ' + o.disabled + '/></span></li>'
+ '<li><label>凭证种类 </label><span><input type="text" name="chnTpye" data-name="chnTpye" value="' + o.chnTpye + '" ' + o.disabled + '/></span></li>'
+ '<li><label>凭证日期</label><span><input type="text" name="chnDate" data-name="chnDate" value="' + o.chnDate + '" ' + o.disabled + '/></span></li>'
+ '<li class="sumbit"><button type="button" class="btn btn-warning">保存</button><button type="button" class="btn btn-reset close">取消</button></li>'
+ '</ul></form>'
);
$.tooltip({className: "sysUser", title: o.title, content: load.join('')});

var _obj = $(".sysUser"), _control = $(":input", _obj), _button = $("button:first", _obj);
// $.select(api.user.select, _control.eq(3),o.rolCode);
_button.on("click", function () {
var form = $("form[name=fileForm]");
var options = {
type:'post',
url:'http://localhost:8080/1/base/addBusSealInfo',
success:function(data){
alert('Success loading XML document');
},
error:function(data){
alert('Error loading XML document');
}
};

form.ajaxSubmit(options);
//$("#fileForm").submit();
});
}


@RequestMapping(value = "/addBusSealInfo", produces = "text/javascript;charset=utf-8", method = RequestMethod.POST)
@ResponseBody
@ResponseStatus(code=HttpStatus.OK,reason="success")
public Map<String, Object> addBusSealInfo(
BusSealInfoDto busSealInfoDto,@RequestParam("myfiles") MultipartFile files) throws Exception {
pSealBusInfoService.addBusSealInfo(busSealInfoDto,files);

Thread.currentThread().sleep(1000);//毫秒

HashMap<String, Object> map = new HashMap<String, Object>();
map.put(message, "");
return map;
}









form提交数据的同时还可以通过data传字符串数据 ..........

$.tooltip({className: "sysUser", title: o.title, content: load.join('')});

var _obj = $(".sysUser"), _control = $(":input", _obj), _button = $("button:first", _obj);
// $.select(api.user.select, _control.eq(3),o.rolCode);
// 选择图片修改page信息,
$("body").on('change','#upImgs', function (e) {
upFile.mUpload(e,'#upimgs');
});

_button.on("click", function () {
var form = $("form[name=fileForm]");
var _parms = $.paramsCollection(_obj);
//图片页码信息
_parms.fileInfo = upFile.toSize('#upimgs');
console.log(_parms);
var options = {
type:'post',
url:'http://localhost:8080/1/base/addBusSealInfo',
data:{"a1":JSON.stringify(_parms)},
success:function(data){
$.tooltip({result: data.message, content: data.message});
viewDataTable();
// alert('Success loading XML document');
},
error:function(data){
alert('Error loading XML document');
}
};

form.ajaxSubmit(options);
//$("#fileForm").submit();
});


var upFile = {
mUpload: function(e,dm){
var m_file = e.target.files;
$(dm).find('.img-item').remove();
var li='';
for(var i=0;i<m_file.length;i++){
var z = m_file[i];
var reader = new FileReader();
reader.readAsDataURL(z);
// console.log(z.name);
reader.onloadend = (function(i){
return function(){
console.log();
console.log(i);
li = '<p class="img-item"><i>'+ i.name +'</i><em><input type="text" placeholder="">页</em></p>';
$(dm).append(li);
};
})(z);
};
},
toSize: function (e) {
var imgdata = ;
$(e+ ' .img-item').each(function () {
var _this = $(this);
var page = _this.find('input').val();
var name = _this.find('i').text();
imgdata.push({
'fileName': name,
'sealPage': page
});
});
return imgdata;
}
};[/i]














  查看全部
Screenshot-51.png
<script src="js/jquery.form.js"></script>
http://plugins.jquery.com/form/
http://malsup.github.io/jquery.form.js
function createDialog(o) {
var load = ;
load.push(
'<ul>'
+'<form enctype="multipart/form-data" method="post" id="fileForm" name="fileForm""><ul>'
+ '<li><label>所属法人机构 </label><span><input type="text" name="orgBlon" data-name="orgBlon" value="' + o.orgBlon + '" ' + o.disabled + '/></span></li>'
+ '<li><label>申请柜员号 </label><span><input type="text" name="appUser" data-name="appUser" value="' + o.appUser + '" ' + o.disabled + '/></span></li>'
+ '<li><label>实际申请人 </label><span><input type="text" name="operUser" data-name="operUser" value="' + o.operUser + '" ' + o.disabled + '/></span></li>'
+ '<li><label>申请编号 </label><span><input type="text" name="appId" data-name="appId" value="' + o.appId + '" ' + o.disabled + '/></span></li>'
+ '<li><label>用印识别码 </label><span><input type="text" name="verCod" data-name="verCod" value="' + o.verCod + '" ' + o.disabled + '/></span></li>'
+ '<li><label>标题 </label><span><input type="text" name="appTitle" data-name="appTitle" value="' + o.appTitle + '" ' + o.disabled + '/></span></li>'
+ '<li><label>印章类型id </label><span><input type="text" name="sealTypeid" data-name="sealTypeid" value="' + o.sealTypeid + '" ' + o.disabled + '/></span></li>'
+ '<li class="max"><label>文件上传</label><span><input type="file" name="myfiles" data-name="myfiles" value="' + o.myfiles + '" /></span></li>'
+ '<li><label>文件类型 </label><span><input type="text" name="fileType" data-name="fileType" value="' + o.fileType + '" ' + o.disabled + '/></span></li>'
+ '<li><label>电子文档格式 </label><span><input type="text" name="efileForm" data-name="efileForm" value="' + o.efileForm + '" ' + o.disabled + '/></span></li>'
+ '<li><label>文件名称 </label><span><input type="text" name="fileName" data-name="fileName" value="' + o.fileName + '" ' + o.disabled + '/></span></li>'
+ '<li><label>页数 </label><span><input type="text" name="pagNum" data-name="pagNum" value="' + o.pagNum + '" ' + o.disabled + '/></span></li>'
+ '<li><label>盖章页 </label><span><input type="text" name="sealPage" data-name="sealPage" value="' + o.sealPage + '" ' + o.disabled + '/></span></li>'
+ '<li><label>用章次数 </label><span><input type="text" name="useSealNum" data-name="useSealNum" value="' + o.useSealNum + '" ' + o.disabled + '/></span></li>'
+ '<li><label>摘要 </label><span><input type="text" name="appComment" data-name="appComment" value="' + o.appComment + '" ' + o.disabled + '/></span></li>'
+ '<li><label>凭证ID </label><span><input type="text" name="chnId" data-name="chnId" value="' + o.chnId + '" ' + o.disabled + '/></span></li>'
+ '<li><label>付款人账号 </label><span><input type="text" name="payAcc" data-name="payAcc" value="' + o.payAcc + '" ' + o.disabled + '/></span></li>'
+ '<li><label>凭证种类 </label><span><input type="text" name="chnTpye" data-name="chnTpye" value="' + o.chnTpye + '" ' + o.disabled + '/></span></li>'
+ '<li><label>凭证号 </label><span><input type="text" name="chnCode" data-name="chnCode" value="' + o.chnCode + '" ' + o.disabled + '/></span></li>'
+ '<li><label>金额 </label><span><input type="text" name="chnMoney" data-name="chnMoney" value="' + o.chnMoney + '" ' + o.disabled + '/></span></li>'
+ '<li><label>凭证种类 </label><span><input type="text" name="chnTpye" data-name="chnTpye" value="' + o.chnTpye + '" ' + o.disabled + '/></span></li>'
+ '<li><label>凭证日期</label><span><input type="text" name="chnDate" data-name="chnDate" value="' + o.chnDate + '" ' + o.disabled + '/></span></li>'
+ '<li class="sumbit"><button type="button" class="btn btn-warning">保存</button><button type="button" class="btn btn-reset close">取消</button></li>'
+ '</ul></form>'
);
$.tooltip({className: "sysUser", title: o.title, content: load.join('')});

var _obj = $(".sysUser"), _control = $(":input", _obj), _button = $("button:first", _obj);
// $.select(api.user.select, _control.eq(3),o.rolCode);
_button.on("click", function () {
var form = $("form[name=fileForm]");
var options = {
type:'post',
url:'http://localhost:8080/1/base/addBusSealInfo',
success:function(data){
alert('Success loading XML document');
},
error:function(data){
alert('Error loading XML document');
}
};

form.ajaxSubmit(options);
//$("#fileForm").submit();
});
}
Screenshot-52.png
@RequestMapping(value = "/addBusSealInfo", produces = "text/javascript;charset=utf-8", method = RequestMethod.POST)
@ResponseBody
@ResponseStatus(code=HttpStatus.OK,reason="success")
public Map<String, Object> addBusSealInfo(
BusSealInfoDto busSealInfoDto,@RequestParam("myfiles") MultipartFile files) throws Exception {
pSealBusInfoService.addBusSealInfo(busSealInfoDto,files);

Thread.currentThread().sleep(1000);//毫秒

HashMap<String, Object> map = new HashMap<String, Object>();
map.put(message, "");
return map;
}
Screenshot-1.png


6117c743539244c4a8b8ee8713aaf624.gif


form提交数据的同时还可以通过data传字符串数据
 ..........         

$.tooltip({className: "sysUser", title: o.title, content: load.join('')});

var _obj = $(".sysUser"), _control = $(":input", _obj), _button = $("button:first", _obj);
// $.select(api.user.select, _control.eq(3),o.rolCode);
// 选择图片修改page信息,
$("body").on('change','#upImgs', function (e) {
upFile.mUpload(e,'#upimgs');
});

_button.on("click", function () {
var form = $("form[name=fileForm]");
var _parms = $.paramsCollection(_obj);
//图片页码信息
_parms.fileInfo = upFile.toSize('#upimgs');
console.log(_parms);
var options = {
type:'post',
url:'http://localhost:8080/1/base/addBusSealInfo',
data:{"a1":JSON.stringify(_parms)},
success:function(data){
$.tooltip({result: data.message, content: data.message});
viewDataTable();
// alert('Success loading XML document');
},
error:function(data){
alert('Error loading XML document');
}
};

form.ajaxSubmit(options);
//$("#fileForm").submit();
});
Screenshot-5.png
var upFile = {
mUpload: function(e,dm){
var m_file = e.target.files;
$(dm).find('.img-item').remove();
var li='';
for(var i=0;i<m_file.length;i++){
var z = m_file[i];
var reader = new FileReader();
reader.readAsDataURL(z);
// console.log(z.name);
reader.onloadend = (function(i){
return function(){
console.log();
console.log(i);
li = '<p class="img-item"><i>'+ i.name +'</i><em><input type="text" placeholder="">页</em></p>';
$(dm).append(li);
};
})(z);
};
},
toSize: function (e) {
var imgdata = ;
$(e+ ' .img-item').each(function () {
var _this = $(this);
var page = _this.find('input').val();
var name = _this.find('i').text();
imgdata.push({
'fileName': name,
'sealPage': page
});
});
return imgdata;
}
};[/i]

Screenshot-6.png


Screenshot-3.png


Screenshot-2.png

 

报告一个Java VM运行异常

rogertong 发表了文章 • 7 个评论 • 225 次浏览 • 2018-05-04 12:13 • 来自相关话题

/usr/tomcat/apache-tomcat-7.0.81/bin/catalina.sh run
Using CATALINA_BASE:   /root/.IntelliJIdea2017.2/system/tomcat/Unnamed_pSeal
Using CATALINA_HOME:   /usr/tomcat/apache-tomcat-7.0.81
Using CATALINA_TMPDIR: /usr/tomcat/apache-tomcat-7.0.81/temp
Using JRE_HOME:        /usr/lib/jvm/java-1.8.0-openjdk
Using CLASSPATH:       /usr/tomcat/apache-tomcat-7.0.81/bin/bootstrap.jar:/usr/tomcat/apache-tomcat-7.0.81/bin/tomcat-juli.jar
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x000000fff4004000, pid=4565, tid=1099316752880
#
# JRE version: OpenJDK Runtime Environment (8.0_60-b32) (build 1.8.0_60-rc27-b32)
# Java VM: OpenJDK 64-Bit Server VM (25.60-b24 mixed mode linux-mips64 compressed oops)
# Problematic frame:
# C  0x000000fff4004000
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /usr/tomcat/apache-tomcat-7.0.81/bin/hs_err_pid4565.log
Could not load hsdis-mips64.so; library not loadable; PrintAssembly is disabled
Compiled method (c2)     306    2             java.lang.String::equals (81 bytes)
 total in heap  [0x000000000024a050,0x000000000024a938] = 2280
 relocation     [0x000000000024a170,0x000000000024a190] = 32
 main code      [0x000000000024a190,0x000000000024a720] = 1424
 stub code      [0x000000000024a720,0x000000000024a760] = 64
 metadata       [0x000000000024a760,0x000000000024a770] = 16
 scopes data    [0x000000000024a770,0x000000000024a860] = 240
 scopes pcs     [0x000000000024a860,0x000000000024a910] = 176
 dependencies   [0x000000000024a910,0x000000000024a918] = 8
 nul chk table  [0x000000000024a918,0x000000000024a938] = 32
Compiled method (c2)     306    2             java.lang.String::equals (81 bytes)
 total in heap  [0x000000000024a050,0x000000000024a938] = 2280
 relocation     [0x000000000024a170,0x000000000024a190] = 32
 main code      [0x000000000024a190,0x000000000024a720] = 1424
 stub code      [0x000000000024a720,0x000000000024a760] = 64
 metadata       [0x000000000024a760,0x000000000024a770] = 16
 scopes data    [0x000000000024a770,0x000000000024a860] = 240
 scopes pcs     [0x000000000024a860,0x000000000024a910] = 176
 dependencies   [0x000000000024a910,0x000000000024a918] = 8
 nul chk table  [0x000000000024a918,0x000000000024a938] = 32
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#
Disconnected from server





  查看全部
/usr/tomcat/apache-tomcat-7.0.81/bin/catalina.sh run
Using CATALINA_BASE:   /root/.IntelliJIdea2017.2/system/tomcat/Unnamed_pSeal
Using CATALINA_HOME:   /usr/tomcat/apache-tomcat-7.0.81
Using CATALINA_TMPDIR: /usr/tomcat/apache-tomcat-7.0.81/temp
Using JRE_HOME:        /usr/lib/jvm/java-1.8.0-openjdk
Using CLASSPATH:       /usr/tomcat/apache-tomcat-7.0.81/bin/bootstrap.jar:/usr/tomcat/apache-tomcat-7.0.81/bin/tomcat-juli.jar
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x000000fff4004000, pid=4565, tid=1099316752880
#
# JRE version: OpenJDK Runtime Environment (8.0_60-b32) (build 1.8.0_60-rc27-b32)
# Java VM: OpenJDK 64-Bit Server VM (25.60-b24 mixed mode linux-mips64 compressed oops)
# Problematic frame:
# C  0x000000fff4004000
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /usr/tomcat/apache-tomcat-7.0.81/bin/hs_err_pid4565.log
Could not load hsdis-mips64.so; library not loadable; PrintAssembly is disabled
Compiled method (c2)     306    2             java.lang.String::equals (81 bytes)
 total in heap  [0x000000000024a050,0x000000000024a938] = 2280
 relocation     [0x000000000024a170,0x000000000024a190] = 32
 main code      [0x000000000024a190,0x000000000024a720] = 1424
 stub code      [0x000000000024a720,0x000000000024a760] = 64
 metadata       [0x000000000024a760,0x000000000024a770] = 16
 scopes data    [0x000000000024a770,0x000000000024a860] = 240
 scopes pcs     [0x000000000024a860,0x000000000024a910] = 176
 dependencies   [0x000000000024a910,0x000000000024a918] = 8
 nul chk table  [0x000000000024a918,0x000000000024a938] = 32
Compiled method (c2)     306    2             java.lang.String::equals (81 bytes)
 total in heap  [0x000000000024a050,0x000000000024a938] = 2280
 relocation     [0x000000000024a170,0x000000000024a190] = 32
 main code      [0x000000000024a190,0x000000000024a720] = 1424
 stub code      [0x000000000024a720,0x000000000024a760] = 64
 metadata       [0x000000000024a760,0x000000000024a770] = 16
 scopes data    [0x000000000024a770,0x000000000024a860] = 240
 scopes pcs     [0x000000000024a860,0x000000000024a910] = 176
 dependencies   [0x000000000024a910,0x000000000024a918] = 8
 nul chk table  [0x000000000024a918,0x000000000024a938] = 32
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
#
Disconnected from server

Screenshot-26.png

 

IDEA Debug中

rogertong 发表了文章 • 0 个评论 • 120 次浏览 • 2018-04-28 13:43 • 来自相关话题

在loongnix龙芯电脑上开发的第一个web项目接近尾声了,遇到的问题基本都能克服,SVN DB2都用上了





 
在loongnix龙芯电脑上开发的第一个web项目接近尾声了,遇到的问题基本都能克服,SVN DB2都用上了

Screenshot-25.png

 

设置MySQL最大连接数

rogertong 发表了文章 • 0 个评论 • 111 次浏览 • 2018-04-16 11:46 • 来自相关话题

https://jingyan.baidu.com/arti ... .html

MySQL实现序列(Sequence)并在Mybatis里使用

rogertong 发表了文章 • 0 个评论 • 106 次浏览 • 2018-04-16 11:24 • 来自相关话题

https://blog.csdn.net/sinat_19 ... 69789

Firefox上使用Web接口测试工具Poster

rogertong 发表了文章 • 0 个评论 • 108 次浏览 • 2018-04-13 17:42 • 来自相关话题

https://www.cnblogs.com/fnng/p/5797121.html?utm_source=tuicool&utm_medium=referral

Firefox使用Poster插件发送post请求 
https://www.cnblogs.com/xxyfhjl/p/4074186.html
  查看全部

Java识别简单的数字验证码

rogertong 发表了文章 • 0 个评论 • 131 次浏览 • 2018-03-22 11:07 • 来自相关话题

package util; import java.awt.Graphics; import java.awt.Image; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.File; import java.io.InputStream; import javax.imageio.ImageIO; import javax.media.jai.JAI; import javax.media.jai.RenderedOp; /** * 数字验证码识别器(用于识别xxx系统的图片验证码) * <p> * 算法如下: 分析验证码图片结构,将其分隔成4个独立的数字图片,把四个独立的数字图片处理成单色位图。 * 把单色位图转换为0、1数组,然后分别和0-9的字模进行匹配,得到图片上的数字信息。 * * @author huangyuanmu * @version 1.0 2009-7-7 * @since JDK 1.5.0_8 */ public class NumberVerificationCodeIdentifier { static { System.setProperty("com.sun.media.jai.disableMediaLib", "true"); } // 数字模板 0-9 static int value = { // num 0; {0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0}, // num 1 {0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0}, // num2 {0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0}, // num3 {0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 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 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, // num8 {0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0}, // num9 {0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0}}; /** * 识别图像 * * * @param byteArray * @return * @throws Exception * @author huangyuanmu 2009-7-14 */ public static String recognize(byte byteArray) throws Exception { InputStream is = new ByteArrayInputStream(byteArray); BufferedImage image = ImageIO.read(is); return recognize(image); } /** * 识别图像 * * @author huangyuanmu 2009-7-14 * @param image * @return * @throws Exception */ public static String recognize(BufferedImage image) throws Exception { StringBuffer sb = new StringBuffer(""); BufferedImage newim = new BufferedImage[4]; if (null == image) { throw new RuntimeException("iamage为null"); } // 将图像分成四块,因为要处理的文件有四个数字。 newim[0] = generateSingleColorBitMap(image.getSubimage(2, 1, 8, 11)); newim[1] = generateSingleColorBitMap(image.getSubimage(11, 1, 8, 11)); newim[2] = generateSingleColorBitMap(image.getSubimage(20, 1, 8, 11)); newim[3] = generateSingleColorBitMap(image.getSubimage(29, 1, 8, 11)); for (int k = 0; k < 4; k++) { int iw = newim[k].getWidth(null); int ih = newim[k].getHeight(null); int pix = new int[iw * ih]; // 因为是二值图像,这里的方法将像素读取出来的同时,转换为0,1的图像数组。 for (int i = 0; i < ih; i++) { for (int j = 0; j < iw; j++) { pix[i * (iw) + j] = newim[k].getRGB(j, i); if (pix[i * (iw) + j] == -1) pix[i * (iw) + j] = 0; else pix[i * (iw) + j] = 1; } } // 得到像匹配的数字。 int r = getMatchNum(pix); sb.append(r); } return sb.toString(); } /** * 把单色位图转换成的0、1数组和字模数组进行比较,返回匹配的数字 * * @author huangyuanmu 2009-7-7 * @param pix * @return */ private static int getMatchNum(int pix) { int result = -1; int temp = 100; int x; for (int k = 0; k <= 9; k++) { x = 0; for (int i = 0; i < pix.length; i++) { x = x + Math.abs(pix - value[k][i]); } if (x == 0) { result = k; break; } else if (x < temp) { temp = x; result = k; } } return result; } /** * 把彩色图像转换单色图像 * * @author huangyuanmu 2009-7-7 * @param colorImage * @return */ private static BufferedImage generateSingleColorBitMap(Image colorImage) { BufferedImage image = new BufferedImage(8, 11, BufferedImage.TYPE_BYTE_GRAY); Graphics g = image.getGraphics(); g.drawImage(colorImage, 0, 0, null); g.dispose(); RenderedOp ro = JAI.create("binarize", image, new Double(100)); BufferedImage bi = ro.getAsBufferedImage(); return bi; } /** * 测试 * * @author huangyuanmu 2009-7-7 * @param args */ public static void main(String args) throws Exception { String s = recognize(ImageIO.read(new File("/root/IdeaProjects/java_pdf_demo/src/main/resources/9335.jpg"))); System.out.println("识别结果 " + s); } }[/i]
  查看全部
Screenshot-39.png


Screenshot-40.png


package util; import java.awt.Graphics; import java.awt.Image; import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.File; import java.io.InputStream; import javax.imageio.ImageIO; import javax.media.jai.JAI; import javax.media.jai.RenderedOp; /** * 数字验证码识别器(用于识别xxx系统的图片验证码) * <p> * 算法如下: 分析验证码图片结构,将其分隔成4个独立的数字图片,把四个独立的数字图片处理成单色位图。 * 把单色位图转换为0、1数组,然后分别和0-9的字模进行匹配,得到图片上的数字信息。 * * @author huangyuanmu * @version 1.0 2009-7-7 * @since JDK 1.5.0_8 */ public class NumberVerificationCodeIdentifier { static { System.setProperty("com.sun.media.jai.disableMediaLib", "true"); } // 数字模板 0-9 static int value = { // num 0; {0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0}, // num 1 {0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0}, // num2 {0, 0, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 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 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0}, // num7 {0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0}, // num8 {0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0}, // num9 {0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 0, 0}}; /** * 识别图像 * * * @param byteArray * @return * @throws Exception * @author huangyuanmu 2009-7-14 */ public static String recognize(byte byteArray) throws Exception { InputStream is = new ByteArrayInputStream(byteArray); BufferedImage image = ImageIO.read(is); return recognize(image); } /** * 识别图像 * * @author huangyuanmu 2009-7-14 * @param image * @return * @throws Exception */ public static String recognize(BufferedImage image) throws Exception { StringBuffer sb = new StringBuffer(""); BufferedImage newim = new BufferedImage[4]; if (null == image) { throw new RuntimeException("iamage为null"); } // 将图像分成四块,因为要处理的文件有四个数字。 newim[0] = generateSingleColorBitMap(image.getSubimage(2, 1, 8, 11)); newim[1] = generateSingleColorBitMap(image.getSubimage(11, 1, 8, 11)); newim[2] = generateSingleColorBitMap(image.getSubimage(20, 1, 8, 11)); newim[3] = generateSingleColorBitMap(image.getSubimage(29, 1, 8, 11)); for (int k = 0; k < 4; k++) { int iw = newim[k].getWidth(null); int ih = newim[k].getHeight(null); int pix = new int[iw * ih]; // 因为是二值图像,这里的方法将像素读取出来的同时,转换为0,1的图像数组。 for (int i = 0; i < ih; i++) { for (int j = 0; j < iw; j++) { pix[i * (iw) + j] = newim[k].getRGB(j, i); if (pix[i * (iw) + j] == -1) pix[i * (iw) + j] = 0; else pix[i * (iw) + j] = 1; } } // 得到像匹配的数字。 int r = getMatchNum(pix); sb.append(r); } return sb.toString(); } /** * 把单色位图转换成的0、1数组和字模数组进行比较,返回匹配的数字 * * @author huangyuanmu 2009-7-7 * @param pix * @return */ private static int getMatchNum(int pix) { int result = -1; int temp = 100; int x; for (int k = 0; k <= 9; k++) { x = 0; for (int i = 0; i < pix.length; i++) { x = x + Math.abs(pix - value[k][i]); } if (x == 0) { result = k; break; } else if (x < temp) { temp = x; result = k; } } return result; } /** * 把彩色图像转换单色图像 * * @author huangyuanmu 2009-7-7 * @param colorImage * @return */ private static BufferedImage generateSingleColorBitMap(Image colorImage) { BufferedImage image = new BufferedImage(8, 11, BufferedImage.TYPE_BYTE_GRAY); Graphics g = image.getGraphics(); g.drawImage(colorImage, 0, 0, null); g.dispose(); RenderedOp ro = JAI.create("binarize", image, new Double(100)); BufferedImage bi = ro.getAsBufferedImage(); return bi; } /** * 测试 * * @author huangyuanmu 2009-7-7 * @param args */ public static void main(String args) throws Exception { String s = recognize(ImageIO.read(new File("/root/IdeaProjects/java_pdf_demo/src/main/resources/9335.jpg"))); System.out.println("识别结果 " + s); } }[/i]
 

Java-RC24版本更新

代表月亮消咩尼 发表了文章 • 0 个评论 • 150 次浏览 • 2017-09-05 20:59 • 来自相关话题

Java RC24版本更新
一、本地更新方法
 1、将需要更新的软件包下载到u盘,或者本地硬盘,放入单独目录
2、运行脚本 local-update.sh加上目录路径,可自动完成更新。
脚本下载地址龙芯开源社区
 二、Java RC24版本在线更新方法
安装公司内网源 #yum  install http://10.2.5.28/ftp/os/loongn ... h.rpm -y #yum makecache
更新java #yum update -y java-1.8.0-openjdk-1.8.0.25-6.b17.rc24.fc21.loongson
  查看全部
Java RC24版本更新
一、本地更新方法
 1、将需要更新的软件包下载到u盘,或者本地硬盘,放入单独目录
2、运行脚本 local-update.sh加上目录路径,可自动完成更新。
脚本下载地址龙芯开源社区
 二、Java RC24版本在线更新方法
安装公司内网源 #yum  install http://10.2.5.28/ftp/os/loongn ... h.rpm -y #yum makecache
更新java #yum update -y java-1.8.0-openjdk-1.8.0.25-6.b17.rc24.fc21.loongson
 

Java 基础稳定性测试方法

loongnix 发表了文章 • 1 个评论 • 184 次浏览 • 2017-02-14 09:22 • 来自相关话题

(2017.02.09)

关于 Java 基础稳定性

龙芯机器上确保 Java 应用稳定运行的最基础的测试。根据应用场景,可分为两个等级:
客户端级:至少通过 3 x 24 小时 Java 基础稳定性测试;服务器级:至少通过 7 x 24 小时 Java 基础稳定性测试。
龙芯所有运行 Java 应用的产品都必须经过上述基础稳定性的测试。

硬件环境
CPU :任意一款龙芯 3 号系列芯片;内 存: 4G 以上;硬 盘: 60G 以上。

软件环境
SPECjvm2008 测试集: 下载地址 http://www.loongnix.org/index.php/SpecJVM龙芯 JDK : 下载地址 http://www.loongnix.org/index.php/Java (建议下载最新版本)

测试方法

1. 安装龙芯 JDK
2. 安装 SPECjvm2008 测试集
3. 进入 SPECjvm2008 的安装目录,执行测试脚本 gc.sh (后附样例脚本)

附:各系统推荐的测试脚本 gc.sh 。测试前,需要正确设置脚本中标红的变量 JDK 。

1. 龙芯 3 号双路服务器测试脚本#!/bin/bash

# Set your JAVA_HOME path
# e.g. /opt/j2sdk-image
# JDK="/opt/j2sdk-image"
JDK="YOUR JAVA_HOME path"

Threads="16"
Heap="512M"

Ben="compiler.compiler"
Time=`date +"%Y%m%d%H%M%S"`
Log="gc-${Time}.log"

Num="0"
JVM_ARGS="-Xmx${Heap} -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:ParallelGCThreads=8 "

cat /proc/cpuinfo 1>>${Log}
free -m 1>>${Log}
cat /etc/issue 1>>${Log}
uname -a 1>>${Log}
echo -e "\nJVM_ARGS: ${JVM_ARGS}\n" 1>>${Log}
echo -e "JAVA_VERSION: " 1>>${Log}
{ ${JDK}/bin/java -version; } 1>>${Log} 2>>${Log}
echo -e "\n\n\nTest Start ...\n\n\n " 1>>${Log}

while(true);
do
let Num++
echo "Num: ${Num}" | tee -a ${Log}

${JDK}/bin/java \
${JVM_ARGS} \
-jar SPECjvm2008.jar -ikv -coe -ict -bt ${Threads} ${Ben} | tee -a ${Log}
done2. 龙芯 3 号四路服务器测试脚本#!/bin/bash

# Set your JAVA_HOME path
# e.g. /opt/j2sdk-image
# JDK="/opt/j2sdk-image"
JDK="YOUR JAVA_HOME path"

Threads="32"
Heap="1024M"

Ben="compiler.compiler"
Time=`date +"%Y%m%d%H%M%S"`
Log="gc-${Time}.log"

Num="0"
JVM_ARGS="-Xmx${Heap} -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:ParallelGCThreads=16 "
cat /proc/cpuinfo 1>>${Log}
free -m 1>>${Log}

cat /etc/issue 1>>${Log}
uname -a 1>>${Log}
echo -e "\nJVM_ARGS: ${JVM_ARGS}\n" 1>>${Log}
echo -e "JAVA_VERSION: " 1>>${Log}
{ ${JDK}/bin/java -version; } 1>>${Log} 2>>${Log}
echo -e "\n\n\nTest Start ...\n\n\n " 1>>${Log}

while(true);
do
let Num++
echo "Num: ${Num}" | tee -a ${Log}

${JDK}/bin/java \
${JVM_ARGS} \
-jar SPECjvm2008.jar -ikv -coe -ict -bt ${Threads} ${Ben} | tee -a ${Log}
done3. 龙芯 3 号单路测试脚本#!/bin/bash

# Set your JAVA_HOME path
# e.g. /opt/j2sdk-image
# JDK="/opt/j2sdk-image"
JDK="YOUR JAVA_HOME pPath"

Threads="8"
Heap="512M"

Ben="compiler.compiler"
Time=`date +"%Y%m%d%H%M%S"`
Log="gc-${Time}.log"

Num="0"
JVM_ARGS="-Xmx${Heap} -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:ParallelGCThreads=4"

cat /proc/cpuinfo 1>>${Log}
free -m 1>>${Log}
cat /etc/issue 1>>${Log}
uname -a 1>>${Log}
echo -e "\nJVM_ARGS: ${JVM_ARGS}\n" 1>>${Log}
echo -e "JAVA_VERSION: " 1>>${Log}
{ ${JDK}/bin/java -version; } 1>>${Log} 2>>${Log}
echo -e "\n\n\nTest Start ...\n\n\n " 1>>${Log}

while(true);
do
let Num++
echo "Num: ${Num}" | tee -a ${Log}

${JDK}/bin/java \
${JVM_ARGS} \
-jar SPECjvm2008.jar -ikv -coe -ict -bt ${Threads} ${Ben} | tee -a ${Log}
done正确性检验

要求在规定的测试时间内同时满足以下条件:
不宕机不阻塞无崩溃无“ NOT VALID”

设本测试生成的 Log 文件为 gc-20170209134605.log ,则第 3 , 4 条可以借助以下两条命令进行检验:# 检查是否发生崩溃
# 正确时输出为 0,否则非零
$ grep “hs_err_*.log” gc-20170209134605.log | wc -l

# 检查是否存在“NOT VALID”
# 正确时输出为 0,否则非零
$ grep “NOT VALID” gc-20170209134605.log | wc -l 查看全部
(2017.02.09)

关于 Java 基础稳定性

龙芯机器上确保 Java 应用稳定运行的最基础的测试。根据应用场景,可分为两个等级:
  • 客户端级:至少通过 3 x 24 小时 Java 基础稳定性测试;
  • 服务器级:至少通过 7 x 24 小时 Java 基础稳定性测试。

龙芯所有运行 Java 应用的产品都必须经过上述基础稳定性的测试。

硬件环境
  1. CPU :任意一款龙芯 3 号系列芯片;
  2. 内 存: 4G 以上;
  3. 硬 盘: 60G 以上。


软件环境
  1. SPECjvm2008 测试集: 下载地址 http://www.loongnix.org/index.php/SpecJVM
  2. 龙芯 JDK : 下载地址 http://www.loongnix.org/index.php/Java (建议下载最新版本)


测试方法

1. 安装龙芯 JDK
2. 安装 SPECjvm2008 测试集
3. 进入 SPECjvm2008 的安装目录,执行测试脚本 gc.sh (后附样例脚本)

附:各系统推荐的测试脚本 gc.sh 。测试前,需要正确设置脚本中标红的变量 JDK 。

1. 龙芯 3 号双路服务器测试脚本
#!/bin/bash

# Set your JAVA_HOME path
# e.g. /opt/j2sdk-image
# JDK="/opt/j2sdk-image"
JDK="YOUR JAVA_HOME path"

Threads="16"
Heap="512M"

Ben="compiler.compiler"
Time=`date +"%Y%m%d%H%M%S"`
Log="gc-${Time}.log"

Num="0"
JVM_ARGS="-Xmx${Heap} -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:ParallelGCThreads=8 "

cat /proc/cpuinfo 1>>${Log}
free -m 1>>${Log}
cat /etc/issue 1>>${Log}
uname -a 1>>${Log}
echo -e "\nJVM_ARGS: ${JVM_ARGS}\n" 1>>${Log}
echo -e "JAVA_VERSION: " 1>>${Log}
{ ${JDK}/bin/java -version; } 1>>${Log} 2>>${Log}
echo -e "\n\n\nTest Start ...\n\n\n " 1>>${Log}

while(true);
do
let Num++
echo "Num: ${Num}" | tee -a ${Log}

${JDK}/bin/java \
${JVM_ARGS} \
-jar SPECjvm2008.jar -ikv -coe -ict -bt ${Threads} ${Ben} | tee -a ${Log}
done
2. 龙芯 3 号四路服务器测试脚本
#!/bin/bash

# Set your JAVA_HOME path
# e.g. /opt/j2sdk-image
# JDK="/opt/j2sdk-image"
JDK="YOUR JAVA_HOME path"

Threads="32"
Heap="1024M"

Ben="compiler.compiler"
Time=`date +"%Y%m%d%H%M%S"`
Log="gc-${Time}.log"

Num="0"
JVM_ARGS="-Xmx${Heap} -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:ParallelGCThreads=16 "
cat /proc/cpuinfo 1>>${Log}
free -m 1>>${Log}

cat /etc/issue 1>>${Log}
uname -a 1>>${Log}
echo -e "\nJVM_ARGS: ${JVM_ARGS}\n" 1>>${Log}
echo -e "JAVA_VERSION: " 1>>${Log}
{ ${JDK}/bin/java -version; } 1>>${Log} 2>>${Log}
echo -e "\n\n\nTest Start ...\n\n\n " 1>>${Log}

while(true);
do
let Num++
echo "Num: ${Num}" | tee -a ${Log}

${JDK}/bin/java \
${JVM_ARGS} \
-jar SPECjvm2008.jar -ikv -coe -ict -bt ${Threads} ${Ben} | tee -a ${Log}
done
3. 龙芯 3 号单路测试脚本
#!/bin/bash

# Set your JAVA_HOME path
# e.g. /opt/j2sdk-image
# JDK="/opt/j2sdk-image"
JDK="YOUR JAVA_HOME pPath"

Threads="8"
Heap="512M"

Ben="compiler.compiler"
Time=`date +"%Y%m%d%H%M%S"`
Log="gc-${Time}.log"

Num="0"
JVM_ARGS="-Xmx${Heap} -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:ParallelGCThreads=4"

cat /proc/cpuinfo 1>>${Log}
free -m 1>>${Log}
cat /etc/issue 1>>${Log}
uname -a 1>>${Log}
echo -e "\nJVM_ARGS: ${JVM_ARGS}\n" 1>>${Log}
echo -e "JAVA_VERSION: " 1>>${Log}
{ ${JDK}/bin/java -version; } 1>>${Log} 2>>${Log}
echo -e "\n\n\nTest Start ...\n\n\n " 1>>${Log}

while(true);
do
let Num++
echo "Num: ${Num}" | tee -a ${Log}

${JDK}/bin/java \
${JVM_ARGS} \
-jar SPECjvm2008.jar -ikv -coe -ict -bt ${Threads} ${Ben} | tee -a ${Log}
done
正确性检验

要求在规定的测试时间内同时满足以下条件:
  1. 不宕机
  2. 不阻塞
  3. 无崩溃
  4. 无“ NOT VALID”


设本测试生成的 Log 文件为 gc-20170209134605.log ,则第 3 , 4 条可以借助以下两条命令进行检验:
# 检查是否发生崩溃
# 正确时输出为 0,否则非零
$ grep “hs_err_*.log” gc-20170209134605.log | wc -l

# 检查是否存在“NOT VALID”
# 正确时输出为 0,否则非零
$ grep “NOT VALID” gc-20170209134605.log | wc -l

龙芯3A2000上移植NASA WorldWind指南

代表月亮消咩尼 发表了文章 • 0 个评论 • 177 次浏览 • 2017-01-24 11:36 • 来自相关话题

龙芯3A2000上移植NASA WorldWind指南

一、初识NASA WORLDWIND   NASA World Wind是NASA(美国)国家航空和宇宙航行局联合出品,类似Earthview 3D的鸟瞰工具,更加权威而且完全免费。通过这套程序的3D引擎,可以让你从外太空看见地球上的任何一个角落。







worldwind主界面
    有“天眼”之称的一款软件是否可以在龙芯平台上运行呢?经过修改、调试、编译,笔者终于成功的在龙芯3A2000上运行了worldwind。下面来看看移植过程。
二、下载worldwind以及相关的软件包
首先介绍下和worliwind相关的两外两个软件包gluegen和jogl。
gluegen是自动生成的java和JNI代码,调用C库的工具,可以绑定底层API,如java本地接口(JNI)和 AWT本地接口(jawt)。
jogl是Java对OpenGL绑定的开源项目并设计为采用Java开发的应用程序,还提供了众多3D图形库,如:AWT、Swing和SWT widget,以及自定义窗口工具nativewindow。
为了不让大家走弯路,笔者先简单的介绍下载包的版本。笔者下载的worldwind是2.0.0版本,REDME.txt文档上介绍支持Java SDK1.5.0以上版本。需下载1.5版本的gluegen和jogl包。
● worldwind下载路径:http://ftp.loongnix.org/others/NasaWorldWind/
● gluegen和jogl下载路径:http://jogamp.org/deployment/a ... rces/
点击gluegen-v2.1.5.tar.7z和jogl-v2.1.5.tar.7z即可下载。
三、编译环境
笔者使用的电脑是龙芯3A2000,系统是Loongnix-Fedora21。
系统下载地址:  http://www.loongnix.org
四、编译源代码
笔者详细的述说这三个软件包里需要修改的地方。
第一步:首先编译gluegen软件包
1.进入gluegen软件包,查找build.xml文件。(记得将解压后的文件名修改为gluegen)
[loongson@localhost gluegen]$find . -name build.xml
./test/TestOneJar_InJar/jogamp01/build.xml
./test/junit/com/jogamp/gluegen/build.xml
./make/build.xml 修改 ./make/build.xml文件,搜索mips,添加如下代码:
在328行添加如下代码:
+  <target name="declare.linux.mips64el" if="isLinuxMips64el">
+      <echo message="Linux.mips64el" />
+     <property name="compiler.cfg.id"                      value="compiler.cfg.linux" />
+    <property name="linker.cfg.id"                        value="linker.cfg.linux.mips64el" />
+  </target>在360行后面加上代码:
+  declare.linux.mips64el,2.进入gluegen软件包,查找PlatformPropsImpl.java文件。
[loongson@localhost gluegen]$ find . -name PlatformPropsImpl.java
./src/java/jogamp/common/os/PlatformPropsImpl.java修改PlatformPropsImpl.java文件,查找mips,在301行添加如下代码:
+ else if( archLower.equals("mips64") ) {        // android  gaoquan
+            return CPUType.MIPS_64;
+        } else if( archLower.equals("mips64el") ) {        // android   gaoquan
+            return CPUType.MIPS_64el;
+        }3.修改PlatformPropsImpl.java文件。
在./src/java/jogamp/common/os/PlatformPropsImpl.java文件的getOSAndArch()方法下,添加分支,代码如下:
case IA64:
                _os_and_arch = "ia64";
                break;
+            case MIPS_64el:
+                os_and_arch = "mips64el";
+               break;
             case SPARCV9_64:
                _os_and_arch = "sparcv9";
                break;4.修改MachineDescriptionRuntime.java文件。
在./src/java/jogamp/common/os/MachineDescriptionRuntime.java文件的isCPUArch32Bit()方法下,添加分支,代码如下:
private static boolean isCPUArch32Bit(final Platform.CPUType cpuType) throws RuntimeException {
    switch( cpuType ) {
        case X86_32:
        ...........    
+      case MIPS_64el:
            return false;5.进入gluegen软件包,查找./make/gluegen-cpptasks-base.xml文件,此文件修改的代码有些多。在gluegen-cpptasks-base.xml中搜索mipsel,在380行添加代码:
在gluegen-cpptasks-base.xml中搜索mipsel,在380行添加代码:
 <condition property="isLinuxMipsel">
      <and>
        <istrue value="${isLinux}" />
        <os arch="mipsel" />
      </and>
    </condition>
+    <condition property="mipsel">
+      <os arch="mipsel" />
+    </condition>
+      <condition property="isLinuxMips64el">
+      <and>
+        <istrue value="${isLinux}" />
+        <os arch="mips64el" />
+      </and>
+    </condition>
+    <condition property="mips64el">
+      <os arch="mips64el" />
+    </condition>
<condition property="isLinuxPpc">580行添加代码:
<echo message="LinuxMipsel=${isLinuxMipsel}" />
+    <echo message="LinuxMips64el=${isLinuxMips64el}" />
       <echo message="LinuxPpc=${isLinuxPpc}" />650行添加代码:
 <target name="gluegen.cpptasks.detect.os.linux.mipsel" unless="gluegen.cpptasks.detected.os.2" if="isLinuxMipsel">
    <property name="os.and.arch" value="linux-mipsel" />
  </target>
+  <target name="gluegen.cpptasks.detect.os.linux.mips64el" unless="gluegen.cpptasks.detected.os.2" if="isLinuxMips64el">
+    <property name="os.and.arch" value="linux-mips64el" />
+  </target>
  <target name="gluegen.cpptasks.detect.os.linux.ppc" unless="gluegen.cpptasks.detected.os.2" if="isLinuxPpc">
    <property name="os.and.arch" value="linux-ppc" />
  </target>682行添加代码+ gluegen.cpptasks.detect.os.linux.mips64el,1192行添加代码: <linker id="linker.cfg.linux.mipsel" name="${gcc.compat.compiler}">
    </linker>
+   <linker id="linker.cfg.linux.mips64el" name="${gcc.compat.compiler}">
+   </linker>
    <linker id="linker.cfg.linux.ppc" name="${gcc.compat.compiler}">
</linker> 1413行添加代码:
<target name="gluegen.cpptasks.declare.compiler.linux.mipsel" if="isLinuxMipsel">
      <echo message="Linux.Mipsel" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.linux" />
      <property name="linker.cfg.id.base"            value="linker.cfg.linux" />
      <property name="java.lib.dir.platform"         value="${java.home.dir}/jre/lib/mipsel" />
    </target>
+    <target name="gluegen.cpptasks.declare.compiler.linux.mips64el" if="isLinuxMips64el">
+      <echo message="Linux.Mips64el" />
+      <property name="compiler.cfg.id.base"          value="compiler.cfg.linux" />
+      <property name="linker.cfg.id.base"            value="linker.cfg.linux" />
+      <property name="java.lib.dir.platform"         value="${java.home.dir}/jre/lib/mips64el" />
+    </target>
    <target name="gluegen.cpptasks.declare.compiler.linux.ppc" if="isLinuxPpc">
      <echo message="Linux.Ppc" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.linux" />
      <property name="linker.cfg.id.base"            value="linker.cfg.linux" />
      <property name="java.lib.dir.platform"         value="${java.home.dir}/jre/lib/ppc" />
</target>1449行添加代码:
 + gluegen.cpptasks.declare.compiler.linux.mipsel,6.在build-test.xml文件中搜索java.build,在164行添加如下代码:
 +   <!--
+   <target name="android.package" depends="java.generate,java.build,native.build" if="isAndroid">
+   -->
+    <target name="android.package" depends="java.generate,native.build" if="isAndroid">
+        <aapt.signed
            assetsdir="resources/assets-test"7.最后在make目录下,使用ant来编译:
 gluegen.build.check.aapt:
android.package:
developer-src-zip:
      [zip] Building zip: /home/loongson/jogl/gluegen/build/gluegen-java-src.zip
developer-zip-archive:
all:
BUILD SUCCESSFULgluegen软件包终于编译成功了!
* 最后记得将build目录下的 .jar 文件拷贝到worldwind下
第二步:编译jogl软件包
1.下载swt.jar文件(http://ftp.loongnix.org/others/NasaWorldWind/),拷贝到swt目录下(jogl-v2.1.5/make/lib/swt/)
2.进入jogl-v2.15软件包,在./make/build-nativewindow.xml文件中进行修改。
  <target name="c.configure.linux.mipsel" if="isLinuxMipsel">
      <echo message="Linux.MIPSEL" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.linux" />
      <property name="linker.cfg.id.oswin"                  value="linker.cfg.linux.nativewindow.x11" />
    </target>
+   <target name="c.configure.linux.mips64el" if="isLinuxMips64el">
+      <echo message="Linux.MIPS64EL" />
+      <property name="compiler.cfg.id"                      value="compiler.cfg.linux" />
+      <property name="linker.cfg.id.oswin"                  value="linker.cfg.linux.nativewindow.x11" />
+    </target>
<target name="c.configure.linux.ppc" if="isLinuxPpc">
    ..........
+   c.configure.linux.mipsel,c.configure.linux.mips64el,c.configure.linux.ppc  3.修改build-common.xml文件,添加如下代码:
  <condition property="swt.jar" value="${project.root}/make/lib/swt/gtk-linux-x86/swt-debug.jar">
          <istrue value="${isAndroid}" /> <!-- FIXME JAU .. hack -->
        </condition>
+       <condition property="swt.jar" value="${project.root}/make/lib/swt/gtk-linux-mips64el/swt.jar">
+          <istrue value="${isLinuxMips64el}" /> <!-- FIXME JAU .. hack -->
+        </condition>
         <property name="swt-cocoa-macosx-x86_64.jar" value="${project.root}/make/lib/swt/cocoa-macosx-x86_64/swt-debug.jar"/>  4.修改build-jogl.xml文件,添加如下代码:
 <target name="c.configure.linux.mipsel" if="isLinuxMipsel">
      <echo message="Linux.MIPSEL" />
      <property name="compiler.cfg.id"                     value="compiler.cfg.linux" />
      <property name="linker.cfg.id.os"                    value="linker.cfg.linux.jogl.x11" />
    </target>
+    <target name="c.configure.linux.mips64el" if="isLinuxMipsel">
+      <echo message="Linux.MIPSEL" />
+      <property name="compiler.cfg.id"                     value="compiler.cfg.linux" />
+      <property name="linker.cfg.id.os"                    value="linker.cfg.linux.jogl.x11" />
+    </target>
+   c.configure.linux.mipsel,c.configure.linux.mips64el,c.configure.linux.ppc5.修改build-newt.xml文件,添加如下代码:
 +    <target name="c.configure.linux.mips64el" if="isLinuxMips64el">
+      <echo message="Linux.mips64el" />
+      <property name="compiler.cfg.id"                      value="compiler.cfg.linux" />
+      <condition property="linker.cfg.id.oswin"             value="linker.cfg.linux.newt.x11"
+                                                            else="linker.cfg.linux">
+          <isset property="isX11" />
+      </condition>
+      <echo message="linker.cfg.id.oswin ${linker.cfg.id.oswin}" />
+    </target>
+    c.configure.linux.mipsel,c.configure.linux.mips64el,c.configure.linux.ppc6.在make目录下,使用ant来编译:
 all:
BUILD SUCCESSFUL
Total time: 3 minutes 1 second终于编译成功了!
* 记得将jogl下的jogl-all.jar、nativewindow-natives-linux-mips64el.jar、jogl-all-natives-linux-mips64el.jar,拷贝到worldwind下
第三步:在worldwind下,运行提供的用例。
 [loongson@localhost worldwind-2.0.0]$ chmod +x run-demo.bash
[loongson@localhost worldwind-2.0.0]$ ./run-demo.bash gov.nasa.worldwindx.examples.ApplicationTemplate最终worldwind终于运行起来了!3A2000下拖动页面基本流畅。
为了能够更流畅的查看地图,可以屏蔽终端的输入:
 [loongson@localhost worldwind-2.0.0]$ ./run-demo.bash gov.nasa.worldwindx.examples.ApplicationTemplate &>/dev/null
五、如果您觉得要修改的代码太多,不方便。笔者为你提供了更简单的方法。
1. 下载http://ftp.loongnix.org/others/NasaWorldWind/ 里面有patch文件,还有使用说明。根据说明来修改三个软件包,最后在worldwind目录里输入
./run-demo.bash gov.nasa.worldwindx.examples.ApplicationTemplate
 
  查看全部
龙芯3A2000上移植NASA WorldWind指南

一、初识NASA WORLDWIND   NASA World Wind是NASA(美国)国家航空和宇宙航行局联合出品,类似Earthview 3D的鸟瞰工具,更加权威而且完全免费。通过这套程序的3D引擎,可以让你从外太空看见地球上的任何一个角落。


91.png


worldwind主界面
    有“天眼”之称的一款软件是否可以在龙芯平台上运行呢?经过修改、调试、编译,笔者终于成功的在龙芯3A2000上运行了worldwind。下面来看看移植过程。
二、下载worldwind以及相关的软件包
首先介绍下和worliwind相关的两外两个软件包gluegen和jogl。
gluegen是自动生成的java和JNI代码,调用C库的工具,可以绑定底层API,如java本地接口(JNI)和 AWT本地接口(jawt)。
jogl是Java对OpenGL绑定的开源项目并设计为采用Java开发的应用程序,还提供了众多3D图形库,如:AWT、Swing和SWT widget,以及自定义窗口工具nativewindow。
为了不让大家走弯路,笔者先简单的介绍下载包的版本。笔者下载的worldwind是2.0.0版本,REDME.txt文档上介绍支持Java SDK1.5.0以上版本。需下载1.5版本的gluegen和jogl包。
● worldwind下载路径:http://ftp.loongnix.org/others/NasaWorldWind/
● gluegen和jogl下载路径:http://jogamp.org/deployment/a ... rces/
点击gluegen-v2.1.5.tar.7z和jogl-v2.1.5.tar.7z即可下载。
三、编译环境
笔者使用的电脑是龙芯3A2000,系统是Loongnix-Fedora21。
系统下载地址:  http://www.loongnix.org
四、编译源代码
笔者详细的述说这三个软件包里需要修改的地方。
第一步:首先编译gluegen软件包
1.进入gluegen软件包,查找build.xml文件。(记得将解压后的文件名修改为gluegen)
[loongson@localhost gluegen]$find . -name build.xml
./test/TestOneJar_InJar/jogamp01/build.xml
./test/junit/com/jogamp/gluegen/build.xml
./make/build.xml 修改 ./make/build.xml文件,搜索mips,添加如下代码:
在328行添加如下代码:
+  <target name="declare.linux.mips64el" if="isLinuxMips64el">
+      <echo message="Linux.mips64el" />
+     <property name="compiler.cfg.id"                      value="compiler.cfg.linux" />
+    <property name="linker.cfg.id"                        value="linker.cfg.linux.mips64el" />
+  </target>在360行后面加上代码:
+  declare.linux.mips64el,2.进入gluegen软件包,查找PlatformPropsImpl.java文件。
[loongson@localhost gluegen]$ find . -name PlatformPropsImpl.java
./src/java/jogamp/common/os/PlatformPropsImpl.java修改PlatformPropsImpl.java文件,查找mips,在301行添加如下代码:
+ else if( archLower.equals("mips64") ) {        // android  gaoquan
+            return CPUType.MIPS_64;
+        } else if( archLower.equals("mips64el") ) {        // android   gaoquan
+            return CPUType.MIPS_64el;
+        }3.修改PlatformPropsImpl.java文件。
在./src/java/jogamp/common/os/PlatformPropsImpl.java文件的getOSAndArch()方法下,添加分支,代码如下:
case IA64:
                _os_and_arch = "ia64";
                break;
+            case MIPS_64el:
+                os_and_arch = "mips64el";
+               break;
             case SPARCV9_64:
                _os_and_arch = "sparcv9";
                break;4.修改MachineDescriptionRuntime.java文件。
在./src/java/jogamp/common/os/MachineDescriptionRuntime.java文件的isCPUArch32Bit()方法下,添加分支,代码如下:
private static boolean isCPUArch32Bit(final Platform.CPUType cpuType) throws RuntimeException {
    switch( cpuType ) {
        case X86_32:
        ...........    
+      case MIPS_64el:
            return false;5.进入gluegen软件包,查找./make/gluegen-cpptasks-base.xml文件,此文件修改的代码有些多。在gluegen-cpptasks-base.xml中搜索mipsel,在380行添加代码:
在gluegen-cpptasks-base.xml中搜索mipsel,在380行添加代码:
 <condition property="isLinuxMipsel">
      <and>
        <istrue value="${isLinux}" />
        <os arch="mipsel" />
      </and>
    </condition>
+    <condition property="mipsel">
+      <os arch="mipsel" />
+    </condition>
+      <condition property="isLinuxMips64el">
+      <and>
+        <istrue value="${isLinux}" />
+        <os arch="mips64el" />
+      </and>
+    </condition>
+    <condition property="mips64el">
+      <os arch="mips64el" />
+    </condition>
<condition property="isLinuxPpc">580行添加代码:
<echo message="LinuxMipsel=${isLinuxMipsel}" />
+    <echo message="LinuxMips64el=${isLinuxMips64el}" />
       <echo message="LinuxPpc=${isLinuxPpc}" />650行添加代码:
 <target name="gluegen.cpptasks.detect.os.linux.mipsel" unless="gluegen.cpptasks.detected.os.2" if="isLinuxMipsel">
    <property name="os.and.arch" value="linux-mipsel" />
  </target>
+  <target name="gluegen.cpptasks.detect.os.linux.mips64el" unless="gluegen.cpptasks.detected.os.2" if="isLinuxMips64el">
+    <property name="os.and.arch" value="linux-mips64el" />
+  </target>
  <target name="gluegen.cpptasks.detect.os.linux.ppc" unless="gluegen.cpptasks.detected.os.2" if="isLinuxPpc">
    <property name="os.and.arch" value="linux-ppc" />
  </target>682行添加代码+ gluegen.cpptasks.detect.os.linux.mips64el,1192行添加代码: <linker id="linker.cfg.linux.mipsel" name="${gcc.compat.compiler}">
    </linker>
+   <linker id="linker.cfg.linux.mips64el" name="${gcc.compat.compiler}">
+   </linker>
    <linker id="linker.cfg.linux.ppc" name="${gcc.compat.compiler}">
</linker> 1413行添加代码:
<target name="gluegen.cpptasks.declare.compiler.linux.mipsel" if="isLinuxMipsel">
      <echo message="Linux.Mipsel" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.linux" />
      <property name="linker.cfg.id.base"            value="linker.cfg.linux" />
      <property name="java.lib.dir.platform"         value="${java.home.dir}/jre/lib/mipsel" />
    </target>
+    <target name="gluegen.cpptasks.declare.compiler.linux.mips64el" if="isLinuxMips64el">
+      <echo message="Linux.Mips64el" />
+      <property name="compiler.cfg.id.base"          value="compiler.cfg.linux" />
+      <property name="linker.cfg.id.base"            value="linker.cfg.linux" />
+      <property name="java.lib.dir.platform"         value="${java.home.dir}/jre/lib/mips64el" />
+    </target>
    <target name="gluegen.cpptasks.declare.compiler.linux.ppc" if="isLinuxPpc">
      <echo message="Linux.Ppc" />
      <property name="compiler.cfg.id.base"          value="compiler.cfg.linux" />
      <property name="linker.cfg.id.base"            value="linker.cfg.linux" />
      <property name="java.lib.dir.platform"         value="${java.home.dir}/jre/lib/ppc" />
</target>1449行添加代码:
 + gluegen.cpptasks.declare.compiler.linux.mipsel,6.在build-test.xml文件中搜索java.build,在164行添加如下代码:
 +   <!--
+   <target name="android.package" depends="java.generate,java.build,native.build" if="isAndroid">
+   -->
+    <target name="android.package" depends="java.generate,native.build" if="isAndroid">
+        <aapt.signed
            assetsdir="resources/assets-test"7.最后在make目录下,使用ant来编译:
 gluegen.build.check.aapt:
android.package:
developer-src-zip:
      [zip] Building zip: /home/loongson/jogl/gluegen/build/gluegen-java-src.zip
developer-zip-archive:
all:
BUILD SUCCESSFULgluegen软件包终于编译成功了!
* 最后记得将build目录下的 .jar 文件拷贝到worldwind下
第二步:编译jogl软件包
1.下载swt.jar文件(http://ftp.loongnix.org/others/NasaWorldWind/),拷贝到swt目录下(jogl-v2.1.5/make/lib/swt/)
2.进入jogl-v2.15软件包,在./make/build-nativewindow.xml文件中进行修改。
  <target name="c.configure.linux.mipsel" if="isLinuxMipsel">
      <echo message="Linux.MIPSEL" />
      <property name="compiler.cfg.id"                      value="compiler.cfg.linux" />
      <property name="linker.cfg.id.oswin"                  value="linker.cfg.linux.nativewindow.x11" />
    </target>
+   <target name="c.configure.linux.mips64el" if="isLinuxMips64el">
+      <echo message="Linux.MIPS64EL" />
+      <property name="compiler.cfg.id"                      value="compiler.cfg.linux" />
+      <property name="linker.cfg.id.oswin"                  value="linker.cfg.linux.nativewindow.x11" />
+    </target>
<target name="c.configure.linux.ppc" if="isLinuxPpc">
    ..........
+   c.configure.linux.mipsel,c.configure.linux.mips64el,c.configure.linux.ppc  3.修改build-common.xml文件,添加如下代码:
  <condition property="swt.jar" value="${project.root}/make/lib/swt/gtk-linux-x86/swt-debug.jar">
          <istrue value="${isAndroid}" /> <!-- FIXME JAU .. hack -->
        </condition>
+       <condition property="swt.jar" value="${project.root}/make/lib/swt/gtk-linux-mips64el/swt.jar">
+          <istrue value="${isLinuxMips64el}" /> <!-- FIXME JAU .. hack -->
+        </condition>
         <property name="swt-cocoa-macosx-x86_64.jar" value="${project.root}/make/lib/swt/cocoa-macosx-x86_64/swt-debug.jar"/>  4.修改build-jogl.xml文件,添加如下代码:
 <target name="c.configure.linux.mipsel" if="isLinuxMipsel">
      <echo message="Linux.MIPSEL" />
      <property name="compiler.cfg.id"                     value="compiler.cfg.linux" />
      <property name="linker.cfg.id.os"                    value="linker.cfg.linux.jogl.x11" />
    </target>
+    <target name="c.configure.linux.mips64el" if="isLinuxMipsel">
+      <echo message="Linux.MIPSEL" />
+      <property name="compiler.cfg.id"                     value="compiler.cfg.linux" />
+      <property name="linker.cfg.id.os"                    value="linker.cfg.linux.jogl.x11" />
+    </target>
+   c.configure.linux.mipsel,c.configure.linux.mips64el,c.configure.linux.ppc5.修改build-newt.xml文件,添加如下代码:
 +    <target name="c.configure.linux.mips64el" if="isLinuxMips64el">
+      <echo message="Linux.mips64el" />
+      <property name="compiler.cfg.id"                      value="compiler.cfg.linux" />
+      <condition property="linker.cfg.id.oswin"             value="linker.cfg.linux.newt.x11"
+                                                            else="linker.cfg.linux">
+          <isset property="isX11" />
+      </condition>
+      <echo message="linker.cfg.id.oswin ${linker.cfg.id.oswin}" />
+    </target>
+    c.configure.linux.mipsel,c.configure.linux.mips64el,c.configure.linux.ppc6.在make目录下,使用ant来编译:
 all:
BUILD SUCCESSFUL
Total time: 3 minutes 1 second终于编译成功了!
* 记得将jogl下的jogl-all.jar、nativewindow-natives-linux-mips64el.jar、jogl-all-natives-linux-mips64el.jar,拷贝到worldwind下
第三步:在worldwind下,运行提供的用例。
 [loongson@localhost worldwind-2.0.0]$ chmod +x run-demo.bash
[loongson@localhost worldwind-2.0.0]$ ./run-demo.bash gov.nasa.worldwindx.examples.ApplicationTemplate最终worldwind终于运行起来了!3A2000下拖动页面基本流畅。
为了能够更流畅的查看地图,可以屏蔽终端的输入:
 [loongson@localhost worldwind-2.0.0]$ ./run-demo.bash gov.nasa.worldwindx.examples.ApplicationTemplate &>/dev/null
五、如果您觉得要修改的代码太多,不方便。笔者为你提供了更简单的方法。
1. 下载http://ftp.loongnix.org/others/NasaWorldWind/ 里面有patch文件,还有使用说明。根据说明来修改三个软件包,最后在worldwind目录里输入
./run-demo.bash gov.nasa.worldwindx.examples.ApplicationTemplate