Weekly Round-Up: 11/24/13 to 11/30/13

The Weekly Round-Up is a once weekly collection of my #1Aday daily shares. Hope you find something of interest!

Wed 11/27
More good reasons to skip Black Friday: The Dirty Secret of ‘Discounts’—Black Friday and Beyond – WSJ.com – http://mjg2.net/l/1882

DB2 Duplicate Key Debugging

If you’ve ever gotten a DB2 error like this…

SQL0803N  One or more values in the INSERT statement, UPDATE statement, 
or foreign key update caused by a DELETE statement are not valid because 
the primary key, unique constraint or unique index identified by "1" 
constrains table "XX.TABLE_NAME" from having duplicate values for 
the index key.  SQLSTATE=23505

You may be asking yourself, but exactly which unique index is causing the problem?

Use the info from the error along with this query to find out:

SELECT *
FROM   SYSCAT.INDEXES
WHERE  IID = 1
       AND TABSCHEMA = 'XX'
       AND TABNAME = 'TABLE_NAME';

Of course you will want to replace the WHERE clause conditions with your values.

Weekly Round-Up: 11/17/13 to 11/23/13

The Weekly Round-Up is a once weekly collection of my #1Aday daily shares. Hope you find something of interest!

Mon 11/18
12 Powerful Habits Of Happy Relationships – http://mjg2.net/l/1881

Weekly Round-Up: 11/10/13 to 11/16/13

The Weekly Round-Up is a once weekly collection of my #1Aday daily shares. Hope you find something of interest!

Tue 11/12
Consumerism In America: How Your Stuff Is Killing You And You Don’t Even Know It – http://markjacobsen.net/l/1877

Wed 11/13
10 Things Every Couple Needs To Stop Doing – http://markjacobsen.net/l/1878

Thu 11/14
Working Long Hours Is Like Working for Free – http://markjacobsen.net/l/1879

Fri 11/15
Marriage Isn’t For You – Great article by @SethAdamSmith – http://markjacobsen.net/l/1880

Mind lending a hand?

Thanks ahead of time to everyone who’s already taken a moment to help out, but if you haven’t had the chance yet I’d appreciate your assistance in giving me just a few clicks. Since one of the most important signals to search engines for “recommending” sites when you do a search is social media presence, I was hoping you might be willing to lend a hand by giving my company, Communication Freedom, a link little juice.

Just visit the various sites below and like, follow, or circle it from your account. Don’t worry, I won’t start sending you a bunch of spam 🙂

Facebook

Twitter

Google+ (be sure to “Follow” and “+1”)

LinkedIn

How to tell if a Perl Module is Installed

Want to check if a perl module is installed on your system? There’s a oneliner for that! Here’s an example…

perl -e "use Text::CSV"

… which would of course check if Text::CSV could be loaded. If it can, nothing will be printed. If not, you’ll get an error with some possibly useful information to figuring out why not.

Generate a GUID or UUID in DB2

Want to generate the equivalent of a GUID or UUID in DB2? The closest you’ll get is with GENERATE_UNIQUE(), but beware that you need to do some conversion on it as the value is “BIT DATA” and not character data. To put the value into a typical CHAR or VARCHAR field (like you would with a java UUID), use this…

select TRIM(CHAR(HEX(GENERATE_UNIQUE()))) from sysibm.sysdummy1;

I should probably also mention that there is the IDENTITY and SEQUENCE, but the GENERATE_UNIQUE() function is the closest you’ll get to a GUID or UUID.

Weekly Round-Up: 10/13/13 to 10/19/13

The Weekly Round-Up is a once weekly collection of my #1Aday daily shares. Hope you find something of interest!

Mon 10/14
Peter Shankman @PeterShankman says: Stop Tying Your Employee’s Hands – http://markjacobsen.net/l/1875

Change permissions on files of a specific type in linux

Need to change all *.ksh files to be executable under a directory, but not having luck with a recursive chmod? The issue is you need to combine chmod with a find and xargs like so…

find /home/user -name '*.ksh' | xargs chmod 744

The first piece lists all the files under the path that match *.ksh and passes them to xargs and chmod. If you want to see an example without changing any permissions, just substitute ls -l like so…

find /home/user -name '*.ksh' | xargs ls -l

Find the column causing a DB2 import to fail

Ever run DB2 IMPORT and get a super helpful error like…

SQL0407N  Assignment of a NULL value to a NOT NULL column "TBSPACEID=7,
TABLEID=265, COLNO=2" is not allowed.  SQLSTATE=23502

SQL3185W  The previous error occurred while processing data from row "126" of 
the input file.

After you calm down from wanting to smack a DB2 developer in the face, remember the syscat tables and run this SQL to find out the table and column giving you grief…

select  * 
from    syscat.columns c
            inner join syscat.tables t
                on  c.TABSCHEMA = t.TABSCHEMA
                    and c.TABNAME = t.TABNAME
where   c.COLNO = 2 
        and t.TABLEID = 265
        and t.TBSPACEID = 7