Updates from October, 2008 Toggle Comment Threads | Keyboard Shortcuts

  • wade 18:47 on Sunday, 19 October 2008 Permalink | Log in to leave a Comment  

    job announcement form no longer requires account 

    I am pleased to announce that the job announcement form on the website no longer requires the user to be logged in. This is significant as most people posting job announcements are managers, human resources staff, or recruiters and therefor have no reason to have an account. If you are someone that only created an account to post a job, please send me a note so that we can remove your profile.

     
  • wade 21:02 on Sunday, 12 October 2008 Permalink | Log in to leave a Comment  

    Chainlove alerts 

    Any other cyclists out there? You a chainlove junkie too? After finding myself spending too much time refreshing and refreshing, I wrote the following script to watch the site for things I was interested in and send me a text message when they come up. I put it on my machine that’s always on and scheduled it to run every ten minutes with launchd. Hopefully it will save you a little time and sanity as well. (Note the wrapped lines.)

    /* 
     * CHAINLOVE ALERTS
     * 
     * This script scrapes chainlove.com and sends an email when words in 
     * the "watch list" are included in the current product offering.
     */
     
    // list of words to watch for
    $watch_list = array('sunglasses', 'warmers', 'jersey', 'giordana');
     
    // cache file (including path)
    $cache_file = '/tmp/chainlove_alerts.cache';
     
    // scrape page
    $ch = curl_init() or die(curl_error()); 
    curl_setopt($ch, CURLOPT_URL, "http://www.chainlove.com"); 
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
    $page = curl_exec($ch) or die(curl_error()); 
    curl_close($ch);
     
    // pull out the product details
    preg_match('/<h1 id="item_title">([^<]+)<\/h1>.*<h3 class="price"> ¬
       ([^<]+)<\/h3>.*<div id="regular_price">\n*\t*\s*([^<]+)<br \/> ¬
       \n\t*\s*([^<]+)<\/div>/sm', $page, $matches);
     
    // compare current product against cache product... if same, exit
    if(!file_exists($cache_file)) {
       file_put_contents($cache_file, trim($matches[1]));
    } else {
       $cache_product = file_get_contents($cache_file);
     
       if($cache_product == trim($matches[1])) {
          exit();
       } else {
          file_put_contents($cache_file, trim($matches[1]));
       }
    }
     
    // search current product title with "watch list"
    $send_mail = 0;
    foreach($watch_list as $watch_item) {
       if(stripos($matches[1], $watch_item)) {
          $send_mail++;
       }
    }
     
    // send email
    if($send_mail > 0) {
       $mail['to'] = '8015551212@txt.att.net';
       $mail['subject'] = trim($matches[1]);
       $mail['message'] = trim($matches[2]) . ' (' . trim($matches[3]) .
          ', ' . trim($matches[4]) . ')';
       $mail['from'] = 'Chainlove Alerts <user@example.com>';
       $mail['additional_headers'] = 'From: ' . $mail['from'];
       mail($mail['to'], $mail['subject'], $mail['message'], ¬
          $mail['additional_headers']);
    }
     
    • thebigdog 17:38 on Sunday, 19 October 2008 Permalink | Log in to Reply

      nice job wade. have you thought about storing the data in a sqlite db so you can do some data analysis on it? like how often they actually change the data.

    • wade 18:08 on Sunday, 19 October 2008 Permalink | Log in to Reply

      I hadn’t thought of storing the data anything longer than the cache file. Tossing it in a SQLite database is a cool idea though. It would be very interesting to learn more about their system. For example, they do not always run a product until it is sold out; they appear to run it only as long as it’s hot. As soon as units stop moving at a certain pace, they swap it out with something else. Although I don’t know how automated it is. These products will often appear again later. I wonder if you would be able to start predicting patterns with enough data.

  • mindjuju 12:29 on Thursday, 2 October 2008 Permalink | Log in to leave a Comment  

    UTOS / UPHPU Geek Lunch :: Happy Sumo @ The Gateway 

    Greets codepoets, bloggers, sysadmins, dbas and other citizenry of the net populous!

    The October UTOS / UPHPU Geek lunch will be held at The Happy Sumo at the Gateway on THURSDAY, October 9th, 1pm.

    Please RSVP.

    The Happy Sumo
    153 S Rio Grande St. Salt Lake City, UT
    tele 801.456.7866

    mj/v

     
c
compose new post
j
next post/next comment
k
previous post/previous comment
r
reply
e
edit
o
show/hide comments
t
go to top
l
go to login
h
show/hide help
shift + esc
cancel