-
First, create a table in your database into which you will import the CSV file. After the table is created:
-
Log in to your database using SQL Server Management Studio.
-
Right click the database and select Tasks -> Import Data... Click the Next > button.
-
For Data Source, select Flat File Source. Then use the Browse button to select the CSV file. Spend some time configuring the data import before clicking the Next > button.
-
For Destination, select the correct database provider (e.g. for SQL Server 2012, you can use SQL Server Native Client 11.0). Enter the Server name; check Use SQL Server Authentication, enter the User name, Password, and Database before clicking the Next > button.
-
In the Select Source Tables and Views window, you can Edit Mappings before clicking the Next > button.
-
Check Run immediately and click the Next > button.
-
Click the Finish button to run the package.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Borg: | |
_shared_state = {} | |
def __init__(self): | |
self.__dict__ = self._shared_state |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git checkout . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from itertools import izip // you may also just use zip | |
l = [(1, 2), (3, 4), (5, 6), (7, 8), (9, 0)] | |
result = [sum(x) for x in izip(*l)] | |
print(result) | |
>>> [25, 20] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shutil | |
shutil.rmtree(role_fs_path, ignore_errors=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bisect | |
def get_neighbours(num, interval): | |
interval = set(interval) | |
interval.discard(num) | |
interval = list(interval) | |
interval.sort() | |
if num < interval[0] or interval[-1] < num: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> ["foo", "bar", "baz"].index("bar") | |
1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_active_view(self): | |
"""Return the active view in the currently active window.""" | |
return sublime.active_window().active_view() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Write this: | |
if (mark.a, mark.b) == (region.a, region.b): | |
... | |
# much cleaner than: | |
if mark.a == region.a and mark.b == region.b: | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
l0 = {} | |
l1 = l0.setdefault("key_l1", {}) | |
l2 = l1.setdefault("key_l2", []) | |
l2.append("3") | |
{'key_l1': {'key_l2': ['3']}} |