首页 文章 精选 留言 我的

精选列表

搜索[系统工具],共10000篇文章
优秀的个人博客,低调大师

CNKI知网论文下载工具

之前提到过,可以通过图书馆(大连图书馆办理图书证就可以)的网站访问下载知网的论文。 最近遇到个神器,可以更方便的下载cnki知网的论文。 不多说,直接上下载链接。 链接: https://pan.baidu.com/s/1pMfi6BD 密码: yjkb 下面说说怎么用。 解压,双击运行,出现如下cmd命令框。按照提示来就行, 这里假设我想找“Python”相关的论文,就输入Python。 选择是作者还是摘要还是题目还是只是个关键字? 这里选择标题含有Python的论文,如下,可以翻页显示的。 好啦,下载完成了。 文件完整,可以正常打开。 如果觉得有帮助,点个赞就行了。作为一个持续分享的动力。 ​ 欢迎关注如下微信公众号,获取更多历史文章。

优秀的个人博客,低调大师

JavaUtil_06_DES加解密工具

一、示例 CommonUtil.java package com.ray.test.des; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.Arrays; import sun.misc.BASE64Decoder; import sun.misc.BASE64Encoder; public class CommonUtil { public static void main(String[] args) { byte[] before=new byte[] {80, 75, 3, 4, 10, 60, 82, -83, 68, 8, 0, 28, 0, 80, 97, 121, 108, 108}; String mes=getStringFromBytes(before); byte[] after=getBytesFromString( mes); System.out.println("before= "+Arrays.toString(before)); System.out.println("after = "+Arrays.toString(after)); } public static String getStringFromBytes( byte[] before ) { BASE64Encoder enc=new BASE64Encoder(); String mes=enc.encodeBuffer(before); //使用BASE64编码 return mes; } public static byte[] getBytesFromString( String mes) { BASE64Decoder dec=new BASE64Decoder(); byte[]after=null; try { after =dec.decodeBuffer(mes);//使用BASE64解码 } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return after; } } View Code DESTest.java package com.ray.test.des; import java.io.IOException; import java.security.SecureRandom; import java.util.Arrays; import javax.crypto.Cipher; import javax.crypto.SecretKey; import javax.crypto.SecretKeyFactory; import javax.crypto.spec.DESKeySpec; import sun.misc.BASE64Decoder; import sun.misc.BASE64Encoder; /** * DESTest.java * * @author Techzero * @Email techzero@163.com * @Time 2013-12-12 下午2:22:58 */ public class DESTest { /** * @param args * @throws IOException */ public static void main(String[] args) throws IOException { String content = "wzm"; // 密码长度必须是8的倍数 String password = "12345678"; System.out.println("密 钥:" + password); System.out.println("加密前:" + content); //1.加密 byte[] result = encrypt(content, password); System.out.println("result length:" + result.length); System.out.println("加密后:" + Arrays.toString(result)); //2.解密 String decryResult = decrypt(result, password); System.out.println("解密后:" + decryResult); //3.将字节转String String mes=CommonUtil.getStringFromBytes(result); System.out.println("mes:" + mes); //4.将String转字节 byte[] after=CommonUtil.getBytesFromString(mes); String decryResultString =decrypt(after, password); System.out.println("decryResultString解密后:" + decryResultString); } /** * 加密 * * @param content * 待加密内容 * @param key * 加密的密钥 * @return */ public static byte[] encrypt(String content, String key) { try { SecureRandom random = new SecureRandom(); DESKeySpec desKey = new DESKeySpec(key.getBytes()); SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES"); SecretKey securekey = keyFactory.generateSecret(desKey); Cipher cipher = Cipher.getInstance("DES"); cipher.init(Cipher.ENCRYPT_MODE, securekey, random); byte[] result = cipher.doFinal(content.getBytes()); return result; } catch (Throwable e) { e.printStackTrace(); } return null; } /** * 解密 * * @param content * 待解密内容 * @param key * 解密的密钥 * @return */ public static String decrypt(byte[] content, String key) { try { SecureRandom random = new SecureRandom(); DESKeySpec desKey = new DESKeySpec(key.getBytes()); SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES"); SecretKey securekey = keyFactory.generateSecret(desKey); Cipher cipher = Cipher.getInstance("DES"); cipher.init(Cipher.DECRYPT_MODE, securekey, random); byte[] result = cipher.doFinal(content); return new String(result); } catch (Throwable e) { e.printStackTrace(); } return null; } } View Code 二、参考资料 1.Java DES 加密 解密 示例

优秀的个人博客,低调大师

工具】代码生成器-python脚本

我觉得造轮子这件事情,是谁都可以做的。只不过做得好或者不好而已,用心了做得就要优雅一点。 之前用过java的代码生成器,什么pojodobodbo都能生成,于是我也来自己造一个轮子。 造轮子的事情是没必要做得,费神费心,还没人家做得好,那么我还是要做,就当是体验一把了,看看细节是怎么实现的。 前期准备: 一台装有python、mysql的机器和若干待生成的表。 python版本:3.6.4 python安装mysql模块:pip install pymysql。(python2安装:pip install mysql-python 目标语言:java 待生成表格:为了实现各种数据类型,我们定义一个包含多种数据类型的实体表t_model,数据结构如下。 drop table if exists t_model; create table t_model( f_id varchar(64) primary key not null, --varchar 主键 f_number int null, f_datetime datetime, f_double double ) 目标格式: package com.dyi.po; import java.util.Date; /** * 表t_model模型 * @author WYB * */ public class Model { private String id; private int number; private Date date; private double dble; public Model() { super(); } public Model(String id, int number, Date date, double dble) { super(); this.id = id; this.number = number; this.date = date; this.dble = dble; } /** * * @return */ public String getId() { return id; } public void setId(String id) { this.id = id; } /** * * @return */ public int getNumber() { return number; } public void setNumber(int number) { this.number = number; } /** * * @return */ public Date getDate() { return date; } public void setDate(Date date) { this.date = date; } /** * * @return */ public double getDble() { return dble; } public void setDble(double dble) { this.dble = dble; } } 开始编写脚本 第一步:查询表结构 sql = """ select column_name,data_type,character_maximum_length,column_key,column_comment from information_schema.`COLUMNS` where TABLE_NAME = "%s" """%tableName cursor.execute(sql) tableColumnList = cursor.fetchall() 第二步:分析列的类型 cursor.execute(sql) tableColumnList = cursor.fetchall() modelName = tableName modelName = modelName[modelName.find("_") + 1:] modelName = modelName[0].upper()+modelName[1:] fieldInfoList = [] for col in tableColumnList: colName = col[0] colType = col[1].lower() colLen = col[2] priKey = col[3] comment = col[4] 第三步:拆分字段名,处理细节,生成代码 import pymysql ##连接数据库 db = pymysql.connect("localhost","root","root","stagebo") cursor = db.cursor() def log(str): print(str) def getTableList(): log("开始查询所有数据表...") cursor.execute("show tables") tableList = cursor.fetchall() tList = [] for t in tableList: tList.append(t[0]) return tList def getTableInfo(tableName): log("开始获取表结构") sql = """ select column_name,data_type,character_maximum_length,column_key,column_comment from information_schema.`COLUMNS` where TABLE_NAME = "%s" """%tableName cursor.execute(sql) tableColumnList = cursor.fetchall() modelName = tableName modelName = modelName[modelName.find("_") + 1:] modelName = modelName[0].upper()+modelName[1:] fieldInfoList = [] for col in tableColumnList: colName = col[0] colType = col[1].lower() colLen = col[2] priKey = col[3] comment = col[4] #字段去掉“f_” colName = colName[colName.find("_")+1:] #colName = colName[0].upper()+colName[1:] #判断类型 type = "" if colType in ["varchar","nvarchar"]: type = "String" elif colType == "int": type = "int" elif colType in ["double","float"]: type = "double" pk = False if priKey == "PRI": pk = True fieldInfoList.append([colName,type,pk]) file = open("%s.java"%modelName, "w") code = """ package com.dyi.po; import java.util.*; /** * 表%s模型 * */ """ %tableName code += "public class %s {"%modelName for item in fieldInfoList: code += """ private %s %s; """%(item[1],item[0]) code +=""" /* * 空构造函数 */ public %s(){ super(); } """%modelName code += """ /** *全参数构造函数 */ public %s("""%modelName for item in fieldInfoList: code += "%s %s, "%(item[1],item[0]) code = code[:-1] code += """) { super();""" for item in fieldInfoList: code += """ this.%s = %s;"""%(item[0],item[0]) code += """ }""" for item in fieldInfoList: t = item[1] n = item[0] nu = n[0].upper()+n[1:] code += """ /** * * @return */ public %s get%s(){ return this.%s; } public void set%s(%s %s){ this.%s = %s; } """%(t,nu,n,nu,t,n,n,n) code += "}" file.write(code) file.flush() file.close() if __name__ == "__main__": #查询表 tableList = getTableList() #定义要导出的表 tableToScript = ["t_model"] #开始遍历 for tableName in tableToScript: if tableName not in tableList: continue print(tableName) getTableInfo(tableName) 结果展示 package com.dyi.po; import java.util.*; /** * 表t_model模型 * */ public class Model { private String id; private int number; private date; private double dble; /* * 空构造函数 */ public Model(){ super(); } /** *全参数构造函数 */ public Model(String id, int number, date, double dble,) { super(); this.id = id; this.number = number; this.date = date; this.dble = dble; } /** * * @return */ public String getId(){ return this.id; } public void setId(String id){ this.id = id; } /** * * @return */ public int getNumber(){ return this.number; } public void setNumber(int number){ this.number = number; } /** * * @return */ public getDate(){ return this.date; } public void setDate( date){ this.date = date; } /** * * @return */ public double getDble(){ return this.dble; } public void setDble(double dble){ this.dble = dble; } } 然后流程就通了,一通百通,别的就可以照旧了~~~黑夜给了我黑色的眼睛,我却用它寻找光明

优秀的个人博客,低调大师

完整的抽屉式工具实现

可能大家会遇到一个应用图标过多不好排版也不好处理的问题吧?小马学习了下一个应用图标过多时的一个简单的处理方式,就是用安卓提供的SlidingDrawer来完成漂亮的排版与功能实现,废话不多说,先上效果图再看具体代码实现: 一: 小抽屉未展开时: 二:小抽屉展开时: 三:小抽屉中功能图标过多时(这个好神奇,竟然能自己扩充,激动呀) 四:如果要实现抽屉中不同图标的不同功能时,更简单,直接给GridView的项加事件实现就可以啦,吼吼 下面我们来看下代码实现: packagecom.xiaoma.www; importandroid.app.Activity; importandroid.os.Bundle; importandroid.view.View; importandroid.widget.AdapterView; importandroid.widget.AdapterView.OnItemClickListener; importandroid.widget.GridView; importandroid.widget.ImageView; importandroid.widget.SlidingDrawer; importandroid.widget.Toast; importandroid.widget.SlidingDrawer.OnDrawerCloseListener; importandroid.widget.SlidingDrawer.OnDrawerOpenListener; /** *@Title:SlidingDrawerDemoActivity.java *@Packagecom.xiaoma.www *@Description:抽屉式控件SlidingDrawer的显示与隐藏 *@authorMZH */ publicclassSlidingDrawerDemoActivityActivityextendsActivity{ //声明 privateSlidingDrawersDrawer; privateGridViewgvGridView; //点击小抽屉的小标志哦,不然没得点呐 privateImageViewmyImage1; /** *下面这个两个资源,小马提示下,就是在定义的时候必须一一对应,比如:10:10 *如果少了任何一项的话,会报数组越界异常的,所以稍微注意下 *另外,小马的DEMO本来GridView中内容很少的,但是手闲的,试了下内容撑不下 *一个屏幕时怎么办,没想安卓那么强大,呵,自己扩充,效果图我已经贴上面咯 */ //声明所有图标资源 privateinticons[]={ R.drawable.angry_birds,R.drawable.browser,R.drawable.dropbox, R.drawable.googleearth,R.drawable.lastfm,R.drawable.xiaoma, R.drawable.xbmc,R.drawable.youtube,R.drawable.notes, R.drawable.messages_dock,R.drawable.contacts, R.drawable.facebook,R.drawable.wapedia }; //声明所有图标资源title privateStringitems[]={ "愤怒的小鸟","浏览器","dropbox","谷歌地球","AS","小马果的驴子","嘛东西", "YouTuBe","记事本","消息提示","通讯薄","面谱","WAP" }; /**Calledwhentheactivityisfirstcreated.*/ @Override publicvoidonCreate(BundlesavedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.main); init(); } /** *初始化方法实现 */ privatevoidinit(){ //我的抽屉 sDrawer=(SlidingDrawer)findViewById(R.id.mySliding); //点击抽屉时的小图标 myImage1=(ImageView)findViewById(R.id.myImage1); //抽屉中要显示的内容 gvGridView=(GridView)findViewById(R.id.gridView); //初始化自定义的网格布局适配器并设置到网络布局上 GridViewAdapteradapter=newGridViewAdapter(getApplicationContext(),items,icons); gvGridView.setAdapter(adapter); gvGridView.setOnItemClickListener(newOnItemClickListener(){ @Override publicvoidonItemClick(AdapterView<?>parent,Viewview, intposition,longid){ /** *此处可以实现单击不同图标时的不同功能哦,小马就不多讲废话,简单提示下 */ Toast.makeText(getApplicationContext(), "单击了第"+position+"项",Toast.LENGTH_SHORT).show(); } }); /** *下面给我的抽屉添加两个事件监听器,大家也可以只加载一个,因为考虑到用户体验 *在点击抽屉的小标志打开抽屉时我设置一个打开的图标,关闭时设置关闭图标,这样 *比较好玩,吼吼,下面两个监听大家随意 */ //打开抽屉监听 sDrawer.setOnDrawerOpenListener(newOnDrawerOpenListener(){ @Override publicvoidonDrawerOpened(){ myImage1.setImageResource(R.drawable.close); } }); //关闭抽屉监听 sDrawer.setOnDrawerCloseListener(newOnDrawerCloseListener(){ @Override publicvoidonDrawerClosed(){ myImage1.setImageResource(R.drawable.open); } }); } } 怎么样?简单吧?吼吼,再来看下我们的抽屉主布局,里面有比较重要的两点,大家仔细看下注释: <?xmlversion="1.0"encoding="utf-8"?> <RelativeLayoutxmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/background" android:orientation="vertical"> <!--android:handle指定我们点击抽屉时的小图标,这个必须指定,否则没办法点, 主要是去哪点出来?所以这个属性必须加 android:content指定我们的抽屉里面加载的布局 --> <SlidingDrawer android:id="@+id/mySliding" android:layout_width="fill_parent" android:layout_height="fill_parent" android:handle="@+id/layout1" android:content="@+id/gridView" android:orientation="horizontal" > <LinearLayout android:id="@+id/layout1" android:layout_width="35px" android:layout_height="fill_parent" android:gravity="center_vertical" > <ImageView android:id="@+id/myImage1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/open" /> </LinearLayout> <GridView android:id="@+id/gridView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:numColumns="3" android:gravity="center" /> </SlidingDrawer> </RelativeLayout> 下面再来看下我们对网格布局填充的自定义布局,很简单的,对吧,嘿嘿 <?xmlversion="1.0"encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <ImageView android:id="@+id/icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" /> <TextView android:id="@+id/text" android:layout_width="fill_parent" android:layout_height="20sp" android:gravity="center" android:textColor="@drawable/black" /> </LinearLayout> 最后,老样子,如果小马代码写得太乱,希望看文章的你我多指正,有错必改的,吼吼,谢谢,希望多提意见给小马,这才是对小马最大的帮助,小DEMO源码小马放附件里面了,有用到的朋友可下载改改后,实现自己想要的完美功能吧,加油加油,谢谢 附件:http://down.51cto.com/data/2359704 本文转自华华世界 51CTO博客,原文链接:http://blog.51cto.com/mzh3344258/767188,如需转载请自行联系原作者

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册