Sunday, November 26, 2017

Walmart Grocery $10 Coupon

We've been using Walmart Grocery lately and it's actually a pretty nice service.  I still recommend shopping a locally owned grocery store but this is useful for last minute shopping when you don't want to run in and pick things up.  Here is a coupon link for first time shoppers that you can use to get $10 off your order.

Monday, January 25, 2016

SOAP/WSDL on Perl, Ruby, PHP or Python (anything but .NET/Java)

SOAP was designed to provide cross platform RPC but the reality is that the only usable implementations of the spec are on .NET and Java.  Yes there are several available for other programming languages but they are incomplete or broken (they may or may not work).  Want to know what ALWAYS works?  Read on.

My recommendation is to avoid them completely and download SoapUI (which is written in Java).  This desktop software will allow you to create a new project using the WSDL (file or URL) and view and manually create requests against a service.  You can see the raw data exchange (HINT: There can be additional required HTTP headers you need to pass.  SOAPAction is one that is almost ALWAYS used) and then using whatever language you want create a web client that POSTs the XML (templated so you can change various parameters) and then parse the resulting XML response to get the data you want.  Every programming language has a decent XML parser so that shouldn't be a problem (although sometimes you have "massage" the resulting XML).

Here is a simple example of a client in PHP:

        $soap_url = "";
        $soap_act = '"/SomeCall"'; // Use SoapUI raw view of request to find this
        $soap_xml = <<<ENDOFFILE
        <soapenv .......... </soapenv ...............

        $resp = \Httpful\Request::post($soap_url)
            ->addHeader('SOAPAction', $soap_act)

        // There are ways to make the PHP XML parser handle namespaces but usually
        // we don't need them so make them simple XML elements instead
        // (eg. s_Envelope)

        $xml_str = str_replace('<?xml version="1.0" encoding="UTF-8"?>', '',
        $xml_str = preg_replace("/(<\/?)(\w+):([^>]*>)/", "$1$2_$3", $xml_str);
        $xml_str = preg_replace("/ \w+(:\w+)?=\"[^\"]*\"/", "", $xml_str);

        $xml = new \SimpleXMLElement($xml_str);
        $body = $xml->xpath('//s_Envelope'); // Can use this to narrow it down

        $array = json_decode(json_encode((array)$body), TRUE);

        // Now you can access the data using $array['key_name'][1] etc.. etc..


Good luck and hopefully this will save you some time! :)

Monday, August 3, 2015

How to run a cronjob on the last day of the month

You may have to escape the % sign for direct crontab entry depending on your cron software.  The example runs on the first minute of the last day of the month and starts trying for last day on the 28th (to deal with Feb).

0 0 28,29,30,31 * * [ $(date +\%d -d tomorrow) = “01” ] && command_you_want_to_run

Friday, August 22, 2014

mysqldump warning skipping mysql.event table data

If you don't want to give your "backup" user Super permissions and you don't use events you'll be stuck with an annoying warning:

-- Warning: Skipping the data of table mysql.event. Specify the --events option explicitly.

Every time you run a scheduled backup of your mysql database.  You still want those cronjob emails with any database backup errors but you don't want that one.  This might help you:

mysqldump --routines -u$USER -p$PASS -h$HOST -r$DIR/$FILE $DB 2>&1 | grep -v 'Skipping the data of table mysql.event' 1>&2

What it does is redirects all errors from mysqldump to STDIN.  It then greps out the event error and redirects any other errors back to STDERR.

The key is that you MUST use the -r option  (write to a file directly to a file rather than STDOUT) with mysqldump.  If you have other warnings you don't want to see you can use:

... | grep -vE '(warning 1 substring|warning 2 substring)' 1>&2

Another option might be to use Cronic.  Good luck!

Wednesday, February 27, 2013

Windows device manager / colorspace correction refreshing

If you are experiencing constant refreshing of your device manager or color correction screens in Windows 7 or 8 you will eventually do a search and find lots of information about loose device connections, bad drivers or other types of issues. After several days of uninstalling drivers and disconnecting various devices in my system I stumbled upon the root of the problem. Windows identifies some remote network services (multimedia servers) as "devices." These devices do not show up in the device manager. My issue was that windows automatically discovers these "multimedia streaming services" on your network (other PCs) and when they enter and leave the network (who knows why) they are dropped and added to your devices repeatedly. They might show up under "Plug and Play" devices on Windows 7 but on Windows 8 they show up on a "Devices" screen. If you remove them (right click, "Remove Device") the problem goes away. This might not solve your problem but I wanted to put this here for the search engines. Good luck.

Wednesday, October 10, 2012

Logging STDOUT, STDERR and outputting STDERR

You may find yourself with the need to log both STDOUT and STDERR but also display STDERR. A perfect example is when running cronjobs on Linux. As we all know getting too many notifications will result in the important notifications being lost in the noise. The solution is generally only to show errors. The problem is that those errors might lose context without various debug information. This is where I/O redirection becomes handy. Because we only want to receive emails (cron automatically sends all STD output as an email to the job owner) for errors we can use the following:

<command> 2>&1 >>blah.log | tee -a blah.log

What this does is runs <command> and copies STDERR (file descriptor 2) to STDOUT (file descriptor  1, 2>&1) and then redirects (>>) STDOUT (file descriptor 1) to blah.log.  Because of the order STDERR is not being appended to the blah.log.   That happens in the pipe to the tee command.  The tee command takes input from STDIN, adds it to a file and then echos that output to STDOUT.  The net result is that we now have STDERR from <command> being emailed to us should we use that series of commands in a cronjob.

Friday, April 13, 2012

BlueHarbor Auto Refinance Ripoff

Do not waste your time trying to refinance through BlueHarbor Auto.  You'll give them all your information and they will secure you a good rate and then tell you about all the "fees" involved in completing the loan.  $199 financing fee.  Ok, everyone charges those.  $87.50 re-titling fee.  HUH?  Oh and btw, you have to sign up for our extended service contract on the vehicle.  At this point I told them I was no longer interested in their services.  I found this company on  I really do not think that Bankrate knows that this company is trying to rip people off to save a few points on a loan.  I'm going to be contacting them.  If they don't do anything about it I'd say it's safe to assume that Bankrate has gone down the tubes.


I guess one good thing came out of this situation.  I discovered Pentagon Federal Credit Union.  They had better rates than the above mentioned and their customer service is incredibly helpful and courteous.  Also, the entire application for membership ($5) and the loan (free) are handled online.  After a couple days my loan (refinance) was approved and I had the pay-off check for the current lender.