Computer Programming

Yes, a bit specific, but I need to store some links!

OOXML, counter-standardization

Read this site: http://www.noooxml.org/

A site objecting to Microsoft's political promotion of their "open standard" years after the establishment of Open Document Format (ODF), a similar open standard used by the freely available OpenOffice and some other programs.

In response to the promulgation (and relative success) of the ODF formats, Microsoft is pushing OOXML, the confusingly named Office Open XML -- note the order of the two "O" words -- as an international open standard.

ODF is safer than OOXML, because the OpenOffice suite of programs is available in source code. The most popular parser for the ODF formats is always accessible to programmers, so they don't have to puzzle over the subtleties of the ODF.

Subversion Subtlety: A small error with redirects. (Error 301.)

(This isn't really DIY. It's more of a but report.)

I was getting consistent errors on one of my directories.

svn: Commit failed (details follow):
svn: OPTIONS request failed on '/images'
svn: OPTIONS of '/images': 301 Moved Permanently (http://svn.lolitics.org)

The problem was that the svn client was failing to honor the redirect request that sends requests for http://foo/bar to http://foo/bar/ with the trailing slash. I couldn't figure out why it was happening on this directory and not others.

After much research, I found only one reference to a similar problem: http://svn.haxx.se/users/archive-2005-09/0960.shtml

That thread, however, didn't provide the real solution.

The Wacky World of Software Copyright

At the bottom of the page http://www.etherboot.org/wiki/index.php there's a little story that illustrates, partly, why the more politicized internet and tech folks have an aversion to copyright. Typically, copyright is used to defend authors works from plagiarism. In this scenario, it was used to protect intellectual property that, perhaps, doesn't merit protection.

Update

Please note that some of the code for iSCSI booting of Windows has been temporarily taken out of the gPXE codebase at the request of Microsoft Corporation. One necessary part for iSCSI boot in Windows is the iBFT data structure which Microsoft claims is proprietary at this time.

Update 13 March 2007

MS Access: Printing the Range of Data on the Page on a Report

I wanted to print a report that indicated the first and last item on each page, just like a dictionary has. You know: "Azeri - Babcock", "Milk - Minder". It makes it easier to flip through printouts.

This is how to do it. It will put the range in the footer. I haven't figured out how to do one in the header, which is what I originally wanted, but found too difficult to do. (There is probably a way.)

First, take your report, and add an unbound field to your report. Rename it to "Range". See the picture below.

Then, set up event handlers for the On Print event of each section. An explanation follows the picture. Here's my code:

Option Compare Database
Option Explicit
Public FirstRow As String
Public CurrentRow As String

Future Web App Development

Things to read and research:

Adobe Flex
qooxdoo
Silverlight
OpenMocha
Backbase
Google Web Toolkit
Authenteo
WebKit

More info - Ajaxian

Not a framework - Scriptaculous which uses Prototype. (That and JQuery are in another post.)

MS Access: Logging Messages

Here's some code to help you log messages to a table. First, make a table called tblLog, with at least these columns: Timestamp, User, Computer, Message. (You don't need a primary key.)

Set the default value of Timestamp to NOW().

Copy the following code into a code module.

Also, add a reference to "Active DS Type something or other". It has the active directory functions you need to discover the username.

Function StartUp()
    Dim dummy
    dummy = LogOpen()
    DoCmd.OpenForm "frmHidden", acNormal, , , , acHidden
    StartUp = Null
End Function

Function LogOpen()
    LogMessage ("User opened database.")
End Function

Function LogClose()
    LogMessage ("User closed database.")
End Function

Function LogMessage(Mess As String)

MS Access: Application Configuration Settings in Tables

This is a relational way to store application configuration in a table. It uses two tables, so you can store multiple configurations, so that you can use the tool over and over, and still retain the old settings. One table stores configurations, and one stores a since row with the current configuration in use.

Setting values are retrieved from the configuration tables with queries like this:
(SELECT PreRegActivityID FROM Congress7_Config WHERE ID=(SELECT CurrentConfigID FROM Congress7_CurrentConfig))

MS Access: Inserting Blank Rows

This is a way to insert empty or empty-like rows into a list of "seats" that contains not only reservations, but a number saying how many seats a group of people have.

Updating a Combo Box with a Requery

In MS Access, when you want a form containing a foreign key, you typically use a combo box that's populated with data from the foreign table.

Perl Rocks (even yet)

Perl still rocks. People still say it's hard to read (true), but it's because the language is terse.

sub getAccountIdsOfSitesToSuspend
{
    $sql = <<EOQ;
        SELECT account_id
        FROM account
        WHERE
            account.account_balance < (SELECT triggerAmount FROM fk_suspension_rules)
            AND (
                    SELECT IF(SUM(transaction_ammount), SUM(transaction_ammount), 0)
                    FROM transaction
                    WHERE transaction_date > DATE_SUB( CURDATE(),
                        INTERVAL (SELECT paymentWindow FROM fk_suspension_rules) DAY)
                    AND transaction.account_id = account.account_id

jQuery

Nice: http://jquery.com/

A good tutorial at DDJ.

There's going to be a conflict with Prototype, because it also uses $, but differently.

Email Obfuscation and Shielding Script

Here's a perl script that takes email addresses as arguments, and returns javascript code that hides your email address from web spiders. The email address is also linked so it's clickable.

Removing Rows from a Table with Access, for JBlast

The goal is to remove all the bad fax numbers from a JBlast fax list. This applies to any situation where you want to remove one list of data from another list of data. Another way to say it is that you have a full list, and you're trying to remove a sublist from the full list.

The way you do it is by taking the full list, and then doing a JOIN that will add a column that identifies the rows that are present in the sublist. You can do this with a LEFT JOIN. A LEFT JOIN includes all the rows in the left table, in this case, the full list. It matches on a key in the right table, and when there's a match, columns from the right table are included; when there's no match, the columns are set to NULL.

The following image shows a left join in Access.

Coding Tactics, Mysteries of Access

Tactics, tactics, tactics: an essay about how to become a better programmer by studying code. Great analogies.

Why does Access hurt? It's just weird how you can modify the standard controls in Access, but they usually look like crap. You get a lot of control, via the numerous object properties, but, the interface never looks very nice.

MySQL Optimization

Here's a noob-to-noob optimization trick. Suppose you have a database table with, say, 200,000 records, and you regularly select on multiple criteria. The rule for selection is to put the most specific WHERE clause first, and the least specific last. The goal is to cut down the search set to something small, and then search through the smaller set. Get all the queries using this order, then create a composite index over the keys to speed up the search even more.

Here are some before and after shots, based on real queries (from sf-active):

select * from tb where display='t' and parent_id=0 and id > 198000 limit 0,30

After:

select * from tb where id > 198000 and parent_id=0 and display='t' limit 0,30
Syndicate content