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 java.io.Writer; | |
import java.lang.ref.WeakReference; | |
import java.util.ArrayList; | |
import javax.microedition.khronos.egl.EGL10; | |
import javax.microedition.khronos.egl.EGL11; | |
import javax.microedition.khronos.egl.EGLConfig; | |
import javax.microedition.khronos.egl.EGLContext; | |
import javax.microedition.khronos.egl.EGLDisplay; | |
import javax.microedition.khronos.egl.EGLSurface; | |
import javax.microedition.khronos.opengles.GL; |
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
setLayout(new BorderLayout(0, 0)); | |
final GLCanvas canvas = new GLCanvas(); | |
canvas.setMinimumSize(new Dimension()); //fix a GLCanvas resize bug. | |
animator = new Animator(canvas); //TODO switch to FPSAnimator to save energy. | |
canvas.addGLEventListener(OpenglCore.getInstance()); | |
this.add(canvas); |
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 static int getResourceId(Context context, String name) { | |
name = name.toLowerCase(); | |
return context.getResources().getIdentifier(name, "drawable", context.getPackageName()); | |
} |
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
getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); | |
//Full screen, landscape. | |
requestWindowFeature(Window.FEATURE_NO_TITLE); | |
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, | |
WindowManager.LayoutParams.FLAG_FULLSCREEN); | |
if (getRequestedOrientation() != ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE) | |
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); |
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
boolean[] r = new boolean[500]; | |
Arrays.fill(r, false); | |
r[2] = r[3] = r[5] = true; | |
for (int i = 2; i != 100; i++) { | |
if(r[i]) { | |
r[i*2] = r[i*3] = r[i*5] = true; | |
System.out.println(i); | |
} | |
} |
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
64bit JVM 32bit JVM | |
16 8 new Object() | |
216 216 new char[100] | |
16 16 new Integer(1) | |
24 16 new Long(1) | |
24 16 new Double(1) | |
40 40 new ArrayList() |
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
<!DOCTYPE html> | |
<html><head> | |
<meta http-equiv="content-type" content="text/html; charset=UTF8"> | |
<meta name="description" content="URL selfhosting content"> | |
<meta name="keywords" content="self hosting web pages by abusing the url"> | |
<meta name="author" content="MJS 2016-02-25"> | |
<script> | |
LZString=function(){function o(o,r){if(!t[o]){t[o]={};for(var n=0;n<o.length;n++)t[o][o.charAt(n)]=n}return t[o][r]}var r=String.fromCharCode,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$",t={},i={compressToBase64:function(o){if(null==o)return"";var r=i._compress(o,6,function(o){return n.charAt(o)});switch(r.length%4){default:case 0:return r;case 1:return r+"===";case 2:return r+"==";case 3:return r+"="}},decompressFromBase64:function(r){return null==r?"":""==r?null:i._decompress(r.length,32,function(e){return o(n,r.charAt(e))})},compressToUTF16:function(o){return null==o?"":i._compress(o,15,function(o){return r(o+32)})+" "},decompress |
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 final static T get(int value) { | |
for (int i = 0; i < values().length; i++) { | |
if (values()[i].value == value) { | |
return values()[i]; | |
} | |
} | |
return null; | |
} |
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
//https://github.com/drewnoakes/metadata-extractor | |
public class JpegExif { | |
public static void main(String[] args) throws ImageProcessingException, IOException { | |
File file = new File("E:/org_3e1fa47a903c1ccb_1470295646000.jpg"); | |
int w = 4; | |
int h = 3; | |
double rw = 1.0 * w / Math.hypot(w, h); | |
double rh = 1.0 * h / Math.hypot(w, h); |
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
1 CppCon 2015: Bjarne Stroustrup “Writing Good C++14” | |
2 CppCon 2015: Herb Sutter "Writing Good C++14... By Default" | |
3 CppCon 2015: Sean Parent "Better Code: Data Structures" | |
4 CppCon 2015: Chandler Carruth "Tuning C++: Benchmarks, and CPUs, and Compilers! Oh My!" | |
5 CppCon 2015: Eric Niebler "Ranges for the Standard Library" | |
6 CppCon 2015: Vittorio Romeo “Implementation of a component-based entity system in modern C++” | |
7 CppCon 2015: Joel Falcou PART 1 “Expression Templates - Past, Present, Future” | |
8 CppCon 2015: Scott Wardle “Memory and C++ debugging at Electronic Arts” | |
9 CppCon 2015: André Bergner “Faster Complex Numbers” | |
10 CppCon 2015: Louis Dionne “C++ Metaprogramming: A Paradigm Shift" |
OlderNewer