Articles in the programming category

  1. [Python] Remove Whitespace From a String

    Posted on in Programming

    >>> print "".join(" hello   world ".split())
    helloworld
    

    The key to the above is that split() separates the string on any amount of whitespace when no separator is specified.

    python

  2. Listing WordPress Database Queries

    Posted on in Programming

    WordPress Horizontal Logo If you need to debug what queries your WordPress site is making, try adding the following PHP to your theme:

    <?php
      foreach ( $wpdb->queries as $query ) {
        echo "$query[0]<br />";
      }
    ?>
    

    For this code to work, you need to add the following line to wp-config.php:

    define('SAVEQUERIES', true);
    

    After that …

  3. Subversion: Revert to Earlier Version

    Posted on in Programming

    This is one of those annoying little things I have to do ever so often. There are two different commands to accomplish this task depending on the specific situation.

    If you've made a lot of changes to a file and need to back all of those changes out, you can …

  4. No such table: django_admin_log

    Posted on in Programming

    If you get this error when trying to save something in the Django admin, it's probably because you forgot to synchronize the database after adding the admin application. If you are using a pre-1.2 version of Django, you can simply:

    $ ./managy.py syncdb
    

    Django 1.2 (which is currently …

  5. Sorting dictionary keys in Python

    Posted on in Programming

    For some reason, sorting a dictionary by its keys seems to be one of the most frequently asked Python questions. I'm not sure if this is because it's just much easier to do in other languages, or if the semantics of the language just confuse new Python developers. I guess …

  6. Suggest Tags WordPress Plugin

    Posted on in Programming

    Fomenteu la lectura\<br /> Photograph by Marc Garrido i PuigFor the last couple of years, I've used the Tag Suggest Thing WordPress plugin to recommend tags for my posts based on the post content. Beginning with WordPress 2.5, that plugin started to have problems interacting with the WordPress administration pages. In August 2009, Yahoo! announced that they would …

  7. Spreadsheets to Databases: Exporting and Importing

    Posted on in Programming

    In the early stages of an organization, it is common for most data to be stored in spreadsheets. Spreadsheet applications are common and easily understood by most small business people. Unfortunately, spreadsheets become burdensome when tasks move beyond calculations and into querying (Churcher, 2007). Fortunately, databases are designed with querying …

  8. Getting Ready to Repackage

    Posted on in Programming

    Hard Disk (Internal)Having built an entire application, the time has come to consider the possibility of redistributing the application for a wider audience. Since the original application was designed to meet the needs of a specific business, one of the primary considerations will be how the application must be modified to meet …

Slaptijack's Koding Kraken