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 Drawable getAPKDrawable(String filePath) { | |
Drawable dr = null; | |
if (filePath != null) { | |
String PATH_PackageParser = "android.content.pm.PackageParser"; | |
String PATH_AssetManager = "android.content.res.AssetManager"; | |
try { | |
Class pkgParserCls = Class.forName(PATH_PackageParser); | |
Class[] typeArgs = new Class[1]; |
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
var generateShortLink = function(space, value) { | |
if (typeof value === 'number') { | |
var result = ''; | |
do { | |
result = space[value % space.length] + result; | |
value = Math.floor(value / space.length); | |
} while (value > 0) | |
} else if (typeof value === 'string') { | |
var result = 0; | |
for (var i = 0; i < value.length; ++i) { |
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
private void logMemory(String callingFunction) | |
{ | |
long max = Runtime.getRuntime().maxMemory() / 1024; | |
if (debugJavaMemory) | |
{ | |
long used = Runtime.getRuntime().totalMemory() / 1024; | |
long available = max - used; | |
long change = available - availableJavaMemoryOld; | |
if (availableJavaMemoryOld != 0) |
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
<?php | |
$api = new apibus(); //创建 ApiBus 对象 | |
$Geo = $api->load( "geoone"); //创建一级地理位置服务对象 | |
// getDriveRoute方法 测试通过 | |
$begin = "121.418687,31.21855"; | |
$end = "121.400263,31.23210"; | |
$drive_route = $Geo->getDriveRoute($begin, $end); | |
echo "drive_rote: "; | |
print_r($drive_route); |
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
var addWxContact = function(wxid, cb) | |
{ | |
if (typeof WeixinJSBridge == 'undefined') return false; | |
WeixinJSBridge.invoke('addContact', { | |
webtype: '1', | |
username: wxid | |
}, function(d) { | |
// 返回d.err_msg取值,d还有一个属性是err_desc | |
// add_contact:cancel 用户取消 | |
// add_contact:fail 关注失败 |
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
#!/usr/bin/python | |
#coding=utf-8 | |
import urllib | |
import urllib2 | |
import re | |
import threading | |
import Queue | |
url = 'https://who.is/whois/name_search/' |
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
void ShuffleArray_Fisher_Yates(char* arr, int len) | |
{ | |
int i = len, j; | |
char temp; | |
if ( i == 0 ) return; | |
while ( --i ) { | |
j = rand() % (i+1); | |
temp = arr[i]; | |
arr[i] = arr[j]; |
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
bd = new BitmapDrawable(tmpInfo.bitmap); | |
try { | |
Method m = BitmapDrawable.class.getMethod( | |
"setTargetDensity", | |
new Class[] { DisplayMetrics.class }); | |
m.invoke(bd, GlobalInfo.currentActivity.getResources() | |
.getDisplayMetrics()); | |
} catch (NoSuchMethodException e) { | |
e.printStackTrace(); |
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
@Override | |
public boolean onQueryTextChange(String searchText) { | |
// 清空上一次的搜索结果 | |
GlobalInfo.searchGameResults.clear(); | |
// 取得搜索结果集 | |
int resultCount = 0; | |
for (HashMap<String, String> item : GlobalInfo.searchGameSet) { | |
if (item.get("game_name").contains(searchText)) { | |
resultCount++; |