RSS Feed

‘Tech Tips’ Category

  1. Status Code 0 – a simple fix

    April 11, 2011 by John Minnihan

    While working on the launcher for some new enterprise build management stuff, I ran into a situation I hadn’t seen before. The core javascript that launched the process was working as expected in IE, but was failing + throwing a very scary looking Status Code 0 in Chrome.

    Setting aside for a moment the amusement I felt by IE ‘working’ while Chrome failed, I dug into root causes behind a Status Code 0. Clearly, this isn’t a standard response code from the browser. While I initially thought the issue was timing-related (webkit’s javascript parser is faster), using alerts + setTimeouts didn’t shed any real light on why I was seeing this in Chrome.

    I did figure it out & resolve it after about 10 minutes. The launcher has a form in which the user makes a couple selections to set the context for the work that is to be performed, and the form’s submission triggers a javascript function called getContext() that, if happy, would then fire off the actual worker asynchronously (ajax).

    That form’s button was firing the form immediately rather than waiting for the results of the check(s). Adding a return false; to the button’s setup fixed it. Here’s how:

    <button onclick="getContext();return false;">do stuff!</button>

    Why does this matter?

    The moment the form’s do stuff! button is clicked, the form is submitted.  This means that the form was submitted at the same time the function was called, generating a response to the browser – the Status Code 0 – before the function could process anything. By setting return false; on the function call, the form submission is cancelled in the browser but the function call continues to process the request.


  2. Development Process Nirvana

    October 6, 2010 by John Minnihan

    I’m often asked for advice on how to improve a company’s development process. Almost without exception, the advice I provide is the same:

    (more…)


  3. Tech Tip: Multi-line Perl regex pattern match

    June 18, 2009 by John Minnihan

    Yesterday, I encountered an analysis issue that appeared to be resolvable with a simple pattern replacement technique.
    (more…)


  4. Quick file & directory cleanup tools

    June 15, 2009 by John Minnihan

    Every sys admin needs to quickly free up disk space from time to time, and here are two well-tested scripts I use for exactly this purpose.

    (more…)


  5. Converting .DOC to .PDF. Is this difficult?

    January 26, 2008 by John Minnihan

    If you are using a Mac running a recent version of OSX, the answer is No.  In fact this is super easy and is available from inside Microsoft Word.   If you run Windows, this feature isn’t available without an additional plugin from a third-party.

     

    (more…)


  6. Gmail, Apple Mail & the iPhone

    November 17, 2007 by John Minnihan

    Since Gmail began supporting IMAP, setting up Gmail to work with both Apple Mail & the iPhone is a common need for those of us with both iPhones and new Macbooks.

    I began using Gmail about two weeks and had noticed the inconsistencies mentioned in the below article, and was both pleased to see that the solution was so simple as well as slightly embarrassed that I hadn’t yet resolved the issue myself.

    Here’s the HOWTO:

    http://5thirtyone.com/archives/862 

    Tags: , , ,


  7. AJAX Logfile Tailer & Viewer

    April 13, 2007 by John Minnihan

    Recently I had a need for a simple logfile viewer for use in some stuff we have planned at Freepository. But this log file viewer had a few requirements that made it unique: it had to get the log file contents from the server in small chunks, not tie up the browser (such as an old-style synchronous request would do), and refresh in the browser without reloading the page.

    I thought I could easily find one that someone had already written, but Google was not my friend. I found nothing even close, so I wrote my own. Here it is.

    Working example:  https://freepository.com/ajax-logtail-viewer/ajax-logtail-viewer.php

    Sorry -the working example has been disabled due to abuse. Too many people or bots were hitting it with hundreds of requests a minute.

    Open that page (↑) in a new window, follow the instructions and view the source.

    (more…)


  8. Tech Tip: Publishing iCal Calendar in Multiple Places

    March 13, 2007 by John Minnihan

    Recently I had a need to publish a calendar in more than one location. Simple, right? Just use Google calendar, Boxes, or one of the other free services. Not quite. I don’t want to manage any users, nor give anyone direct access to an account that is hosting the calendar. I want to publish, not provide direct access to, the calendar.

    (more…)


  9. A Powerful Custom Spamassassin Rule

    February 19, 2007 by John Minnihan

    Tech Tip – Spamassassin Custom Rule

    I had been inundated with so much spam lately that I added some custom rules to my spamassassin setup. These rules are added to your local.cf (don’t put them in /usr/share/spamassassion, as they’ll get overwritten with the next SA update). The single most useful one for me in this bunch is the LOCAL_RETURNED_MAIL rule.

    (more…)


  10. Tech Tip of the Day: Quick file deletion

    September 18, 2006 by John Minnihan

    Here’s another quick tip.  If you have a large directory tree (hundreds or thousands of nested levels), and you need to find and delete a set of files from the tree, consider this one-line approach:

    cd [target-dir-top-level];for i in `find . -name \*tar.gz`; do rm -f $i; done

    Replace my pattern ‘tar.gz’ with one that matches the files you wish to delete.

    Tags: , ,