This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| :^) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .gray { | |
| -webkit-filter: grayscale(100%); | |
| -moz-filter: grayscale(100%); | |
| -ms-filter: grayscale(100%); | |
| -o-filter: grayscale(100%); | |
| filter: grayscale(100%); | |
| filter: gray; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* gets the data from a URL */ | |
| function get_data($url) { | |
| $ch = curl_init(); | |
| $timeout = 5; | |
| curl_setopt($ch, CURLOPT_URL, $url); | |
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
| curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout); | |
| curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_2) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.64 Safari/537.11"); | |
| curl_setopt($ch, CURLOPT_REFERER, $url); | |
| $data = curl_exec($ch); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| The commands for mounting the partition and copying the old build.prop from the root of your sdcard are: | |
| $su | |
| # mount -ro remount,rw /system | |
| You don't need to use those though if you are using an app that gets root access. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public void myClickHandler(View view) { | |
| ... | |
| ConnectivityManager connMgr = (ConnectivityManager) | |
| getSystemService(Context.CONNECTIVITY_SERVICE); | |
| NetworkInfo networkInfo = connMgr.getActiveNetworkInfo(); | |
| if (networkInfo != null && networkInfo.isConnected()) { | |
| // fetch data | |
| } else { | |
| // display error | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| http://greencompute.org/instructions.php | |
| 1. 请求接口(GET): | |
| http://ip.taobao.com/service/getIpInfo.php?ip=[ip地址字串] | |
| 2. 响应信息: | |
| (json格式的)国家 、省(自治区或直辖市)、市(县)、运营商 | |
| 3. 返回数据格式: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| String response = ""; | |
| DefaultHttpClient client = new DefaultHttpClient(); | |
| HttpGet httpGet = new HttpGet(url); | |
| try { | |
| HttpResponse execute = client.execute(httpGet); | |
| InputStream content = execute.getEntity().getContent(); | |
| BufferedReader buffer = new BufferedReader(new InputStreamReader(content)); | |
| String s = ""; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public static String md5(String string) { | |
| byte[] hash; | |
| try { | |
| hash = MessageDigest.getInstance("MD5").digest(string.getBytes("UTF-8")); | |
| } catch (NoSuchAlgorithmException e) { | |
| throw new RuntimeException("Huh, MD5 should be supported?", e); | |
| } catch (UnsupportedEncodingException e) { | |
| throw new RuntimeException("Huh, UTF-8 should be supported?", e); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 获取重复的数据 | |
| select title, id, count(*) as count from eslpod group by title having count(*) > 1; | |
| # 删除重复的数据,其中 rowid 为 sqlite 自带字段 | |
| delete from eslpod where eslpod.rowid not in (select max(eslpod.rowid) from eslpod group by | |
| title); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class HelloWorld { | |
| public static void main(String[] args) { | |
| var greet = "Hello, world!"; | |
| System.out.println(greet); | |
| } | |
| } |
OlderNewer