Monday, December 26, 2011

C++: "string" to C char*

Apparently there's a built in function for the c++ std::string type:
c_str()


Why does it come up? Things like ifstream are initialized with char* file names, not std::string.

Thursday, December 22, 2011

MS SQL and Python

Had trouble connecting Python to MS SQL Server. Here is the answer!

MS-SQL and Python

In short:
  • Set up your ODBC Data Source Administrator
  • Insert Python code using very built in imports (dbi, odbc)

    Python code:

    import dbi
    import odbc

    query = "SELECT * FROM default_table";
    conn=odbc.odbc("odbc_data_source_admin_name");
    cursor = conn.cursor();
    cursor.execute(query);
    print (cursor.fetchall());
  • Sunday, December 11, 2011

    Slavery and Freedom

    When people impose order on you, they enslave you.
    When you impose order on yourself, you liberate yourself.