[Author: ming.lian] [Sun, 2013-08-11, 17:44] [1896 views]
Open a file:
f = open('filename', 'r')
'r' means read only and if it is 'w', it means write only.
'rb' -> read binary
'wb' -> write binary
'w+' write append
f.write("I am an engineer.")
f.write(str) -> write a string.
f.read() -> read all.
f.read(size) -> the size is the count that how ... see full article
[Author: Dingyu] [Sun, 2013-08-11, 17:44] [2500 views]
I know two ways to find records with non-printable characters in T-SQL. The first way, use the "like" statement to do it:
SELECT * FROM tableName
WHERE (columnName COLLATE Latin1_General_BIN2) like '%[^' + CHAR(32) + '-' + CHAR(126) + CHAR(9) + CHAR(10) + CHAR(13) + ']%'
The second way, use the "PAT ... see full article
[Author: xiaotian.li] [Sun, 2013-08-11, 17:43] [1952 views]
Here I'm going to introduce 2 ways of installing python module for import.
1. Using easy_install
Easy Install is a python module (easy_install) bundled with setuptools that lets you automatically download, build, install, and manage Python packages.
Add path to system variables.
Go to "C ... see full article
[Author: xiaotian.li] [Sun, 2013-08-11, 17:43] [2319 views]
First, make sure you have downloaded an appropriate Python version from http://www.python.org/download/
Next are the instructions targeted at Eclipse 3.5 onwards.
1. To install PyDev and PyDev Extensions using the Eclipse Update Manager,
Go to: Help > Install New Software... menu.
2. In the next sc ... see full article
[Author: Dingyu] [Sun, 2013-08-11, 17:43] [3889 views]
In Rails 3, the primary key in a database table is very important. Rails model ActiveRecord functions, like save, destroy, update_attributes, and so on, require it to invoke callbacks. Rails 3 uses the column 'id' as a default primary key in a database table. However, in MySQL, only the primary key ... see full article
[Author: Dingyu] [Sun, 2013-08-11, 17:43] [1265 views]
I copied this article from a Stockflow post. Click here to see the original Stockflow post.
Let's say you have a class Person.
person = Person.new
person.name # no method error
Obviously we never defined method name. Let's do that.
@name # simpl ... see full article