The number of times the pasteboard’s contents have changed.
Whenever the contents of a pasteboard changes—specifically, when pasteboard items are added, modified, or removed—UIPasteboard increments the value of this property. After it increments the change count, UIPasteboard posts the notifications named UIPasteboardChangedNotification (for additions and modifications) and UIPasteboardRemovedNotification (for removals). These notifications include (in the userInfo dictionary) the types of the pasteboard items added or removed. Because UIPasteboard waits until the end of the current event loop before incrementing the change count, notifications can be batched. The class also updates the change count when an app reactivates and another app has changed the pasteboard contents. When users restart a device, the change count is reset to zero.
var levelOrder = function(root) { if (!root) { return; }
let queue = []; queue.unshift(root);
while(queue.length > 0) { let pointNode = queue.pop(); console.log(pointNode.value);
if (pointNode.left) { queue.unshift(pointNode.left) }
if (pointNode.right) { queue.unshift(pointNode.right); } } }
var tree = new TreeNode(3); tree.left = new TreeNode(9); tree.right = new TreeNode(20); tree.right.left = new TreeNode(15); tree.right.right = new TreeNode(7);
let depth = maxDepth(tree); console.log("depth:"+depth);
console.log("pre order:"); preOrder(tree);
console.log("mid order:"); midOrder(tree)
console.log("post order:"); postOrder(tree)
console.log("pre order without recursion"); preOrderWithoutRescursion(tree);
console.log("mid order without recursion"); midOrderWithoutRescursion(tree);
console.log("post order without recursion"); postOrderWithoutRescursion(tree);
###Initializing a Class class func initialize() Initializes the class before it receives its first message.
he runtime sends initialize() to each class in a program just before the class, or any class that inherits from it, is sent its first message from within the program. Superclasses receive this message before their subclasses. The runtime sends the initialize() message to classes in a thread-safe manner. That is, initialize() is run by the first thread to send a message to a class, and any other thread that tries to send a message to that class will block until initialize() completes. The superclass implementation may be called multiple times if subclasses do not implement initialize()—the runtime will call the inherited implementation—or if subclasses explicitly call [super initialize]. If you want to protect yourself from being run multiple times, you can structure your implementation along these lines:
1 2 3 4 5
+ (void)initialize { if (self == [ClassName self]) { // ... do the initialization ... } }
Because initialize() is called in a blocking manner, it’s important to limit method implementations to the minimum amount of work necessary possible. Specifically, any code that takes locks that might be required by other classes in their initialize() methods is liable to lead to deadlocks. Therefore, you should not rely on initialize() for complex initialization, and should instead limit it to straightforward, class local initialization.
initialize() is invoked only once per class. If you want to perform independent initialization for the class and for categories of the class, you should implement load() methods.
###class func load() Invoked whenever a class or category is added to the Objective-C runtime; implement this method to perform class-specific behavior upon loading.
The load() message is sent to classes and categories that are both dynamically loaded and statically linked, but only if the newly loaded class or category implements a method that can respond. The order of initialization is as follows:
1. All initializers in any framework you link to.
2. All +load methods in your image.
3. All C++ static initializers and C/C++ __attribute__(constructor) functions in your image.
4. All initializers in frameworks that link to you.
In addition:
* A class’s +load method is called after all of its superclasses’ +load methods.
* A category +load method is called after the class’s own +load method.
In a custom implementation of load() you can therefore safely message other unrelated classes from the same image, but any load() methods implemented by those classes may not have run yet.
导入数据遇到的:ERROR : (2006, 'MySQL server has gone away') 意思就是连接断开了。
主要看下面几个参数:
1.是否重启过,如果uptime太短就是最近重启过
1 2 3 4 5 6 7
MariaDB [(none)]> show global status like 'uptime'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | Uptime | 68600 | +---------------+-------+ 1 row in set (0.93 sec)
MariaDB [(none)]> show global status like 'com_kill'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | Com_kill | 10 | +---------------+-------+ 1 row in set (0.00 sec) MariaDB [(none)]> show global variables like 'max_allowed_packet'; +--------------------+---------+ | Variable_name | Value | +--------------------+---------+ | max_allowed_packet | 1048576 | +--------------------+---------+ 1 row in set (0.01 sec)
那就设置大一点儿就行了,这个也可以在上面的那个文件里修改:
1 2 3 4 5 6 7 8 9 10
MariaDB [(none)]> set global max_allowed_packet=1024*1024*16; Query OK, 0 rows affected (0.03 sec)
MariaDB [(none)]> show global variables like 'max_allowed_packet'; +--------------------+----------+ | Variable_name | Value | +--------------------+----------+ | max_allowed_packet | 16777216 | +--------------------+----------+ 1 row in set (0.00 sec)