文章目录
一、文件预览功能的实现,包括 图片、pdf、word、excel的实现
二、总结
一、文件预览功能的实现,包括 图片、pdf、word、excel的实现
封装组件实现:目前可以实现的文件格式,包括图片
,word支持docx
, excel支持xlsx
,还有pdf
< template>
< div class = "viewItemFile" >
< ! -- 预览文件 -- >
< el- dialog
width= "61%"
class = "viewItemFileDialog"
title= "预 览"
v- model= 'dialogVisible'
: before- close= "handleClose"
: close- on- click- modal= "false"
: close- on- press- escape= "false"
>
< div class = "image" v- if = "props.type == 'JPG' || props.type == 'jpg' || props.type == 'JPEG' || props.type == 'jpeg' || props.type == 'PNG' || props.type == 'png'" >
< div>
< img style= "display: block; max-width: 100%; margin: 0 auto" : src= "imgUrl" alt= "" / >
< / div>
< / div>
< div class = "docWrap" v- if = "props.type == 'docx'" >
< ! -- 预览文件的地方(用于渲染) -- >
< div ref= "file" > < / div>
< / div>
< div v- if = "props.type == 'xlsx'" >
< div class = "tab" >
< el- radio- group size= "small" v- model= "excel.sheetNameActive" @change= "getSheetNameTable" >
< el- radio- button v- for = "(item,index) in excel.sheetNames" : key= "index" : label= "item" > < / el- radio- button>
< / el- radio- group>
< / div>
< div
style= "margin-top: 5px;border: 1px solid #a0a0a0;overflow:auto;" >
< div v- html= "excel.SheetActiveTable" style= "padding: 10px 15px" > < / div>
< / div>
< / div>
< div v- if = "props.type == 'pdf'" >
< iframe
: src= "pdfurl"
type= "application/x-google-chrome-pdf"
width= "100%"
height= "1000px"
/ >
< / div>
< / el- dialog>
< / div>
< / template>
< script setup>
import { ref, nextTick, onMounted, getCurrentInstance, reactive, toRefs} from 'vue'
import * as docx from 'docx-preview'
import XLSX from 'xlsx'
import axios from 'axios' ;
const { proxy } = getCurrentInstance ( ) ;
const typeName = ref ( props. type) ;
const imgUrl = ref ( '' ) ;
const srcList = ref ( ) ;
const loading = ref ( false ) ;
const pdfurl = ref ( '' ) ;
const dialogVisible = ref ( props. showTime) ;
const emits = defineEmits ( ) ;
const emptyTips = ref ( '暂无内容' ) ;
const fullscreen = ref ( false ) ;
const data = reactive ( {
excel : {
workbook : { } ,
sheetNames : [ ] ,
sheetNameActive : "" ,
SheetActiveTable : ""
}
} )
const props = defineProps ( {
showTime : {
type : Boolean,
default : false
} ,
url : {
type : String,
default : ''
} ,
type : {
type : String,
default : 'image'
} ,
clientHeight : {
type : Number,
default : 600
}
} ) ;
const { excel} = toRefs ( data) ;
onMounted ( ( ) => {
console. log ( props. type, '++++' )
init ( props. type) ;
} )
function init ( type ) {
typeName. value = type;
if ( type == "JPG" || type == 'JPEG' || type == 'PNG' || type == 'jpg' || type == 'jpeg' ) {
axios. request ( {
method : "GET" ,
url : props. url,
responseType : "blob" ,
headers : {
Accept : "application/octet-stream" ,
} ,
} )
. then ( ( res ) => {
console. log ( res, 'image' ) ;
if ( res) {
let blob = new Blob ( [ res. data] , { type : "image/jpg" } ) ;
const imageUrl = URL . createObjectURL ( blob) ;
imgUrl. value = imageUrl;
srcList. value = [ imageUrl] ,
loading. value = true ;
} else {
loading. value = false ;
}
} )
. catch ( function ( error ) {
console. log ( error) ;
loading. value = false ;
} ) ;
} else if ( type == "pdf" ) {
axios. request ( {
method : "GET" ,
url : props. url,
responseType : "blob" ,
headers : {
"Content-Type" : "application/pdf;charset=UTF-8" ,
} ,
} )
. then ( ( res ) => {
console. log ( res) ;
if ( res) {
let blob = new Blob ( [ res. data] , { type : "application/pdf" } ) ;
const url = URL . createObjectURL ( blob) ;
console. log ( url) ;
loading. value = false ;
pdfurl. value = url;
} else {
loading. value = false ;
}
} )
. catch ( function ( error ) {
console. log ( error) ;
loading. value = false ;
} ) ;
} else if ( type == "xlsx" ) {
axios. request ( {
method : "GET" ,
url : props. url,
responseType : "arraybuffer" ,
headers : {
"Content-Type" :
"application/vnd.ms-excel;application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" ,
}
} ) . then ( ( res ) => {
console. log ( res, 'res' ) ;
if ( res) {
const workbook = XLSX . read ( new Uint8Array ( res. data) , {
type : "array" ,
} ) ;
const sheetNames = workbook. SheetNames
excel. value. workbook = workbook
excel. value. sheetNames = sheetNames
excel. value. sheetNameActive = sheetNames[ 0 ]
getSheetNameTable ( sheetNames[ 0 ] )
} else {
loading. value = false ;
}
} )
. catch ( function ( error ) {
console. log ( error) ;
loading. value = false ;
} ) ;
} else if ( type == "docx" ) {
axios. request ( {
method : "GET" ,
url : props. url,
responseType : "blob" ,
} )
. then ( ( res ) => {
console. log ( res) ;
if ( res) {
docx. renderAsync ( res. data, proxy. $refs. file) ;
} else {
loading. value = false ;
}
} )
. catch ( function ( error ) {
loading. value = false ;
} ) ;
}
dialogVisible. value = true ;
}
function getSheetNameTable ( sheetName ) {
try {
const worksheet = excel. value. workbook. Sheets[ sheetName]
let htmlData = XLSX . utils. sheet_to_html ( worksheet, { header : '' , footer : '' } )
htmlData = htmlData === '' ? htmlData : htmlData. replace ( / / , ')
htmlData = htmlData === '' ? htmlData : htmlData. replace ( / / , ')
excel. value. SheetActiveTable = htmlData
} catch ( e) {
excel. value. SheetActiveTable = '' + emptyTips. value + ''
}
}
function handleClose ( ) {
emits ( 'update' , false )
}
< / script>
< style lang= "scss" scoped>
. viewItemFile {
. image {
width : 100 % ;
height : 100 % ;
display : flex;
align- items: center;
justify- content: center;
div {
height : 600px;
width : 600px;
}
}
. divContent {
display : flex;
align- items: center;
justify- content: center;
}
v- deep . el- dialog {
margin : 0 ! important;
height : 100vh ! important;
. el- dialog__footer {
margin- bottom: 30px;
padding : 0px;
}
}
v- deep . el- dialog__body {
height : 96 % ;
width : 100 % ;
padding : 0 ;
overflow : auto;
}
}
. viewItemFile {
. file- pre {
height : calc ( 100vh - 40px) ;
padding : 20px;
. table- html- wrap v- deep table {
border- right: 1px solid #e8eaec;
border- bottom: 1px solid #e8eaec;
border- collapse: collapse;
margin : auto;
}
. table- html- wrap v- deep table td {
border- left: 1px solid #e8eaec;
border- top: 1px solid #e8eaec;
white- space: wrap;
text- align: left;
min- width: 100px;
padding : 4px;
}
table {
border- top: 1px solid #EBEEF5 ;
border- left: 1px solid #EBEEF5 ;
width : 100 % ;
overflow : auto;
tr {
height : 44px;
}
td {
min- width: 200px;
max- width: 400px;
padding : 4px 8px;
border- right: 1px solid #EBEEF5 ;
border- bottom: 1px solid #EBEEF5 ;
}
}
. el- tabs-- border- card {
}
. el- tabs-- border- card > . el- tabs__content {
overflow : auto;
height : calc ( 100vh - 110px) ;
}
}
v- deep table {
width : 100 % ! important;
border- collapse: collapse ! important;
border- spacing: 0 ! important;
text- align: center ! important;
border : 0px ! important;
overflow- x: auto ! important;
}
v- deep table tr td {
border- right: 1px solid gray ! important;
border- bottom: 1px solid gray ! important;
width : 300px ! important;
height : 33px ! important;
}
v- deep . excel- view- container {
background- color: #ffffff;
}
v- deep . class4Title {
font- size: 22px ! important;
font- weight: bold ! important;
padding : 10px ! important;
}
v- deep. class4TableTh {
font- weight: bold ! important;
padding : 2px ! important;
background- color: #ccc ! important;
}
}
html body {
width : 100 % ;
height : 100vh;
margin : 0 ;
}
< / style>
二、总结
总结:通过父组件传给子组件文件的后端地址url
,组件通过文件类型来判断不同文件的接收类型,并且组件通过props.url
来接收就可以了。
你可能感兴趣的:(vue3,pdf,word,excel)
pyecharts——绘制柱形图折线图
2224070247
信息可视化 python java 数据可视化
一、pyecharts概述自2013年6月百度EFE(ExcellentFrontEnd)数据可视化团队研发的ECharts1.0发布到GitHub网站以来,ECharts一直备受业界权威的关注并获得广泛好评,成为目前成熟且流行的数据可视化图表工具,被应用到诸多数据可视化的开发领域。Python作为数据分析领域最受欢迎的语言,也加入ECharts的使用行列,并研发出方便Python开发者使用的数据
《Python数据分析实战终极指南》
xjt921122
python 数据分析 开发语言
对于分析师来说,大家在学习Python数据分析的路上,多多少少都遇到过很多大坑**,有关于技能和思维的**:Excel已经没办法处理现有的数据量了,应该学Python吗?找了一大堆Python和Pandas的资料来学习,为什么自己动手就懵了?跟着比赛类公开数据分析案例练了很久,为什么当自己面对数据需求还是只会数据处理而没有分析思路?学了对比、细分、聚类分析,也会用PEST、波特五力这类分析法,为啥
自然语言处理_tf-idf
_feivirus_
算法 机器学习和数学 自然语言处理 tf-idf 逆文档频率 词频
importpandasaspdimportmath1.数据预处理docA="Thecatsatonmyface"docB="Thedogsatonmybed"wordsA=docA.split("")wordsB=docB.split("")wordsSet=set(wordsA).union(set(wordsB))print(wordsSet){'on','my','face','sat',
K近邻算法_分类鸢尾花数据集
_feivirus_
算法 机器学习和数学 分类 机器学习 K近邻
importnumpyasnpimportpandasaspdfromsklearn.datasetsimportload_irisfromsklearn.model_selectionimporttrain_test_splitfromsklearn.metricsimportaccuracy_score1.数据预处理iris=load_iris()df=pd.DataFrame(data=ir
用Python实现读取统计单词个数
程序媛了了
python 游戏 java
完整实例代码:fromcollectionsimportCounterdefpythonit():danci={}withopen("pythonit.txt","r",encoding="utf-8")asf:foriinf:words=i.strip().split()forwordinwords:ifwordnotindanci:danci[word]=1else:danci[word]+=
基于Python给出的PDF文档转Markdown文档的方法
程序媛了了
python pdf 开发语言
注:网上有很多将Markdown文档转为PDF文档的方法,但是却很少有将PDF文档转为Markdown文档的方法。就算有,比如某些网站声称可以将PDF文档转为Markdown文档,尝试过,不太符合自己的要求,而且无法保证文档没有泄露风险。于是本人为了解决这个问题,借助GPT(能使用GPT镜像或者有条件直接使用GPT的,反正能调用GPT接口就行)生成Python代码来完成这个功能。笔记、代码难免存在
vue3中el-table中点击图片放大时,被表格覆盖
叫我小鹏呀
vue.js javascript 前端
问题:vue3中el-table中点击图片放大时,被表格覆盖。解决方法:el-image添加preview-teleported
ARMv8 Debug
__pop_
ARMv8 ARM64 架构 linux 运维
内容来自DEN0024A_v8_architecture_PG.pdf本质ARMv8Debug是什么历史在ARMv4开始被引入,并已发展成一系列广泛的调试(debug1)和跟踪(trace)功能ARMv6和ARMv7-a新增了自托管调试(debug2)和性能评测(trace-enhance)ARMv8处理器提供硬件功能侵入式:调试工具能够对核心活动提供显著级别的控制非侵入式:以非侵入性方式收集有关
ubuntu安装wordpress
lissettecarlr
1安装nginx网上安装方式很多,这就就直接用apt-get了apt-getinstallnginx不用启动啥,然后直接在浏览器里面输入IP:80就能看到nginx的主页了。如果修改了一些配置可以使用下列命令重启一下systemctlrestartnginx.service2安装mysql输入安装前也可以更新一下软件源,在安装过程中将会让你输入数据库的密码。sudoapt-getinstallmy
vue render 函数详解 (配参数详解)
你的眼睛會笑
vue2 vue.js javascript 前端
vuerender函数详解(配参数详解)在Vue3中,`render`函数被用来代替Vue2中的模板语法。它接收一个h函数(或者是`createElement`函数的别名),并且返回一个虚拟DOM。render函数的语法结构如下:render(h){returnh('div',{class:'container'},'Hello,World!')}在上面的示例中,我们使用h函数创建了一个div元素
【Golang】实现 Excel 文件下载功能
RumIV
Golang golang excel 开发语言
在当今的网络应用开发中,提供数据导出功能是一项常见的需求。Excel作为一种广泛使用的电子表格格式,通常是数据导出的首选格式之一。在本教程中,我们将学习如何使用Go语言和GinWeb框架来创建一个Excel文件,并允许用户通过HTTP请求下载该文件。准备工作在开始之前,请确保您的开发环境中已经安装了Go语言和相关的开发工具。此外,您还需要安装GinWeb框架和excelize包,这两个包都将用于我
VUE3 + xterm + nestjs实现web远程终端 或 连接开启SSH登录的路由器和交换机。
焚木灵
node.js vue
可远程连接系统终端或开启SSH登录的路由器和交换机。相关资料:xtermjs/xterm.js:Aterminalfortheweb(github.com)后端实现(NestJS):1、安装依赖:npminstallnode-ssh@nestjs/websockets@nestjs/platform-socket.io2、我们将创建一个名为RemoteControlModule的NestJS模块,
探索ASPICE V3.1:汽车行业软件开发的中文指南
阮懿同
探索ASPICEV3.1:汽车行业软件开发的中文指南ASPICE_V3.1中文版.pdf.zip项目地址:https://gitcode.com/open-source-toolkit/422a2在汽车软件工程领域,高质量的标准对于确保行车安全和提升用户体验至关重要。今天,我们为您介绍一个珍贵的开源宝藏——ASPICEV3.1中文版资源。这是一篇专为国内汽车行业开发者、质量管理者准备的深度解读,旨
golang实现从服务器下载文件到本地指定目录
余生逆风飞翔
golang 服务器 开发语言
一、连接服务器,采用sftp连接模式packagemiddlewaresimport("fmt""time""github.com/pkg/sftp""golang.org/x/crypto/ssh")//建立服务器连接funcConnect(user,password,hoststring,portint)(*sftp.Client,error){var(auth[]ssh.AuthMethod
【Golang】使用 Golang 语言和 excelize 库将数据写入Excel
不爱洗脚的小滕
golang excel 开发语言
文章目录前言一、Excelize简介二、代码实现1.获取依赖2.示例代码三、总结前言在数据处理和分析中,Excel作为一种常见的电子表格格式,被广泛应用于各种场景。然而,如何在Go语言中有效地处理Excel文件呢?在这篇博客中,我将介绍如何使用Go语言和excelize库将数据写入Excel文件。一、Excelize简介Excelize是一个用于读取和写入MicrosoftExcel™(XLSX)
【vite 自动配置路由】
CODER-V
前端 javascript vue.js 前端 软件构建
手动配置路由,是一个没有技术含量又浪费时间的工作。本文将介绍vite构建的vue3项目如何编写一个自动配置路由的脚本。约定大于配置要想使用脚本完成路由的自动配置,我们就需要遵循以下目录规则:每一个页面对应一个包,当前包下的主页面命名为index.vue;每个包里必须配置一个page.js;在每一个page.js里边配置,额外的路由信息,比如:exportdefault{title:'商品',men
Vue3 vant组件库自动导入
不叫虎子
Vue vue.js 前端 javascript 前端框架 typescript
实现:完整使用vant组件库文档安装:#Vue3项目,安装最新版Vantnpmivant#通过yarn安装yarnaddvant#通过pnpm安装pnpmaddvant【一】按需引入:https://vant-contrib.gitee.io/vant/#/zh-CN/quickstart#fang-fa-er.-an-xu-yin-ru-zu-jian-yang-shi【二】批量引入在基于vit
坚持抄书打卡第七天,掌握新技能的一天
爱读书的无业游民
我是爱读书的无业游民hjk,为什么是这个名字呢?因为我想做个无业游民,不上班还能够维持自己的生活开销!今天学会了如何解密pdf,对添加密码的pdf如何进行编辑操作,果然,遇到问题会激发自己学习的欲望,要不就一直没有学习的动力。抄书增长自己的学识,丰富自己的见闻,充实自己,让自己更优秀,同时善于分享,把一些我认为比较好的,有意义的语句分享给大家,如果帮到了大家,欢迎留言讨论!最近看得这本书是中村恒子
python编写直方图和饼图
2301_80421078
python 开发语言
1.直方图#直方图的绘制#语法格式:plt.hist(x,bins),其中x:数据集;bins:统计数据的分布区间importmatplotlib.pyplotaspltimportpandasaspd#导入文件excel=pd.read_excel('成绩.xlsx')#print(excel)#避免乱码plt.rcParams['font.sans-serif']=['SimHei']x=ex
如何在Excel中使用COLUMN函数
Excel客旅
一、COLUMN函数介绍1.COLUMN函数是用来得到指定单元格的列号。比如“=COLUMN(B1)”,得到的就是B1的列号为“2”。2.如果括号里面为空,什么都不引用,则默认引用公式所在单元格的列号。3.COLUMN函数还可以引用区域。首先我们选中B1至F1的单元格区域,然后输入公式“=COLUMN(B:F)”或者“=COLUMN(B1:F1)”,然后按Ctrl+Shift+Enter键。二、用
由于直接在一个回答中提供完整且多语言的游戏商城代码是不现实的(因为每种语言都有其独特的语法和库),我将为你概述一个游戏商城的核心概念,并提供几种不同编程语言的基本框架或示例代码段。
uthRaman
游戏 python 开发语言
商城系统概述hailiangwang.com游戏商城系统通常包含以下部分:用户系统(登录、注册、用户信息)商品列表(游戏、DLC、虚拟货币等)购物车系统支付系统订单系统2.示例框架(伪代码)首先,我们给出一个伪代码框架,描述商城的核心逻辑。plaintextclassUser:deflogin(username,password):#验证用户登录passdefregister(username,p
好看的vue登录页面(附 源代码 背景图)
小小薛定谔
vue.js javascript css 前端
一、效果展示二、代码你好!欢迎回来登录忘记密码?注册exportdefault{name:"MedLogin",data(){return{confirm_disabled:false,loginForm:{no:'',password:''},rules:{no:[{required:true,message:'请输入账号',trigger:'blur'},{min:3,max:6,messag
Python实现mysql命令行
xu-jssy
python mysql adb
一、源码importosimportpymysqldefsql_shell():password=input("EnterPassword:")#访问密码ifpassword.strip()!="yyds":print("Bye")return#清空控制台输出os.system("cls"ifos.name=="nt"else"clear")try:#连接到MySQL数据库conn=pymysql
word转html制作操作手册,Word文档转换为HTML帮助文档操作手册范本.pdf
想吃草莓干
word转html制作操作手册
Word文档转换为HTML帮助文档操作手册一、使用到的软件DOC2CHMDreamweaverCS3Helpandmanual4二、操作步骤1.先建立一个工作目录。如hhwork。2.将需要转换的文件复制到此工作目录下。如果是中文文件名,最好将其改为英文文件名。例:现在要将《小神探点检定修信息管理系统使用手册0.3.6.doc》转换为Html格式的帮助文档,首先将此文档复制到hhwork目录下并将
WORD批量转换器MultiDoc Converter
uolian
工作 word
WORD批量转换器MultiDocConverterhttps://www.52pojie.cn/thread-1318745-1-1.html可批量将doc、docx等文件格式转成doc、docx、pdf、rtf、txt、html、epub等格式。安装包下载地址:https://wws.lanzouj.com/irvVbiz0pkd最终下载文件打包地址(未作成单文件,不确定是否可以直接使用):h
听学长学姐录音有感
dd7ac5aef048
在听学长学姐的录音时,我记下了一些关键词来帮助自己做出总结。首先,办公软件的应用能力是个高频词,无论是税务部门还是企业、银行等,都需要对办公软件的熟练应用来提升办事效率,比较常规的Excel、PS其实是有基础在的,但要更加重视,不要慢慢丢失了这些能力,还要加强使用能力。读写能力、沟通能力也是不断被强调。对于这方面的能力,大学就是最好的训练场,重视每一次写作的锻炼机会,在过程中,你的检索能力、自我学
华为坤灵路由器初始化开局的注意事项,含NAT配置
redmond88
网络技术 华为 服务器 运维
坤灵路由器比较坑,无web界面,全程命令行配置,但是版本更新导致和华为企业路由器配置很多不一样的地方,今天介绍下1、aaa密码复杂度修改:#使能设备对密码进行四选三复杂度检查功能。system-view[HUAWEI]aaa[HUAWEI-aaa]local-aaa-userpasswordpolicyadministrator[HUAWEI-aaa-lupp-admin]passwordcomp
锋哥写一套前后端分离Python权限系统 基于Django5+DRF+Vue3.2+Element Plus+Jwt 视频教程 ,帅呆了~~
java1234_小锋
Python 权限系统 django权限系统 python web权限系统 django DRF VUE权限 python
大家好,我是java1234_小锋老师,最近写了一套【前后端分离Python权限系统基于Django5+DRF+Vue3.2+ElementPlus+Jwt】视频教程,持续更新中,计划月底更新完,感谢支持。视频在线地址:打造前后端分离Python权限系统基于Django5+DRF+Vue3.2+ElementPlus+Jwt视频教程(火爆连载更新中..)_哔哩哔哩_bilibili项目介绍本课程采
Python办公自动化案例(二):对比两个Excel数据内容并标出不同
衍生星球
python excel 高阶办公 办公自动化
案例:对比两个word文档并找出不同。在数据处理和分析的日常工作中,我们经常需要比较两个Excel文件的差异。这可能是为了验证数据的一致性、检查数据的准确性,或者在版本控制中追踪更改。手动比较这些文件不仅耗时,而且容易出错。幸运的是,Python的openpyxl库提供了一种自动化这一过程的方法。步骤1:安装openpyxl在命令行中输入以下命令来安装pipinstallopenpyxl步骤2:编
ResNet的半监督和半弱监督模型
Valar_Morghulis
Billion-scalesemi-supervisedlearningforimageclassificationhttps://arxiv.org/pdf/1905.00546.pdfhttps://github.com/facebookresearch/semi-supervised-ImageNet1K-models/权重在timm中也有:https://hub.fastgit.org/r
开发者关心的那些事
圣子足道
ios 游戏 编程 apple 支付
我要在app里添加IAP,必须要注册自己的产品标识符(product identifiers)。产品标识符是什么?
产品标识符(Product Identifiers)是一串字符串,它用来识别你在应用内贩卖的每件商品。App Store用产品标识符来检索产品信息,标识符只能包含大小写字母(A-Z)、数字(0-9)、下划线(-)、以及圆点(.)。你可以任意排列这些元素,但我们建议你创建标识符时使用
负载均衡器技术Nginx和F5的优缺点对比
bijian1013
nginx F5
对于数据流量过大的网络中,往往单一设备无法承担,需要多台设备进行数据分流,而负载均衡器就是用来将数据分流到多台设备的一个转发器。
目前有许多不同的负载均衡技术用以满足不同的应用需求,如软/硬件负载均衡、本地/全局负载均衡、更高
LeetCode[Math] - #9 Palindrome Number
Cwind
java Algorithm 题解 LeetCode Math
原题链接:#9 Palindrome Number
要求:
判断一个整数是否是回文数,不要使用额外的存储空间
难度:简单
分析:
题目限制不允许使用额外的存储空间应指不允许使用O(n)的内存空间,O(1)的内存用于存储中间结果是可以接受的。于是考虑将该整型数反转,然后与原数字进行比较。
注:没有看到有关负数是否可以是回文数的明确结论,例如
画图板的基本实现
15700786134
画图板
要实现画图板的基本功能,除了在qq登陆界面中用到的组件和方法外,还需要添加鼠标监听器,和接口实现。
首先,需要显示一个JFrame界面:
public class DrameFrame extends JFrame { //显示
linux的ps命令
被触发
linux
Linux中的ps命令是Process Status的缩写。ps命令用来列出系统中当前运行的那些进程。ps命令列出的是当前那些进程的快照,就是执行ps命令的那个时刻的那些进程,如果想要动态的显示进程信息,就可以使用top命令。
要对进程进行监测和控制,首先必须要了解当前进程的情况,也就是需要查看当前进程,而 ps 命令就是最基本同时也是非常强大的进程查看命令。使用该命令可以确定有哪些进程正在运行
Android 音乐播放器 下一曲 连续跳几首歌
肆无忌惮_
android
最近在写安卓音乐播放器的时候遇到个问题。在MediaPlayer播放结束时会回调
player.setOnCompletionListener(new OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer mp) {
mp.reset();
Log.i("H
java导出txt文件的例子
知了ing
java servlet
代码很简单就一个servlet,如下:
package com.eastcom.servlet;
import java.io.BufferedOutputStream;
import java.io.IOException;
import java.net.URLEncoder;
import java.sql.Connection;
import java.sql.Resu
Scala stack试玩, 提高第三方依赖下载速度
矮蛋蛋
scala sbt
原文地址:
http://segmentfault.com/a/1190000002894524
sbt下载速度实在是惨不忍睹, 需要做些配置优化
下载typesafe离线包, 保存为ivy本地库
wget http://downloads.typesafe.com/typesafe-activator/1.3.4/typesafe-activator-1.3.4.zip
解压r
phantomjs安装(linux,附带环境变量设置) ,以及casperjs安装。
alleni123
linux spider
1. 首先从官网
http://phantomjs.org/下载phantomjs压缩包,解压缩到/root/phantomjs文件夹。
2. 安装依赖
sudo yum install fontconfig freetype libfreetype.so.6 libfontconfig.so.1 libstdc++.so.6
3. 配置环境变量
vi /etc/profil
JAVA IO FileInputStream和FileOutputStream,字节流的打包输出
百合不是茶
java核心思想 JAVA IO操作 字节流
在程序设计语言中,数据的保存是基本,如果某程序语言不能保存数据那么该语言是不可能存在的,JAVA是当今最流行的面向对象设计语言之一,在保存数据中也有自己独特的一面,字节流和字符流
1,字节流是由字节构成的,字符流是由字符构成的 字节流和字符流都是继承的InputStream和OutPutStream ,java中两种最基本的就是字节流和字符流
类 FileInputStream
Spring基础实例(依赖注入和控制反转)
bijian1013
spring
前提条件:在http://www.springsource.org/download网站上下载Spring框架,并将spring.jar、log4j-1.2.15.jar、commons-logging.jar加载至工程1.武器接口
package com.bijian.spring.base3;
public interface Weapon {
void kil
HR看重的十大技能
bijian1013
提升 能力 HR 成长
一个人掌握何种技能取决于他的兴趣、能力和聪明程度,也取决于他所能支配的资源以及制定的事业目标,拥有过硬技能的人有更多的工作机会。但是,由于经济发展前景不确定,掌握对你的事业有所帮助的技能显得尤为重要。以下是最受雇主欢迎的十种技能。 一、解决问题的能力 每天,我们都要在生活和工作中解决一些综合性的问题。那些能够发现问题、解决问题并迅速作出有效决
【Thrift一】Thrift编译安装
bit1129
thrift
什么是Thrift
The Apache Thrift software framework, for scalable cross-language services development, combines a software stack with a code generation engine to build services that work efficiently and s
【Avro三】Hadoop MapReduce读写Avro文件
bit1129
mapreduce
Avro是Doug Cutting(此人绝对是神一般的存在)牵头开发的。 开发之初就是围绕着完善Hadoop生态系统的数据处理而开展的(使用Avro作为Hadoop MapReduce需要处理数据序列化和反序列化的场景),因此Hadoop MapReduce集成Avro也就是自然而然的事情。
这个例子是一个简单的Hadoop MapReduce读取Avro格式的源文件进行计数统计,然后将计算结果
nginx定制500,502,503,504页面
ronin47
nginx 错误显示
server {
listen 80;
error_page 500/500.html;
error_page 502/502.html;
error_page 503/503.html;
error_page 504/504.html;
location /test {return502;}}
配置很简单,和配
java-1.二叉查找树转为双向链表
bylijinnan
二叉查找树
import java.util.ArrayList;
import java.util.List;
public class BSTreeToLinkedList {
/*
把二元查找树转变成排序的双向链表
题目:
输入一棵二元查找树,将该二元查找树转换成一个排序的双向链表。
要求不能创建任何新的结点,只调整指针的指向。
10
/ \
6 14
/ \
Netty源码学习-HTTP-tunnel
bylijinnan
java netty
Netty关于HTTP tunnel的说明:
http://docs.jboss.org/netty/3.2/api/org/jboss/netty/channel/socket/http/package-summary.html#package_description
这个说明有点太简略了
一个完整的例子在这里:
https://github.com/bylijinnan
JSONUtil.serialize(map)和JSON.toJSONString(map)的区别
coder_xpf
jquery json map val()
JSONUtil.serialize(map)和JSON.toJSONString(map)的区别
数据库查询出来的map有一个字段为空
通过System.out.println()输出 JSONUtil.serialize(map): {"one":"1","two":"nul
Hibernate缓存总结
cuishikuan
开源 ssh javaweb hibernate缓存 三大框架
一、为什么要用Hibernate缓存?
Hibernate是一个持久层框架,经常访问物理数据库。
为了降低应用程序对物理数据源访问的频次,从而提高应用程序的运行性能。
缓存内的数据是对物理数据源中的数据的复制,应用程序在运行时从缓存读写数据,在特定的时刻或事件会同步缓存和物理数据源的数据。
二、Hibernate缓存原理是怎样的?
Hibernate缓存包括两大类:Hib
CentOs6
dalan_123
centos
首先su - 切换到root下面1、首先要先安装GCC GCC-C++ Openssl等以来模块:yum -y install make gcc gcc-c++ kernel-devel m4 ncurses-devel openssl-devel2、再安装ncurses模块yum -y install ncurses-develyum install ncurses-devel3、下载Erang
10款用 jquery 实现滚动条至页面底端自动加载数据效果
dcj3sjt126com
JavaScript
无限滚动自动翻页可以说是web2.0时代的一项堪称伟大的技术,它让我们在浏览页面的时候只需要把滚动条拉到网页底部就能自动显示下一页的结果,改变了一直以来只能通过点击下一页来翻页这种常规做法。
无限滚动自动翻页技术的鼻祖是微博的先驱:推特(twitter),后来必应图片搜索、谷歌图片搜索、google reader、箱包批发网等纷纷抄袭了这一项技术,于是靠滚动浏览器滚动条
ImageButton去边框&Button或者ImageButton的背景透明
dcj3sjt126com
imagebutton
在ImageButton中载入图片后,很多人会觉得有图片周围的白边会影响到美观,其实解决这个问题有两种方法
一种方法是将ImageButton的背景改为所需要的图片。如:android:background="@drawable/XXX"
第二种方法就是将ImageButton背景改为透明,这个方法更常用
在XML里;
<ImageBut
JSP之c:foreach
eksliang
jsp forearch
原文出自:http://www.cnblogs.com/draem0507/archive/2012/09/24/2699745.html
<c:forEach>标签用于通用数据循环,它有以下属性 属 性 描 述 是否必须 缺省值 items 进行循环的项目 否 无 begin 开始条件 否 0 end 结束条件 否 集合中的最后一个项目 step 步长 否 1
Android实现主动连接蓝牙耳机
gqdy365
android
在Android程序中可以实现自动扫描蓝牙、配对蓝牙、建立数据通道。蓝牙分不同类型,这篇文字只讨论如何与蓝牙耳机连接。
大致可以分三步:
一、扫描蓝牙设备:
1、注册并监听广播:
BluetoothAdapter.ACTION_DISCOVERY_STARTED
BluetoothDevice.ACTION_FOUND
BluetoothAdapter.ACTION_DIS
android学习轨迹之四:org.json.JSONException: No value for
hyz301
json
org.json.JSONException: No value for items
在JSON解析中会遇到一种错误,很常见的错误
06-21 12:19:08.714 2098-2127/com.jikexueyuan.secret I/System.out﹕ Result:{"status":1,"page":1,&
干货分享:从零开始学编程 系列汇总
justjavac
编程
程序员总爱重新发明轮子,于是做了要给轮子汇总。
从零开始写个编译器吧系列 (知乎专栏)
从零开始写一个简单的操作系统 (伯乐在线)
从零开始写JavaScript框架 (图灵社区)
从零开始写jQuery框架 (蓝色理想 )
从零开始nodejs系列文章 (粉丝日志)
从零开始编写网络游戏 
jquery-autocomplete 使用手册
macroli
jquery Ajax 脚本
jquery-autocomplete学习
一、用前必备
官方网站:http://bassistance.de/jquery-plugins/jquery-plugin-autocomplete/
当前版本:1.1
需要JQuery版本:1.2.6
二、使用
<script src="./jquery-1.3.2.js" type="text/ja
PLSQL-Developer或者Navicat等工具连接远程oracle数据库的详细配置以及数据库编码的修改
超声波
oracle plsql
在服务器上将Oracle安装好之后接下来要做的就是通过本地机器来远程连接服务器端的oracle数据库,常用的客户端连接工具就是PLSQL-Developer或者Navicat这些工具了。刚开始也是各种报错,什么TNS:no listener;TNS:lost connection;TNS:target hosts...花了一天的时间终于让PLSQL-Developer和Navicat等这些客户
数据仓库数据模型之:极限存储--历史拉链表
superlxw1234
极限存储 数据仓库 数据模型 拉链历史表
在数据仓库的数据模型设计过程中,经常会遇到这样的需求:
1. 数据量比较大; 2. 表中的部分字段会被update,如用户的地址,产品的描述信息,订单的状态等等; 3. 需要查看某一个时间点或者时间段的历史快照信息,比如,查看某一个订单在历史某一个时间点的状态, 比如,查看某一个用户在过去某一段时间内,更新过几次等等; 4. 变化的比例和频率不是很大,比如,总共有10
10点睛Spring MVC4.1-全局异常处理
wiselyman
spring mvc
10.1 全局异常处理
使用@ControllerAdvice注解来实现全局异常处理;
使用@ControllerAdvice的属性缩小处理范围
10.2 演示
演示控制器
package com.wisely.web;
import org.springframework.stereotype.Controller;
import org.spring