1. Nintendo Switch was Announced!

    March 2017! Begin to save money~ The price maybe $299.99, I can save $60 each month! Till the end of March 2017, I will get $300!

    But, I have a problem...Can I buy one in origin price here? It may not on sale in China...maybe taobao is ...

    read more
  2. LeetCode: 235. Lowest Common Ancestor of a Binary Search Tree

    The problem is here: https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/ . Using recursive function solve this fast, because of the nature of BST. For each node in BST, every node on left is smaller than root and every node on right. Therefore, the ancestor of two nodes in BST must be a ...

    read more
  3. LeetCode: 48. Rotate Image

    The problem is Rotate Image. If I can use more space, just copy the number for original matrix to new matrix. And the rule of rotate 90 degrees is simple, using original y coordinate as new x coordinate, lenght minus x as new y. After copying to new matrix, copy ...

    read more
  4. Install MySQLdb in virtualenv on Ubuntu

    I have install the python-mysqldb on my Ubuntu server, but a missing dependency message alerted when I run a program in virtualenv.

    Then I do as this post and solved my problem:

    $ sudo apt-get build-dep python-mysqldb
    $ source venv/bin/activate
    (venv)$ pip install MySQL-python

    then everything works fine.

    read more
  5. Modify timezone and datetime on Ubuntu

    Some configurations commands for Ubuntu server:

    $ tzselect
    # Since I'm in China, I select the Asia -> China -> Beijing Time
    # The TZ='Asia/Shanghai'
    # Update the localtime profile
    $ sudo cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
    # Update datetime by time center
    $ sudo ntpdate asia.pool.ntp.org
    # Update the hardware ...
    read more
  6. Install Jupyter Environment

    In order to start my own work on data analysis into EDM, I need a development environment of Python Notebook. The process is quite simple:

    Install the virtualenv and related packages:

    $ sudo apt-get install python-virtualenv python-pip python-tk

    Create a virtual environment for project:

    $ cd ~/workspace
    $ virtualenv edm
    $ source edm/bin ...
    read more
  7. Simple Jupyter Python Scripts

    Basic imports

    Import these packages:

    import numpy as np
    import matplotlib.pyplot as plt

    Enable the inline display of graphs

    %pylab inline


    Jupyter Notebook has two different keyboard input modes, which are similar to VIM. I prefer this!

    read more
  8. LeetCode: 125. Valid Palindrome

    The problem is 125. Valid Palindrome. It's quite simple to make a simple one.

    class Solution(object):
        def isPalindrome(self, s):
            :type s: str
            :rtype: bool
            if s == '': return True
            cs = 'abcdefghijklmnopqrstuvwxyz0123456789'
            is_char = lambda c: c in cs
            to_sstr = lambda s: ''.join([ c if is_char(c) else '' for c ...
    read more

« Page 2 / 4 »