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.

    Saturday, November 26, 2011

    The Product

    Is this the answer? "Sculley believed in keeping people happy and worrying about relationships. Steve didn't give a shit about that. But he did care about the product in a way that Sculley never could, and he was able to avoid having too many bozos working at Apple by insulting anyone who wasn't an A player."

    Friday, November 25, 2011

    8353: Bugs today

    1) Was chasing around this bug for a few hours: for some reason my posts for my navigation bar wouldn't go to the right URL (select_auction.php), except when I was at the right URL (select_auction.php) to begin with. Turns out, I wrote
    action-"select_auction.php"
    What surprises me is the fact that this worked correctly for when I was at select_auction.php. I guess the default behavior for HTML is rather tolerant (redirect confused posts to self) which makes it hard to find bugs!

    Thursday, November 24, 2011

    8352: Bugs today

    1) For MySQL Queries, don't forget the "Quotations that surround text fields" when INSERTing new values
    2) Know when to tinker, and when to use the manual

    Thursday, November 10, 2011

    Quickie on Make Files

    Found it at this quick Makefile Tutorial

    CC=g++
    CFLAGS=-c -Wall
    LDFLAGS=
    SOURCES=main.cpp hello.cpp factorial.cpp
    OBJECTS=$(SOURCES:.cpp=.o)
    EXECUTABLE=hello

    all: $(SOURCES) $(EXECUTABLE)

    $(EXECUTABLE): $(OBJECTS)
    $(CC) $(LDFLAGS) $(OBJECTS) -o $@

    .cpp.o:
    $(CC) $(CFLAGS) $< -o $@