Just another programmer's site

Month: 2月 2015 (page 1 of 2)

SQL: Count Rows Correctly

In T-SQL, aggregate functions(ex. COUNT(), SUM()) return NULL value or raise Error if  all values are NULL or no rows. Here’s query count rows correctly even if all column values are NULL or no rows hit.

* please change “ISNULL” to “IFNULL” in MySQL or SQLite.

Python: format()

In Python3, using format() for string formatting is standard instead using traditional “%” formatting.

>This method of string formatting is the new standard in Python 3, and should be preferred to the % formatting described in String Formatting Operations in new code.

Python: Clear list

Python: tempfile read

Before reading tempfile contents, execute “seek(0)” is needed to point beginning of the file.


Git: checkout from remote branch

git fetch

git checkout -b {branch_name} origin/{branch_name}

Python: String encode

string encode from ‘utf-8’ to ‘cp932’ avoiding “UnicodeDecodeError”


CheckIO: Count “Striped words”

I learned re.split(pattern, text) in CheckIO Count Striped words question.

*Striped word is a word its alphabets sequenced vowels or consonants alternately.


Git: ignore file permission change

By default, git detects file permission change in workspace.

To ignore this, exec the following command.


git config core.filemode false


Python: format

I learned string.format() today.

Python: True or False

I learned all python objects can be classified “True” or “False”.

“”, [], {}, None are evaluated “False”.


Older posts

© 2018

Theme by Anders NorenUp ↑