1. Install Package Control for Sublime Text 3 (or 2 for Sublime Text 2) 2. Using Package Control, Install LaTeXTools plugin for Sublime Text 3. Using Package Control, Install LaTeXing 3 (or 2 for Sublime Text 2) plugin for Sublime Text 4. Read the documentation for LaTeXing
Author: Idin
MySQL: A list of handy commands
MySQL: Starting MySQL Server (Unsuccessful)
I have installed MySQL on my Macbook Pro some time ago but it didn’t work today. I got the error: ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2) I reinstalled MySQL and got the same error. Eric Dennis on stackoverflow suggested to check if MySQL starts properly by running /usr/local/bin/safe_mysqld. […]
PyCharm: Code Completion
A special variant of the Code Completion feature invoked by pressing ⌃Space twice allows you to complete the name of any class no matter if it was imported in the current file or not. If the class is not imported yet, the import statement is generated automatically.
Python: Binary Search Tree
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
import random class TreeNode: def __init__(self, key): self.key = key self.left = None self.right = None self.p = None class BinaryTree: def __init__(self): self.root = None def length(self): return self.size def inorder(self, node): if node == None: return None else: self.inorder(node.left) print node.key, self.inorder(node.right) |
Python: Static, Class, and Abstract Methods
Julien Danjou has a great guide on how to use static, class, or abstract methods in python.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
# class method class TrackedObject: __id__ = 0 def __init__(self, x, id = None): self.x = x if id != None: self.id = id else: self.id = self.__class__.__id__ self.__class__.__id__ += 1 @classmethod def reset(cls): cls.__id__ = 0 # |