Wednesday, June 7, 2017
Thursday, June 1, 2017
Wednesday, May 10, 2017
IDL: 关闭所有文件
代码示例:
1 2 3 4 5 6 7 8 9 10 11 | ;; get all files IDs fids = envi_get_file_ids() size = size(fids) length = size[1] for j = 0L, length-1, 1 do begin ;; to delete the specified file from the hard disk ENVI_FILE_MNG, id = fids[j], /DELETE ;; to remove the specified file from within ENVI Classic ;;ENVI_FILE_MNG, id = fids[j], /REMOVE endfor |
Friday, April 28, 2017
Thursday, April 27, 2017
GOLang: 搭建GO语言IDE
GO的IDE组件包含2部分:
Binary distribution
首先,搭建工作在参考文献[1]下载适用于不同平台的Binary distribution。目标机器是Win7 64bit,所以下载go1.8.1.windows-amd64.msi安装程序。
双击启动安装,本例的安装位置位于C:\Tools\GO,安装结束后须在环境变量Path添加启动位置如C:\Tools\GO\bin,这部分就安装好了。
Liteide
其次,搭建工作在参考文献[2]下载适用于不同平台的安装程序。对应于目标机器,这里下载liteidex31.windows-qt4.zip。下载结束后解压,本程序不需要安装,直接将它放置在一定位置即可。
在~\liteide\bin下,找到liteide.exe并为其创建快捷方式,我将快捷方式置于桌面,方便随时启动该IDE。
检验搭建是否成功只需运行一小段代码即可,请见参考文献[3]。
IDE部分属性配置请见参考文献[4]。
References
Tuesday, April 11, 2017
FFmpeg: Clip Audio Files
Introduction
剪辑音频文件,提取出文件特定时间的音频资料,并且周而复始。
文献[1]示例代码:
1 | ffmpeg -ss 0 -t 30 -i file.mp3 file.wav |
代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | % Created by LI Xu % Version 1.0 % April 11, 2017 % Description: % % If you have any question about this code, % please do not hesitate to contact me via E-mail: % jeremy456@163.com % Blog: % http://blog.sciencenet.cn/u/lixujeremy % http://lixuworld.blogspot.com/ % Reference % http://stackoverflow.com/questions/7945747/how-can-you-only-extract-30-seconds-of-audio-using-ffmpeg clear; clc; timebegin=tic; cur_data=date; cur_time=fix(clock); str1=sprintf('%s %.2d:%.2d:%.2d', cur_data, cur_time(4), cur_time(5), cur_time(6)); fprintf('Time Begin: '); fprintf(str1); fprintf('\n'); % XLS xlspath='AudioInfo.xlsx'; [~, conaud]=xlsread(xlspath); conaud(1, :)=[]; % Source Directory SouDir='input'; % Destination Directory DesDir='output'; % Loop for ii=1:size(conaud, 1) rowrd=conaud(ii, :); filepath=GetFilePath(SouDir, rowrd{1}); if filepath==0 continue; end [~, filename, ext]=fileparts(filepath); inpath=fullfile(SouDir, [filename, ext]); otpath=fullfile(DesDir, [filename, ext]); if exist(otpath, 'file') delete(otpath); end % Start sttm=rowrd{2}; % Finish fitm=rowrd{3}; % Construct Sentence Constr=['ffmpeg -ss ', sttm, ' -t ', fitm, ' -i ', inpath, ' ', otpath]; disp(['...Start to process ', filename, ext, '...']); [stuat, cmdout]=system(Constr); disp(['...Finish ', filename, ext, '...']); end fprintf('Time Begin: '); fprintf(str1); fprintf('\n'); cur_data=date; cur_time=fix(clock); str2=sprintf('%s %.2d:%.2d:%.2d', cur_data, cur_time(4), cur_time(5), cur_time(6)); fprintf('Time End: '); disp(str2); timespan=toc(timebegin); fprintf('Time Span: %.4f s\n', timespan); disp('******************************************'); |
References
Wednesday, February 8, 2017
Tool: CMD执行简单EXE
Introduction
Win系统启动CMD,将CMD当前目录导航至EXE所在文件夹,而后在命令行中键入EXE文件名称,回车执行。执行成功输出一行文字“This is a simple C++ program!”,如Fig. 1。
Fig. 1
或者,在不切换目录的前提下,将EXE文件绝对路径键入命令行执行亦可。
References
Subscribe to:
Posts (Atom)