This file contains 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/env python | |
# -*- coding: utf-8 -*- | |
if __name__ == '__main__': | |
main() |
This file contains 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
for(Iterator<Hoge> iter = objList.iterator(); iter.hasNext();){ | |
Hoge obj = iter.next(); | |
if (obj.getId().equals(id)){ | |
return obj; | |
} | |
} |
This file contains 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 getDeviceInfo(){ | |
WindowManager windowmanager = (WindowManager)getSystemService(WINDOW_SERVICE); | |
Display disp = windowmanager.getDefaultDisplay(); | |
deviceWidth = disp.getWidth(); | |
deviceHeight = disp.getHeight(); | |
} |
This file contains 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
import getpass | |
print("enter password for %s" % args.file) | |
password = getpass.getpass() |
This file contains 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 setView(View child){ | |
ViewGroup parent = (ViewGroup) child.getParent(); | |
if (parent != null){ | |
parent.removeView(child); | |
} | |
mainLayout.removeAllViews(); | |
mainLayout.addView(child); | |
} |
This file contains 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
view.invalidate(); | |
final Bitmap bitmap = Bitmap.createBitmap(mapView.getWidth(),view.getHeight(), Bitmap.Config.ARGB_8888); | |
final Canvas canvas = new Canvas(bitmap); | |
view.draw(canvas); | |
imageView.setImageBitmap(bitmap); |
This file contains 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
// Gesture detection | |
mGestureDetector = new GestureDetector(this, new GestureDetector.SimpleOnGestureListener() { | |
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { | |
int dx = (int) (e2.getX() - e1.getX()); | |
// don't accept the fling if it's too short | |
// as it may conflict with a button push | |
if (Math.abs(dx) > MAJOR_MOVE && Math.abs(velocityX) > Math.absvelocityY)) { | |
if (velocityX > 0) { |
This file contains 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
# Math.max | |
var k:Number = Math.max( a, b ); | |
var k:Number = ( a > b )? a : b; | |
# 46.4ms -> 3.5ms | |
# Math.min | |
var k:Number = Math.min( a, b ); | |
var k:Number = ( a < b )? a : b; | |
# 50.2ms -> 3.5ms |
This file contains 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
for(int i=0;i<3;i++) | |
int resId = getResources().getIdentifier("b" + i, "drawable", getPackageName()); |
OlderNewer