Archive for February, 2006

NYC BarCamp

Ok, it is of course the case that being around a bunch of geeks is talking technology is going to get my ass in gear to actually do some house cleaning.

Specifically, some really good stuff seems to be appearing from the NYC Barcamp. I hadn’t heard about the Drupal Guild before, and honestly I’m really excited about it. As a person who deploys drupal all the time, I’m extremely excited to see a more formal structure around the development community of drupal. It seems like this could:

  • improve the longevity of the project
  • create more of a sense of legitamcy to a project
  • tie organizations that are leveraging drupal together and encourage more direct support of the project
  • There is a bunch more that I think that this can do. I’m really excited about it ultimately

    Comments

    Summers Quits Harvard

    The man who once said: “‘Dirty Industries’: Just between you and me, shouldn’t the World Bank be encouraging MORE migration of the dirty industries to the LDCs [Less Developed Countries]? I can think of three reasons…”

    I wrote about this here back when he was saying stupid things about women.

    BBC NEWS | Americas | Beleaguered Harvard head to quit

    Comments

    More Craig’s List Scamming

    Ugh. Selling something else, and, yet another scam. Here’s the details on this one:

    My post: http://newyork.craigslist.org/brk/sys/135483890.html

    The first email:

    Hello i have intrest in buying your Mac which am pok with your fixed price get back to me with more dettails and how and where we can meet for pick up. Thankz

    I responded by suggesting a place to meet. Of course, now comes the revelation that they aren’t near by:

    Hello i am in florida i wont be able to come down but i can send you a bank of america money order which will be deliverd at your home address and i will wait till you confirm the money order before you ship it out just get back to me with your full name and valid addrress so i can send out the money order today and dont worry about the shipping i will be paying for that myself with fedex private shipping account. am waiting to read from you soon

    The dead give away is the florida/fedex combo. And within a few minutes I receive the following. You can clearly see that they are using “boa.com” for bank of america, yet a quick check of http://boa.com/ makes it pretty clear that this isn’t a bank. Interestingly, looks like the user sending stuff is darec@islamabad.net. I removed my email and address from this, but I don’t think it’s really needed to see what’s going on here.

    Here are the headers from the email I received:

    Return-Path:

    Received: from 127.0.0.1 by freemail (envelope-from , uid 1020) with qmail-scanner-1.24
    (
    Clear:RC:1(127.0.0.1):.
    Processed in 0.220363 secs); 21 Feb 2006 00:17:58 -0000
    Received: from localhost (HELO wapda.com) (127.0.0.1)
    by 0 with SMTP; 21 Feb 2006 00:17:58 -0000
    X-MessageWall-Score: 0 (wapda.com)
    Received: from [209.71.203.5] by wapda.com (MessageWall 1.0.9) with SMTP; 21 Feb 2006 0:17:58 -0000
    Received: from 192.116.71.104 (proxying for 192.168.0.5, 192.116.71.104)
    (SquirrelMail authenticated user darec@islamabad.net)
    by webmail.islamabad.net with HTTP;
    Mon, 20 Feb 2006 19:17:58 -0500 (EST)
    Message-ID: <34790.192.116.71.104.1140481078.squirrel@webmail.islamabad.net>
    Date: Mon, 20 Feb 2006 19:17:58 -0500 (EST)
    Subject: ******Your Money Order #$500 Has Been Approved*******
    From: “Bank Of America”
    User-Agent: SquirrelMail/1.4.2
    MIME-Version: 1.0
    Content-Type: text/html;charset=iso-8859-1
    Content-Transfer-Encoding: 8bit
    X-Priority: 3
    Importance: Normal
    X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at eggplantmedia.com

    Here’s the html version of the email:

    Bank of America Higher Standards Home

    Dear
    Arthur,

    Bank Of America hereby congratulate you and at the same time informing you that the Money Order sent to you from Beckham Zizo has been Approved, Money
    Order SM:$500.00.

     
    Auction Item: Mini Mac
    Auction Site: Craigslist.org

    Order Number:
    845645794

     Payment status is listed below:-

    Billed from:

    Buyer’s Billing
    Informations:-


    Name:
     Beckham Zizo 
    Address: 2829 Forestbrook Dr  North

    City: Lakeland
    State: FL

    Zip Code: 33811.
    Country: USA

    Card Type: Visa
    Name On
    Card: 
    Beckham M. Zizo 
    Amount Charged:
    $9.34.00
    Card Number: 427**********739

    Expiry Date: 06/07
    CCV2:
    564

    Please verify that the
    following address (as entered by the buyer) is correct:- Country:
    USA

    If there is a mistake in your address, please contact the buyer
    to correct the error. This order has been Confirmed and approved and will
    be sent out for delivery as a Money Cash to your address
    on  Wednesday 22nd Febuary, 2006.You can now send the item(s) to the
    buyer.Moreover the above Order number and the valid shipment tracking
    number will be asked before delivering the Money to the above
    address.

    Purchase Protection and Refund Information:

    Currently, this buyer has $15,435.23 deposit with Boa managed
    purchase protection account. Transactions with this buyer are covered 90%
    in case of fraud and description errors. Your Money gets to your home
    address 48hrs after you have shipped the item to the buyer.
    For your
    safety:- This account has been blocked today,The buyer is unable to
    withdraw the money within this period.
     

    IMPORTANT: You are to send the package 48 hrs you
    received this confirmation message for fast delivering your money to the
    above address

    Thank you for using Boa payment. We
    look forward serving your online auction payments needs in the future.

     
    Sincerely,

    Bank Of America

    Bank of America Higher Standards Home

    © 2005
    Bank of America Corporation. All rights reserved

    Comments (5)

    Don’t mess with octopi

    Octopus Eats Shark - Google Video

    Don’t wanna be a shark in the tank with this.

    Comments

    Modify product.module to support taxonomy terms

    I wanted to use the default layout of the product module to display store items, but I also wanted it to support taxonomy terms, so that I could easily group my items.

    I basically modified the theme_product_view_collection() function to grab term arguments and then added some complexity to the sql. I’m not totally sure that I got the sql right, but it’s functional for me.

    This setup allows the calls for all products:

    http://yoursite.com/product

    and then by various terms:

    http://yoursite.com/product/term/1

    http://yoursite.com/product/term/1,2,3

    Here’s the modified function:

    <pre>
    function theme_product_view_collection() {

    // should these be variables?
    $columns = 3;
    $rows = 5;

    // find out which terms are being passed in
    $tids = array(arg(2));

    foreach ($tids as $index => $tid) {
    $term = taxonomy_get_term($tid);
    $tree = taxonomy_get_tree($term->vid, $tid, -1, $depth);
    $descendant_tids[] = array_merge(array($tid), array_map('_taxonomy_get_tid_from_term', $tree));
    }
    $str_tids = implode(',', call_user_func_array('array_merge', $descendant_tids));

    $query = 'SELECT DISTINCT(n.nid) FROM {node} n ';
    $query .= 'INNER JOIN {ec_product} p ON n.nid = p.nid ';

    // if tids are coming in, do this sql
    if ($str_tids) {
    $query .= 'INNER JOIN {term_node} tn ON n.nid = tn.nid ';
    $query .= 'WHERE tn.tid IN (' . $str_tids . ') AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC';
    }
    else {
    $query .= 'WHERE n.status = 1 ORDER BY n.sticky DESC, n.created DESC';
    }

    //fetch the products
    $result = pager_query(db_rewrite_sql($query), $rows * $columns, 0);

    $output = '<table width="100%" cellpadding="10">';
    for ($i = 0; $node = db_fetch_object($result); $i++) {

    if ($i % $columns == 0) {
    $output .= '<tr>';
    }

    $node = node_load(array('nid' => $node->nid));
    $teaser = true;
    $page = false;

    $node->body = str_replace('', ", $node->body);
    if (node_hook($node, 'view')) {
    node_invoke($node, 'view', $teaser, $page);
    }
    else {
    $node = node_prepare($node, $teaser);
    }
    node_invoke_nodeapi($node, 'view', $teaser, $page);

    $output .= '<td valign="top"><p>'. l($node->title, "node/$node->nid") ."</p><div>$node->teaser</div></td>\n";

    if ($i % $columns == $columns - 1) {
    $output .= "</tr>\n";
    }
    }

    if ($i % $columns != 0) {
    $output .= "</tr>\n";
    }
    $output .= '</table>';

    if ($pager = theme('pager', NULL, $rows * $columns, 0)) {
    $output .= $pager;
    }

    return $output;
    }

    What this probably needs is:

    1) sql clean up.
    2) output of term titles
    3) review of how i’m formating urls and letting me know if i’m doing this right

    Download patch here

    Comments

    Custom Filter

    I wanted to be able to give users the ability to create a custom filter of various taxonomy data on the fly. I know that there are modules out there that sort of do this, however, nothing quite met my needs.

    So this is two parts:

    1) a function that returns lists of the terms under a vocabulary (you can feed it more than one vocabulary) with check boxes that a user can check off for what terms they want to display (in an “and” capacity)

    2) a javascript function that checks the form that the above code produces and redirects the user to the page

    <pre>
    // this function returns a list navigation options
    function get_navigation($vocab_ids) {

    $html = "<form action=\"javascript:void(null);\" name=\"nav_filter\">\n";

    // first we want to loop through each of the terms being passed in
    foreach ($vocab_ids as $vocab_id) {

    $term_title = taxonomy_get_vocabularies('flexinode-1', $vocab_id);
    $html .= "<h1>" .$term_title[$vocab_id]->name . "</h1>\n";
    $html .= "<ul id=\"nav_$vocab_id\" style=\"display: block;\">\n";

    // now loop through each single term

    foreach(taxonomy_get_tree($vocab_id, $parent = 0, $depth = -1, $max_depth = NULL) as $term) {

    // make sure there are items in this
    $the_count = taxonomy_term_count_nodes($term->tid);

    if ($the_count > 0) {

    $html .= "<li>tid . "\">" . $term->name . " \n";
    $html .= "<input name=\"terms\" type=\"checkbox\" value=\"" . $term->tid . "\" />\n";

    $html .= "</li> \n";
    }
    }
    $html .= "</ul>\n";
    $html .= "<br />\n";

    } // end foreach

    $html .= "<input type=\"submit\" value=\"List!\" onclick=\"javascript: build_filter(document.nav_filter.terms)\"></form>\n";

    return $html;
    }
    </pre>

    so if we do something like:

    <pre>
    $terms = array(1,2);
    print get_navigation($terms);
    </pre>

    we’ll produce a nice list of terms with checkboxes next to them.

    Now we just need this javascript to tie it together.

    <pre>
    // this is used to build a filter
    function build_filter(field){

    var terms;
    var base;
    base = '/taxonomy/term/';

    for (i = 0; i < field.length; i++)
    if (field[i].checked == true) {
    //alert(field[i].value);
    if (terms == undefined) {terms = field[i].value;}
    else {terms += "+";
    terms += field[i].value;
    }
    }
    //alert(terms);
    if (terms != undefined) {
    window.location=base+terms;
    } else { alert ('Please select some options!'); }
    }
    </pre>

    When the form is submitted, the javascript is called, it walks through the form, picking up the ids of each of the terms, and then it build a url. If there are no terms selected, it alerts the user.

    Comments

    Adding Sort Order to taxonomy_select_nodes

    I’m doing some display of nodes and I want to sort them as I display them, doing something like this:

    $somenodes = taxonomy_select_nodes($terms, ‘or’, 2, FALSE, ‘n.title’);

    This lets me sort by title which is handy in listings sometimes. For example, in the hacked up menu system that I’ve been using everywhere, this lets me display nodes by title.

    In order to do this, 2 lines in taxonomy module need to be modified:

    Line 824 From:

    function taxonomy_select_nodes($tids = array(), $operator = ‘or’, $depth = 0, $pager = TRUE) {

    To:

    function taxonomy_select_nodes($tids = array(), $operator = ‘or’, $depth = 0, $pager = TRUE, $order = ‘n.sticky DESC, n.created DESC’) {

    (this leaves the default sort order intact)

    Secondly Line 839 From

    $sql = ‘SELECT DISTINCT(n.nid), n.sticky, n.title, n.created FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN (’. $str_tids .’) AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC’);

    To

    $sql = ‘SELECT DISTINCT(n.nid), n.sticky, n.title, n.created FROM {node} n INNER JOIN {term_node} tn ON n.nid = tn.nid WHERE tn.tid IN (’. $str_tids .’) AND n.status = 1 ORDER BY ‘ . $order;

    Download modified taxonomy.module here

    Comments

    « Previous entries