Archive

Archive for September, 2009

Free Software, Free Society: Selected Essays of Richard M. Stallman

September 29th, 2009 No comments

Download PDF version

Selected Essays of Richard M. Stallman

Selected Essays of Richard M. Stallman

The intersection of ethics, law, business and computer software is the subject of these essays and speeches by MacArthur Foundation Grant winner, Richard M. Stallman. This collection includes historical writings such as The GNU Manifesto, which defined and launched the activist Free Software Movement, along with new writings on hot topics in copyright, patent law, and the controversial issue of “trusted computing.” Stallman takes a critical look at common abuses of copyright law and patents when applied to computer software programs, and how these abuses damage our entire society and remove our existing freedoms. He also discusses the social aspects of software and how free software can create community and social justice.

Given the current turmoil in copyright and patent laws, including the DMCA and proposed CBDTPA, these essays are more relevant than ever. Stallman tackles head-on the essential issues driving the current changes in copyright law. He argues that for creativity to flourish, software must be free of inappropriate and overly-broad legal constraints. Over the past twenty years his arguments and actions have changed the course of software history; this new book is sure to impact the future of software and legal policies in the years to come.

Lawrence Lessig, the author of two well-known books on similar topics, writes the introduction. He is a noted legal expert on copyright law and a Stanford Law School professor.

Permission is granted to make and distribute verbatim copies of this book provided the copyright notice and this permission notice are preserved on all copies.

Categories: Free books Tags:

CodePress gotcha

September 22nd, 2009 No comments

Doing some PHP recently, I had to use CodePress on a form for editing some code “the nice way”. The problem I had was that on submit the content that I was editing didn’t get submitted at all.

It turns out CodePress “replaces” the textarea you’re giving it with some frame that it uses for syntax coloring and stuff (it’s a little more complicated than this, but this is the basic idea). The issue is that in the end, when submitting the form, it forgets to set the text to the original textarea you had on the page. The solution was to disable the nice editor on submit by calling toggleEditor() on it in the onsubmit or onclick handler of the form’s submit control.

Categories: Programming Tags: , ,

DECIMAL columns with ODBC

September 16th, 2009 No comments

I had to debug a piece of code recently that in short tried to run a query against a database and get the results through ODBC. The problem was that the DECIMAL columns were reported as being NULL, even though they actually had valid values. The procedure was simple and classic:

  • bind the column
  • set the properties (precision, scale)
  • fetch the data

In code it looked something like:

SQLBindCol( statement, columnIndex, SQL_C_NUMERIC, buffer, bufferLen, indicator );

// set the attributes
SQLHDESC desc;
SQLGetStmtAttr( statement, SQL_ATTR_APP_PARAM_DESC, desc, 0, 0 );
SQLSetDescField( desc, columnIndex, SQL_DESC_TYPE, SQL_C_NUMERIC, 0 );
SQLSetDescField( desc, columnIndex, SQL_DESC_PRECISION, precision, 0 );
SQLSetDescField( desc, columnIndex, SQL_DESC_SCALE, scale, 0 );
SQLSetDescField( desc, columnIndex, SQL_DESC_DATA_PTR, buffer, 0 );

(Error checking and other stuff removed, all variables have proper types and values)

What this lead to is that after the fetch the buffer had the right value in it but the indicator parameter was -1, saying the column is NULL.

After about half a day of banging my head against all the walls I could find trying to figure out what was wrong with this, it finally hit me: there was one more thing I had to set (actually re-set – it was already done in the call to SQLBindCol(), or so I thought). Yep, the indicator field needs to be set again:

SQLSetDescField( desc, columnIndex, SQL_DESC_INDICATOR_PTR, indicator, 0 );
SQLSetDescField( desc, columnIndex, SQL_DESC_OCTET_LENGTH_PTR, indicator, 0 );

Once this was added, the indicator started to get the right value after the fetch – problem fixed.

Maybe I’m an idiot who doesn’t know shit so I’m asking: should I have seen or implied this from the documentation? Is there a hint somewhere in MSDN that I completely missed?

Categories: Programming Tags: , , ,