protected void onAttachedToWindow() This is called when the view is attached to a window. At this point it has a Surface and will start drawing. Note that this function is guaranteed to be called before onDraw(android.graphics.Canvas), however it
函数strlen()和sizeof的区别: #include<stdio.h> #include<stdlib.h> #include<string.h> #define SENTENCE "It is a cat" int main() { char name[40]; gets(name); printf("%s\n", name); printf("The size of name is %zd %d\nThe s
参考这篇文章的代码封装了一个类似Matlab中的magic函数,用来生成魔方矩阵. #!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np def magic(n): row,col=0,n//2 magic=[] for i in range(n): magic.append([0]*n) magic[row][col]=1 for i in range(2,n*n+1): r,l=(row-1+n)%n,(col+1)