CartMetrix - Do you know yours?

6/12/2007

MySQL Saved Queries

phpMyAdmin’s SQL popup has an interesting bookmarking feature called SQL History.

PMA SQL History

I have plenty of saved queries to produce different reports on many of the client databases that I administer. I was looking for a way to supply a variable to search on in some of the queries. A little trial and error with the SQL bookmarks and the answer was right there.

If you need to use a query like this:

SELECT sum( products_weight ) AS total_weight FROM products WHERE products_id IN ( SELECT products_id FROM orders_products WHERE orders_id = ‘10204′ )

But you need to lookup specific orders and need to pass an orders_id to the bookmarked query… create a bookmark like this

SELECT sum( products_weight ) AS total_weight FROM products WHERE products_id IN ( SELECT products_id FROM orders_products WHERE orders_id = ‘/*[VARIABLE]*/’ )

phpMyAdmin will replace the placeholder

/*[VARIABLE]*/

with the variable entered in to the field at right.

Bookmarks seem to be unique to the database that is selected. I found this out the hard way when I was editing a different database and tried to access bookmarks from another DB on the same server.

Popularity: 8%

6/6/2007

Network Printing from a Mac to XP

I purchased a ‘free’ (with rebates) HP printer with my last MacBook last month. I had originally intended to list it on Ebay with a ton of other tech junk I need out of my house. This hadn’t happened and my MacBook still didn’t have a printer available to it (can’t find OS X drivers for my old Epson Actionlaser workhorse), so I thought I’d hook it up.

Network printing seemed to be the best option since the MacBook may be wireless anywhere in my house. The only permanently connected (and non-laptop) box I have is an aging XP machine. Setting up a printer on it and allowing network access to my workgroup should be a snap, or so I thought. Boy, was I wrong.

Long story, short… I was able to install the printer locally only. I was able to work around OS X’s undocumented feature to access the advanced printing properties with the help of a few pages from Google. Namely from Erik J. Heels’ blog. Using his howto, I got the printer connection up, but all of my prints were garbage on account of no available driver for my specific printer being available. The HP setup disk did install a driver that I could use locally but the new driver is not showing up under available drivers when setting up the printer via Samba.

It is interesting that in this instance Windows is more user-friendly than good ‘ol Apple. Why doesn’t the new printer driver get added to the overall driver list as in all Windows versions since 95? Why are the advanced printer settings hidden and undocumented in OS X?

Anyone know where the printer drivers are actually installed so I could manually select the file?

Popularity: 28%

5/7/2007

ValidRcptTo.cdb Patch for Qmailrocks

Received a call from a client this morning about not receiving any email for the last few days. Viewing the queue on their server showed 50,000 messages in the local queue. Tailing the logs, showed dozens of messages being received every minute to non-existent addresses to valid domains on the server. Qmail was accepting the messages only to eventually bounce them after failing to deliver locally to the fake local address. If only Qmail could check for valid email addresses in the initial SMTP connection and reject mail for addresses that do not exist.

ValidRcptTo.cdb is a patch for Qmail that does just this. There are several implementations of this functionality, but John Simpson’s version handles aliases, vpopmail and system accounts, Qmail’s .qmail-default aliases and utilizes a cdb database for speed.

Patching my existing QMR install proved to be troublesome. qmail-smtpd.c and the Makefile blew rejects. I manually worked these rejected code chunks into the QMR Qmail source and produced a new patch file to use on the other installs I manage.

For full details on using ValidRcptTo see John’s page.

Original ValidRcptTo.cdb Patch

QMR 2.2.1 ValidRcptTo.db Patch

John also maintains a bundle of other worthwhile Qmail patches at his site.

Popularity: 18%

3/28/2007

Todo.txt - A Command Line Task Tracker

I found Todo.txt by Gina Trapani, randomly last weekend and have been playing with it all week. Todo.txt is a todo list written in shell script. It should run fine under any system that supports a Unix like shell… Linux, OS X, Cygwin etc.

At any given time I have a half dozen post-it pads going with todo lists, usually the things that have to get done TODAY! Todo.txt is so simple to use I’ve misplaced most of my post-it pads (still need paper for the grocery list). :-)

Some examples:

todo.sh add This is my first task
todo.sh add Another task
todo.sh list
02 Another task
01 This is my first task

TODO: 2 tasks in /Users/damonp/etc/todo.txt.

Set task number one to the highest priority, A.

todo.sh pri 1 A
todo.sh list
01 (A) This is my first task
02 Another task

TODO: 2 tasks in /Users/damonp/etc/todo.txt.

I haven’t gotten much further than adding, prioritizing and marking off items, but the builtin help shows options for archiving, reporting, appending, prepending and deleting items.

Popularity: 16%

3/25/2007

Advanced OSX Mail Searches

When you live and breathe email for work and play, it can be quite important to keep messages around for reference. In my business, client and project specific correspondence is supremely important as a record of what has been done, what needs done and project cost quotes among other things. The important information usually gets copied into my bug tracker, project information database and billing applications, but there is just something about the chronological nature of email that helps me follow a project.

What’s the point of keeping email around if you can’t accurately find the messages you are looking for? Apple’s Mail application can be used to do some heavy lifting searches if you can think outside of the box a little. Below are some examples of the general boolean search available directly in Mail.

Heads AND Tails

heads & tails

Heads OR Tails

heads | tails

Heads but NOT Tails

heads ! tails

Heads AND either Tails OR Both

heads & (tails | both)

While researching these search options I found some users that reported that and, or and not worked as well. This is not listed in the Mail documentation and I was not able to confirm their usage. These did not work on my machine. For reference, I am running 10.4.9 and Mail 2.1 (752/752.2).

From the Mail help system:

If you search the From, To, or Subject fields in selected mailboxes, Mail finds messages that contain the entire search phrase, in the order you entered the words. If you search an entire message or search in all mailboxes, Mail finds only messages containing words that have the same prefix (or the same beginning letters) as any of the words you entered in the Search field. The words can be in any order. For example, if you enter “box” in the Search field, the results would include “boxcar” but would not include “mailbox,” because “box” is not part of the prefix in that word.

The help document also mentions that any IMAP accounts need to be configured to “Keep copies of messages for offline viewing”. This setting is configured from the Advanced tab of the Accounts pane in Mail Preferences. The default is to cache “All messages and their attachments.” I use “All messages but omit their attachments.” I would like to use “Only messages I’ve read,” as that would omit all of the uncaught spam and messages that get deleted without being read, but from my tests that option still caches the attachments. I think caching attachments is a waste of bandwidth and local disk space, plus it doesn’t fit in with my normal usage. When I get an important attachment, I download it to a local folder, either a client folder to keep with the rest of the client data or to my general downloads folder where it can be dealt with and deleted when no longer needed.

I have been using a beta version of MailTags for a month now and am finding it more and more invaluable in tracking project and client emails. It adds customizable fields to messages so may easily tag a message with a project name or add notes to a message and adds to the built-in Mail search so you can search by these tags specifically. It also integrates nicely with OSX’s Calendar application, allowing you to create To Do items directly from the MailTags pane in a message.

Another searching option is to create a Smart Mailbox with your search parameters. Smart Mailboxes can be used to mix and match multiple search parameters in the same search. Don’t be shy about creating a Smart Mailbox to do a one-off search. Wouldn’t it be faster to create a Smart Mailbox, use it to find your messages and delete it afterwards than to manually search for a message for twenty minutes? You can also create a Smart Mailbox to pre-select a group of messages, say by including all messages from all of the parties involved in a particular project and then using Mail’s basic search over that Smart Mailbox to find only those messages that contain a particular keyword.

There are some shortcomings I find in Mail’s search and Smart Mailbox implementations. My biggest beef is that Mail won’t let you Cmd-select multiple locations to do a keyword search over. For instance, you cannot search for an email address that appears in the From or To fields. You can do separate searches for both and manually merge them in your head or setup a Smart Mailbox to do the task.

The Smart Mailbox implementation is also crippled in that you can only select messages by all the criterion you supply or by any single criteria not some of these but none of those. This can be overcome by using multiple Smart Mailboxes, one to select all of the messages you want and a second mailbox to deselect the ones you don’t need that happen to fall in to the first mailbox.

Say you would like all messages from a particular domain except the general address info@domain.com. First create the deselect mailbox that finds all messages from info@domain.com, then create a second Smart Mailbox that selects all messages from domain.com and add a second criteria to it that says “Mail is not in mailbox” and choose the deselect Smart Mailbox you created. This is a simplistic example that can be overcome by creating a box that manually selects all messages from user1@domain.com … userN@domain.com, but that would require you to know all of the addresses and key them in.

All in all Mail’s searching implementation is powerful if you know the right tricks. Have some more Mail search tricks? Post via the comments below.

Popularity: 31%

3/9/2007

Google Code Search

Bad code haunts you forever… Google Code Search

Popularity: 9%

« Previous Page Next Page »


damonparker.org is proudly powered by WordPress
Entries (RSS) and Comments (RSS).

copyright © 2002-2008 damonparker.org. all rights reserved.

Close
E-mail It