destinate:怎么在lua中解压文件 时间:2023-01-05 06:52:20 由诗词网小编 分享 复制全文 下载本文 诗词网小编2023-01-05 06:52:20 复制全文 下载全文 目录1.怎么在lua中解压文件2.destinate的意思是什么?3.中文古诗翻译成意大利文4.在Win-TC中,怎么使用命令行参数?5.用MATLAB怎么实现图像的双线性插值6.怎么在lua中解压文件7.java 怎么实现不指定端口号的UDP通信1.怎么在lua中解压文件方法是导出ZipUtils,在ZipUtils里面添加uncompressDir的方法给lua用bool ZipUtils:char* destPath){ if (filename == NULL || destPath == NULL) { CCLOG(","!string outFileName = filename:unzFile zipfile = unzOpen(outFileName.c_str()):outFileName.c_str());Get info about the zip file unz_global_info global_info;&global_info);= UNZ_OK) { CCLOG("outFileName.c_str())!} const int BUFFER_SIZE = 8192,Buffer to hold data read from the zip file char readBuffer[BUFFER_SIZE];CCLOG("start uncompressing"global_info.number_entry;Get info about current file. unz_file_info fileInfo;&fileInfo;NULL,= UNZ_OK) { CCLOG(",can not read file info",std;Check if this entry is a directory or a file. const size_t filenameLength = strlen(fileName);/:/string fileNameStr = std;string(fileName);size_t position = 0;while ((position = fileNameStr.find_;/position)),string:string dirPath = storagePath + fileNameStr.substr(0:position):/:createDirectory(dirPath.c_str())) { CCLOG("/,} position++;= UNZ_OK) { CCLOG("Create a file to store current file. FILE *out = fopen(fullPath.c_str(),wb"can not open destination file %s",fullPath.c_str());/Write current file content to destinate file. int error = UNZ_OK,BUFFER_SIZE);0) { CCLOG("error code is %d"0) { fwrite(readBuffer;error,1,fclose(out);};/global_info.number_entry) { if (unzGoToNextFile(zipfile)!= UNZ_OK) { CCLOG("can not read next file"CCLOG("end uncompressing"return true;}2.destinate的意思是什么?终点3.中文古诗翻译成意大利文春眠不觉晓,处处闻啼鸟,花落知多少。你要知道中国的古诗文化是博大精深的,翻译成外文总是少了个韵味,不管是英文还是什么,就像著名的一道菜非常吉利的一道菜“四喜丸子”翻译成英文是,Four glad meatballs“(四个高兴的肉团) 搞笑的还有很多... 比如蚂蚁上树之类的....希望你喜欢”4.在Win-TC中,怎么使用命令行参数?由于很多人都在问彩色图像的双线性插值程序,这里就给出一个简陋的示例程序,根据具体需要稍做一些修改应该就可以用于其它情况了。完整源程序以及说明请下载附件bilinear_rgb.rar。THE MINIMUM SCALOR == 1.0% Copyright 2006-2007,please contact me via% ybc2084@163 com% read source image into memory,ncols:ncoms]=size(RGB),':scale factor beyond permitted range(1.0 - 9.0)',ERROR'error(',please input scale factor (must between 1.0 - 9.0)'end% display source imageimshow(RGB);GG = uint8(zeros(height,OUT = uint8(zeros(height;width;K;heightScale = 1/K,end if (yy >nrows - 1) yy = nrows - 1:end if (xx/:double(uint16(xx)) == 1.0) && (yy/double(uint16(yy)) == 1.0) % if a a,y) <y) RR(y,BB(y,x) = B(int16(yy),int16(xx));else % a or b is not integer a = double(fix(yy));b) is the base-dot b = double(fix(xx));r12 = double(R(a,r22 = double(R(a+1,RR(y,x) = uint8( (b+1-xx) * ((yy-a)*r21 + (a+1-yy)*r11) + (xx-b) * ((yy-a)*r22 +(a+1-yy) * r12) );g12 = double(G(a,g22 = double(G(a+1,GG(y,b12 = double(B(a,b));b22 = double(B(a+1,b+1));BB(y,x) = uint8( (b+1-xx) * ((yy-a)*b21 + (a+1-yy)*b11) + (xx-b) * ((yy-a)*b22 +(a+1-yy) * b12) );OUT(:OUT(;3) = BB:% show the interplated imageimwrite(OUT,':FreeBSD2.jpg','figure:imshow(OUT),5.用MATLAB怎么实现图像的双线性插值由于很多人都在问彩色图像的双线性插值程序,这里就给出一个简陋的示例程序,根据具体需要稍做一些修改应该就可以用于其它情况了。完整源程序以及说明请下载附件bilinear_rgb.rar。% THIS PROGRAMME IS WRITTEN BY Rockins% THE FEATURE IS BILINEAR-INTERPOLATE THE SOUCE-IMAGE TO GET A DESTINATE-IMAGE% THE MAXIMUM SCALOR == 9.0, THE MINIMUM SCALOR == 1.0% Copyright 2006-2007,All Copyrights(C) Reserved by Rockins% You can redistibute this programme under the GNU Less GPL license% If you have any question about this programme,please contact me via% ybc2084@163 com% read source image into memory,and get the primitive rows and colsRGB = imread('FreeBSD.jpg');R = RGB(:,:,1);G = RGB(:,:,2);B = RGB(:,:,3);[nrows,ncols,ncoms]=size(RGB);% Next line is the scale-factor,the range is 1.0-9.0K = str2double(inputdlg('please input scale factor (must between 1.0 - 9.0)', 'INPUT scale factor', 1, {'5.0'}));% Validatingif (K < 1.0) | (K > 9.0) errordlg('scale factor beyond permitted range(1.0 - 9.0)', 'ERROR'); error('please input scale factor (must between 1.0 - 9.0)');end% display source imageimshow(RGB);% output image width and height are both scaled by factor Kwidth = K * ncols;height = K * nrows;RR = uint8(zeros(height,width));GG = uint8(zeros(height,width));BB = uint8(zeros(height,width));OUT = uint8(zeros(height,width,ncoms));% width scalor and height scalorwidthScale = 1/K;heightScale = 1/K;% bilinear interpolatefor x = K:width-K % this index range is to avoid exceeding the permitted matrix index for y = K:height-K xx = x * widthScale; % xx and yy are the source ordinate,while x and y are the destinate ordinate yy = y * heightScale; if (xx <= 1.0e-8) xx = 1; end if (xx > ncols - 1) xx = ncols - 1; end if (yy <= 1.0e-8) yy = 1; end if (yy > nrows - 1) yy = nrows - 1; end if (xx/double(uint16(xx)) == 1.0) && (yy/double(uint16(yy)) == 1.0) % if a and b is integer,then J(x,y) <- I(x,y) RR(y,x) = R(int16(yy),int16(xx)); GG(y,x) = G(int16(yy),int16(xx)); BB(y,x) = B(int16(yy),int16(xx)); else % a or b is not integer a = double(fix(yy)); % (a,b) is the base-dot b = double(fix(xx)); r11 = double(R(a,b)); r12 = double(R(a,b+1)); r21 = double(R(a+1,b)); r22 = double(R(a+1,b+1)); RR(y,x) = uint8( (b+1-xx) * ((yy-a)*r21 + (a+1-yy)*r11) + (xx-b) * ((yy-a)*r22 +(a+1-yy) * r12) ); g11 = double(G(a,b)); g12 = double(G(a,b+1)); g21 = double(G(a+1,b)); g22 = double(G(a+1,b+1)); GG(y,x) = uint8( (b+1-xx) * ((yy-a)*g21 + (a+1-yy)*g11) + (xx-b) * ((yy-a)*g22 +(a+1-yy) * g12) ); b11 = double(B(a,b)); b12 = double(B(a,b+1)); b21 = double(B(a+1,b)); b22 = double(B(a+1,b+1)); BB(y,x) = uint8( (b+1-xx) * ((yy-a)*b21 + (a+1-yy)*b11) + (xx-b) * ((yy-a)*b22 +(a+1-yy) * b12) ); end endendOUT(:,:,1) = RR;OUT(:,:,2) = GG;OUT(:,:,3) = BB;% show the interplated imageimwrite(OUT, 'FreeBSD2.jpg', 'jpg');figure;imshow(OUT);6.怎么在lua中解压文件方法是导出ZipUtils,在ZipUtils里面添加uncompressDir的方法给lua用bool ZipUtils:char* destPath){ if (filename == NULL || destPath == NULL) { CCLOG(","!string outFileName = filename:unzFile zipfile = unzOpen(outFileName.c_str()):outFileName.c_str());Get info about the zip file unz_global_info global_info;&global_info);= UNZ_OK) { CCLOG("outFileName.c_str())!} const int BUFFER_SIZE = 8192,Buffer to hold data read from the zip file char readBuffer[BUFFER_SIZE];CCLOG("start uncompressing"global_info.number_entry;Get info about current file. unz_file_info fileInfo;&fileInfo;NULL,= UNZ_OK) { CCLOG(",can not read file info",std;Check if this entry is a directory or a file. const size_t filenameLength = strlen(fileName);/:/string fileNameStr = std;string(fileName);size_t position = 0;while ((position = fileNameStr.find_;/position)),string:string dirPath = storagePath + fileNameStr.substr(0:position):/:createDirectory(dirPath.c_str())) { CCLOG("/,} position++;= UNZ_OK) { CCLOG("Create a file to store current file. FILE *out = fopen(fullPath.c_str(),wb"can not open destination file %s",fullPath.c_str());/Write current file content to destinate file. int error = UNZ_OK,BUFFER_SIZE);0) { CCLOG("error code is %d"0) { fwrite(readBuffer;error,1,fclose(out);};/global_info.number_entry) { if (unzGoToNextFile(zipfile)!= UNZ_OK) { CCLOG("can not read next file"CCLOG("end uncompressing"return true;}7.java 怎么实现不指定端口号的UDP通信解决了没有?没有就给个简单的答案给你参考哈哈(记得给分哦):思想就是你想的那样用随机端口的方案:(由于这个端口要求是1024以上的哈)在登录页面(LoginInterface.java)加上这个函数:} 将这个函数的返回值用一个静态变量保存起,以备我们在日后UDPchat.java上使用,同时我们将其放入到用户登录时的USer表中port列下。update user set status='tmpip=',tmpport='",'where usr_id='+ usr_id + "'st.executeUpdate(updatesql);.................................. 在UDPchat页面的构造方法中new 以个thread;用来接收别人发来的数据;其监听端口为自己登陆时所产生的那个随机端口new Thread() {/try { int acceptport = Integer.parseInt(LoginInterface.port);DatagramPacket dp = new DatagramPacket(data;String ip = new String(dp.getAddress().getHostAddress()),String str = new String(dp.getData());From;Port:receive data:receives.add(sum:另外构造一个send 方法用来发送自己的消息;部分代码如下;.............................try { //:send data if (sends.getText().equals(":)) { JOptionPane.showMessageDialog(null;"输入内容不能为空"),} else { int port = Integer.parseInt(MainInterface.port);InetAddress address = InetAddress.getByName(MainInterface.ip);DatagramPacket dp = new;DatagramPacket(buf,address,port);/destinate port ds.send(dp);receives.add("我说:+ sends.getText(),"} finally { ds.close(); 复制全文下载全文 复制全文下载全文