1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
::-webkit-input-placeholder { /* WebKit browsers */ color: #e00; } :-moz-placeholder { /* Mozilla Firefox 4 to 18 */ color: #e00; } ::-moz-placeholder { /* Mozilla Firefox 19+ */ color: #e00; } :-ms-input-placeholder { /* Internet Explorer 10+ */ color: #e00; } |
用阴影实现:
1 |
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus { box-shadow:0 0 0 60px #fff inset; -webkit-text-fill-color: #333; } |
如果不想保存密码的话加个autocomplete="off"到form或者input就行了。 from:http://jinzhe.net/post/26.html
View Details今天碰到了个郁闷的问题,svn执行clean up命令时报错“Previous operation has not finished; run 'cleanup' if it was interrupted”。无论你到那个父层次的目录执行“clean up “,都是报一样的错。执行cleanup时候,提示要cleanup。看来是进入死循环了。 可能是频繁做了一些改名,文件打开的时候更新或者提交操作,导致svn罢工了。这个也该算是svn的bug吧。类似的情况,其实之前也碰到过。之前都是图省事,把整个svn checkout的主目录都删掉,重新checkout来解决的。但是随着项目的深入开展,要更新的文件越来越多。这个问题迟早要解决的,试试看吧。问题的关键看来需要找到死锁的地方,解锁才行。网上查了下资料。Svn的operation是存放在“work queue’“里的。而“work queue’是在内嵌数据库wc.db的work_queue表中的。看看work_queue表中放了些什么,再做处理。 1. 内嵌数据库一般是用sqlite进行轻量级管理的。网上可以下到sqlite-shell-win32-x86: sqlite3.exe 2. 为了方便命令行执行,将sqlite3.exe放到svn 项目的主目录下,和.svn目录同级下。 3. 执行 sqlite3 .svn/wc.db "select * from work_queue".看到有4条记录。就是刚才我执行的一些操作。 226539|(sync-file-flags 93目录名 文件名) 226540|(file-remove 21 .svn/tmp/svn-7B43C232) 226541|(sync-file-flags 目录名 文件名) 226542|(file-remove 21 .svn/tmp/svn-7B48224E) 4. 执行 sqlite3 .svn/wc.db "delete from work_queue". 把队列清空。 5. 执行 sqlite3 .svn/wc.db "select * from work_queue". 确认一下是否已经清空队列,发现已经没有记录显示,说明已经清空了。 6. 最后再试一下,看是否可以 clean up了。果然成功了。 另外还有一种方法别人也推荐,但因为这个成功了就没再试。就是使用命令行工具svn.exe 执行cleanup svn项目目录。因为默认安装的时候,这个命令行工具是不被安装的,所以需要启动安装程序,选择”修改“,选上”命令行工具“才行。估计这个命令的实际效果和上面一种方法是类似的。不过应该比图形界面的右键菜单的更强大些吧。有兴趣可以试试。 顺便补充一下, sqlite是一个非常常用的嵌入式数据库,就是一个db文件。像手机qq等这些软件都会内置一个这样的数据库进行多条数据的管理。 from:http://blog.csdn.net/superch0054/article/details/38668017
View DetailsUbuntu 更改文件夹权限 Ubuntu的许多操作是在终端中进行的,通过sudo命令管理的文件是由root持有权限的,一般用户是无法改变的。在图形界面上,我们可以通过属性中的权限选项夹进行操作。但是一旦文件的属性显示当前用户没有读写权力时,无法在图形界面上修改权限。 M6JLinux联盟 常用方法如下: M6JLinux联盟 sudo chmod 600 ××× (只有所有者有读和写的权限) sudo chmod 644 ××× (所有者有读和写的权限,组用户只有读的权限) sudo chmod 700 ××× (只有所有者有读和写以及执行的权限) sudo chmod 666 ××× (每个人都有读和写的权限) sudo chmod 777 ××× (每个人都有读和写以及执行的权限) M6JLinux联盟 其中×××指文件名(也可以是文件夹名,不过要在chmod后加-ld)。 M6JLinux联盟 解释一下,其实整个命令的形式是 sudo chmod -(代表类型)×××(所有者)×××(组用户)×××(其他用户) M6JLinux联盟 三位数的每一位都表示一个用户类型的权限设置。取值是0~7,即二进制的[000]~[111]。 M6JLinux联盟 这个三位的二进制数的每一位分别表示读、写、执行权限。 M6JLinux联盟 如000表示三项权限均无,而100表示只读。这样,我们就有了下面的对应: 0 [000] 无任何权限 4 [100] 只读权限 6 [110] 读写权限 7 [111] 读写执行权限 M6JLinux联盟 现在看上面的几个常用用法就非常清楚了。试着自己来修改权限吧 M6JLinux联盟 最后同时附上查询文件(或文件夹)权限的命令 ls -l 文件名称 (文件夹将-l改为-ld)。 原文地址:http://liufeng2008.blogspot.com/2008/08/ubuntu.html chmod命令详细用法 指令名称 : chmod 使用权限 : 所有使用者 使用方式 : chmod [-cfvR] [--help] [--version] mode file… 说明 : Linux/Unix 的档案调用权限分为三级 : 档案拥有者、群组、其他。利用 chmod 可以藉以控制档案如何被他人所调用。 参数 : mode : 权限设定字串,格式如下 : [ugoa…][[+-=][rwxX]…][,…],其中 u 表示该档案的拥有者,g 表示与该档案的拥有者属于同一个群体(group)者,o 表示其他以外的人,a 表示这三者皆是。 + 表示增加权限、- 表示取消权限、= 表示唯一设定权限。 r 表示可读取,w 表示可写入,x 表示可执行,X 表示只有当该档案是个子目录或者该档案已经被设定过为可执行。 -c : 若该档案权限确实已经更改,才显示其更改动作 -f : 若该档案权限无法被更改也不要显示错误讯息 -v : 显示权限变更的详细资料 -R : 对目前目录下的所有档案与子目录进行相同的权限变更(即以递回的方式逐个变更) --help : 显示辅助说明 --version : 显示版本 范例 :将档案 file1.txt 设为所有人皆可读取 : chmod ugo+r file1.txt 将档案 file1.txt 设为所有人皆可读取 : chmod a+r file1.txt […]
View Detailseclipse打开当前文件所在文件夹 Run-->External Tools-->External Tools Configurations… new 一个 program Name 里面填:打开当前目录 location 里面填:C:\WINDOWS\explorer.exe Arguments 里面填:${container_loc} 打开文件夹目录 from:http://blog.csdn.net/aerchi/article/details/7102496
View Details在学习Android开发的过程你,你往往会去借鉴别人的应用是怎么开发的,那些漂亮的动画和精致的布局可能会让你爱不释手,作为一个开发者,你可能会很想知道这些效果界面是怎么去实现的,这时,你便可以对改应用的APK进行反编译查看。下面是我参考了一些文章后简单的教程详解。 (注:反编译不是让各位开发者去对一个应用破解搞重装什么的,主要目的是为了促进开发者学习,借鉴好的代码,提升自我开发水平。) 测试环境: win 7 使用工具: CSDN上下载地址: apktool (资源文件获取) 下载 dex2jar(源码文件获取) 下载 jd-gui (源码查看) 下载 Android反编译整合工具包(最新) 下载 官方最新版本下载地址: apktool(google code) dex2jar(google code) jd-gui(google code)最新版请见官方 工具介绍: apktool 作用:资源文件获取,可以提取出图片文件和布局文件进行使用查看 dex2jar 作用:将apk反编译成java源码(classes.dex转化成jar文件) jd-gui 作用:查看APK中classes.dex转化成出的jar文件,即源码文件 反编译流程: 一、apk反编译得到程序的源代码、图片、XML配置、语言资源等文件 下载上述工具中的apktool,解压得到3个文件:aapt.exe,apktool.bat,apktool.jar ,将需要反编译的APK文件放到该目录下, 打开命令行界面(运行-CMD) ,定位到apktool文件夹,输入以下命令:apktool.bat d -f test.apk test (命令中test.apk指的是要反编译的APK文件全名,test为反编译后资源文件存放的目录名称,即为:apktool.bat d -f [apk文件 ] [输出文件夹]) 说明获取成功,之后发现在文件夹下多了个test文件,点击便可以查看该应用的所有资源文件了。 如果你想将反编译完的文件重新打包成apk,那你可以:输入apktool.bat b test(你编译出来文件夹)便可,效果如下: 之后在之前的test文件下便可以发现多了2个文件夹: build dist(里面存放着打包出来的APK文件) 二、Apk反编译得到Java源代码 下载上述工具中的dex2jar和jd-gui ,解压 将要反编译的APK后缀名改为.rar或则 .zip,并解压,得到其中的额classes.dex文件(它就是java文件编译再通过dx工具打包而成的),将获取到的classes.dex放到之前解压出来的工具dex2jar-0.0.9.15 文件夹内, 在命令行下定位到dex2jar.bat所在目录,输入dex2jar.bat classes.dex,效果如下: 在改目录下会生成一个classes_dex2jar.jar的文件,然后打开工具jd-gui文件夹里的jd-gui.exe,之后用该工具打开之前生成的classes_dex2jar.jar文件,便可以看到源码了,效果如下: 被混淆过的效果图(类文件名称以及里面的方法名称都会以a,b,c….之类的样式命名): 三、 […]
View Details这年头找个正经能用的东西那是真难,网上一搜索一大堆,正经能用的没几个,得,最后还是得靠自己,正巧遇上需要AES加解密的地方了,而且还是Java和C#间的相互加解密操作,这里做个备忘 这里采用的加解密使用base64转码方法,ECB模式,PKCS5Padding填充,密码必须是16位,否则会报错哈 模式:Java的ECB对应C#的System.Security.Cryptography.CipherMode.ECB 填充方法:Java的PKCS5Padding对应C#System.Security.Cryptography.PaddingMode.PKCS7 Java和C#版的加解密是互通的,也就是能相互加解密,编码明确指定了采用UTF-8,有需要其他编码方法的请自行扩展 Java版
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 |
package nb.tmall.util; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import javax.crypto.*; import javax.crypto.spec.SecretKeySpec; import sun.misc.*; @SuppressWarnings("restriction") public class EncryptUtil { public static String aesEncrypt(String str, String key) throws Exception { if (str == null || key == null) return null; Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key.getBytes("utf-8"), "AES")); byte[] bytes = cipher.doFinal(str.getBytes("utf-8")); return new BASE64Encoder().encode(bytes); } public static String aesDecrypt(String str, String key) throws Exception { if (str == null || key == null) return null; Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding"); cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(key.getBytes("utf-8"), "AES")); byte[] bytes = new BASE64Decoder().decodeBuffer(str); bytes = cipher.doFinal(bytes); return new String(bytes, "utf-8"); } } |
C#版
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 |
using System; using System.Security.Cryptography; using System.Text; namespace CSharp.Util.Security { /// <summary> /// AES 加密 /// </summary> /// <param name="str"></param> /// <param name="key"></param> /// <returns></returns> public static string AesEncrypt(string str, string key) { if (string.IsNullOrEmpty(str)) return null; Byte[] toEncryptArray = Encoding.UTF8.GetBytes(str); System.Security.Cryptography.RijndaelManaged rm = new System.Security.Cryptography.RijndaelManaged { Key = Encoding.UTF8.GetBytes(key), Mode = System.Security.Cryptography.CipherMode.ECB, Padding = System.Security.Cryptography.PaddingMode.PKCS7 }; System.Security.Cryptography.ICryptoTransform cTransform = rm.CreateEncryptor(); Byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length); return Convert.ToBase64String(resultArray, 0, resultArray.Length); } /// <summary> /// AES 解密 /// </summary> /// <param name="str"></param> /// <param name="key"></param> /// <returns></returns> public static string AesDecrypt(string str, string key) { if (string.IsNullOrEmpty(str)) return null; Byte[] toEncryptArray = Convert.FromBase64String(str); System.Security.Cryptography.RijndaelManaged rm = new System.Security.Cryptography.RijndaelManaged { Key = Encoding.UTF8.GetBytes(key), Mode = System.Security.Cryptography.CipherMode.ECB, Padding = System.Security.Cryptography.PaddingMode.PKCS7 }; System.Security.Cryptography.ICryptoTransform cTransform = rm.CreateDecryptor(); Byte[] resultArray = cTransform.TransformFinalBlock(toEncryptArray, 0, toEncryptArray.Length); return Encoding.UTF8.GetString(resultArray); } } } |
from:http://www.cnblogs.com/lzrabbit/p/3639503.html
View DetailsAES指高级加密标准(Advanced Encryption Standard),是当前最流行的一种密码算法,在web应用开发,特别是对外提供接口时经常会用到,下面是我整理的一套php与java通用的AES加密解密算法。 php版代码如下:
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 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
<?php class CryptAES { protected $cipher = MCRYPT_RIJNDAEL_128; protected $mode = MCRYPT_MODE_ECB; protected $pad_method = NULL; protected $secret_key = ''; protected $iv = ''; public function set_cipher($cipher) { $this->cipher = $cipher; } public function set_mode($mode) { $this->mode = $mode; } public function set_iv($iv) { $this->iv = $iv; } public function set_key($key) { $this->secret_key = $key; } public function require_pkcs5() { $this->pad_method = 'pkcs5'; } protected function pad_or_unpad($str, $ext) { if ( is_null($this->pad_method) ) { return $str; } else { $func_name = __CLASS__ . '::' . $this->pad_method . '_' . $ext . 'pad'; if ( is_callable($func_name) ) { $size = mcrypt_get_block_size($this->cipher, $this->mode); return call_user_func($func_name, $str, $size); } } return $str; } protected function pad($str) { return $this->pad_or_unpad($str, ''); } protected function unpad($str) { return $this->pad_or_unpad($str, 'un'); } public function encrypt($str) { $str = $this->pad($str); $td = mcrypt_module_open($this->cipher, '', $this->mode, ''); if ( empty($this->iv) ) { $iv = @mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND); } else { $iv = $this->iv; } mcrypt_generic_init($td, $this->secret_key, $iv); $cyper_text = mcrypt_generic($td, $str); $rt=base64_encode($cyper_text); //$rt = bin2hex($cyper_text); mcrypt_generic_deinit($td); mcrypt_module_close($td); return $rt; } public function decrypt($str){ $td = mcrypt_module_open($this->cipher, '', $this->mode, ''); if ( empty($this->iv) ) { $iv = @mcrypt_create_iv(mcrypt_enc_get_iv_size($td), MCRYPT_RAND); } else { $iv = $this->iv; } mcrypt_generic_init($td, $this->secret_key, $iv); //$decrypted_text = mdecrypt_generic($td, self::hex2bin($str)); $decrypted_text = mdecrypt_generic($td, base64_decode($str)); $rt = $decrypted_text; mcrypt_generic_deinit($td); mcrypt_module_close($td); return $this->unpad($rt); } public static function hex2bin($hexdata) { $bindata = ''; $length = strlen($hexdata); for ($i=0; $i amp;< $length; $i += 2) { $bindata .= chr(hexdec(substr($hexdata, $i, 2))); } return $bindata; } public static function pkcs5_pad($text, $blocksize) { $pad = $blocksize - (strlen($text) % $blocksize); return $text . str_repeat(chr($pad), $pad); } public static function pkcs5_unpad($text) { $pad = ord($text{strlen($text) - 1}); if ($pad > strlen($text)) return false; if (strspn($text, chr($pad), strlen($text) - $pad) != $pad) return false; return substr($text, 0, -1 * $pad); } } $keyStr = 'UITN25LMUQC436IM'; $plainText = 'this is a string will be AES_Encrypt'; $aes = new CryptAES(); $aes->set_key($keyStr); $aes->require_pkcs5(); $encText = $aes->encrypt($plainText); $decString = $aes->decrypt($encText); echo $encText,"n",$decString; ?> |
运行结果: fhTD0NNIzv4jUEhJuC1htFFXJ/4S/rL6tDCJPiNvJ8mVLHWOD0HWweuxHynxoZf9 this is a string will be AES_Encrypt java版代码如下:
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 |
import java.security.Key; import javax.crypto.Cipher; import javax.crypto.spec.SecretKeySpec; import org.apache.commons.codec.binary.Base64; public class CryptAES { private static final String AESTYPE ="AES/ECB/PKCS5Padding"; public static String AES_Encrypt(String keyStr, String plainText) { byte[] encrypt = null; try{ Key key = generateKey(keyStr); Cipher cipher = Cipher.getInstance(AESTYPE); cipher.init(Cipher.ENCRYPT_MODE, key); encrypt = cipher.doFinal(plainText.getBytes()); }catch(Exception e){ e.printStackTrace(); } return new String(Base64.encodeBase64(encrypt)); } public static String AES_Decrypt(String keyStr, String encryptData) { byte[] decrypt = null; try{ Key key = generateKey(keyStr); Cipher cipher = Cipher.getInstance(AESTYPE); cipher.init(Cipher.DECRYPT_MODE, key); decrypt = cipher.doFinal(Base64.decodeBase64(encryptData)); }catch(Exception e){ e.printStackTrace(); } return new String(decrypt).trim(); } private static Key generateKey(String key)throws Exception{ try{ SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(), "AES"); return keySpec; }catch(Exception e){ e.printStackTrace(); throw e; } } public static void main(String[] args) { String keyStr = "UITN25LMUQC436IM"; String plainText = "this is a string will be AES_Encrypt"; String encText = AES_Encrypt(keyStr, plainText); String decString = AES_Decrypt(keyStr, encText); System.out.println(encText); System.out.println(decString); } } |
运行结果: fhTD0NNIzv4jUEhJuC1htFFXJ/4S/rL6tDCJPiNvJ8mVLHWOD0HWweuxHynxoZf9 this is a string will be AES_Encrypt 转自: http://alunblog.duapp.com/?p=17
View DetailsMounty 这个小软件虽然小但是功能挺实用的. 当你插入 NTFS 硬盘后会提示是否创新加载成读写模式. 尤其是写入模式很重要. 因为 Mac OS X 默认没有开启 NTFS 的写入模式. 这样不在需要安装其他软件就可以对 Windows 的 NTFS 硬盘进行复制文件操作啦. 当有硬盘接入的时候会显示是否装载成写入模式 , 点击 YES 即可. 你会看到 NTFS 硬盘是写入状态了. USB 2.0 写入速度蛮快的. 基本满速. 速度不受影响. 这样加载的文件不在 桌面显示 需要在菜单上显示与安全推出. 下载: Mounty11.dmg from:http://www.macx.cn/thread-2134547-1-1.html
View Details